\n )\n}\n\nexport default CommercetoolsProjectForm\n","import React from \"react\"\nimport { FormattedMessage } from \"gatsby-plugin-intl\"\nimport { Button } from \"react-bootstrap\"\n\nconst Shopify = ({ name }) => {\n\n const storeNameModalAction = () => {\n return (\n \n )\n }\n\n return (\n
\n
\n \n
\n
\n {[\n {\n header: (\n {msg}, name }}\n />\n ),\n description: (\n Connect button below.\n You will be redirected to Shopify to install the Locale app on your store.\n After accepting the permissions, you are brought back to Locale to continue setup.\n `}\n values={{ b: msg => {msg}, name }}\n />\n ),\n },\n {\n header: (\n {msg}, name }}\n />\n ),\n description: (\n {msg} }}\n />\n ),\n },\n {\n header: (\n {msg} }}\n />\n ),\n description: (\n {msg}, name }}\n />\n ),\n },\n ].map(({ header, description }, index) => (\n
\n
\n
\n {index + 1}\n
\n
{header}
\n
\n
{description}
\n
\n ))}\n
\n {storeNameModalAction()}\n
\n )\n}\n\nexport default Shopify\n","import React from \"react\"\nimport { FormattedMessage } from \"gatsby-plugin-intl\"\nimport { WIZARD_ROOT } from \"../../containers/projects/NewProject\"\nimport { WIZARD_ROUTES } from \"../../store/models/projectWizard\"\nimport { stateGenerator } from \"../../helpers/application\"\n\nconst Google = ({ connector, name, redirectURI, scopes }) => {\n const connectorRoute = `${WIZARD_ROOT}${WIZARD_ROUTES.CONNECTOR.path(connector)}`\n const state = stateGenerator({\n redirectURL: connectorRoute\n });\n const oauthRedirectionLink = `${process.env.GOOGLE_OAUTH_URL}?state=${state}&client_id=${process.env.GOOGLE_CLIENT_ID}&scope=${encodeURIComponent(scopes)}&redirect_uri=${encodeURIComponent(redirectURI)}&response_type=code&prompt=consent&access_type=offline`;\n return (\n
\n
\n \n
\n Connect With Google button below.\n You will be redirected to Google to authorize Locale on your Account.\n After accepting the permissions, you are brought back to Locale to continue setup.`}\n values={{ b: msg => {msg} }}\n />\n
\n )\n}\n\nexport default Google\n","import React from \"react\"\nimport { FormattedMessage } from \"gatsby-plugin-intl\"\nimport { WIZARD_ROOT } from \"../../containers/projects/NewProject\"\nimport { WIZARD_ROUTES } from \"../../store/models/projectWizard\"\nimport { stateGenerator } from \"../../helpers/application\"\n\nconst Lokalise = ({ connector, name, redirectURI, scopes }) => {\n const connectorRoute = `${WIZARD_ROOT}${WIZARD_ROUTES.CONNECTOR.path(connector)}`\n const state = stateGenerator({\n redirectURL: connectorRoute\n });\n\n const redirectTo = `${process.env.LOKALISE_OAUTH_URL}?state=${state}&redirect_uri=${redirectURI}&client_id=${process.env.LOKALISE_CLIENT_ID}&scope=${encodeURIComponent(scopes)}`;\n\n return (\n
\n
\n \n
\n Connect With {name} button below.\n You will be redirected to {name} to authorize Locale on your Account.\n After accepting the permissions, you are brought back to Locale to continue setup.`}\n values={{ b: msg => {msg}, name }}\n />\n
\n*/\n\nvar RestClient =\n/** @class */\nfunction () {\n /**\n * @param {RestClientOptions} [options] - Instance options\n */\n function RestClient(options) {\n this._region = 'us-east-1'; // this will be updated by endpoint function\n\n this._service = 'execute-api'; // this can be updated by endpoint function\n\n this._custom_header = undefined; // this can be updated by endpoint function\n\n /**\n * This weak map provides functionality to let clients cancel\n * in-flight axios requests. https://github.com/axios/axios#cancellation\n *\n * 1. For every axios request, a unique cancel token is generated and added in the request.\n * 2. Promise for fulfilling the request is then mapped to that unique cancel token.\n * 3. The promise is returned to the client.\n * 4. Clients can either wait for the promise to fulfill or call `API.cancel(promise)` to cancel the request.\n * 5. If `API.cancel(promise)` is called, then the corresponding cancel token is retrieved from the map below.\n * 6. Promise returned to the client will be in rejected state with the error provided during cancel.\n * 7. Clients can check if the error is because of cancelling by calling `API.isCancel(error)`.\n *\n * For more details, see https://github.com/aws-amplify/amplify-js/pull/3769#issuecomment-552660025\n */\n\n this._cancelTokenMap = null;\n this._options = options;\n logger.debug('API Options', this._options);\n\n if (this._cancelTokenMap == null) {\n this._cancelTokenMap = new WeakMap();\n }\n }\n /**\n * Update AWS credentials\n * @param {AWSCredentials} credentials - AWS credentials\n *\n updateCredentials(credentials: AWSCredentials) {\n this.options.credentials = credentials;\n }\n */\n\n /**\n * Basic HTTP request. Customizable\n * @param {string} url - Full request URL\n * @param {string} method - Request HTTP method\n * @param {json} [init] - Request extra params\n * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.\n */\n\n\n RestClient.prototype.ajax = function (url, method, init) {\n return __awaiter(this, void 0, void 0, function () {\n var parsed_url, params, libraryHeaders, userAgent, initParams, isAllResponse, custom_header, _a, _b, search, parsedUrl;\n\n var _this = this;\n\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n logger.debug(method + ' ' + url);\n parsed_url = this._parseUrl(url);\n params = {\n method: method,\n url: url,\n host: parsed_url.host,\n path: parsed_url.path,\n headers: {},\n data: null,\n responseType: 'json',\n timeout: 0,\n cancelToken: null\n };\n libraryHeaders = {};\n\n if (Platform.isReactNative) {\n userAgent = Platform.userAgent || 'aws-amplify/0.1.x';\n libraryHeaders = {\n 'User-Agent': userAgent\n };\n }\n\n initParams = Object.assign({}, init);\n isAllResponse = initParams.response;\n\n if (initParams.body) {\n libraryHeaders['Content-Type'] = 'application/json; charset=UTF-8';\n params.data = JSON.stringify(initParams.body);\n }\n\n if (initParams.responseType) {\n params.responseType = initParams.responseType;\n }\n\n if (initParams.withCredentials) {\n params['withCredentials'] = initParams.withCredentials;\n }\n\n if (initParams.timeout) {\n params.timeout = initParams.timeout;\n }\n\n if (initParams.cancellableToken) {\n params.cancelToken = initParams.cancellableToken.token;\n }\n\n params['signerServiceInfo'] = initParams.signerServiceInfo;\n if (!this._custom_header) return [3\n /*break*/\n , 2];\n return [4\n /*yield*/\n , this._custom_header()];\n\n case 1:\n _a = _c.sent();\n return [3\n /*break*/\n , 3];\n\n case 2:\n _a = undefined;\n _c.label = 3;\n\n case 3:\n custom_header = _a;\n params.headers = __assign(__assign(__assign({}, libraryHeaders), custom_header), initParams.headers);\n _b = parse(url, true, true), search = _b.search, parsedUrl = __rest(_b, [\"search\"]);\n params.url = format(__assign(__assign({}, parsedUrl), {\n query: __assign(__assign({}, parsedUrl.query), initParams.queryStringParameters || {})\n })); // Do not sign the request if client has added 'Authorization' header,\n // which means custom authorizer.\n\n if (typeof params.headers['Authorization'] !== 'undefined') {\n params.headers = Object.keys(params.headers).reduce(function (acc, k) {\n if (params.headers[k]) {\n acc[k] = params.headers[k];\n }\n\n return acc; // tslint:disable-next-line:align\n }, {});\n return [2\n /*return*/\n , this._request(params, isAllResponse)];\n } // Signing the request in case there credentials are available\n\n\n return [2\n /*return*/\n , Credentials.get().then(function (credentials) {\n return _this._signed(__assign({}, params), credentials, isAllResponse).catch(function (error) {\n if (DateUtils.isClockSkewError(error)) {\n var headers = error.response.headers;\n var dateHeader = headers && (headers.date || headers.Date);\n var responseDate = new Date(dateHeader);\n var requestDate = DateUtils.getDateFromHeaderString(params.headers['x-amz-date']);\n\n if (DateUtils.isClockSkewed(requestDate, responseDate)) {\n DateUtils.setClockOffset(responseDate.getTime() - requestDate.getTime());\n return _this.ajax(url, method, init);\n }\n }\n\n throw error;\n });\n }, function (err) {\n logger.debug('No credentials available, the request will be unsigned');\n return _this._request(params, isAllResponse);\n })];\n }\n });\n });\n };\n /**\n * GET HTTP request\n * @param {string} url - Full request URL\n * @param {JSON} init - Request extra params\n * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.\n */\n\n\n RestClient.prototype.get = function (url, init) {\n return this.ajax(url, 'GET', init);\n };\n /**\n * PUT HTTP request\n * @param {string} url - Full request URL\n * @param {json} init - Request extra params\n * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.\n */\n\n\n RestClient.prototype.put = function (url, init) {\n return this.ajax(url, 'PUT', init);\n };\n /**\n * PATCH HTTP request\n * @param {string} url - Full request URL\n * @param {json} init - Request extra params\n * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.\n */\n\n\n RestClient.prototype.patch = function (url, init) {\n return this.ajax(url, 'PATCH', init);\n };\n /**\n * POST HTTP request\n * @param {string} url - Full request URL\n * @param {json} init - Request extra params\n * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.\n */\n\n\n RestClient.prototype.post = function (url, init) {\n return this.ajax(url, 'POST', init);\n };\n /**\n * DELETE HTTP request\n * @param {string} url - Full request URL\n * @param {json} init - Request extra params\n * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.\n */\n\n\n RestClient.prototype.del = function (url, init) {\n return this.ajax(url, 'DELETE', init);\n };\n /**\n * HEAD HTTP request\n * @param {string} url - Full request URL\n * @param {json} init - Request extra params\n * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.\n */\n\n\n RestClient.prototype.head = function (url, init) {\n return this.ajax(url, 'HEAD', init);\n };\n /**\n * Cancel an inflight API request\n * @param {Promise} request - The request promise to cancel\n * @param {string} [message] - A message to include in the cancelation exception\n */\n\n\n RestClient.prototype.cancel = function (request, message) {\n var source = this._cancelTokenMap.get(request);\n\n if (source) {\n source.cancel(message);\n }\n\n return true;\n };\n /**\n * Checks to see if an error thrown is from an api request cancellation\n * @param {any} error - Any error\n * @return {boolean} - A boolean indicating if the error was from an api request cancellation\n */\n\n\n RestClient.prototype.isCancel = function (error) {\n return axios.isCancel(error);\n };\n /**\n * Retrieves a new and unique cancel token which can be\n * provided in an axios request to be cancelled later.\n */\n\n\n RestClient.prototype.getCancellableToken = function () {\n return axios.CancelToken.source();\n };\n /**\n * Updates the weakmap with a response promise and its\n * cancel token such that the cancel token can be easily\n * retrieved (and used for cancelling the request)\n */\n\n\n RestClient.prototype.updateRequestToBeCancellable = function (promise, cancelTokenSource) {\n this._cancelTokenMap.set(promise, cancelTokenSource);\n };\n /**\n * Getting endpoint for API\n * @param {string} apiName - The name of the api\n * @return {string} - The endpoint of the api\n */\n\n\n RestClient.prototype.endpoint = function (apiName) {\n var _this = this;\n\n var cloud_logic_array = this._options.endpoints;\n var response = '';\n\n if (!Array.isArray(cloud_logic_array)) {\n return response;\n }\n\n cloud_logic_array.forEach(function (v) {\n if (v.name === apiName) {\n response = v.endpoint;\n\n if (typeof v.region === 'string') {\n _this._region = v.region;\n } else if (typeof _this._options.region === 'string') {\n _this._region = _this._options.region;\n }\n\n if (typeof v.service === 'string') {\n _this._service = v.service || 'execute-api';\n } else {\n _this._service = 'execute-api';\n }\n\n if (typeof v.custom_header === 'function') {\n _this._custom_header = v.custom_header;\n } else {\n _this._custom_header = undefined;\n }\n }\n });\n return response;\n };\n /** private methods **/\n\n\n RestClient.prototype._signed = function (params, credentials, isAllResponse) {\n var signerServiceInfoParams = params.signerServiceInfo,\n otherParams = __rest(params, [\"signerServiceInfo\"]);\n\n var endpoint_region = this._region || this._options.region;\n var endpoint_service = this._service || this._options.service;\n var creds = {\n secret_key: credentials.secretAccessKey,\n access_key: credentials.accessKeyId,\n session_token: credentials.sessionToken\n };\n var endpointInfo = {\n region: endpoint_region,\n service: endpoint_service\n };\n var signerServiceInfo = Object.assign(endpointInfo, signerServiceInfoParams);\n var signed_params = Signer.sign(otherParams, creds, signerServiceInfo);\n\n if (signed_params.data) {\n signed_params.body = signed_params.data;\n }\n\n logger.debug('Signed Request: ', signed_params);\n delete signed_params.headers['host'];\n return axios(signed_params).then(function (response) {\n return isAllResponse ? response : response.data;\n }).catch(function (error) {\n logger.debug(error);\n throw error;\n });\n };\n\n RestClient.prototype._request = function (params, isAllResponse) {\n if (isAllResponse === void 0) {\n isAllResponse = false;\n }\n\n return axios(params).then(function (response) {\n return isAllResponse ? response : response.data;\n }).catch(function (error) {\n logger.debug(error);\n throw error;\n });\n };\n\n RestClient.prototype._parseUrl = function (url) {\n var parts = url.split('/');\n return {\n host: parts[2],\n path: '/' + parts.slice(3).join('/')\n };\n };\n\n return RestClient;\n}();\n\nexport { RestClient };","'use strict';\nvar isArray = require('../internals/is-array');\nvar toLength = require('../internals/to-length');\nvar bind = require('../internals/function-bind-context');\n\n// `FlattenIntoArray` abstract operation\n// https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray\nvar flattenIntoArray = function (target, original, source, sourceLen, start, depth, mapper, thisArg) {\n var targetIndex = start;\n var sourceIndex = 0;\n var mapFn = mapper ? bind(mapper, thisArg, 3) : false;\n var element;\n\n while (sourceIndex < sourceLen) {\n if (sourceIndex in source) {\n element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];\n\n if (depth > 0 && isArray(element)) {\n targetIndex = flattenIntoArray(target, original, element, toLength(element.length), targetIndex, depth - 1) - 1;\n } else {\n if (targetIndex >= 0x1FFFFFFFFFFFFF) throw TypeError('Exceed the acceptable array length');\n target[targetIndex] = element;\n }\n\n targetIndex++;\n }\n sourceIndex++;\n }\n return targetIndex;\n};\n\nmodule.exports = flattenIntoArray;\n","module.exports = require('./lib/Observable.js').Observable;","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport classNames from 'classnames';\nimport React from 'react';\nimport isRequiredForA11y from 'prop-types-extra/lib/isRequiredForA11y';\nimport { useBootstrapPrefix } from './ThemeProvider';\nvar defaultProps = {\n placement: 'right'\n};\nvar Tooltip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {\n var bsPrefix = _ref.bsPrefix,\n placement = _ref.placement,\n className = _ref.className,\n style = _ref.style,\n children = _ref.children,\n arrowProps = _ref.arrowProps,\n _ = _ref.popper,\n _2 = _ref.show,\n props = _objectWithoutPropertiesLoose(_ref, [\"bsPrefix\", \"placement\", \"className\", \"style\", \"children\", \"arrowProps\", \"popper\", \"show\"]);\n\n bsPrefix = useBootstrapPrefix(bsPrefix, 'tooltip');\n\n var _ref2 = (placement == null ? void 0 : placement.split('-')) || [],\n primaryPlacement = _ref2[0];\n\n return /*#__PURE__*/React.createElement(\"div\", _extends({\n ref: ref,\n style: style,\n role: \"tooltip\",\n \"x-placement\": primaryPlacement,\n className: classNames(className, bsPrefix, \"bs-tooltip-\" + primaryPlacement)\n }, props), /*#__PURE__*/React.createElement(\"div\", _extends({\n className: \"arrow\"\n }, arrowProps)), /*#__PURE__*/React.createElement(\"div\", {\n className: bsPrefix + \"-inner\"\n }, children));\n});\nTooltip.defaultProps = defaultProps;\nTooltip.displayName = 'Tooltip';\nexport default Tooltip;","var generatePrime = require('./lib/generatePrime');\n\nvar primes = require('./lib/primes.json');\n\nvar DH = require('./lib/dh');\n\nfunction getDiffieHellman(mod) {\n var prime = new Buffer(primes[mod].prime, 'hex');\n var gen = new Buffer(primes[mod].gen, 'hex');\n return new DH(prime, gen);\n}\n\nvar ENCODINGS = {\n 'binary': true,\n 'hex': true,\n 'base64': true\n};\n\nfunction createDiffieHellman(prime, enc, generator, genc) {\n if (Buffer.isBuffer(enc) || ENCODINGS[enc] === undefined) {\n return createDiffieHellman(prime, 'binary', enc, generator);\n }\n\n enc = enc || 'binary';\n genc = genc || 'binary';\n generator = generator || new Buffer([2]);\n\n if (!Buffer.isBuffer(generator)) {\n generator = new Buffer(generator, genc);\n }\n\n if (typeof prime === 'number') {\n return new DH(generatePrime(prime, generator), generator, true);\n }\n\n if (!Buffer.isBuffer(prime)) {\n prime = new Buffer(prime, enc);\n }\n\n return new DH(prime, generator, true);\n}\n\nexports.DiffieHellmanGroup = exports.createDiffieHellmanGroup = exports.getDiffieHellman = getDiffieHellman;\nexports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman;","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nimport { Auth } from './Auth';\nimport { CognitoHostedUIIdentityProvider } from './types/Auth';\nimport { CognitoUser, CookieStorage, appendToCognitoUserAgent } from 'amazon-cognito-identity-js';\nimport { AuthErrorStrings } from './common/AuthErrorStrings';\n/**\n * @deprecated use named import\n */\n\nexport default Auth;\nexport { Auth, CognitoUser, CookieStorage, CognitoHostedUIIdentityProvider, appendToCognitoUserAgent, AuthErrorStrings };","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar react_1 = require(\"react\");\n/**\n * @ignore\n */\n\n\nvar context = react_1.createContext({\n flags: {},\n ldClient: undefined\n});\nvar\n/**\n * @ignore\n */\nProvider = context.Provider,\n\n/**\n * @ignore\n */\nConsumer = context.Consumer;\nexports.Provider = Provider;\nexports.Consumer = Consumer;\nexports.default = context;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.Sha256 = void 0;\n\nvar tslib_1 = require(\"tslib\");\n\nvar constants_1 = require(\"./constants\");\n\nvar RawSha256_1 = require(\"./RawSha256\");\n\nvar util_1 = require(\"@aws-crypto/util\");\n\nvar Sha256 =\n/** @class */\nfunction () {\n function Sha256(secret) {\n this.hash = new RawSha256_1.RawSha256();\n\n if (secret) {\n this.outer = new RawSha256_1.RawSha256();\n var inner = bufferFromSecret(secret);\n var outer = new Uint8Array(constants_1.BLOCK_SIZE);\n outer.set(inner);\n\n for (var i = 0; i < constants_1.BLOCK_SIZE; i++) {\n inner[i] ^= 0x36;\n outer[i] ^= 0x5c;\n }\n\n this.hash.update(inner);\n this.outer.update(outer); // overwrite the copied key in memory\n\n for (var i = 0; i < inner.byteLength; i++) {\n inner[i] = 0;\n }\n }\n }\n\n Sha256.prototype.update = function (toHash) {\n if ((0, util_1.isEmptyData)(toHash) || this.error) {\n return;\n }\n\n try {\n this.hash.update((0, util_1.convertToBuffer)(toHash));\n } catch (e) {\n this.error = e;\n }\n };\n /* This synchronous method keeps compatibility\n * with the v2 aws-sdk.\n */\n\n\n Sha256.prototype.digestSync = function () {\n if (this.error) {\n throw this.error;\n }\n\n if (this.outer) {\n if (!this.outer.finished) {\n this.outer.update(this.hash.digest());\n }\n\n return this.outer.digest();\n }\n\n return this.hash.digest();\n };\n /* The underlying digest method here is synchronous.\n * To keep the same interface with the other hash functions\n * the default is to expose this as an async method.\n * However, it can sometimes be useful to have a sync method.\n */\n\n\n Sha256.prototype.digest = function () {\n return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {\n return (0, tslib_1.__generator)(this, function (_a) {\n return [2\n /*return*/\n , this.digestSync()];\n });\n });\n };\n\n return Sha256;\n}();\n\nexports.Sha256 = Sha256;\n\nfunction bufferFromSecret(secret) {\n var input = (0, util_1.convertToBuffer)(secret);\n\n if (input.byteLength > constants_1.BLOCK_SIZE) {\n var bufferHash = new RawSha256_1.RawSha256();\n bufferHash.update(input);\n input = bufferHash.digest();\n }\n\n var buffer = new Uint8Array(constants_1.BLOCK_SIZE);\n buffer.set(input);\n return buffer;\n}","(function (module, exports) {\n 'use strict'; // Utils\n\n function assert(val, msg) {\n if (!val) throw new Error(msg || 'Assertion failed');\n } // Could use `inherits` module, but don't want to move from single file\n // architecture yet.\n\n\n function inherits(ctor, superCtor) {\n ctor.super_ = superCtor;\n\n var TempCtor = function TempCtor() {};\n\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n } // BN\n\n\n function BN(number, base, endian) {\n if (BN.isBN(number)) {\n return number;\n }\n\n this.negative = 0;\n this.words = null;\n this.length = 0; // Reduction context\n\n this.red = null;\n\n if (number !== null) {\n if (base === 'le' || base === 'be') {\n endian = base;\n base = 10;\n }\n\n this._init(number || 0, base || 10, endian || 'be');\n }\n }\n\n if (typeof module === 'object') {\n module.exports = BN;\n } else {\n exports.BN = BN;\n }\n\n BN.BN = BN;\n BN.wordSize = 26;\n var Buffer;\n\n try {\n Buffer = require('buffer').Buffer;\n } catch (e) {}\n\n BN.isBN = function isBN(num) {\n if (num instanceof BN) {\n return true;\n }\n\n return num !== null && typeof num === 'object' && num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);\n };\n\n BN.max = function max(left, right) {\n if (left.cmp(right) > 0) return left;\n return right;\n };\n\n BN.min = function min(left, right) {\n if (left.cmp(right) < 0) return left;\n return right;\n };\n\n BN.prototype._init = function init(number, base, endian) {\n if (typeof number === 'number') {\n return this._initNumber(number, base, endian);\n }\n\n if (typeof number === 'object') {\n return this._initArray(number, base, endian);\n }\n\n if (base === 'hex') {\n base = 16;\n }\n\n assert(base === (base | 0) && base >= 2 && base <= 36);\n number = number.toString().replace(/\\s+/g, '');\n var start = 0;\n\n if (number[0] === '-') {\n start++;\n }\n\n if (base === 16) {\n this._parseHex(number, start);\n } else {\n this._parseBase(number, base, start);\n }\n\n if (number[0] === '-') {\n this.negative = 1;\n }\n\n this.strip();\n if (endian !== 'le') return;\n\n this._initArray(this.toArray(), base, endian);\n };\n\n BN.prototype._initNumber = function _initNumber(number, base, endian) {\n if (number < 0) {\n this.negative = 1;\n number = -number;\n }\n\n if (number < 0x4000000) {\n this.words = [number & 0x3ffffff];\n this.length = 1;\n } else if (number < 0x10000000000000) {\n this.words = [number & 0x3ffffff, number / 0x4000000 & 0x3ffffff];\n this.length = 2;\n } else {\n assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)\n\n this.words = [number & 0x3ffffff, number / 0x4000000 & 0x3ffffff, 1];\n this.length = 3;\n }\n\n if (endian !== 'le') return; // Reverse the bytes\n\n this._initArray(this.toArray(), base, endian);\n };\n\n BN.prototype._initArray = function _initArray(number, base, endian) {\n // Perhaps a Uint8Array\n assert(typeof number.length === 'number');\n\n if (number.length <= 0) {\n this.words = [0];\n this.length = 1;\n return this;\n }\n\n this.length = Math.ceil(number.length / 3);\n this.words = new Array(this.length);\n\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n var j, w;\n var off = 0;\n\n if (endian === 'be') {\n for (i = number.length - 1, j = 0; i >= 0; i -= 3) {\n w = number[i] | number[i - 1] << 8 | number[i - 2] << 16;\n this.words[j] |= w << off & 0x3ffffff;\n this.words[j + 1] = w >>> 26 - off & 0x3ffffff;\n off += 24;\n\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n } else if (endian === 'le') {\n for (i = 0, j = 0; i < number.length; i += 3) {\n w = number[i] | number[i + 1] << 8 | number[i + 2] << 16;\n this.words[j] |= w << off & 0x3ffffff;\n this.words[j + 1] = w >>> 26 - off & 0x3ffffff;\n off += 24;\n\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n }\n\n return this.strip();\n };\n\n function parseHex(str, start, end) {\n var r = 0;\n var len = Math.min(str.length, end);\n\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n r <<= 4; // 'a' - 'f'\n\n if (c >= 49 && c <= 54) {\n r |= c - 49 + 0xa; // 'A' - 'F'\n } else if (c >= 17 && c <= 22) {\n r |= c - 17 + 0xa; // '0' - '9'\n } else {\n r |= c & 0xf;\n }\n }\n\n return r;\n }\n\n BN.prototype._parseHex = function _parseHex(number, start) {\n // Create possibly bigger array to ensure that it fits the number\n this.length = Math.ceil((number.length - start) / 6);\n this.words = new Array(this.length);\n\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n var j, w; // Scan 24-bit chunks and add them to the number\n\n var off = 0;\n\n for (i = number.length - 6, j = 0; i >= start; i -= 6) {\n w = parseHex(number, i, i + 6);\n this.words[j] |= w << off & 0x3ffffff; // NOTE: `0x3fffff` is intentional here, 26bits max shift + 24bit hex limb\n\n this.words[j + 1] |= w >>> 26 - off & 0x3fffff;\n off += 24;\n\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n\n if (i + 6 !== start) {\n w = parseHex(number, start, i + 6);\n this.words[j] |= w << off & 0x3ffffff;\n this.words[j + 1] |= w >>> 26 - off & 0x3fffff;\n }\n\n this.strip();\n };\n\n function parseBase(str, start, end, mul) {\n var r = 0;\n var len = Math.min(str.length, end);\n\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n r *= mul; // 'a'\n\n if (c >= 49) {\n r += c - 49 + 0xa; // 'A'\n } else if (c >= 17) {\n r += c - 17 + 0xa; // '0' - '9'\n } else {\n r += c;\n }\n }\n\n return r;\n }\n\n BN.prototype._parseBase = function _parseBase(number, base, start) {\n // Initialize as zero\n this.words = [0];\n this.length = 1; // Find length of limb in base\n\n for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {\n limbLen++;\n }\n\n limbLen--;\n limbPow = limbPow / base | 0;\n var total = number.length - start;\n var mod = total % limbLen;\n var end = Math.min(total, total - mod) + start;\n var word = 0;\n\n for (var i = start; i < end; i += limbLen) {\n word = parseBase(number, i, i + limbLen, base);\n this.imuln(limbPow);\n\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n if (mod !== 0) {\n var pow = 1;\n word = parseBase(number, i, number.length, base);\n\n for (i = 0; i < mod; i++) {\n pow *= base;\n }\n\n this.imuln(pow);\n\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n };\n\n BN.prototype.copy = function copy(dest) {\n dest.words = new Array(this.length);\n\n for (var i = 0; i < this.length; i++) {\n dest.words[i] = this.words[i];\n }\n\n dest.length = this.length;\n dest.negative = this.negative;\n dest.red = this.red;\n };\n\n BN.prototype.clone = function clone() {\n var r = new BN(null);\n this.copy(r);\n return r;\n };\n\n BN.prototype._expand = function _expand(size) {\n while (this.length < size) {\n this.words[this.length++] = 0;\n }\n\n return this;\n }; // Remove leading `0` from `this`\n\n\n BN.prototype.strip = function strip() {\n while (this.length > 1 && this.words[this.length - 1] === 0) {\n this.length--;\n }\n\n return this._normSign();\n };\n\n BN.prototype._normSign = function _normSign() {\n // -0 = 0\n if (this.length === 1 && this.words[0] === 0) {\n this.negative = 0;\n }\n\n return this;\n };\n\n BN.prototype.inspect = function inspect() {\n return (this.red ? '';\n };\n /*\n var zeros = [];\n var groupSizes = [];\n var groupBases = [];\n var s = '';\n var i = -1;\n while (++i < BN.wordSize) {\n zeros[i] = s;\n s += '0';\n }\n groupSizes[0] = 0;\n groupSizes[1] = 0;\n groupBases[0] = 0;\n groupBases[1] = 0;\n var base = 2 - 1;\n while (++base < 36 + 1) {\n var groupSize = 0;\n var groupBase = 1;\n while (groupBase < (1 << BN.wordSize) / base) {\n groupBase *= base;\n groupSize += 1;\n }\n groupSizes[base] = groupSize;\n groupBases[base] = groupBase;\n }\n */\n\n\n var zeros = ['', '0', '00', '000', '0000', '00000', '000000', '0000000', '00000000', '000000000', '0000000000', '00000000000', '000000000000', '0000000000000', '00000000000000', '000000000000000', '0000000000000000', '00000000000000000', '000000000000000000', '0000000000000000000', '00000000000000000000', '000000000000000000000', '0000000000000000000000', '00000000000000000000000', '000000000000000000000000', '0000000000000000000000000'];\n var groupSizes = [0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5];\n var groupBases = [0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176];\n\n BN.prototype.toString = function toString(base, padding) {\n base = base || 10;\n padding = padding | 0 || 1;\n var out;\n\n if (base === 16 || base === 'hex') {\n out = '';\n var off = 0;\n var carry = 0;\n\n for (var i = 0; i < this.length; i++) {\n var w = this.words[i];\n var word = ((w << off | carry) & 0xffffff).toString(16);\n carry = w >>> 24 - off & 0xffffff;\n\n if (carry !== 0 || i !== this.length - 1) {\n out = zeros[6 - word.length] + word + out;\n } else {\n out = word + out;\n }\n\n off += 2;\n\n if (off >= 26) {\n off -= 26;\n i--;\n }\n }\n\n if (carry !== 0) {\n out = carry.toString(16) + out;\n }\n\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n\n if (this.negative !== 0) {\n out = '-' + out;\n }\n\n return out;\n }\n\n if (base === (base | 0) && base >= 2 && base <= 36) {\n // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));\n var groupSize = groupSizes[base]; // var groupBase = Math.pow(base, groupSize);\n\n var groupBase = groupBases[base];\n out = '';\n var c = this.clone();\n c.negative = 0;\n\n while (!c.isZero()) {\n var r = c.modn(groupBase).toString(base);\n c = c.idivn(groupBase);\n\n if (!c.isZero()) {\n out = zeros[groupSize - r.length] + r + out;\n } else {\n out = r + out;\n }\n }\n\n if (this.isZero()) {\n out = '0' + out;\n }\n\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n\n if (this.negative !== 0) {\n out = '-' + out;\n }\n\n return out;\n }\n\n assert(false, 'Base should be between 2 and 36');\n };\n\n BN.prototype.toNumber = function toNumber() {\n var ret = this.words[0];\n\n if (this.length === 2) {\n ret += this.words[1] * 0x4000000;\n } else if (this.length === 3 && this.words[2] === 0x01) {\n // NOTE: at this stage it is known that the top bit is set\n ret += 0x10000000000000 + this.words[1] * 0x4000000;\n } else if (this.length > 2) {\n assert(false, 'Number can only safely store up to 53 bits');\n }\n\n return this.negative !== 0 ? -ret : ret;\n };\n\n BN.prototype.toJSON = function toJSON() {\n return this.toString(16);\n };\n\n BN.prototype.toBuffer = function toBuffer(endian, length) {\n assert(typeof Buffer !== 'undefined');\n return this.toArrayLike(Buffer, endian, length);\n };\n\n BN.prototype.toArray = function toArray(endian, length) {\n return this.toArrayLike(Array, endian, length);\n };\n\n BN.prototype.toArrayLike = function toArrayLike(ArrayType, endian, length) {\n var byteLength = this.byteLength();\n var reqLength = length || Math.max(1, byteLength);\n assert(byteLength <= reqLength, 'byte array longer than desired length');\n assert(reqLength > 0, 'Requested array length <= 0');\n this.strip();\n var littleEndian = endian === 'le';\n var res = new ArrayType(reqLength);\n var b, i;\n var q = this.clone();\n\n if (!littleEndian) {\n // Assume big-endian\n for (i = 0; i < reqLength - byteLength; i++) {\n res[i] = 0;\n }\n\n for (i = 0; !q.isZero(); i++) {\n b = q.andln(0xff);\n q.iushrn(8);\n res[reqLength - i - 1] = b;\n }\n } else {\n for (i = 0; !q.isZero(); i++) {\n b = q.andln(0xff);\n q.iushrn(8);\n res[i] = b;\n }\n\n for (; i < reqLength; i++) {\n res[i] = 0;\n }\n }\n\n return res;\n };\n\n if (Math.clz32) {\n BN.prototype._countBits = function _countBits(w) {\n return 32 - Math.clz32(w);\n };\n } else {\n BN.prototype._countBits = function _countBits(w) {\n var t = w;\n var r = 0;\n\n if (t >= 0x1000) {\n r += 13;\n t >>>= 13;\n }\n\n if (t >= 0x40) {\n r += 7;\n t >>>= 7;\n }\n\n if (t >= 0x8) {\n r += 4;\n t >>>= 4;\n }\n\n if (t >= 0x02) {\n r += 2;\n t >>>= 2;\n }\n\n return r + t;\n };\n }\n\n BN.prototype._zeroBits = function _zeroBits(w) {\n // Short-cut\n if (w === 0) return 26;\n var t = w;\n var r = 0;\n\n if ((t & 0x1fff) === 0) {\n r += 13;\n t >>>= 13;\n }\n\n if ((t & 0x7f) === 0) {\n r += 7;\n t >>>= 7;\n }\n\n if ((t & 0xf) === 0) {\n r += 4;\n t >>>= 4;\n }\n\n if ((t & 0x3) === 0) {\n r += 2;\n t >>>= 2;\n }\n\n if ((t & 0x1) === 0) {\n r++;\n }\n\n return r;\n }; // Return number of used bits in a BN\n\n\n BN.prototype.bitLength = function bitLength() {\n var w = this.words[this.length - 1];\n\n var hi = this._countBits(w);\n\n return (this.length - 1) * 26 + hi;\n };\n\n function toBitArray(num) {\n var w = new Array(num.bitLength());\n\n for (var bit = 0; bit < w.length; bit++) {\n var off = bit / 26 | 0;\n var wbit = bit % 26;\n w[bit] = (num.words[off] & 1 << wbit) >>> wbit;\n }\n\n return w;\n } // Number of trailing zero bits\n\n\n BN.prototype.zeroBits = function zeroBits() {\n if (this.isZero()) return 0;\n var r = 0;\n\n for (var i = 0; i < this.length; i++) {\n var b = this._zeroBits(this.words[i]);\n\n r += b;\n if (b !== 26) break;\n }\n\n return r;\n };\n\n BN.prototype.byteLength = function byteLength() {\n return Math.ceil(this.bitLength() / 8);\n };\n\n BN.prototype.toTwos = function toTwos(width) {\n if (this.negative !== 0) {\n return this.abs().inotn(width).iaddn(1);\n }\n\n return this.clone();\n };\n\n BN.prototype.fromTwos = function fromTwos(width) {\n if (this.testn(width - 1)) {\n return this.notn(width).iaddn(1).ineg();\n }\n\n return this.clone();\n };\n\n BN.prototype.isNeg = function isNeg() {\n return this.negative !== 0;\n }; // Return negative clone of `this`\n\n\n BN.prototype.neg = function neg() {\n return this.clone().ineg();\n };\n\n BN.prototype.ineg = function ineg() {\n if (!this.isZero()) {\n this.negative ^= 1;\n }\n\n return this;\n }; // Or `num` with `this` in-place\n\n\n BN.prototype.iuor = function iuor(num) {\n while (this.length < num.length) {\n this.words[this.length++] = 0;\n }\n\n for (var i = 0; i < num.length; i++) {\n this.words[i] = this.words[i] | num.words[i];\n }\n\n return this.strip();\n };\n\n BN.prototype.ior = function ior(num) {\n assert((this.negative | num.negative) === 0);\n return this.iuor(num);\n }; // Or `num` with `this`\n\n\n BN.prototype.or = function or(num) {\n if (this.length > num.length) return this.clone().ior(num);\n return num.clone().ior(this);\n };\n\n BN.prototype.uor = function uor(num) {\n if (this.length > num.length) return this.clone().iuor(num);\n return num.clone().iuor(this);\n }; // And `num` with `this` in-place\n\n\n BN.prototype.iuand = function iuand(num) {\n // b = min-length(num, this)\n var b;\n\n if (this.length > num.length) {\n b = num;\n } else {\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = this.words[i] & num.words[i];\n }\n\n this.length = b.length;\n return this.strip();\n };\n\n BN.prototype.iand = function iand(num) {\n assert((this.negative | num.negative) === 0);\n return this.iuand(num);\n }; // And `num` with `this`\n\n\n BN.prototype.and = function and(num) {\n if (this.length > num.length) return this.clone().iand(num);\n return num.clone().iand(this);\n };\n\n BN.prototype.uand = function uand(num) {\n if (this.length > num.length) return this.clone().iuand(num);\n return num.clone().iuand(this);\n }; // Xor `num` with `this` in-place\n\n\n BN.prototype.iuxor = function iuxor(num) {\n // a.length > b.length\n var a;\n var b;\n\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = a.words[i] ^ b.words[i];\n }\n\n if (this !== a) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = a.length;\n return this.strip();\n };\n\n BN.prototype.ixor = function ixor(num) {\n assert((this.negative | num.negative) === 0);\n return this.iuxor(num);\n }; // Xor `num` with `this`\n\n\n BN.prototype.xor = function xor(num) {\n if (this.length > num.length) return this.clone().ixor(num);\n return num.clone().ixor(this);\n };\n\n BN.prototype.uxor = function uxor(num) {\n if (this.length > num.length) return this.clone().iuxor(num);\n return num.clone().iuxor(this);\n }; // Not ``this`` with ``width`` bitwidth\n\n\n BN.prototype.inotn = function inotn(width) {\n assert(typeof width === 'number' && width >= 0);\n var bytesNeeded = Math.ceil(width / 26) | 0;\n var bitsLeft = width % 26; // Extend the buffer with leading zeroes\n\n this._expand(bytesNeeded);\n\n if (bitsLeft > 0) {\n bytesNeeded--;\n } // Handle complete words\n\n\n for (var i = 0; i < bytesNeeded; i++) {\n this.words[i] = ~this.words[i] & 0x3ffffff;\n } // Handle the residue\n\n\n if (bitsLeft > 0) {\n this.words[i] = ~this.words[i] & 0x3ffffff >> 26 - bitsLeft;\n } // And remove leading zeroes\n\n\n return this.strip();\n };\n\n BN.prototype.notn = function notn(width) {\n return this.clone().inotn(width);\n }; // Set `bit` of `this`\n\n\n BN.prototype.setn = function setn(bit, val) {\n assert(typeof bit === 'number' && bit >= 0);\n var off = bit / 26 | 0;\n var wbit = bit % 26;\n\n this._expand(off + 1);\n\n if (val) {\n this.words[off] = this.words[off] | 1 << wbit;\n } else {\n this.words[off] = this.words[off] & ~(1 << wbit);\n }\n\n return this.strip();\n }; // Add `num` to `this` in-place\n\n\n BN.prototype.iadd = function iadd(num) {\n var r; // negative + positive\n\n if (this.negative !== 0 && num.negative === 0) {\n this.negative = 0;\n r = this.isub(num);\n this.negative ^= 1;\n return this._normSign(); // positive + negative\n } else if (this.negative === 0 && num.negative !== 0) {\n num.negative = 0;\n r = this.isub(num);\n num.negative = 1;\n return r._normSign();\n } // a.length > b.length\n\n\n var a, b;\n\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) + (b.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n\n this.length = a.length;\n\n if (carry !== 0) {\n this.words[this.length] = carry;\n this.length++; // Copy the rest of the words\n } else if (a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n return this;\n }; // Add `num` to `this`\n\n\n BN.prototype.add = function add(num) {\n var res;\n\n if (num.negative !== 0 && this.negative === 0) {\n num.negative = 0;\n res = this.sub(num);\n num.negative ^= 1;\n return res;\n } else if (num.negative === 0 && this.negative !== 0) {\n this.negative = 0;\n res = num.sub(this);\n this.negative = 1;\n return res;\n }\n\n if (this.length > num.length) return this.clone().iadd(num);\n return num.clone().iadd(this);\n }; // Subtract `num` from `this` in-place\n\n\n BN.prototype.isub = function isub(num) {\n // this - (-num) = this + num\n if (num.negative !== 0) {\n num.negative = 0;\n var r = this.iadd(num);\n num.negative = 1;\n return r._normSign(); // -this - num = -(this + num)\n } else if (this.negative !== 0) {\n this.negative = 0;\n this.iadd(num);\n this.negative = 1;\n return this._normSign();\n } // At this point both numbers are positive\n\n\n var cmp = this.cmp(num); // Optimization - zeroify\n\n if (cmp === 0) {\n this.negative = 0;\n this.length = 1;\n this.words[0] = 0;\n return this;\n } // a > b\n\n\n var a, b;\n\n if (cmp > 0) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) - (b.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n } // Copy rest of the words\n\n\n if (carry === 0 && i < a.length && a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = Math.max(this.length, i);\n\n if (a !== this) {\n this.negative = 1;\n }\n\n return this.strip();\n }; // Subtract `num` from `this`\n\n\n BN.prototype.sub = function sub(num) {\n return this.clone().isub(num);\n };\n\n function smallMulTo(self, num, out) {\n out.negative = num.negative ^ self.negative;\n var len = self.length + num.length | 0;\n out.length = len;\n len = len - 1 | 0; // Peel one iteration (compiler can't do it, because of code complexity)\n\n var a = self.words[0] | 0;\n var b = num.words[0] | 0;\n var r = a * b;\n var lo = r & 0x3ffffff;\n var carry = r / 0x4000000 | 0;\n out.words[0] = lo;\n\n for (var k = 1; k < len; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = carry >>> 26;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = k - j | 0;\n a = self.words[i] | 0;\n b = num.words[j] | 0;\n r = a * b + rword;\n ncarry += r / 0x4000000 | 0;\n rword = r & 0x3ffffff;\n }\n\n out.words[k] = rword | 0;\n carry = ncarry | 0;\n }\n\n if (carry !== 0) {\n out.words[k] = carry | 0;\n } else {\n out.length--;\n }\n\n return out.strip();\n } // TODO(indutny): it may be reasonable to omit it for users who don't need\n // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit\n // multiplication (like elliptic secp256k1).\n\n\n var comb10MulTo = function comb10MulTo(self, num, out) {\n var a = self.words;\n var b = num.words;\n var o = out.words;\n var c = 0;\n var lo;\n var mid;\n var hi;\n var a0 = a[0] | 0;\n var al0 = a0 & 0x1fff;\n var ah0 = a0 >>> 13;\n var a1 = a[1] | 0;\n var al1 = a1 & 0x1fff;\n var ah1 = a1 >>> 13;\n var a2 = a[2] | 0;\n var al2 = a2 & 0x1fff;\n var ah2 = a2 >>> 13;\n var a3 = a[3] | 0;\n var al3 = a3 & 0x1fff;\n var ah3 = a3 >>> 13;\n var a4 = a[4] | 0;\n var al4 = a4 & 0x1fff;\n var ah4 = a4 >>> 13;\n var a5 = a[5] | 0;\n var al5 = a5 & 0x1fff;\n var ah5 = a5 >>> 13;\n var a6 = a[6] | 0;\n var al6 = a6 & 0x1fff;\n var ah6 = a6 >>> 13;\n var a7 = a[7] | 0;\n var al7 = a7 & 0x1fff;\n var ah7 = a7 >>> 13;\n var a8 = a[8] | 0;\n var al8 = a8 & 0x1fff;\n var ah8 = a8 >>> 13;\n var a9 = a[9] | 0;\n var al9 = a9 & 0x1fff;\n var ah9 = a9 >>> 13;\n var b0 = b[0] | 0;\n var bl0 = b0 & 0x1fff;\n var bh0 = b0 >>> 13;\n var b1 = b[1] | 0;\n var bl1 = b1 & 0x1fff;\n var bh1 = b1 >>> 13;\n var b2 = b[2] | 0;\n var bl2 = b2 & 0x1fff;\n var bh2 = b2 >>> 13;\n var b3 = b[3] | 0;\n var bl3 = b3 & 0x1fff;\n var bh3 = b3 >>> 13;\n var b4 = b[4] | 0;\n var bl4 = b4 & 0x1fff;\n var bh4 = b4 >>> 13;\n var b5 = b[5] | 0;\n var bl5 = b5 & 0x1fff;\n var bh5 = b5 >>> 13;\n var b6 = b[6] | 0;\n var bl6 = b6 & 0x1fff;\n var bh6 = b6 >>> 13;\n var b7 = b[7] | 0;\n var bl7 = b7 & 0x1fff;\n var bh7 = b7 >>> 13;\n var b8 = b[8] | 0;\n var bl8 = b8 & 0x1fff;\n var bh8 = b8 >>> 13;\n var b9 = b[9] | 0;\n var bl9 = b9 & 0x1fff;\n var bh9 = b9 >>> 13;\n out.negative = self.negative ^ num.negative;\n out.length = 19;\n /* k = 0 */\n\n lo = Math.imul(al0, bl0);\n mid = Math.imul(al0, bh0);\n mid = mid + Math.imul(ah0, bl0) | 0;\n hi = Math.imul(ah0, bh0);\n var w0 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w0 >>> 26) | 0;\n w0 &= 0x3ffffff;\n /* k = 1 */\n\n lo = Math.imul(al1, bl0);\n mid = Math.imul(al1, bh0);\n mid = mid + Math.imul(ah1, bl0) | 0;\n hi = Math.imul(ah1, bh0);\n lo = lo + Math.imul(al0, bl1) | 0;\n mid = mid + Math.imul(al0, bh1) | 0;\n mid = mid + Math.imul(ah0, bl1) | 0;\n hi = hi + Math.imul(ah0, bh1) | 0;\n var w1 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w1 >>> 26) | 0;\n w1 &= 0x3ffffff;\n /* k = 2 */\n\n lo = Math.imul(al2, bl0);\n mid = Math.imul(al2, bh0);\n mid = mid + Math.imul(ah2, bl0) | 0;\n hi = Math.imul(ah2, bh0);\n lo = lo + Math.imul(al1, bl1) | 0;\n mid = mid + Math.imul(al1, bh1) | 0;\n mid = mid + Math.imul(ah1, bl1) | 0;\n hi = hi + Math.imul(ah1, bh1) | 0;\n lo = lo + Math.imul(al0, bl2) | 0;\n mid = mid + Math.imul(al0, bh2) | 0;\n mid = mid + Math.imul(ah0, bl2) | 0;\n hi = hi + Math.imul(ah0, bh2) | 0;\n var w2 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w2 >>> 26) | 0;\n w2 &= 0x3ffffff;\n /* k = 3 */\n\n lo = Math.imul(al3, bl0);\n mid = Math.imul(al3, bh0);\n mid = mid + Math.imul(ah3, bl0) | 0;\n hi = Math.imul(ah3, bh0);\n lo = lo + Math.imul(al2, bl1) | 0;\n mid = mid + Math.imul(al2, bh1) | 0;\n mid = mid + Math.imul(ah2, bl1) | 0;\n hi = hi + Math.imul(ah2, bh1) | 0;\n lo = lo + Math.imul(al1, bl2) | 0;\n mid = mid + Math.imul(al1, bh2) | 0;\n mid = mid + Math.imul(ah1, bl2) | 0;\n hi = hi + Math.imul(ah1, bh2) | 0;\n lo = lo + Math.imul(al0, bl3) | 0;\n mid = mid + Math.imul(al0, bh3) | 0;\n mid = mid + Math.imul(ah0, bl3) | 0;\n hi = hi + Math.imul(ah0, bh3) | 0;\n var w3 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w3 >>> 26) | 0;\n w3 &= 0x3ffffff;\n /* k = 4 */\n\n lo = Math.imul(al4, bl0);\n mid = Math.imul(al4, bh0);\n mid = mid + Math.imul(ah4, bl0) | 0;\n hi = Math.imul(ah4, bh0);\n lo = lo + Math.imul(al3, bl1) | 0;\n mid = mid + Math.imul(al3, bh1) | 0;\n mid = mid + Math.imul(ah3, bl1) | 0;\n hi = hi + Math.imul(ah3, bh1) | 0;\n lo = lo + Math.imul(al2, bl2) | 0;\n mid = mid + Math.imul(al2, bh2) | 0;\n mid = mid + Math.imul(ah2, bl2) | 0;\n hi = hi + Math.imul(ah2, bh2) | 0;\n lo = lo + Math.imul(al1, bl3) | 0;\n mid = mid + Math.imul(al1, bh3) | 0;\n mid = mid + Math.imul(ah1, bl3) | 0;\n hi = hi + Math.imul(ah1, bh3) | 0;\n lo = lo + Math.imul(al0, bl4) | 0;\n mid = mid + Math.imul(al0, bh4) | 0;\n mid = mid + Math.imul(ah0, bl4) | 0;\n hi = hi + Math.imul(ah0, bh4) | 0;\n var w4 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w4 >>> 26) | 0;\n w4 &= 0x3ffffff;\n /* k = 5 */\n\n lo = Math.imul(al5, bl0);\n mid = Math.imul(al5, bh0);\n mid = mid + Math.imul(ah5, bl0) | 0;\n hi = Math.imul(ah5, bh0);\n lo = lo + Math.imul(al4, bl1) | 0;\n mid = mid + Math.imul(al4, bh1) | 0;\n mid = mid + Math.imul(ah4, bl1) | 0;\n hi = hi + Math.imul(ah4, bh1) | 0;\n lo = lo + Math.imul(al3, bl2) | 0;\n mid = mid + Math.imul(al3, bh2) | 0;\n mid = mid + Math.imul(ah3, bl2) | 0;\n hi = hi + Math.imul(ah3, bh2) | 0;\n lo = lo + Math.imul(al2, bl3) | 0;\n mid = mid + Math.imul(al2, bh3) | 0;\n mid = mid + Math.imul(ah2, bl3) | 0;\n hi = hi + Math.imul(ah2, bh3) | 0;\n lo = lo + Math.imul(al1, bl4) | 0;\n mid = mid + Math.imul(al1, bh4) | 0;\n mid = mid + Math.imul(ah1, bl4) | 0;\n hi = hi + Math.imul(ah1, bh4) | 0;\n lo = lo + Math.imul(al0, bl5) | 0;\n mid = mid + Math.imul(al0, bh5) | 0;\n mid = mid + Math.imul(ah0, bl5) | 0;\n hi = hi + Math.imul(ah0, bh5) | 0;\n var w5 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w5 >>> 26) | 0;\n w5 &= 0x3ffffff;\n /* k = 6 */\n\n lo = Math.imul(al6, bl0);\n mid = Math.imul(al6, bh0);\n mid = mid + Math.imul(ah6, bl0) | 0;\n hi = Math.imul(ah6, bh0);\n lo = lo + Math.imul(al5, bl1) | 0;\n mid = mid + Math.imul(al5, bh1) | 0;\n mid = mid + Math.imul(ah5, bl1) | 0;\n hi = hi + Math.imul(ah5, bh1) | 0;\n lo = lo + Math.imul(al4, bl2) | 0;\n mid = mid + Math.imul(al4, bh2) | 0;\n mid = mid + Math.imul(ah4, bl2) | 0;\n hi = hi + Math.imul(ah4, bh2) | 0;\n lo = lo + Math.imul(al3, bl3) | 0;\n mid = mid + Math.imul(al3, bh3) | 0;\n mid = mid + Math.imul(ah3, bl3) | 0;\n hi = hi + Math.imul(ah3, bh3) | 0;\n lo = lo + Math.imul(al2, bl4) | 0;\n mid = mid + Math.imul(al2, bh4) | 0;\n mid = mid + Math.imul(ah2, bl4) | 0;\n hi = hi + Math.imul(ah2, bh4) | 0;\n lo = lo + Math.imul(al1, bl5) | 0;\n mid = mid + Math.imul(al1, bh5) | 0;\n mid = mid + Math.imul(ah1, bl5) | 0;\n hi = hi + Math.imul(ah1, bh5) | 0;\n lo = lo + Math.imul(al0, bl6) | 0;\n mid = mid + Math.imul(al0, bh6) | 0;\n mid = mid + Math.imul(ah0, bl6) | 0;\n hi = hi + Math.imul(ah0, bh6) | 0;\n var w6 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w6 >>> 26) | 0;\n w6 &= 0x3ffffff;\n /* k = 7 */\n\n lo = Math.imul(al7, bl0);\n mid = Math.imul(al7, bh0);\n mid = mid + Math.imul(ah7, bl0) | 0;\n hi = Math.imul(ah7, bh0);\n lo = lo + Math.imul(al6, bl1) | 0;\n mid = mid + Math.imul(al6, bh1) | 0;\n mid = mid + Math.imul(ah6, bl1) | 0;\n hi = hi + Math.imul(ah6, bh1) | 0;\n lo = lo + Math.imul(al5, bl2) | 0;\n mid = mid + Math.imul(al5, bh2) | 0;\n mid = mid + Math.imul(ah5, bl2) | 0;\n hi = hi + Math.imul(ah5, bh2) | 0;\n lo = lo + Math.imul(al4, bl3) | 0;\n mid = mid + Math.imul(al4, bh3) | 0;\n mid = mid + Math.imul(ah4, bl3) | 0;\n hi = hi + Math.imul(ah4, bh3) | 0;\n lo = lo + Math.imul(al3, bl4) | 0;\n mid = mid + Math.imul(al3, bh4) | 0;\n mid = mid + Math.imul(ah3, bl4) | 0;\n hi = hi + Math.imul(ah3, bh4) | 0;\n lo = lo + Math.imul(al2, bl5) | 0;\n mid = mid + Math.imul(al2, bh5) | 0;\n mid = mid + Math.imul(ah2, bl5) | 0;\n hi = hi + Math.imul(ah2, bh5) | 0;\n lo = lo + Math.imul(al1, bl6) | 0;\n mid = mid + Math.imul(al1, bh6) | 0;\n mid = mid + Math.imul(ah1, bl6) | 0;\n hi = hi + Math.imul(ah1, bh6) | 0;\n lo = lo + Math.imul(al0, bl7) | 0;\n mid = mid + Math.imul(al0, bh7) | 0;\n mid = mid + Math.imul(ah0, bl7) | 0;\n hi = hi + Math.imul(ah0, bh7) | 0;\n var w7 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w7 >>> 26) | 0;\n w7 &= 0x3ffffff;\n /* k = 8 */\n\n lo = Math.imul(al8, bl0);\n mid = Math.imul(al8, bh0);\n mid = mid + Math.imul(ah8, bl0) | 0;\n hi = Math.imul(ah8, bh0);\n lo = lo + Math.imul(al7, bl1) | 0;\n mid = mid + Math.imul(al7, bh1) | 0;\n mid = mid + Math.imul(ah7, bl1) | 0;\n hi = hi + Math.imul(ah7, bh1) | 0;\n lo = lo + Math.imul(al6, bl2) | 0;\n mid = mid + Math.imul(al6, bh2) | 0;\n mid = mid + Math.imul(ah6, bl2) | 0;\n hi = hi + Math.imul(ah6, bh2) | 0;\n lo = lo + Math.imul(al5, bl3) | 0;\n mid = mid + Math.imul(al5, bh3) | 0;\n mid = mid + Math.imul(ah5, bl3) | 0;\n hi = hi + Math.imul(ah5, bh3) | 0;\n lo = lo + Math.imul(al4, bl4) | 0;\n mid = mid + Math.imul(al4, bh4) | 0;\n mid = mid + Math.imul(ah4, bl4) | 0;\n hi = hi + Math.imul(ah4, bh4) | 0;\n lo = lo + Math.imul(al3, bl5) | 0;\n mid = mid + Math.imul(al3, bh5) | 0;\n mid = mid + Math.imul(ah3, bl5) | 0;\n hi = hi + Math.imul(ah3, bh5) | 0;\n lo = lo + Math.imul(al2, bl6) | 0;\n mid = mid + Math.imul(al2, bh6) | 0;\n mid = mid + Math.imul(ah2, bl6) | 0;\n hi = hi + Math.imul(ah2, bh6) | 0;\n lo = lo + Math.imul(al1, bl7) | 0;\n mid = mid + Math.imul(al1, bh7) | 0;\n mid = mid + Math.imul(ah1, bl7) | 0;\n hi = hi + Math.imul(ah1, bh7) | 0;\n lo = lo + Math.imul(al0, bl8) | 0;\n mid = mid + Math.imul(al0, bh8) | 0;\n mid = mid + Math.imul(ah0, bl8) | 0;\n hi = hi + Math.imul(ah0, bh8) | 0;\n var w8 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w8 >>> 26) | 0;\n w8 &= 0x3ffffff;\n /* k = 9 */\n\n lo = Math.imul(al9, bl0);\n mid = Math.imul(al9, bh0);\n mid = mid + Math.imul(ah9, bl0) | 0;\n hi = Math.imul(ah9, bh0);\n lo = lo + Math.imul(al8, bl1) | 0;\n mid = mid + Math.imul(al8, bh1) | 0;\n mid = mid + Math.imul(ah8, bl1) | 0;\n hi = hi + Math.imul(ah8, bh1) | 0;\n lo = lo + Math.imul(al7, bl2) | 0;\n mid = mid + Math.imul(al7, bh2) | 0;\n mid = mid + Math.imul(ah7, bl2) | 0;\n hi = hi + Math.imul(ah7, bh2) | 0;\n lo = lo + Math.imul(al6, bl3) | 0;\n mid = mid + Math.imul(al6, bh3) | 0;\n mid = mid + Math.imul(ah6, bl3) | 0;\n hi = hi + Math.imul(ah6, bh3) | 0;\n lo = lo + Math.imul(al5, bl4) | 0;\n mid = mid + Math.imul(al5, bh4) | 0;\n mid = mid + Math.imul(ah5, bl4) | 0;\n hi = hi + Math.imul(ah5, bh4) | 0;\n lo = lo + Math.imul(al4, bl5) | 0;\n mid = mid + Math.imul(al4, bh5) | 0;\n mid = mid + Math.imul(ah4, bl5) | 0;\n hi = hi + Math.imul(ah4, bh5) | 0;\n lo = lo + Math.imul(al3, bl6) | 0;\n mid = mid + Math.imul(al3, bh6) | 0;\n mid = mid + Math.imul(ah3, bl6) | 0;\n hi = hi + Math.imul(ah3, bh6) | 0;\n lo = lo + Math.imul(al2, bl7) | 0;\n mid = mid + Math.imul(al2, bh7) | 0;\n mid = mid + Math.imul(ah2, bl7) | 0;\n hi = hi + Math.imul(ah2, bh7) | 0;\n lo = lo + Math.imul(al1, bl8) | 0;\n mid = mid + Math.imul(al1, bh8) | 0;\n mid = mid + Math.imul(ah1, bl8) | 0;\n hi = hi + Math.imul(ah1, bh8) | 0;\n lo = lo + Math.imul(al0, bl9) | 0;\n mid = mid + Math.imul(al0, bh9) | 0;\n mid = mid + Math.imul(ah0, bl9) | 0;\n hi = hi + Math.imul(ah0, bh9) | 0;\n var w9 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w9 >>> 26) | 0;\n w9 &= 0x3ffffff;\n /* k = 10 */\n\n lo = Math.imul(al9, bl1);\n mid = Math.imul(al9, bh1);\n mid = mid + Math.imul(ah9, bl1) | 0;\n hi = Math.imul(ah9, bh1);\n lo = lo + Math.imul(al8, bl2) | 0;\n mid = mid + Math.imul(al8, bh2) | 0;\n mid = mid + Math.imul(ah8, bl2) | 0;\n hi = hi + Math.imul(ah8, bh2) | 0;\n lo = lo + Math.imul(al7, bl3) | 0;\n mid = mid + Math.imul(al7, bh3) | 0;\n mid = mid + Math.imul(ah7, bl3) | 0;\n hi = hi + Math.imul(ah7, bh3) | 0;\n lo = lo + Math.imul(al6, bl4) | 0;\n mid = mid + Math.imul(al6, bh4) | 0;\n mid = mid + Math.imul(ah6, bl4) | 0;\n hi = hi + Math.imul(ah6, bh4) | 0;\n lo = lo + Math.imul(al5, bl5) | 0;\n mid = mid + Math.imul(al5, bh5) | 0;\n mid = mid + Math.imul(ah5, bl5) | 0;\n hi = hi + Math.imul(ah5, bh5) | 0;\n lo = lo + Math.imul(al4, bl6) | 0;\n mid = mid + Math.imul(al4, bh6) | 0;\n mid = mid + Math.imul(ah4, bl6) | 0;\n hi = hi + Math.imul(ah4, bh6) | 0;\n lo = lo + Math.imul(al3, bl7) | 0;\n mid = mid + Math.imul(al3, bh7) | 0;\n mid = mid + Math.imul(ah3, bl7) | 0;\n hi = hi + Math.imul(ah3, bh7) | 0;\n lo = lo + Math.imul(al2, bl8) | 0;\n mid = mid + Math.imul(al2, bh8) | 0;\n mid = mid + Math.imul(ah2, bl8) | 0;\n hi = hi + Math.imul(ah2, bh8) | 0;\n lo = lo + Math.imul(al1, bl9) | 0;\n mid = mid + Math.imul(al1, bh9) | 0;\n mid = mid + Math.imul(ah1, bl9) | 0;\n hi = hi + Math.imul(ah1, bh9) | 0;\n var w10 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w10 >>> 26) | 0;\n w10 &= 0x3ffffff;\n /* k = 11 */\n\n lo = Math.imul(al9, bl2);\n mid = Math.imul(al9, bh2);\n mid = mid + Math.imul(ah9, bl2) | 0;\n hi = Math.imul(ah9, bh2);\n lo = lo + Math.imul(al8, bl3) | 0;\n mid = mid + Math.imul(al8, bh3) | 0;\n mid = mid + Math.imul(ah8, bl3) | 0;\n hi = hi + Math.imul(ah8, bh3) | 0;\n lo = lo + Math.imul(al7, bl4) | 0;\n mid = mid + Math.imul(al7, bh4) | 0;\n mid = mid + Math.imul(ah7, bl4) | 0;\n hi = hi + Math.imul(ah7, bh4) | 0;\n lo = lo + Math.imul(al6, bl5) | 0;\n mid = mid + Math.imul(al6, bh5) | 0;\n mid = mid + Math.imul(ah6, bl5) | 0;\n hi = hi + Math.imul(ah6, bh5) | 0;\n lo = lo + Math.imul(al5, bl6) | 0;\n mid = mid + Math.imul(al5, bh6) | 0;\n mid = mid + Math.imul(ah5, bl6) | 0;\n hi = hi + Math.imul(ah5, bh6) | 0;\n lo = lo + Math.imul(al4, bl7) | 0;\n mid = mid + Math.imul(al4, bh7) | 0;\n mid = mid + Math.imul(ah4, bl7) | 0;\n hi = hi + Math.imul(ah4, bh7) | 0;\n lo = lo + Math.imul(al3, bl8) | 0;\n mid = mid + Math.imul(al3, bh8) | 0;\n mid = mid + Math.imul(ah3, bl8) | 0;\n hi = hi + Math.imul(ah3, bh8) | 0;\n lo = lo + Math.imul(al2, bl9) | 0;\n mid = mid + Math.imul(al2, bh9) | 0;\n mid = mid + Math.imul(ah2, bl9) | 0;\n hi = hi + Math.imul(ah2, bh9) | 0;\n var w11 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w11 >>> 26) | 0;\n w11 &= 0x3ffffff;\n /* k = 12 */\n\n lo = Math.imul(al9, bl3);\n mid = Math.imul(al9, bh3);\n mid = mid + Math.imul(ah9, bl3) | 0;\n hi = Math.imul(ah9, bh3);\n lo = lo + Math.imul(al8, bl4) | 0;\n mid = mid + Math.imul(al8, bh4) | 0;\n mid = mid + Math.imul(ah8, bl4) | 0;\n hi = hi + Math.imul(ah8, bh4) | 0;\n lo = lo + Math.imul(al7, bl5) | 0;\n mid = mid + Math.imul(al7, bh5) | 0;\n mid = mid + Math.imul(ah7, bl5) | 0;\n hi = hi + Math.imul(ah7, bh5) | 0;\n lo = lo + Math.imul(al6, bl6) | 0;\n mid = mid + Math.imul(al6, bh6) | 0;\n mid = mid + Math.imul(ah6, bl6) | 0;\n hi = hi + Math.imul(ah6, bh6) | 0;\n lo = lo + Math.imul(al5, bl7) | 0;\n mid = mid + Math.imul(al5, bh7) | 0;\n mid = mid + Math.imul(ah5, bl7) | 0;\n hi = hi + Math.imul(ah5, bh7) | 0;\n lo = lo + Math.imul(al4, bl8) | 0;\n mid = mid + Math.imul(al4, bh8) | 0;\n mid = mid + Math.imul(ah4, bl8) | 0;\n hi = hi + Math.imul(ah4, bh8) | 0;\n lo = lo + Math.imul(al3, bl9) | 0;\n mid = mid + Math.imul(al3, bh9) | 0;\n mid = mid + Math.imul(ah3, bl9) | 0;\n hi = hi + Math.imul(ah3, bh9) | 0;\n var w12 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w12 >>> 26) | 0;\n w12 &= 0x3ffffff;\n /* k = 13 */\n\n lo = Math.imul(al9, bl4);\n mid = Math.imul(al9, bh4);\n mid = mid + Math.imul(ah9, bl4) | 0;\n hi = Math.imul(ah9, bh4);\n lo = lo + Math.imul(al8, bl5) | 0;\n mid = mid + Math.imul(al8, bh5) | 0;\n mid = mid + Math.imul(ah8, bl5) | 0;\n hi = hi + Math.imul(ah8, bh5) | 0;\n lo = lo + Math.imul(al7, bl6) | 0;\n mid = mid + Math.imul(al7, bh6) | 0;\n mid = mid + Math.imul(ah7, bl6) | 0;\n hi = hi + Math.imul(ah7, bh6) | 0;\n lo = lo + Math.imul(al6, bl7) | 0;\n mid = mid + Math.imul(al6, bh7) | 0;\n mid = mid + Math.imul(ah6, bl7) | 0;\n hi = hi + Math.imul(ah6, bh7) | 0;\n lo = lo + Math.imul(al5, bl8) | 0;\n mid = mid + Math.imul(al5, bh8) | 0;\n mid = mid + Math.imul(ah5, bl8) | 0;\n hi = hi + Math.imul(ah5, bh8) | 0;\n lo = lo + Math.imul(al4, bl9) | 0;\n mid = mid + Math.imul(al4, bh9) | 0;\n mid = mid + Math.imul(ah4, bl9) | 0;\n hi = hi + Math.imul(ah4, bh9) | 0;\n var w13 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w13 >>> 26) | 0;\n w13 &= 0x3ffffff;\n /* k = 14 */\n\n lo = Math.imul(al9, bl5);\n mid = Math.imul(al9, bh5);\n mid = mid + Math.imul(ah9, bl5) | 0;\n hi = Math.imul(ah9, bh5);\n lo = lo + Math.imul(al8, bl6) | 0;\n mid = mid + Math.imul(al8, bh6) | 0;\n mid = mid + Math.imul(ah8, bl6) | 0;\n hi = hi + Math.imul(ah8, bh6) | 0;\n lo = lo + Math.imul(al7, bl7) | 0;\n mid = mid + Math.imul(al7, bh7) | 0;\n mid = mid + Math.imul(ah7, bl7) | 0;\n hi = hi + Math.imul(ah7, bh7) | 0;\n lo = lo + Math.imul(al6, bl8) | 0;\n mid = mid + Math.imul(al6, bh8) | 0;\n mid = mid + Math.imul(ah6, bl8) | 0;\n hi = hi + Math.imul(ah6, bh8) | 0;\n lo = lo + Math.imul(al5, bl9) | 0;\n mid = mid + Math.imul(al5, bh9) | 0;\n mid = mid + Math.imul(ah5, bl9) | 0;\n hi = hi + Math.imul(ah5, bh9) | 0;\n var w14 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w14 >>> 26) | 0;\n w14 &= 0x3ffffff;\n /* k = 15 */\n\n lo = Math.imul(al9, bl6);\n mid = Math.imul(al9, bh6);\n mid = mid + Math.imul(ah9, bl6) | 0;\n hi = Math.imul(ah9, bh6);\n lo = lo + Math.imul(al8, bl7) | 0;\n mid = mid + Math.imul(al8, bh7) | 0;\n mid = mid + Math.imul(ah8, bl7) | 0;\n hi = hi + Math.imul(ah8, bh7) | 0;\n lo = lo + Math.imul(al7, bl8) | 0;\n mid = mid + Math.imul(al7, bh8) | 0;\n mid = mid + Math.imul(ah7, bl8) | 0;\n hi = hi + Math.imul(ah7, bh8) | 0;\n lo = lo + Math.imul(al6, bl9) | 0;\n mid = mid + Math.imul(al6, bh9) | 0;\n mid = mid + Math.imul(ah6, bl9) | 0;\n hi = hi + Math.imul(ah6, bh9) | 0;\n var w15 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w15 >>> 26) | 0;\n w15 &= 0x3ffffff;\n /* k = 16 */\n\n lo = Math.imul(al9, bl7);\n mid = Math.imul(al9, bh7);\n mid = mid + Math.imul(ah9, bl7) | 0;\n hi = Math.imul(ah9, bh7);\n lo = lo + Math.imul(al8, bl8) | 0;\n mid = mid + Math.imul(al8, bh8) | 0;\n mid = mid + Math.imul(ah8, bl8) | 0;\n hi = hi + Math.imul(ah8, bh8) | 0;\n lo = lo + Math.imul(al7, bl9) | 0;\n mid = mid + Math.imul(al7, bh9) | 0;\n mid = mid + Math.imul(ah7, bl9) | 0;\n hi = hi + Math.imul(ah7, bh9) | 0;\n var w16 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w16 >>> 26) | 0;\n w16 &= 0x3ffffff;\n /* k = 17 */\n\n lo = Math.imul(al9, bl8);\n mid = Math.imul(al9, bh8);\n mid = mid + Math.imul(ah9, bl8) | 0;\n hi = Math.imul(ah9, bh8);\n lo = lo + Math.imul(al8, bl9) | 0;\n mid = mid + Math.imul(al8, bh9) | 0;\n mid = mid + Math.imul(ah8, bl9) | 0;\n hi = hi + Math.imul(ah8, bh9) | 0;\n var w17 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w17 >>> 26) | 0;\n w17 &= 0x3ffffff;\n /* k = 18 */\n\n lo = Math.imul(al9, bl9);\n mid = Math.imul(al9, bh9);\n mid = mid + Math.imul(ah9, bl9) | 0;\n hi = Math.imul(ah9, bh9);\n var w18 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w18 >>> 26) | 0;\n w18 &= 0x3ffffff;\n o[0] = w0;\n o[1] = w1;\n o[2] = w2;\n o[3] = w3;\n o[4] = w4;\n o[5] = w5;\n o[6] = w6;\n o[7] = w7;\n o[8] = w8;\n o[9] = w9;\n o[10] = w10;\n o[11] = w11;\n o[12] = w12;\n o[13] = w13;\n o[14] = w14;\n o[15] = w15;\n o[16] = w16;\n o[17] = w17;\n o[18] = w18;\n\n if (c !== 0) {\n o[19] = c;\n out.length++;\n }\n\n return out;\n }; // Polyfill comb\n\n\n if (!Math.imul) {\n comb10MulTo = smallMulTo;\n }\n\n function bigMulTo(self, num, out) {\n out.negative = num.negative ^ self.negative;\n out.length = self.length + num.length;\n var carry = 0;\n var hncarry = 0;\n\n for (var k = 0; k < out.length - 1; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = hncarry;\n hncarry = 0;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = k - j;\n var a = self.words[i] | 0;\n var b = num.words[j] | 0;\n var r = a * b;\n var lo = r & 0x3ffffff;\n ncarry = ncarry + (r / 0x4000000 | 0) | 0;\n lo = lo + rword | 0;\n rword = lo & 0x3ffffff;\n ncarry = ncarry + (lo >>> 26) | 0;\n hncarry += ncarry >>> 26;\n ncarry &= 0x3ffffff;\n }\n\n out.words[k] = rword;\n carry = ncarry;\n ncarry = hncarry;\n }\n\n if (carry !== 0) {\n out.words[k] = carry;\n } else {\n out.length--;\n }\n\n return out.strip();\n }\n\n function jumboMulTo(self, num, out) {\n var fftm = new FFTM();\n return fftm.mulp(self, num, out);\n }\n\n BN.prototype.mulTo = function mulTo(num, out) {\n var res;\n var len = this.length + num.length;\n\n if (this.length === 10 && num.length === 10) {\n res = comb10MulTo(this, num, out);\n } else if (len < 63) {\n res = smallMulTo(this, num, out);\n } else if (len < 1024) {\n res = bigMulTo(this, num, out);\n } else {\n res = jumboMulTo(this, num, out);\n }\n\n return res;\n }; // Cooley-Tukey algorithm for FFT\n // slightly revisited to rely on looping instead of recursion\n\n\n function FFTM(x, y) {\n this.x = x;\n this.y = y;\n }\n\n FFTM.prototype.makeRBT = function makeRBT(N) {\n var t = new Array(N);\n var l = BN.prototype._countBits(N) - 1;\n\n for (var i = 0; i < N; i++) {\n t[i] = this.revBin(i, l, N);\n }\n\n return t;\n }; // Returns binary-reversed representation of `x`\n\n\n FFTM.prototype.revBin = function revBin(x, l, N) {\n if (x === 0 || x === N - 1) return x;\n var rb = 0;\n\n for (var i = 0; i < l; i++) {\n rb |= (x & 1) << l - i - 1;\n x >>= 1;\n }\n\n return rb;\n }; // Performs \"tweedling\" phase, therefore 'emulating'\n // behaviour of the recursive algorithm\n\n\n FFTM.prototype.permute = function permute(rbt, rws, iws, rtws, itws, N) {\n for (var i = 0; i < N; i++) {\n rtws[i] = rws[rbt[i]];\n itws[i] = iws[rbt[i]];\n }\n };\n\n FFTM.prototype.transform = function transform(rws, iws, rtws, itws, N, rbt) {\n this.permute(rbt, rws, iws, rtws, itws, N);\n\n for (var s = 1; s < N; s <<= 1) {\n var l = s << 1;\n var rtwdf = Math.cos(2 * Math.PI / l);\n var itwdf = Math.sin(2 * Math.PI / l);\n\n for (var p = 0; p < N; p += l) {\n var rtwdf_ = rtwdf;\n var itwdf_ = itwdf;\n\n for (var j = 0; j < s; j++) {\n var re = rtws[p + j];\n var ie = itws[p + j];\n var ro = rtws[p + j + s];\n var io = itws[p + j + s];\n var rx = rtwdf_ * ro - itwdf_ * io;\n io = rtwdf_ * io + itwdf_ * ro;\n ro = rx;\n rtws[p + j] = re + ro;\n itws[p + j] = ie + io;\n rtws[p + j + s] = re - ro;\n itws[p + j + s] = ie - io;\n /* jshint maxdepth : false */\n\n if (j !== l) {\n rx = rtwdf * rtwdf_ - itwdf * itwdf_;\n itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;\n rtwdf_ = rx;\n }\n }\n }\n }\n };\n\n FFTM.prototype.guessLen13b = function guessLen13b(n, m) {\n var N = Math.max(m, n) | 1;\n var odd = N & 1;\n var i = 0;\n\n for (N = N / 2 | 0; N; N = N >>> 1) {\n i++;\n }\n\n return 1 << i + 1 + odd;\n };\n\n FFTM.prototype.conjugate = function conjugate(rws, iws, N) {\n if (N <= 1) return;\n\n for (var i = 0; i < N / 2; i++) {\n var t = rws[i];\n rws[i] = rws[N - i - 1];\n rws[N - i - 1] = t;\n t = iws[i];\n iws[i] = -iws[N - i - 1];\n iws[N - i - 1] = -t;\n }\n };\n\n FFTM.prototype.normalize13b = function normalize13b(ws, N) {\n var carry = 0;\n\n for (var i = 0; i < N / 2; i++) {\n var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + Math.round(ws[2 * i] / N) + carry;\n ws[i] = w & 0x3ffffff;\n\n if (w < 0x4000000) {\n carry = 0;\n } else {\n carry = w / 0x4000000 | 0;\n }\n }\n\n return ws;\n };\n\n FFTM.prototype.convert13b = function convert13b(ws, len, rws, N) {\n var carry = 0;\n\n for (var i = 0; i < len; i++) {\n carry = carry + (ws[i] | 0);\n rws[2 * i] = carry & 0x1fff;\n carry = carry >>> 13;\n rws[2 * i + 1] = carry & 0x1fff;\n carry = carry >>> 13;\n } // Pad with zeroes\n\n\n for (i = 2 * len; i < N; ++i) {\n rws[i] = 0;\n }\n\n assert(carry === 0);\n assert((carry & ~0x1fff) === 0);\n };\n\n FFTM.prototype.stub = function stub(N) {\n var ph = new Array(N);\n\n for (var i = 0; i < N; i++) {\n ph[i] = 0;\n }\n\n return ph;\n };\n\n FFTM.prototype.mulp = function mulp(x, y, out) {\n var N = 2 * this.guessLen13b(x.length, y.length);\n var rbt = this.makeRBT(N);\n\n var _ = this.stub(N);\n\n var rws = new Array(N);\n var rwst = new Array(N);\n var iwst = new Array(N);\n var nrws = new Array(N);\n var nrwst = new Array(N);\n var niwst = new Array(N);\n var rmws = out.words;\n rmws.length = N;\n this.convert13b(x.words, x.length, rws, N);\n this.convert13b(y.words, y.length, nrws, N);\n this.transform(rws, _, rwst, iwst, N, rbt);\n this.transform(nrws, _, nrwst, niwst, N, rbt);\n\n for (var i = 0; i < N; i++) {\n var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];\n iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];\n rwst[i] = rx;\n }\n\n this.conjugate(rwst, iwst, N);\n this.transform(rwst, iwst, rmws, _, N, rbt);\n this.conjugate(rmws, _, N);\n this.normalize13b(rmws, N);\n out.negative = x.negative ^ y.negative;\n out.length = x.length + y.length;\n return out.strip();\n }; // Multiply `this` by `num`\n\n\n BN.prototype.mul = function mul(num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return this.mulTo(num, out);\n }; // Multiply employing FFT\n\n\n BN.prototype.mulf = function mulf(num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return jumboMulTo(this, num, out);\n }; // In-place Multiplication\n\n\n BN.prototype.imul = function imul(num) {\n return this.clone().mulTo(num, this);\n };\n\n BN.prototype.imuln = function imuln(num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000); // Carry\n\n var carry = 0;\n\n for (var i = 0; i < this.length; i++) {\n var w = (this.words[i] | 0) * num;\n var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);\n carry >>= 26;\n carry += w / 0x4000000 | 0; // NOTE: lo is 27bit maximum\n\n carry += lo >>> 26;\n this.words[i] = lo & 0x3ffffff;\n }\n\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n\n return this;\n };\n\n BN.prototype.muln = function muln(num) {\n return this.clone().imuln(num);\n }; // `this` * `this`\n\n\n BN.prototype.sqr = function sqr() {\n return this.mul(this);\n }; // `this` * `this` in-place\n\n\n BN.prototype.isqr = function isqr() {\n return this.imul(this.clone());\n }; // Math.pow(`this`, `num`)\n\n\n BN.prototype.pow = function pow(num) {\n var w = toBitArray(num);\n if (w.length === 0) return new BN(1); // Skip leading zeroes\n\n var res = this;\n\n for (var i = 0; i < w.length; i++, res = res.sqr()) {\n if (w[i] !== 0) break;\n }\n\n if (++i < w.length) {\n for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {\n if (w[i] === 0) continue;\n res = res.mul(q);\n }\n }\n\n return res;\n }; // Shift-left in-place\n\n\n BN.prototype.iushln = function iushln(bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n var carryMask = 0x3ffffff >>> 26 - r << 26 - r;\n var i;\n\n if (r !== 0) {\n var carry = 0;\n\n for (i = 0; i < this.length; i++) {\n var newCarry = this.words[i] & carryMask;\n var c = (this.words[i] | 0) - newCarry << r;\n this.words[i] = c | carry;\n carry = newCarry >>> 26 - r;\n }\n\n if (carry) {\n this.words[i] = carry;\n this.length++;\n }\n }\n\n if (s !== 0) {\n for (i = this.length - 1; i >= 0; i--) {\n this.words[i + s] = this.words[i];\n }\n\n for (i = 0; i < s; i++) {\n this.words[i] = 0;\n }\n\n this.length += s;\n }\n\n return this.strip();\n };\n\n BN.prototype.ishln = function ishln(bits) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushln(bits);\n }; // Shift-right in-place\n // NOTE: `hint` is a lowest bit before trailing zeroes\n // NOTE: if `extended` is present - it will be filled with destroyed bits\n\n\n BN.prototype.iushrn = function iushrn(bits, hint, extended) {\n assert(typeof bits === 'number' && bits >= 0);\n var h;\n\n if (hint) {\n h = (hint - hint % 26) / 26;\n } else {\n h = 0;\n }\n\n var r = bits % 26;\n var s = Math.min((bits - r) / 26, this.length);\n var mask = 0x3ffffff ^ 0x3ffffff >>> r << r;\n var maskedWords = extended;\n h -= s;\n h = Math.max(0, h); // Extended mode, copy masked part\n\n if (maskedWords) {\n for (var i = 0; i < s; i++) {\n maskedWords.words[i] = this.words[i];\n }\n\n maskedWords.length = s;\n }\n\n if (s === 0) {// No-op, we should not move anything at all\n } else if (this.length > s) {\n this.length -= s;\n\n for (i = 0; i < this.length; i++) {\n this.words[i] = this.words[i + s];\n }\n } else {\n this.words[0] = 0;\n this.length = 1;\n }\n\n var carry = 0;\n\n for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {\n var word = this.words[i] | 0;\n this.words[i] = carry << 26 - r | word >>> r;\n carry = word & mask;\n } // Push carried bits as a mask\n\n\n if (maskedWords && carry !== 0) {\n maskedWords.words[maskedWords.length++] = carry;\n }\n\n if (this.length === 0) {\n this.words[0] = 0;\n this.length = 1;\n }\n\n return this.strip();\n };\n\n BN.prototype.ishrn = function ishrn(bits, hint, extended) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushrn(bits, hint, extended);\n }; // Shift-left\n\n\n BN.prototype.shln = function shln(bits) {\n return this.clone().ishln(bits);\n };\n\n BN.prototype.ushln = function ushln(bits) {\n return this.clone().iushln(bits);\n }; // Shift-right\n\n\n BN.prototype.shrn = function shrn(bits) {\n return this.clone().ishrn(bits);\n };\n\n BN.prototype.ushrn = function ushrn(bits) {\n return this.clone().iushrn(bits);\n }; // Test if n bit is set\n\n\n BN.prototype.testn = function testn(bit) {\n assert(typeof bit === 'number' && bit >= 0);\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r; // Fast case: bit is much higher than all existing words\n\n if (this.length <= s) return false; // Check bit and return\n\n var w = this.words[s];\n return !!(w & q);\n }; // Return only lowers bits of number (in-place)\n\n\n BN.prototype.imaskn = function imaskn(bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n assert(this.negative === 0, 'imaskn works only with positive numbers');\n\n if (this.length <= s) {\n return this;\n }\n\n if (r !== 0) {\n s++;\n }\n\n this.length = Math.min(s, this.length);\n\n if (r !== 0) {\n var mask = 0x3ffffff ^ 0x3ffffff >>> r << r;\n this.words[this.length - 1] &= mask;\n }\n\n return this.strip();\n }; // Return only lowers bits of number\n\n\n BN.prototype.maskn = function maskn(bits) {\n return this.clone().imaskn(bits);\n }; // Add plain number `num` to `this`\n\n\n BN.prototype.iaddn = function iaddn(num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.isubn(-num); // Possible sign change\n\n if (this.negative !== 0) {\n if (this.length === 1 && (this.words[0] | 0) < num) {\n this.words[0] = num - (this.words[0] | 0);\n this.negative = 0;\n return this;\n }\n\n this.negative = 0;\n this.isubn(num);\n this.negative = 1;\n return this;\n } // Add without checks\n\n\n return this._iaddn(num);\n };\n\n BN.prototype._iaddn = function _iaddn(num) {\n this.words[0] += num; // Carry\n\n for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {\n this.words[i] -= 0x4000000;\n\n if (i === this.length - 1) {\n this.words[i + 1] = 1;\n } else {\n this.words[i + 1]++;\n }\n }\n\n this.length = Math.max(this.length, i + 1);\n return this;\n }; // Subtract plain number `num` from `this`\n\n\n BN.prototype.isubn = function isubn(num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.iaddn(-num);\n\n if (this.negative !== 0) {\n this.negative = 0;\n this.iaddn(num);\n this.negative = 1;\n return this;\n }\n\n this.words[0] -= num;\n\n if (this.length === 1 && this.words[0] < 0) {\n this.words[0] = -this.words[0];\n this.negative = 1;\n } else {\n // Carry\n for (var i = 0; i < this.length && this.words[i] < 0; i++) {\n this.words[i] += 0x4000000;\n this.words[i + 1] -= 1;\n }\n }\n\n return this.strip();\n };\n\n BN.prototype.addn = function addn(num) {\n return this.clone().iaddn(num);\n };\n\n BN.prototype.subn = function subn(num) {\n return this.clone().isubn(num);\n };\n\n BN.prototype.iabs = function iabs() {\n this.negative = 0;\n return this;\n };\n\n BN.prototype.abs = function abs() {\n return this.clone().iabs();\n };\n\n BN.prototype._ishlnsubmul = function _ishlnsubmul(num, mul, shift) {\n var len = num.length + shift;\n var i;\n\n this._expand(len);\n\n var w;\n var carry = 0;\n\n for (i = 0; i < num.length; i++) {\n w = (this.words[i + shift] | 0) + carry;\n var right = (num.words[i] | 0) * mul;\n w -= right & 0x3ffffff;\n carry = (w >> 26) - (right / 0x4000000 | 0);\n this.words[i + shift] = w & 0x3ffffff;\n }\n\n for (; i < this.length - shift; i++) {\n w = (this.words[i + shift] | 0) + carry;\n carry = w >> 26;\n this.words[i + shift] = w & 0x3ffffff;\n }\n\n if (carry === 0) return this.strip(); // Subtraction overflow\n\n assert(carry === -1);\n carry = 0;\n\n for (i = 0; i < this.length; i++) {\n w = -(this.words[i] | 0) + carry;\n carry = w >> 26;\n this.words[i] = w & 0x3ffffff;\n }\n\n this.negative = 1;\n return this.strip();\n };\n\n BN.prototype._wordDiv = function _wordDiv(num, mode) {\n var shift = this.length - num.length;\n var a = this.clone();\n var b = num; // Normalize\n\n var bhi = b.words[b.length - 1] | 0;\n\n var bhiBits = this._countBits(bhi);\n\n shift = 26 - bhiBits;\n\n if (shift !== 0) {\n b = b.ushln(shift);\n a.iushln(shift);\n bhi = b.words[b.length - 1] | 0;\n } // Initialize quotient\n\n\n var m = a.length - b.length;\n var q;\n\n if (mode !== 'mod') {\n q = new BN(null);\n q.length = m + 1;\n q.words = new Array(q.length);\n\n for (var i = 0; i < q.length; i++) {\n q.words[i] = 0;\n }\n }\n\n var diff = a.clone()._ishlnsubmul(b, 1, m);\n\n if (diff.negative === 0) {\n a = diff;\n\n if (q) {\n q.words[m] = 1;\n }\n }\n\n for (var j = m - 1; j >= 0; j--) {\n var qj = (a.words[b.length + j] | 0) * 0x4000000 + (a.words[b.length + j - 1] | 0); // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max\n // (0x7ffffff)\n\n qj = Math.min(qj / bhi | 0, 0x3ffffff);\n\n a._ishlnsubmul(b, qj, j);\n\n while (a.negative !== 0) {\n qj--;\n a.negative = 0;\n\n a._ishlnsubmul(b, 1, j);\n\n if (!a.isZero()) {\n a.negative ^= 1;\n }\n }\n\n if (q) {\n q.words[j] = qj;\n }\n }\n\n if (q) {\n q.strip();\n }\n\n a.strip(); // Denormalize\n\n if (mode !== 'div' && shift !== 0) {\n a.iushrn(shift);\n }\n\n return {\n div: q || null,\n mod: a\n };\n }; // NOTE: 1) `mode` can be set to `mod` to request mod only,\n // to `div` to request div only, or be absent to\n // request both div & mod\n // 2) `positive` is true if unsigned mod is requested\n\n\n BN.prototype.divmod = function divmod(num, mode, positive) {\n assert(!num.isZero());\n\n if (this.isZero()) {\n return {\n div: new BN(0),\n mod: new BN(0)\n };\n }\n\n var div, mod, res;\n\n if (this.negative !== 0 && num.negative === 0) {\n res = this.neg().divmod(num, mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n\n if (positive && mod.negative !== 0) {\n mod.iadd(num);\n }\n }\n\n return {\n div: div,\n mod: mod\n };\n }\n\n if (this.negative === 0 && num.negative !== 0) {\n res = this.divmod(num.neg(), mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n return {\n div: div,\n mod: res.mod\n };\n }\n\n if ((this.negative & num.negative) !== 0) {\n res = this.neg().divmod(num.neg(), mode);\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n\n if (positive && mod.negative !== 0) {\n mod.isub(num);\n }\n }\n\n return {\n div: res.div,\n mod: mod\n };\n } // Both numbers are positive at this point\n // Strip both numbers to approximate shift value\n\n\n if (num.length > this.length || this.cmp(num) < 0) {\n return {\n div: new BN(0),\n mod: this\n };\n } // Very short reduction\n\n\n if (num.length === 1) {\n if (mode === 'div') {\n return {\n div: this.divn(num.words[0]),\n mod: null\n };\n }\n\n if (mode === 'mod') {\n return {\n div: null,\n mod: new BN(this.modn(num.words[0]))\n };\n }\n\n return {\n div: this.divn(num.words[0]),\n mod: new BN(this.modn(num.words[0]))\n };\n }\n\n return this._wordDiv(num, mode);\n }; // Find `this` / `num`\n\n\n BN.prototype.div = function div(num) {\n return this.divmod(num, 'div', false).div;\n }; // Find `this` % `num`\n\n\n BN.prototype.mod = function mod(num) {\n return this.divmod(num, 'mod', false).mod;\n };\n\n BN.prototype.umod = function umod(num) {\n return this.divmod(num, 'mod', true).mod;\n }; // Find Round(`this` / `num`)\n\n\n BN.prototype.divRound = function divRound(num) {\n var dm = this.divmod(num); // Fast case - exact division\n\n if (dm.mod.isZero()) return dm.div;\n var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;\n var half = num.ushrn(1);\n var r2 = num.andln(1);\n var cmp = mod.cmp(half); // Round down\n\n if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div; // Round up\n\n return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);\n };\n\n BN.prototype.modn = function modn(num) {\n assert(num <= 0x3ffffff);\n var p = (1 << 26) % num;\n var acc = 0;\n\n for (var i = this.length - 1; i >= 0; i--) {\n acc = (p * acc + (this.words[i] | 0)) % num;\n }\n\n return acc;\n }; // In-place division by number\n\n\n BN.prototype.idivn = function idivn(num) {\n assert(num <= 0x3ffffff);\n var carry = 0;\n\n for (var i = this.length - 1; i >= 0; i--) {\n var w = (this.words[i] | 0) + carry * 0x4000000;\n this.words[i] = w / num | 0;\n carry = w % num;\n }\n\n return this.strip();\n };\n\n BN.prototype.divn = function divn(num) {\n return this.clone().idivn(num);\n };\n\n BN.prototype.egcd = function egcd(p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n var x = this;\n var y = p.clone();\n\n if (x.negative !== 0) {\n x = x.umod(p);\n } else {\n x = x.clone();\n } // A * x + B * y = x\n\n\n var A = new BN(1);\n var B = new BN(0); // C * x + D * y = y\n\n var C = new BN(0);\n var D = new BN(1);\n var g = 0;\n\n while (x.isEven() && y.isEven()) {\n x.iushrn(1);\n y.iushrn(1);\n ++g;\n }\n\n var yp = y.clone();\n var xp = x.clone();\n\n while (!x.isZero()) {\n for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1) {\n ;\n }\n\n if (i > 0) {\n x.iushrn(i);\n\n while (i-- > 0) {\n if (A.isOdd() || B.isOdd()) {\n A.iadd(yp);\n B.isub(xp);\n }\n\n A.iushrn(1);\n B.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1) {\n ;\n }\n\n if (j > 0) {\n y.iushrn(j);\n\n while (j-- > 0) {\n if (C.isOdd() || D.isOdd()) {\n C.iadd(yp);\n D.isub(xp);\n }\n\n C.iushrn(1);\n D.iushrn(1);\n }\n }\n\n if (x.cmp(y) >= 0) {\n x.isub(y);\n A.isub(C);\n B.isub(D);\n } else {\n y.isub(x);\n C.isub(A);\n D.isub(B);\n }\n }\n\n return {\n a: C,\n b: D,\n gcd: y.iushln(g)\n };\n }; // This is reduced incarnation of the binary EEA\n // above, designated to invert members of the\n // _prime_ fields F(p) at a maximal speed\n\n\n BN.prototype._invmp = function _invmp(p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n var a = this;\n var b = p.clone();\n\n if (a.negative !== 0) {\n a = a.umod(p);\n } else {\n a = a.clone();\n }\n\n var x1 = new BN(1);\n var x2 = new BN(0);\n var delta = b.clone();\n\n while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {\n for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1) {\n ;\n }\n\n if (i > 0) {\n a.iushrn(i);\n\n while (i-- > 0) {\n if (x1.isOdd()) {\n x1.iadd(delta);\n }\n\n x1.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1) {\n ;\n }\n\n if (j > 0) {\n b.iushrn(j);\n\n while (j-- > 0) {\n if (x2.isOdd()) {\n x2.iadd(delta);\n }\n\n x2.iushrn(1);\n }\n }\n\n if (a.cmp(b) >= 0) {\n a.isub(b);\n x1.isub(x2);\n } else {\n b.isub(a);\n x2.isub(x1);\n }\n }\n\n var res;\n\n if (a.cmpn(1) === 0) {\n res = x1;\n } else {\n res = x2;\n }\n\n if (res.cmpn(0) < 0) {\n res.iadd(p);\n }\n\n return res;\n };\n\n BN.prototype.gcd = function gcd(num) {\n if (this.isZero()) return num.abs();\n if (num.isZero()) return this.abs();\n var a = this.clone();\n var b = num.clone();\n a.negative = 0;\n b.negative = 0; // Remove common factor of two\n\n for (var shift = 0; a.isEven() && b.isEven(); shift++) {\n a.iushrn(1);\n b.iushrn(1);\n }\n\n do {\n while (a.isEven()) {\n a.iushrn(1);\n }\n\n while (b.isEven()) {\n b.iushrn(1);\n }\n\n var r = a.cmp(b);\n\n if (r < 0) {\n // Swap `a` and `b` to make `a` always bigger than `b`\n var t = a;\n a = b;\n b = t;\n } else if (r === 0 || b.cmpn(1) === 0) {\n break;\n }\n\n a.isub(b);\n } while (true);\n\n return b.iushln(shift);\n }; // Invert number in the field F(num)\n\n\n BN.prototype.invm = function invm(num) {\n return this.egcd(num).a.umod(num);\n };\n\n BN.prototype.isEven = function isEven() {\n return (this.words[0] & 1) === 0;\n };\n\n BN.prototype.isOdd = function isOdd() {\n return (this.words[0] & 1) === 1;\n }; // And first word and num\n\n\n BN.prototype.andln = function andln(num) {\n return this.words[0] & num;\n }; // Increment at the bit position in-line\n\n\n BN.prototype.bincn = function bincn(bit) {\n assert(typeof bit === 'number');\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r; // Fast case: bit is much higher than all existing words\n\n if (this.length <= s) {\n this._expand(s + 1);\n\n this.words[s] |= q;\n return this;\n } // Add bit and propagate, if needed\n\n\n var carry = q;\n\n for (var i = s; carry !== 0 && i < this.length; i++) {\n var w = this.words[i] | 0;\n w += carry;\n carry = w >>> 26;\n w &= 0x3ffffff;\n this.words[i] = w;\n }\n\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n\n return this;\n };\n\n BN.prototype.isZero = function isZero() {\n return this.length === 1 && this.words[0] === 0;\n };\n\n BN.prototype.cmpn = function cmpn(num) {\n var negative = num < 0;\n if (this.negative !== 0 && !negative) return -1;\n if (this.negative === 0 && negative) return 1;\n this.strip();\n var res;\n\n if (this.length > 1) {\n res = 1;\n } else {\n if (negative) {\n num = -num;\n }\n\n assert(num <= 0x3ffffff, 'Number is too big');\n var w = this.words[0] | 0;\n res = w === num ? 0 : w < num ? -1 : 1;\n }\n\n if (this.negative !== 0) return -res | 0;\n return res;\n }; // Compare two numbers and return:\n // 1 - if `this` > `num`\n // 0 - if `this` == `num`\n // -1 - if `this` < `num`\n\n\n BN.prototype.cmp = function cmp(num) {\n if (this.negative !== 0 && num.negative === 0) return -1;\n if (this.negative === 0 && num.negative !== 0) return 1;\n var res = this.ucmp(num);\n if (this.negative !== 0) return -res | 0;\n return res;\n }; // Unsigned comparison\n\n\n BN.prototype.ucmp = function ucmp(num) {\n // At this point both numbers have the same sign\n if (this.length > num.length) return 1;\n if (this.length < num.length) return -1;\n var res = 0;\n\n for (var i = this.length - 1; i >= 0; i--) {\n var a = this.words[i] | 0;\n var b = num.words[i] | 0;\n if (a === b) continue;\n\n if (a < b) {\n res = -1;\n } else if (a > b) {\n res = 1;\n }\n\n break;\n }\n\n return res;\n };\n\n BN.prototype.gtn = function gtn(num) {\n return this.cmpn(num) === 1;\n };\n\n BN.prototype.gt = function gt(num) {\n return this.cmp(num) === 1;\n };\n\n BN.prototype.gten = function gten(num) {\n return this.cmpn(num) >= 0;\n };\n\n BN.prototype.gte = function gte(num) {\n return this.cmp(num) >= 0;\n };\n\n BN.prototype.ltn = function ltn(num) {\n return this.cmpn(num) === -1;\n };\n\n BN.prototype.lt = function lt(num) {\n return this.cmp(num) === -1;\n };\n\n BN.prototype.lten = function lten(num) {\n return this.cmpn(num) <= 0;\n };\n\n BN.prototype.lte = function lte(num) {\n return this.cmp(num) <= 0;\n };\n\n BN.prototype.eqn = function eqn(num) {\n return this.cmpn(num) === 0;\n };\n\n BN.prototype.eq = function eq(num) {\n return this.cmp(num) === 0;\n }; //\n // A reduce context, could be using montgomery or something better, depending\n // on the `m` itself.\n //\n\n\n BN.red = function red(num) {\n return new Red(num);\n };\n\n BN.prototype.toRed = function toRed(ctx) {\n assert(!this.red, 'Already a number in reduction context');\n assert(this.negative === 0, 'red works only with positives');\n return ctx.convertTo(this)._forceRed(ctx);\n };\n\n BN.prototype.fromRed = function fromRed() {\n assert(this.red, 'fromRed works only with numbers in reduction context');\n return this.red.convertFrom(this);\n };\n\n BN.prototype._forceRed = function _forceRed(ctx) {\n this.red = ctx;\n return this;\n };\n\n BN.prototype.forceRed = function forceRed(ctx) {\n assert(!this.red, 'Already a number in reduction context');\n return this._forceRed(ctx);\n };\n\n BN.prototype.redAdd = function redAdd(num) {\n assert(this.red, 'redAdd works only with red numbers');\n return this.red.add(this, num);\n };\n\n BN.prototype.redIAdd = function redIAdd(num) {\n assert(this.red, 'redIAdd works only with red numbers');\n return this.red.iadd(this, num);\n };\n\n BN.prototype.redSub = function redSub(num) {\n assert(this.red, 'redSub works only with red numbers');\n return this.red.sub(this, num);\n };\n\n BN.prototype.redISub = function redISub(num) {\n assert(this.red, 'redISub works only with red numbers');\n return this.red.isub(this, num);\n };\n\n BN.prototype.redShl = function redShl(num) {\n assert(this.red, 'redShl works only with red numbers');\n return this.red.shl(this, num);\n };\n\n BN.prototype.redMul = function redMul(num) {\n assert(this.red, 'redMul works only with red numbers');\n\n this.red._verify2(this, num);\n\n return this.red.mul(this, num);\n };\n\n BN.prototype.redIMul = function redIMul(num) {\n assert(this.red, 'redMul works only with red numbers');\n\n this.red._verify2(this, num);\n\n return this.red.imul(this, num);\n };\n\n BN.prototype.redSqr = function redSqr() {\n assert(this.red, 'redSqr works only with red numbers');\n\n this.red._verify1(this);\n\n return this.red.sqr(this);\n };\n\n BN.prototype.redISqr = function redISqr() {\n assert(this.red, 'redISqr works only with red numbers');\n\n this.red._verify1(this);\n\n return this.red.isqr(this);\n }; // Square root over p\n\n\n BN.prototype.redSqrt = function redSqrt() {\n assert(this.red, 'redSqrt works only with red numbers');\n\n this.red._verify1(this);\n\n return this.red.sqrt(this);\n };\n\n BN.prototype.redInvm = function redInvm() {\n assert(this.red, 'redInvm works only with red numbers');\n\n this.red._verify1(this);\n\n return this.red.invm(this);\n }; // Return negative clone of `this` % `red modulo`\n\n\n BN.prototype.redNeg = function redNeg() {\n assert(this.red, 'redNeg works only with red numbers');\n\n this.red._verify1(this);\n\n return this.red.neg(this);\n };\n\n BN.prototype.redPow = function redPow(num) {\n assert(this.red && !num.red, 'redPow(normalNum)');\n\n this.red._verify1(this);\n\n return this.red.pow(this, num);\n }; // Prime numbers with efficient reduction\n\n\n var primes = {\n k256: null,\n p224: null,\n p192: null,\n p25519: null\n }; // Pseudo-Mersenne prime\n\n function MPrime(name, p) {\n // P = 2 ^ N - K\n this.name = name;\n this.p = new BN(p, 16);\n this.n = this.p.bitLength();\n this.k = new BN(1).iushln(this.n).isub(this.p);\n this.tmp = this._tmp();\n }\n\n MPrime.prototype._tmp = function _tmp() {\n var tmp = new BN(null);\n tmp.words = new Array(Math.ceil(this.n / 13));\n return tmp;\n };\n\n MPrime.prototype.ireduce = function ireduce(num) {\n // Assumes that `num` is less than `P^2`\n // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)\n var r = num;\n var rlen;\n\n do {\n this.split(r, this.tmp);\n r = this.imulK(r);\n r = r.iadd(this.tmp);\n rlen = r.bitLength();\n } while (rlen > this.n);\n\n var cmp = rlen < this.n ? -1 : r.ucmp(this.p);\n\n if (cmp === 0) {\n r.words[0] = 0;\n r.length = 1;\n } else if (cmp > 0) {\n r.isub(this.p);\n } else {\n if (r.strip !== undefined) {\n // r is BN v4 instance\n r.strip();\n } else {\n // r is BN v5 instance\n r._strip();\n }\n }\n\n return r;\n };\n\n MPrime.prototype.split = function split(input, out) {\n input.iushrn(this.n, 0, out);\n };\n\n MPrime.prototype.imulK = function imulK(num) {\n return num.imul(this.k);\n };\n\n function K256() {\n MPrime.call(this, 'k256', 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');\n }\n\n inherits(K256, MPrime);\n\n K256.prototype.split = function split(input, output) {\n // 256 = 9 * 26 + 22\n var mask = 0x3fffff;\n var outLen = Math.min(input.length, 9);\n\n for (var i = 0; i < outLen; i++) {\n output.words[i] = input.words[i];\n }\n\n output.length = outLen;\n\n if (input.length <= 9) {\n input.words[0] = 0;\n input.length = 1;\n return;\n } // Shift by 9 limbs\n\n\n var prev = input.words[9];\n output.words[output.length++] = prev & mask;\n\n for (i = 10; i < input.length; i++) {\n var next = input.words[i] | 0;\n input.words[i - 10] = (next & mask) << 4 | prev >>> 22;\n prev = next;\n }\n\n prev >>>= 22;\n input.words[i - 10] = prev;\n\n if (prev === 0 && input.length > 10) {\n input.length -= 10;\n } else {\n input.length -= 9;\n }\n };\n\n K256.prototype.imulK = function imulK(num) {\n // K = 0x1000003d1 = [ 0x40, 0x3d1 ]\n num.words[num.length] = 0;\n num.words[num.length + 1] = 0;\n num.length += 2; // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390\n\n var lo = 0;\n\n for (var i = 0; i < num.length; i++) {\n var w = num.words[i] | 0;\n lo += w * 0x3d1;\n num.words[i] = lo & 0x3ffffff;\n lo = w * 0x40 + (lo / 0x4000000 | 0);\n } // Fast length reduction\n\n\n if (num.words[num.length - 1] === 0) {\n num.length--;\n\n if (num.words[num.length - 1] === 0) {\n num.length--;\n }\n }\n\n return num;\n };\n\n function P224() {\n MPrime.call(this, 'p224', 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');\n }\n\n inherits(P224, MPrime);\n\n function P192() {\n MPrime.call(this, 'p192', 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');\n }\n\n inherits(P192, MPrime);\n\n function P25519() {\n // 2 ^ 255 - 19\n MPrime.call(this, '25519', '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');\n }\n\n inherits(P25519, MPrime);\n\n P25519.prototype.imulK = function imulK(num) {\n // K = 0x13\n var carry = 0;\n\n for (var i = 0; i < num.length; i++) {\n var hi = (num.words[i] | 0) * 0x13 + carry;\n var lo = hi & 0x3ffffff;\n hi >>>= 26;\n num.words[i] = lo;\n carry = hi;\n }\n\n if (carry !== 0) {\n num.words[num.length++] = carry;\n }\n\n return num;\n }; // Exported mostly for testing purposes, use plain name instead\n\n\n BN._prime = function prime(name) {\n // Cached version of prime\n if (primes[name]) return primes[name];\n var prime;\n\n if (name === 'k256') {\n prime = new K256();\n } else if (name === 'p224') {\n prime = new P224();\n } else if (name === 'p192') {\n prime = new P192();\n } else if (name === 'p25519') {\n prime = new P25519();\n } else {\n throw new Error('Unknown prime ' + name);\n }\n\n primes[name] = prime;\n return prime;\n }; //\n // Base reduction engine\n //\n\n\n function Red(m) {\n if (typeof m === 'string') {\n var prime = BN._prime(m);\n\n this.m = prime.p;\n this.prime = prime;\n } else {\n assert(m.gtn(1), 'modulus must be greater than 1');\n this.m = m;\n this.prime = null;\n }\n }\n\n Red.prototype._verify1 = function _verify1(a) {\n assert(a.negative === 0, 'red works only with positives');\n assert(a.red, 'red works only with red numbers');\n };\n\n Red.prototype._verify2 = function _verify2(a, b) {\n assert((a.negative | b.negative) === 0, 'red works only with positives');\n assert(a.red && a.red === b.red, 'red works only with red numbers');\n };\n\n Red.prototype.imod = function imod(a) {\n if (this.prime) return this.prime.ireduce(a)._forceRed(this);\n return a.umod(this.m)._forceRed(this);\n };\n\n Red.prototype.neg = function neg(a) {\n if (a.isZero()) {\n return a.clone();\n }\n\n return this.m.sub(a)._forceRed(this);\n };\n\n Red.prototype.add = function add(a, b) {\n this._verify2(a, b);\n\n var res = a.add(b);\n\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Red.prototype.iadd = function iadd(a, b) {\n this._verify2(a, b);\n\n var res = a.iadd(b);\n\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n\n return res;\n };\n\n Red.prototype.sub = function sub(a, b) {\n this._verify2(a, b);\n\n var res = a.sub(b);\n\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Red.prototype.isub = function isub(a, b) {\n this._verify2(a, b);\n\n var res = a.isub(b);\n\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n\n return res;\n };\n\n Red.prototype.shl = function shl(a, num) {\n this._verify1(a);\n\n return this.imod(a.ushln(num));\n };\n\n Red.prototype.imul = function imul(a, b) {\n this._verify2(a, b);\n\n return this.imod(a.imul(b));\n };\n\n Red.prototype.mul = function mul(a, b) {\n this._verify2(a, b);\n\n return this.imod(a.mul(b));\n };\n\n Red.prototype.isqr = function isqr(a) {\n return this.imul(a, a.clone());\n };\n\n Red.prototype.sqr = function sqr(a) {\n return this.mul(a, a);\n };\n\n Red.prototype.sqrt = function sqrt(a) {\n if (a.isZero()) return a.clone();\n var mod3 = this.m.andln(3);\n assert(mod3 % 2 === 1); // Fast case\n\n if (mod3 === 3) {\n var pow = this.m.add(new BN(1)).iushrn(2);\n return this.pow(a, pow);\n } // Tonelli-Shanks algorithm (Totally unoptimized and slow)\n //\n // Find Q and S, that Q * 2 ^ S = (P - 1)\n\n\n var q = this.m.subn(1);\n var s = 0;\n\n while (!q.isZero() && q.andln(1) === 0) {\n s++;\n q.iushrn(1);\n }\n\n assert(!q.isZero());\n var one = new BN(1).toRed(this);\n var nOne = one.redNeg(); // Find quadratic non-residue\n // NOTE: Max is such because of generalized Riemann hypothesis.\n\n var lpow = this.m.subn(1).iushrn(1);\n var z = this.m.bitLength();\n z = new BN(2 * z * z).toRed(this);\n\n while (this.pow(z, lpow).cmp(nOne) !== 0) {\n z.redIAdd(nOne);\n }\n\n var c = this.pow(z, q);\n var r = this.pow(a, q.addn(1).iushrn(1));\n var t = this.pow(a, q);\n var m = s;\n\n while (t.cmp(one) !== 0) {\n var tmp = t;\n\n for (var i = 0; tmp.cmp(one) !== 0; i++) {\n tmp = tmp.redSqr();\n }\n\n assert(i < m);\n var b = this.pow(c, new BN(1).iushln(m - i - 1));\n r = r.redMul(b);\n c = b.redSqr();\n t = t.redMul(c);\n m = i;\n }\n\n return r;\n };\n\n Red.prototype.invm = function invm(a) {\n var inv = a._invmp(this.m);\n\n if (inv.negative !== 0) {\n inv.negative = 0;\n return this.imod(inv).redNeg();\n } else {\n return this.imod(inv);\n }\n };\n\n Red.prototype.pow = function pow(a, num) {\n if (num.isZero()) return new BN(1).toRed(this);\n if (num.cmpn(1) === 0) return a.clone();\n var windowSize = 4;\n var wnd = new Array(1 << windowSize);\n wnd[0] = new BN(1).toRed(this);\n wnd[1] = a;\n\n for (var i = 2; i < wnd.length; i++) {\n wnd[i] = this.mul(wnd[i - 1], a);\n }\n\n var res = wnd[0];\n var current = 0;\n var currentLen = 0;\n var start = num.bitLength() % 26;\n\n if (start === 0) {\n start = 26;\n }\n\n for (i = num.length - 1; i >= 0; i--) {\n var word = num.words[i];\n\n for (var j = start - 1; j >= 0; j--) {\n var bit = word >> j & 1;\n\n if (res !== wnd[0]) {\n res = this.sqr(res);\n }\n\n if (bit === 0 && current === 0) {\n currentLen = 0;\n continue;\n }\n\n current <<= 1;\n current |= bit;\n currentLen++;\n if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;\n res = this.mul(res, wnd[current]);\n currentLen = 0;\n current = 0;\n }\n\n start = 26;\n }\n\n return res;\n };\n\n Red.prototype.convertTo = function convertTo(num) {\n var r = num.umod(this.m);\n return r === num ? r.clone() : r;\n };\n\n Red.prototype.convertFrom = function convertFrom(num) {\n var res = num.clone();\n res.red = null;\n return res;\n }; //\n // Montgomery method engine\n //\n\n\n BN.mont = function mont(num) {\n return new Mont(num);\n };\n\n function Mont(m) {\n Red.call(this, m);\n this.shift = this.m.bitLength();\n\n if (this.shift % 26 !== 0) {\n this.shift += 26 - this.shift % 26;\n }\n\n this.r = new BN(1).iushln(this.shift);\n this.r2 = this.imod(this.r.sqr());\n this.rinv = this.r._invmp(this.m);\n this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);\n this.minv = this.minv.umod(this.r);\n this.minv = this.r.sub(this.minv);\n }\n\n inherits(Mont, Red);\n\n Mont.prototype.convertTo = function convertTo(num) {\n return this.imod(num.ushln(this.shift));\n };\n\n Mont.prototype.convertFrom = function convertFrom(num) {\n var r = this.imod(num.mul(this.rinv));\n r.red = null;\n return r;\n };\n\n Mont.prototype.imul = function imul(a, b) {\n if (a.isZero() || b.isZero()) {\n a.words[0] = 0;\n a.length = 1;\n return a;\n }\n\n var t = a.imul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.mul = function mul(a, b) {\n if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);\n var t = a.mul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.invm = function invm(a) {\n // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R\n var res = this.imod(a._invmp(this.m).mul(this.r2));\n return res._forceRed(this);\n };\n})(typeof module === 'undefined' || module, this);","exports.encrypt = function (self, block) {\n return self._cipher.encryptBlock(block);\n};\n\nexports.decrypt = function (self, block) {\n return self._cipher.decryptBlock(block);\n};","'use strict';\n\nvar assert = require('minimalistic-assert');\n\nfunction Cipher(options) {\n this.options = options;\n this.type = this.options.type;\n this.blockSize = 8;\n\n this._init();\n\n this.buffer = new Array(this.blockSize);\n this.bufferOff = 0;\n}\n\nmodule.exports = Cipher;\n\nCipher.prototype._init = function _init() {// Might be overrided\n};\n\nCipher.prototype.update = function update(data) {\n if (data.length === 0) return [];\n if (this.type === 'decrypt') return this._updateDecrypt(data);else return this._updateEncrypt(data);\n};\n\nCipher.prototype._buffer = function _buffer(data, off) {\n // Append data to buffer\n var min = Math.min(this.buffer.length - this.bufferOff, data.length - off);\n\n for (var i = 0; i < min; i++) {\n this.buffer[this.bufferOff + i] = data[off + i];\n }\n\n this.bufferOff += min; // Shift next\n\n return min;\n};\n\nCipher.prototype._flushBuffer = function _flushBuffer(out, off) {\n this._update(this.buffer, 0, out, off);\n\n this.bufferOff = 0;\n return this.blockSize;\n};\n\nCipher.prototype._updateEncrypt = function _updateEncrypt(data) {\n var inputOff = 0;\n var outputOff = 0;\n var count = (this.bufferOff + data.length) / this.blockSize | 0;\n var out = new Array(count * this.blockSize);\n\n if (this.bufferOff !== 0) {\n inputOff += this._buffer(data, inputOff);\n if (this.bufferOff === this.buffer.length) outputOff += this._flushBuffer(out, outputOff);\n } // Write blocks\n\n\n var max = data.length - (data.length - inputOff) % this.blockSize;\n\n for (; inputOff < max; inputOff += this.blockSize) {\n this._update(data, inputOff, out, outputOff);\n\n outputOff += this.blockSize;\n } // Queue rest\n\n\n for (; inputOff < data.length; inputOff++, this.bufferOff++) {\n this.buffer[this.bufferOff] = data[inputOff];\n }\n\n return out;\n};\n\nCipher.prototype._updateDecrypt = function _updateDecrypt(data) {\n var inputOff = 0;\n var outputOff = 0;\n var count = Math.ceil((this.bufferOff + data.length) / this.blockSize) - 1;\n var out = new Array(count * this.blockSize); // TODO(indutny): optimize it, this is far from optimal\n\n for (; count > 0; count--) {\n inputOff += this._buffer(data, inputOff);\n outputOff += this._flushBuffer(out, outputOff);\n } // Buffer rest of the input\n\n\n inputOff += this._buffer(data, inputOff);\n return out;\n};\n\nCipher.prototype.final = function final(buffer) {\n var first;\n if (buffer) first = this.update(buffer);\n var last;\n if (this.type === 'encrypt') last = this._finalEncrypt();else last = this._finalDecrypt();\n if (first) return first.concat(last);else return last;\n};\n\nCipher.prototype._pad = function _pad(buffer, off) {\n if (off === 0) return false;\n\n while (off < buffer.length) {\n buffer[off++] = 0;\n }\n\n return true;\n};\n\nCipher.prototype._finalEncrypt = function _finalEncrypt() {\n if (!this._pad(this.buffer, this.bufferOff)) return [];\n var out = new Array(this.blockSize);\n\n this._update(this.buffer, 0, out, 0);\n\n return out;\n};\n\nCipher.prototype._unpad = function _unpad(buffer) {\n return buffer;\n};\n\nCipher.prototype._finalDecrypt = function _finalDecrypt() {\n assert.equal(this.bufferOff, this.blockSize, 'Not enough data to decrypt');\n var out = new Array(this.blockSize);\n\n this._flushBuffer(out, 0);\n\n return this._unpad(out);\n};","'use strict';\n\nvar constants = exports; // Helper\n\nconstants._reverse = function reverse(map) {\n var res = {};\n Object.keys(map).forEach(function (key) {\n // Convert key to integer if it is stringified\n if ((key | 0) == key) key = key | 0;\n var value = map[key];\n res[value] = key;\n });\n return res;\n};\n\nconstants.der = require('./der');","import React, { useState, useEffect } from \"react\"\nimport { Modal } from \"react-bootstrap\"\nimport { STATUSES } from \"../FormContainer\"\nimport Icon from \"../../Icon\"\n\nconst InfoModal = ({\n children,\n title,\n subtitle,\n description,\n Trigger,\n status,\n setStatus,\n banner,\n onExit,\n className,\n dialogClassName,\n isOpen,\n scrollable,\n dialog,\n centered\n}) => {\n const [show, setShow] = useState(false)\n const toggleModal = () => setShow(!show)\n\n useEffect(() => {\n if (status === STATUSES.success && show === true) {\n setStatus(null)\n toggleModal()\n }\n })\n\n useEffect(() => {\n if (isOpen !== undefined) setShow(isOpen)\n }, [isOpen])\n \n return (\n <>\n {Trigger && }\n \n \n {banner && (\n \n {banner}\n \n )}\n \n \n {subtitle}\n \n \n {title}\n \n {description && (\n
{description}
\n )}\n {children}\n \n \n >\n )\n}\n\nexport default InfoModal\n","import { navigate } from \"gatsby-plugin-intl\"\n\nconst ROUTES = {\n ACCOUNT_ADD: { path: \"/account-add/\" },\n ACCOUNT_DETAILS: { path: \"/account-details/:id\" },\n ACCOUNTS: { path: \"/accounts\" },\n BILLING: { path: \"/billing\" },\n BILLING_CHECKOUT: { path: \"/billing/checkout/:item_price_id\" },\n BILLING_CHECKOUT_SUCCESS: { path: \"/billing/checkout/success\" },\n BILLING_PLANS: { path: \"/billing/plans\" },\n BOOK_MEETING: { path: \"/meeting/book\" },\n CONNECT: { path: \"/connect/\" },\n CONNECTORS: { path: \"/connectors\" },\n CONNECTOR_INSTALLER: { path: \"/connector/install/:connectorId\" },\n DASHBOARD: { path: \"/dashboard\" },\n EDIT_INTEGRATION: { path: \"/integrations/:id/edit\" },\n INTEGRATIONS: { path: \"/integrations\" },\n LOCALES: { path: \"/settings/locales\" },\n NEW_INTEGRATION: { path: \"/integrations/:type/new\" },\n NEW_PROJECT: { path: \"/projects/new\" },\n NEW_PROJECT_CONNECTOR: { path: \"/projects/new/connector/:id\" },\n PROFILE: { path: \"/profile\" },\n PROJECT: { path: \"/projects/:id\" },\n ROOT: { path: \"/\" },\n SETTINGS: { path: \"/settings\" },\n GENERAL: { path: \"/general\" },\n SHOPIFY_CALLBACK: { path: \"/shopify/callback\" },\n SIGN_IN: { path: \"/signin\" },\n SIGN_UP: { path: \"/signup\" },\n TEAM: { path: \"/team\" },\n PARTNER_REDIRECT: { path: \"/protemos/:partnerID\" },\n PARTNER_ABOUT_YOUR_TEAM: { path: \"/protemos\" },\n UPGRADE_PLAN: { path: \"/settings/plans/\" },\n PLANS: { path: \"/plans/\" },\n PLAN_CHECKOUT: { path: \"/plans/:item_price_id/checkout\" },\n}\n\nexport const path = (routeName, params = {}) => {\n if (!ROUTES[routeName]) throw new Error(\"Route undefined\", routeName)\n const path = path_params_substitution(ROUTES[routeName].path, params)\n return path\n}\n\nexport const redirect = (routeName, params = {}, options = {}) => {\n navigate(path(routeName, params), options)\n}\n\nexport function path_params_substitution(path, params) {\n Object.entries(params).forEach(([key, value]) => {\n path = path.replace(new RegExp(`:${key}`), value)\n })\n return path\n}\n\nexport default ROUTES\n","'use strict';\n\nvar utils = require('../utils');\n\nvar SHA256 = require('./256');\n\nfunction SHA224() {\n if (!(this instanceof SHA224)) return new SHA224();\n SHA256.call(this);\n this.h = [0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4];\n}\n\nutils.inherits(SHA224, SHA256);\nmodule.exports = SHA224;\nSHA224.blockSize = 512;\nSHA224.outSize = 224;\nSHA224.hmacStrength = 192;\nSHA224.padLength = 64;\n\nSHA224.prototype._digest = function digest(enc) {\n // Just truncate output\n if (enc === 'hex') return utils.toHex32(this.h.slice(0, 7), 'big');else return utils.split32(this.h.slice(0, 7), 'big');\n};","import ReactDOM from 'react-dom';\nexport default function safeFindDOMNode(componentOrElement) {\n if (componentOrElement && 'setState' in componentOrElement) {\n return ReactDOM.findDOMNode(componentOrElement);\n }\n\n return componentOrElement != null ? componentOrElement : null;\n}","var arrayLikeToArray = require(\"./arrayLikeToArray\");\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}\n\nmodule.exports = _unsupportedIterableToArray;","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isRequiredForA11y;\n\nfunction isRequiredForA11y(validator) {\n return function validate(props, propName, componentName, location, propFullName) {\n var componentNameSafe = componentName || '<>';\n var propFullNameSafe = propFullName || propName;\n\n if (props[propName] == null) {\n return new Error('The ' + location + ' `' + propFullNameSafe + '` is required to make ' + ('`' + componentNameSafe + '` accessible for users of assistive ') + 'technologies such as screen readers.');\n }\n\n for (var _len = arguments.length, args = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) {\n args[_key - 5] = arguments[_key];\n }\n\n return validator.apply(undefined, [props, propName, componentName, location, propFullName].concat(args));\n };\n}\n\nmodule.exports = exports['default'];","var SHORT_TO_HEX = {};\nvar HEX_TO_SHORT = {};\n\nfor (var i = 0; i < 256; i++) {\n var encodedByte = i.toString(16).toLowerCase();\n\n if (encodedByte.length === 1) {\n encodedByte = \"0\" + encodedByte;\n }\n\n SHORT_TO_HEX[i] = encodedByte;\n HEX_TO_SHORT[encodedByte] = i;\n}\n/**\n * Converts a hexadecimal encoded string to a Uint8Array of bytes.\n *\n * @param encoded The hexadecimal encoded string\n */\n\n\nexport function fromHex(encoded) {\n if (encoded.length % 2 !== 0) {\n throw new Error(\"Hex encoded strings must have an even number length\");\n }\n\n var out = new Uint8Array(encoded.length / 2);\n\n for (var i = 0; i < encoded.length; i += 2) {\n var encodedByte = encoded.substr(i, 2).toLowerCase();\n\n if (encodedByte in HEX_TO_SHORT) {\n out[i / 2] = HEX_TO_SHORT[encodedByte];\n } else {\n throw new Error(\"Cannot decode unrecognized sequence \" + encodedByte + \" as hexadecimal\");\n }\n }\n\n return out;\n}\n/**\n * Converts a Uint8Array of binary data to a hexadecimal encoded string.\n *\n * @param bytes The binary data to encode\n */\n\nexport function toHex(bytes) {\n var out = \"\";\n\n for (var i = 0; i < bytes.byteLength; i++) {\n out += SHORT_TO_HEX[bytes[i]];\n }\n\n return out;\n}","'use strict';\n\nvar ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE;\n\nfunction highWaterMarkFrom(options, isDuplex, duplexKey) {\n return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;\n}\n\nfunction getHighWaterMark(state, options, duplexKey, isDuplex) {\n var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);\n\n if (hwm != null) {\n if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {\n var name = isDuplex ? duplexKey : 'highWaterMark';\n throw new ERR_INVALID_OPT_VALUE(name, hwm);\n }\n\n return Math.floor(hwm);\n } // Default value\n\n\n return state.objectMode ? 16 : 16 * 1024;\n}\n\nmodule.exports = {\n getHighWaterMark: getHighWaterMark\n};","/*! safe-buffer. MIT License. Feross Aboukhadijeh */\n\n/* eslint-disable node/no-deprecated-api */\nvar buffer = require('buffer');\n\nvar Buffer = buffer.Buffer; // alternative to using Object.keys for old browsers\n\nfunction copyProps(src, dst) {\n for (var key in src) {\n dst[key] = src[key];\n }\n}\n\nif (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {\n module.exports = buffer;\n} else {\n // Copy properties from require('buffer')\n copyProps(buffer, exports);\n exports.Buffer = SafeBuffer;\n}\n\nfunction SafeBuffer(arg, encodingOrOffset, length) {\n return Buffer(arg, encodingOrOffset, length);\n}\n\nSafeBuffer.prototype = Object.create(Buffer.prototype); // Copy static methods from Buffer\n\ncopyProps(Buffer, SafeBuffer);\n\nSafeBuffer.from = function (arg, encodingOrOffset, length) {\n if (typeof arg === 'number') {\n throw new TypeError('Argument must not be a number');\n }\n\n return Buffer(arg, encodingOrOffset, length);\n};\n\nSafeBuffer.alloc = function (size, fill, encoding) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number');\n }\n\n var buf = Buffer(size);\n\n if (fill !== undefined) {\n if (typeof encoding === 'string') {\n buf.fill(fill, encoding);\n } else {\n buf.fill(fill);\n }\n } else {\n buf.fill(0);\n }\n\n return buf;\n};\n\nSafeBuffer.allocUnsafe = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number');\n }\n\n return Buffer(size);\n};\n\nSafeBuffer.allocUnsafeSlow = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number');\n }\n\n return buffer.SlowBuffer(size);\n};","exports['des-ecb'] = {\n key: 8,\n iv: 0\n};\nexports['des-cbc'] = exports.des = {\n key: 8,\n iv: 8\n};\nexports['des-ede3-cbc'] = exports.des3 = {\n key: 24,\n iv: 8\n};\nexports['des-ede3'] = {\n key: 24,\n iv: 0\n};\nexports['des-ede-cbc'] = {\n key: 16,\n iv: 8\n};\nexports['des-ede'] = {\n key: 16,\n iv: 0\n};","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar pureJs_1 = require(\"./pureJs\");\n\nvar whatwgEncodingApi_1 = require(\"./whatwgEncodingApi\");\n\nfunction fromUtf8(input) {\n if (typeof TextEncoder === \"function\") {\n return whatwgEncodingApi_1.fromUtf8(input);\n }\n\n return pureJs_1.fromUtf8(input);\n}\n\nexports.fromUtf8 = fromUtf8;\n\nfunction toUtf8(input) {\n if (typeof TextDecoder === \"function\") {\n return whatwgEncodingApi_1.toUtf8(input);\n }\n\n return pureJs_1.toUtf8(input);\n}\n\nexports.toUtf8 = toUtf8;","import Cookies from 'universal-cookie';\nimport { browserOrNode } from '../JS';\nvar isBrowser = browserOrNode().isBrowser;\n\nvar UniversalStorage =\n/** @class */\nfunction () {\n function UniversalStorage(context) {\n if (context === void 0) {\n context = {};\n }\n\n this.cookies = new Cookies();\n this.store = isBrowser ? window.localStorage : Object.create(null);\n this.cookies = context.req ? new Cookies(context.req.headers.cookie) : new Cookies();\n Object.assign(this.store, this.cookies.getAll());\n }\n\n Object.defineProperty(UniversalStorage.prototype, \"length\", {\n get: function get() {\n return Object.entries(this.store).length;\n },\n enumerable: true,\n configurable: true\n });\n\n UniversalStorage.prototype.clear = function () {\n var _this = this;\n\n Array.from(new Array(this.length)).map(function (_, i) {\n return _this.key(i);\n }).forEach(function (key) {\n return _this.removeItem(key);\n });\n };\n\n UniversalStorage.prototype.getItem = function (key) {\n return this.getLocalItem(key);\n };\n\n UniversalStorage.prototype.getLocalItem = function (key) {\n return Object.prototype.hasOwnProperty.call(this.store, key) ? this.store[key] : null;\n };\n\n UniversalStorage.prototype.getUniversalItem = function (key) {\n return this.cookies.get(key);\n };\n\n UniversalStorage.prototype.key = function (index) {\n return Object.keys(this.store)[index];\n };\n\n UniversalStorage.prototype.removeItem = function (key) {\n this.removeLocalItem(key);\n this.removeUniversalItem(key);\n };\n\n UniversalStorage.prototype.removeLocalItem = function (key) {\n delete this.store[key];\n };\n\n UniversalStorage.prototype.removeUniversalItem = function (key) {\n this.cookies.remove(key, {\n path: '/'\n });\n };\n\n UniversalStorage.prototype.setItem = function (key, value) {\n this.setLocalItem(key, value); // keys take the shape:\n // 1. `${ProviderPrefix}.${userPoolClientId}.${username}.${tokenType}\n // 2. `${ProviderPrefix}.${userPoolClientId}.LastAuthUser\n\n var tokenType = key.split('.').pop();\n\n switch (tokenType) {\n // LastAuthUser is needed for computing other key names\n case 'LastAuthUser': // accessToken is required for CognitoUserSession\n\n case 'accessToken': // Required for CognitoUserSession\n\n case 'idToken':\n this.setUniversalItem(key, value);\n // userData is used when `Auth.currentAuthenticatedUser({ bypassCache: false })`.\n // Can be persisted to speed up calls to `Auth.currentAuthenticatedUser()`\n // case 'userData':\n // refreshToken isn't shared with the server so that the client handles refreshing\n // case 'refreshToken':\n // Ignoring clockDrift on the server for now, but needs testing\n // case 'clockDrift':\n }\n };\n\n UniversalStorage.prototype.setLocalItem = function (key, value) {\n this.store[key] = value;\n };\n\n UniversalStorage.prototype.setUniversalItem = function (key, value) {\n this.cookies.set(key, value, {\n path: '/',\n // `httpOnly` cannot be set via JavaScript: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#JavaScript_access_using_Document.cookie\n sameSite: true,\n // Allow unsecure requests to http://localhost:3000/ when in development.\n secure: window.location.hostname === 'localhost' ? false : true\n });\n };\n\n return UniversalStorage;\n}();\n\nexport { UniversalStorage };","/*\n * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined\n * in FIPS PUB 180-1\n * This source code is derived from sha1.js of the same repository.\n * The difference between SHA-0 and SHA-1 is just a bitwise rotate left\n * operation was added.\n */\nvar inherits = require('inherits');\n\nvar Hash = require('./hash');\n\nvar Buffer = require('safe-buffer').Buffer;\n\nvar K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0];\nvar W = new Array(80);\n\nfunction Sha() {\n this.init();\n this._w = W;\n Hash.call(this, 64, 56);\n}\n\ninherits(Sha, Hash);\n\nSha.prototype.init = function () {\n this._a = 0x67452301;\n this._b = 0xefcdab89;\n this._c = 0x98badcfe;\n this._d = 0x10325476;\n this._e = 0xc3d2e1f0;\n return this;\n};\n\nfunction rotl5(num) {\n return num << 5 | num >>> 27;\n}\n\nfunction rotl30(num) {\n return num << 30 | num >>> 2;\n}\n\nfunction ft(s, b, c, d) {\n if (s === 0) return b & c | ~b & d;\n if (s === 2) return b & c | b & d | c & d;\n return b ^ c ^ d;\n}\n\nSha.prototype._update = function (M) {\n var W = this._w;\n var a = this._a | 0;\n var b = this._b | 0;\n var c = this._c | 0;\n var d = this._d | 0;\n var e = this._e | 0;\n\n for (var i = 0; i < 16; ++i) {\n W[i] = M.readInt32BE(i * 4);\n }\n\n for (; i < 80; ++i) {\n W[i] = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];\n }\n\n for (var j = 0; j < 80; ++j) {\n var s = ~~(j / 20);\n var t = rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s] | 0;\n e = d;\n d = c;\n c = rotl30(b);\n b = a;\n a = t;\n }\n\n this._a = a + this._a | 0;\n this._b = b + this._b | 0;\n this._c = c + this._c | 0;\n this._d = d + this._d | 0;\n this._e = e + this._e | 0;\n};\n\nSha.prototype._hash = function () {\n var H = Buffer.allocUnsafe(20);\n H.writeInt32BE(this._a | 0, 0);\n H.writeInt32BE(this._b | 0, 4);\n H.writeInt32BE(this._c | 0, 8);\n H.writeInt32BE(this._d | 0, 12);\n H.writeInt32BE(this._e | 0, 16);\n return H;\n};\n\nmodule.exports = Sha;","import { dynamicRequire, fill, logger } from '@sentry/utils';\n/** Tracing integration for node-postgres package */\n\nvar Postgres =\n/** @class */\nfunction () {\n function Postgres() {\n /**\n * @inheritDoc\n */\n this.name = Postgres.id;\n }\n /**\n * @inheritDoc\n */\n\n\n Postgres.prototype.setupOnce = function (_, getCurrentHub) {\n var client;\n\n try {\n var pgModule = dynamicRequire(module, 'pg');\n client = pgModule.Client;\n } catch (e) {\n logger.error('Postgres Integration was unable to require `pg` package.');\n return;\n }\n /**\n * function (query, callback) => void\n * function (query, params, callback) => void\n * function (query) => Promise\n * function (query, params) => Promise\n */\n\n\n fill(client.prototype, 'query', function (orig) {\n return function (config, values, callback) {\n var _a, _b;\n\n var scope = getCurrentHub().getScope();\n var parentSpan = (_a = scope) === null || _a === void 0 ? void 0 : _a.getSpan();\n var span = (_b = parentSpan) === null || _b === void 0 ? void 0 : _b.startChild({\n description: typeof config === 'string' ? config : config.text,\n op: \"db\"\n });\n\n if (typeof callback === 'function') {\n return orig.call(this, config, values, function (err, result) {\n var _a;\n\n (_a = span) === null || _a === void 0 ? void 0 : _a.finish();\n callback(err, result);\n });\n }\n\n if (typeof values === 'function') {\n return orig.call(this, config, function (err, result) {\n var _a;\n\n (_a = span) === null || _a === void 0 ? void 0 : _a.finish();\n values(err, result);\n });\n }\n\n return orig.call(this, config, values).then(function (res) {\n var _a;\n\n (_a = span) === null || _a === void 0 ? void 0 : _a.finish();\n return res;\n });\n };\n });\n };\n /**\n * @inheritDoc\n */\n\n\n Postgres.id = 'Postgres';\n return Postgres;\n}();\n\nexport { Postgres };","module.exports = require('./lib/_stream_duplex.js');","var obj;\nvar NOTHING = typeof Symbol !== \"undefined\" ? Symbol(\"immer-nothing\") : (obj = {}, obj[\"immer-nothing\"] = true, obj);\nvar DRAFTABLE = typeof Symbol !== \"undefined\" && Symbol.for ? Symbol.for(\"immer-draftable\") : \"__$immer_draftable\";\nvar DRAFT_STATE = typeof Symbol !== \"undefined\" && Symbol.for ? Symbol.for(\"immer-state\") : \"__$immer_state\";\n\nfunction isDraft(value) {\n return !!value && !!value[DRAFT_STATE];\n}\n\nfunction isDraftable(value) {\n if (!value || typeof value !== \"object\") {\n return false;\n }\n\n if (Array.isArray(value)) {\n return true;\n }\n\n var proto = Object.getPrototypeOf(value);\n\n if (!proto || proto === Object.prototype) {\n return true;\n }\n\n return !!value[DRAFTABLE] || !!value.constructor[DRAFTABLE];\n}\n\nfunction original(value) {\n if (value && value[DRAFT_STATE]) {\n return value[DRAFT_STATE].base;\n } // otherwise return undefined\n\n}\n\nvar assign = Object.assign || function assign(target, value) {\n for (var key in value) {\n if (has(value, key)) {\n target[key] = value[key];\n }\n }\n\n return target;\n};\n\nvar ownKeys = typeof Reflect !== \"undefined\" && Reflect.ownKeys ? Reflect.ownKeys : typeof Object.getOwnPropertySymbols !== \"undefined\" ? function (obj) {\n return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj));\n} : Object.getOwnPropertyNames;\n\nfunction shallowCopy(base, invokeGetters) {\n if (invokeGetters === void 0) invokeGetters = false;\n\n if (Array.isArray(base)) {\n return base.slice();\n }\n\n var clone = Object.create(Object.getPrototypeOf(base));\n ownKeys(base).forEach(function (key) {\n if (key === DRAFT_STATE) {\n return; // Never copy over draft state.\n }\n\n var desc = Object.getOwnPropertyDescriptor(base, key);\n var value = desc.value;\n\n if (desc.get) {\n if (invokeGetters) {\n value = desc.get.call(base);\n }\n }\n\n if (desc.enumerable) {\n clone[key] = value;\n } else if (invokeGetters) {\n Object.defineProperty(clone, key, {\n value: value,\n writable: true,\n configurable: true\n });\n }\n });\n return clone;\n}\n\nfunction each(value, cb) {\n if (Array.isArray(value)) {\n for (var i = 0; i < value.length; i++) {\n cb(i, value[i], value);\n }\n } else {\n ownKeys(value).forEach(function (key) {\n return cb(key, value[key], value);\n });\n }\n}\n\nfunction isEnumerable(base, prop) {\n var desc = Object.getOwnPropertyDescriptor(base, prop);\n return !!desc && desc.enumerable;\n}\n\nfunction has(thing, prop) {\n return Object.prototype.hasOwnProperty.call(thing, prop);\n}\n\nfunction is(x, y) {\n // From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js\n if (x === y) {\n return x !== 0 || 1 / x === 1 / y;\n } else {\n return x !== x && y !== y;\n }\n}\n/** Each scope represents a `produce` call. */\n\n\nvar ImmerScope = function ImmerScope(parent) {\n this.drafts = [];\n this.parent = parent; // Whenever the modified draft contains a draft from another scope, we\n // need to prevent auto-freezing so the unowned draft can be finalized.\n\n this.canAutoFreeze = true; // To avoid prototype lookups:\n\n this.patches = null;\n};\n\nImmerScope.prototype.usePatches = function usePatches(patchListener) {\n if (patchListener) {\n this.patches = [];\n this.inversePatches = [];\n this.patchListener = patchListener;\n }\n};\n\nImmerScope.prototype.revoke = function revoke$1() {\n this.leave();\n this.drafts.forEach(revoke);\n this.drafts = null; // Make draft-related methods throw.\n};\n\nImmerScope.prototype.leave = function leave() {\n if (this === ImmerScope.current) {\n ImmerScope.current = this.parent;\n }\n};\n\nImmerScope.current = null;\n\nImmerScope.enter = function () {\n return this.current = new ImmerScope(this.current);\n};\n\nfunction revoke(draft) {\n draft[DRAFT_STATE].revoke();\n} // but share them all instead\n\n\nvar descriptors = {};\n\nfunction willFinalize(scope, result, isReplaced) {\n scope.drafts.forEach(function (draft) {\n draft[DRAFT_STATE].finalizing = true;\n });\n\n if (!isReplaced) {\n if (scope.patches) {\n markChangesRecursively(scope.drafts[0]);\n } // This is faster when we don't care about which attributes changed.\n\n\n markChangesSweep(scope.drafts);\n } // When a child draft is returned, look for changes.\n else if (isDraft(result) && result[DRAFT_STATE].scope === scope) {\n markChangesSweep(scope.drafts);\n }\n}\n\nfunction createProxy(base, parent) {\n var isArray = Array.isArray(base);\n var draft = clonePotentialDraft(base);\n each(draft, function (prop) {\n proxyProperty(draft, prop, isArray || isEnumerable(base, prop));\n }); // See \"proxy.js\" for property documentation.\n\n var scope = parent ? parent.scope : ImmerScope.current;\n var state = {\n scope: scope,\n modified: false,\n finalizing: false,\n // es5 only\n finalized: false,\n assigned: {},\n parent: parent,\n base: base,\n draft: draft,\n copy: null,\n revoke: revoke$1,\n revoked: false // es5 only\n\n };\n createHiddenProperty(draft, DRAFT_STATE, state);\n scope.drafts.push(draft);\n return draft;\n}\n\nfunction revoke$1() {\n this.revoked = true;\n}\n\nfunction source(state) {\n return state.copy || state.base;\n} // Access a property without creating an Immer draft.\n\n\nfunction peek(draft, prop) {\n var state = draft[DRAFT_STATE];\n\n if (state && !state.finalizing) {\n state.finalizing = true;\n var value = draft[prop];\n state.finalizing = false;\n return value;\n }\n\n return draft[prop];\n}\n\nfunction get(state, prop) {\n assertUnrevoked(state);\n var value = peek(source(state), prop);\n\n if (state.finalizing) {\n return value;\n } // Create a draft if the value is unmodified.\n\n\n if (value === peek(state.base, prop) && isDraftable(value)) {\n prepareCopy(state);\n return state.copy[prop] = createProxy(value, state);\n }\n\n return value;\n}\n\nfunction set(state, prop, value) {\n assertUnrevoked(state);\n state.assigned[prop] = true;\n\n if (!state.modified) {\n if (is(value, peek(source(state), prop))) {\n return;\n }\n\n markChanged(state);\n prepareCopy(state);\n }\n\n state.copy[prop] = value;\n}\n\nfunction markChanged(state) {\n if (!state.modified) {\n state.modified = true;\n\n if (state.parent) {\n markChanged(state.parent);\n }\n }\n}\n\nfunction prepareCopy(state) {\n if (!state.copy) {\n state.copy = clonePotentialDraft(state.base);\n }\n}\n\nfunction clonePotentialDraft(base) {\n var state = base && base[DRAFT_STATE];\n\n if (state) {\n state.finalizing = true;\n var draft = shallowCopy(state.draft, true);\n state.finalizing = false;\n return draft;\n }\n\n return shallowCopy(base);\n}\n\nfunction proxyProperty(draft, prop, enumerable) {\n var desc = descriptors[prop];\n\n if (desc) {\n desc.enumerable = enumerable;\n } else {\n descriptors[prop] = desc = {\n configurable: true,\n enumerable: enumerable,\n get: function get$1() {\n return get(this[DRAFT_STATE], prop);\n },\n set: function set$1(value) {\n set(this[DRAFT_STATE], prop, value);\n }\n };\n }\n\n Object.defineProperty(draft, prop, desc);\n}\n\nfunction assertUnrevoked(state) {\n if (state.revoked === true) {\n throw new Error(\"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? \" + JSON.stringify(source(state)));\n }\n} // This looks expensive, but only proxies are visited, and only objects without known changes are scanned.\n\n\nfunction markChangesSweep(drafts) {\n // The natural order of drafts in the `scope` array is based on when they\n // were accessed. By processing drafts in reverse natural order, we have a\n // better chance of processing leaf nodes first. When a leaf node is known to\n // have changed, we can avoid any traversal of its ancestor nodes.\n for (var i = drafts.length - 1; i >= 0; i--) {\n var state = drafts[i][DRAFT_STATE];\n\n if (!state.modified) {\n if (Array.isArray(state.base)) {\n if (hasArrayChanges(state)) {\n markChanged(state);\n }\n } else if (hasObjectChanges(state)) {\n markChanged(state);\n }\n }\n }\n}\n\nfunction markChangesRecursively(object) {\n if (!object || typeof object !== \"object\") {\n return;\n }\n\n var state = object[DRAFT_STATE];\n\n if (!state) {\n return;\n }\n\n var base = state.base;\n var draft = state.draft;\n var assigned = state.assigned;\n\n if (!Array.isArray(object)) {\n // Look for added keys.\n Object.keys(draft).forEach(function (key) {\n // The `undefined` check is a fast path for pre-existing keys.\n if (base[key] === undefined && !has(base, key)) {\n assigned[key] = true;\n markChanged(state);\n } else if (!assigned[key]) {\n // Only untouched properties trigger recursion.\n markChangesRecursively(draft[key]);\n }\n }); // Look for removed keys.\n\n Object.keys(base).forEach(function (key) {\n // The `undefined` check is a fast path for pre-existing keys.\n if (draft[key] === undefined && !has(draft, key)) {\n assigned[key] = false;\n markChanged(state);\n }\n });\n } else if (hasArrayChanges(state)) {\n markChanged(state);\n assigned.length = true;\n\n if (draft.length < base.length) {\n for (var i = draft.length; i < base.length; i++) {\n assigned[i] = false;\n }\n } else {\n for (var i$1 = base.length; i$1 < draft.length; i$1++) {\n assigned[i$1] = true;\n }\n }\n\n for (var i$2 = 0; i$2 < draft.length; i$2++) {\n // Only untouched indices trigger recursion.\n if (assigned[i$2] === undefined) {\n markChangesRecursively(draft[i$2]);\n }\n }\n }\n}\n\nfunction hasObjectChanges(state) {\n var base = state.base;\n var draft = state.draft; // Search for added keys and changed keys. Start at the back, because\n // non-numeric keys are ordered by time of definition on the object.\n\n var keys = Object.keys(draft);\n\n for (var i = keys.length - 1; i >= 0; i--) {\n var key = keys[i];\n var baseValue = base[key]; // The `undefined` check is a fast path for pre-existing keys.\n\n if (baseValue === undefined && !has(base, key)) {\n return true;\n } // Once a base key is deleted, future changes go undetected, because its\n // descriptor is erased. This branch detects any missed changes.\n else {\n var value = draft[key];\n var state$1 = value && value[DRAFT_STATE];\n\n if (state$1 ? state$1.base !== baseValue : !is(value, baseValue)) {\n return true;\n }\n }\n } // At this point, no keys were added or changed.\n // Compare key count to determine if keys were deleted.\n\n\n return keys.length !== Object.keys(base).length;\n}\n\nfunction hasArrayChanges(state) {\n var draft = state.draft;\n\n if (draft.length !== state.base.length) {\n return true;\n } // See #116\n // If we first shorten the length, our array interceptors will be removed.\n // If after that new items are added, result in the same original length,\n // those last items will have no intercepting property.\n // So if there is no own descriptor on the last position, we know that items were removed and added\n // N.B.: splice, unshift, etc only shift values around, but not prop descriptors, so we only have to check\n // the last one\n\n\n var descriptor = Object.getOwnPropertyDescriptor(draft, draft.length - 1); // descriptor can be null, but only for newly created sparse arrays, eg. new Array(10)\n\n if (descriptor && !descriptor.get) {\n return true;\n } // For all other cases, we don't have to compare, as they would have been picked up by the index setters\n\n\n return false;\n}\n\nfunction createHiddenProperty(target, prop, value) {\n Object.defineProperty(target, prop, {\n value: value,\n enumerable: false,\n writable: true\n });\n}\n\nvar legacyProxy = /*#__PURE__*/Object.freeze({\n willFinalize: willFinalize,\n createProxy: createProxy\n});\n\nfunction willFinalize$1() {}\n\nfunction createProxy$1(base, parent) {\n var scope = parent ? parent.scope : ImmerScope.current;\n var state = {\n // Track which produce call this is associated with.\n scope: scope,\n // True for both shallow and deep changes.\n modified: false,\n // Used during finalization.\n finalized: false,\n // Track which properties have been assigned (true) or deleted (false).\n assigned: {},\n // The parent draft state.\n parent: parent,\n // The base state.\n base: base,\n // The base proxy.\n draft: null,\n // Any property proxies.\n drafts: {},\n // The base copy with any updated values.\n copy: null,\n // Called by the `produce` function.\n revoke: null\n };\n var ref = Array.isArray(base) ? // [state] is used for arrays, to make sure the proxy is array-ish and not violate invariants,\n // although state itself is an object\n Proxy.revocable([state], arrayTraps) : Proxy.revocable(state, objectTraps);\n var revoke = ref.revoke;\n var proxy = ref.proxy;\n state.draft = proxy;\n state.revoke = revoke;\n scope.drafts.push(proxy);\n return proxy;\n}\n\nvar objectTraps = {\n get: get$1,\n has: function has(target, prop) {\n return prop in source$1(target);\n },\n ownKeys: function ownKeys(target) {\n return Reflect.ownKeys(source$1(target));\n },\n set: set$1,\n deleteProperty: deleteProperty,\n getOwnPropertyDescriptor: getOwnPropertyDescriptor,\n defineProperty: function defineProperty() {\n throw new Error(\"Object.defineProperty() cannot be used on an Immer draft\"); // prettier-ignore\n },\n getPrototypeOf: function getPrototypeOf(target) {\n return Object.getPrototypeOf(target.base);\n },\n setPrototypeOf: function setPrototypeOf() {\n throw new Error(\"Object.setPrototypeOf() cannot be used on an Immer draft\"); // prettier-ignore\n }\n};\nvar arrayTraps = {};\neach(objectTraps, function (key, fn) {\n arrayTraps[key] = function () {\n arguments[0] = arguments[0][0];\n return fn.apply(this, arguments);\n };\n});\n\narrayTraps.deleteProperty = function (state, prop) {\n if (isNaN(parseInt(prop))) {\n throw new Error(\"Immer only supports deleting array indices\"); // prettier-ignore\n }\n\n return objectTraps.deleteProperty.call(this, state[0], prop);\n};\n\narrayTraps.set = function (state, prop, value) {\n if (prop !== \"length\" && isNaN(parseInt(prop))) {\n throw new Error(\"Immer only supports setting array indices and the 'length' property\"); // prettier-ignore\n }\n\n return objectTraps.set.call(this, state[0], prop, value);\n}; // returns the object we should be reading the current value from, which is base, until some change has been made\n\n\nfunction source$1(state) {\n return state.copy || state.base;\n} // Access a property without creating an Immer draft.\n\n\nfunction peek$1(draft, prop) {\n var state = draft[DRAFT_STATE];\n var desc = Reflect.getOwnPropertyDescriptor(state ? source$1(state) : draft, prop);\n return desc && desc.value;\n}\n\nfunction get$1(state, prop) {\n if (prop === DRAFT_STATE) {\n return state;\n }\n\n var drafts = state.drafts; // Check for existing draft in unmodified state.\n\n if (!state.modified && has(drafts, prop)) {\n return drafts[prop];\n }\n\n var value = source$1(state)[prop];\n\n if (state.finalized || !isDraftable(value)) {\n return value;\n } // Check for existing draft in modified state.\n\n\n if (state.modified) {\n // Assigned values are never drafted. This catches any drafts we created, too.\n if (value !== peek$1(state.base, prop)) {\n return value;\n } // Store drafts on the copy (when one exists).\n\n\n drafts = state.copy;\n }\n\n return drafts[prop] = createProxy$1(value, state);\n}\n\nfunction set$1(state, prop, value) {\n if (!state.modified) {\n var baseValue = peek$1(state.base, prop); // Optimize based on value's truthiness. Truthy values are guaranteed to\n // never be undefined, so we can avoid the `in` operator. Lastly, truthy\n // values may be drafts, but falsy values are never drafts.\n\n var isUnchanged = value ? is(baseValue, value) || value === state.drafts[prop] : is(baseValue, value) && prop in state.base;\n\n if (isUnchanged) {\n return true;\n }\n\n markChanged$1(state);\n }\n\n state.assigned[prop] = true;\n state.copy[prop] = value;\n return true;\n}\n\nfunction deleteProperty(state, prop) {\n // The `undefined` check is a fast path for pre-existing keys.\n if (peek$1(state.base, prop) !== undefined || prop in state.base) {\n state.assigned[prop] = false;\n markChanged$1(state);\n }\n\n if (state.copy) {\n delete state.copy[prop];\n }\n\n return true;\n} // Note: We never coerce `desc.value` into an Immer draft, because we can't make\n// the same guarantee in ES5 mode.\n\n\nfunction getOwnPropertyDescriptor(state, prop) {\n var owner = source$1(state);\n var desc = Reflect.getOwnPropertyDescriptor(owner, prop);\n\n if (desc) {\n desc.writable = true;\n desc.configurable = !Array.isArray(owner) || prop !== \"length\";\n }\n\n return desc;\n}\n\nfunction markChanged$1(state) {\n if (!state.modified) {\n state.modified = true;\n state.copy = assign(shallowCopy(state.base), state.drafts);\n state.drafts = null;\n\n if (state.parent) {\n markChanged$1(state.parent);\n }\n }\n}\n\nvar modernProxy = /*#__PURE__*/Object.freeze({\n willFinalize: willFinalize$1,\n createProxy: createProxy$1\n});\n\nfunction generatePatches(state, basePath, patches, inversePatches) {\n Array.isArray(state.base) ? generateArrayPatches(state, basePath, patches, inversePatches) : generateObjectPatches(state, basePath, patches, inversePatches);\n}\n\nfunction generateArrayPatches(state, basePath, patches, inversePatches) {\n var assign, assign$1;\n var base = state.base;\n var copy = state.copy;\n var assigned = state.assigned; // Reduce complexity by ensuring `base` is never longer.\n\n if (copy.length < base.length) {\n assign = [copy, base], base = assign[0], copy = assign[1];\n assign$1 = [inversePatches, patches], patches = assign$1[0], inversePatches = assign$1[1];\n }\n\n var delta = copy.length - base.length; // Find the first replaced index.\n\n var start = 0;\n\n while (base[start] === copy[start] && start < base.length) {\n ++start;\n } // Find the last replaced index. Search from the end to optimize splice patches.\n\n\n var end = base.length;\n\n while (end > start && base[end - 1] === copy[end + delta - 1]) {\n --end;\n } // Process replaced indices.\n\n\n for (var i = start; i < end; ++i) {\n if (assigned[i] && copy[i] !== base[i]) {\n var path = basePath.concat([i]);\n patches.push({\n op: \"replace\",\n path: path,\n value: copy[i]\n });\n inversePatches.push({\n op: \"replace\",\n path: path,\n value: base[i]\n });\n }\n }\n\n var useRemove = end != base.length;\n var replaceCount = patches.length; // Process added indices.\n\n for (var i$1 = end + delta - 1; i$1 >= end; --i$1) {\n var path$1 = basePath.concat([i$1]);\n patches[replaceCount + i$1 - end] = {\n op: \"add\",\n path: path$1,\n value: copy[i$1]\n };\n\n if (useRemove) {\n inversePatches.push({\n op: \"remove\",\n path: path$1\n });\n }\n } // One \"replace\" patch reverses all non-splicing \"add\" patches.\n\n\n if (!useRemove) {\n inversePatches.push({\n op: \"replace\",\n path: basePath.concat([\"length\"]),\n value: base.length\n });\n }\n}\n\nfunction generateObjectPatches(state, basePath, patches, inversePatches) {\n var base = state.base;\n var copy = state.copy;\n each(state.assigned, function (key, assignedValue) {\n var origValue = base[key];\n var value = copy[key];\n var op = !assignedValue ? \"remove\" : key in base ? \"replace\" : \"add\";\n\n if (origValue === value && op === \"replace\") {\n return;\n }\n\n var path = basePath.concat(key);\n patches.push(op === \"remove\" ? {\n op: op,\n path: path\n } : {\n op: op,\n path: path,\n value: value\n });\n inversePatches.push(op === \"add\" ? {\n op: \"remove\",\n path: path\n } : op === \"remove\" ? {\n op: \"add\",\n path: path,\n value: origValue\n } : {\n op: \"replace\",\n path: path,\n value: origValue\n });\n });\n}\n\nfunction applyPatches(draft, patches) {\n for (var i = 0; i < patches.length; i++) {\n var patch = patches[i];\n var path = patch.path;\n\n if (path.length === 0 && patch.op === \"replace\") {\n draft = patch.value;\n } else {\n var base = draft;\n\n for (var i$1 = 0; i$1 < path.length - 1; i$1++) {\n base = base[path[i$1]];\n\n if (!base || typeof base !== \"object\") {\n throw new Error(\"Cannot apply patch, path doesn't resolve: \" + path.join(\"/\"));\n } // prettier-ignore\n\n }\n\n var key = path[path.length - 1];\n\n switch (patch.op) {\n case \"replace\":\n base[key] = patch.value;\n break;\n\n case \"add\":\n if (Array.isArray(base)) {\n // TODO: support \"foo/-\" paths for appending to an array\n base.splice(key, 0, patch.value);\n } else {\n base[key] = patch.value;\n }\n\n break;\n\n case \"remove\":\n if (Array.isArray(base)) {\n base.splice(key, 1);\n } else {\n delete base[key];\n }\n\n break;\n\n default:\n throw new Error(\"Unsupported patch operation: \" + patch.op);\n }\n }\n }\n\n return draft;\n}\n\nfunction verifyMinified() {}\n\nvar configDefaults = {\n useProxies: typeof Proxy !== \"undefined\" && typeof Reflect !== \"undefined\",\n autoFreeze: typeof process !== \"undefined\" ? process.env.NODE_ENV !== \"production\" : verifyMinified.name === \"verifyMinified\",\n onAssign: null,\n onDelete: null,\n onCopy: null\n};\n\nvar Immer = function Immer(config) {\n assign(this, configDefaults, config);\n this.setUseProxies(this.useProxies);\n this.produce = this.produce.bind(this);\n};\n\nImmer.prototype.produce = function produce(base, recipe, patchListener) {\n var this$1 = this; // curried invocation\n\n if (typeof base === \"function\" && typeof recipe !== \"function\") {\n var defaultBase = recipe;\n recipe = base;\n var self = this;\n return function curriedProduce(base) {\n var this$1 = this;\n if (base === void 0) base = defaultBase;\n var args = [],\n len = arguments.length - 1;\n\n while (len-- > 0) {\n args[len] = arguments[len + 1];\n }\n\n return self.produce(base, function (draft) {\n return recipe.call.apply(recipe, [this$1, draft].concat(args));\n }); // prettier-ignore\n };\n } // prettier-ignore\n\n\n {\n if (typeof recipe !== \"function\") {\n throw new Error(\"The first or second argument to `produce` must be a function\");\n }\n\n if (patchListener !== undefined && typeof patchListener !== \"function\") {\n throw new Error(\"The third argument to `produce` must be a function or undefined\");\n }\n }\n var result; // Only plain objects, arrays, and \"immerable classes\" are drafted.\n\n if (isDraftable(base)) {\n var scope = ImmerScope.enter();\n var proxy = this.createProxy(base);\n var hasError = true;\n\n try {\n result = recipe(proxy);\n hasError = false;\n } finally {\n // finally instead of catch + rethrow better preserves original stack\n if (hasError) {\n scope.revoke();\n } else {\n scope.leave();\n }\n }\n\n if (result instanceof Promise) {\n return result.then(function (result) {\n scope.usePatches(patchListener);\n return this$1.processResult(result, scope);\n }, function (error) {\n scope.revoke();\n throw error;\n });\n }\n\n scope.usePatches(patchListener);\n return this.processResult(result, scope);\n } else {\n result = recipe(base);\n\n if (result === undefined) {\n return base;\n }\n\n return result !== NOTHING ? result : undefined;\n }\n};\n\nImmer.prototype.createDraft = function createDraft(base) {\n if (!isDraftable(base)) {\n throw new Error(\"First argument to `createDraft` must be a plain object, an array, or an immerable object\"); // prettier-ignore\n }\n\n var scope = ImmerScope.enter();\n var proxy = this.createProxy(base);\n proxy[DRAFT_STATE].isManual = true;\n scope.leave();\n return proxy;\n};\n\nImmer.prototype.finishDraft = function finishDraft(draft, patchListener) {\n var state = draft && draft[DRAFT_STATE];\n\n if (!state || !state.isManual) {\n throw new Error(\"First argument to `finishDraft` must be a draft returned by `createDraft`\"); // prettier-ignore\n }\n\n if (state.finalized) {\n throw new Error(\"The given draft is already finalized\"); // prettier-ignore\n }\n\n var scope = state.scope;\n scope.usePatches(patchListener);\n return this.processResult(undefined, scope);\n};\n\nImmer.prototype.setAutoFreeze = function setAutoFreeze(value) {\n this.autoFreeze = value;\n};\n\nImmer.prototype.setUseProxies = function setUseProxies(value) {\n this.useProxies = value;\n assign(this, value ? modernProxy : legacyProxy);\n};\n\nImmer.prototype.applyPatches = function applyPatches$1(base, patches) {\n // Mutate the base state when a draft is passed.\n if (isDraft(base)) {\n return applyPatches(base, patches);\n } // Otherwise, produce a copy of the base state.\n\n\n return this.produce(base, function (draft) {\n return applyPatches(draft, patches);\n });\n};\n/** @internal */\n\n\nImmer.prototype.processResult = function processResult(result, scope) {\n var baseDraft = scope.drafts[0];\n var isReplaced = result !== undefined && result !== baseDraft;\n this.willFinalize(scope, result, isReplaced);\n\n if (isReplaced) {\n if (baseDraft[DRAFT_STATE].modified) {\n scope.revoke();\n throw new Error(\"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.\"); // prettier-ignore\n }\n\n if (isDraftable(result)) {\n // Finalize the result in case it contains (or is) a subset of the draft.\n result = this.finalize(result, null, scope);\n }\n\n if (scope.patches) {\n scope.patches.push({\n op: \"replace\",\n path: [],\n value: result\n });\n scope.inversePatches.push({\n op: \"replace\",\n path: [],\n value: baseDraft[DRAFT_STATE].base\n });\n }\n } else {\n // Finalize the base draft.\n result = this.finalize(baseDraft, [], scope);\n }\n\n scope.revoke();\n\n if (scope.patches) {\n scope.patchListener(scope.patches, scope.inversePatches);\n }\n\n return result !== NOTHING ? result : undefined;\n};\n/**\n * @internal\n * Finalize a draft, returning either the unmodified base state or a modified\n * copy of the base state.\n */\n\n\nImmer.prototype.finalize = function finalize(draft, path, scope) {\n var this$1 = this;\n var state = draft[DRAFT_STATE];\n\n if (!state) {\n if (Object.isFrozen(draft)) {\n return draft;\n }\n\n return this.finalizeTree(draft, null, scope);\n } // Never finalize drafts owned by another scope.\n\n\n if (state.scope !== scope) {\n return draft;\n }\n\n if (!state.modified) {\n return state.base;\n }\n\n if (!state.finalized) {\n state.finalized = true;\n this.finalizeTree(state.draft, path, scope);\n\n if (this.onDelete) {\n // The `assigned` object is unreliable with ES5 drafts.\n if (this.useProxies) {\n var assigned = state.assigned;\n\n for (var prop in assigned) {\n if (!assigned[prop]) {\n this.onDelete(state, prop);\n }\n }\n } else {\n var base = state.base;\n var copy = state.copy;\n each(base, function (prop) {\n if (!has(copy, prop)) {\n this$1.onDelete(state, prop);\n }\n });\n }\n }\n\n if (this.onCopy) {\n this.onCopy(state);\n } // At this point, all descendants of `state.copy` have been finalized,\n // so we can be sure that `scope.canAutoFreeze` is accurate.\n\n\n if (this.autoFreeze && scope.canAutoFreeze) {\n Object.freeze(state.copy);\n }\n\n if (path && scope.patches) {\n generatePatches(state, path, scope.patches, scope.inversePatches);\n }\n }\n\n return state.copy;\n};\n/**\n * @internal\n * Finalize all drafts in the given state tree.\n */\n\n\nImmer.prototype.finalizeTree = function finalizeTree(root, rootPath, scope) {\n var this$1 = this;\n var state = root[DRAFT_STATE];\n\n if (state) {\n if (!this.useProxies) {\n // Create the final copy, with added keys and without deleted keys.\n state.copy = shallowCopy(state.draft, true);\n }\n\n root = state.copy;\n }\n\n var needPatches = !!rootPath && !!scope.patches;\n\n var finalizeProperty = function finalizeProperty(prop, value, parent) {\n if (value === parent) {\n throw Error(\"Immer forbids circular references\");\n } // In the `finalizeTree` method, only the `root` object may be a draft.\n\n\n var isDraftProp = !!state && parent === root;\n\n if (isDraft(value)) {\n var path = isDraftProp && needPatches && !state.assigned[prop] ? rootPath.concat(prop) : null; // Drafts owned by `scope` are finalized here.\n\n value = this$1.finalize(value, path, scope); // Drafts from another scope must prevent auto-freezing.\n\n if (isDraft(value)) {\n scope.canAutoFreeze = false;\n } // Preserve non-enumerable properties.\n\n\n if (Array.isArray(parent) || isEnumerable(parent, prop)) {\n parent[prop] = value;\n } else {\n Object.defineProperty(parent, prop, {\n value: value\n });\n } // Unchanged drafts are never passed to the `onAssign` hook.\n\n\n if (isDraftProp && value === state.base[prop]) {\n return;\n }\n } // Unchanged draft properties are ignored.\n else if (isDraftProp && is(value, state.base[prop])) {\n return;\n } // Search new objects for unfinalized drafts. Frozen objects should never contain drafts.\n else if (isDraftable(value) && !Object.isFrozen(value)) {\n each(value, finalizeProperty);\n }\n\n if (isDraftProp && this$1.onAssign) {\n this$1.onAssign(state, prop, value);\n }\n };\n\n each(root, finalizeProperty);\n return root;\n};\n\nvar immer = new Immer();\n/**\n * The `produce` function takes a value and a \"recipe function\" (whose\n * return value often depends on the base state). The recipe function is\n * free to mutate its first argument however it wants. All mutations are\n * only ever applied to a __copy__ of the base state.\n *\n * Pass only a function to create a \"curried producer\" which relieves you\n * from passing the recipe function every time.\n *\n * Only plain objects and arrays are made mutable. All other objects are\n * considered uncopyable.\n *\n * Note: This function is __bound__ to its `Immer` instance.\n *\n * @param {any} base - the initial state\n * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified\n * @param {Function} patchListener - optional function that will be called with all the patches produced here\n * @returns {any} a new state, or the initial state if nothing was modified\n */\n\nvar produce = immer.produce;\n/**\n * Pass true to automatically freeze all copies created by Immer.\n *\n * By default, auto-freezing is disabled in production.\n */\n\nvar setAutoFreeze = immer.setAutoFreeze.bind(immer);\n/**\n * Pass true to use the ES2015 `Proxy` class when creating drafts, which is\n * always faster than using ES5 proxies.\n *\n * By default, feature detection is used, so calling this is rarely necessary.\n */\n\nvar setUseProxies = immer.setUseProxies.bind(immer);\n/**\n * Apply an array of Immer patches to the first argument.\n *\n * This function is a producer, which means copy-on-write is in effect.\n */\n\nvar applyPatches$1 = immer.applyPatches.bind(immer);\n/**\n * Create an Immer draft from the given base state, which may be a draft itself.\n * The draft can be modified until you finalize it with the `finishDraft` function.\n */\n\nvar createDraft = immer.createDraft.bind(immer);\n/**\n * Finalize an Immer draft from a `createDraft` call, returning the base state\n * (if no changes were made) or a modified copy. The draft must *not* be\n * mutated afterwards.\n *\n * Pass a function as the 2nd argument to generate Immer patches based on the\n * changes that were made.\n */\n\nvar finishDraft = immer.finishDraft.bind(immer);\nexport default produce;\nexport { Immer, applyPatches$1 as applyPatches, createDraft, finishDraft, DRAFTABLE as immerable, isDraft, isDraftable, NOTHING as nothing, original, produce, setAutoFreeze, setUseProxies };","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n'use strict';\n\nmodule.exports = Transform;\n\nvar _require$codes = require('../errors').codes,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,\n ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,\n ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;\n\nvar Duplex = require('./_stream_duplex');\n\nrequire('inherits')(Transform, Duplex);\n\nfunction afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n var cb = ts.writecb;\n\n if (cb === null) {\n return this.emit('error', new ERR_MULTIPLE_CALLBACK());\n }\n\n ts.writechunk = null;\n ts.writecb = null;\n if (data != null) // single equals check for both `null` and `undefined`\n this.push(data);\n cb(er);\n var rs = this._readableState;\n rs.reading = false;\n\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n}\n\nfunction Transform(options) {\n if (!(this instanceof Transform)) return new Transform(options);\n Duplex.call(this, options);\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n }; // start out asking for a readable event once data is transformed.\n\n this._readableState.needReadable = true; // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n\n this._readableState.sync = false;\n\n if (options) {\n if (typeof options.transform === 'function') this._transform = options.transform;\n if (typeof options.flush === 'function') this._flush = options.flush;\n } // When the writable side finishes, then flush out anything remaining.\n\n\n this.on('prefinish', prefinish);\n}\n\nfunction prefinish() {\n var _this = this;\n\n if (typeof this._flush === 'function' && !this._readableState.destroyed) {\n this._flush(function (er, data) {\n done(_this, er, data);\n });\n } else {\n done(this, null, null);\n }\n}\n\nTransform.prototype.push = function (chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n}; // This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\n\n\nTransform.prototype._transform = function (chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()'));\n};\n\nTransform.prototype._write = function (chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);\n }\n}; // Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\n\n\nTransform.prototype._read = function (n) {\n var ts = this._transformState;\n\n if (ts.writechunk !== null && !ts.transforming) {\n ts.transforming = true;\n\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\n\nTransform.prototype._destroy = function (err, cb) {\n Duplex.prototype._destroy.call(this, err, function (err2) {\n cb(err2);\n });\n};\n\nfunction done(stream, er, data) {\n if (er) return stream.emit('error', er);\n if (data != null) // single equals check for both `null` and `undefined`\n stream.push(data); // TODO(BridgeAR): Write a test for these two error cases\n // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n\n if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();\n if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();\n return stream.push(null);\n}","/*\n * Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\n\n/**\n * This Symbol is used to reference an internal-only PubSub provider that\n * is used for AppSync/GraphQL subscriptions in the API category.\n */\nvar hasSymbol = typeof Symbol !== 'undefined' && typeof Symbol.for === 'function';\nexport var INTERNAL_AWS_APPSYNC_PUBSUB_PROVIDER = hasSymbol ? Symbol.for('INTERNAL_AWS_APPSYNC_PUBSUB_PROVIDER') : '@@INTERNAL_AWS_APPSYNC_PUBSUB_PROVIDER';\nexport var INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER = hasSymbol ? Symbol.for('INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER') : '@@INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER';\nexport var USER_AGENT_HEADER = 'x-amz-user-agent';","var aes = require('./aes');\n\nvar Buffer = require('safe-buffer').Buffer;\n\nvar Transform = require('cipher-base');\n\nvar inherits = require('inherits');\n\nfunction StreamCipher(mode, key, iv, decrypt) {\n Transform.call(this);\n this._cipher = new aes.AES(key);\n this._prev = Buffer.from(iv);\n this._cache = Buffer.allocUnsafe(0);\n this._secCache = Buffer.allocUnsafe(0);\n this._decrypt = decrypt;\n this._mode = mode;\n}\n\ninherits(StreamCipher, Transform);\n\nStreamCipher.prototype._update = function (chunk) {\n return this._mode.encrypt(this, chunk, this._decrypt);\n};\n\nStreamCipher.prototype._final = function () {\n this._cipher.scrub();\n};\n\nmodule.exports = StreamCipher;","function areInputsEqual(newInputs, lastInputs) {\n if (newInputs.length !== lastInputs.length) {\n return false;\n }\n\n for (var i = 0; i < newInputs.length; i++) {\n if (newInputs[i] !== lastInputs[i]) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction memoizeOne(resultFn, isEqual) {\n if (isEqual === void 0) {\n isEqual = areInputsEqual;\n }\n\n var lastThis;\n var lastArgs = [];\n var lastResult;\n var calledOnce = false;\n\n function memoized() {\n var newArgs = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n newArgs[_i] = arguments[_i];\n }\n\n if (calledOnce && lastThis === this && isEqual(newArgs, lastArgs)) {\n return lastResult;\n }\n\n lastResult = resultFn.apply(this, newArgs);\n calledOnce = true;\n lastThis = this;\n lastArgs = newArgs;\n return lastResult;\n }\n\n return memoized;\n}\n\nexport default memoizeOne;","import React, { Component, PureComponent } from 'react';\nimport memoizeOne from 'memoize-one';\nimport { jsx } from '@emotion/core';\nimport { findDOMNode } from 'react-dom';\nimport { i as isTouchCapable, d as isMobileDevice, e as cleanValue, f as scrollIntoView, h as classNames, n as noop, j as isDocumentElement } from './utils-06b0d5a4.browser.esm.js';\nimport { c as clearIndicatorCSS, a as containerCSS, b as css, d as dropdownIndicatorCSS, g as groupCSS, e as groupHeadingCSS, i as indicatorsContainerCSS, f as indicatorSeparatorCSS, h as inputCSS, l as loadingIndicatorCSS, j as loadingMessageCSS, m as menuCSS, k as menuListCSS, n as menuPortalCSS, o as multiValueCSS, p as multiValueLabelCSS, q as multiValueRemoveCSS, r as noOptionsMessageCSS, s as optionCSS, t as placeholderCSS, u as css$1, v as valueContainerCSS, M as MenuPlacer, w as defaultComponents, x as exportedEqual } from './index-4322c0ed.browser.esm.js';\nimport _css from '@emotion/css';\nvar diacritics = [{\n base: 'A',\n letters: /[\\u0041\\u24B6\\uFF21\\u00C0\\u00C1\\u00C2\\u1EA6\\u1EA4\\u1EAA\\u1EA8\\u00C3\\u0100\\u0102\\u1EB0\\u1EAE\\u1EB4\\u1EB2\\u0226\\u01E0\\u00C4\\u01DE\\u1EA2\\u00C5\\u01FA\\u01CD\\u0200\\u0202\\u1EA0\\u1EAC\\u1EB6\\u1E00\\u0104\\u023A\\u2C6F]/g\n}, {\n base: 'AA',\n letters: /[\\uA732]/g\n}, {\n base: 'AE',\n letters: /[\\u00C6\\u01FC\\u01E2]/g\n}, {\n base: 'AO',\n letters: /[\\uA734]/g\n}, {\n base: 'AU',\n letters: /[\\uA736]/g\n}, {\n base: 'AV',\n letters: /[\\uA738\\uA73A]/g\n}, {\n base: 'AY',\n letters: /[\\uA73C]/g\n}, {\n base: 'B',\n letters: /[\\u0042\\u24B7\\uFF22\\u1E02\\u1E04\\u1E06\\u0243\\u0182\\u0181]/g\n}, {\n base: 'C',\n letters: /[\\u0043\\u24B8\\uFF23\\u0106\\u0108\\u010A\\u010C\\u00C7\\u1E08\\u0187\\u023B\\uA73E]/g\n}, {\n base: 'D',\n letters: /[\\u0044\\u24B9\\uFF24\\u1E0A\\u010E\\u1E0C\\u1E10\\u1E12\\u1E0E\\u0110\\u018B\\u018A\\u0189\\uA779]/g\n}, {\n base: 'DZ',\n letters: /[\\u01F1\\u01C4]/g\n}, {\n base: 'Dz',\n letters: /[\\u01F2\\u01C5]/g\n}, {\n base: 'E',\n letters: /[\\u0045\\u24BA\\uFF25\\u00C8\\u00C9\\u00CA\\u1EC0\\u1EBE\\u1EC4\\u1EC2\\u1EBC\\u0112\\u1E14\\u1E16\\u0114\\u0116\\u00CB\\u1EBA\\u011A\\u0204\\u0206\\u1EB8\\u1EC6\\u0228\\u1E1C\\u0118\\u1E18\\u1E1A\\u0190\\u018E]/g\n}, {\n base: 'F',\n letters: /[\\u0046\\u24BB\\uFF26\\u1E1E\\u0191\\uA77B]/g\n}, {\n base: 'G',\n letters: /[\\u0047\\u24BC\\uFF27\\u01F4\\u011C\\u1E20\\u011E\\u0120\\u01E6\\u0122\\u01E4\\u0193\\uA7A0\\uA77D\\uA77E]/g\n}, {\n base: 'H',\n letters: /[\\u0048\\u24BD\\uFF28\\u0124\\u1E22\\u1E26\\u021E\\u1E24\\u1E28\\u1E2A\\u0126\\u2C67\\u2C75\\uA78D]/g\n}, {\n base: 'I',\n letters: /[\\u0049\\u24BE\\uFF29\\u00CC\\u00CD\\u00CE\\u0128\\u012A\\u012C\\u0130\\u00CF\\u1E2E\\u1EC8\\u01CF\\u0208\\u020A\\u1ECA\\u012E\\u1E2C\\u0197]/g\n}, {\n base: 'J',\n letters: /[\\u004A\\u24BF\\uFF2A\\u0134\\u0248]/g\n}, {\n base: 'K',\n letters: /[\\u004B\\u24C0\\uFF2B\\u1E30\\u01E8\\u1E32\\u0136\\u1E34\\u0198\\u2C69\\uA740\\uA742\\uA744\\uA7A2]/g\n}, {\n base: 'L',\n letters: /[\\u004C\\u24C1\\uFF2C\\u013F\\u0139\\u013D\\u1E36\\u1E38\\u013B\\u1E3C\\u1E3A\\u0141\\u023D\\u2C62\\u2C60\\uA748\\uA746\\uA780]/g\n}, {\n base: 'LJ',\n letters: /[\\u01C7]/g\n}, {\n base: 'Lj',\n letters: /[\\u01C8]/g\n}, {\n base: 'M',\n letters: /[\\u004D\\u24C2\\uFF2D\\u1E3E\\u1E40\\u1E42\\u2C6E\\u019C]/g\n}, {\n base: 'N',\n letters: /[\\u004E\\u24C3\\uFF2E\\u01F8\\u0143\\u00D1\\u1E44\\u0147\\u1E46\\u0145\\u1E4A\\u1E48\\u0220\\u019D\\uA790\\uA7A4]/g\n}, {\n base: 'NJ',\n letters: /[\\u01CA]/g\n}, {\n base: 'Nj',\n letters: /[\\u01CB]/g\n}, {\n base: 'O',\n letters: /[\\u004F\\u24C4\\uFF2F\\u00D2\\u00D3\\u00D4\\u1ED2\\u1ED0\\u1ED6\\u1ED4\\u00D5\\u1E4C\\u022C\\u1E4E\\u014C\\u1E50\\u1E52\\u014E\\u022E\\u0230\\u00D6\\u022A\\u1ECE\\u0150\\u01D1\\u020C\\u020E\\u01A0\\u1EDC\\u1EDA\\u1EE0\\u1EDE\\u1EE2\\u1ECC\\u1ED8\\u01EA\\u01EC\\u00D8\\u01FE\\u0186\\u019F\\uA74A\\uA74C]/g\n}, {\n base: 'OI',\n letters: /[\\u01A2]/g\n}, {\n base: 'OO',\n letters: /[\\uA74E]/g\n}, {\n base: 'OU',\n letters: /[\\u0222]/g\n}, {\n base: 'P',\n letters: /[\\u0050\\u24C5\\uFF30\\u1E54\\u1E56\\u01A4\\u2C63\\uA750\\uA752\\uA754]/g\n}, {\n base: 'Q',\n letters: /[\\u0051\\u24C6\\uFF31\\uA756\\uA758\\u024A]/g\n}, {\n base: 'R',\n letters: /[\\u0052\\u24C7\\uFF32\\u0154\\u1E58\\u0158\\u0210\\u0212\\u1E5A\\u1E5C\\u0156\\u1E5E\\u024C\\u2C64\\uA75A\\uA7A6\\uA782]/g\n}, {\n base: 'S',\n letters: /[\\u0053\\u24C8\\uFF33\\u1E9E\\u015A\\u1E64\\u015C\\u1E60\\u0160\\u1E66\\u1E62\\u1E68\\u0218\\u015E\\u2C7E\\uA7A8\\uA784]/g\n}, {\n base: 'T',\n letters: /[\\u0054\\u24C9\\uFF34\\u1E6A\\u0164\\u1E6C\\u021A\\u0162\\u1E70\\u1E6E\\u0166\\u01AC\\u01AE\\u023E\\uA786]/g\n}, {\n base: 'TZ',\n letters: /[\\uA728]/g\n}, {\n base: 'U',\n letters: /[\\u0055\\u24CA\\uFF35\\u00D9\\u00DA\\u00DB\\u0168\\u1E78\\u016A\\u1E7A\\u016C\\u00DC\\u01DB\\u01D7\\u01D5\\u01D9\\u1EE6\\u016E\\u0170\\u01D3\\u0214\\u0216\\u01AF\\u1EEA\\u1EE8\\u1EEE\\u1EEC\\u1EF0\\u1EE4\\u1E72\\u0172\\u1E76\\u1E74\\u0244]/g\n}, {\n base: 'V',\n letters: /[\\u0056\\u24CB\\uFF36\\u1E7C\\u1E7E\\u01B2\\uA75E\\u0245]/g\n}, {\n base: 'VY',\n letters: /[\\uA760]/g\n}, {\n base: 'W',\n letters: /[\\u0057\\u24CC\\uFF37\\u1E80\\u1E82\\u0174\\u1E86\\u1E84\\u1E88\\u2C72]/g\n}, {\n base: 'X',\n letters: /[\\u0058\\u24CD\\uFF38\\u1E8A\\u1E8C]/g\n}, {\n base: 'Y',\n letters: /[\\u0059\\u24CE\\uFF39\\u1EF2\\u00DD\\u0176\\u1EF8\\u0232\\u1E8E\\u0178\\u1EF6\\u1EF4\\u01B3\\u024E\\u1EFE]/g\n}, {\n base: 'Z',\n letters: /[\\u005A\\u24CF\\uFF3A\\u0179\\u1E90\\u017B\\u017D\\u1E92\\u1E94\\u01B5\\u0224\\u2C7F\\u2C6B\\uA762]/g\n}, {\n base: 'a',\n letters: /[\\u0061\\u24D0\\uFF41\\u1E9A\\u00E0\\u00E1\\u00E2\\u1EA7\\u1EA5\\u1EAB\\u1EA9\\u00E3\\u0101\\u0103\\u1EB1\\u1EAF\\u1EB5\\u1EB3\\u0227\\u01E1\\u00E4\\u01DF\\u1EA3\\u00E5\\u01FB\\u01CE\\u0201\\u0203\\u1EA1\\u1EAD\\u1EB7\\u1E01\\u0105\\u2C65\\u0250]/g\n}, {\n base: 'aa',\n letters: /[\\uA733]/g\n}, {\n base: 'ae',\n letters: /[\\u00E6\\u01FD\\u01E3]/g\n}, {\n base: 'ao',\n letters: /[\\uA735]/g\n}, {\n base: 'au',\n letters: /[\\uA737]/g\n}, {\n base: 'av',\n letters: /[\\uA739\\uA73B]/g\n}, {\n base: 'ay',\n letters: /[\\uA73D]/g\n}, {\n base: 'b',\n letters: /[\\u0062\\u24D1\\uFF42\\u1E03\\u1E05\\u1E07\\u0180\\u0183\\u0253]/g\n}, {\n base: 'c',\n letters: /[\\u0063\\u24D2\\uFF43\\u0107\\u0109\\u010B\\u010D\\u00E7\\u1E09\\u0188\\u023C\\uA73F\\u2184]/g\n}, {\n base: 'd',\n letters: /[\\u0064\\u24D3\\uFF44\\u1E0B\\u010F\\u1E0D\\u1E11\\u1E13\\u1E0F\\u0111\\u018C\\u0256\\u0257\\uA77A]/g\n}, {\n base: 'dz',\n letters: /[\\u01F3\\u01C6]/g\n}, {\n base: 'e',\n letters: /[\\u0065\\u24D4\\uFF45\\u00E8\\u00E9\\u00EA\\u1EC1\\u1EBF\\u1EC5\\u1EC3\\u1EBD\\u0113\\u1E15\\u1E17\\u0115\\u0117\\u00EB\\u1EBB\\u011B\\u0205\\u0207\\u1EB9\\u1EC7\\u0229\\u1E1D\\u0119\\u1E19\\u1E1B\\u0247\\u025B\\u01DD]/g\n}, {\n base: 'f',\n letters: /[\\u0066\\u24D5\\uFF46\\u1E1F\\u0192\\uA77C]/g\n}, {\n base: 'g',\n letters: /[\\u0067\\u24D6\\uFF47\\u01F5\\u011D\\u1E21\\u011F\\u0121\\u01E7\\u0123\\u01E5\\u0260\\uA7A1\\u1D79\\uA77F]/g\n}, {\n base: 'h',\n letters: /[\\u0068\\u24D7\\uFF48\\u0125\\u1E23\\u1E27\\u021F\\u1E25\\u1E29\\u1E2B\\u1E96\\u0127\\u2C68\\u2C76\\u0265]/g\n}, {\n base: 'hv',\n letters: /[\\u0195]/g\n}, {\n base: 'i',\n letters: /[\\u0069\\u24D8\\uFF49\\u00EC\\u00ED\\u00EE\\u0129\\u012B\\u012D\\u00EF\\u1E2F\\u1EC9\\u01D0\\u0209\\u020B\\u1ECB\\u012F\\u1E2D\\u0268\\u0131]/g\n}, {\n base: 'j',\n letters: /[\\u006A\\u24D9\\uFF4A\\u0135\\u01F0\\u0249]/g\n}, {\n base: 'k',\n letters: /[\\u006B\\u24DA\\uFF4B\\u1E31\\u01E9\\u1E33\\u0137\\u1E35\\u0199\\u2C6A\\uA741\\uA743\\uA745\\uA7A3]/g\n}, {\n base: 'l',\n letters: /[\\u006C\\u24DB\\uFF4C\\u0140\\u013A\\u013E\\u1E37\\u1E39\\u013C\\u1E3D\\u1E3B\\u017F\\u0142\\u019A\\u026B\\u2C61\\uA749\\uA781\\uA747]/g\n}, {\n base: 'lj',\n letters: /[\\u01C9]/g\n}, {\n base: 'm',\n letters: /[\\u006D\\u24DC\\uFF4D\\u1E3F\\u1E41\\u1E43\\u0271\\u026F]/g\n}, {\n base: 'n',\n letters: /[\\u006E\\u24DD\\uFF4E\\u01F9\\u0144\\u00F1\\u1E45\\u0148\\u1E47\\u0146\\u1E4B\\u1E49\\u019E\\u0272\\u0149\\uA791\\uA7A5]/g\n}, {\n base: 'nj',\n letters: /[\\u01CC]/g\n}, {\n base: 'o',\n letters: /[\\u006F\\u24DE\\uFF4F\\u00F2\\u00F3\\u00F4\\u1ED3\\u1ED1\\u1ED7\\u1ED5\\u00F5\\u1E4D\\u022D\\u1E4F\\u014D\\u1E51\\u1E53\\u014F\\u022F\\u0231\\u00F6\\u022B\\u1ECF\\u0151\\u01D2\\u020D\\u020F\\u01A1\\u1EDD\\u1EDB\\u1EE1\\u1EDF\\u1EE3\\u1ECD\\u1ED9\\u01EB\\u01ED\\u00F8\\u01FF\\u0254\\uA74B\\uA74D\\u0275]/g\n}, {\n base: 'oi',\n letters: /[\\u01A3]/g\n}, {\n base: 'ou',\n letters: /[\\u0223]/g\n}, {\n base: 'oo',\n letters: /[\\uA74F]/g\n}, {\n base: 'p',\n letters: /[\\u0070\\u24DF\\uFF50\\u1E55\\u1E57\\u01A5\\u1D7D\\uA751\\uA753\\uA755]/g\n}, {\n base: 'q',\n letters: /[\\u0071\\u24E0\\uFF51\\u024B\\uA757\\uA759]/g\n}, {\n base: 'r',\n letters: /[\\u0072\\u24E1\\uFF52\\u0155\\u1E59\\u0159\\u0211\\u0213\\u1E5B\\u1E5D\\u0157\\u1E5F\\u024D\\u027D\\uA75B\\uA7A7\\uA783]/g\n}, {\n base: 's',\n letters: /[\\u0073\\u24E2\\uFF53\\u00DF\\u015B\\u1E65\\u015D\\u1E61\\u0161\\u1E67\\u1E63\\u1E69\\u0219\\u015F\\u023F\\uA7A9\\uA785\\u1E9B]/g\n}, {\n base: 't',\n letters: /[\\u0074\\u24E3\\uFF54\\u1E6B\\u1E97\\u0165\\u1E6D\\u021B\\u0163\\u1E71\\u1E6F\\u0167\\u01AD\\u0288\\u2C66\\uA787]/g\n}, {\n base: 'tz',\n letters: /[\\uA729]/g\n}, {\n base: 'u',\n letters: /[\\u0075\\u24E4\\uFF55\\u00F9\\u00FA\\u00FB\\u0169\\u1E79\\u016B\\u1E7B\\u016D\\u00FC\\u01DC\\u01D8\\u01D6\\u01DA\\u1EE7\\u016F\\u0171\\u01D4\\u0215\\u0217\\u01B0\\u1EEB\\u1EE9\\u1EEF\\u1EED\\u1EF1\\u1EE5\\u1E73\\u0173\\u1E77\\u1E75\\u0289]/g\n}, {\n base: 'v',\n letters: /[\\u0076\\u24E5\\uFF56\\u1E7D\\u1E7F\\u028B\\uA75F\\u028C]/g\n}, {\n base: 'vy',\n letters: /[\\uA761]/g\n}, {\n base: 'w',\n letters: /[\\u0077\\u24E6\\uFF57\\u1E81\\u1E83\\u0175\\u1E87\\u1E85\\u1E98\\u1E89\\u2C73]/g\n}, {\n base: 'x',\n letters: /[\\u0078\\u24E7\\uFF58\\u1E8B\\u1E8D]/g\n}, {\n base: 'y',\n letters: /[\\u0079\\u24E8\\uFF59\\u1EF3\\u00FD\\u0177\\u1EF9\\u0233\\u1E8F\\u00FF\\u1EF7\\u1E99\\u1EF5\\u01B4\\u024F\\u1EFF]/g\n}, {\n base: 'z',\n letters: /[\\u007A\\u24E9\\uFF5A\\u017A\\u1E91\\u017C\\u017E\\u1E93\\u1E95\\u01B6\\u0225\\u0240\\u2C6C\\uA763]/g\n}];\n\nvar stripDiacritics = function stripDiacritics(str) {\n for (var i = 0; i < diacritics.length; i++) {\n str = str.replace(diacritics[i].letters, diacritics[i].base);\n }\n\n return str;\n};\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nvar trimString = function trimString(str) {\n return str.replace(/^\\s+|\\s+$/g, '');\n};\n\nvar defaultStringify = function defaultStringify(option) {\n return option.label + \" \" + option.value;\n};\n\nvar createFilter = function createFilter(config) {\n return function (option, rawInput) {\n var _ignoreCase$ignoreAcc = _extends({\n ignoreCase: true,\n ignoreAccents: true,\n stringify: defaultStringify,\n trim: true,\n matchFrom: 'any'\n }, config),\n ignoreCase = _ignoreCase$ignoreAcc.ignoreCase,\n ignoreAccents = _ignoreCase$ignoreAcc.ignoreAccents,\n stringify = _ignoreCase$ignoreAcc.stringify,\n trim = _ignoreCase$ignoreAcc.trim,\n matchFrom = _ignoreCase$ignoreAcc.matchFrom;\n\n var input = trim ? trimString(rawInput) : rawInput;\n var candidate = trim ? trimString(stringify(option)) : stringify(option);\n\n if (ignoreCase) {\n input = input.toLowerCase();\n candidate = candidate.toLowerCase();\n }\n\n if (ignoreAccents) {\n input = stripDiacritics(input);\n candidate = stripDiacritics(candidate);\n }\n\n return matchFrom === 'start' ? candidate.substr(0, input.length) === input : candidate.indexOf(input) > -1;\n };\n};\n\nfunction _extends$1() {\n _extends$1 = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends$1.apply(this, arguments);\n}\n\nvar _ref = process.env.NODE_ENV === \"production\" ? {\n name: \"1laao21-a11yText\",\n styles: \"label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap;\"\n} : {\n name: \"1laao21-a11yText\",\n styles: \"label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap;\",\n map: \"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkExMXlUZXh0LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVFNIiwiZmlsZSI6IkExMXlUZXh0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8gQGZsb3dcbi8qKiBAanN4IGpzeCAqL1xuaW1wb3J0IHsgdHlwZSBFbGVtZW50Q29uZmlnIH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHsganN4IH0gZnJvbSAnQGVtb3Rpb24vY29yZSc7XG5cbi8vIEFzc2lzdGl2ZSB0ZXh0IHRvIGRlc2NyaWJlIHZpc3VhbCBlbGVtZW50cy4gSGlkZGVuIGZvciBzaWdodGVkIHVzZXJzLlxuY29uc3QgQTExeVRleHQgPSAocHJvcHM6IEVsZW1lbnRDb25maWc8J3NwYW4nPikgPT4gKFxuICAgIDxzcGFuXG4gICAgICBjc3M9e3tcbiAgICAgICAgbGFiZWw6ICdhMTF5VGV4dCcsXG4gICAgICAgIHpJbmRleDogOTk5OSxcbiAgICAgICAgYm9yZGVyOiAwLFxuICAgICAgICBjbGlwOiAncmVjdCgxcHgsIDFweCwgMXB4LCAxcHgpJyxcbiAgICAgICAgaGVpZ2h0OiAxLFxuICAgICAgICB3aWR0aDogMSxcbiAgICAgICAgcG9zaXRpb246ICdhYnNvbHV0ZScsXG4gICAgICAgIG92ZXJmbG93OiAnaGlkZGVuJyxcbiAgICAgICAgcGFkZGluZzogMCxcbiAgICAgICAgd2hpdGVTcGFjZTogJ25vd3JhcCcsXG4gICAgICB9fVxuICAgICAgey4uLnByb3BzfVxuICAgIC8+XG4pO1xuXG5leHBvcnQgZGVmYXVsdCBBMTF5VGV4dDtcbiJdfQ== */\"\n};\n\nvar A11yText = function A11yText(props) {\n return jsx(\"span\", _extends$1({\n css: _ref\n }, props));\n};\n\nfunction _extends$2() {\n _extends$2 = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends$2.apply(this, arguments);\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction DummyInput(_ref) {\n var inProp = _ref.in,\n out = _ref.out,\n onExited = _ref.onExited,\n appear = _ref.appear,\n enter = _ref.enter,\n exit = _ref.exit,\n innerRef = _ref.innerRef,\n emotion = _ref.emotion,\n props = _objectWithoutPropertiesLoose(_ref, [\"in\", \"out\", \"onExited\", \"appear\", \"enter\", \"exit\", \"innerRef\", \"emotion\"]);\n\n return jsx(\"input\", _extends$2({\n ref: innerRef\n }, props, {\n css: /*#__PURE__*/_css({\n label: 'dummyInput',\n // get rid of any default styles\n background: 0,\n border: 0,\n fontSize: 'inherit',\n outline: 0,\n padding: 0,\n // important! without `width` browsers won't allow focus\n width: 1,\n // remove cursor on desktop\n color: 'transparent',\n // remove cursor on mobile whilst maintaining \"scroll into view\" behaviour\n left: -100,\n opacity: 0,\n position: 'relative',\n transform: 'scale(0)'\n }, process.env.NODE_ENV === \"production\" ? \"\" : \"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkR1bW15SW5wdXQuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBbUJNIiwiZmlsZSI6IkR1bW15SW5wdXQuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLyBAZmxvd1xuLyoqIEBqc3gganN4ICovXG5pbXBvcnQgeyBqc3ggfSBmcm9tICdAZW1vdGlvbi9jb3JlJztcblxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gRHVtbXlJbnB1dCh7XG4gIGluOiBpblByb3AsXG4gIG91dCxcbiAgb25FeGl0ZWQsXG4gIGFwcGVhcixcbiAgZW50ZXIsXG4gIGV4aXQsXG4gIGlubmVyUmVmLFxuICBlbW90aW9uLFxuICAuLi5wcm9wc1xufTogYW55KSB7XG4gIHJldHVybiAoXG4gICAgPGlucHV0XG4gICAgICByZWY9e2lubmVyUmVmfVxuICAgICAgey4uLnByb3BzfVxuICAgICAgY3NzPXt7XG4gICAgICAgIGxhYmVsOiAnZHVtbXlJbnB1dCcsXG4gICAgICAgIC8vIGdldCByaWQgb2YgYW55IGRlZmF1bHQgc3R5bGVzXG4gICAgICAgIGJhY2tncm91bmQ6IDAsXG4gICAgICAgIGJvcmRlcjogMCxcbiAgICAgICAgZm9udFNpemU6ICdpbmhlcml0JyxcbiAgICAgICAgb3V0bGluZTogMCxcbiAgICAgICAgcGFkZGluZzogMCxcbiAgICAgICAgLy8gaW1wb3J0YW50ISB3aXRob3V0IGB3aWR0aGAgYnJvd3NlcnMgd29uJ3QgYWxsb3cgZm9jdXNcbiAgICAgICAgd2lkdGg6IDEsXG5cbiAgICAgICAgLy8gcmVtb3ZlIGN1cnNvciBvbiBkZXNrdG9wXG4gICAgICAgIGNvbG9yOiAndHJhbnNwYXJlbnQnLFxuXG4gICAgICAgIC8vIHJlbW92ZSBjdXJzb3Igb24gbW9iaWxlIHdoaWxzdCBtYWludGFpbmluZyBcInNjcm9sbCBpbnRvIHZpZXdcIiBiZWhhdmlvdXJcbiAgICAgICAgbGVmdDogLTEwMCxcbiAgICAgICAgb3BhY2l0eTogMCxcbiAgICAgICAgcG9zaXRpb246ICdyZWxhdGl2ZScsXG4gICAgICAgIHRyYW5zZm9ybTogJ3NjYWxlKDApJyxcbiAgICAgIH19XG4gICAgLz5cbiAgKTtcbn1cbiJdfQ== */\")\n }));\n}\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}\n\nvar NodeResolver = /*#__PURE__*/function (_Component) {\n _inheritsLoose(NodeResolver, _Component);\n\n function NodeResolver() {\n return _Component.apply(this, arguments) || this;\n }\n\n var _proto = NodeResolver.prototype;\n\n _proto.componentDidMount = function componentDidMount() {\n this.props.innerRef(findDOMNode(this));\n };\n\n _proto.componentWillUnmount = function componentWillUnmount() {\n this.props.innerRef(null);\n };\n\n _proto.render = function render() {\n return this.props.children;\n };\n\n return NodeResolver;\n}(Component);\n\nvar STYLE_KEYS = ['boxSizing', 'height', 'overflow', 'paddingRight', 'position'];\nvar LOCK_STYLES = {\n boxSizing: 'border-box',\n // account for possible declaration `width: 100%;` on body\n overflow: 'hidden',\n position: 'relative',\n height: '100%'\n};\n\nfunction preventTouchMove(e) {\n e.preventDefault();\n}\n\nfunction allowTouchMove(e) {\n e.stopPropagation();\n}\n\nfunction preventInertiaScroll() {\n var top = this.scrollTop;\n var totalScroll = this.scrollHeight;\n var currentScroll = top + this.offsetHeight;\n\n if (top === 0) {\n this.scrollTop = 1;\n } else if (currentScroll === totalScroll) {\n this.scrollTop = top - 1;\n }\n} // `ontouchstart` check works on most browsers\n// `maxTouchPoints` works on IE10/11 and Surface\n\n\nfunction isTouchDevice() {\n return 'ontouchstart' in window || navigator.maxTouchPoints;\n}\n\nfunction _inheritsLoose$1(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}\n\nvar canUseDOM = !!(window.document && window.document.createElement);\nvar activeScrollLocks = 0;\n\nvar ScrollLock = /*#__PURE__*/function (_Component) {\n _inheritsLoose$1(ScrollLock, _Component);\n\n function ScrollLock() {\n var _this;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _Component.call.apply(_Component, [this].concat(args)) || this;\n _this.originalStyles = {};\n _this.listenerOptions = {\n capture: false,\n passive: false\n };\n return _this;\n }\n\n var _proto = ScrollLock.prototype;\n\n _proto.componentDidMount = function componentDidMount() {\n var _this2 = this;\n\n if (!canUseDOM) return;\n var _this$props = this.props,\n accountForScrollbars = _this$props.accountForScrollbars,\n touchScrollTarget = _this$props.touchScrollTarget;\n var target = document.body;\n var targetStyle = target && target.style;\n\n if (accountForScrollbars) {\n // store any styles already applied to the body\n STYLE_KEYS.forEach(function (key) {\n var val = targetStyle && targetStyle[key];\n _this2.originalStyles[key] = val;\n });\n } // apply the lock styles and padding if this is the first scroll lock\n\n\n if (accountForScrollbars && activeScrollLocks < 1) {\n var currentPadding = parseInt(this.originalStyles.paddingRight, 10) || 0;\n var clientWidth = document.body ? document.body.clientWidth : 0;\n var adjustedPadding = window.innerWidth - clientWidth + currentPadding || 0;\n Object.keys(LOCK_STYLES).forEach(function (key) {\n var val = LOCK_STYLES[key];\n\n if (targetStyle) {\n targetStyle[key] = val;\n }\n });\n\n if (targetStyle) {\n targetStyle.paddingRight = adjustedPadding + \"px\";\n }\n } // account for touch devices\n\n\n if (target && isTouchDevice()) {\n // Mobile Safari ignores { overflow: hidden } declaration on the body.\n target.addEventListener('touchmove', preventTouchMove, this.listenerOptions); // Allow scroll on provided target\n\n if (touchScrollTarget) {\n touchScrollTarget.addEventListener('touchstart', preventInertiaScroll, this.listenerOptions);\n touchScrollTarget.addEventListener('touchmove', allowTouchMove, this.listenerOptions);\n }\n } // increment active scroll locks\n\n\n activeScrollLocks += 1;\n };\n\n _proto.componentWillUnmount = function componentWillUnmount() {\n var _this3 = this;\n\n if (!canUseDOM) return;\n var _this$props2 = this.props,\n accountForScrollbars = _this$props2.accountForScrollbars,\n touchScrollTarget = _this$props2.touchScrollTarget;\n var target = document.body;\n var targetStyle = target && target.style; // safely decrement active scroll locks\n\n activeScrollLocks = Math.max(activeScrollLocks - 1, 0); // reapply original body styles, if any\n\n if (accountForScrollbars && activeScrollLocks < 1) {\n STYLE_KEYS.forEach(function (key) {\n var val = _this3.originalStyles[key];\n\n if (targetStyle) {\n targetStyle[key] = val;\n }\n });\n } // remove touch listeners\n\n\n if (target && isTouchDevice()) {\n target.removeEventListener('touchmove', preventTouchMove, this.listenerOptions);\n\n if (touchScrollTarget) {\n touchScrollTarget.removeEventListener('touchstart', preventInertiaScroll, this.listenerOptions);\n touchScrollTarget.removeEventListener('touchmove', allowTouchMove, this.listenerOptions);\n }\n }\n };\n\n _proto.render = function render() {\n return null;\n };\n\n return ScrollLock;\n}(Component);\n\nScrollLock.defaultProps = {\n accountForScrollbars: true\n};\n\nfunction _inheritsLoose$2(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}\n\nvar _ref$1 = process.env.NODE_ENV === \"production\" ? {\n name: \"1dsbpcp\",\n styles: \"position:fixed;left:0;bottom:0;right:0;top:0;\"\n} : {\n name: \"1dsbpcp\",\n styles: \"position:fixed;left:0;bottom:0;right:0;top:0;\",\n map: \"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlNjcm9sbEJsb2NrLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQTZEVSIsImZpbGUiOiJTY3JvbGxCbG9jay5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8vIEBmbG93XG4vKiogQGpzeCBqc3ggKi9cbmltcG9ydCB7IFB1cmVDb21wb25lbnQsIHR5cGUgRWxlbWVudCB9IGZyb20gJ3JlYWN0JztcbmltcG9ydCB7IGpzeCB9IGZyb20gJ0BlbW90aW9uL2NvcmUnO1xuaW1wb3J0IE5vZGVSZXNvbHZlciBmcm9tICcuL05vZGVSZXNvbHZlcic7XG5pbXBvcnQgU2Nyb2xsTG9jayBmcm9tICcuL1Njcm9sbExvY2svaW5kZXgnO1xuXG50eXBlIFByb3BzID0ge1xuICBjaGlsZHJlbjogRWxlbWVudDwqPixcbiAgaXNFbmFibGVkOiBib29sZWFuLFxufTtcbnR5cGUgU3RhdGUgPSB7XG4gIHRvdWNoU2Nyb2xsVGFyZ2V0OiBIVE1MRWxlbWVudCB8IG51bGwsXG59O1xuXG4vLyBOT1RFOlxuLy8gV2Ugc2hvdWxkbid0IG5lZWQgdGhpcyBhZnRlciB1cGRhdGluZyB0byBSZWFjdCB2MTYuMy4wLCB3aGljaCBpbnRyb2R1Y2VzOlxuLy8gLSBjcmVhdGVSZWYoKSBodHRwczovL3JlYWN0anMub3JnL2RvY3MvcmVhY3QtYXBpLmh0bWwjcmVhY3RjcmVhdGVyZWZcbi8vIC0gZm9yd2FyZFJlZigpIGh0dHBzOi8vcmVhY3Rqcy5vcmcvZG9jcy9yZWFjdC1hcGkuaHRtbCNyZWFjdGZvcndhcmRyZWZcblxuZXhwb3J0IGRlZmF1bHQgY2xhc3MgU2Nyb2xsQmxvY2sgZXh0ZW5kcyBQdXJlQ29tcG9uZW50PFByb3BzLCBTdGF0ZT4ge1xuICBzdGF0ZSA9IHsgdG91Y2hTY3JvbGxUYXJnZXQ6IG51bGwgfTtcblxuICAvLyBtdXN0IGJlIGluIHN0YXRlIHRvIHRyaWdnZXIgYSByZS1yZW5kZXIsIG9ubHkgcnVucyBvbmNlIHBlciBpbnN0YW5jZVxuICBnZXRTY3JvbGxUYXJnZXQgPSAocmVmOiBIVE1MRWxlbWVudCkgPT4ge1xuICAgIGlmIChyZWYgPT09IHRoaXMuc3RhdGUudG91Y2hTY3JvbGxUYXJnZXQpIHJldHVybjtcbiAgICB0aGlzLnNldFN0YXRlKHsgdG91Y2hTY3JvbGxUYXJnZXQ6IHJlZiB9KTtcbiAgfTtcblxuICAvLyB0aGlzIHdpbGwgY2xvc2UgdGhlIG1lbnUgd2hlbiBhIHVzZXIgY2xpY2tzIG91dHNpZGVcbiAgYmx1clNlbGVjdElucHV0ID0gKCkgPT4ge1xuICAgIGlmIChkb2N1bWVudC5hY3RpdmVFbGVtZW50KSB7XG4gICAgICBkb2N1bWVudC5hY3RpdmVFbGVtZW50LmJsdXIoKTtcbiAgICB9XG4gIH07XG5cbiAgcmVuZGVyKCkge1xuICAgIGNvbnN0IHsgY2hpbGRyZW4sIGlzRW5hYmxlZCB9ID0gdGhpcy5wcm9wcztcbiAgICBjb25zdCB7IHRvdWNoU2Nyb2xsVGFyZ2V0IH0gPSB0aGlzLnN0YXRlO1xuXG4gICAgLy8gYmFpbCBlYXJseSBpZiBub3QgZW5hYmxlZFxuICAgIGlmICghaXNFbmFibGVkKSByZXR1cm4gY2hpbGRyZW47XG5cbiAgICAvKlxuICAgICAqIERpdlxuICAgICAqIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLVxuICAgICAqIGJsb2NrcyBzY3JvbGxpbmcgb24gbm9uLWJvZHkgZWxlbWVudHMgYmVoaW5kIHRoZSBtZW51XG5cbiAgICAgKiBOb2RlUmVzb2x2ZXJcbiAgICAgKiAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS1cbiAgICAgKiB3ZSBuZWVkIGEgcmVmZXJlbmNlIHRvIHRoZSBzY3JvbGxhYmxlIGVsZW1lbnQgdG8gXCJ1bmxvY2tcIiBzY3JvbGwgb25cbiAgICAgKiBtb2JpbGUgZGV2aWNlc1xuXG4gICAgICogU2Nyb2xsTG9ja1xuICAgICAqIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLVxuICAgICAqIGFjdHVhbGx5IGRvZXMgdGhlIHNjcm9sbCBsb2NraW5nXG4gICAgICovXG4gICAgcmV0dXJuIChcbiAgICAgIDxkaXY+XG4gICAgICAgIDxkaXZcbiAgICAgICAgICBvbkNsaWNrPXt0aGlzLmJsdXJTZWxlY3RJbnB1dH1cbiAgICAgICAgICBjc3M9e3sgcG9zaXRpb246ICdmaXhlZCcsIGxlZnQ6IDAsIGJvdHRvbTogMCwgcmlnaHQ6IDAsIHRvcDogMCB9fVxuICAgICAgICAvPlxuICAgICAgICA8Tm9kZVJlc29sdmVyIGlubmVyUmVmPXt0aGlzLmdldFNjcm9sbFRhcmdldH0+e2NoaWxkcmVufTwvTm9kZVJlc29sdmVyPlxuICAgICAgICB7dG91Y2hTY3JvbGxUYXJnZXQgPyAoXG4gICAgICAgICAgPFNjcm9sbExvY2sgdG91Y2hTY3JvbGxUYXJnZXQ9e3RvdWNoU2Nyb2xsVGFyZ2V0fSAvPlxuICAgICAgICApIDogbnVsbH1cbiAgICAgIDwvZGl2PlxuICAgICk7XG4gIH1cbn1cbiJdfQ== */\"\n}; // NOTE:\n// We shouldn't need this after updating to React v16.3.0, which introduces:\n// - createRef() https://reactjs.org/docs/react-api.html#reactcreateref\n// - forwardRef() https://reactjs.org/docs/react-api.html#reactforwardref\n\n\nvar ScrollBlock = /*#__PURE__*/function (_PureComponent) {\n _inheritsLoose$2(ScrollBlock, _PureComponent);\n\n function ScrollBlock() {\n var _this;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _PureComponent.call.apply(_PureComponent, [this].concat(args)) || this;\n _this.state = {\n touchScrollTarget: null\n };\n\n _this.getScrollTarget = function (ref) {\n if (ref === _this.state.touchScrollTarget) return;\n\n _this.setState({\n touchScrollTarget: ref\n });\n };\n\n _this.blurSelectInput = function () {\n if (document.activeElement) {\n document.activeElement.blur();\n }\n };\n\n return _this;\n }\n\n var _proto = ScrollBlock.prototype;\n\n _proto.render = function render() {\n var _this$props = this.props,\n children = _this$props.children,\n isEnabled = _this$props.isEnabled;\n var touchScrollTarget = this.state.touchScrollTarget; // bail early if not enabled\n\n if (!isEnabled) return children;\n /*\n * Div\n * ------------------------------\n * blocks scrolling on non-body elements behind the menu\n * NodeResolver\n * ------------------------------\n * we need a reference to the scrollable element to \"unlock\" scroll on\n * mobile devices\n * ScrollLock\n * ------------------------------\n * actually does the scroll locking\n */\n\n return jsx(\"div\", null, jsx(\"div\", {\n onClick: this.blurSelectInput,\n css: _ref$1\n }), jsx(NodeResolver, {\n innerRef: this.getScrollTarget\n }, children), touchScrollTarget ? jsx(ScrollLock, {\n touchScrollTarget: touchScrollTarget\n }) : null);\n };\n\n return ScrollBlock;\n}(PureComponent);\n\nfunction _objectWithoutPropertiesLoose$1(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction _inheritsLoose$3(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}\n\nvar ScrollCaptor = /*#__PURE__*/function (_Component) {\n _inheritsLoose$3(ScrollCaptor, _Component);\n\n function ScrollCaptor() {\n var _this;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _Component.call.apply(_Component, [this].concat(args)) || this;\n _this.isBottom = false;\n _this.isTop = false;\n _this.scrollTarget = void 0;\n _this.touchStart = void 0;\n\n _this.cancelScroll = function (event) {\n event.preventDefault();\n event.stopPropagation();\n };\n\n _this.handleEventDelta = function (event, delta) {\n var _this$props = _this.props,\n onBottomArrive = _this$props.onBottomArrive,\n onBottomLeave = _this$props.onBottomLeave,\n onTopArrive = _this$props.onTopArrive,\n onTopLeave = _this$props.onTopLeave;\n var _this$scrollTarget = _this.scrollTarget,\n scrollTop = _this$scrollTarget.scrollTop,\n scrollHeight = _this$scrollTarget.scrollHeight,\n clientHeight = _this$scrollTarget.clientHeight;\n var target = _this.scrollTarget;\n var isDeltaPositive = delta > 0;\n var availableScroll = scrollHeight - clientHeight - scrollTop;\n var shouldCancelScroll = false; // reset bottom/top flags\n\n if (availableScroll > delta && _this.isBottom) {\n if (onBottomLeave) onBottomLeave(event);\n _this.isBottom = false;\n }\n\n if (isDeltaPositive && _this.isTop) {\n if (onTopLeave) onTopLeave(event);\n _this.isTop = false;\n } // bottom limit\n\n\n if (isDeltaPositive && delta > availableScroll) {\n if (onBottomArrive && !_this.isBottom) {\n onBottomArrive(event);\n }\n\n target.scrollTop = scrollHeight;\n shouldCancelScroll = true;\n _this.isBottom = true; // top limit\n } else if (!isDeltaPositive && -delta > scrollTop) {\n if (onTopArrive && !_this.isTop) {\n onTopArrive(event);\n }\n\n target.scrollTop = 0;\n shouldCancelScroll = true;\n _this.isTop = true;\n } // cancel scroll\n\n\n if (shouldCancelScroll) {\n _this.cancelScroll(event);\n }\n };\n\n _this.onWheel = function (event) {\n _this.handleEventDelta(event, event.deltaY);\n };\n\n _this.onTouchStart = function (event) {\n // set touch start so we can calculate touchmove delta\n _this.touchStart = event.changedTouches[0].clientY;\n };\n\n _this.onTouchMove = function (event) {\n var deltaY = _this.touchStart - event.changedTouches[0].clientY;\n\n _this.handleEventDelta(event, deltaY);\n };\n\n _this.getScrollTarget = function (ref) {\n _this.scrollTarget = ref;\n };\n\n return _this;\n }\n\n var _proto = ScrollCaptor.prototype;\n\n _proto.componentDidMount = function componentDidMount() {\n this.startListening(this.scrollTarget);\n };\n\n _proto.componentWillUnmount = function componentWillUnmount() {\n this.stopListening(this.scrollTarget);\n };\n\n _proto.startListening = function startListening(el) {\n // bail early if no element is available to attach to\n if (!el) return; // all the if statements are to appease Flow 😢\n\n if (typeof el.addEventListener === 'function') {\n el.addEventListener('wheel', this.onWheel, false);\n }\n\n if (typeof el.addEventListener === 'function') {\n el.addEventListener('touchstart', this.onTouchStart, false);\n }\n\n if (typeof el.addEventListener === 'function') {\n el.addEventListener('touchmove', this.onTouchMove, false);\n }\n };\n\n _proto.stopListening = function stopListening(el) {\n // all the if statements are to appease Flow 😢\n if (typeof el.removeEventListener === 'function') {\n el.removeEventListener('wheel', this.onWheel, false);\n }\n\n if (typeof el.removeEventListener === 'function') {\n el.removeEventListener('touchstart', this.onTouchStart, false);\n }\n\n if (typeof el.removeEventListener === 'function') {\n el.removeEventListener('touchmove', this.onTouchMove, false);\n }\n };\n\n _proto.render = function render() {\n return React.createElement(NodeResolver, {\n innerRef: this.getScrollTarget\n }, this.props.children);\n };\n\n return ScrollCaptor;\n}(Component);\n\nfunction ScrollCaptorSwitch(_ref) {\n var _ref$isEnabled = _ref.isEnabled,\n isEnabled = _ref$isEnabled === void 0 ? true : _ref$isEnabled,\n props = _objectWithoutPropertiesLoose$1(_ref, [\"isEnabled\"]);\n\n return isEnabled ? React.createElement(ScrollCaptor, props) : props.children;\n}\n\nvar instructionsAriaMessage = function instructionsAriaMessage(event, context) {\n if (context === void 0) {\n context = {};\n }\n\n var _context = context,\n isSearchable = _context.isSearchable,\n isMulti = _context.isMulti,\n label = _context.label,\n isDisabled = _context.isDisabled;\n\n switch (event) {\n case 'menu':\n return \"Use Up and Down to choose options\" + (isDisabled ? '' : ', press Enter to select the currently focused option') + \", press Escape to exit the menu, press Tab to select the option and exit the menu.\";\n\n case 'input':\n return (label ? label : 'Select') + \" is focused \" + (isSearchable ? ',type to refine list' : '') + \", press Down to open the menu, \" + (isMulti ? ' press left to focus selected values' : '');\n\n case 'value':\n return 'Use left and right to toggle between focused values, press Backspace to remove the currently focused value';\n }\n};\n\nvar valueEventAriaMessage = function valueEventAriaMessage(event, context) {\n var value = context.value,\n isDisabled = context.isDisabled;\n if (!value) return;\n\n switch (event) {\n case 'deselect-option':\n case 'pop-value':\n case 'remove-value':\n return \"option \" + value + \", deselected.\";\n\n case 'select-option':\n return isDisabled ? \"option \" + value + \" is disabled. Select another option.\" : \"option \" + value + \", selected.\";\n }\n};\n\nvar valueFocusAriaMessage = function valueFocusAriaMessage(_ref) {\n var focusedValue = _ref.focusedValue,\n getOptionLabel = _ref.getOptionLabel,\n selectValue = _ref.selectValue;\n return \"value \" + getOptionLabel(focusedValue) + \" focused, \" + (selectValue.indexOf(focusedValue) + 1) + \" of \" + selectValue.length + \".\";\n};\n\nvar optionFocusAriaMessage = function optionFocusAriaMessage(_ref2) {\n var focusedOption = _ref2.focusedOption,\n getOptionLabel = _ref2.getOptionLabel,\n options = _ref2.options;\n return \"option \" + getOptionLabel(focusedOption) + \" focused\" + (focusedOption.isDisabled ? ' disabled' : '') + \", \" + (options.indexOf(focusedOption) + 1) + \" of \" + options.length + \".\";\n};\n\nvar resultsAriaMessage = function resultsAriaMessage(_ref3) {\n var inputValue = _ref3.inputValue,\n screenReaderMessage = _ref3.screenReaderMessage;\n return \"\" + screenReaderMessage + (inputValue ? ' for search term ' + inputValue : '') + \".\";\n};\n\nvar formatGroupLabel = function formatGroupLabel(group) {\n return group.label;\n};\n\nvar getOptionLabel = function getOptionLabel(option) {\n return option.label;\n};\n\nvar getOptionValue = function getOptionValue(option) {\n return option.value;\n};\n\nvar isOptionDisabled = function isOptionDisabled(option) {\n return !!option.isDisabled;\n};\n\nfunction _extends$3() {\n _extends$3 = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends$3.apply(this, arguments);\n}\n\nvar defaultStyles = {\n clearIndicator: clearIndicatorCSS,\n container: containerCSS,\n control: css,\n dropdownIndicator: dropdownIndicatorCSS,\n group: groupCSS,\n groupHeading: groupHeadingCSS,\n indicatorsContainer: indicatorsContainerCSS,\n indicatorSeparator: indicatorSeparatorCSS,\n input: inputCSS,\n loadingIndicator: loadingIndicatorCSS,\n loadingMessage: loadingMessageCSS,\n menu: menuCSS,\n menuList: menuListCSS,\n menuPortal: menuPortalCSS,\n multiValue: multiValueCSS,\n multiValueLabel: multiValueLabelCSS,\n multiValueRemove: multiValueRemoveCSS,\n noOptionsMessage: noOptionsMessageCSS,\n option: optionCSS,\n placeholder: placeholderCSS,\n singleValue: css$1,\n valueContainer: valueContainerCSS\n}; // Merge Utility\n// Allows consumers to extend a base Select with additional styles\n\nfunction mergeStyles(source, target) {\n if (target === void 0) {\n target = {};\n } // initialize with source styles\n\n\n var styles = _extends$3({}, source); // massage in target styles\n\n\n Object.keys(target).forEach(function (key) {\n if (source[key]) {\n styles[key] = function (rsCss, props) {\n return target[key](source[key](rsCss, props), props);\n };\n } else {\n styles[key] = target[key];\n }\n });\n return styles;\n}\n\nvar colors = {\n primary: '#2684FF',\n primary75: '#4C9AFF',\n primary50: '#B2D4FF',\n primary25: '#DEEBFF',\n danger: '#DE350B',\n dangerLight: '#FFBDAD',\n neutral0: 'hsl(0, 0%, 100%)',\n neutral5: 'hsl(0, 0%, 95%)',\n neutral10: 'hsl(0, 0%, 90%)',\n neutral20: 'hsl(0, 0%, 80%)',\n neutral30: 'hsl(0, 0%, 70%)',\n neutral40: 'hsl(0, 0%, 60%)',\n neutral50: 'hsl(0, 0%, 50%)',\n neutral60: 'hsl(0, 0%, 40%)',\n neutral70: 'hsl(0, 0%, 30%)',\n neutral80: 'hsl(0, 0%, 20%)',\n neutral90: 'hsl(0, 0%, 10%)'\n};\nvar borderRadius = 4; // Used to calculate consistent margin/padding on elements\n\nvar baseUnit = 4; // The minimum height of the control\n\nvar controlHeight = 38; // The amount of space between the control and menu */\n\nvar menuGutter = baseUnit * 2;\nvar spacing = {\n baseUnit: baseUnit,\n controlHeight: controlHeight,\n menuGutter: menuGutter\n};\nvar defaultTheme = {\n borderRadius: borderRadius,\n colors: colors,\n spacing: spacing\n};\n\nfunction _objectWithoutPropertiesLoose$2(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction _extends$4() {\n _extends$4 = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends$4.apply(this, arguments);\n}\n\nfunction _inheritsLoose$4(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nvar defaultProps = {\n backspaceRemovesValue: true,\n blurInputOnSelect: isTouchCapable(),\n captureMenuScroll: !isTouchCapable(),\n closeMenuOnSelect: true,\n closeMenuOnScroll: false,\n components: {},\n controlShouldRenderValue: true,\n escapeClearsValue: false,\n filterOption: createFilter(),\n formatGroupLabel: formatGroupLabel,\n getOptionLabel: getOptionLabel,\n getOptionValue: getOptionValue,\n isDisabled: false,\n isLoading: false,\n isMulti: false,\n isRtl: false,\n isSearchable: true,\n isOptionDisabled: isOptionDisabled,\n loadingMessage: function loadingMessage() {\n return 'Loading...';\n },\n maxMenuHeight: 300,\n minMenuHeight: 140,\n menuIsOpen: false,\n menuPlacement: 'bottom',\n menuPosition: 'absolute',\n menuShouldBlockScroll: false,\n menuShouldScrollIntoView: !isMobileDevice(),\n noOptionsMessage: function noOptionsMessage() {\n return 'No options';\n },\n openMenuOnFocus: false,\n openMenuOnClick: true,\n options: [],\n pageSize: 5,\n placeholder: 'Select...',\n screenReaderStatus: function screenReaderStatus(_ref) {\n var count = _ref.count;\n return count + \" result\" + (count !== 1 ? 's' : '') + \" available\";\n },\n styles: {},\n tabIndex: '0',\n tabSelectsValue: true\n};\nvar instanceId = 1;\n\nvar Select = /*#__PURE__*/function (_Component) {\n _inheritsLoose$4(Select, _Component); // Misc. Instance Properties\n // ------------------------------\n // TODO\n // Refs\n // ------------------------------\n // Lifecycle\n // ------------------------------\n\n\n function Select(_props) {\n var _this;\n\n _this = _Component.call(this, _props) || this;\n _this.state = {\n ariaLiveSelection: '',\n ariaLiveContext: '',\n focusedOption: null,\n focusedValue: null,\n inputIsHidden: false,\n isFocused: false,\n menuOptions: {\n render: [],\n focusable: []\n },\n selectValue: []\n };\n _this.blockOptionHover = false;\n _this.isComposing = false;\n _this.clearFocusValueOnUpdate = false;\n _this.commonProps = void 0;\n _this.components = void 0;\n _this.hasGroups = false;\n _this.initialTouchX = 0;\n _this.initialTouchY = 0;\n _this.inputIsHiddenAfterUpdate = void 0;\n _this.instancePrefix = '';\n _this.openAfterFocus = false;\n _this.scrollToFocusedOptionOnUpdate = false;\n _this.userIsDragging = void 0;\n _this.controlRef = null;\n\n _this.getControlRef = function (ref) {\n _this.controlRef = ref;\n };\n\n _this.focusedOptionRef = null;\n\n _this.getFocusedOptionRef = function (ref) {\n _this.focusedOptionRef = ref;\n };\n\n _this.menuListRef = null;\n\n _this.getMenuListRef = function (ref) {\n _this.menuListRef = ref;\n };\n\n _this.inputRef = null;\n\n _this.getInputRef = function (ref) {\n _this.inputRef = ref;\n };\n\n _this.cacheComponents = function (components) {\n _this.components = defaultComponents({\n components: components\n });\n };\n\n _this.focus = _this.focusInput;\n _this.blur = _this.blurInput;\n\n _this.onChange = function (newValue, actionMeta) {\n var _this$props = _this.props,\n onChange = _this$props.onChange,\n name = _this$props.name;\n onChange(newValue, _extends$4({}, actionMeta, {\n name: name\n }));\n };\n\n _this.setValue = function (newValue, action, option) {\n if (action === void 0) {\n action = 'set-value';\n }\n\n var _this$props2 = _this.props,\n closeMenuOnSelect = _this$props2.closeMenuOnSelect,\n isMulti = _this$props2.isMulti;\n\n _this.onInputChange('', {\n action: 'set-value'\n });\n\n if (closeMenuOnSelect) {\n _this.inputIsHiddenAfterUpdate = !isMulti;\n\n _this.onMenuClose();\n } // when the select value should change, we should reset focusedValue\n\n\n _this.clearFocusValueOnUpdate = true;\n\n _this.onChange(newValue, {\n action: action,\n option: option\n });\n };\n\n _this.selectOption = function (newValue) {\n var _this$props3 = _this.props,\n blurInputOnSelect = _this$props3.blurInputOnSelect,\n isMulti = _this$props3.isMulti;\n var selectValue = _this.state.selectValue;\n\n if (isMulti) {\n if (_this.isOptionSelected(newValue, selectValue)) {\n var candidate = _this.getOptionValue(newValue);\n\n _this.setValue(selectValue.filter(function (i) {\n return _this.getOptionValue(i) !== candidate;\n }), 'deselect-option', newValue);\n\n _this.announceAriaLiveSelection({\n event: 'deselect-option',\n context: {\n value: _this.getOptionLabel(newValue)\n }\n });\n } else {\n if (!_this.isOptionDisabled(newValue, selectValue)) {\n _this.setValue([].concat(selectValue, [newValue]), 'select-option', newValue);\n\n _this.announceAriaLiveSelection({\n event: 'select-option',\n context: {\n value: _this.getOptionLabel(newValue)\n }\n });\n } else {\n // announce that option is disabled\n _this.announceAriaLiveSelection({\n event: 'select-option',\n context: {\n value: _this.getOptionLabel(newValue),\n isDisabled: true\n }\n });\n }\n }\n } else {\n if (!_this.isOptionDisabled(newValue, selectValue)) {\n _this.setValue(newValue, 'select-option');\n\n _this.announceAriaLiveSelection({\n event: 'select-option',\n context: {\n value: _this.getOptionLabel(newValue)\n }\n });\n } else {\n // announce that option is disabled\n _this.announceAriaLiveSelection({\n event: 'select-option',\n context: {\n value: _this.getOptionLabel(newValue),\n isDisabled: true\n }\n });\n }\n }\n\n if (blurInputOnSelect) {\n _this.blurInput();\n }\n };\n\n _this.removeValue = function (removedValue) {\n var selectValue = _this.state.selectValue;\n\n var candidate = _this.getOptionValue(removedValue);\n\n var newValue = selectValue.filter(function (i) {\n return _this.getOptionValue(i) !== candidate;\n });\n\n _this.onChange(newValue.length ? newValue : null, {\n action: 'remove-value',\n removedValue: removedValue\n });\n\n _this.announceAriaLiveSelection({\n event: 'remove-value',\n context: {\n value: removedValue ? _this.getOptionLabel(removedValue) : ''\n }\n });\n\n _this.focusInput();\n };\n\n _this.clearValue = function () {\n var isMulti = _this.props.isMulti;\n\n _this.onChange(isMulti ? [] : null, {\n action: 'clear'\n });\n };\n\n _this.popValue = function () {\n var selectValue = _this.state.selectValue;\n var lastSelectedValue = selectValue[selectValue.length - 1];\n var newValue = selectValue.slice(0, selectValue.length - 1);\n\n _this.announceAriaLiveSelection({\n event: 'pop-value',\n context: {\n value: lastSelectedValue ? _this.getOptionLabel(lastSelectedValue) : ''\n }\n });\n\n _this.onChange(newValue.length ? newValue : null, {\n action: 'pop-value',\n removedValue: lastSelectedValue\n });\n };\n\n _this.getOptionLabel = function (data) {\n return _this.props.getOptionLabel(data);\n };\n\n _this.getOptionValue = function (data) {\n return _this.props.getOptionValue(data);\n };\n\n _this.getStyles = function (key, props) {\n var base = defaultStyles[key](props);\n base.boxSizing = 'border-box';\n var custom = _this.props.styles[key];\n return custom ? custom(base, props) : base;\n };\n\n _this.getElementId = function (element) {\n return _this.instancePrefix + \"-\" + element;\n };\n\n _this.getActiveDescendentId = function () {\n var menuIsOpen = _this.props.menuIsOpen;\n var _this$state = _this.state,\n menuOptions = _this$state.menuOptions,\n focusedOption = _this$state.focusedOption;\n if (!focusedOption || !menuIsOpen) return undefined;\n var index = menuOptions.focusable.indexOf(focusedOption);\n var option = menuOptions.render[index];\n return option && option.key;\n };\n\n _this.announceAriaLiveSelection = function (_ref2) {\n var event = _ref2.event,\n context = _ref2.context;\n\n _this.setState({\n ariaLiveSelection: valueEventAriaMessage(event, context)\n });\n };\n\n _this.announceAriaLiveContext = function (_ref3) {\n var event = _ref3.event,\n context = _ref3.context;\n\n _this.setState({\n ariaLiveContext: instructionsAriaMessage(event, _extends$4({}, context, {\n label: _this.props['aria-label']\n }))\n });\n };\n\n _this.onMenuMouseDown = function (event) {\n if (event.button !== 0) {\n return;\n }\n\n event.stopPropagation();\n event.preventDefault();\n\n _this.focusInput();\n };\n\n _this.onMenuMouseMove = function (event) {\n _this.blockOptionHover = false;\n };\n\n _this.onControlMouseDown = function (event) {\n var openMenuOnClick = _this.props.openMenuOnClick;\n\n if (!_this.state.isFocused) {\n if (openMenuOnClick) {\n _this.openAfterFocus = true;\n }\n\n _this.focusInput();\n } else if (!_this.props.menuIsOpen) {\n if (openMenuOnClick) {\n _this.openMenu('first');\n }\n } else {\n if ( // $FlowFixMe\n event.target.tagName !== 'INPUT' && event.target.tagName !== 'TEXTAREA') {\n _this.onMenuClose();\n }\n }\n\n if ( // $FlowFixMe\n event.target.tagName !== 'INPUT' && event.target.tagName !== 'TEXTAREA') {\n event.preventDefault();\n }\n };\n\n _this.onDropdownIndicatorMouseDown = function (event) {\n // ignore mouse events that weren't triggered by the primary button\n if (event && event.type === 'mousedown' && event.button !== 0) {\n return;\n }\n\n if (_this.props.isDisabled) return;\n var _this$props4 = _this.props,\n isMulti = _this$props4.isMulti,\n menuIsOpen = _this$props4.menuIsOpen;\n\n _this.focusInput();\n\n if (menuIsOpen) {\n _this.inputIsHiddenAfterUpdate = !isMulti;\n\n _this.onMenuClose();\n } else {\n _this.openMenu('first');\n }\n\n event.preventDefault();\n event.stopPropagation();\n };\n\n _this.onClearIndicatorMouseDown = function (event) {\n // ignore mouse events that weren't triggered by the primary button\n if (event && event.type === 'mousedown' && event.button !== 0) {\n return;\n }\n\n _this.clearValue();\n\n event.stopPropagation();\n _this.openAfterFocus = false;\n\n if (event.type === 'touchend') {\n _this.focusInput();\n } else {\n setTimeout(function () {\n return _this.focusInput();\n });\n }\n };\n\n _this.onScroll = function (event) {\n if (typeof _this.props.closeMenuOnScroll === 'boolean') {\n if (event.target instanceof HTMLElement && isDocumentElement(event.target)) {\n _this.props.onMenuClose();\n }\n } else if (typeof _this.props.closeMenuOnScroll === 'function') {\n if (_this.props.closeMenuOnScroll(event)) {\n _this.props.onMenuClose();\n }\n }\n };\n\n _this.onCompositionStart = function () {\n _this.isComposing = true;\n };\n\n _this.onCompositionEnd = function () {\n _this.isComposing = false;\n };\n\n _this.onTouchStart = function (_ref4) {\n var touches = _ref4.touches;\n var touch = touches.item(0);\n\n if (!touch) {\n return;\n }\n\n _this.initialTouchX = touch.clientX;\n _this.initialTouchY = touch.clientY;\n _this.userIsDragging = false;\n };\n\n _this.onTouchMove = function (_ref5) {\n var touches = _ref5.touches;\n var touch = touches.item(0);\n\n if (!touch) {\n return;\n }\n\n var deltaX = Math.abs(touch.clientX - _this.initialTouchX);\n var deltaY = Math.abs(touch.clientY - _this.initialTouchY);\n var moveThreshold = 5;\n _this.userIsDragging = deltaX > moveThreshold || deltaY > moveThreshold;\n };\n\n _this.onTouchEnd = function (event) {\n if (_this.userIsDragging) return; // close the menu if the user taps outside\n // we're checking on event.target here instead of event.currentTarget, because we want to assert information\n // on events on child elements, not the document (which we've attached this handler to).\n\n if (_this.controlRef && !_this.controlRef.contains(event.target) && _this.menuListRef && !_this.menuListRef.contains(event.target)) {\n _this.blurInput();\n } // reset move vars\n\n\n _this.initialTouchX = 0;\n _this.initialTouchY = 0;\n };\n\n _this.onControlTouchEnd = function (event) {\n if (_this.userIsDragging) return;\n\n _this.onControlMouseDown(event);\n };\n\n _this.onClearIndicatorTouchEnd = function (event) {\n if (_this.userIsDragging) return;\n\n _this.onClearIndicatorMouseDown(event);\n };\n\n _this.onDropdownIndicatorTouchEnd = function (event) {\n if (_this.userIsDragging) return;\n\n _this.onDropdownIndicatorMouseDown(event);\n };\n\n _this.handleInputChange = function (event) {\n var inputValue = event.currentTarget.value;\n _this.inputIsHiddenAfterUpdate = false;\n\n _this.onInputChange(inputValue, {\n action: 'input-change'\n });\n\n _this.onMenuOpen();\n };\n\n _this.onInputFocus = function (event) {\n var _this$props5 = _this.props,\n isSearchable = _this$props5.isSearchable,\n isMulti = _this$props5.isMulti;\n\n if (_this.props.onFocus) {\n _this.props.onFocus(event);\n }\n\n _this.inputIsHiddenAfterUpdate = false;\n\n _this.announceAriaLiveContext({\n event: 'input',\n context: {\n isSearchable: isSearchable,\n isMulti: isMulti\n }\n });\n\n _this.setState({\n isFocused: true\n });\n\n if (_this.openAfterFocus || _this.props.openMenuOnFocus) {\n _this.openMenu('first');\n }\n\n _this.openAfterFocus = false;\n };\n\n _this.onInputBlur = function (event) {\n if (_this.menuListRef && _this.menuListRef.contains(document.activeElement)) {\n _this.inputRef.focus();\n\n return;\n }\n\n if (_this.props.onBlur) {\n _this.props.onBlur(event);\n }\n\n _this.onInputChange('', {\n action: 'input-blur'\n });\n\n _this.onMenuClose();\n\n _this.setState({\n focusedValue: null,\n isFocused: false\n });\n };\n\n _this.onOptionHover = function (focusedOption) {\n if (_this.blockOptionHover || _this.state.focusedOption === focusedOption) {\n return;\n }\n\n _this.setState({\n focusedOption: focusedOption\n });\n };\n\n _this.shouldHideSelectedOptions = function () {\n var _this$props6 = _this.props,\n hideSelectedOptions = _this$props6.hideSelectedOptions,\n isMulti = _this$props6.isMulti;\n if (hideSelectedOptions === undefined) return isMulti;\n return hideSelectedOptions;\n };\n\n _this.onKeyDown = function (event) {\n var _this$props7 = _this.props,\n isMulti = _this$props7.isMulti,\n backspaceRemovesValue = _this$props7.backspaceRemovesValue,\n escapeClearsValue = _this$props7.escapeClearsValue,\n inputValue = _this$props7.inputValue,\n isClearable = _this$props7.isClearable,\n isDisabled = _this$props7.isDisabled,\n menuIsOpen = _this$props7.menuIsOpen,\n onKeyDown = _this$props7.onKeyDown,\n tabSelectsValue = _this$props7.tabSelectsValue,\n openMenuOnFocus = _this$props7.openMenuOnFocus;\n var _this$state2 = _this.state,\n focusedOption = _this$state2.focusedOption,\n focusedValue = _this$state2.focusedValue,\n selectValue = _this$state2.selectValue;\n if (isDisabled) return;\n\n if (typeof onKeyDown === 'function') {\n onKeyDown(event);\n\n if (event.defaultPrevented) {\n return;\n }\n } // Block option hover events when the user has just pressed a key\n\n\n _this.blockOptionHover = true;\n\n switch (event.key) {\n case 'ArrowLeft':\n if (!isMulti || inputValue) return;\n\n _this.focusValue('previous');\n\n break;\n\n case 'ArrowRight':\n if (!isMulti || inputValue) return;\n\n _this.focusValue('next');\n\n break;\n\n case 'Delete':\n case 'Backspace':\n if (inputValue) return;\n\n if (focusedValue) {\n _this.removeValue(focusedValue);\n } else {\n if (!backspaceRemovesValue) return;\n\n if (isMulti) {\n _this.popValue();\n } else if (isClearable) {\n _this.clearValue();\n }\n }\n\n break;\n\n case 'Tab':\n if (_this.isComposing) return;\n\n if (event.shiftKey || !menuIsOpen || !tabSelectsValue || !focusedOption || // don't capture the event if the menu opens on focus and the focused\n // option is already selected; it breaks the flow of navigation\n openMenuOnFocus && _this.isOptionSelected(focusedOption, selectValue)) {\n return;\n }\n\n _this.selectOption(focusedOption);\n\n break;\n\n case 'Enter':\n if (event.keyCode === 229) {\n // ignore the keydown event from an Input Method Editor(IME)\n // ref. https://www.w3.org/TR/uievents/#determine-keydown-keyup-keyCode\n break;\n }\n\n if (menuIsOpen) {\n if (!focusedOption) return;\n if (_this.isComposing) return;\n\n _this.selectOption(focusedOption);\n\n break;\n }\n\n return;\n\n case 'Escape':\n if (menuIsOpen) {\n _this.inputIsHiddenAfterUpdate = false;\n\n _this.onInputChange('', {\n action: 'menu-close'\n });\n\n _this.onMenuClose();\n } else if (isClearable && escapeClearsValue) {\n _this.clearValue();\n }\n\n break;\n\n case ' ':\n // space\n if (inputValue) {\n return;\n }\n\n if (!menuIsOpen) {\n _this.openMenu('first');\n\n break;\n }\n\n if (!focusedOption) return;\n\n _this.selectOption(focusedOption);\n\n break;\n\n case 'ArrowUp':\n if (menuIsOpen) {\n _this.focusOption('up');\n } else {\n _this.openMenu('last');\n }\n\n break;\n\n case 'ArrowDown':\n if (menuIsOpen) {\n _this.focusOption('down');\n } else {\n _this.openMenu('first');\n }\n\n break;\n\n case 'PageUp':\n if (!menuIsOpen) return;\n\n _this.focusOption('pageup');\n\n break;\n\n case 'PageDown':\n if (!menuIsOpen) return;\n\n _this.focusOption('pagedown');\n\n break;\n\n case 'Home':\n if (!menuIsOpen) return;\n\n _this.focusOption('first');\n\n break;\n\n case 'End':\n if (!menuIsOpen) return;\n\n _this.focusOption('last');\n\n break;\n\n default:\n return;\n }\n\n event.preventDefault();\n };\n\n _this.buildMenuOptions = function (props, selectValue) {\n var _props$inputValue = props.inputValue,\n inputValue = _props$inputValue === void 0 ? '' : _props$inputValue,\n options = props.options;\n\n var toOption = function toOption(option, id) {\n var isDisabled = _this.isOptionDisabled(option, selectValue);\n\n var isSelected = _this.isOptionSelected(option, selectValue);\n\n var label = _this.getOptionLabel(option);\n\n var value = _this.getOptionValue(option);\n\n if (_this.shouldHideSelectedOptions() && isSelected || !_this.filterOption({\n label: label,\n value: value,\n data: option\n }, inputValue)) {\n return;\n }\n\n var onHover = isDisabled ? undefined : function () {\n return _this.onOptionHover(option);\n };\n var onSelect = isDisabled ? undefined : function () {\n return _this.selectOption(option);\n };\n var optionId = _this.getElementId('option') + \"-\" + id;\n return {\n innerProps: {\n id: optionId,\n onClick: onSelect,\n onMouseMove: onHover,\n onMouseOver: onHover,\n tabIndex: -1\n },\n data: option,\n isDisabled: isDisabled,\n isSelected: isSelected,\n key: optionId,\n label: label,\n type: 'option',\n value: value\n };\n };\n\n return options.reduce(function (acc, item, itemIndex) {\n if (item.options) {\n // TODO needs a tidier implementation\n if (!_this.hasGroups) _this.hasGroups = true;\n var items = item.options;\n var children = items.map(function (child, i) {\n var option = toOption(child, itemIndex + \"-\" + i);\n if (option) acc.focusable.push(child);\n return option;\n }).filter(Boolean);\n\n if (children.length) {\n var groupId = _this.getElementId('group') + \"-\" + itemIndex;\n acc.render.push({\n type: 'group',\n key: groupId,\n data: item,\n options: children\n });\n }\n } else {\n var option = toOption(item, \"\" + itemIndex);\n\n if (option) {\n acc.render.push(option);\n acc.focusable.push(item);\n }\n }\n\n return acc;\n }, {\n render: [],\n focusable: []\n });\n };\n\n var _value = _props.value;\n _this.cacheComponents = memoizeOne(_this.cacheComponents, exportedEqual).bind(_assertThisInitialized(_assertThisInitialized(_this)));\n\n _this.cacheComponents(_props.components);\n\n _this.instancePrefix = 'react-select-' + (_this.props.instanceId || ++instanceId);\n\n var _selectValue = cleanValue(_value);\n\n _this.buildMenuOptions = memoizeOne(_this.buildMenuOptions, function (newArgs, lastArgs) {\n var _ref6 = newArgs,\n newProps = _ref6[0],\n newSelectValue = _ref6[1];\n var _ref7 = lastArgs,\n lastProps = _ref7[0],\n lastSelectValue = _ref7[1];\n return exportedEqual(newSelectValue, lastSelectValue) && exportedEqual(newProps.inputValue, lastProps.inputValue) && exportedEqual(newProps.options, lastProps.options);\n }).bind(_assertThisInitialized(_assertThisInitialized(_this)));\n\n var _menuOptions = _props.menuIsOpen ? _this.buildMenuOptions(_props, _selectValue) : {\n render: [],\n focusable: []\n };\n\n _this.state.menuOptions = _menuOptions;\n _this.state.selectValue = _selectValue;\n return _this;\n }\n\n var _proto = Select.prototype;\n\n _proto.componentDidMount = function componentDidMount() {\n this.startListeningComposition();\n this.startListeningToTouch();\n\n if (this.props.closeMenuOnScroll && document && document.addEventListener) {\n // Listen to all scroll events, and filter them out inside of 'onScroll'\n document.addEventListener('scroll', this.onScroll, true);\n }\n\n if (this.props.autoFocus) {\n this.focusInput();\n }\n };\n\n _proto.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(nextProps) {\n var _this$props8 = this.props,\n options = _this$props8.options,\n value = _this$props8.value,\n menuIsOpen = _this$props8.menuIsOpen,\n inputValue = _this$props8.inputValue; // re-cache custom components\n\n this.cacheComponents(nextProps.components); // rebuild the menu options\n\n if (nextProps.value !== value || nextProps.options !== options || nextProps.menuIsOpen !== menuIsOpen || nextProps.inputValue !== inputValue) {\n var selectValue = cleanValue(nextProps.value);\n var menuOptions = nextProps.menuIsOpen ? this.buildMenuOptions(nextProps, selectValue) : {\n render: [],\n focusable: []\n };\n var focusedValue = this.getNextFocusedValue(selectValue);\n var focusedOption = this.getNextFocusedOption(menuOptions.focusable);\n this.setState({\n menuOptions: menuOptions,\n selectValue: selectValue,\n focusedOption: focusedOption,\n focusedValue: focusedValue\n });\n } // some updates should toggle the state of the input visibility\n\n\n if (this.inputIsHiddenAfterUpdate != null) {\n this.setState({\n inputIsHidden: this.inputIsHiddenAfterUpdate\n });\n delete this.inputIsHiddenAfterUpdate;\n }\n };\n\n _proto.componentDidUpdate = function componentDidUpdate(prevProps) {\n var _this$props9 = this.props,\n isDisabled = _this$props9.isDisabled,\n menuIsOpen = _this$props9.menuIsOpen;\n var isFocused = this.state.isFocused;\n\n if ( // ensure focus is restored correctly when the control becomes enabled\n isFocused && !isDisabled && prevProps.isDisabled || // ensure focus is on the Input when the menu opens\n isFocused && menuIsOpen && !prevProps.menuIsOpen) {\n this.focusInput();\n } // scroll the focused option into view if necessary\n\n\n if (this.menuListRef && this.focusedOptionRef && this.scrollToFocusedOptionOnUpdate) {\n scrollIntoView(this.menuListRef, this.focusedOptionRef);\n this.scrollToFocusedOptionOnUpdate = false;\n }\n };\n\n _proto.componentWillUnmount = function componentWillUnmount() {\n this.stopListeningComposition();\n this.stopListeningToTouch();\n document.removeEventListener('scroll', this.onScroll, true);\n }; // ==============================\n // Consumer Handlers\n // ==============================\n\n\n _proto.onMenuOpen = function onMenuOpen() {\n this.props.onMenuOpen();\n };\n\n _proto.onMenuClose = function onMenuClose() {\n var _this$props10 = this.props,\n isSearchable = _this$props10.isSearchable,\n isMulti = _this$props10.isMulti;\n this.announceAriaLiveContext({\n event: 'input',\n context: {\n isSearchable: isSearchable,\n isMulti: isMulti\n }\n });\n this.onInputChange('', {\n action: 'menu-close'\n });\n this.props.onMenuClose();\n };\n\n _proto.onInputChange = function onInputChange(newValue, actionMeta) {\n this.props.onInputChange(newValue, actionMeta);\n } // ==============================\n // Methods\n // ==============================\n ;\n\n _proto.focusInput = function focusInput() {\n if (!this.inputRef) return;\n this.inputRef.focus();\n };\n\n _proto.blurInput = function blurInput() {\n if (!this.inputRef) return;\n this.inputRef.blur();\n } // aliased for consumers\n ;\n\n _proto.openMenu = function openMenu(focusOption) {\n var _this2 = this;\n\n var _this$state3 = this.state,\n selectValue = _this$state3.selectValue,\n isFocused = _this$state3.isFocused;\n var menuOptions = this.buildMenuOptions(this.props, selectValue);\n var isMulti = this.props.isMulti;\n var openAtIndex = focusOption === 'first' ? 0 : menuOptions.focusable.length - 1;\n\n if (!isMulti) {\n var selectedIndex = menuOptions.focusable.indexOf(selectValue[0]);\n\n if (selectedIndex > -1) {\n openAtIndex = selectedIndex;\n }\n } // only scroll if the menu isn't already open\n\n\n this.scrollToFocusedOptionOnUpdate = !(isFocused && this.menuListRef);\n this.inputIsHiddenAfterUpdate = false;\n this.setState({\n menuOptions: menuOptions,\n focusedValue: null,\n focusedOption: menuOptions.focusable[openAtIndex]\n }, function () {\n _this2.onMenuOpen();\n\n _this2.announceAriaLiveContext({\n event: 'menu'\n });\n });\n };\n\n _proto.focusValue = function focusValue(direction) {\n var _this$props11 = this.props,\n isMulti = _this$props11.isMulti,\n isSearchable = _this$props11.isSearchable;\n var _this$state4 = this.state,\n selectValue = _this$state4.selectValue,\n focusedValue = _this$state4.focusedValue; // Only multiselects support value focusing\n\n if (!isMulti) return;\n this.setState({\n focusedOption: null\n });\n var focusedIndex = selectValue.indexOf(focusedValue);\n\n if (!focusedValue) {\n focusedIndex = -1;\n this.announceAriaLiveContext({\n event: 'value'\n });\n }\n\n var lastIndex = selectValue.length - 1;\n var nextFocus = -1;\n if (!selectValue.length) return;\n\n switch (direction) {\n case 'previous':\n if (focusedIndex === 0) {\n // don't cycle from the start to the end\n nextFocus = 0;\n } else if (focusedIndex === -1) {\n // if nothing is focused, focus the last value first\n nextFocus = lastIndex;\n } else {\n nextFocus = focusedIndex - 1;\n }\n\n break;\n\n case 'next':\n if (focusedIndex > -1 && focusedIndex < lastIndex) {\n nextFocus = focusedIndex + 1;\n }\n\n break;\n }\n\n if (nextFocus === -1) {\n this.announceAriaLiveContext({\n event: 'input',\n context: {\n isSearchable: isSearchable,\n isMulti: isMulti\n }\n });\n }\n\n this.setState({\n inputIsHidden: nextFocus !== -1,\n focusedValue: selectValue[nextFocus]\n });\n };\n\n _proto.focusOption = function focusOption(direction) {\n if (direction === void 0) {\n direction = 'first';\n }\n\n var pageSize = this.props.pageSize;\n var _this$state5 = this.state,\n focusedOption = _this$state5.focusedOption,\n menuOptions = _this$state5.menuOptions;\n var options = menuOptions.focusable;\n if (!options.length) return;\n var nextFocus = 0; // handles 'first'\n\n var focusedIndex = options.indexOf(focusedOption);\n\n if (!focusedOption) {\n focusedIndex = -1;\n this.announceAriaLiveContext({\n event: 'menu'\n });\n }\n\n if (direction === 'up') {\n nextFocus = focusedIndex > 0 ? focusedIndex - 1 : options.length - 1;\n } else if (direction === 'down') {\n nextFocus = (focusedIndex + 1) % options.length;\n } else if (direction === 'pageup') {\n nextFocus = focusedIndex - pageSize;\n if (nextFocus < 0) nextFocus = 0;\n } else if (direction === 'pagedown') {\n nextFocus = focusedIndex + pageSize;\n if (nextFocus > options.length - 1) nextFocus = options.length - 1;\n } else if (direction === 'last') {\n nextFocus = options.length - 1;\n }\n\n this.scrollToFocusedOptionOnUpdate = true;\n this.setState({\n focusedOption: options[nextFocus],\n focusedValue: null\n });\n this.announceAriaLiveContext({\n event: 'menu',\n context: {\n isDisabled: isOptionDisabled(options[nextFocus])\n }\n });\n }; // ==============================\n // Getters\n // ==============================\n\n\n _proto.getTheme = function getTheme() {\n // Use the default theme if there are no customizations.\n if (!this.props.theme) {\n return defaultTheme;\n } // If the theme prop is a function, assume the function\n // knows how to merge the passed-in default theme with\n // its own modifications.\n\n\n if (typeof this.props.theme === 'function') {\n return this.props.theme(defaultTheme);\n } // Otherwise, if a plain theme object was passed in,\n // overlay it with the default theme.\n\n\n return _extends$4({}, defaultTheme, this.props.theme);\n };\n\n _proto.getCommonProps = function getCommonProps() {\n var clearValue = this.clearValue,\n getStyles = this.getStyles,\n setValue = this.setValue,\n selectOption = this.selectOption,\n props = this.props;\n var classNamePrefix = props.classNamePrefix,\n isMulti = props.isMulti,\n isRtl = props.isRtl,\n options = props.options;\n var selectValue = this.state.selectValue;\n var hasValue = this.hasValue();\n\n var getValue = function getValue() {\n return selectValue;\n };\n\n var cx = classNames.bind(null, classNamePrefix);\n return {\n cx: cx,\n clearValue: clearValue,\n getStyles: getStyles,\n getValue: getValue,\n hasValue: hasValue,\n isMulti: isMulti,\n isRtl: isRtl,\n options: options,\n selectOption: selectOption,\n setValue: setValue,\n selectProps: props,\n theme: this.getTheme()\n };\n };\n\n _proto.getNextFocusedValue = function getNextFocusedValue(nextSelectValue) {\n if (this.clearFocusValueOnUpdate) {\n this.clearFocusValueOnUpdate = false;\n return null;\n }\n\n var _this$state6 = this.state,\n focusedValue = _this$state6.focusedValue,\n lastSelectValue = _this$state6.selectValue;\n var lastFocusedIndex = lastSelectValue.indexOf(focusedValue);\n\n if (lastFocusedIndex > -1) {\n var nextFocusedIndex = nextSelectValue.indexOf(focusedValue);\n\n if (nextFocusedIndex > -1) {\n // the focused value is still in the selectValue, return it\n return focusedValue;\n } else if (lastFocusedIndex < nextSelectValue.length) {\n // the focusedValue is not present in the next selectValue array by\n // reference, so return the new value at the same index\n return nextSelectValue[lastFocusedIndex];\n }\n }\n\n return null;\n };\n\n _proto.getNextFocusedOption = function getNextFocusedOption(options) {\n var lastFocusedOption = this.state.focusedOption;\n return lastFocusedOption && options.indexOf(lastFocusedOption) > -1 ? lastFocusedOption : options[0];\n };\n\n _proto.hasValue = function hasValue() {\n var selectValue = this.state.selectValue;\n return selectValue.length > 0;\n };\n\n _proto.hasOptions = function hasOptions() {\n return !!this.state.menuOptions.render.length;\n };\n\n _proto.countOptions = function countOptions() {\n return this.state.menuOptions.focusable.length;\n };\n\n _proto.isClearable = function isClearable() {\n var _this$props12 = this.props,\n isClearable = _this$props12.isClearable,\n isMulti = _this$props12.isMulti; // single select, by default, IS NOT clearable\n // multi select, by default, IS clearable\n\n if (isClearable === undefined) return isMulti;\n return isClearable;\n };\n\n _proto.isOptionDisabled = function isOptionDisabled(option, selectValue) {\n return typeof this.props.isOptionDisabled === 'function' ? this.props.isOptionDisabled(option, selectValue) : false;\n };\n\n _proto.isOptionSelected = function isOptionSelected(option, selectValue) {\n var _this3 = this;\n\n if (selectValue.indexOf(option) > -1) return true;\n\n if (typeof this.props.isOptionSelected === 'function') {\n return this.props.isOptionSelected(option, selectValue);\n }\n\n var candidate = this.getOptionValue(option);\n return selectValue.some(function (i) {\n return _this3.getOptionValue(i) === candidate;\n });\n };\n\n _proto.filterOption = function filterOption(option, inputValue) {\n return this.props.filterOption ? this.props.filterOption(option, inputValue) : true;\n };\n\n _proto.formatOptionLabel = function formatOptionLabel(data, context) {\n if (typeof this.props.formatOptionLabel === 'function') {\n var inputValue = this.props.inputValue;\n var selectValue = this.state.selectValue;\n return this.props.formatOptionLabel(data, {\n context: context,\n inputValue: inputValue,\n selectValue: selectValue\n });\n } else {\n return this.getOptionLabel(data);\n }\n };\n\n _proto.formatGroupLabel = function formatGroupLabel(data) {\n return this.props.formatGroupLabel(data);\n } // ==============================\n // Mouse Handlers\n // ==============================\n ; // ==============================\n // Composition Handlers\n // ==============================\n\n\n _proto.startListeningComposition = function startListeningComposition() {\n if (document && document.addEventListener) {\n document.addEventListener('compositionstart', this.onCompositionStart, false);\n document.addEventListener('compositionend', this.onCompositionEnd, false);\n }\n };\n\n _proto.stopListeningComposition = function stopListeningComposition() {\n if (document && document.removeEventListener) {\n document.removeEventListener('compositionstart', this.onCompositionStart);\n document.removeEventListener('compositionend', this.onCompositionEnd);\n }\n }; // ==============================\n // Touch Handlers\n // ==============================\n\n\n _proto.startListeningToTouch = function startListeningToTouch() {\n if (document && document.addEventListener) {\n document.addEventListener('touchstart', this.onTouchStart, false);\n document.addEventListener('touchmove', this.onTouchMove, false);\n document.addEventListener('touchend', this.onTouchEnd, false);\n }\n };\n\n _proto.stopListeningToTouch = function stopListeningToTouch() {\n if (document && document.removeEventListener) {\n document.removeEventListener('touchstart', this.onTouchStart);\n document.removeEventListener('touchmove', this.onTouchMove);\n document.removeEventListener('touchend', this.onTouchEnd);\n }\n }; // ==============================\n // Renderers\n // ==============================\n\n\n _proto.constructAriaLiveMessage = function constructAriaLiveMessage() {\n var _this$state7 = this.state,\n ariaLiveContext = _this$state7.ariaLiveContext,\n selectValue = _this$state7.selectValue,\n focusedValue = _this$state7.focusedValue,\n focusedOption = _this$state7.focusedOption;\n var _this$props13 = this.props,\n options = _this$props13.options,\n menuIsOpen = _this$props13.menuIsOpen,\n inputValue = _this$props13.inputValue,\n screenReaderStatus = _this$props13.screenReaderStatus; // An aria live message representing the currently focused value in the select.\n\n var focusedValueMsg = focusedValue ? valueFocusAriaMessage({\n focusedValue: focusedValue,\n getOptionLabel: this.getOptionLabel,\n selectValue: selectValue\n }) : ''; // An aria live message representing the currently focused option in the select.\n\n var focusedOptionMsg = focusedOption && menuIsOpen ? optionFocusAriaMessage({\n focusedOption: focusedOption,\n getOptionLabel: this.getOptionLabel,\n options: options\n }) : ''; // An aria live message representing the set of focusable results and current searchterm/inputvalue.\n\n var resultsMsg = resultsAriaMessage({\n inputValue: inputValue,\n screenReaderMessage: screenReaderStatus({\n count: this.countOptions()\n })\n });\n return focusedValueMsg + \" \" + focusedOptionMsg + \" \" + resultsMsg + \" \" + ariaLiveContext;\n };\n\n _proto.renderInput = function renderInput() {\n var _this$props14 = this.props,\n isDisabled = _this$props14.isDisabled,\n isSearchable = _this$props14.isSearchable,\n inputId = _this$props14.inputId,\n inputValue = _this$props14.inputValue,\n tabIndex = _this$props14.tabIndex;\n var Input = this.components.Input;\n var inputIsHidden = this.state.inputIsHidden;\n var id = inputId || this.getElementId('input'); // aria attributes makes the JSX \"noisy\", separated for clarity\n\n var ariaAttributes = {\n 'aria-autocomplete': 'list',\n 'aria-label': this.props['aria-label'],\n 'aria-labelledby': this.props['aria-labelledby']\n };\n\n if (!isSearchable) {\n // use a dummy input to maintain focus/blur functionality\n return React.createElement(DummyInput, _extends$4({\n id: id,\n innerRef: this.getInputRef,\n onBlur: this.onInputBlur,\n onChange: noop,\n onFocus: this.onInputFocus,\n readOnly: true,\n disabled: isDisabled,\n tabIndex: tabIndex,\n value: \"\"\n }, ariaAttributes));\n }\n\n var _this$commonProps = this.commonProps,\n cx = _this$commonProps.cx,\n theme = _this$commonProps.theme,\n selectProps = _this$commonProps.selectProps;\n return React.createElement(Input, _extends$4({\n autoCapitalize: \"none\",\n autoComplete: \"off\",\n autoCorrect: \"off\",\n cx: cx,\n getStyles: this.getStyles,\n id: id,\n innerRef: this.getInputRef,\n isDisabled: isDisabled,\n isHidden: inputIsHidden,\n onBlur: this.onInputBlur,\n onChange: this.handleInputChange,\n onFocus: this.onInputFocus,\n selectProps: selectProps,\n spellCheck: \"false\",\n tabIndex: tabIndex,\n theme: theme,\n type: \"text\",\n value: inputValue\n }, ariaAttributes));\n };\n\n _proto.renderPlaceholderOrValue = function renderPlaceholderOrValue() {\n var _this4 = this;\n\n var _this$components = this.components,\n MultiValue = _this$components.MultiValue,\n MultiValueContainer = _this$components.MultiValueContainer,\n MultiValueLabel = _this$components.MultiValueLabel,\n MultiValueRemove = _this$components.MultiValueRemove,\n SingleValue = _this$components.SingleValue,\n Placeholder = _this$components.Placeholder;\n var commonProps = this.commonProps;\n var _this$props15 = this.props,\n controlShouldRenderValue = _this$props15.controlShouldRenderValue,\n isDisabled = _this$props15.isDisabled,\n isMulti = _this$props15.isMulti,\n inputValue = _this$props15.inputValue,\n placeholder = _this$props15.placeholder;\n var _this$state8 = this.state,\n selectValue = _this$state8.selectValue,\n focusedValue = _this$state8.focusedValue,\n isFocused = _this$state8.isFocused;\n\n if (!this.hasValue() || !controlShouldRenderValue) {\n return inputValue ? null : React.createElement(Placeholder, _extends$4({}, commonProps, {\n key: \"placeholder\",\n isDisabled: isDisabled,\n isFocused: isFocused\n }), placeholder);\n }\n\n if (isMulti) {\n var selectValues = selectValue.map(function (opt, index) {\n var isOptionFocused = opt === focusedValue;\n return React.createElement(MultiValue, _extends$4({}, commonProps, {\n components: {\n Container: MultiValueContainer,\n Label: MultiValueLabel,\n Remove: MultiValueRemove\n },\n isFocused: isOptionFocused,\n isDisabled: isDisabled,\n key: _this4.getOptionValue(opt),\n index: index,\n removeProps: {\n onClick: function onClick() {\n return _this4.removeValue(opt);\n },\n onTouchEnd: function onTouchEnd() {\n return _this4.removeValue(opt);\n },\n onMouseDown: function onMouseDown(e) {\n e.preventDefault();\n e.stopPropagation();\n }\n },\n data: opt\n }), _this4.formatOptionLabel(opt, 'value'));\n });\n return selectValues;\n }\n\n if (inputValue) {\n return null;\n }\n\n var singleValue = selectValue[0];\n return React.createElement(SingleValue, _extends$4({}, commonProps, {\n data: singleValue,\n isDisabled: isDisabled\n }), this.formatOptionLabel(singleValue, 'value'));\n };\n\n _proto.renderClearIndicator = function renderClearIndicator() {\n var ClearIndicator = this.components.ClearIndicator;\n var commonProps = this.commonProps;\n var _this$props16 = this.props,\n isDisabled = _this$props16.isDisabled,\n isLoading = _this$props16.isLoading;\n var isFocused = this.state.isFocused;\n\n if (!this.isClearable() || !ClearIndicator || isDisabled || !this.hasValue() || isLoading) {\n return null;\n }\n\n var innerProps = {\n onMouseDown: this.onClearIndicatorMouseDown,\n onTouchEnd: this.onClearIndicatorTouchEnd,\n 'aria-hidden': 'true'\n };\n return React.createElement(ClearIndicator, _extends$4({}, commonProps, {\n innerProps: innerProps,\n isFocused: isFocused\n }));\n };\n\n _proto.renderLoadingIndicator = function renderLoadingIndicator() {\n var LoadingIndicator = this.components.LoadingIndicator;\n var commonProps = this.commonProps;\n var _this$props17 = this.props,\n isDisabled = _this$props17.isDisabled,\n isLoading = _this$props17.isLoading;\n var isFocused = this.state.isFocused;\n if (!LoadingIndicator || !isLoading) return null;\n var innerProps = {\n 'aria-hidden': 'true'\n };\n return React.createElement(LoadingIndicator, _extends$4({}, commonProps, {\n innerProps: innerProps,\n isDisabled: isDisabled,\n isFocused: isFocused\n }));\n };\n\n _proto.renderIndicatorSeparator = function renderIndicatorSeparator() {\n var _this$components2 = this.components,\n DropdownIndicator = _this$components2.DropdownIndicator,\n IndicatorSeparator = _this$components2.IndicatorSeparator; // separator doesn't make sense without the dropdown indicator\n\n if (!DropdownIndicator || !IndicatorSeparator) return null;\n var commonProps = this.commonProps;\n var isDisabled = this.props.isDisabled;\n var isFocused = this.state.isFocused;\n return React.createElement(IndicatorSeparator, _extends$4({}, commonProps, {\n isDisabled: isDisabled,\n isFocused: isFocused\n }));\n };\n\n _proto.renderDropdownIndicator = function renderDropdownIndicator() {\n var DropdownIndicator = this.components.DropdownIndicator;\n if (!DropdownIndicator) return null;\n var commonProps = this.commonProps;\n var isDisabled = this.props.isDisabled;\n var isFocused = this.state.isFocused;\n var innerProps = {\n onMouseDown: this.onDropdownIndicatorMouseDown,\n onTouchEnd: this.onDropdownIndicatorTouchEnd,\n 'aria-hidden': 'true'\n };\n return React.createElement(DropdownIndicator, _extends$4({}, commonProps, {\n innerProps: innerProps,\n isDisabled: isDisabled,\n isFocused: isFocused\n }));\n };\n\n _proto.renderMenu = function renderMenu() {\n var _this5 = this;\n\n var _this$components3 = this.components,\n Group = _this$components3.Group,\n GroupHeading = _this$components3.GroupHeading,\n Menu = _this$components3.Menu,\n MenuList = _this$components3.MenuList,\n MenuPortal = _this$components3.MenuPortal,\n LoadingMessage = _this$components3.LoadingMessage,\n NoOptionsMessage = _this$components3.NoOptionsMessage,\n Option = _this$components3.Option;\n var commonProps = this.commonProps;\n var _this$state9 = this.state,\n focusedOption = _this$state9.focusedOption,\n menuOptions = _this$state9.menuOptions;\n var _this$props18 = this.props,\n captureMenuScroll = _this$props18.captureMenuScroll,\n inputValue = _this$props18.inputValue,\n isLoading = _this$props18.isLoading,\n loadingMessage = _this$props18.loadingMessage,\n minMenuHeight = _this$props18.minMenuHeight,\n maxMenuHeight = _this$props18.maxMenuHeight,\n menuIsOpen = _this$props18.menuIsOpen,\n menuPlacement = _this$props18.menuPlacement,\n menuPosition = _this$props18.menuPosition,\n menuPortalTarget = _this$props18.menuPortalTarget,\n menuShouldBlockScroll = _this$props18.menuShouldBlockScroll,\n menuShouldScrollIntoView = _this$props18.menuShouldScrollIntoView,\n noOptionsMessage = _this$props18.noOptionsMessage,\n onMenuScrollToTop = _this$props18.onMenuScrollToTop,\n onMenuScrollToBottom = _this$props18.onMenuScrollToBottom;\n if (!menuIsOpen) return null; // TODO: Internal Option Type here\n\n var render = function render(props) {\n // for performance, the menu options in state aren't changed when the\n // focused option changes so we calculate additional props based on that\n var isFocused = focusedOption === props.data;\n props.innerRef = isFocused ? _this5.getFocusedOptionRef : undefined;\n return React.createElement(Option, _extends$4({}, commonProps, props, {\n isFocused: isFocused\n }), _this5.formatOptionLabel(props.data, 'menu'));\n };\n\n var menuUI;\n\n if (this.hasOptions()) {\n menuUI = menuOptions.render.map(function (item) {\n if (item.type === 'group') {\n var type = item.type,\n group = _objectWithoutPropertiesLoose$2(item, [\"type\"]);\n\n var headingId = item.key + \"-heading\";\n return React.createElement(Group, _extends$4({}, commonProps, group, {\n Heading: GroupHeading,\n headingProps: {\n id: headingId\n },\n label: _this5.formatGroupLabel(item.data)\n }), item.options.map(function (option) {\n return render(option);\n }));\n } else if (item.type === 'option') {\n return render(item);\n }\n });\n } else if (isLoading) {\n var message = loadingMessage({\n inputValue: inputValue\n });\n if (message === null) return null;\n menuUI = React.createElement(LoadingMessage, commonProps, message);\n } else {\n var _message = noOptionsMessage({\n inputValue: inputValue\n });\n\n if (_message === null) return null;\n menuUI = React.createElement(NoOptionsMessage, commonProps, _message);\n }\n\n var menuPlacementProps = {\n minMenuHeight: minMenuHeight,\n maxMenuHeight: maxMenuHeight,\n menuPlacement: menuPlacement,\n menuPosition: menuPosition,\n menuShouldScrollIntoView: menuShouldScrollIntoView\n };\n var menuElement = React.createElement(MenuPlacer, _extends$4({}, commonProps, menuPlacementProps), function (_ref8) {\n var ref = _ref8.ref,\n _ref8$placerProps = _ref8.placerProps,\n placement = _ref8$placerProps.placement,\n maxHeight = _ref8$placerProps.maxHeight;\n return React.createElement(Menu, _extends$4({}, commonProps, menuPlacementProps, {\n innerRef: ref,\n innerProps: {\n onMouseDown: _this5.onMenuMouseDown,\n onMouseMove: _this5.onMenuMouseMove\n },\n isLoading: isLoading,\n placement: placement\n }), React.createElement(ScrollCaptorSwitch, {\n isEnabled: captureMenuScroll,\n onTopArrive: onMenuScrollToTop,\n onBottomArrive: onMenuScrollToBottom\n }, React.createElement(ScrollBlock, {\n isEnabled: menuShouldBlockScroll\n }, React.createElement(MenuList, _extends$4({}, commonProps, {\n innerRef: _this5.getMenuListRef,\n isLoading: isLoading,\n maxHeight: maxHeight\n }), menuUI))));\n }); // positioning behaviour is almost identical for portalled and fixed,\n // so we use the same component. the actual portalling logic is forked\n // within the component based on `menuPosition`\n\n return menuPortalTarget || menuPosition === 'fixed' ? React.createElement(MenuPortal, _extends$4({}, commonProps, {\n appendTo: menuPortalTarget,\n controlElement: this.controlRef,\n menuPlacement: menuPlacement,\n menuPosition: menuPosition\n }), menuElement) : menuElement;\n };\n\n _proto.renderFormField = function renderFormField() {\n var _this6 = this;\n\n var _this$props19 = this.props,\n delimiter = _this$props19.delimiter,\n isDisabled = _this$props19.isDisabled,\n isMulti = _this$props19.isMulti,\n name = _this$props19.name;\n var selectValue = this.state.selectValue;\n if (!name || isDisabled) return;\n\n if (isMulti) {\n if (delimiter) {\n var value = selectValue.map(function (opt) {\n return _this6.getOptionValue(opt);\n }).join(delimiter);\n return React.createElement(\"input\", {\n name: name,\n type: \"hidden\",\n value: value\n });\n } else {\n var input = selectValue.length > 0 ? selectValue.map(function (opt, i) {\n return React.createElement(\"input\", {\n key: \"i-\" + i,\n name: name,\n type: \"hidden\",\n value: _this6.getOptionValue(opt)\n });\n }) : React.createElement(\"input\", {\n name: name,\n type: \"hidden\"\n });\n return React.createElement(\"div\", null, input);\n }\n } else {\n var _value2 = selectValue[0] ? this.getOptionValue(selectValue[0]) : '';\n\n return React.createElement(\"input\", {\n name: name,\n type: \"hidden\",\n value: _value2\n });\n }\n };\n\n _proto.renderLiveRegion = function renderLiveRegion() {\n if (!this.state.isFocused) return null;\n return React.createElement(A11yText, {\n \"aria-live\": \"polite\"\n }, React.createElement(\"p\", {\n id: \"aria-selection-event\"\n }, \"\\xA0\", this.state.ariaLiveSelection), React.createElement(\"p\", {\n id: \"aria-context\"\n }, \"\\xA0\", this.constructAriaLiveMessage()));\n };\n\n _proto.render = function render() {\n var _this$components4 = this.components,\n Control = _this$components4.Control,\n IndicatorsContainer = _this$components4.IndicatorsContainer,\n SelectContainer = _this$components4.SelectContainer,\n ValueContainer = _this$components4.ValueContainer;\n var _this$props20 = this.props,\n className = _this$props20.className,\n id = _this$props20.id,\n isDisabled = _this$props20.isDisabled,\n menuIsOpen = _this$props20.menuIsOpen;\n var isFocused = this.state.isFocused;\n var commonProps = this.commonProps = this.getCommonProps();\n return React.createElement(SelectContainer, _extends$4({}, commonProps, {\n className: className,\n innerProps: {\n id: id,\n onKeyDown: this.onKeyDown\n },\n isDisabled: isDisabled,\n isFocused: isFocused\n }), this.renderLiveRegion(), React.createElement(Control, _extends$4({}, commonProps, {\n innerRef: this.getControlRef,\n innerProps: {\n onMouseDown: this.onControlMouseDown,\n onTouchEnd: this.onControlTouchEnd\n },\n isDisabled: isDisabled,\n isFocused: isFocused,\n menuIsOpen: menuIsOpen\n }), React.createElement(ValueContainer, _extends$4({}, commonProps, {\n isDisabled: isDisabled\n }), this.renderPlaceholderOrValue(), this.renderInput()), React.createElement(IndicatorsContainer, _extends$4({}, commonProps, {\n isDisabled: isDisabled\n }), this.renderClearIndicator(), this.renderLoadingIndicator(), this.renderIndicatorSeparator(), this.renderDropdownIndicator())), this.renderMenu(), this.renderFormField());\n };\n\n return Select;\n}(Component);\n\nSelect.defaultProps = defaultProps;\nexport { Select as S, defaultTheme as a, createFilter as c, defaultProps as d, mergeStyles as m };","import React, { Component } from 'react';\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}\n\nvar defaultProps = {\n defaultInputValue: '',\n defaultMenuIsOpen: false,\n defaultValue: null\n};\n\nvar manageState = function manageState(SelectComponent) {\n var _class, _temp;\n\n return _temp = _class = /*#__PURE__*/function (_Component) {\n _inheritsLoose(StateManager, _Component);\n\n function StateManager() {\n var _this;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _Component.call.apply(_Component, [this].concat(args)) || this;\n _this.select = void 0;\n _this.state = {\n inputValue: _this.props.inputValue !== undefined ? _this.props.inputValue : _this.props.defaultInputValue,\n menuIsOpen: _this.props.menuIsOpen !== undefined ? _this.props.menuIsOpen : _this.props.defaultMenuIsOpen,\n value: _this.props.value !== undefined ? _this.props.value : _this.props.defaultValue\n };\n\n _this.onChange = function (value, actionMeta) {\n _this.callProp('onChange', value, actionMeta);\n\n _this.setState({\n value: value\n });\n };\n\n _this.onInputChange = function (value, actionMeta) {\n // TODO: for backwards compatibility, we allow the prop to return a new\n // value, but now inputValue is a controllable prop we probably shouldn't\n var newValue = _this.callProp('onInputChange', value, actionMeta);\n\n _this.setState({\n inputValue: newValue !== undefined ? newValue : value\n });\n };\n\n _this.onMenuOpen = function () {\n _this.callProp('onMenuOpen');\n\n _this.setState({\n menuIsOpen: true\n });\n };\n\n _this.onMenuClose = function () {\n _this.callProp('onMenuClose');\n\n _this.setState({\n menuIsOpen: false\n });\n };\n\n return _this;\n }\n\n var _proto = StateManager.prototype;\n\n _proto.focus = function focus() {\n this.select.focus();\n };\n\n _proto.blur = function blur() {\n this.select.blur();\n } // FIXME: untyped flow code, return any\n ;\n\n _proto.getProp = function getProp(key) {\n return this.props[key] !== undefined ? this.props[key] : this.state[key];\n } // FIXME: untyped flow code, return any\n ;\n\n _proto.callProp = function callProp(name) {\n if (typeof this.props[name] === 'function') {\n var _this$props;\n\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n return (_this$props = this.props)[name].apply(_this$props, args);\n }\n };\n\n _proto.render = function render() {\n var _this2 = this;\n\n var _this$props2 = this.props,\n defaultInputValue = _this$props2.defaultInputValue,\n defaultMenuIsOpen = _this$props2.defaultMenuIsOpen,\n defaultValue = _this$props2.defaultValue,\n props = _objectWithoutPropertiesLoose(_this$props2, [\"defaultInputValue\", \"defaultMenuIsOpen\", \"defaultValue\"]);\n\n return React.createElement(SelectComponent, _extends({}, props, {\n ref: function ref(_ref) {\n _this2.select = _ref;\n },\n inputValue: this.getProp('inputValue'),\n menuIsOpen: this.getProp('menuIsOpen'),\n onChange: this.onChange,\n onInputChange: this.onInputChange,\n onMenuClose: this.onMenuClose,\n onMenuOpen: this.onMenuOpen,\n value: this.getProp('value')\n }));\n };\n\n return StateManager;\n }(Component), _class.defaultProps = defaultProps, _temp;\n};\n\nexport { manageState as m };","import React, { Component } from 'react';\nimport memoizeOne from 'memoize-one';\nimport { CacheProvider } from '@emotion/core';\nimport 'react-dom';\nimport './utils-06b0d5a4.browser.esm.js';\nexport { y as components } from './index-4322c0ed.browser.esm.js';\nimport { S as Select } from './Select-9fdb8cd0.browser.esm.js';\nexport { c as createFilter, a as defaultTheme, m as mergeStyles } from './Select-9fdb8cd0.browser.esm.js';\nimport '@emotion/css';\nimport 'react-input-autosize';\nimport { m as manageState } from './stateManager-04f734a2.browser.esm.js';\nimport createCache from '@emotion/cache';\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}\n\nvar NonceProvider = /*#__PURE__*/function (_Component) {\n _inheritsLoose(NonceProvider, _Component);\n\n function NonceProvider(props) {\n var _this;\n\n _this = _Component.call(this, props) || this;\n\n _this.createEmotionCache = function (nonce) {\n return createCache({\n nonce: nonce\n });\n };\n\n _this.createEmotionCache = memoizeOne(_this.createEmotionCache);\n return _this;\n }\n\n var _proto = NonceProvider.prototype;\n\n _proto.render = function render() {\n var emotionCache = this.createEmotionCache(this.props.nonce);\n return React.createElement(CacheProvider, {\n value: emotionCache\n }, this.props.children);\n };\n\n return NonceProvider;\n}(Component);\n\nvar index = manageState(Select);\nexport default index;\nexport { NonceProvider };","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n'use strict';\n\nmodule.exports = PassThrough;\n\nvar Transform = require('./_stream_transform');\n\nrequire('inherits')(PassThrough, Transform);\n\nfunction PassThrough(options) {\n if (!(this instanceof PassThrough)) return new PassThrough(options);\n Transform.call(this, options);\n}\n\nPassThrough.prototype._transform = function (chunk, encoding, cb) {\n cb(null, chunk);\n};","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n'use strict';\n\nvar punycode = require('punycode');\n\nvar util = require('./util');\n\nexports.parse = urlParse;\nexports.resolve = urlResolve;\nexports.resolveObject = urlResolveObject;\nexports.format = urlFormat;\nexports.Url = Url;\n\nfunction Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.host = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.query = null;\n this.pathname = null;\n this.path = null;\n this.href = null;\n} // Reference: RFC 3986, RFC 1808, RFC 2396\n// define these here so at least they only have to be\n// compiled once on the first module load.\n\n\nvar protocolPattern = /^([a-z0-9.+-]+:)/i,\n portPattern = /:[0-9]*$/,\n // Special case for a simple path URL\nsimplePathPattern = /^(\\/\\/?(?!\\/)[^\\?\\s]*)(\\?[^\\s]*)?$/,\n // RFC 2396: characters reserved for delimiting URLs.\n// We actually just auto-escape these.\ndelims = ['<', '>', '\"', '`', ' ', '\\r', '\\n', '\\t'],\n // RFC 2396: characters not allowed for various reasons.\nunwise = ['{', '}', '|', '\\\\', '^', '`'].concat(delims),\n // Allowed by RFCs, but cause of XSS attacks. Always escape these.\nautoEscape = ['\\''].concat(unwise),\n // Characters that are never ever allowed in a hostname.\n// Note that any invalid chars are also handled, but these\n// are the ones that are *expected* to be seen, so we fast-path\n// them.\nnonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),\n hostEndingChars = ['/', '?', '#'],\n hostnameMaxLen = 255,\n hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,\n hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,\n // protocols that can allow \"unsafe\" and \"unwise\" chars.\nunsafeProtocol = {\n 'javascript': true,\n 'javascript:': true\n},\n // protocols that never have a hostname.\nhostlessProtocol = {\n 'javascript': true,\n 'javascript:': true\n},\n // protocols that always contain a // bit.\nslashedProtocol = {\n 'http': true,\n 'https': true,\n 'ftp': true,\n 'gopher': true,\n 'file': true,\n 'http:': true,\n 'https:': true,\n 'ftp:': true,\n 'gopher:': true,\n 'file:': true\n},\n querystring = require('querystring');\n\nfunction urlParse(url, parseQueryString, slashesDenoteHost) {\n if (url && util.isObject(url) && url instanceof Url) return url;\n var u = new Url();\n u.parse(url, parseQueryString, slashesDenoteHost);\n return u;\n}\n\nUrl.prototype.parse = function (url, parseQueryString, slashesDenoteHost) {\n if (!util.isString(url)) {\n throw new TypeError(\"Parameter 'url' must be a string, not \" + typeof url);\n } // Copy chrome, IE, opera backslash-handling behavior.\n // Back slashes before the query string get converted to forward slashes\n // See: https://code.google.com/p/chromium/issues/detail?id=25916\n\n\n var queryIndex = url.indexOf('?'),\n splitter = queryIndex !== -1 && queryIndex < url.indexOf('#') ? '?' : '#',\n uSplit = url.split(splitter),\n slashRegex = /\\\\/g;\n uSplit[0] = uSplit[0].replace(slashRegex, '/');\n url = uSplit.join(splitter);\n var rest = url; // trim before proceeding.\n // This is to support parse stuff like \" http://foo.com \\n\"\n\n rest = rest.trim();\n\n if (!slashesDenoteHost && url.split('#').length === 1) {\n // Try fast path regexp\n var simplePath = simplePathPattern.exec(rest);\n\n if (simplePath) {\n this.path = rest;\n this.href = rest;\n this.pathname = simplePath[1];\n\n if (simplePath[2]) {\n this.search = simplePath[2];\n\n if (parseQueryString) {\n this.query = querystring.parse(this.search.substr(1));\n } else {\n this.query = this.search.substr(1);\n }\n } else if (parseQueryString) {\n this.search = '';\n this.query = {};\n }\n\n return this;\n }\n }\n\n var proto = protocolPattern.exec(rest);\n\n if (proto) {\n proto = proto[0];\n var lowerProto = proto.toLowerCase();\n this.protocol = lowerProto;\n rest = rest.substr(proto.length);\n } // figure out if it's got a host\n // user@server is *always* interpreted as a hostname, and url\n // resolution will treat //foo/bar as host=foo,path=bar because that's\n // how the browser resolves relative URLs.\n\n\n if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@\\/]+@[^@\\/]+/)) {\n var slashes = rest.substr(0, 2) === '//';\n\n if (slashes && !(proto && hostlessProtocol[proto])) {\n rest = rest.substr(2);\n this.slashes = true;\n }\n }\n\n if (!hostlessProtocol[proto] && (slashes || proto && !slashedProtocol[proto])) {\n // there's a hostname.\n // the first instance of /, ?, ;, or # ends the host.\n //\n // If there is an @ in the hostname, then non-host chars *are* allowed\n // to the left of the last @ sign, unless some host-ending character\n // comes *before* the @-sign.\n // URLs are obnoxious.\n //\n // ex:\n // http://a@b@c/ => user:a@b host:c\n // http://a@b?@c => user:a host:c path:/?@c\n // v0.12 TODO(isaacs): This is not quite how Chrome does things.\n // Review our test case against browsers more comprehensively.\n // find the first instance of any hostEndingChars\n var hostEnd = -1;\n\n for (var i = 0; i < hostEndingChars.length; i++) {\n var hec = rest.indexOf(hostEndingChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) hostEnd = hec;\n } // at this point, either we have an explicit point where the\n // auth portion cannot go past, or the last @ char is the decider.\n\n\n var auth, atSign;\n\n if (hostEnd === -1) {\n // atSign can be anywhere.\n atSign = rest.lastIndexOf('@');\n } else {\n // atSign must be in auth portion.\n // http://a@b/c@d => host:b auth:a path:/c@d\n atSign = rest.lastIndexOf('@', hostEnd);\n } // Now we have a portion which is definitely the auth.\n // Pull that off.\n\n\n if (atSign !== -1) {\n auth = rest.slice(0, atSign);\n rest = rest.slice(atSign + 1);\n this.auth = decodeURIComponent(auth);\n } // the host is the remaining to the left of the first non-host char\n\n\n hostEnd = -1;\n\n for (var i = 0; i < nonHostChars.length; i++) {\n var hec = rest.indexOf(nonHostChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) hostEnd = hec;\n } // if we still have not hit it, then the entire thing is a host.\n\n\n if (hostEnd === -1) hostEnd = rest.length;\n this.host = rest.slice(0, hostEnd);\n rest = rest.slice(hostEnd); // pull out port.\n\n this.parseHost(); // we've indicated that there is a hostname,\n // so even if it's empty, it has to be present.\n\n this.hostname = this.hostname || ''; // if hostname begins with [ and ends with ]\n // assume that it's an IPv6 address.\n\n var ipv6Hostname = this.hostname[0] === '[' && this.hostname[this.hostname.length - 1] === ']'; // validate a little.\n\n if (!ipv6Hostname) {\n var hostparts = this.hostname.split(/\\./);\n\n for (var i = 0, l = hostparts.length; i < l; i++) {\n var part = hostparts[i];\n if (!part) continue;\n\n if (!part.match(hostnamePartPattern)) {\n var newpart = '';\n\n for (var j = 0, k = part.length; j < k; j++) {\n if (part.charCodeAt(j) > 127) {\n // we replace non-ASCII char with a temporary placeholder\n // we need this to make sure size of hostname is not\n // broken by replacing non-ASCII by nothing\n newpart += 'x';\n } else {\n newpart += part[j];\n }\n } // we test again with ASCII char only\n\n\n if (!newpart.match(hostnamePartPattern)) {\n var validParts = hostparts.slice(0, i);\n var notHost = hostparts.slice(i + 1);\n var bit = part.match(hostnamePartStart);\n\n if (bit) {\n validParts.push(bit[1]);\n notHost.unshift(bit[2]);\n }\n\n if (notHost.length) {\n rest = '/' + notHost.join('.') + rest;\n }\n\n this.hostname = validParts.join('.');\n break;\n }\n }\n }\n }\n\n if (this.hostname.length > hostnameMaxLen) {\n this.hostname = '';\n } else {\n // hostnames are always lower case.\n this.hostname = this.hostname.toLowerCase();\n }\n\n if (!ipv6Hostname) {\n // IDNA Support: Returns a punycoded representation of \"domain\".\n // It only converts parts of the domain name that\n // have non-ASCII characters, i.e. it doesn't matter if\n // you call it with a domain that already is ASCII-only.\n this.hostname = punycode.toASCII(this.hostname);\n }\n\n var p = this.port ? ':' + this.port : '';\n var h = this.hostname || '';\n this.host = h + p;\n this.href += this.host; // strip [ and ] from the hostname\n // the host field still retains them, though\n\n if (ipv6Hostname) {\n this.hostname = this.hostname.substr(1, this.hostname.length - 2);\n\n if (rest[0] !== '/') {\n rest = '/' + rest;\n }\n }\n } // now rest is set to the post-host stuff.\n // chop off any delim chars.\n\n\n if (!unsafeProtocol[lowerProto]) {\n // First, make 100% sure that any \"autoEscape\" chars get\n // escaped, even if encodeURIComponent doesn't think they\n // need to be.\n for (var i = 0, l = autoEscape.length; i < l; i++) {\n var ae = autoEscape[i];\n if (rest.indexOf(ae) === -1) continue;\n var esc = encodeURIComponent(ae);\n\n if (esc === ae) {\n esc = escape(ae);\n }\n\n rest = rest.split(ae).join(esc);\n }\n } // chop off from the tail first.\n\n\n var hash = rest.indexOf('#');\n\n if (hash !== -1) {\n // got a fragment string.\n this.hash = rest.substr(hash);\n rest = rest.slice(0, hash);\n }\n\n var qm = rest.indexOf('?');\n\n if (qm !== -1) {\n this.search = rest.substr(qm);\n this.query = rest.substr(qm + 1);\n\n if (parseQueryString) {\n this.query = querystring.parse(this.query);\n }\n\n rest = rest.slice(0, qm);\n } else if (parseQueryString) {\n // no query string, but parseQueryString still requested\n this.search = '';\n this.query = {};\n }\n\n if (rest) this.pathname = rest;\n\n if (slashedProtocol[lowerProto] && this.hostname && !this.pathname) {\n this.pathname = '/';\n } //to support http.request\n\n\n if (this.pathname || this.search) {\n var p = this.pathname || '';\n var s = this.search || '';\n this.path = p + s;\n } // finally, reconstruct the href based on what has been validated.\n\n\n this.href = this.format();\n return this;\n}; // format a parsed object into a url string\n\n\nfunction urlFormat(obj) {\n // ensure it's an object, and not a string url.\n // If it's an obj, this is a no-op.\n // this way, you can call url_format() on strings\n // to clean up potentially wonky urls.\n if (util.isString(obj)) obj = urlParse(obj);\n if (!(obj instanceof Url)) return Url.prototype.format.call(obj);\n return obj.format();\n}\n\nUrl.prototype.format = function () {\n var auth = this.auth || '';\n\n if (auth) {\n auth = encodeURIComponent(auth);\n auth = auth.replace(/%3A/i, ':');\n auth += '@';\n }\n\n var protocol = this.protocol || '',\n pathname = this.pathname || '',\n hash = this.hash || '',\n host = false,\n query = '';\n\n if (this.host) {\n host = auth + this.host;\n } else if (this.hostname) {\n host = auth + (this.hostname.indexOf(':') === -1 ? this.hostname : '[' + this.hostname + ']');\n\n if (this.port) {\n host += ':' + this.port;\n }\n }\n\n if (this.query && util.isObject(this.query) && Object.keys(this.query).length) {\n query = querystring.stringify(this.query);\n }\n\n var search = this.search || query && '?' + query || '';\n if (protocol && protocol.substr(-1) !== ':') protocol += ':'; // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.\n // unless they had them to begin with.\n\n if (this.slashes || (!protocol || slashedProtocol[protocol]) && host !== false) {\n host = '//' + (host || '');\n if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;\n } else if (!host) {\n host = '';\n }\n\n if (hash && hash.charAt(0) !== '#') hash = '#' + hash;\n if (search && search.charAt(0) !== '?') search = '?' + search;\n pathname = pathname.replace(/[?#]/g, function (match) {\n return encodeURIComponent(match);\n });\n search = search.replace('#', '%23');\n return protocol + host + pathname + search + hash;\n};\n\nfunction urlResolve(source, relative) {\n return urlParse(source, false, true).resolve(relative);\n}\n\nUrl.prototype.resolve = function (relative) {\n return this.resolveObject(urlParse(relative, false, true)).format();\n};\n\nfunction urlResolveObject(source, relative) {\n if (!source) return relative;\n return urlParse(source, false, true).resolveObject(relative);\n}\n\nUrl.prototype.resolveObject = function (relative) {\n if (util.isString(relative)) {\n var rel = new Url();\n rel.parse(relative, false, true);\n relative = rel;\n }\n\n var result = new Url();\n var tkeys = Object.keys(this);\n\n for (var tk = 0; tk < tkeys.length; tk++) {\n var tkey = tkeys[tk];\n result[tkey] = this[tkey];\n } // hash is always overridden, no matter what.\n // even href=\"\" will remove it.\n\n\n result.hash = relative.hash; // if the relative url is empty, then there's nothing left to do here.\n\n if (relative.href === '') {\n result.href = result.format();\n return result;\n } // hrefs like //foo/bar always cut to the protocol.\n\n\n if (relative.slashes && !relative.protocol) {\n // take everything except the protocol from relative\n var rkeys = Object.keys(relative);\n\n for (var rk = 0; rk < rkeys.length; rk++) {\n var rkey = rkeys[rk];\n if (rkey !== 'protocol') result[rkey] = relative[rkey];\n } //urlParse appends trailing / to urls like http://www.example.com\n\n\n if (slashedProtocol[result.protocol] && result.hostname && !result.pathname) {\n result.path = result.pathname = '/';\n }\n\n result.href = result.format();\n return result;\n }\n\n if (relative.protocol && relative.protocol !== result.protocol) {\n // if it's a known url protocol, then changing\n // the protocol does weird things\n // first, if it's not file:, then we MUST have a host,\n // and if there was a path\n // to begin with, then we MUST have a path.\n // if it is file:, then the host is dropped,\n // because that's known to be hostless.\n // anything else is assumed to be absolute.\n if (!slashedProtocol[relative.protocol]) {\n var keys = Object.keys(relative);\n\n for (var v = 0; v < keys.length; v++) {\n var k = keys[v];\n result[k] = relative[k];\n }\n\n result.href = result.format();\n return result;\n }\n\n result.protocol = relative.protocol;\n\n if (!relative.host && !hostlessProtocol[relative.protocol]) {\n var relPath = (relative.pathname || '').split('/');\n\n while (relPath.length && !(relative.host = relPath.shift())) {\n ;\n }\n\n if (!relative.host) relative.host = '';\n if (!relative.hostname) relative.hostname = '';\n if (relPath[0] !== '') relPath.unshift('');\n if (relPath.length < 2) relPath.unshift('');\n result.pathname = relPath.join('/');\n } else {\n result.pathname = relative.pathname;\n }\n\n result.search = relative.search;\n result.query = relative.query;\n result.host = relative.host || '';\n result.auth = relative.auth;\n result.hostname = relative.hostname || relative.host;\n result.port = relative.port; // to support http.request\n\n if (result.pathname || result.search) {\n var p = result.pathname || '';\n var s = result.search || '';\n result.path = p + s;\n }\n\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n }\n\n var isSourceAbs = result.pathname && result.pathname.charAt(0) === '/',\n isRelAbs = relative.host || relative.pathname && relative.pathname.charAt(0) === '/',\n mustEndAbs = isRelAbs || isSourceAbs || result.host && relative.pathname,\n removeAllDots = mustEndAbs,\n srcPath = result.pathname && result.pathname.split('/') || [],\n relPath = relative.pathname && relative.pathname.split('/') || [],\n psychotic = result.protocol && !slashedProtocol[result.protocol]; // if the url is a non-slashed url, then relative\n // links like ../.. should be able\n // to crawl up to the hostname, as well. This is strange.\n // result.protocol has already been set by now.\n // Later on, put the first path part into the host field.\n\n if (psychotic) {\n result.hostname = '';\n result.port = null;\n\n if (result.host) {\n if (srcPath[0] === '') srcPath[0] = result.host;else srcPath.unshift(result.host);\n }\n\n result.host = '';\n\n if (relative.protocol) {\n relative.hostname = null;\n relative.port = null;\n\n if (relative.host) {\n if (relPath[0] === '') relPath[0] = relative.host;else relPath.unshift(relative.host);\n }\n\n relative.host = null;\n }\n\n mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');\n }\n\n if (isRelAbs) {\n // it's absolute.\n result.host = relative.host || relative.host === '' ? relative.host : result.host;\n result.hostname = relative.hostname || relative.hostname === '' ? relative.hostname : result.hostname;\n result.search = relative.search;\n result.query = relative.query;\n srcPath = relPath; // fall through to the dot-handling below.\n } else if (relPath.length) {\n // it's relative\n // throw away the existing file, and take the new path instead.\n if (!srcPath) srcPath = [];\n srcPath.pop();\n srcPath = srcPath.concat(relPath);\n result.search = relative.search;\n result.query = relative.query;\n } else if (!util.isNullOrUndefined(relative.search)) {\n // just pull out the search.\n // like href='?foo'.\n // Put this after the other two cases because it simplifies the booleans\n if (psychotic) {\n result.hostname = result.host = srcPath.shift(); //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n\n var authInHost = result.host && result.host.indexOf('@') > 0 ? result.host.split('@') : false;\n\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n\n result.search = relative.search;\n result.query = relative.query; //to support http.request\n\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : '');\n }\n\n result.href = result.format();\n return result;\n }\n\n if (!srcPath.length) {\n // no path at all. easy.\n // we've already handled the other stuff above.\n result.pathname = null; //to support http.request\n\n if (result.search) {\n result.path = '/' + result.search;\n } else {\n result.path = null;\n }\n\n result.href = result.format();\n return result;\n } // if a url ENDs in . or .., then it must get a trailing slash.\n // however, if it ends in anything else non-slashy,\n // then it must NOT get a trailing slash.\n\n\n var last = srcPath.slice(-1)[0];\n var hasTrailingSlash = (result.host || relative.host || srcPath.length > 1) && (last === '.' || last === '..') || last === ''; // strip single dots, resolve double dots to parent dir\n // if the path tries to go above the root, `up` ends up > 0\n\n var up = 0;\n\n for (var i = srcPath.length; i >= 0; i--) {\n last = srcPath[i];\n\n if (last === '.') {\n srcPath.splice(i, 1);\n } else if (last === '..') {\n srcPath.splice(i, 1);\n up++;\n } else if (up) {\n srcPath.splice(i, 1);\n up--;\n }\n } // if the path is allowed to go above the root, restore leading ..s\n\n\n if (!mustEndAbs && !removeAllDots) {\n for (; up--; up) {\n srcPath.unshift('..');\n }\n }\n\n if (mustEndAbs && srcPath[0] !== '' && (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {\n srcPath.unshift('');\n }\n\n if (hasTrailingSlash && srcPath.join('/').substr(-1) !== '/') {\n srcPath.push('');\n }\n\n var isAbsolute = srcPath[0] === '' || srcPath[0] && srcPath[0].charAt(0) === '/'; // put the host back\n\n if (psychotic) {\n result.hostname = result.host = isAbsolute ? '' : srcPath.length ? srcPath.shift() : ''; //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n\n var authInHost = result.host && result.host.indexOf('@') > 0 ? result.host.split('@') : false;\n\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n\n mustEndAbs = mustEndAbs || result.host && srcPath.length;\n\n if (mustEndAbs && !isAbsolute) {\n srcPath.unshift('');\n }\n\n if (!srcPath.length) {\n result.pathname = null;\n result.path = null;\n } else {\n result.pathname = srcPath.join('/');\n } //to support request.http\n\n\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : '');\n }\n\n result.auth = relative.auth || result.auth;\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n};\n\nUrl.prototype.parseHost = function () {\n var host = this.host;\n var port = portPattern.exec(host);\n\n if (port) {\n port = port[0];\n\n if (port !== ':') {\n this.port = port.substr(1);\n }\n\n host = host.substr(0, host.length - port.length);\n }\n\n if (host) this.hostname = host;\n};","'use strict';\n\nvar curves = exports;\n\nvar hash = require('hash.js');\n\nvar curve = require('./curve');\n\nvar utils = require('./utils');\n\nvar assert = utils.assert;\n\nfunction PresetCurve(options) {\n if (options.type === 'short') this.curve = new curve.short(options);else if (options.type === 'edwards') this.curve = new curve.edwards(options);else this.curve = new curve.mont(options);\n this.g = this.curve.g;\n this.n = this.curve.n;\n this.hash = options.hash;\n assert(this.g.validate(), 'Invalid curve');\n assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O');\n}\n\ncurves.PresetCurve = PresetCurve;\n\nfunction defineCurve(name, options) {\n Object.defineProperty(curves, name, {\n configurable: true,\n enumerable: true,\n get: function get() {\n var curve = new PresetCurve(options);\n Object.defineProperty(curves, name, {\n configurable: true,\n enumerable: true,\n value: curve\n });\n return curve;\n }\n });\n}\n\ndefineCurve('p192', {\n type: 'short',\n prime: 'p192',\n p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff',\n a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc',\n b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1',\n n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831',\n hash: hash.sha256,\n gRed: false,\n g: ['188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012', '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811']\n});\ndefineCurve('p224', {\n type: 'short',\n prime: 'p224',\n p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001',\n a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe',\n b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4',\n n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d',\n hash: hash.sha256,\n gRed: false,\n g: ['b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21', 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34']\n});\ndefineCurve('p256', {\n type: 'short',\n prime: null,\n p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff',\n a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc',\n b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b',\n n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551',\n hash: hash.sha256,\n gRed: false,\n g: ['6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296', '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5']\n});\ndefineCurve('p384', {\n type: 'short',\n prime: null,\n p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'fffffffe ffffffff 00000000 00000000 ffffffff',\n a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'fffffffe ffffffff 00000000 00000000 fffffffc',\n b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' + '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef',\n n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' + 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973',\n hash: hash.sha384,\n gRed: false,\n g: ['aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' + '5502f25d bf55296c 3a545e38 72760ab7', '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' + '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f']\n});\ndefineCurve('p521', {\n type: 'short',\n prime: null,\n p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff ffffffff ffffffff ffffffff',\n a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff ffffffff ffffffff fffffffc',\n b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' + '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' + '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00',\n n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' + 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409',\n hash: hash.sha512,\n gRed: false,\n g: ['000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' + '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' + 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66', '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' + '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' + '3fad0761 353c7086 a272c240 88be9476 9fd16650']\n});\ndefineCurve('curve25519', {\n type: 'mont',\n prime: 'p25519',\n p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',\n a: '76d06',\n b: '1',\n n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',\n hash: hash.sha256,\n gRed: false,\n g: ['9']\n});\ndefineCurve('ed25519', {\n type: 'edwards',\n prime: 'p25519',\n p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',\n a: '-1',\n c: '1',\n // -121665 * (121666^(-1)) (mod P)\n d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3',\n n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',\n hash: hash.sha256,\n gRed: false,\n g: ['216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a', // 4/5\n '6666666666666666666666666666666666666666666666666666666666666658']\n});\nvar pre;\n\ntry {\n pre = require('./precomputed/secp256k1');\n} catch (e) {\n pre = undefined;\n}\n\ndefineCurve('secp256k1', {\n type: 'short',\n prime: 'k256',\n p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f',\n a: '0',\n b: '7',\n n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141',\n h: '1',\n hash: hash.sha256,\n // Precomputed endomorphism\n beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee',\n lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72',\n basis: [{\n a: '3086d221a7d46bcde86c90e49284eb15',\n b: '-e4437ed6010e88286f547fa90abfe4c3'\n }, {\n a: '114ca50f7a8e2f3f657c1108d9d44cfd8',\n b: '3086d221a7d46bcde86c90e49284eb15'\n }],\n gRed: false,\n g: ['79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8', pre]\n});","/* @generated */\n// prettier-ignore\nif (Intl.PluralRules && typeof Intl.PluralRules.__addLocaleData === 'function') {\n Intl.PluralRules.__addLocaleData({\n \"data\": {\n \"kde\": {\n \"categories\": {\n \"cardinal\": [\"other\"],\n \"ordinal\": [\"other\"]\n },\n \"fn\": function fn(n, ord) {\n return 'other';\n }\n }\n },\n \"aliases\": {},\n \"parentLocales\": {},\n \"availableLocales\": [\"kde\"]\n });\n}","function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nmodule.exports = _arrayLikeToArray;","'use strict';\n\nvar assert = require('minimalistic-assert');\n\nvar inherits = require('inherits');\n\nvar proto = {};\n\nfunction CBCState(iv) {\n assert.equal(iv.length, 8, 'Invalid IV length');\n this.iv = new Array(8);\n\n for (var i = 0; i < this.iv.length; i++) {\n this.iv[i] = iv[i];\n }\n}\n\nfunction instantiate(Base) {\n function CBC(options) {\n Base.call(this, options);\n\n this._cbcInit();\n }\n\n inherits(CBC, Base);\n var keys = Object.keys(proto);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n CBC.prototype[key] = proto[key];\n }\n\n CBC.create = function create(options) {\n return new CBC(options);\n };\n\n return CBC;\n}\n\nexports.instantiate = instantiate;\n\nproto._cbcInit = function _cbcInit() {\n var state = new CBCState(this.options.iv);\n this._cbcState = state;\n};\n\nproto._update = function _update(inp, inOff, out, outOff) {\n var state = this._cbcState;\n var superProto = this.constructor.super_.prototype;\n var iv = state.iv;\n\n if (this.type === 'encrypt') {\n for (var i = 0; i < this.blockSize; i++) {\n iv[i] ^= inp[inOff + i];\n }\n\n superProto._update.call(this, iv, 0, out, outOff);\n\n for (var i = 0; i < this.blockSize; i++) {\n iv[i] = out[outOff + i];\n }\n } else {\n superProto._update.call(this, inp, inOff, out, outOff);\n\n for (var i = 0; i < this.blockSize; i++) {\n out[outOff + i] ^= iv[i];\n }\n\n for (var i = 0; i < this.blockSize; i++) {\n iv[i] = inp[inOff + i];\n }\n }\n};","var parseKeys = require('parse-asn1');\n\nvar mgf = require('./mgf');\n\nvar xor = require('./xor');\n\nvar BN = require('bn.js');\n\nvar crt = require('browserify-rsa');\n\nvar createHash = require('create-hash');\n\nvar withPublic = require('./withPublic');\n\nvar Buffer = require('safe-buffer').Buffer;\n\nmodule.exports = function privateDecrypt(privateKey, enc, reverse) {\n var padding;\n\n if (privateKey.padding) {\n padding = privateKey.padding;\n } else if (reverse) {\n padding = 1;\n } else {\n padding = 4;\n }\n\n var key = parseKeys(privateKey);\n var k = key.modulus.byteLength();\n\n if (enc.length > k || new BN(enc).cmp(key.modulus) >= 0) {\n throw new Error('decryption error');\n }\n\n var msg;\n\n if (reverse) {\n msg = withPublic(new BN(enc), key);\n } else {\n msg = crt(enc, key);\n }\n\n var zBuffer = Buffer.alloc(k - msg.length);\n msg = Buffer.concat([zBuffer, msg], k);\n\n if (padding === 4) {\n return oaep(key, msg);\n } else if (padding === 1) {\n return pkcs1(key, msg, reverse);\n } else if (padding === 3) {\n return msg;\n } else {\n throw new Error('unknown padding');\n }\n};\n\nfunction oaep(key, msg) {\n var k = key.modulus.byteLength();\n var iHash = createHash('sha1').update(Buffer.alloc(0)).digest();\n var hLen = iHash.length;\n\n if (msg[0] !== 0) {\n throw new Error('decryption error');\n }\n\n var maskedSeed = msg.slice(1, hLen + 1);\n var maskedDb = msg.slice(hLen + 1);\n var seed = xor(maskedSeed, mgf(maskedDb, hLen));\n var db = xor(maskedDb, mgf(seed, k - hLen - 1));\n\n if (compare(iHash, db.slice(0, hLen))) {\n throw new Error('decryption error');\n }\n\n var i = hLen;\n\n while (db[i] === 0) {\n i++;\n }\n\n if (db[i++] !== 1) {\n throw new Error('decryption error');\n }\n\n return db.slice(i);\n}\n\nfunction pkcs1(key, msg, reverse) {\n var p1 = msg.slice(0, 2);\n var i = 2;\n var status = 0;\n\n while (msg[i++] !== 0) {\n if (i >= msg.length) {\n status++;\n break;\n }\n }\n\n var ps = msg.slice(2, i - 1);\n\n if (p1.toString('hex') !== '0002' && !reverse || p1.toString('hex') !== '0001' && reverse) {\n status++;\n }\n\n if (ps.length < 8) {\n status++;\n }\n\n if (status) {\n throw new Error('decryption error');\n }\n\n return msg.slice(i);\n}\n\nfunction compare(a, b) {\n a = Buffer.from(a);\n b = Buffer.from(b);\n var dif = 0;\n var len = a.length;\n\n if (a.length !== b.length) {\n dif++;\n len = Math.min(a.length, b.length);\n }\n\n var i = -1;\n\n while (++i < len) {\n dif += a[i] ^ b[i];\n }\n\n return dif;\n}","'use strict';\n\nvar utils = require('../utils');\n\nvar common = require('../common');\n\nvar shaCommon = require('./common');\n\nvar rotl32 = utils.rotl32;\nvar sum32 = utils.sum32;\nvar sum32_5 = utils.sum32_5;\nvar ft_1 = shaCommon.ft_1;\nvar BlockHash = common.BlockHash;\nvar sha1_K = [0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xCA62C1D6];\n\nfunction SHA1() {\n if (!(this instanceof SHA1)) return new SHA1();\n BlockHash.call(this);\n this.h = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];\n this.W = new Array(80);\n}\n\nutils.inherits(SHA1, BlockHash);\nmodule.exports = SHA1;\nSHA1.blockSize = 512;\nSHA1.outSize = 160;\nSHA1.hmacStrength = 80;\nSHA1.padLength = 64;\n\nSHA1.prototype._update = function _update(msg, start) {\n var W = this.W;\n\n for (var i = 0; i < 16; i++) {\n W[i] = msg[start + i];\n }\n\n for (; i < W.length; i++) {\n W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);\n }\n\n var a = this.h[0];\n var b = this.h[1];\n var c = this.h[2];\n var d = this.h[3];\n var e = this.h[4];\n\n for (i = 0; i < W.length; i++) {\n var s = ~~(i / 20);\n var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]);\n e = d;\n d = c;\n c = rotl32(b, 30);\n b = a;\n a = t;\n }\n\n this.h[0] = sum32(this.h[0], a);\n this.h[1] = sum32(this.h[1], b);\n this.h[2] = sum32(this.h[2], c);\n this.h[3] = sum32(this.h[3], d);\n this.h[4] = sum32(this.h[4], e);\n};\n\nSHA1.prototype._digest = function digest(enc) {\n if (enc === 'hex') return utils.toHex32(this.h, 'big');else return utils.split32(this.h, 'big');\n};","/* @generated */\n// prettier-ignore\nif (Intl.PluralRules && typeof Intl.PluralRules.__addLocaleData === 'function') {\n Intl.PluralRules.__addLocaleData({\n \"data\": {\n \"de\": {\n \"categories\": {\n \"cardinal\": [\"one\", \"other\"],\n \"ordinal\": [\"other\"]\n },\n \"fn\": function fn(n, ord) {\n var s = String(n).split('.'),\n v0 = !s[1];\n if (ord) return 'other';\n return n == 1 && v0 ? 'one' : 'other';\n }\n }\n },\n \"aliases\": {},\n \"parentLocales\": {},\n \"availableLocales\": [\"de\"]\n });\n}",";\n\n(function (root, factory) {\n if (typeof exports === \"object\") {\n // CommonJS\n module.exports = exports = factory(require(\"./core\"));\n } else if (typeof define === \"function\" && define.amd) {\n // AMD\n define([\"./core\"], factory);\n } else {\n // Global (browser)\n factory(root.CryptoJS);\n }\n})(this, function (CryptoJS) {\n (function () {\n // Shortcuts\n var C = CryptoJS;\n var C_lib = C.lib;\n var WordArray = C_lib.WordArray;\n var C_enc = C.enc;\n /**\n * Base64 encoding strategy.\n */\n\n var Base64 = C_enc.Base64 = {\n /**\n * Converts a word array to a Base64 string.\n *\n * @param {WordArray} wordArray The word array.\n *\n * @return {string} The Base64 string.\n *\n * @static\n *\n * @example\n *\n * var base64String = CryptoJS.enc.Base64.stringify(wordArray);\n */\n stringify: function stringify(wordArray) {\n // Shortcuts\n var words = wordArray.words;\n var sigBytes = wordArray.sigBytes;\n var map = this._map; // Clamp excess bits\n\n wordArray.clamp(); // Convert\n\n var base64Chars = [];\n\n for (var i = 0; i < sigBytes; i += 3) {\n var byte1 = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;\n var byte2 = words[i + 1 >>> 2] >>> 24 - (i + 1) % 4 * 8 & 0xff;\n var byte3 = words[i + 2 >>> 2] >>> 24 - (i + 2) % 4 * 8 & 0xff;\n var triplet = byte1 << 16 | byte2 << 8 | byte3;\n\n for (var j = 0; j < 4 && i + j * 0.75 < sigBytes; j++) {\n base64Chars.push(map.charAt(triplet >>> 6 * (3 - j) & 0x3f));\n }\n } // Add padding\n\n\n var paddingChar = map.charAt(64);\n\n if (paddingChar) {\n while (base64Chars.length % 4) {\n base64Chars.push(paddingChar);\n }\n }\n\n return base64Chars.join('');\n },\n\n /**\n * Converts a Base64 string to a word array.\n *\n * @param {string} base64Str The Base64 string.\n *\n * @return {WordArray} The word array.\n *\n * @static\n *\n * @example\n *\n * var wordArray = CryptoJS.enc.Base64.parse(base64String);\n */\n parse: function parse(base64Str) {\n // Shortcuts\n var base64StrLength = base64Str.length;\n var map = this._map;\n var reverseMap = this._reverseMap;\n\n if (!reverseMap) {\n reverseMap = this._reverseMap = [];\n\n for (var j = 0; j < map.length; j++) {\n reverseMap[map.charCodeAt(j)] = j;\n }\n } // Ignore padding\n\n\n var paddingChar = map.charAt(64);\n\n if (paddingChar) {\n var paddingIndex = base64Str.indexOf(paddingChar);\n\n if (paddingIndex !== -1) {\n base64StrLength = paddingIndex;\n }\n } // Convert\n\n\n return parseLoop(base64Str, base64StrLength, reverseMap);\n },\n _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='\n };\n\n function parseLoop(base64Str, base64StrLength, reverseMap) {\n var words = [];\n var nBytes = 0;\n\n for (var i = 0; i < base64StrLength; i++) {\n if (i % 4) {\n var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << i % 4 * 2;\n var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> 6 - i % 4 * 2;\n words[nBytes >>> 2] |= (bits1 | bits2) << 24 - nBytes % 4 * 8;\n nBytes++;\n }\n }\n\n return WordArray.create(words, nBytes);\n }\n })();\n\n return CryptoJS.enc.Base64;\n});","module.exports = require('./browser/algorithms.json');","var map = {\n\t\"./ar\": \"OkP2\",\n\t\"./ar.js\": \"OkP2\",\n\t\"./de\": \"EMl2\",\n\t\"./de.js\": \"EMl2\",\n\t\"./en\": \"Wud9\",\n\t\"./en.js\": \"Wud9\",\n\t\"./es\": \"/F5S\",\n\t\"./es.js\": \"/F5S\",\n\t\"./fr\": \"zH1P\",\n\t\"./fr.js\": \"zH1P\",\n\t\"./he\": \"tzmf\",\n\t\"./he.js\": \"tzmf\",\n\t\"./kde\": \"DQ8Y\",\n\t\"./kde.js\": \"DQ8Y\",\n\t\"./pt\": \"PJ5K\",\n\t\"./pt.js\": \"PJ5K\",\n\t\"./ru\": \"eQfh\",\n\t\"./ru.js\": \"eQfh\",\n\t\"./ses\": \"X5M3\",\n\t\"./ses.js\": \"X5M3\",\n\t\"./zh\": \"PjFX\",\n\t\"./zh.js\": \"PjFX\"\n};\n\n\nfunction webpackContext(req) {\n\tvar id = webpackContextResolve(req);\n\treturn __webpack_require__(id);\n}\nfunction webpackContextResolve(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\treturn map[req];\n}\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = \"EZgR\";","var v1 = require('./v1');\n\nvar v4 = require('./v4');\n\nvar uuid = v4;\nuuid.v1 = v1;\nuuid.v4 = v4;\nmodule.exports = uuid;","'use strict'; // limit of Crypto.getRandomValues()\n// https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues\n\nvar MAX_BYTES = 65536; // Node supports requesting up to this number of bytes\n// https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48\n\nvar MAX_UINT32 = 4294967295;\n\nfunction oldBrowser() {\n throw new Error('Secure random number generation is not supported by this browser.\\nUse Chrome, Firefox or Internet Explorer 11');\n}\n\nvar Buffer = require('safe-buffer').Buffer;\n\nvar crypto = global.crypto || global.msCrypto;\n\nif (crypto && crypto.getRandomValues) {\n module.exports = randomBytes;\n} else {\n module.exports = oldBrowser;\n}\n\nfunction randomBytes(size, cb) {\n // phantomjs needs to throw\n if (size > MAX_UINT32) throw new RangeError('requested too many random bytes');\n var bytes = Buffer.allocUnsafe(size);\n\n if (size > 0) {\n // getRandomValues fails on IE if size == 0\n if (size > MAX_BYTES) {\n // this is the max bytes crypto.getRandomValues\n // can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues\n for (var generated = 0; generated < size; generated += MAX_BYTES) {\n // buffer.slice automatically checks if the end is past the end of\n // the buffer so we don't have to here\n crypto.getRandomValues(bytes.slice(generated, generated + MAX_BYTES));\n }\n } else {\n crypto.getRandomValues(bytes);\n }\n }\n\n if (typeof cb === 'function') {\n return process.nextTick(function () {\n cb(null, bytes);\n });\n }\n\n return bytes;\n}","\"use strict\";\n\nvar _interopRequireWildcard = require(\"@babel/runtime/helpers/interopRequireWildcard\");\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nexports.__esModule = true;\nexports.ScrollHandler = exports.ScrollContext = void 0;\n\nvar _assertThisInitialized2 = _interopRequireDefault(require(\"@babel/runtime/helpers/assertThisInitialized\"));\n\nvar _inheritsLoose2 = _interopRequireDefault(require(\"@babel/runtime/helpers/inheritsLoose\"));\n\nvar React = _interopRequireWildcard(require(\"react\"));\n\nvar _propTypes = _interopRequireDefault(require(\"prop-types\"));\n\nvar _sessionStorage = require(\"./session-storage\");\n\nvar ScrollContext = React.createContext(new _sessionStorage.SessionStorage());\nexports.ScrollContext = ScrollContext;\nScrollContext.displayName = \"GatsbyScrollContext\";\n\nvar ScrollHandler = /*#__PURE__*/function (_React$Component) {\n (0, _inheritsLoose2.default)(ScrollHandler, _React$Component);\n\n function ScrollHandler() {\n var _this;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;\n _this._stateStorage = new _sessionStorage.SessionStorage();\n\n _this.scrollListener = function () {\n var key = _this.props.location.key;\n\n if (key) {\n _this._stateStorage.save(_this.props.location, key, window.scrollY);\n }\n };\n\n _this.windowScroll = function (position, prevProps) {\n if (_this.shouldUpdateScroll(prevProps, _this.props)) {\n window.scrollTo(0, position);\n }\n };\n\n _this.scrollToHash = function (hash, prevProps) {\n var node = document.getElementById(hash.substring(1));\n\n if (node && _this.shouldUpdateScroll(prevProps, _this.props)) {\n node.scrollIntoView();\n }\n };\n\n _this.shouldUpdateScroll = function (prevRouterProps, routerProps) {\n var shouldUpdateScroll = _this.props.shouldUpdateScroll;\n\n if (!shouldUpdateScroll) {\n return true;\n } // Hack to allow accessing this._stateStorage.\n\n\n return shouldUpdateScroll.call((0, _assertThisInitialized2.default)(_this), prevRouterProps, routerProps);\n };\n\n return _this;\n }\n\n var _proto = ScrollHandler.prototype;\n\n _proto.componentDidMount = function componentDidMount() {\n window.addEventListener(\"scroll\", this.scrollListener);\n var scrollPosition;\n var _this$props$location = this.props.location,\n key = _this$props$location.key,\n hash = _this$props$location.hash;\n\n if (key) {\n scrollPosition = this._stateStorage.read(this.props.location, key);\n }\n\n if (scrollPosition) {\n this.windowScroll(scrollPosition, undefined);\n } else if (hash) {\n this.scrollToHash(decodeURI(hash), undefined);\n }\n };\n\n _proto.componentWillUnmount = function componentWillUnmount() {\n window.removeEventListener(\"scroll\", this.scrollListener);\n };\n\n _proto.componentDidUpdate = function componentDidUpdate(prevProps) {\n var _this$props$location2 = this.props.location,\n hash = _this$props$location2.hash,\n key = _this$props$location2.key;\n var scrollPosition;\n\n if (key) {\n scrollPosition = this._stateStorage.read(this.props.location, key);\n }\n\n if (hash && scrollPosition === 0) {\n this.scrollToHash(decodeURI(hash), prevProps);\n } else {\n this.windowScroll(scrollPosition, prevProps);\n }\n };\n\n _proto.render = function render() {\n return /*#__PURE__*/React.createElement(ScrollContext.Provider, {\n value: this._stateStorage\n }, this.props.children);\n };\n\n return ScrollHandler;\n}(React.Component);\n\nexports.ScrollHandler = ScrollHandler;\nScrollHandler.propTypes = {\n shouldUpdateScroll: _propTypes.default.func,\n children: _propTypes.default.element.isRequired,\n location: _propTypes.default.object.isRequired\n};",";\n\n(function (root, factory) {\n if (typeof exports === \"object\") {\n // CommonJS\n module.exports = exports = factory(require(\"./core\"));\n } else if (typeof define === \"function\" && define.amd) {\n // AMD\n define([\"./core\"], factory);\n } else {\n // Global (browser)\n factory(root.CryptoJS);\n }\n})(this, function (CryptoJS) {\n (function () {\n // Check if typed arrays are supported\n if (typeof ArrayBuffer != 'function') {\n return;\n } // Shortcuts\n\n\n var C = CryptoJS;\n var C_lib = C.lib;\n var WordArray = C_lib.WordArray; // Reference original init\n\n var superInit = WordArray.init; // Augment WordArray.init to handle typed arrays\n\n var subInit = WordArray.init = function (typedArray) {\n // Convert buffers to uint8\n if (typedArray instanceof ArrayBuffer) {\n typedArray = new Uint8Array(typedArray);\n } // Convert other array views to uint8\n\n\n if (typedArray instanceof Int8Array || typeof Uint8ClampedArray !== \"undefined\" && typedArray instanceof Uint8ClampedArray || typedArray instanceof Int16Array || typedArray instanceof Uint16Array || typedArray instanceof Int32Array || typedArray instanceof Uint32Array || typedArray instanceof Float32Array || typedArray instanceof Float64Array) {\n typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength);\n } // Handle Uint8Array\n\n\n if (typedArray instanceof Uint8Array) {\n // Shortcut\n var typedArrayByteLength = typedArray.byteLength; // Extract bytes\n\n var words = [];\n\n for (var i = 0; i < typedArrayByteLength; i++) {\n words[i >>> 2] |= typedArray[i] << 24 - i % 4 * 8;\n } // Initialize this word array\n\n\n superInit.call(this, words, typedArrayByteLength);\n } else {\n // Else call normal init\n superInit.apply(this, arguments);\n }\n };\n\n subInit.prototype = WordArray;\n })();\n\n return CryptoJS.lib.WordArray;\n});","'use strict';\n\nvar utils = require('./../utils'); // Headers whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\n\n\nvar ignoreDuplicateOf = ['age', 'authorization', 'content-length', 'content-type', 'etag', 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 'referer', 'retry-after', 'user-agent'];\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} headers Headers needing to be parsed\n * @returns {Object} Headers parsed into an object\n */\n\nmodule.exports = function parseHeaders(headers) {\n var parsed = {};\n var key;\n var val;\n var i;\n\n if (!headers) {\n return parsed;\n }\n\n utils.forEach(headers.split('\\n'), function parser(line) {\n i = line.indexOf(':');\n key = utils.trim(line.substr(0, i)).toLowerCase();\n val = utils.trim(line.substr(i + 1));\n\n if (key) {\n if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {\n return;\n }\n\n if (key === 'set-cookie') {\n parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n }\n });\n return parsed;\n};","import { Component } from 'react';\nimport { jsx, keyframes, ClassNames } from '@emotion/core';\nimport { createPortal } from 'react-dom';\nimport PropTypes from 'prop-types';\nimport { g as getBoundingClientObj, a as getScrollParent, b as getScrollTop, c as animatedScrollTo, s as scrollTo } from './utils-06b0d5a4.browser.esm.js';\nimport _css from '@emotion/css';\nimport AutosizeInput from 'react-input-autosize';\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}\n\nfunction getMenuPlacement(_ref) {\n var maxHeight = _ref.maxHeight,\n menuEl = _ref.menuEl,\n minHeight = _ref.minHeight,\n placement = _ref.placement,\n shouldScroll = _ref.shouldScroll,\n isFixedPosition = _ref.isFixedPosition,\n theme = _ref.theme;\n var spacing = theme.spacing;\n var scrollParent = getScrollParent(menuEl);\n var defaultState = {\n placement: 'bottom',\n maxHeight: maxHeight\n }; // something went wrong, return default state\n\n if (!menuEl || !menuEl.offsetParent) return defaultState; // we can't trust `scrollParent.scrollHeight` --> it may increase when\n // the menu is rendered\n\n var _scrollParent$getBoun = scrollParent.getBoundingClientRect(),\n scrollHeight = _scrollParent$getBoun.height;\n\n var _menuEl$getBoundingCl = menuEl.getBoundingClientRect(),\n menuBottom = _menuEl$getBoundingCl.bottom,\n menuHeight = _menuEl$getBoundingCl.height,\n menuTop = _menuEl$getBoundingCl.top;\n\n var _menuEl$offsetParent$ = menuEl.offsetParent.getBoundingClientRect(),\n containerTop = _menuEl$offsetParent$.top;\n\n var viewHeight = window.innerHeight;\n var scrollTop = getScrollTop(scrollParent);\n var marginBottom = parseInt(getComputedStyle(menuEl).marginBottom, 10);\n var marginTop = parseInt(getComputedStyle(menuEl).marginTop, 10);\n var viewSpaceAbove = containerTop - marginTop;\n var viewSpaceBelow = viewHeight - menuTop;\n var scrollSpaceAbove = viewSpaceAbove + scrollTop;\n var scrollSpaceBelow = scrollHeight - scrollTop - menuTop;\n var scrollDown = menuBottom - viewHeight + scrollTop + marginBottom;\n var scrollUp = scrollTop + menuTop - marginTop;\n var scrollDuration = 160;\n\n switch (placement) {\n case 'auto':\n case 'bottom':\n // 1: the menu will fit, do nothing\n if (viewSpaceBelow >= menuHeight) {\n return {\n placement: 'bottom',\n maxHeight: maxHeight\n };\n } // 2: the menu will fit, if scrolled\n\n\n if (scrollSpaceBelow >= menuHeight && !isFixedPosition) {\n if (shouldScroll) {\n animatedScrollTo(scrollParent, scrollDown, scrollDuration);\n }\n\n return {\n placement: 'bottom',\n maxHeight: maxHeight\n };\n } // 3: the menu will fit, if constrained\n\n\n if (!isFixedPosition && scrollSpaceBelow >= minHeight || isFixedPosition && viewSpaceBelow >= minHeight) {\n if (shouldScroll) {\n animatedScrollTo(scrollParent, scrollDown, scrollDuration);\n } // we want to provide as much of the menu as possible to the user,\n // so give them whatever is available below rather than the minHeight.\n\n\n var constrainedHeight = isFixedPosition ? viewSpaceBelow - marginBottom : scrollSpaceBelow - marginBottom;\n return {\n placement: 'bottom',\n maxHeight: constrainedHeight\n };\n } // 4. Forked beviour when there isn't enough space below\n // AUTO: flip the menu, render above\n\n\n if (placement === 'auto' || isFixedPosition) {\n // may need to be constrained after flipping\n var _constrainedHeight = maxHeight;\n var spaceAbove = isFixedPosition ? viewSpaceAbove : scrollSpaceAbove;\n\n if (spaceAbove >= minHeight) {\n _constrainedHeight = Math.min(spaceAbove - marginBottom - spacing.controlHeight, maxHeight);\n }\n\n return {\n placement: 'top',\n maxHeight: _constrainedHeight\n };\n } // BOTTOM: allow browser to increase scrollable area and immediately set scroll\n\n\n if (placement === 'bottom') {\n scrollTo(scrollParent, scrollDown);\n return {\n placement: 'bottom',\n maxHeight: maxHeight\n };\n }\n\n break;\n\n case 'top':\n // 1: the menu will fit, do nothing\n if (viewSpaceAbove >= menuHeight) {\n return {\n placement: 'top',\n maxHeight: maxHeight\n };\n } // 2: the menu will fit, if scrolled\n\n\n if (scrollSpaceAbove >= menuHeight && !isFixedPosition) {\n if (shouldScroll) {\n animatedScrollTo(scrollParent, scrollUp, scrollDuration);\n }\n\n return {\n placement: 'top',\n maxHeight: maxHeight\n };\n } // 3: the menu will fit, if constrained\n\n\n if (!isFixedPosition && scrollSpaceAbove >= minHeight || isFixedPosition && viewSpaceAbove >= minHeight) {\n var _constrainedHeight2 = maxHeight; // we want to provide as much of the menu as possible to the user,\n // so give them whatever is available below rather than the minHeight.\n\n if (!isFixedPosition && scrollSpaceAbove >= minHeight || isFixedPosition && viewSpaceAbove >= minHeight) {\n _constrainedHeight2 = isFixedPosition ? viewSpaceAbove - marginTop : scrollSpaceAbove - marginTop;\n }\n\n if (shouldScroll) {\n animatedScrollTo(scrollParent, scrollUp, scrollDuration);\n }\n\n return {\n placement: 'top',\n maxHeight: _constrainedHeight2\n };\n } // 4. not enough space, the browser WILL NOT increase scrollable area when\n // absolutely positioned element rendered above the viewport (only below).\n // Flip the menu, render below\n\n\n return {\n placement: 'bottom',\n maxHeight: maxHeight\n };\n\n default:\n throw new Error(\"Invalid placement provided \\\"\" + placement + \"\\\".\");\n } // fulfil contract with flow: implicit return value of undefined\n\n\n return defaultState;\n} // Menu Component\n// ------------------------------\n\n\nfunction alignToControl(placement) {\n var placementToCSSProp = {\n bottom: 'top',\n top: 'bottom'\n };\n return placement ? placementToCSSProp[placement] : 'bottom';\n}\n\nvar coercePlacement = function coercePlacement(p) {\n return p === 'auto' ? 'bottom' : p;\n};\n\nvar menuCSS = function menuCSS(_ref2) {\n var _ref3;\n\n var placement = _ref2.placement,\n _ref2$theme = _ref2.theme,\n borderRadius = _ref2$theme.borderRadius,\n spacing = _ref2$theme.spacing,\n colors = _ref2$theme.colors;\n return _ref3 = {\n label: 'menu'\n }, _ref3[alignToControl(placement)] = '100%', _ref3.backgroundColor = colors.neutral0, _ref3.borderRadius = borderRadius, _ref3.boxShadow = '0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)', _ref3.marginBottom = spacing.menuGutter, _ref3.marginTop = spacing.menuGutter, _ref3.position = 'absolute', _ref3.width = '100%', _ref3.zIndex = 1, _ref3;\n}; // NOTE: internal only\n\n\nvar MenuPlacer = /*#__PURE__*/function (_Component) {\n _inheritsLoose(MenuPlacer, _Component);\n\n function MenuPlacer() {\n var _this;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _Component.call.apply(_Component, [this].concat(args)) || this;\n _this.state = {\n maxHeight: _this.props.maxMenuHeight,\n placement: null\n };\n\n _this.getPlacement = function (ref) {\n var _this$props = _this.props,\n minMenuHeight = _this$props.minMenuHeight,\n maxMenuHeight = _this$props.maxMenuHeight,\n menuPlacement = _this$props.menuPlacement,\n menuPosition = _this$props.menuPosition,\n menuShouldScrollIntoView = _this$props.menuShouldScrollIntoView,\n theme = _this$props.theme;\n var getPortalPlacement = _this.context.getPortalPlacement;\n if (!ref) return; // DO NOT scroll if position is fixed\n\n var isFixedPosition = menuPosition === 'fixed';\n var shouldScroll = menuShouldScrollIntoView && !isFixedPosition;\n var state = getMenuPlacement({\n maxHeight: maxMenuHeight,\n menuEl: ref,\n minHeight: minMenuHeight,\n placement: menuPlacement,\n shouldScroll: shouldScroll,\n isFixedPosition: isFixedPosition,\n theme: theme\n });\n if (getPortalPlacement) getPortalPlacement(state);\n\n _this.setState(state);\n };\n\n _this.getUpdatedProps = function () {\n var menuPlacement = _this.props.menuPlacement;\n var placement = _this.state.placement || coercePlacement(menuPlacement);\n return _extends({}, _this.props, {\n placement: placement,\n maxHeight: _this.state.maxHeight\n });\n };\n\n return _this;\n }\n\n var _proto = MenuPlacer.prototype;\n\n _proto.render = function render() {\n var children = this.props.children;\n return children({\n ref: this.getPlacement,\n placerProps: this.getUpdatedProps()\n });\n };\n\n return MenuPlacer;\n}(Component);\n\nMenuPlacer.contextTypes = {\n getPortalPlacement: PropTypes.func\n};\n\nvar Menu = function Menu(props) {\n var children = props.children,\n className = props.className,\n cx = props.cx,\n getStyles = props.getStyles,\n innerRef = props.innerRef,\n innerProps = props.innerProps;\n return jsx(\"div\", _extends({\n css: getStyles('menu', props),\n className: cx({\n menu: true\n }, className)\n }, innerProps, {\n ref: innerRef\n }), children);\n}; // Menu List\n// ==============================\n\n\nvar menuListCSS = function menuListCSS(_ref4) {\n var maxHeight = _ref4.maxHeight,\n baseUnit = _ref4.theme.spacing.baseUnit;\n return {\n maxHeight: maxHeight,\n overflowY: 'auto',\n paddingBottom: baseUnit,\n paddingTop: baseUnit,\n position: 'relative',\n // required for offset[Height, Top] > keyboard scroll\n WebkitOverflowScrolling: 'touch'\n };\n};\n\nvar MenuList = function MenuList(props) {\n var children = props.children,\n className = props.className,\n cx = props.cx,\n getStyles = props.getStyles,\n isMulti = props.isMulti,\n innerRef = props.innerRef;\n return jsx(\"div\", {\n css: getStyles('menuList', props),\n className: cx({\n 'menu-list': true,\n 'menu-list--is-multi': isMulti\n }, className),\n ref: innerRef\n }, children);\n}; // ==============================\n// Menu Notices\n// ==============================\n\n\nvar noticeCSS = function noticeCSS(_ref5) {\n var _ref5$theme = _ref5.theme,\n baseUnit = _ref5$theme.spacing.baseUnit,\n colors = _ref5$theme.colors;\n return {\n color: colors.neutral40,\n padding: baseUnit * 2 + \"px \" + baseUnit * 3 + \"px\",\n textAlign: 'center'\n };\n};\n\nvar noOptionsMessageCSS = noticeCSS;\nvar loadingMessageCSS = noticeCSS;\n\nvar NoOptionsMessage = function NoOptionsMessage(props) {\n var children = props.children,\n className = props.className,\n cx = props.cx,\n getStyles = props.getStyles,\n innerProps = props.innerProps;\n return jsx(\"div\", _extends({\n css: getStyles('noOptionsMessage', props),\n className: cx({\n 'menu-notice': true,\n 'menu-notice--no-options': true\n }, className)\n }, innerProps), children);\n};\n\nNoOptionsMessage.defaultProps = {\n children: 'No options'\n};\n\nvar LoadingMessage = function LoadingMessage(props) {\n var children = props.children,\n className = props.className,\n cx = props.cx,\n getStyles = props.getStyles,\n innerProps = props.innerProps;\n return jsx(\"div\", _extends({\n css: getStyles('loadingMessage', props),\n className: cx({\n 'menu-notice': true,\n 'menu-notice--loading': true\n }, className)\n }, innerProps), children);\n};\n\nLoadingMessage.defaultProps = {\n children: 'Loading...'\n}; // ==============================\n// Menu Portal\n// ==============================\n\nvar menuPortalCSS = function menuPortalCSS(_ref6) {\n var rect = _ref6.rect,\n offset = _ref6.offset,\n position = _ref6.position;\n return {\n left: rect.left,\n position: position,\n top: offset,\n width: rect.width,\n zIndex: 1\n };\n};\n\nvar MenuPortal = /*#__PURE__*/function (_Component2) {\n _inheritsLoose(MenuPortal, _Component2);\n\n function MenuPortal() {\n var _this2;\n\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n _this2 = _Component2.call.apply(_Component2, [this].concat(args)) || this;\n _this2.state = {\n placement: null\n };\n\n _this2.getPortalPlacement = function (_ref7) {\n var placement = _ref7.placement;\n var initialPlacement = coercePlacement(_this2.props.menuPlacement); // avoid re-renders if the placement has not changed\n\n if (placement !== initialPlacement) {\n _this2.setState({\n placement: placement\n });\n }\n };\n\n return _this2;\n }\n\n var _proto2 = MenuPortal.prototype;\n\n _proto2.getChildContext = function getChildContext() {\n return {\n getPortalPlacement: this.getPortalPlacement\n };\n } // callback for occassions where the menu must \"flip\"\n ;\n\n _proto2.render = function render() {\n var _this$props2 = this.props,\n appendTo = _this$props2.appendTo,\n children = _this$props2.children,\n controlElement = _this$props2.controlElement,\n menuPlacement = _this$props2.menuPlacement,\n position = _this$props2.menuPosition,\n getStyles = _this$props2.getStyles;\n var isFixed = position === 'fixed'; // bail early if required elements aren't present\n\n if (!appendTo && !isFixed || !controlElement) {\n return null;\n }\n\n var placement = this.state.placement || coercePlacement(menuPlacement);\n var rect = getBoundingClientObj(controlElement);\n var scrollDistance = isFixed ? 0 : window.pageYOffset;\n var offset = rect[placement] + scrollDistance;\n var state = {\n offset: offset,\n position: position,\n rect: rect\n }; // same wrapper element whether fixed or portalled\n\n var menuWrapper = jsx(\"div\", {\n css: getStyles('menuPortal', state)\n }, children);\n return appendTo ? createPortal(menuWrapper, appendTo) : menuWrapper;\n };\n\n return MenuPortal;\n}(Component);\n\nMenuPortal.childContextTypes = {\n getPortalPlacement: PropTypes.func\n};\nvar isArray = Array.isArray;\nvar keyList = Object.keys;\nvar hasProp = Object.prototype.hasOwnProperty;\n\nfunction equal(a, b) {\n // fast-deep-equal index.js 2.0.1\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n var arrA = isArray(a),\n arrB = isArray(b),\n i,\n length,\n key;\n\n if (arrA && arrB) {\n length = a.length;\n if (length != b.length) return false;\n\n for (i = length; i-- !== 0;) {\n if (!equal(a[i], b[i])) return false;\n }\n\n return true;\n }\n\n if (arrA != arrB) return false;\n var dateA = a instanceof Date,\n dateB = b instanceof Date;\n if (dateA != dateB) return false;\n if (dateA && dateB) return a.getTime() == b.getTime();\n var regexpA = a instanceof RegExp,\n regexpB = b instanceof RegExp;\n if (regexpA != regexpB) return false;\n if (regexpA && regexpB) return a.toString() == b.toString();\n var keys = keyList(a);\n length = keys.length;\n\n if (length !== keyList(b).length) {\n return false;\n }\n\n for (i = length; i-- !== 0;) {\n if (!hasProp.call(b, keys[i])) return false;\n } // end fast-deep-equal\n // Custom handling for React\n\n\n for (i = length; i-- !== 0;) {\n key = keys[i];\n\n if (key === '_owner' && a.$$typeof) {\n // React-specific: avoid traversing React elements' _owner.\n // _owner contains circular references\n // and is not needed when comparing the actual elements (and not their owners)\n // .$$typeof and ._store on just reasonable markers of a react element\n continue;\n } else {\n // all other properties should be traversed as usual\n if (!equal(a[key], b[key])) return false;\n }\n } // fast-deep-equal index.js 2.0.1\n\n\n return true;\n }\n\n return a !== a && b !== b;\n} // end fast-deep-equal\n\n\nfunction exportedEqual(a, b) {\n try {\n return equal(a, b);\n } catch (error) {\n if (error.message && error.message.match(/stack|recursion/i)) {\n // warn on circular references, don't crash\n // browsers give this different errors name and messages:\n // chrome/safari: \"RangeError\", \"Maximum call stack size exceeded\"\n // firefox: \"InternalError\", too much recursion\"\n // edge: \"Error\", \"Out of stack space\"\n console.warn('Warning: react-fast-compare does not handle circular references.', error.name, error.message);\n return false;\n } // some other error. we should definitely know about these\n\n\n throw error;\n }\n}\n\nfunction _extends$1() {\n _extends$1 = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends$1.apply(this, arguments);\n}\n\nvar containerCSS = function containerCSS(_ref) {\n var isDisabled = _ref.isDisabled,\n isRtl = _ref.isRtl;\n return {\n label: 'container',\n direction: isRtl ? 'rtl' : null,\n pointerEvents: isDisabled ? 'none' : null,\n // cancel mouse events when disabled\n position: 'relative'\n };\n};\n\nvar SelectContainer = function SelectContainer(props) {\n var children = props.children,\n className = props.className,\n cx = props.cx,\n getStyles = props.getStyles,\n innerProps = props.innerProps,\n isDisabled = props.isDisabled,\n isRtl = props.isRtl;\n return jsx(\"div\", _extends$1({\n css: getStyles('container', props),\n className: cx({\n '--is-disabled': isDisabled,\n '--is-rtl': isRtl\n }, className)\n }, innerProps), children);\n}; // ==============================\n// Value Container\n// ==============================\n\n\nvar valueContainerCSS = function valueContainerCSS(_ref2) {\n var spacing = _ref2.theme.spacing;\n return {\n alignItems: 'center',\n display: 'flex',\n flex: 1,\n flexWrap: 'wrap',\n padding: spacing.baseUnit / 2 + \"px \" + spacing.baseUnit * 2 + \"px\",\n WebkitOverflowScrolling: 'touch',\n position: 'relative',\n overflow: 'hidden'\n };\n};\n\nvar ValueContainer = function ValueContainer(props) {\n var children = props.children,\n className = props.className,\n cx = props.cx,\n isMulti = props.isMulti,\n getStyles = props.getStyles,\n hasValue = props.hasValue;\n return jsx(\"div\", {\n css: getStyles('valueContainer', props),\n className: cx({\n 'value-container': true,\n 'value-container--is-multi': isMulti,\n 'value-container--has-value': hasValue\n }, className)\n }, children);\n}; // ==============================\n// Indicator Container\n// ==============================\n\n\nvar indicatorsContainerCSS = function indicatorsContainerCSS() {\n return {\n alignItems: 'center',\n alignSelf: 'stretch',\n display: 'flex',\n flexShrink: 0\n };\n};\n\nvar IndicatorsContainer = function IndicatorsContainer(props) {\n var children = props.children,\n className = props.className,\n cx = props.cx,\n getStyles = props.getStyles;\n return jsx(\"div\", {\n css: getStyles('indicatorsContainer', props),\n className: cx({\n indicators: true\n }, className)\n }, children);\n};\n\nfunction _templateObject() {\n var data = _taggedTemplateLiteralLoose([\"\\n 0%, 80%, 100% { opacity: 0; }\\n 40% { opacity: 1; }\\n\"]);\n\n _templateObject = function _templateObject() {\n return data;\n };\n\n return data;\n}\n\nfunction _taggedTemplateLiteralLoose(strings, raw) {\n if (!raw) {\n raw = strings.slice(0);\n }\n\n strings.raw = raw;\n return strings;\n}\n\nfunction _extends$2() {\n _extends$2 = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends$2.apply(this, arguments);\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nvar _ref2 = process.env.NODE_ENV === \"production\" ? {\n name: \"19bqh2r\",\n styles: \"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0;\"\n} : {\n name: \"19bqh2r\",\n styles: \"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0;\",\n map: \"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGljYXRvcnMuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBa0JJIiwiZmlsZSI6ImluZGljYXRvcnMuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLyBAZmxvd1xuLyoqIEBqc3gganN4ICovXG5pbXBvcnQgeyB0eXBlIE5vZGUgfSBmcm9tICdyZWFjdCc7XG5pbXBvcnQgeyBqc3gsIGtleWZyYW1lcyB9IGZyb20gJ0BlbW90aW9uL2NvcmUnO1xuXG5pbXBvcnQgdHlwZSB7IENvbW1vblByb3BzLCBUaGVtZSB9IGZyb20gJy4uL3R5cGVzJztcblxuLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XG4vLyBEcm9wZG93biAmIENsZWFyIEljb25zXG4vLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cblxuY29uc3QgU3ZnID0gKHsgc2l6ZSwgLi4ucHJvcHMgfTogeyBzaXplOiBudW1iZXIgfSkgPT4gKFxuICA8c3ZnXG4gICAgaGVpZ2h0PXtzaXplfVxuICAgIHdpZHRoPXtzaXplfVxuICAgIHZpZXdCb3g9XCIwIDAgMjAgMjBcIlxuICAgIGFyaWEtaGlkZGVuPVwidHJ1ZVwiXG4gICAgZm9jdXNhYmxlPVwiZmFsc2VcIlxuICAgIGNzcz17e1xuICAgICAgZGlzcGxheTogJ2lubGluZS1ibG9jaycsXG4gICAgICBmaWxsOiAnY3VycmVudENvbG9yJyxcbiAgICAgIGxpbmVIZWlnaHQ6IDEsXG4gICAgICBzdHJva2U6ICdjdXJyZW50Q29sb3InLFxuICAgICAgc3Ryb2tlV2lkdGg6IDAsXG4gICAgfX1cbiAgICB7Li4ucHJvcHN9XG4gIC8+XG4pO1xuXG5leHBvcnQgY29uc3QgQ3Jvc3NJY29uID0gKHByb3BzOiBhbnkpID0+IChcbiAgPFN2ZyBzaXplPXsyMH0gey4uLnByb3BzfT5cbiAgICA8cGF0aCBkPVwiTTE0LjM0OCAxNC44NDljLTAuNDY5IDAuNDY5LTEuMjI5IDAuNDY5LTEuNjk3IDBsLTIuNjUxLTMuMDMwLTIuNjUxIDMuMDI5Yy0wLjQ2OSAwLjQ2OS0xLjIyOSAwLjQ2OS0xLjY5NyAwLTAuNDY5LTAuNDY5LTAuNDY5LTEuMjI5IDAtMS42OTdsMi43NTgtMy4xNS0yLjc1OS0zLjE1MmMtMC40NjktMC40NjktMC40NjktMS4yMjggMC0xLjY5N3MxLjIyOC0wLjQ2OSAxLjY5NyAwbDIuNjUyIDMuMDMxIDIuNjUxLTMuMDMxYzAuNDY5LTAuNDY5IDEuMjI4LTAuNDY5IDEuNjk3IDBzMC40NjkgMS4yMjkgMCAxLjY5N2wtMi43NTggMy4xNTIgMi43NTggMy4xNWMwLjQ2OSAwLjQ2OSAwLjQ2OSAxLjIyOSAwIDEuNjk4elwiIC8+XG4gIDwvU3ZnPlxuKTtcbmV4cG9ydCBjb25zdCBEb3duQ2hldnJvbiA9IChwcm9wczogYW55KSA9PiAoXG4gIDxTdmcgc2l6ZT17MjB9IHsuLi5wcm9wc30+XG4gICAgPHBhdGggZD1cIk00LjUxNiA3LjU0OGMwLjQzNi0wLjQ0NiAxLjA0My0wLjQ4MSAxLjU3NiAwbDMuOTA4IDMuNzQ3IDMuOTA4LTMuNzQ3YzAuNTMzLTAuNDgxIDEuMTQxLTAuNDQ2IDEuNTc0IDAgMC40MzYgMC40NDUgMC40MDggMS4xOTcgMCAxLjYxNS0wLjQwNiAwLjQxOC00LjY5NSA0LjUwMi00LjY5NSA0LjUwMi0wLjIxNyAwLjIyMy0wLjUwMiAwLjMzNS0wLjc4NyAwLjMzNXMtMC41Ny0wLjExMi0wLjc4OS0wLjMzNWMwIDAtNC4yODctNC4wODQtNC42OTUtNC41MDJzLTAuNDM2LTEuMTcgMC0xLjYxNXpcIiAvPlxuICA8L1N2Zz5cbik7XG5cbi8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuLy8gRHJvcGRvd24gJiBDbGVhciBCdXR0b25zXG4vLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cblxuZXhwb3J0IHR5cGUgSW5kaWNhdG9yUHJvcHMgPSBDb21tb25Qcm9wcyAmIHtcbiAgLyoqIFRoZSBjaGlsZHJlbiB0byBiZSByZW5kZXJlZCBpbnNpZGUgdGhlIGluZGljYXRvci4gKi9cbiAgY2hpbGRyZW46IE5vZGUsXG4gIC8qKiBQcm9wcyB0aGF0IHdpbGwgYmUgcGFzc2VkIG9uIHRvIHRoZSBjaGlsZHJlbi4gKi9cbiAgaW5uZXJQcm9wczogYW55LFxuICAvKiogVGhlIGZvY3VzZWQgc3RhdGUgb2YgdGhlIHNlbGVjdC4gKi9cbiAgaXNGb2N1c2VkOiBib29sZWFuLFxuICAvKiogV2hldGhlciB0aGUgdGV4dCBpcyByaWdodCB0byBsZWZ0ICovXG4gIGlzUnRsOiBib29sZWFuLFxufTtcblxuY29uc3QgYmFzZUNTUyA9ICh7XG4gIGlzRm9jdXNlZCxcbiAgdGhlbWU6IHtcbiAgICBzcGFjaW5nOiB7IGJhc2VVbml0IH0sXG4gICAgY29sb3JzLFxuICB9LFxufTogSW5kaWNhdG9yUHJvcHMpID0+ICh7XG4gIGxhYmVsOiAnaW5kaWNhdG9yQ29udGFpbmVyJyxcbiAgY29sb3I6IGlzRm9jdXNlZCA/IGNvbG9ycy5uZXV0cmFsNjAgOiBjb2xvcnMubmV1dHJhbDIwLFxuICBkaXNwbGF5OiAnZmxleCcsXG4gIHBhZGRpbmc6IGJhc2VVbml0ICogMixcbiAgdHJhbnNpdGlvbjogJ2NvbG9yIDE1MG1zJyxcblxuICAnOmhvdmVyJzoge1xuICAgIGNvbG9yOiBpc0ZvY3VzZWQgPyBjb2xvcnMubmV1dHJhbDgwIDogY29sb3JzLm5ldXRyYWw0MCxcbiAgfSxcbn0pO1xuXG5leHBvcnQgY29uc3QgZHJvcGRvd25JbmRpY2F0b3JDU1MgPSBiYXNlQ1NTO1xuZXhwb3J0IGNvbnN0IERyb3Bkb3duSW5kaWNhdG9yID0gKHByb3BzOiBJbmRpY2F0b3JQcm9wcykgPT4ge1xuICBjb25zdCB7IGNoaWxkcmVuLCBjbGFzc05hbWUsIGN4LCBnZXRTdHlsZXMsIGlubmVyUHJvcHMgfSA9IHByb3BzO1xuICByZXR1cm4gKFxuICAgIDxkaXZcbiAgICAgIHsuLi5pbm5lclByb3BzfVxuICAgICAgY3NzPXtnZXRTdHlsZXMoJ2Ryb3Bkb3duSW5kaWNhdG9yJywgcHJvcHMpfVxuICAgICAgY2xhc3NOYW1lPXtjeChcbiAgICAgICAge1xuICAgICAgICAgIGluZGljYXRvcjogdHJ1ZSxcbiAgICAgICAgICAnZHJvcGRvd24taW5kaWNhdG9yJzogdHJ1ZSxcbiAgICAgICAgfSxcbiAgICAgICAgY2xhc3NOYW1lXG4gICAgICApfVxuICAgID5cbiAgICAgIHtjaGlsZHJlbiB8fCA8RG93bkNoZXZyb24gLz59XG4gICAgPC9kaXY+XG4gICk7XG59O1xuXG5leHBvcnQgY29uc3QgY2xlYXJJbmRpY2F0b3JDU1MgPSBiYXNlQ1NTO1xuZXhwb3J0IGNvbnN0IENsZWFySW5kaWNhdG9yID0gKHByb3BzOiBJbmRpY2F0b3JQcm9wcykgPT4ge1xuICBjb25zdCB7IGNoaWxkcmVuLCBjbGFzc05hbWUsIGN4LCBnZXRTdHlsZXMsIGlubmVyUHJvcHMgfSA9IHByb3BzO1xuICByZXR1cm4gKFxuICAgIDxkaXZcbiAgICAgIHsuLi5pbm5lclByb3BzfVxuICAgICAgY3NzPXtnZXRTdHlsZXMoJ2NsZWFySW5kaWNhdG9yJywgcHJvcHMpfVxuICAgICAgY2xhc3NOYW1lPXtjeChcbiAgICAgICAge1xuICAgICAgICAgIGluZGljYXRvcjogdHJ1ZSxcbiAgICAgICAgICAnY2xlYXItaW5kaWNhdG9yJzogdHJ1ZSxcbiAgICAgICAgfSxcbiAgICAgICAgY2xhc3NOYW1lXG4gICAgICApfVxuICAgID5cbiAgICAgIHtjaGlsZHJlbiB8fCA8Q3Jvc3NJY29uIC8+fVxuICAgIDwvZGl2PlxuICApO1xufTtcblxuLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XG4vLyBTZXBhcmF0b3Jcbi8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuXG50eXBlIFNlcGFyYXRvclN0YXRlID0geyBpc0Rpc2FibGVkOiBib29sZWFuIH07XG5cbmV4cG9ydCBjb25zdCBpbmRpY2F0b3JTZXBhcmF0b3JDU1MgPSAoe1xuICBpc0Rpc2FibGVkLFxuICB0aGVtZToge1xuICAgIHNwYWNpbmc6IHsgYmFzZVVuaXQgfSxcbiAgICBjb2xvcnMsXG4gIH0sXG59OiBDb21tb25Qcm9wcyAmIFNlcGFyYXRvclN0YXRlKSA9PiAoe1xuICBsYWJlbDogJ2luZGljYXRvclNlcGFyYXRvcicsXG4gIGFsaWduU2VsZjogJ3N0cmV0Y2gnLFxuICBiYWNrZ3JvdW5kQ29sb3I6IGlzRGlzYWJsZWQgPyBjb2xvcnMubmV1dHJhbDEwIDogY29sb3JzLm5ldXRyYWwyMCxcbiAgbWFyZ2luQm90dG9tOiBiYXNlVW5pdCAqIDIsXG4gIG1hcmdpblRvcDogYmFzZVVuaXQgKiAyLFxuICB3aWR0aDogMSxcbn0pO1xuXG5leHBvcnQgY29uc3QgSW5kaWNhdG9yU2VwYXJhdG9yID0gKHByb3BzOiBJbmRpY2F0b3JQcm9wcykgPT4ge1xuICBjb25zdCB7IGNsYXNzTmFtZSwgY3gsIGdldFN0eWxlcywgaW5uZXJQcm9wcyB9ID0gcHJvcHM7XG4gIHJldHVybiAoXG4gICAgPHNwYW5cbiAgICAgIHsuLi5pbm5lclByb3BzfVxuICAgICAgY3NzPXtnZXRTdHlsZXMoJ2luZGljYXRvclNlcGFyYXRvcicsIHByb3BzKX1cbiAgICAgIGNsYXNzTmFtZT17Y3goeyAnaW5kaWNhdG9yLXNlcGFyYXRvcic6IHRydWUgfSwgY2xhc3NOYW1lKX1cbiAgICAvPlxuICApO1xufTtcblxuLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XG4vLyBMb2FkaW5nXG4vLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cblxuY29uc3QgbG9hZGluZ0RvdEFuaW1hdGlvbnMgPSBrZXlmcmFtZXNgXG4gIDAlLCA4MCUsIDEwMCUgeyBvcGFjaXR5OiAwOyB9XG4gIDQwJSB7IG9wYWNpdHk6IDE7IH1cbmA7XG5cbmV4cG9ydCBjb25zdCBsb2FkaW5nSW5kaWNhdG9yQ1NTID0gKHtcbiAgaXNGb2N1c2VkLFxuICBzaXplLFxuICB0aGVtZToge1xuICAgIGNvbG9ycyxcbiAgICBzcGFjaW5nOiB7IGJhc2VVbml0IH0sXG4gIH0sXG59OiB7XG4gIGlzRm9jdXNlZDogYm9vbGVhbixcbiAgc2l6ZTogbnVtYmVyLFxuICB0aGVtZTogVGhlbWUsXG59KSA9PiAoe1xuICBsYWJlbDogJ2xvYWRpbmdJbmRpY2F0b3InLFxuICBjb2xvcjogaXNGb2N1c2VkID8gY29sb3JzLm5ldXRyYWw2MCA6IGNvbG9ycy5uZXV0cmFsMjAsXG4gIGRpc3BsYXk6ICdmbGV4JyxcbiAgcGFkZGluZzogYmFzZVVuaXQgKiAyLFxuICB0cmFuc2l0aW9uOiAnY29sb3IgMTUwbXMnLFxuICBhbGlnblNlbGY6ICdjZW50ZXInLFxuICBmb250U2l6ZTogc2l6ZSxcbiAgbGluZUhlaWdodDogMSxcbiAgbWFyZ2luUmlnaHQ6IHNpemUsXG4gIHRleHRBbGlnbjogJ2NlbnRlcicsXG4gIHZlcnRpY2FsQWxpZ246ICdtaWRkbGUnLFxufSk7XG5cbnR5cGUgRG90UHJvcHMgPSB7IGRlbGF5OiBudW1iZXIsIG9mZnNldDogYm9vbGVhbiB9O1xuY29uc3QgTG9hZGluZ0RvdCA9ICh7IGRlbGF5LCBvZmZzZXQgfTogRG90UHJvcHMpID0+IChcbiAgPHNwYW5cbiAgICBjc3M9e3tcbiAgICAgIGFuaW1hdGlvbjogYCR7bG9hZGluZ0RvdEFuaW1hdGlvbnN9IDFzIGVhc2UtaW4tb3V0ICR7ZGVsYXl9bXMgaW5maW5pdGU7YCxcbiAgICAgIGJhY2tncm91bmRDb2xvcjogJ2N1cnJlbnRDb2xvcicsXG4gICAgICBib3JkZXJSYWRpdXM6ICcxZW0nLFxuICAgICAgZGlzcGxheTogJ2lubGluZS1ibG9jaycsXG4gICAgICBtYXJnaW5MZWZ0OiBvZmZzZXQgPyAnMWVtJyA6IG51bGwsXG4gICAgICBoZWlnaHQ6ICcxZW0nLFxuICAgICAgdmVydGljYWxBbGlnbjogJ3RvcCcsXG4gICAgICB3aWR0aDogJzFlbScsXG4gICAgfX1cbiAgLz5cbik7XG5cbmV4cG9ydCB0eXBlIExvYWRpbmdJY29uUHJvcHMgPSB7XG4gIC8qKiBQcm9wcyB0aGF0IHdpbGwgYmUgcGFzc2VkIG9uIHRvIHRoZSBjaGlsZHJlbi4gKi9cbiAgaW5uZXJQcm9wczogYW55LFxuICAvKiogVGhlIGZvY3VzZWQgc3RhdGUgb2YgdGhlIHNlbGVjdC4gKi9cbiAgaXNGb2N1c2VkOiBib29sZWFuLFxuICAvKiogV2hldGhlciB0aGUgdGV4dCBpcyByaWdodCB0byBsZWZ0ICovXG4gIGlzUnRsOiBib29sZWFuLFxufSAmIENvbW1vblByb3BzICYge1xuICAgIC8qKiBTZXQgc2l6ZSBvZiB0aGUgY29udGFpbmVyLiAqL1xuICAgIHNpemU6IG51bWJlcixcbiAgfTtcbmV4cG9ydCBjb25zdCBMb2FkaW5nSW5kaWNhdG9yID0gKHByb3BzOiBMb2FkaW5nSWNvblByb3BzKSA9PiB7XG4gIGNvbnN0IHsgY2xhc3NOYW1lLCBjeCwgZ2V0U3R5bGVzLCBpbm5lclByb3BzLCBpc1J0bCB9ID0gcHJvcHM7XG5cbiAgcmV0dXJuIChcbiAgICA8ZGl2XG4gICAgICB7Li4uaW5uZXJQcm9wc31cbiAgICAgIGNzcz17Z2V0U3R5bGVzKCdsb2FkaW5nSW5kaWNhdG9yJywgcHJvcHMpfVxuICAgICAgY2xhc3NOYW1lPXtjeChcbiAgICAgICAge1xuICAgICAgICAgIGluZGljYXRvcjogdHJ1ZSxcbiAgICAgICAgICAnbG9hZGluZy1pbmRpY2F0b3InOiB0cnVlLFxuICAgICAgICB9LFxuICAgICAgICBjbGFzc05hbWVcbiAgICAgICl9XG4gICAgPlxuICAgICAgPExvYWRpbmdEb3QgZGVsYXk9ezB9IG9mZnNldD17aXNSdGx9IC8+XG4gICAgICA8TG9hZGluZ0RvdCBkZWxheT17MTYwfSBvZmZzZXQgLz5cbiAgICAgIDxMb2FkaW5nRG90IGRlbGF5PXszMjB9IG9mZnNldD17IWlzUnRsfSAvPlxuICAgIDwvZGl2PlxuICApO1xufTtcbkxvYWRpbmdJbmRpY2F0b3IuZGVmYXVsdFByb3BzID0geyBzaXplOiA0IH07XG4iXX0= */\"\n}; // ==============================\n// Dropdown & Clear Icons\n// ==============================\n\n\nvar Svg = function Svg(_ref) {\n var size = _ref.size,\n props = _objectWithoutPropertiesLoose(_ref, [\"size\"]);\n\n return jsx(\"svg\", _extends$2({\n height: size,\n width: size,\n viewBox: \"0 0 20 20\",\n \"aria-hidden\": \"true\",\n focusable: \"false\",\n css: _ref2\n }, props));\n};\n\nvar CrossIcon = function CrossIcon(props) {\n return jsx(Svg, _extends$2({\n size: 20\n }, props), jsx(\"path\", {\n d: \"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z\"\n }));\n};\n\nvar DownChevron = function DownChevron(props) {\n return jsx(Svg, _extends$2({\n size: 20\n }, props), jsx(\"path\", {\n d: \"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z\"\n }));\n}; // ==============================\n// Dropdown & Clear Buttons\n// ==============================\n\n\nvar baseCSS = function baseCSS(_ref3) {\n var isFocused = _ref3.isFocused,\n _ref3$theme = _ref3.theme,\n baseUnit = _ref3$theme.spacing.baseUnit,\n colors = _ref3$theme.colors;\n return {\n label: 'indicatorContainer',\n color: isFocused ? colors.neutral60 : colors.neutral20,\n display: 'flex',\n padding: baseUnit * 2,\n transition: 'color 150ms',\n ':hover': {\n color: isFocused ? colors.neutral80 : colors.neutral40\n }\n };\n};\n\nvar dropdownIndicatorCSS = baseCSS;\n\nvar DropdownIndicator = function DropdownIndicator(props) {\n var children = props.children,\n className = props.className,\n cx = props.cx,\n getStyles = props.getStyles,\n innerProps = props.innerProps;\n return jsx(\"div\", _extends$2({}, innerProps, {\n css: getStyles('dropdownIndicator', props),\n className: cx({\n indicator: true,\n 'dropdown-indicator': true\n }, className)\n }), children || jsx(DownChevron, null));\n};\n\nvar clearIndicatorCSS = baseCSS;\n\nvar ClearIndicator = function ClearIndicator(props) {\n var children = props.children,\n className = props.className,\n cx = props.cx,\n getStyles = props.getStyles,\n innerProps = props.innerProps;\n return jsx(\"div\", _extends$2({}, innerProps, {\n css: getStyles('clearIndicator', props),\n className: cx({\n indicator: true,\n 'clear-indicator': true\n }, className)\n }), children || jsx(CrossIcon, null));\n}; // ==============================\n// Separator\n// ==============================\n\n\nvar indicatorSeparatorCSS = function indicatorSeparatorCSS(_ref4) {\n var isDisabled = _ref4.isDisabled,\n _ref4$theme = _ref4.theme,\n baseUnit = _ref4$theme.spacing.baseUnit,\n colors = _ref4$theme.colors;\n return {\n label: 'indicatorSeparator',\n alignSelf: 'stretch',\n backgroundColor: isDisabled ? colors.neutral10 : colors.neutral20,\n marginBottom: baseUnit * 2,\n marginTop: baseUnit * 2,\n width: 1\n };\n};\n\nvar IndicatorSeparator = function IndicatorSeparator(props) {\n var className = props.className,\n cx = props.cx,\n getStyles = props.getStyles,\n innerProps = props.innerProps;\n return jsx(\"span\", _extends$2({}, innerProps, {\n css: getStyles('indicatorSeparator', props),\n className: cx({\n 'indicator-separator': true\n }, className)\n }));\n}; // ==============================\n// Loading\n// ==============================\n\n\nvar loadingDotAnimations = keyframes(_templateObject());\n\nvar loadingIndicatorCSS = function loadingIndicatorCSS(_ref5) {\n var isFocused = _ref5.isFocused,\n size = _ref5.size,\n _ref5$theme = _ref5.theme,\n colors = _ref5$theme.colors,\n baseUnit = _ref5$theme.spacing.baseUnit;\n return {\n label: 'loadingIndicator',\n color: isFocused ? colors.neutral60 : colors.neutral20,\n display: 'flex',\n padding: baseUnit * 2,\n transition: 'color 150ms',\n alignSelf: 'center',\n fontSize: size,\n lineHeight: 1,\n marginRight: size,\n textAlign: 'center',\n verticalAlign: 'middle'\n };\n};\n\nvar LoadingDot = function LoadingDot(_ref6) {\n var delay = _ref6.delay,\n offset = _ref6.offset;\n return jsx(\"span\", {\n css: /*#__PURE__*/_css({\n animation: loadingDotAnimations + \" 1s ease-in-out \" + delay + \"ms infinite;\",\n backgroundColor: 'currentColor',\n borderRadius: '1em',\n display: 'inline-block',\n marginLeft: offset ? '1em' : null,\n height: '1em',\n verticalAlign: 'top',\n width: '1em'\n }, process.env.NODE_ENV === \"production\" ? \"\" : \"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGljYXRvcnMuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBc0xJIiwiZmlsZSI6ImluZGljYXRvcnMuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLyBAZmxvd1xuLyoqIEBqc3gganN4ICovXG5pbXBvcnQgeyB0eXBlIE5vZGUgfSBmcm9tICdyZWFjdCc7XG5pbXBvcnQgeyBqc3gsIGtleWZyYW1lcyB9IGZyb20gJ0BlbW90aW9uL2NvcmUnO1xuXG5pbXBvcnQgdHlwZSB7IENvbW1vblByb3BzLCBUaGVtZSB9IGZyb20gJy4uL3R5cGVzJztcblxuLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XG4vLyBEcm9wZG93biAmIENsZWFyIEljb25zXG4vLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cblxuY29uc3QgU3ZnID0gKHsgc2l6ZSwgLi4ucHJvcHMgfTogeyBzaXplOiBudW1iZXIgfSkgPT4gKFxuICA8c3ZnXG4gICAgaGVpZ2h0PXtzaXplfVxuICAgIHdpZHRoPXtzaXplfVxuICAgIHZpZXdCb3g9XCIwIDAgMjAgMjBcIlxuICAgIGFyaWEtaGlkZGVuPVwidHJ1ZVwiXG4gICAgZm9jdXNhYmxlPVwiZmFsc2VcIlxuICAgIGNzcz17e1xuICAgICAgZGlzcGxheTogJ2lubGluZS1ibG9jaycsXG4gICAgICBmaWxsOiAnY3VycmVudENvbG9yJyxcbiAgICAgIGxpbmVIZWlnaHQ6IDEsXG4gICAgICBzdHJva2U6ICdjdXJyZW50Q29sb3InLFxuICAgICAgc3Ryb2tlV2lkdGg6IDAsXG4gICAgfX1cbiAgICB7Li4ucHJvcHN9XG4gIC8+XG4pO1xuXG5leHBvcnQgY29uc3QgQ3Jvc3NJY29uID0gKHByb3BzOiBhbnkpID0+IChcbiAgPFN2ZyBzaXplPXsyMH0gey4uLnByb3BzfT5cbiAgICA8cGF0aCBkPVwiTTE0LjM0OCAxNC44NDljLTAuNDY5IDAuNDY5LTEuMjI5IDAuNDY5LTEuNjk3IDBsLTIuNjUxLTMuMDMwLTIuNjUxIDMuMDI5Yy0wLjQ2OSAwLjQ2OS0xLjIyOSAwLjQ2OS0xLjY5NyAwLTAuNDY5LTAuNDY5LTAuNDY5LTEuMjI5IDAtMS42OTdsMi43NTgtMy4xNS0yLjc1OS0zLjE1MmMtMC40NjktMC40NjktMC40NjktMS4yMjggMC0xLjY5N3MxLjIyOC0wLjQ2OSAxLjY5NyAwbDIuNjUyIDMuMDMxIDIuNjUxLTMuMDMxYzAuNDY5LTAuNDY5IDEuMjI4LTAuNDY5IDEuNjk3IDBzMC40NjkgMS4yMjkgMCAxLjY5N2wtMi43NTggMy4xNTIgMi43NTggMy4xNWMwLjQ2OSAwLjQ2OSAwLjQ2OSAxLjIyOSAwIDEuNjk4elwiIC8+XG4gIDwvU3ZnPlxuKTtcbmV4cG9ydCBjb25zdCBEb3duQ2hldnJvbiA9IChwcm9wczogYW55KSA9PiAoXG4gIDxTdmcgc2l6ZT17MjB9IHsuLi5wcm9wc30+XG4gICAgPHBhdGggZD1cIk00LjUxNiA3LjU0OGMwLjQzNi0wLjQ0NiAxLjA0My0wLjQ4MSAxLjU3NiAwbDMuOTA4IDMuNzQ3IDMuOTA4LTMuNzQ3YzAuNTMzLTAuNDgxIDEuMTQxLTAuNDQ2IDEuNTc0IDAgMC40MzYgMC40NDUgMC40MDggMS4xOTcgMCAxLjYxNS0wLjQwNiAwLjQxOC00LjY5NSA0LjUwMi00LjY5NSA0LjUwMi0wLjIxNyAwLjIyMy0wLjUwMiAwLjMzNS0wLjc4NyAwLjMzNXMtMC41Ny0wLjExMi0wLjc4OS0wLjMzNWMwIDAtNC4yODctNC4wODQtNC42OTUtNC41MDJzLTAuNDM2LTEuMTcgMC0xLjYxNXpcIiAvPlxuICA8L1N2Zz5cbik7XG5cbi8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuLy8gRHJvcGRvd24gJiBDbGVhciBCdXR0b25zXG4vLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cblxuZXhwb3J0IHR5cGUgSW5kaWNhdG9yUHJvcHMgPSBDb21tb25Qcm9wcyAmIHtcbiAgLyoqIFRoZSBjaGlsZHJlbiB0byBiZSByZW5kZXJlZCBpbnNpZGUgdGhlIGluZGljYXRvci4gKi9cbiAgY2hpbGRyZW46IE5vZGUsXG4gIC8qKiBQcm9wcyB0aGF0IHdpbGwgYmUgcGFzc2VkIG9uIHRvIHRoZSBjaGlsZHJlbi4gKi9cbiAgaW5uZXJQcm9wczogYW55LFxuICAvKiogVGhlIGZvY3VzZWQgc3RhdGUgb2YgdGhlIHNlbGVjdC4gKi9cbiAgaXNGb2N1c2VkOiBib29sZWFuLFxuICAvKiogV2hldGhlciB0aGUgdGV4dCBpcyByaWdodCB0byBsZWZ0ICovXG4gIGlzUnRsOiBib29sZWFuLFxufTtcblxuY29uc3QgYmFzZUNTUyA9ICh7XG4gIGlzRm9jdXNlZCxcbiAgdGhlbWU6IHtcbiAgICBzcGFjaW5nOiB7IGJhc2VVbml0IH0sXG4gICAgY29sb3JzLFxuICB9LFxufTogSW5kaWNhdG9yUHJvcHMpID0+ICh7XG4gIGxhYmVsOiAnaW5kaWNhdG9yQ29udGFpbmVyJyxcbiAgY29sb3I6IGlzRm9jdXNlZCA/IGNvbG9ycy5uZXV0cmFsNjAgOiBjb2xvcnMubmV1dHJhbDIwLFxuICBkaXNwbGF5OiAnZmxleCcsXG4gIHBhZGRpbmc6IGJhc2VVbml0ICogMixcbiAgdHJhbnNpdGlvbjogJ2NvbG9yIDE1MG1zJyxcblxuICAnOmhvdmVyJzoge1xuICAgIGNvbG9yOiBpc0ZvY3VzZWQgPyBjb2xvcnMubmV1dHJhbDgwIDogY29sb3JzLm5ldXRyYWw0MCxcbiAgfSxcbn0pO1xuXG5leHBvcnQgY29uc3QgZHJvcGRvd25JbmRpY2F0b3JDU1MgPSBiYXNlQ1NTO1xuZXhwb3J0IGNvbnN0IERyb3Bkb3duSW5kaWNhdG9yID0gKHByb3BzOiBJbmRpY2F0b3JQcm9wcykgPT4ge1xuICBjb25zdCB7IGNoaWxkcmVuLCBjbGFzc05hbWUsIGN4LCBnZXRTdHlsZXMsIGlubmVyUHJvcHMgfSA9IHByb3BzO1xuICByZXR1cm4gKFxuICAgIDxkaXZcbiAgICAgIHsuLi5pbm5lclByb3BzfVxuICAgICAgY3NzPXtnZXRTdHlsZXMoJ2Ryb3Bkb3duSW5kaWNhdG9yJywgcHJvcHMpfVxuICAgICAgY2xhc3NOYW1lPXtjeChcbiAgICAgICAge1xuICAgICAgICAgIGluZGljYXRvcjogdHJ1ZSxcbiAgICAgICAgICAnZHJvcGRvd24taW5kaWNhdG9yJzogdHJ1ZSxcbiAgICAgICAgfSxcbiAgICAgICAgY2xhc3NOYW1lXG4gICAgICApfVxuICAgID5cbiAgICAgIHtjaGlsZHJlbiB8fCA8RG93bkNoZXZyb24gLz59XG4gICAgPC9kaXY+XG4gICk7XG59O1xuXG5leHBvcnQgY29uc3QgY2xlYXJJbmRpY2F0b3JDU1MgPSBiYXNlQ1NTO1xuZXhwb3J0IGNvbnN0IENsZWFySW5kaWNhdG9yID0gKHByb3BzOiBJbmRpY2F0b3JQcm9wcykgPT4ge1xuICBjb25zdCB7IGNoaWxkcmVuLCBjbGFzc05hbWUsIGN4LCBnZXRTdHlsZXMsIGlubmVyUHJvcHMgfSA9IHByb3BzO1xuICByZXR1cm4gKFxuICAgIDxkaXZcbiAgICAgIHsuLi5pbm5lclByb3BzfVxuICAgICAgY3NzPXtnZXRTdHlsZXMoJ2NsZWFySW5kaWNhdG9yJywgcHJvcHMpfVxuICAgICAgY2xhc3NOYW1lPXtjeChcbiAgICAgICAge1xuICAgICAgICAgIGluZGljYXRvcjogdHJ1ZSxcbiAgICAgICAgICAnY2xlYXItaW5kaWNhdG9yJzogdHJ1ZSxcbiAgICAgICAgfSxcbiAgICAgICAgY2xhc3NOYW1lXG4gICAgICApfVxuICAgID5cbiAgICAgIHtjaGlsZHJlbiB8fCA8Q3Jvc3NJY29uIC8+fVxuICAgIDwvZGl2PlxuICApO1xufTtcblxuLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XG4vLyBTZXBhcmF0b3Jcbi8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuXG50eXBlIFNlcGFyYXRvclN0YXRlID0geyBpc0Rpc2FibGVkOiBib29sZWFuIH07XG5cbmV4cG9ydCBjb25zdCBpbmRpY2F0b3JTZXBhcmF0b3JDU1MgPSAoe1xuICBpc0Rpc2FibGVkLFxuICB0aGVtZToge1xuICAgIHNwYWNpbmc6IHsgYmFzZVVuaXQgfSxcbiAgICBjb2xvcnMsXG4gIH0sXG59OiBDb21tb25Qcm9wcyAmIFNlcGFyYXRvclN0YXRlKSA9PiAoe1xuICBsYWJlbDogJ2luZGljYXRvclNlcGFyYXRvcicsXG4gIGFsaWduU2VsZjogJ3N0cmV0Y2gnLFxuICBiYWNrZ3JvdW5kQ29sb3I6IGlzRGlzYWJsZWQgPyBjb2xvcnMubmV1dHJhbDEwIDogY29sb3JzLm5ldXRyYWwyMCxcbiAgbWFyZ2luQm90dG9tOiBiYXNlVW5pdCAqIDIsXG4gIG1hcmdpblRvcDogYmFzZVVuaXQgKiAyLFxuICB3aWR0aDogMSxcbn0pO1xuXG5leHBvcnQgY29uc3QgSW5kaWNhdG9yU2VwYXJhdG9yID0gKHByb3BzOiBJbmRpY2F0b3JQcm9wcykgPT4ge1xuICBjb25zdCB7IGNsYXNzTmFtZSwgY3gsIGdldFN0eWxlcywgaW5uZXJQcm9wcyB9ID0gcHJvcHM7XG4gIHJldHVybiAoXG4gICAgPHNwYW5cbiAgICAgIHsuLi5pbm5lclByb3BzfVxuICAgICAgY3NzPXtnZXRTdHlsZXMoJ2luZGljYXRvclNlcGFyYXRvcicsIHByb3BzKX1cbiAgICAgIGNsYXNzTmFtZT17Y3goeyAnaW5kaWNhdG9yLXNlcGFyYXRvcic6IHRydWUgfSwgY2xhc3NOYW1lKX1cbiAgICAvPlxuICApO1xufTtcblxuLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XG4vLyBMb2FkaW5nXG4vLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cblxuY29uc3QgbG9hZGluZ0RvdEFuaW1hdGlvbnMgPSBrZXlmcmFtZXNgXG4gIDAlLCA4MCUsIDEwMCUgeyBvcGFjaXR5OiAwOyB9XG4gIDQwJSB7IG9wYWNpdHk6IDE7IH1cbmA7XG5cbmV4cG9ydCBjb25zdCBsb2FkaW5nSW5kaWNhdG9yQ1NTID0gKHtcbiAgaXNGb2N1c2VkLFxuICBzaXplLFxuICB0aGVtZToge1xuICAgIGNvbG9ycyxcbiAgICBzcGFjaW5nOiB7IGJhc2VVbml0IH0sXG4gIH0sXG59OiB7XG4gIGlzRm9jdXNlZDogYm9vbGVhbixcbiAgc2l6ZTogbnVtYmVyLFxuICB0aGVtZTogVGhlbWUsXG59KSA9PiAoe1xuICBsYWJlbDogJ2xvYWRpbmdJbmRpY2F0b3InLFxuICBjb2xvcjogaXNGb2N1c2VkID8gY29sb3JzLm5ldXRyYWw2MCA6IGNvbG9ycy5uZXV0cmFsMjAsXG4gIGRpc3BsYXk6ICdmbGV4JyxcbiAgcGFkZGluZzogYmFzZVVuaXQgKiAyLFxuICB0cmFuc2l0aW9uOiAnY29sb3IgMTUwbXMnLFxuICBhbGlnblNlbGY6ICdjZW50ZXInLFxuICBmb250U2l6ZTogc2l6ZSxcbiAgbGluZUhlaWdodDogMSxcbiAgbWFyZ2luUmlnaHQ6IHNpemUsXG4gIHRleHRBbGlnbjogJ2NlbnRlcicsXG4gIHZlcnRpY2FsQWxpZ246ICdtaWRkbGUnLFxufSk7XG5cbnR5cGUgRG90UHJvcHMgPSB7IGRlbGF5OiBudW1iZXIsIG9mZnNldDogYm9vbGVhbiB9O1xuY29uc3QgTG9hZGluZ0RvdCA9ICh7IGRlbGF5LCBvZmZzZXQgfTogRG90UHJvcHMpID0+IChcbiAgPHNwYW5cbiAgICBjc3M9e3tcbiAgICAgIGFuaW1hdGlvbjogYCR7bG9hZGluZ0RvdEFuaW1hdGlvbnN9IDFzIGVhc2UtaW4tb3V0ICR7ZGVsYXl9bXMgaW5maW5pdGU7YCxcbiAgICAgIGJhY2tncm91bmRDb2xvcjogJ2N1cnJlbnRDb2xvcicsXG4gICAgICBib3JkZXJSYWRpdXM6ICcxZW0nLFxuICAgICAgZGlzcGxheTogJ2lubGluZS1ibG9jaycsXG4gICAgICBtYXJnaW5MZWZ0OiBvZmZzZXQgPyAnMWVtJyA6IG51bGwsXG4gICAgICBoZWlnaHQ6ICcxZW0nLFxuICAgICAgdmVydGljYWxBbGlnbjogJ3RvcCcsXG4gICAgICB3aWR0aDogJzFlbScsXG4gICAgfX1cbiAgLz5cbik7XG5cbmV4cG9ydCB0eXBlIExvYWRpbmdJY29uUHJvcHMgPSB7XG4gIC8qKiBQcm9wcyB0aGF0IHdpbGwgYmUgcGFzc2VkIG9uIHRvIHRoZSBjaGlsZHJlbi4gKi9cbiAgaW5uZXJQcm9wczogYW55LFxuICAvKiogVGhlIGZvY3VzZWQgc3RhdGUgb2YgdGhlIHNlbGVjdC4gKi9cbiAgaXNGb2N1c2VkOiBib29sZWFuLFxuICAvKiogV2hldGhlciB0aGUgdGV4dCBpcyByaWdodCB0byBsZWZ0ICovXG4gIGlzUnRsOiBib29sZWFuLFxufSAmIENvbW1vblByb3BzICYge1xuICAgIC8qKiBTZXQgc2l6ZSBvZiB0aGUgY29udGFpbmVyLiAqL1xuICAgIHNpemU6IG51bWJlcixcbiAgfTtcbmV4cG9ydCBjb25zdCBMb2FkaW5nSW5kaWNhdG9yID0gKHByb3BzOiBMb2FkaW5nSWNvblByb3BzKSA9PiB7XG4gIGNvbnN0IHsgY2xhc3NOYW1lLCBjeCwgZ2V0U3R5bGVzLCBpbm5lclByb3BzLCBpc1J0bCB9ID0gcHJvcHM7XG5cbiAgcmV0dXJuIChcbiAgICA8ZGl2XG4gICAgICB7Li4uaW5uZXJQcm9wc31cbiAgICAgIGNzcz17Z2V0U3R5bGVzKCdsb2FkaW5nSW5kaWNhdG9yJywgcHJvcHMpfVxuICAgICAgY2xhc3NOYW1lPXtjeChcbiAgICAgICAge1xuICAgICAgICAgIGluZGljYXRvcjogdHJ1ZSxcbiAgICAgICAgICAnbG9hZGluZy1pbmRpY2F0b3InOiB0cnVlLFxuICAgICAgICB9LFxuICAgICAgICBjbGFzc05hbWVcbiAgICAgICl9XG4gICAgPlxuICAgICAgPExvYWRpbmdEb3QgZGVsYXk9ezB9IG9mZnNldD17aXNSdGx9IC8+XG4gICAgICA8TG9hZGluZ0RvdCBkZWxheT17MTYwfSBvZmZzZXQgLz5cbiAgICAgIDxMb2FkaW5nRG90IGRlbGF5PXszMjB9IG9mZnNldD17IWlzUnRsfSAvPlxuICAgIDwvZGl2PlxuICApO1xufTtcbkxvYWRpbmdJbmRpY2F0b3IuZGVmYXVsdFByb3BzID0geyBzaXplOiA0IH07XG4iXX0= */\")\n });\n};\n\nvar LoadingIndicator = function LoadingIndicator(props) {\n var className = props.className,\n cx = props.cx,\n getStyles = props.getStyles,\n innerProps = props.innerProps,\n isRtl = props.isRtl;\n return jsx(\"div\", _extends$2({}, innerProps, {\n css: getStyles('loadingIndicator', props),\n className: cx({\n indicator: true,\n 'loading-indicator': true\n }, className)\n }), jsx(LoadingDot, {\n delay: 0,\n offset: isRtl\n }), jsx(LoadingDot, {\n delay: 160,\n offset: true\n }), jsx(LoadingDot, {\n delay: 320,\n offset: !isRtl\n }));\n};\n\nLoadingIndicator.defaultProps = {\n size: 4\n};\n\nfunction _extends$3() {\n _extends$3 = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends$3.apply(this, arguments);\n}\n\nvar css = function css(_ref) {\n var isDisabled = _ref.isDisabled,\n isFocused = _ref.isFocused,\n _ref$theme = _ref.theme,\n colors = _ref$theme.colors,\n borderRadius = _ref$theme.borderRadius,\n spacing = _ref$theme.spacing;\n return {\n label: 'control',\n alignItems: 'center',\n backgroundColor: isDisabled ? colors.neutral5 : colors.neutral0,\n borderColor: isDisabled ? colors.neutral10 : isFocused ? colors.primary : colors.neutral20,\n borderRadius: borderRadius,\n borderStyle: 'solid',\n borderWidth: 1,\n boxShadow: isFocused ? \"0 0 0 1px \" + colors.primary : null,\n cursor: 'default',\n display: 'flex',\n flexWrap: 'wrap',\n justifyContent: 'space-between',\n minHeight: spacing.controlHeight,\n outline: '0 !important',\n position: 'relative',\n transition: 'all 100ms',\n '&:hover': {\n borderColor: isFocused ? colors.primary : colors.neutral30\n }\n };\n};\n\nvar Control = function Control(props) {\n var children = props.children,\n cx = props.cx,\n getStyles = props.getStyles,\n className = props.className,\n isDisabled = props.isDisabled,\n isFocused = props.isFocused,\n innerRef = props.innerRef,\n innerProps = props.innerProps,\n menuIsOpen = props.menuIsOpen;\n return jsx(\"div\", _extends$3({\n ref: innerRef,\n css: getStyles('control', props),\n className: cx({\n control: true,\n 'control--is-disabled': isDisabled,\n 'control--is-focused': isFocused,\n 'control--menu-is-open': menuIsOpen\n }, className)\n }, innerProps), children);\n};\n\nfunction _objectWithoutPropertiesLoose$1(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction _extends$4() {\n _extends$4 = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends$4.apply(this, arguments);\n}\n\nvar groupCSS = function groupCSS(_ref) {\n var spacing = _ref.theme.spacing;\n return {\n paddingBottom: spacing.baseUnit * 2,\n paddingTop: spacing.baseUnit * 2\n };\n};\n\nvar Group = function Group(props) {\n var children = props.children,\n className = props.className,\n cx = props.cx,\n getStyles = props.getStyles,\n Heading = props.Heading,\n headingProps = props.headingProps,\n label = props.label,\n theme = props.theme,\n selectProps = props.selectProps;\n return jsx(\"div\", {\n css: getStyles('group', props),\n className: cx({\n group: true\n }, className)\n }, jsx(Heading, _extends$4({}, headingProps, {\n selectProps: selectProps,\n theme: theme,\n getStyles: getStyles,\n cx: cx\n }), label), jsx(\"div\", null, children));\n};\n\nvar groupHeadingCSS = function groupHeadingCSS(_ref2) {\n var spacing = _ref2.theme.spacing;\n return {\n label: 'group',\n color: '#999',\n cursor: 'default',\n display: 'block',\n fontSize: '75%',\n fontWeight: '500',\n marginBottom: '0.25em',\n paddingLeft: spacing.baseUnit * 3,\n paddingRight: spacing.baseUnit * 3,\n textTransform: 'uppercase'\n };\n};\n\nvar GroupHeading = function GroupHeading(props) {\n var className = props.className,\n cx = props.cx,\n getStyles = props.getStyles,\n theme = props.theme,\n selectProps = props.selectProps,\n cleanProps = _objectWithoutPropertiesLoose$1(props, [\"className\", \"cx\", \"getStyles\", \"theme\", \"selectProps\"]);\n\n return jsx(\"div\", _extends$4({\n css: getStyles('groupHeading', _extends$4({\n theme: theme\n }, cleanProps)),\n className: cx({\n 'group-heading': true\n }, className)\n }, cleanProps));\n};\n\nfunction _extends$5() {\n _extends$5 = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends$5.apply(this, arguments);\n}\n\nfunction _objectWithoutPropertiesLoose$2(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nvar inputCSS = function inputCSS(_ref) {\n var isDisabled = _ref.isDisabled,\n _ref$theme = _ref.theme,\n spacing = _ref$theme.spacing,\n colors = _ref$theme.colors;\n return {\n margin: spacing.baseUnit / 2,\n paddingBottom: spacing.baseUnit / 2,\n paddingTop: spacing.baseUnit / 2,\n visibility: isDisabled ? 'hidden' : 'visible',\n color: colors.neutral80\n };\n};\n\nvar inputStyle = function inputStyle(isHidden) {\n return {\n label: 'input',\n background: 0,\n border: 0,\n fontSize: 'inherit',\n opacity: isHidden ? 0 : 1,\n outline: 0,\n padding: 0,\n color: 'inherit'\n };\n};\n\nvar Input = function Input(_ref2) {\n var className = _ref2.className,\n cx = _ref2.cx,\n getStyles = _ref2.getStyles,\n innerRef = _ref2.innerRef,\n isHidden = _ref2.isHidden,\n isDisabled = _ref2.isDisabled,\n theme = _ref2.theme,\n selectProps = _ref2.selectProps,\n props = _objectWithoutPropertiesLoose$2(_ref2, [\"className\", \"cx\", \"getStyles\", \"innerRef\", \"isHidden\", \"isDisabled\", \"theme\", \"selectProps\"]);\n\n return jsx(\"div\", {\n css: getStyles('input', _extends$5({\n theme: theme\n }, props))\n }, jsx(AutosizeInput, _extends$5({\n className: cx({\n input: true\n }, className),\n inputRef: innerRef,\n inputStyle: inputStyle(isHidden),\n disabled: isDisabled\n }, props)));\n};\n\nfunction _extends$6() {\n _extends$6 = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends$6.apply(this, arguments);\n}\n\nvar multiValueCSS = function multiValueCSS(_ref) {\n var _ref$theme = _ref.theme,\n spacing = _ref$theme.spacing,\n borderRadius = _ref$theme.borderRadius,\n colors = _ref$theme.colors;\n return {\n label: 'multiValue',\n backgroundColor: colors.neutral10,\n borderRadius: borderRadius / 2,\n display: 'flex',\n margin: spacing.baseUnit / 2,\n minWidth: 0 // resolves flex/text-overflow bug\n\n };\n};\n\nvar multiValueLabelCSS = function multiValueLabelCSS(_ref2) {\n var _ref2$theme = _ref2.theme,\n borderRadius = _ref2$theme.borderRadius,\n colors = _ref2$theme.colors,\n cropWithEllipsis = _ref2.cropWithEllipsis;\n return {\n borderRadius: borderRadius / 2,\n color: colors.neutral80,\n fontSize: '85%',\n overflow: 'hidden',\n padding: 3,\n paddingLeft: 6,\n textOverflow: cropWithEllipsis ? 'ellipsis' : null,\n whiteSpace: 'nowrap'\n };\n};\n\nvar multiValueRemoveCSS = function multiValueRemoveCSS(_ref3) {\n var _ref3$theme = _ref3.theme,\n spacing = _ref3$theme.spacing,\n borderRadius = _ref3$theme.borderRadius,\n colors = _ref3$theme.colors,\n isFocused = _ref3.isFocused;\n return {\n alignItems: 'center',\n borderRadius: borderRadius / 2,\n backgroundColor: isFocused && colors.dangerLight,\n display: 'flex',\n paddingLeft: spacing.baseUnit,\n paddingRight: spacing.baseUnit,\n ':hover': {\n backgroundColor: colors.dangerLight,\n color: colors.danger\n }\n };\n};\n\nvar MultiValueGeneric = function MultiValueGeneric(_ref4) {\n var children = _ref4.children,\n innerProps = _ref4.innerProps;\n return jsx(\"div\", innerProps, children);\n};\n\nvar MultiValueContainer = MultiValueGeneric;\nvar MultiValueLabel = MultiValueGeneric;\n\nfunction MultiValueRemove(_ref5) {\n var children = _ref5.children,\n innerProps = _ref5.innerProps;\n return jsx(\"div\", innerProps, children || jsx(CrossIcon, {\n size: 14\n }));\n}\n\nvar MultiValue = function MultiValue(props) {\n var children = props.children,\n className = props.className,\n components = props.components,\n cx = props.cx,\n data = props.data,\n getStyles = props.getStyles,\n innerProps = props.innerProps,\n isDisabled = props.isDisabled,\n removeProps = props.removeProps,\n selectProps = props.selectProps;\n var Container = components.Container,\n Label = components.Label,\n Remove = components.Remove;\n return jsx(ClassNames, null, function (_ref6) {\n var css = _ref6.css,\n emotionCx = _ref6.cx;\n return jsx(Container, {\n data: data,\n innerProps: _extends$6({}, innerProps, {\n className: emotionCx(css(getStyles('multiValue', props)), cx({\n 'multi-value': true,\n 'multi-value--is-disabled': isDisabled\n }, className))\n }),\n selectProps: selectProps\n }, jsx(Label, {\n data: data,\n innerProps: {\n className: emotionCx(css(getStyles('multiValueLabel', props)), cx({\n 'multi-value__label': true\n }, className))\n },\n selectProps: selectProps\n }, children), jsx(Remove, {\n data: data,\n innerProps: _extends$6({\n className: emotionCx(css(getStyles('multiValueRemove', props)), cx({\n 'multi-value__remove': true\n }, className))\n }, removeProps),\n selectProps: selectProps\n }));\n });\n};\n\nMultiValue.defaultProps = {\n cropWithEllipsis: true\n};\n\nfunction _extends$7() {\n _extends$7 = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends$7.apply(this, arguments);\n}\n\nvar optionCSS = function optionCSS(_ref) {\n var isDisabled = _ref.isDisabled,\n isFocused = _ref.isFocused,\n isSelected = _ref.isSelected,\n _ref$theme = _ref.theme,\n spacing = _ref$theme.spacing,\n colors = _ref$theme.colors;\n return {\n label: 'option',\n backgroundColor: isSelected ? colors.primary : isFocused ? colors.primary25 : 'transparent',\n color: isDisabled ? colors.neutral20 : isSelected ? colors.neutral0 : 'inherit',\n cursor: 'default',\n display: 'block',\n fontSize: 'inherit',\n padding: spacing.baseUnit * 2 + \"px \" + spacing.baseUnit * 3 + \"px\",\n width: '100%',\n userSelect: 'none',\n WebkitTapHighlightColor: 'rgba(0, 0, 0, 0)',\n // provide some affordance on touch devices\n ':active': {\n backgroundColor: !isDisabled && (isSelected ? colors.primary : colors.primary50)\n }\n };\n};\n\nvar Option = function Option(props) {\n var children = props.children,\n className = props.className,\n cx = props.cx,\n getStyles = props.getStyles,\n isDisabled = props.isDisabled,\n isFocused = props.isFocused,\n isSelected = props.isSelected,\n innerRef = props.innerRef,\n innerProps = props.innerProps;\n return jsx(\"div\", _extends$7({\n css: getStyles('option', props),\n className: cx({\n option: true,\n 'option--is-disabled': isDisabled,\n 'option--is-focused': isFocused,\n 'option--is-selected': isSelected\n }, className),\n ref: innerRef\n }, innerProps), children);\n};\n\nfunction _extends$8() {\n _extends$8 = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends$8.apply(this, arguments);\n}\n\nvar placeholderCSS = function placeholderCSS(_ref) {\n var _ref$theme = _ref.theme,\n spacing = _ref$theme.spacing,\n colors = _ref$theme.colors;\n return {\n label: 'placeholder',\n color: colors.neutral50,\n marginLeft: spacing.baseUnit / 2,\n marginRight: spacing.baseUnit / 2,\n position: 'absolute',\n top: '50%',\n transform: 'translateY(-50%)'\n };\n};\n\nvar Placeholder = function Placeholder(props) {\n var children = props.children,\n className = props.className,\n cx = props.cx,\n getStyles = props.getStyles,\n innerProps = props.innerProps;\n return jsx(\"div\", _extends$8({\n css: getStyles('placeholder', props),\n className: cx({\n placeholder: true\n }, className)\n }, innerProps), children);\n};\n\nfunction _extends$9() {\n _extends$9 = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends$9.apply(this, arguments);\n}\n\nvar css$1 = function css(_ref) {\n var isDisabled = _ref.isDisabled,\n _ref$theme = _ref.theme,\n spacing = _ref$theme.spacing,\n colors = _ref$theme.colors;\n return {\n label: 'singleValue',\n color: isDisabled ? colors.neutral40 : colors.neutral80,\n marginLeft: spacing.baseUnit / 2,\n marginRight: spacing.baseUnit / 2,\n maxWidth: \"calc(100% - \" + spacing.baseUnit * 2 + \"px)\",\n overflow: 'hidden',\n position: 'absolute',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n top: '50%',\n transform: 'translateY(-50%)'\n };\n};\n\nvar SingleValue = function SingleValue(props) {\n var children = props.children,\n className = props.className,\n cx = props.cx,\n getStyles = props.getStyles,\n isDisabled = props.isDisabled,\n innerProps = props.innerProps;\n return jsx(\"div\", _extends$9({\n css: getStyles('singleValue', props),\n className: cx({\n 'single-value': true,\n 'single-value--is-disabled': isDisabled\n }, className)\n }, innerProps), children);\n};\n\nfunction _extends$a() {\n _extends$a = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends$a.apply(this, arguments);\n}\n\nvar components = {\n ClearIndicator: ClearIndicator,\n Control: Control,\n DropdownIndicator: DropdownIndicator,\n DownChevron: DownChevron,\n CrossIcon: CrossIcon,\n Group: Group,\n GroupHeading: GroupHeading,\n IndicatorsContainer: IndicatorsContainer,\n IndicatorSeparator: IndicatorSeparator,\n Input: Input,\n LoadingIndicator: LoadingIndicator,\n Menu: Menu,\n MenuList: MenuList,\n MenuPortal: MenuPortal,\n LoadingMessage: LoadingMessage,\n NoOptionsMessage: NoOptionsMessage,\n MultiValue: MultiValue,\n MultiValueContainer: MultiValueContainer,\n MultiValueLabel: MultiValueLabel,\n MultiValueRemove: MultiValueRemove,\n Option: Option,\n Placeholder: Placeholder,\n SelectContainer: SelectContainer,\n SingleValue: SingleValue,\n ValueContainer: ValueContainer\n};\n\nvar defaultComponents = function defaultComponents(props) {\n return _extends$a({}, components, props.components);\n};\n\nexport { MenuPlacer as M, containerCSS as a, css as b, clearIndicatorCSS as c, dropdownIndicatorCSS as d, groupHeadingCSS as e, indicatorSeparatorCSS as f, groupCSS as g, inputCSS as h, indicatorsContainerCSS as i, loadingMessageCSS as j, menuListCSS as k, loadingIndicatorCSS as l, menuCSS as m, menuPortalCSS as n, multiValueCSS as o, multiValueLabelCSS as p, multiValueRemoveCSS as q, noOptionsMessageCSS as r, optionCSS as s, placeholderCSS as t, css$1 as u, valueContainerCSS as v, defaultComponents as w, exportedEqual as x, components as y };","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n};\n\nvar _createClass = function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n}();\n\nvar _react = require('react');\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _propTypes = require('prop-types');\n\nvar _propTypes2 = _interopRequireDefault(_propTypes);\n\nfunction _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n}\n\nfunction _objectWithoutProperties(obj, keys) {\n var target = {};\n\n for (var i in obj) {\n if (keys.indexOf(i) >= 0) continue;\n if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;\n target[i] = obj[i];\n }\n\n return target;\n}\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (!self) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self;\n}\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass);\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;\n}\n\nvar sizerStyle = {\n position: 'absolute',\n top: 0,\n left: 0,\n visibility: 'hidden',\n height: 0,\n overflow: 'scroll',\n whiteSpace: 'pre'\n};\nvar INPUT_PROPS_BLACKLIST = ['extraWidth', 'injectStyles', 'inputClassName', 'inputRef', 'inputStyle', 'minWidth', 'onAutosize', 'placeholderIsMinWidth'];\n\nvar cleanInputProps = function cleanInputProps(inputProps) {\n INPUT_PROPS_BLACKLIST.forEach(function (field) {\n return delete inputProps[field];\n });\n return inputProps;\n};\n\nvar copyStyles = function copyStyles(styles, node) {\n node.style.fontSize = styles.fontSize;\n node.style.fontFamily = styles.fontFamily;\n node.style.fontWeight = styles.fontWeight;\n node.style.fontStyle = styles.fontStyle;\n node.style.letterSpacing = styles.letterSpacing;\n node.style.textTransform = styles.textTransform;\n};\n\nvar isIE = typeof window !== 'undefined' && window.navigator ? /MSIE |Trident\\/|Edge\\//.test(window.navigator.userAgent) : false;\n\nvar generateId = function generateId() {\n // we only need an auto-generated ID for stylesheet injection, which is only\n // used for IE. so if the browser is not IE, this should return undefined.\n return isIE ? '_' + Math.random().toString(36).substr(2, 12) : undefined;\n};\n\nvar AutosizeInput = function (_Component) {\n _inherits(AutosizeInput, _Component);\n\n function AutosizeInput(props) {\n _classCallCheck(this, AutosizeInput);\n\n var _this = _possibleConstructorReturn(this, (AutosizeInput.__proto__ || Object.getPrototypeOf(AutosizeInput)).call(this, props));\n\n _this.inputRef = function (el) {\n _this.input = el;\n\n if (typeof _this.props.inputRef === 'function') {\n _this.props.inputRef(el);\n }\n };\n\n _this.placeHolderSizerRef = function (el) {\n _this.placeHolderSizer = el;\n };\n\n _this.sizerRef = function (el) {\n _this.sizer = el;\n };\n\n _this.state = {\n inputWidth: props.minWidth,\n inputId: props.id || generateId()\n };\n return _this;\n }\n\n _createClass(AutosizeInput, [{\n key: 'componentDidMount',\n value: function componentDidMount() {\n this.mounted = true;\n this.copyInputStyles();\n this.updateInputWidth();\n }\n }, {\n key: 'UNSAFE_componentWillReceiveProps',\n value: function UNSAFE_componentWillReceiveProps(nextProps) {\n var id = nextProps.id;\n\n if (id !== this.props.id) {\n this.setState({\n inputId: id || generateId()\n });\n }\n }\n }, {\n key: 'componentDidUpdate',\n value: function componentDidUpdate(prevProps, prevState) {\n if (prevState.inputWidth !== this.state.inputWidth) {\n if (typeof this.props.onAutosize === 'function') {\n this.props.onAutosize(this.state.inputWidth);\n }\n }\n\n this.updateInputWidth();\n }\n }, {\n key: 'componentWillUnmount',\n value: function componentWillUnmount() {\n this.mounted = false;\n }\n }, {\n key: 'copyInputStyles',\n value: function copyInputStyles() {\n if (!this.mounted || !window.getComputedStyle) {\n return;\n }\n\n var inputStyles = this.input && window.getComputedStyle(this.input);\n\n if (!inputStyles) {\n return;\n }\n\n copyStyles(inputStyles, this.sizer);\n\n if (this.placeHolderSizer) {\n copyStyles(inputStyles, this.placeHolderSizer);\n }\n }\n }, {\n key: 'updateInputWidth',\n value: function updateInputWidth() {\n if (!this.mounted || !this.sizer || typeof this.sizer.scrollWidth === 'undefined') {\n return;\n }\n\n var newInputWidth = void 0;\n\n if (this.props.placeholder && (!this.props.value || this.props.value && this.props.placeholderIsMinWidth)) {\n newInputWidth = Math.max(this.sizer.scrollWidth, this.placeHolderSizer.scrollWidth) + 2;\n } else {\n newInputWidth = this.sizer.scrollWidth + 2;\n } // add extraWidth to the detected width. for number types, this defaults to 16 to allow for the stepper UI\n\n\n var extraWidth = this.props.type === 'number' && this.props.extraWidth === undefined ? 16 : parseInt(this.props.extraWidth) || 0;\n newInputWidth += extraWidth;\n\n if (newInputWidth < this.props.minWidth) {\n newInputWidth = this.props.minWidth;\n }\n\n if (newInputWidth !== this.state.inputWidth) {\n this.setState({\n inputWidth: newInputWidth\n });\n }\n }\n }, {\n key: 'getInput',\n value: function getInput() {\n return this.input;\n }\n }, {\n key: 'focus',\n value: function focus() {\n this.input.focus();\n }\n }, {\n key: 'blur',\n value: function blur() {\n this.input.blur();\n }\n }, {\n key: 'select',\n value: function select() {\n this.input.select();\n }\n }, {\n key: 'renderStyles',\n value: function renderStyles() {\n // this method injects styles to hide IE's clear indicator, which messes\n // with input size detection. the stylesheet is only injected when the\n // browser is IE, and can also be disabled by the `injectStyles` prop.\n var injectStyles = this.props.injectStyles;\n return isIE && injectStyles ? _react2.default.createElement('style', {\n dangerouslySetInnerHTML: {\n __html: 'input#' + this.state.inputId + '::-ms-clear {display: none;}'\n }\n }) : null;\n }\n }, {\n key: 'render',\n value: function render() {\n var sizerValue = [this.props.defaultValue, this.props.value, ''].reduce(function (previousValue, currentValue) {\n if (previousValue !== null && previousValue !== undefined) {\n return previousValue;\n }\n\n return currentValue;\n });\n\n var wrapperStyle = _extends({}, this.props.style);\n\n if (!wrapperStyle.display) wrapperStyle.display = 'inline-block';\n\n var inputStyle = _extends({\n boxSizing: 'content-box',\n width: this.state.inputWidth + 'px'\n }, this.props.inputStyle);\n\n var inputProps = _objectWithoutProperties(this.props, []);\n\n cleanInputProps(inputProps);\n inputProps.className = this.props.inputClassName;\n inputProps.id = this.state.inputId;\n inputProps.style = inputStyle;\n return _react2.default.createElement('div', {\n className: this.props.className,\n style: wrapperStyle\n }, this.renderStyles(), _react2.default.createElement('input', _extends({}, inputProps, {\n ref: this.inputRef\n })), _react2.default.createElement('div', {\n ref: this.sizerRef,\n style: sizerStyle\n }, sizerValue), this.props.placeholder ? _react2.default.createElement('div', {\n ref: this.placeHolderSizerRef,\n style: sizerStyle\n }, this.props.placeholder) : null);\n }\n }]);\n\n return AutosizeInput;\n}(_react.Component);\n\nAutosizeInput.propTypes = {\n className: _propTypes2.default.string,\n // className for the outer element\n defaultValue: _propTypes2.default.any,\n // default field value\n extraWidth: _propTypes2.default.oneOfType([// additional width for input element\n _propTypes2.default.number, _propTypes2.default.string]),\n id: _propTypes2.default.string,\n // id to use for the input, can be set for consistent snapshots\n injectStyles: _propTypes2.default.bool,\n // inject the custom stylesheet to hide clear UI, defaults to true\n inputClassName: _propTypes2.default.string,\n // className for the input element\n inputRef: _propTypes2.default.func,\n // ref callback for the input element\n inputStyle: _propTypes2.default.object,\n // css styles for the input element\n minWidth: _propTypes2.default.oneOfType([// minimum width for input element\n _propTypes2.default.number, _propTypes2.default.string]),\n onAutosize: _propTypes2.default.func,\n // onAutosize handler: function(newWidth) {}\n onChange: _propTypes2.default.func,\n // onChange handler: function(event) {}\n placeholder: _propTypes2.default.string,\n // placeholder text\n placeholderIsMinWidth: _propTypes2.default.bool,\n // don't collapse size to less than the placeholder\n style: _propTypes2.default.object,\n // css styles for the outer element\n value: _propTypes2.default.any // field value\n\n};\nAutosizeInput.defaultProps = {\n minWidth: 1,\n injectStyles: true\n};\nexports.default = AutosizeInput;","'use strict';\n\nexports.utils = require('./des/utils');\nexports.Cipher = require('./des/cipher');\nexports.DES = require('./des/des');\nexports.CBC = require('./des/cbc');\nexports.EDE = require('./des/ede');","const Sentry = require('@sentry/react');\nconst Tracing = require('@sentry/tracing');\n\nexports.onClientEntry = function(_, pluginParams) {\n if (pluginParams === undefined) {\n return;\n }\n\n pluginParams._metadata = pluginParams._metadata || {};\n pluginParams._metadata.sdk = {\n name: 'sentry.javascript.gatsby',\n packages: [\n {\n name: 'npm:@sentry/gatsby',\n version: Sentry.SDK_VERSION,\n },\n ],\n version: Sentry.SDK_VERSION,\n };\n\n const integrations = [...(pluginParams.integrations || [])];\n\n if (Tracing.hasTracingEnabled(pluginParams) && !integrations.some(ele => ele.name === 'BrowserTracing')) {\n integrations.push(new Tracing.Integrations.BrowserTracing(pluginParams.browserTracingOptions));\n }\n\n Tracing.addExtensionMethods();\n\n Sentry.init({\n autoSessionTracking: true,\n environment: process.env.NODE_ENV || 'development',\n // eslint-disable-next-line no-undef\n release: __SENTRY_RELEASE__,\n // eslint-disable-next-line no-undef\n dsn: __SENTRY_DSN__,\n ...pluginParams,\n integrations,\n });\n\n window.Sentry = Sentry;\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = utils.isStandardBrowserEnv() ? // Standard browser envs have full support of the APIs needed to test\n// whether the request URL is of the same origin as current location.\nfunction standardBrowserEnv() {\n var msie = /(msie|trident)/i.test(navigator.userAgent);\n var urlParsingNode = document.createElement('a');\n var originURL;\n /**\n * Parse a URL to discover it's components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n\n function resolveURL(url) {\n var href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href); // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: urlParsingNode.pathname.charAt(0) === '/' ? urlParsingNode.pathname : '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n\n return function isURLSameOrigin(requestURL) {\n var parsed = utils.isString(requestURL) ? resolveURL(requestURL) : requestURL;\n return parsed.protocol === originURL.protocol && parsed.host === originURL.host;\n };\n}() : // Non standard browser envs (web workers, react-native) lack needed support.\nfunction nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n}();","\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nexports.__esModule = true;\nexports.changeLocale = exports.navigate = exports.default = void 0;\n\nvar _extends2 = _interopRequireDefault(require(\"@babel/runtime/helpers/extends\"));\n\nvar _objectWithoutPropertiesLoose2 = _interopRequireDefault(require(\"@babel/runtime/helpers/objectWithoutPropertiesLoose\"));\n\nvar _react = _interopRequireDefault(require(\"react\"));\n\nvar _propTypes = _interopRequireDefault(require(\"prop-types\"));\n\nvar _gatsby = require(\"gatsby\");\n\nvar _intlContext = require(\"./intl-context\");\n\nvar Link = function Link(_ref) {\n var to = _ref.to,\n language = _ref.language,\n children = _ref.children,\n onClick = _ref.onClick,\n rest = (0, _objectWithoutPropertiesLoose2.default)(_ref, [\"to\", \"language\", \"children\", \"onClick\"]);\n return _react.default.createElement(_intlContext.IntlContextConsumer, null, function (intl) {\n var languageLink = language || intl.language;\n var link = intl.routed || language ? \"/\" + languageLink + to : \"\" + to;\n\n var handleClick = function handleClick(e) {\n if (language) {\n localStorage.setItem(\"gatsby-intl-language\", language);\n }\n\n if (onClick) {\n onClick(e);\n }\n };\n\n return _react.default.createElement(_gatsby.Link, (0, _extends2.default)({}, rest, {\n to: link,\n onClick: handleClick\n }), children);\n });\n};\n\nLink.propTypes = {\n children: _propTypes.default.node.isRequired,\n to: _propTypes.default.string,\n language: _propTypes.default.string\n};\nLink.defaultProps = {\n to: \"\"\n};\nvar _default = Link;\nexports.default = _default;\n\nvar navigate = function navigate(to, options) {\n if (typeof window === \"undefined\") {\n return;\n }\n\n var _window$___gatsbyIntl = window.___gatsbyIntl,\n language = _window$___gatsbyIntl.language,\n routed = _window$___gatsbyIntl.routed;\n var link = routed ? \"/\" + language + to : \"\" + to;\n (0, _gatsby.navigate)(link, options);\n};\n\nexports.navigate = navigate;\n\nvar changeLocale = function changeLocale(language, to) {\n if (typeof window === \"undefined\") {\n return;\n }\n\n var routed = window.___gatsbyIntl.routed;\n\n var removePrefix = function removePrefix(pathname) {\n var base = typeof __BASE_PATH__ !== \"undefined\" ? __BASE_PATH__ : __PATH_PREFIX__;\n\n if (base && pathname.indexOf(base) === 0) {\n pathname = pathname.slice(base.length);\n }\n\n return pathname;\n };\n\n var removeLocalePart = function removeLocalePart(pathname) {\n if (!routed) {\n return pathname;\n }\n\n var i = pathname.indexOf(\"/\", 1);\n return pathname.substring(i);\n };\n\n var pathname = to || removeLocalePart(removePrefix(window.location.pathname)); // TODO: check slash\n\n var link = \"/\" + language + pathname + window.location.search;\n localStorage.setItem(\"gatsby-intl-language\", language);\n (0, _gatsby.navigate)(link);\n};\n\nexports.changeLocale = changeLocale;","import addEventListener from './addEventListener';\nimport removeEventListener from './removeEventListener';\n\nfunction listen(node, eventName, handler, options) {\n addEventListener(node, eventName, handler, options);\n return function () {\n removeEventListener(node, eventName, handler, options);\n };\n}\n\nexport default listen;","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nimport { Amplify } from './Amplify';\nimport { Platform } from './Platform';\nexport { AmplifyClass } from './Amplify';\nexport { ClientDevice } from './ClientDevice';\nexport { ConsoleLogger, ConsoleLogger as Logger } from './Logger';\nexport * from './Errors';\nexport { Hub } from './Hub';\nexport { I18n } from './I18n';\nexport * from './JS';\nexport { Signer } from './Signer';\nexport * from './Parser';\nexport { FacebookOAuth, GoogleOAuth } from './OAuthHelper';\nexport * from './RNComponents';\nexport { Credentials, CredentialsClass } from './Credentials';\nexport { ServiceWorker } from './ServiceWorker';\nexport { StorageHelper, MemoryStorage } from './StorageHelper';\nexport { UniversalStorage } from './UniversalStorage';\nexport { Platform, getAmplifyUserAgent } from './Platform';\nexport * from './constants';\nexport var Constants = {\n userAgent: Platform.userAgent\n};\nexport * from './constants';\nexport * from './Util';\nexport { Amplify };\n/**\n * @deprecated use named import\n */\n\nexport default Amplify;","/*! https://mths.be/punycode v1.4.1 by @mathias */\n;\n\n(function (root) {\n /** Detect free variables */\n var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n var freeModule = typeof module == 'object' && module && !module.nodeType && module;\n var freeGlobal = typeof global == 'object' && global;\n\n if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal) {\n root = freeGlobal;\n }\n /**\n * The `punycode` object.\n * @name punycode\n * @type Object\n */\n\n\n var punycode,\n\n /** Highest positive signed 32-bit float value */\n maxInt = 2147483647,\n // aka. 0x7FFFFFFF or 2^31-1\n\n /** Bootstring parameters */\n base = 36,\n tMin = 1,\n tMax = 26,\n skew = 38,\n damp = 700,\n initialBias = 72,\n initialN = 128,\n // 0x80\n delimiter = '-',\n // '\\x2D'\n\n /** Regular expressions */\n regexPunycode = /^xn--/,\n regexNonASCII = /[^\\x20-\\x7E]/,\n // unprintable ASCII chars + non-ASCII chars\n regexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g,\n // RFC 3490 separators\n\n /** Error messages */\n errors = {\n 'overflow': 'Overflow: input needs wider integers to process',\n 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n 'invalid-input': 'Invalid input'\n },\n\n /** Convenience shortcuts */\n baseMinusTMin = base - tMin,\n floor = Math.floor,\n stringFromCharCode = String.fromCharCode,\n\n /** Temporary variable */\n key;\n /*--------------------------------------------------------------------------*/\n\n /**\n * A generic error utility function.\n * @private\n * @param {String} type The error type.\n * @returns {Error} Throws a `RangeError` with the applicable error message.\n */\n\n function error(type) {\n throw new RangeError(errors[type]);\n }\n /**\n * A generic `Array#map` utility function.\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} callback The function that gets called for every array\n * item.\n * @returns {Array} A new array of values returned by the callback function.\n */\n\n\n function map(array, fn) {\n var length = array.length;\n var result = [];\n\n while (length--) {\n result[length] = fn(array[length]);\n }\n\n return result;\n }\n /**\n * A simple `Array#map`-like wrapper to work with domain name strings or email\n * addresses.\n * @private\n * @param {String} domain The domain name or email address.\n * @param {Function} callback The function that gets called for every\n * character.\n * @returns {Array} A new string of characters returned by the callback\n * function.\n */\n\n\n function mapDomain(string, fn) {\n var parts = string.split('@');\n var result = '';\n\n if (parts.length > 1) {\n // In email addresses, only the domain name should be punycoded. Leave\n // the local part (i.e. everything up to `@`) intact.\n result = parts[0] + '@';\n string = parts[1];\n } // Avoid `split(regex)` for IE8 compatibility. See #17.\n\n\n string = string.replace(regexSeparators, '\\x2E');\n var labels = string.split('.');\n var encoded = map(labels, fn).join('.');\n return result + encoded;\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 * @see `punycode.ucs2.encode`\n * @see \n * @memberOf punycode.ucs2\n * @name decode\n * @param {String} string The Unicode input string (UCS-2).\n * @returns {Array} The new array of code points.\n */\n\n\n function ucs2decode(string) {\n var output = [],\n counter = 0,\n length = string.length,\n value,\n extra;\n\n while (counter < length) {\n value = string.charCodeAt(counter++);\n\n if (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n // high surrogate, and there is a next character\n extra = string.charCodeAt(counter++);\n\n if ((extra & 0xFC00) == 0xDC00) {\n // low surrogate\n output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n } else {\n // unmatched surrogate; only append this code unit, in case the next\n // code unit is the high surrogate of a surrogate pair\n output.push(value);\n counter--;\n }\n } else {\n output.push(value);\n }\n }\n\n return output;\n }\n /**\n * Creates a string based on an array of numeric code points.\n * @see `punycode.ucs2.decode`\n * @memberOf punycode.ucs2\n * @name encode\n * @param {Array} codePoints The array of numeric code points.\n * @returns {String} The new Unicode string (UCS-2).\n */\n\n\n function ucs2encode(array) {\n return map(array, function (value) {\n var output = '';\n\n if (value > 0xFFFF) {\n value -= 0x10000;\n output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n value = 0xDC00 | value & 0x3FF;\n }\n\n output += stringFromCharCode(value);\n return output;\n }).join('');\n }\n /**\n * Converts a basic code point into a digit/integer.\n * @see `digitToBasic()`\n * @private\n * @param {Number} codePoint The basic numeric code point value.\n * @returns {Number} The numeric value of a basic code point (for use in\n * representing integers) in the range `0` to `base - 1`, or `base` if\n * the code point does not represent a value.\n */\n\n\n function basicToDigit(codePoint) {\n if (codePoint - 48 < 10) {\n return codePoint - 22;\n }\n\n if (codePoint - 65 < 26) {\n return codePoint - 65;\n }\n\n if (codePoint - 97 < 26) {\n return codePoint - 97;\n }\n\n return base;\n }\n /**\n * Converts a digit/integer into a basic code point.\n * @see `basicToDigit()`\n * @private\n * @param {Number} digit The numeric value of a basic code point.\n * @returns {Number} The basic code point whose value (when used for\n * representing integers) is `digit`, which needs to be in the range\n * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n * used; else, the lowercase form is used. The behavior is undefined\n * if `flag` is non-zero and `digit` has no uppercase form.\n */\n\n\n function digitToBasic(digit, flag) {\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) - ((flag != 0) << 5);\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 * @private\n */\n\n\n function adapt(delta, numPoints, firstTime) {\n var k = 0;\n delta = firstTime ? floor(delta / damp) : delta >> 1;\n delta += floor(delta / numPoints);\n\n for (; delta > baseMinusTMin * tMax >> 1; k += base) {\n delta = floor(delta / baseMinusTMin);\n }\n\n return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n }\n /**\n * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n * symbols.\n * @memberOf punycode\n * @param {String} input The Punycode string of ASCII-only symbols.\n * @returns {String} The resulting string of Unicode symbols.\n */\n\n\n function decode(input) {\n // Don't use UCS-2\n var output = [],\n inputLength = input.length,\n out,\n i = 0,\n n = initialN,\n bias = initialBias,\n basic,\n j,\n index,\n oldi,\n w,\n k,\n digit,\n t,\n\n /** Cached calculation results */\n baseMinusT; // Handle the basic code points: let `basic` be the number of input code\n // points before the last delimiter, or `0` if there is none, then copy\n // the first basic code points to the output.\n\n basic = input.lastIndexOf(delimiter);\n\n if (basic < 0) {\n basic = 0;\n }\n\n for (j = 0; j < basic; ++j) {\n // if it's not a basic code point\n if (input.charCodeAt(j) >= 0x80) {\n error('not-basic');\n }\n\n output.push(input.charCodeAt(j));\n } // Main decoding loop: start just after the last delimiter if any basic code\n // points were copied; start at the beginning otherwise.\n\n\n for (index = basic > 0 ? basic + 1 : 0; index < inputLength;) {\n // `index` is the index of the next character to be consumed.\n // Decode a generalized variable-length integer into `delta`,\n // which gets added to `i`. The overflow checking is easier\n // if we increase `i` as we go, then subtract off its starting\n // value at the end to obtain `delta`.\n for (oldi = i, w = 1, k = base;; k += base) {\n if (index >= inputLength) {\n error('invalid-input');\n }\n\n digit = basicToDigit(input.charCodeAt(index++));\n\n if (digit >= base || digit > floor((maxInt - i) / w)) {\n error('overflow');\n }\n\n i += digit * w;\n t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;\n\n if (digit < t) {\n break;\n }\n\n baseMinusT = base - t;\n\n if (w > floor(maxInt / baseMinusT)) {\n error('overflow');\n }\n\n w *= baseMinusT;\n }\n\n out = output.length + 1;\n bias = adapt(i - oldi, out, oldi == 0); // `i` was supposed to wrap around from `out` to `0`,\n // incrementing `n` each time, so we'll fix that now:\n\n if (floor(i / out) > maxInt - n) {\n error('overflow');\n }\n\n n += floor(i / out);\n i %= out; // Insert `n` at position `i` of the output\n\n output.splice(i++, 0, n);\n }\n\n return ucs2encode(output);\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 * @memberOf punycode\n * @param {String} input The string of Unicode symbols.\n * @returns {String} The resulting Punycode string of ASCII-only symbols.\n */\n\n\n function encode(input) {\n var n,\n delta,\n handledCPCount,\n basicLength,\n bias,\n j,\n m,\n q,\n k,\n t,\n currentValue,\n output = [],\n\n /** `inputLength` will hold the number of code points in `input`. */\n inputLength,\n\n /** Cached calculation results */\n handledCPCountPlusOne,\n baseMinusT,\n qMinusT; // Convert the input in UCS-2 to Unicode\n\n input = ucs2decode(input); // Cache the length\n\n inputLength = input.length; // Initialize the state\n\n n = initialN;\n delta = 0;\n bias = initialBias; // Handle the basic code points\n\n for (j = 0; j < inputLength; ++j) {\n currentValue = input[j];\n\n if (currentValue < 0x80) {\n output.push(stringFromCharCode(currentValue));\n }\n }\n\n handledCPCount = basicLength = output.length; // `handledCPCount` is the number of code points that have been handled;\n // `basicLength` is the number of basic code points.\n // Finish the basic string - if it is not empty - with a delimiter\n\n if (basicLength) {\n output.push(delimiter);\n } // Main encoding loop:\n\n\n while (handledCPCount < inputLength) {\n // All non-basic code points < n have been handled already. Find the next\n // larger one:\n for (m = maxInt, j = 0; j < inputLength; ++j) {\n currentValue = input[j];\n\n if (currentValue >= n && currentValue < m) {\n m = currentValue;\n }\n } // Increase `delta` enough to advance the decoder's state to ,\n // but guard against overflow\n\n\n handledCPCountPlusOne = handledCPCount + 1;\n\n if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n error('overflow');\n }\n\n delta += (m - n) * handledCPCountPlusOne;\n n = m;\n\n for (j = 0; j < inputLength; ++j) {\n currentValue = input[j];\n\n if (currentValue < n && ++delta > maxInt) {\n error('overflow');\n }\n\n if (currentValue == n) {\n // Represent delta as a generalized variable-length integer\n for (q = delta, k = base;; k += base) {\n t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;\n\n if (q < t) {\n break;\n }\n\n qMinusT = q - t;\n baseMinusT = base - t;\n output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));\n q = floor(qMinusT / baseMinusT);\n }\n\n output.push(stringFromCharCode(digitToBasic(q, 0)));\n bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n delta = 0;\n ++handledCPCount;\n }\n }\n\n ++delta;\n ++n;\n }\n\n return output.join('');\n }\n /**\n * Converts a Punycode string representing a domain name or an email address\n * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n * it doesn't matter if you call it on a string that has already been\n * converted to Unicode.\n * @memberOf punycode\n * @param {String} input The Punycoded domain name or email address to\n * convert to Unicode.\n * @returns {String} The Unicode representation of the given Punycode\n * string.\n */\n\n\n function toUnicode(input) {\n return mapDomain(input, function (string) {\n return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;\n });\n }\n /**\n * Converts a Unicode string representing a domain name or an email address to\n * Punycode. Only the non-ASCII parts of the domain name will be converted,\n * i.e. it doesn't matter if you call it with a domain that's already in\n * ASCII.\n * @memberOf punycode\n * @param {String} input The domain name or email address to convert, as a\n * Unicode string.\n * @returns {String} The Punycode representation of the given domain name or\n * email address.\n */\n\n\n function toASCII(input) {\n return mapDomain(input, function (string) {\n return regexNonASCII.test(string) ? 'xn--' + encode(string) : string;\n });\n }\n /*--------------------------------------------------------------------------*/\n\n /** Define the public API */\n\n\n punycode = {\n /**\n * A string representing the current Punycode.js version number.\n * @memberOf punycode\n * @type String\n */\n 'version': '1.4.1',\n\n /**\n * An object of methods to convert from JavaScript's internal character\n * representation (UCS-2) to Unicode code points, and back.\n * @see \n * @memberOf punycode\n * @type Object\n */\n 'ucs2': {\n 'decode': ucs2decode,\n 'encode': ucs2encode\n },\n 'decode': decode,\n 'encode': encode,\n 'toASCII': toASCII,\n 'toUnicode': toUnicode\n };\n /** Expose `punycode` */\n // Some AMD build optimizers, like r.js, check for specific condition patterns\n // like the following:\n\n if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {\n define('punycode', function () {\n return punycode;\n });\n } else if (freeExports && freeModule) {\n if (module.exports == freeExports) {\n // in Node.js, io.js, or RingoJS v0.8.0+\n freeModule.exports = punycode;\n } else {\n // in Narwhal or RingoJS v0.7.0-\n for (key in punycode) {\n punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);\n }\n }\n } else {\n // in Rhino or a web browser\n root.punycode = punycode;\n }\n})(this);","/**\n * Implement Gatsby's Browser APIs in this file.\n *\n * See: https://www.gatsbyjs.org/docs/browser-apis/\n */\n\nimport wrapWithProvider from \"./src/store/wrapWithProvider\"\n\nexport const wrapRootElement = wrapWithProvider\n","import React from \"react\"\nimport { StoreProvider } from \"easy-peasy\"\nimport store from \"./index\"\n\nconst wrapWithProvider = ({ element }) => (\n {element}\n)\n\nexport default wrapWithProvider\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n'use strict';\n\nmodule.exports = Writable;\n/* */\n\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n this.next = null;\n} // It seems a linked list but it is not\n// there will be only 2 of these for each stream\n\n\nfunction CorkedRequest(state) {\n var _this = this;\n\n this.next = null;\n this.entry = null;\n\n this.finish = function () {\n onCorkedFinish(_this, state);\n };\n}\n/* */\n\n/**/\n\n\nvar Duplex;\n/**/\n\nWritable.WritableState = WritableState;\n/**/\n\nvar internalUtil = {\n deprecate: require('util-deprecate')\n};\n/**/\n\n/**/\n\nvar Stream = require('./internal/streams/stream');\n/**/\n\n\nvar Buffer = require('buffer').Buffer;\n\nvar OurUint8Array = global.Uint8Array || function () {};\n\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\n\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n\nvar destroyImpl = require('./internal/streams/destroy');\n\nvar _require = require('./internal/streams/state'),\n getHighWaterMark = _require.getHighWaterMark;\n\nvar _require$codes = require('../errors').codes,\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,\n ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE,\n ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED,\n ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES,\n ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,\n ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;\n\nvar errorOrDestroy = destroyImpl.errorOrDestroy;\n\nrequire('inherits')(Writable, Stream);\n\nfunction nop() {}\n\nfunction WritableState(options, stream, isDuplex) {\n Duplex = Duplex || require('./_stream_duplex');\n options = options || {}; // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream,\n // e.g. options.readableObjectMode vs. options.writableObjectMode, etc.\n\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n\n this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); // if _final has been called\n\n this.finalCalled = false; // drain event flag.\n\n this.needDrain = false; // at the start of calling end()\n\n this.ending = false; // when end() has been called, and returned\n\n this.ended = false; // when 'finish' is emitted\n\n this.finished = false; // has it been destroyed\n\n this.destroyed = false; // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode; // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n\n this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n\n this.length = 0; // a flag to see when we're in the middle of a write.\n\n this.writing = false; // when true all writes will be buffered until .uncork() call\n\n this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n\n this.sync = true; // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n\n this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb)\n\n this.onwrite = function (er) {\n onwrite(stream, er);\n }; // the callback that the user supplies to write(chunk,encoding,cb)\n\n\n this.writecb = null; // the amount that is being written when _write is called.\n\n this.writelen = 0;\n this.bufferedRequest = null;\n this.lastBufferedRequest = null; // number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted\n\n this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams\n\n this.prefinished = false; // True if the error was already emitted and should not be thrown again\n\n this.errorEmitted = false; // Should close be emitted on destroy. Defaults to true.\n\n this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'finish' (and potentially 'end')\n\n this.autoDestroy = !!options.autoDestroy; // count buffered requests\n\n this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always\n // one allocated and free to use, and we maintain at most two\n\n this.corkedRequestsFree = new CorkedRequest(this);\n}\n\nWritableState.prototype.getBuffer = function getBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n\n while (current) {\n out.push(current);\n current = current.next;\n }\n\n return out;\n};\n\n(function () {\n try {\n Object.defineProperty(WritableState.prototype, 'buffer', {\n get: internalUtil.deprecate(function writableStateBufferGetter() {\n return this.getBuffer();\n }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')\n });\n } catch (_) {}\n})(); // Test _writableState for inheritance to account for Duplex streams,\n// whose prototype chain only points to Readable.\n\n\nvar realHasInstance;\n\nif (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {\n realHasInstance = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(Writable, Symbol.hasInstance, {\n value: function value(object) {\n if (realHasInstance.call(this, object)) return true;\n if (this !== Writable) return false;\n return object && object._writableState instanceof WritableState;\n }\n });\n} else {\n realHasInstance = function realHasInstance(object) {\n return object instanceof this;\n };\n}\n\nfunction Writable(options) {\n Duplex = Duplex || require('./_stream_duplex'); // Writable ctor is applied to Duplexes, too.\n // `realHasInstance` is necessary because using plain `instanceof`\n // would return false, as no `_writableState` property is attached.\n // Trying to use the custom `instanceof` for Writable here will also break the\n // Node.js LazyTransform implementation, which has a non-trivial getter for\n // `_writableState` that would lead to infinite recursion.\n // Checking for a Stream.Duplex instance is faster here instead of inside\n // the WritableState constructor, at least with V8 6.5\n\n var isDuplex = this instanceof Duplex;\n if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);\n this._writableState = new WritableState(options, this, isDuplex); // legacy.\n\n this.writable = true;\n\n if (options) {\n if (typeof options.write === 'function') this._write = options.write;\n if (typeof options.writev === 'function') this._writev = options.writev;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n if (typeof options.final === 'function') this._final = options.final;\n }\n\n Stream.call(this);\n} // Otherwise people can pipe Writable streams, which is just wrong.\n\n\nWritable.prototype.pipe = function () {\n errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());\n};\n\nfunction writeAfterEnd(stream, cb) {\n var er = new ERR_STREAM_WRITE_AFTER_END(); // TODO: defer error events consistently everywhere, not just the cb\n\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n} // Checks that a user-supplied chunk is valid, especially for the particular\n// mode the stream is in. Currently this means that `null` is never accepted\n// and undefined/non-string values are only allowed in object mode.\n\n\nfunction validChunk(stream, state, chunk, cb) {\n var er;\n\n if (chunk === null) {\n er = new ERR_STREAM_NULL_VALUES();\n } else if (typeof chunk !== 'string' && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk);\n }\n\n if (er) {\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n return false;\n }\n\n return true;\n}\n\nWritable.prototype.write = function (chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n\n var isBuf = !state.objectMode && _isUint8Array(chunk);\n\n if (isBuf && !Buffer.isBuffer(chunk)) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;\n if (typeof cb !== 'function') cb = nop;\n if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);\n }\n return ret;\n};\n\nWritable.prototype.cork = function () {\n this._writableState.corked++;\n};\n\nWritable.prototype.uncork = function () {\n var state = this._writableState;\n\n if (state.corked) {\n state.corked--;\n if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);\n }\n};\n\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n // node::ParseEncoding() requires lower case.\n if (typeof encoding === 'string') encoding = encoding.toLowerCase();\n if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding);\n this._writableState.defaultEncoding = encoding;\n return this;\n};\n\nObject.defineProperty(Writable.prototype, 'writableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n});\n\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding);\n }\n\n return chunk;\n}\n\nObject.defineProperty(Writable.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n}); // if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\n\nfunction writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {\n if (!isBuf) {\n var newChunk = decodeChunk(state, chunk, encoding);\n\n if (chunk !== newChunk) {\n isBuf = true;\n encoding = 'buffer';\n chunk = newChunk;\n }\n }\n\n var len = state.objectMode ? 1 : chunk.length;\n state.length += len;\n var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false.\n\n if (!ret) state.needDrain = true;\n\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = {\n chunk: chunk,\n encoding: encoding,\n isBuf: isBuf,\n callback: cb,\n next: null\n };\n\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n\n return ret;\n}\n\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\n\nfunction onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n\n if (sync) {\n // defer the callback if we are being called synchronously\n // to avoid piling up things on the stack\n process.nextTick(cb, er); // this can emit finish, and it will always happen\n // after error\n\n process.nextTick(finishMaybe, stream, state);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n } else {\n // the caller expect this to happen before if\n // it is async\n cb(er);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er); // this can emit finish, but finish must\n // always follow error\n\n finishMaybe(stream, state);\n }\n}\n\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\n\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK();\n onwriteStateUpdate(state);\n if (er) onwriteError(stream, state, sync, er, cb);else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(state) || stream.destroyed;\n\n if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n\n if (sync) {\n process.nextTick(afterWrite, stream, state, finished, cb);\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\n\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished) onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n} // Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\n\n\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it\n\n\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n\n if (stream._writev && entry && entry.next) {\n // Fast case, write everything using _writev()\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n var count = 0;\n var allBuffers = true;\n\n while (entry) {\n buffer[count] = entry;\n if (!entry.isBuf) allBuffers = false;\n entry = entry.next;\n count += 1;\n }\n\n buffer.allBuffers = allBuffers;\n doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time\n // as the hot path ends with doWrite\n\n state.pendingcb++;\n state.lastBufferedRequest = null;\n\n if (holder.next) {\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n state.corkedRequestsFree = new CorkedRequest(state);\n }\n\n state.bufferedRequestCount = 0;\n } else {\n // Slow case, write chunks one-by-one\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n\n if (state.writing) {\n break;\n }\n }\n\n if (entry === null) state.lastBufferedRequest = null;\n }\n\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n}\n\nWritable.prototype._write = function (chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()'));\n};\n\nWritable.prototype._writev = null;\n\nWritable.prototype.end = function (chunk, encoding, cb) {\n var state = this._writableState;\n\n if (typeof chunk === 'function') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks\n\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n } // ignore unnecessary end() calls.\n\n\n if (!state.ending) endWritable(this, state, cb);\n return this;\n};\n\nObject.defineProperty(Writable.prototype, 'writableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n});\n\nfunction needFinish(state) {\n return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n}\n\nfunction callFinal(stream, state) {\n stream._final(function (err) {\n state.pendingcb--;\n\n if (err) {\n errorOrDestroy(stream, err);\n }\n\n state.prefinished = true;\n stream.emit('prefinish');\n finishMaybe(stream, state);\n });\n}\n\nfunction prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === 'function' && !state.destroyed) {\n state.pendingcb++;\n state.finalCalled = true;\n process.nextTick(callFinal, stream, state);\n } else {\n state.prefinished = true;\n stream.emit('prefinish');\n }\n }\n}\n\nfunction finishMaybe(stream, state) {\n var need = needFinish(state);\n\n if (need) {\n prefinish(stream, state);\n\n if (state.pendingcb === 0) {\n state.finished = true;\n stream.emit('finish');\n\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the readable side is ready for autoDestroy as well\n var rState = stream._readableState;\n\n if (!rState || rState.autoDestroy && rState.endEmitted) {\n stream.destroy();\n }\n }\n }\n }\n\n return need;\n}\n\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n\n if (cb) {\n if (state.finished) process.nextTick(cb);else stream.once('finish', cb);\n }\n\n state.ended = true;\n stream.writable = false;\n}\n\nfunction onCorkedFinish(corkReq, state, err) {\n var entry = corkReq.entry;\n corkReq.entry = null;\n\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n } // reuse the free corkReq.\n\n\n state.corkedRequestsFree.next = corkReq;\n}\n\nObject.defineProperty(Writable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._writableState === undefined) {\n return false;\n }\n\n return this._writableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._writableState) {\n return;\n } // backward compatibility, the user is explicitly\n // managing destroyed\n\n\n this._writableState.destroyed = value;\n }\n});\nWritable.prototype.destroy = destroyImpl.destroy;\nWritable.prototype._undestroy = destroyImpl.undestroy;\n\nWritable.prototype._destroy = function (err, cb) {\n cb(err);\n};","'use strict';\n\nvar Cancel = require('./Cancel');\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @class\n * @param {Function} executor The executor function.\n */\n\n\nfunction CancelToken(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n var resolvePromise;\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n var token = this;\n executor(function cancel(message) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new Cancel(message);\n resolvePromise(token.reason);\n });\n}\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\n\n\nCancelToken.prototype.throwIfRequested = function throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n};\n/**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\n\n\nCancelToken.source = function source() {\n var cancel;\n var token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token: token,\n cancel: cancel\n };\n};\n\nmodule.exports = CancelToken;","'use strict';\n\nvar inherits = require('inherits');\n\nvar Legacy = require('./legacy');\n\nvar Base = require('cipher-base');\n\nvar Buffer = require('safe-buffer').Buffer;\n\nvar md5 = require('create-hash/md5');\n\nvar RIPEMD160 = require('ripemd160');\n\nvar sha = require('sha.js');\n\nvar ZEROS = Buffer.alloc(128);\n\nfunction Hmac(alg, key) {\n Base.call(this, 'digest');\n\n if (typeof key === 'string') {\n key = Buffer.from(key);\n }\n\n var blocksize = alg === 'sha512' || alg === 'sha384' ? 128 : 64;\n this._alg = alg;\n this._key = key;\n\n if (key.length > blocksize) {\n var hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg);\n key = hash.update(key).digest();\n } else if (key.length < blocksize) {\n key = Buffer.concat([key, ZEROS], blocksize);\n }\n\n var ipad = this._ipad = Buffer.allocUnsafe(blocksize);\n var opad = this._opad = Buffer.allocUnsafe(blocksize);\n\n for (var i = 0; i < blocksize; i++) {\n ipad[i] = key[i] ^ 0x36;\n opad[i] = key[i] ^ 0x5C;\n }\n\n this._hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg);\n\n this._hash.update(ipad);\n}\n\ninherits(Hmac, Base);\n\nHmac.prototype._update = function (data) {\n this._hash.update(data);\n};\n\nHmac.prototype._final = function () {\n var h = this._hash.digest();\n\n var hash = this._alg === 'rmd160' ? new RIPEMD160() : sha(this._alg);\n return hash.update(this._opad).update(h).digest();\n};\n\nmodule.exports = function createHmac(alg, key) {\n alg = alg.toLowerCase();\n\n if (alg === 'rmd160' || alg === 'ripemd160') {\n return new Hmac('rmd160', key);\n }\n\n if (alg === 'md5') {\n return new Legacy(md5, key);\n }\n\n return new Hmac(alg, key);\n};","/*\n * Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nimport { API } from './API';\nexport { API, APIClass } from './API';\nexport { graphqlOperation, GRAPHQL_AUTH_MODE } from '@aws-amplify/api-graphql';\n/*\n * @deprecated use named import\n */\n\nexport default API;","'use strict';\n\nvar assert = require('minimalistic-assert');\n\nvar inherits = require('inherits');\n\nvar Cipher = require('./cipher');\n\nvar DES = require('./des');\n\nfunction EDEState(type, key) {\n assert.equal(key.length, 24, 'Invalid key length');\n var k1 = key.slice(0, 8);\n var k2 = key.slice(8, 16);\n var k3 = key.slice(16, 24);\n\n if (type === 'encrypt') {\n this.ciphers = [DES.create({\n type: 'encrypt',\n key: k1\n }), DES.create({\n type: 'decrypt',\n key: k2\n }), DES.create({\n type: 'encrypt',\n key: k3\n })];\n } else {\n this.ciphers = [DES.create({\n type: 'decrypt',\n key: k3\n }), DES.create({\n type: 'encrypt',\n key: k2\n }), DES.create({\n type: 'decrypt',\n key: k1\n })];\n }\n}\n\nfunction EDE(options) {\n Cipher.call(this, options);\n var state = new EDEState(this.type, this.options.key);\n this._edeState = state;\n}\n\ninherits(EDE, Cipher);\nmodule.exports = EDE;\n\nEDE.create = function create(options) {\n return new EDE(options);\n};\n\nEDE.prototype._update = function _update(inp, inOff, out, outOff) {\n var state = this._edeState;\n\n state.ciphers[0]._update(inp, inOff, out, outOff);\n\n state.ciphers[1]._update(out, outOff, out, outOff);\n\n state.ciphers[2]._update(out, outOff, out, outOff);\n};\n\nEDE.prototype._pad = DES.prototype._pad;\nEDE.prototype._unpad = DES.prototype._unpad;","'use strict';\n\nexports.byteLength = byteLength;\nexports.toByteArray = toByteArray;\nexports.fromByteArray = fromByteArray;\nvar lookup = [];\nvar revLookup = [];\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i];\n revLookup[code.charCodeAt(i)] = i;\n} // Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\n\n\nrevLookup['-'.charCodeAt(0)] = 62;\nrevLookup['_'.charCodeAt(0)] = 63;\n\nfunction getLens(b64) {\n var len = b64.length;\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4');\n } // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n\n\n var validLen = b64.indexOf('=');\n if (validLen === -1) validLen = len;\n var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4;\n return [validLen, placeHoldersLen];\n} // base64 is 4/3 + up to two characters of the original data\n\n\nfunction byteLength(b64) {\n var lens = getLens(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;\n}\n\nfunction _byteLength(b64, validLen, placeHoldersLen) {\n return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;\n}\n\nfunction toByteArray(b64) {\n var tmp;\n var lens = getLens(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));\n var curByte = 0; // if there are placeholders, only get up to the last complete 4 chars\n\n var len = placeHoldersLen > 0 ? validLen - 4 : validLen;\n var i;\n\n for (i = 0; i < len; i += 4) {\n tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];\n arr[curByte++] = tmp >> 16 & 0xFF;\n arr[curByte++] = tmp >> 8 & 0xFF;\n arr[curByte++] = tmp & 0xFF;\n }\n\n if (placeHoldersLen === 2) {\n tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;\n arr[curByte++] = tmp & 0xFF;\n }\n\n if (placeHoldersLen === 1) {\n tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;\n arr[curByte++] = tmp >> 8 & 0xFF;\n arr[curByte++] = tmp & 0xFF;\n }\n\n return arr;\n}\n\nfunction tripletToBase64(num) {\n return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F];\n}\n\nfunction encodeChunk(uint8, start, end) {\n var tmp;\n var output = [];\n\n for (var i = start; i < end; i += 3) {\n tmp = (uint8[i] << 16 & 0xFF0000) + (uint8[i + 1] << 8 & 0xFF00) + (uint8[i + 2] & 0xFF);\n output.push(tripletToBase64(tmp));\n }\n\n return output.join('');\n}\n\nfunction fromByteArray(uint8) {\n var tmp;\n var len = uint8.length;\n var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes\n\n var parts = [];\n var maxChunkLength = 16383; // must be multiple of 3\n // go through the array every three bytes, we'll deal with trailing stuff later\n\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength));\n } // pad the end with zeros, but make sure to not forget the extra bytes\n\n\n if (extraBytes === 1) {\n tmp = uint8[len - 1];\n parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 0x3F] + '==');\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1];\n parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 0x3F] + lookup[tmp << 2 & 0x3F] + '=');\n }\n\n return parts.join('');\n}","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n\n/* eslint-disable no-proto */\n'use strict';\n\nvar base64 = require('base64-js');\n\nvar ieee754 = require('ieee754');\n\nvar isArray = require('isarray');\n\nexports.Buffer = Buffer;\nexports.SlowBuffer = SlowBuffer;\nexports.INSPECT_MAX_BYTES = 50;\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\n\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined ? global.TYPED_ARRAY_SUPPORT : typedArraySupport();\n/*\n * Export kMaxLength after typed array support is determined.\n */\n\nexports.kMaxLength = kMaxLength();\n\nfunction typedArraySupport() {\n try {\n var arr = new Uint8Array(1);\n arr.__proto__ = {\n __proto__: Uint8Array.prototype,\n foo: function foo() {\n return 42;\n }\n };\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0; // ie10 has broken `subarray`\n } catch (e) {\n return false;\n }\n}\n\nfunction kMaxLength() {\n return Buffer.TYPED_ARRAY_SUPPORT ? 0x7fffffff : 0x3fffffff;\n}\n\nfunction createBuffer(that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length');\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length);\n that.__proto__ = Buffer.prototype;\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length);\n }\n\n that.length = length;\n }\n\n return that;\n}\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\n\nfunction Buffer(arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length);\n } // Common case.\n\n\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error('If encoding is specified then the first argument must be a string');\n }\n\n return allocUnsafe(this, arg);\n }\n\n return from(this, arg, encodingOrOffset, length);\n}\n\nBuffer.poolSize = 8192; // not used by this implementation\n// TODO: Legacy, not needed anymore. Remove in next major version.\n\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype;\n return arr;\n};\n\nfunction from(that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number');\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length);\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset);\n }\n\n return fromObject(that, value);\n}\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\n\n\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length);\n};\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype;\n Buffer.__proto__ = Uint8Array;\n\n if (typeof Symbol !== 'undefined' && Symbol.species && Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n });\n }\n}\n\nfunction assertSize(size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number');\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative');\n }\n}\n\nfunction alloc(that, size, fill, encoding) {\n assertSize(size);\n\n if (size <= 0) {\n return createBuffer(that, size);\n }\n\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string' ? createBuffer(that, size).fill(fill, encoding) : createBuffer(that, size).fill(fill);\n }\n\n return createBuffer(that, size);\n}\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\n\n\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding);\n};\n\nfunction allocUnsafe(that, size) {\n assertSize(size);\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0);\n\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0;\n }\n }\n\n return that;\n}\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\n\n\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size);\n};\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\n\n\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size);\n};\n\nfunction fromString(that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8';\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding');\n }\n\n var length = byteLength(string, encoding) | 0;\n that = createBuffer(that, length);\n var actual = that.write(string, encoding);\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual);\n }\n\n return that;\n}\n\nfunction fromArrayLike(that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0;\n that = createBuffer(that, length);\n\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255;\n }\n\n return that;\n}\n\nfunction fromArrayBuffer(that, array, byteOffset, length) {\n array.byteLength; // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds');\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds');\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array);\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset);\n } else {\n array = new Uint8Array(array, byteOffset, length);\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array;\n that.__proto__ = Buffer.prototype;\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array);\n }\n\n return that;\n}\n\nfunction fromObject(that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0;\n that = createBuffer(that, len);\n\n if (that.length === 0) {\n return that;\n }\n\n obj.copy(that, 0, 0, len);\n return that;\n }\n\n if (obj) {\n if (typeof ArrayBuffer !== 'undefined' && obj.buffer instanceof ArrayBuffer || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0);\n }\n\n return fromArrayLike(that, obj);\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data);\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.');\n}\n\nfunction checked(length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + kMaxLength().toString(16) + ' bytes');\n }\n\n return length | 0;\n}\n\nfunction SlowBuffer(length) {\n if (+length != length) {\n // eslint-disable-line eqeqeq\n length = 0;\n }\n\n return Buffer.alloc(+length);\n}\n\nBuffer.isBuffer = function isBuffer(b) {\n return !!(b != null && b._isBuffer);\n};\n\nBuffer.compare = function compare(a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers');\n }\n\n if (a === b) return 0;\n var x = a.length;\n var y = b.length;\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i];\n y = b[i];\n break;\n }\n }\n\n if (x < y) return -1;\n if (y < x) return 1;\n return 0;\n};\n\nBuffer.isEncoding = function isEncoding(encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true;\n\n default:\n return false;\n }\n};\n\nBuffer.concat = function concat(list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers');\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0);\n }\n\n var i;\n\n if (length === undefined) {\n length = 0;\n\n for (i = 0; i < list.length; ++i) {\n length += list[i].length;\n }\n }\n\n var buffer = Buffer.allocUnsafe(length);\n var pos = 0;\n\n for (i = 0; i < list.length; ++i) {\n var buf = list[i];\n\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers');\n }\n\n buf.copy(buffer, pos);\n pos += buf.length;\n }\n\n return buffer;\n};\n\nfunction byteLength(string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length;\n }\n\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength;\n }\n\n if (typeof string !== 'string') {\n string = '' + string;\n }\n\n var len = string.length;\n if (len === 0) return 0; // Use a for loop to avoid recursion\n\n var loweredCase = false;\n\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len;\n\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length;\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2;\n\n case 'hex':\n return len >>> 1;\n\n case 'base64':\n return base64ToBytes(string).length;\n\n default:\n if (loweredCase) return utf8ToBytes(string).length; // assume utf8\n\n encoding = ('' + encoding).toLowerCase();\n loweredCase = true;\n }\n }\n}\n\nBuffer.byteLength = byteLength;\n\nfunction slowToString(encoding, start, end) {\n var loweredCase = false; // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n\n if (start === undefined || start < 0) {\n start = 0;\n } // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n\n\n if (start > this.length) {\n return '';\n }\n\n if (end === undefined || end > this.length) {\n end = this.length;\n }\n\n if (end <= 0) {\n return '';\n } // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n\n\n end >>>= 0;\n start >>>= 0;\n\n if (end <= start) {\n return '';\n }\n\n if (!encoding) encoding = 'utf8';\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end);\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end);\n\n case 'ascii':\n return asciiSlice(this, start, end);\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end);\n\n case 'base64':\n return base64Slice(this, start, end);\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end);\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);\n encoding = (encoding + '').toLowerCase();\n loweredCase = true;\n }\n }\n} // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\n\n\nBuffer.prototype._isBuffer = true;\n\nfunction swap(b, n, m) {\n var i = b[n];\n b[n] = b[m];\n b[m] = i;\n}\n\nBuffer.prototype.swap16 = function swap16() {\n var len = this.length;\n\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits');\n }\n\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1);\n }\n\n return this;\n};\n\nBuffer.prototype.swap32 = function swap32() {\n var len = this.length;\n\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits');\n }\n\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3);\n swap(this, i + 1, i + 2);\n }\n\n return this;\n};\n\nBuffer.prototype.swap64 = function swap64() {\n var len = this.length;\n\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits');\n }\n\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7);\n swap(this, i + 1, i + 6);\n swap(this, i + 2, i + 5);\n swap(this, i + 3, i + 4);\n }\n\n return this;\n};\n\nBuffer.prototype.toString = function toString() {\n var length = this.length | 0;\n if (length === 0) return '';\n if (arguments.length === 0) return utf8Slice(this, 0, length);\n return slowToString.apply(this, arguments);\n};\n\nBuffer.prototype.equals = function equals(b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer');\n if (this === b) return true;\n return Buffer.compare(this, b) === 0;\n};\n\nBuffer.prototype.inspect = function inspect() {\n var str = '';\n var max = exports.INSPECT_MAX_BYTES;\n\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ');\n if (this.length > max) str += ' ... ';\n }\n\n return '';\n};\n\nBuffer.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer');\n }\n\n if (start === undefined) {\n start = 0;\n }\n\n if (end === undefined) {\n end = target ? target.length : 0;\n }\n\n if (thisStart === undefined) {\n thisStart = 0;\n }\n\n if (thisEnd === undefined) {\n thisEnd = this.length;\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index');\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0;\n }\n\n if (thisStart >= thisEnd) {\n return -1;\n }\n\n if (start >= end) {\n return 1;\n }\n\n start >>>= 0;\n end >>>= 0;\n thisStart >>>= 0;\n thisEnd >>>= 0;\n if (this === target) return 0;\n var x = thisEnd - thisStart;\n var y = end - start;\n var len = Math.min(x, y);\n var thisCopy = this.slice(thisStart, thisEnd);\n var targetCopy = target.slice(start, end);\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i];\n y = targetCopy[i];\n break;\n }\n }\n\n if (x < y) return -1;\n if (y < x) return 1;\n return 0;\n}; // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\n\n\nfunction bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1; // Normalize byteOffset\n\n if (typeof byteOffset === 'string') {\n encoding = byteOffset;\n byteOffset = 0;\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff;\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000;\n }\n\n byteOffset = +byteOffset; // Coerce to Number.\n\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : buffer.length - 1;\n } // Normalize byteOffset: negative offsets start from the end of the buffer\n\n\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset;\n\n if (byteOffset >= buffer.length) {\n if (dir) return -1;else byteOffset = buffer.length - 1;\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0;else return -1;\n } // Normalize val\n\n\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding);\n } // Finally, search either indexOf (if dir is true) or lastIndexOf\n\n\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1;\n }\n\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir);\n } else if (typeof val === 'number') {\n val = val & 0xFF; // Search for a byte value [0-255]\n\n if (Buffer.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);\n }\n }\n\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);\n }\n\n throw new TypeError('val must be string, number or Buffer');\n}\n\nfunction arrayIndexOf(arr, val, byteOffset, encoding, dir) {\n var indexSize = 1;\n var arrLength = arr.length;\n var valLength = val.length;\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase();\n\n if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1;\n }\n\n indexSize = 2;\n arrLength /= 2;\n valLength /= 2;\n byteOffset /= 2;\n }\n }\n\n function read(buf, i) {\n if (indexSize === 1) {\n return buf[i];\n } else {\n return buf.readUInt16BE(i * indexSize);\n }\n }\n\n var i;\n\n if (dir) {\n var foundIndex = -1;\n\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i;\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;\n } else {\n if (foundIndex !== -1) i -= i - foundIndex;\n foundIndex = -1;\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;\n\n for (i = byteOffset; i >= 0; i--) {\n var found = true;\n\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false;\n break;\n }\n }\n\n if (found) return i;\n }\n }\n\n return -1;\n}\n\nBuffer.prototype.includes = function includes(val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1;\n};\n\nBuffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true);\n};\n\nBuffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false);\n};\n\nfunction hexWrite(buf, string, offset, length) {\n offset = Number(offset) || 0;\n var remaining = buf.length - offset;\n\n if (!length) {\n length = remaining;\n } else {\n length = Number(length);\n\n if (length > remaining) {\n length = remaining;\n }\n } // must be an even number of digits\n\n\n var strLen = string.length;\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string');\n\n if (length > strLen / 2) {\n length = strLen / 2;\n }\n\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16);\n if (isNaN(parsed)) return i;\n buf[offset + i] = parsed;\n }\n\n return i;\n}\n\nfunction utf8Write(buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);\n}\n\nfunction asciiWrite(buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length);\n}\n\nfunction latin1Write(buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length);\n}\n\nfunction base64Write(buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length);\n}\n\nfunction ucs2Write(buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);\n}\n\nBuffer.prototype.write = function write(string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8';\n length = this.length;\n offset = 0; // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset;\n length = this.length;\n offset = 0; // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0;\n\n if (isFinite(length)) {\n length = length | 0;\n if (encoding === undefined) encoding = 'utf8';\n } else {\n encoding = length;\n length = undefined;\n } // legacy write(string, encoding, offset, length) - remove in v0.13\n\n } else {\n throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported');\n }\n\n var remaining = this.length - offset;\n if (length === undefined || length > remaining) length = remaining;\n\n if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds');\n }\n\n if (!encoding) encoding = 'utf8';\n var loweredCase = false;\n\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length);\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length);\n\n case 'ascii':\n return asciiWrite(this, string, offset, length);\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length);\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length);\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length);\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);\n encoding = ('' + encoding).toLowerCase();\n loweredCase = true;\n }\n }\n};\n\nBuffer.prototype.toJSON = function toJSON() {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n };\n};\n\nfunction base64Slice(buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf);\n } else {\n return base64.fromByteArray(buf.slice(start, end));\n }\n}\n\nfunction utf8Slice(buf, start, end) {\n end = Math.min(buf.length, end);\n var res = [];\n var i = start;\n\n while (i < end) {\n var firstByte = buf[i];\n var codePoint = null;\n var bytesPerSequence = firstByte > 0xEF ? 4 : firstByte > 0xDF ? 3 : firstByte > 0xBF ? 2 : 1;\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint;\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte;\n }\n\n break;\n\n case 2:\n secondByte = buf[i + 1];\n\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | secondByte & 0x3F;\n\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint;\n }\n }\n\n break;\n\n case 3:\n secondByte = buf[i + 1];\n thirdByte = buf[i + 2];\n\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | thirdByte & 0x3F;\n\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint;\n }\n }\n\n break;\n\n case 4:\n secondByte = buf[i + 1];\n thirdByte = buf[i + 2];\n fourthByte = buf[i + 3];\n\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | fourthByte & 0x3F;\n\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint;\n }\n }\n\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD;\n bytesPerSequence = 1;\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000;\n res.push(codePoint >>> 10 & 0x3FF | 0xD800);\n codePoint = 0xDC00 | codePoint & 0x3FF;\n }\n\n res.push(codePoint);\n i += bytesPerSequence;\n }\n\n return decodeCodePointsArray(res);\n} // Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\n\n\nvar MAX_ARGUMENTS_LENGTH = 0x1000;\n\nfunction decodeCodePointsArray(codePoints) {\n var len = codePoints.length;\n\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints); // avoid extra slice()\n } // Decode in chunks to avoid \"call stack size exceeded\".\n\n\n var res = '';\n var i = 0;\n\n while (i < len) {\n res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));\n }\n\n return res;\n}\n\nfunction asciiSlice(buf, start, end) {\n var ret = '';\n end = Math.min(buf.length, end);\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F);\n }\n\n return ret;\n}\n\nfunction latin1Slice(buf, start, end) {\n var ret = '';\n end = Math.min(buf.length, end);\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i]);\n }\n\n return ret;\n}\n\nfunction hexSlice(buf, start, end) {\n var len = buf.length;\n if (!start || start < 0) start = 0;\n if (!end || end < 0 || end > len) end = len;\n var out = '';\n\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i]);\n }\n\n return out;\n}\n\nfunction utf16leSlice(buf, start, end) {\n var bytes = buf.slice(start, end);\n var res = '';\n\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);\n }\n\n return res;\n}\n\nBuffer.prototype.slice = function slice(start, end) {\n var len = this.length;\n start = ~~start;\n end = end === undefined ? len : ~~end;\n\n if (start < 0) {\n start += len;\n if (start < 0) start = 0;\n } else if (start > len) {\n start = len;\n }\n\n if (end < 0) {\n end += len;\n if (end < 0) end = 0;\n } else if (end > len) {\n end = len;\n }\n\n if (end < start) end = start;\n var newBuf;\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end);\n newBuf.__proto__ = Buffer.prototype;\n } else {\n var sliceLen = end - start;\n newBuf = new Buffer(sliceLen, undefined);\n\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start];\n }\n }\n\n return newBuf;\n};\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\n\n\nfunction checkOffset(offset, ext, length) {\n if (offset % 1 !== 0 || offset < 0) throw new RangeError('offset is not uint');\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length');\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) {\n offset = offset | 0;\n byteLength = byteLength | 0;\n if (!noAssert) checkOffset(offset, byteLength, this.length);\n var val = this[offset];\n var mul = 1;\n var i = 0;\n\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul;\n }\n\n return val;\n};\n\nBuffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) {\n offset = offset | 0;\n byteLength = byteLength | 0;\n\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length);\n }\n\n var val = this[offset + --byteLength];\n var mul = 1;\n\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul;\n }\n\n return val;\n};\n\nBuffer.prototype.readUInt8 = function readUInt8(offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length);\n return this[offset];\n};\n\nBuffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length);\n return this[offset] | this[offset + 1] << 8;\n};\n\nBuffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length);\n return this[offset] << 8 | this[offset + 1];\n};\n\nBuffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length);\n return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 0x1000000;\n};\n\nBuffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length);\n return this[offset] * 0x1000000 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);\n};\n\nBuffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {\n offset = offset | 0;\n byteLength = byteLength | 0;\n if (!noAssert) checkOffset(offset, byteLength, this.length);\n var val = this[offset];\n var mul = 1;\n var i = 0;\n\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul;\n }\n\n mul *= 0x80;\n if (val >= mul) val -= Math.pow(2, 8 * byteLength);\n return val;\n};\n\nBuffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) {\n offset = offset | 0;\n byteLength = byteLength | 0;\n if (!noAssert) checkOffset(offset, byteLength, this.length);\n var i = byteLength;\n var mul = 1;\n var val = this[offset + --i];\n\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul;\n }\n\n mul *= 0x80;\n if (val >= mul) val -= Math.pow(2, 8 * byteLength);\n return val;\n};\n\nBuffer.prototype.readInt8 = function readInt8(offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length);\n if (!(this[offset] & 0x80)) return this[offset];\n return (0xff - this[offset] + 1) * -1;\n};\n\nBuffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length);\n var val = this[offset] | this[offset + 1] << 8;\n return val & 0x8000 ? val | 0xFFFF0000 : val;\n};\n\nBuffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length);\n var val = this[offset + 1] | this[offset] << 8;\n return val & 0x8000 ? val | 0xFFFF0000 : val;\n};\n\nBuffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length);\n return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;\n};\n\nBuffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length);\n return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];\n};\n\nBuffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length);\n return ieee754.read(this, offset, true, 23, 4);\n};\n\nBuffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length);\n return ieee754.read(this, offset, false, 23, 4);\n};\n\nBuffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length);\n return ieee754.read(this, offset, true, 52, 8);\n};\n\nBuffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length);\n return ieee754.read(this, offset, false, 52, 8);\n};\n\nfunction checkInt(buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance');\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds');\n if (offset + ext > buf.length) throw new RangeError('Index out of range');\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) {\n value = +value;\n offset = offset | 0;\n byteLength = byteLength | 0;\n\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1;\n checkInt(this, value, offset, byteLength, maxBytes, 0);\n }\n\n var mul = 1;\n var i = 0;\n this[offset] = value & 0xFF;\n\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = value / mul & 0xFF;\n }\n\n return offset + byteLength;\n};\n\nBuffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) {\n value = +value;\n offset = offset | 0;\n byteLength = byteLength | 0;\n\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1;\n checkInt(this, value, offset, byteLength, maxBytes, 0);\n }\n\n var i = byteLength - 1;\n var mul = 1;\n this[offset + i] = value & 0xFF;\n\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = value / mul & 0xFF;\n }\n\n return offset + byteLength;\n};\n\nBuffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);\n this[offset] = value & 0xff;\n return offset + 1;\n};\n\nfunction objectWriteUInt16(buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1;\n\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & 0xff << 8 * (littleEndian ? i : 1 - i)) >>> (littleEndian ? i : 1 - i) * 8;\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = value & 0xff;\n this[offset + 1] = value >>> 8;\n } else {\n objectWriteUInt16(this, value, offset, true);\n }\n\n return offset + 2;\n};\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = value >>> 8;\n this[offset + 1] = value & 0xff;\n } else {\n objectWriteUInt16(this, value, offset, false);\n }\n\n return offset + 2;\n};\n\nfunction objectWriteUInt32(buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1;\n\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = value >>> (littleEndian ? i : 3 - i) * 8 & 0xff;\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = value >>> 24;\n this[offset + 2] = value >>> 16;\n this[offset + 1] = value >>> 8;\n this[offset] = value & 0xff;\n } else {\n objectWriteUInt32(this, value, offset, true);\n }\n\n return offset + 4;\n};\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = value >>> 24;\n this[offset + 1] = value >>> 16;\n this[offset + 2] = value >>> 8;\n this[offset + 3] = value & 0xff;\n } else {\n objectWriteUInt32(this, value, offset, false);\n }\n\n return offset + 4;\n};\n\nBuffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) {\n value = +value;\n offset = offset | 0;\n\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1);\n checkInt(this, value, offset, byteLength, limit - 1, -limit);\n }\n\n var i = 0;\n var mul = 1;\n var sub = 0;\n this[offset] = value & 0xFF;\n\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1;\n }\n\n this[offset + i] = (value / mul >> 0) - sub & 0xFF;\n }\n\n return offset + byteLength;\n};\n\nBuffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) {\n value = +value;\n offset = offset | 0;\n\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1);\n checkInt(this, value, offset, byteLength, limit - 1, -limit);\n }\n\n var i = byteLength - 1;\n var mul = 1;\n var sub = 0;\n this[offset + i] = value & 0xFF;\n\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1;\n }\n\n this[offset + i] = (value / mul >> 0) - sub & 0xFF;\n }\n\n return offset + byteLength;\n};\n\nBuffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);\n if (value < 0) value = 0xff + value + 1;\n this[offset] = value & 0xff;\n return offset + 1;\n};\n\nBuffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = value & 0xff;\n this[offset + 1] = value >>> 8;\n } else {\n objectWriteUInt16(this, value, offset, true);\n }\n\n return offset + 2;\n};\n\nBuffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = value >>> 8;\n this[offset + 1] = value & 0xff;\n } else {\n objectWriteUInt16(this, value, offset, false);\n }\n\n return offset + 2;\n};\n\nBuffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = value & 0xff;\n this[offset + 1] = value >>> 8;\n this[offset + 2] = value >>> 16;\n this[offset + 3] = value >>> 24;\n } else {\n objectWriteUInt32(this, value, offset, true);\n }\n\n return offset + 4;\n};\n\nBuffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);\n if (value < 0) value = 0xffffffff + value + 1;\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = value >>> 24;\n this[offset + 1] = value >>> 16;\n this[offset + 2] = value >>> 8;\n this[offset + 3] = value & 0xff;\n } else {\n objectWriteUInt32(this, value, offset, false);\n }\n\n return offset + 4;\n};\n\nfunction checkIEEE754(buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range');\n if (offset < 0) throw new RangeError('Index out of range');\n}\n\nfunction writeFloat(buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38);\n }\n\n ieee754.write(buf, value, offset, littleEndian, 23, 4);\n return offset + 4;\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert);\n};\n\nBuffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert);\n};\n\nfunction writeDouble(buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308);\n }\n\n ieee754.write(buf, value, offset, littleEndian, 52, 8);\n return offset + 8;\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert);\n};\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert);\n}; // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\n\n\nBuffer.prototype.copy = function copy(target, targetStart, start, end) {\n if (!start) start = 0;\n if (!end && end !== 0) end = this.length;\n if (targetStart >= target.length) targetStart = target.length;\n if (!targetStart) targetStart = 0;\n if (end > 0 && end < start) end = start; // Copy 0 bytes; we're done\n\n if (end === start) return 0;\n if (target.length === 0 || this.length === 0) return 0; // Fatal error conditions\n\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds');\n }\n\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds');\n if (end < 0) throw new RangeError('sourceEnd out of bounds'); // Are we oob?\n\n if (end > this.length) end = this.length;\n\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start;\n }\n\n var len = end - start;\n var i;\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start];\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start];\n }\n } else {\n Uint8Array.prototype.set.call(target, this.subarray(start, start + len), targetStart);\n }\n\n return len;\n}; // Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\n\n\nBuffer.prototype.fill = function fill(val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start;\n start = 0;\n end = this.length;\n } else if (typeof end === 'string') {\n encoding = end;\n end = this.length;\n }\n\n if (val.length === 1) {\n var code = val.charCodeAt(0);\n\n if (code < 256) {\n val = code;\n }\n }\n\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string');\n }\n\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding);\n }\n } else if (typeof val === 'number') {\n val = val & 255;\n } // Invalid ranges are not set to a default, so can range check early.\n\n\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index');\n }\n\n if (end <= start) {\n return this;\n }\n\n start = start >>> 0;\n end = end === undefined ? this.length : end >>> 0;\n if (!val) val = 0;\n var i;\n\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val;\n }\n } else {\n var bytes = Buffer.isBuffer(val) ? val : utf8ToBytes(new Buffer(val, encoding).toString());\n var len = bytes.length;\n\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len];\n }\n }\n\n return this;\n}; // HELPER FUNCTIONS\n// ================\n\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g;\n\nfunction base64clean(str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, ''); // Node converts strings with length < 2 to ''\n\n if (str.length < 2) return ''; // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n\n while (str.length % 4 !== 0) {\n str = str + '=';\n }\n\n return str;\n}\n\nfunction stringtrim(str) {\n if (str.trim) return str.trim();\n return str.replace(/^\\s+|\\s+$/g, '');\n}\n\nfunction toHex(n) {\n if (n < 16) return '0' + n.toString(16);\n return n.toString(16);\n}\n\nfunction utf8ToBytes(string, units) {\n units = units || Infinity;\n var codePoint;\n var length = string.length;\n var leadSurrogate = null;\n var bytes = [];\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i); // is surrogate component\n\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n continue;\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n continue;\n } // valid lead\n\n\n leadSurrogate = codePoint;\n continue;\n } // 2 leads in a row\n\n\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n leadSurrogate = codePoint;\n continue;\n } // valid surrogate pair\n\n\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n }\n\n leadSurrogate = null; // encode utf8\n\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break;\n bytes.push(codePoint);\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break;\n bytes.push(codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80);\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break;\n bytes.push(codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break;\n bytes.push(codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);\n } else {\n throw new Error('Invalid code point');\n }\n }\n\n return bytes;\n}\n\nfunction asciiToBytes(str) {\n var byteArray = [];\n\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF);\n }\n\n return byteArray;\n}\n\nfunction utf16leToBytes(str, units) {\n var c, hi, lo;\n var byteArray = [];\n\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break;\n c = str.charCodeAt(i);\n hi = c >> 8;\n lo = c % 256;\n byteArray.push(lo);\n byteArray.push(hi);\n }\n\n return byteArray;\n}\n\nfunction base64ToBytes(str) {\n return base64.toByteArray(base64clean(str));\n}\n\nfunction blitBuffer(src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if (i + offset >= dst.length || i >= src.length) break;\n dst[i + offset] = src[i];\n }\n\n return i;\n}\n\nfunction isnan(val) {\n return val !== val; // eslint-disable-line no-self-compare\n}","'use strict';\n\nexports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = require('randombytes');\nexports.createHash = exports.Hash = require('create-hash');\nexports.createHmac = exports.Hmac = require('create-hmac');\n\nvar algos = require('browserify-sign/algos');\n\nvar algoKeys = Object.keys(algos);\nvar hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(algoKeys);\n\nexports.getHashes = function () {\n return hashes;\n};\n\nvar p = require('pbkdf2');\n\nexports.pbkdf2 = p.pbkdf2;\nexports.pbkdf2Sync = p.pbkdf2Sync;\n\nvar aes = require('browserify-cipher');\n\nexports.Cipher = aes.Cipher;\nexports.createCipher = aes.createCipher;\nexports.Cipheriv = aes.Cipheriv;\nexports.createCipheriv = aes.createCipheriv;\nexports.Decipher = aes.Decipher;\nexports.createDecipher = aes.createDecipher;\nexports.Decipheriv = aes.Decipheriv;\nexports.createDecipheriv = aes.createDecipheriv;\nexports.getCiphers = aes.getCiphers;\nexports.listCiphers = aes.listCiphers;\n\nvar dh = require('diffie-hellman');\n\nexports.DiffieHellmanGroup = dh.DiffieHellmanGroup;\nexports.createDiffieHellmanGroup = dh.createDiffieHellmanGroup;\nexports.getDiffieHellman = dh.getDiffieHellman;\nexports.createDiffieHellman = dh.createDiffieHellman;\nexports.DiffieHellman = dh.DiffieHellman;\n\nvar sign = require('browserify-sign');\n\nexports.createSign = sign.createSign;\nexports.Sign = sign.Sign;\nexports.createVerify = sign.createVerify;\nexports.Verify = sign.Verify;\nexports.createECDH = require('create-ecdh');\n\nvar publicEncrypt = require('public-encrypt');\n\nexports.publicEncrypt = publicEncrypt.publicEncrypt;\nexports.privateEncrypt = publicEncrypt.privateEncrypt;\nexports.publicDecrypt = publicEncrypt.publicDecrypt;\nexports.privateDecrypt = publicEncrypt.privateDecrypt; // the least I can do is make error messages for the rest of the node.js/crypto api.\n// ;[\n// 'createCredentials'\n// ].forEach(function (name) {\n// exports[name] = function () {\n// throw new Error([\n// 'sorry, ' + name + ' is not implemented yet',\n// 'we accept pull requests',\n// 'https://github.com/crypto-browserify/crypto-browserify'\n// ].join('\\n'))\n// }\n// })\n\nvar rf = require('randomfill');\n\nexports.randomFill = rf.randomFill;\nexports.randomFillSync = rf.randomFillSync;\n\nexports.createCredentials = function () {\n throw new Error(['sorry, createCredentials is not implemented yet', 'we accept pull requests', 'https://github.com/crypto-browserify/crypto-browserify'].join('\\n'));\n};\n\nexports.constants = {\n 'DH_CHECK_P_NOT_SAFE_PRIME': 2,\n 'DH_CHECK_P_NOT_PRIME': 1,\n 'DH_UNABLE_TO_CHECK_GENERATOR': 4,\n 'DH_NOT_SUITABLE_GENERATOR': 8,\n 'NPN_ENABLED': 1,\n 'ALPN_ENABLED': 1,\n 'RSA_PKCS1_PADDING': 1,\n 'RSA_SSLV23_PADDING': 2,\n 'RSA_NO_PADDING': 3,\n 'RSA_PKCS1_OAEP_PADDING': 4,\n 'RSA_X931_PADDING': 5,\n 'RSA_PKCS1_PSS_PADDING': 6,\n 'POINT_CONVERSION_COMPRESSED': 2,\n 'POINT_CONVERSION_UNCOMPRESSED': 4,\n 'POINT_CONVERSION_HYBRID': 6\n};","import \"core-js/modules/es.promise.finally\";\n\n/* eslint-disable @typescript-eslint/explicit-function-return-type */\n\n/* eslint-disable @typescript-eslint/typedef */\n\n/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { isThenable } from './is';\n/** SyncPromise internal states */\n\nvar States;\n\n(function (States) {\n /** Pending */\n States[\"PENDING\"] = \"PENDING\";\n /** Resolved / OK */\n\n States[\"RESOLVED\"] = \"RESOLVED\";\n /** Rejected / Error */\n\n States[\"REJECTED\"] = \"REJECTED\";\n})(States || (States = {}));\n/**\n * Thenable class that behaves like a Promise and follows it's interface\n * but is not async internally\n */\n\n\nvar SyncPromise =\n/** @class */\nfunction () {\n function SyncPromise(executor) {\n var _this = this;\n\n this._state = States.PENDING;\n this._handlers = [];\n /** JSDoc */\n\n this._resolve = function (value) {\n _this._setResult(States.RESOLVED, value);\n };\n /** JSDoc */\n\n\n this._reject = function (reason) {\n _this._setResult(States.REJECTED, reason);\n };\n /** JSDoc */\n\n\n this._setResult = function (state, value) {\n if (_this._state !== States.PENDING) {\n return;\n }\n\n if (isThenable(value)) {\n value.then(_this._resolve, _this._reject);\n return;\n }\n\n _this._state = state;\n _this._value = value;\n\n _this._executeHandlers();\n }; // TODO: FIXME\n\n /** JSDoc */\n\n\n this._attachHandler = function (handler) {\n _this._handlers = _this._handlers.concat(handler);\n\n _this._executeHandlers();\n };\n /** JSDoc */\n\n\n this._executeHandlers = function () {\n if (_this._state === States.PENDING) {\n return;\n }\n\n var cachedHandlers = _this._handlers.slice();\n\n _this._handlers = [];\n cachedHandlers.forEach(function (handler) {\n if (handler.done) {\n return;\n }\n\n if (_this._state === States.RESOLVED) {\n if (handler.onfulfilled) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n handler.onfulfilled(_this._value);\n }\n }\n\n if (_this._state === States.REJECTED) {\n if (handler.onrejected) {\n handler.onrejected(_this._value);\n }\n }\n\n handler.done = true;\n });\n };\n\n try {\n executor(this._resolve, this._reject);\n } catch (e) {\n this._reject(e);\n }\n }\n /** JSDoc */\n\n\n SyncPromise.resolve = function (value) {\n return new SyncPromise(function (resolve) {\n resolve(value);\n });\n };\n /** JSDoc */\n\n\n SyncPromise.reject = function (reason) {\n return new SyncPromise(function (_, reject) {\n reject(reason);\n });\n };\n /** JSDoc */\n\n\n SyncPromise.all = function (collection) {\n return new SyncPromise(function (resolve, reject) {\n if (!Array.isArray(collection)) {\n reject(new TypeError(\"Promise.all requires an array as input.\"));\n return;\n }\n\n if (collection.length === 0) {\n resolve([]);\n return;\n }\n\n var counter = collection.length;\n var resolvedCollection = [];\n collection.forEach(function (item, index) {\n SyncPromise.resolve(item).then(function (value) {\n resolvedCollection[index] = value;\n counter -= 1;\n\n if (counter !== 0) {\n return;\n }\n\n resolve(resolvedCollection);\n }).then(null, reject);\n });\n });\n };\n /** JSDoc */\n\n\n SyncPromise.prototype.then = function (_onfulfilled, _onrejected) {\n var _this = this;\n\n return new SyncPromise(function (resolve, reject) {\n _this._attachHandler({\n done: false,\n onfulfilled: function onfulfilled(result) {\n if (!_onfulfilled) {\n // TODO: ¯\\_(ツ)_/¯\n // TODO: FIXME\n resolve(result);\n return;\n }\n\n try {\n resolve(_onfulfilled(result));\n return;\n } catch (e) {\n reject(e);\n return;\n }\n },\n onrejected: function onrejected(reason) {\n if (!_onrejected) {\n reject(reason);\n return;\n }\n\n try {\n resolve(_onrejected(reason));\n return;\n } catch (e) {\n reject(e);\n return;\n }\n }\n });\n });\n };\n /** JSDoc */\n\n\n SyncPromise.prototype.catch = function (onrejected) {\n return this.then(function (val) {\n return val;\n }, onrejected);\n };\n /** JSDoc */\n\n\n SyncPromise.prototype.finally = function (onfinally) {\n var _this = this;\n\n return new SyncPromise(function (resolve, reject) {\n var val;\n var isRejected;\n return _this.then(function (value) {\n isRejected = false;\n val = value;\n\n if (onfinally) {\n onfinally();\n }\n }, function (reason) {\n isRejected = true;\n val = reason;\n\n if (onfinally) {\n onfinally();\n }\n }).then(function () {\n if (isRejected) {\n reject(val);\n return;\n }\n\n resolve(val);\n });\n });\n };\n /** JSDoc */\n\n\n SyncPromise.prototype.toString = function () {\n return '[object SyncPromise]';\n };\n\n return SyncPromise;\n}();\n\nexport { SyncPromise };","var CipherBase = require('cipher-base');\n\nvar des = require('des.js');\n\nvar inherits = require('inherits');\n\nvar Buffer = require('safe-buffer').Buffer;\n\nvar modes = {\n 'des-ede3-cbc': des.CBC.instantiate(des.EDE),\n 'des-ede3': des.EDE,\n 'des-ede-cbc': des.CBC.instantiate(des.EDE),\n 'des-ede': des.EDE,\n 'des-cbc': des.CBC.instantiate(des.DES),\n 'des-ecb': des.DES\n};\nmodes.des = modes['des-cbc'];\nmodes.des3 = modes['des-ede3-cbc'];\nmodule.exports = DES;\ninherits(DES, CipherBase);\n\nfunction DES(opts) {\n CipherBase.call(this);\n var modeName = opts.mode.toLowerCase();\n var mode = modes[modeName];\n var type;\n\n if (opts.decrypt) {\n type = 'decrypt';\n } else {\n type = 'encrypt';\n }\n\n var key = opts.key;\n\n if (!Buffer.isBuffer(key)) {\n key = Buffer.from(key);\n }\n\n if (modeName === 'des-ede' || modeName === 'des-ede-cbc') {\n key = Buffer.concat([key, key.slice(0, 8)]);\n }\n\n var iv = opts.iv;\n\n if (!Buffer.isBuffer(iv)) {\n iv = Buffer.from(iv);\n }\n\n this._des = mode.create({\n key: key,\n iv: iv,\n type: type\n });\n}\n\nDES.prototype._update = function (data) {\n return Buffer.from(this._des.update(data));\n};\n\nDES.prototype._final = function () {\n return Buffer.from(this._des.final());\n};","export const INTEGRATION_MODES = {\n dedicated: 'dedicated',\n shared: 'shared',\n};","var arrayWithHoles = require(\"./arrayWithHoles\");\n\nvar iterableToArrayLimit = require(\"./iterableToArrayLimit\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray\");\n\nvar nonIterableRest = require(\"./nonIterableRest\");\n\nfunction _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}\n\nmodule.exports = _slicedToArray;","'use strict';\n/**\n * A `Cancel` is an object that is thrown when an operation is canceled.\n *\n * @class\n * @param {string=} message The message.\n */\n\nfunction Cancel(message) {\n this.message = message;\n}\n\nCancel.prototype.toString = function toString() {\n return 'Cancel' + (this.message ? ': ' + this.message : '');\n};\n\nCancel.prototype.__CANCEL__ = true;\nmodule.exports = Cancel;","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nvar MIME_MAP = [{\n type: 'text/plain',\n ext: 'txt'\n}, {\n type: 'text/html',\n ext: 'html'\n}, {\n type: 'text/javascript',\n ext: 'js'\n}, {\n type: 'text/css',\n ext: 'css'\n}, {\n type: 'text/csv',\n ext: 'csv'\n}, {\n type: 'text/yaml',\n ext: 'yml'\n}, {\n type: 'text/yaml',\n ext: 'yaml'\n}, {\n type: 'text/calendar',\n ext: 'ics'\n}, {\n type: 'text/calendar',\n ext: 'ical'\n}, {\n type: 'image/apng',\n ext: 'apng'\n}, {\n type: 'image/bmp',\n ext: 'bmp'\n}, {\n type: 'image/gif',\n ext: 'gif'\n}, {\n type: 'image/x-icon',\n ext: 'ico'\n}, {\n type: 'image/x-icon',\n ext: 'cur'\n}, {\n type: 'image/jpeg',\n ext: 'jpg'\n}, {\n type: 'image/jpeg',\n ext: 'jpeg'\n}, {\n type: 'image/jpeg',\n ext: 'jfif'\n}, {\n type: 'image/jpeg',\n ext: 'pjp'\n}, {\n type: 'image/jpeg',\n ext: 'pjpeg'\n}, {\n type: 'image/png',\n ext: 'png'\n}, {\n type: 'image/svg+xml',\n ext: 'svg'\n}, {\n type: 'image/tiff',\n ext: 'tif'\n}, {\n type: 'image/tiff',\n ext: 'tiff'\n}, {\n type: 'image/webp',\n ext: 'webp'\n}, {\n type: 'application/json',\n ext: 'json'\n}, {\n type: 'application/xml',\n ext: 'xml'\n}, {\n type: 'application/x-sh',\n ext: 'sh'\n}, {\n type: 'application/zip',\n ext: 'zip'\n}, {\n type: 'application/x-rar-compressed',\n ext: 'rar'\n}, {\n type: 'application/x-tar',\n ext: 'tar'\n}, {\n type: 'application/x-bzip',\n ext: 'bz'\n}, {\n type: 'application/x-bzip2',\n ext: 'bz2'\n}, {\n type: 'application/pdf',\n ext: 'pdf'\n}, {\n type: 'application/java-archive',\n ext: 'jar'\n}, {\n type: 'application/msword',\n ext: 'doc'\n}, {\n type: 'application/vnd.ms-excel',\n ext: 'xls'\n}, {\n type: 'application/vnd.ms-excel',\n ext: 'xlsx'\n}, {\n type: 'message/rfc822',\n ext: 'eml'\n}];\nexport var isEmpty = function isEmpty(obj) {\n if (obj === void 0) {\n obj = {};\n }\n\n return Object.keys(obj).length === 0;\n};\nexport var sortByField = function sortByField(list, field, dir) {\n if (!list || !list.sort) {\n return false;\n }\n\n var dirX = dir && dir === 'desc' ? -1 : 1;\n list.sort(function (a, b) {\n var a_val = a[field];\n var b_val = b[field];\n\n if (typeof b_val === 'undefined') {\n return typeof a_val === 'undefined' ? 0 : 1 * dirX;\n }\n\n if (typeof a_val === 'undefined') {\n return -1 * dirX;\n }\n\n if (a_val < b_val) {\n return -1 * dirX;\n }\n\n if (a_val > b_val) {\n return 1 * dirX;\n }\n\n return 0;\n });\n return true;\n};\nexport var objectLessAttributes = function objectLessAttributes(obj, less) {\n var ret = Object.assign({}, obj);\n\n if (less) {\n if (typeof less === 'string') {\n delete ret[less];\n } else {\n less.forEach(function (attr) {\n delete ret[attr];\n });\n }\n }\n\n return ret;\n};\nexport var filenameToContentType = function filenameToContentType(filename, defVal) {\n if (defVal === void 0) {\n defVal = 'application/octet-stream';\n }\n\n var name = filename.toLowerCase();\n var filtered = MIME_MAP.filter(function (mime) {\n return name.endsWith('.' + mime.ext);\n });\n return filtered.length > 0 ? filtered[0].type : defVal;\n};\nexport var isTextFile = function isTextFile(contentType) {\n var type = contentType.toLowerCase();\n\n if (type.startsWith('text/')) {\n return true;\n }\n\n return 'application/json' === type || 'application/xml' === type || 'application/sh' === type;\n};\nexport var generateRandomString = function generateRandomString() {\n var result = '';\n var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n\n for (var i = 32; i > 0; i -= 1) {\n result += chars[Math.floor(Math.random() * chars.length)];\n }\n\n return result;\n};\nexport var makeQuerablePromise = function makeQuerablePromise(promise) {\n if (promise.isResolved) return promise;\n var isPending = true;\n var isRejected = false;\n var isFullfilled = false;\n var result = promise.then(function (data) {\n isFullfilled = true;\n isPending = false;\n return data;\n }, function (e) {\n isRejected = true;\n isPending = false;\n throw e;\n });\n\n result.isFullfilled = function () {\n return isFullfilled;\n };\n\n result.isPending = function () {\n return isPending;\n };\n\n result.isRejected = function () {\n return isRejected;\n };\n\n return result;\n};\nexport var isWebWorker = function isWebWorker() {\n if (typeof self === 'undefined') {\n return false;\n }\n\n var selfContext = self;\n return typeof selfContext.WorkerGlobalScope !== 'undefined' && self instanceof selfContext.WorkerGlobalScope;\n};\nexport var browserOrNode = function browserOrNode() {\n var isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';\n var isNode = typeof process !== 'undefined' && process.versions != null && process.versions.node != null;\n return {\n isBrowser: isBrowser,\n isNode: isNode\n };\n};\n/**\n * transfer the first letter of the keys to lowercase\n * @param {Object} obj - the object need to be transferred\n * @param {Array} whiteListForItself - whitelist itself from being transferred\n * @param {Array} whiteListForChildren - whitelist its children keys from being transferred\n */\n\nexport var transferKeyToLowerCase = function transferKeyToLowerCase(obj, whiteListForItself, whiteListForChildren) {\n if (whiteListForItself === void 0) {\n whiteListForItself = [];\n }\n\n if (whiteListForChildren === void 0) {\n whiteListForChildren = [];\n }\n\n if (!isStrictObject(obj)) return obj;\n var ret = {};\n\n for (var key in obj) {\n if (obj.hasOwnProperty(key)) {\n var transferedKey = whiteListForItself.includes(key) ? key : key[0].toLowerCase() + key.slice(1);\n ret[transferedKey] = whiteListForChildren.includes(key) ? obj[key] : transferKeyToLowerCase(obj[key], whiteListForItself, whiteListForChildren);\n }\n }\n\n return ret;\n};\n/**\n * transfer the first letter of the keys to lowercase\n * @param {Object} obj - the object need to be transferred\n * @param {Array} whiteListForItself - whitelist itself from being transferred\n * @param {Array} whiteListForChildren - whitelist its children keys from being transferred\n */\n\nexport var transferKeyToUpperCase = function transferKeyToUpperCase(obj, whiteListForItself, whiteListForChildren) {\n if (whiteListForItself === void 0) {\n whiteListForItself = [];\n }\n\n if (whiteListForChildren === void 0) {\n whiteListForChildren = [];\n }\n\n if (!isStrictObject(obj)) return obj;\n var ret = {};\n\n for (var key in obj) {\n if (obj.hasOwnProperty(key)) {\n var transferredKey = whiteListForItself.includes(key) ? key : key[0].toUpperCase() + key.slice(1);\n ret[transferredKey] = whiteListForChildren.includes(key) ? obj[key] : transferKeyToUpperCase(obj[key], whiteListForItself, whiteListForChildren);\n }\n }\n\n return ret;\n};\n/**\n * Return true if the object is a strict object\n * which means it's not Array, Function, Number, String, Boolean or Null\n * @param obj the Object\n */\n\nexport var isStrictObject = function isStrictObject(obj) {\n return obj instanceof Object && !(obj instanceof Array) && !(obj instanceof Function) && !(obj instanceof Number) && !(obj instanceof String) && !(obj instanceof Boolean);\n};\n/**\n * @deprecated use per-function imports\n */\n\nvar JS =\n/** @class */\nfunction () {\n function JS() {}\n\n JS.isEmpty = isEmpty;\n JS.sortByField = sortByField;\n JS.objectLessAttributes = objectLessAttributes;\n JS.filenameToContentType = filenameToContentType;\n JS.isTextFile = isTextFile;\n JS.generateRandomString = generateRandomString;\n JS.makeQuerablePromise = makeQuerablePromise;\n JS.isWebWorker = isWebWorker;\n JS.browserOrNode = browserOrNode;\n JS.transferKeyToLowerCase = transferKeyToLowerCase;\n JS.transferKeyToUpperCase = transferKeyToUpperCase;\n JS.isStrictObject = isStrictObject;\n return JS;\n}();\n\nexport { JS };\n/**\n * @deprecated use per-function imports\n */\n\nexport default JS;","/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nvar byteToHex = [];\n\nfor (var i = 0; i < 256; ++i) {\n byteToHex[i] = (i + 0x100).toString(16).substr(1);\n}\n\nfunction bytesToUuid(buf, offset) {\n var i = offset || 0;\n var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4\n\n return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join('');\n}\n\nmodule.exports = bytesToUuid;","var Buffer = require('safe-buffer').Buffer;\n\nvar checkParameters = require('./precondition');\n\nvar defaultEncoding = require('./default-encoding');\n\nvar sync = require('./sync');\n\nvar toBuffer = require('./to-buffer');\n\nvar ZERO_BUF;\nvar subtle = global.crypto && global.crypto.subtle;\nvar toBrowser = {\n sha: 'SHA-1',\n 'sha-1': 'SHA-1',\n sha1: 'SHA-1',\n sha256: 'SHA-256',\n 'sha-256': 'SHA-256',\n sha384: 'SHA-384',\n 'sha-384': 'SHA-384',\n 'sha-512': 'SHA-512',\n sha512: 'SHA-512'\n};\nvar checks = [];\n\nfunction checkNative(algo) {\n if (global.process && !global.process.browser) {\n return Promise.resolve(false);\n }\n\n if (!subtle || !subtle.importKey || !subtle.deriveBits) {\n return Promise.resolve(false);\n }\n\n if (checks[algo] !== undefined) {\n return checks[algo];\n }\n\n ZERO_BUF = ZERO_BUF || Buffer.alloc(8);\n var prom = browserPbkdf2(ZERO_BUF, ZERO_BUF, 10, 128, algo).then(function () {\n return true;\n }).catch(function () {\n return false;\n });\n checks[algo] = prom;\n return prom;\n}\n\nfunction browserPbkdf2(password, salt, iterations, length, algo) {\n return subtle.importKey('raw', password, {\n name: 'PBKDF2'\n }, false, ['deriveBits']).then(function (key) {\n return subtle.deriveBits({\n name: 'PBKDF2',\n salt: salt,\n iterations: iterations,\n hash: {\n name: algo\n }\n }, key, length << 3);\n }).then(function (res) {\n return Buffer.from(res);\n });\n}\n\nfunction resolvePromise(promise, callback) {\n promise.then(function (out) {\n process.nextTick(function () {\n callback(null, out);\n });\n }, function (e) {\n process.nextTick(function () {\n callback(e);\n });\n });\n}\n\nmodule.exports = function (password, salt, iterations, keylen, digest, callback) {\n if (typeof digest === 'function') {\n callback = digest;\n digest = undefined;\n }\n\n digest = digest || 'sha1';\n var algo = toBrowser[digest.toLowerCase()];\n\n if (!algo || typeof global.Promise !== 'function') {\n return process.nextTick(function () {\n var out;\n\n try {\n out = sync(password, salt, iterations, keylen, digest);\n } catch (e) {\n return callback(e);\n }\n\n callback(null, out);\n });\n }\n\n checkParameters(iterations, keylen);\n password = toBuffer(password, defaultEncoding, 'Password');\n salt = toBuffer(salt, defaultEncoding, 'Salt');\n if (typeof callback !== 'function') throw new Error('No callback provided to pbkdf2');\n resolvePromise(checkNative(algo).then(function (resp) {\n if (resp) return browserPbkdf2(password, salt, iterations, keylen, algo);\n return sync(password, salt, iterations, keylen, digest);\n }), callback);\n};","import React, { createElement } from \"react\"\nimport PropTypes from \"prop-types\"\nimport { publicLoader } from \"./loader\"\nimport { apiRunner } from \"./api-runner-browser\"\nimport { grabMatchParams } from \"./find-path\"\n\n// Renders page\nclass PageRenderer extends React.Component {\n render() {\n const props = {\n ...this.props,\n params: {\n ...grabMatchParams(this.props.location.pathname),\n ...this.props.pageResources.json.pageContext.__params,\n },\n pathContext: this.props.pageContext,\n }\n\n const [replacementElement] = apiRunner(`replaceComponentRenderer`, {\n props: this.props,\n loader: publicLoader,\n })\n\n const pageElement =\n replacementElement ||\n createElement(this.props.pageResources.component, {\n ...props,\n key: this.props.path || this.props.pageResources.page.path,\n })\n\n const wrappedPage = apiRunner(\n `wrapPageElement`,\n { element: pageElement, props },\n pageElement,\n ({ result }) => {\n return { element: result, props }\n }\n ).pop()\n\n return wrappedPage\n }\n}\n\nPageRenderer.propTypes = {\n location: PropTypes.object.isRequired,\n pageResources: PropTypes.object.isRequired,\n data: PropTypes.object,\n pageContext: PropTypes.object.isRequired,\n}\n\nexport default PageRenderer\n","'use strict';\n\nvar decoders = exports;\ndecoders.der = require('./der');\ndecoders.pem = require('./pem');","'use strict';\n\nvar utils = require('./utils');\n\nvar assert = require('minimalistic-assert');\n\nfunction Hmac(hash, key, enc) {\n if (!(this instanceof Hmac)) return new Hmac(hash, key, enc);\n this.Hash = hash;\n this.blockSize = hash.blockSize / 8;\n this.outSize = hash.outSize / 8;\n this.inner = null;\n this.outer = null;\n\n this._init(utils.toArray(key, enc));\n}\n\nmodule.exports = Hmac;\n\nHmac.prototype._init = function init(key) {\n // Shorten key, if needed\n if (key.length > this.blockSize) key = new this.Hash().update(key).digest();\n assert(key.length <= this.blockSize); // Add padding to key\n\n for (var i = key.length; i < this.blockSize; i++) {\n key.push(0);\n }\n\n for (i = 0; i < key.length; i++) {\n key[i] ^= 0x36;\n }\n\n this.inner = new this.Hash().update(key); // 0x36 ^ 0x5c = 0x6a\n\n for (i = 0; i < key.length; i++) {\n key[i] ^= 0x6a;\n }\n\n this.outer = new this.Hash().update(key);\n};\n\nHmac.prototype.update = function update(msg, enc) {\n this.inner.update(msg, enc);\n return this;\n};\n\nHmac.prototype.digest = function digest(enc) {\n this.outer.update(this.inner.digest());\n return this.outer.digest(enc);\n};",";\n\n(function (root, factory) {\n if (typeof exports === \"object\") {\n // CommonJS\n module.exports = exports = factory();\n } else if (typeof define === \"function\" && define.amd) {\n // AMD\n define([], factory);\n } else {\n // Global (browser)\n root.CryptoJS = factory();\n }\n})(this, function () {\n /**\n * CryptoJS core components.\n */\n var CryptoJS = CryptoJS || function (Math, undefined) {\n /*\n * Local polyfil of Object.create\n */\n var create = Object.create || function () {\n function F() {}\n\n ;\n return function (obj) {\n var subtype;\n F.prototype = obj;\n subtype = new F();\n F.prototype = null;\n return subtype;\n };\n }();\n /**\n * CryptoJS namespace.\n */\n\n\n var C = {};\n /**\n * Library namespace.\n */\n\n var C_lib = C.lib = {};\n /**\n * Base object for prototypal inheritance.\n */\n\n var Base = C_lib.Base = function () {\n return {\n /**\n * Creates a new object that inherits from this object.\n *\n * @param {Object} overrides Properties to copy into the new object.\n *\n * @return {Object} The new object.\n *\n * @static\n *\n * @example\n *\n * var MyType = CryptoJS.lib.Base.extend({\n * field: 'value',\n *\n * method: function () {\n * }\n * });\n */\n extend: function extend(overrides) {\n // Spawn\n var subtype = create(this); // Augment\n\n if (overrides) {\n subtype.mixIn(overrides);\n } // Create default initializer\n\n\n if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {\n subtype.init = function () {\n subtype.$super.init.apply(this, arguments);\n };\n } // Initializer's prototype is the subtype object\n\n\n subtype.init.prototype = subtype; // Reference supertype\n\n subtype.$super = this;\n return subtype;\n },\n\n /**\n * Extends this object and runs the init method.\n * Arguments to create() will be passed to init().\n *\n * @return {Object} The new object.\n *\n * @static\n *\n * @example\n *\n * var instance = MyType.create();\n */\n create: function create() {\n var instance = this.extend();\n instance.init.apply(instance, arguments);\n return instance;\n },\n\n /**\n * Initializes a newly created object.\n * Override this method to add some logic when your objects are created.\n *\n * @example\n *\n * var MyType = CryptoJS.lib.Base.extend({\n * init: function () {\n * // ...\n * }\n * });\n */\n init: function init() {},\n\n /**\n * Copies properties into this object.\n *\n * @param {Object} properties The properties to mix in.\n *\n * @example\n *\n * MyType.mixIn({\n * field: 'value'\n * });\n */\n mixIn: function mixIn(properties) {\n for (var propertyName in properties) {\n if (properties.hasOwnProperty(propertyName)) {\n this[propertyName] = properties[propertyName];\n }\n } // IE won't copy toString using the loop above\n\n\n if (properties.hasOwnProperty('toString')) {\n this.toString = properties.toString;\n }\n },\n\n /**\n * Creates a copy of this object.\n *\n * @return {Object} The clone.\n *\n * @example\n *\n * var clone = instance.clone();\n */\n clone: function clone() {\n return this.init.prototype.extend(this);\n }\n };\n }();\n /**\n * An array of 32-bit words.\n *\n * @property {Array} words The array of 32-bit words.\n * @property {number} sigBytes The number of significant bytes in this word array.\n */\n\n\n var WordArray = C_lib.WordArray = Base.extend({\n /**\n * Initializes a newly created word array.\n *\n * @param {Array} words (Optional) An array of 32-bit words.\n * @param {number} sigBytes (Optional) The number of significant bytes in the words.\n *\n * @example\n *\n * var wordArray = CryptoJS.lib.WordArray.create();\n * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);\n * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);\n */\n init: function init(words, sigBytes) {\n words = this.words = words || [];\n\n if (sigBytes != undefined) {\n this.sigBytes = sigBytes;\n } else {\n this.sigBytes = words.length * 4;\n }\n },\n\n /**\n * Converts this word array to a string.\n *\n * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex\n *\n * @return {string} The stringified word array.\n *\n * @example\n *\n * var string = wordArray + '';\n * var string = wordArray.toString();\n * var string = wordArray.toString(CryptoJS.enc.Utf8);\n */\n toString: function toString(encoder) {\n return (encoder || Hex).stringify(this);\n },\n\n /**\n * Concatenates a word array to this word array.\n *\n * @param {WordArray} wordArray The word array to append.\n *\n * @return {WordArray} This word array.\n *\n * @example\n *\n * wordArray1.concat(wordArray2);\n */\n concat: function concat(wordArray) {\n // Shortcuts\n var thisWords = this.words;\n var thatWords = wordArray.words;\n var thisSigBytes = this.sigBytes;\n var thatSigBytes = wordArray.sigBytes; // Clamp excess bits\n\n this.clamp(); // Concat\n\n if (thisSigBytes % 4) {\n // Copy one byte at a time\n for (var i = 0; i < thatSigBytes; i++) {\n var thatByte = thatWords[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;\n thisWords[thisSigBytes + i >>> 2] |= thatByte << 24 - (thisSigBytes + i) % 4 * 8;\n }\n } else {\n // Copy one word at a time\n for (var i = 0; i < thatSigBytes; i += 4) {\n thisWords[thisSigBytes + i >>> 2] = thatWords[i >>> 2];\n }\n }\n\n this.sigBytes += thatSigBytes; // Chainable\n\n return this;\n },\n\n /**\n * Removes insignificant bits.\n *\n * @example\n *\n * wordArray.clamp();\n */\n clamp: function clamp() {\n // Shortcuts\n var words = this.words;\n var sigBytes = this.sigBytes; // Clamp\n\n words[sigBytes >>> 2] &= 0xffffffff << 32 - sigBytes % 4 * 8;\n words.length = Math.ceil(sigBytes / 4);\n },\n\n /**\n * Creates a copy of this word array.\n *\n * @return {WordArray} The clone.\n *\n * @example\n *\n * var clone = wordArray.clone();\n */\n clone: function clone() {\n var clone = Base.clone.call(this);\n clone.words = this.words.slice(0);\n return clone;\n },\n\n /**\n * Creates a word array filled with random bytes.\n *\n * @param {number} nBytes The number of random bytes to generate.\n *\n * @return {WordArray} The random word array.\n *\n * @static\n *\n * @example\n *\n * var wordArray = CryptoJS.lib.WordArray.random(16);\n */\n random: function random(nBytes) {\n var words = [];\n\n var r = function r(m_w) {\n var m_w = m_w;\n var m_z = 0x3ade68b1;\n var mask = 0xffffffff;\n return function () {\n m_z = 0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10) & mask;\n m_w = 0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10) & mask;\n var result = (m_z << 0x10) + m_w & mask;\n result /= 0x100000000;\n result += 0.5;\n return result * (Math.random() > .5 ? 1 : -1);\n };\n };\n\n for (var i = 0, rcache; i < nBytes; i += 4) {\n var _r = r((rcache || Math.random()) * 0x100000000);\n\n rcache = _r() * 0x3ade67b7;\n words.push(_r() * 0x100000000 | 0);\n }\n\n return new WordArray.init(words, nBytes);\n }\n });\n /**\n * Encoder namespace.\n */\n\n var C_enc = C.enc = {};\n /**\n * Hex encoding strategy.\n */\n\n var Hex = C_enc.Hex = {\n /**\n * Converts a word array to a hex string.\n *\n * @param {WordArray} wordArray The word array.\n *\n * @return {string} The hex string.\n *\n * @static\n *\n * @example\n *\n * var hexString = CryptoJS.enc.Hex.stringify(wordArray);\n */\n stringify: function stringify(wordArray) {\n // Shortcuts\n var words = wordArray.words;\n var sigBytes = wordArray.sigBytes; // Convert\n\n var hexChars = [];\n\n for (var i = 0; i < sigBytes; i++) {\n var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;\n hexChars.push((bite >>> 4).toString(16));\n hexChars.push((bite & 0x0f).toString(16));\n }\n\n return hexChars.join('');\n },\n\n /**\n * Converts a hex string to a word array.\n *\n * @param {string} hexStr The hex string.\n *\n * @return {WordArray} The word array.\n *\n * @static\n *\n * @example\n *\n * var wordArray = CryptoJS.enc.Hex.parse(hexString);\n */\n parse: function parse(hexStr) {\n // Shortcut\n var hexStrLength = hexStr.length; // Convert\n\n var words = [];\n\n for (var i = 0; i < hexStrLength; i += 2) {\n words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << 24 - i % 8 * 4;\n }\n\n return new WordArray.init(words, hexStrLength / 2);\n }\n };\n /**\n * Latin1 encoding strategy.\n */\n\n var Latin1 = C_enc.Latin1 = {\n /**\n * Converts a word array to a Latin1 string.\n *\n * @param {WordArray} wordArray The word array.\n *\n * @return {string} The Latin1 string.\n *\n * @static\n *\n * @example\n *\n * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);\n */\n stringify: function stringify(wordArray) {\n // Shortcuts\n var words = wordArray.words;\n var sigBytes = wordArray.sigBytes; // Convert\n\n var latin1Chars = [];\n\n for (var i = 0; i < sigBytes; i++) {\n var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;\n latin1Chars.push(String.fromCharCode(bite));\n }\n\n return latin1Chars.join('');\n },\n\n /**\n * Converts a Latin1 string to a word array.\n *\n * @param {string} latin1Str The Latin1 string.\n *\n * @return {WordArray} The word array.\n *\n * @static\n *\n * @example\n *\n * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);\n */\n parse: function parse(latin1Str) {\n // Shortcut\n var latin1StrLength = latin1Str.length; // Convert\n\n var words = [];\n\n for (var i = 0; i < latin1StrLength; i++) {\n words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << 24 - i % 4 * 8;\n }\n\n return new WordArray.init(words, latin1StrLength);\n }\n };\n /**\n * UTF-8 encoding strategy.\n */\n\n var Utf8 = C_enc.Utf8 = {\n /**\n * Converts a word array to a UTF-8 string.\n *\n * @param {WordArray} wordArray The word array.\n *\n * @return {string} The UTF-8 string.\n *\n * @static\n *\n * @example\n *\n * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);\n */\n stringify: function stringify(wordArray) {\n try {\n return decodeURIComponent(escape(Latin1.stringify(wordArray)));\n } catch (e) {\n throw new Error('Malformed UTF-8 data');\n }\n },\n\n /**\n * Converts a UTF-8 string to a word array.\n *\n * @param {string} utf8Str The UTF-8 string.\n *\n * @return {WordArray} The word array.\n *\n * @static\n *\n * @example\n *\n * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);\n */\n parse: function parse(utf8Str) {\n return Latin1.parse(unescape(encodeURIComponent(utf8Str)));\n }\n };\n /**\n * Abstract buffered block algorithm template.\n *\n * The property blockSize must be implemented in a concrete subtype.\n *\n * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0\n */\n\n var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({\n /**\n * Resets this block algorithm's data buffer to its initial state.\n *\n * @example\n *\n * bufferedBlockAlgorithm.reset();\n */\n reset: function reset() {\n // Initial values\n this._data = new WordArray.init();\n this._nDataBytes = 0;\n },\n\n /**\n * Adds new data to this block algorithm's buffer.\n *\n * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.\n *\n * @example\n *\n * bufferedBlockAlgorithm._append('data');\n * bufferedBlockAlgorithm._append(wordArray);\n */\n _append: function _append(data) {\n // Convert string to WordArray, else assume WordArray already\n if (typeof data == 'string') {\n data = Utf8.parse(data);\n } // Append\n\n\n this._data.concat(data);\n\n this._nDataBytes += data.sigBytes;\n },\n\n /**\n * Processes available data blocks.\n *\n * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.\n *\n * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.\n *\n * @return {WordArray} The processed data.\n *\n * @example\n *\n * var processedData = bufferedBlockAlgorithm._process();\n * var processedData = bufferedBlockAlgorithm._process(!!'flush');\n */\n _process: function _process(doFlush) {\n // Shortcuts\n var data = this._data;\n var dataWords = data.words;\n var dataSigBytes = data.sigBytes;\n var blockSize = this.blockSize;\n var blockSizeBytes = blockSize * 4; // Count blocks ready\n\n var nBlocksReady = dataSigBytes / blockSizeBytes;\n\n if (doFlush) {\n // Round up to include partial blocks\n nBlocksReady = Math.ceil(nBlocksReady);\n } else {\n // Round down to include only full blocks,\n // less the number of blocks that must remain in the buffer\n nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);\n } // Count words ready\n\n\n var nWordsReady = nBlocksReady * blockSize; // Count bytes ready\n\n var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes); // Process blocks\n\n if (nWordsReady) {\n for (var offset = 0; offset < nWordsReady; offset += blockSize) {\n // Perform concrete-algorithm logic\n this._doProcessBlock(dataWords, offset);\n } // Remove processed words\n\n\n var processedWords = dataWords.splice(0, nWordsReady);\n data.sigBytes -= nBytesReady;\n } // Return processed words\n\n\n return new WordArray.init(processedWords, nBytesReady);\n },\n\n /**\n * Creates a copy of this object.\n *\n * @return {Object} The clone.\n *\n * @example\n *\n * var clone = bufferedBlockAlgorithm.clone();\n */\n clone: function clone() {\n var clone = Base.clone.call(this);\n clone._data = this._data.clone();\n return clone;\n },\n _minBufferSize: 0\n });\n /**\n * Abstract hasher template.\n *\n * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)\n */\n\n var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({\n /**\n * Configuration options.\n */\n cfg: Base.extend(),\n\n /**\n * Initializes a newly created hasher.\n *\n * @param {Object} cfg (Optional) The configuration options to use for this hash computation.\n *\n * @example\n *\n * var hasher = CryptoJS.algo.SHA256.create();\n */\n init: function init(cfg) {\n // Apply config defaults\n this.cfg = this.cfg.extend(cfg); // Set initial values\n\n this.reset();\n },\n\n /**\n * Resets this hasher to its initial state.\n *\n * @example\n *\n * hasher.reset();\n */\n reset: function reset() {\n // Reset data buffer\n BufferedBlockAlgorithm.reset.call(this); // Perform concrete-hasher logic\n\n this._doReset();\n },\n\n /**\n * Updates this hasher with a message.\n *\n * @param {WordArray|string} messageUpdate The message to append.\n *\n * @return {Hasher} This hasher.\n *\n * @example\n *\n * hasher.update('message');\n * hasher.update(wordArray);\n */\n update: function update(messageUpdate) {\n // Append\n this._append(messageUpdate); // Update the hash\n\n\n this._process(); // Chainable\n\n\n return this;\n },\n\n /**\n * Finalizes the hash computation.\n * Note that the finalize operation is effectively a destructive, read-once operation.\n *\n * @param {WordArray|string} messageUpdate (Optional) A final message update.\n *\n * @return {WordArray} The hash.\n *\n * @example\n *\n * var hash = hasher.finalize();\n * var hash = hasher.finalize('message');\n * var hash = hasher.finalize(wordArray);\n */\n finalize: function finalize(messageUpdate) {\n // Final message update\n if (messageUpdate) {\n this._append(messageUpdate);\n } // Perform concrete-hasher logic\n\n\n var hash = this._doFinalize();\n\n return hash;\n },\n blockSize: 512 / 32,\n\n /**\n * Creates a shortcut function to a hasher's object interface.\n *\n * @param {Hasher} hasher The hasher to create a helper for.\n *\n * @return {Function} The shortcut function.\n *\n * @static\n *\n * @example\n *\n * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);\n */\n _createHelper: function _createHelper(hasher) {\n return function (message, cfg) {\n return new hasher.init(cfg).finalize(message);\n };\n },\n\n /**\n * Creates a shortcut function to the HMAC's object interface.\n *\n * @param {Hasher} hasher The hasher to use in this HMAC helper.\n *\n * @return {Function} The shortcut function.\n *\n * @static\n *\n * @example\n *\n * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);\n */\n _createHmacHelper: function _createHmacHelper(hasher) {\n return function (message, key) {\n return new C_algo.HMAC.init(hasher, key).finalize(message);\n };\n }\n });\n /**\n * Algorithm namespace.\n */\n\n var C_algo = C.algo = {};\n return C;\n }(Math);\n\n return CryptoJS;\n});","'use strict';\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nvar _require = require('buffer'),\n Buffer = _require.Buffer;\n\nvar _require2 = require('util'),\n inspect = _require2.inspect;\n\nvar custom = inspect && inspect.custom || 'inspect';\n\nfunction copyBuffer(src, target, offset) {\n Buffer.prototype.copy.call(src, target, offset);\n}\n\nmodule.exports = /*#__PURE__*/function () {\n function BufferList() {\n _classCallCheck(this, BufferList);\n\n this.head = null;\n this.tail = null;\n this.length = 0;\n }\n\n _createClass(BufferList, [{\n key: \"push\",\n value: function push(v) {\n var entry = {\n data: v,\n next: null\n };\n if (this.length > 0) this.tail.next = entry;else this.head = entry;\n this.tail = entry;\n ++this.length;\n }\n }, {\n key: \"unshift\",\n value: function unshift(v) {\n var entry = {\n data: v,\n next: this.head\n };\n if (this.length === 0) this.tail = entry;\n this.head = entry;\n ++this.length;\n }\n }, {\n key: \"shift\",\n value: function shift() {\n if (this.length === 0) return;\n var ret = this.head.data;\n if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;\n --this.length;\n return ret;\n }\n }, {\n key: \"clear\",\n value: function clear() {\n this.head = this.tail = null;\n this.length = 0;\n }\n }, {\n key: \"join\",\n value: function join(s) {\n if (this.length === 0) return '';\n var p = this.head;\n var ret = '' + p.data;\n\n while (p = p.next) {\n ret += s + p.data;\n }\n\n return ret;\n }\n }, {\n key: \"concat\",\n value: function concat(n) {\n if (this.length === 0) return Buffer.alloc(0);\n var ret = Buffer.allocUnsafe(n >>> 0);\n var p = this.head;\n var i = 0;\n\n while (p) {\n copyBuffer(p.data, ret, i);\n i += p.data.length;\n p = p.next;\n }\n\n return ret;\n } // Consumes a specified amount of bytes or characters from the buffered data.\n\n }, {\n key: \"consume\",\n value: function consume(n, hasStrings) {\n var ret;\n\n if (n < this.head.data.length) {\n // `slice` is the same for buffers and strings.\n ret = this.head.data.slice(0, n);\n this.head.data = this.head.data.slice(n);\n } else if (n === this.head.data.length) {\n // First chunk is a perfect match.\n ret = this.shift();\n } else {\n // Result spans more than one buffer.\n ret = hasStrings ? this._getString(n) : this._getBuffer(n);\n }\n\n return ret;\n }\n }, {\n key: \"first\",\n value: function first() {\n return this.head.data;\n } // Consumes a specified amount of characters from the buffered data.\n\n }, {\n key: \"_getString\",\n value: function _getString(n) {\n var p = this.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n\n while (p = p.next) {\n var str = p.data;\n var nb = n > str.length ? str.length : n;\n if (nb === str.length) ret += str;else ret += str.slice(0, n);\n n -= nb;\n\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next) this.head = p.next;else this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = str.slice(nb);\n }\n\n break;\n }\n\n ++c;\n }\n\n this.length -= c;\n return ret;\n } // Consumes a specified amount of bytes from the buffered data.\n\n }, {\n key: \"_getBuffer\",\n value: function _getBuffer(n) {\n var ret = Buffer.allocUnsafe(n);\n var p = this.head;\n var c = 1;\n p.data.copy(ret);\n n -= p.data.length;\n\n while (p = p.next) {\n var buf = p.data;\n var nb = n > buf.length ? buf.length : n;\n buf.copy(ret, ret.length - n, 0, nb);\n n -= nb;\n\n if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) this.head = p.next;else this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = buf.slice(nb);\n }\n\n break;\n }\n\n ++c;\n }\n\n this.length -= c;\n return ret;\n } // Make sure the linked list only shows the minimal necessary information.\n\n }, {\n key: custom,\n value: function value(_, options) {\n return inspect(this, _objectSpread({}, options, {\n // Only inspect one level.\n depth: 0,\n // It should not recurse.\n customInspect: false\n }));\n }\n }]);\n\n return BufferList;\n}();","import React from \"react\"\nimport { FormattedMessage } from \"gatsby-plugin-intl\"\nimport { CONNECTORS } from \"../store/models/connectors\"\n\nconst NO_COLLECTIONS = \"NoCollections\"\n\nexport const isContentNamespace = (connector, item) => {\n if (connector?.startsWith(CONNECTORS.intercom))\n return item.providerType !== \"article\"\n else\n return !item.parentId && !item.translatable\n}\n\nexport const filterContentByConnector = connector => item => !isContentNamespace(connector, item)\n\nexport const formatNamespaceTitle = (namespace) => {\n if (namespace === NO_COLLECTIONS) {\n return (\n \n )\n }\n\n return namespace\n}\n\nexport const isGroupEnabled = (resourcesExcluded, group, parentExcluded = false) =>\n !parentExcluded && !resourcesExcluded?.find(r => r === group.id || r === group.parentId)\n\nexport const groupByNamespace = (items) => {\n const nest = (items, id = null) =>\n items\n .filter(item => item.parentId === id)\n .map(item => ({\n ...item,\n children: nest(items, item.id).sort((a, b) => {\n if (a.children.length > 0) return 1\n if (b.children.length > 0) return -1\n\n return a.title.localeCompare(b.title, undefined, {\n numeric: true,\n })\n }),\n }))\n\n const groupByNamespace = nest(items).filter(i => i.children.length > 0)\n\n return groupByNamespace\n}\n\nexport const getResourceTypeForConnector = (intl, connector, count) => {\n switch (connector) {\n case CONNECTORS.intercom:\n return intl.formatMessage(\n {\n id: \"helpers.contentResource.article\",\n defaultMessage: \"{count, plural, one {article} other {articles}}\",\n },\n { count }\n )\n default:\n return intl.formatMessage(\n {\n id: \"helpers.contentResource.item\",\n defaultMessage: \"{count, plural, one {item} other {items}}\",\n },\n { count }\n )\n }\n}\n\nexport const getEnabledTotal = (items, resourcesExcluded) =>\n getTotal(items, item => isGroupEnabled(resourcesExcluded, item))\n\nexport const getTotal = (items, filter) => {\n const computed = (groupedResources, sum = 0) => {\n return groupedResources.reduce((sum, group) => {\n const nonParents = group.children.filter(c => c.children.length === 0)\n\n if ((filter && filter(group)) || !filter)\n return computed(group.children, sum + nonParents.length)\n\n return sum\n }, sum)\n }\n\n return computed(items)\n}\n","import store from \"../store/index\"\n\nexport default class OnboardingUpdater {\n constructor({ onboarding, stage, isCompleted }) {\n this._onboarding = onboarding\n this._stage = stage || onboarding.stage\n this._isCompleted = isCompleted || onboarding.isCompleted\n }\n\n static async call(args) {\n return new OnboardingUpdater(args).call()\n }\n\n async call() {\n try {\n switch(this.type()) {\n case \"vendor\":\n await this.updateVendor()\n break;\n case \"organization\":\n default:\n await this.updateOrg()\n }\n return true\n } catch (err) {\n return false\n }\n }\n\n type() {\n return this.organization().id ? \"organization\" : \"vendor\"\n }\n\n id() {\n return this.type() === \"organization\" ? this.organization().id : this.vendor().id\n }\n\n // PRIVATE METHODS\n onboarding() {\n return {\n id: this.id(),\n onboarding: {\n ...this._onboarding.toJSON(),\n stage: this._stage,\n isCompleted: this._isCompleted,\n },\n }\n }\n\n organization() {\n return this._onboarding.organization\n }\n\n vendor() {\n return this._onboarding.vendor\n }\n\n updateOrg() {\n return store.getActions().currentOrg.update(this.onboarding())\n }\n\n updateVendor() {\n return store.getActions().currentVendor.update(this.onboarding())\n }\n}\n","import { path } from \"../config/routes\"\nimport OnboardingUpdater from \"../service/onboardingUpdater\"\nimport { INTEGRATION_MODES } from \"./integrationModes\"\nimport { parse } from \"query-string\"\n\nexport const STAGES = {\n checkout: \"checkout\",\n checkoutSuccess: \"checkoutSuccess\",\n connector: \"connector\",\n connector_install:\"connector-install\",\n congratulations: \"congratulations\",\n integration: \"integration\",\n integrations: \"integrations\",\n newClient: \"newClient\",\n partnerIntegration: \"partnerIntegration\",\n plans: \"plans\",\n profile: \"profile\",\n project: \"project\",\n scheduleOnboarding: \"scheduleOnboarding\",\n team: \"team\",\n welcome: \"welcome\",\n workspace: \"workspace\",\n}\n\nexport const OnboardingRoutes = {\n CHECKOUT: {\n path: \"/checkout/:item_price_id\",\n root: \"/checkout\",\n stage: STAGES.checkout,\n required: true,\n },\n CHECKOUT_SUCCESS: {\n path: \"/checkout-success\",\n root: \"/checkout-success\",\n stage: STAGES.checkoutSuccess,\n required: true,\n },\n INTEGRATION: {\n path: \"/integration\",\n root: \"/integration\",\n stage: STAGES.integration,\n required: true,\n },\n INTEGRATIONS: {\n path: \"/integrations\",\n root: \"/integrations\",\n stage: STAGES.integrations,\n required: true,\n },\n NEW_PROJECT: {\n path: path(\"NEW_PROJECT\"),\n root: \"/new-project\",\n stage: STAGES.project,\n absolute: true,\n },\n PARTNER_INTEGRATION: {\n path: \"/partner-integration\",\n root: \"/partner-integration\",\n stage: STAGES.partnerIntegration,\n required: true,\n },\n PLANS: {\n path: \"/plans\",\n root: \"/plans\",\n stage: STAGES.plans,\n required: true,\n },\n PROFILE: {\n path: \"/profile\",\n root: \"/profile\",\n stage: STAGES.profile,\n required: true,\n },\n SCHEDULE_ONBOARDING: {\n path: \"/schedule-onboarding\",\n root: \"/schedule-onboarding\",\n stage: STAGES.scheduleOnboarding,\n required: true,\n },\n TEAM: {\n path: \"/team\",\n root: \"/team\",\n stage: STAGES.team,\n required: true\n },\n WORKSPACE: {\n path: \"/workspace\",\n root: \"/workspace\",\n stage: STAGES.workspace,\n required: true,\n },\n CONGRATULATIONS: {\n path: \"/congratulations\",\n root: \"/congratulations\",\n stage: STAGES.congratulations,\n required: true,\n },\n CONNECTOR_INSTALL: {\n path: path(\"CONNECTOR_INSTALLER\", { connectorId: parse(typeof location !== \"undefined\" ? location.search : \"\")?.connector }),\n root: \"/connector-installer\",\n stage: STAGES.connector_install,\n absolute: true,\n },\n}\n\nexport const TYPES = {\n addClient: \"addClient\",\n addWorkspace: \"addWorkspace\",\n github: \"github\",\n newUser: \"newUser\",\n partnerVendor: \"partnerVendor\",\n languageTeam: \"languageTeam\",\n}\n\nexport const ADD_WORKSPACE_PATH = [\n STAGES.workspace,\n STAGES.team,\n STAGES.project,\n]\n\nexport const DEFAULT_PATH = [\n STAGES.profile,\n STAGES.workspace,\n STAGES.team,\n STAGES.project,\n]\n\nexport const VENDOR_DEFAULT_PATH = [\n STAGES.workspace,\n STAGES.team,\n STAGES.project,\n]\n\nexport const INTEGRATION_PATH = [\n STAGES.profile,\n STAGES.workspace,\n STAGES.integration,\n STAGES.team,\n STAGES.project,\n]\n\nexport const VENDOR_INTEGRATION_PATH = [\n STAGES.workspace,\n STAGES.integration,\n STAGES.team,\n STAGES.project,\n]\n\nexport const CONNECTOR_SIGNUP_PATH = [\n STAGES.profile,\n STAGES.workspace,\n STAGES.team,\n STAGES.connector_install,\n];\n\nexport const LANGUAGE_TEAM_PATH = [\n STAGES.profile,\n STAGES.workspace,\n STAGES.team,\n STAGES.project,\n];\n\nexport const PARTNER_VENDOR = [\n STAGES.workspace,\n STAGES.team,\n STAGES.partnerIntegration,\n STAGES.plans,\n STAGES.checkout,\n STAGES.scheduleOnboarding,\n STAGES.congratulations\n]\n\nexport const GITHUB_PATH = [STAGES.welcome, STAGES.project]\n\nexport default class Onboarding {\n constructor(attrs) {\n attrs = attrs || {}\n this.organization = attrs.organization || {}\n this.type = attrs.type || TYPES.newUser\n this.pathExclude = attrs.pathExclude || []\n this.stage = attrs.stage || this.path[0]\n this.isCompleted = attrs.isCompleted || false\n this.integrationMode = this.organization?.vendor?.integrationMode || attrs.integrationMode;\n this.vendor = attrs.vendor || {}\n this.partner = attrs.partner\n }\n\n get currentStage() {\n return this.stage\n }\n\n get currentStepNumber() {\n return this.path.indexOf(this.currentStage) + 1\n }\n\n get length() {\n return this.path.length\n }\n\n skipStep(step) {\n this.pathExclude.push(step)\n\n return new Onboarding(this)\n }\n\n getPathOfStep() {\n const route = Object.values(OnboardingRoutes).find(\n route => route.stage === this.stage\n )\n\n return {\n path: route?.path,\n absolute: !!route?.absolute,\n required: !!route?.required,\n newTab: !!route?.newTab,\n }\n }\n\n static getRouteFromLocation(location) {\n return Object.values(OnboardingRoutes).find(\n (route) => route.root === location\n )\n }\n\n getStepFromLocation(location) {\n const route = Onboarding.getRouteFromLocation(location)\n\n return this.path.findIndex((path) => path === route?.stage) + 1\n }\n\n markAsCompleted() {\n OnboardingUpdater.call({\n onboarding: this,\n isCompleted: true,\n })\n\n return new Onboarding({ ...this, isCompleted: true })\n }\n\n setStage(stage, isCompleted) {\n OnboardingUpdater.call({\n onboarding: this,\n stage,\n isCompleted: isCompleted || false,\n })\n\n return new Onboarding({ ...this, stage, isCompleted: isCompleted || false })\n }\n\n moveToNextStage() {\n const route = Object.values(OnboardingRoutes).find(\n route => route.stage === this.nextStage\n )\n\n return this.setStage(route.stage, !route?.required)\n }\n\n moveToBackStage() {\n return this.setStage(this.backStage, this.isCompleted)\n }\n\n\n get nextStage() {\n const nextStep = this.path.indexOf(this.currentStage) + 1\n return this.path[nextStep]\n }\n\n get backStage() {\n const backStep = this.path.indexOf(this.currentStage) - 1\n return this.path[backStep]\n }\n\n getOnboarding(options = {}) {\n const { createWorkspace, addClient, partnerVendor, languageTeam } = options\n\n if(parse(location.search)?.connector){\n return CONNECTOR_SIGNUP_PATH;\n }\n\n if (partnerVendor) {\n return PARTNER_VENDOR;\n }\n\n if (languageTeam) {\n return LANGUAGE_TEAM_PATH;\n }\n\n if (createWorkspace || addClient) {\n return this.integrationMode === INTEGRATION_MODES.dedicated ? VENDOR_INTEGRATION_PATH : VENDOR_DEFAULT_PATH;\n }\n\n return this.integrationMode === INTEGRATION_MODES.dedicated ? INTEGRATION_PATH : DEFAULT_PATH;\n }\n\n get path() {\n let currentPath\n switch (this.type) {\n case TYPES.github:\n currentPath = GITHUB_PATH\n break\n case TYPES.addWorkspace:\n currentPath = this.getOnboarding({ createWorkspace: true })\n break\n case TYPES.addClient:\n currentPath = this.getOnboarding({ addClient: true })\n break\n case TYPES.partnerVendor:\n currentPath = this.getOnboarding({ partnerVendor: true })\n break;\n case TYPES.languageTeam:\n currentPath = this.getOnboarding({ languageTeam: true })\n break;\n default:\n currentPath = this.getOnboarding()\n }\n\n return currentPath.filter(\n path => !this.pathExclude.find(excluded => excluded === path)\n )\n }\n\n toJSON() {\n return {\n stage: this.stage,\n isCompleted: this.isCompleted,\n type: this.type,\n partner: this.partner,\n }\n }\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n'use strict';\n\nmodule.exports = Transform;\n\nvar Duplex = require('./_stream_duplex');\n/**/\n\n\nvar util = Object.create(require('core-util-is'));\nutil.inherits = require('inherits');\n/**/\n\nutil.inherits(Transform, Duplex);\n\nfunction afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n var cb = ts.writecb;\n\n if (!cb) {\n return this.emit('error', new Error('write callback called multiple times'));\n }\n\n ts.writechunk = null;\n ts.writecb = null;\n if (data != null) // single equals check for both `null` and `undefined`\n this.push(data);\n cb(er);\n var rs = this._readableState;\n rs.reading = false;\n\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n}\n\nfunction Transform(options) {\n if (!(this instanceof Transform)) return new Transform(options);\n Duplex.call(this, options);\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n }; // start out asking for a readable event once data is transformed.\n\n this._readableState.needReadable = true; // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n\n this._readableState.sync = false;\n\n if (options) {\n if (typeof options.transform === 'function') this._transform = options.transform;\n if (typeof options.flush === 'function') this._flush = options.flush;\n } // When the writable side finishes, then flush out anything remaining.\n\n\n this.on('prefinish', prefinish);\n}\n\nfunction prefinish() {\n var _this = this;\n\n if (typeof this._flush === 'function') {\n this._flush(function (er, data) {\n done(_this, er, data);\n });\n } else {\n done(this, null, null);\n }\n}\n\nTransform.prototype.push = function (chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n}; // This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\n\n\nTransform.prototype._transform = function (chunk, encoding, cb) {\n throw new Error('_transform() is not implemented');\n};\n\nTransform.prototype._write = function (chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);\n }\n}; // Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\n\n\nTransform.prototype._read = function (n) {\n var ts = this._transformState;\n\n if (ts.writechunk !== null && ts.writecb && !ts.transforming) {\n ts.transforming = true;\n\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\n\nTransform.prototype._destroy = function (err, cb) {\n var _this2 = this;\n\n Duplex.prototype._destroy.call(this, err, function (err2) {\n cb(err2);\n\n _this2.emit('close');\n });\n};\n\nfunction done(stream, er, data) {\n if (er) return stream.emit('error', er);\n if (data != null) // single equals check for both `null` and `undefined`\n stream.push(data); // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n\n if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');\n if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');\n return stream.push(null);\n}","/* @generated */\n// prettier-ignore\nif (Intl.RelativeTimeFormat && typeof Intl.RelativeTimeFormat.__addLocaleData === 'function') {\n Intl.RelativeTimeFormat.__addLocaleData({\n \"data\": {\n \"ses\": {\n \"nu\": [\"latn\"],\n \"year\": {\n \"0\": \"this year\",\n \"1\": \"next year\",\n \"future\": {\n \"other\": \"+{0} y\"\n },\n \"past\": {\n \"other\": \"-{0} y\"\n },\n \"-1\": \"last year\"\n },\n \"year-short\": {\n \"0\": \"this year\",\n \"1\": \"next year\",\n \"future\": {\n \"other\": \"+{0} y\"\n },\n \"past\": {\n \"other\": \"-{0} y\"\n },\n \"-1\": \"last year\"\n },\n \"year-narrow\": {\n \"0\": \"this year\",\n \"1\": \"next year\",\n \"future\": {\n \"other\": \"+{0} y\"\n },\n \"past\": {\n \"other\": \"-{0} y\"\n },\n \"-1\": \"last year\"\n },\n \"quarter\": {\n \"0\": \"this quarter\",\n \"1\": \"next quarter\",\n \"future\": {\n \"other\": \"+{0} Q\"\n },\n \"past\": {\n \"other\": \"-{0} Q\"\n },\n \"-1\": \"last quarter\"\n },\n \"quarter-short\": {\n \"0\": \"this quarter\",\n \"1\": \"next quarter\",\n \"future\": {\n \"other\": \"+{0} Q\"\n },\n \"past\": {\n \"other\": \"-{0} Q\"\n },\n \"-1\": \"last quarter\"\n },\n \"quarter-narrow\": {\n \"0\": \"this quarter\",\n \"1\": \"next quarter\",\n \"future\": {\n \"other\": \"+{0} Q\"\n },\n \"past\": {\n \"other\": \"-{0} Q\"\n },\n \"-1\": \"last quarter\"\n },\n \"month\": {\n \"0\": \"this month\",\n \"1\": \"next month\",\n \"future\": {\n \"other\": \"+{0} m\"\n },\n \"past\": {\n \"other\": \"-{0} m\"\n },\n \"-1\": \"last month\"\n },\n \"month-short\": {\n \"0\": \"this month\",\n \"1\": \"next month\",\n \"future\": {\n \"other\": \"+{0} m\"\n },\n \"past\": {\n \"other\": \"-{0} m\"\n },\n \"-1\": \"last month\"\n },\n \"month-narrow\": {\n \"0\": \"this month\",\n \"1\": \"next month\",\n \"future\": {\n \"other\": \"+{0} m\"\n },\n \"past\": {\n \"other\": \"-{0} m\"\n },\n \"-1\": \"last month\"\n },\n \"week\": {\n \"0\": \"this week\",\n \"1\": \"next week\",\n \"future\": {\n \"other\": \"+{0} w\"\n },\n \"past\": {\n \"other\": \"-{0} w\"\n },\n \"-1\": \"last week\"\n },\n \"week-short\": {\n \"0\": \"this week\",\n \"1\": \"next week\",\n \"future\": {\n \"other\": \"+{0} w\"\n },\n \"past\": {\n \"other\": \"-{0} w\"\n },\n \"-1\": \"last week\"\n },\n \"week-narrow\": {\n \"0\": \"this week\",\n \"1\": \"next week\",\n \"future\": {\n \"other\": \"+{0} w\"\n },\n \"past\": {\n \"other\": \"-{0} w\"\n },\n \"-1\": \"last week\"\n },\n \"day\": {\n \"0\": \"Hõo\",\n \"1\": \"Suba\",\n \"future\": {\n \"other\": \"+{0} d\"\n },\n \"past\": {\n \"other\": \"-{0} d\"\n },\n \"-1\": \"Bi\"\n },\n \"day-short\": {\n \"0\": \"Hõo\",\n \"1\": \"Suba\",\n \"future\": {\n \"other\": \"+{0} d\"\n },\n \"past\": {\n \"other\": \"-{0} d\"\n },\n \"-1\": \"Bi\"\n },\n \"day-narrow\": {\n \"0\": \"Hõo\",\n \"1\": \"Suba\",\n \"future\": {\n \"other\": \"+{0} d\"\n },\n \"past\": {\n \"other\": \"-{0} d\"\n },\n \"-1\": \"Bi\"\n },\n \"hour\": {\n \"0\": \"this hour\",\n \"future\": {\n \"other\": \"+{0} h\"\n },\n \"past\": {\n \"other\": \"-{0} h\"\n }\n },\n \"hour-short\": {\n \"0\": \"this hour\",\n \"future\": {\n \"other\": \"+{0} h\"\n },\n \"past\": {\n \"other\": \"-{0} h\"\n }\n },\n \"hour-narrow\": {\n \"0\": \"this hour\",\n \"future\": {\n \"other\": \"+{0} h\"\n },\n \"past\": {\n \"other\": \"-{0} h\"\n }\n },\n \"minute\": {\n \"0\": \"this minute\",\n \"future\": {\n \"other\": \"+{0} min\"\n },\n \"past\": {\n \"other\": \"-{0} min\"\n }\n },\n \"minute-short\": {\n \"0\": \"this minute\",\n \"future\": {\n \"other\": \"+{0} min\"\n },\n \"past\": {\n \"other\": \"-{0} min\"\n }\n },\n \"minute-narrow\": {\n \"0\": \"this minute\",\n \"future\": {\n \"other\": \"+{0} min\"\n },\n \"past\": {\n \"other\": \"-{0} min\"\n }\n },\n \"second\": {\n \"0\": \"now\",\n \"future\": {\n \"other\": \"+{0} s\"\n },\n \"past\": {\n \"other\": \"-{0} s\"\n }\n },\n \"second-short\": {\n \"0\": \"now\",\n \"future\": {\n \"other\": \"+{0} s\"\n },\n \"past\": {\n \"other\": \"-{0} s\"\n }\n },\n \"second-narrow\": {\n \"0\": \"now\",\n \"future\": {\n \"other\": \"+{0} s\"\n },\n \"past\": {\n \"other\": \"-{0} s\"\n }\n }\n }\n },\n \"availableLocales\": [\"ses\"],\n \"aliases\": {},\n \"parentLocales\": {}\n });\n}","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});","import React, { useEffect } from \"react\"\nimport { useStoreState, useStoreActions } from \"easy-peasy\"\nimport { Link } from \"gatsby-plugin-intl\"\nimport { FormattedMessage, useIntl } from \"gatsby-plugin-intl\"\nimport { path, redirect } from \"../../../config/routes\"\nimport Form from \"../../forms/Form\"\nimport { useForm } from \"react-hook-form\"\nimport { fieldRequired } from \"../../../utils/validations\"\nimport { Button } from \"react-bootstrap\"\nimport { API_CONNECTORS } from \"../../../store/models/connectors\"\nimport { hasApiKey, hasTestApiKey, isEmailable } from \"../../../helpers/project\"\n\nexport const shouldRedirectToSuccess = project =>\n API_CONNECTORS.includes(project.connector.id) && hasApiKey(project.connector.id);\n\nconst Success = ({ projectId }) => {\n const { errors, control, status, setValue } = useForm()\n\n const intl = useIntl()\n const project = useStoreState(state => state.projects.byId(projectId))\n const resetForm = useStoreActions(actions => actions.projectWizard.resetForm)\n\n useEffect(() => {\n return () => resetForm()\n }, [resetForm])\n\n useEffect(() => {\n if (project) {\n setValue(\n \"email\",\n `wpml+${project.liveApiKey?.replace(\"live_\", \"\")}@locale.email`\n )\n setValue(\"project[liveApiKey]\", project.liveApiKey)\n setValue(\"project[testApiKey]\", project.testApiKey)\n }\n }, [project, setValue])\n\n const keyFields = []\n if (isEmailable(project)) {\n keyFields.push({\n name: \"email\",\n type: \"copyToClip\",\n label: intl.formatMessage({\n id: \"components.projects.editForm.fields.email.label\",\n defaultMessage: \"Email address\",\n }),\n description: intl.formatMessage({\n id: \"components.projects.editForm.fields.email.description\",\n defaultMessage: \"The email address to give an access to your project\",\n }),\n plaintext: true,\n readOnly: true,\n validations: { ...fieldRequired },\n })\n keyFields.push({\n name: \"project[liveApiKey]\",\n type: \"hidden\",\n validations: { ...fieldRequired },\n })\n } else {\n keyFields.push({\n name: \"project[liveApiKey]\",\n type: \"copyToClip\",\n label: intl.formatMessage({\n id: \"components.projects.editForm.fields.apiKey.label\",\n defaultMessage: \"Live API key\",\n }),\n moreInfo: `${process.env.API_DOCUMENTATION_URL}/#section/Authentication`,\n validations: { ...fieldRequired },\n })\n if (hasTestApiKey(project)) {\n keyFields.push({\n name: \"project[testApiKey]\",\n type: \"copyToClip\",\n label: intl.formatMessage({\n id: \"components.projects.editForm.fields.testApiKey.label\",\n defaultMessage: \"Test API key\",\n }),\n validations: { ...fieldRequired },\n })\n }\n }\n\n return (\n
\n
\n \n
\n
\n {project} Project is ready to go. Below is the email address to invite that will give us access to your project. You can also find it in your project's `\n : `Your {project} Project is ready to go. Below are your API key. Keep it safe. You can also find it in your project's `,\n },\n {\n project: project.name,\n }\n ),\n }}\n />\n \n \n \n \n .\n \n
\n
\n \n
\n \n
\n )\n}\n\nexport default Success\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport classNames from 'classnames';\nimport React from 'react';\nimport { useBootstrapPrefix } from './ThemeProvider';\nvar DEVICE_SIZES = ['xl', 'lg', 'md', 'sm', 'xs'];\nvar Col = /*#__PURE__*/React.forwardRef( // Need to define the default \"as\" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595\nfunction (_ref, ref) {\n var bsPrefix = _ref.bsPrefix,\n className = _ref.className,\n _ref$as = _ref.as,\n Component = _ref$as === void 0 ? 'div' : _ref$as,\n props = _objectWithoutPropertiesLoose(_ref, [\"bsPrefix\", \"className\", \"as\"]);\n\n var prefix = useBootstrapPrefix(bsPrefix, 'col');\n var spans = [];\n var classes = [];\n DEVICE_SIZES.forEach(function (brkPoint) {\n var propValue = props[brkPoint];\n delete props[brkPoint];\n var span;\n var offset;\n var order;\n\n if (typeof propValue === 'object' && propValue != null) {\n var _propValue$span = propValue.span;\n span = _propValue$span === void 0 ? true : _propValue$span;\n offset = propValue.offset;\n order = propValue.order;\n } else {\n span = propValue;\n }\n\n var infix = brkPoint !== 'xs' ? \"-\" + brkPoint : '';\n if (span) spans.push(span === true ? \"\" + prefix + infix : \"\" + prefix + infix + \"-\" + span);\n if (order != null) classes.push(\"order\" + infix + \"-\" + order);\n if (offset != null) classes.push(\"offset\" + infix + \"-\" + offset);\n });\n\n if (!spans.length) {\n spans.push(prefix); // plain 'col'\n }\n\n return /*#__PURE__*/React.createElement(Component, _extends({}, props, {\n ref: ref,\n className: classNames.apply(void 0, [className].concat(spans, classes))\n }));\n});\nCol.displayName = 'Col';\nexport default Col;","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nimport { ConsoleLogger as Logger } from '../Logger';\nvar logger = new Logger('I18n');\n/**\n * Language transition class\n */\n\nvar I18n =\n/** @class */\nfunction () {\n /**\n * @constructor\n * Initialize with configurations\n * @param {Object} options\n */\n function I18n(options) {\n /**\n * @private\n */\n this._options = null;\n /**\n * @private\n */\n\n this._lang = null;\n /**\n * @private\n */\n\n this._dict = {};\n this._options = Object.assign({}, options);\n this._lang = this._options.language;\n\n if (!this._lang && typeof window !== 'undefined' && window && window.navigator) {\n this._lang = window.navigator.language;\n }\n\n logger.debug(this._lang);\n }\n /**\n * @method\n * Explicitly setting language\n * @param {String} lang\n */\n\n\n I18n.prototype.setLanguage = function (lang) {\n this._lang = lang;\n };\n /**\n * @method\n * Get value\n * @param {String} key\n * @param {String} defVal - Default value\n */\n\n\n I18n.prototype.get = function (key, defVal) {\n if (defVal === void 0) {\n defVal = undefined;\n }\n\n if (!this._lang) {\n return typeof defVal !== 'undefined' ? defVal : key;\n }\n\n var lang = this._lang;\n var val = this.getByLanguage(key, lang);\n\n if (val) {\n return val;\n }\n\n if (lang.indexOf('-') > 0) {\n val = this.getByLanguage(key, lang.split('-')[0]);\n }\n\n if (val) {\n return val;\n }\n\n return typeof defVal !== 'undefined' ? defVal : key;\n };\n /**\n * @method\n * Get value according to specified language\n * @param {String} key\n * @param {String} language - Specified langurage to be used\n * @param {String} defVal - Default value\n */\n\n\n I18n.prototype.getByLanguage = function (key, language, defVal) {\n if (defVal === void 0) {\n defVal = null;\n }\n\n if (!language) {\n return defVal;\n }\n\n var lang_dict = this._dict[language];\n\n if (!lang_dict) {\n return defVal;\n }\n\n return lang_dict[key];\n };\n /**\n * @method\n * Add vocabularies for one language\n * @param {String} language - Language of the dictionary\n * @param {Object} vocabularies - Object that has key-value as dictionary entry\n */\n\n\n I18n.prototype.putVocabulariesForLanguage = function (language, vocabularies) {\n var lang_dict = this._dict[language];\n\n if (!lang_dict) {\n lang_dict = this._dict[language] = {};\n }\n\n Object.assign(lang_dict, vocabularies);\n };\n /**\n * @method\n * Add vocabularies for one language\n * @param {Object} vocabularies - Object that has language as key,\n * vocabularies of each language as value\n */\n\n\n I18n.prototype.putVocabularies = function (vocabularies) {\n var _this = this;\n\n Object.keys(vocabularies).map(function (key) {\n _this.putVocabulariesForLanguage(key, vocabularies[key]);\n });\n };\n\n return I18n;\n}();\n\nexport { I18n };","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nimport { I18n as I18nClass } from './I18n';\nimport { ConsoleLogger as Logger } from '../Logger';\nimport { Amplify } from '../Amplify';\nvar logger = new Logger('I18n');\nvar _config = null;\nvar _i18n = null;\n/**\n * Export I18n APIs\n */\n\nvar I18n =\n/** @class */\nfunction () {\n function I18n() {}\n /**\n * @static\n * @method\n * Configure I18n part\n * @param {Object} config - Configuration of the I18n\n */\n\n\n I18n.configure = function (config) {\n logger.debug('configure I18n');\n\n if (!config) {\n return _config;\n }\n\n _config = Object.assign({}, _config, config.I18n || config);\n I18n.createInstance();\n return _config;\n };\n\n I18n.getModuleName = function () {\n return 'I18n';\n };\n /**\n * @static\n * @method\n * Create an instance of I18n for the library\n */\n\n\n I18n.createInstance = function () {\n logger.debug('create I18n instance');\n\n if (_i18n) {\n return;\n }\n\n _i18n = new I18nClass(_config);\n };\n /**\n * @static @method\n * Explicitly setting language\n * @param {String} lang\n */\n\n\n I18n.setLanguage = function (lang) {\n I18n.checkConfig();\n return _i18n.setLanguage(lang);\n };\n /**\n * @static @method\n * Get value\n * @param {String} key\n * @param {String} defVal - Default value\n */\n\n\n I18n.get = function (key, defVal) {\n if (!I18n.checkConfig()) {\n return typeof defVal === 'undefined' ? key : defVal;\n }\n\n return _i18n.get(key, defVal);\n };\n /**\n * @static\n * @method\n * Add vocabularies for one language\n * @param {String} langurage - Language of the dictionary\n * @param {Object} vocabularies - Object that has key-value as dictionary entry\n */\n\n\n I18n.putVocabulariesForLanguage = function (language, vocabularies) {\n I18n.checkConfig();\n return _i18n.putVocabulariesForLanguage(language, vocabularies);\n };\n /**\n * @static\n * @method\n * Add vocabularies for one language\n * @param {Object} vocabularies - Object that has language as key,\n * vocabularies of each language as value\n */\n\n\n I18n.putVocabularies = function (vocabularies) {\n I18n.checkConfig();\n return _i18n.putVocabularies(vocabularies);\n };\n\n I18n.checkConfig = function () {\n if (!_i18n) {\n _i18n = new I18nClass(_config);\n }\n\n return true;\n };\n\n return I18n;\n}();\n\nexport { I18n };\nAmplify.register(I18n);\n/**\n * @deprecated use named import\n */\n\nexport default I18n;","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport classNames from 'classnames';\nimport React, { cloneElement } from 'react';\nimport { useBootstrapPrefix } from './ThemeProvider';\nimport { map } from './ElementChildren';\nvar ROUND_PRECISION = 1000;\n/**\n * Validate that children, if any, are instances of ``.\n */\n\nfunction onlyProgressBar(props, propName, componentName) {\n var children = props[propName];\n\n if (!children) {\n return null;\n }\n\n var error = null;\n React.Children.forEach(children, function (child) {\n if (error) {\n return;\n }\n /**\n * Compare types in a way that works with libraries that patch and proxy\n * components like react-hot-loader.\n *\n * see https://github.com/gaearon/react-hot-loader#checking-element-types\n */\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n\n\n var element = /*#__PURE__*/React.createElement(ProgressBar, null);\n if (child.type === element.type) return;\n var childType = child.type;\n var childIdentifier = /*#__PURE__*/React.isValidElement(child) ? childType.displayName || childType.name || childType : child;\n error = new Error(\"Children of \" + componentName + \" can contain only ProgressBar \" + (\"components. Found \" + childIdentifier + \".\"));\n });\n return error;\n}\n\nvar defaultProps = {\n min: 0,\n max: 100,\n animated: false,\n isChild: false,\n srOnly: false,\n striped: false\n};\n\nfunction getPercentage(now, min, max) {\n var percentage = (now - min) / (max - min) * 100;\n return Math.round(percentage * ROUND_PRECISION) / ROUND_PRECISION;\n}\n\nfunction renderProgressBar(_ref, ref) {\n var _classNames;\n\n var min = _ref.min,\n now = _ref.now,\n max = _ref.max,\n label = _ref.label,\n srOnly = _ref.srOnly,\n striped = _ref.striped,\n animated = _ref.animated,\n className = _ref.className,\n style = _ref.style,\n variant = _ref.variant,\n bsPrefix = _ref.bsPrefix,\n props = _objectWithoutPropertiesLoose(_ref, [\"min\", \"now\", \"max\", \"label\", \"srOnly\", \"striped\", \"animated\", \"className\", \"style\", \"variant\", \"bsPrefix\"]);\n\n return /*#__PURE__*/React.createElement(\"div\", _extends({\n ref: ref\n }, props, {\n role: \"progressbar\",\n className: classNames(className, bsPrefix + \"-bar\", (_classNames = {}, _classNames[\"bg-\" + variant] = variant, _classNames[bsPrefix + \"-bar-animated\"] = animated, _classNames[bsPrefix + \"-bar-striped\"] = animated || striped, _classNames)),\n style: _extends({\n width: getPercentage(now, min, max) + \"%\"\n }, style),\n \"aria-valuenow\": now,\n \"aria-valuemin\": min,\n \"aria-valuemax\": max\n }), srOnly ? /*#__PURE__*/React.createElement(\"span\", {\n className: \"sr-only\"\n }, label) : label);\n}\n\nvar ProgressBar = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {\n var isChild = _ref2.isChild,\n props = _objectWithoutPropertiesLoose(_ref2, [\"isChild\"]);\n\n props.bsPrefix = useBootstrapPrefix(props.bsPrefix, 'progress');\n\n if (isChild) {\n return renderProgressBar(props, ref);\n }\n\n var min = props.min,\n now = props.now,\n max = props.max,\n label = props.label,\n srOnly = props.srOnly,\n striped = props.striped,\n animated = props.animated,\n bsPrefix = props.bsPrefix,\n variant = props.variant,\n className = props.className,\n children = props.children,\n wrapperProps = _objectWithoutPropertiesLoose(props, [\"min\", \"now\", \"max\", \"label\", \"srOnly\", \"striped\", \"animated\", \"bsPrefix\", \"variant\", \"className\", \"children\"]);\n\n return /*#__PURE__*/React.createElement(\"div\", _extends({\n ref: ref\n }, wrapperProps, {\n className: classNames(className, bsPrefix)\n }), children ? map(children, function (child) {\n return /*#__PURE__*/cloneElement(child, {\n isChild: true\n });\n }) : renderProgressBar({\n min: min,\n now: now,\n max: max,\n label: label,\n srOnly: srOnly,\n striped: striped,\n animated: animated,\n bsPrefix: bsPrefix,\n variant: variant\n }, ref));\n});\nProgressBar.displayName = 'ProgressBar';\nProgressBar.defaultProps = defaultProps;\nexport default ProgressBar;","import React from 'react';\n/**\n * Iterates through children that are typically specified as `props.children`,\n * but only maps over children that are \"valid elements\".\n *\n * The mapFunction provided index will be normalised to the components mapped,\n * so an invalid component would not increase the index.\n *\n */\n\nfunction map(children, func) {\n var index = 0;\n return React.Children.map(children, function (child) {\n return /*#__PURE__*/React.isValidElement(child) ? func(child, index++) : child;\n });\n}\n/**\n * Iterates through children that are \"valid elements\".\n *\n * The provided forEachFunc(child, index) will be called for each\n * leaf child with the index reflecting the position relative to \"valid components\".\n */\n\n\nfunction forEach(children, func) {\n var index = 0;\n React.Children.forEach(children, function (child) {\n if ( /*#__PURE__*/React.isValidElement(child)) func(child, index++);\n });\n}\n\nexport { map, forEach };","/* @generated */\n// prettier-ignore\nif (Intl.RelativeTimeFormat && typeof Intl.RelativeTimeFormat.__addLocaleData === 'function') {\n Intl.RelativeTimeFormat.__addLocaleData({\n \"data\": {\n \"fr-CA\": {\n \"quarter\": {\n \"0\": \"ce trimestre-ci\",\n \"1\": \"le trimestre prochain\",\n \"future\": {\n \"one\": \"dans {0} trimestre\",\n \"other\": \"dans {0} trimestres\"\n },\n \"past\": {\n \"one\": \"il y a {0} trimestre\",\n \"other\": \"il y a {0} trimestres\"\n },\n \"-1\": \"le trimestre dernier\"\n },\n \"quarter-short\": {\n \"0\": \"ce trim.\",\n \"1\": \"trim. prochain\",\n \"future\": {\n \"one\": \"dans {0} trim.\",\n \"other\": \"dans {0} trim.\"\n },\n \"past\": {\n \"one\": \"il y a {0} trim.\",\n \"other\": \"il y a {0} trim.\"\n },\n \"-1\": \"trim. dernier\"\n },\n \"quarter-narrow\": {\n \"0\": \"ce trim.\",\n \"1\": \"trim.prochain\",\n \"future\": {\n \"one\": \"+{0} trim.\",\n \"other\": \"+{0} trim.\"\n },\n \"past\": {\n \"one\": \"-{0} trim.\",\n \"other\": \"-{0} trim.\"\n },\n \"-1\": \"trim. dernier\"\n },\n \"second-narrow\": {\n \"0\": \"maintenant\",\n \"future\": {\n \"one\": \"+ {0} s\",\n \"other\": \"+{0} s\"\n },\n \"past\": {\n \"one\": \"-{0} s\",\n \"other\": \"-{0} s\"\n }\n }\n },\n \"fr\": {\n \"nu\": [\"latn\"],\n \"year\": {\n \"0\": \"cette année\",\n \"1\": \"l’année prochaine\",\n \"future\": {\n \"one\": \"dans {0} an\",\n \"other\": \"dans {0} ans\"\n },\n \"past\": {\n \"one\": \"il y a {0} an\",\n \"other\": \"il y a {0} ans\"\n },\n \"-1\": \"l’année dernière\"\n },\n \"year-short\": {\n \"0\": \"cette année\",\n \"1\": \"l’année prochaine\",\n \"future\": {\n \"one\": \"dans {0} a\",\n \"other\": \"dans {0} a\"\n },\n \"past\": {\n \"one\": \"il y a {0} a\",\n \"other\": \"il y a {0} a\"\n },\n \"-1\": \"l’année dernière\"\n },\n \"year-narrow\": {\n \"0\": \"cette année\",\n \"1\": \"l’année prochaine\",\n \"future\": {\n \"one\": \"+{0} a\",\n \"other\": \"+{0} a\"\n },\n \"past\": {\n \"one\": \"-{0} a\",\n \"other\": \"-{0} a\"\n },\n \"-1\": \"l’année dernière\"\n },\n \"quarter\": {\n \"0\": \"ce trimestre\",\n \"1\": \"le trimestre prochain\",\n \"future\": {\n \"one\": \"dans {0} trimestre\",\n \"other\": \"dans {0} trimestres\"\n },\n \"past\": {\n \"one\": \"il y a {0} trimestre\",\n \"other\": \"il y a {0} trimestres\"\n },\n \"-1\": \"le trimestre dernier\"\n },\n \"quarter-short\": {\n \"0\": \"ce trimestre\",\n \"1\": \"le trimestre prochain\",\n \"future\": {\n \"one\": \"dans {0} trim.\",\n \"other\": \"dans {0} trim.\"\n },\n \"past\": {\n \"one\": \"il y a {0} trim.\",\n \"other\": \"il y a {0} trim.\"\n },\n \"-1\": \"le trimestre dernier\"\n },\n \"quarter-narrow\": {\n \"0\": \"ce trimestre\",\n \"1\": \"le trimestre prochain\",\n \"future\": {\n \"one\": \"+{0} trim.\",\n \"other\": \"+{0} trim.\"\n },\n \"past\": {\n \"one\": \"-{0} trim.\",\n \"other\": \"-{0} trim.\"\n },\n \"-1\": \"le trimestre dernier\"\n },\n \"month\": {\n \"0\": \"ce mois-ci\",\n \"1\": \"le mois prochain\",\n \"future\": {\n \"one\": \"dans {0} mois\",\n \"other\": \"dans {0} mois\"\n },\n \"past\": {\n \"one\": \"il y a {0} mois\",\n \"other\": \"il y a {0} mois\"\n },\n \"-1\": \"le mois dernier\"\n },\n \"month-short\": {\n \"0\": \"ce mois-ci\",\n \"1\": \"le mois prochain\",\n \"future\": {\n \"one\": \"dans {0} m.\",\n \"other\": \"dans {0} m.\"\n },\n \"past\": {\n \"one\": \"il y a {0} m.\",\n \"other\": \"il y a {0} m.\"\n },\n \"-1\": \"le mois dernier\"\n },\n \"month-narrow\": {\n \"0\": \"ce mois-ci\",\n \"1\": \"le mois prochain\",\n \"future\": {\n \"one\": \"+{0} m.\",\n \"other\": \"+{0} m.\"\n },\n \"past\": {\n \"one\": \"-{0} m.\",\n \"other\": \"-{0} m.\"\n },\n \"-1\": \"le mois dernier\"\n },\n \"week\": {\n \"0\": \"cette semaine\",\n \"1\": \"la semaine prochaine\",\n \"future\": {\n \"one\": \"dans {0} semaine\",\n \"other\": \"dans {0} semaines\"\n },\n \"past\": {\n \"one\": \"il y a {0} semaine\",\n \"other\": \"il y a {0} semaines\"\n },\n \"-1\": \"la semaine dernière\"\n },\n \"week-short\": {\n \"0\": \"cette semaine\",\n \"1\": \"la semaine prochaine\",\n \"future\": {\n \"one\": \"dans {0} sem.\",\n \"other\": \"dans {0} sem.\"\n },\n \"past\": {\n \"one\": \"il y a {0} sem.\",\n \"other\": \"il y a {0} sem.\"\n },\n \"-1\": \"la semaine dernière\"\n },\n \"week-narrow\": {\n \"0\": \"cette semaine\",\n \"1\": \"la semaine prochaine\",\n \"future\": {\n \"one\": \"+{0} sem.\",\n \"other\": \"+{0} sem.\"\n },\n \"past\": {\n \"one\": \"-{0} sem.\",\n \"other\": \"-{0} sem.\"\n },\n \"-1\": \"la semaine dernière\"\n },\n \"day\": {\n \"0\": \"aujourd’hui\",\n \"1\": \"demain\",\n \"2\": \"après-demain\",\n \"future\": {\n \"one\": \"dans {0} jour\",\n \"other\": \"dans {0} jours\"\n },\n \"past\": {\n \"one\": \"il y a {0} jour\",\n \"other\": \"il y a {0} jours\"\n },\n \"-2\": \"avant-hier\",\n \"-1\": \"hier\"\n },\n \"day-short\": {\n \"0\": \"aujourd’hui\",\n \"1\": \"demain\",\n \"2\": \"après-demain\",\n \"future\": {\n \"one\": \"dans {0} j\",\n \"other\": \"dans {0} j\"\n },\n \"past\": {\n \"one\": \"il y a {0} j\",\n \"other\": \"il y a {0} j\"\n },\n \"-2\": \"avant-hier\",\n \"-1\": \"hier\"\n },\n \"day-narrow\": {\n \"0\": \"aujourd’hui\",\n \"1\": \"demain\",\n \"2\": \"après-demain\",\n \"future\": {\n \"one\": \"+{0} j\",\n \"other\": \"+{0} j\"\n },\n \"past\": {\n \"one\": \"-{0} j\",\n \"other\": \"-{0} j\"\n },\n \"-2\": \"avant-hier\",\n \"-1\": \"hier\"\n },\n \"hour\": {\n \"0\": \"cette heure-ci\",\n \"future\": {\n \"one\": \"dans {0} heure\",\n \"other\": \"dans {0} heures\"\n },\n \"past\": {\n \"one\": \"il y a {0} heure\",\n \"other\": \"il y a {0} heures\"\n }\n },\n \"hour-short\": {\n \"0\": \"cette heure-ci\",\n \"future\": {\n \"one\": \"dans {0} h\",\n \"other\": \"dans {0} h\"\n },\n \"past\": {\n \"one\": \"il y a {0} h\",\n \"other\": \"il y a {0} h\"\n }\n },\n \"hour-narrow\": {\n \"0\": \"cette heure-ci\",\n \"future\": {\n \"one\": \"+{0} h\",\n \"other\": \"+{0} h\"\n },\n \"past\": {\n \"one\": \"-{0} h\",\n \"other\": \"-{0} h\"\n }\n },\n \"minute\": {\n \"0\": \"cette minute-ci\",\n \"future\": {\n \"one\": \"dans {0} minute\",\n \"other\": \"dans {0} minutes\"\n },\n \"past\": {\n \"one\": \"il y a {0} minute\",\n \"other\": \"il y a {0} minutes\"\n }\n },\n \"minute-short\": {\n \"0\": \"cette minute-ci\",\n \"future\": {\n \"one\": \"dans {0} min\",\n \"other\": \"dans {0} min\"\n },\n \"past\": {\n \"one\": \"il y a {0} min\",\n \"other\": \"il y a {0} min\"\n }\n },\n \"minute-narrow\": {\n \"0\": \"cette minute-ci\",\n \"future\": {\n \"one\": \"+{0} min\",\n \"other\": \"+{0} min\"\n },\n \"past\": {\n \"one\": \"-{0} min\",\n \"other\": \"-{0} min\"\n }\n },\n \"second\": {\n \"0\": \"maintenant\",\n \"future\": {\n \"one\": \"dans {0} seconde\",\n \"other\": \"dans {0} secondes\"\n },\n \"past\": {\n \"one\": \"il y a {0} seconde\",\n \"other\": \"il y a {0} secondes\"\n }\n },\n \"second-short\": {\n \"0\": \"maintenant\",\n \"future\": {\n \"one\": \"dans {0} s\",\n \"other\": \"dans {0} s\"\n },\n \"past\": {\n \"one\": \"il y a {0} s\",\n \"other\": \"il y a {0} s\"\n }\n },\n \"second-narrow\": {\n \"0\": \"maintenant\",\n \"future\": {\n \"one\": \"+{0} s\",\n \"other\": \"+{0} s\"\n },\n \"past\": {\n \"one\": \"-{0} s\",\n \"other\": \"-{0} s\"\n }\n }\n }\n },\n \"availableLocales\": [\"fr-BE\", \"fr-BF\", \"fr-BI\", \"fr-BJ\", \"fr-BL\", \"fr-CA\", \"fr-CD\", \"fr-CF\", \"fr-CG\", \"fr-CH\", \"fr-CI\", \"fr-CM\", \"fr-DJ\", \"fr-DZ\", \"fr-GA\", \"fr-GF\", \"fr-GN\", \"fr-GP\", \"fr-GQ\", \"fr-HT\", \"fr-KM\", \"fr-LU\", \"fr-MA\", \"fr-MC\", \"fr-MF\", \"fr-MG\", \"fr-ML\", \"fr-MQ\", \"fr-MR\", \"fr-MU\", \"fr-NC\", \"fr-NE\", \"fr-PF\", \"fr-PM\", \"fr-RE\", \"fr-RW\", \"fr-SC\", \"fr-SN\", \"fr-SY\", \"fr-TD\", \"fr-TG\", \"fr-TN\", \"fr-VU\", \"fr-WF\", \"fr-YT\", \"fr\"],\n \"aliases\": {},\n \"parentLocales\": {}\n });\n}","import React from 'react'; // TODO: check\n\nvar ToastContext = /*#__PURE__*/React.createContext({\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onClose: function onClose() {}\n});\nexport default ToastContext;","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport classNames from 'classnames';\nimport React, { useContext } from 'react';\nimport useEventCallback from '@restart/hooks/useEventCallback';\nimport { useBootstrapPrefix } from './ThemeProvider';\nimport CloseButton from './CloseButton';\nimport ToastContext from './ToastContext';\nvar defaultProps = {\n closeLabel: 'Close',\n closeButton: true\n};\nvar ToastHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {\n var bsPrefix = _ref.bsPrefix,\n closeLabel = _ref.closeLabel,\n closeButton = _ref.closeButton,\n className = _ref.className,\n children = _ref.children,\n props = _objectWithoutPropertiesLoose(_ref, [\"bsPrefix\", \"closeLabel\", \"closeButton\", \"className\", \"children\"]);\n\n bsPrefix = useBootstrapPrefix(bsPrefix, 'toast-header');\n var context = useContext(ToastContext);\n var handleClick = useEventCallback(function (e) {\n if (context && context.onClose) {\n context.onClose(e);\n }\n });\n return /*#__PURE__*/React.createElement(\"div\", _extends({\n ref: ref\n }, props, {\n className: classNames(bsPrefix, className)\n }), children, closeButton && /*#__PURE__*/React.createElement(CloseButton, {\n label: closeLabel,\n onClick: handleClick,\n className: \"ml-2 mb-1\",\n \"data-dismiss\": \"toast\"\n }));\n});\nToastHeader.displayName = 'ToastHeader';\nToastHeader.defaultProps = defaultProps;\nexport default ToastHeader;","import createWithBsPrefix from './createWithBsPrefix';\nexport default createWithBsPrefix('toast-body');","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport React, { useEffect, useMemo, useRef, useCallback } from 'react';\nimport classNames from 'classnames';\nimport useTimeout from '@restart/hooks/useTimeout';\nimport Fade from './Fade';\nimport ToastHeader from './ToastHeader';\nimport ToastBody from './ToastBody';\nimport { useBootstrapPrefix } from './ThemeProvider';\nimport ToastContext from './ToastContext';\nvar Toast = /*#__PURE__*/React.forwardRef(function (_ref, ref) {\n var bsPrefix = _ref.bsPrefix,\n className = _ref.className,\n children = _ref.children,\n _ref$transition = _ref.transition,\n Transition = _ref$transition === void 0 ? Fade : _ref$transition,\n _ref$show = _ref.show,\n show = _ref$show === void 0 ? true : _ref$show,\n _ref$animation = _ref.animation,\n animation = _ref$animation === void 0 ? true : _ref$animation,\n _ref$delay = _ref.delay,\n delay = _ref$delay === void 0 ? 3000 : _ref$delay,\n _ref$autohide = _ref.autohide,\n autohide = _ref$autohide === void 0 ? false : _ref$autohide,\n onClose = _ref.onClose,\n props = _objectWithoutPropertiesLoose(_ref, [\"bsPrefix\", \"className\", \"children\", \"transition\", \"show\", \"animation\", \"delay\", \"autohide\", \"onClose\"]);\n\n bsPrefix = useBootstrapPrefix(bsPrefix, 'toast'); // We use refs for these, because we don't want to restart the autohide\n // timer in case these values change.\n\n var delayRef = useRef(delay);\n var onCloseRef = useRef(onClose);\n useEffect(function () {\n delayRef.current = delay;\n onCloseRef.current = onClose;\n }, [delay, onClose]);\n var autohideTimeout = useTimeout();\n var autohideToast = !!(autohide && show);\n var autohideFunc = useCallback(function () {\n if (autohideToast) {\n onCloseRef.current == null ? void 0 : onCloseRef.current();\n }\n }, [autohideToast]);\n useEffect(function () {\n // Only reset timer if show or autohide changes.\n autohideTimeout.set(autohideFunc, delayRef.current);\n }, [autohideTimeout, autohideFunc]);\n var toastContext = useMemo(function () {\n return {\n onClose: onClose\n };\n }, [onClose]);\n var hasAnimation = !!(Transition && animation);\n var toast = /*#__PURE__*/React.createElement(\"div\", _extends({}, props, {\n ref: ref,\n className: classNames(bsPrefix, className, !hasAnimation && (show ? 'show' : 'hide')),\n role: \"alert\",\n \"aria-live\": \"assertive\",\n \"aria-atomic\": \"true\"\n }), children);\n return /*#__PURE__*/React.createElement(ToastContext.Provider, {\n value: toastContext\n }, hasAnimation && Transition ? /*#__PURE__*/React.createElement(Transition, {\n in: show,\n unmountOnExit: true\n }, toast) : toast);\n});\nToast.displayName = 'Toast';\nexport default Object.assign(Toast, {\n Body: ToastBody,\n Header: ToastHeader\n});","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.DisplayNames = void 0;\n\nvar tslib_1 = require(\"tslib\");\n\nvar ecma402_abstract_1 = require(\"@formatjs/ecma402-abstract\");\n\nvar DisplayNames =\n/** @class */\nfunction () {\n function DisplayNames(locales, options) {\n var _newTarget = this.constructor;\n\n if (_newTarget === undefined) {\n throw TypeError(\"Constructor Intl.DisplayNames requires 'new'\");\n }\n\n var requestedLocales = ecma402_abstract_1.CanonicalizeLocaleList(locales);\n options = ecma402_abstract_1.ToObject(options);\n var opt = Object.create(null);\n var localeData = DisplayNames.localeData;\n var matcher = ecma402_abstract_1.GetOption(options, 'localeMatcher', 'string', ['lookup', 'best fit'], 'best fit');\n opt.localeMatcher = matcher;\n var r = ecma402_abstract_1.ResolveLocale(DisplayNames.availableLocales, requestedLocales, opt, [], // there is no relevantExtensionKeys\n DisplayNames.localeData, DisplayNames.getDefaultLocale);\n var style = ecma402_abstract_1.GetOption(options, 'style', 'string', ['narrow', 'short', 'long'], 'long');\n setSlot(this, 'style', style);\n var type = ecma402_abstract_1.GetOption(options, 'type', 'string', ['language', 'currency', 'region', 'script'], undefined);\n\n if (type === undefined) {\n throw TypeError(\"Intl.DisplayNames constructor requires \\\"type\\\" option\");\n }\n\n setSlot(this, 'type', type);\n var fallback = ecma402_abstract_1.GetOption(options, 'fallback', 'string', ['code', 'none'], 'code');\n setSlot(this, 'fallback', fallback);\n setSlot(this, 'locale', r.locale);\n var dataLocale = r.dataLocale;\n var dataLocaleData = localeData[dataLocale];\n ecma402_abstract_1.invariant(!!dataLocaleData, \"Missing locale data for \" + dataLocale);\n setSlot(this, 'localeData', dataLocaleData);\n ecma402_abstract_1.invariant(dataLocaleData !== undefined, \"locale data for \" + r.locale + \" does not exist.\");\n var types = dataLocaleData.types;\n ecma402_abstract_1.invariant(typeof types === 'object' && types != null, 'invalid types data');\n var typeFields = types[type];\n ecma402_abstract_1.invariant(typeof typeFields === 'object' && typeFields != null, 'invalid typeFields data');\n var styleFields = typeFields[style];\n ecma402_abstract_1.invariant(typeof styleFields === 'object' && styleFields != null, 'invalid styleFields data');\n setSlot(this, 'fields', styleFields);\n }\n\n DisplayNames.supportedLocalesOf = function (locales, options) {\n return ecma402_abstract_1.SupportedLocales(DisplayNames.availableLocales, ecma402_abstract_1.CanonicalizeLocaleList(locales), options);\n };\n\n DisplayNames.__addLocaleData = function () {\n var data = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n data[_i] = arguments[_i];\n }\n\n for (var _a = 0, data_1 = data; _a < data_1.length; _a++) {\n var _b = data_1[_a],\n d = _b.data,\n locale = _b.locale;\n var minimizedLocale = new Intl.Locale(locale).minimize().toString();\n DisplayNames.localeData[locale] = DisplayNames.localeData[minimizedLocale] = d;\n DisplayNames.availableLocales.add(minimizedLocale);\n DisplayNames.availableLocales.add(locale);\n\n if (!DisplayNames.__defaultLocale) {\n DisplayNames.__defaultLocale = minimizedLocale;\n }\n }\n };\n\n DisplayNames.prototype.of = function (code) {\n checkReceiver(this, 'of');\n var type = getSlot(this, 'type');\n var codeAsString = ecma402_abstract_1.ToString(code);\n\n if (!isValidCodeForDisplayNames(type, codeAsString)) {\n throw RangeError('invalid code for Intl.DisplayNames.prototype.of');\n }\n\n var _a = ecma402_abstract_1.getMultiInternalSlots(__INTERNAL_SLOT_MAP__, this, 'localeData', 'style', 'fallback'),\n localeData = _a.localeData,\n style = _a.style,\n fallback = _a.fallback; // Canonicalize the case.\n\n\n var canonicalCode; // This is only used to store extracted language region.\n\n var regionSubTag;\n\n switch (type) {\n // Normalize the locale id and remove the region.\n case 'language':\n {\n canonicalCode = ecma402_abstract_1.CanonicalizeLocaleList(codeAsString)[0];\n var regionMatch = /-([a-z]{2}|\\d{3})\\b/i.exec(canonicalCode);\n\n if (regionMatch) {\n // Remove region subtag\n canonicalCode = canonicalCode.substring(0, regionMatch.index) + canonicalCode.substring(regionMatch.index + regionMatch[0].length);\n regionSubTag = regionMatch[1];\n }\n\n break;\n }\n // currency code should be all upper-case.\n\n case 'currency':\n canonicalCode = codeAsString.toUpperCase();\n break;\n // script code should be title case\n\n case 'script':\n canonicalCode = codeAsString[0] + codeAsString.substring(1).toLowerCase();\n break;\n // region shold be all upper-case\n\n case 'region':\n canonicalCode = codeAsString.toUpperCase();\n break;\n }\n\n var typesData = localeData.types[type]; // If the style of choice does not exist, fallback to \"long\".\n\n var name = typesData[style][canonicalCode] || typesData.long[canonicalCode];\n\n if (name !== undefined) {\n // If there is a region subtag in the language id, use locale pattern to interpolate the region\n if (regionSubTag) {\n // Retrieve region display names\n var regionsData = localeData.types.region;\n var regionDisplayName = regionsData[style][regionSubTag] || regionsData.long[regionSubTag];\n\n if (regionDisplayName || fallback === 'code') {\n // Interpolate into locale-specific pattern.\n var pattern = localeData.patterns.locale;\n return pattern.replace('{0}', name).replace('{1}', regionDisplayName || regionSubTag);\n }\n } else {\n return name;\n }\n }\n\n if (fallback === 'code') {\n return codeAsString;\n }\n };\n\n DisplayNames.prototype.resolvedOptions = function () {\n checkReceiver(this, 'resolvedOptions');\n return tslib_1.__assign({}, ecma402_abstract_1.getMultiInternalSlots(__INTERNAL_SLOT_MAP__, this, 'locale', 'style', 'type', 'fallback'));\n };\n\n DisplayNames.getDefaultLocale = function () {\n return DisplayNames.__defaultLocale;\n };\n\n DisplayNames.localeData = {};\n DisplayNames.availableLocales = new Set();\n DisplayNames.__defaultLocale = '';\n DisplayNames.polyfilled = true;\n return DisplayNames;\n}();\n\nexports.DisplayNames = DisplayNames; // https://tc39.es/proposal-intl-displaynames/#sec-isvalidcodefordisplaynames\n\nfunction isValidCodeForDisplayNames(type, code) {\n switch (type) {\n case 'language':\n // subset of unicode_language_id\n // languageCode [\"-\" scriptCode] [\"-\" regionCode] *(\"-\" variant)\n // where:\n // - languageCode is either a two letters ISO 639-1 language code or a three letters ISO 639-2 language code.\n // - scriptCode is should be an ISO-15924 four letters script code\n // - regionCode is either an ISO-3166 two letters region code, or a three digits UN M49 Geographic Regions.\n return /^[a-z]{2,3}(-[a-z]{4})?(-([a-z]{2}|\\d{3}))?(-([a-z\\d]{5,8}|\\d[a-z\\d]{3}))*$/i.test(code);\n\n case 'region':\n // unicode_region_subtag\n return /^([a-z]{2}|\\d{3})$/i.test(code);\n\n case 'script':\n // unicode_script_subtag\n return /^[a-z]{4}$/i.test(code);\n\n case 'currency':\n return ecma402_abstract_1.IsWellFormedCurrencyCode(code);\n }\n}\n\ntry {\n // IE11 does not have Symbol\n if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n Object.defineProperty(DisplayNames.prototype, Symbol.toStringTag, {\n value: 'Intl.DisplayNames',\n configurable: true,\n enumerable: false,\n writable: false\n });\n }\n\n Object.defineProperty(DisplayNames, 'length', {\n value: 2,\n writable: false,\n enumerable: false,\n configurable: true\n });\n} catch (e) {// Make test 262 compliant\n}\n\nvar __INTERNAL_SLOT_MAP__ = new WeakMap();\n\nfunction getSlot(instance, key) {\n return ecma402_abstract_1.getInternalSlot(__INTERNAL_SLOT_MAP__, instance, key);\n}\n\nfunction setSlot(instance, key, value) {\n ecma402_abstract_1.setInternalSlot(__INTERNAL_SLOT_MAP__, instance, key, value);\n}\n\nfunction checkReceiver(receiver, methodName) {\n if (!(receiver instanceof DisplayNames)) {\n throw TypeError(\"Method Intl.DisplayNames.prototype.\" + methodName + \" called on incompatible receiver\");\n }\n}","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = all;\n\nvar _createChainableTypeChecker = require('./utils/createChainableTypeChecker');\n\nvar _createChainableTypeChecker2 = _interopRequireDefault(_createChainableTypeChecker);\n\nfunction _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n}\n\nfunction all() {\n for (var _len = arguments.length, validators = Array(_len), _key = 0; _key < _len; _key++) {\n validators[_key] = arguments[_key];\n }\n\n function allPropTypes() {\n for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n var error = null;\n validators.forEach(function (validator) {\n if (error != null) {\n return;\n }\n\n var result = validator.apply(undefined, args);\n\n if (result != null) {\n error = result;\n }\n });\n return error;\n }\n\n return (0, _createChainableTypeChecker2.default)(allPropTypes);\n}\n\nmodule.exports = exports['default'];","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor;\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor;\n\n var TempCtor = function TempCtor() {};\n\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n };\n}","export default function hasClass(element, className) {\n if (element.classList) return !!className && element.classList.contains(className);\n return (\" \" + (element.className.baseVal || element.className) + \" \").indexOf(\" \" + className + \" \") !== -1;\n}","/* @generated */\n// prettier-ignore\nif (Intl.RelativeTimeFormat && typeof Intl.RelativeTimeFormat.__addLocaleData === 'function') {\n Intl.RelativeTimeFormat.__addLocaleData({\n \"data\": {\n \"ru\": {\n \"nu\": [\"latn\"],\n \"year\": {\n \"0\": \"в этом году\",\n \"1\": \"в следующем году\",\n \"future\": {\n \"one\": \"через {0} год\",\n \"few\": \"через {0} года\",\n \"many\": \"через {0} лет\",\n \"other\": \"через {0} года\"\n },\n \"past\": {\n \"one\": \"{0} год назад\",\n \"few\": \"{0} года назад\",\n \"many\": \"{0} лет назад\",\n \"other\": \"{0} года назад\"\n },\n \"-1\": \"в прошлом году\"\n },\n \"year-short\": {\n \"0\": \"в этом г.\",\n \"1\": \"в след. г.\",\n \"future\": {\n \"one\": \"через {0} г.\",\n \"few\": \"через {0} г.\",\n \"many\": \"через {0} л.\",\n \"other\": \"через {0} г.\"\n },\n \"past\": {\n \"one\": \"{0} г. назад\",\n \"few\": \"{0} г. назад\",\n \"many\": \"{0} л. назад\",\n \"other\": \"{0} г. назад\"\n },\n \"-1\": \"в прошлом г.\"\n },\n \"year-narrow\": {\n \"0\": \"в эт. г.\",\n \"1\": \"в сл. г.\",\n \"future\": {\n \"one\": \"+{0} г.\",\n \"few\": \"+{0} г.\",\n \"many\": \"+{0} л.\",\n \"other\": \"+{0} г.\"\n },\n \"past\": {\n \"one\": \"-{0} г.\",\n \"few\": \"-{0} г.\",\n \"many\": \"-{0} л.\",\n \"other\": \"-{0} г.\"\n },\n \"-1\": \"в пр. г.\"\n },\n \"quarter\": {\n \"0\": \"в текущем квартале\",\n \"1\": \"в следующем квартале\",\n \"future\": {\n \"one\": \"через {0} квартал\",\n \"few\": \"через {0} квартала\",\n \"many\": \"через {0} кварталов\",\n \"other\": \"через {0} квартала\"\n },\n \"past\": {\n \"one\": \"{0} квартал назад\",\n \"few\": \"{0} квартала назад\",\n \"many\": \"{0} кварталов назад\",\n \"other\": \"{0} квартала назад\"\n },\n \"-1\": \"в прошлом квартале\"\n },\n \"quarter-short\": {\n \"0\": \"текущий кв.\",\n \"1\": \"следующий кв.\",\n \"future\": {\n \"one\": \"через {0} кв.\",\n \"few\": \"через {0} кв.\",\n \"many\": \"через {0} кв.\",\n \"other\": \"через {0} кв.\"\n },\n \"past\": {\n \"one\": \"{0} кв. назад\",\n \"few\": \"{0} кв. назад\",\n \"many\": \"{0} кв. назад\",\n \"other\": \"{0} кв. назад\"\n },\n \"-1\": \"последний кв.\"\n },\n \"quarter-narrow\": {\n \"0\": \"тек. кв.\",\n \"1\": \"след. кв.\",\n \"future\": {\n \"one\": \"+{0} кв.\",\n \"few\": \"+{0} кв.\",\n \"many\": \"+{0} кв.\",\n \"other\": \"+{0} кв.\"\n },\n \"past\": {\n \"one\": \"-{0} кв.\",\n \"few\": \"-{0} кв.\",\n \"many\": \"-{0} кв.\",\n \"other\": \"-{0} кв.\"\n },\n \"-1\": \"посл. кв.\"\n },\n \"month\": {\n \"0\": \"в этом месяце\",\n \"1\": \"в следующем месяце\",\n \"future\": {\n \"one\": \"через {0} месяц\",\n \"few\": \"через {0} месяца\",\n \"many\": \"через {0} месяцев\",\n \"other\": \"через {0} месяца\"\n },\n \"past\": {\n \"one\": \"{0} месяц назад\",\n \"few\": \"{0} месяца назад\",\n \"many\": \"{0} месяцев назад\",\n \"other\": \"{0} месяца назад\"\n },\n \"-1\": \"в прошлом месяце\"\n },\n \"month-short\": {\n \"0\": \"в этом мес.\",\n \"1\": \"в следующем мес.\",\n \"future\": {\n \"one\": \"через {0} мес.\",\n \"few\": \"через {0} мес.\",\n \"many\": \"через {0} мес.\",\n \"other\": \"через {0} мес.\"\n },\n \"past\": {\n \"one\": \"{0} мес. назад\",\n \"few\": \"{0} мес. назад\",\n \"many\": \"{0} мес. назад\",\n \"other\": \"{0} мес. назад\"\n },\n \"-1\": \"в прошлом мес.\"\n },\n \"month-narrow\": {\n \"0\": \"в эт. мес.\",\n \"1\": \"в след. мес.\",\n \"future\": {\n \"one\": \"+{0} мес.\",\n \"few\": \"+{0} мес.\",\n \"many\": \"+{0} мес.\",\n \"other\": \"+{0} мес.\"\n },\n \"past\": {\n \"one\": \"-{0} мес.\",\n \"few\": \"-{0} мес.\",\n \"many\": \"-{0} мес.\",\n \"other\": \"-{0} мес.\"\n },\n \"-1\": \"в пр. мес.\"\n },\n \"week\": {\n \"0\": \"на этой неделе\",\n \"1\": \"на следующей неделе\",\n \"future\": {\n \"one\": \"через {0} неделю\",\n \"few\": \"через {0} недели\",\n \"many\": \"через {0} недель\",\n \"other\": \"через {0} недели\"\n },\n \"past\": {\n \"one\": \"{0} неделю назад\",\n \"few\": \"{0} недели назад\",\n \"many\": \"{0} недель назад\",\n \"other\": \"{0} недели назад\"\n },\n \"-1\": \"на прошлой неделе\"\n },\n \"week-short\": {\n \"0\": \"на этой нед.\",\n \"1\": \"на следующей нед.\",\n \"future\": {\n \"one\": \"через {0} нед.\",\n \"few\": \"через {0} нед.\",\n \"many\": \"через {0} нед.\",\n \"other\": \"через {0} нед.\"\n },\n \"past\": {\n \"one\": \"{0} нед. назад\",\n \"few\": \"{0} нед. назад\",\n \"many\": \"{0} нед. назад\",\n \"other\": \"{0} нед. назад\"\n },\n \"-1\": \"на прошлой нед.\"\n },\n \"week-narrow\": {\n \"0\": \"на эт. нед.\",\n \"1\": \"на след. нед.\",\n \"future\": {\n \"one\": \"+{0} нед.\",\n \"few\": \"+{0} нед.\",\n \"many\": \"+{0} нед.\",\n \"other\": \"+{0} нед.\"\n },\n \"past\": {\n \"one\": \"-{0} нед.\",\n \"few\": \"-{0} нед.\",\n \"many\": \"-{0} нед.\",\n \"other\": \"-{0} нед.\"\n },\n \"-1\": \"на пр. нед.\"\n },\n \"day\": {\n \"0\": \"сегодня\",\n \"1\": \"завтра\",\n \"2\": \"послезавтра\",\n \"future\": {\n \"one\": \"через {0} день\",\n \"few\": \"через {0} дня\",\n \"many\": \"через {0} дней\",\n \"other\": \"через {0} дня\"\n },\n \"past\": {\n \"one\": \"{0} день назад\",\n \"few\": \"{0} дня назад\",\n \"many\": \"{0} дней назад\",\n \"other\": \"{0} дня назад\"\n },\n \"-2\": \"позавчера\",\n \"-1\": \"вчера\"\n },\n \"day-short\": {\n \"0\": \"сегодня\",\n \"1\": \"завтра\",\n \"2\": \"послезавтра\",\n \"future\": {\n \"one\": \"через {0} дн.\",\n \"few\": \"через {0} дн.\",\n \"many\": \"через {0} дн.\",\n \"other\": \"через {0} дн.\"\n },\n \"past\": {\n \"one\": \"{0} дн. назад\",\n \"few\": \"{0} дн. назад\",\n \"many\": \"{0} дн. назад\",\n \"other\": \"{0} дн. назад\"\n },\n \"-2\": \"позавчера\",\n \"-1\": \"вчера\"\n },\n \"day-narrow\": {\n \"0\": \"сегодня\",\n \"1\": \"завтра\",\n \"2\": \"послезавтра\",\n \"future\": {\n \"one\": \"+{0} дн.\",\n \"few\": \"+{0} дн.\",\n \"many\": \"+{0} дн.\",\n \"other\": \"+{0} дн.\"\n },\n \"past\": {\n \"one\": \"-{0} дн.\",\n \"few\": \"-{0} дн.\",\n \"many\": \"-{0} дн.\",\n \"other\": \"-{0} дн.\"\n },\n \"-2\": \"позавчера\",\n \"-1\": \"вчера\"\n },\n \"hour\": {\n \"0\": \"в этот час\",\n \"future\": {\n \"one\": \"через {0} час\",\n \"few\": \"через {0} часа\",\n \"many\": \"через {0} часов\",\n \"other\": \"через {0} часа\"\n },\n \"past\": {\n \"one\": \"{0} час назад\",\n \"few\": \"{0} часа назад\",\n \"many\": \"{0} часов назад\",\n \"other\": \"{0} часа назад\"\n }\n },\n \"hour-short\": {\n \"0\": \"в этот час\",\n \"future\": {\n \"one\": \"через {0} ч\",\n \"few\": \"через {0} ч\",\n \"many\": \"через {0} ч\",\n \"other\": \"через {0} ч\"\n },\n \"past\": {\n \"one\": \"{0} ч назад\",\n \"few\": \"{0} ч назад\",\n \"many\": \"{0} ч назад\",\n \"other\": \"{0} ч назад\"\n }\n },\n \"hour-narrow\": {\n \"0\": \"в этот час\",\n \"future\": {\n \"one\": \"+{0} ч\",\n \"few\": \"+{0} ч\",\n \"many\": \"+{0} ч\",\n \"other\": \"+{0} ч\"\n },\n \"past\": {\n \"one\": \"-{0} ч\",\n \"few\": \"-{0} ч\",\n \"many\": \"-{0} ч\",\n \"other\": \"-{0} ч\"\n }\n },\n \"minute\": {\n \"0\": \"в эту минуту\",\n \"future\": {\n \"one\": \"через {0} минуту\",\n \"few\": \"через {0} минуты\",\n \"many\": \"через {0} минут\",\n \"other\": \"через {0} минуты\"\n },\n \"past\": {\n \"one\": \"{0} минуту назад\",\n \"few\": \"{0} минуты назад\",\n \"many\": \"{0} минут назад\",\n \"other\": \"{0} минуты назад\"\n }\n },\n \"minute-short\": {\n \"0\": \"в эту минуту\",\n \"future\": {\n \"one\": \"через {0} мин.\",\n \"few\": \"через {0} мин.\",\n \"many\": \"через {0} мин.\",\n \"other\": \"через {0} мин.\"\n },\n \"past\": {\n \"one\": \"{0} мин. назад\",\n \"few\": \"{0} мин. назад\",\n \"many\": \"{0} мин. назад\",\n \"other\": \"{0} мин. назад\"\n }\n },\n \"minute-narrow\": {\n \"0\": \"в эту минуту\",\n \"future\": {\n \"one\": \"+{0} мин\",\n \"few\": \"+{0} мин\",\n \"many\": \"+{0} мин\",\n \"other\": \"+{0} мин\"\n },\n \"past\": {\n \"one\": \"-{0} мин\",\n \"few\": \"-{0} мин\",\n \"many\": \"-{0} мин\",\n \"other\": \"-{0} мин\"\n }\n },\n \"second\": {\n \"0\": \"сейчас\",\n \"future\": {\n \"one\": \"через {0} секунду\",\n \"few\": \"через {0} секунды\",\n \"many\": \"через {0} секунд\",\n \"other\": \"через {0} секунды\"\n },\n \"past\": {\n \"one\": \"{0} секунду назад\",\n \"few\": \"{0} секунды назад\",\n \"many\": \"{0} секунд назад\",\n \"other\": \"{0} секунды назад\"\n }\n },\n \"second-short\": {\n \"0\": \"сейчас\",\n \"future\": {\n \"one\": \"через {0} сек.\",\n \"few\": \"через {0} сек.\",\n \"many\": \"через {0} сек.\",\n \"other\": \"через {0} сек.\"\n },\n \"past\": {\n \"one\": \"{0} сек. назад\",\n \"few\": \"{0} сек. назад\",\n \"many\": \"{0} сек. назад\",\n \"other\": \"{0} сек. назад\"\n }\n },\n \"second-narrow\": {\n \"0\": \"сейчас\",\n \"future\": {\n \"one\": \"+{0} с\",\n \"few\": \"+{0} с\",\n \"many\": \"+{0} с\",\n \"other\": \"+{0} с\"\n },\n \"past\": {\n \"one\": \"-{0} с\",\n \"few\": \"-{0} с\",\n \"many\": \"-{0} с\",\n \"other\": \"-{0} с\"\n }\n }\n }\n },\n \"availableLocales\": [\"ru-BY\", \"ru-KG\", \"ru-KZ\", \"ru-MD\", \"ru-UA\", \"ru\"],\n \"aliases\": {},\n \"parentLocales\": {}\n });\n}","import arrayWithoutHoles from \"./arrayWithoutHoles\";\nimport iterableToArray from \"./iterableToArray\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray\";\nimport nonIterableSpread from \"./nonIterableSpread\";\nexport default function _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}","import arrayLikeToArray from \"./arrayLikeToArray\";\nexport default function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return arrayLikeToArray(arr);\n}","export default function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n}","export default function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","import { __assign, __read, __spread } from \"tslib\";\nimport { dateTimestampInSeconds, getGlobalObject, isPlainObject, isThenable, SyncPromise } from '@sentry/utils';\n/**\n * Holds additional event information. {@link Scope.applyToEvent} will be\n * called by the client before an event will be sent.\n */\n\nvar Scope =\n/** @class */\nfunction () {\n function Scope() {\n /** Flag if notifiying is happening. */\n this._notifyingListeners = false;\n /** Callback for client to receive scope changes. */\n\n this._scopeListeners = [];\n /** Callback list that will be called after {@link applyToEvent}. */\n\n this._eventProcessors = [];\n /** Array of breadcrumbs. */\n\n this._breadcrumbs = [];\n /** User */\n\n this._user = {};\n /** Tags */\n\n this._tags = {};\n /** Extra */\n\n this._extra = {};\n /** Contexts */\n\n this._contexts = {};\n }\n /**\n * Inherit values from the parent scope.\n * @param scope to clone.\n */\n\n\n Scope.clone = function (scope) {\n var newScope = new Scope();\n\n if (scope) {\n newScope._breadcrumbs = __spread(scope._breadcrumbs);\n newScope._tags = __assign({}, scope._tags);\n newScope._extra = __assign({}, scope._extra);\n newScope._contexts = __assign({}, scope._contexts);\n newScope._user = scope._user;\n newScope._level = scope._level;\n newScope._span = scope._span;\n newScope._session = scope._session;\n newScope._transactionName = scope._transactionName;\n newScope._fingerprint = scope._fingerprint;\n newScope._eventProcessors = __spread(scope._eventProcessors);\n }\n\n return newScope;\n };\n /**\n * Add internal on change listener. Used for sub SDKs that need to store the scope.\n * @hidden\n */\n\n\n Scope.prototype.addScopeListener = function (callback) {\n this._scopeListeners.push(callback);\n };\n /**\n * @inheritDoc\n */\n\n\n Scope.prototype.addEventProcessor = function (callback) {\n this._eventProcessors.push(callback);\n\n return this;\n };\n /**\n * @inheritDoc\n */\n\n\n Scope.prototype.setUser = function (user) {\n this._user = user || {};\n\n if (this._session) {\n this._session.update({\n user: user\n });\n }\n\n this._notifyScopeListeners();\n\n return this;\n };\n /**\n * @inheritDoc\n */\n\n\n Scope.prototype.getUser = function () {\n return this._user;\n };\n /**\n * @inheritDoc\n */\n\n\n Scope.prototype.setTags = function (tags) {\n this._tags = __assign(__assign({}, this._tags), tags);\n\n this._notifyScopeListeners();\n\n return this;\n };\n /**\n * @inheritDoc\n */\n\n\n Scope.prototype.setTag = function (key, value) {\n var _a;\n\n this._tags = __assign(__assign({}, this._tags), (_a = {}, _a[key] = value, _a));\n\n this._notifyScopeListeners();\n\n return this;\n };\n /**\n * @inheritDoc\n */\n\n\n Scope.prototype.setExtras = function (extras) {\n this._extra = __assign(__assign({}, this._extra), extras);\n\n this._notifyScopeListeners();\n\n return this;\n };\n /**\n * @inheritDoc\n */\n\n\n Scope.prototype.setExtra = function (key, extra) {\n var _a;\n\n this._extra = __assign(__assign({}, this._extra), (_a = {}, _a[key] = extra, _a));\n\n this._notifyScopeListeners();\n\n return this;\n };\n /**\n * @inheritDoc\n */\n\n\n Scope.prototype.setFingerprint = function (fingerprint) {\n this._fingerprint = fingerprint;\n\n this._notifyScopeListeners();\n\n return this;\n };\n /**\n * @inheritDoc\n */\n\n\n Scope.prototype.setLevel = function (level) {\n this._level = level;\n\n this._notifyScopeListeners();\n\n return this;\n };\n /**\n * @inheritDoc\n */\n\n\n Scope.prototype.setTransactionName = function (name) {\n this._transactionName = name;\n\n this._notifyScopeListeners();\n\n return this;\n };\n /**\n * Can be removed in major version.\n * @deprecated in favor of {@link this.setTransactionName}\n */\n\n\n Scope.prototype.setTransaction = function (name) {\n return this.setTransactionName(name);\n };\n /**\n * @inheritDoc\n */\n\n\n Scope.prototype.setContext = function (key, context) {\n var _a;\n\n if (context === null) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete this._contexts[key];\n } else {\n this._contexts = __assign(__assign({}, this._contexts), (_a = {}, _a[key] = context, _a));\n }\n\n this._notifyScopeListeners();\n\n return this;\n };\n /**\n * @inheritDoc\n */\n\n\n Scope.prototype.setSpan = function (span) {\n this._span = span;\n\n this._notifyScopeListeners();\n\n return this;\n };\n /**\n * @inheritDoc\n */\n\n\n Scope.prototype.getSpan = function () {\n return this._span;\n };\n /**\n * @inheritDoc\n */\n\n\n Scope.prototype.getTransaction = function () {\n var _a, _b, _c, _d; // often, this span will be a transaction, but it's not guaranteed to be\n\n\n var span = this.getSpan(); // try it the new way first\n\n if ((_a = span) === null || _a === void 0 ? void 0 : _a.transaction) {\n return (_b = span) === null || _b === void 0 ? void 0 : _b.transaction;\n } // fallback to the old way (known bug: this only finds transactions with sampled = true)\n\n\n if ((_d = (_c = span) === null || _c === void 0 ? void 0 : _c.spanRecorder) === null || _d === void 0 ? void 0 : _d.spans[0]) {\n return span.spanRecorder.spans[0];\n } // neither way found a transaction\n\n\n return undefined;\n };\n /**\n * @inheritDoc\n */\n\n\n Scope.prototype.setSession = function (session) {\n if (!session) {\n delete this._session;\n } else {\n this._session = session;\n }\n\n this._notifyScopeListeners();\n\n return this;\n };\n /**\n * @inheritDoc\n */\n\n\n Scope.prototype.getSession = function () {\n return this._session;\n };\n /**\n * @inheritDoc\n */\n\n\n Scope.prototype.update = function (captureContext) {\n if (!captureContext) {\n return this;\n }\n\n if (typeof captureContext === 'function') {\n var updatedScope = captureContext(this);\n return updatedScope instanceof Scope ? updatedScope : this;\n }\n\n if (captureContext instanceof Scope) {\n this._tags = __assign(__assign({}, this._tags), captureContext._tags);\n this._extra = __assign(__assign({}, this._extra), captureContext._extra);\n this._contexts = __assign(__assign({}, this._contexts), captureContext._contexts);\n\n if (captureContext._user && Object.keys(captureContext._user).length) {\n this._user = captureContext._user;\n }\n\n if (captureContext._level) {\n this._level = captureContext._level;\n }\n\n if (captureContext._fingerprint) {\n this._fingerprint = captureContext._fingerprint;\n }\n } else if (isPlainObject(captureContext)) {\n // eslint-disable-next-line no-param-reassign\n captureContext = captureContext;\n this._tags = __assign(__assign({}, this._tags), captureContext.tags);\n this._extra = __assign(__assign({}, this._extra), captureContext.extra);\n this._contexts = __assign(__assign({}, this._contexts), captureContext.contexts);\n\n if (captureContext.user) {\n this._user = captureContext.user;\n }\n\n if (captureContext.level) {\n this._level = captureContext.level;\n }\n\n if (captureContext.fingerprint) {\n this._fingerprint = captureContext.fingerprint;\n }\n }\n\n return this;\n };\n /**\n * @inheritDoc\n */\n\n\n Scope.prototype.clear = function () {\n this._breadcrumbs = [];\n this._tags = {};\n this._extra = {};\n this._user = {};\n this._contexts = {};\n this._level = undefined;\n this._transactionName = undefined;\n this._fingerprint = undefined;\n this._span = undefined;\n this._session = undefined;\n\n this._notifyScopeListeners();\n\n return this;\n };\n /**\n * @inheritDoc\n */\n\n\n Scope.prototype.addBreadcrumb = function (breadcrumb, maxBreadcrumbs) {\n var mergedBreadcrumb = __assign({\n timestamp: dateTimestampInSeconds()\n }, breadcrumb);\n\n this._breadcrumbs = maxBreadcrumbs !== undefined && maxBreadcrumbs >= 0 ? __spread(this._breadcrumbs, [mergedBreadcrumb]).slice(-maxBreadcrumbs) : __spread(this._breadcrumbs, [mergedBreadcrumb]);\n\n this._notifyScopeListeners();\n\n return this;\n };\n /**\n * @inheritDoc\n */\n\n\n Scope.prototype.clearBreadcrumbs = function () {\n this._breadcrumbs = [];\n\n this._notifyScopeListeners();\n\n return this;\n };\n /**\n * Applies the current context and fingerprint to the event.\n * Note that breadcrumbs will be added by the client.\n * Also if the event has already breadcrumbs on it, we do not merge them.\n * @param event Event\n * @param hint May contain additional informartion about the original exception.\n * @hidden\n */\n\n\n Scope.prototype.applyToEvent = function (event, hint) {\n var _a;\n\n if (this._extra && Object.keys(this._extra).length) {\n event.extra = __assign(__assign({}, this._extra), event.extra);\n }\n\n if (this._tags && Object.keys(this._tags).length) {\n event.tags = __assign(__assign({}, this._tags), event.tags);\n }\n\n if (this._user && Object.keys(this._user).length) {\n event.user = __assign(__assign({}, this._user), event.user);\n }\n\n if (this._contexts && Object.keys(this._contexts).length) {\n event.contexts = __assign(__assign({}, this._contexts), event.contexts);\n }\n\n if (this._level) {\n event.level = this._level;\n }\n\n if (this._transactionName) {\n event.transaction = this._transactionName;\n } // We want to set the trace context for normal events only if there isn't already\n // a trace context on the event. There is a product feature in place where we link\n // errors with transaction and it relys on that.\n\n\n if (this._span) {\n event.contexts = __assign({\n trace: this._span.getTraceContext()\n }, event.contexts);\n var transactionName = (_a = this._span.transaction) === null || _a === void 0 ? void 0 : _a.name;\n\n if (transactionName) {\n event.tags = __assign({\n transaction: transactionName\n }, event.tags);\n }\n }\n\n this._applyFingerprint(event);\n\n event.breadcrumbs = __spread(event.breadcrumbs || [], this._breadcrumbs);\n event.breadcrumbs = event.breadcrumbs.length > 0 ? event.breadcrumbs : undefined;\n return this._notifyEventProcessors(__spread(getGlobalEventProcessors(), this._eventProcessors), event, hint);\n };\n /**\n * This will be called after {@link applyToEvent} is finished.\n */\n\n\n Scope.prototype._notifyEventProcessors = function (processors, event, hint, index) {\n var _this = this;\n\n if (index === void 0) {\n index = 0;\n }\n\n return new SyncPromise(function (resolve, reject) {\n var processor = processors[index];\n\n if (event === null || typeof processor !== 'function') {\n resolve(event);\n } else {\n var result = processor(__assign({}, event), hint);\n\n if (isThenable(result)) {\n result.then(function (final) {\n return _this._notifyEventProcessors(processors, final, hint, index + 1).then(resolve);\n }).then(null, reject);\n } else {\n _this._notifyEventProcessors(processors, result, hint, index + 1).then(resolve).then(null, reject);\n }\n }\n });\n };\n /**\n * This will be called on every set call.\n */\n\n\n Scope.prototype._notifyScopeListeners = function () {\n var _this = this; // We need this check for this._notifyingListeners to be able to work on scope during updates\n // If this check is not here we'll produce endless recursion when something is done with the scope\n // during the callback.\n\n\n if (!this._notifyingListeners) {\n this._notifyingListeners = true;\n\n this._scopeListeners.forEach(function (callback) {\n callback(_this);\n });\n\n this._notifyingListeners = false;\n }\n };\n /**\n * Applies fingerprint from the scope to the event if there's one,\n * uses message if there's one instead or get rid of empty fingerprint\n */\n\n\n Scope.prototype._applyFingerprint = function (event) {\n // Make sure it's an array first and we actually have something in place\n event.fingerprint = event.fingerprint ? Array.isArray(event.fingerprint) ? event.fingerprint : [event.fingerprint] : []; // If we have something on the scope, then merge it with event\n\n if (this._fingerprint) {\n event.fingerprint = event.fingerprint.concat(this._fingerprint);\n } // If we have no data at all, remove empty array default\n\n\n if (event.fingerprint && !event.fingerprint.length) {\n delete event.fingerprint;\n }\n };\n\n return Scope;\n}();\n\nexport { Scope };\n/**\n * Retruns the global event processors.\n */\n\nfunction getGlobalEventProcessors() {\n /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\n var global = getGlobalObject();\n global.__SENTRY__ = global.__SENTRY__ || {};\n global.__SENTRY__.globalEventProcessors = global.__SENTRY__.globalEventProcessors || [];\n return global.__SENTRY__.globalEventProcessors;\n /* eslint-enable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\n}\n/**\n * Add a EventProcessor to be kept globally.\n * @param callback EventProcessor to add\n */\n\n\nexport function addGlobalEventProcessor(callback) {\n getGlobalEventProcessors().push(callback);\n}","var anObject = require('../internals/an-object');\nvar defineProperties = require('../internals/object-define-properties');\nvar enumBugKeys = require('../internals/enum-bug-keys');\nvar hiddenKeys = require('../internals/hidden-keys');\nvar html = require('../internals/html');\nvar documentCreateElement = require('../internals/document-create-element');\nvar sharedKey = require('../internals/shared-key');\n\nvar GT = '>';\nvar LT = '<';\nvar PROTOTYPE = 'prototype';\nvar SCRIPT = 'script';\nvar IE_PROTO = sharedKey('IE_PROTO');\n\nvar EmptyConstructor = function () { /* empty */ };\n\nvar scriptTag = function (content) {\n return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;\n};\n\n// Create object with fake `null` prototype: use ActiveX Object with cleared prototype\nvar NullProtoObjectViaActiveX = function (activeXDocument) {\n activeXDocument.write(scriptTag(''));\n activeXDocument.close();\n var temp = activeXDocument.parentWindow.Object;\n activeXDocument = null; // avoid memory leak\n return temp;\n};\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar NullProtoObjectViaIFrame = function () {\n // Thrash, waste and sodomy: IE GC bug\n var iframe = documentCreateElement('iframe');\n var JS = 'java' + SCRIPT + ':';\n var iframeDocument;\n iframe.style.display = 'none';\n html.appendChild(iframe);\n // https://github.com/zloirock/core-js/issues/475\n iframe.src = String(JS);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(scriptTag('document.F=Object'));\n iframeDocument.close();\n return iframeDocument.F;\n};\n\n// Check for document.domain and active x support\n// No need to use active x approach when document.domain is not set\n// see https://github.com/es-shims/es5-shim/issues/150\n// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346\n// avoid IE GC bug\nvar activeXDocument;\nvar NullProtoObject = function () {\n try {\n /* global ActiveXObject */\n activeXDocument = document.domain && new ActiveXObject('htmlfile');\n } catch (error) { /* ignore */ }\n NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();\n var length = enumBugKeys.length;\n while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];\n return NullProtoObject();\n};\n\nhiddenKeys[IE_PROTO] = true;\n\n// `Object.create` method\n// https://tc39.github.io/ecma262/#sec-object.create\nmodule.exports = Object.create || function create(O, Properties) {\n var result;\n if (O !== null) {\n EmptyConstructor[PROTOTYPE] = anObject(O);\n result = new EmptyConstructor();\n EmptyConstructor[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = NullProtoObject();\n return Properties === undefined ? result : defineProperties(result, Properties);\n};\n","var asn1 = require('./asn1');\n\nvar aesid = require('./aesid.json');\n\nvar fixProc = require('./fixProc');\n\nvar ciphers = require('browserify-aes');\n\nvar compat = require('pbkdf2');\n\nvar Buffer = require('safe-buffer').Buffer;\n\nmodule.exports = parseKeys;\n\nfunction parseKeys(buffer) {\n var password;\n\n if (typeof buffer === 'object' && !Buffer.isBuffer(buffer)) {\n password = buffer.passphrase;\n buffer = buffer.key;\n }\n\n if (typeof buffer === 'string') {\n buffer = Buffer.from(buffer);\n }\n\n var stripped = fixProc(buffer, password);\n var type = stripped.tag;\n var data = stripped.data;\n var subtype, ndata;\n\n switch (type) {\n case 'CERTIFICATE':\n ndata = asn1.certificate.decode(data, 'der').tbsCertificate.subjectPublicKeyInfo;\n // falls through\n\n case 'PUBLIC KEY':\n if (!ndata) {\n ndata = asn1.PublicKey.decode(data, 'der');\n }\n\n subtype = ndata.algorithm.algorithm.join('.');\n\n switch (subtype) {\n case '1.2.840.113549.1.1.1':\n return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, 'der');\n\n case '1.2.840.10045.2.1':\n ndata.subjectPrivateKey = ndata.subjectPublicKey;\n return {\n type: 'ec',\n data: ndata\n };\n\n case '1.2.840.10040.4.1':\n ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, 'der');\n return {\n type: 'dsa',\n data: ndata.algorithm.params\n };\n\n default:\n throw new Error('unknown key id ' + subtype);\n }\n\n // throw new Error('unknown key type ' + type)\n\n case 'ENCRYPTED PRIVATE KEY':\n data = asn1.EncryptedPrivateKey.decode(data, 'der');\n data = decrypt(data, password);\n // falls through\n\n case 'PRIVATE KEY':\n ndata = asn1.PrivateKey.decode(data, 'der');\n subtype = ndata.algorithm.algorithm.join('.');\n\n switch (subtype) {\n case '1.2.840.113549.1.1.1':\n return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, 'der');\n\n case '1.2.840.10045.2.1':\n return {\n curve: ndata.algorithm.curve,\n privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, 'der').privateKey\n };\n\n case '1.2.840.10040.4.1':\n ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, 'der');\n return {\n type: 'dsa',\n params: ndata.algorithm.params\n };\n\n default:\n throw new Error('unknown key id ' + subtype);\n }\n\n // throw new Error('unknown key type ' + type)\n\n case 'RSA PUBLIC KEY':\n return asn1.RSAPublicKey.decode(data, 'der');\n\n case 'RSA PRIVATE KEY':\n return asn1.RSAPrivateKey.decode(data, 'der');\n\n case 'DSA PRIVATE KEY':\n return {\n type: 'dsa',\n params: asn1.DSAPrivateKey.decode(data, 'der')\n };\n\n case 'EC PRIVATE KEY':\n data = asn1.ECPrivateKey.decode(data, 'der');\n return {\n curve: data.parameters.value,\n privateKey: data.privateKey\n };\n\n default:\n throw new Error('unknown key type ' + type);\n }\n}\n\nparseKeys.signature = asn1.signature;\n\nfunction decrypt(data, password) {\n var salt = data.algorithm.decrypt.kde.kdeparams.salt;\n var iters = parseInt(data.algorithm.decrypt.kde.kdeparams.iters.toString(), 10);\n var algo = aesid[data.algorithm.decrypt.cipher.algo.join('.')];\n var iv = data.algorithm.decrypt.cipher.iv;\n var cipherText = data.subjectPrivateKey;\n var keylen = parseInt(algo.split('-')[1], 10) / 8;\n var key = compat.pbkdf2Sync(password, salt, iters, keylen, 'sha1');\n var cipher = ciphers.createDecipheriv(algo, key, iv);\n var out = [];\n out.push(cipher.update(cipherText));\n out.push(cipher.final());\n return Buffer.concat(out);\n}","'use strict';\n\nvar utils = require('./../utils');\n\nfunction InterceptorManager() {\n this.handlers = [];\n}\n/**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\n\n\nInterceptorManager.prototype.use = function use(fulfilled, rejected) {\n this.handlers.push({\n fulfilled: fulfilled,\n rejected: rejected\n });\n return this.handlers.length - 1;\n};\n/**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n */\n\n\nInterceptorManager.prototype.eject = function eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n};\n/**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n */\n\n\nInterceptorManager.prototype.forEach = function forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n};\n\nmodule.exports = InterceptorManager;","import path from \"path\"\nimport { LOCALE_PATTERN } from \"../store/models/formats\"\n\nexport const formatPath = (format, locale) => {\n return format.path.replace(LOCALE_PATTERN, locale.code)\n}\n\nexport const appendIndexToPath = (formattedPath, index) => {\n const fileExt = path.extname(formattedPath)\n return formattedPath.replace(fileExt, `-${index}${fileExt}`)\n}\n\nexport const hasFramework = (format) => {\n return !!format.framework\n}\n\nexport const formatCreditCardBrand = brandName =>\n brandName.replace(/[^a-zA-Z\\s]/g, \" \").toUpperCase()\n","// This file is a workaround for a bug in web browsers' \"native\"\n// ES6 importing system which is uncapable of importing \"*.json\" files.\n// https://github.com/catamphetamine/libphonenumber-js/issues/239\nexport default {\n \"version\": 4,\n \"country_calling_codes\": {\n \"1\": [\"US\", \"AG\", \"AI\", \"AS\", \"BB\", \"BM\", \"BS\", \"CA\", \"DM\", \"DO\", \"GD\", \"GU\", \"JM\", \"KN\", \"KY\", \"LC\", \"MP\", \"MS\", \"PR\", \"SX\", \"TC\", \"TT\", \"VC\", \"VG\", \"VI\"],\n \"7\": [\"RU\", \"KZ\"],\n \"20\": [\"EG\"],\n \"27\": [\"ZA\"],\n \"30\": [\"GR\"],\n \"31\": [\"NL\"],\n \"32\": [\"BE\"],\n \"33\": [\"FR\"],\n \"34\": [\"ES\"],\n \"36\": [\"HU\"],\n \"39\": [\"IT\", \"VA\"],\n \"40\": [\"RO\"],\n \"41\": [\"CH\"],\n \"43\": [\"AT\"],\n \"44\": [\"GB\", \"GG\", \"IM\", \"JE\"],\n \"45\": [\"DK\"],\n \"46\": [\"SE\"],\n \"47\": [\"NO\", \"SJ\"],\n \"48\": [\"PL\"],\n \"49\": [\"DE\"],\n \"51\": [\"PE\"],\n \"52\": [\"MX\"],\n \"53\": [\"CU\"],\n \"54\": [\"AR\"],\n \"55\": [\"BR\"],\n \"56\": [\"CL\"],\n \"57\": [\"CO\"],\n \"58\": [\"VE\"],\n \"60\": [\"MY\"],\n \"61\": [\"AU\", \"CC\", \"CX\"],\n \"62\": [\"ID\"],\n \"63\": [\"PH\"],\n \"64\": [\"NZ\"],\n \"65\": [\"SG\"],\n \"66\": [\"TH\"],\n \"81\": [\"JP\"],\n \"82\": [\"KR\"],\n \"84\": [\"VN\"],\n \"86\": [\"CN\"],\n \"90\": [\"TR\"],\n \"91\": [\"IN\"],\n \"92\": [\"PK\"],\n \"93\": [\"AF\"],\n \"94\": [\"LK\"],\n \"95\": [\"MM\"],\n \"98\": [\"IR\"],\n \"211\": [\"SS\"],\n \"212\": [\"MA\", \"EH\"],\n \"213\": [\"DZ\"],\n \"216\": [\"TN\"],\n \"218\": [\"LY\"],\n \"220\": [\"GM\"],\n \"221\": [\"SN\"],\n \"222\": [\"MR\"],\n \"223\": [\"ML\"],\n \"224\": [\"GN\"],\n \"225\": [\"CI\"],\n \"226\": [\"BF\"],\n \"227\": [\"NE\"],\n \"228\": [\"TG\"],\n \"229\": [\"BJ\"],\n \"230\": [\"MU\"],\n \"231\": [\"LR\"],\n \"232\": [\"SL\"],\n \"233\": [\"GH\"],\n \"234\": [\"NG\"],\n \"235\": [\"TD\"],\n \"236\": [\"CF\"],\n \"237\": [\"CM\"],\n \"238\": [\"CV\"],\n \"239\": [\"ST\"],\n \"240\": [\"GQ\"],\n \"241\": [\"GA\"],\n \"242\": [\"CG\"],\n \"243\": [\"CD\"],\n \"244\": [\"AO\"],\n \"245\": [\"GW\"],\n \"246\": [\"IO\"],\n \"247\": [\"AC\"],\n \"248\": [\"SC\"],\n \"249\": [\"SD\"],\n \"250\": [\"RW\"],\n \"251\": [\"ET\"],\n \"252\": [\"SO\"],\n \"253\": [\"DJ\"],\n \"254\": [\"KE\"],\n \"255\": [\"TZ\"],\n \"256\": [\"UG\"],\n \"257\": [\"BI\"],\n \"258\": [\"MZ\"],\n \"260\": [\"ZM\"],\n \"261\": [\"MG\"],\n \"262\": [\"RE\", \"YT\"],\n \"263\": [\"ZW\"],\n \"264\": [\"NA\"],\n \"265\": [\"MW\"],\n \"266\": [\"LS\"],\n \"267\": [\"BW\"],\n \"268\": [\"SZ\"],\n \"269\": [\"KM\"],\n \"290\": [\"SH\", \"TA\"],\n \"291\": [\"ER\"],\n \"297\": [\"AW\"],\n \"298\": [\"FO\"],\n \"299\": [\"GL\"],\n \"350\": [\"GI\"],\n \"351\": [\"PT\"],\n \"352\": [\"LU\"],\n \"353\": [\"IE\"],\n \"354\": [\"IS\"],\n \"355\": [\"AL\"],\n \"356\": [\"MT\"],\n \"357\": [\"CY\"],\n \"358\": [\"FI\", \"AX\"],\n \"359\": [\"BG\"],\n \"370\": [\"LT\"],\n \"371\": [\"LV\"],\n \"372\": [\"EE\"],\n \"373\": [\"MD\"],\n \"374\": [\"AM\"],\n \"375\": [\"BY\"],\n \"376\": [\"AD\"],\n \"377\": [\"MC\"],\n \"378\": [\"SM\"],\n \"380\": [\"UA\"],\n \"381\": [\"RS\"],\n \"382\": [\"ME\"],\n \"383\": [\"XK\"],\n \"385\": [\"HR\"],\n \"386\": [\"SI\"],\n \"387\": [\"BA\"],\n \"389\": [\"MK\"],\n \"420\": [\"CZ\"],\n \"421\": [\"SK\"],\n \"423\": [\"LI\"],\n \"500\": [\"FK\"],\n \"501\": [\"BZ\"],\n \"502\": [\"GT\"],\n \"503\": [\"SV\"],\n \"504\": [\"HN\"],\n \"505\": [\"NI\"],\n \"506\": [\"CR\"],\n \"507\": [\"PA\"],\n \"508\": [\"PM\"],\n \"509\": [\"HT\"],\n \"590\": [\"GP\", \"BL\", \"MF\"],\n \"591\": [\"BO\"],\n \"592\": [\"GY\"],\n \"593\": [\"EC\"],\n \"594\": [\"GF\"],\n \"595\": [\"PY\"],\n \"596\": [\"MQ\"],\n \"597\": [\"SR\"],\n \"598\": [\"UY\"],\n \"599\": [\"CW\", \"BQ\"],\n \"670\": [\"TL\"],\n \"672\": [\"NF\"],\n \"673\": [\"BN\"],\n \"674\": [\"NR\"],\n \"675\": [\"PG\"],\n \"676\": [\"TO\"],\n \"677\": [\"SB\"],\n \"678\": [\"VU\"],\n \"679\": [\"FJ\"],\n \"680\": [\"PW\"],\n \"681\": [\"WF\"],\n \"682\": [\"CK\"],\n \"683\": [\"NU\"],\n \"685\": [\"WS\"],\n \"686\": [\"KI\"],\n \"687\": [\"NC\"],\n \"688\": [\"TV\"],\n \"689\": [\"PF\"],\n \"690\": [\"TK\"],\n \"691\": [\"FM\"],\n \"692\": [\"MH\"],\n \"850\": [\"KP\"],\n \"852\": [\"HK\"],\n \"853\": [\"MO\"],\n \"855\": [\"KH\"],\n \"856\": [\"LA\"],\n \"880\": [\"BD\"],\n \"886\": [\"TW\"],\n \"960\": [\"MV\"],\n \"961\": [\"LB\"],\n \"962\": [\"JO\"],\n \"963\": [\"SY\"],\n \"964\": [\"IQ\"],\n \"965\": [\"KW\"],\n \"966\": [\"SA\"],\n \"967\": [\"YE\"],\n \"968\": [\"OM\"],\n \"970\": [\"PS\"],\n \"971\": [\"AE\"],\n \"972\": [\"IL\"],\n \"973\": [\"BH\"],\n \"974\": [\"QA\"],\n \"975\": [\"BT\"],\n \"976\": [\"MN\"],\n \"977\": [\"NP\"],\n \"992\": [\"TJ\"],\n \"993\": [\"TM\"],\n \"994\": [\"AZ\"],\n \"995\": [\"GE\"],\n \"996\": [\"KG\"],\n \"998\": [\"UZ\"]\n },\n \"countries\": {\n \"AC\": [\"247\", \"00\", \"(?:[01589]\\\\d|[46])\\\\d{4}\", [5, 6]],\n \"AD\": [\"376\", \"00\", \"(?:1|6\\\\d)\\\\d{7}|[135-9]\\\\d{5}\", [6, 8, 9], [[\"(\\\\d{3})(\\\\d{3})\", \"$1 $2\", [\"[135-9]\"]], [\"(\\\\d{4})(\\\\d{4})\", \"$1 $2\", [\"1\"]], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"6\"]]]],\n \"AE\": [\"971\", \"00\", \"(?:[4-7]\\\\d|9[0-689])\\\\d{7}|800\\\\d{2,9}|[2-4679]\\\\d{7}\", [5, 6, 7, 8, 9, 10, 11, 12], [[\"(\\\\d{3})(\\\\d{2,9})\", \"$1 $2\", [\"60|8\"]], [\"(\\\\d)(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"[236]|[479][2-8]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d)(\\\\d{5})\", \"$1 $2 $3\", [\"[479]\"]], [\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"5\"], \"0$1\"]], \"0\"],\n \"AF\": [\"93\", \"00\", \"[2-7]\\\\d{8}\", [9], [[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"[2-7]\"], \"0$1\"]], \"0\"],\n \"AG\": [\"1\", \"011\", \"(?:268|[58]\\\\d\\\\d|900)\\\\d{7}\", [10], 0, \"1\", 0, \"1|([457]\\\\d{6})$\", \"268$1\", 0, \"268\"],\n \"AI\": [\"1\", \"011\", \"(?:264|[58]\\\\d\\\\d|900)\\\\d{7}\", [10], 0, \"1\", 0, \"1|([2457]\\\\d{6})$\", \"264$1\", 0, \"264\"],\n \"AL\": [\"355\", \"00\", \"(?:700\\\\d\\\\d|900)\\\\d{3}|8\\\\d{5,7}|(?:[2-5]|6\\\\d)\\\\d{7}\", [6, 7, 8, 9], [[\"(\\\\d{3})(\\\\d{3,4})\", \"$1 $2\", [\"80|9\"], \"0$1\"], [\"(\\\\d)(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"4[2-6]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[2358][2-5]|4\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{5})\", \"$1 $2\", [\"[23578]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"6\"], \"0$1\"]], \"0\"],\n \"AM\": [\"374\", \"00\", \"(?:[1-489]\\\\d|55|60|77)\\\\d{6}\", [8], [[\"(\\\\d{3})(\\\\d{2})(\\\\d{3})\", \"$1 $2 $3\", [\"[89]0\"], \"0 $1\"], [\"(\\\\d{3})(\\\\d{5})\", \"$1 $2\", [\"2|3[12]\"], \"(0$1)\"], [\"(\\\\d{2})(\\\\d{6})\", \"$1 $2\", [\"1|47\"], \"(0$1)\"], [\"(\\\\d{2})(\\\\d{6})\", \"$1 $2\", [\"[3-9]\"], \"0$1\"]], \"0\"],\n \"AO\": [\"244\", \"00\", \"[29]\\\\d{8}\", [9], [[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[29]\"]]]],\n \"AR\": [\"54\", \"00\", \"(?:11|[89]\\\\d\\\\d)\\\\d{8}|[2368]\\\\d{9}\", [10, 11], [[\"(\\\\d{4})(\\\\d{2})(\\\\d{4})\", \"$1 $2-$3\", [\"2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])\", \"2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)\", \"2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]\", \"2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]\"], \"0$1\", 1], [\"(\\\\d{2})(\\\\d{4})(\\\\d{4})\", \"$1 $2-$3\", [\"1\"], \"0$1\", 1], [\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$1-$2-$3\", [\"[68]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$1 $2-$3\", [\"[23]\"], \"0$1\", 1], [\"(\\\\d)(\\\\d{4})(\\\\d{2})(\\\\d{4})\", \"$2 15-$3-$4\", [\"9(?:2[2-469]|3[3-578])\", \"9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))\", \"9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)\", \"9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]\", \"9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]\"], \"0$1\", 0, \"$1 $2 $3-$4\"], [\"(\\\\d)(\\\\d{2})(\\\\d{4})(\\\\d{4})\", \"$2 15-$3-$4\", [\"91\"], \"0$1\", 0, \"$1 $2 $3-$4\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{5})\", \"$1-$2-$3\", [\"8\"], \"0$1\"], [\"(\\\\d)(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$2 15-$3-$4\", [\"9\"], \"0$1\", 0, \"$1 $2 $3-$4\"]], \"0\", 0, \"0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?\", \"9$1\"],\n \"AS\": [\"1\", \"011\", \"(?:[58]\\\\d\\\\d|684|900)\\\\d{7}\", [10], 0, \"1\", 0, \"1|([267]\\\\d{6})$\", \"684$1\", 0, \"684\"],\n \"AT\": [\"43\", \"00\", \"1\\\\d{3,12}|2\\\\d{6,12}|43(?:(?:0\\\\d|5[02-9])\\\\d{3,9}|2\\\\d{4,5}|[3467]\\\\d{4}|8\\\\d{4,6}|9\\\\d{4,7})|5\\\\d{4,12}|8\\\\d{7,12}|9\\\\d{8,12}|(?:[367]\\\\d|4[0-24-9])\\\\d{4,11}\", [4, 5, 6, 7, 8, 9, 10, 11, 12, 13], [[\"(\\\\d)(\\\\d{3,12})\", \"$1 $2\", [\"1(?:11|[2-9])\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{2})\", \"$1 $2\", [\"517\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3,5})\", \"$1 $2\", [\"5[079]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3,10})\", \"$1 $2\", [\"(?:31|4)6|51|6(?:5[0-3579]|[6-9])|7(?:20|32|8)|[89]\"], \"0$1\"], [\"(\\\\d{4})(\\\\d{3,9})\", \"$1 $2\", [\"[2-467]|5[2-6]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"5\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{4})(\\\\d{4,7})\", \"$1 $2 $3\", [\"5\"], \"0$1\"]], \"0\"],\n \"AU\": [\"61\", \"001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011\", \"1(?:[0-79]\\\\d{7}(?:\\\\d(?:\\\\d{2})?)?|8[0-24-9]\\\\d{7})|[2-478]\\\\d{8}|1\\\\d{4,7}\", [5, 6, 7, 8, 9, 10, 12], [[\"(\\\\d{2})(\\\\d{3,4})\", \"$1 $2\", [\"16\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{2,4})\", \"$1 $2 $3\", [\"16\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"14|4\"], \"0$1\"], [\"(\\\\d)(\\\\d{4})(\\\\d{4})\", \"$1 $2 $3\", [\"[2378]\"], \"(0$1)\"], [\"(\\\\d{4})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"1(?:30|[89])\"]]], \"0\", 0, \"0|(183[12])\", 0, 0, 0, [[\"(?:(?:2(?:[0-26-9]\\\\d|3[0-8]|4[02-9]|5[0135-9])|3(?:[0-3589]\\\\d|4[0-578]|6[1-9]|7[0-35-9])|7(?:[013-57-9]\\\\d|2[0-8]))\\\\d{3}|8(?:51(?:0(?:0[03-9]|[12479]\\\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\\\d|7[89]|9[0-4]))|(?:6[0-8]|[78]\\\\d)\\\\d{3}|9(?:[02-9]\\\\d{3}|1(?:(?:[0-58]\\\\d|6[0135-9])\\\\d|7(?:0[0-24-9]|[1-9]\\\\d)|9(?:[0-46-9]\\\\d|5[0-79])))))\\\\d{3}\", [9]], [\"4(?:83[0-38]|93[0-6])\\\\d{5}|4(?:[0-3]\\\\d|4[047-9]|5[0-25-9]|6[06-9]|7[02-9]|8[0-24-9]|9[0-27-9])\\\\d{6}\", [9]], [\"180(?:0\\\\d{3}|2)\\\\d{3}\", [7, 10]], [\"190[0-26]\\\\d{6}\", [10]], 0, 0, 0, [\"163\\\\d{2,6}\", [5, 6, 7, 8, 9]], [\"14(?:5(?:1[0458]|[23][458])|71\\\\d)\\\\d{4}\", [9]], [\"13(?:00\\\\d{6}(?:\\\\d{2})?|45[0-4]\\\\d{3})|13\\\\d{4}\", [6, 8, 10, 12]]], \"0011\"],\n \"AW\": [\"297\", \"00\", \"(?:[25-79]\\\\d\\\\d|800)\\\\d{4}\", [7], [[\"(\\\\d{3})(\\\\d{4})\", \"$1 $2\", [\"[25-9]\"]]]],\n \"AX\": [\"358\", \"00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))\", \"2\\\\d{4,9}|35\\\\d{4,5}|(?:60\\\\d\\\\d|800)\\\\d{4,6}|7\\\\d{5,11}|(?:[14]\\\\d|3[0-46-9]|50)\\\\d{4,8}\", [5, 6, 7, 8, 9, 10, 11, 12], 0, \"0\", 0, 0, 0, 0, \"18\", 0, \"00\"],\n \"AZ\": [\"994\", \"00\", \"365\\\\d{6}|(?:[124579]\\\\d|60|88)\\\\d{7}\", [9], [[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"90\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"1[28]|2|365|46\", \"1[28]|2|365[45]|46\", \"1[28]|2|365(?:4|5[02])|46\"], \"(0$1)\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[13-9]\"], \"0$1\"]], \"0\"],\n \"BA\": [\"387\", \"00\", \"6\\\\d{8}|(?:[35689]\\\\d|49|70)\\\\d{6}\", [8, 9], [[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"6[1-3]|[7-9]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\", \"$1 $2-$3\", [\"[3-5]|6[56]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{3})\", \"$1 $2 $3 $4\", [\"6\"], \"0$1\"]], \"0\"],\n \"BB\": [\"1\", \"011\", \"(?:246|[58]\\\\d\\\\d|900)\\\\d{7}\", [10], 0, \"1\", 0, \"1|([2-9]\\\\d{6})$\", \"246$1\", 0, \"246\"],\n \"BD\": [\"880\", \"00\", \"[1-469]\\\\d{9}|8[0-79]\\\\d{7,8}|[2-79]\\\\d{8}|[2-9]\\\\d{7}|[3-9]\\\\d{6}|[57-9]\\\\d{5}\", [6, 7, 8, 9, 10], [[\"(\\\\d{2})(\\\\d{4,6})\", \"$1-$2\", [\"31[5-8]|[459]1\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3,7})\", \"$1-$2\", [\"3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:28|4[14]|5)|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]\"], \"0$1\"], [\"(\\\\d{4})(\\\\d{3,6})\", \"$1-$2\", [\"[13-9]|22\"], \"0$1\"], [\"(\\\\d)(\\\\d{7,8})\", \"$1-$2\", [\"2\"], \"0$1\"]], \"0\"],\n \"BE\": [\"32\", \"00\", \"4\\\\d{8}|[1-9]\\\\d{7}\", [8, 9], [[\"(\\\\d{3})(\\\\d{2})(\\\\d{3})\", \"$1 $2 $3\", [\"(?:80|9)0\"], \"0$1\"], [\"(\\\\d)(\\\\d{3})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[239]|4[23]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[15-8]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"4\"], \"0$1\"]], \"0\"],\n \"BF\": [\"226\", \"00\", \"[025-7]\\\\d{7}\", [8], [[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[025-7]\"]]]],\n \"BG\": [\"359\", \"00\", \"[2-7]\\\\d{6,7}|[89]\\\\d{6,8}|2\\\\d{5}\", [6, 7, 8, 9], [[\"(\\\\d)(\\\\d)(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"2\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{4})\", \"$1 $2\", [\"43[1-6]|70[1-9]\"], \"0$1\"], [\"(\\\\d)(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"2\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{2,3})\", \"$1 $2 $3\", [\"[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{2})(\\\\d{3})\", \"$1 $2 $3\", [\"(?:70|8)0\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{2})\", \"$1 $2 $3\", [\"43[1-7]|7\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"[48]|9[08]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"9\"], \"0$1\"]], \"0\"],\n \"BH\": [\"973\", \"00\", \"[136-9]\\\\d{7}\", [8], [[\"(\\\\d{4})(\\\\d{4})\", \"$1 $2\", [\"[13679]|8[047]\"]]]],\n \"BI\": [\"257\", \"00\", \"(?:[267]\\\\d|31)\\\\d{6}\", [8], [[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[2367]\"]]]],\n \"BJ\": [\"229\", \"00\", \"(?:[25689]\\\\d|40)\\\\d{6}\", [8], [[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[24-689]\"]]]],\n \"BL\": [\"590\", \"00\", \"(?:590|(?:69|80)\\\\d|976)\\\\d{6}\", [9], 0, \"0\", 0, 0, 0, 0, 0, [[\"590(?:2[7-9]|5[12]|87)\\\\d{4}\"], [\"69(?:0\\\\d\\\\d|1(?:2[2-9]|3[0-5]))\\\\d{4}\"], [\"80[0-5]\\\\d{6}\"], 0, 0, 0, 0, 0, [\"976[01]\\\\d{5}\"]]],\n \"BM\": [\"1\", \"011\", \"(?:441|[58]\\\\d\\\\d|900)\\\\d{7}\", [10], 0, \"1\", 0, \"1|([2-8]\\\\d{6})$\", \"441$1\", 0, \"441\"],\n \"BN\": [\"673\", \"00\", \"[2-578]\\\\d{6}\", [7], [[\"(\\\\d{3})(\\\\d{4})\", \"$1 $2\", [\"[2-578]\"]]]],\n \"BO\": [\"591\", \"00(?:1\\\\d)?\", \"(?:[2-467]\\\\d\\\\d|8001)\\\\d{5}\", [8, 9], [[\"(\\\\d)(\\\\d{7})\", \"$1 $2\", [\"[23]|4[46]\"]], [\"(\\\\d{8})\", \"$1\", [\"[67]\"]], [\"(\\\\d{3})(\\\\d{2})(\\\\d{4})\", \"$1 $2 $3\", [\"8\"]]], \"0\", 0, \"0(1\\\\d)?\"],\n \"BQ\": [\"599\", \"00\", \"(?:[34]1|7\\\\d)\\\\d{5}\", [7], 0, 0, 0, 0, 0, 0, \"[347]\"],\n \"BR\": [\"55\", \"00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)\", \"(?:[1-46-9]\\\\d\\\\d|5(?:[0-46-9]\\\\d|5[0-46-9]))\\\\d{8}|[1-9]\\\\d{9}|[3589]\\\\d{8}|[34]\\\\d{7}\", [8, 9, 10, 11], [[\"(\\\\d{4})(\\\\d{4})\", \"$1-$2\", [\"300|4(?:0[02]|37)\", \"4(?:02|37)0|[34]00\"]], [\"(\\\\d{3})(\\\\d{2,3})(\\\\d{4})\", \"$1 $2 $3\", [\"(?:[358]|90)0\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{4})(\\\\d{4})\", \"$1 $2-$3\", [\"(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]\"], \"($1)\"], [\"(\\\\d{2})(\\\\d{5})(\\\\d{4})\", \"$1 $2-$3\", [\"[16][1-9]|[2-57-9]\"], \"($1)\"]], \"0\", 0, \"(?:0|90)(?:(1[245]|2[1-35]|31|4[13]|[56]5|99)(\\\\d{10,11}))?\", \"$2\"],\n \"BS\": [\"1\", \"011\", \"(?:242|[58]\\\\d\\\\d|900)\\\\d{7}\", [10], 0, \"1\", 0, \"1|([3-8]\\\\d{6})$\", \"242$1\", 0, \"242\"],\n \"BT\": [\"975\", \"00\", \"[17]\\\\d{7}|[2-8]\\\\d{6}\", [7, 8], [[\"(\\\\d)(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[2-68]|7[246]\"]], [\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"1[67]|7\"]]]],\n \"BW\": [\"267\", \"00\", \"(?:0800|(?:[37]|800)\\\\d)\\\\d{6}|(?:[2-6]\\\\d|90)\\\\d{5}\", [7, 8, 10], [[\"(\\\\d{2})(\\\\d{5})\", \"$1 $2\", [\"90\"]], [\"(\\\\d{3})(\\\\d{4})\", \"$1 $2\", [\"[24-6]|3[15-79]\"]], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[37]\"]], [\"(\\\\d{4})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"0\"]], [\"(\\\\d{3})(\\\\d{4})(\\\\d{3})\", \"$1 $2 $3\", [\"8\"]]]],\n \"BY\": [\"375\", \"810\", \"(?:[12]\\\\d|33|44|902)\\\\d{7}|8(?:0[0-79]\\\\d{5,7}|[1-7]\\\\d{9})|8(?:1[0-489]|[5-79]\\\\d)\\\\d{7}|8[1-79]\\\\d{6,7}|8[0-79]\\\\d{5}|8\\\\d{5}\", [6, 7, 8, 9, 10, 11], [[\"(\\\\d{3})(\\\\d{3})\", \"$1 $2\", [\"800\"], \"8 $1\"], [\"(\\\\d{3})(\\\\d{2})(\\\\d{2,4})\", \"$1 $2 $3\", [\"800\"], \"8 $1\"], [\"(\\\\d{4})(\\\\d{2})(\\\\d{3})\", \"$1 $2-$3\", [\"1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])\", \"1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])\"], \"8 0$1\"], [\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2-$3-$4\", [\"1(?:[56]|7[467])|2[1-3]\"], \"8 0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{2})(\\\\d{2})\", \"$1 $2-$3-$4\", [\"[1-4]\"], \"8 0$1\"], [\"(\\\\d{3})(\\\\d{3,4})(\\\\d{4})\", \"$1 $2 $3\", [\"[89]\"], \"8 $1\"]], \"8\", 0, \"0|80?\", 0, 0, 0, 0, \"8~10\"],\n \"BZ\": [\"501\", \"00\", \"(?:0800\\\\d|[2-8])\\\\d{6}\", [7, 11], [[\"(\\\\d{3})(\\\\d{4})\", \"$1-$2\", [\"[2-8]\"]], [\"(\\\\d)(\\\\d{3})(\\\\d{4})(\\\\d{3})\", \"$1-$2-$3-$4\", [\"0\"]]]],\n \"CA\": [\"1\", \"011\", \"(?:[2-8]\\\\d|90)\\\\d{8}|3\\\\d{6}\", [7, 10], 0, \"1\", 0, 0, 0, 0, 0, [[\"(?:2(?:04|[23]6|[48]9|50|63)|3(?:06|43|6[578])|4(?:03|1[68]|3[178]|50|68|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|13|39|47|72)|7(?:0[59]|78|8[02])|8(?:[06]7|19|25|73)|90[25])[2-9]\\\\d{6}\", [10]], [\"\", [10]], [\"8(?:00|33|44|55|66|77|88)[2-9]\\\\d{6}\", [10]], [\"900[2-9]\\\\d{6}\", [10]], [\"52(?:3(?:[2-46-9][02-9]\\\\d|5(?:[02-46-9]\\\\d|5[0-46-9]))|4(?:[2-478][02-9]\\\\d|5(?:[034]\\\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\\\d)|9(?:[05-9]\\\\d|2[0-5]|49)))\\\\d{4}|52[34][2-9]1[02-9]\\\\d{4}|(?:5(?:00|2[125-7]|33|44|66|77|88)|622)[2-9]\\\\d{6}\", [10]], 0, [\"310\\\\d{4}\", [7]], 0, [\"600[2-9]\\\\d{6}\", [10]]]],\n \"CC\": [\"61\", \"001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011\", \"1(?:[0-79]\\\\d{8}(?:\\\\d{2})?|8[0-24-9]\\\\d{7})|[148]\\\\d{8}|1\\\\d{5,7}\", [6, 7, 8, 9, 10, 12], 0, \"0\", 0, \"0|([59]\\\\d{7})$\", \"8$1\", 0, 0, [[\"8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\\\d|70[23]|959))\\\\d{3}\", [9]], [\"4(?:83[0-38]|93[0-6])\\\\d{5}|4(?:[0-3]\\\\d|4[047-9]|5[0-25-9]|6[06-9]|7[02-9]|8[0-24-9]|9[0-27-9])\\\\d{6}\", [9]], [\"180(?:0\\\\d{3}|2)\\\\d{3}\", [7, 10]], [\"190[0-26]\\\\d{6}\", [10]], 0, 0, 0, 0, [\"14(?:5(?:1[0458]|[23][458])|71\\\\d)\\\\d{4}\", [9]], [\"13(?:00\\\\d{6}(?:\\\\d{2})?|45[0-4]\\\\d{3})|13\\\\d{4}\", [6, 8, 10, 12]]], \"0011\"],\n \"CD\": [\"243\", \"00\", \"[189]\\\\d{8}|[1-68]\\\\d{6}\", [7, 9], [[\"(\\\\d{2})(\\\\d{2})(\\\\d{3})\", \"$1 $2 $3\", [\"88\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{5})\", \"$1 $2\", [\"[1-6]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"1\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[89]\"], \"0$1\"]], \"0\"],\n \"CF\": [\"236\", \"00\", \"(?:[27]\\\\d{3}|8776)\\\\d{4}\", [8], [[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[278]\"]]]],\n \"CG\": [\"242\", \"00\", \"222\\\\d{6}|(?:0\\\\d|80)\\\\d{7}\", [9], [[\"(\\\\d)(\\\\d{4})(\\\\d{4})\", \"$1 $2 $3\", [\"8\"]], [\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"[02]\"]]]],\n \"CH\": [\"41\", \"00\", \"8\\\\d{11}|[2-9]\\\\d{8}\", [9], [[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"8[047]|90\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[2-79]|81\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{2})(\\\\d{3})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4 $5\", [\"8\"], \"0$1\"]], \"0\"],\n \"CI\": [\"225\", \"00\", \"[02]\\\\d{9}\", [10], [[\"(\\\\d{2})(\\\\d{2})(\\\\d)(\\\\d{5})\", \"$1 $2 $3 $4\", [\"2\"]], [\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{4})\", \"$1 $2 $3 $4\", [\"0\"]]]],\n \"CK\": [\"682\", \"00\", \"[2-578]\\\\d{4}\", [5], [[\"(\\\\d{2})(\\\\d{3})\", \"$1 $2\", [\"[2-578]\"]]]],\n \"CL\": [\"56\", \"(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0\", \"12300\\\\d{6}|6\\\\d{9,10}|[2-9]\\\\d{8}\", [9, 10, 11], [[\"(\\\\d{5})(\\\\d{4})\", \"$1 $2\", [\"219\", \"2196\"], \"($1)\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"44\"]], [\"(\\\\d)(\\\\d{4})(\\\\d{4})\", \"$1 $2 $3\", [\"2[1-36]\"], \"($1)\"], [\"(\\\\d)(\\\\d{4})(\\\\d{4})\", \"$1 $2 $3\", [\"9[2-9]\"]], [\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-9]|[1-9])\"], \"($1)\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"60|8\"]], [\"(\\\\d{4})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"1\"]], [\"(\\\\d{3})(\\\\d{3})(\\\\d{2})(\\\\d{3})\", \"$1 $2 $3 $4\", [\"60\"]]]],\n \"CM\": [\"237\", \"00\", \"[26]\\\\d{8}|88\\\\d{6,7}\", [8, 9], [[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"88\"]], [\"(\\\\d)(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4 $5\", [\"[26]|88\"]]]],\n \"CN\": [\"86\", \"00|1(?:[12]\\\\d|79)\\\\d\\\\d00\", \"1[127]\\\\d{8,9}|2\\\\d{9}(?:\\\\d{2})?|[12]\\\\d{6,7}|86\\\\d{6}|(?:1[03-689]\\\\d|6)\\\\d{7,9}|(?:[3-579]\\\\d|8[0-57-9])\\\\d{6,9}\", [7, 8, 9, 10, 11, 12], [[\"(\\\\d{2})(\\\\d{5,6})\", \"$1 $2\", [\"(?:10|2[0-57-9])[19]\", \"(?:10|2[0-57-9])(?:10|9[56])\", \"(?:10|2[0-57-9])(?:100|9[56])\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{5,6})\", \"$1 $2\", [\"3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]\", \"(?:3(?:[157]\\\\d|35|49|9[1-68])|4(?:[17]\\\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\\\d|4[13]|5[1-5]))[19]\", \"85[23](?:10|95)|(?:3(?:[157]\\\\d|35|49|9[1-68])|4(?:[17]\\\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\\\d|4[13]|5[1-5]))(?:10|9[56])\", \"85[23](?:100|95)|(?:3(?:[157]\\\\d|35|49|9[1-68])|4(?:[17]\\\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\\\d|4[13]|5[1-5]))(?:100|9[56])\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"(?:4|80)0\"]], [\"(\\\\d{2})(\\\\d{4})(\\\\d{4})\", \"$1 $2 $3\", [\"10|2(?:[02-57-9]|1[1-9])\", \"10|2(?:[02-57-9]|1[1-9])\", \"10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])\"], \"0$1\", 1], [\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]\"], \"0$1\", 1], [\"(\\\\d{3})(\\\\d{7,8})\", \"$1 $2\", [\"9\"]], [\"(\\\\d{4})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"80\"], \"0$1\", 1], [\"(\\\\d{3})(\\\\d{4})(\\\\d{4})\", \"$1 $2 $3\", [\"[3-578]\"], \"0$1\", 1], [\"(\\\\d{3})(\\\\d{4})(\\\\d{4})\", \"$1 $2 $3\", [\"1[3-9]\"]], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3 $4\", [\"[12]\"], \"0$1\", 1]], \"0\", 0, \"0|(1(?:[12]\\\\d|79)\\\\d\\\\d)\", 0, 0, 0, 0, \"00\"],\n \"CO\": [\"57\", \"00(?:4(?:[14]4|56)|[579])\", \"(?:60\\\\d\\\\d|9101)\\\\d{6}|(?:1\\\\d|3)\\\\d{9}\", [10, 11], [[\"(\\\\d{3})(\\\\d{7})\", \"$1 $2\", [\"6\"], \"($1)\"], [\"(\\\\d{3})(\\\\d{7})\", \"$1 $2\", [\"[39]\"]], [\"(\\\\d)(\\\\d{3})(\\\\d{7})\", \"$1-$2-$3\", [\"1\"], \"0$1\", 0, \"$1 $2 $3\"]], \"0\", 0, \"0(4(?:[14]4|56)|[579])?\"],\n \"CR\": [\"506\", \"00\", \"(?:8\\\\d|90)\\\\d{8}|(?:[24-8]\\\\d{3}|3005)\\\\d{4}\", [8, 10], [[\"(\\\\d{4})(\\\\d{4})\", \"$1 $2\", [\"[2-7]|8[3-9]\"]], [\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$1-$2-$3\", [\"[89]\"]]], 0, 0, \"(19(?:0[0-2468]|1[09]|20|66|77|99))\"],\n \"CU\": [\"53\", \"119\", \"[27]\\\\d{6,7}|[34]\\\\d{5,7}|(?:5|8\\\\d\\\\d)\\\\d{7}\", [6, 7, 8, 10], [[\"(\\\\d{2})(\\\\d{4,6})\", \"$1 $2\", [\"2[1-4]|[34]\"], \"(0$1)\"], [\"(\\\\d)(\\\\d{6,7})\", \"$1 $2\", [\"7\"], \"(0$1)\"], [\"(\\\\d)(\\\\d{7})\", \"$1 $2\", [\"5\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{7})\", \"$1 $2\", [\"8\"], \"0$1\"]], \"0\"],\n \"CV\": [\"238\", \"0\", \"(?:[2-59]\\\\d\\\\d|800)\\\\d{4}\", [7], [[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3\", [\"[2-589]\"]]]],\n \"CW\": [\"599\", \"00\", \"(?:[34]1|60|(?:7|9\\\\d)\\\\d)\\\\d{5}\", [7, 8], [[\"(\\\\d{3})(\\\\d{4})\", \"$1 $2\", [\"[3467]\"]], [\"(\\\\d)(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"9[4-8]\"]]], 0, 0, 0, 0, 0, \"[69]\"],\n \"CX\": [\"61\", \"001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011\", \"1(?:[0-79]\\\\d{8}(?:\\\\d{2})?|8[0-24-9]\\\\d{7})|[148]\\\\d{8}|1\\\\d{5,7}\", [6, 7, 8, 9, 10, 12], 0, \"0\", 0, \"0|([59]\\\\d{7})$\", \"8$1\", 0, 0, [[\"8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\\\d|7(?:0[01]|1[0-2])|958))\\\\d{3}\", [9]], [\"4(?:83[0-38]|93[0-6])\\\\d{5}|4(?:[0-3]\\\\d|4[047-9]|5[0-25-9]|6[06-9]|7[02-9]|8[0-24-9]|9[0-27-9])\\\\d{6}\", [9]], [\"180(?:0\\\\d{3}|2)\\\\d{3}\", [7, 10]], [\"190[0-26]\\\\d{6}\", [10]], 0, 0, 0, 0, [\"14(?:5(?:1[0458]|[23][458])|71\\\\d)\\\\d{4}\", [9]], [\"13(?:00\\\\d{6}(?:\\\\d{2})?|45[0-4]\\\\d{3})|13\\\\d{4}\", [6, 8, 10, 12]]], \"0011\"],\n \"CY\": [\"357\", \"00\", \"(?:[279]\\\\d|[58]0)\\\\d{6}\", [8], [[\"(\\\\d{2})(\\\\d{6})\", \"$1 $2\", [\"[257-9]\"]]]],\n \"CZ\": [\"420\", \"00\", \"(?:[2-578]\\\\d|60)\\\\d{7}|9\\\\d{8,11}\", [9], [[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[2-8]|9[015-7]\"]], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"96\"]], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3 $4\", [\"9\"]], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3 $4\", [\"9\"]]]],\n \"DE\": [\"49\", \"00\", \"[2579]\\\\d{5,14}|49(?:[34]0|69|8\\\\d)\\\\d\\\\d?|49(?:37|49|60|7[089]|9\\\\d)\\\\d{1,3}|49(?:2[02-9]|3[2-689]|7[1-7])\\\\d{1,8}|(?:1|[368]\\\\d|4[0-8])\\\\d{3,13}|49(?:[015]\\\\d|[23]1|[46][1-8])\\\\d{1,9}\", [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [[\"(\\\\d{2})(\\\\d{3,13})\", \"$1 $2\", [\"3[02]|40|[68]9\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3,12})\", \"$1 $2\", [\"2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1\", \"2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1\"], \"0$1\"], [\"(\\\\d{4})(\\\\d{2,11})\", \"$1 $2\", [\"[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]\", \"[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{4})\", \"$1 $2\", [\"138\"], \"0$1\"], [\"(\\\\d{5})(\\\\d{2,10})\", \"$1 $2\", [\"3\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{5,11})\", \"$1 $2\", [\"181\"], \"0$1\"], [\"(\\\\d{3})(\\\\d)(\\\\d{4,10})\", \"$1 $2 $3\", [\"1(?:3|80)|9\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{7,8})\", \"$1 $2\", [\"1[67]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{7,12})\", \"$1 $2\", [\"8\"], \"0$1\"], [\"(\\\\d{5})(\\\\d{6})\", \"$1 $2\", [\"185\", \"1850\", \"18500\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{4})(\\\\d{4})\", \"$1 $2 $3\", [\"7\"], \"0$1\"], [\"(\\\\d{4})(\\\\d{7})\", \"$1 $2\", [\"18[68]\"], \"0$1\"], [\"(\\\\d{5})(\\\\d{6})\", \"$1 $2\", [\"15[0568]\"], \"0$1\"], [\"(\\\\d{4})(\\\\d{7})\", \"$1 $2\", [\"15[1279]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{8})\", \"$1 $2\", [\"18\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{2})(\\\\d{7,8})\", \"$1 $2 $3\", [\"1(?:6[023]|7)\"], \"0$1\"], [\"(\\\\d{4})(\\\\d{2})(\\\\d{7})\", \"$1 $2 $3\", [\"15[279]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{2})(\\\\d{8})\", \"$1 $2 $3\", [\"15\"], \"0$1\"]], \"0\"],\n \"DJ\": [\"253\", \"00\", \"(?:2\\\\d|77)\\\\d{6}\", [8], [[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[27]\"]]]],\n \"DK\": [\"45\", \"00\", \"[2-9]\\\\d{7}\", [8], [[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[2-9]\"]]]],\n \"DM\": [\"1\", \"011\", \"(?:[58]\\\\d\\\\d|767|900)\\\\d{7}\", [10], 0, \"1\", 0, \"1|([2-7]\\\\d{6})$\", \"767$1\", 0, \"767\"],\n \"DO\": [\"1\", \"011\", \"(?:[58]\\\\d\\\\d|900)\\\\d{7}\", [10], 0, \"1\", 0, 0, 0, 0, \"8001|8[024]9\"],\n \"DZ\": [\"213\", \"00\", \"(?:[1-4]|[5-79]\\\\d|80)\\\\d{7}\", [8, 9], [[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[1-4]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"9\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[5-8]\"], \"0$1\"]], \"0\"],\n \"EC\": [\"593\", \"00\", \"1\\\\d{9,10}|(?:[2-7]|9\\\\d)\\\\d{7}\", [8, 9, 10, 11], [[\"(\\\\d)(\\\\d{3})(\\\\d{4})\", \"$1 $2-$3\", [\"[2-7]\"], \"(0$1)\", 0, \"$1-$2-$3\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"9\"], \"0$1\"], [\"(\\\\d{4})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"1\"]]], \"0\"],\n \"EE\": [\"372\", \"00\", \"8\\\\d{9}|[4578]\\\\d{7}|(?:[3-8]\\\\d|90)\\\\d{5}\", [7, 8, 10], [[\"(\\\\d{3})(\\\\d{4})\", \"$1 $2\", [\"[369]|4[3-8]|5(?:[0-2]|5[0-478]|6[45])|7[1-9]|88\", \"[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]|88\"]], [\"(\\\\d{4})(\\\\d{3,4})\", \"$1 $2\", [\"[45]|8(?:00|[1-49])\", \"[45]|8(?:00[1-9]|[1-49])\"]], [\"(\\\\d{2})(\\\\d{2})(\\\\d{4})\", \"$1 $2 $3\", [\"7\"]], [\"(\\\\d{4})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"8\"]]]],\n \"EG\": [\"20\", \"00\", \"[189]\\\\d{8,9}|[24-6]\\\\d{8}|[135]\\\\d{7}\", [8, 9, 10], [[\"(\\\\d)(\\\\d{7,8})\", \"$1 $2\", [\"[23]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{6,7})\", \"$1 $2\", [\"1[35]|[4-6]|8[2468]|9[235-7]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"[189]\"], \"0$1\"]], \"0\"],\n \"EH\": [\"212\", \"00\", \"[5-8]\\\\d{8}\", [9], 0, \"0\", 0, 0, 0, 0, \"528[89]\"],\n \"ER\": [\"291\", \"00\", \"[178]\\\\d{6}\", [7], [[\"(\\\\d)(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[178]\"], \"0$1\"]], \"0\"],\n \"ES\": [\"34\", \"00\", \"[5-9]\\\\d{8}\", [9], [[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[89]00\"]], [\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[5-9]\"]]]],\n \"ET\": [\"251\", \"00\", \"(?:11|[2-579]\\\\d)\\\\d{7}\", [9], [[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"[1-579]\"], \"0$1\"]], \"0\"],\n \"FI\": [\"358\", \"00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))\", \"[1-35689]\\\\d{4}|7\\\\d{10,11}|(?:[124-7]\\\\d|3[0-46-9])\\\\d{8}|[1-9]\\\\d{5,8}\", [5, 6, 7, 8, 9, 10, 11, 12], [[\"(\\\\d)(\\\\d{4,9})\", \"$1 $2\", [\"[2568][1-8]|3(?:0[1-9]|[1-9])|9\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3,7})\", \"$1 $2\", [\"[12]00|[368]|70[07-9]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{4,8})\", \"$1 $2\", [\"[1245]|7[135]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{6,10})\", \"$1 $2\", [\"7\"], \"0$1\"]], \"0\", 0, 0, 0, 0, \"1[03-79]|[2-9]\", 0, \"00\"],\n \"FJ\": [\"679\", \"0(?:0|52)\", \"45\\\\d{5}|(?:0800\\\\d|[235-9])\\\\d{6}\", [7, 11], [[\"(\\\\d{3})(\\\\d{4})\", \"$1 $2\", [\"[235-9]|45\"]], [\"(\\\\d{4})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"0\"]]], 0, 0, 0, 0, 0, 0, 0, \"00\"],\n \"FK\": [\"500\", \"00\", \"[2-7]\\\\d{4}\", [5]],\n \"FM\": [\"691\", \"00\", \"(?:[39]\\\\d\\\\d|820)\\\\d{4}\", [7], [[\"(\\\\d{3})(\\\\d{4})\", \"$1 $2\", [\"[389]\"]]]],\n \"FO\": [\"298\", \"00\", \"[2-9]\\\\d{5}\", [6], [[\"(\\\\d{6})\", \"$1\", [\"[2-9]\"]]], 0, 0, \"(10(?:01|[12]0|88))\"],\n \"FR\": [\"33\", \"00\", \"[1-9]\\\\d{8}\", [9], [[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"8\"], \"0 $1\"], [\"(\\\\d)(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4 $5\", [\"[1-79]\"], \"0$1\"]], \"0\"],\n \"GA\": [\"241\", \"00\", \"(?:[067]\\\\d|11)\\\\d{6}|[2-7]\\\\d{6}\", [7, 8], [[\"(\\\\d)(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[2-7]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"0\"]], [\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"11|[67]\"], \"0$1\"]], 0, 0, \"0(11\\\\d{6}|60\\\\d{6}|61\\\\d{6}|6[256]\\\\d{6}|7[467]\\\\d{6})\", \"$1\"],\n \"GB\": [\"44\", \"00\", \"[1-357-9]\\\\d{9}|[18]\\\\d{8}|8\\\\d{6}\", [7, 9, 10], [[\"(\\\\d{3})(\\\\d{4})\", \"$1 $2\", [\"800\", \"8001\", \"80011\", \"800111\", \"8001111\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3\", [\"845\", \"8454\", \"84546\", \"845464\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{6})\", \"$1 $2\", [\"800\"], \"0$1\"], [\"(\\\\d{5})(\\\\d{4,5})\", \"$1 $2\", [\"1(?:38|5[23]|69|76|94)\", \"1(?:(?:38|69)7|5(?:24|39)|768|946)\", \"1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)\"], \"0$1\"], [\"(\\\\d{4})(\\\\d{5,6})\", \"$1 $2\", [\"1(?:[2-69][02-9]|[78])\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{4})(\\\\d{4})\", \"$1 $2 $3\", [\"[25]|7(?:0|6[02-9])\", \"[25]|7(?:0|6(?:[03-9]|2[356]))\"], \"0$1\"], [\"(\\\\d{4})(\\\\d{6})\", \"$1 $2\", [\"7\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"[1389]\"], \"0$1\"]], \"0\", 0, 0, 0, 0, 0, [[\"(?:1(?:1(?:3(?:[0-58]\\\\d\\\\d|73[0235])|4(?:[0-5]\\\\d\\\\d|69[7-9]|70[01359])|(?:5[0-26-9]|[78][0-49])\\\\d\\\\d|6(?:[0-4]\\\\d\\\\d|50[0-79]))|2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\\\d)\\\\d\\\\d|1(?:[0-7]\\\\d\\\\d|8(?:[02]\\\\d|1[0-26-9])))|(?:3(?:0\\\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\\\d\\\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\\\d{3})\\\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\\\d)|76\\\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\\\d|7[4-79])|295[5-7]|35[34]\\\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\\\d{3}\", [9, 10]], [\"7(?:457[0-57-9]|700[01]|911[028])\\\\d{5}|7(?:[1-3]\\\\d\\\\d|4(?:[0-46-9]\\\\d|5[0-689])|5(?:0[0-8]|[13-9]\\\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\\\d|8[02-9]|9[0-689])|8(?:[014-9]\\\\d|[23][0-8])|9(?:[024-9]\\\\d|1[02-9]|3[0-689]))\\\\d{6}\", [10]], [\"80[08]\\\\d{7}|800\\\\d{6}|8001111\"], [\"(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\\\d|8[2-49]))\\\\d{7}|845464\\\\d\", [7, 10]], [\"70\\\\d{8}\", [10]], 0, [\"(?:3[0347]|55)\\\\d{8}\", [10]], [\"76(?:464|652)\\\\d{5}|76(?:0[0-2]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\\\d{6}\", [10]], [\"56\\\\d{8}\", [10]]], 0, \" x\"],\n \"GD\": [\"1\", \"011\", \"(?:473|[58]\\\\d\\\\d|900)\\\\d{7}\", [10], 0, \"1\", 0, \"1|([2-9]\\\\d{6})$\", \"473$1\", 0, \"473\"],\n \"GE\": [\"995\", \"00\", \"(?:[3-57]\\\\d\\\\d|800)\\\\d{6}\", [9], [[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"70\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"32\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[57]\"]], [\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[348]\"], \"0$1\"]], \"0\"],\n \"GF\": [\"594\", \"00\", \"(?:[56]94|80\\\\d|976)\\\\d{6}\", [9], [[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[569]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"8\"], \"0$1\"]], \"0\"],\n \"GG\": [\"44\", \"00\", \"(?:1481|[357-9]\\\\d{3})\\\\d{6}|8\\\\d{6}(?:\\\\d{2})?\", [7, 9, 10], 0, \"0\", 0, \"0|([25-9]\\\\d{5})$\", \"1481$1\", 0, 0, [[\"1481[25-9]\\\\d{5}\", [10]], [\"7(?:(?:781|839)\\\\d|911[17])\\\\d{5}\", [10]], [\"80[08]\\\\d{7}|800\\\\d{6}|8001111\"], [\"(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\\\d|8[0-3]))\\\\d{7}|845464\\\\d\", [7, 10]], [\"70\\\\d{8}\", [10]], 0, [\"(?:3[0347]|55)\\\\d{8}\", [10]], [\"76(?:464|652)\\\\d{5}|76(?:0[0-2]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\\\d{6}\", [10]], [\"56\\\\d{8}\", [10]]]],\n \"GH\": [\"233\", \"00\", \"(?:[235]\\\\d{3}|800)\\\\d{5}\", [8, 9], [[\"(\\\\d{3})(\\\\d{5})\", \"$1 $2\", [\"8\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"[235]\"], \"0$1\"]], \"0\"],\n \"GI\": [\"350\", \"00\", \"(?:[25]\\\\d\\\\d|606)\\\\d{5}\", [8], [[\"(\\\\d{3})(\\\\d{5})\", \"$1 $2\", [\"2\"]]]],\n \"GL\": [\"299\", \"00\", \"(?:19|[2-689]\\\\d|70)\\\\d{4}\", [6], [[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3\", [\"19|[2-9]\"]]]],\n \"GM\": [\"220\", \"00\", \"[2-9]\\\\d{6}\", [7], [[\"(\\\\d{3})(\\\\d{4})\", \"$1 $2\", [\"[2-9]\"]]]],\n \"GN\": [\"224\", \"00\", \"722\\\\d{6}|(?:3|6\\\\d)\\\\d{7}\", [8, 9], [[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"3\"]], [\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[67]\"]]]],\n \"GP\": [\"590\", \"00\", \"(?:590|(?:69|80)\\\\d|976)\\\\d{6}\", [9], [[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[569]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"8\"], \"0$1\"]], \"0\", 0, 0, 0, 0, 0, [[\"590(?:0[1-68]|[14][0-24-9]|2[0-68]|3[1289]|5[3-579]|6[0-289]|7[08]|8[0-689]|9\\\\d)\\\\d{4}\"], [\"69(?:0\\\\d\\\\d|1(?:2[2-9]|3[0-5]))\\\\d{4}\"], [\"80[0-5]\\\\d{6}\"], 0, 0, 0, 0, 0, [\"976[01]\\\\d{5}\"]]],\n \"GQ\": [\"240\", \"00\", \"222\\\\d{6}|(?:3\\\\d|55|[89]0)\\\\d{7}\", [9], [[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[235]\"]], [\"(\\\\d{3})(\\\\d{6})\", \"$1 $2\", [\"[89]\"]]]],\n \"GR\": [\"30\", \"00\", \"5005000\\\\d{3}|8\\\\d{9,11}|(?:[269]\\\\d|70)\\\\d{8}\", [10, 11, 12], [[\"(\\\\d{2})(\\\\d{4})(\\\\d{4})\", \"$1 $2 $3\", [\"21|7\"]], [\"(\\\\d{4})(\\\\d{6})\", \"$1 $2\", [\"2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5\"]], [\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"[2689]\"]], [\"(\\\\d{3})(\\\\d{3,4})(\\\\d{5})\", \"$1 $2 $3\", [\"8\"]]]],\n \"GT\": [\"502\", \"00\", \"(?:1\\\\d{3}|[2-7])\\\\d{7}\", [8, 11], [[\"(\\\\d{4})(\\\\d{4})\", \"$1 $2\", [\"[2-7]\"]], [\"(\\\\d{4})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"1\"]]]],\n \"GU\": [\"1\", \"011\", \"(?:[58]\\\\d\\\\d|671|900)\\\\d{7}\", [10], 0, \"1\", 0, \"1|([3-9]\\\\d{6})$\", \"671$1\", 0, \"671\"],\n \"GW\": [\"245\", \"00\", \"[49]\\\\d{8}|4\\\\d{6}\", [7, 9], [[\"(\\\\d{3})(\\\\d{4})\", \"$1 $2\", [\"40\"]], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[49]\"]]]],\n \"GY\": [\"592\", \"001\", \"9008\\\\d{3}|(?:[2-467]\\\\d\\\\d|862)\\\\d{4}\", [7], [[\"(\\\\d{3})(\\\\d{4})\", \"$1 $2\", [\"[2-46-9]\"]]]],\n \"HK\": [\"852\", \"00(?:30|5[09]|[126-9]?)\", \"8[0-46-9]\\\\d{6,7}|9\\\\d{4,7}|(?:[2-7]|9\\\\d{3})\\\\d{7}\", [5, 6, 7, 8, 9, 11], [[\"(\\\\d{3})(\\\\d{2,5})\", \"$1 $2\", [\"900\", \"9003\"]], [\"(\\\\d{4})(\\\\d{4})\", \"$1 $2\", [\"[2-7]|8[1-4]|9(?:0[1-9]|[1-8])\"]], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"8\"]], [\"(\\\\d{3})(\\\\d{2})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3 $4\", [\"9\"]]], 0, 0, 0, 0, 0, 0, 0, \"00\"],\n \"HN\": [\"504\", \"00\", \"8\\\\d{10}|[237-9]\\\\d{7}\", [8, 11], [[\"(\\\\d{4})(\\\\d{4})\", \"$1-$2\", [\"[237-9]\"]]]],\n \"HR\": [\"385\", \"00\", \"(?:[24-69]\\\\d|3[0-79])\\\\d{7}|80\\\\d{5,7}|[1-79]\\\\d{7}|6\\\\d{5,6}\", [6, 7, 8, 9], [[\"(\\\\d{2})(\\\\d{2})(\\\\d{2,3})\", \"$1 $2 $3\", [\"6[01]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{2})(\\\\d{2,3})\", \"$1 $2 $3\", [\"8\"], \"0$1\"], [\"(\\\\d)(\\\\d{4})(\\\\d{3})\", \"$1 $2 $3\", [\"1\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"[67]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"9\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"[2-5]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"8\"], \"0$1\"]], \"0\"],\n \"HT\": [\"509\", \"00\", \"[2-489]\\\\d{7}\", [8], [[\"(\\\\d{2})(\\\\d{2})(\\\\d{4})\", \"$1 $2 $3\", [\"[2-489]\"]]]],\n \"HU\": [\"36\", \"00\", \"[235-7]\\\\d{8}|[1-9]\\\\d{7}\", [8, 9], [[\"(\\\\d)(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"1\"], \"(06 $1)\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6|8[2-57-9]|9[2-69]\"], \"(06 $1)\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"[2-9]\"], \"06 $1\"]], \"06\"],\n \"ID\": [\"62\", \"00[89]\", \"(?:(?:00[1-9]|8\\\\d)\\\\d{4}|[1-36])\\\\d{6}|00\\\\d{10}|[1-9]\\\\d{8,10}|[2-9]\\\\d{7}\", [7, 8, 9, 10, 11, 12, 13], [[\"(\\\\d)(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"15\"]], [\"(\\\\d{2})(\\\\d{5,9})\", \"$1 $2\", [\"2[124]|[36]1\"], \"(0$1)\"], [\"(\\\\d{3})(\\\\d{5,7})\", \"$1 $2\", [\"800\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{5,8})\", \"$1 $2\", [\"[2-79]\"], \"(0$1)\"], [\"(\\\\d{3})(\\\\d{3,4})(\\\\d{3})\", \"$1-$2-$3\", [\"8[1-35-9]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{6,8})\", \"$1 $2\", [\"1\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"804\"], \"0$1\"], [\"(\\\\d{3})(\\\\d)(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3 $4\", [\"80\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{4})(\\\\d{4,5})\", \"$1-$2-$3\", [\"8\"], \"0$1\"]], \"0\"],\n \"IE\": [\"353\", \"00\", \"(?:1\\\\d|[2569])\\\\d{6,8}|4\\\\d{6,9}|7\\\\d{8}|8\\\\d{8,9}\", [7, 8, 9, 10], [[\"(\\\\d{2})(\\\\d{5})\", \"$1 $2\", [\"2[24-9]|47|58|6[237-9]|9[35-9]\"], \"(0$1)\"], [\"(\\\\d{3})(\\\\d{5})\", \"$1 $2\", [\"[45]0\"], \"(0$1)\"], [\"(\\\\d)(\\\\d{3,4})(\\\\d{4})\", \"$1 $2 $3\", [\"1\"], \"(0$1)\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"[2569]|4[1-69]|7[14]\"], \"(0$1)\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"70\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"81\"], \"(0$1)\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"[78]\"], \"0$1\"], [\"(\\\\d{4})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"1\"]], [\"(\\\\d{2})(\\\\d{4})(\\\\d{4})\", \"$1 $2 $3\", [\"4\"], \"(0$1)\"], [\"(\\\\d{2})(\\\\d)(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3 $4\", [\"8\"], \"0$1\"]], \"0\"],\n \"IL\": [\"972\", \"0(?:0|1[2-9])\", \"1\\\\d{6}(?:\\\\d{3,5})?|[57]\\\\d{8}|[1-489]\\\\d{7}\", [7, 8, 9, 10, 11, 12], [[\"(\\\\d{4})(\\\\d{3})\", \"$1-$2\", [\"125\"]], [\"(\\\\d{4})(\\\\d{2})(\\\\d{2})\", \"$1-$2-$3\", [\"121\"]], [\"(\\\\d)(\\\\d{3})(\\\\d{4})\", \"$1-$2-$3\", [\"[2-489]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1-$2-$3\", [\"[57]\"], \"0$1\"], [\"(\\\\d{4})(\\\\d{3})(\\\\d{3})\", \"$1-$2-$3\", [\"12\"]], [\"(\\\\d{4})(\\\\d{6})\", \"$1-$2\", [\"159\"]], [\"(\\\\d)(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1-$2-$3-$4\", [\"1[7-9]\"]], [\"(\\\\d{3})(\\\\d{1,2})(\\\\d{3})(\\\\d{4})\", \"$1-$2 $3-$4\", [\"15\"]]], \"0\"],\n \"IM\": [\"44\", \"00\", \"1624\\\\d{6}|(?:[3578]\\\\d|90)\\\\d{8}\", [10], 0, \"0\", 0, \"0|([25-8]\\\\d{5})$\", \"1624$1\", 0, \"74576|(?:16|7[56])24\"],\n \"IN\": [\"91\", \"00\", \"(?:000800|[2-9]\\\\d\\\\d)\\\\d{7}|1\\\\d{7,12}\", [8, 9, 10, 11, 12, 13], [[\"(\\\\d{8})\", \"$1\", [\"5(?:0|2[23]|3[03]|[67]1|88)\", \"5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)\", \"5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)\"], 0, 1], [\"(\\\\d{4})(\\\\d{4,5})\", \"$1 $2\", [\"180\", \"1800\"], 0, 1], [\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"140\"], 0, 1], [\"(\\\\d{2})(\\\\d{4})(\\\\d{4})\", \"$1 $2 $3\", [\"11|2[02]|33|4[04]|79[1-7]|80[2-46]\", \"11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])\", \"11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])\"], \"0$1\", 1], [\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|4[47]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67|72)[14]\", \"1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:2[14]|3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31|4[47])|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]\", \"1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:(?:2[14]|5[15])[2-6]|3171|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|(?:74[47]|8(?:16|2[014]|3[126]|6[136]|7[78]|83))(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]\"], \"0$1\", 1], [\"(\\\\d{4})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|28|3[129]|4[1-35689]|5[29]|6[02-5]|70)|807\", \"1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1(?:[013-8]|9[6-9])|28[6-8]|3(?:17|2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]\", \"1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|83)|73179|807(?:1|9[1-3])|(?:1552|6(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[124-6])\\\\d|7(?:1(?:[013-8]\\\\d|9[6-9])|28[6-8]|3(?:2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]\\\\d|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\\\d|5[0-367])|70[13-7]))[2-7]\"], \"0$1\", 1], [\"(\\\\d{5})(\\\\d{5})\", \"$1 $2\", [\"[6-9]\"], \"0$1\", 1], [\"(\\\\d{4})(\\\\d{2,4})(\\\\d{4})\", \"$1 $2 $3\", [\"1(?:6|8[06])\", \"1(?:6|8[06]0)\"], 0, 1], [\"(\\\\d{4})(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3 $4\", [\"18\"], 0, 1]], \"0\"],\n \"IO\": [\"246\", \"00\", \"3\\\\d{6}\", [7], [[\"(\\\\d{3})(\\\\d{4})\", \"$1 $2\", [\"3\"]]]],\n \"IQ\": [\"964\", \"00\", \"(?:1|7\\\\d\\\\d)\\\\d{7}|[2-6]\\\\d{7,8}\", [8, 9, 10], [[\"(\\\\d)(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"1\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"[2-6]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"7\"], \"0$1\"]], \"0\"],\n \"IR\": [\"98\", \"00\", \"[1-9]\\\\d{9}|(?:[1-8]\\\\d\\\\d|9)\\\\d{3,4}\", [4, 5, 6, 7, 10], [[\"(\\\\d{4,5})\", \"$1\", [\"96\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{4,5})\", \"$1 $2\", [\"(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])[12689]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"9\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{4})(\\\\d{4})\", \"$1 $2 $3\", [\"[1-8]\"], \"0$1\"]], \"0\"],\n \"IS\": [\"354\", \"00|1(?:0(?:01|[12]0)|100)\", \"(?:38\\\\d|[4-9])\\\\d{6}\", [7, 9], [[\"(\\\\d{3})(\\\\d{4})\", \"$1 $2\", [\"[4-9]\"]], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"3\"]]], 0, 0, 0, 0, 0, 0, 0, \"00\"],\n \"IT\": [\"39\", \"00\", \"0\\\\d{5,10}|1\\\\d{8,10}|3(?:[0-8]\\\\d{7,10}|9\\\\d{7,8})|(?:55|70)\\\\d{8}|8\\\\d{5}(?:\\\\d{2,4})?\", [6, 7, 8, 9, 10, 11], [[\"(\\\\d{2})(\\\\d{4,6})\", \"$1 $2\", [\"0[26]\"]], [\"(\\\\d{3})(\\\\d{3,6})\", \"$1 $2\", [\"0[13-57-9][0159]|8(?:03|4[17]|9[2-5])\", \"0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))\"]], [\"(\\\\d{4})(\\\\d{2,6})\", \"$1 $2\", [\"0(?:[13-579][2-46-8]|8[236-8])\"]], [\"(\\\\d{4})(\\\\d{4})\", \"$1 $2\", [\"894\"]], [\"(\\\\d{2})(\\\\d{3,4})(\\\\d{4})\", \"$1 $2 $3\", [\"0[26]|5\"]], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"1(?:44|[679])|[378]\"]], [\"(\\\\d{3})(\\\\d{3,4})(\\\\d{4})\", \"$1 $2 $3\", [\"0[13-57-9][0159]|14\"]], [\"(\\\\d{2})(\\\\d{4})(\\\\d{5})\", \"$1 $2 $3\", [\"0[26]\"]], [\"(\\\\d{4})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"0\"]], [\"(\\\\d{3})(\\\\d{4})(\\\\d{4,5})\", \"$1 $2 $3\", [\"3\"]]], 0, 0, 0, 0, 0, 0, [[\"0669[0-79]\\\\d{1,6}|0(?:1(?:[0159]\\\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\\\d\\\\d|3(?:[0159]\\\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\\\d|6[0-8])|7(?:[0159]\\\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\\\d|2[3-578]|3[1-356]|[6-8][1-5])|9(?:[0159]\\\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\\\d{2,7}\"], [\"3[1-9]\\\\d{8}|3[2-9]\\\\d{7}\", [9, 10]], [\"80(?:0\\\\d{3}|3)\\\\d{3}\", [6, 9]], [\"(?:0878\\\\d{3}|89(?:2\\\\d|3[04]|4(?:[0-4]|[5-9]\\\\d\\\\d)|5[0-4]))\\\\d\\\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\\\d{6}\", [6, 8, 9, 10]], [\"1(?:78\\\\d|99)\\\\d{6}\", [9, 10]], 0, 0, 0, [\"55\\\\d{8}\", [10]], [\"84(?:[08]\\\\d{3}|[17])\\\\d{3}\", [6, 9]]]],\n \"JE\": [\"44\", \"00\", \"1534\\\\d{6}|(?:[3578]\\\\d|90)\\\\d{8}\", [10], 0, \"0\", 0, \"0|([0-24-8]\\\\d{5})$\", \"1534$1\", 0, 0, [[\"1534[0-24-8]\\\\d{5}\"], [\"7(?:(?:(?:50|82)9|937)\\\\d|7(?:00[378]|97[7-9]))\\\\d{5}\"], [\"80(?:07(?:35|81)|8901)\\\\d{4}\"], [\"(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\\\d{4}\"], [\"701511\\\\d{4}\"], 0, [\"(?:3(?:0(?:07(?:35|81)|8901)|3\\\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\\\d{4})\\\\d{4}\"], [\"76(?:464|652)\\\\d{5}|76(?:0[0-2]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\\\d{6}\"], [\"56\\\\d{8}\"]]],\n \"JM\": [\"1\", \"011\", \"(?:[58]\\\\d\\\\d|658|900)\\\\d{7}\", [10], 0, \"1\", 0, 0, 0, 0, \"658|876\"],\n \"JO\": [\"962\", \"00\", \"(?:(?:[2689]|7\\\\d)\\\\d|32|53)\\\\d{6}\", [8, 9], [[\"(\\\\d)(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"[2356]|87\"], \"(0$1)\"], [\"(\\\\d{3})(\\\\d{5,6})\", \"$1 $2\", [\"[89]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{7})\", \"$1 $2\", [\"70\"], \"0$1\"], [\"(\\\\d)(\\\\d{4})(\\\\d{4})\", \"$1 $2 $3\", [\"7\"], \"0$1\"]], \"0\"],\n \"JP\": [\"81\", \"010\", \"00[1-9]\\\\d{6,14}|[257-9]\\\\d{9}|(?:00|[1-9]\\\\d\\\\d)\\\\d{6}\", [8, 9, 10, 11, 12, 13, 14, 15, 16, 17], [[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1-$2-$3\", [\"(?:12|57|99)0\"], \"0$1\"], [\"(\\\\d{4})(\\\\d)(\\\\d{4})\", \"$1-$2-$3\", [\"1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51|63)|9(?:80|9[16])\", \"1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9]|636)|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]\", \"1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9]|636[457-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1-$2-$3\", [\"60\"], \"0$1\"], [\"(\\\\d)(\\\\d{4})(\\\\d{4})\", \"$1-$2-$3\", [\"[36]|4(?:2[09]|7[01])\", \"[36]|4(?:2(?:0|9[02-69])|7(?:0[019]|1))\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1-$2-$3\", [\"1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[045]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[27-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])\", \"1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9])|5(?:2|3[045]|4[0-369]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|49|51|6(?:[0-24]|36|5[0-3589]|72|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:49|55|83)[29]|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]\", \"1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3[045]|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[23]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|72|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]\", \"1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|7[015-9]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17|3[015-9]))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3[045]|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9(?:[019]|4[1-3]|6(?:[0-47-9]|5[01346-9])))|3(?:[29]|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[23]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|72|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|829(?:2|66)|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{2})(\\\\d{4})\", \"$1-$2-$3\", [\"[14]|[289][2-9]|5[3-9]|7[2-4679]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$1-$2-$3\", [\"800\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{4})(\\\\d{4})\", \"$1-$2-$3\", [\"[257-9]\"], \"0$1\"]], \"0\"],\n \"KE\": [\"254\", \"000\", \"(?:[17]\\\\d\\\\d|900)\\\\d{6}|(?:2|80)0\\\\d{6,7}|[4-6]\\\\d{6,8}\", [7, 8, 9, 10], [[\"(\\\\d{2})(\\\\d{5,7})\", \"$1 $2\", [\"[24-6]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{6})\", \"$1 $2\", [\"[17]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"[89]\"], \"0$1\"]], \"0\"],\n \"KG\": [\"996\", \"00\", \"8\\\\d{9}|(?:[235-8]\\\\d|99)\\\\d{7}\", [9, 10], [[\"(\\\\d{4})(\\\\d{5})\", \"$1 $2\", [\"3(?:1[346]|[24-79])\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[235-79]|88\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d)(\\\\d{2,3})\", \"$1 $2 $3 $4\", [\"8\"], \"0$1\"]], \"0\"],\n \"KH\": [\"855\", \"00[14-9]\", \"1\\\\d{9}|[1-9]\\\\d{7,8}\", [8, 9, 10], [[\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"[1-9]\"], \"0$1\"], [\"(\\\\d{4})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"1\"]]], \"0\"],\n \"KI\": [\"686\", \"00\", \"(?:[37]\\\\d|6[0-79])\\\\d{6}|(?:[2-48]\\\\d|50)\\\\d{3}\", [5, 8], 0, \"0\"],\n \"KM\": [\"269\", \"00\", \"[3478]\\\\d{6}\", [7], [[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3\", [\"[3478]\"]]]],\n \"KN\": [\"1\", \"011\", \"(?:[58]\\\\d\\\\d|900)\\\\d{7}\", [10], 0, \"1\", 0, \"1|([2-7]\\\\d{6})$\", \"869$1\", 0, \"869\"],\n \"KP\": [\"850\", \"00|99\", \"85\\\\d{6}|(?:19\\\\d|[2-7])\\\\d{7}\", [8, 10], [[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"8\"], \"0$1\"], [\"(\\\\d)(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"[2-7]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"1\"], \"0$1\"]], \"0\"],\n \"KR\": [\"82\", \"00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))\", \"00[1-9]\\\\d{8,11}|(?:[12]|5\\\\d{3})\\\\d{7}|[13-6]\\\\d{9}|(?:[1-6]\\\\d|80)\\\\d{7}|[3-6]\\\\d{4,5}|(?:00|7)0\\\\d{8}\", [5, 6, 8, 9, 10, 11, 12, 13, 14], [[\"(\\\\d{2})(\\\\d{3,4})\", \"$1-$2\", [\"(?:3[1-3]|[46][1-4]|5[1-5])1\"], \"0$1\"], [\"(\\\\d{4})(\\\\d{4})\", \"$1-$2\", [\"1\"]], [\"(\\\\d)(\\\\d{3,4})(\\\\d{4})\", \"$1-$2-$3\", [\"2\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1-$2-$3\", [\"60|8\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3,4})(\\\\d{4})\", \"$1-$2-$3\", [\"[1346]|5[1-5]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{4})(\\\\d{4})\", \"$1-$2-$3\", [\"[57]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{5})(\\\\d{4})\", \"$1-$2-$3\", [\"5\"], \"0$1\"]], \"0\", 0, \"0(8(?:[1-46-8]|5\\\\d\\\\d))?\"],\n \"KW\": [\"965\", \"00\", \"18\\\\d{5}|(?:[2569]\\\\d|41)\\\\d{6}\", [7, 8], [[\"(\\\\d{4})(\\\\d{3,4})\", \"$1 $2\", [\"[169]|2(?:[235]|4[1-35-9])|52\"]], [\"(\\\\d{3})(\\\\d{5})\", \"$1 $2\", [\"[245]\"]]]],\n \"KY\": [\"1\", \"011\", \"(?:345|[58]\\\\d\\\\d|900)\\\\d{7}\", [10], 0, \"1\", 0, \"1|([2-9]\\\\d{6})$\", \"345$1\", 0, \"345\"],\n \"KZ\": [\"7\", \"810\", \"(?:33622|8\\\\d{8})\\\\d{5}|[78]\\\\d{9}\", [10, 14], 0, \"8\", 0, 0, 0, 0, \"33|7\", 0, \"8~10\"],\n \"LA\": [\"856\", \"00\", \"[23]\\\\d{9}|3\\\\d{8}|(?:[235-8]\\\\d|41)\\\\d{6}\", [8, 9, 10], [[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"2[13]|3[14]|[4-8]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{3})\", \"$1 $2 $3 $4\", [\"30[013-9]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{2})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3 $4\", [\"[23]\"], \"0$1\"]], \"0\"],\n \"LB\": [\"961\", \"00\", \"[27-9]\\\\d{7}|[13-9]\\\\d{6}\", [7, 8], [[\"(\\\\d)(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[13-69]|7(?:[2-57]|62|8[0-7]|9[04-9])|8[02-9]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[27-9]\"]]], \"0\"],\n \"LC\": [\"1\", \"011\", \"(?:[58]\\\\d\\\\d|758|900)\\\\d{7}\", [10], 0, \"1\", 0, \"1|([2-8]\\\\d{6})$\", \"758$1\", 0, \"758\"],\n \"LI\": [\"423\", \"00\", \"[68]\\\\d{8}|(?:[2378]\\\\d|90)\\\\d{5}\", [7, 9], [[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3\", [\"[2379]|8(?:0[09]|7)\", \"[2379]|8(?:0(?:02|9)|7)\"]], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"8\"]], [\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"69\"]], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"6\"]]], \"0\", 0, \"0|(1001)\"],\n \"LK\": [\"94\", \"00\", \"[1-9]\\\\d{8}\", [9], [[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"7\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[1-689]\"], \"0$1\"]], \"0\"],\n \"LR\": [\"231\", \"00\", \"(?:2|33|5\\\\d|77|88)\\\\d{7}|[4-6]\\\\d{6}\", [7, 8, 9], [[\"(\\\\d)(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[4-6]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"2\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"[3578]\"], \"0$1\"]], \"0\"],\n \"LS\": [\"266\", \"00\", \"(?:[256]\\\\d\\\\d|800)\\\\d{5}\", [8], [[\"(\\\\d{4})(\\\\d{4})\", \"$1 $2\", [\"[2568]\"]]]],\n \"LT\": [\"370\", \"00\", \"(?:[3469]\\\\d|52|[78]0)\\\\d{6}\", [8], [[\"(\\\\d)(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"52[0-7]\"], \"(8-$1)\", 1], [\"(\\\\d{3})(\\\\d{2})(\\\\d{3})\", \"$1 $2 $3\", [\"[7-9]\"], \"8 $1\", 1], [\"(\\\\d{2})(\\\\d{6})\", \"$1 $2\", [\"37|4(?:[15]|6[1-8])\"], \"(8-$1)\", 1], [\"(\\\\d{3})(\\\\d{5})\", \"$1 $2\", [\"[3-6]\"], \"(8-$1)\", 1]], \"8\", 0, \"[08]\"],\n \"LU\": [\"352\", \"00\", \"35[013-9]\\\\d{4,8}|6\\\\d{8}|35\\\\d{2,4}|(?:[2457-9]\\\\d|3[0-46-9])\\\\d{2,9}\", [4, 5, 6, 7, 8, 9, 10, 11], [[\"(\\\\d{2})(\\\\d{3})\", \"$1 $2\", [\"2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])\"]], [\"(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3\", [\"2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])\"]], [\"(\\\\d{2})(\\\\d{2})(\\\\d{3})\", \"$1 $2 $3\", [\"20[2-689]\"]], [\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{1,2})\", \"$1 $2 $3 $4\", [\"2(?:[0367]|4[3-8])\"]], [\"(\\\\d{3})(\\\\d{2})(\\\\d{3})\", \"$1 $2 $3\", [\"80[01]|90[015]\"]], [\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{3})\", \"$1 $2 $3 $4\", [\"20\"]], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"6\"]], [\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{1,2})\", \"$1 $2 $3 $4 $5\", [\"2(?:[0367]|4[3-8])\"]], [\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{1,5})\", \"$1 $2 $3 $4\", [\"[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]\"]]], 0, 0, \"(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\\\d)\"],\n \"LV\": [\"371\", \"00\", \"(?:[268]\\\\d|90)\\\\d{6}\", [8], [[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[269]|8[01]\"]]]],\n \"LY\": [\"218\", \"00\", \"[2-9]\\\\d{8}\", [9], [[\"(\\\\d{2})(\\\\d{7})\", \"$1-$2\", [\"[2-9]\"], \"0$1\"]], \"0\"],\n \"MA\": [\"212\", \"00\", \"[5-8]\\\\d{8}\", [9], [[\"(\\\\d{5})(\\\\d{4})\", \"$1-$2\", [\"5(?:29|38)\", \"5(?:29[89]|389)\", \"5(?:29[89]|389)0\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"5[45]\"], \"0$1\"], [\"(\\\\d{4})(\\\\d{5})\", \"$1-$2\", [\"5(?:2[2-489]|3[5-9]|9)|892\", \"5(?:2(?:[2-49]|8[235-9])|3[5-9]|9)|892\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{7})\", \"$1-$2\", [\"8\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{6})\", \"$1-$2\", [\"[5-7]\"], \"0$1\"]], \"0\", 0, 0, 0, 0, 0, [[\"5(?:29(?:[189][05]|2[29]|3[01])|389[05])\\\\d{4}|5(?:2(?:[0-25-7]\\\\d|3[1-578]|4[02-46-8]|8[0235-7]|90)|3(?:[0-47]\\\\d|5[02-9]|6[02-8]|8[08]|9[3-9])|(?:4[067]|5[03])\\\\d)\\\\d{5}\"], [\"(?:6(?:[0-79]\\\\d|8[0-247-9])|7(?:[017]\\\\d|2[0-2]|6[0-8]))\\\\d{6}\"], [\"80\\\\d{7}\"], [\"89\\\\d{7}\"], 0, 0, 0, 0, [\"592(?:4[0-2]|93)\\\\d{4}\"]]],\n \"MC\": [\"377\", \"00\", \"(?:[3489]|6\\\\d)\\\\d{7}\", [8, 9], [[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"4\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[389]\"]], [\"(\\\\d)(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4 $5\", [\"6\"], \"0$1\"]], \"0\"],\n \"MD\": [\"373\", \"00\", \"(?:[235-7]\\\\d|[89]0)\\\\d{6}\", [8], [[\"(\\\\d{3})(\\\\d{5})\", \"$1 $2\", [\"[89]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"22|3\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{2})(\\\\d{3})\", \"$1 $2 $3\", [\"[25-7]\"], \"0$1\"]], \"0\"],\n \"ME\": [\"382\", \"00\", \"(?:20|[3-79]\\\\d)\\\\d{6}|80\\\\d{6,7}\", [8, 9], [[\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"[2-9]\"], \"0$1\"]], \"0\"],\n \"MF\": [\"590\", \"00\", \"(?:590|(?:69|80)\\\\d|976)\\\\d{6}\", [9], 0, \"0\", 0, 0, 0, 0, 0, [[\"590(?:0[079]|[14]3|[27][79]|30|5[0-268]|87)\\\\d{4}\"], [\"69(?:0\\\\d\\\\d|1(?:2[2-9]|3[0-5]))\\\\d{4}\"], [\"80[0-5]\\\\d{6}\"], 0, 0, 0, 0, 0, [\"976[01]\\\\d{5}\"]]],\n \"MG\": [\"261\", \"00\", \"[23]\\\\d{8}\", [9], [[\"(\\\\d{2})(\\\\d{2})(\\\\d{3})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[23]\"], \"0$1\"]], \"0\", 0, \"0|([24-9]\\\\d{6})$\", \"20$1\"],\n \"MH\": [\"692\", \"011\", \"329\\\\d{4}|(?:[256]\\\\d|45)\\\\d{5}\", [7], [[\"(\\\\d{3})(\\\\d{4})\", \"$1-$2\", [\"[2-6]\"]]], \"1\"],\n \"MK\": [\"389\", \"00\", \"[2-578]\\\\d{7}\", [8], [[\"(\\\\d)(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"2|34[47]|4(?:[37]7|5[47]|64)\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[347]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d)(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[58]\"], \"0$1\"]], \"0\"],\n \"ML\": [\"223\", \"00\", \"[24-9]\\\\d{7}\", [8], [[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[24-9]\"]]]],\n \"MM\": [\"95\", \"00\", \"1\\\\d{5,7}|95\\\\d{6}|(?:[4-7]|9[0-46-9])\\\\d{6,8}|(?:2|8\\\\d)\\\\d{5,8}\", [6, 7, 8, 9, 10], [[\"(\\\\d)(\\\\d{2})(\\\\d{3})\", \"$1 $2 $3\", [\"16|2\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{2})(\\\\d{3})\", \"$1 $2 $3\", [\"[45]|6(?:0[23]|[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-6]\"], \"0$1\"], [\"(\\\\d)(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"[12]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"[4-7]|8[1-35]\"], \"0$1\"], [\"(\\\\d)(\\\\d{3})(\\\\d{4,6})\", \"$1 $2 $3\", [\"9(?:2[0-4]|[35-9]|4[137-9])\"], \"0$1\"], [\"(\\\\d)(\\\\d{4})(\\\\d{4})\", \"$1 $2 $3\", [\"2\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"8\"], \"0$1\"], [\"(\\\\d)(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3 $4\", [\"92\"], \"0$1\"], [\"(\\\\d)(\\\\d{5})(\\\\d{4})\", \"$1 $2 $3\", [\"9\"], \"0$1\"]], \"0\"],\n \"MN\": [\"976\", \"001\", \"[12]\\\\d{7,9}|[5-9]\\\\d{7}\", [8, 9, 10], [[\"(\\\\d{2})(\\\\d{2})(\\\\d{4})\", \"$1 $2 $3\", [\"[12]1\"], \"0$1\"], [\"(\\\\d{4})(\\\\d{4})\", \"$1 $2\", [\"[5-9]\"]], [\"(\\\\d{3})(\\\\d{5,6})\", \"$1 $2\", [\"[12]2[1-3]\"], \"0$1\"], [\"(\\\\d{4})(\\\\d{5,6})\", \"$1 $2\", [\"[12](?:27|3[2-8]|4[2-68]|5[1-4689])\", \"[12](?:27|3[2-8]|4[2-68]|5[1-4689])[0-3]\"], \"0$1\"], [\"(\\\\d{5})(\\\\d{4,5})\", \"$1 $2\", [\"[12]\"], \"0$1\"]], \"0\"],\n \"MO\": [\"853\", \"00\", \"0800\\\\d{3}|(?:28|[68]\\\\d)\\\\d{6}\", [7, 8], [[\"(\\\\d{4})(\\\\d{3})\", \"$1 $2\", [\"0\"]], [\"(\\\\d{4})(\\\\d{4})\", \"$1 $2\", [\"[268]\"]]]],\n \"MP\": [\"1\", \"011\", \"[58]\\\\d{9}|(?:67|90)0\\\\d{7}\", [10], 0, \"1\", 0, \"1|([2-9]\\\\d{6})$\", \"670$1\", 0, \"670\"],\n \"MQ\": [\"596\", \"00\", \"(?:69|80)\\\\d{7}|(?:59|97)6\\\\d{6}\", [9], [[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[569]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"8\"], \"0$1\"]], \"0\"],\n \"MR\": [\"222\", \"00\", \"(?:[2-4]\\\\d\\\\d|800)\\\\d{5}\", [8], [[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[2-48]\"]]]],\n \"MS\": [\"1\", \"011\", \"(?:[58]\\\\d\\\\d|664|900)\\\\d{7}\", [10], 0, \"1\", 0, \"1|([34]\\\\d{6})$\", \"664$1\", 0, \"664\"],\n \"MT\": [\"356\", \"00\", \"3550\\\\d{4}|(?:[2579]\\\\d\\\\d|800)\\\\d{5}\", [8], [[\"(\\\\d{4})(\\\\d{4})\", \"$1 $2\", [\"[2357-9]\"]]]],\n \"MU\": [\"230\", \"0(?:0|[24-7]0|3[03])\", \"(?:5|8\\\\d\\\\d)\\\\d{7}|[2-468]\\\\d{6}\", [7, 8, 10], [[\"(\\\\d{3})(\\\\d{4})\", \"$1 $2\", [\"[2-46]|8[013]\"]], [\"(\\\\d{4})(\\\\d{4})\", \"$1 $2\", [\"5\"]], [\"(\\\\d{5})(\\\\d{5})\", \"$1 $2\", [\"8\"]]], 0, 0, 0, 0, 0, 0, 0, \"020\"],\n \"MV\": [\"960\", \"0(?:0|19)\", \"(?:800|9[0-57-9]\\\\d)\\\\d{7}|[34679]\\\\d{6}\", [7, 10], [[\"(\\\\d{3})(\\\\d{4})\", \"$1-$2\", [\"[3467]|9[13-9]\"]], [\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"[89]\"]]], 0, 0, 0, 0, 0, 0, 0, \"00\"],\n \"MW\": [\"265\", \"00\", \"(?:[129]\\\\d|31|77|88)\\\\d{7}|1\\\\d{6}\", [7, 9], [[\"(\\\\d)(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"1[2-9]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"2\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[137-9]\"], \"0$1\"]], \"0\"],\n \"MX\": [\"52\", \"0[09]\", \"1(?:(?:44|99)[1-9]|65[0-689])\\\\d{7}|(?:1(?:[017]\\\\d|[235][1-9]|4[0-35-9]|6[0-46-9]|8[1-79]|9[1-8])|[2-9]\\\\d)\\\\d{8}\", [10, 11], [[\"(\\\\d{2})(\\\\d{4})(\\\\d{4})\", \"$1 $2 $3\", [\"33|5[56]|81\"], 0, 1], [\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"[2-9]\"], 0, 1], [\"(\\\\d)(\\\\d{2})(\\\\d{4})(\\\\d{4})\", \"$2 $3 $4\", [\"1(?:33|5[56]|81)\"], 0, 1], [\"(\\\\d)(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$2 $3 $4\", [\"1\"], 0, 1]], \"01\", 0, \"0(?:[12]|4[45])|1\", 0, 0, 0, 0, \"00\"],\n \"MY\": [\"60\", \"00\", \"1\\\\d{8,9}|(?:3\\\\d|[4-9])\\\\d{7}\", [8, 9, 10], [[\"(\\\\d)(\\\\d{3})(\\\\d{4})\", \"$1-$2 $3\", [\"[4-79]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\", \"$1-$2 $3\", [\"1(?:[02469]|[378][1-9]|53)|8\", \"1(?:[02469]|[37][1-9]|53|8(?:[1-46-9]|5[7-9]))|8\"], \"0$1\"], [\"(\\\\d)(\\\\d{4})(\\\\d{4})\", \"$1-$2 $3\", [\"3\"], \"0$1\"], [\"(\\\\d)(\\\\d{3})(\\\\d{2})(\\\\d{4})\", \"$1-$2-$3-$4\", [\"1(?:[367]|80)\"]], [\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$1-$2 $3\", [\"15\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{4})(\\\\d{4})\", \"$1-$2 $3\", [\"1\"], \"0$1\"]], \"0\"],\n \"MZ\": [\"258\", \"00\", \"(?:2|8\\\\d)\\\\d{7}\", [8, 9], [[\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"2|8[2-79]\"]], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"8\"]]]],\n \"NA\": [\"264\", \"00\", \"[68]\\\\d{7,8}\", [8, 9], [[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"88\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"6\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"87\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"8\"], \"0$1\"]], \"0\"],\n \"NC\": [\"687\", \"00\", \"(?:050|[2-57-9]\\\\d\\\\d)\\\\d{3}\", [6], [[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1.$2.$3\", [\"[02-57-9]\"]]]],\n \"NE\": [\"227\", \"00\", \"[027-9]\\\\d{7}\", [8], [[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"08\"]], [\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[089]|2[013]|7[04]\"]]]],\n \"NF\": [\"672\", \"00\", \"[13]\\\\d{5}\", [6], [[\"(\\\\d{2})(\\\\d{4})\", \"$1 $2\", [\"1[0-3]\"]], [\"(\\\\d)(\\\\d{5})\", \"$1 $2\", [\"[13]\"]]], 0, 0, \"([0-258]\\\\d{4})$\", \"3$1\"],\n \"NG\": [\"234\", \"009\", \"(?:[124-7]|9\\\\d{3})\\\\d{6}|[1-9]\\\\d{7}|[78]\\\\d{9,13}\", [7, 8, 10, 11, 12, 13, 14], [[\"(\\\\d{2})(\\\\d{2})(\\\\d{3})\", \"$1 $2 $3\", [\"78\"], \"0$1\"], [\"(\\\\d)(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"[12]|9(?:0[3-9]|[1-9])\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{2,3})\", \"$1 $2 $3\", [\"[3-7]|8[2-9]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"[7-9]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{4})(\\\\d{4,5})\", \"$1 $2 $3\", [\"[78]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{5})(\\\\d{5,6})\", \"$1 $2 $3\", [\"[78]\"], \"0$1\"]], \"0\"],\n \"NI\": [\"505\", \"00\", \"(?:1800|[25-8]\\\\d{3})\\\\d{4}\", [8], [[\"(\\\\d{4})(\\\\d{4})\", \"$1 $2\", [\"[125-8]\"]]]],\n \"NL\": [\"31\", \"00\", \"(?:[124-7]\\\\d\\\\d|3(?:[02-9]\\\\d|1[0-8]))\\\\d{6}|8\\\\d{6,9}|9\\\\d{6,10}|1\\\\d{4,5}\", [5, 6, 7, 8, 9, 10, 11], [[\"(\\\\d{3})(\\\\d{4,7})\", \"$1 $2\", [\"[89]0\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{7})\", \"$1 $2\", [\"66\"], \"0$1\"], [\"(\\\\d)(\\\\d{8})\", \"$1 $2\", [\"6\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"1[16-8]|2[259]|3[124]|4[17-9]|5[124679]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"[1-578]|91\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{5})\", \"$1 $2 $3\", [\"9\"], \"0$1\"]], \"0\"],\n \"NO\": [\"47\", \"00\", \"(?:0|[2-9]\\\\d{3})\\\\d{4}\", [5, 8], [[\"(\\\\d{3})(\\\\d{2})(\\\\d{3})\", \"$1 $2 $3\", [\"[489]|59\"]], [\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[235-7]\"]]], 0, 0, 0, 0, 0, \"[02-689]|7[0-8]\"],\n \"NP\": [\"977\", \"00\", \"(?:1\\\\d|9)\\\\d{9}|[1-9]\\\\d{7}\", [8, 10, 11], [[\"(\\\\d)(\\\\d{7})\", \"$1-$2\", [\"1[2-6]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{6})\", \"$1-$2\", [\"1[01]|[2-8]|9(?:[1-59]|[67][2-6])\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{7})\", \"$1-$2\", [\"9\"]]], \"0\"],\n \"NR\": [\"674\", \"00\", \"(?:444|(?:55|8\\\\d)\\\\d|666)\\\\d{4}\", [7], [[\"(\\\\d{3})(\\\\d{4})\", \"$1 $2\", [\"[4-68]\"]]]],\n \"NU\": [\"683\", \"00\", \"(?:[47]|888\\\\d)\\\\d{3}\", [4, 7], [[\"(\\\\d{3})(\\\\d{4})\", \"$1 $2\", [\"8\"]]]],\n \"NZ\": [\"64\", \"0(?:0|161)\", \"[29]\\\\d{7,9}|50\\\\d{5}(?:\\\\d{2,3})?|6[0-35-9]\\\\d{6}|7\\\\d{7,8}|8\\\\d{4,9}|(?:11\\\\d|[34])\\\\d{7}\", [5, 6, 7, 8, 9, 10], [[\"(\\\\d{2})(\\\\d{3,8})\", \"$1 $2\", [\"8[1-579]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{2})(\\\\d{2,3})\", \"$1 $2 $3\", [\"50[036-8]|[89]0\", \"50(?:[0367]|88)|[89]0\"], \"0$1\"], [\"(\\\\d)(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"24|[346]|7[2-57-9]|9[2-9]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"2(?:10|74)|[59]|80\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3,4})(\\\\d{4})\", \"$1 $2 $3\", [\"1|2[028]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3,5})\", \"$1 $2 $3\", [\"2(?:[169]|7[0-35-9])|7|86\"], \"0$1\"]], \"0\", 0, 0, 0, 0, 0, 0, \"00\"],\n \"OM\": [\"968\", \"00\", \"(?:1505|[279]\\\\d{3}|500)\\\\d{4}|800\\\\d{5,6}\", [7, 8, 9], [[\"(\\\\d{3})(\\\\d{4,6})\", \"$1 $2\", [\"[58]\"]], [\"(\\\\d{2})(\\\\d{6})\", \"$1 $2\", [\"2\"]], [\"(\\\\d{4})(\\\\d{4})\", \"$1 $2\", [\"[179]\"]]]],\n \"PA\": [\"507\", \"00\", \"(?:00800|8\\\\d{3})\\\\d{6}|[68]\\\\d{7}|[1-57-9]\\\\d{6}\", [7, 8, 10, 11], [[\"(\\\\d{3})(\\\\d{4})\", \"$1-$2\", [\"[1-57-9]\"]], [\"(\\\\d{4})(\\\\d{4})\", \"$1-$2\", [\"[68]\"]], [\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"8\"]]]],\n \"PE\": [\"51\", \"00|19(?:1[124]|77|90)00\", \"(?:[14-8]|9\\\\d)\\\\d{7}\", [8, 9], [[\"(\\\\d{3})(\\\\d{5})\", \"$1 $2\", [\"80\"], \"(0$1)\"], [\"(\\\\d)(\\\\d{7})\", \"$1 $2\", [\"1\"], \"(0$1)\"], [\"(\\\\d{2})(\\\\d{6})\", \"$1 $2\", [\"[4-8]\"], \"(0$1)\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"9\"]]], \"0\", 0, 0, 0, 0, 0, 0, \"00\", \" Anexo \"],\n \"PF\": [\"689\", \"00\", \"4\\\\d{5}(?:\\\\d{2})?|8\\\\d{7,8}\", [6, 8, 9], [[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3\", [\"44\"]], [\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"4|8[7-9]\"]], [\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"8\"]]]],\n \"PG\": [\"675\", \"00|140[1-3]\", \"(?:180|[78]\\\\d{3})\\\\d{4}|(?:[2-589]\\\\d|64)\\\\d{5}\", [7, 8], [[\"(\\\\d{3})(\\\\d{4})\", \"$1 $2\", [\"18|[2-69]|85\"]], [\"(\\\\d{4})(\\\\d{4})\", \"$1 $2\", [\"[78]\"]]], 0, 0, 0, 0, 0, 0, 0, \"00\"],\n \"PH\": [\"63\", \"00\", \"(?:[2-7]|9\\\\d)\\\\d{8}|2\\\\d{5}|(?:1800|8)\\\\d{7,9}\", [6, 8, 9, 10, 11, 12, 13], [[\"(\\\\d)(\\\\d{5})\", \"$1 $2\", [\"2\"], \"(0$1)\"], [\"(\\\\d{4})(\\\\d{4,6})\", \"$1 $2\", [\"3(?:23|39|46)|4(?:2[3-6]|[35]9|4[26]|76)|544|88[245]|(?:52|64|86)2\", \"3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))\"], \"(0$1)\"], [\"(\\\\d{5})(\\\\d{4})\", \"$1 $2\", [\"346|4(?:27|9[35])|883\", \"3469|4(?:279|9(?:30|56))|8834\"], \"(0$1)\"], [\"(\\\\d)(\\\\d{4})(\\\\d{4})\", \"$1 $2 $3\", [\"2\"], \"(0$1)\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"[3-7]|8[2-8]\"], \"(0$1)\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"[89]\"], \"0$1\"], [\"(\\\\d{4})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"1\"]], [\"(\\\\d{4})(\\\\d{1,2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3 $4\", [\"1\"]]], \"0\"],\n \"PK\": [\"92\", \"00\", \"122\\\\d{6}|[24-8]\\\\d{10,11}|9(?:[013-9]\\\\d{8,10}|2(?:[01]\\\\d\\\\d|2(?:[06-8]\\\\d|1[01]))\\\\d{7})|(?:[2-8]\\\\d{3}|92(?:[0-7]\\\\d|8[1-9]))\\\\d{6}|[24-9]\\\\d{8}|[89]\\\\d{7}\", [8, 9, 10, 11, 12], [[\"(\\\\d{3})(\\\\d{3})(\\\\d{2,7})\", \"$1 $2 $3\", [\"[89]0\"], \"0$1\"], [\"(\\\\d{4})(\\\\d{5})\", \"$1 $2\", [\"1\"]], [\"(\\\\d{3})(\\\\d{6,7})\", \"$1 $2\", [\"2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8])\", \"9(?:2[3-8]|98)|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:22|3[27-9]|4[2-6]|6[3569]|9[25-7]))[2-9]\"], \"(0$1)\"], [\"(\\\\d{2})(\\\\d{7,8})\", \"$1 $2\", [\"(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]\"], \"(0$1)\"], [\"(\\\\d{5})(\\\\d{5})\", \"$1 $2\", [\"58\"], \"(0$1)\"], [\"(\\\\d{3})(\\\\d{7})\", \"$1 $2\", [\"3\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3 $4\", [\"2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91\"], \"(0$1)\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3 $4\", [\"[24-9]\"], \"(0$1)\"]], \"0\"],\n \"PL\": [\"48\", \"00\", \"6\\\\d{5}(?:\\\\d{2})?|8\\\\d{9}|[1-9]\\\\d{6}(?:\\\\d{2})?\", [6, 7, 8, 9, 10], [[\"(\\\\d{5})\", \"$1\", [\"19\"]], [\"(\\\\d{3})(\\\\d{3})\", \"$1 $2\", [\"11|64\"]], [\"(\\\\d{2})(\\\\d{2})(\\\\d{3})\", \"$1 $2 $3\", [\"(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])1\", \"(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])19\"]], [\"(\\\\d{3})(\\\\d{2})(\\\\d{2,3})\", \"$1 $2 $3\", [\"64\"]], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"21|39|45|5[0137]|6[0469]|7[02389]|8(?:0[14]|8)\"]], [\"(\\\\d{2})(\\\\d{3})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"1[2-8]|[2-7]|8[1-79]|9[145]\"]], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"8\"]]]],\n \"PM\": [\"508\", \"00\", \"(?:[45]|80\\\\d\\\\d)\\\\d{5}\", [6, 9], [[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3\", [\"[45]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"8\"], \"0$1\"]], \"0\"],\n \"PR\": [\"1\", \"011\", \"(?:[589]\\\\d\\\\d|787)\\\\d{7}\", [10], 0, \"1\", 0, 0, 0, 0, \"787|939\"],\n \"PS\": [\"970\", \"00\", \"[2489]2\\\\d{6}|(?:1\\\\d|5)\\\\d{8}\", [8, 9, 10], [[\"(\\\\d)(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"[2489]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"5\"], \"0$1\"], [\"(\\\\d{4})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"1\"]]], \"0\"],\n \"PT\": [\"351\", \"00\", \"1693\\\\d{5}|(?:[26-9]\\\\d|30)\\\\d{7}\", [9], [[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"2[12]\"]], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"16|[236-9]\"]]]],\n \"PW\": [\"680\", \"01[12]\", \"(?:[24-8]\\\\d\\\\d|345|900)\\\\d{4}\", [7], [[\"(\\\\d{3})(\\\\d{4})\", \"$1 $2\", [\"[2-9]\"]]]],\n \"PY\": [\"595\", \"00\", \"59\\\\d{4,6}|9\\\\d{5,10}|(?:[2-46-8]\\\\d|5[0-8])\\\\d{4,7}\", [6, 7, 8, 9, 10, 11], [[\"(\\\\d{3})(\\\\d{3,6})\", \"$1 $2\", [\"[2-9]0\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{5})\", \"$1 $2\", [\"[26]1|3[289]|4[1246-8]|7[1-3]|8[1-36]\"], \"(0$1)\"], [\"(\\\\d{3})(\\\\d{4,5})\", \"$1 $2\", [\"2[279]|3[13-5]|4[359]|5|6(?:[34]|7[1-46-8])|7[46-8]|85\"], \"(0$1)\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"2[14-68]|3[26-9]|4[1246-8]|6(?:1|75)|7[1-35]|8[1-36]\"], \"(0$1)\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"87\"]], [\"(\\\\d{3})(\\\\d{6})\", \"$1 $2\", [\"9(?:[5-79]|8[1-6])\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[2-8]\"], \"0$1\"], [\"(\\\\d{4})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"9\"]]], \"0\"],\n \"QA\": [\"974\", \"00\", \"[2-7]\\\\d{7}|800\\\\d{4}(?:\\\\d{2})?|2\\\\d{6}\", [7, 8, 9], [[\"(\\\\d{3})(\\\\d{4})\", \"$1 $2\", [\"2[126]|8\"]], [\"(\\\\d{4})(\\\\d{4})\", \"$1 $2\", [\"[2-7]\"]]]],\n \"RE\": [\"262\", \"00\", \"976\\\\d{6}|(?:26|[68]\\\\d)\\\\d{7}\", [9], [[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[2689]\"], \"0$1\"]], \"0\", 0, 0, 0, 0, \"26[23]|69|[89]\"],\n \"RO\": [\"40\", \"00\", \"(?:[2378]\\\\d|90)\\\\d{7}|[23]\\\\d{5}\", [6, 9], [[\"(\\\\d{3})(\\\\d{3})\", \"$1 $2\", [\"2[3-6]\", \"2[3-6]\\\\d9\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{4})\", \"$1 $2\", [\"219|31\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"[23]1\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[237-9]\"], \"0$1\"]], \"0\", 0, 0, 0, 0, 0, 0, 0, \" int \"],\n \"RS\": [\"381\", \"00\", \"38[02-9]\\\\d{6,9}|6\\\\d{7,9}|90\\\\d{4,8}|38\\\\d{5,6}|(?:7\\\\d\\\\d|800)\\\\d{3,9}|(?:[12]\\\\d|3[0-79])\\\\d{5,10}\", [6, 7, 8, 9, 10, 11, 12], [[\"(\\\\d{3})(\\\\d{3,9})\", \"$1 $2\", [\"(?:2[389]|39)0|[7-9]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{5,10})\", \"$1 $2\", [\"[1-36]\"], \"0$1\"]], \"0\"],\n \"RU\": [\"7\", \"810\", \"8\\\\d{13}|[347-9]\\\\d{9}\", [10, 14], [[\"(\\\\d{4})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"7(?:1[0-8]|2[1-9])\", \"7(?:1(?:[0-6]2|7|8[27])|2(?:1[23]|[2-9]2))\", \"7(?:1(?:[0-6]2|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2\"], \"8 ($1)\", 1], [\"(\\\\d{5})(\\\\d)(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"7(?:1[0-68]|2[1-9])\", \"7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))\", \"7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]\"], \"8 ($1)\", 1], [\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"7\"], \"8 ($1)\", 1], [\"(\\\\d{3})(\\\\d{3})(\\\\d{2})(\\\\d{2})\", \"$1 $2-$3-$4\", [\"[349]|8(?:[02-7]|1[1-8])\"], \"8 ($1)\", 1], [\"(\\\\d{4})(\\\\d{4})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3 $4\", [\"8\"], \"8 ($1)\"]], \"8\", 0, 0, 0, 0, \"3[04-689]|[489]\", 0, \"8~10\"],\n \"RW\": [\"250\", \"00\", \"(?:06|[27]\\\\d\\\\d|[89]00)\\\\d{6}\", [8, 9], [[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"0\"]], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[7-9]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"2\"]]], \"0\"],\n \"SA\": [\"966\", \"00\", \"92\\\\d{7}|(?:[15]|8\\\\d)\\\\d{8}\", [9, 10], [[\"(\\\\d{4})(\\\\d{5})\", \"$1 $2\", [\"9\"]], [\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"1\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"5\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"81\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"8\"]]], \"0\"],\n \"SB\": [\"677\", \"0[01]\", \"(?:[1-6]|[7-9]\\\\d\\\\d)\\\\d{4}\", [5, 7], [[\"(\\\\d{2})(\\\\d{5})\", \"$1 $2\", [\"7|8[4-9]|9(?:[1-8]|9[0-8])\"]]]],\n \"SC\": [\"248\", \"010|0[0-2]\", \"800\\\\d{4}|(?:[249]\\\\d|64)\\\\d{5}\", [7], [[\"(\\\\d)(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[246]|9[57]\"]]], 0, 0, 0, 0, 0, 0, 0, \"00\"],\n \"SD\": [\"249\", \"00\", \"[19]\\\\d{8}\", [9], [[\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"[19]\"], \"0$1\"]], \"0\"],\n \"SE\": [\"46\", \"00\", \"(?:[26]\\\\d\\\\d|9)\\\\d{9}|[1-9]\\\\d{8}|[1-689]\\\\d{7}|[1-4689]\\\\d{6}|2\\\\d{5}\", [6, 7, 8, 9, 10], [[\"(\\\\d{2})(\\\\d{2,3})(\\\\d{2})\", \"$1-$2 $3\", [\"20\"], \"0$1\", 0, \"$1 $2 $3\"], [\"(\\\\d{3})(\\\\d{4})\", \"$1-$2\", [\"9(?:00|39|44|9)\"], \"0$1\", 0, \"$1 $2\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{2})\", \"$1-$2 $3\", [\"[12][136]|3[356]|4[0246]|6[03]|90[1-9]\"], \"0$1\", 0, \"$1 $2 $3\"], [\"(\\\\d)(\\\\d{2,3})(\\\\d{2})(\\\\d{2})\", \"$1-$2 $3 $4\", [\"8\"], \"0$1\", 0, \"$1 $2 $3 $4\"], [\"(\\\\d{3})(\\\\d{2,3})(\\\\d{2})\", \"$1-$2 $3\", [\"1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])\"], \"0$1\", 0, \"$1 $2 $3\"], [\"(\\\\d{3})(\\\\d{2,3})(\\\\d{3})\", \"$1-$2 $3\", [\"9(?:00|39|44)\"], \"0$1\", 0, \"$1 $2 $3\"], [\"(\\\\d{2})(\\\\d{2,3})(\\\\d{2})(\\\\d{2})\", \"$1-$2 $3 $4\", [\"1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]\"], \"0$1\", 0, \"$1 $2 $3 $4\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{2})(\\\\d{2})\", \"$1-$2 $3 $4\", [\"10|7\"], \"0$1\", 0, \"$1 $2 $3 $4\"], [\"(\\\\d)(\\\\d{3})(\\\\d{3})(\\\\d{2})\", \"$1-$2 $3 $4\", [\"8\"], \"0$1\", 0, \"$1 $2 $3 $4\"], [\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1-$2 $3 $4\", [\"[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])\"], \"0$1\", 0, \"$1 $2 $3 $4\"], [\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{3})\", \"$1-$2 $3 $4\", [\"9\"], \"0$1\", 0, \"$1 $2 $3 $4\"], [\"(\\\\d{3})(\\\\d{2})(\\\\d{3})(\\\\d{2})(\\\\d{2})\", \"$1-$2 $3 $4 $5\", [\"[26]\"], \"0$1\", 0, \"$1 $2 $3 $4 $5\"]], \"0\"],\n \"SG\": [\"65\", \"0[0-3]\\\\d\", \"(?:(?:1\\\\d|8)\\\\d\\\\d|7000)\\\\d{7}|[3689]\\\\d{7}\", [8, 10, 11], [[\"(\\\\d{4})(\\\\d{4})\", \"$1 $2\", [\"[369]|8(?:0[1-5]|[1-9])\"]], [\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"8\"]], [\"(\\\\d{4})(\\\\d{4})(\\\\d{3})\", \"$1 $2 $3\", [\"7\"]], [\"(\\\\d{4})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"1\"]]]],\n \"SH\": [\"290\", \"00\", \"(?:[256]\\\\d|8)\\\\d{3}\", [4, 5], 0, 0, 0, 0, 0, 0, \"[256]\"],\n \"SI\": [\"386\", \"00|10(?:22|66|88|99)\", \"[1-7]\\\\d{7}|8\\\\d{4,7}|90\\\\d{4,6}\", [5, 6, 7, 8], [[\"(\\\\d{2})(\\\\d{3,6})\", \"$1 $2\", [\"8[09]|9\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{5})\", \"$1 $2\", [\"59|8\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[37][01]|4[0139]|51|6\"], \"0$1\"], [\"(\\\\d)(\\\\d{3})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[1-57]\"], \"(0$1)\"]], \"0\", 0, 0, 0, 0, 0, 0, \"00\"],\n \"SJ\": [\"47\", \"00\", \"0\\\\d{4}|(?:[489]\\\\d|[57]9)\\\\d{6}\", [5, 8], 0, 0, 0, 0, 0, 0, \"79\"],\n \"SK\": [\"421\", \"00\", \"[2-689]\\\\d{8}|[2-59]\\\\d{6}|[2-5]\\\\d{5}\", [6, 7, 9], [[\"(\\\\d)(\\\\d{2})(\\\\d{3,4})\", \"$1 $2 $3\", [\"21\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{2})(\\\\d{2,3})\", \"$1 $2 $3\", [\"[3-5][1-8]1\", \"[3-5][1-8]1[67]\"], \"0$1\"], [\"(\\\\d)(\\\\d{3})(\\\\d{3})(\\\\d{2})\", \"$1/$2 $3 $4\", [\"2\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[689]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{2})(\\\\d{2})\", \"$1/$2 $3 $4\", [\"[3-5]\"], \"0$1\"]], \"0\"],\n \"SL\": [\"232\", \"00\", \"(?:[237-9]\\\\d|66)\\\\d{6}\", [8], [[\"(\\\\d{2})(\\\\d{6})\", \"$1 $2\", [\"[236-9]\"], \"(0$1)\"]], \"0\"],\n \"SM\": [\"378\", \"00\", \"(?:0549|[5-7]\\\\d)\\\\d{6}\", [8, 10], [[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[5-7]\"]], [\"(\\\\d{4})(\\\\d{6})\", \"$1 $2\", [\"0\"]]], 0, 0, \"([89]\\\\d{5})$\", \"0549$1\"],\n \"SN\": [\"221\", \"00\", \"(?:[378]\\\\d|93)\\\\d{7}\", [9], [[\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"8\"]], [\"(\\\\d{2})(\\\\d{3})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[379]\"]]]],\n \"SO\": [\"252\", \"00\", \"[346-9]\\\\d{8}|[12679]\\\\d{7}|[1-5]\\\\d{6}|[1348]\\\\d{5}\", [6, 7, 8, 9], [[\"(\\\\d{2})(\\\\d{4})\", \"$1 $2\", [\"8[125]\"]], [\"(\\\\d{6})\", \"$1\", [\"[134]\"]], [\"(\\\\d)(\\\\d{6})\", \"$1 $2\", [\"[15]|2[0-79]|3[0-46-8]|4[0-7]\"]], [\"(\\\\d)(\\\\d{7})\", \"$1 $2\", [\"24|[67]\"]], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[3478]|64|90\"]], [\"(\\\\d{2})(\\\\d{5,7})\", \"$1 $2\", [\"1|28|6(?:0[5-7]|[1-35-9])|9[2-9]\"]]], \"0\"],\n \"SR\": [\"597\", \"00\", \"(?:[2-5]|68|[78]\\\\d)\\\\d{5}\", [6, 7], [[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1-$2-$3\", [\"56\"]], [\"(\\\\d{3})(\\\\d{3})\", \"$1-$2\", [\"[2-5]\"]], [\"(\\\\d{3})(\\\\d{4})\", \"$1-$2\", [\"[6-8]\"]]]],\n \"SS\": [\"211\", \"00\", \"[19]\\\\d{8}\", [9], [[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[19]\"], \"0$1\"]], \"0\"],\n \"ST\": [\"239\", \"00\", \"(?:22|9\\\\d)\\\\d{5}\", [7], [[\"(\\\\d{3})(\\\\d{4})\", \"$1 $2\", [\"[29]\"]]]],\n \"SV\": [\"503\", \"00\", \"[267]\\\\d{7}|[89]00\\\\d{4}(?:\\\\d{4})?\", [7, 8, 11], [[\"(\\\\d{3})(\\\\d{4})\", \"$1 $2\", [\"[89]\"]], [\"(\\\\d{4})(\\\\d{4})\", \"$1 $2\", [\"[267]\"]], [\"(\\\\d{3})(\\\\d{4})(\\\\d{4})\", \"$1 $2 $3\", [\"[89]\"]]]],\n \"SX\": [\"1\", \"011\", \"7215\\\\d{6}|(?:[58]\\\\d\\\\d|900)\\\\d{7}\", [10], 0, \"1\", 0, \"1|(5\\\\d{6})$\", \"721$1\", 0, \"721\"],\n \"SY\": [\"963\", \"00\", \"[1-39]\\\\d{8}|[1-5]\\\\d{7}\", [8, 9], [[\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"[1-5]\"], \"0$1\", 1], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"9\"], \"0$1\", 1]], \"0\"],\n \"SZ\": [\"268\", \"00\", \"0800\\\\d{4}|(?:[237]\\\\d|900)\\\\d{6}\", [8, 9], [[\"(\\\\d{4})(\\\\d{4})\", \"$1 $2\", [\"[0237]\"]], [\"(\\\\d{5})(\\\\d{4})\", \"$1 $2\", [\"9\"]]]],\n \"TA\": [\"290\", \"00\", \"8\\\\d{3}\", [4], 0, 0, 0, 0, 0, 0, \"8\"],\n \"TC\": [\"1\", \"011\", \"(?:[58]\\\\d\\\\d|649|900)\\\\d{7}\", [10], 0, \"1\", 0, \"1|([2-479]\\\\d{6})$\", \"649$1\", 0, \"649\"],\n \"TD\": [\"235\", \"00|16\", \"(?:22|[69]\\\\d|77)\\\\d{6}\", [8], [[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[2679]\"]]], 0, 0, 0, 0, 0, 0, 0, \"00\"],\n \"TG\": [\"228\", \"00\", \"[279]\\\\d{7}\", [8], [[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[279]\"]]]],\n \"TH\": [\"66\", \"00[1-9]\", \"(?:001800|[2-57]|[689]\\\\d)\\\\d{7}|1\\\\d{7,9}\", [8, 9, 10, 13], [[\"(\\\\d)(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"2\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"[13-9]\"], \"0$1\"], [\"(\\\\d{4})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"1\"]]], \"0\"],\n \"TJ\": [\"992\", \"810\", \"(?:00|[1-57-9]\\\\d)\\\\d{7}\", [9], [[\"(\\\\d{6})(\\\\d)(\\\\d{2})\", \"$1 $2 $3\", [\"331\", \"3317\"]], [\"(\\\\d{3})(\\\\d{2})(\\\\d{4})\", \"$1 $2 $3\", [\"[34]7|91[78]\"]], [\"(\\\\d{4})(\\\\d)(\\\\d{4})\", \"$1 $2 $3\", [\"3[1-5]\"]], [\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"[0-57-9]\"]]], 0, 0, 0, 0, 0, 0, 0, \"8~10\"],\n \"TK\": [\"690\", \"00\", \"[2-47]\\\\d{3,6}\", [4, 5, 6, 7]],\n \"TL\": [\"670\", \"00\", \"7\\\\d{7}|(?:[2-47]\\\\d|[89]0)\\\\d{5}\", [7, 8], [[\"(\\\\d{3})(\\\\d{4})\", \"$1 $2\", [\"[2-489]|70\"]], [\"(\\\\d{4})(\\\\d{4})\", \"$1 $2\", [\"7\"]]]],\n \"TM\": [\"993\", \"810\", \"[1-6]\\\\d{7}\", [8], [[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2-$3-$4\", [\"12\"], \"(8 $1)\"], [\"(\\\\d{3})(\\\\d)(\\\\d{2})(\\\\d{2})\", \"$1 $2-$3-$4\", [\"[1-5]\"], \"(8 $1)\"], [\"(\\\\d{2})(\\\\d{6})\", \"$1 $2\", [\"6\"], \"8 $1\"]], \"8\", 0, 0, 0, 0, 0, 0, \"8~10\"],\n \"TN\": [\"216\", \"00\", \"[2-57-9]\\\\d{7}\", [8], [[\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[2-57-9]\"]]]],\n \"TO\": [\"676\", \"00\", \"(?:0800|(?:[5-8]\\\\d\\\\d|999)\\\\d)\\\\d{3}|[2-8]\\\\d{4}\", [5, 7], [[\"(\\\\d{2})(\\\\d{3})\", \"$1-$2\", [\"[2-4]|50|6[09]|7[0-24-69]|8[05]\"]], [\"(\\\\d{4})(\\\\d{3})\", \"$1 $2\", [\"0\"]], [\"(\\\\d{3})(\\\\d{4})\", \"$1 $2\", [\"[5-9]\"]]]],\n \"TR\": [\"90\", \"00\", \"4\\\\d{6}|8\\\\d{11,12}|(?:[2-58]\\\\d\\\\d|900)\\\\d{7}\", [7, 10, 12, 13], [[\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"512|8[01589]|90\"], \"0$1\", 1], [\"(\\\\d{3})(\\\\d{3})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"5(?:[0-59]|61)\", \"5(?:[0-59]|616)\", \"5(?:[0-59]|6161)\"], \"0$1\", 1], [\"(\\\\d{3})(\\\\d{3})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[24][1-8]|3[1-9]\"], \"(0$1)\", 1], [\"(\\\\d{3})(\\\\d{3})(\\\\d{6,7})\", \"$1 $2 $3\", [\"80\"], \"0$1\", 1]], \"0\"],\n \"TT\": [\"1\", \"011\", \"(?:[58]\\\\d\\\\d|900)\\\\d{7}\", [10], 0, \"1\", 0, \"1|([2-46-8]\\\\d{6})$\", \"868$1\", 0, \"868\"],\n \"TV\": [\"688\", \"00\", \"(?:2|7\\\\d\\\\d|90)\\\\d{4}\", [5, 6, 7], [[\"(\\\\d{2})(\\\\d{3})\", \"$1 $2\", [\"2\"]], [\"(\\\\d{2})(\\\\d{4})\", \"$1 $2\", [\"90\"]], [\"(\\\\d{2})(\\\\d{5})\", \"$1 $2\", [\"7\"]]]],\n \"TW\": [\"886\", \"0(?:0[25-79]|19)\", \"[2-689]\\\\d{8}|7\\\\d{9,10}|[2-8]\\\\d{7}|2\\\\d{6}\", [7, 8, 9, 10, 11], [[\"(\\\\d{2})(\\\\d)(\\\\d{4})\", \"$1 $2 $3\", [\"202\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"[258]0\"], \"0$1\"], [\"(\\\\d)(\\\\d{3,4})(\\\\d{4})\", \"$1 $2 $3\", [\"[23568]|4(?:0[02-48]|[1-47-9])|7[1-9]\", \"[23568]|4(?:0[2-48]|[1-47-9])|(?:400|7)[1-9]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[49]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{4})(\\\\d{4,5})\", \"$1 $2 $3\", [\"7\"], \"0$1\"]], \"0\", 0, 0, 0, 0, 0, 0, 0, \"#\"],\n \"TZ\": [\"255\", \"00[056]\", \"(?:[26-8]\\\\d|41|90)\\\\d{7}\", [9], [[\"(\\\\d{3})(\\\\d{2})(\\\\d{4})\", \"$1 $2 $3\", [\"[89]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"[24]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[67]\"], \"0$1\"]], \"0\"],\n \"UA\": [\"380\", \"00\", \"[89]\\\\d{9}|[3-9]\\\\d{8}\", [9, 10], [[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"6[12][29]|(?:3[1-8]|4[136-8]|5[12457]|6[49])2|(?:56|65)[24]\", \"6[12][29]|(?:35|4[1378]|5[12457]|6[49])2|(?:56|65)[24]|(?:3[1-46-8]|46)2[013-9]\"], \"0$1\"], [\"(\\\\d{4})(\\\\d{5})\", \"$1 $2\", [\"3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6[0135689]|7[4-6])|6(?:[12][3-7]|[459])\", \"3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6(?:[015689]|3[02389])|7[4-6])|6(?:[12][3-7]|[459])\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"[3-7]|89|9[1-9]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"[89]\"], \"0$1\"]], \"0\", 0, 0, 0, 0, 0, 0, \"0~0\"],\n \"UG\": [\"256\", \"00[057]\", \"800\\\\d{6}|(?:[29]0|[347]\\\\d)\\\\d{7}\", [9], [[\"(\\\\d{4})(\\\\d{5})\", \"$1 $2\", [\"202\", \"2024\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{6})\", \"$1 $2\", [\"[27-9]|4(?:6[45]|[7-9])\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{7})\", \"$1 $2\", [\"[34]\"], \"0$1\"]], \"0\"],\n \"US\": [\"1\", \"011\", \"[2-9]\\\\d{9}|3\\\\d{6}\", [10], [[\"(\\\\d{3})(\\\\d{4})\", \"$1-$2\", [\"310\"], 0, 1], [\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"($1) $2-$3\", [\"[2-9]\"], 0, 1, \"$1-$2-$3\"]], \"1\", 0, 0, 0, 0, 0, [[\"5(?:05(?:[2-57-9]\\\\d\\\\d|6(?:[0-35-9]\\\\d|44))|82(?:2(?:0[0-3]|[268]2)|3(?:0[02]|22|33)|4(?:00|4[24]|65|82)|5(?:00|29|58|83)|6(?:00|66|82)|7(?:58|77)|8(?:00|42|5[25]|88)|9(?:00|9[89])))\\\\d{4}|(?:2(?:0[1-35-9]|1[02-9]|2[03-589]|3[149]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-57-9]|1[02-9]|2[01356]|3[0-24679]|4[167]|5[12]|6[014]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[19]|6[1-47]|7[0-5]|8[056])|6(?:0[1-35-9]|1[024-9]|2[03689]|[34][016]|5[01679]|6[0-279]|78|8[0-29])|7(?:0[1-46-8]|1[2-9]|2[04-7]|3[1247]|4[037]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[068]|3[0-289]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-389]|8[04-69]))[2-9]\\\\d{6}\"], [\"\"], [\"8(?:00|33|44|55|66|77|88)[2-9]\\\\d{6}\"], [\"900[2-9]\\\\d{6}\"], [\"52(?:3(?:[2-46-9][02-9]\\\\d|5(?:[02-46-9]\\\\d|5[0-46-9]))|4(?:[2-478][02-9]\\\\d|5(?:[034]\\\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\\\d)|9(?:[05-9]\\\\d|2[0-5]|49)))\\\\d{4}|52[34][2-9]1[02-9]\\\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\\\d{6}\"]]],\n \"UY\": [\"598\", \"0(?:0|1[3-9]\\\\d)\", \"4\\\\d{9}|[1249]\\\\d{7}|(?:[49]\\\\d|80)\\\\d{5}\", [7, 8, 10], [[\"(\\\\d{3})(\\\\d{4})\", \"$1 $2\", [\"405|8|90\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"9\"], \"0$1\"], [\"(\\\\d{4})(\\\\d{4})\", \"$1 $2\", [\"[124]\"]], [\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"4\"], \"0$1\"]], \"0\", 0, 0, 0, 0, 0, 0, \"00\", \" int. \"],\n \"UZ\": [\"998\", \"810\", \"(?:33|55|[679]\\\\d|88)\\\\d{7}\", [9], [[\"(\\\\d{2})(\\\\d{3})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[35-9]\"], \"8 $1\"]], \"8\", 0, 0, 0, 0, 0, 0, \"8~10\"],\n \"VA\": [\"39\", \"00\", \"0\\\\d{5,10}|3[0-8]\\\\d{7,10}|55\\\\d{8}|8\\\\d{5}(?:\\\\d{2,4})?|(?:1\\\\d|39)\\\\d{7,8}\", [6, 7, 8, 9, 10, 11], 0, 0, 0, 0, 0, 0, \"06698\"],\n \"VC\": [\"1\", \"011\", \"(?:[58]\\\\d\\\\d|784|900)\\\\d{7}\", [10], 0, \"1\", 0, \"1|([2-7]\\\\d{6})$\", \"784$1\", 0, \"784\"],\n \"VE\": [\"58\", \"00\", \"[68]00\\\\d{7}|(?:[24]\\\\d|[59]0)\\\\d{8}\", [10], [[\"(\\\\d{3})(\\\\d{7})\", \"$1-$2\", [\"[24-689]\"], \"0$1\"]], \"0\"],\n \"VG\": [\"1\", \"011\", \"(?:284|[58]\\\\d\\\\d|900)\\\\d{7}\", [10], 0, \"1\", 0, \"1|([2-578]\\\\d{6})$\", \"284$1\", 0, \"284\"],\n \"VI\": [\"1\", \"011\", \"[58]\\\\d{9}|(?:34|90)0\\\\d{7}\", [10], 0, \"1\", 0, \"1|([2-9]\\\\d{6})$\", \"340$1\", 0, \"340\"],\n \"VN\": [\"84\", \"00\", \"[12]\\\\d{9}|[135-9]\\\\d{8}|[16]\\\\d{7}|[16-8]\\\\d{6}\", [7, 8, 9, 10], [[\"(\\\\d{2})(\\\\d{5})\", \"$1 $2\", [\"80\"], \"0$1\", 1], [\"(\\\\d{4})(\\\\d{4,6})\", \"$1 $2\", [\"1\"], 0, 1], [\"(\\\\d{2})(\\\\d{3})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"[69]\"], \"0$1\", 1], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[3578]\"], \"0$1\", 1], [\"(\\\\d{2})(\\\\d{4})(\\\\d{4})\", \"$1 $2 $3\", [\"2[48]\"], \"0$1\", 1], [\"(\\\\d{3})(\\\\d{4})(\\\\d{3})\", \"$1 $2 $3\", [\"2\"], \"0$1\", 1]], \"0\"],\n \"VU\": [\"678\", \"00\", \"[57-9]\\\\d{6}|(?:[238]\\\\d|48)\\\\d{3}\", [5, 7], [[\"(\\\\d{3})(\\\\d{4})\", \"$1 $2\", [\"[57-9]\"]]]],\n \"WF\": [\"681\", \"00\", \"(?:40|72)\\\\d{4}|8\\\\d{5}(?:\\\\d{3})?\", [6, 9], [[\"(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3\", [\"[478]\"]], [\"(\\\\d{3})(\\\\d{2})(\\\\d{2})(\\\\d{2})\", \"$1 $2 $3 $4\", [\"8\"]]]],\n \"WS\": [\"685\", \"0\", \"(?:[2-6]|8\\\\d{5})\\\\d{4}|[78]\\\\d{6}|[68]\\\\d{5}\", [5, 6, 7, 10], [[\"(\\\\d{5})\", \"$1\", [\"[2-5]|6[1-9]\"]], [\"(\\\\d{3})(\\\\d{3,7})\", \"$1 $2\", [\"[68]\"]], [\"(\\\\d{2})(\\\\d{5})\", \"$1 $2\", [\"7\"]]]],\n \"XK\": [\"383\", \"00\", \"[23]\\\\d{7,8}|(?:4\\\\d\\\\d|[89]00)\\\\d{5}\", [8, 9], [[\"(\\\\d{3})(\\\\d{5})\", \"$1 $2\", [\"[89]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[2-4]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[23]\"], \"0$1\"]], \"0\"],\n \"YE\": [\"967\", \"00\", \"(?:1|7\\\\d)\\\\d{7}|[1-7]\\\\d{6}\", [7, 8, 9], [[\"(\\\\d)(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"[1-6]|7[24-68]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"7\"], \"0$1\"]], \"0\"],\n \"YT\": [\"262\", \"00\", \"80\\\\d{7}|(?:26|63)9\\\\d{6}\", [9], 0, \"0\", 0, 0, 0, 0, \"269|63\"],\n \"ZA\": [\"27\", \"00\", \"[1-79]\\\\d{8}|8\\\\d{4,9}\", [5, 6, 7, 8, 9, 10], [[\"(\\\\d{2})(\\\\d{3,4})\", \"$1 $2\", [\"8[1-4]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{2,3})\", \"$1 $2 $3\", [\"8[1-4]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"860\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"[1-9]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"8\"], \"0$1\"]], \"0\"],\n \"ZM\": [\"260\", \"00\", \"800\\\\d{6}|(?:21|63|[79]\\\\d)\\\\d{7}\", [9], [[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[28]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{7})\", \"$1 $2\", [\"[79]\"], \"0$1\"]], \"0\"],\n \"ZW\": [\"263\", \"00\", \"2(?:[0-57-9]\\\\d{6,8}|6[0-24-9]\\\\d{6,7})|[38]\\\\d{9}|[35-8]\\\\d{8}|[3-6]\\\\d{7}|[1-689]\\\\d{6}|[1-3569]\\\\d{5}|[1356]\\\\d{4}\", [5, 6, 7, 8, 9, 10], [[\"(\\\\d{3})(\\\\d{3,5})\", \"$1 $2\", [\"2(?:0[45]|2[278]|[49]8)|3(?:[09]8|17)|6(?:[29]8|37|75)|[23][78]|(?:33|5[15]|6[68])[78]\"], \"0$1\"], [\"(\\\\d)(\\\\d{3})(\\\\d{2,4})\", \"$1 $2 $3\", [\"[49]\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{4})\", \"$1 $2\", [\"80\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{7})\", \"$1 $2\", [\"24|8[13-59]|(?:2[05-79]|39|5[45]|6[15-8])2\", \"2(?:02[014]|4|[56]20|[79]2)|392|5(?:42|525)|6(?:[16-8]21|52[013])|8[13-59]\"], \"(0$1)\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"7\"], \"0$1\"], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"2(?:1[39]|2[0157]|[378]|[56][14])|3(?:12|29)\", \"2(?:1[39]|2[0157]|[378]|[56][14])|3(?:123|29)\"], \"0$1\"], [\"(\\\\d{4})(\\\\d{6})\", \"$1 $2\", [\"8\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3,5})\", \"$1 $2\", [\"1|2(?:0[0-36-9]|12|29|[56])|3(?:1[0-689]|[24-6])|5(?:[0236-9]|1[2-4])|6(?:[013-59]|7[0-46-9])|(?:33|55|6[68])[0-69]|(?:29|3[09]|62)[0-79]\"], \"0$1\"], [\"(\\\\d{2})(\\\\d{3})(\\\\d{3,4})\", \"$1 $2 $3\", [\"29[013-9]|39|54\"], \"0$1\"], [\"(\\\\d{4})(\\\\d{3,5})\", \"$1 $2\", [\"(?:25|54)8\", \"258|5483\"], \"0$1\"]], \"0\"]\n },\n \"nonGeographic\": {\n \"800\": [\"800\", 0, \"(?:00|[1-9]\\\\d)\\\\d{6}\", [8], [[\"(\\\\d{4})(\\\\d{4})\", \"$1 $2\", [\"\\\\d\"]]], 0, 0, 0, 0, 0, 0, [0, 0, [\"(?:00|[1-9]\\\\d)\\\\d{6}\"]]],\n \"808\": [\"808\", 0, \"[1-9]\\\\d{7}\", [8], [[\"(\\\\d{4})(\\\\d{4})\", \"$1 $2\", [\"[1-9]\"]]], 0, 0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0, 0, 0, 0, [\"[1-9]\\\\d{7}\"]]],\n \"870\": [\"870\", 0, \"7\\\\d{11}|[35-7]\\\\d{8}\", [9, 12], [[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"[35-7]\"]]], 0, 0, 0, 0, 0, 0, [0, [\"(?:[356]|774[45])\\\\d{8}|7[6-8]\\\\d{7}\"]]],\n \"878\": [\"878\", 0, \"10\\\\d{10}\", [12], [[\"(\\\\d{2})(\\\\d{5})(\\\\d{5})\", \"$1 $2 $3\", [\"1\"]]], 0, 0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0, 0, 0, [\"10\\\\d{10}\"]]],\n \"881\": [\"881\", 0, \"[0-36-9]\\\\d{8}\", [9], [[\"(\\\\d)(\\\\d{3})(\\\\d{5})\", \"$1 $2 $3\", [\"[0-36-9]\"]]], 0, 0, 0, 0, 0, 0, [0, [\"[0-36-9]\\\\d{8}\"]]],\n \"882\": [\"882\", 0, \"[13]\\\\d{6}(?:\\\\d{2,5})?|285\\\\d{9}|(?:[19]\\\\d|49)\\\\d{6}\", [7, 8, 9, 10, 11, 12], [[\"(\\\\d{2})(\\\\d{5})\", \"$1 $2\", [\"16|342\"]], [\"(\\\\d{2})(\\\\d{6})\", \"$1 $2\", [\"4\"]], [\"(\\\\d{2})(\\\\d{2})(\\\\d{4})\", \"$1 $2 $3\", [\"[19]\"]], [\"(\\\\d{2})(\\\\d{4})(\\\\d{3})\", \"$1 $2 $3\", [\"3[23]\"]], [\"(\\\\d{2})(\\\\d{3,4})(\\\\d{4})\", \"$1 $2 $3\", [\"1\"]], [\"(\\\\d{2})(\\\\d{4})(\\\\d{4})\", \"$1 $2 $3\", [\"34[57]\"]], [\"(\\\\d{3})(\\\\d{4})(\\\\d{4})\", \"$1 $2 $3\", [\"34\"]], [\"(\\\\d{2})(\\\\d{4,5})(\\\\d{5})\", \"$1 $2 $3\", [\"[1-3]\"]]], 0, 0, 0, 0, 0, 0, [0, [\"342\\\\d{4}|(?:337|49)\\\\d{6}|3(?:2|47|7\\\\d{3})\\\\d{7}\", [7, 8, 9, 10, 12]], 0, 0, 0, 0, 0, 0, [\"1(?:3(?:0[0347]|[13][0139]|2[035]|4[013568]|6[0459]|7[06]|8[15-8]|9[0689])\\\\d{4}|6\\\\d{5,10})|(?:(?:285\\\\d\\\\d|3(?:45|[69]\\\\d{3}))\\\\d|9[89])\\\\d{6}\"]]],\n \"883\": [\"883\", 0, \"(?:210|370\\\\d\\\\d)\\\\d{7}|51\\\\d{7}(?:\\\\d{3})?\", [9, 10, 12], [[\"(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3\", [\"510\"]], [\"(\\\\d{3})(\\\\d{3})(\\\\d{4})\", \"$1 $2 $3\", [\"2\"]], [\"(\\\\d{4})(\\\\d{4})(\\\\d{4})\", \"$1 $2 $3\", [\"51[13]\"]], [\"(\\\\d{3})(\\\\d{3})(\\\\d{3})(\\\\d{3})\", \"$1 $2 $3 $4\", [\"[35]\"]]], 0, 0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0, 0, 0, [\"(?:210|(?:370[1-9]|51[013]0)\\\\d)\\\\d{7}|5100\\\\d{5}\"]]],\n \"888\": [\"888\", 0, \"\\\\d{11}\", [11], [[\"(\\\\d{3})(\\\\d{3})(\\\\d{5})\", \"$1 $2 $3\"]], 0, 0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0, [\"\\\\d{11}\"]]],\n \"979\": [\"979\", 0, \"[1359]\\\\d{8}\", [9], [[\"(\\\\d)(\\\\d{4})(\\\\d{4})\", \"$1 $2 $3\", [\"[1359]\"]]], 0, 0, 0, 0, 0, 0, [0, 0, 0, [\"[1359]\\\\d{8}\"]]]\n }\n};","// The minimum length of the national significant number.\nexport var MIN_LENGTH_FOR_NSN = 2; // The ITU says the maximum length should be 15,\n// but one can find longer numbers in Germany.\n\nexport var MAX_LENGTH_FOR_NSN = 17; // The maximum length of the country calling code.\n\nexport var MAX_LENGTH_COUNTRY_CODE = 3; // Digits accepted in phone numbers\n// (ascii, fullwidth, arabic-indic, and eastern arabic digits).\n\nexport var VALID_DIGITS = \"0-9\\uFF10-\\uFF19\\u0660-\\u0669\\u06F0-\\u06F9\"; // `DASHES` will be right after the opening square bracket of the \"character class\"\n\nvar DASHES = \"-\\u2010-\\u2015\\u2212\\u30FC\\uFF0D\";\nvar SLASHES = \"\\uFF0F/\";\nvar DOTS = \"\\uFF0E.\";\nexport var WHITESPACE = \" \\xA0\\xAD\\u200B\\u2060\\u3000\";\nvar BRACKETS = \"()\\uFF08\\uFF09\\uFF3B\\uFF3D\\\\[\\\\]\"; // export const OPENING_BRACKETS = '(\\uFF08\\uFF3B\\\\\\['\n\nvar TILDES = \"~\\u2053\\u223C\\uFF5E\"; // Regular expression of acceptable punctuation found in phone numbers. This\n// excludes punctuation found as a leading character only. This consists of dash\n// characters, white space characters, full stops, slashes, square brackets,\n// parentheses and tildes. Full-width variants are also present.\n\nexport var VALID_PUNCTUATION = \"\".concat(DASHES).concat(SLASHES).concat(DOTS).concat(WHITESPACE).concat(BRACKETS).concat(TILDES);\nexport var PLUS_CHARS = \"+\\uFF0B\"; // const LEADING_PLUS_CHARS_PATTERN = new RegExp('^[' + PLUS_CHARS + ']+')","function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, _typeof(obj);\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n Object.defineProperty(subClass, \"prototype\", {\n writable: false\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n}\n\nfunction _createSuper(Derived) {\n var hasNativeReflectConstruct = _isNativeReflectConstruct();\n\n return function _createSuperInternal() {\n var Super = _getPrototypeOf(Derived),\n result;\n\n if (hasNativeReflectConstruct) {\n var NewTarget = _getPrototypeOf(this).constructor;\n\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return _possibleConstructorReturn(this, result);\n };\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n } else if (call !== void 0) {\n throw new TypeError(\"Derived constructors may only return object or undefined\");\n }\n\n return _assertThisInitialized(self);\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nfunction _wrapNativeSuper(Class) {\n var _cache = typeof Map === \"function\" ? new Map() : undefined;\n\n _wrapNativeSuper = function _wrapNativeSuper(Class) {\n if (Class === null || !_isNativeFunction(Class)) return Class;\n\n if (typeof Class !== \"function\") {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n if (typeof _cache !== \"undefined\") {\n if (_cache.has(Class)) return _cache.get(Class);\n\n _cache.set(Class, Wrapper);\n }\n\n function Wrapper() {\n return _construct(Class, arguments, _getPrototypeOf(this).constructor);\n }\n\n Wrapper.prototype = Object.create(Class.prototype, {\n constructor: {\n value: Wrapper,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n return _setPrototypeOf(Wrapper, Class);\n };\n\n return _wrapNativeSuper(Class);\n}\n\nfunction _construct(Parent, args, Class) {\n if (_isNativeReflectConstruct()) {\n _construct = Reflect.construct;\n } else {\n _construct = function _construct(Parent, args, Class) {\n var a = [null];\n a.push.apply(a, args);\n var Constructor = Function.bind.apply(Parent, a);\n var instance = new Constructor();\n if (Class) _setPrototypeOf(instance, Class.prototype);\n return instance;\n };\n }\n\n return _construct.apply(null, arguments);\n}\n\nfunction _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction _isNativeFunction(fn) {\n return Function.toString.call(fn).indexOf(\"[native code]\") !== -1;\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n} // https://stackoverflow.com/a/46971044/970769\n// \"Breaking changes in Typescript 2.1\"\n// \"Extending built-ins like Error, Array, and Map may no longer work.\"\n// \"As a recommendation, you can manually adjust the prototype immediately after any super(...) calls.\"\n// https://github.com/Microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n\n\nvar ParseError = /*#__PURE__*/function (_Error) {\n _inherits(ParseError, _Error);\n\n var _super = _createSuper(ParseError);\n\n function ParseError(code) {\n var _this;\n\n _classCallCheck(this, ParseError);\n\n _this = _super.call(this, code); // Set the prototype explicitly.\n // Any subclass of FooError will have to manually set the prototype as well.\n\n Object.setPrototypeOf(_assertThisInitialized(_this), ParseError.prototype);\n _this.name = _this.constructor.name;\n return _this;\n }\n\n return _createClass(ParseError);\n}( /*#__PURE__*/_wrapNativeSuper(Error));\n\nexport { ParseError as default };","// Copy-pasted from:\n// https://github.com/substack/semver-compare/blob/master/index.js\n//\n// Inlining this function because some users reported issues with\n// importing from `semver-compare` in a browser with ES6 \"native\" modules.\n//\n// Fixes `semver-compare` not being able to compare versions with alpha/beta/etc \"tags\".\n// https://github.com/catamphetamine/libphonenumber-js/issues/381\nexport default function (a, b) {\n a = a.split('-');\n b = b.split('-');\n var pa = a[0].split('.');\n var pb = b[0].split('.');\n\n for (var i = 0; i < 3; i++) {\n var na = Number(pa[i]);\n var nb = Number(pb[i]);\n if (na > nb) return 1;\n if (nb > na) return -1;\n if (!isNaN(na) && isNaN(nb)) return 1;\n if (isNaN(na) && !isNaN(nb)) return -1;\n }\n\n if (a[1] && b[1]) {\n return a[1] > b[1] ? 1 : a[1] < b[1] ? -1 : 0;\n }\n\n return !a[1] && b[1] ? 1 : a[1] && !b[1] ? -1 : 0;\n}","function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, _typeof(obj);\n}\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}\n\nimport compare from './tools/semver-compare.js'; // Added \"possibleLengths\" and renamed\n// \"country_phone_code_to_countries\" to \"country_calling_codes\".\n\nvar V2 = '1.0.18'; // Added \"idd_prefix\" and \"default_idd_prefix\".\n\nvar V3 = '1.2.0'; // Moved `001` country code to \"nonGeographic\" section of metadata.\n\nvar V4 = '1.7.35';\nvar DEFAULT_EXT_PREFIX = ' ext. ';\nvar CALLING_CODE_REG_EXP = /^\\d+$/;\n/**\r\n * See: https://gitlab.com/catamphetamine/libphonenumber-js/blob/master/METADATA.md\r\n */\n\nvar Metadata = /*#__PURE__*/function () {\n function Metadata(metadata) {\n _classCallCheck(this, Metadata);\n\n validateMetadata(metadata);\n this.metadata = metadata;\n setVersion.call(this, metadata);\n }\n\n _createClass(Metadata, [{\n key: \"getCountries\",\n value: function getCountries() {\n return Object.keys(this.metadata.countries).filter(function (_) {\n return _ !== '001';\n });\n }\n }, {\n key: \"getCountryMetadata\",\n value: function getCountryMetadata(countryCode) {\n return this.metadata.countries[countryCode];\n }\n }, {\n key: \"nonGeographic\",\n value: function nonGeographic() {\n if (this.v1 || this.v2 || this.v3) return; // `nonGeographical` was a typo.\n // It's present in metadata generated from `1.7.35` to `1.7.37`.\n // The test case could be found by searching for \"nonGeographical\".\n\n return this.metadata.nonGeographic || this.metadata.nonGeographical;\n }\n }, {\n key: \"hasCountry\",\n value: function hasCountry(country) {\n return this.getCountryMetadata(country) !== undefined;\n }\n }, {\n key: \"hasCallingCode\",\n value: function hasCallingCode(callingCode) {\n if (this.getCountryCodesForCallingCode(callingCode)) {\n return true;\n }\n\n if (this.nonGeographic()) {\n if (this.nonGeographic()[callingCode]) {\n return true;\n }\n } else {\n // A hacky workaround for old custom metadata (generated before V4).\n var countryCodes = this.countryCallingCodes()[callingCode];\n\n if (countryCodes && countryCodes.length === 1 && countryCodes[0] === '001') {\n return true;\n }\n }\n }\n }, {\n key: \"isNonGeographicCallingCode\",\n value: function isNonGeographicCallingCode(callingCode) {\n if (this.nonGeographic()) {\n return this.nonGeographic()[callingCode] ? true : false;\n } else {\n return this.getCountryCodesForCallingCode(callingCode) ? false : true;\n }\n } // Deprecated.\n\n }, {\n key: \"country\",\n value: function country(countryCode) {\n return this.selectNumberingPlan(countryCode);\n }\n }, {\n key: \"selectNumberingPlan\",\n value: function selectNumberingPlan(countryCode, callingCode) {\n // Supports just passing `callingCode` as the first argument.\n if (countryCode && CALLING_CODE_REG_EXP.test(countryCode)) {\n callingCode = countryCode;\n countryCode = null;\n }\n\n if (countryCode && countryCode !== '001') {\n if (!this.hasCountry(countryCode)) {\n throw new Error(\"Unknown country: \".concat(countryCode));\n }\n\n this.numberingPlan = new NumberingPlan(this.getCountryMetadata(countryCode), this);\n } else if (callingCode) {\n if (!this.hasCallingCode(callingCode)) {\n throw new Error(\"Unknown calling code: \".concat(callingCode));\n }\n\n this.numberingPlan = new NumberingPlan(this.getNumberingPlanMetadata(callingCode), this);\n } else {\n this.numberingPlan = undefined;\n }\n\n return this;\n }\n }, {\n key: \"getCountryCodesForCallingCode\",\n value: function getCountryCodesForCallingCode(callingCode) {\n var countryCodes = this.countryCallingCodes()[callingCode];\n\n if (countryCodes) {\n // Metadata before V4 included \"non-geographic entity\" calling codes\n // inside `country_calling_codes` (for example, `\"881\":[\"001\"]`).\n // Now the semantics of `country_calling_codes` has changed:\n // it's specifically for \"countries\" now.\n // Older versions of custom metadata will simply skip parsing\n // \"non-geographic entity\" phone numbers with new versions\n // of this library: it's not considered a bug,\n // because such numbers are extremely rare,\n // and developers extremely rarely use custom metadata.\n if (countryCodes.length === 1 && countryCodes[0].length === 3) {\n return;\n }\n\n return countryCodes;\n }\n }\n }, {\n key: \"getCountryCodeForCallingCode\",\n value: function getCountryCodeForCallingCode(callingCode) {\n var countryCodes = this.getCountryCodesForCallingCode(callingCode);\n\n if (countryCodes) {\n return countryCodes[0];\n }\n }\n }, {\n key: \"getNumberingPlanMetadata\",\n value: function getNumberingPlanMetadata(callingCode) {\n var countryCode = this.getCountryCodeForCallingCode(callingCode);\n\n if (countryCode) {\n return this.getCountryMetadata(countryCode);\n }\n\n if (this.nonGeographic()) {\n var metadata = this.nonGeographic()[callingCode];\n\n if (metadata) {\n return metadata;\n }\n } else {\n // A hacky workaround for old custom metadata (generated before V4).\n // In that metadata, there was no concept of \"non-geographic\" metadata\n // so metadata for `001` country code was stored along with other countries.\n // The test case can be found by searching for:\n // \"should work around `nonGeographic` metadata not existing\".\n var countryCodes = this.countryCallingCodes()[callingCode];\n\n if (countryCodes && countryCodes.length === 1 && countryCodes[0] === '001') {\n return this.metadata.countries['001'];\n }\n }\n } // Deprecated.\n\n }, {\n key: \"countryCallingCode\",\n value: function countryCallingCode() {\n return this.numberingPlan.callingCode();\n } // Deprecated.\n\n }, {\n key: \"IDDPrefix\",\n value: function IDDPrefix() {\n return this.numberingPlan.IDDPrefix();\n } // Deprecated.\n\n }, {\n key: \"defaultIDDPrefix\",\n value: function defaultIDDPrefix() {\n return this.numberingPlan.defaultIDDPrefix();\n } // Deprecated.\n\n }, {\n key: \"nationalNumberPattern\",\n value: function nationalNumberPattern() {\n return this.numberingPlan.nationalNumberPattern();\n } // Deprecated.\n\n }, {\n key: \"possibleLengths\",\n value: function possibleLengths() {\n return this.numberingPlan.possibleLengths();\n } // Deprecated.\n\n }, {\n key: \"formats\",\n value: function formats() {\n return this.numberingPlan.formats();\n } // Deprecated.\n\n }, {\n key: \"nationalPrefixForParsing\",\n value: function nationalPrefixForParsing() {\n return this.numberingPlan.nationalPrefixForParsing();\n } // Deprecated.\n\n }, {\n key: \"nationalPrefixTransformRule\",\n value: function nationalPrefixTransformRule() {\n return this.numberingPlan.nationalPrefixTransformRule();\n } // Deprecated.\n\n }, {\n key: \"leadingDigits\",\n value: function leadingDigits() {\n return this.numberingPlan.leadingDigits();\n } // Deprecated.\n\n }, {\n key: \"hasTypes\",\n value: function hasTypes() {\n return this.numberingPlan.hasTypes();\n } // Deprecated.\n\n }, {\n key: \"type\",\n value: function type(_type) {\n return this.numberingPlan.type(_type);\n } // Deprecated.\n\n }, {\n key: \"ext\",\n value: function ext() {\n return this.numberingPlan.ext();\n }\n }, {\n key: \"countryCallingCodes\",\n value: function countryCallingCodes() {\n if (this.v1) return this.metadata.country_phone_code_to_countries;\n return this.metadata.country_calling_codes;\n } // Deprecated.\n\n }, {\n key: \"chooseCountryByCountryCallingCode\",\n value: function chooseCountryByCountryCallingCode(callingCode) {\n return this.selectNumberingPlan(callingCode);\n }\n }, {\n key: \"hasSelectedNumberingPlan\",\n value: function hasSelectedNumberingPlan() {\n return this.numberingPlan !== undefined;\n }\n }]);\n\n return Metadata;\n}();\n\nexport { Metadata as default };\n\nvar NumberingPlan = /*#__PURE__*/function () {\n function NumberingPlan(metadata, globalMetadataObject) {\n _classCallCheck(this, NumberingPlan);\n\n this.globalMetadataObject = globalMetadataObject;\n this.metadata = metadata;\n setVersion.call(this, globalMetadataObject.metadata);\n }\n\n _createClass(NumberingPlan, [{\n key: \"callingCode\",\n value: function callingCode() {\n return this.metadata[0];\n } // Formatting information for regions which share\n // a country calling code is contained by only one region\n // for performance reasons. For example, for NANPA region\n // (\"North American Numbering Plan Administration\",\n // which includes USA, Canada, Cayman Islands, Bahamas, etc)\n // it will be contained in the metadata for `US`.\n\n }, {\n key: \"getDefaultCountryMetadataForRegion\",\n value: function getDefaultCountryMetadataForRegion() {\n return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode());\n } // Is always present.\n\n }, {\n key: \"IDDPrefix\",\n value: function IDDPrefix() {\n if (this.v1 || this.v2) return;\n return this.metadata[1];\n } // Is only present when a country supports multiple IDD prefixes.\n\n }, {\n key: \"defaultIDDPrefix\",\n value: function defaultIDDPrefix() {\n if (this.v1 || this.v2) return;\n return this.metadata[12];\n }\n }, {\n key: \"nationalNumberPattern\",\n value: function nationalNumberPattern() {\n if (this.v1 || this.v2) return this.metadata[1];\n return this.metadata[2];\n } // \"possible length\" data is always present in Google's metadata.\n\n }, {\n key: \"possibleLengths\",\n value: function possibleLengths() {\n if (this.v1) return;\n return this.metadata[this.v2 ? 2 : 3];\n }\n }, {\n key: \"_getFormats\",\n value: function _getFormats(metadata) {\n return metadata[this.v1 ? 2 : this.v2 ? 3 : 4];\n } // For countries of the same region (e.g. NANPA)\n // formats are all stored in the \"main\" country for that region.\n // E.g. \"RU\" and \"KZ\", \"US\" and \"CA\".\n\n }, {\n key: \"formats\",\n value: function formats() {\n var _this = this;\n\n var formats = this._getFormats(this.metadata) || this._getFormats(this.getDefaultCountryMetadataForRegion()) || [];\n return formats.map(function (_) {\n return new Format(_, _this);\n });\n }\n }, {\n key: \"nationalPrefix\",\n value: function nationalPrefix() {\n return this.metadata[this.v1 ? 3 : this.v2 ? 4 : 5];\n }\n }, {\n key: \"_getNationalPrefixFormattingRule\",\n value: function _getNationalPrefixFormattingRule(metadata) {\n return metadata[this.v1 ? 4 : this.v2 ? 5 : 6];\n } // For countries of the same region (e.g. NANPA)\n // national prefix formatting rule is stored in the \"main\" country for that region.\n // E.g. \"RU\" and \"KZ\", \"US\" and \"CA\".\n\n }, {\n key: \"nationalPrefixFormattingRule\",\n value: function nationalPrefixFormattingRule() {\n return this._getNationalPrefixFormattingRule(this.metadata) || this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion());\n }\n }, {\n key: \"_nationalPrefixForParsing\",\n value: function _nationalPrefixForParsing() {\n return this.metadata[this.v1 ? 5 : this.v2 ? 6 : 7];\n }\n }, {\n key: \"nationalPrefixForParsing\",\n value: function nationalPrefixForParsing() {\n // If `national_prefix_for_parsing` is not set explicitly,\n // then infer it from `national_prefix` (if any)\n return this._nationalPrefixForParsing() || this.nationalPrefix();\n }\n }, {\n key: \"nationalPrefixTransformRule\",\n value: function nationalPrefixTransformRule() {\n return this.metadata[this.v1 ? 6 : this.v2 ? 7 : 8];\n }\n }, {\n key: \"_getNationalPrefixIsOptionalWhenFormatting\",\n value: function _getNationalPrefixIsOptionalWhenFormatting() {\n return !!this.metadata[this.v1 ? 7 : this.v2 ? 8 : 9];\n } // For countries of the same region (e.g. NANPA)\n // \"national prefix is optional when formatting\" flag is\n // stored in the \"main\" country for that region.\n // E.g. \"RU\" and \"KZ\", \"US\" and \"CA\".\n\n }, {\n key: \"nationalPrefixIsOptionalWhenFormattingInNationalFormat\",\n value: function nationalPrefixIsOptionalWhenFormattingInNationalFormat() {\n return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata) || this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion());\n }\n }, {\n key: \"leadingDigits\",\n value: function leadingDigits() {\n return this.metadata[this.v1 ? 8 : this.v2 ? 9 : 10];\n }\n }, {\n key: \"types\",\n value: function types() {\n return this.metadata[this.v1 ? 9 : this.v2 ? 10 : 11];\n }\n }, {\n key: \"hasTypes\",\n value: function hasTypes() {\n // Versions 1.2.0 - 1.2.4: can be `[]`.\n\n /* istanbul ignore next */\n if (this.types() && this.types().length === 0) {\n return false;\n } // Versions <= 1.2.4: can be `undefined`.\n // Version >= 1.2.5: can be `0`.\n\n\n return !!this.types();\n }\n }, {\n key: \"type\",\n value: function type(_type2) {\n if (this.hasTypes() && getType(this.types(), _type2)) {\n return new Type(getType(this.types(), _type2), this);\n }\n }\n }, {\n key: \"ext\",\n value: function ext() {\n if (this.v1 || this.v2) return DEFAULT_EXT_PREFIX;\n return this.metadata[13] || DEFAULT_EXT_PREFIX;\n }\n }]);\n\n return NumberingPlan;\n}();\n\nvar Format = /*#__PURE__*/function () {\n function Format(format, metadata) {\n _classCallCheck(this, Format);\n\n this._format = format;\n this.metadata = metadata;\n }\n\n _createClass(Format, [{\n key: \"pattern\",\n value: function pattern() {\n return this._format[0];\n }\n }, {\n key: \"format\",\n value: function format() {\n return this._format[1];\n }\n }, {\n key: \"leadingDigitsPatterns\",\n value: function leadingDigitsPatterns() {\n return this._format[2] || [];\n }\n }, {\n key: \"nationalPrefixFormattingRule\",\n value: function nationalPrefixFormattingRule() {\n return this._format[3] || this.metadata.nationalPrefixFormattingRule();\n }\n }, {\n key: \"nationalPrefixIsOptionalWhenFormattingInNationalFormat\",\n value: function nationalPrefixIsOptionalWhenFormattingInNationalFormat() {\n return !!this._format[4] || this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat();\n }\n }, {\n key: \"nationalPrefixIsMandatoryWhenFormattingInNationalFormat\",\n value: function nationalPrefixIsMandatoryWhenFormattingInNationalFormat() {\n // National prefix is omitted if there's no national prefix formatting rule\n // set for this country, or when the national prefix formatting rule\n // contains no national prefix itself, or when this rule is set but\n // national prefix is optional for this phone number format\n // (and it is not enforced explicitly)\n return this.usesNationalPrefix() && !this.nationalPrefixIsOptionalWhenFormattingInNationalFormat();\n } // Checks whether national prefix formatting rule contains national prefix.\n\n }, {\n key: \"usesNationalPrefix\",\n value: function usesNationalPrefix() {\n return this.nationalPrefixFormattingRule() && // Check that national prefix formatting rule is not a \"dummy\" one.\n !FIRST_GROUP_ONLY_PREFIX_PATTERN.test(this.nationalPrefixFormattingRule()) // In compressed metadata, `this.nationalPrefixFormattingRule()` is `0`\n // when `national_prefix_formatting_rule` is not present.\n // So, `true` or `false` are returned explicitly here, so that\n // `0` number isn't returned.\n ? true : false;\n }\n }, {\n key: \"internationalFormat\",\n value: function internationalFormat() {\n return this._format[5] || this.format();\n }\n }]);\n\n return Format;\n}();\n/**\r\n * A pattern that is used to determine if the national prefix formatting rule\r\n * has the first group only, i.e., does not start with the national prefix.\r\n * Note that the pattern explicitly allows for unbalanced parentheses.\r\n */\n\n\nvar FIRST_GROUP_ONLY_PREFIX_PATTERN = /^\\(?\\$1\\)?$/;\n\nvar Type = /*#__PURE__*/function () {\n function Type(type, metadata) {\n _classCallCheck(this, Type);\n\n this.type = type;\n this.metadata = metadata;\n }\n\n _createClass(Type, [{\n key: \"pattern\",\n value: function pattern() {\n if (this.metadata.v1) return this.type;\n return this.type[0];\n }\n }, {\n key: \"possibleLengths\",\n value: function possibleLengths() {\n if (this.metadata.v1) return;\n return this.type[1] || this.metadata.possibleLengths();\n }\n }]);\n\n return Type;\n}();\n\nfunction getType(types, type) {\n switch (type) {\n case 'FIXED_LINE':\n return types[0];\n\n case 'MOBILE':\n return types[1];\n\n case 'TOLL_FREE':\n return types[2];\n\n case 'PREMIUM_RATE':\n return types[3];\n\n case 'PERSONAL_NUMBER':\n return types[4];\n\n case 'VOICEMAIL':\n return types[5];\n\n case 'UAN':\n return types[6];\n\n case 'PAGER':\n return types[7];\n\n case 'VOIP':\n return types[8];\n\n case 'SHARED_COST':\n return types[9];\n }\n}\n\nexport function validateMetadata(metadata) {\n if (!metadata) {\n throw new Error('[libphonenumber-js] `metadata` argument not passed. Check your arguments.');\n } // `country_phone_code_to_countries` was renamed to\n // `country_calling_codes` in `1.0.18`.\n\n\n if (!is_object(metadata) || !is_object(metadata.countries)) {\n throw new Error(\"[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got \".concat(is_object(metadata) ? 'an object of shape: { ' + Object.keys(metadata).join(', ') + ' }' : 'a ' + type_of(metadata) + ': ' + metadata, \".\"));\n }\n} // Babel transforms `typeof` into some \"branches\"\n// so istanbul will show this as \"branch not covered\".\n\n/* istanbul ignore next */\n\nvar is_object = function is_object(_) {\n return _typeof(_) === 'object';\n}; // Babel transforms `typeof` into some \"branches\"\n// so istanbul will show this as \"branch not covered\".\n\n/* istanbul ignore next */\n\n\nvar type_of = function type_of(_) {\n return _typeof(_);\n};\n/**\r\n * Returns extension prefix for a country.\r\n * @param {string} country\r\n * @param {object} metadata\r\n * @return {string?}\r\n * @example\r\n * // Returns \" ext. \"\r\n * getExtPrefix(\"US\")\r\n */\n\n\nexport function getExtPrefix(country, metadata) {\n metadata = new Metadata(metadata);\n\n if (metadata.hasCountry(country)) {\n return metadata.country(country).ext();\n }\n\n return DEFAULT_EXT_PREFIX;\n}\n/**\r\n * Returns \"country calling code\" for a country.\r\n * Throws an error if the country doesn't exist or isn't supported by this library.\r\n * @param {string} country\r\n * @param {object} metadata\r\n * @return {string}\r\n * @example\r\n * // Returns \"44\"\r\n * getCountryCallingCode(\"GB\")\r\n */\n\nexport function getCountryCallingCode(country, metadata) {\n metadata = new Metadata(metadata);\n\n if (metadata.hasCountry(country)) {\n return metadata.country(country).countryCallingCode();\n }\n\n throw new Error(\"Unknown country: \".concat(country));\n}\nexport function isSupportedCountry(country, metadata) {\n // metadata = new Metadata(metadata)\n // return metadata.hasCountry(country)\n return metadata.countries[country] !== undefined;\n}\n\nfunction setVersion(metadata) {\n var version = metadata.version;\n\n if (typeof version === 'number') {\n this.v1 = version === 1;\n this.v2 = version === 2;\n this.v3 = version === 3;\n this.v4 = version === 4;\n } else {\n if (!version) {\n this.v1 = true;\n } else if (compare(version, V3) === -1) {\n this.v2 = true;\n } else if (compare(version, V4) === -1) {\n this.v3 = true;\n } else {\n this.v4 = true;\n }\n }\n} // const ISO_COUNTRY_CODE = /^[A-Z]{2}$/\n// function isCountryCode(countryCode) {\n// \treturn ISO_COUNTRY_CODE.test(countryCodeOrCountryCallingCode)\n// }","import { VALID_DIGITS } from '../../constants.js'; // The RFC 3966 format for extensions.\n\nvar RFC3966_EXTN_PREFIX = ';ext=';\n/**\r\n * Helper method for constructing regular expressions for parsing. Creates\r\n * an expression that captures up to max_length digits.\r\n * @return {string} RegEx pattern to capture extension digits.\r\n */\n\nvar getExtensionDigitsPattern = function getExtensionDigitsPattern(maxLength) {\n return \"([\".concat(VALID_DIGITS, \"]{1,\").concat(maxLength, \"})\");\n};\n/**\r\n * Helper initialiser method to create the regular-expression pattern to match\r\n * extensions.\r\n * Copy-pasted from Google's `libphonenumber`:\r\n * https://github.com/google/libphonenumber/blob/55b2646ec9393f4d3d6661b9c82ef9e258e8b829/javascript/i18n/phonenumbers/phonenumberutil.js#L759-L766\r\n * @return {string} RegEx pattern to capture extensions.\r\n */\n\n\nexport default function createExtensionPattern(purpose) {\n // We cap the maximum length of an extension based on the ambiguity of the way\n // the extension is prefixed. As per ITU, the officially allowed length for\n // extensions is actually 40, but we don't support this since we haven't seen real\n // examples and this introduces many false interpretations as the extension labels\n // are not standardized.\n\n /** @type {string} */\n var extLimitAfterExplicitLabel = '20';\n /** @type {string} */\n\n var extLimitAfterLikelyLabel = '15';\n /** @type {string} */\n\n var extLimitAfterAmbiguousChar = '9';\n /** @type {string} */\n\n var extLimitWhenNotSure = '6';\n /** @type {string} */\n\n var possibleSeparatorsBetweenNumberAndExtLabel = \"[ \\xA0\\\\t,]*\"; // Optional full stop (.) or colon, followed by zero or more spaces/tabs/commas.\n\n /** @type {string} */\n\n var possibleCharsAfterExtLabel = \"[:\\\\.\\uFF0E]?[ \\xA0\\\\t,-]*\";\n /** @type {string} */\n\n var optionalExtnSuffix = \"#?\"; // Here the extension is called out in more explicit way, i.e mentioning it obvious\n // patterns like \"ext.\".\n\n /** @type {string} */\n\n var explicitExtLabels = \"(?:e?xt(?:ensi(?:o\\u0301?|\\xF3))?n?|\\uFF45?\\uFF58\\uFF54\\uFF4E?|\\u0434\\u043E\\u0431|anexo)\"; // One-character symbols that can be used to indicate an extension, and less\n // commonly used or more ambiguous extension labels.\n\n /** @type {string} */\n\n var ambiguousExtLabels = \"(?:[x\\uFF58#\\uFF03~\\uFF5E]|int|\\uFF49\\uFF4E\\uFF54)\"; // When extension is not separated clearly.\n\n /** @type {string} */\n\n var ambiguousSeparator = \"[- ]+\"; // This is the same as possibleSeparatorsBetweenNumberAndExtLabel, but not matching\n // comma as extension label may have it.\n\n /** @type {string} */\n\n var possibleSeparatorsNumberExtLabelNoComma = \"[ \\xA0\\\\t]*\"; // \",,\" is commonly used for auto dialling the extension when connected. First\n // comma is matched through possibleSeparatorsBetweenNumberAndExtLabel, so we do\n // not repeat it here. Semi-colon works in Iphone and Android also to pop up a\n // button with the extension number following.\n\n /** @type {string} */\n\n var autoDiallingAndExtLabelsFound = \"(?:,{2}|;)\";\n /** @type {string} */\n\n var rfcExtn = RFC3966_EXTN_PREFIX + getExtensionDigitsPattern(extLimitAfterExplicitLabel);\n /** @type {string} */\n\n var explicitExtn = possibleSeparatorsBetweenNumberAndExtLabel + explicitExtLabels + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterExplicitLabel) + optionalExtnSuffix;\n /** @type {string} */\n\n var ambiguousExtn = possibleSeparatorsBetweenNumberAndExtLabel + ambiguousExtLabels + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterAmbiguousChar) + optionalExtnSuffix;\n /** @type {string} */\n\n var americanStyleExtnWithSuffix = ambiguousSeparator + getExtensionDigitsPattern(extLimitWhenNotSure) + \"#\";\n /** @type {string} */\n\n var autoDiallingExtn = possibleSeparatorsNumberExtLabelNoComma + autoDiallingAndExtLabelsFound + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterLikelyLabel) + optionalExtnSuffix;\n /** @type {string} */\n\n var onlyCommasExtn = possibleSeparatorsNumberExtLabelNoComma + \"(?:,)+\" + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterAmbiguousChar) + optionalExtnSuffix; // The first regular expression covers RFC 3966 format, where the extension is added\n // using \";ext=\". The second more generic where extension is mentioned with explicit\n // labels like \"ext:\". In both the above cases we allow more numbers in extension than\n // any other extension labels. The third one captures when single character extension\n // labels or less commonly used labels are used. In such cases we capture fewer\n // extension digits in order to reduce the chance of falsely interpreting two\n // numbers beside each other as a number + extension. The fourth one covers the\n // special case of American numbers where the extension is written with a hash\n // at the end, such as \"- 503#\". The fifth one is exclusively for extension\n // autodialling formats which are used when dialling and in this case we accept longer\n // extensions. The last one is more liberal on the number of commas that acts as\n // extension labels, so we have a strict cap on the number of digits in such extensions.\n\n return rfcExtn + \"|\" + explicitExtn + \"|\" + ambiguousExtn + \"|\" + americanStyleExtnWithSuffix + \"|\" + autoDiallingExtn + \"|\" + onlyCommasExtn;\n}","import { MIN_LENGTH_FOR_NSN, VALID_DIGITS, VALID_PUNCTUATION, PLUS_CHARS } from '../constants.js';\nimport createExtensionPattern from './extension/createExtensionPattern.js'; // Regular expression of viable phone numbers. This is location independent.\n// Checks we have at least three leading digits, and only valid punctuation,\n// alpha characters and digits in the phone number. Does not include extension\n// data. The symbol 'x' is allowed here as valid punctuation since it is often\n// used as a placeholder for carrier codes, for example in Brazilian phone\n// numbers. We also allow multiple '+' characters at the start.\n//\n// Corresponds to the following:\n// [digits]{minLengthNsn}|\n// plus_sign*\n// (([punctuation]|[star])*[digits]){3,}([punctuation]|[star]|[digits]|[alpha])*\n//\n// The first reg-ex is to allow short numbers (two digits long) to be parsed if\n// they are entered as \"15\" etc, but only if there is no punctuation in them.\n// The second expression restricts the number of digits to three or more, but\n// then allows them to be in international form, and to have alpha-characters\n// and punctuation. We split up the two reg-exes here and combine them when\n// creating the reg-ex VALID_PHONE_NUMBER_PATTERN itself so we can prefix it\n// with ^ and append $ to each branch.\n//\n// \"Note VALID_PUNCTUATION starts with a -,\n// so must be the first in the range\" (c) Google devs.\n// (wtf did they mean by saying that; probably nothing)\n//\n\nvar MIN_LENGTH_PHONE_NUMBER_PATTERN = '[' + VALID_DIGITS + ']{' + MIN_LENGTH_FOR_NSN + '}'; //\n// And this is the second reg-exp:\n// (see MIN_LENGTH_PHONE_NUMBER_PATTERN for a full description of this reg-exp)\n//\n\nexport var VALID_PHONE_NUMBER = '[' + PLUS_CHARS + ']{0,1}' + '(?:' + '[' + VALID_PUNCTUATION + ']*' + '[' + VALID_DIGITS + ']' + '){3,}' + '[' + VALID_PUNCTUATION + VALID_DIGITS + ']*'; // This regular expression isn't present in Google's `libphonenumber`\n// and is only used to determine whether the phone number being input\n// is too short for it to even consider it a \"valid\" number.\n// This is just a way to differentiate between a really invalid phone\n// number like \"abcde\" and a valid phone number that a user has just\n// started inputting, like \"+1\" or \"1\": both these cases would be\n// considered `NOT_A_NUMBER` by Google's `libphonenumber`, but this\n// library can provide a more detailed error message — whether it's\n// really \"not a number\", or is it just a start of a valid phone number.\n\nvar VALID_PHONE_NUMBER_START_REG_EXP = new RegExp('^' + '[' + PLUS_CHARS + ']{0,1}' + '(?:' + '[' + VALID_PUNCTUATION + ']*' + '[' + VALID_DIGITS + ']' + '){1,2}' + '$', 'i');\nexport var VALID_PHONE_NUMBER_WITH_EXTENSION = VALID_PHONE_NUMBER + // Phone number extensions\n'(?:' + createExtensionPattern() + ')?'; // The combined regular expression for valid phone numbers:\n//\n\nvar VALID_PHONE_NUMBER_PATTERN = new RegExp( // Either a short two-digit-only phone number\n'^' + MIN_LENGTH_PHONE_NUMBER_PATTERN + '$' + '|' + // Or a longer fully parsed phone number (min 3 characters)\n'^' + VALID_PHONE_NUMBER_WITH_EXTENSION + '$', 'i'); // Checks to see if the string of characters could possibly be a phone number at\n// all. At the moment, checks to see that the string begins with at least 2\n// digits, ignoring any punctuation commonly found in phone numbers. This method\n// does not require the number to be normalized in advance - but does assume\n// that leading non-number symbols have been removed, such as by the method\n// `extract_possible_number`.\n//\n\nexport default function isViablePhoneNumber(number) {\n return number.length >= MIN_LENGTH_FOR_NSN && VALID_PHONE_NUMBER_PATTERN.test(number);\n} // This is just a way to differentiate between a really invalid phone\n// number like \"abcde\" and a valid phone number that a user has just\n// started inputting, like \"+1\" or \"1\": both these cases would be\n// considered `NOT_A_NUMBER` by Google's `libphonenumber`, but this\n// library can provide a more detailed error message — whether it's\n// really \"not a number\", or is it just a start of a valid phone number.\n\nexport function isViablePhoneNumberStart(number) {\n return VALID_PHONE_NUMBER_START_REG_EXP.test(number);\n}","import createExtensionPattern from './createExtensionPattern.js'; // Regexp of all known extension prefixes used by different regions followed by\n// 1 or more valid digits, for use when parsing.\n\nvar EXTN_PATTERN = new RegExp('(?:' + createExtensionPattern() + ')$', 'i'); // Strips any extension (as in, the part of the number dialled after the call is\n// connected, usually indicated with extn, ext, x or similar) from the end of\n// the number, and returns it.\n\nexport default function extractExtension(number) {\n var start = number.search(EXTN_PATTERN);\n\n if (start < 0) {\n return {};\n } // If we find a potential extension, and the number preceding this is a viable\n // number, we assume it is an extension.\n\n\n var numberWithoutExtension = number.slice(0, start);\n var matches = number.match(EXTN_PATTERN);\n var i = 1;\n\n while (i < matches.length) {\n if (matches[i]) {\n return {\n number: numberWithoutExtension,\n ext: matches[i]\n };\n }\n\n i++;\n }\n}","function _createForOfIteratorHelperLoose(o, allowArrayLike) {\n var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"];\n if (it) return (it = it.call(o)).next.bind(it);\n\n if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n return function () {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n };\n }\n\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n} // These mappings map a character (key) to a specific digit that should\n// replace it for normalization purposes. Non-European digits that\n// may be used in phone numbers are mapped to a European equivalent.\n//\n// E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`.\n//\n\n\nexport var DIGITS = {\n '0': '0',\n '1': '1',\n '2': '2',\n '3': '3',\n '4': '4',\n '5': '5',\n '6': '6',\n '7': '7',\n '8': '8',\n '9': '9',\n \"\\uFF10\": '0',\n // Fullwidth digit 0\n \"\\uFF11\": '1',\n // Fullwidth digit 1\n \"\\uFF12\": '2',\n // Fullwidth digit 2\n \"\\uFF13\": '3',\n // Fullwidth digit 3\n \"\\uFF14\": '4',\n // Fullwidth digit 4\n \"\\uFF15\": '5',\n // Fullwidth digit 5\n \"\\uFF16\": '6',\n // Fullwidth digit 6\n \"\\uFF17\": '7',\n // Fullwidth digit 7\n \"\\uFF18\": '8',\n // Fullwidth digit 8\n \"\\uFF19\": '9',\n // Fullwidth digit 9\n \"\\u0660\": '0',\n // Arabic-indic digit 0\n \"\\u0661\": '1',\n // Arabic-indic digit 1\n \"\\u0662\": '2',\n // Arabic-indic digit 2\n \"\\u0663\": '3',\n // Arabic-indic digit 3\n \"\\u0664\": '4',\n // Arabic-indic digit 4\n \"\\u0665\": '5',\n // Arabic-indic digit 5\n \"\\u0666\": '6',\n // Arabic-indic digit 6\n \"\\u0667\": '7',\n // Arabic-indic digit 7\n \"\\u0668\": '8',\n // Arabic-indic digit 8\n \"\\u0669\": '9',\n // Arabic-indic digit 9\n \"\\u06F0\": '0',\n // Eastern-Arabic digit 0\n \"\\u06F1\": '1',\n // Eastern-Arabic digit 1\n \"\\u06F2\": '2',\n // Eastern-Arabic digit 2\n \"\\u06F3\": '3',\n // Eastern-Arabic digit 3\n \"\\u06F4\": '4',\n // Eastern-Arabic digit 4\n \"\\u06F5\": '5',\n // Eastern-Arabic digit 5\n \"\\u06F6\": '6',\n // Eastern-Arabic digit 6\n \"\\u06F7\": '7',\n // Eastern-Arabic digit 7\n \"\\u06F8\": '8',\n // Eastern-Arabic digit 8\n \"\\u06F9\": '9' // Eastern-Arabic digit 9\n\n};\nexport function parseDigit(character) {\n return DIGITS[character];\n}\n/**\r\n * Parses phone number digits from a string.\r\n * Drops all punctuation leaving only digits.\r\n * Also converts wide-ascii and arabic-indic numerals to conventional numerals.\r\n * E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`.\r\n * @param {string} string\r\n * @return {string}\r\n * @example\r\n * ```js\r\n * parseDigits('8 (800) 555')\r\n * // Outputs '8800555'.\r\n * ```\r\n */\n\nexport default function parseDigits(string) {\n var result = ''; // Using `.split('')` here instead of normal `for ... of`\n // because the importing application doesn't neccessarily include an ES6 polyfill.\n // The `.split('')` approach discards \"exotic\" UTF-8 characters\n // (the ones consisting of four bytes) but digits\n // (including non-European ones) don't fall into that range\n // so such \"exotic\" characters would be discarded anyway.\n\n for (var _iterator = _createForOfIteratorHelperLoose(string.split('')), _step; !(_step = _iterator()).done;) {\n var character = _step.value;\n var digit = parseDigit(character);\n\n if (digit) {\n result += digit;\n }\n }\n\n return result;\n}","function _createForOfIteratorHelperLoose(o, allowArrayLike) {\n var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"];\n if (it) return (it = it.call(o)).next.bind(it);\n\n if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n return function () {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n };\n }\n\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nimport { parseDigit } from './helpers/parseDigits.js';\n/**\r\n * Parses phone number characters from a string.\r\n * Drops all punctuation leaving only digits and the leading `+` sign (if any).\r\n * Also converts wide-ascii and arabic-indic numerals to conventional numerals.\r\n * E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`.\r\n * @param {string} string\r\n * @return {string}\r\n * @example\r\n * ```js\r\n * // Outputs '8800555'.\r\n * parseIncompletePhoneNumber('8 (800) 555')\r\n * // Outputs '+7800555'.\r\n * parseIncompletePhoneNumber('+7 800 555')\r\n * ```\r\n */\n\nexport default function parseIncompletePhoneNumber(string) {\n var result = ''; // Using `.split('')` here instead of normal `for ... of`\n // because the importing application doesn't neccessarily include an ES6 polyfill.\n // The `.split('')` approach discards \"exotic\" UTF-8 characters\n // (the ones consisting of four bytes) but digits\n // (including non-European ones) don't fall into that range\n // so such \"exotic\" characters would be discarded anyway.\n\n for (var _iterator = _createForOfIteratorHelperLoose(string.split('')), _step; !(_step = _iterator()).done;) {\n var character = _step.value;\n result += parsePhoneNumberCharacter(character, result) || '';\n }\n\n return result;\n}\n/**\r\n * Parses next character while parsing phone number digits (including a `+`)\r\n * from text: discards everything except `+` and digits, and `+` is only allowed\r\n * at the start of a phone number.\r\n * For example, is used in `react-phone-number-input` where it uses\r\n * [`input-format`](https://gitlab.com/catamphetamine/input-format).\r\n * @param {string} character - Yet another character from raw input string.\r\n * @param {string?} prevParsedCharacters - Previous parsed characters.\r\n * @param {object} meta - Optional custom use-case-specific metadata.\r\n * @return {string?} The parsed character.\r\n */\n\nexport function parsePhoneNumberCharacter(character, prevParsedCharacters) {\n // Only allow a leading `+`.\n if (character === '+') {\n // If this `+` is not the first parsed character\n // then discard it.\n if (prevParsedCharacters) {\n return;\n }\n\n return '+';\n } // Allow digits.\n\n\n return parseDigit(character);\n}","function _createForOfIteratorHelperLoose(o, allowArrayLike) {\n var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"];\n if (it) return (it = it.call(o)).next.bind(it);\n\n if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n return function () {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n };\n }\n\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n/**\r\n * Merges two arrays.\r\n * @param {*} a\r\n * @param {*} b\r\n * @return {*}\r\n */\n\n\nexport default function mergeArrays(a, b) {\n var merged = a.slice();\n\n for (var _iterator = _createForOfIteratorHelperLoose(b), _step; !(_step = _iterator()).done;) {\n var element = _step.value;\n\n if (a.indexOf(element) < 0) {\n merged.push(element);\n }\n }\n\n return merged.sort(function (a, b) {\n return a - b;\n }); // ES6 version, requires Set polyfill.\n // let merged = new Set(a)\n // for (const element of b) {\n // \tmerged.add(i)\n // }\n // return Array.from(merged).sort((a, b) => a - b)\n}","import mergeArrays from './mergeArrays.js';\nexport default function checkNumberLength(nationalNumber, metadata) {\n return checkNumberLengthForType(nationalNumber, undefined, metadata);\n} // Checks whether a number is possible for the country based on its length.\n// Should only be called for the \"new\" metadata which has \"possible lengths\".\n\nexport function checkNumberLengthForType(nationalNumber, type, metadata) {\n var type_info = metadata.type(type); // There should always be \"\" set for every type element.\n // This is declared in the XML schema.\n // For size efficiency, where a sub-description (e.g. fixed-line)\n // has the same \"\" as the \"general description\", this is missing,\n // so we fall back to the \"general description\". Where no numbers of the type\n // exist at all, there is one possible length (-1) which is guaranteed\n // not to match the length of any real phone number.\n\n var possible_lengths = type_info && type_info.possibleLengths() || metadata.possibleLengths(); // let local_lengths = type_info && type.possibleLengthsLocal() || metadata.possibleLengthsLocal()\n // Metadata before version `1.0.18` didn't contain `possible_lengths`.\n\n if (!possible_lengths) {\n return 'IS_POSSIBLE';\n }\n\n if (type === 'FIXED_LINE_OR_MOBILE') {\n // No such country in metadata.\n\n /* istanbul ignore next */\n if (!metadata.type('FIXED_LINE')) {\n // The rare case has been encountered where no fixedLine data is available\n // (true for some non-geographic entities), so we just check mobile.\n return checkNumberLengthForType(nationalNumber, 'MOBILE', metadata);\n }\n\n var mobile_type = metadata.type('MOBILE');\n\n if (mobile_type) {\n // Merge the mobile data in if there was any. \"Concat\" creates a new\n // array, it doesn't edit possible_lengths in place, so we don't need a copy.\n // Note that when adding the possible lengths from mobile, we have\n // to again check they aren't empty since if they are this indicates\n // they are the same as the general desc and should be obtained from there.\n possible_lengths = mergeArrays(possible_lengths, mobile_type.possibleLengths()); // The current list is sorted; we need to merge in the new list and\n // re-sort (duplicates are okay). Sorting isn't so expensive because\n // the lists are very small.\n // if (local_lengths) {\n // \tlocal_lengths = mergeArrays(local_lengths, mobile_type.possibleLengthsLocal())\n // } else {\n // \tlocal_lengths = mobile_type.possibleLengthsLocal()\n // }\n }\n } // If the type doesn't exist then return 'INVALID_LENGTH'.\n else if (type && !type_info) {\n return 'INVALID_LENGTH';\n }\n\n var actual_length = nationalNumber.length; // In `libphonenumber-js` all \"local-only\" formats are dropped for simplicity.\n // // This is safe because there is never an overlap beween the possible lengths\n // // and the local-only lengths; this is checked at build time.\n // if (local_lengths && local_lengths.indexOf(nationalNumber.length) >= 0)\n // {\n // \treturn 'IS_POSSIBLE_LOCAL_ONLY'\n // }\n\n var minimum_length = possible_lengths[0];\n\n if (minimum_length === actual_length) {\n return 'IS_POSSIBLE';\n }\n\n if (minimum_length > actual_length) {\n return 'TOO_SHORT';\n }\n\n if (possible_lengths[possible_lengths.length - 1] < actual_length) {\n return 'TOO_LONG';\n } // We skip the first element since we've already checked it.\n\n\n return possible_lengths.indexOf(actual_length, 1) >= 0 ? 'IS_POSSIBLE' : 'INVALID_LENGTH';\n}","import Metadata from './metadata.js';\nimport checkNumberLength from './helpers/checkNumberLength.js';\nexport default function isPossiblePhoneNumber(input, options, metadata) {\n /* istanbul ignore if */\n if (options === undefined) {\n options = {};\n }\n\n metadata = new Metadata(metadata);\n\n if (options.v2) {\n if (!input.countryCallingCode) {\n throw new Error('Invalid phone number object passed');\n }\n\n metadata.selectNumberingPlan(input.countryCallingCode);\n } else {\n if (!input.phone) {\n return false;\n }\n\n if (input.country) {\n if (!metadata.hasCountry(input.country)) {\n throw new Error(\"Unknown country: \".concat(input.country));\n }\n\n metadata.country(input.country);\n } else {\n if (!input.countryCallingCode) {\n throw new Error('Invalid phone number object passed');\n }\n\n metadata.selectNumberingPlan(input.countryCallingCode);\n }\n } // Old metadata (< 1.0.18) had no \"possible length\" data.\n\n\n if (metadata.possibleLengths()) {\n return isPossibleNumber(input.phone || input.nationalNumber, metadata);\n } else {\n // There was a bug between `1.7.35` and `1.7.37` where \"possible_lengths\"\n // were missing for \"non-geographical\" numbering plans.\n // Just assume the number is possible in such cases:\n // it's unlikely that anyone generated their custom metadata\n // in that short period of time (one day).\n // This code can be removed in some future major version update.\n if (input.countryCallingCode && metadata.isNonGeographicCallingCode(input.countryCallingCode)) {\n // \"Non-geographic entities\" did't have `possibleLengths`\n // due to a bug in metadata generation process.\n return true;\n } else {\n throw new Error('Missing \"possibleLengths\" in metadata. Perhaps the metadata has been generated before v1.0.18.');\n }\n }\n}\nexport function isPossibleNumber(nationalNumber, metadata) {\n //, isInternational) {\n switch (checkNumberLength(nationalNumber, metadata)) {\n case 'IS_POSSIBLE':\n return true;\n // This library ignores \"local-only\" phone numbers (for simplicity).\n // See the readme for more info on what are \"local-only\" phone numbers.\n // case 'IS_POSSIBLE_LOCAL_ONLY':\n // \treturn !isInternational\n\n default:\n return false;\n }\n}","function _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();\n}\n\nfunction _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction _iterableToArrayLimit(arr, i) {\n var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"];\n\n if (_i == null) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n\n var _s, _e;\n\n try {\n for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nfunction _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nfunction _createForOfIteratorHelperLoose(o, allowArrayLike) {\n var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"];\n if (it) return (it = it.call(o)).next.bind(it);\n\n if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n return function () {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n };\n }\n\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nimport isViablePhoneNumber from './isViablePhoneNumber.js'; // https://www.ietf.org/rfc/rfc3966.txt\n\n/**\r\n * @param {string} text - Phone URI (RFC 3966).\r\n * @return {object} `{ ?number, ?ext }`.\r\n */\n\nexport function parseRFC3966(text) {\n var number;\n var ext; // Replace \"tel:\" with \"tel=\" for parsing convenience.\n\n text = text.replace(/^tel:/, 'tel=');\n\n for (var _iterator = _createForOfIteratorHelperLoose(text.split(';')), _step; !(_step = _iterator()).done;) {\n var part = _step.value;\n\n var _part$split = part.split('='),\n _part$split2 = _slicedToArray(_part$split, 2),\n name = _part$split2[0],\n value = _part$split2[1];\n\n switch (name) {\n case 'tel':\n number = value;\n break;\n\n case 'ext':\n ext = value;\n break;\n\n case 'phone-context':\n // Only \"country contexts\" are supported.\n // \"Domain contexts\" are ignored.\n if (value[0] === '+') {\n number = value + number;\n }\n\n break;\n }\n } // If the phone number is not viable, then abort.\n\n\n if (!isViablePhoneNumber(number)) {\n return {};\n }\n\n var result = {\n number: number\n };\n\n if (ext) {\n result.ext = ext;\n }\n\n return result;\n}\n/**\r\n * @param {object} - `{ ?number, ?extension }`.\r\n * @return {string} Phone URI (RFC 3966).\r\n */\n\nexport function formatRFC3966(_ref) {\n var number = _ref.number,\n ext = _ref.ext;\n\n if (!number) {\n return '';\n }\n\n if (number[0] !== '+') {\n throw new Error(\"\\\"formatRFC3966()\\\" expects \\\"number\\\" to be in E.164 format.\");\n }\n\n return \"tel:\".concat(number).concat(ext ? ';ext=' + ext : '');\n}","/**\r\n * Checks whether the entire input sequence can be matched\r\n * against the regular expression.\r\n * @return {boolean}\r\n */\nexport default function matchesEntirely(text, regular_expression) {\n // If assigning the `''` default value is moved to the arguments above,\n // code coverage would decrease for some weird reason.\n text = text || '';\n return new RegExp('^(?:' + regular_expression + ')$').test(text);\n}","function _createForOfIteratorHelperLoose(o, allowArrayLike) {\n var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"];\n if (it) return (it = it.call(o)).next.bind(it);\n\n if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n return function () {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n };\n }\n\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nimport Metadata from '../metadata.js';\nimport matchesEntirely from './matchesEntirely.js';\nvar NON_FIXED_LINE_PHONE_TYPES = ['MOBILE', 'PREMIUM_RATE', 'TOLL_FREE', 'SHARED_COST', 'VOIP', 'PERSONAL_NUMBER', 'PAGER', 'UAN', 'VOICEMAIL']; // Finds out national phone number type (fixed line, mobile, etc)\n\nexport default function getNumberType(input, options, metadata) {\n // If assigning the `{}` default value is moved to the arguments above,\n // code coverage would decrease for some weird reason.\n options = options || {}; // When `parse()` returned `{}`\n // meaning that the phone number is not a valid one.\n\n if (!input.country) {\n return;\n }\n\n metadata = new Metadata(metadata);\n metadata.selectNumberingPlan(input.country, input.countryCallingCode);\n var nationalNumber = options.v2 ? input.nationalNumber : input.phone; // The following is copy-pasted from the original function:\n // https://github.com/googlei18n/libphonenumber/blob/3ea547d4fbaa2d0b67588904dfa5d3f2557c27ff/javascript/i18n/phonenumbers/phonenumberutil.js#L2835\n // Is this national number even valid for this country\n\n if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern())) {\n return;\n } // Is it fixed line number\n\n\n if (isNumberTypeEqualTo(nationalNumber, 'FIXED_LINE', metadata)) {\n // Because duplicate regular expressions are removed\n // to reduce metadata size, if \"mobile\" pattern is \"\"\n // then it means it was removed due to being a duplicate of the fixed-line pattern.\n //\n if (metadata.type('MOBILE') && metadata.type('MOBILE').pattern() === '') {\n return 'FIXED_LINE_OR_MOBILE';\n } // `MOBILE` type pattern isn't included if it matched `FIXED_LINE` one.\n // For example, for \"US\" country.\n // Old metadata (< `1.0.18`) had a specific \"types\" data structure\n // that happened to be `undefined` for `MOBILE` in that case.\n // Newer metadata (>= `1.0.18`) has another data structure that is\n // not `undefined` for `MOBILE` in that case (it's just an empty array).\n // So this `if` is just for backwards compatibility with old metadata.\n\n\n if (!metadata.type('MOBILE')) {\n return 'FIXED_LINE_OR_MOBILE';\n } // Check if the number happens to qualify as both fixed line and mobile.\n // (no such country in the minimal metadata set)\n\n /* istanbul ignore if */\n\n\n if (isNumberTypeEqualTo(nationalNumber, 'MOBILE', metadata)) {\n return 'FIXED_LINE_OR_MOBILE';\n }\n\n return 'FIXED_LINE';\n }\n\n for (var _iterator = _createForOfIteratorHelperLoose(NON_FIXED_LINE_PHONE_TYPES), _step; !(_step = _iterator()).done;) {\n var type = _step.value;\n\n if (isNumberTypeEqualTo(nationalNumber, type, metadata)) {\n return type;\n }\n }\n}\nexport function isNumberTypeEqualTo(nationalNumber, type, metadata) {\n type = metadata.type(type);\n\n if (!type || !type.pattern()) {\n return false;\n } // Check if any possible number lengths are present;\n // if so, we use them to avoid checking\n // the validation pattern if they don't match.\n // If they are absent, this means they match\n // the general description, which we have\n // already checked before a specific number type.\n\n\n if (type.possibleLengths() && type.possibleLengths().indexOf(nationalNumber.length) < 0) {\n return false;\n }\n\n return matchesEntirely(nationalNumber, type.pattern());\n}","import { VALID_PUNCTUATION } from '../constants.js'; // Removes brackets and replaces dashes with spaces.\n//\n// E.g. \"(999) 111-22-33\" -> \"999 111 22 33\"\n//\n// For some reason Google's metadata contains ``s with brackets and dashes.\n// Meanwhile, there's no single opinion about using punctuation in international phone numbers.\n//\n// For example, Google's `` for USA is `+1 213-373-4253`.\n// And here's a quote from WikiPedia's \"North American Numbering Plan\" page:\n// https://en.wikipedia.org/wiki/North_American_Numbering_Plan\n//\n// \"The country calling code for all countries participating in the NANP is 1.\n// In international format, an NANP number should be listed as +1 301 555 01 00,\n// where 301 is an area code (Maryland).\"\n//\n// I personally prefer the international format without any punctuation.\n// For example, brackets are remnants of the old age, meaning that the\n// phone number part in brackets (so called \"area code\") can be omitted\n// if dialing within the same \"area\".\n// And hyphens were clearly introduced for splitting local numbers into memorizable groups.\n// For example, remembering \"5553535\" is difficult but \"555-35-35\" is much simpler.\n// Imagine a man taking a bus from home to work and seeing an ad with a phone number.\n// He has a couple of seconds to memorize that number until it passes by.\n// If it were spaces instead of hyphens the man wouldn't necessarily get it,\n// but with hyphens instead of spaces the grouping is more explicit.\n// I personally think that hyphens introduce visual clutter,\n// so I prefer replacing them with spaces in international numbers.\n// In the modern age all output is done on displays where spaces are clearly distinguishable\n// so hyphens can be safely replaced with spaces without losing any legibility.\n//\n\nexport default function applyInternationalSeparatorStyle(formattedNumber) {\n return formattedNumber.replace(new RegExp(\"[\".concat(VALID_PUNCTUATION, \"]+\"), 'g'), ' ').trim();\n}","import applyInternationalSeparatorStyle from './applyInternationalSeparatorStyle.js'; // This was originally set to $1 but there are some countries for which the\n// first group is not used in the national pattern (e.g. Argentina) so the $1\n// group does not match correctly. Therefore, we use `\\d`, so that the first\n// group actually used in the pattern will be matched.\n\nexport var FIRST_GROUP_PATTERN = /(\\$\\d)/;\nexport default function formatNationalNumberUsingFormat(number, format, _ref) {\n var useInternationalFormat = _ref.useInternationalFormat,\n withNationalPrefix = _ref.withNationalPrefix,\n carrierCode = _ref.carrierCode,\n metadata = _ref.metadata;\n var formattedNumber = number.replace(new RegExp(format.pattern()), useInternationalFormat ? format.internationalFormat() : // This library doesn't use `domestic_carrier_code_formatting_rule`,\n // because that one is only used when formatting phone numbers\n // for dialing from a mobile phone, and this is not a dialing library.\n // carrierCode && format.domesticCarrierCodeFormattingRule()\n // \t// First, replace the $CC in the formatting rule with the desired carrier code.\n // \t// Then, replace the $FG in the formatting rule with the first group\n // \t// and the carrier code combined in the appropriate way.\n // \t? format.format().replace(FIRST_GROUP_PATTERN, format.domesticCarrierCodeFormattingRule().replace('$CC', carrierCode))\n // \t: (\n // \t\twithNationalPrefix && format.nationalPrefixFormattingRule()\n // \t\t\t? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule())\n // \t\t\t: format.format()\n // \t)\n withNationalPrefix && format.nationalPrefixFormattingRule() ? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule()) : format.format());\n\n if (useInternationalFormat) {\n return applyInternationalSeparatorStyle(formattedNumber);\n }\n\n return formattedNumber;\n}","import Metadata from '../metadata.js';\n/**\r\n * Pattern that makes it easy to distinguish whether a region has a single\r\n * international dialing prefix or not. If a region has a single international\r\n * prefix (e.g. 011 in USA), it will be represented as a string that contains\r\n * a sequence of ASCII digits, and possibly a tilde, which signals waiting for\r\n * the tone. If there are multiple available international prefixes in a\r\n * region, they will be represented as a regex string that always contains one\r\n * or more characters that are not ASCII digits or a tilde.\r\n */\n\nvar SINGLE_IDD_PREFIX_REG_EXP = /^[\\d]+(?:[~\\u2053\\u223C\\uFF5E][\\d]+)?$/; // For regions that have multiple IDD prefixes\n// a preferred IDD prefix is returned.\n\nexport default function getIddPrefix(country, callingCode, metadata) {\n var countryMetadata = new Metadata(metadata);\n countryMetadata.selectNumberingPlan(country, callingCode);\n\n if (countryMetadata.defaultIDDPrefix()) {\n return countryMetadata.defaultIDDPrefix();\n }\n\n if (SINGLE_IDD_PREFIX_REG_EXP.test(countryMetadata.IDDPrefix())) {\n return countryMetadata.IDDPrefix();\n }\n}","function _createForOfIteratorHelperLoose(o, allowArrayLike) {\n var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"];\n if (it) return (it = it.call(o)).next.bind(it);\n\n if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n return function () {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n };\n }\n\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n enumerableOnly && (symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n })), keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = null != arguments[i] ? arguments[i] : {};\n i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n\n return target;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n} // This is a port of Google Android `libphonenumber`'s\n// `phonenumberutil.js` of December 31th, 2018.\n//\n// https://github.com/googlei18n/libphonenumber/commits/master/javascript/i18n/phonenumbers/phonenumberutil.js\n\n\nimport matchesEntirely from './helpers/matchesEntirely.js';\nimport formatNationalNumberUsingFormat from './helpers/formatNationalNumberUsingFormat.js';\nimport Metadata, { getCountryCallingCode } from './metadata.js';\nimport getIddPrefix from './helpers/getIddPrefix.js';\nimport { formatRFC3966 } from './helpers/RFC3966.js';\nvar DEFAULT_OPTIONS = {\n formatExtension: function formatExtension(formattedNumber, extension, metadata) {\n return \"\".concat(formattedNumber).concat(metadata.ext()).concat(extension);\n }\n}; // Formats a phone number\n//\n// Example use cases:\n//\n// ```js\n// formatNumber('8005553535', 'RU', 'INTERNATIONAL')\n// formatNumber('8005553535', 'RU', 'INTERNATIONAL', metadata)\n// formatNumber({ phone: '8005553535', country: 'RU' }, 'INTERNATIONAL')\n// formatNumber({ phone: '8005553535', country: 'RU' }, 'INTERNATIONAL', metadata)\n// formatNumber('+78005553535', 'NATIONAL')\n// formatNumber('+78005553535', 'NATIONAL', metadata)\n// ```\n//\n\nexport default function formatNumber(input, format, options, metadata) {\n // Apply default options.\n if (options) {\n options = _objectSpread(_objectSpread({}, DEFAULT_OPTIONS), options);\n } else {\n options = DEFAULT_OPTIONS;\n }\n\n metadata = new Metadata(metadata);\n\n if (input.country && input.country !== '001') {\n // Validate `input.country`.\n if (!metadata.hasCountry(input.country)) {\n throw new Error(\"Unknown country: \".concat(input.country));\n }\n\n metadata.country(input.country);\n } else if (input.countryCallingCode) {\n metadata.selectNumberingPlan(input.countryCallingCode);\n } else return input.phone || '';\n\n var countryCallingCode = metadata.countryCallingCode();\n var nationalNumber = options.v2 ? input.nationalNumber : input.phone; // This variable should have been declared inside `case`s\n // but Babel has a bug and it says \"duplicate variable declaration\".\n\n var number;\n\n switch (format) {\n case 'NATIONAL':\n // Legacy argument support.\n // (`{ country: ..., phone: '' }`)\n if (!nationalNumber) {\n return '';\n }\n\n number = formatNationalNumber(nationalNumber, input.carrierCode, 'NATIONAL', metadata, options);\n return addExtension(number, input.ext, metadata, options.formatExtension);\n\n case 'INTERNATIONAL':\n // Legacy argument support.\n // (`{ country: ..., phone: '' }`)\n if (!nationalNumber) {\n return \"+\".concat(countryCallingCode);\n }\n\n number = formatNationalNumber(nationalNumber, null, 'INTERNATIONAL', metadata, options);\n number = \"+\".concat(countryCallingCode, \" \").concat(number);\n return addExtension(number, input.ext, metadata, options.formatExtension);\n\n case 'E.164':\n // `E.164` doesn't define \"phone number extensions\".\n return \"+\".concat(countryCallingCode).concat(nationalNumber);\n\n case 'RFC3966':\n return formatRFC3966({\n number: \"+\".concat(countryCallingCode).concat(nationalNumber),\n ext: input.ext\n });\n // For reference, here's Google's IDD formatter:\n // https://github.com/google/libphonenumber/blob/32719cf74e68796788d1ca45abc85dcdc63ba5b9/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L1546\n // Not saying that this IDD formatter replicates it 1:1, but it seems to work.\n // Who would even need to format phone numbers in IDD format anyway?\n\n case 'IDD':\n if (!options.fromCountry) {\n return; // throw new Error('`fromCountry` option not passed for IDD-prefixed formatting.')\n }\n\n var formattedNumber = formatIDD(nationalNumber, input.carrierCode, countryCallingCode, options.fromCountry, metadata);\n return addExtension(formattedNumber, input.ext, metadata, options.formatExtension);\n\n default:\n throw new Error(\"Unknown \\\"format\\\" argument passed to \\\"formatNumber()\\\": \\\"\".concat(format, \"\\\"\"));\n }\n}\n\nfunction formatNationalNumber(number, carrierCode, formatAs, metadata, options) {\n var format = chooseFormatForNumber(metadata.formats(), number);\n\n if (!format) {\n return number;\n }\n\n return formatNationalNumberUsingFormat(number, format, {\n useInternationalFormat: formatAs === 'INTERNATIONAL',\n withNationalPrefix: format.nationalPrefixIsOptionalWhenFormattingInNationalFormat() && options && options.nationalPrefix === false ? false : true,\n carrierCode: carrierCode,\n metadata: metadata\n });\n}\n\nfunction chooseFormatForNumber(availableFormats, nationalNnumber) {\n for (var _iterator = _createForOfIteratorHelperLoose(availableFormats), _step; !(_step = _iterator()).done;) {\n var format = _step.value; // Validate leading digits.\n // The test case for \"else path\" could be found by searching for\n // \"format.leadingDigitsPatterns().length === 0\".\n\n if (format.leadingDigitsPatterns().length > 0) {\n // The last leading_digits_pattern is used here, as it is the most detailed\n var lastLeadingDigitsPattern = format.leadingDigitsPatterns()[format.leadingDigitsPatterns().length - 1]; // If leading digits don't match then move on to the next phone number format\n\n if (nationalNnumber.search(lastLeadingDigitsPattern) !== 0) {\n continue;\n }\n } // Check that the national number matches the phone number format regular expression\n\n\n if (matchesEntirely(nationalNnumber, format.pattern())) {\n return format;\n }\n }\n}\n\nfunction addExtension(formattedNumber, ext, metadata, formatExtension) {\n return ext ? formatExtension(formattedNumber, ext, metadata) : formattedNumber;\n}\n\nfunction formatIDD(nationalNumber, carrierCode, countryCallingCode, fromCountry, metadata) {\n var fromCountryCallingCode = getCountryCallingCode(fromCountry, metadata.metadata); // When calling within the same country calling code.\n\n if (fromCountryCallingCode === countryCallingCode) {\n var formattedNumber = formatNationalNumber(nationalNumber, carrierCode, 'NATIONAL', metadata); // For NANPA regions, return the national format for these regions\n // but prefix it with the country calling code.\n\n if (countryCallingCode === '1') {\n return countryCallingCode + ' ' + formattedNumber;\n } // If regions share a country calling code, the country calling code need\n // not be dialled. This also applies when dialling within a region, so this\n // if clause covers both these cases. Technically this is the case for\n // dialling from La Reunion to other overseas departments of France (French\n // Guiana, Martinique, Guadeloupe), but not vice versa - so we don't cover\n // this edge case for now and for those cases return the version including\n // country calling code. Details here:\n // http://www.petitfute.com/voyage/225-info-pratiques-reunion\n //\n\n\n return formattedNumber;\n }\n\n var iddPrefix = getIddPrefix(fromCountry, undefined, metadata.metadata);\n\n if (iddPrefix) {\n return \"\".concat(iddPrefix, \" \").concat(countryCallingCode, \" \").concat(formatNationalNumber(nationalNumber, null, 'INTERNATIONAL', metadata));\n }\n}","function ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n enumerableOnly && (symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n })), keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = null != arguments[i] ? arguments[i] : {};\n i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n\n return target;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}\n\nimport Metadata from './metadata.js';\nimport isPossibleNumber from './isPossibleNumber_.js';\nimport isValidNumber from './validate_.js';\nimport isValidNumberForRegion from './isValidNumberForRegion_.js';\nimport getNumberType from './helpers/getNumberType.js';\nimport formatNumber from './format_.js';\nvar USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;\n\nvar PhoneNumber = /*#__PURE__*/function () {\n function PhoneNumber(countryCallingCode, nationalNumber, metadata) {\n _classCallCheck(this, PhoneNumber);\n\n if (!countryCallingCode) {\n throw new TypeError('`country` or `countryCallingCode` not passed');\n }\n\n if (!nationalNumber) {\n throw new TypeError('`nationalNumber` not passed');\n }\n\n if (!metadata) {\n throw new TypeError('`metadata` not passed');\n }\n\n var _metadata = new Metadata(metadata); // If country code is passed then derive `countryCallingCode` from it.\n // Also store the country code as `.country`.\n\n\n if (isCountryCode(countryCallingCode)) {\n this.country = countryCallingCode;\n\n _metadata.country(countryCallingCode);\n\n countryCallingCode = _metadata.countryCallingCode();\n } else {\n /* istanbul ignore if */\n if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\n if (_metadata.isNonGeographicCallingCode(countryCallingCode)) {\n this.country = '001';\n }\n }\n }\n\n this.countryCallingCode = countryCallingCode;\n this.nationalNumber = nationalNumber;\n this.number = '+' + this.countryCallingCode + this.nationalNumber;\n this.metadata = metadata;\n }\n\n _createClass(PhoneNumber, [{\n key: \"setExt\",\n value: function setExt(ext) {\n this.ext = ext;\n }\n }, {\n key: \"isPossible\",\n value: function isPossible() {\n return isPossibleNumber(this, {\n v2: true\n }, this.metadata);\n }\n }, {\n key: \"isValid\",\n value: function isValid() {\n return isValidNumber(this, {\n v2: true\n }, this.metadata);\n }\n }, {\n key: \"isNonGeographic\",\n value: function isNonGeographic() {\n var metadata = new Metadata(this.metadata);\n return metadata.isNonGeographicCallingCode(this.countryCallingCode);\n }\n }, {\n key: \"isEqual\",\n value: function isEqual(phoneNumber) {\n return this.number === phoneNumber.number && this.ext === phoneNumber.ext;\n } // // Is just an alias for `this.isValid() && this.country === country`.\n // // https://github.com/googlei18n/libphonenumber/blob/master/FAQ.md#when-should-i-use-isvalidnumberforregion\n // isValidForRegion(country) {\n // \treturn isValidNumberForRegion(this, country, { v2: true }, this.metadata)\n // }\n\n }, {\n key: \"getType\",\n value: function getType() {\n return getNumberType(this, {\n v2: true\n }, this.metadata);\n }\n }, {\n key: \"format\",\n value: function format(_format, options) {\n return formatNumber(this, _format, options ? _objectSpread(_objectSpread({}, options), {}, {\n v2: true\n }) : {\n v2: true\n }, this.metadata);\n }\n }, {\n key: \"formatNational\",\n value: function formatNational(options) {\n return this.format('NATIONAL', options);\n }\n }, {\n key: \"formatInternational\",\n value: function formatInternational(options) {\n return this.format('INTERNATIONAL', options);\n }\n }, {\n key: \"getURI\",\n value: function getURI(options) {\n return this.format('RFC3966', options);\n }\n }]);\n\n return PhoneNumber;\n}();\n\nexport { PhoneNumber as default };\n\nvar isCountryCode = function isCountryCode(value) {\n return /^[A-Z]{2}$/.test(value);\n};","import Metadata from './metadata.js';\nimport matchesEntirely from './helpers/matchesEntirely.js';\nimport getNumberType from './helpers/getNumberType.js';\n/**\r\n * Checks if a given phone number is valid.\r\n *\r\n * If the `number` is a string, it will be parsed to an object,\r\n * but only if it contains only valid phone number characters (including punctuation).\r\n * If the `number` is an object, it is used as is.\r\n *\r\n * The optional `defaultCountry` argument is the default country.\r\n * I.e. it does not restrict to just that country,\r\n * e.g. in those cases where several countries share\r\n * the same phone numbering rules (NANPA, Britain, etc).\r\n * For example, even though the number `07624 369230`\r\n * belongs to the Isle of Man (\"IM\" country code)\r\n * calling `isValidNumber('07624369230', 'GB', metadata)`\r\n * still returns `true` because the country is not restricted to `GB`,\r\n * it's just that `GB` is the default one for the phone numbering rules.\r\n * For restricting the country see `isValidNumberForRegion()`\r\n * though restricting a country might not be a good idea.\r\n * https://github.com/googlei18n/libphonenumber/blob/master/FAQ.md#when-should-i-use-isvalidnumberforregion\r\n *\r\n * Examples:\r\n *\r\n * ```js\r\n * isValidNumber('+78005553535', metadata)\r\n * isValidNumber('8005553535', 'RU', metadata)\r\n * isValidNumber('88005553535', 'RU', metadata)\r\n * isValidNumber({ phone: '8005553535', country: 'RU' }, metadata)\r\n * ```\r\n */\n\nexport default function isValidNumber(input, options, metadata) {\n // If assigning the `{}` default value is moved to the arguments above,\n // code coverage would decrease for some weird reason.\n options = options || {};\n metadata = new Metadata(metadata); // This is just to support `isValidNumber({})`\n // for cases when `parseNumber()` returns `{}`.\n\n if (!input.country) {\n return false;\n }\n\n metadata.selectNumberingPlan(input.country, input.countryCallingCode); // By default, countries only have type regexps when it's required for\n // distinguishing different countries having the same `countryCallingCode`.\n\n if (metadata.hasTypes()) {\n return getNumberType(input, options, metadata.metadata) !== undefined;\n } // If there are no type regexps for this country in metadata then use\n // `nationalNumberPattern` as a \"better than nothing\" replacement.\n\n\n var national_number = options.v2 ? input.nationalNumber : input.phone;\n return matchesEntirely(national_number, metadata.nationalNumberPattern());\n}","import Metadata from '../metadata.js';\nimport { VALID_DIGITS } from '../constants.js';\nvar CAPTURING_DIGIT_PATTERN = new RegExp('([' + VALID_DIGITS + '])');\nexport default function stripIddPrefix(number, country, callingCode, metadata) {\n if (!country) {\n return;\n } // Check if the number is IDD-prefixed.\n\n\n var countryMetadata = new Metadata(metadata);\n countryMetadata.selectNumberingPlan(country, callingCode);\n var IDDPrefixPattern = new RegExp(countryMetadata.IDDPrefix());\n\n if (number.search(IDDPrefixPattern) !== 0) {\n return;\n } // Strip IDD prefix.\n\n\n number = number.slice(number.match(IDDPrefixPattern)[0].length); // If there're any digits after an IDD prefix,\n // then those digits are a country calling code.\n // Since no country code starts with a `0`,\n // the code below validates that the next digit (if present) is not `0`.\n\n var matchedGroups = number.match(CAPTURING_DIGIT_PATTERN);\n\n if (matchedGroups && matchedGroups[1] != null && matchedGroups[1].length > 0) {\n if (matchedGroups[1] === '0') {\n return;\n }\n }\n\n return number;\n}","/**\r\n * Strips any national prefix (such as 0, 1) present in a\r\n * (possibly incomplete) number provided.\r\n * \"Carrier codes\" are only used in Colombia and Brazil,\r\n * and only when dialing within those countries from a mobile phone to a fixed line number.\r\n * Sometimes it won't actually strip national prefix\r\n * and will instead prepend some digits to the `number`:\r\n * for example, when number `2345678` is passed with `VI` country selected,\r\n * it will return `{ number: \"3402345678\" }`, because `340` area code is prepended.\r\n * @param {string} number — National number digits.\r\n * @param {object} metadata — Metadata with country selected.\r\n * @return {object} `{ nationalNumber: string, nationalPrefix: string? carrierCode: string? }`. Even if a national prefix was extracted, it's not necessarily present in the returned object, so don't rely on its presence in the returned object in order to find out whether a national prefix has been extracted or not.\r\n */\nexport default function extractNationalNumberFromPossiblyIncompleteNumber(number, metadata) {\n if (number && metadata.numberingPlan.nationalPrefixForParsing()) {\n // See METADATA.md for the description of\n // `national_prefix_for_parsing` and `national_prefix_transform_rule`.\n // Attempt to parse the first digits as a national prefix.\n var prefixPattern = new RegExp('^(?:' + metadata.numberingPlan.nationalPrefixForParsing() + ')');\n var prefixMatch = prefixPattern.exec(number);\n\n if (prefixMatch) {\n var nationalNumber;\n var carrierCode; // https://gitlab.com/catamphetamine/libphonenumber-js/-/blob/master/METADATA.md#national_prefix_for_parsing--national_prefix_transform_rule\n // If a `national_prefix_for_parsing` has any \"capturing groups\"\n // then it means that the national (significant) number is equal to\n // those \"capturing groups\" transformed via `national_prefix_transform_rule`,\n // and nothing could be said about the actual national prefix:\n // what is it and was it even there.\n // If a `national_prefix_for_parsing` doesn't have any \"capturing groups\",\n // then everything it matches is a national prefix.\n // To determine whether `national_prefix_for_parsing` matched any\n // \"capturing groups\", the value of the result of calling `.exec()`\n // is looked at, and if it has non-undefined values where there're\n // \"capturing groups\" in the regular expression, then it means\n // that \"capturing groups\" have been matched.\n // It's not possible to tell whether there'll be any \"capturing gropus\"\n // before the matching process, because a `national_prefix_for_parsing`\n // could exhibit both behaviors.\n\n var capturedGroupsCount = prefixMatch.length - 1;\n var hasCapturedGroups = capturedGroupsCount > 0 && prefixMatch[capturedGroupsCount];\n\n if (metadata.nationalPrefixTransformRule() && hasCapturedGroups) {\n nationalNumber = number.replace(prefixPattern, metadata.nationalPrefixTransformRule()); // If there's more than one captured group,\n // then carrier code is the second one.\n\n if (capturedGroupsCount > 1) {\n carrierCode = prefixMatch[1];\n }\n } // If there're no \"capturing groups\",\n // or if there're \"capturing groups\" but no\n // `national_prefix_transform_rule`,\n // then just strip the national prefix from the number,\n // and possibly a carrier code.\n // Seems like there could be more.\n else {\n // `prefixBeforeNationalNumber` is the whole substring matched by\n // the `national_prefix_for_parsing` regular expression.\n // There seem to be no guarantees that it's just a national prefix.\n // For example, if there's a carrier code, it's gonna be a\n // part of `prefixBeforeNationalNumber` too.\n var prefixBeforeNationalNumber = prefixMatch[0];\n nationalNumber = number.slice(prefixBeforeNationalNumber.length); // If there's at least one captured group,\n // then carrier code is the first one.\n\n if (hasCapturedGroups) {\n carrierCode = prefixMatch[1];\n }\n } // Tries to guess whether a national prefix was present in the input.\n // This is not something copy-pasted from Google's library:\n // they don't seem to have an equivalent for that.\n // So this isn't an \"officially approved\" way of doing something like that.\n // But since there seems no other existing method, this library uses it.\n\n\n var nationalPrefix;\n\n if (hasCapturedGroups) {\n var possiblePositionOfTheFirstCapturedGroup = number.indexOf(prefixMatch[1]);\n var possibleNationalPrefix = number.slice(0, possiblePositionOfTheFirstCapturedGroup); // Example: an Argentinian (AR) phone number `0111523456789`.\n // `prefixMatch[0]` is `01115`, and `$1` is `11`,\n // and the rest of the phone number is `23456789`.\n // The national number is transformed via `9$1` to `91123456789`.\n // National prefix `0` is detected being present at the start.\n // if (possibleNationalPrefix.indexOf(metadata.numberingPlan.nationalPrefix()) === 0) {\n\n if (possibleNationalPrefix === metadata.numberingPlan.nationalPrefix()) {\n nationalPrefix = metadata.numberingPlan.nationalPrefix();\n }\n } else {\n nationalPrefix = prefixMatch[0];\n }\n\n return {\n nationalNumber: nationalNumber,\n nationalPrefix: nationalPrefix,\n carrierCode: carrierCode\n };\n }\n }\n\n return {\n nationalNumber: number\n };\n}","import extractNationalNumberFromPossiblyIncompleteNumber from './extractNationalNumberFromPossiblyIncompleteNumber.js';\nimport matchesEntirely from './matchesEntirely.js';\nimport checkNumberLength from './checkNumberLength.js';\n/**\r\n * Strips national prefix and carrier code from a complete phone number.\r\n * The difference from the non-\"FromCompleteNumber\" function is that\r\n * it won't extract national prefix if the resultant number is too short\r\n * to be a complete number for the selected phone numbering plan.\r\n * @param {string} number — Complete phone number digits.\r\n * @param {Metadata} metadata — Metadata with a phone numbering plan selected.\r\n * @return {object} `{ nationalNumber: string, carrierCode: string? }`.\r\n */\n\nexport default function extractNationalNumber(number, metadata) {\n // Parsing national prefixes and carrier codes\n // is only required for local phone numbers\n // but some people don't understand that\n // and sometimes write international phone numbers\n // with national prefixes (or maybe even carrier codes).\n // http://ucken.blogspot.ru/2016/03/trunk-prefixes-in-skype4b.html\n // Google's original library forgives such mistakes\n // and so does this library, because it has been requested:\n // https://github.com/catamphetamine/libphonenumber-js/issues/127\n var _extractNationalNumbe = extractNationalNumberFromPossiblyIncompleteNumber(number, metadata),\n carrierCode = _extractNationalNumbe.carrierCode,\n nationalNumber = _extractNationalNumbe.nationalNumber;\n\n if (nationalNumber !== number) {\n if (!shouldHaveExtractedNationalPrefix(number, nationalNumber, metadata)) {\n // Don't strip the national prefix.\n return {\n nationalNumber: number\n };\n } // Check the national (significant) number length after extracting national prefix and carrier code.\n // Legacy generated metadata (before `1.0.18`) didn't support the \"possible lengths\" feature.\n\n\n if (metadata.possibleLengths()) {\n // The number remaining after stripping the national prefix and carrier code\n // should be long enough to have a possible length for the country.\n // Otherwise, don't strip the national prefix and carrier code,\n // since the original number could be a valid number.\n // This check has been copy-pasted \"as is\" from Google's original library:\n // https://github.com/google/libphonenumber/blob/876268eb1ad6cdc1b7b5bef17fc5e43052702d57/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L3236-L3250\n // It doesn't check for the \"possibility\" of the original `number`.\n // I guess it's fine not checking that one. It works as is anyway.\n if (!isPossibleIncompleteNationalNumber(nationalNumber, metadata)) {\n // Don't strip the national prefix.\n return {\n nationalNumber: number\n };\n }\n }\n }\n\n return {\n nationalNumber: nationalNumber,\n carrierCode: carrierCode\n };\n} // In some countries, the same digit could be a national prefix\n// or a leading digit of a valid phone number.\n// For example, in Russia, national prefix is `8`,\n// and also `800 555 35 35` is a valid number\n// in which `8` is not a national prefix, but the first digit\n// of a national (significant) number.\n// Same's with Belarus:\n// `82004910060` is a valid national (significant) number,\n// but `2004910060` is not.\n// To support such cases (to prevent the code from always stripping\n// national prefix), a condition is imposed: a national prefix\n// is not extracted when the original number is \"viable\" and the\n// resultant number is not, a \"viable\" national number being the one\n// that matches `national_number_pattern`.\n\nfunction shouldHaveExtractedNationalPrefix(nationalNumberBefore, nationalNumberAfter, metadata) {\n // The equivalent in Google's code is:\n // https://github.com/google/libphonenumber/blob/e326fa1fc4283bb05eb35cb3c15c18f98a31af33/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L2969-L3004\n if (matchesEntirely(nationalNumberBefore, metadata.nationalNumberPattern()) && !matchesEntirely(nationalNumberAfter, metadata.nationalNumberPattern())) {\n return false;\n } // This \"is possible\" national number (length) check has been commented out\n // because it's superceded by the (effectively) same check done in the\n // `extractNationalNumber()` function after it calls `shouldHaveExtractedNationalPrefix()`.\n // In other words, why run the same check twice if it could only be run once.\n // // Check the national (significant) number length after extracting national prefix and carrier code.\n // // Fixes a minor \"weird behavior\" bug: https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/57\n // // (Legacy generated metadata (before `1.0.18`) didn't support the \"possible lengths\" feature).\n // if (metadata.possibleLengths()) {\n // \tif (isPossibleIncompleteNationalNumber(nationalNumberBefore, metadata) &&\n // \t\t!isPossibleIncompleteNationalNumber(nationalNumberAfter, metadata)) {\n // \t\treturn false\n // \t}\n // }\n\n\n return true;\n}\n\nfunction isPossibleIncompleteNationalNumber(nationalNumber, metadata) {\n switch (checkNumberLength(nationalNumber, metadata)) {\n case 'TOO_SHORT':\n case 'INVALID_LENGTH':\n // This library ignores \"local-only\" phone numbers (for simplicity).\n // See the readme for more info on what are \"local-only\" phone numbers.\n // case 'IS_POSSIBLE_LOCAL_ONLY':\n return false;\n\n default:\n return true;\n }\n}","import Metadata from '../metadata.js';\nimport matchesEntirely from './matchesEntirely.js';\nimport extractNationalNumber from './extractNationalNumber.js';\nimport checkNumberLength from './checkNumberLength.js';\nimport getCountryCallingCode from '../getCountryCallingCode.js';\n/**\r\n * Sometimes some people incorrectly input international phone numbers\r\n * without the leading `+`. This function corrects such input.\r\n * @param {string} number — Phone number digits.\r\n * @param {string?} country\r\n * @param {string?} callingCode\r\n * @param {object} metadata\r\n * @return {object} `{ countryCallingCode: string?, number: string }`.\r\n */\n\nexport default function extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, callingCode, metadata) {\n var countryCallingCode = country ? getCountryCallingCode(country, metadata) : callingCode;\n\n if (number.indexOf(countryCallingCode) === 0) {\n metadata = new Metadata(metadata);\n metadata.selectNumberingPlan(country, callingCode);\n var possibleShorterNumber = number.slice(countryCallingCode.length);\n\n var _extractNationalNumbe = extractNationalNumber(possibleShorterNumber, metadata),\n possibleShorterNationalNumber = _extractNationalNumbe.nationalNumber;\n\n var _extractNationalNumbe2 = extractNationalNumber(number, metadata),\n nationalNumber = _extractNationalNumbe2.nationalNumber; // If the number was not valid before but is valid now,\n // or if it was too long before, we consider the number\n // with the country calling code stripped to be a better result\n // and keep that instead.\n // For example, in Germany (+49), `49` is a valid area code,\n // so if a number starts with `49`, it could be both a valid\n // national German number or an international number without\n // a leading `+`.\n\n\n if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern()) && matchesEntirely(possibleShorterNationalNumber, metadata.nationalNumberPattern()) || checkNumberLength(nationalNumber, metadata) === 'TOO_LONG') {\n return {\n countryCallingCode: countryCallingCode,\n number: possibleShorterNumber\n };\n }\n }\n\n return {\n number: number\n };\n}","import stripIddPrefix from './stripIddPrefix.js';\nimport extractCountryCallingCodeFromInternationalNumberWithoutPlusSign from './extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js';\nimport Metadata from '../metadata.js';\nimport { MAX_LENGTH_COUNTRY_CODE } from '../constants.js';\n/**\r\n * Converts a phone number digits (possibly with a `+`)\r\n * into a calling code and the rest phone number digits.\r\n * The \"rest phone number digits\" could include\r\n * a national prefix, carrier code, and national\r\n * (significant) number.\r\n * @param {string} number — Phone number digits (possibly with a `+`).\r\n * @param {string} [country] — Default country.\r\n * @param {string} [callingCode] — Default calling code (some phone numbering plans are non-geographic).\r\n * @param {object} metadata\r\n * @return {object} `{ countryCallingCode: string?, number: string }`\r\n * @example\r\n * // Returns `{ countryCallingCode: \"1\", number: \"2133734253\" }`.\r\n * extractCountryCallingCode('2133734253', 'US', null, metadata)\r\n * extractCountryCallingCode('2133734253', null, '1', metadata)\r\n * extractCountryCallingCode('+12133734253', null, null, metadata)\r\n * extractCountryCallingCode('+12133734253', 'RU', null, metadata)\r\n */\n\nexport default function extractCountryCallingCode(number, country, callingCode, metadata) {\n if (!number) {\n return {};\n } // If this is not an international phone number,\n // then either extract an \"IDD\" prefix, or extract a\n // country calling code from a number by autocorrecting it\n // by prepending a leading `+` in cases when it starts\n // with the country calling code.\n // https://wikitravel.org/en/International_dialling_prefix\n // https://github.com/catamphetamine/libphonenumber-js/issues/376\n\n\n if (number[0] !== '+') {\n // Convert an \"out-of-country\" dialing phone number\n // to a proper international phone number.\n var numberWithoutIDD = stripIddPrefix(number, country, callingCode, metadata); // If an IDD prefix was stripped then\n // convert the number to international one\n // for subsequent parsing.\n\n if (numberWithoutIDD && numberWithoutIDD !== number) {\n number = '+' + numberWithoutIDD;\n } else {\n // Check to see if the number starts with the country calling code\n // for the default country. If so, we remove the country calling code,\n // and do some checks on the validity of the number before and after.\n // https://github.com/catamphetamine/libphonenumber-js/issues/376\n if (country || callingCode) {\n var _extractCountryCallin = extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, callingCode, metadata),\n countryCallingCode = _extractCountryCallin.countryCallingCode,\n shorterNumber = _extractCountryCallin.number;\n\n if (countryCallingCode) {\n return {\n countryCallingCode: countryCallingCode,\n number: shorterNumber\n };\n }\n }\n\n return {\n number: number\n };\n }\n } // Fast abortion: country codes do not begin with a '0'\n\n\n if (number[1] === '0') {\n return {};\n }\n\n metadata = new Metadata(metadata); // The thing with country phone codes\n // is that they are orthogonal to each other\n // i.e. there's no such country phone code A\n // for which country phone code B exists\n // where B starts with A.\n // Therefore, while scanning digits,\n // if a valid country code is found,\n // that means that it is the country code.\n //\n\n var i = 2;\n\n while (i - 1 <= MAX_LENGTH_COUNTRY_CODE && i <= number.length) {\n var _countryCallingCode = number.slice(1, i);\n\n if (metadata.hasCallingCode(_countryCallingCode)) {\n metadata.selectNumberingPlan(_countryCallingCode);\n return {\n countryCallingCode: _countryCallingCode,\n number: number.slice(i)\n };\n }\n\n i++;\n }\n\n return {};\n}","function _createForOfIteratorHelperLoose(o, allowArrayLike) {\n var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"];\n if (it) return (it = it.call(o)).next.bind(it);\n\n if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n return function () {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n };\n }\n\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nimport Metadata from '../metadata.js';\nimport getNumberType from './getNumberType.js';\nvar USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;\nexport default function getCountryByCallingCode(callingCode, nationalPhoneNumber, metadata) {\n /* istanbul ignore if */\n if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\n if (metadata.isNonGeographicCallingCode(callingCode)) {\n return '001';\n }\n } // Is always non-empty, because `callingCode` is always valid\n\n\n var possibleCountries = metadata.getCountryCodesForCallingCode(callingCode);\n\n if (!possibleCountries) {\n return;\n } // If there's just one country corresponding to the country code,\n // then just return it, without further phone number digits validation.\n\n\n if (possibleCountries.length === 1) {\n return possibleCountries[0];\n }\n\n return selectCountryFromList(possibleCountries, nationalPhoneNumber, metadata.metadata);\n}\n\nfunction selectCountryFromList(possibleCountries, nationalPhoneNumber, metadata) {\n // Re-create `metadata` because it will be selecting a `country`.\n metadata = new Metadata(metadata);\n\n for (var _iterator = _createForOfIteratorHelperLoose(possibleCountries), _step; !(_step = _iterator()).done;) {\n var country = _step.value;\n metadata.country(country); // Leading digits check would be the simplest and fastest one.\n // Leading digits patterns are only defined for about 20% of all countries.\n // https://gitlab.com/catamphetamine/libphonenumber-js/blob/master/METADATA.md#leading_digits\n // Matching \"leading digits\" is a sufficient but not necessary condition.\n\n if (metadata.leadingDigits()) {\n if (nationalPhoneNumber && nationalPhoneNumber.search(metadata.leadingDigits()) === 0) {\n return country;\n }\n } // Else perform full validation with all of those\n // fixed-line/mobile/etc regular expressions.\n else if (getNumberType({\n phone: nationalPhoneNumber,\n country: country\n }, undefined, metadata.metadata)) {\n return country;\n }\n }\n}","// This is a port of Google Android `libphonenumber`'s\n// `phonenumberutil.js` of December 31th, 2018.\n//\n// https://github.com/googlei18n/libphonenumber/commits/master/javascript/i18n/phonenumbers/phonenumberutil.js\nimport { VALID_DIGITS, PLUS_CHARS, MIN_LENGTH_FOR_NSN, MAX_LENGTH_FOR_NSN } from './constants.js';\nimport ParseError from './ParseError.js';\nimport Metadata from './metadata.js';\nimport isViablePhoneNumber, { isViablePhoneNumberStart } from './helpers/isViablePhoneNumber.js';\nimport extractExtension from './helpers/extension/extractExtension.js';\nimport parseIncompletePhoneNumber from './parseIncompletePhoneNumber.js';\nimport getCountryCallingCode from './getCountryCallingCode.js';\nimport { isPossibleNumber } from './isPossibleNumber_.js';\nimport { parseRFC3966 } from './helpers/RFC3966.js';\nimport PhoneNumber from './PhoneNumber.js';\nimport matchesEntirely from './helpers/matchesEntirely.js';\nimport extractCountryCallingCode from './helpers/extractCountryCallingCode.js';\nimport extractCountryCallingCodeFromInternationalNumberWithoutPlusSign from './helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js';\nimport extractNationalNumber from './helpers/extractNationalNumber.js';\nimport stripIddPrefix from './helpers/stripIddPrefix.js';\nimport getCountryByCallingCode from './helpers/getCountryByCallingCode.js'; // We don't allow input strings for parsing to be longer than 250 chars.\n// This prevents malicious input from consuming CPU.\n\nvar MAX_INPUT_STRING_LENGTH = 250; // This consists of the plus symbol, digits, and arabic-indic digits.\n\nvar PHONE_NUMBER_START_PATTERN = new RegExp('[' + PLUS_CHARS + VALID_DIGITS + ']'); // Regular expression of trailing characters that we want to remove.\n// A trailing `#` is sometimes used when writing phone numbers with extensions in US.\n// Example: \"+1 (645) 123 1234-910#\" number has extension \"910\".\n\nvar AFTER_PHONE_NUMBER_END_PATTERN = new RegExp('[^' + VALID_DIGITS + '#' + ']+$');\nvar USE_NON_GEOGRAPHIC_COUNTRY_CODE = false; // Examples:\n//\n// ```js\n// parse('8 (800) 555-35-35', 'RU')\n// parse('8 (800) 555-35-35', 'RU', metadata)\n// parse('8 (800) 555-35-35', { country: { default: 'RU' } })\n// parse('8 (800) 555-35-35', { country: { default: 'RU' } }, metadata)\n// parse('+7 800 555 35 35')\n// parse('+7 800 555 35 35', metadata)\n// ```\n//\n\nexport default function parse(text, options, metadata) {\n // If assigning the `{}` default value is moved to the arguments above,\n // code coverage would decrease for some weird reason.\n options = options || {};\n metadata = new Metadata(metadata); // Validate `defaultCountry`.\n\n if (options.defaultCountry && !metadata.hasCountry(options.defaultCountry)) {\n if (options.v2) {\n throw new ParseError('INVALID_COUNTRY');\n }\n\n throw new Error(\"Unknown country: \".concat(options.defaultCountry));\n } // Parse the phone number.\n\n\n var _parseInput = parseInput(text, options.v2, options.extract),\n formattedPhoneNumber = _parseInput.number,\n ext = _parseInput.ext,\n error = _parseInput.error; // If the phone number is not viable then return nothing.\n\n\n if (!formattedPhoneNumber) {\n if (options.v2) {\n if (error === 'TOO_SHORT') {\n throw new ParseError('TOO_SHORT');\n }\n\n throw new ParseError('NOT_A_NUMBER');\n }\n\n return {};\n }\n\n var _parsePhoneNumber = parsePhoneNumber(formattedPhoneNumber, options.defaultCountry, options.defaultCallingCode, metadata),\n country = _parsePhoneNumber.country,\n nationalNumber = _parsePhoneNumber.nationalNumber,\n countryCallingCode = _parsePhoneNumber.countryCallingCode,\n carrierCode = _parsePhoneNumber.carrierCode;\n\n if (!metadata.hasSelectedNumberingPlan()) {\n if (options.v2) {\n throw new ParseError('INVALID_COUNTRY');\n }\n\n return {};\n } // Validate national (significant) number length.\n\n\n if (!nationalNumber || nationalNumber.length < MIN_LENGTH_FOR_NSN) {\n // Won't throw here because the regexp already demands length > 1.\n\n /* istanbul ignore if */\n if (options.v2) {\n throw new ParseError('TOO_SHORT');\n } // Google's demo just throws an error in this case.\n\n\n return {};\n } // Validate national (significant) number length.\n //\n // A sidenote:\n //\n // They say that sometimes national (significant) numbers\n // can be longer than `MAX_LENGTH_FOR_NSN` (e.g. in Germany).\n // https://github.com/googlei18n/libphonenumber/blob/7e1748645552da39c4e1ba731e47969d97bdb539/resources/phonenumber.proto#L36\n // Such numbers will just be discarded.\n //\n\n\n if (nationalNumber.length > MAX_LENGTH_FOR_NSN) {\n if (options.v2) {\n throw new ParseError('TOO_LONG');\n } // Google's demo just throws an error in this case.\n\n\n return {};\n }\n\n if (options.v2) {\n var phoneNumber = new PhoneNumber(countryCallingCode, nationalNumber, metadata.metadata);\n\n if (country) {\n phoneNumber.country = country;\n }\n\n if (carrierCode) {\n phoneNumber.carrierCode = carrierCode;\n }\n\n if (ext) {\n phoneNumber.ext = ext;\n }\n\n return phoneNumber;\n } // Check if national phone number pattern matches the number.\n // National number pattern is different for each country,\n // even for those ones which are part of the \"NANPA\" group.\n\n\n var valid = (options.extended ? metadata.hasSelectedNumberingPlan() : country) ? matchesEntirely(nationalNumber, metadata.nationalNumberPattern()) : false;\n\n if (!options.extended) {\n return valid ? result(country, nationalNumber, ext) : {};\n } // isInternational: countryCallingCode !== undefined\n\n\n return {\n country: country,\n countryCallingCode: countryCallingCode,\n carrierCode: carrierCode,\n valid: valid,\n possible: valid ? true : options.extended === true && metadata.possibleLengths() && isPossibleNumber(nationalNumber, metadata) ? true : false,\n phone: nationalNumber,\n ext: ext\n };\n}\n/**\r\n * Extracts a formatted phone number from text.\r\n * Doesn't guarantee that the extracted phone number\r\n * is a valid phone number (for example, doesn't validate its length).\r\n * @param {string} text\r\n * @param {boolean} [extract] — If `false`, then will parse the entire `text` as a phone number.\r\n * @param {boolean} [throwOnError] — By default, it won't throw if the text is too long.\r\n * @return {string}\r\n * @example\r\n * // Returns \"(213) 373-4253\".\r\n * extractFormattedPhoneNumber(\"Call (213) 373-4253 for assistance.\")\r\n */\n\nfunction extractFormattedPhoneNumber(text, extract, throwOnError) {\n if (!text) {\n return;\n }\n\n if (text.length > MAX_INPUT_STRING_LENGTH) {\n if (throwOnError) {\n throw new ParseError('TOO_LONG');\n }\n\n return;\n }\n\n if (extract === false) {\n return text;\n } // Attempt to extract a possible number from the string passed in\n\n\n var startsAt = text.search(PHONE_NUMBER_START_PATTERN);\n\n if (startsAt < 0) {\n return;\n }\n\n return text // Trim everything to the left of the phone number\n .slice(startsAt) // Remove trailing non-numerical characters\n .replace(AFTER_PHONE_NUMBER_END_PATTERN, '');\n}\n/**\r\n * @param {string} text - Input.\r\n * @param {boolean} v2 - Legacy API functions don't pass `v2: true` flag.\r\n * @param {boolean} [extract] - Whether to extract a phone number from `text`, or attempt to parse the entire text as a phone number.\r\n * @return {object} `{ ?number, ?ext }`.\r\n */\n\n\nfunction parseInput(text, v2, extract) {\n // Parse RFC 3966 phone number URI.\n if (text && text.indexOf('tel:') === 0) {\n return parseRFC3966(text);\n }\n\n var number = extractFormattedPhoneNumber(text, extract, v2); // If the phone number is not viable, then abort.\n\n if (!number) {\n return {};\n }\n\n if (!isViablePhoneNumber(number)) {\n if (isViablePhoneNumberStart(number)) {\n return {\n error: 'TOO_SHORT'\n };\n }\n\n return {};\n } // Attempt to parse extension first, since it doesn't require region-specific\n // data and we want to have the non-normalised number here.\n\n\n var withExtensionStripped = extractExtension(number);\n\n if (withExtensionStripped.ext) {\n return withExtensionStripped;\n }\n\n return {\n number: number\n };\n}\n/**\r\n * Creates `parse()` result object.\r\n */\n\n\nfunction result(country, nationalNumber, ext) {\n var result = {\n country: country,\n phone: nationalNumber\n };\n\n if (ext) {\n result.ext = ext;\n }\n\n return result;\n}\n/**\r\n * Parses a viable phone number.\r\n * @param {string} formattedPhoneNumber — Example: \"(213) 373-4253\".\r\n * @param {string} [defaultCountry]\r\n * @param {string} [defaultCallingCode]\r\n * @param {Metadata} metadata\r\n * @return {object} Returns `{ country: string?, countryCallingCode: string?, nationalNumber: string? }`.\r\n */\n\n\nfunction parsePhoneNumber(formattedPhoneNumber, defaultCountry, defaultCallingCode, metadata) {\n // Extract calling code from phone number.\n var _extractCountryCallin = extractCountryCallingCode(parseIncompletePhoneNumber(formattedPhoneNumber), defaultCountry, defaultCallingCode, metadata.metadata),\n countryCallingCode = _extractCountryCallin.countryCallingCode,\n number = _extractCountryCallin.number; // Choose a country by `countryCallingCode`.\n\n\n var country;\n\n if (countryCallingCode) {\n metadata.selectNumberingPlan(countryCallingCode);\n } // If `formattedPhoneNumber` is in \"national\" format\n // then `number` is defined and `countryCallingCode` isn't.\n else if (number && (defaultCountry || defaultCallingCode)) {\n metadata.selectNumberingPlan(defaultCountry, defaultCallingCode);\n\n if (defaultCountry) {\n country = defaultCountry;\n } else {\n /* istanbul ignore if */\n if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\n if (metadata.isNonGeographicCallingCode(defaultCallingCode)) {\n country = '001';\n }\n }\n }\n\n countryCallingCode = defaultCallingCode || getCountryCallingCode(defaultCountry, metadata.metadata);\n } else return {};\n\n if (!number) {\n return {\n countryCallingCode: countryCallingCode\n };\n }\n\n var _extractNationalNumbe = extractNationalNumber(parseIncompletePhoneNumber(number), metadata),\n nationalNumber = _extractNationalNumbe.nationalNumber,\n carrierCode = _extractNationalNumbe.carrierCode; // Sometimes there are several countries\n // corresponding to the same country phone code\n // (e.g. NANPA countries all having `1` country phone code).\n // Therefore, to reliably determine the exact country,\n // national (significant) number should have been parsed first.\n //\n // When `metadata.json` is generated, all \"ambiguous\" country phone codes\n // get their countries populated with the full set of\n // \"phone number type\" regular expressions.\n //\n\n\n var exactCountry = getCountryByCallingCode(countryCallingCode, nationalNumber, metadata);\n\n if (exactCountry) {\n country = exactCountry;\n /* istanbul ignore if */\n\n if (exactCountry === '001') {// Can't happen with `USE_NON_GEOGRAPHIC_COUNTRY_CODE` being `false`.\n // If `USE_NON_GEOGRAPHIC_COUNTRY_CODE` is set to `true` for some reason,\n // then remove the \"istanbul ignore if\".\n } else {\n metadata.country(country);\n }\n }\n\n return {\n country: country,\n countryCallingCode: countryCallingCode,\n nationalNumber: nationalNumber,\n carrierCode: carrierCode\n };\n}","function ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n enumerableOnly && (symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n })), keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = null != arguments[i] ? arguments[i] : {};\n i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n\n return target;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nimport parseNumber from './parse_.js';\nexport default function parsePhoneNumber(text, options, metadata) {\n return parseNumber(text, _objectSpread(_objectSpread({}, options), {}, {\n v2: true\n }), metadata);\n}","function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, _typeof(obj);\n}\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n enumerableOnly && (symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n })), keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = null != arguments[i] ? arguments[i] : {};\n i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n\n return target;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();\n}\n\nfunction _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nfunction _iterableToArrayLimit(arr, i) {\n var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"];\n\n if (_i == null) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n\n var _s, _e;\n\n try {\n for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nfunction _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nimport parsePhoneNumber_ from './parsePhoneNumber_.js';\nexport default function parsePhoneNumber() {\n var _normalizeArguments = normalizeArguments(arguments),\n text = _normalizeArguments.text,\n options = _normalizeArguments.options,\n metadata = _normalizeArguments.metadata;\n\n return parsePhoneNumber_(text, options, metadata);\n}\nexport function normalizeArguments(args) {\n var _Array$prototype$slic = Array.prototype.slice.call(args),\n _Array$prototype$slic2 = _slicedToArray(_Array$prototype$slic, 4),\n arg_1 = _Array$prototype$slic2[0],\n arg_2 = _Array$prototype$slic2[1],\n arg_3 = _Array$prototype$slic2[2],\n arg_4 = _Array$prototype$slic2[3];\n\n var text;\n var options;\n var metadata; // If the phone number is passed as a string.\n // `parsePhoneNumber('88005553535', ...)`.\n\n if (typeof arg_1 === 'string') {\n text = arg_1;\n } else throw new TypeError('A text for parsing must be a string.'); // If \"default country\" argument is being passed then move it to `options`.\n // `parsePhoneNumber('88005553535', 'RU', [options], metadata)`.\n\n\n if (!arg_2 || typeof arg_2 === 'string') {\n if (arg_4) {\n options = arg_3;\n metadata = arg_4;\n } else {\n options = undefined;\n metadata = arg_3;\n }\n\n if (arg_2) {\n options = _objectSpread({\n defaultCountry: arg_2\n }, options);\n }\n } // `defaultCountry` is not passed.\n // Example: `parsePhoneNumber('+78005553535', [options], metadata)`.\n else if (isObject(arg_2)) {\n if (arg_3) {\n options = arg_2;\n metadata = arg_3;\n } else {\n metadata = arg_2;\n }\n } else throw new Error(\"Invalid second argument: \".concat(arg_2));\n\n return {\n text: text,\n options: options,\n metadata: metadata\n };\n} // Otherwise istanbul would show this as \"branch not covered\".\n\n/* istanbul ignore next */\n\nvar isObject = function isObject(_) {\n return _typeof(_) === 'object';\n};","function ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n enumerableOnly && (symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n })), keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = null != arguments[i] ? arguments[i] : {};\n i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n\n return target;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nimport parsePhoneNumber from './parsePhoneNumber_.js';\nimport ParseError from './ParseError.js';\nimport { isSupportedCountry } from './metadata.js';\nexport default function parsePhoneNumberFromString(text, options, metadata) {\n // Validate `defaultCountry`.\n if (options && options.defaultCountry && !isSupportedCountry(options.defaultCountry, metadata)) {\n options = _objectSpread(_objectSpread({}, options), {}, {\n defaultCountry: undefined\n });\n } // Parse phone number.\n\n\n try {\n return parsePhoneNumber(text, options, metadata);\n } catch (error) {\n /* istanbul ignore else */\n if (error instanceof ParseError) {//\n } else {\n throw error;\n }\n }\n}","import { normalizeArguments } from './parsePhoneNumber.js';\nimport parsePhoneNumberFromString_ from './parsePhoneNumberFromString_.js';\nexport default function parsePhoneNumberFromString() {\n var _normalizeArguments = normalizeArguments(arguments),\n text = _normalizeArguments.text,\n options = _normalizeArguments.options,\n metadata = _normalizeArguments.metadata;\n\n return parsePhoneNumberFromString_(text, options, metadata);\n}","function ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n enumerableOnly && (symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n })), keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = null != arguments[i] ? arguments[i] : {};\n i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n\n return target;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nimport { normalizeArguments } from './parsePhoneNumber.js';\nimport parsePhoneNumberFromString from './parsePhoneNumberFromString_.js';\nexport default function isValidPhoneNumber() {\n var _normalizeArguments = normalizeArguments(arguments),\n text = _normalizeArguments.text,\n options = _normalizeArguments.options,\n metadata = _normalizeArguments.metadata;\n\n options = _objectSpread(_objectSpread({}, options), {}, {\n extract: false\n });\n var phoneNumber = parsePhoneNumberFromString(text, options, metadata);\n return phoneNumber && phoneNumber.isValid() || false;\n}","import Metadata from './metadata.js';\nexport default function getCountries(metadata) {\n return new Metadata(metadata).getCountries();\n}","export default {\n \"ext\": \"ext.\",\n \"country\": \"Phone number country\",\n \"phone\": \"Phone\",\n \"AB\": \"Abkhazia\",\n \"AC\": \"Ascension Island\",\n \"AD\": \"Andorra\",\n \"AE\": \"United Arab Emirates\",\n \"AF\": \"Afghanistan\",\n \"AG\": \"Antigua and Barbuda\",\n \"AI\": \"Anguilla\",\n \"AL\": \"Albania\",\n \"AM\": \"Armenia\",\n \"AO\": \"Angola\",\n \"AQ\": \"Antarctica\",\n \"AR\": \"Argentina\",\n \"AS\": \"American Samoa\",\n \"AT\": \"Austria\",\n \"AU\": \"Australia\",\n \"AW\": \"Aruba\",\n \"AX\": \"Åland Islands\",\n \"AZ\": \"Azerbaijan\",\n \"BA\": \"Bosnia and Herzegovina\",\n \"BB\": \"Barbados\",\n \"BD\": \"Bangladesh\",\n \"BE\": \"Belgium\",\n \"BF\": \"Burkina Faso\",\n \"BG\": \"Bulgaria\",\n \"BH\": \"Bahrain\",\n \"BI\": \"Burundi\",\n \"BJ\": \"Benin\",\n \"BL\": \"Saint Barthélemy\",\n \"BM\": \"Bermuda\",\n \"BN\": \"Brunei Darussalam\",\n \"BO\": \"Bolivia\",\n \"BQ\": \"Bonaire, Sint Eustatius and Saba\",\n \"BR\": \"Brazil\",\n \"BS\": \"Bahamas\",\n \"BT\": \"Bhutan\",\n \"BV\": \"Bouvet Island\",\n \"BW\": \"Botswana\",\n \"BY\": \"Belarus\",\n \"BZ\": \"Belize\",\n \"CA\": \"Canada\",\n \"CC\": \"Cocos (Keeling) Islands\",\n \"CD\": \"Congo, Democratic Republic of the\",\n \"CF\": \"Central African Republic\",\n \"CG\": \"Congo\",\n \"CH\": \"Switzerland\",\n \"CI\": \"Cote d'Ivoire\",\n \"CK\": \"Cook Islands\",\n \"CL\": \"Chile\",\n \"CM\": \"Cameroon\",\n \"CN\": \"China\",\n \"CO\": \"Colombia\",\n \"CR\": \"Costa Rica\",\n \"CU\": \"Cuba\",\n \"CV\": \"Cape Verde\",\n \"CW\": \"Curaçao\",\n \"CX\": \"Christmas Island\",\n \"CY\": \"Cyprus\",\n \"CZ\": \"Czech Republic\",\n \"DE\": \"Germany\",\n \"DJ\": \"Djibouti\",\n \"DK\": \"Denmark\",\n \"DM\": \"Dominica\",\n \"DO\": \"Dominican Republic\",\n \"DZ\": \"Algeria\",\n \"EC\": \"Ecuador\",\n \"EE\": \"Estonia\",\n \"EG\": \"Egypt\",\n \"EH\": \"Western Sahara\",\n \"ER\": \"Eritrea\",\n \"ES\": \"Spain\",\n \"ET\": \"Ethiopia\",\n \"FI\": \"Finland\",\n \"FJ\": \"Fiji\",\n \"FK\": \"Falkland Islands\",\n \"FM\": \"Federated States of Micronesia\",\n \"FO\": \"Faroe Islands\",\n \"FR\": \"France\",\n \"GA\": \"Gabon\",\n \"GB\": \"United Kingdom\",\n \"GD\": \"Grenada\",\n \"GE\": \"Georgia\",\n \"GF\": \"French Guiana\",\n \"GG\": \"Guernsey\",\n \"GH\": \"Ghana\",\n \"GI\": \"Gibraltar\",\n \"GL\": \"Greenland\",\n \"GM\": \"Gambia\",\n \"GN\": \"Guinea\",\n \"GP\": \"Guadeloupe\",\n \"GQ\": \"Equatorial Guinea\",\n \"GR\": \"Greece\",\n \"GS\": \"South Georgia and the South Sandwich Islands\",\n \"GT\": \"Guatemala\",\n \"GU\": \"Guam\",\n \"GW\": \"Guinea-Bissau\",\n \"GY\": \"Guyana\",\n \"HK\": \"Hong Kong\",\n \"HM\": \"Heard Island and McDonald Islands\",\n \"HN\": \"Honduras\",\n \"HR\": \"Croatia\",\n \"HT\": \"Haiti\",\n \"HU\": \"Hungary\",\n \"ID\": \"Indonesia\",\n \"IE\": \"Ireland\",\n \"IL\": \"Israel\",\n \"IM\": \"Isle of Man\",\n \"IN\": \"India\",\n \"IO\": \"British Indian Ocean Territory\",\n \"IQ\": \"Iraq\",\n \"IR\": \"Iran\",\n \"IS\": \"Iceland\",\n \"IT\": \"Italy\",\n \"JE\": \"Jersey\",\n \"JM\": \"Jamaica\",\n \"JO\": \"Jordan\",\n \"JP\": \"Japan\",\n \"KE\": \"Kenya\",\n \"KG\": \"Kyrgyzstan\",\n \"KH\": \"Cambodia\",\n \"KI\": \"Kiribati\",\n \"KM\": \"Comoros\",\n \"KN\": \"Saint Kitts and Nevis\",\n \"KP\": \"North Korea\",\n \"KR\": \"South Korea\",\n \"KW\": \"Kuwait\",\n \"KY\": \"Cayman Islands\",\n \"KZ\": \"Kazakhstan\",\n \"LA\": \"Laos\",\n \"LB\": \"Lebanon\",\n \"LC\": \"Saint Lucia\",\n \"LI\": \"Liechtenstein\",\n \"LK\": \"Sri Lanka\",\n \"LR\": \"Liberia\",\n \"LS\": \"Lesotho\",\n \"LT\": \"Lithuania\",\n \"LU\": \"Luxembourg\",\n \"LV\": \"Latvia\",\n \"LY\": \"Libya\",\n \"MA\": \"Morocco\",\n \"MC\": \"Monaco\",\n \"MD\": \"Moldova\",\n \"ME\": \"Montenegro\",\n \"MF\": \"Saint Martin (French Part)\",\n \"MG\": \"Madagascar\",\n \"MH\": \"Marshall Islands\",\n \"MK\": \"North Macedonia\",\n \"ML\": \"Mali\",\n \"MM\": \"Myanmar\",\n \"MN\": \"Mongolia\",\n \"MO\": \"Macao\",\n \"MP\": \"Northern Mariana Islands\",\n \"MQ\": \"Martinique\",\n \"MR\": \"Mauritania\",\n \"MS\": \"Montserrat\",\n \"MT\": \"Malta\",\n \"MU\": \"Mauritius\",\n \"MV\": \"Maldives\",\n \"MW\": \"Malawi\",\n \"MX\": \"Mexico\",\n \"MY\": \"Malaysia\",\n \"MZ\": \"Mozambique\",\n \"NA\": \"Namibia\",\n \"NC\": \"New Caledonia\",\n \"NE\": \"Niger\",\n \"NF\": \"Norfolk Island\",\n \"NG\": \"Nigeria\",\n \"NI\": \"Nicaragua\",\n \"NL\": \"Netherlands\",\n \"NO\": \"Norway\",\n \"NP\": \"Nepal\",\n \"NR\": \"Nauru\",\n \"NU\": \"Niue\",\n \"NZ\": \"New Zealand\",\n \"OM\": \"Oman\",\n \"OS\": \"South Ossetia\",\n \"PA\": \"Panama\",\n \"PE\": \"Peru\",\n \"PF\": \"French Polynesia\",\n \"PG\": \"Papua New Guinea\",\n \"PH\": \"Philippines\",\n \"PK\": \"Pakistan\",\n \"PL\": \"Poland\",\n \"PM\": \"Saint Pierre and Miquelon\",\n \"PN\": \"Pitcairn\",\n \"PR\": \"Puerto Rico\",\n \"PS\": \"Palestine\",\n \"PT\": \"Portugal\",\n \"PW\": \"Palau\",\n \"PY\": \"Paraguay\",\n \"QA\": \"Qatar\",\n \"RE\": \"Reunion\",\n \"RO\": \"Romania\",\n \"RS\": \"Serbia\",\n \"RU\": \"Russia\",\n \"RW\": \"Rwanda\",\n \"SA\": \"Saudi Arabia\",\n \"SB\": \"Solomon Islands\",\n \"SC\": \"Seychelles\",\n \"SD\": \"Sudan\",\n \"SE\": \"Sweden\",\n \"SG\": \"Singapore\",\n \"SH\": \"Saint Helena\",\n \"SI\": \"Slovenia\",\n \"SJ\": \"Svalbard and Jan Mayen\",\n \"SK\": \"Slovakia\",\n \"SL\": \"Sierra Leone\",\n \"SM\": \"San Marino\",\n \"SN\": \"Senegal\",\n \"SO\": \"Somalia\",\n \"SR\": \"Suriname\",\n \"SS\": \"South Sudan\",\n \"ST\": \"Sao Tome and Principe\",\n \"SV\": \"El Salvador\",\n \"SX\": \"Sint Maarten\",\n \"SY\": \"Syria\",\n \"SZ\": \"Swaziland\",\n \"TA\": \"Tristan da Cunha\",\n \"TC\": \"Turks and Caicos Islands\",\n \"TD\": \"Chad\",\n \"TF\": \"French Southern Territories\",\n \"TG\": \"Togo\",\n \"TH\": \"Thailand\",\n \"TJ\": \"Tajikistan\",\n \"TK\": \"Tokelau\",\n \"TL\": \"Timor-Leste\",\n \"TM\": \"Turkmenistan\",\n \"TN\": \"Tunisia\",\n \"TO\": \"Tonga\",\n \"TR\": \"Turkey\",\n \"TT\": \"Trinidad and Tobago\",\n \"TV\": \"Tuvalu\",\n \"TW\": \"Taiwan\",\n \"TZ\": \"Tanzania\",\n \"UA\": \"Ukraine\",\n \"UG\": \"Uganda\",\n \"UM\": \"United States Minor Outlying Islands\",\n \"US\": \"United States\",\n \"UY\": \"Uruguay\",\n \"UZ\": \"Uzbekistan\",\n \"VA\": \"Holy See (Vatican City State)\",\n \"VC\": \"Saint Vincent and the Grenadines\",\n \"VE\": \"Venezuela\",\n \"VG\": \"Virgin Islands, British\",\n \"VI\": \"Virgin Islands, U.S.\",\n \"VN\": \"Vietnam\",\n \"VU\": \"Vanuatu\",\n \"WF\": \"Wallis and Futuna\",\n \"WS\": \"Samoa\",\n \"XK\": \"Kosovo\",\n \"YE\": \"Yemen\",\n \"YT\": \"Mayotte\",\n \"ZA\": \"South Africa\",\n \"ZM\": \"Zambia\",\n \"ZW\": \"Zimbabwe\",\n \"ZZ\": \"International\"\n};","function _createForOfIteratorHelperLoose(o, allowArrayLike) {\n var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"];\n if (it) return (it = it.call(o)).next.bind(it);\n\n if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n return function () {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n };\n }\n\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n} // Counts all occurences of a symbol in a string\n\n\nexport function count_occurences(symbol, string) {\n var count = 0; // Using `.split('')` here instead of normal `for ... of`\n // because the importing application doesn't neccessarily include an ES6 polyfill.\n // The `.split('')` approach discards \"exotic\" UTF-8 characters\n // (the ones consisting of four bytes)\n // but template placeholder characters don't fall into that range\n // so skipping such miscellaneous \"exotic\" characters\n // won't matter here for just counting placeholder character occurrences.\n\n for (var _iterator = _createForOfIteratorHelperLoose(string.split('')), _step; !(_step = _iterator()).done;) {\n var character = _step.value;\n\n if (character === symbol) {\n count++;\n }\n }\n\n return count;\n}","import { count_occurences } from './helpers.js';\nexport default function closeBraces(retained_template, template) {\n var placeholder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'x';\n var empty_placeholder = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ' ';\n var cut_before = retained_template.length;\n var opening_braces = count_occurences('(', retained_template);\n var closing_braces = count_occurences(')', retained_template);\n var dangling_braces = opening_braces - closing_braces;\n\n while (dangling_braces > 0 && cut_before < template.length) {\n retained_template += template[cut_before].replace(placeholder, empty_placeholder);\n\n if (template[cut_before] === ')') {\n dangling_braces--;\n }\n\n cut_before++;\n }\n\n return retained_template;\n}","function _createForOfIteratorHelperLoose(o, allowArrayLike) {\n var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"];\n if (it) return (it = it.call(o)).next.bind(it);\n\n if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n return function () {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n };\n }\n\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nimport { count_occurences } from './helpers.js';\nimport close_braces from './closeBraces.js'; // Takes a `template` where character placeholders\n// are denoted by 'x'es (e.g. 'x (xxx) xxx-xx-xx').\n//\n// Returns a function which takes `value` characters\n// and returns the `template` filled with those characters.\n// If the `template` can only be partially filled\n// then it is cut off.\n//\n// If `should_close_braces` is `true`,\n// then it will also make sure all dangling braces are closed,\n// e.g. \"8 (8\" -> \"8 (8 )\" (iPhone style phone number input).\n//\n\nexport default function (template) {\n var placeholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'x';\n var should_close_braces = arguments.length > 2 ? arguments[2] : undefined;\n\n if (!template) {\n return function (value) {\n return {\n text: value\n };\n };\n }\n\n var characters_in_template = count_occurences(placeholder, template);\n return function (value) {\n if (!value) {\n return {\n text: '',\n template: template\n };\n }\n\n var value_character_index = 0;\n var filled_in_template = ''; // Using `.split('')` here instead of normal `for ... of`\n // because the importing application doesn't neccessarily include an ES6 polyfill.\n // The `.split('')` approach discards \"exotic\" UTF-8 characters\n // (the ones consisting of four bytes)\n // but template placeholder characters don't fall into that range\n // and appending UTF-8 characters to a string in parts still works.\n\n for (var _iterator = _createForOfIteratorHelperLoose(template.split('')), _step; !(_step = _iterator()).done;) {\n var character = _step.value;\n\n if (character !== placeholder) {\n filled_in_template += character;\n continue;\n }\n\n filled_in_template += value[value_character_index];\n value_character_index++; // If the last available value character has been filled in,\n // then return the filled in template\n // (either trim the right part or retain it,\n // if no more character placeholders in there)\n\n if (value_character_index === value.length) {\n // If there are more character placeholders\n // in the right part of the template\n // then simply trim it.\n if (value.length < characters_in_template) {\n break;\n }\n }\n }\n\n if (should_close_braces) {\n filled_in_template = close_braces(filled_in_template, template);\n }\n\n return {\n text: filled_in_template,\n template: template\n };\n };\n}","import template_formatter from './templateFormatter.js'; // Formats `value` value preserving `caret` at the same character.\n//\n// `{ value, caret }` attribute is the result of `parse()` function call.\n//\n// Returns `{ text, caret }` where the new `caret` is the caret position\n// inside `text` text corresponding to the original `caret` position inside `value`.\n//\n// `formatter(value)` is a function returning `{ text, template }`.\n//\n// `text` is the `value` value formatted using `template`.\n// It may either cut off the non-filled right part of the `template`\n// or it may fill the non-filled character placeholders\n// in the right part of the `template` with `spacer`\n// which is a space (' ') character by default.\n//\n// `template` is the template used to format the `value`.\n// It can be either a full-length template or a partial template.\n//\n// `formatter` can also be a string — a `template`\n// where character placeholders are denoted by 'x'es.\n// In this case `formatter` function is automatically created.\n//\n// Example:\n//\n// `value` is '880',\n// `caret` is `2` (before the first `0`)\n//\n// `formatter` is `'880' =>\n// { text: '8 (80 )', template: 'x (xxx) xxx-xx-xx' }`\n//\n// The result is `{ text: '8 (80 )', caret: 4 }`.\n//\n\nexport default function format(value, caret, formatter) {\n if (typeof formatter === 'string') {\n formatter = template_formatter(formatter);\n }\n\n var _ref = formatter(value) || {},\n text = _ref.text,\n template = _ref.template;\n\n if (text === undefined) {\n text = value;\n }\n\n if (template) {\n if (caret === undefined) {\n caret = text.length;\n } else {\n var index = 0;\n var found = false;\n var possibly_last_input_character_index = -1;\n\n while (index < text.length && index < template.length) {\n // Character placeholder found\n if (text[index] !== template[index]) {\n if (caret === 0) {\n found = true;\n caret = index;\n break;\n }\n\n possibly_last_input_character_index = index;\n caret--;\n }\n\n index++;\n } // If the caret was positioned after last input character,\n // then the text caret index is just after the last input character.\n\n\n if (!found) {\n caret = possibly_last_input_character_index + 1;\n }\n }\n }\n\n return {\n text: text,\n caret: caret\n };\n}","export function isReadOnly(element) {\n return element.hasAttribute('readonly');\n} // Gets selection bounds\n\nexport function getSelection(element) {\n // If no selection, return nothing\n if (element.selectionStart === element.selectionEnd) {\n return;\n }\n\n return {\n start: element.selectionStart,\n end: element.selectionEnd\n };\n} // Key codes\n\nexport var Keys = {\n Backspace: 8,\n Delete: 46\n}; // Finds out the operation to be intercepted and performed\n// based on the key down event `keyCode`.\n\nexport function getOperation(event) {\n switch (event.keyCode) {\n case Keys.Backspace:\n return 'Backspace';\n\n case Keys.Delete:\n return 'Delete';\n }\n} // Gets caret position\n\nexport function getCaretPosition(element) {\n return element.selectionStart;\n} // Sets caret position\n\nexport function setCaretPosition(element, caret_position) {\n // Sanity check\n if (caret_position === undefined) {\n return;\n } // Set caret position.\n // There has been an issue with caret positioning on Android devices.\n // https://github.com/catamphetamine/input-format/issues/2\n // I was revisiting this issue and looked for similar issues in other libraries.\n // For example, there's [`text-mask`](https://github.com/text-mask/text-mask) library.\n // They've had exactly the same issue when the caret seemingly refused to be repositioned programmatically.\n // The symptoms were the same: whenever the caret passed through a non-digit character of a mask (a whitespace, a bracket, a dash, etc), it looked as if it placed itself one character before its correct position.\n // https://github.com/text-mask/text-mask/issues/300\n // They seem to have found a basic fix for it: calling `input.setSelectionRange()` in a timeout rather than instantly for Android devices.\n // https://github.com/text-mask/text-mask/pull/400/files\n // I've implemented the same workaround here.\n\n\n if (isAndroid()) {\n setTimeout(function () {\n return element.setSelectionRange(caret_position, caret_position);\n }, 0);\n } else {\n element.setSelectionRange(caret_position, caret_position);\n }\n}\n\nfunction isAndroid() {\n // `navigator` is not defined when running mocha tests.\n if (typeof navigator !== 'undefined') {\n return ANDROID_USER_AGENT_REG_EXP.test(navigator.userAgent);\n }\n}\n\nvar ANDROID_USER_AGENT_REG_EXP = /Android/i;","import edit from './edit.js';\nimport parse from './parse.js';\nimport format from './format.js';\nimport { isReadOnly, getOperation, getSelection, getCaretPosition, setCaretPosition } from './dom.js'; // Deprecated.\n// I don't know why this function exists.\n\nexport function onCut(event, input, _parse, _format, on_change) {\n if (isReadOnly(input)) {\n return;\n } // The actual cut hasn't happened just yet hence the timeout.\n\n\n setTimeout(function () {\n return formatInputText(input, _parse, _format, undefined, on_change);\n }, 0);\n} // Deprecated.\n// I don't know why this function exists.\n\nexport function onPaste(event, input, _parse, _format, on_change) {\n if (isReadOnly(input)) {\n return;\n }\n\n var selection = getSelection(input); // If selection is made,\n // just erase the selected text\n // prior to pasting\n\n if (selection) {\n eraseSelection(input, selection);\n }\n\n formatInputText(input, _parse, _format, undefined, on_change);\n}\nexport function onChange(event, input, _parse, _format, on_change) {\n formatInputText(input, _parse, _format, undefined, on_change);\n} // \"Delete\" and \"Backspace\" keys are special\n// in a way that they're not handled by the regular `onChange()` handler\n// and instead are intercepted and re-applied manually.\n// The reason is that normally hitting \"Backspace\" or \"Delete\"\n// results in erasing a character, but that character might be any character,\n// while it would be a better \"user experience\" if it erased not just any character\n// but the closest \"meaningful\" character.\n// For example, if a template is `(xxx) xxx-xxxx`,\n// and the `` value is `(111) 222-3333`,\n// then, if a user begins erasing the `3333` part via \"Backspace\"\n// and reaches the \"-\" character, then it would just erase the \"-\" character.\n// Nothing wrong with that, but it would be a better \"user experience\"\n// if hitting \"Backspace\" at that position would erase the closest \"meaningful\"\n// character, which would be the rightmost `2`.\n// So, what this `onKeyDown()` handler does is it intercepts\n// \"Backspace\" and \"Delete\" keys and re-applies those operations manually\n// following the logic described above.\n\nexport function onKeyDown(event, input, _parse, _format, on_change) {\n if (isReadOnly(input)) {\n return;\n }\n\n var operation = getOperation(event);\n\n switch (operation) {\n case 'Delete':\n case 'Backspace':\n // Intercept this operation and perform it manually.\n event.preventDefault();\n var selection = getSelection(input); // If a selection is made, just erase the selected text.\n\n if (selection) {\n eraseSelection(input, selection);\n return formatInputText(input, _parse, _format, undefined, on_change);\n } // Else, perform the (character erasing) operation manually.\n\n\n return formatInputText(input, _parse, _format, operation, on_change);\n\n default: // Will be handled normally as part of the `onChange` handler.\n\n }\n}\n/**\r\n * Erases the selected text inside an ``.\r\n * @param {DOMElement} input\r\n * @param {Selection} selection\r\n */\n\nfunction eraseSelection(input, selection) {\n var text = input.value;\n text = text.slice(0, selection.start) + text.slice(selection.end);\n input.value = text;\n setCaretPosition(input, selection.start);\n}\n/**\r\n * Parses and re-formats `` textual value.\r\n * E.g. when a user enters something into the ``\r\n * that raw input must first be parsed and the re-formatted properly.\r\n * Is called either after some user input (e.g. entered a character, pasted something)\r\n * or after the user performed an `operation` (e.g. \"Backspace\", \"Delete\").\r\n * @param {DOMElement} input\r\n * @param {Function} parse\r\n * @param {Function} format\r\n * @param {string} [operation] - The operation that triggered `` textual value change. E.g. \"Backspace\", \"Delete\".\r\n * @param {Function} onChange\r\n */\n\n\nfunction formatInputText(input, _parse, _format, operation, on_change) {\n // Parse `` textual value.\n // Get the `value` and `caret` position.\n var _parse2 = parse(input.value, getCaretPosition(input), _parse),\n value = _parse2.value,\n caret = _parse2.caret; // If a user performed an operation (\"Backspace\", \"Delete\")\n // then apply that operation and get the new `value` and `caret` position.\n\n\n if (operation) {\n var newValueAndCaret = edit(value, caret, operation);\n value = newValueAndCaret.value;\n caret = newValueAndCaret.caret;\n } // Format the `value`.\n // (and reposition the caret accordingly)\n\n\n var formatted = format(value, caret, _format);\n var text = formatted.text;\n caret = formatted.caret; // Set `` textual value manually\n // to prevent React from resetting the caret position\n // later inside a subsequent `render()`.\n // Doesn't work for custom `inputComponent`s for some reason.\n\n input.value = text; // Position the caret properly.\n\n setCaretPosition(input, caret); // If the `` textual value did change,\n // then the parsed `value` may have changed too.\n\n on_change(value);\n}","// Parses the `text`.\n//\n// Returns `{ value, caret }` where `caret` is\n// the caret position inside `value`\n// corresponding to the `caret_position` inside `text`.\n//\n// The `text` is parsed by feeding each character sequentially to\n// `parse_character(character, value)` function\n// and appending the result (if it's not `undefined`) to `value`.\n//\n// Example:\n//\n// `text` is `8 (800) 555-35-35`,\n// `caret_position` is `4` (before the first `0`).\n// `parse_character` is `(character, value) =>\n// if (character >= '0' && character <= '9') { return character }`.\n//\n// then `parse()` outputs `{ value: '88005553535', caret: 2 }`.\n//\nexport default function parse(text, caret_position, parse_character) {\n var value = '';\n var focused_input_character_index = 0;\n var index = 0;\n\n while (index < text.length) {\n var character = parse_character(text[index], value);\n\n if (character !== undefined) {\n value += character;\n\n if (caret_position !== undefined) {\n if (caret_position === index) {\n focused_input_character_index = value.length - 1;\n } else if (caret_position > index) {\n focused_input_character_index = value.length;\n }\n }\n }\n\n index++;\n } // If caret position wasn't specified\n\n\n if (caret_position === undefined) {\n // Then set caret position to \"after the last input character\"\n focused_input_character_index = value.length;\n }\n\n var result = {\n value: value,\n caret: focused_input_character_index\n };\n return result;\n}","// Edits text `value` (if `operation` is passed) and repositions the `caret` if needed.\n//\n// Example:\n//\n// value - '88005553535'\n// caret - 2 // starting from 0; is positioned before the first zero\n// operation - 'Backspace'\n//\n// Returns\n// {\n// \tvalue: '8005553535'\n// \tcaret: 1\n// }\n//\n// Currently supports just 'Delete' and 'Backspace' operations\n//\nexport default function edit(value, caret, operation) {\n switch (operation) {\n case 'Backspace':\n // If there exists the previous character,\n // then erase it and reposition the caret.\n if (caret > 0) {\n // Remove the previous character\n value = value.slice(0, caret - 1) + value.slice(caret); // Position the caret where the previous (erased) character was\n\n caret--;\n }\n\n break;\n\n case 'Delete':\n // Remove current digit (if any)\n value = value.slice(0, caret) + value.slice(caret + 1);\n break;\n }\n\n return {\n value: value,\n caret: caret\n };\n}","var _excluded = [\"value\", \"parse\", \"format\", \"inputComponent\", \"onChange\", \"onKeyDown\"];\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n} // This is just `./ReactInput.js` rewritten in Hooks.\n\n\nimport React, { useCallback, useRef } from 'react';\nimport { onChange as onInputChange, onKeyDown as onInputKeyDown } from '../inputControl.js'; // Usage:\n//\n// this.setState({ phone })}\n// \tparse={character => character}\n// \tformat={value => ({ text: value, template: 'xxxxxxxx' })}/>\n//\n\nfunction Input(_ref, ref) {\n var value = _ref.value,\n parse = _ref.parse,\n format = _ref.format,\n InputComponent = _ref.inputComponent,\n onChange = _ref.onChange,\n onKeyDown = _ref.onKeyDown,\n rest = _objectWithoutProperties(_ref, _excluded);\n\n var internalRef = useRef();\n var setRef = useCallback(function (instance) {\n internalRef.current = instance;\n\n if (ref) {\n if (typeof ref === 'function') {\n ref(instance);\n } else {\n ref.current = instance;\n }\n }\n }, [ref]);\n\n var _onChange = useCallback(function (event) {\n return onInputChange(event, internalRef.current, parse, format, onChange);\n }, [internalRef, parse, format, onChange]);\n\n var _onKeyDown = useCallback(function (event) {\n if (onKeyDown) {\n onKeyDown(event);\n }\n\n return onInputKeyDown(event, internalRef.current, parse, format, onChange);\n }, [internalRef, parse, format, onChange, onKeyDown]);\n\n return /*#__PURE__*/React.createElement(InputComponent, _extends({}, rest, {\n ref: setRef,\n value: format(isEmptyValue(value) ? '' : value).text,\n onKeyDown: _onKeyDown,\n onChange: _onChange\n }));\n}\n\nInput = /*#__PURE__*/React.forwardRef(Input);\nInput.defaultProps = {\n // Renders `` by default.\n inputComponent: 'input',\n // `` `type` attribute.\n type: 'text'\n};\nexport default Input;\n\nfunction isEmptyValue(value) {\n return value === undefined || value === null;\n}","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}\n\nvar AsYouTypeState = /*#__PURE__*/function () {\n function AsYouTypeState(_ref) {\n var onCountryChange = _ref.onCountryChange,\n onCallingCodeChange = _ref.onCallingCodeChange;\n\n _classCallCheck(this, AsYouTypeState);\n\n this.onCountryChange = onCountryChange;\n this.onCallingCodeChange = onCallingCodeChange;\n }\n\n _createClass(AsYouTypeState, [{\n key: \"reset\",\n value: function reset(defaultCountry, defaultCallingCode) {\n this.international = false;\n this.IDDPrefix = undefined;\n this.missingPlus = undefined;\n this.callingCode = undefined;\n this.digits = '';\n this.resetNationalSignificantNumber();\n this.initCountryAndCallingCode(defaultCountry, defaultCallingCode);\n }\n }, {\n key: \"resetNationalSignificantNumber\",\n value: function resetNationalSignificantNumber() {\n this.nationalSignificantNumber = this.getNationalDigits();\n this.nationalSignificantNumberMatchesInput = true;\n this.nationalPrefix = undefined;\n this.carrierCode = undefined;\n this.complexPrefixBeforeNationalSignificantNumber = undefined;\n }\n }, {\n key: \"update\",\n value: function update(properties) {\n for (var _i = 0, _Object$keys = Object.keys(properties); _i < _Object$keys.length; _i++) {\n var key = _Object$keys[_i];\n this[key] = properties[key];\n }\n }\n }, {\n key: \"initCountryAndCallingCode\",\n value: function initCountryAndCallingCode(country, callingCode) {\n this.setCountry(country);\n this.setCallingCode(callingCode);\n }\n }, {\n key: \"setCountry\",\n value: function setCountry(country) {\n this.country = country;\n this.onCountryChange(country);\n }\n }, {\n key: \"setCallingCode\",\n value: function setCallingCode(callingCode) {\n this.callingCode = callingCode;\n this.onCallingCodeChange(callingCode, this.country);\n }\n }, {\n key: \"startInternationalNumber\",\n value: function startInternationalNumber(country, callingCode) {\n // Prepend the `+` to parsed input.\n this.international = true; // If a default country was set then reset it\n // because an explicitly international phone\n // number is being entered.\n\n this.initCountryAndCallingCode(country, callingCode);\n }\n }, {\n key: \"appendDigits\",\n value: function appendDigits(nextDigits) {\n this.digits += nextDigits;\n }\n }, {\n key: \"appendNationalSignificantNumberDigits\",\n value: function appendNationalSignificantNumberDigits(nextDigits) {\n this.nationalSignificantNumber += nextDigits;\n }\n /**\r\n * Returns the part of `this.digits` that corresponds to the national number.\r\n * Basically, all digits that have been input by the user, except for the\r\n * international prefix and the country calling code part\r\n * (if the number is an international one).\r\n * @return {string}\r\n */\n\n }, {\n key: \"getNationalDigits\",\n value: function getNationalDigits() {\n if (this.international) {\n return this.digits.slice((this.IDDPrefix ? this.IDDPrefix.length : 0) + (this.callingCode ? this.callingCode.length : 0));\n }\n\n return this.digits;\n }\n }, {\n key: \"getDigitsWithoutInternationalPrefix\",\n value: function getDigitsWithoutInternationalPrefix() {\n if (this.international) {\n if (this.IDDPrefix) {\n return this.digits.slice(this.IDDPrefix.length);\n }\n }\n\n return this.digits;\n }\n }]);\n\n return AsYouTypeState;\n}();\n\nexport { AsYouTypeState as default };","function _createForOfIteratorHelperLoose(o, allowArrayLike) {\n var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"];\n if (it) return (it = it.call(o)).next.bind(it);\n\n if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n return function () {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n };\n }\n\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n} // Should be the same as `DIGIT_PLACEHOLDER` in `libphonenumber-metadata-generator`.\n\n\nexport var DIGIT_PLACEHOLDER = 'x'; // '\\u2008' (punctuation space)\n\nvar DIGIT_PLACEHOLDER_MATCHER = new RegExp(DIGIT_PLACEHOLDER); // Counts all occurences of a symbol in a string.\n// Unicode-unsafe (because using `.split()`).\n\nexport function countOccurences(symbol, string) {\n var count = 0; // Using `.split('')` to iterate through a string here\n // to avoid requiring `Symbol.iterator` polyfill.\n // `.split('')` is generally not safe for Unicode,\n // but in this particular case for counting brackets it is safe.\n // for (const character of string)\n\n for (var _iterator = _createForOfIteratorHelperLoose(string.split('')), _step; !(_step = _iterator()).done;) {\n var character = _step.value;\n\n if (character === symbol) {\n count++;\n }\n }\n\n return count;\n} // Repeats a string (or a symbol) N times.\n// http://stackoverflow.com/questions/202605/repeat-string-javascript\n\nexport function repeat(string, times) {\n if (times < 1) {\n return '';\n }\n\n var result = '';\n\n while (times > 1) {\n if (times & 1) {\n result += string;\n }\n\n times >>= 1;\n string += string;\n }\n\n return result + string;\n}\nexport function cutAndStripNonPairedParens(string, cutBeforeIndex) {\n if (string[cutBeforeIndex] === ')') {\n cutBeforeIndex++;\n }\n\n return stripNonPairedParens(string.slice(0, cutBeforeIndex));\n}\nexport function closeNonPairedParens(template, cut_before) {\n var retained_template = template.slice(0, cut_before);\n var opening_braces = countOccurences('(', retained_template);\n var closing_braces = countOccurences(')', retained_template);\n var dangling_braces = opening_braces - closing_braces;\n\n while (dangling_braces > 0 && cut_before < template.length) {\n if (template[cut_before] === ')') {\n dangling_braces--;\n }\n\n cut_before++;\n }\n\n return template.slice(0, cut_before);\n}\nexport function stripNonPairedParens(string) {\n var dangling_braces = [];\n var i = 0;\n\n while (i < string.length) {\n if (string[i] === '(') {\n dangling_braces.push(i);\n } else if (string[i] === ')') {\n dangling_braces.pop();\n }\n\n i++;\n }\n\n var start = 0;\n var cleared_string = '';\n dangling_braces.push(string.length);\n\n for (var _i = 0, _dangling_braces = dangling_braces; _i < _dangling_braces.length; _i++) {\n var index = _dangling_braces[_i];\n cleared_string += string.slice(start, index);\n start = index + 1;\n }\n\n return cleared_string;\n}\nexport function populateTemplateWithDigits(template, position, digits) {\n // Using `.split('')` to iterate through a string here\n // to avoid requiring `Symbol.iterator` polyfill.\n // `.split('')` is generally not safe for Unicode,\n // but in this particular case for `digits` it is safe.\n // for (const digit of digits)\n for (var _iterator2 = _createForOfIteratorHelperLoose(digits.split('')), _step2; !(_step2 = _iterator2()).done;) {\n var digit = _step2.value; // If there is room for more digits in current `template`,\n // then set the next digit in the `template`,\n // and return the formatted digits so far.\n // If more digits are entered than the current format could handle.\n\n if (template.slice(position + 1).search(DIGIT_PLACEHOLDER_MATCHER) < 0) {\n return;\n }\n\n position = template.search(DIGIT_PLACEHOLDER_MATCHER);\n template = template.replace(DIGIT_PLACEHOLDER_MATCHER, digit);\n }\n\n return [template, position];\n}","import checkNumberLength from './helpers/checkNumberLength.js';\nimport parseDigits from './helpers/parseDigits.js';\nimport formatNationalNumberUsingFormat from './helpers/formatNationalNumberUsingFormat.js';\nexport default function formatCompleteNumber(state, format, _ref) {\n var metadata = _ref.metadata,\n shouldTryNationalPrefixFormattingRule = _ref.shouldTryNationalPrefixFormattingRule,\n getSeparatorAfterNationalPrefix = _ref.getSeparatorAfterNationalPrefix;\n var matcher = new RegExp(\"^(?:\".concat(format.pattern(), \")$\"));\n\n if (matcher.test(state.nationalSignificantNumber)) {\n return formatNationalNumberWithAndWithoutNationalPrefixFormattingRule(state, format, {\n metadata: metadata,\n shouldTryNationalPrefixFormattingRule: shouldTryNationalPrefixFormattingRule,\n getSeparatorAfterNationalPrefix: getSeparatorAfterNationalPrefix\n });\n }\n}\nexport function canFormatCompleteNumber(nationalSignificantNumber, metadata) {\n return checkNumberLength(nationalSignificantNumber, metadata) === 'IS_POSSIBLE';\n}\n\nfunction formatNationalNumberWithAndWithoutNationalPrefixFormattingRule(state, format, _ref2) {\n var metadata = _ref2.metadata,\n shouldTryNationalPrefixFormattingRule = _ref2.shouldTryNationalPrefixFormattingRule,\n getSeparatorAfterNationalPrefix = _ref2.getSeparatorAfterNationalPrefix; // `format` has already been checked for `nationalPrefix` requirement.\n\n var nationalSignificantNumber = state.nationalSignificantNumber,\n international = state.international,\n nationalPrefix = state.nationalPrefix,\n carrierCode = state.carrierCode; // Format the number with using `national_prefix_formatting_rule`.\n // If the resulting formatted number is a valid formatted number, then return it.\n //\n // Google's AsYouType formatter is different in a way that it doesn't try\n // to format using the \"national prefix formatting rule\", and instead it\n // simply prepends a national prefix followed by a \" \" character.\n // This code does that too, but as a fallback.\n // The reason is that \"national prefix formatting rule\" may use parentheses,\n // which wouldn't be included has it used the simpler Google's way.\n //\n\n if (shouldTryNationalPrefixFormattingRule(format)) {\n var formattedNumber = formatNationalNumber(state, format, {\n useNationalPrefixFormattingRule: true,\n getSeparatorAfterNationalPrefix: getSeparatorAfterNationalPrefix,\n metadata: metadata\n });\n\n if (formattedNumber) {\n return formattedNumber;\n }\n } // Format the number without using `national_prefix_formatting_rule`.\n\n\n return formatNationalNumber(state, format, {\n useNationalPrefixFormattingRule: false,\n getSeparatorAfterNationalPrefix: getSeparatorAfterNationalPrefix,\n metadata: metadata\n });\n}\n\nfunction formatNationalNumber(state, format, _ref3) {\n var metadata = _ref3.metadata,\n useNationalPrefixFormattingRule = _ref3.useNationalPrefixFormattingRule,\n getSeparatorAfterNationalPrefix = _ref3.getSeparatorAfterNationalPrefix;\n var formattedNationalNumber = formatNationalNumberUsingFormat(state.nationalSignificantNumber, format, {\n carrierCode: state.carrierCode,\n useInternationalFormat: state.international,\n withNationalPrefix: useNationalPrefixFormattingRule,\n metadata: metadata\n });\n\n if (!useNationalPrefixFormattingRule) {\n if (state.nationalPrefix) {\n // If a national prefix was extracted, then just prepend it,\n // followed by a \" \" character.\n formattedNationalNumber = state.nationalPrefix + getSeparatorAfterNationalPrefix(format) + formattedNationalNumber;\n } else if (state.complexPrefixBeforeNationalSignificantNumber) {\n formattedNationalNumber = state.complexPrefixBeforeNationalSignificantNumber + ' ' + formattedNationalNumber;\n }\n }\n\n if (isValidFormattedNationalNumber(formattedNationalNumber, state)) {\n return formattedNationalNumber;\n }\n} // Check that the formatted phone number contains exactly\n// the same digits that have been input by the user.\n// For example, when \"0111523456789\" is input for `AR` country,\n// the extracted `this.nationalSignificantNumber` is \"91123456789\",\n// which means that the national part of `this.digits` isn't simply equal to\n// `this.nationalPrefix` + `this.nationalSignificantNumber`.\n//\n// Also, a `format` can add extra digits to the `this.nationalSignificantNumber`\n// being formatted via `metadata[country].national_prefix_transform_rule`.\n// For example, for `VI` country, it prepends `340` to the national number,\n// and if this check hasn't been implemented, then there would be a bug\n// when `340` \"area coude\" is \"duplicated\" during input for `VI` country:\n// https://github.com/catamphetamine/libphonenumber-js/issues/318\n//\n// So, all these \"gotchas\" are filtered out.\n//\n// In the original Google's code, the comments say:\n// \"Check that we didn't remove nor add any extra digits when we matched\n// this formatting pattern. This usually happens after we entered the last\n// digit during AYTF. Eg: In case of MX, we swallow mobile token (1) when\n// formatted but AYTF should retain all the number entered and not change\n// in order to match a format (of same leading digits and length) display\n// in that way.\"\n// \"If it's the same (i.e entered number and format is same), then it's\n// safe to return this in formatted number as nothing is lost / added.\"\n// Otherwise, don't use this format.\n// https://github.com/google/libphonenumber/commit/3e7c1f04f5e7200f87fb131e6f85c6e99d60f510#diff-9149457fa9f5d608a11bb975c6ef4bc5\n// https://github.com/google/libphonenumber/commit/3ac88c7106e7dcb553bcc794b15f19185928a1c6#diff-2dcb77e833422ee304da348b905cde0b\n//\n\n\nfunction isValidFormattedNationalNumber(formattedNationalNumber, state) {\n return parseDigits(formattedNationalNumber) === state.getNationalDigits();\n}","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}\n\nvar PatternParser = /*#__PURE__*/function () {\n function PatternParser() {\n _classCallCheck(this, PatternParser);\n }\n\n _createClass(PatternParser, [{\n key: \"parse\",\n value: function parse(pattern) {\n this.context = [{\n or: true,\n instructions: []\n }];\n this.parsePattern(pattern);\n\n if (this.context.length !== 1) {\n throw new Error('Non-finalized contexts left when pattern parse ended');\n }\n\n var _this$context$ = this.context[0],\n branches = _this$context$.branches,\n instructions = _this$context$.instructions;\n\n if (branches) {\n return {\n op: '|',\n args: branches.concat([expandSingleElementArray(instructions)])\n };\n }\n /* istanbul ignore if */\n\n\n if (instructions.length === 0) {\n throw new Error('Pattern is required');\n }\n\n if (instructions.length === 1) {\n return instructions[0];\n }\n\n return instructions;\n }\n }, {\n key: \"startContext\",\n value: function startContext(context) {\n this.context.push(context);\n }\n }, {\n key: \"endContext\",\n value: function endContext() {\n this.context.pop();\n }\n }, {\n key: \"getContext\",\n value: function getContext() {\n return this.context[this.context.length - 1];\n }\n }, {\n key: \"parsePattern\",\n value: function parsePattern(pattern) {\n if (!pattern) {\n throw new Error('Pattern is required');\n }\n\n var match = pattern.match(OPERATOR);\n\n if (!match) {\n if (ILLEGAL_CHARACTER_REGEXP.test(pattern)) {\n throw new Error(\"Illegal characters found in a pattern: \".concat(pattern));\n }\n\n this.getContext().instructions = this.getContext().instructions.concat(pattern.split(''));\n return;\n }\n\n var operator = match[1];\n var before = pattern.slice(0, match.index);\n var rightPart = pattern.slice(match.index + operator.length);\n\n switch (operator) {\n case '(?:':\n if (before) {\n this.parsePattern(before);\n }\n\n this.startContext({\n or: true,\n instructions: [],\n branches: []\n });\n break;\n\n case ')':\n if (!this.getContext().or) {\n throw new Error('\")\" operator must be preceded by \"(?:\" operator');\n }\n\n if (before) {\n this.parsePattern(before);\n }\n\n if (this.getContext().instructions.length === 0) {\n throw new Error('No instructions found after \"|\" operator in an \"or\" group');\n }\n\n var _this$getContext = this.getContext(),\n branches = _this$getContext.branches;\n\n branches.push(expandSingleElementArray(this.getContext().instructions));\n this.endContext();\n this.getContext().instructions.push({\n op: '|',\n args: branches\n });\n break;\n\n case '|':\n if (!this.getContext().or) {\n throw new Error('\"|\" operator can only be used inside \"or\" groups');\n }\n\n if (before) {\n this.parsePattern(before);\n } // The top-level is an implicit \"or\" group, if required.\n\n\n if (!this.getContext().branches) {\n // `branches` are not defined only for the root implicit \"or\" operator.\n\n /* istanbul ignore else */\n if (this.context.length === 1) {\n this.getContext().branches = [];\n } else {\n throw new Error('\"branches\" not found in an \"or\" group context');\n }\n }\n\n this.getContext().branches.push(expandSingleElementArray(this.getContext().instructions));\n this.getContext().instructions = [];\n break;\n\n case '[':\n if (before) {\n this.parsePattern(before);\n }\n\n this.startContext({\n oneOfSet: true\n });\n break;\n\n case ']':\n if (!this.getContext().oneOfSet) {\n throw new Error('\"]\" operator must be preceded by \"[\" operator');\n }\n\n this.endContext();\n this.getContext().instructions.push({\n op: '[]',\n args: parseOneOfSet(before)\n });\n break;\n\n /* istanbul ignore next */\n\n default:\n throw new Error(\"Unknown operator: \".concat(operator));\n }\n\n if (rightPart) {\n this.parsePattern(rightPart);\n }\n }\n }]);\n\n return PatternParser;\n}();\n\nexport { PatternParser as default };\n\nfunction parseOneOfSet(pattern) {\n var values = [];\n var i = 0;\n\n while (i < pattern.length) {\n if (pattern[i] === '-') {\n if (i === 0 || i === pattern.length - 1) {\n throw new Error(\"Couldn't parse a one-of set pattern: \".concat(pattern));\n }\n\n var prevValue = pattern[i - 1].charCodeAt(0) + 1;\n var nextValue = pattern[i + 1].charCodeAt(0) - 1;\n var value = prevValue;\n\n while (value <= nextValue) {\n values.push(String.fromCharCode(value));\n value++;\n }\n } else {\n values.push(pattern[i]);\n }\n\n i++;\n }\n\n return values;\n}\n\nvar ILLEGAL_CHARACTER_REGEXP = /[\\(\\)\\[\\]\\?\\:\\|]/;\nvar OPERATOR = new RegExp( // any of:\n'(' + // or operator\n'\\\\|' + // or\n'|' + // or group start\n'\\\\(\\\\?\\\\:' + // or\n'|' + // or group end\n'\\\\)' + // or\n'|' + // one-of set start\n'\\\\[' + // or\n'|' + // one-of set end\n'\\\\]' + ')');\n\nfunction expandSingleElementArray(array) {\n if (array.length === 1) {\n return array[0];\n }\n\n return array;\n}","function _createForOfIteratorHelperLoose(o, allowArrayLike) {\n var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"];\n if (it) return (it = it.call(o)).next.bind(it);\n\n if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n return function () {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n };\n }\n\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}\n\nimport PatternParser from './AsYouTypeFormatter.PatternParser.js';\n\nvar PatternMatcher = /*#__PURE__*/function () {\n function PatternMatcher(pattern) {\n _classCallCheck(this, PatternMatcher);\n\n this.matchTree = new PatternParser().parse(pattern);\n }\n\n _createClass(PatternMatcher, [{\n key: \"match\",\n value: function match(string) {\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n allowOverflow = _ref.allowOverflow;\n\n if (!string) {\n throw new Error('String is required');\n }\n\n var result = _match(string.split(''), this.matchTree, true);\n\n if (result && result.match) {\n delete result.matchedChars;\n }\n\n if (result && result.overflow) {\n if (!allowOverflow) {\n return;\n }\n }\n\n return result;\n }\n }]);\n\n return PatternMatcher;\n}();\n/**\r\n * Matches `characters` against a pattern compiled into a `tree`.\r\n * @param {string[]} characters\r\n * @param {Tree} tree — A pattern compiled into a `tree`. See the `*.d.ts` file for the description of the `tree` structure.\r\n * @param {boolean} last — Whether it's the last (rightmost) subtree on its level of the match tree.\r\n * @return {object} See the `*.d.ts` file for the description of the result object.\r\n */\n\n\nexport { PatternMatcher as default };\n\nfunction _match(characters, tree, last) {\n // If `tree` is a string, then `tree` is a single character.\n // That's because when a pattern is parsed, multi-character-string parts\n // of a pattern are compiled into arrays of single characters.\n // I still wrote this piece of code for a \"general\" hypothetical case\n // when `tree` could be a string of several characters, even though\n // such case is not possible with the current implementation.\n if (typeof tree === 'string') {\n var characterString = characters.join('');\n\n if (tree.indexOf(characterString) === 0) {\n // `tree` is always a single character.\n // If `tree.indexOf(characterString) === 0`\n // then `characters.length === tree.length`.\n\n /* istanbul ignore else */\n if (characters.length === tree.length) {\n return {\n match: true,\n matchedChars: characters\n };\n } // `tree` is always a single character.\n // If `tree.indexOf(characterString) === 0`\n // then `characters.length === tree.length`.\n\n /* istanbul ignore next */\n\n\n return {\n partialMatch: true // matchedChars: characters\n\n };\n }\n\n if (characterString.indexOf(tree) === 0) {\n if (last) {\n // The `else` path is not possible because `tree` is always a single character.\n // The `else` case for `characters.length > tree.length` would be\n // `characters.length <= tree.length` which means `characters.length <= 1`.\n // `characters` array can't be empty, so that means `characters === [tree]`,\n // which would also mean `tree.indexOf(characterString) === 0` and that'd mean\n // that the `if (tree.indexOf(characterString) === 0)` condition before this\n // `if` condition would be entered, and returned from there, not reaching this code.\n\n /* istanbul ignore else */\n if (characters.length > tree.length) {\n return {\n overflow: true\n };\n }\n }\n\n return {\n match: true,\n matchedChars: characters.slice(0, tree.length)\n };\n }\n\n return;\n }\n\n if (Array.isArray(tree)) {\n var restCharacters = characters.slice();\n var i = 0;\n\n while (i < tree.length) {\n var subtree = tree[i];\n\n var result = _match(restCharacters, subtree, last && i === tree.length - 1);\n\n if (!result) {\n return;\n } else if (result.overflow) {\n return result;\n } else if (result.match) {\n // Continue with the next subtree with the rest of the characters.\n restCharacters = restCharacters.slice(result.matchedChars.length);\n\n if (restCharacters.length === 0) {\n if (i === tree.length - 1) {\n return {\n match: true,\n matchedChars: characters\n };\n } else {\n return {\n partialMatch: true // matchedChars: characters\n\n };\n }\n }\n } else {\n /* istanbul ignore else */\n if (result.partialMatch) {\n return {\n partialMatch: true // matchedChars: characters\n\n };\n } else {\n throw new Error(\"Unsupported match result:\\n\".concat(JSON.stringify(result, null, 2)));\n }\n }\n\n i++;\n } // If `last` then overflow has already been checked\n // by the last element of the `tree` array.\n\n /* istanbul ignore if */\n\n\n if (last) {\n return {\n overflow: true\n };\n }\n\n return {\n match: true,\n matchedChars: characters.slice(0, characters.length - restCharacters.length)\n };\n }\n\n switch (tree.op) {\n case '|':\n var partialMatch;\n\n for (var _iterator = _createForOfIteratorHelperLoose(tree.args), _step; !(_step = _iterator()).done;) {\n var branch = _step.value;\n\n var _result = _match(characters, branch, last);\n\n if (_result) {\n if (_result.overflow) {\n return _result;\n } else if (_result.match) {\n return {\n match: true,\n matchedChars: _result.matchedChars\n };\n } else {\n /* istanbul ignore else */\n if (_result.partialMatch) {\n partialMatch = true;\n } else {\n throw new Error(\"Unsupported match result:\\n\".concat(JSON.stringify(_result, null, 2)));\n }\n }\n }\n }\n\n if (partialMatch) {\n return {\n partialMatch: true // matchedChars: ...\n\n };\n } // Not even a partial match.\n\n\n return;\n\n case '[]':\n for (var _iterator2 = _createForOfIteratorHelperLoose(tree.args), _step2; !(_step2 = _iterator2()).done;) {\n var _char = _step2.value;\n\n if (characters[0] === _char) {\n if (characters.length === 1) {\n return {\n match: true,\n matchedChars: characters\n };\n }\n\n if (last) {\n return {\n overflow: true\n };\n }\n\n return {\n match: true,\n matchedChars: [_char]\n };\n }\n } // No character matches.\n\n\n return;\n\n /* istanbul ignore next */\n\n default:\n throw new Error(\"Unsupported instruction tree: \".concat(tree));\n }\n}","function _createForOfIteratorHelperLoose(o, allowArrayLike) {\n var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"];\n if (it) return (it = it.call(o)).next.bind(it);\n\n if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n return function () {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n };\n }\n\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}\n\nimport { DIGIT_PLACEHOLDER, countOccurences, repeat, cutAndStripNonPairedParens, closeNonPairedParens, stripNonPairedParens, populateTemplateWithDigits } from './AsYouTypeFormatter.util.js';\nimport formatCompleteNumber, { canFormatCompleteNumber } from './AsYouTypeFormatter.complete.js';\nimport PatternMatcher from './AsYouTypeFormatter.PatternMatcher.js';\nimport parseDigits from './helpers/parseDigits.js';\nexport { DIGIT_PLACEHOLDER } from './AsYouTypeFormatter.util.js';\nimport { FIRST_GROUP_PATTERN } from './helpers/formatNationalNumberUsingFormat.js';\nimport { VALID_PUNCTUATION } from './constants.js';\nimport applyInternationalSeparatorStyle from './helpers/applyInternationalSeparatorStyle.js'; // Used in phone number format template creation.\n// Could be any digit, I guess.\n\nvar DUMMY_DIGIT = '9'; // I don't know why is it exactly `15`\n\nvar LONGEST_NATIONAL_PHONE_NUMBER_LENGTH = 15; // Create a phone number consisting only of the digit 9 that matches the\n// `number_pattern` by applying the pattern to the \"longest phone number\" string.\n\nvar LONGEST_DUMMY_PHONE_NUMBER = repeat(DUMMY_DIGIT, LONGEST_NATIONAL_PHONE_NUMBER_LENGTH); // A set of characters that, if found in a national prefix formatting rules, are an indicator to\n// us that we should separate the national prefix from the number when formatting.\n\nvar NATIONAL_PREFIX_SEPARATORS_PATTERN = /[- ]/; // Deprecated: Google has removed some formatting pattern related code from their repo.\n// https://github.com/googlei18n/libphonenumber/commit/a395b4fef3caf57c4bc5f082e1152a4d2bd0ba4c\n// \"We no longer have numbers in formatting matching patterns, only \\d.\"\n// Because this library supports generating custom metadata\n// some users may still be using old metadata so the relevant\n// code seems to stay until some next major version update.\n\nvar SUPPORT_LEGACY_FORMATTING_PATTERNS = true; // A pattern that is used to match character classes in regular expressions.\n// An example of a character class is \"[1-4]\".\n\nvar CREATE_CHARACTER_CLASS_PATTERN = SUPPORT_LEGACY_FORMATTING_PATTERNS && function () {\n return /\\[([^\\[\\]])*\\]/g;\n}; // Any digit in a regular expression that actually denotes a digit. For\n// example, in the regular expression \"80[0-2]\\d{6,10}\", the first 2 digits\n// (8 and 0) are standalone digits, but the rest are not.\n// Two look-aheads are needed because the number following \\\\d could be a\n// two-digit number, since the phone number can be as long as 15 digits.\n\n\nvar CREATE_STANDALONE_DIGIT_PATTERN = SUPPORT_LEGACY_FORMATTING_PATTERNS && function () {\n return /\\d(?=[^,}][^,}])/g;\n}; // A regular expression that is used to determine if a `format` is\n// suitable to be used in the \"as you type formatter\".\n// A `format` is suitable when the resulting formatted number has\n// the same digits as the user has entered.\n//\n// In the simplest case, that would mean that the format\n// doesn't add any additional digits when formatting a number.\n// Google says that it also shouldn't add \"star\" (`*`) characters,\n// like it does in some Israeli formats.\n// Such basic format would only contain \"valid punctuation\"\n// and \"captured group\" identifiers ($1, $2, etc).\n//\n// An example of a format that adds additional digits:\n//\n// Country: `AR` (Argentina).\n// Format:\n// {\n// \"pattern\": \"(\\\\d)(\\\\d{2})(\\\\d{4})(\\\\d{4})\",\n// \"leading_digits_patterns\": [\"91\"],\n// \"national_prefix_formatting_rule\": \"0$1\",\n// \"format\": \"$2 15-$3-$4\",\n// \"international_format\": \"$1 $2 $3-$4\"\n// }\n//\n// In the format above, the `format` adds `15` to the digits when formatting a number.\n// A sidenote: this format actually is suitable because `national_prefix_for_parsing`\n// has previously removed `15` from a national number, so re-adding `15` in `format`\n// doesn't actually result in any extra digits added to user's input.\n// But verifying that would be a complex procedure, so the code chooses a simpler path:\n// it simply filters out all `format`s that contain anything but \"captured group\" ids.\n//\n// This regular expression is called `ELIGIBLE_FORMAT_PATTERN` in Google's\n// `libphonenumber` code.\n//\n\n\nvar NON_ALTERING_FORMAT_REG_EXP = new RegExp('[' + VALID_PUNCTUATION + ']*' + // Google developers say:\n// \"We require that the first matching group is present in the\n// output pattern to ensure no data is lost while formatting.\"\n'\\\\$1' + '[' + VALID_PUNCTUATION + ']*' + '(\\\\$\\\\d[' + VALID_PUNCTUATION + ']*)*' + '$'); // This is the minimum length of the leading digits of a phone number\n// to guarantee the first \"leading digits pattern\" for a phone number format\n// to be preemptive.\n\nvar MIN_LEADING_DIGITS_LENGTH = 3;\n\nvar AsYouTypeFormatter = /*#__PURE__*/function () {\n function AsYouTypeFormatter(_ref) {\n var state = _ref.state,\n metadata = _ref.metadata;\n\n _classCallCheck(this, AsYouTypeFormatter);\n\n this.metadata = metadata;\n this.resetFormat();\n }\n\n _createClass(AsYouTypeFormatter, [{\n key: \"resetFormat\",\n value: function resetFormat() {\n this.chosenFormat = undefined;\n this.template = undefined;\n this.nationalNumberTemplate = undefined;\n this.populatedNationalNumberTemplate = undefined;\n this.populatedNationalNumberTemplatePosition = -1;\n }\n }, {\n key: \"reset\",\n value: function reset(numberingPlan, state) {\n this.resetFormat();\n\n if (numberingPlan) {\n this.isNANP = numberingPlan.callingCode() === '1';\n this.matchingFormats = numberingPlan.formats();\n\n if (state.nationalSignificantNumber) {\n this.narrowDownMatchingFormats(state);\n }\n } else {\n this.isNANP = undefined;\n this.matchingFormats = [];\n }\n }\n /**\r\n * Formats an updated phone number.\r\n * @param {string} nextDigits — Additional phone number digits.\r\n * @param {object} state — `AsYouType` state.\r\n * @return {[string]} Returns undefined if the updated phone number can't be formatted using any of the available formats.\r\n */\n\n }, {\n key: \"format\",\n value: function format(nextDigits, state) {\n var _this = this; // See if the phone number digits can be formatted as a complete phone number.\n // If not, use the results from `formatNationalNumberWithNextDigits()`,\n // which formats based on the chosen formatting pattern.\n //\n // Attempting to format complete phone number first is how it's done\n // in Google's `libphonenumber`, so this library just follows it.\n // Google's `libphonenumber` code doesn't explain in detail why does it\n // attempt to format digits as a complete phone number\n // instead of just going with a previoulsy (or newly) chosen `format`:\n //\n // \"Checks to see if there is an exact pattern match for these digits.\n // If so, we should use this instead of any other formatting template\n // whose leadingDigitsPattern also matches the input.\"\n //\n\n\n if (canFormatCompleteNumber(state.nationalSignificantNumber, this.metadata)) {\n for (var _iterator = _createForOfIteratorHelperLoose(this.matchingFormats), _step; !(_step = _iterator()).done;) {\n var format = _step.value;\n var formattedCompleteNumber = formatCompleteNumber(state, format, {\n metadata: this.metadata,\n shouldTryNationalPrefixFormattingRule: function shouldTryNationalPrefixFormattingRule(format) {\n return _this.shouldTryNationalPrefixFormattingRule(format, {\n international: state.international,\n nationalPrefix: state.nationalPrefix\n });\n },\n getSeparatorAfterNationalPrefix: function getSeparatorAfterNationalPrefix(format) {\n return _this.getSeparatorAfterNationalPrefix(format);\n }\n });\n\n if (formattedCompleteNumber) {\n this.resetFormat();\n this.chosenFormat = format;\n this.setNationalNumberTemplate(formattedCompleteNumber.replace(/\\d/g, DIGIT_PLACEHOLDER), state);\n this.populatedNationalNumberTemplate = formattedCompleteNumber; // With a new formatting template, the matched position\n // using the old template needs to be reset.\n\n this.populatedNationalNumberTemplatePosition = this.template.lastIndexOf(DIGIT_PLACEHOLDER);\n return formattedCompleteNumber;\n }\n }\n } // Format the digits as a partial (incomplete) phone number\n // using the previously chosen formatting pattern (or a newly chosen one).\n\n\n return this.formatNationalNumberWithNextDigits(nextDigits, state);\n } // Formats the next phone number digits.\n\n }, {\n key: \"formatNationalNumberWithNextDigits\",\n value: function formatNationalNumberWithNextDigits(nextDigits, state) {\n var previouslyChosenFormat = this.chosenFormat; // Choose a format from the list of matching ones.\n\n var newlyChosenFormat = this.chooseFormat(state);\n\n if (newlyChosenFormat) {\n if (newlyChosenFormat === previouslyChosenFormat) {\n // If it can format the next (current) digits\n // using the previously chosen phone number format\n // then return the updated formatted number.\n return this.formatNextNationalNumberDigits(nextDigits);\n } else {\n // If a more appropriate phone number format\n // has been chosen for these \"leading digits\",\n // then re-format the national phone number part\n // using the newly selected format.\n return this.formatNextNationalNumberDigits(state.getNationalDigits());\n }\n }\n }\n }, {\n key: \"narrowDownMatchingFormats\",\n value: function narrowDownMatchingFormats(_ref2) {\n var _this2 = this;\n\n var nationalSignificantNumber = _ref2.nationalSignificantNumber,\n nationalPrefix = _ref2.nationalPrefix,\n international = _ref2.international;\n var leadingDigits = nationalSignificantNumber; // \"leading digits\" pattern list starts with a\n // \"leading digits\" pattern fitting a maximum of 3 leading digits.\n // So, after a user inputs 3 digits of a national (significant) phone number\n // this national (significant) number can already be formatted.\n // The next \"leading digits\" pattern is for 4 leading digits max,\n // and the \"leading digits\" pattern after it is for 5 leading digits max, etc.\n // This implementation is different from Google's\n // in that it searches for a fitting format\n // even if the user has entered less than\n // `MIN_LEADING_DIGITS_LENGTH` digits of a national number.\n // Because some leading digit patterns already match for a single first digit.\n\n var leadingDigitsPatternIndex = leadingDigits.length - MIN_LEADING_DIGITS_LENGTH;\n\n if (leadingDigitsPatternIndex < 0) {\n leadingDigitsPatternIndex = 0;\n }\n\n this.matchingFormats = this.matchingFormats.filter(function (format) {\n return _this2.formatSuits(format, international, nationalPrefix) && _this2.formatMatches(format, leadingDigits, leadingDigitsPatternIndex);\n }); // If there was a phone number format chosen\n // and it no longer holds given the new leading digits then reset it.\n // The test for this `if` condition is marked as:\n // \"Reset a chosen format when it no longer holds given the new leading digits\".\n // To construct a valid test case for this one can find a country\n // in `PhoneNumberMetadata.xml` yielding one format for 3 ``\n // and yielding another format for 4 `` (Australia in this case).\n\n if (this.chosenFormat && this.matchingFormats.indexOf(this.chosenFormat) === -1) {\n this.resetFormat();\n }\n }\n }, {\n key: \"formatSuits\",\n value: function formatSuits(format, international, nationalPrefix) {\n // When a prefix before a national (significant) number is\n // simply a national prefix, then it's parsed as `this.nationalPrefix`.\n // In more complex cases, a prefix before national (significant) number\n // could include a national prefix as well as some \"capturing groups\",\n // and in that case there's no info whether a national prefix has been parsed.\n // If national prefix is not used when formatting a phone number\n // using this format, but a national prefix has been entered by the user,\n // and was extracted, then discard such phone number format.\n // In Google's \"AsYouType\" formatter code, the equivalent would be this part:\n // https://github.com/google/libphonenumber/blob/0a45cfd96e71cad8edb0e162a70fcc8bd9728933/java/libphonenumber/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java#L175-L184\n if (nationalPrefix && !format.usesNationalPrefix() && // !format.domesticCarrierCodeFormattingRule() &&\n !format.nationalPrefixIsOptionalWhenFormattingInNationalFormat()) {\n return false;\n } // If national prefix is mandatory for this phone number format\n // and there're no guarantees that a national prefix is present in user input\n // then discard this phone number format as not suitable.\n // In Google's \"AsYouType\" formatter code, the equivalent would be this part:\n // https://github.com/google/libphonenumber/blob/0a45cfd96e71cad8edb0e162a70fcc8bd9728933/java/libphonenumber/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java#L185-L193\n\n\n if (!international && !nationalPrefix && format.nationalPrefixIsMandatoryWhenFormattingInNationalFormat()) {\n return false;\n }\n\n return true;\n }\n }, {\n key: \"formatMatches\",\n value: function formatMatches(format, leadingDigits, leadingDigitsPatternIndex) {\n var leadingDigitsPatternsCount = format.leadingDigitsPatterns().length; // If this format is not restricted to a certain\n // leading digits pattern then it fits.\n // The test case could be found by searching for \"leadingDigitsPatternsCount === 0\".\n\n if (leadingDigitsPatternsCount === 0) {\n return true;\n } // Start narrowing down the list of possible formats based on the leading digits.\n // (only previously matched formats take part in the narrowing down process)\n // `leading_digits_patterns` start with 3 digits min\n // and then go up from there one digit at a time.\n\n\n leadingDigitsPatternIndex = Math.min(leadingDigitsPatternIndex, leadingDigitsPatternsCount - 1);\n var leadingDigitsPattern = format.leadingDigitsPatterns()[leadingDigitsPatternIndex]; // Google imposes a requirement on the leading digits\n // to be minimum 3 digits long in order to be eligible\n // for checking those with a leading digits pattern.\n //\n // Since `leading_digits_patterns` start with 3 digits min,\n // Google's original `libphonenumber` library only starts\n // excluding any non-matching formats only when the\n // national number entered so far is at least 3 digits long,\n // otherwise format matching would give false negatives.\n //\n // For example, when the digits entered so far are `2`\n // and the leading digits pattern is `21` –\n // it's quite obvious in this case that the format could be the one\n // but due to the absence of further digits it would give false negative.\n //\n // Also, `leading_digits_patterns` doesn't always correspond to a single\n // digits count. For example, `60|8` pattern would already match `8`\n // but the `60` part would require having at least two leading digits,\n // so the whole pattern would require inputting two digits first in order to\n // decide on whether it matches the input, even when the input is \"80\".\n //\n // This library — `libphonenumber-js` — allows filtering by `leading_digits_patterns`\n // even when there's only 1 or 2 digits of the national (significant) number.\n // To do that, it uses a non-strict pattern matcher written specifically for that.\n //\n\n if (leadingDigits.length < MIN_LEADING_DIGITS_LENGTH) {\n // Before leading digits < 3 matching was implemented:\n // return true\n //\n // After leading digits < 3 matching was implemented:\n try {\n return new PatternMatcher(leadingDigitsPattern).match(leadingDigits, {\n allowOverflow: true\n }) !== undefined;\n } catch (error)\n /* istanbul ignore next */\n {\n // There's a slight possibility that there could be some undiscovered bug\n // in the pattern matcher code. Since the \"leading digits < 3 matching\"\n // feature is not \"essential\" for operation, it can fall back to the old way\n // in case of any issues rather than halting the application's execution.\n console.error(error);\n return true;\n }\n } // If at least `MIN_LEADING_DIGITS_LENGTH` digits of a national number are\n // available then use the usual regular expression matching.\n //\n // The whole pattern is wrapped in round brackets (`()`) because\n // the pattern can use \"or\" operator (`|`) at the top level of the pattern.\n //\n\n\n return new RegExp(\"^(\".concat(leadingDigitsPattern, \")\")).test(leadingDigits);\n }\n }, {\n key: \"getFormatFormat\",\n value: function getFormatFormat(format, international) {\n return international ? format.internationalFormat() : format.format();\n }\n }, {\n key: \"chooseFormat\",\n value: function chooseFormat(state) {\n var _this3 = this;\n\n var _loop = function _loop() {\n var format = _step2.value; // If this format is currently being used\n // and is still suitable, then stick to it.\n\n if (_this3.chosenFormat === format) {\n return \"break\";\n } // Sometimes, a formatting rule inserts additional digits in a phone number,\n // and \"as you type\" formatter can't do that: it should only use the digits\n // that the user has input.\n //\n // For example, in Argentina, there's a format for mobile phone numbers:\n //\n // {\n // \"pattern\": \"(\\\\d)(\\\\d{2})(\\\\d{4})(\\\\d{4})\",\n // \"leading_digits_patterns\": [\"91\"],\n // \"national_prefix_formatting_rule\": \"0$1\",\n // \"format\": \"$2 15-$3-$4\",\n // \"international_format\": \"$1 $2 $3-$4\"\n // }\n //\n // In that format, `international_format` is used instead of `format`\n // because `format` inserts `15` in the formatted number,\n // and `AsYouType` formatter should only use the digits\n // the user has actually input, without adding any extra digits.\n // In this case, it wouldn't make a difference, because the `15`\n // is first stripped when applying `national_prefix_for_parsing`\n // and then re-added when using `format`, so in reality it doesn't\n // add any new digits to the number, but to detect that, the code\n // would have to be more complex: it would have to try formatting\n // the digits using the format and then see if any digits have\n // actually been added or removed, and then, every time a new digit\n // is input, it should re-check whether the chosen format doesn't\n // alter the digits.\n //\n // Google's code doesn't go that far, and so does this library:\n // it simply requires that a `format` doesn't add any additonal\n // digits to user's input.\n //\n // Also, people in general should move from inputting phone numbers\n // in national format (possibly with national prefixes)\n // and use international phone number format instead:\n // it's a logical thing in the modern age of mobile phones,\n // globalization and the internet.\n //\n\n /* istanbul ignore if */\n\n\n if (!NON_ALTERING_FORMAT_REG_EXP.test(_this3.getFormatFormat(format, state.international))) {\n return \"continue\";\n }\n\n if (!_this3.createTemplateForFormat(format, state)) {\n // Remove the format if it can't generate a template.\n _this3.matchingFormats = _this3.matchingFormats.filter(function (_) {\n return _ !== format;\n });\n return \"continue\";\n }\n\n _this3.chosenFormat = format;\n return \"break\";\n }; // When there are multiple available formats, the formatter uses the first\n // format where a formatting template could be created.\n //\n // For some weird reason, `istanbul` says \"else path not taken\"\n // for the `for of` line below. Supposedly that means that\n // the loop doesn't ever go over the last element in the list.\n // That's true because there always is `this.chosenFormat`\n // when `this.matchingFormats` is non-empty.\n // And, for some weird reason, it doesn't think that the case\n // with empty `this.matchingFormats` qualifies for a valid \"else\" path.\n // So simply muting this `istanbul` warning.\n // It doesn't skip the contents of the `for of` loop,\n // it just skips the `for of` line.\n //\n\n /* istanbul ignore next */\n\n\n for (var _iterator2 = _createForOfIteratorHelperLoose(this.matchingFormats.slice()), _step2; !(_step2 = _iterator2()).done;) {\n var _ret = _loop();\n\n if (_ret === \"break\") break;\n if (_ret === \"continue\") continue;\n }\n\n if (!this.chosenFormat) {\n // No format matches the national (significant) phone number.\n this.resetFormat();\n }\n\n return this.chosenFormat;\n }\n }, {\n key: \"createTemplateForFormat\",\n value: function createTemplateForFormat(format, state) {\n // The formatter doesn't format numbers when numberPattern contains '|', e.g.\n // (20|3)\\d{4}. In those cases we quickly return.\n // (Though there's no such format in current metadata)\n\n /* istanbul ignore if */\n if (SUPPORT_LEGACY_FORMATTING_PATTERNS && format.pattern().indexOf('|') >= 0) {\n return;\n } // Get formatting template for this phone number format\n\n\n var template = this.getTemplateForFormat(format, state); // If the national number entered is too long\n // for any phone number format, then abort.\n\n if (template) {\n this.setNationalNumberTemplate(template, state);\n return true;\n }\n }\n }, {\n key: \"getSeparatorAfterNationalPrefix\",\n value: function getSeparatorAfterNationalPrefix(format) {\n // `US` metadata doesn't have a `national_prefix_formatting_rule`,\n // so the `if` condition below doesn't apply to `US`,\n // but in reality there shoudl be a separator\n // between a national prefix and a national (significant) number.\n // So `US` national prefix separator is a \"special\" \"hardcoded\" case.\n if (this.isNANP) {\n return ' ';\n } // If a `format` has a `national_prefix_formatting_rule`\n // and that rule has a separator after a national prefix,\n // then it means that there should be a separator\n // between a national prefix and a national (significant) number.\n\n\n if (format && format.nationalPrefixFormattingRule() && NATIONAL_PREFIX_SEPARATORS_PATTERN.test(format.nationalPrefixFormattingRule())) {\n return ' ';\n } // At this point, there seems to be no clear evidence that\n // there should be a separator between a national prefix\n // and a national (significant) number. So don't insert one.\n\n\n return '';\n }\n }, {\n key: \"getInternationalPrefixBeforeCountryCallingCode\",\n value: function getInternationalPrefixBeforeCountryCallingCode(_ref3, options) {\n var IDDPrefix = _ref3.IDDPrefix,\n missingPlus = _ref3.missingPlus;\n\n if (IDDPrefix) {\n return options && options.spacing === false ? IDDPrefix : IDDPrefix + ' ';\n }\n\n if (missingPlus) {\n return '';\n }\n\n return '+';\n }\n }, {\n key: \"getTemplate\",\n value: function getTemplate(state) {\n if (!this.template) {\n return;\n } // `this.template` holds the template for a \"complete\" phone number.\n // The currently entered phone number is most likely not \"complete\",\n // so trim all non-populated digits.\n\n\n var index = -1;\n var i = 0;\n var internationalPrefix = state.international ? this.getInternationalPrefixBeforeCountryCallingCode(state, {\n spacing: false\n }) : '';\n\n while (i < internationalPrefix.length + state.getDigitsWithoutInternationalPrefix().length) {\n index = this.template.indexOf(DIGIT_PLACEHOLDER, index + 1);\n i++;\n }\n\n return cutAndStripNonPairedParens(this.template, index + 1);\n }\n }, {\n key: \"setNationalNumberTemplate\",\n value: function setNationalNumberTemplate(template, state) {\n this.nationalNumberTemplate = template;\n this.populatedNationalNumberTemplate = template; // With a new formatting template, the matched position\n // using the old template needs to be reset.\n\n this.populatedNationalNumberTemplatePosition = -1; // For convenience, the public `.template` property\n // contains the whole international number\n // if the phone number being input is international:\n // 'x' for the '+' sign, 'x'es for the country phone code,\n // a spacebar and then the template for the formatted national number.\n\n if (state.international) {\n this.template = this.getInternationalPrefixBeforeCountryCallingCode(state).replace(/[\\d\\+]/g, DIGIT_PLACEHOLDER) + repeat(DIGIT_PLACEHOLDER, state.callingCode.length) + ' ' + template;\n } else {\n this.template = template;\n }\n }\n /**\r\n * Generates formatting template for a national phone number,\r\n * optionally containing a national prefix, for a format.\r\n * @param {Format} format\r\n * @param {string} nationalPrefix\r\n * @return {string}\r\n */\n\n }, {\n key: \"getTemplateForFormat\",\n value: function getTemplateForFormat(format, _ref4) {\n var nationalSignificantNumber = _ref4.nationalSignificantNumber,\n international = _ref4.international,\n nationalPrefix = _ref4.nationalPrefix,\n complexPrefixBeforeNationalSignificantNumber = _ref4.complexPrefixBeforeNationalSignificantNumber;\n var pattern = format.pattern();\n /* istanbul ignore else */\n\n if (SUPPORT_LEGACY_FORMATTING_PATTERNS) {\n pattern = pattern // Replace anything in the form of [..] with \\d\n .replace(CREATE_CHARACTER_CLASS_PATTERN(), '\\\\d') // Replace any standalone digit (not the one in `{}`) with \\d\n .replace(CREATE_STANDALONE_DIGIT_PATTERN(), '\\\\d');\n } // Generate a dummy national number (consisting of `9`s)\n // that fits this format's `pattern`.\n //\n // This match will always succeed,\n // because the \"longest dummy phone number\"\n // has enough length to accomodate any possible\n // national phone number format pattern.\n //\n\n\n var digits = LONGEST_DUMMY_PHONE_NUMBER.match(pattern)[0]; // If the national number entered is too long\n // for any phone number format, then abort.\n\n if (nationalSignificantNumber.length > digits.length) {\n return;\n } // Get a formatting template which can be used to efficiently format\n // a partial number where digits are added one by one.\n // Below `strictPattern` is used for the\n // regular expression (with `^` and `$`).\n // This wasn't originally in Google's `libphonenumber`\n // and I guess they don't really need it\n // because they're not using \"templates\" to format phone numbers\n // but I added `strictPattern` after encountering\n // South Korean phone number formatting bug.\n //\n // Non-strict regular expression bug demonstration:\n //\n // this.nationalSignificantNumber : `111111111` (9 digits)\n //\n // pattern : (\\d{2})(\\d{3,4})(\\d{4})\n // format : `$1 $2 $3`\n // digits : `9999999999` (10 digits)\n //\n // '9999999999'.replace(new RegExp(/(\\d{2})(\\d{3,4})(\\d{4})/g), '$1 $2 $3') = \"99 9999 9999\"\n //\n // template : xx xxxx xxxx\n //\n // But the correct template in this case is `xx xxx xxxx`.\n // The template was generated incorrectly because of the\n // `{3,4}` variability in the `pattern`.\n //\n // The fix is, if `this.nationalSignificantNumber` has already sufficient length\n // to satisfy the `pattern` completely then `this.nationalSignificantNumber`\n // is used instead of `digits`.\n\n\n var strictPattern = new RegExp('^' + pattern + '$');\n var nationalNumberDummyDigits = nationalSignificantNumber.replace(/\\d/g, DUMMY_DIGIT); // If `this.nationalSignificantNumber` has already sufficient length\n // to satisfy the `pattern` completely then use it\n // instead of `digits`.\n\n if (strictPattern.test(nationalNumberDummyDigits)) {\n digits = nationalNumberDummyDigits;\n }\n\n var numberFormat = this.getFormatFormat(format, international);\n var nationalPrefixIncludedInTemplate; // If a user did input a national prefix (and that's guaranteed),\n // and if a `format` does have a national prefix formatting rule,\n // then see if that national prefix formatting rule\n // prepends exactly the same national prefix the user has input.\n // If that's the case, then use the `format` with the national prefix formatting rule.\n // Otherwise, use the `format` without the national prefix formatting rule,\n // and prepend a national prefix manually to it.\n\n if (this.shouldTryNationalPrefixFormattingRule(format, {\n international: international,\n nationalPrefix: nationalPrefix\n })) {\n var numberFormatWithNationalPrefix = numberFormat.replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule()); // If `national_prefix_formatting_rule` of a `format` simply prepends\n // national prefix at the start of a national (significant) number,\n // then such formatting can be used with `AsYouType` formatter.\n // There seems to be no `else` case: everywhere in metadata,\n // national prefix formatting rule is national prefix + $1,\n // or `($1)`, in which case such format isn't even considered\n // when the user has input a national prefix.\n\n /* istanbul ignore else */\n\n if (parseDigits(format.nationalPrefixFormattingRule()) === (nationalPrefix || '') + parseDigits('$1')) {\n numberFormat = numberFormatWithNationalPrefix;\n nationalPrefixIncludedInTemplate = true; // Replace all digits of the national prefix in the formatting template\n // with `DIGIT_PLACEHOLDER`s.\n\n if (nationalPrefix) {\n var i = nationalPrefix.length;\n\n while (i > 0) {\n numberFormat = numberFormat.replace(/\\d/, DIGIT_PLACEHOLDER);\n i--;\n }\n }\n }\n } // Generate formatting template for this phone number format.\n\n\n var template = digits // Format the dummy phone number according to the format.\n .replace(new RegExp(pattern), numberFormat) // Replace each dummy digit with a DIGIT_PLACEHOLDER.\n .replace(new RegExp(DUMMY_DIGIT, 'g'), DIGIT_PLACEHOLDER); // If a prefix of a national (significant) number is not as simple\n // as just a basic national prefix, then just prepend such prefix\n // before the national (significant) number, optionally spacing\n // the two with a whitespace.\n\n if (!nationalPrefixIncludedInTemplate) {\n if (complexPrefixBeforeNationalSignificantNumber) {\n // Prepend the prefix to the template manually.\n template = repeat(DIGIT_PLACEHOLDER, complexPrefixBeforeNationalSignificantNumber.length) + ' ' + template;\n } else if (nationalPrefix) {\n // Prepend national prefix to the template manually.\n template = repeat(DIGIT_PLACEHOLDER, nationalPrefix.length) + this.getSeparatorAfterNationalPrefix(format) + template;\n }\n }\n\n if (international) {\n template = applyInternationalSeparatorStyle(template);\n }\n\n return template;\n }\n }, {\n key: \"formatNextNationalNumberDigits\",\n value: function formatNextNationalNumberDigits(digits) {\n var result = populateTemplateWithDigits(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition, digits);\n\n if (!result) {\n // Reset the format.\n this.resetFormat();\n return;\n }\n\n this.populatedNationalNumberTemplate = result[0];\n this.populatedNationalNumberTemplatePosition = result[1]; // Return the formatted phone number so far.\n\n return cutAndStripNonPairedParens(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition + 1); // The old way which was good for `input-format` but is not so good\n // for `react-phone-number-input`'s default input (`InputBasic`).\n // return closeNonPairedParens(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition + 1)\n // \t.replace(new RegExp(DIGIT_PLACEHOLDER, 'g'), ' ')\n }\n }, {\n key: \"shouldTryNationalPrefixFormattingRule\",\n value: function shouldTryNationalPrefixFormattingRule(format, _ref5) {\n var international = _ref5.international,\n nationalPrefix = _ref5.nationalPrefix;\n\n if (format.nationalPrefixFormattingRule()) {\n // In some countries, `national_prefix_formatting_rule` is `($1)`,\n // so it applies even if the user hasn't input a national prefix.\n // `format.usesNationalPrefix()` detects such cases.\n var usesNationalPrefix = format.usesNationalPrefix();\n\n if (usesNationalPrefix && nationalPrefix || !usesNationalPrefix && !international) {\n return true;\n }\n }\n }\n }]);\n\n return AsYouTypeFormatter;\n}();\n\nexport { AsYouTypeFormatter as default };","function _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();\n}\n\nfunction _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nfunction _iterableToArrayLimit(arr, i) {\n var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"];\n\n if (_i == null) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n\n var _s, _e;\n\n try {\n for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nfunction _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}\n\nimport _extractCountryCallingCode from './helpers/extractCountryCallingCode.js';\nimport extractCountryCallingCodeFromInternationalNumberWithoutPlusSign from './helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js';\nimport extractNationalNumberFromPossiblyIncompleteNumber from './helpers/extractNationalNumberFromPossiblyIncompleteNumber.js';\nimport stripIddPrefix from './helpers/stripIddPrefix.js';\nimport parseDigits from './helpers/parseDigits.js';\nimport { VALID_DIGITS, VALID_PUNCTUATION, PLUS_CHARS } from './constants.js';\nvar VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART = '[' + VALID_PUNCTUATION + VALID_DIGITS + ']+';\nvar VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART_PATTERN = new RegExp('^' + VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART + '$', 'i');\nvar VALID_FORMATTED_PHONE_NUMBER_PART = '(?:' + '[' + PLUS_CHARS + ']' + '[' + VALID_PUNCTUATION + VALID_DIGITS + ']*' + '|' + '[' + VALID_PUNCTUATION + VALID_DIGITS + ']+' + ')';\nvar AFTER_PHONE_NUMBER_DIGITS_END_PATTERN = new RegExp('[^' + VALID_PUNCTUATION + VALID_DIGITS + ']+' + '.*' + '$'); // Tests whether `national_prefix_for_parsing` could match\n// different national prefixes.\n// Matches anything that's not a digit or a square bracket.\n\nvar COMPLEX_NATIONAL_PREFIX = /[^\\d\\[\\]]/;\n\nvar AsYouTypeParser = /*#__PURE__*/function () {\n function AsYouTypeParser(_ref) {\n var defaultCountry = _ref.defaultCountry,\n defaultCallingCode = _ref.defaultCallingCode,\n metadata = _ref.metadata,\n onNationalSignificantNumberChange = _ref.onNationalSignificantNumberChange;\n\n _classCallCheck(this, AsYouTypeParser);\n\n this.defaultCountry = defaultCountry;\n this.defaultCallingCode = defaultCallingCode;\n this.metadata = metadata;\n this.onNationalSignificantNumberChange = onNationalSignificantNumberChange;\n }\n\n _createClass(AsYouTypeParser, [{\n key: \"input\",\n value: function input(text, state) {\n var _extractFormattedDigi = extractFormattedDigitsAndPlus(text),\n _extractFormattedDigi2 = _slicedToArray(_extractFormattedDigi, 2),\n formattedDigits = _extractFormattedDigi2[0],\n hasPlus = _extractFormattedDigi2[1];\n\n var digits = parseDigits(formattedDigits); // Checks for a special case: just a leading `+` has been entered.\n\n var justLeadingPlus;\n\n if (hasPlus) {\n if (!state.digits) {\n state.startInternationalNumber();\n\n if (!digits) {\n justLeadingPlus = true;\n }\n }\n }\n\n if (digits) {\n this.inputDigits(digits, state);\n }\n\n return {\n digits: digits,\n justLeadingPlus: justLeadingPlus\n };\n }\n /**\r\n * Inputs \"next\" phone number digits.\r\n * @param {string} digits\r\n * @return {string} [formattedNumber] Formatted national phone number (if it can be formatted at this stage). Returning `undefined` means \"don't format the national phone number at this stage\".\r\n */\n\n }, {\n key: \"inputDigits\",\n value: function inputDigits(nextDigits, state) {\n var digits = state.digits;\n var hasReceivedThreeLeadingDigits = digits.length < 3 && digits.length + nextDigits.length >= 3; // Append phone number digits.\n\n state.appendDigits(nextDigits); // Attempt to extract IDD prefix:\n // Some users input their phone number in international format,\n // but in an \"out-of-country\" dialing format instead of using the leading `+`.\n // https://github.com/catamphetamine/libphonenumber-js/issues/185\n // Detect such numbers as soon as there're at least 3 digits.\n // Google's library attempts to extract IDD prefix at 3 digits,\n // so this library just copies that behavior.\n // I guess that's because the most commot IDD prefixes are\n // `00` (Europe) and `011` (US).\n // There exist really long IDD prefixes too:\n // for example, in Australia the default IDD prefix is `0011`,\n // and it could even be as long as `14880011`.\n // An IDD prefix is extracted here, and then every time when\n // there's a new digit and the number couldn't be formatted.\n\n if (hasReceivedThreeLeadingDigits) {\n this.extractIddPrefix(state);\n }\n\n if (this.isWaitingForCountryCallingCode(state)) {\n if (!this.extractCountryCallingCode(state)) {\n return;\n }\n } else {\n state.appendNationalSignificantNumberDigits(nextDigits);\n } // If a phone number is being input in international format,\n // then it's not valid for it to have a national prefix.\n // Still, some people incorrectly input such numbers with a national prefix.\n // In such cases, only attempt to strip a national prefix if the number becomes too long.\n // (but that is done later, not here)\n\n\n if (!state.international) {\n if (!this.hasExtractedNationalSignificantNumber) {\n this.extractNationalSignificantNumber(state.getNationalDigits(), function (stateUpdate) {\n return state.update(stateUpdate);\n });\n }\n }\n }\n }, {\n key: \"isWaitingForCountryCallingCode\",\n value: function isWaitingForCountryCallingCode(_ref2) {\n var international = _ref2.international,\n callingCode = _ref2.callingCode;\n return international && !callingCode;\n } // Extracts a country calling code from a number\n // being entered in internatonal format.\n\n }, {\n key: \"extractCountryCallingCode\",\n value: function extractCountryCallingCode(state) {\n var _extractCountryCallin = _extractCountryCallingCode('+' + state.getDigitsWithoutInternationalPrefix(), this.defaultCountry, this.defaultCallingCode, this.metadata.metadata),\n countryCallingCode = _extractCountryCallin.countryCallingCode,\n number = _extractCountryCallin.number;\n\n if (countryCallingCode) {\n state.setCallingCode(countryCallingCode);\n state.update({\n nationalSignificantNumber: number\n });\n return true;\n }\n }\n }, {\n key: \"reset\",\n value: function reset(numberingPlan) {\n if (numberingPlan) {\n this.hasSelectedNumberingPlan = true;\n\n var nationalPrefixForParsing = numberingPlan._nationalPrefixForParsing();\n\n this.couldPossiblyExtractAnotherNationalSignificantNumber = nationalPrefixForParsing && COMPLEX_NATIONAL_PREFIX.test(nationalPrefixForParsing);\n } else {\n this.hasSelectedNumberingPlan = undefined;\n this.couldPossiblyExtractAnotherNationalSignificantNumber = undefined;\n }\n }\n /**\r\n * Extracts a national (significant) number from user input.\r\n * Google's library is different in that it only applies `national_prefix_for_parsing`\r\n * and doesn't apply `national_prefix_transform_rule` after that.\r\n * https://github.com/google/libphonenumber/blob/a3d70b0487875475e6ad659af404943211d26456/java/libphonenumber/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java#L539\r\n * @return {boolean} [extracted]\r\n */\n\n }, {\n key: \"extractNationalSignificantNumber\",\n value: function extractNationalSignificantNumber(nationalDigits, setState) {\n if (!this.hasSelectedNumberingPlan) {\n return;\n }\n\n var _extractNationalNumbe = extractNationalNumberFromPossiblyIncompleteNumber(nationalDigits, this.metadata),\n nationalPrefix = _extractNationalNumbe.nationalPrefix,\n nationalNumber = _extractNationalNumbe.nationalNumber,\n carrierCode = _extractNationalNumbe.carrierCode;\n\n if (nationalNumber === nationalDigits) {\n return;\n }\n\n this.onExtractedNationalNumber(nationalPrefix, carrierCode, nationalNumber, nationalDigits, setState);\n return true;\n }\n /**\r\n * In Google's code this function is called \"attempt to extract longer NDD\".\r\n * \"Some national prefixes are a substring of others\", they say.\r\n * @return {boolean} [result] — Returns `true` if extracting a national prefix produced different results from what they were.\r\n */\n\n }, {\n key: \"extractAnotherNationalSignificantNumber\",\n value: function extractAnotherNationalSignificantNumber(nationalDigits, prevNationalSignificantNumber, setState) {\n if (!this.hasExtractedNationalSignificantNumber) {\n return this.extractNationalSignificantNumber(nationalDigits, setState);\n }\n\n if (!this.couldPossiblyExtractAnotherNationalSignificantNumber) {\n return;\n }\n\n var _extractNationalNumbe2 = extractNationalNumberFromPossiblyIncompleteNumber(nationalDigits, this.metadata),\n nationalPrefix = _extractNationalNumbe2.nationalPrefix,\n nationalNumber = _extractNationalNumbe2.nationalNumber,\n carrierCode = _extractNationalNumbe2.carrierCode; // If a national prefix has been extracted previously,\n // then it's always extracted as additional digits are added.\n // That's assuming `extractNationalNumberFromPossiblyIncompleteNumber()`\n // doesn't do anything different from what it currently does.\n // So, just in case, here's this check, though it doesn't occur.\n\n /* istanbul ignore if */\n\n\n if (nationalNumber === prevNationalSignificantNumber) {\n return;\n }\n\n this.onExtractedNationalNumber(nationalPrefix, carrierCode, nationalNumber, nationalDigits, setState);\n return true;\n }\n }, {\n key: \"onExtractedNationalNumber\",\n value: function onExtractedNationalNumber(nationalPrefix, carrierCode, nationalSignificantNumber, nationalDigits, setState) {\n var complexPrefixBeforeNationalSignificantNumber;\n var nationalSignificantNumberMatchesInput; // This check also works with empty `this.nationalSignificantNumber`.\n\n var nationalSignificantNumberIndex = nationalDigits.lastIndexOf(nationalSignificantNumber); // If the extracted national (significant) number is the\n // last substring of the `digits`, then it means that it hasn't been altered:\n // no digits have been removed from the national (significant) number\n // while applying `national_prefix_transform_rule`.\n // https://gitlab.com/catamphetamine/libphonenumber-js/-/blob/master/METADATA.md#national_prefix_for_parsing--national_prefix_transform_rule\n\n if (nationalSignificantNumberIndex >= 0 && nationalSignificantNumberIndex === nationalDigits.length - nationalSignificantNumber.length) {\n nationalSignificantNumberMatchesInput = true; // If a prefix of a national (significant) number is not as simple\n // as just a basic national prefix, then such prefix is stored in\n // `this.complexPrefixBeforeNationalSignificantNumber` property and will be\n // prepended \"as is\" to the national (significant) number to produce\n // a formatted result.\n\n var prefixBeforeNationalNumber = nationalDigits.slice(0, nationalSignificantNumberIndex); // `prefixBeforeNationalNumber` is always non-empty,\n // because `onExtractedNationalNumber()` isn't called\n // when a national (significant) number hasn't been actually \"extracted\":\n // when a national (significant) number is equal to the national part of `digits`,\n // then `onExtractedNationalNumber()` doesn't get called.\n\n if (prefixBeforeNationalNumber !== nationalPrefix) {\n complexPrefixBeforeNationalSignificantNumber = prefixBeforeNationalNumber;\n }\n }\n\n setState({\n nationalPrefix: nationalPrefix,\n carrierCode: carrierCode,\n nationalSignificantNumber: nationalSignificantNumber,\n nationalSignificantNumberMatchesInput: nationalSignificantNumberMatchesInput,\n complexPrefixBeforeNationalSignificantNumber: complexPrefixBeforeNationalSignificantNumber\n }); // `onExtractedNationalNumber()` is only called when\n // the national (significant) number actually did change.\n\n this.hasExtractedNationalSignificantNumber = true;\n this.onNationalSignificantNumberChange();\n }\n }, {\n key: \"reExtractNationalSignificantNumber\",\n value: function reExtractNationalSignificantNumber(state) {\n // Attempt to extract a national prefix.\n //\n // Some people incorrectly input national prefix\n // in an international phone number.\n // For example, some people write British phone numbers as `+44(0)...`.\n //\n // Also, in some rare cases, it is valid for a national prefix\n // to be a part of an international phone number.\n // For example, mobile phone numbers in Mexico are supposed to be\n // dialled internationally using a `1` national prefix,\n // so the national prefix will be part of an international number.\n //\n // Quote from:\n // https://www.mexperience.com/dialing-cell-phones-in-mexico/\n //\n // \"Dialing a Mexican cell phone from abroad\n // When you are calling a cell phone number in Mexico from outside Mexico,\n // it’s necessary to dial an additional “1” after Mexico’s country code\n // (which is “52”) and before the area code.\n // You also ignore the 045, and simply dial the area code and the\n // cell phone’s number.\n //\n // If you don’t add the “1”, you’ll receive a recorded announcement\n // asking you to redial using it.\n //\n // For example, if you are calling from the USA to a cell phone\n // in Mexico City, you would dial +52 – 1 – 55 – 1234 5678.\n // (Note that this is different to calling a land line in Mexico City\n // from abroad, where the number dialed would be +52 – 55 – 1234 5678)\".\n //\n // Google's demo output:\n // https://libphonenumber.appspot.com/phonenumberparser?number=%2b5215512345678&country=MX\n //\n if (this.extractAnotherNationalSignificantNumber(state.getNationalDigits(), state.nationalSignificantNumber, function (stateUpdate) {\n return state.update(stateUpdate);\n })) {\n return true;\n } // If no format matches the phone number, then it could be\n // \"a really long IDD\" (quote from a comment in Google's library).\n // An IDD prefix is first extracted when the user has entered at least 3 digits,\n // and then here — every time when there's a new digit and the number\n // couldn't be formatted.\n // For example, in Australia the default IDD prefix is `0011`,\n // and it could even be as long as `14880011`.\n //\n // Could also check `!hasReceivedThreeLeadingDigits` here\n // to filter out the case when this check duplicates the one\n // already performed when there're 3 leading digits,\n // but it's not a big deal, and in most cases there\n // will be a suitable `format` when there're 3 leading digits.\n //\n\n\n if (this.extractIddPrefix(state)) {\n this.extractCallingCodeAndNationalSignificantNumber(state);\n return true;\n } // Google's AsYouType formatter supports sort of an \"autocorrection\" feature\n // when it \"autocorrects\" numbers that have been input for a country\n // with that country's calling code.\n // Such \"autocorrection\" feature looks weird, but different people have been requesting it:\n // https://github.com/catamphetamine/libphonenumber-js/issues/376\n // https://github.com/catamphetamine/libphonenumber-js/issues/375\n // https://github.com/catamphetamine/libphonenumber-js/issues/316\n\n\n if (this.fixMissingPlus(state)) {\n this.extractCallingCodeAndNationalSignificantNumber(state);\n return true;\n }\n }\n }, {\n key: \"extractIddPrefix\",\n value: function extractIddPrefix(state) {\n // An IDD prefix can't be present in a number written with a `+`.\n // Also, don't re-extract an IDD prefix if has already been extracted.\n var international = state.international,\n IDDPrefix = state.IDDPrefix,\n digits = state.digits,\n nationalSignificantNumber = state.nationalSignificantNumber;\n\n if (international || IDDPrefix) {\n return;\n } // Some users input their phone number in \"out-of-country\"\n // dialing format instead of using the leading `+`.\n // https://github.com/catamphetamine/libphonenumber-js/issues/185\n // Detect such numbers.\n\n\n var numberWithoutIDD = stripIddPrefix(digits, this.defaultCountry, this.defaultCallingCode, this.metadata.metadata);\n\n if (numberWithoutIDD !== undefined && numberWithoutIDD !== digits) {\n // If an IDD prefix was stripped then convert the IDD-prefixed number\n // to international number for subsequent parsing.\n state.update({\n IDDPrefix: digits.slice(0, digits.length - numberWithoutIDD.length)\n });\n this.startInternationalNumber(state, {\n country: undefined,\n callingCode: undefined\n });\n return true;\n }\n }\n }, {\n key: \"fixMissingPlus\",\n value: function fixMissingPlus(state) {\n if (!state.international) {\n var _extractCountryCallin2 = extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(state.digits, this.defaultCountry, this.defaultCallingCode, this.metadata.metadata),\n newCallingCode = _extractCountryCallin2.countryCallingCode,\n number = _extractCountryCallin2.number;\n\n if (newCallingCode) {\n state.update({\n missingPlus: true\n });\n this.startInternationalNumber(state, {\n country: state.country,\n callingCode: newCallingCode\n });\n return true;\n }\n }\n }\n }, {\n key: \"startInternationalNumber\",\n value: function startInternationalNumber(state, _ref3) {\n var country = _ref3.country,\n callingCode = _ref3.callingCode;\n state.startInternationalNumber(country, callingCode); // If a national (significant) number has been extracted before, reset it.\n\n if (state.nationalSignificantNumber) {\n state.resetNationalSignificantNumber();\n this.onNationalSignificantNumberChange();\n this.hasExtractedNationalSignificantNumber = undefined;\n }\n }\n }, {\n key: \"extractCallingCodeAndNationalSignificantNumber\",\n value: function extractCallingCodeAndNationalSignificantNumber(state) {\n if (this.extractCountryCallingCode(state)) {\n // `this.extractCallingCode()` is currently called when the number\n // couldn't be formatted during the standard procedure.\n // Normally, the national prefix would be re-extracted\n // for an international number if such number couldn't be formatted,\n // but since it's already not able to be formatted,\n // there won't be yet another retry, so also extract national prefix here.\n this.extractNationalSignificantNumber(state.getNationalDigits(), function (stateUpdate) {\n return state.update(stateUpdate);\n });\n }\n }\n }]);\n\n return AsYouTypeParser;\n}();\n/**\r\n * Extracts formatted phone number from text (if there's any).\r\n * @param {string} text\r\n * @return {string} [formattedPhoneNumber]\r\n */\n\n\nexport { AsYouTypeParser as default };\n\nfunction extractFormattedPhoneNumber(text) {\n // Attempt to extract a possible number from the string passed in.\n var startsAt = text.search(VALID_FORMATTED_PHONE_NUMBER_PART);\n\n if (startsAt < 0) {\n return;\n } // Trim everything to the left of the phone number.\n\n\n text = text.slice(startsAt); // Trim the `+`.\n\n var hasPlus;\n\n if (text[0] === '+') {\n hasPlus = true;\n text = text.slice('+'.length);\n } // Trim everything to the right of the phone number.\n\n\n text = text.replace(AFTER_PHONE_NUMBER_DIGITS_END_PATTERN, ''); // Re-add the previously trimmed `+`.\n\n if (hasPlus) {\n text = '+' + text;\n }\n\n return text;\n}\n/**\r\n * Extracts formatted phone number digits (and a `+`) from text (if there're any).\r\n * @param {string} text\r\n * @return {any[]}\r\n */\n\n\nfunction _extractFormattedDigitsAndPlus(text) {\n // Extract a formatted phone number part from text.\n var extractedNumber = extractFormattedPhoneNumber(text) || ''; // Trim a `+`.\n\n if (extractedNumber[0] === '+') {\n return [extractedNumber.slice('+'.length), true];\n }\n\n return [extractedNumber];\n}\n/**\r\n * Extracts formatted phone number digits (and a `+`) from text (if there're any).\r\n * @param {string} text\r\n * @return {any[]}\r\n */\n\n\nexport function extractFormattedDigitsAndPlus(text) {\n var _extractFormattedDigi3 = _extractFormattedDigitsAndPlus(text),\n _extractFormattedDigi4 = _slicedToArray(_extractFormattedDigi3, 2),\n formattedDigits = _extractFormattedDigi4[0],\n hasPlus = _extractFormattedDigi4[1]; // If the extracted phone number part\n // can possibly be a part of some valid phone number\n // then parse phone number characters from a formatted phone number.\n\n\n if (!VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART_PATTERN.test(formattedDigits)) {\n formattedDigits = '';\n }\n\n return [formattedDigits, hasPlus];\n}","function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, _typeof(obj);\n}\n\nfunction _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();\n}\n\nfunction _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nfunction _iterableToArrayLimit(arr, i) {\n var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"];\n\n if (_i == null) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n\n var _s, _e;\n\n try {\n for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nfunction _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}\n\nimport Metadata from './metadata.js';\nimport PhoneNumber from './PhoneNumber.js';\nimport AsYouTypeState from './AsYouTypeState.js';\nimport AsYouTypeFormatter, { DIGIT_PLACEHOLDER } from './AsYouTypeFormatter.js';\nimport AsYouTypeParser, { extractFormattedDigitsAndPlus } from './AsYouTypeParser.js';\nimport getCountryByCallingCode from './helpers/getCountryByCallingCode.js';\nvar USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;\n\nvar AsYouType = /*#__PURE__*/function () {\n /**\r\n * @param {(string|object)?} [optionsOrDefaultCountry] - The default country used for parsing non-international phone numbers. Can also be an `options` object.\r\n * @param {Object} metadata\r\n */\n function AsYouType(optionsOrDefaultCountry, metadata) {\n _classCallCheck(this, AsYouType);\n\n this.metadata = new Metadata(metadata);\n\n var _this$getCountryAndCa = this.getCountryAndCallingCode(optionsOrDefaultCountry),\n _this$getCountryAndCa2 = _slicedToArray(_this$getCountryAndCa, 2),\n defaultCountry = _this$getCountryAndCa2[0],\n defaultCallingCode = _this$getCountryAndCa2[1];\n\n this.defaultCountry = defaultCountry;\n this.defaultCallingCode = defaultCallingCode;\n this.reset();\n }\n\n _createClass(AsYouType, [{\n key: \"getCountryAndCallingCode\",\n value: function getCountryAndCallingCode(optionsOrDefaultCountry) {\n // Set `defaultCountry` and `defaultCallingCode` options.\n var defaultCountry;\n var defaultCallingCode; // Turns out `null` also has type \"object\". Weird.\n\n if (optionsOrDefaultCountry) {\n if (_typeof(optionsOrDefaultCountry) === 'object') {\n defaultCountry = optionsOrDefaultCountry.defaultCountry;\n defaultCallingCode = optionsOrDefaultCountry.defaultCallingCode;\n } else {\n defaultCountry = optionsOrDefaultCountry;\n }\n }\n\n if (defaultCountry && !this.metadata.hasCountry(defaultCountry)) {\n defaultCountry = undefined;\n }\n\n if (defaultCallingCode) {\n /* istanbul ignore if */\n if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\n if (this.metadata.isNonGeographicCallingCode(defaultCallingCode)) {\n defaultCountry = '001';\n }\n }\n }\n\n return [defaultCountry, defaultCallingCode];\n }\n /**\r\n * Inputs \"next\" phone number characters.\r\n * @param {string} text\r\n * @return {string} Formatted phone number characters that have been input so far.\r\n */\n\n }, {\n key: \"input\",\n value: function input(text) {\n var _this$parser$input = this.parser.input(text, this.state),\n digits = _this$parser$input.digits,\n justLeadingPlus = _this$parser$input.justLeadingPlus;\n\n if (justLeadingPlus) {\n this.formattedOutput = '+';\n } else if (digits) {\n this.determineTheCountryIfNeeded(); // Match the available formats by the currently available leading digits.\n\n if (this.state.nationalSignificantNumber) {\n this.formatter.narrowDownMatchingFormats(this.state);\n }\n\n var formattedNationalNumber;\n\n if (this.metadata.hasSelectedNumberingPlan()) {\n formattedNationalNumber = this.formatter.format(digits, this.state);\n }\n\n if (formattedNationalNumber === undefined) {\n // See if another national (significant) number could be re-extracted.\n if (this.parser.reExtractNationalSignificantNumber(this.state)) {\n this.determineTheCountryIfNeeded(); // If it could, then re-try formatting the new national (significant) number.\n\n var nationalDigits = this.state.getNationalDigits();\n\n if (nationalDigits) {\n formattedNationalNumber = this.formatter.format(nationalDigits, this.state);\n }\n }\n }\n\n this.formattedOutput = formattedNationalNumber ? this.getFullNumber(formattedNationalNumber) : this.getNonFormattedNumber();\n }\n\n return this.formattedOutput;\n }\n }, {\n key: \"reset\",\n value: function reset() {\n var _this = this;\n\n this.state = new AsYouTypeState({\n onCountryChange: function onCountryChange(country) {\n // Before version `1.6.0`, the official `AsYouType` formatter API\n // included the `.country` property of an `AsYouType` instance.\n // Since that property (along with the others) have been moved to\n // `this.state`, `this.country` property is emulated for compatibility\n // with the old versions.\n _this.country = country;\n },\n onCallingCodeChange: function onCallingCodeChange(callingCode, country) {\n _this.metadata.selectNumberingPlan(country, callingCode);\n\n _this.formatter.reset(_this.metadata.numberingPlan, _this.state);\n\n _this.parser.reset(_this.metadata.numberingPlan);\n }\n });\n this.formatter = new AsYouTypeFormatter({\n state: this.state,\n metadata: this.metadata\n });\n this.parser = new AsYouTypeParser({\n defaultCountry: this.defaultCountry,\n defaultCallingCode: this.defaultCallingCode,\n metadata: this.metadata,\n state: this.state,\n onNationalSignificantNumberChange: function onNationalSignificantNumberChange() {\n _this.determineTheCountryIfNeeded();\n\n _this.formatter.reset(_this.metadata.numberingPlan, _this.state);\n }\n });\n this.state.reset(this.defaultCountry, this.defaultCallingCode);\n this.formattedOutput = '';\n return this;\n }\n /**\r\n * Returns `true` if the phone number is being input in international format.\r\n * In other words, returns `true` if and only if the parsed phone number starts with a `\"+\"`.\r\n * @return {boolean}\r\n */\n\n }, {\n key: \"isInternational\",\n value: function isInternational() {\n return this.state.international;\n }\n /**\r\n * Returns the \"calling code\" part of the phone number when it's being input\r\n * in an international format.\r\n * If no valid calling code has been entered so far, returns `undefined`.\r\n * @return {string} [callingCode]\r\n */\n\n }, {\n key: \"getCallingCode\",\n value: function getCallingCode() {\n // If the number is being input in national format and some \"default calling code\"\n // has been passed to `AsYouType` constructor, then `this.state.callingCode`\n // is equal to that \"default calling code\".\n //\n // If the number is being input in national format and no \"default calling code\"\n // has been passed to `AsYouType` constructor, then returns `undefined`,\n // even if a \"default country\" has been passed to `AsYouType` constructor.\n //\n if (this.isInternational()) {\n return this.state.callingCode;\n }\n } // A legacy alias.\n\n }, {\n key: \"getCountryCallingCode\",\n value: function getCountryCallingCode() {\n return this.getCallingCode();\n }\n /**\r\n * Returns a two-letter country code of the phone number.\r\n * Returns `undefined` for \"non-geographic\" phone numbering plans.\r\n * Returns `undefined` if no phone number has been input yet.\r\n * @return {string} [country]\r\n */\n\n }, {\n key: \"getCountry\",\n value: function getCountry() {\n var digits = this.state.digits; // Return `undefined` if no digits have been input yet.\n\n if (digits) {\n return this._getCountry();\n }\n }\n /**\r\n * Returns a two-letter country code of the phone number.\r\n * Returns `undefined` for \"non-geographic\" phone numbering plans.\r\n * @return {string} [country]\r\n */\n\n }, {\n key: \"_getCountry\",\n value: function _getCountry() {\n var country = this.state.country;\n /* istanbul ignore if */\n\n if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\n // `AsYouType.getCountry()` returns `undefined`\n // for \"non-geographic\" phone numbering plans.\n if (country === '001') {\n return;\n }\n }\n\n return country;\n }\n }, {\n key: \"determineTheCountryIfNeeded\",\n value: function determineTheCountryIfNeeded() {\n // Suppose a user enters a phone number in international format,\n // and there're several countries corresponding to that country calling code,\n // and a country has been derived from the number, and then\n // a user enters one more digit and the number is no longer\n // valid for the derived country, so the country should be re-derived\n // on every new digit in those cases.\n //\n // If the phone number is being input in national format,\n // then it could be a case when `defaultCountry` wasn't specified\n // when creating `AsYouType` instance, and just `defaultCallingCode` was specified,\n // and that \"calling code\" could correspond to a \"non-geographic entity\",\n // or there could be several countries corresponding to that country calling code.\n // In those cases, `this.country` is `undefined` and should be derived\n // from the number. Again, if country calling code is ambiguous, then\n // `this.country` should be re-derived with each new digit.\n //\n if (!this.state.country || this.isCountryCallingCodeAmbiguous()) {\n this.determineTheCountry();\n }\n } // Prepends `+CountryCode ` in case of an international phone number\n\n }, {\n key: \"getFullNumber\",\n value: function getFullNumber(formattedNationalNumber) {\n var _this2 = this;\n\n if (this.isInternational()) {\n var prefix = function prefix(text) {\n return _this2.formatter.getInternationalPrefixBeforeCountryCallingCode(_this2.state, {\n spacing: text ? true : false\n }) + text;\n };\n\n var callingCode = this.state.callingCode;\n\n if (!callingCode) {\n return prefix(\"\".concat(this.state.getDigitsWithoutInternationalPrefix()));\n }\n\n if (!formattedNationalNumber) {\n return prefix(callingCode);\n }\n\n return prefix(\"\".concat(callingCode, \" \").concat(formattedNationalNumber));\n }\n\n return formattedNationalNumber;\n }\n }, {\n key: \"getNonFormattedNationalNumberWithPrefix\",\n value: function getNonFormattedNationalNumberWithPrefix() {\n var _this$state = this.state,\n nationalSignificantNumber = _this$state.nationalSignificantNumber,\n complexPrefixBeforeNationalSignificantNumber = _this$state.complexPrefixBeforeNationalSignificantNumber,\n nationalPrefix = _this$state.nationalPrefix;\n var number = nationalSignificantNumber;\n var prefix = complexPrefixBeforeNationalSignificantNumber || nationalPrefix;\n\n if (prefix) {\n number = prefix + number;\n }\n\n return number;\n }\n }, {\n key: \"getNonFormattedNumber\",\n value: function getNonFormattedNumber() {\n var nationalSignificantNumberMatchesInput = this.state.nationalSignificantNumberMatchesInput;\n return this.getFullNumber(nationalSignificantNumberMatchesInput ? this.getNonFormattedNationalNumberWithPrefix() : this.state.getNationalDigits());\n }\n }, {\n key: \"getNonFormattedTemplate\",\n value: function getNonFormattedTemplate() {\n var number = this.getNonFormattedNumber();\n\n if (number) {\n return number.replace(/[\\+\\d]/g, DIGIT_PLACEHOLDER);\n }\n }\n }, {\n key: \"isCountryCallingCodeAmbiguous\",\n value: function isCountryCallingCodeAmbiguous() {\n var callingCode = this.state.callingCode;\n var countryCodes = this.metadata.getCountryCodesForCallingCode(callingCode);\n return countryCodes && countryCodes.length > 1;\n } // Determines the country of the phone number\n // entered so far based on the country phone code\n // and the national phone number.\n\n }, {\n key: \"determineTheCountry\",\n value: function determineTheCountry() {\n this.state.setCountry(getCountryByCallingCode(this.isInternational() ? this.state.callingCode : this.defaultCallingCode, this.state.nationalSignificantNumber, this.metadata));\n }\n /**\r\n * Returns a E.164 phone number value for the user's input.\r\n *\r\n * For example, for country `\"US\"` and input `\"(222) 333-4444\"`\r\n * it will return `\"+12223334444\"`.\r\n *\r\n * For international phone number input, it will also auto-correct\r\n * some minor errors such as using a national prefix when writing\r\n * an international phone number. For example, if the user inputs\r\n * `\"+44 0 7400 000000\"` then it will return an auto-corrected\r\n * `\"+447400000000\"` phone number value.\r\n *\r\n * Will return `undefined` if no digits have been input,\r\n * or when inputting a phone number in national format and no\r\n * default country or default \"country calling code\" have been set.\r\n *\r\n * @return {string} [value]\r\n */\n\n }, {\n key: \"getNumberValue\",\n value: function getNumberValue() {\n var _this$state2 = this.state,\n digits = _this$state2.digits,\n callingCode = _this$state2.callingCode,\n country = _this$state2.country,\n nationalSignificantNumber = _this$state2.nationalSignificantNumber; // Will return `undefined` if no digits have been input.\n\n if (!digits) {\n return;\n }\n\n if (this.isInternational()) {\n if (callingCode) {\n return '+' + callingCode + nationalSignificantNumber;\n } else {\n return '+' + digits;\n }\n } else {\n if (country || callingCode) {\n var callingCode_ = country ? this.metadata.countryCallingCode() : callingCode;\n return '+' + callingCode_ + nationalSignificantNumber;\n }\n }\n }\n /**\r\n * Returns an instance of `PhoneNumber` class.\r\n * Will return `undefined` if no national (significant) number\r\n * digits have been entered so far, or if no `defaultCountry` has been\r\n * set and the user enters a phone number not in international format.\r\n */\n\n }, {\n key: \"getNumber\",\n value: function getNumber() {\n var _this$state3 = this.state,\n nationalSignificantNumber = _this$state3.nationalSignificantNumber,\n carrierCode = _this$state3.carrierCode,\n callingCode = _this$state3.callingCode; // `this._getCountry()` is basically same as `this.state.country`\n // with the only change that it return `undefined` in case of a\n // \"non-geographic\" numbering plan instead of `\"001\"` \"internal use\" value.\n\n var country = this._getCountry();\n\n if (!nationalSignificantNumber) {\n return;\n }\n\n if (!country && !callingCode) {\n return;\n }\n\n var phoneNumber = new PhoneNumber(country || callingCode, nationalSignificantNumber, this.metadata.metadata);\n\n if (carrierCode) {\n phoneNumber.carrierCode = carrierCode;\n } // Phone number extensions are not supported by \"As You Type\" formatter.\n\n\n return phoneNumber;\n }\n /**\r\n * Returns `true` if the phone number is \"possible\".\r\n * Is just a shortcut for `PhoneNumber.isPossible()`.\r\n * @return {boolean}\r\n */\n\n }, {\n key: \"isPossible\",\n value: function isPossible() {\n var phoneNumber = this.getNumber();\n\n if (!phoneNumber) {\n return false;\n }\n\n return phoneNumber.isPossible();\n }\n /**\r\n * Returns `true` if the phone number is \"valid\".\r\n * Is just a shortcut for `PhoneNumber.isValid()`.\r\n * @return {boolean}\r\n */\n\n }, {\n key: \"isValid\",\n value: function isValid() {\n var phoneNumber = this.getNumber();\n\n if (!phoneNumber) {\n return false;\n }\n\n return phoneNumber.isValid();\n }\n /**\r\n * @deprecated\r\n * This method is used in `react-phone-number-input/source/input-control.js`\r\n * in versions before `3.0.16`.\r\n */\n\n }, {\n key: \"getNationalNumber\",\n value: function getNationalNumber() {\n return this.state.nationalSignificantNumber;\n }\n /**\r\n * Returns the phone number characters entered by the user.\r\n * @return {string}\r\n */\n\n }, {\n key: \"getChars\",\n value: function getChars() {\n return (this.state.international ? '+' : '') + this.state.digits;\n }\n /**\r\n * Returns the template for the formatted phone number.\r\n * @return {string}\r\n */\n\n }, {\n key: \"getTemplate\",\n value: function getTemplate() {\n return this.formatter.getTemplate(this.state) || this.getNonFormattedTemplate() || '';\n }\n }]);\n\n return AsYouType;\n}();\n\nexport { AsYouType as default };","import { getCountryCallingCode } from 'libphonenumber-js/core';\nexport function getInputValuePrefix(_ref) {\n var country = _ref.country,\n international = _ref.international,\n withCountryCallingCode = _ref.withCountryCallingCode,\n metadata = _ref.metadata;\n return country && international && !withCountryCallingCode ? \"+\".concat(getCountryCallingCode(country, metadata)) : '';\n}\nexport function removeInputValuePrefix(value, prefix) {\n if (prefix) {\n value = value.slice(prefix.length);\n\n if (value[0] === ' ') {\n value = value.slice(1);\n }\n }\n\n return value;\n}","var _excluded = [\"country\", \"international\", \"withCountryCallingCode\", \"metadata\"];\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nimport React, { useCallback } from 'react';\nimport Input from 'input-format/react';\nimport { AsYouType, parsePhoneNumberCharacter } from 'libphonenumber-js/core';\nimport { getInputValuePrefix, removeInputValuePrefix } from './helpers/inputValuePrefix.js';\nexport function createInput(defaultMetadata) {\n /**\r\n * `InputSmart` is a \"smarter\" implementation of a `Component`\r\n * that can be passed to ``. It parses and formats\r\n * the user's and maintains the caret's position in the process.\r\n * The caret positioning is maintained using `input-format` library.\r\n * Relies on being run in a DOM environment for calling caret positioning functions.\r\n */\n function InputSmart(_ref, ref) {\n var country = _ref.country,\n international = _ref.international,\n withCountryCallingCode = _ref.withCountryCallingCode,\n metadata = _ref.metadata,\n rest = _objectWithoutProperties(_ref, _excluded);\n\n var format = useCallback(function (value) {\n // \"As you type\" formatter.\n var formatter = new AsYouType(country, metadata);\n var prefix = getInputValuePrefix({\n country: country,\n international: international,\n withCountryCallingCode: withCountryCallingCode,\n metadata: metadata\n }); // Format the number.\n\n var text = formatter.input(prefix + value);\n var template = formatter.getTemplate();\n\n if (prefix) {\n text = removeInputValuePrefix(text, prefix); // `AsYouType.getTemplate()` can be `undefined`.\n\n if (template) {\n template = removeInputValuePrefix(template, prefix);\n }\n }\n\n return {\n text: text,\n template: template\n };\n }, [country, metadata]);\n return /*#__PURE__*/React.createElement(Input, _extends({}, rest, {\n ref: ref,\n parse: parsePhoneNumberCharacter,\n format: format\n }));\n }\n\n InputSmart = /*#__PURE__*/React.forwardRef(InputSmart);\n InputSmart.defaultProps = {\n metadata: defaultMetadata\n };\n return InputSmart;\n}\nexport default createInput();","var _excluded = [\"value\", \"onChange\", \"country\", \"international\", \"withCountryCallingCode\", \"metadata\", \"inputComponent\"];\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nimport React, { useCallback } from 'react';\nimport { parseIncompletePhoneNumber, formatIncompletePhoneNumber } from 'libphonenumber-js/core';\nimport { getInputValuePrefix, removeInputValuePrefix } from './helpers/inputValuePrefix.js';\nexport function createInput(defaultMetadata) {\n /**\r\n * `InputBasic` is the most basic implementation of a `Component`\r\n * that can be passed to ``. It parses and formats\r\n * the user's input but doesn't control the caret in the process:\r\n * when erasing or inserting digits in the middle of a phone number\r\n * the caret usually jumps to the end (this is the expected behavior).\r\n * Why does `InputBasic` exist when there's `InputSmart`?\r\n * One reason is working around the [Samsung Galaxy smart caret positioning bug]\r\n * (https://github.com/catamphetamine/react-phone-number-input/issues/75).\r\n * Another reason is that, unlike `InputSmart`, it doesn't require DOM environment.\r\n */\n function InputBasic(_ref, ref) {\n var value = _ref.value,\n onChange = _ref.onChange,\n country = _ref.country,\n international = _ref.international,\n withCountryCallingCode = _ref.withCountryCallingCode,\n metadata = _ref.metadata,\n Input = _ref.inputComponent,\n rest = _objectWithoutProperties(_ref, _excluded);\n\n var prefix = getInputValuePrefix({\n country: country,\n international: international,\n withCountryCallingCode: withCountryCallingCode,\n metadata: metadata\n });\n\n var _onChange = useCallback(function (event) {\n var newValue = parseIncompletePhoneNumber(event.target.value); // By default, if a value is something like `\"(123)\"`\n // then Backspace would only erase the rightmost brace\n // becoming something like `\"(123\"`\n // which would give the same `\"123\"` value\n // which would then be formatted back to `\"(123)\"`\n // and so a user wouldn't be able to erase the phone number.\n // Working around this issue with this simple hack.\n\n if (newValue === value) {\n var newValueFormatted = format(prefix, newValue, country, metadata);\n\n if (newValueFormatted.indexOf(event.target.value) === 0) {\n // Trim the last digit (or plus sign).\n newValue = newValue.slice(0, -1);\n }\n }\n\n onChange(newValue);\n }, [prefix, value, onChange, country, metadata]);\n\n return /*#__PURE__*/React.createElement(Input, _extends({}, rest, {\n ref: ref,\n value: format(prefix, value, country, metadata),\n onChange: _onChange\n }));\n }\n\n InputBasic = /*#__PURE__*/React.forwardRef(InputBasic);\n InputBasic.defaultProps = {\n metadata: defaultMetadata,\n inputComponent: 'input'\n };\n return InputBasic;\n}\nexport default createInput();\n\nfunction format(prefix, value, country, metadata) {\n return removeInputValuePrefix(formatIncompletePhoneNumber(prefix + value, country, metadata), prefix);\n}","import AsYouType from './AsYouType.js';\n/**\r\n * Formats a (possibly incomplete) phone number.\r\n * The phone number can be either in E.164 format\r\n * or in a form of national number digits.\r\n * @param {string} value - A possibly incomplete phone number. Either in E.164 format or in a form of national number digits.\r\n * @param {string?} country - Two-letter (\"ISO 3166-1 alpha-2\") country code.\r\n * @return {string} Formatted (possibly incomplete) phone number.\r\n */\n\nexport default function formatIncompletePhoneNumber(value, country, metadata) {\n if (!metadata) {\n metadata = country;\n country = undefined;\n }\n\n return new AsYouType(country, metadata).input(value);\n}","/**\r\n * Creates Unicode flag from a two-letter ISO country code.\r\n * https://stackoverflow.com/questions/24050671/how-to-put-japan-flag-character-in-a-string\r\n * @param {string} country — A two-letter ISO country code (case-insensitive).\r\n * @return {string}\r\n */\nexport default function getCountryFlag(country) {\n return getRegionalIndicatorSymbol(country[0]) + getRegionalIndicatorSymbol(country[1]);\n}\n/**\r\n * Converts a letter to a Regional Indicator Symbol.\r\n * @param {string} letter\r\n * @return {string}\r\n */\n\nfunction getRegionalIndicatorSymbol(letter) {\n return String.fromCodePoint(0x1F1E6 - 65 + letter.toUpperCase().charCodeAt(0));\n}","var _excluded = [\"value\", \"onChange\", \"options\"],\n _excluded2 = [\"value\", \"options\", \"className\", \"iconComponent\", \"getIconAspectRatio\", \"arrowComponent\", \"unicodeFlags\"];\n\nfunction _createForOfIteratorHelperLoose(o, allowArrayLike) {\n var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"];\n if (it) return (it = it.call(o)).next.bind(it);\n\n if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n return function () {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n };\n }\n\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nimport React, { useCallback, useMemo } from 'react';\nimport classNames from 'classnames';\nimport getUnicodeFlagIcon from 'country-flag-icons/unicode';\nexport default function CountrySelect(_ref) {\n var value = _ref.value,\n onChange = _ref.onChange,\n options = _ref.options,\n rest = _objectWithoutProperties(_ref, _excluded);\n\n var onChange_ = useCallback(function (event) {\n var value = event.target.value;\n onChange(value === 'ZZ' ? undefined : value);\n }, [onChange]);\n var selectedOption = useMemo(function () {\n return getSelectedOption(options, value);\n }, [options, value]); // \"ZZ\" means \"International\".\n // (HTML requires each `` have some string `value`).\n\n return /*#__PURE__*/React.createElement(\"select\", _extends({}, rest, {\n value: value || 'ZZ',\n onChange: onChange_\n }), options.map(function (_ref2) {\n var value = _ref2.value,\n label = _ref2.label,\n divider = _ref2.divider;\n return /*#__PURE__*/React.createElement(\"option\", {\n key: divider ? '|' : value || 'ZZ',\n value: divider ? '|' : value || 'ZZ',\n disabled: divider ? true : false,\n style: divider ? DIVIDER_STYLE : undefined\n }, label);\n }));\n}\nvar DIVIDER_STYLE = {\n fontSize: '1px',\n backgroundColor: 'currentColor',\n color: 'inherit'\n};\nexport function CountrySelectWithIcon(_ref3) {\n var value = _ref3.value,\n options = _ref3.options,\n className = _ref3.className,\n Icon = _ref3.iconComponent,\n getIconAspectRatio = _ref3.getIconAspectRatio,\n Arrow = _ref3.arrowComponent,\n unicodeFlags = _ref3.unicodeFlags,\n rest = _objectWithoutProperties(_ref3, _excluded2);\n\n var selectedOption = useMemo(function () {\n return getSelectedOption(options, value);\n }, [options, value]);\n return /*#__PURE__*/React.createElement(\"div\", {\n className: \"PhoneInputCountry\"\n }, /*#__PURE__*/React.createElement(CountrySelect, _extends({}, rest, {\n value: value,\n options: options,\n className: classNames('PhoneInputCountrySelect', className)\n })), unicodeFlags && value && /*#__PURE__*/React.createElement(\"div\", {\n className: \"PhoneInputCountryIconUnicode\"\n }, getUnicodeFlagIcon(value)), !(unicodeFlags && value) && /*#__PURE__*/React.createElement(Icon, {\n \"aria-hidden\": true,\n country: value,\n label: selectedOption && selectedOption.label,\n aspectRatio: unicodeFlags ? 1 : undefined\n }), /*#__PURE__*/React.createElement(Arrow, null));\n}\nCountrySelectWithIcon.defaultProps = {\n arrowComponent: function arrowComponent() {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: \"PhoneInputCountrySelectArrow\"\n });\n }\n};\n\nfunction getSelectedOption(options, value) {\n for (var _iterator = _createForOfIteratorHelperLoose(options), _step; !(_step = _iterator()).done;) {\n var option = _step.value;\n\n if (!option.divider && option.value === value) {\n return option;\n }\n }\n}","var _excluded = [\"country\", \"countryName\", \"flags\", \"flagUrl\"];\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nimport React from 'react';\nimport classNames from 'classnames'; // Default country flag icon.\n// `` is wrapped in a `` to prevent SVGs from exploding in size in IE 11.\n// https://github.com/catamphetamine/react-phone-number-input/issues/111\n\nexport default function FlagComponent(_ref) {\n var country = _ref.country,\n countryName = _ref.countryName,\n flags = _ref.flags,\n flagUrl = _ref.flagUrl,\n rest = _objectWithoutProperties(_ref, _excluded);\n\n if (flags && flags[country]) {\n return flags[country]({\n title: countryName\n });\n }\n\n return /*#__PURE__*/React.createElement(\"img\", _extends({}, rest, {\n alt: countryName,\n role: countryName ? undefined : \"presentation\",\n src: flagUrl.replace('{XX}', country).replace('{xx}', country.toLowerCase())\n }));\n}","var _excluded = [\"aspectRatio\"],\n _excluded2 = [\"title\"],\n _excluded3 = [\"title\"];\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nimport React from 'react';\nexport default function InternationalIcon(_ref) {\n var aspectRatio = _ref.aspectRatio,\n rest = _objectWithoutProperties(_ref, _excluded);\n\n if (aspectRatio === 1) {\n return /*#__PURE__*/React.createElement(InternationalIcon1x1, rest);\n } else {\n return /*#__PURE__*/React.createElement(InternationalIcon3x2, rest);\n }\n}\n\n// 3x2.\n// Using `` in ``s:\n// https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title\nfunction InternationalIcon3x2(_ref2) {\n var title = _ref2.title,\n rest = _objectWithoutProperties(_ref2, _excluded2);\n\n return /*#__PURE__*/React.createElement(\"svg\", _extends({}, rest, {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 75 50\"\n }), /*#__PURE__*/React.createElement(\"title\", null, title), /*#__PURE__*/React.createElement(\"g\", {\n className: \"PhoneInputInternationalIconGlobe\",\n stroke: \"currentColor\",\n fill: \"none\",\n strokeWidth: \"2\",\n strokeMiterlimit: \"10\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n strokeLinecap: \"round\",\n d: \"M47.2,36.1C48.1,36,49,36,50,36c7.4,0,14,1.7,18.5,4.3\"\n }), /*#__PURE__*/React.createElement(\"path\", {\n d: \"M68.6,9.6C64.2,12.3,57.5,14,50,14c-7.4,0-14-1.7-18.5-4.3\"\n }), /*#__PURE__*/React.createElement(\"line\", {\n x1: \"26\",\n y1: \"25\",\n x2: \"74\",\n y2: \"25\"\n }), /*#__PURE__*/React.createElement(\"line\", {\n x1: \"50\",\n y1: \"1\",\n x2: \"50\",\n y2: \"49\"\n }), /*#__PURE__*/React.createElement(\"path\", {\n strokeLinecap: \"round\",\n d: \"M46.3,48.7c1.2,0.2,2.5,0.3,3.7,0.3c13.3,0,24-10.7,24-24S63.3,1,50,1S26,11.7,26,25c0,2,0.3,3.9,0.7,5.8\"\n }), /*#__PURE__*/React.createElement(\"path\", {\n strokeLinecap: \"round\",\n d: \"M46.8,48.2c1,0.6,2.1,0.8,3.2,0.8c6.6,0,12-10.7,12-24S56.6,1,50,1S38,11.7,38,25c0,1.4,0.1,2.7,0.2,4c0,0.1,0,0.2,0,0.2\"\n })), /*#__PURE__*/React.createElement(\"path\", {\n className: \"PhoneInputInternationalIconPhone\",\n stroke: \"none\",\n fill: \"currentColor\",\n d: \"M12.4,17.9c2.9-2.9,5.4-4.8,0.3-11.2S4.1,5.2,1.3,8.1C-2,11.4,1.1,23.5,13.1,35.6s24.3,15.2,27.5,11.9c2.8-2.8,7.8-6.3,1.4-11.5s-8.3-2.6-11.2,0.3c-2,2-7.2-2.2-11.7-6.7S10.4,19.9,12.4,17.9z\"\n }));\n}\n\n// 1x1.\n// Using `` in ``s:\n// https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title\nfunction InternationalIcon1x1(_ref3) {\n var title = _ref3.title,\n rest = _objectWithoutProperties(_ref3, _excluded3);\n\n return /*#__PURE__*/React.createElement(\"svg\", _extends({}, rest, {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 50 50\"\n }), /*#__PURE__*/React.createElement(\"title\", null, title), /*#__PURE__*/React.createElement(\"g\", {\n className: \"PhoneInputInternationalIconGlobe\",\n stroke: \"currentColor\",\n fill: \"none\",\n strokeWidth: \"2\",\n strokeLinecap: \"round\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M8.45,13A21.44,21.44,0,1,1,37.08,41.56\"\n }), /*#__PURE__*/React.createElement(\"path\", {\n d: \"M19.36,35.47a36.9,36.9,0,0,1-2.28-13.24C17.08,10.39,21.88.85,27.8.85s10.72,9.54,10.72,21.38c0,6.48-1.44,12.28-3.71,16.21\"\n }), /*#__PURE__*/React.createElement(\"path\", {\n d: \"M17.41,33.4A39,39,0,0,1,27.8,32.06c6.62,0,12.55,1.5,16.48,3.86\"\n }), /*#__PURE__*/React.createElement(\"path\", {\n d: \"M44.29,8.53c-3.93,2.37-9.86,3.88-16.49,3.88S15.25,10.9,11.31,8.54\"\n }), /*#__PURE__*/React.createElement(\"line\", {\n x1: \"27.8\",\n y1: \"0.85\",\n x2: \"27.8\",\n y2: \"34.61\"\n }), /*#__PURE__*/React.createElement(\"line\", {\n x1: \"15.2\",\n y1: \"22.23\",\n x2: \"49.15\",\n y2: \"22.23\"\n })), /*#__PURE__*/React.createElement(\"path\", {\n className: \"PhoneInputInternationalIconPhone\",\n stroke: \"transparent\",\n fill: \"currentColor\",\n d: \"M9.42,26.64c2.22-2.22,4.15-3.59.22-8.49S3.08,17,.93,19.17c-2.49,2.48-.13,11.74,9,20.89s18.41,11.5,20.89,9c2.15-2.15,5.91-4.77,1-8.71s-6.27-2-8.49.22c-1.55,1.55-5.48-1.69-8.86-5.08S7.87,28.19,9.42,26.64Z\"\n }));\n}","function _createForOfIteratorHelperLoose(o, allowArrayLike) {\n var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"];\n if (it) return (it = it.call(o)).next.bind(it);\n\n if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n return function () {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n };\n }\n\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nimport { isSupportedCountry } from 'libphonenumber-js/core';\nexport { getCountries } from 'libphonenumber-js/core';\n/**\r\n * Sorts country `` options.\r\n * Can move some country `` options\r\n * to the top of the list, for example.\r\n * @param {object[]} countryOptions — Country `` options.\r\n * @param {string[]} [countryOptionsOrder] — Country `` options order. Example: `[\"US\", \"CA\", \"AU\", \"|\", \"...\"]`.\r\n * @return {object[]}\r\n */\n\nexport function sortCountryOptions(options, order) {\n if (!order) {\n return options;\n }\n\n var optionsOnTop = [];\n var optionsOnBottom = [];\n var appendTo = optionsOnTop;\n\n for (var _iterator = _createForOfIteratorHelperLoose(order), _step; !(_step = _iterator()).done;) {\n var element = _step.value;\n\n if (element === '|') {\n appendTo.push({\n divider: true\n });\n } else if (element === '...' || element === '…') {\n appendTo = optionsOnBottom;\n } else {\n (function () {\n var countryCode = void 0;\n\n if (element === '🌐') {\n countryCode = undefined;\n } else {\n countryCode = element;\n } // Find the position of the option.\n\n\n var index = options.indexOf(options.filter(function (option) {\n return option.value === countryCode;\n })[0]); // Get the option.\n\n var option = options[index]; // Remove the option from its default position.\n\n options.splice(index, 1); // Add the option on top.\n\n appendTo.push(option);\n })();\n }\n }\n\n return optionsOnTop.concat(options).concat(optionsOnBottom);\n}\nexport function getSupportedCountryOptions(countryOptions, metadata) {\n if (countryOptions) {\n countryOptions = countryOptions.filter(function (option) {\n switch (option) {\n case '🌐':\n case '|':\n case '...':\n case '…':\n return true;\n\n default:\n return isCountrySupportedWithError(option, metadata);\n }\n });\n\n if (countryOptions.length > 0) {\n return countryOptions;\n }\n }\n}\nexport function isCountrySupportedWithError(country, metadata) {\n if (isSupportedCountry(country, metadata)) {\n return true;\n } else {\n console.error(\"Country not found: \".concat(country));\n return false;\n }\n}\nexport function getSupportedCountries(countries, metadata) {\n if (countries) {\n countries = countries.filter(function (country) {\n return isCountrySupportedWithError(country, metadata);\n });\n\n if (countries.length === 0) {\n countries = undefined;\n }\n }\n\n return countries;\n}","var _excluded = [\"country\", \"label\", \"aspectRatio\"];\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nimport React from 'react';\nimport classNames from 'classnames';\nimport DefaultInternationalIcon from './InternationalIcon.js';\nimport Flag from './Flag.js';\nexport function createCountryIconComponent(_ref) {\n var flags = _ref.flags,\n flagUrl = _ref.flagUrl,\n FlagComponent = _ref.flagComponent,\n InternationalIcon = _ref.internationalIcon;\n\n function CountryIcon(_ref2) {\n var country = _ref2.country,\n label = _ref2.label,\n aspectRatio = _ref2.aspectRatio,\n rest = _objectWithoutProperties(_ref2, _excluded); // `aspectRatio` is currently a hack for the default \"International\" icon\n // to render it as a square when Unicode flag icons are used.\n // So `aspectRatio` property is only used with the default \"International\" icon.\n\n\n var _aspectRatio = InternationalIcon === DefaultInternationalIcon ? aspectRatio : undefined;\n\n return /*#__PURE__*/React.createElement(\"div\", _extends({}, rest, {\n className: classNames('PhoneInputCountryIcon', {\n 'PhoneInputCountryIcon--square': _aspectRatio === 1,\n 'PhoneInputCountryIcon--border': country\n })\n }), country ? /*#__PURE__*/React.createElement(FlagComponent, {\n country: country,\n countryName: label,\n flags: flags,\n flagUrl: flagUrl,\n className: \"PhoneInputCountryIconImg\"\n }) : /*#__PURE__*/React.createElement(InternationalIcon, {\n title: label,\n aspectRatio: _aspectRatio,\n className: \"PhoneInputCountryIconImg\"\n }));\n }\n\n return CountryIcon;\n}\nexport default createCountryIconComponent({\n // Must be equal to `defaultProps.flagUrl` in `./PhoneInputWithCountry.js`.\n flagUrl: 'https://purecatamphetamine.github.io/country-flag-icons/3x2/{XX}.svg',\n flagComponent: Flag,\n internationalIcon: DefaultInternationalIcon\n});","import { getCountryCallingCode, Metadata } from 'libphonenumber-js/core';\nvar ONLY_DIGITS_REGEXP = /^\\d+$/;\nexport default function getInternationalPhoneNumberPrefix(country, metadata) {\n // Standard international phone number prefix: \"+\" and \"country calling code\".\n var prefix = '+' + getCountryCallingCode(country, metadata); // Get \"leading digits\" for a phone number of the country.\n // If there're \"leading digits\" then they can be part of the prefix too.\n\n metadata = new Metadata(metadata);\n metadata.selectNumberingPlan(country);\n\n if (metadata.numberingPlan.leadingDigits() && ONLY_DIGITS_REGEXP.test(metadata.numberingPlan.leadingDigits())) {\n prefix += metadata.numberingPlan.leadingDigits();\n }\n\n return prefix;\n}","import parsePhoneNumber_, { getCountryCallingCode, AsYouType, Metadata } from 'libphonenumber-js/core';\nimport getInternationalPhoneNumberPrefix from './getInternationalPhoneNumberPrefix.js';\n/**\r\n * Decides which country should be pre-selected\r\n * when the phone number input component is first mounted.\r\n * @param {object?} phoneNumber - An instance of `PhoneNumber` class.\r\n * @param {string?} country - Pre-defined country (two-letter code).\r\n * @param {string[]?} countries - A list of countries available.\r\n * @param {object} metadata - `libphonenumber-js` metadata\r\n * @return {string?}\r\n */\n\nexport function getPreSelectedCountry(_ref) {\n var value = _ref.value,\n phoneNumber = _ref.phoneNumber,\n defaultCountry = _ref.defaultCountry,\n getAnyCountry = _ref.getAnyCountry,\n countries = _ref.countries,\n required = _ref.required,\n metadata = _ref.metadata;\n var country; // If can get country from E.164 phone number\n // then it overrides the `country` passed (or not passed).\n\n if (phoneNumber && phoneNumber.country) {\n // `country` will be left `undefined` in case of non-detection.\n country = phoneNumber.country;\n } else if (defaultCountry) {\n if (!value || couldNumberBelongToCountry(value, defaultCountry, metadata)) {\n country = defaultCountry;\n }\n } // Only pre-select a country if it's in the available `countries` list.\n\n\n if (countries && countries.indexOf(country) < 0) {\n country = undefined;\n } // If there will be no \"International\" option\n // then some `country` must be selected.\n // It will still be the wrong country though.\n // But still country `` can't be left in a broken state.\n\n\n if (!country && required && countries && countries.length > 0) {\n country = getAnyCountry(); // noCountryMatchesTheNumber = true\n }\n\n return country;\n}\n/**\r\n * Generates a sorted list of country `` options.\r\n * @param {string[]} countries - A list of two-letter (\"ISO 3166-1 alpha-2\") country codes.\r\n * @param {object} labels - Custom country labels. E.g. `{ RU: 'Россия', US: 'США', ... }`.\r\n * @param {boolean} addInternationalOption - Whether should include \"International\" option at the top of the list.\r\n * @return {object[]} A list of objects having shape `{ value : string, label : string }`.\r\n */\n\nexport function getCountrySelectOptions(_ref2) {\n var countries = _ref2.countries,\n countryNames = _ref2.countryNames,\n addInternationalOption = _ref2.addInternationalOption,\n compareStringsLocales = _ref2.compareStringsLocales,\n _compareStrings = _ref2.compareStrings; // Default country name comparator uses `String.localeCompare()`.\n\n if (!_compareStrings) {\n _compareStrings = compareStrings;\n } // Generates a `` option for each country.\n\n\n var countrySelectOptions = countries.map(function (country) {\n return {\n value: country,\n // All `locale` country names included in this library\n // include all countries (this is checked at build time).\n // The only case when a country name might be missing\n // is when a developer supplies their own `labels` property.\n // To guard against such cases, a missing country name\n // is substituted by country code.\n label: countryNames[country] || country\n };\n }); // Sort the list of countries alphabetically.\n\n countrySelectOptions.sort(function (a, b) {\n return _compareStrings(a.label, b.label, compareStringsLocales);\n }); // Add the \"International\" option to the country list (if suitable)\n\n if (addInternationalOption) {\n countrySelectOptions.unshift({\n label: countryNames.ZZ\n });\n }\n\n return countrySelectOptions;\n}\n/**\r\n * Parses a E.164 phone number to an instance of `PhoneNumber` class.\r\n * @param {string?} value = E.164 phone number.\r\n * @param {object} metadata - `libphonenumber-js` metadata\r\n * @return {object} Object having shape `{ country: string?, countryCallingCode: string, number: string }`. `PhoneNumber`: https://gitlab.com/catamphetamine/libphonenumber-js#phonenumber.\r\n * @example\r\n * parsePhoneNumber('+78005553535')\r\n */\n\nexport function parsePhoneNumber(value, metadata) {\n return parsePhoneNumber_(value || '', metadata);\n}\n/**\r\n * Generates national number digits for a parsed phone.\r\n * May prepend national prefix.\r\n * The phone number must be a complete and valid phone number.\r\n * @param {object} phoneNumber - An instance of `PhoneNumber` class.\r\n * @param {object} metadata - `libphonenumber-js` metadata\r\n * @return {string}\r\n * @example\r\n * getNationalNumberDigits({ country: 'RU', phone: '8005553535' })\r\n * // returns '88005553535'\r\n */\n\nexport function generateNationalNumberDigits(phoneNumber) {\n return phoneNumber.formatNational().replace(/\\D/g, '');\n}\n/**\r\n * Migrates parsed `` `value` for the newly selected `country`.\r\n * @param {string?} phoneDigits - Phone number digits (and `+`) parsed from phone number `` (it's not the same as the `value` property).\r\n * @param {string?} prevCountry - Previously selected country.\r\n * @param {string?} newCountry - Newly selected country. Can't be same as previously selected country.\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @param {boolean} useNationalFormat - whether should attempt to convert from international to national number for the new country.\r\n * @return {string?}\r\n */\n\nexport function getPhoneDigitsForNewCountry(phoneDigits, _ref3) {\n var prevCountry = _ref3.prevCountry,\n newCountry = _ref3.newCountry,\n metadata = _ref3.metadata,\n useNationalFormat = _ref3.useNationalFormat;\n\n if (prevCountry === newCountry) {\n return phoneDigits;\n } // If `parsed_input` is empty\n // then no need to migrate anything.\n\n\n if (!phoneDigits) {\n if (useNationalFormat) {\n return '';\n } else {\n // If `phoneDigits` is empty then set `phoneDigits` to\n // `+{getCountryCallingCode(newCountry)}`.\n return getInternationalPhoneNumberPrefix(newCountry, metadata);\n }\n } // If switching to some country.\n // (from \"International\" or another country)\n // If switching from \"International\" then `phoneDigits` starts with a `+`.\n // Otherwise it may or may not start with a `+`.\n\n\n if (newCountry) {\n // If the phone number was entered in international format\n // then migrate it to the newly selected country.\n // The phone number may be incomplete.\n // The phone number entered not necessarily starts with\n // the previously selected country phone prefix.\n if (phoneDigits[0] === '+') {\n // If the international phone number is for the new country\n // then convert it to local if required.\n if (useNationalFormat) {\n // // If a phone number is being input in international form\n // // and the country can already be derived from it,\n // // and if it is the new country, then format as a national number.\n // const derived_country = getCountryFromPossiblyIncompleteInternationalPhoneNumber(phoneDigits, metadata)\n // if (derived_country === newCountry) {\n // \treturn stripCountryCallingCode(phoneDigits, derived_country, metadata)\n // }\n // Actually, the two countries don't necessarily need to match:\n // the condition could be looser here, because several countries\n // might share the same international phone number format\n // (for example, \"NANPA\" countries like US, Canada, etc).\n // The looser condition would be just \"same nternational phone number format\"\n // which would mean \"same country calling code\" in the context of `libphonenumber-js`.\n if (phoneDigits.indexOf('+' + getCountryCallingCode(newCountry, metadata)) === 0) {\n return stripCountryCallingCode(phoneDigits, newCountry, metadata);\n } // Simply discard the previously entered international phone number,\n // because otherwise any \"smart\" transformation like getting the\n // \"national (significant) number\" part and then prepending the\n // newly selected country's \"country calling code\" to it\n // would just be confusing for a user without being actually useful.\n\n\n return ''; // // Simply strip the leading `+` character\n // // therefore simply converting all digits into a \"local\" phone number.\n // // https://github.com/catamphetamine/react-phone-number-input/issues/287\n // return phoneDigits.slice(1)\n }\n\n if (prevCountry) {\n var newCountryPrefix = getInternationalPhoneNumberPrefix(newCountry, metadata);\n\n if (phoneDigits.indexOf(newCountryPrefix) === 0) {\n return phoneDigits;\n } else {\n return newCountryPrefix;\n }\n } else {\n var defaultValue = getInternationalPhoneNumberPrefix(newCountry, metadata); // If `phoneDigits`'s country calling code part is the same\n // as for the new `country`, then leave `phoneDigits` as is.\n\n if (phoneDigits.indexOf(defaultValue) === 0) {\n return phoneDigits;\n } // If `phoneDigits`'s country calling code part is not the same\n // as for the new `country`, then set `phoneDigits` to\n // `+{getCountryCallingCode(newCountry)}`.\n\n\n return defaultValue;\n } // // If the international phone number already contains\n // // any country calling code then trim the country calling code part.\n // // (that could also be the newly selected country phone code prefix as well)\n // // `phoneDigits` doesn't neccessarily belong to `prevCountry`.\n // // (e.g. if a user enters an international number\n // // not belonging to any of the reduced `countries` list).\n // phoneDigits = stripCountryCallingCode(phoneDigits, prevCountry, metadata)\n // // Prepend country calling code prefix\n // // for the newly selected country.\n // return e164(phoneDigits, newCountry, metadata) || `+${getCountryCallingCode(newCountry, metadata)}`\n\n }\n } // If switching to \"International\" from a country.\n else {\n // If the phone number was entered in national format.\n if (phoneDigits[0] !== '+') {\n // Format the national phone number as an international one.\n // The phone number entered not necessarily even starts with\n // the previously selected country phone prefix.\n // Even if the phone number belongs to whole another country\n // it will still be parsed into some national phone number.\n //\n // Ignore the now-uncovered `|| ''` code branch:\n // previously `e164()` function could return an empty string\n // even when `phoneDigits` were not empty.\n // Now it always returns some `value` when there're any `phoneDigits`.\n // Still, didn't remove the `|| ''` code branch just in case\n // that logic changes somehow in some future, so there're no\n // possible bugs related to that.\n //\n // (ignore the `|| ''` code branch)\n\n /* istanbul ignore next */\n return e164(phoneDigits, prevCountry, metadata) || '';\n }\n }\n\n return phoneDigits;\n}\n/**\r\n * Converts phone number digits to a (possibly incomplete) E.164 phone number.\r\n * @param {string?} number - A possibly incomplete phone number digits string. Can be a possibly incomplete E.164 phone number.\r\n * @param {string?} country\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @return {string?}\r\n */\n\nexport function e164(number, country, metadata) {\n if (!number) {\n return;\n } // If the phone number is being input in international format.\n\n\n if (number[0] === '+') {\n // If it's just the `+` sign then return nothing.\n if (number === '+') {\n return;\n } // Return a E.164 phone number.\n //\n // Could return `number` \"as is\" here, but there's a possibility\n // that some user might incorrectly input an international number\n // with a \"national prefix\". Such numbers aren't considered valid,\n // but `libphonenumber-js` is \"forgiving\" when it comes to parsing\n // user's input, and this input component follows that behavior.\n //\n\n\n var asYouType = new AsYouType(country, metadata);\n asYouType.input(number); // This function would return `undefined` only when `number` is `\"+\"`,\n // but at this point it is known that `number` is not `\"+\"`.\n\n return asYouType.getNumberValue();\n } // For non-international phone numbers\n // an accompanying country code is required.\n // The situation when `country` is `undefined`\n // and a non-international phone number is passed\n // to this function shouldn't happen.\n\n\n if (!country) {\n return;\n }\n\n var partial_national_significant_number = getNationalSignificantNumberDigits(number, country, metadata); //\n // Even if no \"national (significant) number\" digits have been input,\n // still return a non-`undefined` value.\n // https://gitlab.com/catamphetamine/react-phone-number-input/-/issues/113\n //\n // For example, if the user has selected country `US` and entered `\"1\"`\n // then that `\"1\"` is just a \"national prefix\" and no \"national (significant) number\"\n // digits have been input yet. Still, return `\"+1\"` as `value` in such cases,\n // because otherwise the app would think that the input is empty and mark it as such\n // while in reality it isn't empty, which might be thought of as a \"bug\", or just\n // a \"weird\" behavior.\n //\n // if (partial_national_significant_number) {\n\n return \"+\".concat(getCountryCallingCode(country, metadata)).concat(partial_national_significant_number || ''); // }\n}\n/**\r\n * Trims phone number digits if they exceed the maximum possible length\r\n * for a national (significant) number for the country.\r\n * @param {string} number - A possibly incomplete phone number digits string. Can be a possibly incomplete E.164 phone number.\r\n * @param {string} country\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @return {string} Can be empty.\r\n */\n\nexport function trimNumber(number, country, metadata) {\n var nationalSignificantNumberPart = getNationalSignificantNumberDigits(number, country, metadata);\n\n if (nationalSignificantNumberPart) {\n var overflowDigitsCount = nationalSignificantNumberPart.length - getMaxNumberLength(country, metadata);\n\n if (overflowDigitsCount > 0) {\n return number.slice(0, number.length - overflowDigitsCount);\n }\n }\n\n return number;\n}\n\nfunction getMaxNumberLength(country, metadata) {\n // Get \"possible lengths\" for a phone number of the country.\n metadata = new Metadata(metadata);\n metadata.selectNumberingPlan(country); // Return the last \"possible length\".\n\n return metadata.numberingPlan.possibleLengths()[metadata.numberingPlan.possibleLengths().length - 1];\n} // If the phone number being input is an international one\n// then tries to derive the country from the phone number.\n// (regardless of whether there's any country currently selected)\n\n/**\r\n * @param {string} partialE164Number - A possibly incomplete E.164 phone number.\r\n * @param {string?} country - Currently selected country.\r\n * @param {string[]?} countries - A list of available countries. If not passed then \"all countries\" are assumed.\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @return {string?}\r\n */\n\n\nexport function getCountryForPartialE164Number(partialE164Number, _ref4) {\n var country = _ref4.country,\n countries = _ref4.countries,\n required = _ref4.required,\n metadata = _ref4.metadata;\n\n if (partialE164Number === '+') {\n // Don't change the currently selected country yet.\n return country;\n }\n\n var derived_country = getCountryFromPossiblyIncompleteInternationalPhoneNumber(partialE164Number, metadata); // If a phone number is being input in international form\n // and the country can already be derived from it,\n // then select that country.\n\n if (derived_country && (!countries || countries.indexOf(derived_country) >= 0)) {\n return derived_country;\n } // If \"International\" country option has not been disabled\n // and the international phone number entered doesn't correspond\n // to the currently selected country then reset the currently selected country.\n else if (country && !required && !couldNumberBelongToCountry(partialE164Number, country, metadata)) {\n return undefined;\n } // Don't change the currently selected country.\n\n\n return country;\n}\n/**\r\n * Parses `` value. Derives `country` from `input`. Derives an E.164 `value`.\r\n * @param {string?} phoneDigits — Parsed `` value. Examples: `\"\"`, `\"+\"`, `\"+123\"`, `\"123\"`.\r\n * @param {string?} prevPhoneDigits — Previous parsed `` value. Examples: `\"\"`, `\"+\"`, `\"+123\"`, `\"123\"`.\r\n * @param {string?} country - Currently selected country.\r\n * @param {boolean} countryRequired - Is selecting some country required.\r\n * @param {function} getAnyCountry - Can be used to get any country when selecting some country required.\r\n * @param {string[]?} countries - A list of available countries. If not passed then \"all countries\" are assumed.\r\n * @param {boolean} international - Set to `true` to force international phone number format (leading `+`). Set to `false` to force \"national\" phone number format. Is `undefined` by default.\r\n * @param {boolean} limitMaxLength — Whether to enable limiting phone number max length.\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @return {object} An object of shape `{ input, country, value }`.\r\n */\n\nexport function onPhoneDigitsChange(phoneDigits, _ref5) {\n var prevPhoneDigits = _ref5.prevPhoneDigits,\n country = _ref5.country,\n defaultCountry = _ref5.defaultCountry,\n countryRequired = _ref5.countryRequired,\n getAnyCountry = _ref5.getAnyCountry,\n countries = _ref5.countries,\n international = _ref5.international,\n limitMaxLength = _ref5.limitMaxLength,\n countryCallingCodeEditable = _ref5.countryCallingCodeEditable,\n metadata = _ref5.metadata;\n\n if (international && countryCallingCodeEditable === false) {\n var prefix = getInternationalPhoneNumberPrefix(country, metadata); // The `` value must start with the country calling code.\n\n if (phoneDigits.indexOf(prefix) !== 0) {\n var _value; // If a phone number input is declared as\n // `international` and `withCountryCallingCode`,\n // then it's gonna be non-empty even before the user\n // has input anything in it.\n // This will result in its contents (the country calling code part)\n // being selected when the user tabs into such field.\n // If the user then starts inputting the national part digits,\n // then `` value changes from `+xxx` to `y`\n // because inputting anything while having the `` value\n // selected results in erasing the `` value.\n // So, the component handles such case by restoring\n // the intended `` value: `+xxxy`.\n // https://gitlab.com/catamphetamine/react-phone-number-input/-/issues/43\n\n\n if (phoneDigits && phoneDigits[0] !== '+') {\n phoneDigits = prefix + phoneDigits;\n _value = e164(phoneDigits, country, metadata);\n } else {\n phoneDigits = prefix;\n }\n\n return {\n phoneDigits: phoneDigits,\n value: _value,\n country: country\n };\n }\n } // If `international` property is `false`, then it means\n // \"enforce national-only format during input\",\n // so, if that's the case, then remove all `+` characters,\n // but only if some country is currently selected.\n // (not if \"International\" country is selected).\n\n\n if (international === false && country && phoneDigits && phoneDigits[0] === '+') {\n phoneDigits = convertInternationalPhoneDigitsToNational(phoneDigits, country, metadata);\n } // Trim the input to not exceed the maximum possible number length.\n\n\n if (phoneDigits && country && limitMaxLength) {\n phoneDigits = trimNumber(phoneDigits, country, metadata);\n } // If this `onChange()` event was triggered\n // as a result of selecting \"International\" country,\n // then force-prepend a `+` sign if the phone number\n // `` value isn't in international format.\n // Also, force-prepend a `+` sign if international\n // phone number input format is set.\n\n\n if (phoneDigits && phoneDigits[0] !== '+' && (!country || international)) {\n phoneDigits = '+' + phoneDigits;\n } // If the previously entered phone number\n // has been entered in international format\n // and the user decides to erase it,\n // then also reset the `country`\n // because it was most likely automatically selected\n // while the user was typing in the phone number\n // in international format.\n // This fixes the issue when a user is presented\n // with a phone number input with no country selected\n // and then types in their local phone number\n // then discovers that the input's messed up\n // (a `+` has been prepended at the start of their input\n // and a random country has been selected),\n // decides to undo it all by erasing everything\n // and then types in their local phone number again\n // resulting in a seemingly correct phone number\n // but in reality that phone number has incorrect country.\n // https://github.com/catamphetamine/react-phone-number-input/issues/273\n\n\n if (!phoneDigits && prevPhoneDigits && prevPhoneDigits[0] === '+') {\n if (international) {\n country = undefined;\n } else {\n country = defaultCountry;\n }\n } // Also resets such \"randomly\" selected country\n // as soon as the user erases the number\n // digit-by-digit up to the leading `+` sign.\n\n\n if (phoneDigits === '+' && prevPhoneDigits && prevPhoneDigits[0] === '+' && prevPhoneDigits.length > '+'.length) {\n country = undefined;\n } // Generate the new `value` property.\n\n\n var value;\n\n if (phoneDigits) {\n if (phoneDigits[0] === '+') {\n if (phoneDigits === '+') {\n value = undefined;\n } else if (country && getInternationalPhoneNumberPrefix(country, metadata).indexOf(phoneDigits) === 0) {\n // Selected a `country` but started inputting an\n // international phone number for another country.\n // Even though the input value is non-empty,\n // the `value` is assumed `undefined` in such case.\n // The `country` will be reset (or re-selected)\n // immediately after such mismatch has been detected\n // by the phone number input component, and `value`\n // will be set to the currently entered international prefix.\n //\n // For example, if selected `country` `\"US\"`\n // and started inputting phone number `\"+2\"`\n // then `value` `undefined` will be returned from this function,\n // and then, immediately after that, `country` will be reset\n // and the `value` will be set to `\"+2\"`.\n //\n value = undefined;\n } else {\n value = e164(phoneDigits, country, metadata);\n }\n } else {\n value = e164(phoneDigits, country, metadata);\n }\n } // Derive the country from the phone number.\n // (regardless of whether there's any country currently selected,\n // because there could be several countries corresponding to one country calling code)\n\n\n if (value) {\n country = getCountryForPartialE164Number(value, {\n country: country,\n countries: countries,\n metadata: metadata\n }); // If `international` property is `false`, then it means\n // \"enforce national-only format during input\",\n // so, if that's the case, then remove all `+` characters,\n // but only if some country is currently selected.\n // (not if \"International\" country is selected).\n\n if (international === false && country && phoneDigits && phoneDigits[0] === '+') {\n phoneDigits = convertInternationalPhoneDigitsToNational(phoneDigits, country, metadata); // Re-calculate `value` because `phoneDigits` has changed.\n\n value = e164(phoneDigits, country, metadata);\n }\n }\n\n if (!country && countryRequired) {\n country = defaultCountry || getAnyCountry();\n }\n\n return {\n phoneDigits: phoneDigits,\n country: country,\n value: value\n };\n}\n\nfunction convertInternationalPhoneDigitsToNational(input, country, metadata) {\n // Handle the case when a user might have pasted\n // a phone number in international format.\n if (input.indexOf(getInternationalPhoneNumberPrefix(country, metadata)) === 0) {\n // Create \"as you type\" formatter.\n var formatter = new AsYouType(country, metadata); // Input partial national phone number.\n\n formatter.input(input); // Return the parsed partial national phone number.\n\n var phoneNumber = formatter.getNumber();\n\n if (phoneNumber) {\n // Transform the number to a national one,\n // and remove all non-digits.\n return phoneNumber.formatNational().replace(/\\D/g, '');\n } else {\n return '';\n }\n } else {\n // Just remove the `+` sign.\n return input.replace(/\\D/g, '');\n }\n}\n/**\r\n * Determines the country for a given (possibly incomplete) E.164 phone number.\r\n * @param {string} number - A possibly incomplete E.164 phone number.\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @return {string?}\r\n */\n\n\nexport function getCountryFromPossiblyIncompleteInternationalPhoneNumber(number, metadata) {\n var formatter = new AsYouType(null, metadata);\n formatter.input(number); // // `001` is a special \"non-geograpical entity\" code\n // // in Google's `libphonenumber` library.\n // if (formatter.getCountry() === '001') {\n // \treturn\n // }\n\n return formatter.getCountry();\n}\n/**\r\n * Compares two strings.\r\n * A helper for `Array.sort()`.\r\n * @param {string} a — First string.\r\n * @param {string} b — Second string.\r\n * @param {(string[]|string)} [locales] — The `locales` argument of `String.localeCompare`.\r\n */\n\nexport function compareStrings(a, b, locales) {\n // Use `String.localeCompare` if it's available.\n // https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare\n // Which means everyone except IE <= 10 and Safari <= 10.\n // `localeCompare()` is available in latest Node.js versions.\n\n /* istanbul ignore else */\n if (String.prototype.localeCompare) {\n return a.localeCompare(b, locales);\n }\n /* istanbul ignore next */\n\n\n return a < b ? -1 : a > b ? 1 : 0;\n}\n/**\r\n * Strips `+${countryCallingCode}` prefix from an E.164 phone number.\r\n * @param {string} number - (possibly incomplete) E.164 phone number.\r\n * @param {string?} country - A possible country for this phone number.\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @return {string}\r\n */\n\nexport function stripCountryCallingCode(number, country, metadata) {\n // Just an optimization, so that it\n // doesn't have to iterate through all country calling codes.\n if (country) {\n var countryCallingCodePrefix = '+' + getCountryCallingCode(country, metadata); // If `country` fits the actual `number`.\n\n if (number.length < countryCallingCodePrefix.length) {\n if (countryCallingCodePrefix.indexOf(number) === 0) {\n return '';\n }\n } else {\n if (number.indexOf(countryCallingCodePrefix) === 0) {\n return number.slice(countryCallingCodePrefix.length);\n }\n }\n } // If `country` doesn't fit the actual `number`.\n // Try all available country calling codes.\n\n\n for (var _i = 0, _Object$keys = Object.keys(metadata.country_calling_codes); _i < _Object$keys.length; _i++) {\n var country_calling_code = _Object$keys[_i];\n\n if (number.indexOf(country_calling_code) === '+'.length) {\n return number.slice('+'.length + country_calling_code.length);\n }\n }\n\n return '';\n}\n/**\r\n * Parses a partially entered national phone number digits\r\n * (or a partially entered E.164 international phone number)\r\n * and returns the national significant number part.\r\n * National significant number returned doesn't come with a national prefix.\r\n * @param {string} number - National number digits. Or possibly incomplete E.164 phone number.\r\n * @param {string?} country\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @return {string} [result]\r\n */\n\nexport function getNationalSignificantNumberDigits(number, country, metadata) {\n // Create \"as you type\" formatter.\n var formatter = new AsYouType(country, metadata); // Input partial national phone number.\n\n formatter.input(number); // Return the parsed partial national phone number.\n\n var phoneNumber = formatter.getNumber();\n return phoneNumber && phoneNumber.nationalNumber;\n}\n/**\r\n * Checks if a partially entered E.164 phone number could belong to a country.\r\n * @param {string} number\r\n * @param {string} country\r\n * @return {boolean}\r\n */\n\nexport function couldNumberBelongToCountry(number, country, metadata) {\n var intlPhoneNumberPrefix = getInternationalPhoneNumberPrefix(country, metadata);\n var i = 0;\n\n while (i < number.length && i < intlPhoneNumberPrefix.length) {\n if (number[i] !== intlPhoneNumberPrefix[i]) {\n return false;\n }\n\n i++;\n }\n\n return true;\n}\n/**\r\n * Gets initial \"phone digits\" (including `+`, if using international format).\r\n * @return {string} [phoneDigits] Returns `undefined` if there should be no initial \"phone digits\".\r\n */\n\nexport function getInitialPhoneDigits(_ref6) {\n var value = _ref6.value,\n phoneNumber = _ref6.phoneNumber,\n defaultCountry = _ref6.defaultCountry,\n international = _ref6.international,\n useNationalFormat = _ref6.useNationalFormat,\n metadata = _ref6.metadata; // If the `value` (E.164 phone number)\n // belongs to the currently selected country\n // and `useNationalFormat` is `true`\n // then convert `value` (E.164 phone number)\n // to a local phone number digits.\n // E.g. '+78005553535' -> '88005553535'.\n\n if ((international === false || useNationalFormat) && phoneNumber && phoneNumber.country) {\n return generateNationalNumberDigits(phoneNumber);\n } // If `international` property is `true`,\n // meaning \"enforce international phone number format\",\n // then always show country calling code in the input field.\n\n\n if (!value && international && defaultCountry) {\n return getInternationalPhoneNumberPrefix(defaultCountry, metadata);\n }\n\n return value;\n}","function ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n enumerableOnly && (symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n })), keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = null != arguments[i] ? arguments[i] : {};\n i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n\n return target;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nimport { getInitialPhoneDigits, getCountryForPartialE164Number, parsePhoneNumber } from './phoneInputHelpers.js';\nimport { isCountrySupportedWithError, getSupportedCountries } from './countries.js';\nexport default function getPhoneInputWithCountryStateUpdateFromNewProps(props, prevProps, state) {\n var metadata = props.metadata,\n countries = props.countries,\n newDefaultCountry = props.defaultCountry,\n newValue = props.value,\n newReset = props.reset,\n international = props.international,\n displayInitialValueAsLocalNumber = props.displayInitialValueAsLocalNumber,\n initialValueFormat = props.initialValueFormat;\n var prevDefaultCountry = prevProps.defaultCountry,\n prevValue = prevProps.value,\n prevReset = prevProps.reset;\n var country = state.country,\n value = state.value,\n hasUserSelectedACountry = state.hasUserSelectedACountry;\n\n var _getInitialPhoneDigits = function _getInitialPhoneDigits(parameters) {\n return getInitialPhoneDigits(_objectSpread(_objectSpread({}, parameters), {}, {\n international: international,\n useNationalFormat: displayInitialValueAsLocalNumber || initialValueFormat === 'national',\n metadata: metadata\n }));\n }; // Some users requested a way to reset the component\n // (both number `` and country ``).\n // Whenever `reset` property changes both number ``\n // and country `` are reset.\n // It's not implemented as some instance `.reset()` method\n // because `ref` is forwarded to ``.\n // It's also not replaced with just resetting `country` on\n // external `value` reset, because a user could select a country\n // and then not input any `value`, and so the selected country\n // would be \"stuck\", if not using this `reset` property.\n // https://github.com/catamphetamine/react-phone-number-input/issues/300\n\n\n if (newReset !== prevReset) {\n return {\n phoneDigits: _getInitialPhoneDigits({\n value: undefined,\n defaultCountry: newDefaultCountry\n }),\n value: undefined,\n country: newDefaultCountry,\n hasUserSelectedACountry: undefined\n };\n } // `value` is the value currently shown in the component:\n // it's stored in the component's `state`, and it's not the `value` property.\n // `prevValue` is \"previous `value` property\".\n // `newValue` is \"new `value` property\".\n // If the default country changed\n // (e.g. in case of ajax GeoIP detection after page loaded)\n // then select it, but only if the user hasn't already manually\n // selected a country, and no phone number has been manually entered so far.\n // Because if the user has already started inputting a phone number\n // then they're okay with no country being selected at all (\"International\")\n // and they don't want to be disturbed, don't want their input to be screwed, etc.\n\n\n if (newDefaultCountry !== prevDefaultCountry) {\n var isNewDefaultCountrySupported = !newDefaultCountry || isCountrySupportedWithError(newDefaultCountry, metadata);\n\n var noValueHasBeenEnteredByTheUser = // By default, \"no value has been entered\" means `value` is `undefined`.\n !value || // When `international` is `true`, and some country has been pre-selected,\n // then the `` contains a pre-filled value of `+${countryCallingCode}${leadingDigits}`,\n // so in case of `international` being `true`, \"the user hasn't entered anything\" situation\n // doesn't just mean `value` is `undefined`, but could also mean `value` is `+${countryCallingCode}`.\n international && value === _getInitialPhoneDigits({\n value: undefined,\n defaultCountry: prevDefaultCountry\n }); // Only update the `defaultCountry` property if no phone number\n // has been entered by the user or pre-set by the application.\n\n\n var noValueHasBeenEntered = !newValue && noValueHasBeenEnteredByTheUser;\n\n if (!hasUserSelectedACountry && isNewDefaultCountrySupported && noValueHasBeenEntered) {\n return {\n country: newDefaultCountry,\n // If `phoneDigits` is empty, then automatically select the new `country`\n // and set `phoneDigits` to `+{getCountryCallingCode(newCountry)}`.\n // The code assumes that \"no phone number has been entered by the user\",\n // and no `value` property has been passed, so the `phoneNumber` parameter\n // of `_getInitialPhoneDigits({ value, phoneNumber, ... })` is `undefined`.\n phoneDigits: _getInitialPhoneDigits({\n value: undefined,\n defaultCountry: newDefaultCountry\n }),\n // `value` is `undefined` and it stays so.\n value: undefined\n };\n }\n } // If a new `value` is set externally.\n // (e.g. as a result of an ajax API request\n // to get user's phone after page loaded)\n // The first part — `newValue !== prevValue` —\n // is basically `props.value !== prevProps.value`\n // so it means \"if value property was changed externally\".\n // The second part — `newValue !== value` —\n // is for ignoring the `getDerivedStateFromProps()` call\n // which happens in `this.onChange()` right after `this.setState()`.\n // If this `getDerivedStateFromProps()` call isn't ignored\n // then the country flag would reset on each input.\n\n\n if (newValue !== prevValue && newValue !== value) {\n var phoneNumber;\n var parsedCountry;\n\n if (newValue) {\n phoneNumber = parsePhoneNumber(newValue, metadata);\n var supportedCountries = getSupportedCountries(countries, metadata);\n\n if (phoneNumber && phoneNumber.country) {\n // Ignore `else` because all countries are supported in metadata.\n\n /* istanbul ignore next */\n if (!supportedCountries || supportedCountries.indexOf(phoneNumber.country) >= 0) {\n parsedCountry = phoneNumber.country;\n }\n } else {\n parsedCountry = getCountryForPartialE164Number(newValue, {\n country: undefined,\n countries: supportedCountries,\n metadata: metadata\n });\n }\n }\n\n var hasUserSelectedACountryUpdate;\n\n if (!newValue) {\n // Reset `hasUserSelectedACountry` flag in `state`.\n hasUserSelectedACountryUpdate = {\n hasUserSelectedACountry: undefined\n };\n }\n\n return _objectSpread(_objectSpread({}, hasUserSelectedACountryUpdate), {}, {\n phoneDigits: _getInitialPhoneDigits({\n phoneNumber: phoneNumber,\n value: newValue,\n defaultCountry: newDefaultCountry\n }),\n value: newValue,\n country: newValue ? parsedCountry : newDefaultCountry\n });\n } // `defaultCountry` didn't change.\n // `value` didn't change.\n // `phoneDigits` didn't change, because `value` didn't change.\n //\n // So no need to update state.\n\n}","function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, _typeof(obj);\n}\n\nvar _excluded = [\"name\", \"disabled\", \"readOnly\", \"autoComplete\", \"style\", \"className\", \"inputRef\", \"inputComponent\", \"numberInputProps\", \"smartCaret\", \"countrySelectComponent\", \"countrySelectProps\", \"containerComponent\", \"defaultCountry\", \"countries\", \"countryOptionsOrder\", \"labels\", \"flags\", \"flagComponent\", \"flagUrl\", \"addInternationalOption\", \"internationalIcon\", \"displayInitialValueAsLocalNumber\", \"initialValueFormat\", \"onCountryChange\", \"limitMaxLength\", \"countryCallingCodeEditable\", \"focusInputOnCountrySelection\", \"reset\", \"metadata\", \"international\", \"locales\"];\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n enumerableOnly && (symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n })), keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = null != arguments[i] ? arguments[i] : {};\n i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n\n return target;\n}\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n Object.defineProperty(subClass, \"prototype\", {\n writable: false\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nfunction _createSuper(Derived) {\n var hasNativeReflectConstruct = _isNativeReflectConstruct();\n\n return function _createSuperInternal() {\n var Super = _getPrototypeOf(Derived),\n result;\n\n if (hasNativeReflectConstruct) {\n var NewTarget = _getPrototypeOf(this).constructor;\n\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return _possibleConstructorReturn(this, result);\n };\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n } else if (call !== void 0) {\n throw new TypeError(\"Derived constructors may only return object or undefined\");\n }\n\n return _assertThisInitialized(self);\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nfunction _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport InputSmart from './InputSmart.js';\nimport InputBasic from './InputBasic.js';\nimport { CountrySelectWithIcon as CountrySelect } from './CountrySelect.js';\nimport Flag from './Flag.js';\nimport InternationalIcon from './InternationalIcon.js';\nimport { sortCountryOptions, isCountrySupportedWithError, getSupportedCountries, getSupportedCountryOptions, getCountries } from './helpers/countries.js';\nimport { createCountryIconComponent } from './CountryIcon.js';\nimport { metadata as metadataPropType, labels as labelsPropType } from './PropTypes.js';\nimport { getPreSelectedCountry, getCountrySelectOptions as _getCountrySelectOptions, parsePhoneNumber, generateNationalNumberDigits, getPhoneDigitsForNewCountry, getInitialPhoneDigits, onPhoneDigitsChange, e164 } from './helpers/phoneInputHelpers.js';\nimport getPhoneInputWithCountryStateUpdateFromNewProps from './helpers/getPhoneInputWithCountryStateUpdateFromNewProps.js';\n\nvar PhoneNumberInput_ = /*#__PURE__*/function (_React$PureComponent) {\n _inherits(PhoneNumberInput_, _React$PureComponent);\n\n var _super = _createSuper(PhoneNumberInput_);\n\n function PhoneNumberInput_(props) {\n var _this;\n\n _classCallCheck(this, PhoneNumberInput_);\n\n _this = _super.call(this, props);\n\n _defineProperty(_assertThisInitialized(_this), \"setInputRef\", function (instance) {\n _this.inputRef.current = instance;\n var ref = _this.props.inputRef;\n\n if (ref) {\n if (typeof ref === 'function') {\n ref(instance);\n } else {\n ref.current = instance;\n }\n }\n });\n\n _defineProperty(_assertThisInitialized(_this), \"isCountrySupportedWithError\", function (country) {\n var metadata = _this.props.metadata;\n return isCountrySupportedWithError(country, metadata);\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onCountryChange\", function (newCountry) {\n var _this$props = _this.props,\n international = _this$props.international,\n metadata = _this$props.metadata,\n onChange = _this$props.onChange,\n focusInputOnCountrySelection = _this$props.focusInputOnCountrySelection;\n var _this$state = _this.state,\n prevPhoneDigits = _this$state.phoneDigits,\n prevCountry = _this$state.country; // After the new `country` has been selected,\n // if the phone number `` holds any digits\n // then migrate those digits for the new `country`.\n\n var newPhoneDigits = getPhoneDigitsForNewCountry(prevPhoneDigits, {\n prevCountry: prevCountry,\n newCountry: newCountry,\n metadata: metadata,\n // Convert the phone number to \"national\" format\n // when the user changes the selected country by hand.\n useNationalFormat: !international\n });\n var newValue = e164(newPhoneDigits, newCountry, metadata); // Focus phone number `` upon country selection.\n\n if (focusInputOnCountrySelection) {\n _this.inputRef.current.focus();\n } // If the user has already manually selected a country\n // then don't override that already selected country\n // if the `defaultCountry` property changes.\n // That's what `hasUserSelectedACountry` flag is for.\n\n\n _this.setState({\n country: newCountry,\n hasUserSelectedACountry: true,\n phoneDigits: newPhoneDigits,\n value: newValue\n }, function () {\n // Update the new `value` property.\n // Doing it after the `state` has been updated\n // because `onChange()` will trigger `getDerivedStateFromProps()`\n // with the new `value` which will be compared to `state.value` there.\n onChange(newValue);\n });\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onChange\", function (_phoneDigits) {\n var _this$props2 = _this.props,\n defaultCountry = _this$props2.defaultCountry,\n onChange = _this$props2.onChange,\n addInternationalOption = _this$props2.addInternationalOption,\n international = _this$props2.international,\n limitMaxLength = _this$props2.limitMaxLength,\n countryCallingCodeEditable = _this$props2.countryCallingCodeEditable,\n metadata = _this$props2.metadata;\n var _this$state2 = _this.state,\n countries = _this$state2.countries,\n prevPhoneDigits = _this$state2.phoneDigits,\n currentlySelectedCountry = _this$state2.country;\n\n var _onPhoneDigitsChange = onPhoneDigitsChange(_phoneDigits, {\n prevPhoneDigits: prevPhoneDigits,\n country: currentlySelectedCountry,\n countryRequired: !addInternationalOption,\n defaultCountry: defaultCountry,\n getAnyCountry: function getAnyCountry() {\n return _this.getFirstSupportedCountry({\n countries: countries\n });\n },\n countries: countries,\n international: international,\n limitMaxLength: limitMaxLength,\n countryCallingCodeEditable: countryCallingCodeEditable,\n metadata: metadata\n }),\n phoneDigits = _onPhoneDigitsChange.phoneDigits,\n country = _onPhoneDigitsChange.country,\n value = _onPhoneDigitsChange.value;\n\n var stateUpdate = {\n phoneDigits: phoneDigits,\n value: value,\n country: country\n };\n\n if (countryCallingCodeEditable === false) {\n // If it simply did `setState({ phoneDigits: intlPrefix })` here,\n // then it would have no effect when erasing an inital international prefix\n // via Backspace, because `phoneDigits` in `state` wouldn't change\n // as a result, because it was `prefix` and it became `prefix`,\n // so the component wouldn't rerender, and the user would be able\n // to erase the country calling code part, and that part is\n // assumed to be non-eraseable. That's why the component is\n // forcefully rerendered here.\n // https://github.com/catamphetamine/react-phone-number-input/issues/367#issuecomment-721703501\n if (!value && phoneDigits === _this.state.phoneDigits) {\n // Force a re-render of the `` in order to reset its value.\n stateUpdate.forceRerender = {};\n }\n }\n\n _this.setState(stateUpdate, // Update the new `value` property.\n // Doing it after the `state` has been updated\n // because `onChange()` will trigger `getDerivedStateFromProps()`\n // with the new `value` which will be compared to `state.value` there.\n function () {\n return onChange(value);\n });\n });\n\n _defineProperty(_assertThisInitialized(_this), \"_onFocus\", function () {\n return _this.setState({\n isFocused: true\n });\n });\n\n _defineProperty(_assertThisInitialized(_this), \"_onBlur\", function () {\n return _this.setState({\n isFocused: false\n });\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onFocus\", function (event) {\n _this._onFocus();\n\n var onFocus = _this.props.onFocus;\n\n if (onFocus) {\n onFocus(event);\n }\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onBlur\", function (event) {\n var onBlur = _this.props.onBlur;\n\n _this._onBlur();\n\n if (onBlur) {\n onBlur(event);\n }\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onCountryFocus\", function (event) {\n _this._onFocus(); // this.setState({ countrySelectFocused: true })\n\n\n var countrySelectProps = _this.props.countrySelectProps;\n\n if (countrySelectProps) {\n var onFocus = countrySelectProps.onFocus;\n\n if (onFocus) {\n onFocus(event);\n }\n }\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onCountryBlur\", function (event) {\n _this._onBlur(); // this.setState({ countrySelectFocused: false })\n\n\n var countrySelectProps = _this.props.countrySelectProps;\n\n if (countrySelectProps) {\n var onBlur = countrySelectProps.onBlur;\n\n if (onBlur) {\n onBlur(event);\n }\n }\n });\n\n _this.inputRef = /*#__PURE__*/React.createRef();\n var _this$props3 = _this.props,\n _value = _this$props3.value,\n labels = _this$props3.labels,\n _international = _this$props3.international,\n _addInternationalOption = _this$props3.addInternationalOption,\n displayInitialValueAsLocalNumber = _this$props3.displayInitialValueAsLocalNumber,\n initialValueFormat = _this$props3.initialValueFormat,\n _metadata = _this$props3.metadata;\n var _this$props4 = _this.props,\n _defaultCountry = _this$props4.defaultCountry,\n _countries = _this$props4.countries; // Validate `defaultCountry`.\n\n if (_defaultCountry) {\n if (!_this.isCountrySupportedWithError(_defaultCountry)) {\n _defaultCountry = undefined;\n }\n } // Validate `countries`.\n\n\n _countries = getSupportedCountries(_countries, _metadata);\n var phoneNumber = parsePhoneNumber(_value, _metadata);\n _this.CountryIcon = createCountryIconComponent(_this.props);\n var preSelectedCountry = getPreSelectedCountry({\n value: _value,\n phoneNumber: phoneNumber,\n defaultCountry: _defaultCountry,\n required: !_addInternationalOption,\n countries: _countries || getCountries(_metadata),\n getAnyCountry: function getAnyCountry() {\n return _this.getFirstSupportedCountry({\n countries: _countries\n });\n },\n metadata: _metadata\n });\n _this.state = {\n // Workaround for `this.props` inside `getDerivedStateFromProps()`.\n props: _this.props,\n // The country selected.\n country: preSelectedCountry,\n // `countries` are stored in `this.state` because they're filtered.\n // For example, a developer might theoretically pass some unsupported\n // countries as part of the `countries` property, and because of that\n // the component uses `this.state.countries` (which are filtered)\n // instead of `this.props.countries`\n // (which could potentially contain unsupported countries).\n countries: _countries,\n // `phoneDigits` state property holds non-formatted user's input.\n // The reason is that there's no way of finding out\n // in which form should `value` be displayed: international or national.\n // E.g. if `value` is `+78005553535` then it could be input\n // by a user both as `8 (800) 555-35-35` and `+7 800 555 35 35`.\n // Hence storing just `value` is not sufficient for correct formatting.\n // E.g. if a user entered `8 (800) 555-35-35`\n // then value is `+78005553535` and `phoneDigits` are `88005553535`\n // and if a user entered `+7 800 555 35 35`\n // then value is `+78005553535` and `phoneDigits` are `+78005553535`.\n phoneDigits: getInitialPhoneDigits({\n value: _value,\n phoneNumber: phoneNumber,\n defaultCountry: _defaultCountry,\n international: _international,\n useNationalFormat: displayInitialValueAsLocalNumber || initialValueFormat === 'national',\n metadata: _metadata\n }),\n // `value` property is duplicated in state.\n // The reason is that `getDerivedStateFromProps()`\n // needs this `value` to compare to the new `value` property\n // to find out if `phoneDigits` needs updating:\n // If the `value` property was changed externally\n // then it won't be equal to `state.value`\n // in which case `phoneDigits` and `country` should be updated.\n value: _value\n };\n return _this;\n }\n\n _createClass(PhoneNumberInput_, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n var onCountryChange = this.props.onCountryChange;\n var defaultCountry = this.props.defaultCountry;\n var selectedCountry = this.state.country;\n\n if (onCountryChange) {\n if (defaultCountry) {\n if (!this.isCountrySupportedWithError(defaultCountry)) {\n defaultCountry = undefined;\n }\n }\n\n if (selectedCountry !== defaultCountry) {\n onCountryChange(selectedCountry);\n }\n }\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps, prevState) {\n var onCountryChange = this.props.onCountryChange;\n var country = this.state.country; // Call `onCountryChange` when user selects another country.\n\n if (onCountryChange && country !== prevState.country) {\n onCountryChange(country);\n }\n }\n }, {\n key: \"getCountrySelectOptions\",\n value: function getCountrySelectOptions(_ref) {\n var countries = _ref.countries;\n var _this$props5 = this.props,\n international = _this$props5.international,\n countryCallingCodeEditable = _this$props5.countryCallingCodeEditable,\n countryOptionsOrder = _this$props5.countryOptionsOrder,\n addInternationalOption = _this$props5.addInternationalOption,\n labels = _this$props5.labels,\n locales = _this$props5.locales,\n metadata = _this$props5.metadata;\n return this.useMemoCountrySelectOptions(function () {\n return sortCountryOptions(_getCountrySelectOptions({\n countries: countries || getCountries(metadata),\n countryNames: labels,\n addInternationalOption: international && countryCallingCodeEditable === false ? false : addInternationalOption,\n compareStringsLocales: locales // compareStrings\n\n }), getSupportedCountryOptions(countryOptionsOrder, metadata));\n }, [countries, countryOptionsOrder, addInternationalOption, labels, metadata]);\n }\n }, {\n key: \"useMemoCountrySelectOptions\",\n value: function useMemoCountrySelectOptions(generator, dependencies) {\n if (!this.countrySelectOptionsMemoDependencies || !areEqualArrays(dependencies, this.countrySelectOptionsMemoDependencies)) {\n this.countrySelectOptionsMemo = generator();\n this.countrySelectOptionsMemoDependencies = dependencies;\n }\n\n return this.countrySelectOptionsMemo;\n }\n }, {\n key: \"getFirstSupportedCountry\",\n value: function getFirstSupportedCountry(_ref2) {\n var countries = _ref2.countries;\n var countryOptions = this.getCountrySelectOptions({\n countries: countries\n });\n return countryOptions[0].value;\n } // A shorthand for not passing `metadata` as a second argument.\n\n }, {\n key: \"render\",\n value: function render() {\n var _this$props6 = this.props,\n name = _this$props6.name,\n disabled = _this$props6.disabled,\n readOnly = _this$props6.readOnly,\n autoComplete = _this$props6.autoComplete,\n style = _this$props6.style,\n className = _this$props6.className,\n inputRef = _this$props6.inputRef,\n inputComponent = _this$props6.inputComponent,\n numberInputProps = _this$props6.numberInputProps,\n smartCaret = _this$props6.smartCaret,\n CountrySelectComponent = _this$props6.countrySelectComponent,\n countrySelectProps = _this$props6.countrySelectProps,\n ContainerComponent = _this$props6.containerComponent,\n defaultCountry = _this$props6.defaultCountry,\n countriesProperty = _this$props6.countries,\n countryOptionsOrder = _this$props6.countryOptionsOrder,\n labels = _this$props6.labels,\n flags = _this$props6.flags,\n flagComponent = _this$props6.flagComponent,\n flagUrl = _this$props6.flagUrl,\n addInternationalOption = _this$props6.addInternationalOption,\n internationalIcon = _this$props6.internationalIcon,\n displayInitialValueAsLocalNumber = _this$props6.displayInitialValueAsLocalNumber,\n initialValueFormat = _this$props6.initialValueFormat,\n onCountryChange = _this$props6.onCountryChange,\n limitMaxLength = _this$props6.limitMaxLength,\n countryCallingCodeEditable = _this$props6.countryCallingCodeEditable,\n focusInputOnCountrySelection = _this$props6.focusInputOnCountrySelection,\n reset = _this$props6.reset,\n metadata = _this$props6.metadata,\n international = _this$props6.international,\n locales = _this$props6.locales,\n rest = _objectWithoutProperties(_this$props6, _excluded);\n\n var _this$state3 = this.state,\n country = _this$state3.country,\n countries = _this$state3.countries,\n phoneDigits = _this$state3.phoneDigits,\n isFocused = _this$state3.isFocused;\n var InputComponent = smartCaret ? InputSmart : InputBasic;\n var countrySelectOptions = this.getCountrySelectOptions({\n countries: countries\n });\n return /*#__PURE__*/React.createElement(ContainerComponent, {\n style: style,\n className: classNames(className, 'PhoneInput', {\n 'PhoneInput--focus': isFocused,\n 'PhoneInput--disabled': disabled,\n 'PhoneInput--readOnly': readOnly\n })\n }, /*#__PURE__*/React.createElement(CountrySelectComponent, _extends({\n name: name ? \"\".concat(name, \"Country\") : undefined,\n \"aria-label\": labels.country\n }, countrySelectProps, {\n value: country,\n options: countrySelectOptions,\n onChange: this.onCountryChange,\n onFocus: this.onCountryFocus,\n onBlur: this.onCountryBlur,\n disabled: disabled || countrySelectProps && countrySelectProps.disabled,\n readOnly: readOnly || countrySelectProps && countrySelectProps.readOnly,\n iconComponent: this.CountryIcon\n })), /*#__PURE__*/React.createElement(InputComponent, _extends({\n ref: this.setInputRef,\n type: \"tel\",\n autoComplete: autoComplete\n }, numberInputProps, rest, {\n name: name,\n metadata: metadata,\n country: country,\n value: phoneDigits || '',\n onChange: this.onChange,\n onFocus: this.onFocus,\n onBlur: this.onBlur,\n disabled: disabled,\n readOnly: readOnly,\n inputComponent: inputComponent,\n className: classNames('PhoneInputInput', numberInputProps && numberInputProps.className, rest.className)\n })));\n }\n }], [{\n key: \"getDerivedStateFromProps\",\n value: // `state` holds previous props as `props`, and also:\n // * `country` — The currently selected country, e.g. `\"RU\"`.\n // * `value` — The currently entered phone number (E.164), e.g. `+78005553535`.\n // * `phoneDigits` — The parsed `` value, e.g. `8005553535`.\n // (and a couple of other less significant properties)\n function getDerivedStateFromProps(props, state) {\n return _objectSpread({\n // Emulate `prevProps` via `state.props`.\n props: props\n }, getPhoneInputWithCountryStateUpdateFromNewProps(props, state.props, state));\n }\n }]);\n\n return PhoneNumberInput_;\n}(React.PureComponent); // This wrapper is only to `.forwardRef()` to the ``.\n\n\nvar PhoneNumberInput = /*#__PURE__*/React.forwardRef(function (props, ref) {\n return /*#__PURE__*/React.createElement(PhoneNumberInput_, _extends({}, props, {\n inputRef: ref\n }));\n});\nPhoneNumberInput.defaultProps = {\n /**\r\n * Remember (and autofill) the value as a phone number.\r\n */\n autoComplete: 'tel',\n\n /**\r\n * Country `` component.\r\n */\n countrySelectComponent: CountrySelect,\n\n /**\r\n * Flag icon component.\r\n */\n flagComponent: Flag,\n\n /**\r\n * By default, uses icons from `country-flag-icons` gitlab pages website.\r\n */\n // Must be equal to `flagUrl` in `./CountryIcon.js`.\n flagUrl: 'https://purecatamphetamine.github.io/country-flag-icons/3x2/{XX}.svg',\n\n /**\r\n * Default \"International\" country `` option icon.\r\n */\n internationalIcon: InternationalIcon,\n\n /**\r\n * Phone number `` component.\r\n */\n inputComponent: 'input',\n\n /**\r\n * Wrapping `` component.\r\n */\n containerComponent: 'div',\n\n /**\r\n * Some users requested a way to reset the component:\r\n * both number `` and country ``.\r\n * Whenever `reset` property changes both number ``\r\n * and country `` are reset.\r\n * It's not implemented as some instance `.reset()` method\r\n * because `ref` is forwarded to ``.\r\n * It's also not replaced with just resetting `country` on\r\n * external `value` reset, because a user could select a country\r\n * and then not input any `value`, and so the selected country\r\n * would be \"stuck\", if not using this `reset` property.\r\n */\n // https://github.com/catamphetamine/react-phone-number-input/issues/300\n reset: PropTypes.any,\n\n /**\r\n *\r\n */\n\n /**\r\n * Set to `false` to use \"basic\" caret instead of the \"smart\" one.\r\n */\n smartCaret: true,\n\n /**\r\n * Whether to add the \"International\" option\r\n * to the list of countries.\r\n */\n addInternationalOption: true,\n\n /**\r\n * If set to `true` the phone number input will get trimmed\r\n * if it exceeds the maximum length for the country.\r\n */\n limitMaxLength: false,\n\n /**\r\n * If set to `false`, and `international` is `true`, then\r\n * users won't be able to erase the \"country calling part\"\r\n * of a phone number in the ``.\r\n */\n countryCallingCodeEditable: true,\n\n /**\r\n * If set to `false`, will not focus the `` component\r\n * when the user selects a country from the list of countries.\r\n * This can be used to conform to the Web Content Accessibility Guidelines (WCAG).\r\n * Quote:\r\n * \"On input: Changing the setting of any user interface component\r\n * does not automatically cause a change of context unless the user\r\n * has been advised of the behaviour before using the component.\"\r\n */\n focusInputOnCountrySelection: true\n};\nexport default PhoneNumberInput;\n\nfunction areEqualArrays(a, b) {\n if (a.length !== b.length) {\n return false;\n }\n\n var i = 0;\n\n while (i < a.length) {\n if (a[i] !== b[i]) {\n return false;\n }\n\n i++;\n }\n\n return true;\n}","function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nimport React from 'react';\nimport labels from '../locale/en.json.js';\nimport { metadata as metadataPropType, labels as labelsPropType } from './PropTypes.js';\nimport PhoneInput from './PhoneInputWithCountry.js';\nexport function createPhoneInput(defaultMetadata) {\n var PhoneInputDefault = /*#__PURE__*/React.forwardRef(function (props, ref) {\n return /*#__PURE__*/React.createElement(PhoneInput, _extends({\n ref: ref\n }, props));\n });\n PhoneInputDefault.defaultProps = {\n metadata: defaultMetadata,\n labels: labels\n };\n return PhoneInputDefault;\n}\nexport default createPhoneInput();","import metadata from 'libphonenumber-js/min/metadata';\nimport { parsePhoneNumber as _parsePhoneNumber, formatPhoneNumber as _formatPhoneNumber, formatPhoneNumberIntl as _formatPhoneNumberIntl, isValidPhoneNumber as _isValidPhoneNumber, isPossiblePhoneNumber as _isPossiblePhoneNumber, getCountries as _getCountries, getCountryCallingCode as _getCountryCallingCode, isSupportedCountry as _isSupportedCountry } from '../core/index.js';\nimport { createPhoneInput } from '../modules/PhoneInputWithCountryDefault.js';\n\nfunction call(func, _arguments) {\n var args = Array.prototype.slice.call(_arguments);\n args.push(metadata);\n return func.apply(this, args);\n}\n\nexport default createPhoneInput(metadata);\nexport function parsePhoneNumber() {\n return call(_parsePhoneNumber, arguments);\n}\nexport function formatPhoneNumber() {\n return call(_formatPhoneNumber, arguments);\n}\nexport function formatPhoneNumberIntl() {\n return call(_formatPhoneNumberIntl, arguments);\n}\nexport function isValidPhoneNumber() {\n return call(_isValidPhoneNumber, arguments);\n}\nexport function isPossiblePhoneNumber() {\n return call(_isPossiblePhoneNumber, arguments);\n}\nexport function getCountries() {\n return call(_getCountries, arguments);\n}\nexport function getCountryCallingCode() {\n return call(_getCountryCallingCode, arguments);\n}\nexport function isSupportedCountry() {\n return call(_isSupportedCountry, arguments);\n}","module.exports = require('./lib/_stream_writable.js');","var __assign = this && this.__assign || function () {\n __assign = Object.assign || function (t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return __assign.apply(this, arguments);\n};\n\nvar MS_PER_SECOND = 1e3;\nvar SECS_PER_MIN = 60;\nvar SECS_PER_HOUR = SECS_PER_MIN * 60;\nvar SECS_PER_DAY = SECS_PER_HOUR * 24;\nvar SECS_PER_WEEK = SECS_PER_DAY * 7;\nexport function selectUnit(from, to, thresholds) {\n if (to === void 0) {\n to = Date.now();\n }\n\n if (thresholds === void 0) {\n thresholds = {};\n }\n\n var resolvedThresholds = __assign(__assign({}, DEFAULT_THRESHOLDS), thresholds || {});\n\n var secs = (+from - +to) / MS_PER_SECOND;\n\n if (Math.abs(secs) < resolvedThresholds.second) {\n return {\n value: Math.round(secs),\n unit: 'second'\n };\n }\n\n var mins = secs / SECS_PER_MIN;\n\n if (Math.abs(mins) < resolvedThresholds.minute) {\n return {\n value: Math.round(mins),\n unit: 'minute'\n };\n }\n\n var hours = secs / SECS_PER_HOUR;\n\n if (Math.abs(hours) < resolvedThresholds.hour) {\n return {\n value: Math.round(hours),\n unit: 'hour'\n };\n }\n\n var days = secs / SECS_PER_DAY;\n\n if (Math.abs(days) < resolvedThresholds.day) {\n return {\n value: Math.round(days),\n unit: 'day'\n };\n }\n\n var fromDate = new Date(from);\n var toDate = new Date(to);\n var years = fromDate.getFullYear() - toDate.getFullYear();\n\n if (Math.round(Math.abs(years)) > 0) {\n return {\n value: Math.round(years),\n unit: 'year'\n };\n }\n\n var months = years * 12 + fromDate.getMonth() - toDate.getMonth();\n\n if (Math.round(Math.abs(months)) > 0) {\n return {\n value: Math.round(months),\n unit: 'month'\n };\n }\n\n var weeks = secs / SECS_PER_WEEK;\n return {\n value: Math.round(weeks),\n unit: 'week'\n };\n}\nexport var DEFAULT_THRESHOLDS = {\n second: 45,\n minute: 45,\n hour: 22,\n day: 5\n};","/* @generated */\n// prettier-ignore \nexport default {\n \"aa-SAAHO\": \"ssy\",\n \"aam\": \"aas\",\n \"aar\": \"aa\",\n \"abk\": \"ab\",\n \"adp\": \"dz\",\n \"afr\": \"af\",\n \"aju\": \"jrb\",\n \"aka\": \"ak\",\n \"alb\": \"sq\",\n \"als\": \"sq\",\n \"amh\": \"am\",\n \"ara\": \"ar\",\n \"arb\": \"ar\",\n \"arg\": \"an\",\n \"arm\": \"hy\",\n \"art-lojban\": \"jbo\",\n \"asd\": \"snz\",\n \"asm\": \"as\",\n \"aue\": \"ktz\",\n \"ava\": \"av\",\n \"ave\": \"ae\",\n \"aym\": \"ay\",\n \"ayr\": \"ay\",\n \"ayx\": \"nun\",\n \"az-AZ\": \"az-Latn-AZ\",\n \"aze\": \"az\",\n \"azj\": \"az\",\n \"bak\": \"ba\",\n \"bam\": \"bm\",\n \"baq\": \"eu\",\n \"bcc\": \"bal\",\n \"bcl\": \"bik\",\n \"bel\": \"be\",\n \"ben\": \"bn\",\n \"bgm\": \"bcg\",\n \"bh\": \"bho\",\n \"bih\": \"bho\",\n \"bis\": \"bi\",\n \"bjd\": \"drl\",\n \"bod\": \"bo\",\n \"bos\": \"bs\",\n \"bre\": \"br\",\n \"bs-BA\": \"bs-Latn-BA\",\n \"bul\": \"bg\",\n \"bur\": \"my\",\n \"bxk\": \"luy\",\n \"bxr\": \"bua\",\n \"cat\": \"ca\",\n \"ccq\": \"rki\",\n \"cel-gaulish\": \"xtg-x-cel-gaulish\",\n \"ces\": \"cs\",\n \"cha\": \"ch\",\n \"che\": \"ce\",\n \"chi\": \"zh\",\n \"chu\": \"cu\",\n \"chv\": \"cv\",\n \"cjr\": \"mom\",\n \"cka\": \"cmr\",\n \"cld\": \"syr\",\n \"cmk\": \"xch\",\n \"cmn\": \"zh\",\n \"cnr\": \"sr-ME\",\n \"cor\": \"kw\",\n \"cos\": \"co\",\n \"coy\": \"pij\",\n \"cqu\": \"quh\",\n \"cre\": \"cr\",\n \"cwd\": \"cr\",\n \"cym\": \"cy\",\n \"cze\": \"cs\",\n \"dan\": \"da\",\n \"deu\": \"de\",\n \"dgo\": \"doi\",\n \"dhd\": \"mwr\",\n \"dik\": \"din\",\n \"diq\": \"zza\",\n \"dit\": \"dif\",\n \"div\": \"dv\",\n \"drh\": \"mn\",\n \"drw\": \"fa-af\",\n \"dut\": \"nl\",\n \"dzo\": \"dz\",\n \"ekk\": \"et\",\n \"ell\": \"el\",\n \"emk\": \"man\",\n \"eng\": \"en\",\n \"epo\": \"eo\",\n \"esk\": \"ik\",\n \"est\": \"et\",\n \"eus\": \"eu\",\n \"ewe\": \"ee\",\n \"fao\": \"fo\",\n \"fas\": \"fa\",\n \"fat\": \"ak\",\n \"fij\": \"fj\",\n \"fin\": \"fi\",\n \"fra\": \"fr\",\n \"fre\": \"fr\",\n \"fry\": \"fy\",\n \"fuc\": \"ff\",\n \"ful\": \"ff\",\n \"gav\": \"dev\",\n \"gaz\": \"om\",\n \"gbo\": \"grb\",\n \"geo\": \"ka\",\n \"ger\": \"de\",\n \"gfx\": \"vaj\",\n \"ggn\": \"gvr\",\n \"gla\": \"gd\",\n \"gle\": \"ga\",\n \"glg\": \"gl\",\n \"glv\": \"gv\",\n \"gno\": \"gon\",\n \"gre\": \"el\",\n \"grn\": \"gn\",\n \"gti\": \"nyc\",\n \"gug\": \"gn\",\n \"guj\": \"gu\",\n \"guv\": \"duz\",\n \"gya\": \"gba\",\n \"ha-Latn-GH\": \"ha-GH\",\n \"ha-Latn-NE\": \"ha-NE\",\n \"ha-Latn-NG\": \"ha-NG\",\n \"hat\": \"ht\",\n \"hau\": \"ha\",\n \"hbs\": \"sr-Latn\",\n \"hdn\": \"hai\",\n \"hea\": \"hmn\",\n \"heb\": \"he\",\n \"her\": \"hz\",\n \"him\": \"srx\",\n \"hin\": \"hi\",\n \"hmo\": \"ho\",\n \"hrr\": \"jal\",\n \"hrv\": \"hr\",\n \"hun\": \"hu\",\n \"hye\": \"hy\",\n \"i-ami\": \"ami\",\n \"i-bnn\": \"bnn\",\n \"i-hak\": \"hak\",\n \"i-klingon\": \"tlh\",\n \"i-lux\": \"lb\",\n \"i-navajo\": \"nv\",\n \"i-pwn\": \"pwn\",\n \"i-tao\": \"tao\",\n \"i-tay\": \"tay\",\n \"i-tsu\": \"tsu\",\n \"i-default\": \"en-x-i-default\",\n \"i-enochian\": \"und-x-i-enochian\",\n \"i-mingo\": \"see-x-i-mingo\",\n \"ibi\": \"opa\",\n \"ibo\": \"ig\",\n \"ice\": \"is\",\n \"ido\": \"io\",\n \"iii\": \"ii\",\n \"ike\": \"iu\",\n \"iku\": \"iu\",\n \"ile\": \"ie\",\n \"ilw\": \"gal\",\n \"in\": \"id\",\n \"ina\": \"ia\",\n \"ind\": \"id\",\n \"ipk\": \"ik\",\n \"isl\": \"is\",\n \"ita\": \"it\",\n \"iw\": \"he\",\n \"jav\": \"jv\",\n \"jeg\": \"oyb\",\n \"ji\": \"yi\",\n \"jpn\": \"ja\",\n \"jw\": \"jv\",\n \"kal\": \"kl\",\n \"kan\": \"kn\",\n \"kas\": \"ks\",\n \"kat\": \"ka\",\n \"kau\": \"kr\",\n \"kaz\": \"kk\",\n \"kgc\": \"tdf\",\n \"kgh\": \"kml\",\n \"khk\": \"mn\",\n \"khm\": \"km\",\n \"kik\": \"ki\",\n \"kin\": \"rw\",\n \"kir\": \"ky\",\n \"kk-Cyrl-KZ\": \"kk-KZ\",\n \"kmr\": \"ku\",\n \"knc\": \"kr\",\n \"kng\": \"kg\",\n \"knn\": \"kok\",\n \"koj\": \"kwv\",\n \"kom\": \"kv\",\n \"kon\": \"kg\",\n \"kor\": \"ko\",\n \"kpv\": \"kv\",\n \"krm\": \"bmf\",\n \"ks-Arab-IN\": \"ks-IN\",\n \"ktr\": \"dtp\",\n \"kua\": \"kj\",\n \"kur\": \"ku\",\n \"kvs\": \"gdj\",\n \"kwq\": \"yam\",\n \"kxe\": \"tvd\",\n \"ky-Cyrl-KG\": \"ky-KG\",\n \"kzj\": \"dtp\",\n \"kzt\": \"dtp\",\n \"lao\": \"lo\",\n \"lat\": \"la\",\n \"lav\": \"lv\",\n \"lbk\": \"bnc\",\n \"lii\": \"raq\",\n \"lim\": \"li\",\n \"lin\": \"ln\",\n \"lit\": \"lt\",\n \"llo\": \"ngt\",\n \"lmm\": \"rmx\",\n \"ltz\": \"lb\",\n \"lub\": \"lu\",\n \"lug\": \"lg\",\n \"lvs\": \"lv\",\n \"mac\": \"mk\",\n \"mah\": \"mh\",\n \"mal\": \"ml\",\n \"mao\": \"mi\",\n \"mar\": \"mr\",\n \"may\": \"ms\",\n \"meg\": \"cir\",\n \"mhr\": \"chm\",\n \"mkd\": \"mk\",\n \"mlg\": \"mg\",\n \"mlt\": \"mt\",\n \"mn-Cyrl-MN\": \"mn-MN\",\n \"mnk\": \"man\",\n \"mo\": \"ro\",\n \"mol\": \"ro\",\n \"mon\": \"mn\",\n \"mri\": \"mi\",\n \"ms-Latn-BN\": \"ms-BN\",\n \"ms-Latn-MY\": \"ms-MY\",\n \"ms-Latn-SG\": \"ms-SG\",\n \"msa\": \"ms\",\n \"mst\": \"mry\",\n \"mup\": \"raj\",\n \"mwj\": \"vaj\",\n \"mya\": \"my\",\n \"myd\": \"aog\",\n \"myt\": \"mry\",\n \"nad\": \"xny\",\n \"nau\": \"na\",\n \"nav\": \"nv\",\n \"nbl\": \"nr\",\n \"ncp\": \"kdz\",\n \"nde\": \"nd\",\n \"ndo\": \"ng\",\n \"nep\": \"ne\",\n \"nld\": \"nl\",\n \"nno\": \"nn\",\n \"nns\": \"nbr\",\n \"nnx\": \"ngv\",\n \"no\": \"nb\",\n \"no-bok\": \"nb\",\n \"no-BOKMAL\": \"nb\",\n \"no-nyn\": \"nn\",\n \"no-NYNORSK\": \"nn\",\n \"nob\": \"nb\",\n \"nor\": \"nb\",\n \"npi\": \"ne\",\n \"nts\": \"pij\",\n \"nya\": \"ny\",\n \"oci\": \"oc\",\n \"ojg\": \"oj\",\n \"oji\": \"oj\",\n \"ori\": \"or\",\n \"orm\": \"om\",\n \"ory\": \"or\",\n \"oss\": \"os\",\n \"oun\": \"vaj\",\n \"pa-IN\": \"pa-Guru-IN\",\n \"pa-PK\": \"pa-Arab-PK\",\n \"pan\": \"pa\",\n \"pbu\": \"ps\",\n \"pcr\": \"adx\",\n \"per\": \"fa\",\n \"pes\": \"fa\",\n \"pli\": \"pi\",\n \"plt\": \"mg\",\n \"pmc\": \"huw\",\n \"pmu\": \"phr\",\n \"pnb\": \"lah\",\n \"pol\": \"pl\",\n \"por\": \"pt\",\n \"ppa\": \"bfy\",\n \"ppr\": \"lcq\",\n \"prs\": \"fa-AF\",\n \"pry\": \"prt\",\n \"pus\": \"ps\",\n \"puz\": \"pub\",\n \"que\": \"qu\",\n \"quz\": \"qu\",\n \"rmy\": \"rom\",\n \"roh\": \"rm\",\n \"ron\": \"ro\",\n \"rum\": \"ro\",\n \"run\": \"rn\",\n \"rus\": \"ru\",\n \"sag\": \"sg\",\n \"san\": \"sa\",\n \"sca\": \"hle\",\n \"scc\": \"sr\",\n \"scr\": \"hr\",\n \"sgn-BE-FR\": \"sfb\",\n \"sgn-BE-NL\": \"vgt\",\n \"sgn-CH-DE\": \"sgg\",\n \"sh\": \"sr-Latn\",\n \"shi-MA\": \"shi-Tfng-MA\",\n \"sin\": \"si\",\n \"skk\": \"oyb\",\n \"slk\": \"sk\",\n \"slo\": \"sk\",\n \"slv\": \"sl\",\n \"sme\": \"se\",\n \"smo\": \"sm\",\n \"sna\": \"sn\",\n \"snd\": \"sd\",\n \"som\": \"so\",\n \"sot\": \"st\",\n \"spa\": \"es\",\n \"spy\": \"kln\",\n \"sqi\": \"sq\",\n \"sr-BA\": \"sr-Cyrl-BA\",\n \"sr-ME\": \"sr-Latn-ME\",\n \"sr-RS\": \"sr-Cyrl-RS\",\n \"sr-XK\": \"sr-Cyrl-XK\",\n \"src\": \"sc\",\n \"srd\": \"sc\",\n \"srp\": \"sr\",\n \"ssw\": \"ss\",\n \"sun\": \"su\",\n \"swa\": \"sw\",\n \"swc\": \"sw-CD\",\n \"swe\": \"sv\",\n \"swh\": \"sw\",\n \"tah\": \"ty\",\n \"tam\": \"ta\",\n \"tat\": \"tt\",\n \"tdu\": \"dtp\",\n \"tel\": \"te\",\n \"tgk\": \"tg\",\n \"tgl\": \"fil\",\n \"tha\": \"th\",\n \"thc\": \"tpo\",\n \"thx\": \"oyb\",\n \"tib\": \"bo\",\n \"tie\": \"ras\",\n \"tir\": \"ti\",\n \"tkk\": \"twm\",\n \"tl\": \"fil\",\n \"tlw\": \"weo\",\n \"tmp\": \"tyj\",\n \"tne\": \"kak\",\n \"tnf\": \"fa-af\",\n \"ton\": \"to\",\n \"tsf\": \"taj\",\n \"tsn\": \"tn\",\n \"tso\": \"ts\",\n \"ttq\": \"tmh\",\n \"tuk\": \"tk\",\n \"tur\": \"tr\",\n \"tw\": \"ak\",\n \"twi\": \"ak\",\n \"tzm-Latn-MA\": \"tzm-MA\",\n \"ug-Arab-CN\": \"ug-CN\",\n \"uig\": \"ug\",\n \"ukr\": \"uk\",\n \"umu\": \"del\",\n \"uok\": \"ema\",\n \"urd\": \"ur\",\n \"uz-AF\": \"uz-Arab-AF\",\n \"uz-UZ\": \"uz-Latn-UZ\",\n \"uzb\": \"uz\",\n \"uzn\": \"uz\",\n \"vai-LR\": \"vai-Vaii-LR\",\n \"ven\": \"ve\",\n \"vie\": \"vi\",\n \"vol\": \"vo\",\n \"wel\": \"cy\",\n \"wln\": \"wa\",\n \"wol\": \"wo\",\n \"xba\": \"cax\",\n \"xho\": \"xh\",\n \"xia\": \"acn\",\n \"xkh\": \"waw\",\n \"xpe\": \"kpe\",\n \"xsj\": \"suj\",\n \"xsl\": \"den\",\n \"ybd\": \"rki\",\n \"ydd\": \"yi\",\n \"yid\": \"yi\",\n \"yma\": \"lrr\",\n \"ymt\": \"mtm\",\n \"yor\": \"yo\",\n \"yos\": \"zom\",\n \"yue-CN\": \"yue-Hans-CN\",\n \"yue-HK\": \"yue-Hant-HK\",\n \"yuu\": \"yug\",\n \"zai\": \"zap\",\n \"zh-CN\": \"zh-Hans-CN\",\n \"zh-guoyu\": \"zh\",\n \"zh-hakka\": \"hak\",\n \"zh-HK\": \"zh-Hant-HK\",\n \"zh-min-nan\": \"nan\",\n \"zh-MO\": \"zh-Hant-MO\",\n \"zh-SG\": \"zh-Hans-SG\",\n \"zh-TW\": \"zh-Hant-TW\",\n \"zh-xiang\": \"hsn\",\n \"zh-min\": \"nan-x-zh-min\",\n \"zha\": \"za\",\n \"zho\": \"zh\",\n \"zsm\": \"ms\",\n \"zul\": \"zu\",\n \"zyb\": \"za\"\n};","/* @generated */\n// prettier-ignore \nexport default {\n \"en-150\": \"en-001\",\n \"en-AG\": \"en-001\",\n \"en-AI\": \"en-001\",\n \"en-AU\": \"en-001\",\n \"en-BB\": \"en-001\",\n \"en-BM\": \"en-001\",\n \"en-BS\": \"en-001\",\n \"en-BW\": \"en-001\",\n \"en-BZ\": \"en-001\",\n \"en-CA\": \"en-001\",\n \"en-CC\": \"en-001\",\n \"en-CK\": \"en-001\",\n \"en-CM\": \"en-001\",\n \"en-CX\": \"en-001\",\n \"en-CY\": \"en-001\",\n \"en-DG\": \"en-001\",\n \"en-DM\": \"en-001\",\n \"en-ER\": \"en-001\",\n \"en-FJ\": \"en-001\",\n \"en-FK\": \"en-001\",\n \"en-FM\": \"en-001\",\n \"en-GB\": \"en-001\",\n \"en-GD\": \"en-001\",\n \"en-GG\": \"en-001\",\n \"en-GH\": \"en-001\",\n \"en-GI\": \"en-001\",\n \"en-GM\": \"en-001\",\n \"en-GY\": \"en-001\",\n \"en-HK\": \"en-001\",\n \"en-IE\": \"en-001\",\n \"en-IL\": \"en-001\",\n \"en-IM\": \"en-001\",\n \"en-IN\": \"en-001\",\n \"en-IO\": \"en-001\",\n \"en-JE\": \"en-001\",\n \"en-JM\": \"en-001\",\n \"en-KE\": \"en-001\",\n \"en-KI\": \"en-001\",\n \"en-KN\": \"en-001\",\n \"en-KY\": \"en-001\",\n \"en-LC\": \"en-001\",\n \"en-LR\": \"en-001\",\n \"en-LS\": \"en-001\",\n \"en-MG\": \"en-001\",\n \"en-MO\": \"en-001\",\n \"en-MS\": \"en-001\",\n \"en-MT\": \"en-001\",\n \"en-MU\": \"en-001\",\n \"en-MW\": \"en-001\",\n \"en-MY\": \"en-001\",\n \"en-NA\": \"en-001\",\n \"en-NF\": \"en-001\",\n \"en-NG\": \"en-001\",\n \"en-NR\": \"en-001\",\n \"en-NU\": \"en-001\",\n \"en-NZ\": \"en-001\",\n \"en-PG\": \"en-001\",\n \"en-PH\": \"en-001\",\n \"en-PK\": \"en-001\",\n \"en-PN\": \"en-001\",\n \"en-PW\": \"en-001\",\n \"en-RW\": \"en-001\",\n \"en-SB\": \"en-001\",\n \"en-SC\": \"en-001\",\n \"en-SD\": \"en-001\",\n \"en-SG\": \"en-001\",\n \"en-SH\": \"en-001\",\n \"en-SL\": \"en-001\",\n \"en-SS\": \"en-001\",\n \"en-SX\": \"en-001\",\n \"en-SZ\": \"en-001\",\n \"en-TC\": \"en-001\",\n \"en-TK\": \"en-001\",\n \"en-TO\": \"en-001\",\n \"en-TT\": \"en-001\",\n \"en-TV\": \"en-001\",\n \"en-TZ\": \"en-001\",\n \"en-UG\": \"en-001\",\n \"en-VC\": \"en-001\",\n \"en-VG\": \"en-001\",\n \"en-VU\": \"en-001\",\n \"en-WS\": \"en-001\",\n \"en-ZA\": \"en-001\",\n \"en-ZM\": \"en-001\",\n \"en-ZW\": \"en-001\",\n \"en-AT\": \"en-150\",\n \"en-BE\": \"en-150\",\n \"en-CH\": \"en-150\",\n \"en-DE\": \"en-150\",\n \"en-DK\": \"en-150\",\n \"en-FI\": \"en-150\",\n \"en-NL\": \"en-150\",\n \"en-SE\": \"en-150\",\n \"en-SI\": \"en-150\",\n \"es-AR\": \"es-419\",\n \"es-BO\": \"es-419\",\n \"es-BR\": \"es-419\",\n \"es-BZ\": \"es-419\",\n \"es-CL\": \"es-419\",\n \"es-CO\": \"es-419\",\n \"es-CR\": \"es-419\",\n \"es-CU\": \"es-419\",\n \"es-DO\": \"es-419\",\n \"es-EC\": \"es-419\",\n \"es-GT\": \"es-419\",\n \"es-HN\": \"es-419\",\n \"es-MX\": \"es-419\",\n \"es-NI\": \"es-419\",\n \"es-PA\": \"es-419\",\n \"es-PE\": \"es-419\",\n \"es-PR\": \"es-419\",\n \"es-PY\": \"es-419\",\n \"es-SV\": \"es-419\",\n \"es-US\": \"es-419\",\n \"es-UY\": \"es-419\",\n \"es-VE\": \"es-419\",\n \"pt-AO\": \"pt-PT\",\n \"pt-CH\": \"pt-PT\",\n \"pt-CV\": \"pt-PT\",\n \"pt-FR\": \"pt-PT\",\n \"pt-GQ\": \"pt-PT\",\n \"pt-GW\": \"pt-PT\",\n \"pt-LU\": \"pt-PT\",\n \"pt-MO\": \"pt-PT\",\n \"pt-MZ\": \"pt-PT\",\n \"pt-ST\": \"pt-PT\",\n \"pt-TL\": \"pt-PT\",\n \"zh-Hant-MO\": \"zh-Hant-HK\"\n};","import aliases from './aliases';\nimport parentLocales from './parentLocales';\nimport { invariant } from './invariant';\n/**\n * https://tc39.es/ecma262/#sec-toobject\n * @param arg\n */\n\nexport function toObject(arg) {\n if (arg == null) {\n throw new TypeError('undefined/null cannot be converted to object');\n }\n\n return Object(arg);\n}\n/**\n * https://tc39.es/ecma262/#sec-tostring\n */\n\nexport function toString(o) {\n // Only symbol is irregular...\n if (typeof o === 'symbol') {\n throw TypeError('Cannot convert a Symbol value to a string');\n }\n\n return String(o);\n}\n/**\n * https://tc39.es/ecma402/#sec-getoption\n * @param opts\n * @param prop\n * @param type\n * @param values\n * @param fallback\n */\n\nexport function getOption(opts, prop, type, values, fallback) {\n // const descriptor = Object.getOwnPropertyDescriptor(opts, prop);\n var value = opts[prop];\n\n if (value !== undefined) {\n if (type !== 'boolean' && type !== 'string') {\n throw new TypeError('invalid type');\n }\n\n if (type === 'boolean') {\n value = Boolean(value);\n }\n\n if (type === 'string') {\n value = toString(value);\n }\n\n if (values !== undefined && !values.filter(function (val) {\n return val == value;\n }).length) {\n throw new RangeError(value + \" is not within \" + values.join(', '));\n }\n\n return value;\n }\n\n return fallback;\n}\n/**\n * https://tc39.es/ecma402/#sec-defaultnumberoption\n * @param val\n * @param min\n * @param max\n * @param fallback\n */\n\nexport function defaultNumberOption(val, min, max, fallback) {\n if (val !== undefined) {\n val = Number(val);\n\n if (isNaN(val) || val < min || val > max) {\n throw new RangeError(val + \" is outside of range [\" + min + \", \" + max + \"]\");\n }\n\n return Math.floor(val);\n }\n\n return fallback;\n}\n/**\n * https://tc39.es/ecma402/#sec-getnumberoption\n * @param options\n * @param property\n * @param min\n * @param max\n * @param fallback\n */\n\nexport function getNumberOption(options, property, minimum, maximum, fallback) {\n var val = options[property];\n return defaultNumberOption(val, minimum, maximum, fallback);\n}\nexport function getAliasesByLang(lang) {\n return Object.keys(aliases).reduce(function (all, locale) {\n if (locale.split('-')[0] === lang) {\n all[locale] = aliases[locale];\n }\n\n return all;\n }, {});\n}\nexport function getParentLocalesByLang(lang) {\n return Object.keys(parentLocales).reduce(function (all, locale) {\n if (locale.split('-')[0] === lang) {\n all[locale] = parentLocales[locale];\n }\n\n return all;\n }, {});\n}\nexport function setInternalSlot(map, pl, field, value) {\n if (!map.get(pl)) {\n map.set(pl, Object.create(null));\n }\n\n var slots = map.get(pl);\n slots[field] = value;\n}\nexport function setMultiInternalSlots(map, pl, props) {\n for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) {\n var k = _a[_i];\n setInternalSlot(map, pl, k, props[k]);\n }\n}\nexport function getInternalSlot(map, pl, field) {\n return getMultiInternalSlots(map, pl, field)[field];\n}\nexport function getMultiInternalSlots(map, pl) {\n var fields = [];\n\n for (var _i = 2; _i < arguments.length; _i++) {\n fields[_i - 2] = arguments[_i];\n }\n\n var slots = map.get(pl);\n\n if (!slots) {\n throw new TypeError(pl + \" InternalSlot has not been initialized\");\n }\n\n return fields.reduce(function (all, f) {\n all[f] = slots[f];\n return all;\n }, Object.create(null));\n}\nexport function isLiteralPart(patternPart) {\n return patternPart.type === 'literal';\n}\nexport function partitionPattern(pattern) {\n var result = [];\n var beginIndex = pattern.indexOf('{');\n var endIndex = 0;\n var nextIndex = 0;\n var length = pattern.length;\n\n while (beginIndex < pattern.length && beginIndex > -1) {\n endIndex = pattern.indexOf('}', beginIndex);\n invariant(endIndex > beginIndex, \"Invalid pattern \" + pattern);\n\n if (beginIndex > nextIndex) {\n result.push({\n type: 'literal',\n value: pattern.substring(nextIndex, beginIndex)\n });\n }\n\n result.push({\n type: pattern.substring(beginIndex + 1, endIndex),\n value: undefined\n });\n nextIndex = endIndex + 1;\n beginIndex = pattern.indexOf('{', nextIndex);\n }\n\n if (nextIndex < length) {\n result.push({\n type: 'literal',\n value: pattern.substring(nextIndex, length)\n });\n }\n\n return result;\n}\n/**\n * https://tc39.es/ecma402/#sec-setnfdigitoptions\n * https://tc39.es/proposal-unified-intl-numberformat/section11/numberformat_diff_out.html#sec-setnfdigitoptions\n * @param intlObj\n * @param opts\n * @param mnfdDefault\n * @param mxfdDefault\n */\n\nexport function setNumberFormatDigitOptions(internalSlotMap, intlObj, opts, mnfdDefault, mxfdDefault) {\n var mnid = getNumberOption(opts, 'minimumIntegerDigits', 1, 21, 1);\n var mnfd = opts.minimumFractionDigits;\n var mxfd = opts.maximumFractionDigits;\n var mnsd = opts.minimumSignificantDigits;\n var mxsd = opts.maximumSignificantDigits;\n setInternalSlot(internalSlotMap, intlObj, 'minimumIntegerDigits', mnid);\n\n if (mnsd !== undefined || mxsd !== undefined) {\n setInternalSlot(internalSlotMap, intlObj, 'roundingType', 'significantDigits');\n mnsd = defaultNumberOption(mnsd, 1, 21, 1);\n mxsd = defaultNumberOption(mxsd, mnsd, 21, 21);\n setInternalSlot(internalSlotMap, intlObj, 'minimumSignificantDigits', mnsd);\n setInternalSlot(internalSlotMap, intlObj, 'maximumSignificantDigits', mxsd);\n } else if (mnfd !== undefined || mxfd !== undefined) {\n setInternalSlot(internalSlotMap, intlObj, 'roundingType', 'fractionDigits');\n mnfd = defaultNumberOption(mnfd, 0, 20, mnfdDefault);\n var mxfdActualDefault = Math.max(mnfd, mxfdDefault);\n mxfd = defaultNumberOption(mxfd, mnfd, 20, mxfdActualDefault);\n setInternalSlot(internalSlotMap, intlObj, 'minimumFractionDigits', mnfd);\n setInternalSlot(internalSlotMap, intlObj, 'maximumFractionDigits', mxfd);\n } else if (getInternalSlot(internalSlotMap, intlObj, 'notation') === 'compact') {\n setInternalSlot(internalSlotMap, intlObj, 'roundingType', 'compactRounding');\n } else {\n setInternalSlot(internalSlotMap, intlObj, 'roundingType', 'fractionDigits');\n setInternalSlot(internalSlotMap, intlObj, 'minimumFractionDigits', mnfdDefault);\n setInternalSlot(internalSlotMap, intlObj, 'maximumFractionDigits', mxfdDefault);\n }\n}\nexport function objectIs(x, y) {\n if (Object.is) {\n return Object.is(x, y);\n } // SameValue algorithm\n\n\n if (x === y) {\n // Steps 1-5, 7-10\n // Steps 6.b-6.e: +0 != -0\n return x !== 0 || 1 / x === 1 / y;\n } // Step 6.a: NaN == NaN\n\n\n return x !== x && y !== y;\n}\nvar NOT_A_Z_REGEX = /[^A-Z]/;\n/**\n * This follows https://tc39.es/ecma402/#sec-case-sensitivity-and-case-mapping\n * @param str string to convert\n */\n\nfunction toUpperCase(str) {\n return str.replace(/([a-z])/g, function (_, c) {\n return c.toUpperCase();\n });\n}\n/**\n * https://tc39.es/proposal-unified-intl-numberformat/section6/locales-currencies-tz_proposed_out.html#sec-iswellformedcurrencycode\n * @param currency\n */\n\n\nexport function isWellFormedCurrencyCode(currency) {\n currency = toUpperCase(currency);\n\n if (currency.length !== 3) {\n return false;\n }\n\n if (NOT_A_Z_REGEX.test(currency)) {\n return false;\n }\n\n return true;\n}","/**\n * IE11-safe version of getCanonicalLocales since it's ES2016\n * @param locales locales\n */\nexport function getCanonicalLocales(locales) {\n // IE11\n var getCanonicalLocales = Intl.getCanonicalLocales;\n\n if (typeof getCanonicalLocales === 'function') {\n return getCanonicalLocales(locales);\n } // NOTE: we must NOT call `supportedLocalesOf` of a formatjs polyfill, or their implementation\n // will even eventually call this method recursively. Here we use `Intl.DateTimeFormat` since it\n // is not polyfilled by `@formatjs`.\n // TODO: Fix TypeScript type def for this bc undefined is just fine\n\n\n return Intl.DateTimeFormat.supportedLocalesOf(locales);\n}","var __extends = this && this.__extends || function () {\n var _extendStatics = function extendStatics(d, b) {\n _extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) {\n if (b.hasOwnProperty(p)) d[p] = b[p];\n }\n };\n\n return _extendStatics(d, b);\n };\n\n return function (d, b) {\n _extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n}();\n\nvar __assign = this && this.__assign || function () {\n __assign = Object.assign || function (t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return __assign.apply(this, arguments);\n};\n\nimport { getCanonicalLocales } from './get-canonical-locales';\nimport { invariant } from './invariant';\nimport { toObject, getOption } from './polyfill-utils';\nexport function createResolveLocale(getDefaultLocale) {\n var lookupMatcher = createLookupMatcher(getDefaultLocale);\n var bestFitMatcher = createBestFitMatcher(getDefaultLocale);\n /**\n * https://tc39.es/ecma402/#sec-resolvelocale\n */\n\n return function resolveLocale(availableLocales, requestedLocales, options, relevantExtensionKeys, localeData) {\n var matcher = options.localeMatcher;\n var r;\n\n if (matcher === 'lookup') {\n r = lookupMatcher(availableLocales, requestedLocales);\n } else {\n r = bestFitMatcher(availableLocales, requestedLocales);\n }\n\n var foundLocale = r.locale;\n var result = {\n locale: '',\n dataLocale: foundLocale\n };\n var supportedExtension = '-u';\n\n for (var _i = 0, relevantExtensionKeys_1 = relevantExtensionKeys; _i < relevantExtensionKeys_1.length; _i++) {\n var key = relevantExtensionKeys_1[_i];\n var foundLocaleData = localeData[foundLocale];\n invariant(typeof foundLocaleData === 'object' && foundLocaleData !== null, \"locale data \" + key + \" must be an object\");\n var keyLocaleData = foundLocaleData[key];\n invariant(Array.isArray(keyLocaleData), \"keyLocaleData for \" + key + \" must be an array\");\n var value = keyLocaleData[0];\n invariant(typeof value === 'string' || value === null, 'value must be string or null');\n var supportedExtensionAddition = '';\n\n if (r.extension) {\n var requestedValue = unicodeExtensionValue(r.extension, key);\n\n if (requestedValue !== undefined) {\n if (requestedValue !== '') {\n if (~keyLocaleData.indexOf(requestedValue)) {\n value = requestedValue;\n supportedExtensionAddition = \"-\" + key + \"-\" + value;\n }\n } else if (~requestedValue.indexOf('true')) {\n value = 'true';\n supportedExtensionAddition = \"-\" + key;\n }\n }\n }\n\n if (key in options) {\n var optionsValue = options[key];\n invariant(typeof optionsValue === 'string' || typeof optionsValue === 'undefined' || optionsValue === null, 'optionsValue must be String, Undefined or Null');\n\n if (~keyLocaleData.indexOf(optionsValue)) {\n if (optionsValue !== value) {\n value = optionsValue;\n supportedExtensionAddition = '';\n }\n }\n }\n\n result[key] = value;\n supportedExtension += supportedExtensionAddition;\n }\n\n if (supportedExtension.length > 2) {\n var privateIndex = foundLocale.indexOf('-x-');\n\n if (privateIndex === -1) {\n foundLocale = foundLocale + supportedExtension;\n } else {\n var preExtension = foundLocale.slice(0, privateIndex);\n var postExtension = foundLocale.slice(privateIndex, foundLocale.length);\n foundLocale = preExtension + supportedExtension + postExtension;\n }\n\n foundLocale = getCanonicalLocales(foundLocale)[0];\n }\n\n result.locale = foundLocale;\n return result;\n };\n}\n/**\n * https://tc39.es/ecma402/#sec-unicodeextensionvalue\n * @param extension\n * @param key\n */\n\nfunction unicodeExtensionValue(extension, key) {\n invariant(key.length === 2, 'key must have 2 elements');\n var size = extension.length;\n var searchValue = \"-\" + key + \"-\";\n var pos = extension.indexOf(searchValue);\n\n if (pos !== -1) {\n var start = pos + 4;\n var end = start;\n var k = start;\n var done = false;\n\n while (!done) {\n var e = extension.indexOf('-', k);\n var len = void 0;\n\n if (e === -1) {\n len = size - k;\n } else {\n len = e - k;\n }\n\n if (len === 2) {\n done = true;\n } else if (e === -1) {\n end = size;\n done = true;\n } else {\n end = e;\n k = e + 1;\n }\n }\n\n return extension.slice(start, end);\n }\n\n searchValue = \"-\" + key;\n pos = extension.indexOf(searchValue);\n\n if (pos !== -1 && pos + 3 === size) {\n return '';\n }\n\n return undefined;\n}\n\nvar UNICODE_EXTENSION_SEQUENCE_REGEX = /-u(?:-[0-9a-z]{2,8})+/gi;\n/**\n * https://tc39.es/ecma402/#sec-bestavailablelocale\n * @param availableLocales\n * @param locale\n */\n\nfunction bestAvailableLocale(availableLocales, locale) {\n var candidate = locale;\n\n while (true) {\n if (~availableLocales.indexOf(candidate)) {\n return candidate;\n }\n\n var pos = candidate.lastIndexOf('-');\n\n if (!~pos) {\n return undefined;\n }\n\n if (pos >= 2 && candidate[pos - 2] === '-') {\n pos -= 2;\n }\n\n candidate = candidate.slice(0, pos);\n }\n}\n\nfunction createLookupMatcher(getDefaultLocale) {\n /**\n * https://tc39.es/ecma402/#sec-lookupmatcher\n */\n return function lookupMatcher(availableLocales, requestedLocales) {\n var result = {\n locale: ''\n };\n\n for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {\n var locale = requestedLocales_1[_i];\n var noExtensionLocale = locale.replace(UNICODE_EXTENSION_SEQUENCE_REGEX, '');\n var availableLocale = bestAvailableLocale(availableLocales, noExtensionLocale);\n\n if (availableLocale) {\n result.locale = availableLocale;\n\n if (locale !== noExtensionLocale) {\n result.extension = locale.slice(noExtensionLocale.length + 1, locale.length);\n }\n\n return result;\n }\n }\n\n result.locale = getDefaultLocale();\n return result;\n };\n}\n\nfunction createBestFitMatcher(getDefaultLocale) {\n return function bestFitMatcher(availableLocales, requestedLocales) {\n var result = {\n locale: ''\n };\n\n for (var _i = 0, requestedLocales_2 = requestedLocales; _i < requestedLocales_2.length; _i++) {\n var locale = requestedLocales_2[_i];\n var noExtensionLocale = locale.replace(UNICODE_EXTENSION_SEQUENCE_REGEX, '');\n var availableLocale = bestAvailableLocale(availableLocales, noExtensionLocale);\n\n if (availableLocale) {\n result.locale = availableLocale;\n\n if (locale !== noExtensionLocale) {\n result.extension = locale.slice(noExtensionLocale.length + 1, locale.length);\n }\n\n return result;\n }\n }\n\n result.locale = getDefaultLocale();\n return result;\n };\n}\n\nexport function getLocaleHierarchy(locale, aliases, parentLocales) {\n var results = [locale];\n\n if (aliases[locale]) {\n locale = aliases[locale];\n results.push(locale);\n }\n\n var parentLocale = parentLocales[locale];\n\n if (parentLocale) {\n results.push(parentLocale);\n }\n\n var localeParts = locale.split('-');\n\n for (var i = localeParts.length; i > 1; i--) {\n results.push(localeParts.slice(0, i - 1).join('-'));\n }\n\n return results;\n}\n\nfunction lookupSupportedLocales(availableLocales, requestedLocales) {\n var subset = [];\n\n for (var _i = 0, requestedLocales_3 = requestedLocales; _i < requestedLocales_3.length; _i++) {\n var locale = requestedLocales_3[_i];\n var noExtensionLocale = locale.replace(UNICODE_EXTENSION_SEQUENCE_REGEX, '');\n var availableLocale = bestAvailableLocale(availableLocales, noExtensionLocale);\n\n if (availableLocale) {\n subset.push(availableLocale);\n }\n }\n\n return subset;\n}\n\nexport function supportedLocales(availableLocales, requestedLocales, options) {\n var matcher = 'best fit';\n\n if (options !== undefined) {\n options = toObject(options);\n matcher = getOption(options, 'localeMatcher', 'string', ['lookup', 'best fit'], 'best fit');\n }\n\n if (matcher === 'best fit') {\n return lookupSupportedLocales(availableLocales, requestedLocales);\n }\n\n return lookupSupportedLocales(availableLocales, requestedLocales);\n}\n\nvar MissingLocaleDataError =\n/** @class */\nfunction (_super) {\n __extends(MissingLocaleDataError, _super);\n\n function MissingLocaleDataError() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.type = 'MISSING_LOCALE_DATA';\n return _this;\n }\n\n return MissingLocaleDataError;\n}(Error);\n\nexport function isMissingLocaleDataError(e) {\n return e.type === 'MISSING_LOCALE_DATA';\n}\nexport function unpackData(locale, localeData,\n/** By default shallow merge the dictionaries. */\nreducer) {\n if (reducer === void 0) {\n reducer = function reducer(all, d) {\n return __assign(__assign({}, all), d);\n };\n }\n\n var localeHierarchy = getLocaleHierarchy(locale, localeData.aliases, localeData.parentLocales);\n var dataToMerge = localeHierarchy.map(function (l) {\n return localeData.data[l];\n }).filter(Boolean);\n\n if (!dataToMerge.length) {\n throw new MissingLocaleDataError(\"Missing locale data for \\\"\" + locale + \"\\\", lookup hierarchy: \" + localeHierarchy.join(', '));\n }\n\n dataToMerge.reverse();\n return dataToMerge.reduce(reducer, {});\n}","// https://tc39.es/proposal-unified-intl-numberformat/section6/locales-currencies-tz_diff_out.html#sec-issanctionedsimpleunitidentifier\nexport var SANCTIONED_UNITS = ['angle-degree', 'area-acre', 'area-hectare', 'concentr-percent', 'digital-bit', 'digital-byte', 'digital-gigabit', 'digital-gigabyte', 'digital-kilobit', 'digital-kilobyte', 'digital-megabit', 'digital-megabyte', 'digital-petabyte', 'digital-terabit', 'digital-terabyte', 'duration-day', 'duration-hour', 'duration-millisecond', 'duration-minute', 'duration-month', 'duration-second', 'duration-week', 'duration-year', 'length-centimeter', 'length-foot', 'length-inch', 'length-kilometer', 'length-meter', 'length-mile-scandinavian', 'length-mile', 'length-millimeter', 'length-yard', 'mass-gram', 'mass-kilogram', 'mass-ounce', 'mass-pound', 'mass-stone', 'temperature-celsius', 'temperature-fahrenheit', 'volume-fluid-ounce', 'volume-gallon', 'volume-liter', 'volume-milliliter']; // In CLDR, the unit name always follows the form `namespace-unit` pattern.\n// For example: `digital-bit` instead of `bit`. This function removes the namespace prefix.\n\nexport function removeUnitNamespace(unit) {\n return unit.replace(/^(.*?)-/, '');\n}","export var InternalSlotToken;\n\n(function (InternalSlotToken) {\n // To prevent collision with {0} in CLDR\n InternalSlotToken[\"compactName\"] = \"compactName\";\n InternalSlotToken[\"compactSymbol\"] = \"compactSymbol\";\n InternalSlotToken[\"currencyCode\"] = \"currencyCode\";\n InternalSlotToken[\"currencyName\"] = \"currencyName\";\n InternalSlotToken[\"currencyNarrowSymbol\"] = \"currencyNarrowSymbol\";\n InternalSlotToken[\"currencySymbol\"] = \"currencySymbol\";\n InternalSlotToken[\"minusSign\"] = \"minusSign\";\n InternalSlotToken[\"number\"] = \"number\";\n InternalSlotToken[\"percentSign\"] = \"percentSign\";\n InternalSlotToken[\"plusSign\"] = \"plusSign\";\n InternalSlotToken[\"scientificExponent\"] = \"scientificExponent\";\n InternalSlotToken[\"scientificSeparator\"] = \"scientificSeparator\";\n InternalSlotToken[\"unitName\"] = \"unitName\";\n InternalSlotToken[\"unitNarrowSymbol\"] = \"unitNarrowSymbol\";\n InternalSlotToken[\"unitSymbol\"] = \"unitSymbol\";\n})(InternalSlotToken || (InternalSlotToken = {}));","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});","import invariant from \"invariant\";\n\n////////////////////////////////////////////////////////////////////////////////\n// startsWith(string, search) - Check if `string` starts with `search`\nvar startsWith = function startsWith(string, search) {\n return string.substr(0, search.length) === search;\n};\n\n////////////////////////////////////////////////////////////////////////////////\n// pick(routes, uri)\n//\n// Ranks and picks the best route to match. Each segment gets the highest\n// amount of points, then the type of segment gets an additional amount of\n// points where\n//\n// static > dynamic > splat > root\n//\n// This way we don't have to worry about the order of our routes, let the\n// computers do it.\n//\n// A route looks like this\n//\n// { path, default, value }\n//\n// And a returned match looks like:\n//\n// { route, params, uri }\n//\n// I know, I should use TypeScript not comments for these types.\nvar pick = function pick(routes, uri) {\n var match = void 0;\n var default_ = void 0;\n\n var _uri$split = uri.split(\"?\"),\n uriPathname = _uri$split[0];\n\n var uriSegments = segmentize(uriPathname);\n var isRootUri = uriSegments[0] === \"\";\n var ranked = rankRoutes(routes);\n\n for (var i = 0, l = ranked.length; i < l; i++) {\n var missed = false;\n var route = ranked[i].route;\n\n if (route.default) {\n default_ = {\n route: route,\n params: {},\n uri: uri\n };\n continue;\n }\n\n var routeSegments = segmentize(route.path);\n var params = {};\n var max = Math.max(uriSegments.length, routeSegments.length);\n var index = 0;\n\n for (; index < max; index++) {\n var routeSegment = routeSegments[index];\n var uriSegment = uriSegments[index];\n\n if (isSplat(routeSegment)) {\n // Hit a splat, just grab the rest, and return a match\n // uri: /files/documents/work\n // route: /files/*\n var param = routeSegment.slice(1) || \"*\";\n params[param] = uriSegments.slice(index).map(decodeURIComponent).join(\"/\");\n break;\n }\n\n if (uriSegment === undefined) {\n // URI is shorter than the route, no match\n // uri: /users\n // route: /users/:userId\n missed = true;\n break;\n }\n\n var dynamicMatch = paramRe.exec(routeSegment);\n\n if (dynamicMatch && !isRootUri) {\n var matchIsNotReserved = reservedNames.indexOf(dynamicMatch[1]) === -1;\n !matchIsNotReserved ? process.env.NODE_ENV !== \"production\" ? invariant(false, \" dynamic segment \\\"\" + dynamicMatch[1] + \"\\\" is a reserved name. Please use a different name in path \\\"\" + route.path + \"\\\".\") : invariant(false) : void 0;\n var value = decodeURIComponent(uriSegment);\n params[dynamicMatch[1]] = value;\n } else if (routeSegment !== uriSegment) {\n // Current segments don't match, not dynamic, not splat, so no match\n // uri: /users/123/settings\n // route: /users/:id/profile\n missed = true;\n break;\n }\n }\n\n if (!missed) {\n match = {\n route: route,\n params: params,\n uri: \"/\" + uriSegments.slice(0, index).join(\"/\")\n };\n break;\n }\n }\n\n return match || default_ || null;\n};\n\n////////////////////////////////////////////////////////////////////////////////\n// match(path, uri) - Matches just one path to a uri, also lol\nvar match = function match(path, uri) {\n return pick([{ path: path }], uri);\n};\n\n////////////////////////////////////////////////////////////////////////////////\n// resolve(to, basepath)\n//\n// Resolves URIs as though every path is a directory, no files. Relative URIs\n// in the browser can feel awkward because not only can you be \"in a directory\"\n// you can be \"at a file\", too. For example\n//\n// browserSpecResolve('foo', '/bar/') => /bar/foo\n// browserSpecResolve('foo', '/bar') => /foo\n//\n// But on the command line of a file system, it's not as complicated, you can't\n// `cd` from a file, only directories. This way, links have to know less about\n// their current path. To go deeper you can do this:\n//\n// \n// // instead of\n// \n//\n// Just like `cd`, if you want to go deeper from the command line, you do this:\n//\n// cd deeper\n// # not\n// cd $(pwd)/deeper\n//\n// By treating every path as a directory, linking to relative paths should\n// require less contextual information and (fingers crossed) be more intuitive.\nvar resolve = function resolve(to, base) {\n // /foo/bar, /baz/qux => /foo/bar\n if (startsWith(to, \"/\")) {\n return to;\n }\n\n var _to$split = to.split(\"?\"),\n toPathname = _to$split[0],\n toQuery = _to$split[1];\n\n var _base$split = base.split(\"?\"),\n basePathname = _base$split[0];\n\n var toSegments = segmentize(toPathname);\n var baseSegments = segmentize(basePathname);\n\n // ?a=b, /users?b=c => /users?a=b\n if (toSegments[0] === \"\") {\n return addQuery(basePathname, toQuery);\n }\n\n // profile, /users/789 => /users/789/profile\n if (!startsWith(toSegments[0], \".\")) {\n var pathname = baseSegments.concat(toSegments).join(\"/\");\n return addQuery((basePathname === \"/\" ? \"\" : \"/\") + pathname, toQuery);\n }\n\n // ./ /users/123 => /users/123\n // ../ /users/123 => /users\n // ../.. /users/123 => /\n // ../../one /a/b/c/d => /a/b/one\n // .././one /a/b/c/d => /a/b/c/one\n var allSegments = baseSegments.concat(toSegments);\n var segments = [];\n for (var i = 0, l = allSegments.length; i < l; i++) {\n var segment = allSegments[i];\n if (segment === \"..\") segments.pop();else if (segment !== \".\") segments.push(segment);\n }\n\n return addQuery(\"/\" + segments.join(\"/\"), toQuery);\n};\n\n////////////////////////////////////////////////////////////////////////////////\n// insertParams(path, params)\n\nvar insertParams = function insertParams(path, params) {\n var _path$split = path.split(\"?\"),\n pathBase = _path$split[0],\n _path$split$ = _path$split[1],\n query = _path$split$ === undefined ? \"\" : _path$split$;\n\n var segments = segmentize(pathBase);\n var constructedPath = \"/\" + segments.map(function (segment) {\n var match = paramRe.exec(segment);\n return match ? params[match[1]] : segment;\n }).join(\"/\");\n var _params$location = params.location;\n _params$location = _params$location === undefined ? {} : _params$location;\n var _params$location$sear = _params$location.search,\n search = _params$location$sear === undefined ? \"\" : _params$location$sear;\n\n var searchSplit = search.split(\"?\")[1] || \"\";\n constructedPath = addQuery(constructedPath, query, searchSplit);\n return constructedPath;\n};\n\nvar validateRedirect = function validateRedirect(from, to) {\n var filter = function filter(segment) {\n return isDynamic(segment);\n };\n var fromString = segmentize(from).filter(filter).sort().join(\"/\");\n var toString = segmentize(to).filter(filter).sort().join(\"/\");\n return fromString === toString;\n};\n\n////////////////////////////////////////////////////////////////////////////////\n// Junk\nvar paramRe = /^:(.+)/;\n\nvar SEGMENT_POINTS = 4;\nvar STATIC_POINTS = 3;\nvar DYNAMIC_POINTS = 2;\nvar SPLAT_PENALTY = 1;\nvar ROOT_POINTS = 1;\n\nvar isRootSegment = function isRootSegment(segment) {\n return segment === \"\";\n};\nvar isDynamic = function isDynamic(segment) {\n return paramRe.test(segment);\n};\nvar isSplat = function isSplat(segment) {\n return segment && segment[0] === \"*\";\n};\n\nvar rankRoute = function rankRoute(route, index) {\n var score = route.default ? 0 : segmentize(route.path).reduce(function (score, segment) {\n score += SEGMENT_POINTS;\n if (isRootSegment(segment)) score += ROOT_POINTS;else if (isDynamic(segment)) score += DYNAMIC_POINTS;else if (isSplat(segment)) score -= SEGMENT_POINTS + SPLAT_PENALTY;else score += STATIC_POINTS;\n return score;\n }, 0);\n return { route: route, score: score, index: index };\n};\n\nvar rankRoutes = function rankRoutes(routes) {\n return routes.map(rankRoute).sort(function (a, b) {\n return a.score < b.score ? 1 : a.score > b.score ? -1 : a.index - b.index;\n });\n};\n\nvar segmentize = function segmentize(uri) {\n return uri\n // strip starting/ending slashes\n .replace(/(^\\/+|\\/+$)/g, \"\").split(\"/\");\n};\n\nvar addQuery = function addQuery(pathname) {\n for (var _len = arguments.length, query = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n query[_key - 1] = arguments[_key];\n }\n\n query = query.filter(function (q) {\n return q && q.length > 0;\n });\n return pathname + (query && query.length > 0 ? \"?\" + query.join(\"&\") : \"\");\n};\n\nvar reservedNames = [\"uri\", \"path\"];\n\n/**\n * Shallow compares two objects.\n * @param {Object} obj1 The first object to compare.\n * @param {Object} obj2 The second object to compare.\n */\nvar shallowCompare = function shallowCompare(obj1, obj2) {\n var obj1Keys = Object.keys(obj1);\n return obj1Keys.length === Object.keys(obj2).length && obj1Keys.every(function (key) {\n return obj2.hasOwnProperty(key) && obj1[key] === obj2[key];\n });\n};\n\n////////////////////////////////////////////////////////////////////////////////\nexport { startsWith, pick, match, resolve, insertParams, validateRedirect, shallowCompare };","module.exports = [{\n plugin: require('../node_modules/@sentry/gatsby/gatsby-browser.js'),\n options: {\"plugins\":[],\"dsn\":\"https://8f945fd4b3824a0eb30a183afeb6900d@o609280.ingest.sentry.io/5746933\",\"tracesSampleRate\":0.2,\"environment\":\"production\",\"enabled\":true},\n },{\n plugin: require('../node_modules/gatsby-plugin-manifest/gatsby-browser.js'),\n options: {\"plugins\":[],\"name\":\"gatsby-starter-default\",\"short_name\":\"starter\",\"start_url\":\"/\",\"background_color\":\"#663399\",\"theme_color\":\"#663399\",\"display\":\"minimal-ui\",\"icon\":\"src/img/icon.png\",\"cache_busting_mode\":\"query\",\"include_favicon\":true,\"legacy\":true,\"theme_color_in_head\":true,\"cacheDigest\":\"ba54f2ebeac1ac570084677b2d820adc\"},\n },{\n plugin: require('../node_modules/gatsby-plugin-intl/gatsby-browser.js'),\n options: {\"plugins\":[],\"path\":\"/codebuild/output/src1753007849/src/nepal/src/intl\",\"languages\":[\"ar\",\"de\",\"en\",\"es\",\"fr\",\"he\",\"pt-BR\",\"ru\",\"zh-Hans\",\"zh-Hant\"],\"defaultLanguage\":\"en\",\"redirect\":false},\n },{\n plugin: require('../node_modules/gatsby-plugin-launchdarkly/gatsby-browser.js'),\n options: {\"plugins\":[],\"clientSideID\":\"6123734bdd822b260558ae05\",\"user\":{\"key\":\"anonymous\",\"anonymous\":false},\"options\":{\"bootstrap\":\"localstorage\"}},\n },{\n plugin: require('../gatsby-browser.js'),\n options: {\"plugins\":[]},\n }]\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.shouldPolyfill = void 0;\n/**\n * https://bugs.chromium.org/p/chromium/issues/detail?id=1097432\n */\n\nfunction hasMissingICUBug() {\n if (Intl.DisplayNames) {\n var regionNames = new Intl.DisplayNames(['en'], {\n type: 'region'\n });\n return regionNames.of('CA') === 'CA';\n }\n\n return false;\n}\n\nfunction shouldPolyfill() {\n return !Intl.DisplayNames || hasMissingICUBug();\n}\n\nexports.shouldPolyfill = shouldPolyfill;","exports = module.exports = require('./lib/_stream_readable.js');\nexports.Stream = exports;\nexports.Readable = exports;\nexports.Writable = require('./lib/_stream_writable.js');\nexports.Duplex = require('./lib/_stream_duplex.js');\nexports.Transform = require('./lib/_stream_transform.js');\nexports.PassThrough = require('./lib/_stream_passthrough.js');\nexports.finished = require('./lib/internal/streams/end-of-stream.js');\nexports.pipeline = require('./lib/internal/streams/pipeline.js');","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.variantAlias = exports.scriptAlias = exports.territoryAlias = exports.languageAlias = void 0;\n/* @generated */\n// prettier-ignore \n\nexports.languageAlias = {\n \"aa-saaho\": \"ssy\",\n \"aam\": \"aas\",\n \"aar\": \"aa\",\n \"abk\": \"ab\",\n \"adp\": \"dz\",\n \"afr\": \"af\",\n \"agp\": \"apf\",\n \"ais\": \"ami\",\n \"aju\": \"jrb\",\n \"aka\": \"ak\",\n \"alb\": \"sq\",\n \"als\": \"sq\",\n \"amh\": \"am\",\n \"ara\": \"ar\",\n \"arb\": \"ar\",\n \"arg\": \"an\",\n \"arm\": \"hy\",\n \"art-lojban\": \"jbo\",\n \"asd\": \"snz\",\n \"asm\": \"as\",\n \"aue\": \"ktz\",\n \"ava\": \"av\",\n \"ave\": \"ae\",\n \"aym\": \"ay\",\n \"ayr\": \"ay\",\n \"ayx\": \"nun\",\n \"aze\": \"az\",\n \"azj\": \"az\",\n \"bak\": \"ba\",\n \"bam\": \"bm\",\n \"baq\": \"eu\",\n \"baz\": \"nvo\",\n \"bcc\": \"bal\",\n \"bcl\": \"bik\",\n \"bel\": \"be\",\n \"ben\": \"bn\",\n \"bgm\": \"bcg\",\n \"bh\": \"bho\",\n \"bhk\": \"fbl\",\n \"bih\": \"bho\",\n \"bis\": \"bi\",\n \"bjd\": \"drl\",\n \"bjq\": \"bzc\",\n \"bkb\": \"ebk\",\n \"bod\": \"bo\",\n \"bos\": \"bs\",\n \"bre\": \"br\",\n \"btb\": \"beb\",\n \"bul\": \"bg\",\n \"bur\": \"my\",\n \"bxk\": \"luy\",\n \"bxr\": \"bua\",\n \"cat\": \"ca\",\n \"ccq\": \"rki\",\n \"cel-gaulish\": \"xtg\",\n \"ces\": \"cs\",\n \"cha\": \"ch\",\n \"che\": \"ce\",\n \"chi\": \"zh\",\n \"chu\": \"cu\",\n \"chv\": \"cv\",\n \"cjr\": \"mom\",\n \"cka\": \"cmr\",\n \"cld\": \"syr\",\n \"cmk\": \"xch\",\n \"cmn\": \"zh\",\n \"cnr\": \"sr-ME\",\n \"cor\": \"kw\",\n \"cos\": \"co\",\n \"coy\": \"pij\",\n \"cqu\": \"quh\",\n \"cre\": \"cr\",\n \"cwd\": \"cr\",\n \"cym\": \"cy\",\n \"cze\": \"cs\",\n \"daf\": \"dnj\",\n \"dan\": \"da\",\n \"dap\": \"njz\",\n \"deu\": \"de\",\n \"dgo\": \"doi\",\n \"dhd\": \"mwr\",\n \"dik\": \"din\",\n \"diq\": \"zza\",\n \"dit\": \"dif\",\n \"div\": \"dv\",\n \"djl\": \"dze\",\n \"dkl\": \"aqd\",\n \"drh\": \"mn\",\n \"drr\": \"kzk\",\n \"drw\": \"fa-AF\",\n \"dud\": \"uth\",\n \"duj\": \"dwu\",\n \"dut\": \"nl\",\n \"dwl\": \"dbt\",\n \"dzo\": \"dz\",\n \"ekk\": \"et\",\n \"ell\": \"el\",\n \"elp\": \"amq\",\n \"emk\": \"man\",\n \"en-GB-oed\": \"en-GB-oxendict\",\n \"eng\": \"en\",\n \"epo\": \"eo\",\n \"esk\": \"ik\",\n \"est\": \"et\",\n \"eus\": \"eu\",\n \"ewe\": \"ee\",\n \"fao\": \"fo\",\n \"fas\": \"fa\",\n \"fat\": \"ak\",\n \"fij\": \"fj\",\n \"fin\": \"fi\",\n \"fra\": \"fr\",\n \"fre\": \"fr\",\n \"fry\": \"fy\",\n \"fuc\": \"ff\",\n \"ful\": \"ff\",\n \"gav\": \"dev\",\n \"gaz\": \"om\",\n \"gbc\": \"wny\",\n \"gbo\": \"grb\",\n \"geo\": \"ka\",\n \"ger\": \"de\",\n \"gfx\": \"vaj\",\n \"ggn\": \"gvr\",\n \"ggo\": \"esg\",\n \"ggr\": \"gtu\",\n \"gio\": \"aou\",\n \"gla\": \"gd\",\n \"gle\": \"ga\",\n \"glg\": \"gl\",\n \"gli\": \"kzk\",\n \"glv\": \"gv\",\n \"gno\": \"gon\",\n \"gre\": \"el\",\n \"grn\": \"gn\",\n \"gti\": \"nyc\",\n \"gug\": \"gn\",\n \"guj\": \"gu\",\n \"guv\": \"duz\",\n \"gya\": \"gba\",\n \"hat\": \"ht\",\n \"hau\": \"ha\",\n \"hbs\": \"sr-Latn\",\n \"hdn\": \"hai\",\n \"hea\": \"hmn\",\n \"heb\": \"he\",\n \"her\": \"hz\",\n \"him\": \"srx\",\n \"hin\": \"hi\",\n \"hmo\": \"ho\",\n \"hrr\": \"jal\",\n \"hrv\": \"hr\",\n \"hun\": \"hu\",\n \"hy-arevmda\": \"hyw\",\n \"hye\": \"hy\",\n \"i-ami\": \"ami\",\n \"i-bnn\": \"bnn\",\n \"i-default\": \"en-x-i-default\",\n \"i-enochian\": \"und-x-i-enochian\",\n \"i-hak\": \"hak\",\n \"i-klingon\": \"tlh\",\n \"i-lux\": \"lb\",\n \"i-mingo\": \"see-x-i-mingo\",\n \"i-navajo\": \"nv\",\n \"i-pwn\": \"pwn\",\n \"i-tao\": \"tao\",\n \"i-tay\": \"tay\",\n \"i-tsu\": \"tsu\",\n \"ibi\": \"opa\",\n \"ibo\": \"ig\",\n \"ice\": \"is\",\n \"ido\": \"io\",\n \"iii\": \"ii\",\n \"ike\": \"iu\",\n \"iku\": \"iu\",\n \"ile\": \"ie\",\n \"ill\": \"ilm\",\n \"ilw\": \"gal\",\n \"in\": \"id\",\n \"ina\": \"ia\",\n \"ind\": \"id\",\n \"ipk\": \"ik\",\n \"isl\": \"is\",\n \"ita\": \"it\",\n \"iw\": \"he\",\n \"izi\": \"eza\",\n \"jar\": \"jgk\",\n \"jav\": \"jv\",\n \"jeg\": \"oyb\",\n \"ji\": \"yi\",\n \"jpn\": \"ja\",\n \"jw\": \"jv\",\n \"kal\": \"kl\",\n \"kan\": \"kn\",\n \"kas\": \"ks\",\n \"kat\": \"ka\",\n \"kau\": \"kr\",\n \"kaz\": \"kk\",\n \"kdv\": \"zkd\",\n \"kgc\": \"tdf\",\n \"kgd\": \"ncq\",\n \"kgh\": \"kml\",\n \"khk\": \"mn\",\n \"khm\": \"km\",\n \"kik\": \"ki\",\n \"kin\": \"rw\",\n \"kir\": \"ky\",\n \"kmr\": \"ku\",\n \"knc\": \"kr\",\n \"kng\": \"kg\",\n \"knn\": \"kok\",\n \"koj\": \"kwv\",\n \"kom\": \"kv\",\n \"kon\": \"kg\",\n \"kor\": \"ko\",\n \"kpp\": \"jkm\",\n \"kpv\": \"kv\",\n \"krm\": \"bmf\",\n \"ktr\": \"dtp\",\n \"kua\": \"kj\",\n \"kur\": \"ku\",\n \"kvs\": \"gdj\",\n \"kwq\": \"yam\",\n \"kxe\": \"tvd\",\n \"kxl\": \"kru\",\n \"kzh\": \"dgl\",\n \"kzj\": \"dtp\",\n \"kzt\": \"dtp\",\n \"lao\": \"lo\",\n \"lat\": \"la\",\n \"lav\": \"lv\",\n \"lbk\": \"bnc\",\n \"leg\": \"enl\",\n \"lii\": \"raq\",\n \"lim\": \"li\",\n \"lin\": \"ln\",\n \"lit\": \"lt\",\n \"llo\": \"ngt\",\n \"lmm\": \"rmx\",\n \"ltz\": \"lb\",\n \"lub\": \"lu\",\n \"lug\": \"lg\",\n \"lvs\": \"lv\",\n \"mac\": \"mk\",\n \"mah\": \"mh\",\n \"mal\": \"ml\",\n \"mao\": \"mi\",\n \"mar\": \"mr\",\n \"may\": \"ms\",\n \"meg\": \"cir\",\n \"mgx\": \"jbk\",\n \"mhr\": \"chm\",\n \"mkd\": \"mk\",\n \"mlg\": \"mg\",\n \"mlt\": \"mt\",\n \"mnk\": \"man\",\n \"mnt\": \"wnn\",\n \"mo\": \"ro\",\n \"mof\": \"xnt\",\n \"mol\": \"ro\",\n \"mon\": \"mn\",\n \"mri\": \"mi\",\n \"msa\": \"ms\",\n \"mst\": \"mry\",\n \"mup\": \"raj\",\n \"mwd\": \"dmw\",\n \"mwj\": \"vaj\",\n \"mya\": \"my\",\n \"myd\": \"aog\",\n \"myt\": \"mry\",\n \"nad\": \"xny\",\n \"nau\": \"na\",\n \"nav\": \"nv\",\n \"nbf\": \"nru\",\n \"nbl\": \"nr\",\n \"nbx\": \"ekc\",\n \"ncp\": \"kdz\",\n \"nde\": \"nd\",\n \"ndo\": \"ng\",\n \"nep\": \"ne\",\n \"nld\": \"nl\",\n \"nln\": \"azd\",\n \"nlr\": \"nrk\",\n \"nno\": \"nn\",\n \"nns\": \"nbr\",\n \"nnx\": \"ngv\",\n \"no\": \"nb\",\n \"no-bok\": \"nb\",\n \"no-bokmal\": \"nb\",\n \"no-nyn\": \"nn\",\n \"no-nynorsk\": \"nn\",\n \"nob\": \"nb\",\n \"noo\": \"dtd\",\n \"nor\": \"nb\",\n \"npi\": \"ne\",\n \"nts\": \"pij\",\n \"nxu\": \"bpp\",\n \"nya\": \"ny\",\n \"oci\": \"oc\",\n \"ojg\": \"oj\",\n \"oji\": \"oj\",\n \"ori\": \"or\",\n \"orm\": \"om\",\n \"ory\": \"or\",\n \"oss\": \"os\",\n \"oun\": \"vaj\",\n \"pan\": \"pa\",\n \"pbu\": \"ps\",\n \"pcr\": \"adx\",\n \"per\": \"fa\",\n \"pes\": \"fa\",\n \"pli\": \"pi\",\n \"plt\": \"mg\",\n \"pmc\": \"huw\",\n \"pmu\": \"phr\",\n \"pnb\": \"lah\",\n \"pol\": \"pl\",\n \"por\": \"pt\",\n \"ppa\": \"bfy\",\n \"ppr\": \"lcq\",\n \"prs\": \"fa-AF\",\n \"pry\": \"prt\",\n \"pus\": \"ps\",\n \"puz\": \"pub\",\n \"que\": \"qu\",\n \"quz\": \"qu\",\n \"rmr\": \"emx\",\n \"rmy\": \"rom\",\n \"roh\": \"rm\",\n \"ron\": \"ro\",\n \"rum\": \"ro\",\n \"run\": \"rn\",\n \"rus\": \"ru\",\n \"sag\": \"sg\",\n \"san\": \"sa\",\n \"sap\": \"aqt\",\n \"sca\": \"hle\",\n \"scc\": \"sr\",\n \"scr\": \"hr\",\n \"sgl\": \"isk\",\n \"sgn-BE-FR\": \"sfb\",\n \"sgn-BE-NL\": \"vgt\",\n \"sgn-BR\": \"bzs\",\n \"sgn-CH-DE\": \"sgg\",\n \"sgn-CO\": \"csn\",\n \"sgn-DE\": \"gsg\",\n \"sgn-DK\": \"dsl\",\n \"sgn-ES\": \"ssp\",\n \"sgn-FR\": \"fsl\",\n \"sgn-GB\": \"bfi\",\n \"sgn-GR\": \"gss\",\n \"sgn-IE\": \"isg\",\n \"sgn-IT\": \"ise\",\n \"sgn-JP\": \"jsl\",\n \"sgn-MX\": \"mfs\",\n \"sgn-NI\": \"ncs\",\n \"sgn-NL\": \"dse\",\n \"sgn-NO\": \"nsi\",\n \"sgn-PT\": \"psr\",\n \"sgn-SE\": \"swl\",\n \"sgn-US\": \"ase\",\n \"sgn-ZA\": \"sfs\",\n \"sh\": \"sr-Latn\",\n \"sin\": \"si\",\n \"skk\": \"oyb\",\n \"slk\": \"sk\",\n \"slo\": \"sk\",\n \"slv\": \"sl\",\n \"sme\": \"se\",\n \"smo\": \"sm\",\n \"sna\": \"sn\",\n \"snd\": \"sd\",\n \"som\": \"so\",\n \"sot\": \"st\",\n \"spa\": \"es\",\n \"spy\": \"kln\",\n \"sqi\": \"sq\",\n \"src\": \"sc\",\n \"srd\": \"sc\",\n \"srp\": \"sr\",\n \"ssw\": \"ss\",\n \"sul\": \"sgd\",\n \"sum\": \"ulw\",\n \"sun\": \"su\",\n \"swa\": \"sw\",\n \"swc\": \"sw-CD\",\n \"swe\": \"sv\",\n \"swh\": \"sw\",\n \"tah\": \"ty\",\n \"tam\": \"ta\",\n \"tat\": \"tt\",\n \"tdu\": \"dtp\",\n \"tel\": \"te\",\n \"tgg\": \"bjp\",\n \"tgk\": \"tg\",\n \"tgl\": \"fil\",\n \"tha\": \"th\",\n \"thc\": \"tpo\",\n \"thw\": \"ola\",\n \"thx\": \"oyb\",\n \"tib\": \"bo\",\n \"tid\": \"itd\",\n \"tie\": \"ras\",\n \"tir\": \"ti\",\n \"tkk\": \"twm\",\n \"tl\": \"fil\",\n \"tlw\": \"weo\",\n \"tmp\": \"tyj\",\n \"tne\": \"kak\",\n \"tnf\": \"fa-AF\",\n \"ton\": \"to\",\n \"tsf\": \"taj\",\n \"tsn\": \"tn\",\n \"tso\": \"ts\",\n \"ttq\": \"tmh\",\n \"tuk\": \"tk\",\n \"tur\": \"tr\",\n \"tw\": \"ak\",\n \"twi\": \"ak\",\n \"uig\": \"ug\",\n \"ukr\": \"uk\",\n \"umu\": \"del\",\n \"und-aaland\": \"und-AX\",\n \"und-arevela\": \"und\",\n \"und-arevmda\": \"und\",\n \"und-bokmal\": \"und\",\n \"und-hakka\": \"und\",\n \"und-hepburn-heploc\": \"und-alalc97\",\n \"und-lojban\": \"und\",\n \"und-nynorsk\": \"und\",\n \"und-saaho\": \"und\",\n \"und-xiang\": \"und\",\n \"unp\": \"wro\",\n \"uok\": \"ema\",\n \"urd\": \"ur\",\n \"uzb\": \"uz\",\n \"uzn\": \"uz\",\n \"ven\": \"ve\",\n \"vie\": \"vi\",\n \"vol\": \"vo\",\n \"wel\": \"cy\",\n \"wgw\": \"wgb\",\n \"wit\": \"nol\",\n \"wiw\": \"nwo\",\n \"wln\": \"wa\",\n \"wol\": \"wo\",\n \"xba\": \"cax\",\n \"xho\": \"xh\",\n \"xia\": \"acn\",\n \"xkh\": \"waw\",\n \"xpe\": \"kpe\",\n \"xrq\": \"dmw\",\n \"xsj\": \"suj\",\n \"xsl\": \"den\",\n \"ybd\": \"rki\",\n \"ydd\": \"yi\",\n \"yen\": \"ynq\",\n \"yid\": \"yi\",\n \"yiy\": \"yrm\",\n \"yma\": \"lrr\",\n \"ymt\": \"mtm\",\n \"yor\": \"yo\",\n \"yos\": \"zom\",\n \"yuu\": \"yug\",\n \"zai\": \"zap\",\n \"zh-cmn\": \"zh\",\n \"zh-cmn-Hans\": \"zh-Hans\",\n \"zh-cmn-Hant\": \"zh-Hant\",\n \"zh-gan\": \"gan\",\n \"zh-guoyu\": \"zh\",\n \"zh-hakka\": \"hak\",\n \"zh-min\": \"nan-x-zh-min\",\n \"zh-min-nan\": \"nan\",\n \"zh-wuu\": \"wuu\",\n \"zh-xiang\": \"hsn\",\n \"zh-yue\": \"yue\",\n \"zha\": \"za\",\n \"zho\": \"zh\",\n \"zir\": \"scv\",\n \"zsm\": \"ms\",\n \"zul\": \"zu\",\n \"zyb\": \"za\"\n};\nexports.territoryAlias = {\n \"100\": \"BG\",\n \"104\": \"MM\",\n \"108\": \"BI\",\n \"112\": \"BY\",\n \"116\": \"KH\",\n \"120\": \"CM\",\n \"124\": \"CA\",\n \"132\": \"CV\",\n \"136\": \"KY\",\n \"140\": \"CF\",\n \"144\": \"LK\",\n \"148\": \"TD\",\n \"152\": \"CL\",\n \"156\": \"CN\",\n \"158\": \"TW\",\n \"162\": \"CX\",\n \"166\": \"CC\",\n \"170\": \"CO\",\n \"172\": \"RU AM AZ BY GE KG KZ MD TJ TM UA UZ\",\n \"174\": \"KM\",\n \"175\": \"YT\",\n \"178\": \"CG\",\n \"180\": \"CD\",\n \"184\": \"CK\",\n \"188\": \"CR\",\n \"191\": \"HR\",\n \"192\": \"CU\",\n \"196\": \"CY\",\n \"200\": \"CZ SK\",\n \"203\": \"CZ\",\n \"204\": \"BJ\",\n \"208\": \"DK\",\n \"212\": \"DM\",\n \"214\": \"DO\",\n \"218\": \"EC\",\n \"222\": \"SV\",\n \"226\": \"GQ\",\n \"230\": \"ET\",\n \"231\": \"ET\",\n \"232\": \"ER\",\n \"233\": \"EE\",\n \"234\": \"FO\",\n \"238\": \"FK\",\n \"239\": \"GS\",\n \"242\": \"FJ\",\n \"246\": \"FI\",\n \"248\": \"AX\",\n \"249\": \"FR\",\n \"250\": \"FR\",\n \"254\": \"GF\",\n \"258\": \"PF\",\n \"260\": \"TF\",\n \"262\": \"DJ\",\n \"266\": \"GA\",\n \"268\": \"GE\",\n \"270\": \"GM\",\n \"275\": \"PS\",\n \"276\": \"DE\",\n \"278\": \"DE\",\n \"280\": \"DE\",\n \"288\": \"GH\",\n \"292\": \"GI\",\n \"296\": \"KI\",\n \"300\": \"GR\",\n \"304\": \"GL\",\n \"308\": \"GD\",\n \"312\": \"GP\",\n \"316\": \"GU\",\n \"320\": \"GT\",\n \"324\": \"GN\",\n \"328\": \"GY\",\n \"332\": \"HT\",\n \"334\": \"HM\",\n \"336\": \"VA\",\n \"340\": \"HN\",\n \"344\": \"HK\",\n \"348\": \"HU\",\n \"352\": \"IS\",\n \"356\": \"IN\",\n \"360\": \"ID\",\n \"364\": \"IR\",\n \"368\": \"IQ\",\n \"372\": \"IE\",\n \"376\": \"IL\",\n \"380\": \"IT\",\n \"384\": \"CI\",\n \"388\": \"JM\",\n \"392\": \"JP\",\n \"398\": \"KZ\",\n \"400\": \"JO\",\n \"404\": \"KE\",\n \"408\": \"KP\",\n \"410\": \"KR\",\n \"414\": \"KW\",\n \"417\": \"KG\",\n \"418\": \"LA\",\n \"422\": \"LB\",\n \"426\": \"LS\",\n \"428\": \"LV\",\n \"430\": \"LR\",\n \"434\": \"LY\",\n \"438\": \"LI\",\n \"440\": \"LT\",\n \"442\": \"LU\",\n \"446\": \"MO\",\n \"450\": \"MG\",\n \"454\": \"MW\",\n \"458\": \"MY\",\n \"462\": \"MV\",\n \"466\": \"ML\",\n \"470\": \"MT\",\n \"474\": \"MQ\",\n \"478\": \"MR\",\n \"480\": \"MU\",\n \"484\": \"MX\",\n \"492\": \"MC\",\n \"496\": \"MN\",\n \"498\": \"MD\",\n \"499\": \"ME\",\n \"500\": \"MS\",\n \"504\": \"MA\",\n \"508\": \"MZ\",\n \"512\": \"OM\",\n \"516\": \"NA\",\n \"520\": \"NR\",\n \"524\": \"NP\",\n \"528\": \"NL\",\n \"530\": \"CW SX BQ\",\n \"531\": \"CW\",\n \"532\": \"CW SX BQ\",\n \"533\": \"AW\",\n \"534\": \"SX\",\n \"535\": \"BQ\",\n \"536\": \"SA IQ\",\n \"540\": \"NC\",\n \"548\": \"VU\",\n \"554\": \"NZ\",\n \"558\": \"NI\",\n \"562\": \"NE\",\n \"566\": \"NG\",\n \"570\": \"NU\",\n \"574\": \"NF\",\n \"578\": \"NO\",\n \"580\": \"MP\",\n \"581\": \"UM\",\n \"582\": \"FM MH MP PW\",\n \"583\": \"FM\",\n \"584\": \"MH\",\n \"585\": \"PW\",\n \"586\": \"PK\",\n \"591\": \"PA\",\n \"598\": \"PG\",\n \"600\": \"PY\",\n \"604\": \"PE\",\n \"608\": \"PH\",\n \"612\": \"PN\",\n \"616\": \"PL\",\n \"620\": \"PT\",\n \"624\": \"GW\",\n \"626\": \"TL\",\n \"630\": \"PR\",\n \"634\": \"QA\",\n \"638\": \"RE\",\n \"642\": \"RO\",\n \"643\": \"RU\",\n \"646\": \"RW\",\n \"652\": \"BL\",\n \"654\": \"SH\",\n \"659\": \"KN\",\n \"660\": \"AI\",\n \"662\": \"LC\",\n \"663\": \"MF\",\n \"666\": \"PM\",\n \"670\": \"VC\",\n \"674\": \"SM\",\n \"678\": \"ST\",\n \"682\": \"SA\",\n \"686\": \"SN\",\n \"688\": \"RS\",\n \"690\": \"SC\",\n \"694\": \"SL\",\n \"702\": \"SG\",\n \"703\": \"SK\",\n \"704\": \"VN\",\n \"705\": \"SI\",\n \"706\": \"SO\",\n \"710\": \"ZA\",\n \"716\": \"ZW\",\n \"720\": \"YE\",\n \"724\": \"ES\",\n \"728\": \"SS\",\n \"729\": \"SD\",\n \"732\": \"EH\",\n \"736\": \"SD\",\n \"740\": \"SR\",\n \"744\": \"SJ\",\n \"748\": \"SZ\",\n \"752\": \"SE\",\n \"756\": \"CH\",\n \"760\": \"SY\",\n \"762\": \"TJ\",\n \"764\": \"TH\",\n \"768\": \"TG\",\n \"772\": \"TK\",\n \"776\": \"TO\",\n \"780\": \"TT\",\n \"784\": \"AE\",\n \"788\": \"TN\",\n \"792\": \"TR\",\n \"795\": \"TM\",\n \"796\": \"TC\",\n \"798\": \"TV\",\n \"800\": \"UG\",\n \"804\": \"UA\",\n \"807\": \"MK\",\n \"810\": \"RU AM AZ BY EE GE KZ KG LV LT MD TJ TM UA UZ\",\n \"818\": \"EG\",\n \"826\": \"GB\",\n \"830\": \"JE GG\",\n \"831\": \"GG\",\n \"832\": \"JE\",\n \"833\": \"IM\",\n \"834\": \"TZ\",\n \"840\": \"US\",\n \"850\": \"VI\",\n \"854\": \"BF\",\n \"858\": \"UY\",\n \"860\": \"UZ\",\n \"862\": \"VE\",\n \"876\": \"WF\",\n \"882\": \"WS\",\n \"886\": \"YE\",\n \"887\": \"YE\",\n \"890\": \"RS ME SI HR MK BA\",\n \"891\": \"RS ME\",\n \"894\": \"ZM\",\n \"958\": \"AA\",\n \"959\": \"QM\",\n \"960\": \"QN\",\n \"962\": \"QP\",\n \"963\": \"QQ\",\n \"964\": \"QR\",\n \"965\": \"QS\",\n \"966\": \"QT\",\n \"967\": \"EU\",\n \"968\": \"QV\",\n \"969\": \"QW\",\n \"970\": \"QX\",\n \"971\": \"QY\",\n \"972\": \"QZ\",\n \"973\": \"XA\",\n \"974\": \"XB\",\n \"975\": \"XC\",\n \"976\": \"XD\",\n \"977\": \"XE\",\n \"978\": \"XF\",\n \"979\": \"XG\",\n \"980\": \"XH\",\n \"981\": \"XI\",\n \"982\": \"XJ\",\n \"983\": \"XK\",\n \"984\": \"XL\",\n \"985\": \"XM\",\n \"986\": \"XN\",\n \"987\": \"XO\",\n \"988\": \"XP\",\n \"989\": \"XQ\",\n \"990\": \"XR\",\n \"991\": \"XS\",\n \"992\": \"XT\",\n \"993\": \"XU\",\n \"994\": \"XV\",\n \"995\": \"XW\",\n \"996\": \"XX\",\n \"997\": \"XY\",\n \"998\": \"XZ\",\n \"999\": \"ZZ\",\n \"004\": \"AF\",\n \"008\": \"AL\",\n \"010\": \"AQ\",\n \"012\": \"DZ\",\n \"016\": \"AS\",\n \"020\": \"AD\",\n \"024\": \"AO\",\n \"028\": \"AG\",\n \"031\": \"AZ\",\n \"032\": \"AR\",\n \"036\": \"AU\",\n \"040\": \"AT\",\n \"044\": \"BS\",\n \"048\": \"BH\",\n \"050\": \"BD\",\n \"051\": \"AM\",\n \"052\": \"BB\",\n \"056\": \"BE\",\n \"060\": \"BM\",\n \"062\": \"034 143\",\n \"064\": \"BT\",\n \"068\": \"BO\",\n \"070\": \"BA\",\n \"072\": \"BW\",\n \"074\": \"BV\",\n \"076\": \"BR\",\n \"084\": \"BZ\",\n \"086\": \"IO\",\n \"090\": \"SB\",\n \"092\": \"VG\",\n \"096\": \"BN\",\n \"AAA\": \"AA\",\n \"ABW\": \"AW\",\n \"AFG\": \"AF\",\n \"AGO\": \"AO\",\n \"AIA\": \"AI\",\n \"ALA\": \"AX\",\n \"ALB\": \"AL\",\n \"AN\": \"CW SX BQ\",\n \"AND\": \"AD\",\n \"ANT\": \"CW SX BQ\",\n \"ARE\": \"AE\",\n \"ARG\": \"AR\",\n \"ARM\": \"AM\",\n \"ASC\": \"AC\",\n \"ASM\": \"AS\",\n \"ATA\": \"AQ\",\n \"ATF\": \"TF\",\n \"ATG\": \"AG\",\n \"AUS\": \"AU\",\n \"AUT\": \"AT\",\n \"AZE\": \"AZ\",\n \"BDI\": \"BI\",\n \"BEL\": \"BE\",\n \"BEN\": \"BJ\",\n \"BES\": \"BQ\",\n \"BFA\": \"BF\",\n \"BGD\": \"BD\",\n \"BGR\": \"BG\",\n \"BHR\": \"BH\",\n \"BHS\": \"BS\",\n \"BIH\": \"BA\",\n \"BLM\": \"BL\",\n \"BLR\": \"BY\",\n \"BLZ\": \"BZ\",\n \"BMU\": \"BM\",\n \"BOL\": \"BO\",\n \"BRA\": \"BR\",\n \"BRB\": \"BB\",\n \"BRN\": \"BN\",\n \"BTN\": \"BT\",\n \"BU\": \"MM\",\n \"BUR\": \"MM\",\n \"BVT\": \"BV\",\n \"BWA\": \"BW\",\n \"CAF\": \"CF\",\n \"CAN\": \"CA\",\n \"CCK\": \"CC\",\n \"CHE\": \"CH\",\n \"CHL\": \"CL\",\n \"CHN\": \"CN\",\n \"CIV\": \"CI\",\n \"CMR\": \"CM\",\n \"COD\": \"CD\",\n \"COG\": \"CG\",\n \"COK\": \"CK\",\n \"COL\": \"CO\",\n \"COM\": \"KM\",\n \"CPT\": \"CP\",\n \"CPV\": \"CV\",\n \"CRI\": \"CR\",\n \"CS\": \"RS ME\",\n \"CT\": \"KI\",\n \"CUB\": \"CU\",\n \"CUW\": \"CW\",\n \"CXR\": \"CX\",\n \"CYM\": \"KY\",\n \"CYP\": \"CY\",\n \"CZE\": \"CZ\",\n \"DD\": \"DE\",\n \"DDR\": \"DE\",\n \"DEU\": \"DE\",\n \"DGA\": \"DG\",\n \"DJI\": \"DJ\",\n \"DMA\": \"DM\",\n \"DNK\": \"DK\",\n \"DOM\": \"DO\",\n \"DY\": \"BJ\",\n \"DZA\": \"DZ\",\n \"ECU\": \"EC\",\n \"EGY\": \"EG\",\n \"ERI\": \"ER\",\n \"ESH\": \"EH\",\n \"ESP\": \"ES\",\n \"EST\": \"EE\",\n \"ETH\": \"ET\",\n \"FIN\": \"FI\",\n \"FJI\": \"FJ\",\n \"FLK\": \"FK\",\n \"FQ\": \"AQ TF\",\n \"FRA\": \"FR\",\n \"FRO\": \"FO\",\n \"FSM\": \"FM\",\n \"FX\": \"FR\",\n \"FXX\": \"FR\",\n \"GAB\": \"GA\",\n \"GBR\": \"GB\",\n \"GEO\": \"GE\",\n \"GGY\": \"GG\",\n \"GHA\": \"GH\",\n \"GIB\": \"GI\",\n \"GIN\": \"GN\",\n \"GLP\": \"GP\",\n \"GMB\": \"GM\",\n \"GNB\": \"GW\",\n \"GNQ\": \"GQ\",\n \"GRC\": \"GR\",\n \"GRD\": \"GD\",\n \"GRL\": \"GL\",\n \"GTM\": \"GT\",\n \"GUF\": \"GF\",\n \"GUM\": \"GU\",\n \"GUY\": \"GY\",\n \"HKG\": \"HK\",\n \"HMD\": \"HM\",\n \"HND\": \"HN\",\n \"HRV\": \"HR\",\n \"HTI\": \"HT\",\n \"HUN\": \"HU\",\n \"HV\": \"BF\",\n \"IDN\": \"ID\",\n \"IMN\": \"IM\",\n \"IND\": \"IN\",\n \"IOT\": \"IO\",\n \"IRL\": \"IE\",\n \"IRN\": \"IR\",\n \"IRQ\": \"IQ\",\n \"ISL\": \"IS\",\n \"ISR\": \"IL\",\n \"ITA\": \"IT\",\n \"JAM\": \"JM\",\n \"JEY\": \"JE\",\n \"JOR\": \"JO\",\n \"JPN\": \"JP\",\n \"JT\": \"UM\",\n \"KAZ\": \"KZ\",\n \"KEN\": \"KE\",\n \"KGZ\": \"KG\",\n \"KHM\": \"KH\",\n \"KIR\": \"KI\",\n \"KNA\": \"KN\",\n \"KOR\": \"KR\",\n \"KWT\": \"KW\",\n \"LAO\": \"LA\",\n \"LBN\": \"LB\",\n \"LBR\": \"LR\",\n \"LBY\": \"LY\",\n \"LCA\": \"LC\",\n \"LIE\": \"LI\",\n \"LKA\": \"LK\",\n \"LSO\": \"LS\",\n \"LTU\": \"LT\",\n \"LUX\": \"LU\",\n \"LVA\": \"LV\",\n \"MAC\": \"MO\",\n \"MAF\": \"MF\",\n \"MAR\": \"MA\",\n \"MCO\": \"MC\",\n \"MDA\": \"MD\",\n \"MDG\": \"MG\",\n \"MDV\": \"MV\",\n \"MEX\": \"MX\",\n \"MHL\": \"MH\",\n \"MI\": \"UM\",\n \"MKD\": \"MK\",\n \"MLI\": \"ML\",\n \"MLT\": \"MT\",\n \"MMR\": \"MM\",\n \"MNE\": \"ME\",\n \"MNG\": \"MN\",\n \"MNP\": \"MP\",\n \"MOZ\": \"MZ\",\n \"MRT\": \"MR\",\n \"MSR\": \"MS\",\n \"MTQ\": \"MQ\",\n \"MUS\": \"MU\",\n \"MWI\": \"MW\",\n \"MYS\": \"MY\",\n \"MYT\": \"YT\",\n \"NAM\": \"NA\",\n \"NCL\": \"NC\",\n \"NER\": \"NE\",\n \"NFK\": \"NF\",\n \"NGA\": \"NG\",\n \"NH\": \"VU\",\n \"NIC\": \"NI\",\n \"NIU\": \"NU\",\n \"NLD\": \"NL\",\n \"NOR\": \"NO\",\n \"NPL\": \"NP\",\n \"NQ\": \"AQ\",\n \"NRU\": \"NR\",\n \"NT\": \"SA IQ\",\n \"NTZ\": \"SA IQ\",\n \"NZL\": \"NZ\",\n \"OMN\": \"OM\",\n \"PAK\": \"PK\",\n \"PAN\": \"PA\",\n \"PC\": \"FM MH MP PW\",\n \"PCN\": \"PN\",\n \"PER\": \"PE\",\n \"PHL\": \"PH\",\n \"PLW\": \"PW\",\n \"PNG\": \"PG\",\n \"POL\": \"PL\",\n \"PRI\": \"PR\",\n \"PRK\": \"KP\",\n \"PRT\": \"PT\",\n \"PRY\": \"PY\",\n \"PSE\": \"PS\",\n \"PU\": \"UM\",\n \"PYF\": \"PF\",\n \"PZ\": \"PA\",\n \"QAT\": \"QA\",\n \"QMM\": \"QM\",\n \"QNN\": \"QN\",\n \"QPP\": \"QP\",\n \"QQQ\": \"QQ\",\n \"QRR\": \"QR\",\n \"QSS\": \"QS\",\n \"QTT\": \"QT\",\n \"QU\": \"EU\",\n \"QUU\": \"EU\",\n \"QVV\": \"QV\",\n \"QWW\": \"QW\",\n \"QXX\": \"QX\",\n \"QYY\": \"QY\",\n \"QZZ\": \"QZ\",\n \"REU\": \"RE\",\n \"RH\": \"ZW\",\n \"ROU\": \"RO\",\n \"RUS\": \"RU\",\n \"RWA\": \"RW\",\n \"SAU\": \"SA\",\n \"SCG\": \"RS ME\",\n \"SDN\": \"SD\",\n \"SEN\": \"SN\",\n \"SGP\": \"SG\",\n \"SGS\": \"GS\",\n \"SHN\": \"SH\",\n \"SJM\": \"SJ\",\n \"SLB\": \"SB\",\n \"SLE\": \"SL\",\n \"SLV\": \"SV\",\n \"SMR\": \"SM\",\n \"SOM\": \"SO\",\n \"SPM\": \"PM\",\n \"SRB\": \"RS\",\n \"SSD\": \"SS\",\n \"STP\": \"ST\",\n \"SU\": \"RU AM AZ BY EE GE KZ KG LV LT MD TJ TM UA UZ\",\n \"SUN\": \"RU AM AZ BY EE GE KZ KG LV LT MD TJ TM UA UZ\",\n \"SUR\": \"SR\",\n \"SVK\": \"SK\",\n \"SVN\": \"SI\",\n \"SWE\": \"SE\",\n \"SWZ\": \"SZ\",\n \"SXM\": \"SX\",\n \"SYC\": \"SC\",\n \"SYR\": \"SY\",\n \"TAA\": \"TA\",\n \"TCA\": \"TC\",\n \"TCD\": \"TD\",\n \"TGO\": \"TG\",\n \"THA\": \"TH\",\n \"TJK\": \"TJ\",\n \"TKL\": \"TK\",\n \"TKM\": \"TM\",\n \"TLS\": \"TL\",\n \"TMP\": \"TL\",\n \"TON\": \"TO\",\n \"TP\": \"TL\",\n \"TTO\": \"TT\",\n \"TUN\": \"TN\",\n \"TUR\": \"TR\",\n \"TUV\": \"TV\",\n \"TWN\": \"TW\",\n \"TZA\": \"TZ\",\n \"UGA\": \"UG\",\n \"UK\": \"GB\",\n \"UKR\": \"UA\",\n \"UMI\": \"UM\",\n \"URY\": \"UY\",\n \"USA\": \"US\",\n \"UZB\": \"UZ\",\n \"VAT\": \"VA\",\n \"VCT\": \"VC\",\n \"VD\": \"VN\",\n \"VEN\": \"VE\",\n \"VGB\": \"VG\",\n \"VIR\": \"VI\",\n \"VNM\": \"VN\",\n \"VUT\": \"VU\",\n \"WK\": \"UM\",\n \"WLF\": \"WF\",\n \"WSM\": \"WS\",\n \"XAA\": \"XA\",\n \"XBB\": \"XB\",\n \"XCC\": \"XC\",\n \"XDD\": \"XD\",\n \"XEE\": \"XE\",\n \"XFF\": \"XF\",\n \"XGG\": \"XG\",\n \"XHH\": \"XH\",\n \"XII\": \"XI\",\n \"XJJ\": \"XJ\",\n \"XKK\": \"XK\",\n \"XLL\": \"XL\",\n \"XMM\": \"XM\",\n \"XNN\": \"XN\",\n \"XOO\": \"XO\",\n \"XPP\": \"XP\",\n \"XQQ\": \"XQ\",\n \"XRR\": \"XR\",\n \"XSS\": \"XS\",\n \"XTT\": \"XT\",\n \"XUU\": \"XU\",\n \"XVV\": \"XV\",\n \"XWW\": \"XW\",\n \"XXX\": \"XX\",\n \"XYY\": \"XY\",\n \"XZZ\": \"XZ\",\n \"YD\": \"YE\",\n \"YEM\": \"YE\",\n \"YMD\": \"YE\",\n \"YU\": \"RS ME\",\n \"YUG\": \"RS ME\",\n \"ZAF\": \"ZA\",\n \"ZAR\": \"CD\",\n \"ZMB\": \"ZM\",\n \"ZR\": \"CD\",\n \"ZWE\": \"ZW\",\n \"ZZZ\": \"ZZ\"\n};\nexports.scriptAlias = {\n \"Qaai\": \"Zinh\"\n};\nexports.variantAlias = {\n \"heploc\": \"alalc97\",\n \"polytoni\": \"polyton\"\n};","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(obj) {\n var keys = Object.keys(obj);\n var descriptors = {};\n\n for (var i = 0; i < keys.length; i++) {\n descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);\n }\n\n return descriptors;\n};\n\nvar formatRegExp = /%[sdj%]/g;\n\nexports.format = function (f) {\n if (!isString(f)) {\n var objects = [];\n\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function (x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n\n switch (x) {\n case '%s':\n return String(args[i++]);\n\n case '%d':\n return Number(args[i++]);\n\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n\n default:\n return x;\n }\n });\n\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n\n return str;\n}; // Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\n\n\nexports.deprecate = function (fn, msg) {\n if (typeof process !== 'undefined' && process.noDeprecation === true) {\n return fn;\n } // Allow for deprecating things in the process of starting up.\n\n\n if (typeof process === 'undefined') {\n return function () {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n var warned = false;\n\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n\n warned = true;\n }\n\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\nvar debugs = {};\nvar debugEnviron;\n\nexports.debuglog = function (set) {\n if (isUndefined(debugEnviron)) debugEnviron = process.env.NODE_DEBUG || '';\n set = set.toUpperCase();\n\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = process.pid;\n\n debugs[set] = function () {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function () {};\n }\n }\n\n return debugs[set];\n};\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n\n/* legacy: obj, showHidden, depth, colors*/\n\n\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n }; // legacy...\n\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n } // set default options\n\n\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\n\nexports.inspect = inspect; // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\n\ninspect.colors = {\n 'bold': [1, 22],\n 'italic': [3, 23],\n 'underline': [4, 24],\n 'inverse': [7, 27],\n 'white': [37, 39],\n 'grey': [90, 39],\n 'black': [30, 39],\n 'blue': [34, 39],\n 'cyan': [36, 39],\n 'green': [32, 39],\n 'magenta': [35, 39],\n 'red': [31, 39],\n 'yellow': [33, 39]\n}; // Don't use 'blue' not visible on cmd.exe\n\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return \"\\x1B[\" + inspect.colors[style][0] + 'm' + str + \"\\x1B[\" + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\nfunction arrayToHash(array) {\n var hash = {};\n array.forEach(function (val, idx) {\n hash[val] = true;\n });\n return hash;\n}\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect && value && isFunction(value.inspect) && // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect && // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n\n return ret;\n } // Primitive types cannot have properties\n\n\n var primitive = formatPrimitive(ctx, value);\n\n if (primitive) {\n return primitive;\n } // Look up the keys of the object.\n\n\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n } // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n\n\n if (isError(value) && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n } // Some type of object without properties can be shortcutted.\n\n\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '',\n array = false,\n braces = ['{', '}']; // Make Array say that they are Array\n\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n } // Make functions say that they are functions\n\n\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n } // Make RegExps say that they are RegExps\n\n\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n } // Make dates with properties first say the date\n\n\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n } // Make error with message first say the error\n\n\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n var output;\n\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function (key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n return reduceToSingleString(output, base, braces);\n}\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value)) return ctx.stylize('undefined', 'undefined');\n\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '').replace(/'/g, \"\\\\'\").replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n\n if (isNumber(value)) return ctx.stylize('' + value, 'number');\n if (isBoolean(value)) return ctx.stylize('' + value, 'boolean'); // For some reason typeof null is \"object\", so special case here.\n\n if (isNull(value)) return ctx.stylize('null', 'null');\n}\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true));\n } else {\n output.push('');\n }\n }\n\n keys.forEach(function (key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, true));\n }\n });\n return output;\n}\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || {\n value: value[key]\n };\n\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function (line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function (line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n\n name = JSON.stringify('' + key);\n\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\").replace(/\\\\\"/g, '\"').replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function (prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] + (base === '' ? '' : base + '\\n ') + ' ' + output.join(',\\n ') + ' ' + braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n} // NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\n\n\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\n\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\n\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\n\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\n\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\n\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\n\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\n\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\n\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\n\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\n\nexports.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) && (objectToString(e) === '[object Error]' || e instanceof Error);\n}\n\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\n\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null || typeof arg === 'boolean' || typeof arg === 'number' || typeof arg === 'string' || typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\n\nexports.isPrimitive = isPrimitive;\nexports.isBuffer = require('./support/isBuffer');\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; // 26 Feb 16:19:34\n\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()), pad(d.getMinutes()), pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n} // log is just a thin wrapper to console.log that prepends a timestamp\n\n\nexports.log = function () {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\n\n\nexports.inherits = require('inherits');\n\nexports._extend = function (origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n var keys = Object.keys(add);\n var i = keys.length;\n\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nvar kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;\n\nexports.promisify = function promisify(original) {\n if (typeof original !== 'function') throw new TypeError('The \"original\" argument must be of type Function');\n\n if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {\n var fn = original[kCustomPromisifiedSymbol];\n\n if (typeof fn !== 'function') {\n throw new TypeError('The \"util.promisify.custom\" argument must be of type Function');\n }\n\n Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn,\n enumerable: false,\n writable: false,\n configurable: true\n });\n return fn;\n }\n\n function fn() {\n var promiseResolve, promiseReject;\n var promise = new Promise(function (resolve, reject) {\n promiseResolve = resolve;\n promiseReject = reject;\n });\n var args = [];\n\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n\n args.push(function (err, value) {\n if (err) {\n promiseReject(err);\n } else {\n promiseResolve(value);\n }\n });\n\n try {\n original.apply(this, args);\n } catch (err) {\n promiseReject(err);\n }\n\n return promise;\n }\n\n Object.setPrototypeOf(fn, Object.getPrototypeOf(original));\n if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn,\n enumerable: false,\n writable: false,\n configurable: true\n });\n return Object.defineProperties(fn, getOwnPropertyDescriptors(original));\n};\n\nexports.promisify.custom = kCustomPromisifiedSymbol;\n\nfunction callbackifyOnRejected(reason, cb) {\n // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).\n // Because `null` is a special error value in callbacks which means \"no error\n // occurred\", we error-wrap so the callback consumer can distinguish between\n // \"the promise rejected with null\" or \"the promise fulfilled with undefined\".\n if (!reason) {\n var newReason = new Error('Promise was rejected with a falsy value');\n newReason.reason = reason;\n reason = newReason;\n }\n\n return cb(reason);\n}\n\nfunction callbackify(original) {\n if (typeof original !== 'function') {\n throw new TypeError('The \"original\" argument must be of type Function');\n } // We DO NOT return the promise as it gives the user a false sense that\n // the promise is actually somehow related to the callback's execution\n // and that the callback throwing will reject the promise.\n\n\n function callbackified() {\n var args = [];\n\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n\n var maybeCb = args.pop();\n\n if (typeof maybeCb !== 'function') {\n throw new TypeError('The last argument must be of type Function');\n }\n\n var self = this;\n\n var cb = function cb() {\n return maybeCb.apply(self, arguments);\n }; // In true node style we process the callback on `nextTick` with all the\n // implications (stack, `uncaughtException`, `async_hooks`)\n\n\n original.apply(this, args).then(function (ret) {\n process.nextTick(cb, null, ret);\n }, function (rej) {\n process.nextTick(callbackifyOnRejected, rej, cb);\n });\n }\n\n Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));\n Object.defineProperties(callbackified, getOwnPropertyDescriptors(original));\n return callbackified;\n}\n\nexports.callbackify = callbackify;","/*!\n * domready (c) Dustin Diaz 2014 - License MIT\n * ie10 fix - Mikael Kristiansson 2019\n */\n!(function(name, definition) {\n if (typeof module != \"undefined\") module.exports = definition();\n else if (typeof define == \"function\" && typeof define.amd == \"object\")\n define(definition);\n else this[name] = definition();\n})(\"domready\", function() {\n var ie10 = false;\n if (navigator.appVersion.indexOf(\"MSIE 10\") !== -1) {\n ie10 = true;\n }\n\n var fns = [],\n listener,\n doc = typeof document === \"object\" && document,\n hack = ie10\n ? doc.documentElement.doScroll(\"left\")\n : doc.documentElement.doScroll,\n domContentLoaded = \"DOMContentLoaded\",\n loaded =\n doc && (hack ? /^loaded|^c/ : /^loaded|^i|^c/).test(doc.readyState);\n\n if (!loaded && doc)\n doc.addEventListener(\n domContentLoaded,\n (listener = function() {\n doc.removeEventListener(domContentLoaded, listener);\n loaded = 1;\n while ((listener = fns.shift())) listener();\n })\n );\n\n return function(fn) {\n loaded ? setTimeout(fn, 0) : fns.push(fn);\n };\n});\n","'use strict';\n\nvar utils = require('./utils');\n\nvar bind = require('./helpers/bind');\n\nvar Axios = require('./core/Axios');\n\nvar mergeConfig = require('./core/mergeConfig');\n\nvar defaults = require('./defaults');\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n * @return {Axios} A new instance of Axios\n */\n\n\nfunction createInstance(defaultConfig) {\n var context = new Axios(defaultConfig);\n var instance = bind(Axios.prototype.request, context); // Copy axios.prototype to instance\n\n utils.extend(instance, Axios.prototype, context); // Copy context to instance\n\n utils.extend(instance, context);\n return instance;\n} // Create the default instance to be exported\n\n\nvar axios = createInstance(defaults); // Expose Axios class to allow class inheritance\n\naxios.Axios = Axios; // Factory for creating new instances\n\naxios.create = function create(instanceConfig) {\n return createInstance(mergeConfig(axios.defaults, instanceConfig));\n}; // Expose Cancel & CancelToken\n\n\naxios.Cancel = require('./cancel/Cancel');\naxios.CancelToken = require('./cancel/CancelToken');\naxios.isCancel = require('./cancel/isCancel'); // Expose all/spread\n\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\n\naxios.spread = require('./helpers/spread');\nmodule.exports = axios; // Allow use of default import syntax in TypeScript\n\nmodule.exports.default = axios;","require('./dist/polyfill');","/* eslint-disable */\n// Inspired by https://github.com/garycourt/murmurhash-js\n// Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86\nfunction murmur2(str) {\n // 'm' and 'r' are mixing constants generated offline.\n // They're not really 'magic', they just happen to work well.\n // const m = 0x5bd1e995;\n // const r = 24;\n // Initialize the hash\n var h = 0; // Mix 4 bytes at a time into the hash\n\n var k,\n i = 0,\n len = str.length;\n\n for (; len >= 4; ++i, len -= 4) {\n k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;\n k =\n /* Math.imul(k, m): */\n (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16);\n k ^=\n /* k >>> r: */\n k >>> 24;\n h =\n /* Math.imul(k, m): */\n (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^\n /* Math.imul(h, m): */\n (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);\n } // Handle the last few bytes of the input array\n\n\n switch (len) {\n case 3:\n h ^= (str.charCodeAt(i + 2) & 0xff) << 16;\n\n case 2:\n h ^= (str.charCodeAt(i + 1) & 0xff) << 8;\n\n case 1:\n h ^= str.charCodeAt(i) & 0xff;\n h =\n /* Math.imul(h, m): */\n (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);\n } // Do a few final mixes of the hash to ensure the last few\n // bytes are well-incorporated.\n\n\n h ^= h >>> 13;\n h =\n /* Math.imul(h, m): */\n (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);\n return ((h ^ h >>> 15) >>> 0).toString(36);\n}\n\nexport default murmur2;","var unitlessKeys = {\n animationIterationCount: 1,\n borderImageOutset: 1,\n borderImageSlice: 1,\n borderImageWidth: 1,\n boxFlex: 1,\n boxFlexGroup: 1,\n boxOrdinalGroup: 1,\n columnCount: 1,\n columns: 1,\n flex: 1,\n flexGrow: 1,\n flexPositive: 1,\n flexShrink: 1,\n flexNegative: 1,\n flexOrder: 1,\n gridRow: 1,\n gridRowEnd: 1,\n gridRowSpan: 1,\n gridRowStart: 1,\n gridColumn: 1,\n gridColumnEnd: 1,\n gridColumnSpan: 1,\n gridColumnStart: 1,\n msGridRow: 1,\n msGridRowSpan: 1,\n msGridColumn: 1,\n msGridColumnSpan: 1,\n fontWeight: 1,\n lineHeight: 1,\n opacity: 1,\n order: 1,\n orphans: 1,\n tabSize: 1,\n widows: 1,\n zIndex: 1,\n zoom: 1,\n WebkitLineClamp: 1,\n // SVG-related properties\n fillOpacity: 1,\n floodOpacity: 1,\n stopOpacity: 1,\n strokeDasharray: 1,\n strokeDashoffset: 1,\n strokeMiterlimit: 1,\n strokeOpacity: 1,\n strokeWidth: 1\n};\nexport default unitlessKeys;","function memoize(fn) {\n var cache = {};\n return function (arg) {\n if (cache[arg] === undefined) cache[arg] = fn(arg);\n return cache[arg];\n };\n}\n\nexport default memoize;","import hashString from '@emotion/hash';\nimport unitless from '@emotion/unitless';\nimport memoize from '@emotion/memoize';\nvar ILLEGAL_ESCAPE_SEQUENCE_ERROR = \"You have illegal escape sequence in your template literal, most likely inside content's property value.\\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \\\"content: '\\\\00d7';\\\" should become \\\"content: '\\\\\\\\00d7';\\\".\\nYou can read more about this here:\\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences\";\nvar UNDEFINED_AS_OBJECT_KEY_ERROR = \"You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key).\";\nvar hyphenateRegex = /[A-Z]|^ms/g;\nvar animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;\n\nvar isCustomProperty = function isCustomProperty(property) {\n return property.charCodeAt(1) === 45;\n};\n\nvar isProcessableValue = function isProcessableValue(value) {\n return value != null && typeof value !== 'boolean';\n};\n\nvar processStyleName = memoize(function (styleName) {\n return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase();\n});\n\nvar processStyleValue = function processStyleValue(key, value) {\n switch (key) {\n case 'animation':\n case 'animationName':\n {\n if (typeof value === 'string') {\n return value.replace(animationRegex, function (match, p1, p2) {\n cursor = {\n name: p1,\n styles: p2,\n next: cursor\n };\n return p1;\n });\n }\n }\n }\n\n if (unitless[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) {\n return value + 'px';\n }\n\n return value;\n};\n\nif (process.env.NODE_ENV !== 'production') {\n var contentValuePattern = /(attr|calc|counters?|url)\\(/;\n var contentValues = ['normal', 'none', 'counter', 'open-quote', 'close-quote', 'no-open-quote', 'no-close-quote', 'initial', 'inherit', 'unset'];\n var oldProcessStyleValue = processStyleValue;\n var msPattern = /^-ms-/;\n var hyphenPattern = /-(.)/g;\n var hyphenatedCache = {};\n\n processStyleValue = function processStyleValue(key, value) {\n if (key === 'content') {\n if (typeof value !== 'string' || contentValues.indexOf(value) === -1 && !contentValuePattern.test(value) && (value.charAt(0) !== value.charAt(value.length - 1) || value.charAt(0) !== '\"' && value.charAt(0) !== \"'\")) {\n console.error(\"You seem to be using a value for 'content' without quotes, try replacing it with `content: '\\\"\" + value + \"\\\"'`\");\n }\n }\n\n var processed = oldProcessStyleValue(key, value);\n\n if (processed !== '' && !isCustomProperty(key) && key.indexOf('-') !== -1 && hyphenatedCache[key] === undefined) {\n hyphenatedCache[key] = true;\n console.error(\"Using kebab-case for css properties in objects is not supported. Did you mean \" + key.replace(msPattern, 'ms-').replace(hyphenPattern, function (str, _char) {\n return _char.toUpperCase();\n }) + \"?\");\n }\n\n return processed;\n };\n}\n\nvar shouldWarnAboutInterpolatingClassNameFromCss = true;\n\nfunction handleInterpolation(mergedProps, registered, interpolation, couldBeSelectorInterpolation) {\n if (interpolation == null) {\n return '';\n }\n\n if (interpolation.__emotion_styles !== undefined) {\n if (process.env.NODE_ENV !== 'production' && interpolation.toString() === 'NO_COMPONENT_SELECTOR') {\n throw new Error('Component selectors can only be used in conjunction with babel-plugin-emotion.');\n }\n\n return interpolation;\n }\n\n switch (typeof interpolation) {\n case 'boolean':\n {\n return '';\n }\n\n case 'object':\n {\n if (interpolation.anim === 1) {\n cursor = {\n name: interpolation.name,\n styles: interpolation.styles,\n next: cursor\n };\n return interpolation.name;\n }\n\n if (interpolation.styles !== undefined) {\n var next = interpolation.next;\n\n if (next !== undefined) {\n // not the most efficient thing ever but this is a pretty rare case\n // and there will be very few iterations of this generally\n while (next !== undefined) {\n cursor = {\n name: next.name,\n styles: next.styles,\n next: cursor\n };\n next = next.next;\n }\n }\n\n var styles = interpolation.styles + \";\";\n\n if (process.env.NODE_ENV !== 'production' && interpolation.map !== undefined) {\n styles += interpolation.map;\n }\n\n return styles;\n }\n\n return createStringFromObject(mergedProps, registered, interpolation);\n }\n\n case 'function':\n {\n if (mergedProps !== undefined) {\n var previousCursor = cursor;\n var result = interpolation(mergedProps);\n cursor = previousCursor;\n return handleInterpolation(mergedProps, registered, result, couldBeSelectorInterpolation);\n } else if (process.env.NODE_ENV !== 'production') {\n console.error('Functions that are interpolated in css calls will be stringified.\\n' + 'If you want to have a css call based on props, create a function that returns a css call like this\\n' + 'let dynamicStyle = (props) => css`color: ${props.color}`\\n' + 'It can be called directly with props or interpolated in a styled call like this\\n' + \"let SomeComponent = styled('div')`${dynamicStyle}`\");\n }\n\n break;\n }\n\n case 'string':\n if (process.env.NODE_ENV !== 'production') {\n var matched = [];\n var replaced = interpolation.replace(animationRegex, function (match, p1, p2) {\n var fakeVarName = \"animation\" + matched.length;\n matched.push(\"const \" + fakeVarName + \" = keyframes`\" + p2.replace(/^@keyframes animation-\\w+/, '') + \"`\");\n return \"${\" + fakeVarName + \"}\";\n });\n\n if (matched.length) {\n console.error('`keyframes` output got interpolated into plain string, please wrap it with `css`.\\n\\n' + 'Instead of doing this:\\n\\n' + [].concat(matched, [\"`\" + replaced + \"`\"]).join('\\n') + '\\n\\nYou should wrap it with `css` like this:\\n\\n' + (\"css`\" + replaced + \"`\"));\n }\n }\n\n break;\n } // finalize string values (regular strings and functions interpolated into css calls)\n\n\n if (registered == null) {\n return interpolation;\n }\n\n var cached = registered[interpolation];\n\n if (process.env.NODE_ENV !== 'production' && couldBeSelectorInterpolation && shouldWarnAboutInterpolatingClassNameFromCss && cached !== undefined) {\n console.error('Interpolating a className from css`` is not recommended and will cause problems with composition.\\n' + 'Interpolating a className from css`` will be completely unsupported in a future major version of Emotion');\n shouldWarnAboutInterpolatingClassNameFromCss = false;\n }\n\n return cached !== undefined && !couldBeSelectorInterpolation ? cached : interpolation;\n}\n\nfunction createStringFromObject(mergedProps, registered, obj) {\n var string = '';\n\n if (Array.isArray(obj)) {\n for (var i = 0; i < obj.length; i++) {\n string += handleInterpolation(mergedProps, registered, obj[i], false);\n }\n } else {\n for (var _key in obj) {\n var value = obj[_key];\n\n if (typeof value !== 'object') {\n if (registered != null && registered[value] !== undefined) {\n string += _key + \"{\" + registered[value] + \"}\";\n } else if (isProcessableValue(value)) {\n string += processStyleName(_key) + \":\" + processStyleValue(_key, value) + \";\";\n }\n } else {\n if (_key === 'NO_COMPONENT_SELECTOR' && process.env.NODE_ENV !== 'production') {\n throw new Error('Component selectors can only be used in conjunction with babel-plugin-emotion.');\n }\n\n if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) {\n for (var _i = 0; _i < value.length; _i++) {\n if (isProcessableValue(value[_i])) {\n string += processStyleName(_key) + \":\" + processStyleValue(_key, value[_i]) + \";\";\n }\n }\n } else {\n var interpolated = handleInterpolation(mergedProps, registered, value, false);\n\n switch (_key) {\n case 'animation':\n case 'animationName':\n {\n string += processStyleName(_key) + \":\" + interpolated + \";\";\n break;\n }\n\n default:\n {\n if (process.env.NODE_ENV !== 'production' && _key === 'undefined') {\n console.error(UNDEFINED_AS_OBJECT_KEY_ERROR);\n }\n\n string += _key + \"{\" + interpolated + \"}\";\n }\n }\n }\n }\n }\n }\n\n return string;\n}\n\nvar labelPattern = /label:\\s*([^\\s;\\n{]+)\\s*;/g;\nvar sourceMapPattern;\n\nif (process.env.NODE_ENV !== 'production') {\n sourceMapPattern = /\\/\\*#\\ssourceMappingURL=data:application\\/json;\\S+\\s+\\*\\//;\n} // this is the cursor for keyframes\n// keyframes are stored on the SerializedStyles object as a linked list\n\n\nvar cursor;\n\nvar serializeStyles = function serializeStyles(args, registered, mergedProps) {\n if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) {\n return args[0];\n }\n\n var stringMode = true;\n var styles = '';\n cursor = undefined;\n var strings = args[0];\n\n if (strings == null || strings.raw === undefined) {\n stringMode = false;\n styles += handleInterpolation(mergedProps, registered, strings, false);\n } else {\n if (process.env.NODE_ENV !== 'production' && strings[0] === undefined) {\n console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR);\n }\n\n styles += strings[0];\n } // we start at 1 since we've already handled the first arg\n\n\n for (var i = 1; i < args.length; i++) {\n styles += handleInterpolation(mergedProps, registered, args[i], styles.charCodeAt(styles.length - 1) === 46);\n\n if (stringMode) {\n if (process.env.NODE_ENV !== 'production' && strings[i] === undefined) {\n console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR);\n }\n\n styles += strings[i];\n }\n }\n\n var sourceMap;\n\n if (process.env.NODE_ENV !== 'production') {\n styles = styles.replace(sourceMapPattern, function (match) {\n sourceMap = match;\n return '';\n });\n } // using a global regex with .exec is stateful so lastIndex has to be reset each time\n\n\n labelPattern.lastIndex = 0;\n var identifierName = '';\n var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5\n\n while ((match = labelPattern.exec(styles)) !== null) {\n identifierName += '-' + // $FlowFixMe we know it's not null\n match[1];\n }\n\n var name = hashString(styles) + identifierName;\n\n if (process.env.NODE_ENV !== 'production') {\n // $FlowFixMe SerializedStyles type doesn't have toString property (and we don't want to add it)\n return {\n name: name,\n styles: styles,\n map: sourceMap,\n next: cursor,\n toString: function toString() {\n return \"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).\";\n }\n };\n }\n\n return {\n name: name,\n styles: styles,\n next: cursor\n };\n};\n\nexport { serializeStyles };","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport classNames from 'classnames';\nimport React from 'react';\nvar Feedback = /*#__PURE__*/React.forwardRef( // Need to define the default \"as\" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595\nfunction (_ref, ref) {\n var _ref$as = _ref.as,\n Component = _ref$as === void 0 ? 'div' : _ref$as,\n className = _ref.className,\n _ref$type = _ref.type,\n type = _ref$type === void 0 ? 'valid' : _ref$type,\n _ref$tooltip = _ref.tooltip,\n tooltip = _ref$tooltip === void 0 ? false : _ref$tooltip,\n props = _objectWithoutPropertiesLoose(_ref, [\"as\", \"className\", \"type\", \"tooltip\"]);\n\n return /*#__PURE__*/React.createElement(Component, _extends({}, props, {\n ref: ref,\n className: classNames(className, type + \"-\" + (tooltip ? 'tooltip' : 'feedback'))\n }));\n});\nFeedback.displayName = 'Feedback';\nexport default Feedback;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar core_1 = require(\"./core\");\n\nif (typeof Intl.PluralRules === 'undefined' || !Intl.PluralRules.polyfilled && new Intl.PluralRules('en', {\n minimumFractionDigits: 2\n}).select(1) === 'one') {\n Object.defineProperty(Intl, 'PluralRules', {\n value: core_1.PluralRules,\n writable: true,\n enumerable: false,\n configurable: true\n });\n}","'use strict';\n\nvar utils = require('../utils');\n\nvar BN = require('bn.js');\n\nvar inherits = require('inherits');\n\nvar Base = require('./base');\n\nvar assert = utils.assert;\n\nfunction ShortCurve(conf) {\n Base.call(this, 'short', conf);\n this.a = new BN(conf.a, 16).toRed(this.red);\n this.b = new BN(conf.b, 16).toRed(this.red);\n this.tinv = this.two.redInvm();\n this.zeroA = this.a.fromRed().cmpn(0) === 0;\n this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0; // If the curve is endomorphic, precalculate beta and lambda\n\n this.endo = this._getEndomorphism(conf);\n this._endoWnafT1 = new Array(4);\n this._endoWnafT2 = new Array(4);\n}\n\ninherits(ShortCurve, Base);\nmodule.exports = ShortCurve;\n\nShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) {\n // No efficient endomorphism\n if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1) return; // Compute beta and lambda, that lambda * P = (beta * Px; Py)\n\n var beta;\n var lambda;\n\n if (conf.beta) {\n beta = new BN(conf.beta, 16).toRed(this.red);\n } else {\n var betas = this._getEndoRoots(this.p); // Choose the smallest beta\n\n\n beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1];\n beta = beta.toRed(this.red);\n }\n\n if (conf.lambda) {\n lambda = new BN(conf.lambda, 16);\n } else {\n // Choose the lambda that is matching selected beta\n var lambdas = this._getEndoRoots(this.n);\n\n if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) {\n lambda = lambdas[0];\n } else {\n lambda = lambdas[1];\n assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0);\n }\n } // Get basis vectors, used for balanced length-two representation\n\n\n var basis;\n\n if (conf.basis) {\n basis = conf.basis.map(function (vec) {\n return {\n a: new BN(vec.a, 16),\n b: new BN(vec.b, 16)\n };\n });\n } else {\n basis = this._getEndoBasis(lambda);\n }\n\n return {\n beta: beta,\n lambda: lambda,\n basis: basis\n };\n};\n\nShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) {\n // Find roots of for x^2 + x + 1 in F\n // Root = (-1 +- Sqrt(-3)) / 2\n //\n var red = num === this.p ? this.red : BN.mont(num);\n var tinv = new BN(2).toRed(red).redInvm();\n var ntinv = tinv.redNeg();\n var s = new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv);\n var l1 = ntinv.redAdd(s).fromRed();\n var l2 = ntinv.redSub(s).fromRed();\n return [l1, l2];\n};\n\nShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) {\n // aprxSqrt >= sqrt(this.n)\n var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2)); // 3.74\n // Run EGCD, until r(L + 1) < aprxSqrt\n\n var u = lambda;\n var v = this.n.clone();\n var x1 = new BN(1);\n var y1 = new BN(0);\n var x2 = new BN(0);\n var y2 = new BN(1); // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n)\n\n var a0;\n var b0; // First vector\n\n var a1;\n var b1; // Second vector\n\n var a2;\n var b2;\n var prevR;\n var i = 0;\n var r;\n var x;\n\n while (u.cmpn(0) !== 0) {\n var q = v.div(u);\n r = v.sub(q.mul(u));\n x = x2.sub(q.mul(x1));\n var y = y2.sub(q.mul(y1));\n\n if (!a1 && r.cmp(aprxSqrt) < 0) {\n a0 = prevR.neg();\n b0 = x1;\n a1 = r.neg();\n b1 = x;\n } else if (a1 && ++i === 2) {\n break;\n }\n\n prevR = r;\n v = u;\n u = r;\n x2 = x1;\n x1 = x;\n y2 = y1;\n y1 = y;\n }\n\n a2 = r.neg();\n b2 = x;\n var len1 = a1.sqr().add(b1.sqr());\n var len2 = a2.sqr().add(b2.sqr());\n\n if (len2.cmp(len1) >= 0) {\n a2 = a0;\n b2 = b0;\n } // Normalize signs\n\n\n if (a1.negative) {\n a1 = a1.neg();\n b1 = b1.neg();\n }\n\n if (a2.negative) {\n a2 = a2.neg();\n b2 = b2.neg();\n }\n\n return [{\n a: a1,\n b: b1\n }, {\n a: a2,\n b: b2\n }];\n};\n\nShortCurve.prototype._endoSplit = function _endoSplit(k) {\n var basis = this.endo.basis;\n var v1 = basis[0];\n var v2 = basis[1];\n var c1 = v2.b.mul(k).divRound(this.n);\n var c2 = v1.b.neg().mul(k).divRound(this.n);\n var p1 = c1.mul(v1.a);\n var p2 = c2.mul(v2.a);\n var q1 = c1.mul(v1.b);\n var q2 = c2.mul(v2.b); // Calculate answer\n\n var k1 = k.sub(p1).sub(p2);\n var k2 = q1.add(q2).neg();\n return {\n k1: k1,\n k2: k2\n };\n};\n\nShortCurve.prototype.pointFromX = function pointFromX(x, odd) {\n x = new BN(x, 16);\n if (!x.red) x = x.toRed(this.red);\n var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b);\n var y = y2.redSqrt();\n if (y.redSqr().redSub(y2).cmp(this.zero) !== 0) throw new Error('invalid point'); // XXX Is there any way to tell if the number is odd without converting it\n // to non-red form?\n\n var isOdd = y.fromRed().isOdd();\n if (odd && !isOdd || !odd && isOdd) y = y.redNeg();\n return this.point(x, y);\n};\n\nShortCurve.prototype.validate = function validate(point) {\n if (point.inf) return true;\n var x = point.x;\n var y = point.y;\n var ax = this.a.redMul(x);\n var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);\n return y.redSqr().redISub(rhs).cmpn(0) === 0;\n};\n\nShortCurve.prototype._endoWnafMulAdd = function _endoWnafMulAdd(points, coeffs, jacobianResult) {\n var npoints = this._endoWnafT1;\n var ncoeffs = this._endoWnafT2;\n\n for (var i = 0; i < points.length; i++) {\n var split = this._endoSplit(coeffs[i]);\n\n var p = points[i];\n\n var beta = p._getBeta();\n\n if (split.k1.negative) {\n split.k1.ineg();\n p = p.neg(true);\n }\n\n if (split.k2.negative) {\n split.k2.ineg();\n beta = beta.neg(true);\n }\n\n npoints[i * 2] = p;\n npoints[i * 2 + 1] = beta;\n ncoeffs[i * 2] = split.k1;\n ncoeffs[i * 2 + 1] = split.k2;\n }\n\n var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult); // Clean-up references to points and coefficients\n\n\n for (var j = 0; j < i * 2; j++) {\n npoints[j] = null;\n ncoeffs[j] = null;\n }\n\n return res;\n};\n\nfunction Point(curve, x, y, isRed) {\n Base.BasePoint.call(this, curve, 'affine');\n\n if (x === null && y === null) {\n this.x = null;\n this.y = null;\n this.inf = true;\n } else {\n this.x = new BN(x, 16);\n this.y = new BN(y, 16); // Force redgomery representation when loading from JSON\n\n if (isRed) {\n this.x.forceRed(this.curve.red);\n this.y.forceRed(this.curve.red);\n }\n\n if (!this.x.red) this.x = this.x.toRed(this.curve.red);\n if (!this.y.red) this.y = this.y.toRed(this.curve.red);\n this.inf = false;\n }\n}\n\ninherits(Point, Base.BasePoint);\n\nShortCurve.prototype.point = function point(x, y, isRed) {\n return new Point(this, x, y, isRed);\n};\n\nShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) {\n return Point.fromJSON(this, obj, red);\n};\n\nPoint.prototype._getBeta = function _getBeta() {\n if (!this.curve.endo) return;\n var pre = this.precomputed;\n if (pre && pre.beta) return pre.beta;\n var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y);\n\n if (pre) {\n var curve = this.curve;\n\n var endoMul = function endoMul(p) {\n return curve.point(p.x.redMul(curve.endo.beta), p.y);\n };\n\n pre.beta = beta;\n beta.precomputed = {\n beta: null,\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: pre.naf.points.map(endoMul)\n },\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: pre.doubles.points.map(endoMul)\n }\n };\n }\n\n return beta;\n};\n\nPoint.prototype.toJSON = function toJSON() {\n if (!this.precomputed) return [this.x, this.y];\n return [this.x, this.y, this.precomputed && {\n doubles: this.precomputed.doubles && {\n step: this.precomputed.doubles.step,\n points: this.precomputed.doubles.points.slice(1)\n },\n naf: this.precomputed.naf && {\n wnd: this.precomputed.naf.wnd,\n points: this.precomputed.naf.points.slice(1)\n }\n }];\n};\n\nPoint.fromJSON = function fromJSON(curve, obj, red) {\n if (typeof obj === 'string') obj = JSON.parse(obj);\n var res = curve.point(obj[0], obj[1], red);\n if (!obj[2]) return res;\n\n function obj2point(obj) {\n return curve.point(obj[0], obj[1], red);\n }\n\n var pre = obj[2];\n res.precomputed = {\n beta: null,\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: [res].concat(pre.doubles.points.map(obj2point))\n },\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: [res].concat(pre.naf.points.map(obj2point))\n }\n };\n return res;\n};\n\nPoint.prototype.inspect = function inspect() {\n if (this.isInfinity()) return '';\n return '';\n};\n\nPoint.prototype.isInfinity = function isInfinity() {\n return this.inf;\n};\n\nPoint.prototype.add = function add(p) {\n // O + P = P\n if (this.inf) return p; // P + O = P\n\n if (p.inf) return this; // P + P = 2P\n\n if (this.eq(p)) return this.dbl(); // P + (-P) = O\n\n if (this.neg().eq(p)) return this.curve.point(null, null); // P + Q = O\n\n if (this.x.cmp(p.x) === 0) return this.curve.point(null, null);\n var c = this.y.redSub(p.y);\n if (c.cmpn(0) !== 0) c = c.redMul(this.x.redSub(p.x).redInvm());\n var nx = c.redSqr().redISub(this.x).redISub(p.x);\n var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);\n return this.curve.point(nx, ny);\n};\n\nPoint.prototype.dbl = function dbl() {\n if (this.inf) return this; // 2P = O\n\n var ys1 = this.y.redAdd(this.y);\n if (ys1.cmpn(0) === 0) return this.curve.point(null, null);\n var a = this.curve.a;\n var x2 = this.x.redSqr();\n var dyinv = ys1.redInvm();\n var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv);\n var nx = c.redSqr().redISub(this.x.redAdd(this.x));\n var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);\n return this.curve.point(nx, ny);\n};\n\nPoint.prototype.getX = function getX() {\n return this.x.fromRed();\n};\n\nPoint.prototype.getY = function getY() {\n return this.y.fromRed();\n};\n\nPoint.prototype.mul = function mul(k) {\n k = new BN(k, 16);\n if (this.isInfinity()) return this;else if (this._hasDoubles(k)) return this.curve._fixedNafMul(this, k);else if (this.curve.endo) return this.curve._endoWnafMulAdd([this], [k]);else return this.curve._wnafMul(this, k);\n};\n\nPoint.prototype.mulAdd = function mulAdd(k1, p2, k2) {\n var points = [this, p2];\n var coeffs = [k1, k2];\n if (this.curve.endo) return this.curve._endoWnafMulAdd(points, coeffs);else return this.curve._wnafMulAdd(1, points, coeffs, 2);\n};\n\nPoint.prototype.jmulAdd = function jmulAdd(k1, p2, k2) {\n var points = [this, p2];\n var coeffs = [k1, k2];\n if (this.curve.endo) return this.curve._endoWnafMulAdd(points, coeffs, true);else return this.curve._wnafMulAdd(1, points, coeffs, 2, true);\n};\n\nPoint.prototype.eq = function eq(p) {\n return this === p || this.inf === p.inf && (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0);\n};\n\nPoint.prototype.neg = function neg(_precompute) {\n if (this.inf) return this;\n var res = this.curve.point(this.x, this.y.redNeg());\n\n if (_precompute && this.precomputed) {\n var pre = this.precomputed;\n\n var negate = function negate(p) {\n return p.neg();\n };\n\n res.precomputed = {\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: pre.naf.points.map(negate)\n },\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: pre.doubles.points.map(negate)\n }\n };\n }\n\n return res;\n};\n\nPoint.prototype.toJ = function toJ() {\n if (this.inf) return this.curve.jpoint(null, null, null);\n var res = this.curve.jpoint(this.x, this.y, this.curve.one);\n return res;\n};\n\nfunction JPoint(curve, x, y, z) {\n Base.BasePoint.call(this, curve, 'jacobian');\n\n if (x === null && y === null && z === null) {\n this.x = this.curve.one;\n this.y = this.curve.one;\n this.z = new BN(0);\n } else {\n this.x = new BN(x, 16);\n this.y = new BN(y, 16);\n this.z = new BN(z, 16);\n }\n\n if (!this.x.red) this.x = this.x.toRed(this.curve.red);\n if (!this.y.red) this.y = this.y.toRed(this.curve.red);\n if (!this.z.red) this.z = this.z.toRed(this.curve.red);\n this.zOne = this.z === this.curve.one;\n}\n\ninherits(JPoint, Base.BasePoint);\n\nShortCurve.prototype.jpoint = function jpoint(x, y, z) {\n return new JPoint(this, x, y, z);\n};\n\nJPoint.prototype.toP = function toP() {\n if (this.isInfinity()) return this.curve.point(null, null);\n var zinv = this.z.redInvm();\n var zinv2 = zinv.redSqr();\n var ax = this.x.redMul(zinv2);\n var ay = this.y.redMul(zinv2).redMul(zinv);\n return this.curve.point(ax, ay);\n};\n\nJPoint.prototype.neg = function neg() {\n return this.curve.jpoint(this.x, this.y.redNeg(), this.z);\n};\n\nJPoint.prototype.add = function add(p) {\n // O + P = P\n if (this.isInfinity()) return p; // P + O = P\n\n if (p.isInfinity()) return this; // 12M + 4S + 7A\n\n var pz2 = p.z.redSqr();\n var z2 = this.z.redSqr();\n var u1 = this.x.redMul(pz2);\n var u2 = p.x.redMul(z2);\n var s1 = this.y.redMul(pz2.redMul(p.z));\n var s2 = p.y.redMul(z2.redMul(this.z));\n var h = u1.redSub(u2);\n var r = s1.redSub(s2);\n\n if (h.cmpn(0) === 0) {\n if (r.cmpn(0) !== 0) return this.curve.jpoint(null, null, null);else return this.dbl();\n }\n\n var h2 = h.redSqr();\n var h3 = h2.redMul(h);\n var v = u1.redMul(h2);\n var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);\n var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));\n var nz = this.z.redMul(p.z).redMul(h);\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.mixedAdd = function mixedAdd(p) {\n // O + P = P\n if (this.isInfinity()) return p.toJ(); // P + O = P\n\n if (p.isInfinity()) return this; // 8M + 3S + 7A\n\n var z2 = this.z.redSqr();\n var u1 = this.x;\n var u2 = p.x.redMul(z2);\n var s1 = this.y;\n var s2 = p.y.redMul(z2).redMul(this.z);\n var h = u1.redSub(u2);\n var r = s1.redSub(s2);\n\n if (h.cmpn(0) === 0) {\n if (r.cmpn(0) !== 0) return this.curve.jpoint(null, null, null);else return this.dbl();\n }\n\n var h2 = h.redSqr();\n var h3 = h2.redMul(h);\n var v = u1.redMul(h2);\n var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);\n var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));\n var nz = this.z.redMul(h);\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.dblp = function dblp(pow) {\n if (pow === 0) return this;\n if (this.isInfinity()) return this;\n if (!pow) return this.dbl();\n\n if (this.curve.zeroA || this.curve.threeA) {\n var r = this;\n\n for (var i = 0; i < pow; i++) {\n r = r.dbl();\n }\n\n return r;\n } // 1M + 2S + 1A + N * (4S + 5M + 8A)\n // N = 1 => 6M + 6S + 9A\n\n\n var a = this.curve.a;\n var tinv = this.curve.tinv;\n var jx = this.x;\n var jy = this.y;\n var jz = this.z;\n var jz4 = jz.redSqr().redSqr(); // Reuse results\n\n var jyd = jy.redAdd(jy);\n\n for (var i = 0; i < pow; i++) {\n var jx2 = jx.redSqr();\n var jyd2 = jyd.redSqr();\n var jyd4 = jyd2.redSqr();\n var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));\n var t1 = jx.redMul(jyd2);\n var nx = c.redSqr().redISub(t1.redAdd(t1));\n var t2 = t1.redISub(nx);\n var dny = c.redMul(t2);\n dny = dny.redIAdd(dny).redISub(jyd4);\n var nz = jyd.redMul(jz);\n if (i + 1 < pow) jz4 = jz4.redMul(jyd4);\n jx = nx;\n jz = nz;\n jyd = dny;\n }\n\n return this.curve.jpoint(jx, jyd.redMul(tinv), jz);\n};\n\nJPoint.prototype.dbl = function dbl() {\n if (this.isInfinity()) return this;\n if (this.curve.zeroA) return this._zeroDbl();else if (this.curve.threeA) return this._threeDbl();else return this._dbl();\n};\n\nJPoint.prototype._zeroDbl = function _zeroDbl() {\n var nx;\n var ny;\n var nz; // Z = 1\n\n if (this.zOne) {\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html\n // #doubling-mdbl-2007-bl\n // 1M + 5S + 14A\n // XX = X1^2\n var xx = this.x.redSqr(); // YY = Y1^2\n\n var yy = this.y.redSqr(); // YYYY = YY^2\n\n var yyyy = yy.redSqr(); // S = 2 * ((X1 + YY)^2 - XX - YYYY)\n\n var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n s = s.redIAdd(s); // M = 3 * XX + a; a = 0\n\n var m = xx.redAdd(xx).redIAdd(xx); // T = M ^ 2 - 2*S\n\n var t = m.redSqr().redISub(s).redISub(s); // 8 * YYYY\n\n var yyyy8 = yyyy.redIAdd(yyyy);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n yyyy8 = yyyy8.redIAdd(yyyy8); // X3 = T\n\n nx = t; // Y3 = M * (S - T) - 8 * YYYY\n\n ny = m.redMul(s.redISub(t)).redISub(yyyy8); // Z3 = 2*Y1\n\n nz = this.y.redAdd(this.y);\n } else {\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html\n // #doubling-dbl-2009-l\n // 2M + 5S + 13A\n // A = X1^2\n var a = this.x.redSqr(); // B = Y1^2\n\n var b = this.y.redSqr(); // C = B^2\n\n var c = b.redSqr(); // D = 2 * ((X1 + B)^2 - A - C)\n\n var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c);\n d = d.redIAdd(d); // E = 3 * A\n\n var e = a.redAdd(a).redIAdd(a); // F = E^2\n\n var f = e.redSqr(); // 8 * C\n\n var c8 = c.redIAdd(c);\n c8 = c8.redIAdd(c8);\n c8 = c8.redIAdd(c8); // X3 = F - 2 * D\n\n nx = f.redISub(d).redISub(d); // Y3 = E * (D - X3) - 8 * C\n\n ny = e.redMul(d.redISub(nx)).redISub(c8); // Z3 = 2 * Y1 * Z1\n\n nz = this.y.redMul(this.z);\n nz = nz.redIAdd(nz);\n }\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype._threeDbl = function _threeDbl() {\n var nx;\n var ny;\n var nz; // Z = 1\n\n if (this.zOne) {\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html\n // #doubling-mdbl-2007-bl\n // 1M + 5S + 15A\n // XX = X1^2\n var xx = this.x.redSqr(); // YY = Y1^2\n\n var yy = this.y.redSqr(); // YYYY = YY^2\n\n var yyyy = yy.redSqr(); // S = 2 * ((X1 + YY)^2 - XX - YYYY)\n\n var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n s = s.redIAdd(s); // M = 3 * XX + a\n\n var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a); // T = M^2 - 2 * S\n\n var t = m.redSqr().redISub(s).redISub(s); // X3 = T\n\n nx = t; // Y3 = M * (S - T) - 8 * YYYY\n\n var yyyy8 = yyyy.redIAdd(yyyy);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n ny = m.redMul(s.redISub(t)).redISub(yyyy8); // Z3 = 2 * Y1\n\n nz = this.y.redAdd(this.y);\n } else {\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b\n // 3M + 5S\n // delta = Z1^2\n var delta = this.z.redSqr(); // gamma = Y1^2\n\n var gamma = this.y.redSqr(); // beta = X1 * gamma\n\n var beta = this.x.redMul(gamma); // alpha = 3 * (X1 - delta) * (X1 + delta)\n\n var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta));\n alpha = alpha.redAdd(alpha).redIAdd(alpha); // X3 = alpha^2 - 8 * beta\n\n var beta4 = beta.redIAdd(beta);\n beta4 = beta4.redIAdd(beta4);\n var beta8 = beta4.redAdd(beta4);\n nx = alpha.redSqr().redISub(beta8); // Z3 = (Y1 + Z1)^2 - gamma - delta\n\n nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta); // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2\n\n var ggamma8 = gamma.redSqr();\n ggamma8 = ggamma8.redIAdd(ggamma8);\n ggamma8 = ggamma8.redIAdd(ggamma8);\n ggamma8 = ggamma8.redIAdd(ggamma8);\n ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8);\n }\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype._dbl = function _dbl() {\n var a = this.curve.a; // 4M + 6S + 10A\n\n var jx = this.x;\n var jy = this.y;\n var jz = this.z;\n var jz4 = jz.redSqr().redSqr();\n var jx2 = jx.redSqr();\n var jy2 = jy.redSqr();\n var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));\n var jxd4 = jx.redAdd(jx);\n jxd4 = jxd4.redIAdd(jxd4);\n var t1 = jxd4.redMul(jy2);\n var nx = c.redSqr().redISub(t1.redAdd(t1));\n var t2 = t1.redISub(nx);\n var jyd8 = jy2.redSqr();\n jyd8 = jyd8.redIAdd(jyd8);\n jyd8 = jyd8.redIAdd(jyd8);\n jyd8 = jyd8.redIAdd(jyd8);\n var ny = c.redMul(t2).redISub(jyd8);\n var nz = jy.redAdd(jy).redMul(jz);\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.trpl = function trpl() {\n if (!this.curve.zeroA) return this.dbl().add(this); // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl\n // 5M + 10S + ...\n // XX = X1^2\n\n var xx = this.x.redSqr(); // YY = Y1^2\n\n var yy = this.y.redSqr(); // ZZ = Z1^2\n\n var zz = this.z.redSqr(); // YYYY = YY^2\n\n var yyyy = yy.redSqr(); // M = 3 * XX + a * ZZ2; a = 0\n\n var m = xx.redAdd(xx).redIAdd(xx); // MM = M^2\n\n var mm = m.redSqr(); // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM\n\n var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n e = e.redIAdd(e);\n e = e.redAdd(e).redIAdd(e);\n e = e.redISub(mm); // EE = E^2\n\n var ee = e.redSqr(); // T = 16*YYYY\n\n var t = yyyy.redIAdd(yyyy);\n t = t.redIAdd(t);\n t = t.redIAdd(t);\n t = t.redIAdd(t); // U = (M + E)^2 - MM - EE - T\n\n var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t); // X3 = 4 * (X1 * EE - 4 * YY * U)\n\n var yyu4 = yy.redMul(u);\n yyu4 = yyu4.redIAdd(yyu4);\n yyu4 = yyu4.redIAdd(yyu4);\n var nx = this.x.redMul(ee).redISub(yyu4);\n nx = nx.redIAdd(nx);\n nx = nx.redIAdd(nx); // Y3 = 8 * Y1 * (U * (T - U) - E * EE)\n\n var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee)));\n ny = ny.redIAdd(ny);\n ny = ny.redIAdd(ny);\n ny = ny.redIAdd(ny); // Z3 = (Z1 + E)^2 - ZZ - EE\n\n var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee);\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.mul = function mul(k, kbase) {\n k = new BN(k, kbase);\n return this.curve._wnafMul(this, k);\n};\n\nJPoint.prototype.eq = function eq(p) {\n if (p.type === 'affine') return this.eq(p.toJ());\n if (this === p) return true; // x1 * z2^2 == x2 * z1^2\n\n var z2 = this.z.redSqr();\n var pz2 = p.z.redSqr();\n if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0) return false; // y1 * z2^3 == y2 * z1^3\n\n var z3 = z2.redMul(this.z);\n var pz3 = pz2.redMul(p.z);\n return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0;\n};\n\nJPoint.prototype.eqXToP = function eqXToP(x) {\n var zs = this.z.redSqr();\n var rx = x.toRed(this.curve.red).redMul(zs);\n if (this.x.cmp(rx) === 0) return true;\n var xc = x.clone();\n var t = this.curve.redN.redMul(zs);\n\n for (;;) {\n xc.iadd(this.curve.n);\n if (xc.cmp(this.curve.p) >= 0) return false;\n rx.redIAdd(t);\n if (this.x.cmp(rx) === 0) return true;\n }\n};\n\nJPoint.prototype.inspect = function inspect() {\n if (this.isInfinity()) return '';\n return '';\n};\n\nJPoint.prototype.isInfinity = function isInfinity() {\n // XXX This code assumes that zero is always zero in red\n return this.z.cmpn(0) === 0;\n};","import { fromUtf8 as jsFromUtf8, toUtf8 as jsToUtf8 } from \"./pureJs\";\nimport { fromUtf8 as textEncoderFromUtf8, toUtf8 as textEncoderToUtf8 } from \"./whatwgEncodingApi\";\nexport var fromUtf8 = function fromUtf8(input) {\n return typeof TextEncoder === \"function\" ? textEncoderFromUtf8(input) : jsFromUtf8(input);\n};\nexport var toUtf8 = function toUtf8(input) {\n return typeof TextDecoder === \"function\" ? textEncoderToUtf8(input) : jsToUtf8(input);\n};","export function fromUtf8(input) {\n return new TextEncoder().encode(input);\n}\nexport function toUtf8(input) {\n return new TextDecoder(\"utf-8\").decode(input);\n}","export var fromUtf8 = function fromUtf8(input) {\n var bytes = [];\n\n for (var i = 0, len = input.length; i < len; i++) {\n var value = input.charCodeAt(i);\n\n if (value < 0x80) {\n bytes.push(value);\n } else if (value < 0x800) {\n bytes.push(value >> 6 | 192, value & 63 | 128);\n } else if (i + 1 < input.length && (value & 0xfc00) === 0xd800 && (input.charCodeAt(i + 1) & 0xfc00) === 0xdc00) {\n var surrogatePair = 0x10000 + ((value & 1023) << 10) + (input.charCodeAt(++i) & 1023);\n bytes.push(surrogatePair >> 18 | 240, surrogatePair >> 12 & 63 | 128, surrogatePair >> 6 & 63 | 128, surrogatePair & 63 | 128);\n } else {\n bytes.push(value >> 12 | 224, value >> 6 & 63 | 128, value & 63 | 128);\n }\n }\n\n return Uint8Array.from(bytes);\n};\nexport var toUtf8 = function toUtf8(input) {\n var decoded = \"\";\n\n for (var i = 0, len = input.length; i < len; i++) {\n var byte = input[i];\n\n if (byte < 0x80) {\n decoded += String.fromCharCode(byte);\n } else if (192 <= byte && byte < 224) {\n var nextByte = input[++i];\n decoded += String.fromCharCode((byte & 31) << 6 | nextByte & 63);\n } else if (240 <= byte && byte < 365) {\n var surrogatePair = [byte, input[++i], input[++i], input[++i]];\n var encoded = \"%\" + surrogatePair.map(function (byteValue) {\n return byteValue.toString(16);\n }).join(\"%\");\n decoded += decodeURIComponent(encoded);\n } else {\n decoded += String.fromCharCode((byte & 15) << 12 | (input[++i] & 63) << 6 | input[++i] & 63);\n }\n }\n\n return decoded;\n};","'use strict';\n\nvar elliptic = exports;\nelliptic.version = require('../package.json').version;\nelliptic.utils = require('./elliptic/utils');\nelliptic.rand = require('brorand');\nelliptic.curve = require('./elliptic/curve');\nelliptic.curves = require('./elliptic/curves'); // Protocols\n\nelliptic.ec = require('./elliptic/ec');\nelliptic.eddsa = require('./elliptic/eddsa');","(function (module, exports) {\n 'use strict'; // Utils\n\n function assert(val, msg) {\n if (!val) throw new Error(msg || 'Assertion failed');\n } // Could use `inherits` module, but don't want to move from single file\n // architecture yet.\n\n\n function inherits(ctor, superCtor) {\n ctor.super_ = superCtor;\n\n var TempCtor = function TempCtor() {};\n\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n } // BN\n\n\n function BN(number, base, endian) {\n if (BN.isBN(number)) {\n return number;\n }\n\n this.negative = 0;\n this.words = null;\n this.length = 0; // Reduction context\n\n this.red = null;\n\n if (number !== null) {\n if (base === 'le' || base === 'be') {\n endian = base;\n base = 10;\n }\n\n this._init(number || 0, base || 10, endian || 'be');\n }\n }\n\n if (typeof module === 'object') {\n module.exports = BN;\n } else {\n exports.BN = BN;\n }\n\n BN.BN = BN;\n BN.wordSize = 26;\n var Buffer;\n\n try {\n Buffer = require('buffer').Buffer;\n } catch (e) {}\n\n BN.isBN = function isBN(num) {\n if (num instanceof BN) {\n return true;\n }\n\n return num !== null && typeof num === 'object' && num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);\n };\n\n BN.max = function max(left, right) {\n if (left.cmp(right) > 0) return left;\n return right;\n };\n\n BN.min = function min(left, right) {\n if (left.cmp(right) < 0) return left;\n return right;\n };\n\n BN.prototype._init = function init(number, base, endian) {\n if (typeof number === 'number') {\n return this._initNumber(number, base, endian);\n }\n\n if (typeof number === 'object') {\n return this._initArray(number, base, endian);\n }\n\n if (base === 'hex') {\n base = 16;\n }\n\n assert(base === (base | 0) && base >= 2 && base <= 36);\n number = number.toString().replace(/\\s+/g, '');\n var start = 0;\n\n if (number[0] === '-') {\n start++;\n }\n\n if (base === 16) {\n this._parseHex(number, start);\n } else {\n this._parseBase(number, base, start);\n }\n\n if (number[0] === '-') {\n this.negative = 1;\n }\n\n this.strip();\n if (endian !== 'le') return;\n\n this._initArray(this.toArray(), base, endian);\n };\n\n BN.prototype._initNumber = function _initNumber(number, base, endian) {\n if (number < 0) {\n this.negative = 1;\n number = -number;\n }\n\n if (number < 0x4000000) {\n this.words = [number & 0x3ffffff];\n this.length = 1;\n } else if (number < 0x10000000000000) {\n this.words = [number & 0x3ffffff, number / 0x4000000 & 0x3ffffff];\n this.length = 2;\n } else {\n assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)\n\n this.words = [number & 0x3ffffff, number / 0x4000000 & 0x3ffffff, 1];\n this.length = 3;\n }\n\n if (endian !== 'le') return; // Reverse the bytes\n\n this._initArray(this.toArray(), base, endian);\n };\n\n BN.prototype._initArray = function _initArray(number, base, endian) {\n // Perhaps a Uint8Array\n assert(typeof number.length === 'number');\n\n if (number.length <= 0) {\n this.words = [0];\n this.length = 1;\n return this;\n }\n\n this.length = Math.ceil(number.length / 3);\n this.words = new Array(this.length);\n\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n var j, w;\n var off = 0;\n\n if (endian === 'be') {\n for (i = number.length - 1, j = 0; i >= 0; i -= 3) {\n w = number[i] | number[i - 1] << 8 | number[i - 2] << 16;\n this.words[j] |= w << off & 0x3ffffff;\n this.words[j + 1] = w >>> 26 - off & 0x3ffffff;\n off += 24;\n\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n } else if (endian === 'le') {\n for (i = 0, j = 0; i < number.length; i += 3) {\n w = number[i] | number[i + 1] << 8 | number[i + 2] << 16;\n this.words[j] |= w << off & 0x3ffffff;\n this.words[j + 1] = w >>> 26 - off & 0x3ffffff;\n off += 24;\n\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n }\n\n return this.strip();\n };\n\n function parseHex(str, start, end) {\n var r = 0;\n var len = Math.min(str.length, end);\n\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n r <<= 4; // 'a' - 'f'\n\n if (c >= 49 && c <= 54) {\n r |= c - 49 + 0xa; // 'A' - 'F'\n } else if (c >= 17 && c <= 22) {\n r |= c - 17 + 0xa; // '0' - '9'\n } else {\n r |= c & 0xf;\n }\n }\n\n return r;\n }\n\n BN.prototype._parseHex = function _parseHex(number, start) {\n // Create possibly bigger array to ensure that it fits the number\n this.length = Math.ceil((number.length - start) / 6);\n this.words = new Array(this.length);\n\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n var j, w; // Scan 24-bit chunks and add them to the number\n\n var off = 0;\n\n for (i = number.length - 6, j = 0; i >= start; i -= 6) {\n w = parseHex(number, i, i + 6);\n this.words[j] |= w << off & 0x3ffffff; // NOTE: `0x3fffff` is intentional here, 26bits max shift + 24bit hex limb\n\n this.words[j + 1] |= w >>> 26 - off & 0x3fffff;\n off += 24;\n\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n\n if (i + 6 !== start) {\n w = parseHex(number, start, i + 6);\n this.words[j] |= w << off & 0x3ffffff;\n this.words[j + 1] |= w >>> 26 - off & 0x3fffff;\n }\n\n this.strip();\n };\n\n function parseBase(str, start, end, mul) {\n var r = 0;\n var len = Math.min(str.length, end);\n\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n r *= mul; // 'a'\n\n if (c >= 49) {\n r += c - 49 + 0xa; // 'A'\n } else if (c >= 17) {\n r += c - 17 + 0xa; // '0' - '9'\n } else {\n r += c;\n }\n }\n\n return r;\n }\n\n BN.prototype._parseBase = function _parseBase(number, base, start) {\n // Initialize as zero\n this.words = [0];\n this.length = 1; // Find length of limb in base\n\n for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {\n limbLen++;\n }\n\n limbLen--;\n limbPow = limbPow / base | 0;\n var total = number.length - start;\n var mod = total % limbLen;\n var end = Math.min(total, total - mod) + start;\n var word = 0;\n\n for (var i = start; i < end; i += limbLen) {\n word = parseBase(number, i, i + limbLen, base);\n this.imuln(limbPow);\n\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n if (mod !== 0) {\n var pow = 1;\n word = parseBase(number, i, number.length, base);\n\n for (i = 0; i < mod; i++) {\n pow *= base;\n }\n\n this.imuln(pow);\n\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n };\n\n BN.prototype.copy = function copy(dest) {\n dest.words = new Array(this.length);\n\n for (var i = 0; i < this.length; i++) {\n dest.words[i] = this.words[i];\n }\n\n dest.length = this.length;\n dest.negative = this.negative;\n dest.red = this.red;\n };\n\n BN.prototype.clone = function clone() {\n var r = new BN(null);\n this.copy(r);\n return r;\n };\n\n BN.prototype._expand = function _expand(size) {\n while (this.length < size) {\n this.words[this.length++] = 0;\n }\n\n return this;\n }; // Remove leading `0` from `this`\n\n\n BN.prototype.strip = function strip() {\n while (this.length > 1 && this.words[this.length - 1] === 0) {\n this.length--;\n }\n\n return this._normSign();\n };\n\n BN.prototype._normSign = function _normSign() {\n // -0 = 0\n if (this.length === 1 && this.words[0] === 0) {\n this.negative = 0;\n }\n\n return this;\n };\n\n BN.prototype.inspect = function inspect() {\n return (this.red ? '';\n };\n /*\n var zeros = [];\n var groupSizes = [];\n var groupBases = [];\n var s = '';\n var i = -1;\n while (++i < BN.wordSize) {\n zeros[i] = s;\n s += '0';\n }\n groupSizes[0] = 0;\n groupSizes[1] = 0;\n groupBases[0] = 0;\n groupBases[1] = 0;\n var base = 2 - 1;\n while (++base < 36 + 1) {\n var groupSize = 0;\n var groupBase = 1;\n while (groupBase < (1 << BN.wordSize) / base) {\n groupBase *= base;\n groupSize += 1;\n }\n groupSizes[base] = groupSize;\n groupBases[base] = groupBase;\n }\n */\n\n\n var zeros = ['', '0', '00', '000', '0000', '00000', '000000', '0000000', '00000000', '000000000', '0000000000', '00000000000', '000000000000', '0000000000000', '00000000000000', '000000000000000', '0000000000000000', '00000000000000000', '000000000000000000', '0000000000000000000', '00000000000000000000', '000000000000000000000', '0000000000000000000000', '00000000000000000000000', '000000000000000000000000', '0000000000000000000000000'];\n var groupSizes = [0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5];\n var groupBases = [0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176];\n\n BN.prototype.toString = function toString(base, padding) {\n base = base || 10;\n padding = padding | 0 || 1;\n var out;\n\n if (base === 16 || base === 'hex') {\n out = '';\n var off = 0;\n var carry = 0;\n\n for (var i = 0; i < this.length; i++) {\n var w = this.words[i];\n var word = ((w << off | carry) & 0xffffff).toString(16);\n carry = w >>> 24 - off & 0xffffff;\n\n if (carry !== 0 || i !== this.length - 1) {\n out = zeros[6 - word.length] + word + out;\n } else {\n out = word + out;\n }\n\n off += 2;\n\n if (off >= 26) {\n off -= 26;\n i--;\n }\n }\n\n if (carry !== 0) {\n out = carry.toString(16) + out;\n }\n\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n\n if (this.negative !== 0) {\n out = '-' + out;\n }\n\n return out;\n }\n\n if (base === (base | 0) && base >= 2 && base <= 36) {\n // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));\n var groupSize = groupSizes[base]; // var groupBase = Math.pow(base, groupSize);\n\n var groupBase = groupBases[base];\n out = '';\n var c = this.clone();\n c.negative = 0;\n\n while (!c.isZero()) {\n var r = c.modn(groupBase).toString(base);\n c = c.idivn(groupBase);\n\n if (!c.isZero()) {\n out = zeros[groupSize - r.length] + r + out;\n } else {\n out = r + out;\n }\n }\n\n if (this.isZero()) {\n out = '0' + out;\n }\n\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n\n if (this.negative !== 0) {\n out = '-' + out;\n }\n\n return out;\n }\n\n assert(false, 'Base should be between 2 and 36');\n };\n\n BN.prototype.toNumber = function toNumber() {\n var ret = this.words[0];\n\n if (this.length === 2) {\n ret += this.words[1] * 0x4000000;\n } else if (this.length === 3 && this.words[2] === 0x01) {\n // NOTE: at this stage it is known that the top bit is set\n ret += 0x10000000000000 + this.words[1] * 0x4000000;\n } else if (this.length > 2) {\n assert(false, 'Number can only safely store up to 53 bits');\n }\n\n return this.negative !== 0 ? -ret : ret;\n };\n\n BN.prototype.toJSON = function toJSON() {\n return this.toString(16);\n };\n\n BN.prototype.toBuffer = function toBuffer(endian, length) {\n assert(typeof Buffer !== 'undefined');\n return this.toArrayLike(Buffer, endian, length);\n };\n\n BN.prototype.toArray = function toArray(endian, length) {\n return this.toArrayLike(Array, endian, length);\n };\n\n BN.prototype.toArrayLike = function toArrayLike(ArrayType, endian, length) {\n var byteLength = this.byteLength();\n var reqLength = length || Math.max(1, byteLength);\n assert(byteLength <= reqLength, 'byte array longer than desired length');\n assert(reqLength > 0, 'Requested array length <= 0');\n this.strip();\n var littleEndian = endian === 'le';\n var res = new ArrayType(reqLength);\n var b, i;\n var q = this.clone();\n\n if (!littleEndian) {\n // Assume big-endian\n for (i = 0; i < reqLength - byteLength; i++) {\n res[i] = 0;\n }\n\n for (i = 0; !q.isZero(); i++) {\n b = q.andln(0xff);\n q.iushrn(8);\n res[reqLength - i - 1] = b;\n }\n } else {\n for (i = 0; !q.isZero(); i++) {\n b = q.andln(0xff);\n q.iushrn(8);\n res[i] = b;\n }\n\n for (; i < reqLength; i++) {\n res[i] = 0;\n }\n }\n\n return res;\n };\n\n if (Math.clz32) {\n BN.prototype._countBits = function _countBits(w) {\n return 32 - Math.clz32(w);\n };\n } else {\n BN.prototype._countBits = function _countBits(w) {\n var t = w;\n var r = 0;\n\n if (t >= 0x1000) {\n r += 13;\n t >>>= 13;\n }\n\n if (t >= 0x40) {\n r += 7;\n t >>>= 7;\n }\n\n if (t >= 0x8) {\n r += 4;\n t >>>= 4;\n }\n\n if (t >= 0x02) {\n r += 2;\n t >>>= 2;\n }\n\n return r + t;\n };\n }\n\n BN.prototype._zeroBits = function _zeroBits(w) {\n // Short-cut\n if (w === 0) return 26;\n var t = w;\n var r = 0;\n\n if ((t & 0x1fff) === 0) {\n r += 13;\n t >>>= 13;\n }\n\n if ((t & 0x7f) === 0) {\n r += 7;\n t >>>= 7;\n }\n\n if ((t & 0xf) === 0) {\n r += 4;\n t >>>= 4;\n }\n\n if ((t & 0x3) === 0) {\n r += 2;\n t >>>= 2;\n }\n\n if ((t & 0x1) === 0) {\n r++;\n }\n\n return r;\n }; // Return number of used bits in a BN\n\n\n BN.prototype.bitLength = function bitLength() {\n var w = this.words[this.length - 1];\n\n var hi = this._countBits(w);\n\n return (this.length - 1) * 26 + hi;\n };\n\n function toBitArray(num) {\n var w = new Array(num.bitLength());\n\n for (var bit = 0; bit < w.length; bit++) {\n var off = bit / 26 | 0;\n var wbit = bit % 26;\n w[bit] = (num.words[off] & 1 << wbit) >>> wbit;\n }\n\n return w;\n } // Number of trailing zero bits\n\n\n BN.prototype.zeroBits = function zeroBits() {\n if (this.isZero()) return 0;\n var r = 0;\n\n for (var i = 0; i < this.length; i++) {\n var b = this._zeroBits(this.words[i]);\n\n r += b;\n if (b !== 26) break;\n }\n\n return r;\n };\n\n BN.prototype.byteLength = function byteLength() {\n return Math.ceil(this.bitLength() / 8);\n };\n\n BN.prototype.toTwos = function toTwos(width) {\n if (this.negative !== 0) {\n return this.abs().inotn(width).iaddn(1);\n }\n\n return this.clone();\n };\n\n BN.prototype.fromTwos = function fromTwos(width) {\n if (this.testn(width - 1)) {\n return this.notn(width).iaddn(1).ineg();\n }\n\n return this.clone();\n };\n\n BN.prototype.isNeg = function isNeg() {\n return this.negative !== 0;\n }; // Return negative clone of `this`\n\n\n BN.prototype.neg = function neg() {\n return this.clone().ineg();\n };\n\n BN.prototype.ineg = function ineg() {\n if (!this.isZero()) {\n this.negative ^= 1;\n }\n\n return this;\n }; // Or `num` with `this` in-place\n\n\n BN.prototype.iuor = function iuor(num) {\n while (this.length < num.length) {\n this.words[this.length++] = 0;\n }\n\n for (var i = 0; i < num.length; i++) {\n this.words[i] = this.words[i] | num.words[i];\n }\n\n return this.strip();\n };\n\n BN.prototype.ior = function ior(num) {\n assert((this.negative | num.negative) === 0);\n return this.iuor(num);\n }; // Or `num` with `this`\n\n\n BN.prototype.or = function or(num) {\n if (this.length > num.length) return this.clone().ior(num);\n return num.clone().ior(this);\n };\n\n BN.prototype.uor = function uor(num) {\n if (this.length > num.length) return this.clone().iuor(num);\n return num.clone().iuor(this);\n }; // And `num` with `this` in-place\n\n\n BN.prototype.iuand = function iuand(num) {\n // b = min-length(num, this)\n var b;\n\n if (this.length > num.length) {\n b = num;\n } else {\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = this.words[i] & num.words[i];\n }\n\n this.length = b.length;\n return this.strip();\n };\n\n BN.prototype.iand = function iand(num) {\n assert((this.negative | num.negative) === 0);\n return this.iuand(num);\n }; // And `num` with `this`\n\n\n BN.prototype.and = function and(num) {\n if (this.length > num.length) return this.clone().iand(num);\n return num.clone().iand(this);\n };\n\n BN.prototype.uand = function uand(num) {\n if (this.length > num.length) return this.clone().iuand(num);\n return num.clone().iuand(this);\n }; // Xor `num` with `this` in-place\n\n\n BN.prototype.iuxor = function iuxor(num) {\n // a.length > b.length\n var a;\n var b;\n\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = a.words[i] ^ b.words[i];\n }\n\n if (this !== a) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = a.length;\n return this.strip();\n };\n\n BN.prototype.ixor = function ixor(num) {\n assert((this.negative | num.negative) === 0);\n return this.iuxor(num);\n }; // Xor `num` with `this`\n\n\n BN.prototype.xor = function xor(num) {\n if (this.length > num.length) return this.clone().ixor(num);\n return num.clone().ixor(this);\n };\n\n BN.prototype.uxor = function uxor(num) {\n if (this.length > num.length) return this.clone().iuxor(num);\n return num.clone().iuxor(this);\n }; // Not ``this`` with ``width`` bitwidth\n\n\n BN.prototype.inotn = function inotn(width) {\n assert(typeof width === 'number' && width >= 0);\n var bytesNeeded = Math.ceil(width / 26) | 0;\n var bitsLeft = width % 26; // Extend the buffer with leading zeroes\n\n this._expand(bytesNeeded);\n\n if (bitsLeft > 0) {\n bytesNeeded--;\n } // Handle complete words\n\n\n for (var i = 0; i < bytesNeeded; i++) {\n this.words[i] = ~this.words[i] & 0x3ffffff;\n } // Handle the residue\n\n\n if (bitsLeft > 0) {\n this.words[i] = ~this.words[i] & 0x3ffffff >> 26 - bitsLeft;\n } // And remove leading zeroes\n\n\n return this.strip();\n };\n\n BN.prototype.notn = function notn(width) {\n return this.clone().inotn(width);\n }; // Set `bit` of `this`\n\n\n BN.prototype.setn = function setn(bit, val) {\n assert(typeof bit === 'number' && bit >= 0);\n var off = bit / 26 | 0;\n var wbit = bit % 26;\n\n this._expand(off + 1);\n\n if (val) {\n this.words[off] = this.words[off] | 1 << wbit;\n } else {\n this.words[off] = this.words[off] & ~(1 << wbit);\n }\n\n return this.strip();\n }; // Add `num` to `this` in-place\n\n\n BN.prototype.iadd = function iadd(num) {\n var r; // negative + positive\n\n if (this.negative !== 0 && num.negative === 0) {\n this.negative = 0;\n r = this.isub(num);\n this.negative ^= 1;\n return this._normSign(); // positive + negative\n } else if (this.negative === 0 && num.negative !== 0) {\n num.negative = 0;\n r = this.isub(num);\n num.negative = 1;\n return r._normSign();\n } // a.length > b.length\n\n\n var a, b;\n\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) + (b.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n\n this.length = a.length;\n\n if (carry !== 0) {\n this.words[this.length] = carry;\n this.length++; // Copy the rest of the words\n } else if (a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n return this;\n }; // Add `num` to `this`\n\n\n BN.prototype.add = function add(num) {\n var res;\n\n if (num.negative !== 0 && this.negative === 0) {\n num.negative = 0;\n res = this.sub(num);\n num.negative ^= 1;\n return res;\n } else if (num.negative === 0 && this.negative !== 0) {\n this.negative = 0;\n res = num.sub(this);\n this.negative = 1;\n return res;\n }\n\n if (this.length > num.length) return this.clone().iadd(num);\n return num.clone().iadd(this);\n }; // Subtract `num` from `this` in-place\n\n\n BN.prototype.isub = function isub(num) {\n // this - (-num) = this + num\n if (num.negative !== 0) {\n num.negative = 0;\n var r = this.iadd(num);\n num.negative = 1;\n return r._normSign(); // -this - num = -(this + num)\n } else if (this.negative !== 0) {\n this.negative = 0;\n this.iadd(num);\n this.negative = 1;\n return this._normSign();\n } // At this point both numbers are positive\n\n\n var cmp = this.cmp(num); // Optimization - zeroify\n\n if (cmp === 0) {\n this.negative = 0;\n this.length = 1;\n this.words[0] = 0;\n return this;\n } // a > b\n\n\n var a, b;\n\n if (cmp > 0) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) - (b.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n } // Copy rest of the words\n\n\n if (carry === 0 && i < a.length && a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = Math.max(this.length, i);\n\n if (a !== this) {\n this.negative = 1;\n }\n\n return this.strip();\n }; // Subtract `num` from `this`\n\n\n BN.prototype.sub = function sub(num) {\n return this.clone().isub(num);\n };\n\n function smallMulTo(self, num, out) {\n out.negative = num.negative ^ self.negative;\n var len = self.length + num.length | 0;\n out.length = len;\n len = len - 1 | 0; // Peel one iteration (compiler can't do it, because of code complexity)\n\n var a = self.words[0] | 0;\n var b = num.words[0] | 0;\n var r = a * b;\n var lo = r & 0x3ffffff;\n var carry = r / 0x4000000 | 0;\n out.words[0] = lo;\n\n for (var k = 1; k < len; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = carry >>> 26;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = k - j | 0;\n a = self.words[i] | 0;\n b = num.words[j] | 0;\n r = a * b + rword;\n ncarry += r / 0x4000000 | 0;\n rword = r & 0x3ffffff;\n }\n\n out.words[k] = rword | 0;\n carry = ncarry | 0;\n }\n\n if (carry !== 0) {\n out.words[k] = carry | 0;\n } else {\n out.length--;\n }\n\n return out.strip();\n } // TODO(indutny): it may be reasonable to omit it for users who don't need\n // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit\n // multiplication (like elliptic secp256k1).\n\n\n var comb10MulTo = function comb10MulTo(self, num, out) {\n var a = self.words;\n var b = num.words;\n var o = out.words;\n var c = 0;\n var lo;\n var mid;\n var hi;\n var a0 = a[0] | 0;\n var al0 = a0 & 0x1fff;\n var ah0 = a0 >>> 13;\n var a1 = a[1] | 0;\n var al1 = a1 & 0x1fff;\n var ah1 = a1 >>> 13;\n var a2 = a[2] | 0;\n var al2 = a2 & 0x1fff;\n var ah2 = a2 >>> 13;\n var a3 = a[3] | 0;\n var al3 = a3 & 0x1fff;\n var ah3 = a3 >>> 13;\n var a4 = a[4] | 0;\n var al4 = a4 & 0x1fff;\n var ah4 = a4 >>> 13;\n var a5 = a[5] | 0;\n var al5 = a5 & 0x1fff;\n var ah5 = a5 >>> 13;\n var a6 = a[6] | 0;\n var al6 = a6 & 0x1fff;\n var ah6 = a6 >>> 13;\n var a7 = a[7] | 0;\n var al7 = a7 & 0x1fff;\n var ah7 = a7 >>> 13;\n var a8 = a[8] | 0;\n var al8 = a8 & 0x1fff;\n var ah8 = a8 >>> 13;\n var a9 = a[9] | 0;\n var al9 = a9 & 0x1fff;\n var ah9 = a9 >>> 13;\n var b0 = b[0] | 0;\n var bl0 = b0 & 0x1fff;\n var bh0 = b0 >>> 13;\n var b1 = b[1] | 0;\n var bl1 = b1 & 0x1fff;\n var bh1 = b1 >>> 13;\n var b2 = b[2] | 0;\n var bl2 = b2 & 0x1fff;\n var bh2 = b2 >>> 13;\n var b3 = b[3] | 0;\n var bl3 = b3 & 0x1fff;\n var bh3 = b3 >>> 13;\n var b4 = b[4] | 0;\n var bl4 = b4 & 0x1fff;\n var bh4 = b4 >>> 13;\n var b5 = b[5] | 0;\n var bl5 = b5 & 0x1fff;\n var bh5 = b5 >>> 13;\n var b6 = b[6] | 0;\n var bl6 = b6 & 0x1fff;\n var bh6 = b6 >>> 13;\n var b7 = b[7] | 0;\n var bl7 = b7 & 0x1fff;\n var bh7 = b7 >>> 13;\n var b8 = b[8] | 0;\n var bl8 = b8 & 0x1fff;\n var bh8 = b8 >>> 13;\n var b9 = b[9] | 0;\n var bl9 = b9 & 0x1fff;\n var bh9 = b9 >>> 13;\n out.negative = self.negative ^ num.negative;\n out.length = 19;\n /* k = 0 */\n\n lo = Math.imul(al0, bl0);\n mid = Math.imul(al0, bh0);\n mid = mid + Math.imul(ah0, bl0) | 0;\n hi = Math.imul(ah0, bh0);\n var w0 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w0 >>> 26) | 0;\n w0 &= 0x3ffffff;\n /* k = 1 */\n\n lo = Math.imul(al1, bl0);\n mid = Math.imul(al1, bh0);\n mid = mid + Math.imul(ah1, bl0) | 0;\n hi = Math.imul(ah1, bh0);\n lo = lo + Math.imul(al0, bl1) | 0;\n mid = mid + Math.imul(al0, bh1) | 0;\n mid = mid + Math.imul(ah0, bl1) | 0;\n hi = hi + Math.imul(ah0, bh1) | 0;\n var w1 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w1 >>> 26) | 0;\n w1 &= 0x3ffffff;\n /* k = 2 */\n\n lo = Math.imul(al2, bl0);\n mid = Math.imul(al2, bh0);\n mid = mid + Math.imul(ah2, bl0) | 0;\n hi = Math.imul(ah2, bh0);\n lo = lo + Math.imul(al1, bl1) | 0;\n mid = mid + Math.imul(al1, bh1) | 0;\n mid = mid + Math.imul(ah1, bl1) | 0;\n hi = hi + Math.imul(ah1, bh1) | 0;\n lo = lo + Math.imul(al0, bl2) | 0;\n mid = mid + Math.imul(al0, bh2) | 0;\n mid = mid + Math.imul(ah0, bl2) | 0;\n hi = hi + Math.imul(ah0, bh2) | 0;\n var w2 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w2 >>> 26) | 0;\n w2 &= 0x3ffffff;\n /* k = 3 */\n\n lo = Math.imul(al3, bl0);\n mid = Math.imul(al3, bh0);\n mid = mid + Math.imul(ah3, bl0) | 0;\n hi = Math.imul(ah3, bh0);\n lo = lo + Math.imul(al2, bl1) | 0;\n mid = mid + Math.imul(al2, bh1) | 0;\n mid = mid + Math.imul(ah2, bl1) | 0;\n hi = hi + Math.imul(ah2, bh1) | 0;\n lo = lo + Math.imul(al1, bl2) | 0;\n mid = mid + Math.imul(al1, bh2) | 0;\n mid = mid + Math.imul(ah1, bl2) | 0;\n hi = hi + Math.imul(ah1, bh2) | 0;\n lo = lo + Math.imul(al0, bl3) | 0;\n mid = mid + Math.imul(al0, bh3) | 0;\n mid = mid + Math.imul(ah0, bl3) | 0;\n hi = hi + Math.imul(ah0, bh3) | 0;\n var w3 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w3 >>> 26) | 0;\n w3 &= 0x3ffffff;\n /* k = 4 */\n\n lo = Math.imul(al4, bl0);\n mid = Math.imul(al4, bh0);\n mid = mid + Math.imul(ah4, bl0) | 0;\n hi = Math.imul(ah4, bh0);\n lo = lo + Math.imul(al3, bl1) | 0;\n mid = mid + Math.imul(al3, bh1) | 0;\n mid = mid + Math.imul(ah3, bl1) | 0;\n hi = hi + Math.imul(ah3, bh1) | 0;\n lo = lo + Math.imul(al2, bl2) | 0;\n mid = mid + Math.imul(al2, bh2) | 0;\n mid = mid + Math.imul(ah2, bl2) | 0;\n hi = hi + Math.imul(ah2, bh2) | 0;\n lo = lo + Math.imul(al1, bl3) | 0;\n mid = mid + Math.imul(al1, bh3) | 0;\n mid = mid + Math.imul(ah1, bl3) | 0;\n hi = hi + Math.imul(ah1, bh3) | 0;\n lo = lo + Math.imul(al0, bl4) | 0;\n mid = mid + Math.imul(al0, bh4) | 0;\n mid = mid + Math.imul(ah0, bl4) | 0;\n hi = hi + Math.imul(ah0, bh4) | 0;\n var w4 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w4 >>> 26) | 0;\n w4 &= 0x3ffffff;\n /* k = 5 */\n\n lo = Math.imul(al5, bl0);\n mid = Math.imul(al5, bh0);\n mid = mid + Math.imul(ah5, bl0) | 0;\n hi = Math.imul(ah5, bh0);\n lo = lo + Math.imul(al4, bl1) | 0;\n mid = mid + Math.imul(al4, bh1) | 0;\n mid = mid + Math.imul(ah4, bl1) | 0;\n hi = hi + Math.imul(ah4, bh1) | 0;\n lo = lo + Math.imul(al3, bl2) | 0;\n mid = mid + Math.imul(al3, bh2) | 0;\n mid = mid + Math.imul(ah3, bl2) | 0;\n hi = hi + Math.imul(ah3, bh2) | 0;\n lo = lo + Math.imul(al2, bl3) | 0;\n mid = mid + Math.imul(al2, bh3) | 0;\n mid = mid + Math.imul(ah2, bl3) | 0;\n hi = hi + Math.imul(ah2, bh3) | 0;\n lo = lo + Math.imul(al1, bl4) | 0;\n mid = mid + Math.imul(al1, bh4) | 0;\n mid = mid + Math.imul(ah1, bl4) | 0;\n hi = hi + Math.imul(ah1, bh4) | 0;\n lo = lo + Math.imul(al0, bl5) | 0;\n mid = mid + Math.imul(al0, bh5) | 0;\n mid = mid + Math.imul(ah0, bl5) | 0;\n hi = hi + Math.imul(ah0, bh5) | 0;\n var w5 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w5 >>> 26) | 0;\n w5 &= 0x3ffffff;\n /* k = 6 */\n\n lo = Math.imul(al6, bl0);\n mid = Math.imul(al6, bh0);\n mid = mid + Math.imul(ah6, bl0) | 0;\n hi = Math.imul(ah6, bh0);\n lo = lo + Math.imul(al5, bl1) | 0;\n mid = mid + Math.imul(al5, bh1) | 0;\n mid = mid + Math.imul(ah5, bl1) | 0;\n hi = hi + Math.imul(ah5, bh1) | 0;\n lo = lo + Math.imul(al4, bl2) | 0;\n mid = mid + Math.imul(al4, bh2) | 0;\n mid = mid + Math.imul(ah4, bl2) | 0;\n hi = hi + Math.imul(ah4, bh2) | 0;\n lo = lo + Math.imul(al3, bl3) | 0;\n mid = mid + Math.imul(al3, bh3) | 0;\n mid = mid + Math.imul(ah3, bl3) | 0;\n hi = hi + Math.imul(ah3, bh3) | 0;\n lo = lo + Math.imul(al2, bl4) | 0;\n mid = mid + Math.imul(al2, bh4) | 0;\n mid = mid + Math.imul(ah2, bl4) | 0;\n hi = hi + Math.imul(ah2, bh4) | 0;\n lo = lo + Math.imul(al1, bl5) | 0;\n mid = mid + Math.imul(al1, bh5) | 0;\n mid = mid + Math.imul(ah1, bl5) | 0;\n hi = hi + Math.imul(ah1, bh5) | 0;\n lo = lo + Math.imul(al0, bl6) | 0;\n mid = mid + Math.imul(al0, bh6) | 0;\n mid = mid + Math.imul(ah0, bl6) | 0;\n hi = hi + Math.imul(ah0, bh6) | 0;\n var w6 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w6 >>> 26) | 0;\n w6 &= 0x3ffffff;\n /* k = 7 */\n\n lo = Math.imul(al7, bl0);\n mid = Math.imul(al7, bh0);\n mid = mid + Math.imul(ah7, bl0) | 0;\n hi = Math.imul(ah7, bh0);\n lo = lo + Math.imul(al6, bl1) | 0;\n mid = mid + Math.imul(al6, bh1) | 0;\n mid = mid + Math.imul(ah6, bl1) | 0;\n hi = hi + Math.imul(ah6, bh1) | 0;\n lo = lo + Math.imul(al5, bl2) | 0;\n mid = mid + Math.imul(al5, bh2) | 0;\n mid = mid + Math.imul(ah5, bl2) | 0;\n hi = hi + Math.imul(ah5, bh2) | 0;\n lo = lo + Math.imul(al4, bl3) | 0;\n mid = mid + Math.imul(al4, bh3) | 0;\n mid = mid + Math.imul(ah4, bl3) | 0;\n hi = hi + Math.imul(ah4, bh3) | 0;\n lo = lo + Math.imul(al3, bl4) | 0;\n mid = mid + Math.imul(al3, bh4) | 0;\n mid = mid + Math.imul(ah3, bl4) | 0;\n hi = hi + Math.imul(ah3, bh4) | 0;\n lo = lo + Math.imul(al2, bl5) | 0;\n mid = mid + Math.imul(al2, bh5) | 0;\n mid = mid + Math.imul(ah2, bl5) | 0;\n hi = hi + Math.imul(ah2, bh5) | 0;\n lo = lo + Math.imul(al1, bl6) | 0;\n mid = mid + Math.imul(al1, bh6) | 0;\n mid = mid + Math.imul(ah1, bl6) | 0;\n hi = hi + Math.imul(ah1, bh6) | 0;\n lo = lo + Math.imul(al0, bl7) | 0;\n mid = mid + Math.imul(al0, bh7) | 0;\n mid = mid + Math.imul(ah0, bl7) | 0;\n hi = hi + Math.imul(ah0, bh7) | 0;\n var w7 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w7 >>> 26) | 0;\n w7 &= 0x3ffffff;\n /* k = 8 */\n\n lo = Math.imul(al8, bl0);\n mid = Math.imul(al8, bh0);\n mid = mid + Math.imul(ah8, bl0) | 0;\n hi = Math.imul(ah8, bh0);\n lo = lo + Math.imul(al7, bl1) | 0;\n mid = mid + Math.imul(al7, bh1) | 0;\n mid = mid + Math.imul(ah7, bl1) | 0;\n hi = hi + Math.imul(ah7, bh1) | 0;\n lo = lo + Math.imul(al6, bl2) | 0;\n mid = mid + Math.imul(al6, bh2) | 0;\n mid = mid + Math.imul(ah6, bl2) | 0;\n hi = hi + Math.imul(ah6, bh2) | 0;\n lo = lo + Math.imul(al5, bl3) | 0;\n mid = mid + Math.imul(al5, bh3) | 0;\n mid = mid + Math.imul(ah5, bl3) | 0;\n hi = hi + Math.imul(ah5, bh3) | 0;\n lo = lo + Math.imul(al4, bl4) | 0;\n mid = mid + Math.imul(al4, bh4) | 0;\n mid = mid + Math.imul(ah4, bl4) | 0;\n hi = hi + Math.imul(ah4, bh4) | 0;\n lo = lo + Math.imul(al3, bl5) | 0;\n mid = mid + Math.imul(al3, bh5) | 0;\n mid = mid + Math.imul(ah3, bl5) | 0;\n hi = hi + Math.imul(ah3, bh5) | 0;\n lo = lo + Math.imul(al2, bl6) | 0;\n mid = mid + Math.imul(al2, bh6) | 0;\n mid = mid + Math.imul(ah2, bl6) | 0;\n hi = hi + Math.imul(ah2, bh6) | 0;\n lo = lo + Math.imul(al1, bl7) | 0;\n mid = mid + Math.imul(al1, bh7) | 0;\n mid = mid + Math.imul(ah1, bl7) | 0;\n hi = hi + Math.imul(ah1, bh7) | 0;\n lo = lo + Math.imul(al0, bl8) | 0;\n mid = mid + Math.imul(al0, bh8) | 0;\n mid = mid + Math.imul(ah0, bl8) | 0;\n hi = hi + Math.imul(ah0, bh8) | 0;\n var w8 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w8 >>> 26) | 0;\n w8 &= 0x3ffffff;\n /* k = 9 */\n\n lo = Math.imul(al9, bl0);\n mid = Math.imul(al9, bh0);\n mid = mid + Math.imul(ah9, bl0) | 0;\n hi = Math.imul(ah9, bh0);\n lo = lo + Math.imul(al8, bl1) | 0;\n mid = mid + Math.imul(al8, bh1) | 0;\n mid = mid + Math.imul(ah8, bl1) | 0;\n hi = hi + Math.imul(ah8, bh1) | 0;\n lo = lo + Math.imul(al7, bl2) | 0;\n mid = mid + Math.imul(al7, bh2) | 0;\n mid = mid + Math.imul(ah7, bl2) | 0;\n hi = hi + Math.imul(ah7, bh2) | 0;\n lo = lo + Math.imul(al6, bl3) | 0;\n mid = mid + Math.imul(al6, bh3) | 0;\n mid = mid + Math.imul(ah6, bl3) | 0;\n hi = hi + Math.imul(ah6, bh3) | 0;\n lo = lo + Math.imul(al5, bl4) | 0;\n mid = mid + Math.imul(al5, bh4) | 0;\n mid = mid + Math.imul(ah5, bl4) | 0;\n hi = hi + Math.imul(ah5, bh4) | 0;\n lo = lo + Math.imul(al4, bl5) | 0;\n mid = mid + Math.imul(al4, bh5) | 0;\n mid = mid + Math.imul(ah4, bl5) | 0;\n hi = hi + Math.imul(ah4, bh5) | 0;\n lo = lo + Math.imul(al3, bl6) | 0;\n mid = mid + Math.imul(al3, bh6) | 0;\n mid = mid + Math.imul(ah3, bl6) | 0;\n hi = hi + Math.imul(ah3, bh6) | 0;\n lo = lo + Math.imul(al2, bl7) | 0;\n mid = mid + Math.imul(al2, bh7) | 0;\n mid = mid + Math.imul(ah2, bl7) | 0;\n hi = hi + Math.imul(ah2, bh7) | 0;\n lo = lo + Math.imul(al1, bl8) | 0;\n mid = mid + Math.imul(al1, bh8) | 0;\n mid = mid + Math.imul(ah1, bl8) | 0;\n hi = hi + Math.imul(ah1, bh8) | 0;\n lo = lo + Math.imul(al0, bl9) | 0;\n mid = mid + Math.imul(al0, bh9) | 0;\n mid = mid + Math.imul(ah0, bl9) | 0;\n hi = hi + Math.imul(ah0, bh9) | 0;\n var w9 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w9 >>> 26) | 0;\n w9 &= 0x3ffffff;\n /* k = 10 */\n\n lo = Math.imul(al9, bl1);\n mid = Math.imul(al9, bh1);\n mid = mid + Math.imul(ah9, bl1) | 0;\n hi = Math.imul(ah9, bh1);\n lo = lo + Math.imul(al8, bl2) | 0;\n mid = mid + Math.imul(al8, bh2) | 0;\n mid = mid + Math.imul(ah8, bl2) | 0;\n hi = hi + Math.imul(ah8, bh2) | 0;\n lo = lo + Math.imul(al7, bl3) | 0;\n mid = mid + Math.imul(al7, bh3) | 0;\n mid = mid + Math.imul(ah7, bl3) | 0;\n hi = hi + Math.imul(ah7, bh3) | 0;\n lo = lo + Math.imul(al6, bl4) | 0;\n mid = mid + Math.imul(al6, bh4) | 0;\n mid = mid + Math.imul(ah6, bl4) | 0;\n hi = hi + Math.imul(ah6, bh4) | 0;\n lo = lo + Math.imul(al5, bl5) | 0;\n mid = mid + Math.imul(al5, bh5) | 0;\n mid = mid + Math.imul(ah5, bl5) | 0;\n hi = hi + Math.imul(ah5, bh5) | 0;\n lo = lo + Math.imul(al4, bl6) | 0;\n mid = mid + Math.imul(al4, bh6) | 0;\n mid = mid + Math.imul(ah4, bl6) | 0;\n hi = hi + Math.imul(ah4, bh6) | 0;\n lo = lo + Math.imul(al3, bl7) | 0;\n mid = mid + Math.imul(al3, bh7) | 0;\n mid = mid + Math.imul(ah3, bl7) | 0;\n hi = hi + Math.imul(ah3, bh7) | 0;\n lo = lo + Math.imul(al2, bl8) | 0;\n mid = mid + Math.imul(al2, bh8) | 0;\n mid = mid + Math.imul(ah2, bl8) | 0;\n hi = hi + Math.imul(ah2, bh8) | 0;\n lo = lo + Math.imul(al1, bl9) | 0;\n mid = mid + Math.imul(al1, bh9) | 0;\n mid = mid + Math.imul(ah1, bl9) | 0;\n hi = hi + Math.imul(ah1, bh9) | 0;\n var w10 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w10 >>> 26) | 0;\n w10 &= 0x3ffffff;\n /* k = 11 */\n\n lo = Math.imul(al9, bl2);\n mid = Math.imul(al9, bh2);\n mid = mid + Math.imul(ah9, bl2) | 0;\n hi = Math.imul(ah9, bh2);\n lo = lo + Math.imul(al8, bl3) | 0;\n mid = mid + Math.imul(al8, bh3) | 0;\n mid = mid + Math.imul(ah8, bl3) | 0;\n hi = hi + Math.imul(ah8, bh3) | 0;\n lo = lo + Math.imul(al7, bl4) | 0;\n mid = mid + Math.imul(al7, bh4) | 0;\n mid = mid + Math.imul(ah7, bl4) | 0;\n hi = hi + Math.imul(ah7, bh4) | 0;\n lo = lo + Math.imul(al6, bl5) | 0;\n mid = mid + Math.imul(al6, bh5) | 0;\n mid = mid + Math.imul(ah6, bl5) | 0;\n hi = hi + Math.imul(ah6, bh5) | 0;\n lo = lo + Math.imul(al5, bl6) | 0;\n mid = mid + Math.imul(al5, bh6) | 0;\n mid = mid + Math.imul(ah5, bl6) | 0;\n hi = hi + Math.imul(ah5, bh6) | 0;\n lo = lo + Math.imul(al4, bl7) | 0;\n mid = mid + Math.imul(al4, bh7) | 0;\n mid = mid + Math.imul(ah4, bl7) | 0;\n hi = hi + Math.imul(ah4, bh7) | 0;\n lo = lo + Math.imul(al3, bl8) | 0;\n mid = mid + Math.imul(al3, bh8) | 0;\n mid = mid + Math.imul(ah3, bl8) | 0;\n hi = hi + Math.imul(ah3, bh8) | 0;\n lo = lo + Math.imul(al2, bl9) | 0;\n mid = mid + Math.imul(al2, bh9) | 0;\n mid = mid + Math.imul(ah2, bl9) | 0;\n hi = hi + Math.imul(ah2, bh9) | 0;\n var w11 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w11 >>> 26) | 0;\n w11 &= 0x3ffffff;\n /* k = 12 */\n\n lo = Math.imul(al9, bl3);\n mid = Math.imul(al9, bh3);\n mid = mid + Math.imul(ah9, bl3) | 0;\n hi = Math.imul(ah9, bh3);\n lo = lo + Math.imul(al8, bl4) | 0;\n mid = mid + Math.imul(al8, bh4) | 0;\n mid = mid + Math.imul(ah8, bl4) | 0;\n hi = hi + Math.imul(ah8, bh4) | 0;\n lo = lo + Math.imul(al7, bl5) | 0;\n mid = mid + Math.imul(al7, bh5) | 0;\n mid = mid + Math.imul(ah7, bl5) | 0;\n hi = hi + Math.imul(ah7, bh5) | 0;\n lo = lo + Math.imul(al6, bl6) | 0;\n mid = mid + Math.imul(al6, bh6) | 0;\n mid = mid + Math.imul(ah6, bl6) | 0;\n hi = hi + Math.imul(ah6, bh6) | 0;\n lo = lo + Math.imul(al5, bl7) | 0;\n mid = mid + Math.imul(al5, bh7) | 0;\n mid = mid + Math.imul(ah5, bl7) | 0;\n hi = hi + Math.imul(ah5, bh7) | 0;\n lo = lo + Math.imul(al4, bl8) | 0;\n mid = mid + Math.imul(al4, bh8) | 0;\n mid = mid + Math.imul(ah4, bl8) | 0;\n hi = hi + Math.imul(ah4, bh8) | 0;\n lo = lo + Math.imul(al3, bl9) | 0;\n mid = mid + Math.imul(al3, bh9) | 0;\n mid = mid + Math.imul(ah3, bl9) | 0;\n hi = hi + Math.imul(ah3, bh9) | 0;\n var w12 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w12 >>> 26) | 0;\n w12 &= 0x3ffffff;\n /* k = 13 */\n\n lo = Math.imul(al9, bl4);\n mid = Math.imul(al9, bh4);\n mid = mid + Math.imul(ah9, bl4) | 0;\n hi = Math.imul(ah9, bh4);\n lo = lo + Math.imul(al8, bl5) | 0;\n mid = mid + Math.imul(al8, bh5) | 0;\n mid = mid + Math.imul(ah8, bl5) | 0;\n hi = hi + Math.imul(ah8, bh5) | 0;\n lo = lo + Math.imul(al7, bl6) | 0;\n mid = mid + Math.imul(al7, bh6) | 0;\n mid = mid + Math.imul(ah7, bl6) | 0;\n hi = hi + Math.imul(ah7, bh6) | 0;\n lo = lo + Math.imul(al6, bl7) | 0;\n mid = mid + Math.imul(al6, bh7) | 0;\n mid = mid + Math.imul(ah6, bl7) | 0;\n hi = hi + Math.imul(ah6, bh7) | 0;\n lo = lo + Math.imul(al5, bl8) | 0;\n mid = mid + Math.imul(al5, bh8) | 0;\n mid = mid + Math.imul(ah5, bl8) | 0;\n hi = hi + Math.imul(ah5, bh8) | 0;\n lo = lo + Math.imul(al4, bl9) | 0;\n mid = mid + Math.imul(al4, bh9) | 0;\n mid = mid + Math.imul(ah4, bl9) | 0;\n hi = hi + Math.imul(ah4, bh9) | 0;\n var w13 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w13 >>> 26) | 0;\n w13 &= 0x3ffffff;\n /* k = 14 */\n\n lo = Math.imul(al9, bl5);\n mid = Math.imul(al9, bh5);\n mid = mid + Math.imul(ah9, bl5) | 0;\n hi = Math.imul(ah9, bh5);\n lo = lo + Math.imul(al8, bl6) | 0;\n mid = mid + Math.imul(al8, bh6) | 0;\n mid = mid + Math.imul(ah8, bl6) | 0;\n hi = hi + Math.imul(ah8, bh6) | 0;\n lo = lo + Math.imul(al7, bl7) | 0;\n mid = mid + Math.imul(al7, bh7) | 0;\n mid = mid + Math.imul(ah7, bl7) | 0;\n hi = hi + Math.imul(ah7, bh7) | 0;\n lo = lo + Math.imul(al6, bl8) | 0;\n mid = mid + Math.imul(al6, bh8) | 0;\n mid = mid + Math.imul(ah6, bl8) | 0;\n hi = hi + Math.imul(ah6, bh8) | 0;\n lo = lo + Math.imul(al5, bl9) | 0;\n mid = mid + Math.imul(al5, bh9) | 0;\n mid = mid + Math.imul(ah5, bl9) | 0;\n hi = hi + Math.imul(ah5, bh9) | 0;\n var w14 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w14 >>> 26) | 0;\n w14 &= 0x3ffffff;\n /* k = 15 */\n\n lo = Math.imul(al9, bl6);\n mid = Math.imul(al9, bh6);\n mid = mid + Math.imul(ah9, bl6) | 0;\n hi = Math.imul(ah9, bh6);\n lo = lo + Math.imul(al8, bl7) | 0;\n mid = mid + Math.imul(al8, bh7) | 0;\n mid = mid + Math.imul(ah8, bl7) | 0;\n hi = hi + Math.imul(ah8, bh7) | 0;\n lo = lo + Math.imul(al7, bl8) | 0;\n mid = mid + Math.imul(al7, bh8) | 0;\n mid = mid + Math.imul(ah7, bl8) | 0;\n hi = hi + Math.imul(ah7, bh8) | 0;\n lo = lo + Math.imul(al6, bl9) | 0;\n mid = mid + Math.imul(al6, bh9) | 0;\n mid = mid + Math.imul(ah6, bl9) | 0;\n hi = hi + Math.imul(ah6, bh9) | 0;\n var w15 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w15 >>> 26) | 0;\n w15 &= 0x3ffffff;\n /* k = 16 */\n\n lo = Math.imul(al9, bl7);\n mid = Math.imul(al9, bh7);\n mid = mid + Math.imul(ah9, bl7) | 0;\n hi = Math.imul(ah9, bh7);\n lo = lo + Math.imul(al8, bl8) | 0;\n mid = mid + Math.imul(al8, bh8) | 0;\n mid = mid + Math.imul(ah8, bl8) | 0;\n hi = hi + Math.imul(ah8, bh8) | 0;\n lo = lo + Math.imul(al7, bl9) | 0;\n mid = mid + Math.imul(al7, bh9) | 0;\n mid = mid + Math.imul(ah7, bl9) | 0;\n hi = hi + Math.imul(ah7, bh9) | 0;\n var w16 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w16 >>> 26) | 0;\n w16 &= 0x3ffffff;\n /* k = 17 */\n\n lo = Math.imul(al9, bl8);\n mid = Math.imul(al9, bh8);\n mid = mid + Math.imul(ah9, bl8) | 0;\n hi = Math.imul(ah9, bh8);\n lo = lo + Math.imul(al8, bl9) | 0;\n mid = mid + Math.imul(al8, bh9) | 0;\n mid = mid + Math.imul(ah8, bl9) | 0;\n hi = hi + Math.imul(ah8, bh9) | 0;\n var w17 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w17 >>> 26) | 0;\n w17 &= 0x3ffffff;\n /* k = 18 */\n\n lo = Math.imul(al9, bl9);\n mid = Math.imul(al9, bh9);\n mid = mid + Math.imul(ah9, bl9) | 0;\n hi = Math.imul(ah9, bh9);\n var w18 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w18 >>> 26) | 0;\n w18 &= 0x3ffffff;\n o[0] = w0;\n o[1] = w1;\n o[2] = w2;\n o[3] = w3;\n o[4] = w4;\n o[5] = w5;\n o[6] = w6;\n o[7] = w7;\n o[8] = w8;\n o[9] = w9;\n o[10] = w10;\n o[11] = w11;\n o[12] = w12;\n o[13] = w13;\n o[14] = w14;\n o[15] = w15;\n o[16] = w16;\n o[17] = w17;\n o[18] = w18;\n\n if (c !== 0) {\n o[19] = c;\n out.length++;\n }\n\n return out;\n }; // Polyfill comb\n\n\n if (!Math.imul) {\n comb10MulTo = smallMulTo;\n }\n\n function bigMulTo(self, num, out) {\n out.negative = num.negative ^ self.negative;\n out.length = self.length + num.length;\n var carry = 0;\n var hncarry = 0;\n\n for (var k = 0; k < out.length - 1; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = hncarry;\n hncarry = 0;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = k - j;\n var a = self.words[i] | 0;\n var b = num.words[j] | 0;\n var r = a * b;\n var lo = r & 0x3ffffff;\n ncarry = ncarry + (r / 0x4000000 | 0) | 0;\n lo = lo + rword | 0;\n rword = lo & 0x3ffffff;\n ncarry = ncarry + (lo >>> 26) | 0;\n hncarry += ncarry >>> 26;\n ncarry &= 0x3ffffff;\n }\n\n out.words[k] = rword;\n carry = ncarry;\n ncarry = hncarry;\n }\n\n if (carry !== 0) {\n out.words[k] = carry;\n } else {\n out.length--;\n }\n\n return out.strip();\n }\n\n function jumboMulTo(self, num, out) {\n var fftm = new FFTM();\n return fftm.mulp(self, num, out);\n }\n\n BN.prototype.mulTo = function mulTo(num, out) {\n var res;\n var len = this.length + num.length;\n\n if (this.length === 10 && num.length === 10) {\n res = comb10MulTo(this, num, out);\n } else if (len < 63) {\n res = smallMulTo(this, num, out);\n } else if (len < 1024) {\n res = bigMulTo(this, num, out);\n } else {\n res = jumboMulTo(this, num, out);\n }\n\n return res;\n }; // Cooley-Tukey algorithm for FFT\n // slightly revisited to rely on looping instead of recursion\n\n\n function FFTM(x, y) {\n this.x = x;\n this.y = y;\n }\n\n FFTM.prototype.makeRBT = function makeRBT(N) {\n var t = new Array(N);\n var l = BN.prototype._countBits(N) - 1;\n\n for (var i = 0; i < N; i++) {\n t[i] = this.revBin(i, l, N);\n }\n\n return t;\n }; // Returns binary-reversed representation of `x`\n\n\n FFTM.prototype.revBin = function revBin(x, l, N) {\n if (x === 0 || x === N - 1) return x;\n var rb = 0;\n\n for (var i = 0; i < l; i++) {\n rb |= (x & 1) << l - i - 1;\n x >>= 1;\n }\n\n return rb;\n }; // Performs \"tweedling\" phase, therefore 'emulating'\n // behaviour of the recursive algorithm\n\n\n FFTM.prototype.permute = function permute(rbt, rws, iws, rtws, itws, N) {\n for (var i = 0; i < N; i++) {\n rtws[i] = rws[rbt[i]];\n itws[i] = iws[rbt[i]];\n }\n };\n\n FFTM.prototype.transform = function transform(rws, iws, rtws, itws, N, rbt) {\n this.permute(rbt, rws, iws, rtws, itws, N);\n\n for (var s = 1; s < N; s <<= 1) {\n var l = s << 1;\n var rtwdf = Math.cos(2 * Math.PI / l);\n var itwdf = Math.sin(2 * Math.PI / l);\n\n for (var p = 0; p < N; p += l) {\n var rtwdf_ = rtwdf;\n var itwdf_ = itwdf;\n\n for (var j = 0; j < s; j++) {\n var re = rtws[p + j];\n var ie = itws[p + j];\n var ro = rtws[p + j + s];\n var io = itws[p + j + s];\n var rx = rtwdf_ * ro - itwdf_ * io;\n io = rtwdf_ * io + itwdf_ * ro;\n ro = rx;\n rtws[p + j] = re + ro;\n itws[p + j] = ie + io;\n rtws[p + j + s] = re - ro;\n itws[p + j + s] = ie - io;\n /* jshint maxdepth : false */\n\n if (j !== l) {\n rx = rtwdf * rtwdf_ - itwdf * itwdf_;\n itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;\n rtwdf_ = rx;\n }\n }\n }\n }\n };\n\n FFTM.prototype.guessLen13b = function guessLen13b(n, m) {\n var N = Math.max(m, n) | 1;\n var odd = N & 1;\n var i = 0;\n\n for (N = N / 2 | 0; N; N = N >>> 1) {\n i++;\n }\n\n return 1 << i + 1 + odd;\n };\n\n FFTM.prototype.conjugate = function conjugate(rws, iws, N) {\n if (N <= 1) return;\n\n for (var i = 0; i < N / 2; i++) {\n var t = rws[i];\n rws[i] = rws[N - i - 1];\n rws[N - i - 1] = t;\n t = iws[i];\n iws[i] = -iws[N - i - 1];\n iws[N - i - 1] = -t;\n }\n };\n\n FFTM.prototype.normalize13b = function normalize13b(ws, N) {\n var carry = 0;\n\n for (var i = 0; i < N / 2; i++) {\n var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + Math.round(ws[2 * i] / N) + carry;\n ws[i] = w & 0x3ffffff;\n\n if (w < 0x4000000) {\n carry = 0;\n } else {\n carry = w / 0x4000000 | 0;\n }\n }\n\n return ws;\n };\n\n FFTM.prototype.convert13b = function convert13b(ws, len, rws, N) {\n var carry = 0;\n\n for (var i = 0; i < len; i++) {\n carry = carry + (ws[i] | 0);\n rws[2 * i] = carry & 0x1fff;\n carry = carry >>> 13;\n rws[2 * i + 1] = carry & 0x1fff;\n carry = carry >>> 13;\n } // Pad with zeroes\n\n\n for (i = 2 * len; i < N; ++i) {\n rws[i] = 0;\n }\n\n assert(carry === 0);\n assert((carry & ~0x1fff) === 0);\n };\n\n FFTM.prototype.stub = function stub(N) {\n var ph = new Array(N);\n\n for (var i = 0; i < N; i++) {\n ph[i] = 0;\n }\n\n return ph;\n };\n\n FFTM.prototype.mulp = function mulp(x, y, out) {\n var N = 2 * this.guessLen13b(x.length, y.length);\n var rbt = this.makeRBT(N);\n\n var _ = this.stub(N);\n\n var rws = new Array(N);\n var rwst = new Array(N);\n var iwst = new Array(N);\n var nrws = new Array(N);\n var nrwst = new Array(N);\n var niwst = new Array(N);\n var rmws = out.words;\n rmws.length = N;\n this.convert13b(x.words, x.length, rws, N);\n this.convert13b(y.words, y.length, nrws, N);\n this.transform(rws, _, rwst, iwst, N, rbt);\n this.transform(nrws, _, nrwst, niwst, N, rbt);\n\n for (var i = 0; i < N; i++) {\n var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];\n iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];\n rwst[i] = rx;\n }\n\n this.conjugate(rwst, iwst, N);\n this.transform(rwst, iwst, rmws, _, N, rbt);\n this.conjugate(rmws, _, N);\n this.normalize13b(rmws, N);\n out.negative = x.negative ^ y.negative;\n out.length = x.length + y.length;\n return out.strip();\n }; // Multiply `this` by `num`\n\n\n BN.prototype.mul = function mul(num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return this.mulTo(num, out);\n }; // Multiply employing FFT\n\n\n BN.prototype.mulf = function mulf(num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return jumboMulTo(this, num, out);\n }; // In-place Multiplication\n\n\n BN.prototype.imul = function imul(num) {\n return this.clone().mulTo(num, this);\n };\n\n BN.prototype.imuln = function imuln(num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000); // Carry\n\n var carry = 0;\n\n for (var i = 0; i < this.length; i++) {\n var w = (this.words[i] | 0) * num;\n var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);\n carry >>= 26;\n carry += w / 0x4000000 | 0; // NOTE: lo is 27bit maximum\n\n carry += lo >>> 26;\n this.words[i] = lo & 0x3ffffff;\n }\n\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n\n return this;\n };\n\n BN.prototype.muln = function muln(num) {\n return this.clone().imuln(num);\n }; // `this` * `this`\n\n\n BN.prototype.sqr = function sqr() {\n return this.mul(this);\n }; // `this` * `this` in-place\n\n\n BN.prototype.isqr = function isqr() {\n return this.imul(this.clone());\n }; // Math.pow(`this`, `num`)\n\n\n BN.prototype.pow = function pow(num) {\n var w = toBitArray(num);\n if (w.length === 0) return new BN(1); // Skip leading zeroes\n\n var res = this;\n\n for (var i = 0; i < w.length; i++, res = res.sqr()) {\n if (w[i] !== 0) break;\n }\n\n if (++i < w.length) {\n for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {\n if (w[i] === 0) continue;\n res = res.mul(q);\n }\n }\n\n return res;\n }; // Shift-left in-place\n\n\n BN.prototype.iushln = function iushln(bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n var carryMask = 0x3ffffff >>> 26 - r << 26 - r;\n var i;\n\n if (r !== 0) {\n var carry = 0;\n\n for (i = 0; i < this.length; i++) {\n var newCarry = this.words[i] & carryMask;\n var c = (this.words[i] | 0) - newCarry << r;\n this.words[i] = c | carry;\n carry = newCarry >>> 26 - r;\n }\n\n if (carry) {\n this.words[i] = carry;\n this.length++;\n }\n }\n\n if (s !== 0) {\n for (i = this.length - 1; i >= 0; i--) {\n this.words[i + s] = this.words[i];\n }\n\n for (i = 0; i < s; i++) {\n this.words[i] = 0;\n }\n\n this.length += s;\n }\n\n return this.strip();\n };\n\n BN.prototype.ishln = function ishln(bits) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushln(bits);\n }; // Shift-right in-place\n // NOTE: `hint` is a lowest bit before trailing zeroes\n // NOTE: if `extended` is present - it will be filled with destroyed bits\n\n\n BN.prototype.iushrn = function iushrn(bits, hint, extended) {\n assert(typeof bits === 'number' && bits >= 0);\n var h;\n\n if (hint) {\n h = (hint - hint % 26) / 26;\n } else {\n h = 0;\n }\n\n var r = bits % 26;\n var s = Math.min((bits - r) / 26, this.length);\n var mask = 0x3ffffff ^ 0x3ffffff >>> r << r;\n var maskedWords = extended;\n h -= s;\n h = Math.max(0, h); // Extended mode, copy masked part\n\n if (maskedWords) {\n for (var i = 0; i < s; i++) {\n maskedWords.words[i] = this.words[i];\n }\n\n maskedWords.length = s;\n }\n\n if (s === 0) {// No-op, we should not move anything at all\n } else if (this.length > s) {\n this.length -= s;\n\n for (i = 0; i < this.length; i++) {\n this.words[i] = this.words[i + s];\n }\n } else {\n this.words[0] = 0;\n this.length = 1;\n }\n\n var carry = 0;\n\n for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {\n var word = this.words[i] | 0;\n this.words[i] = carry << 26 - r | word >>> r;\n carry = word & mask;\n } // Push carried bits as a mask\n\n\n if (maskedWords && carry !== 0) {\n maskedWords.words[maskedWords.length++] = carry;\n }\n\n if (this.length === 0) {\n this.words[0] = 0;\n this.length = 1;\n }\n\n return this.strip();\n };\n\n BN.prototype.ishrn = function ishrn(bits, hint, extended) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushrn(bits, hint, extended);\n }; // Shift-left\n\n\n BN.prototype.shln = function shln(bits) {\n return this.clone().ishln(bits);\n };\n\n BN.prototype.ushln = function ushln(bits) {\n return this.clone().iushln(bits);\n }; // Shift-right\n\n\n BN.prototype.shrn = function shrn(bits) {\n return this.clone().ishrn(bits);\n };\n\n BN.prototype.ushrn = function ushrn(bits) {\n return this.clone().iushrn(bits);\n }; // Test if n bit is set\n\n\n BN.prototype.testn = function testn(bit) {\n assert(typeof bit === 'number' && bit >= 0);\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r; // Fast case: bit is much higher than all existing words\n\n if (this.length <= s) return false; // Check bit and return\n\n var w = this.words[s];\n return !!(w & q);\n }; // Return only lowers bits of number (in-place)\n\n\n BN.prototype.imaskn = function imaskn(bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n assert(this.negative === 0, 'imaskn works only with positive numbers');\n\n if (this.length <= s) {\n return this;\n }\n\n if (r !== 0) {\n s++;\n }\n\n this.length = Math.min(s, this.length);\n\n if (r !== 0) {\n var mask = 0x3ffffff ^ 0x3ffffff >>> r << r;\n this.words[this.length - 1] &= mask;\n }\n\n return this.strip();\n }; // Return only lowers bits of number\n\n\n BN.prototype.maskn = function maskn(bits) {\n return this.clone().imaskn(bits);\n }; // Add plain number `num` to `this`\n\n\n BN.prototype.iaddn = function iaddn(num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.isubn(-num); // Possible sign change\n\n if (this.negative !== 0) {\n if (this.length === 1 && (this.words[0] | 0) < num) {\n this.words[0] = num - (this.words[0] | 0);\n this.negative = 0;\n return this;\n }\n\n this.negative = 0;\n this.isubn(num);\n this.negative = 1;\n return this;\n } // Add without checks\n\n\n return this._iaddn(num);\n };\n\n BN.prototype._iaddn = function _iaddn(num) {\n this.words[0] += num; // Carry\n\n for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {\n this.words[i] -= 0x4000000;\n\n if (i === this.length - 1) {\n this.words[i + 1] = 1;\n } else {\n this.words[i + 1]++;\n }\n }\n\n this.length = Math.max(this.length, i + 1);\n return this;\n }; // Subtract plain number `num` from `this`\n\n\n BN.prototype.isubn = function isubn(num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.iaddn(-num);\n\n if (this.negative !== 0) {\n this.negative = 0;\n this.iaddn(num);\n this.negative = 1;\n return this;\n }\n\n this.words[0] -= num;\n\n if (this.length === 1 && this.words[0] < 0) {\n this.words[0] = -this.words[0];\n this.negative = 1;\n } else {\n // Carry\n for (var i = 0; i < this.length && this.words[i] < 0; i++) {\n this.words[i] += 0x4000000;\n this.words[i + 1] -= 1;\n }\n }\n\n return this.strip();\n };\n\n BN.prototype.addn = function addn(num) {\n return this.clone().iaddn(num);\n };\n\n BN.prototype.subn = function subn(num) {\n return this.clone().isubn(num);\n };\n\n BN.prototype.iabs = function iabs() {\n this.negative = 0;\n return this;\n };\n\n BN.prototype.abs = function abs() {\n return this.clone().iabs();\n };\n\n BN.prototype._ishlnsubmul = function _ishlnsubmul(num, mul, shift) {\n var len = num.length + shift;\n var i;\n\n this._expand(len);\n\n var w;\n var carry = 0;\n\n for (i = 0; i < num.length; i++) {\n w = (this.words[i + shift] | 0) + carry;\n var right = (num.words[i] | 0) * mul;\n w -= right & 0x3ffffff;\n carry = (w >> 26) - (right / 0x4000000 | 0);\n this.words[i + shift] = w & 0x3ffffff;\n }\n\n for (; i < this.length - shift; i++) {\n w = (this.words[i + shift] | 0) + carry;\n carry = w >> 26;\n this.words[i + shift] = w & 0x3ffffff;\n }\n\n if (carry === 0) return this.strip(); // Subtraction overflow\n\n assert(carry === -1);\n carry = 0;\n\n for (i = 0; i < this.length; i++) {\n w = -(this.words[i] | 0) + carry;\n carry = w >> 26;\n this.words[i] = w & 0x3ffffff;\n }\n\n this.negative = 1;\n return this.strip();\n };\n\n BN.prototype._wordDiv = function _wordDiv(num, mode) {\n var shift = this.length - num.length;\n var a = this.clone();\n var b = num; // Normalize\n\n var bhi = b.words[b.length - 1] | 0;\n\n var bhiBits = this._countBits(bhi);\n\n shift = 26 - bhiBits;\n\n if (shift !== 0) {\n b = b.ushln(shift);\n a.iushln(shift);\n bhi = b.words[b.length - 1] | 0;\n } // Initialize quotient\n\n\n var m = a.length - b.length;\n var q;\n\n if (mode !== 'mod') {\n q = new BN(null);\n q.length = m + 1;\n q.words = new Array(q.length);\n\n for (var i = 0; i < q.length; i++) {\n q.words[i] = 0;\n }\n }\n\n var diff = a.clone()._ishlnsubmul(b, 1, m);\n\n if (diff.negative === 0) {\n a = diff;\n\n if (q) {\n q.words[m] = 1;\n }\n }\n\n for (var j = m - 1; j >= 0; j--) {\n var qj = (a.words[b.length + j] | 0) * 0x4000000 + (a.words[b.length + j - 1] | 0); // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max\n // (0x7ffffff)\n\n qj = Math.min(qj / bhi | 0, 0x3ffffff);\n\n a._ishlnsubmul(b, qj, j);\n\n while (a.negative !== 0) {\n qj--;\n a.negative = 0;\n\n a._ishlnsubmul(b, 1, j);\n\n if (!a.isZero()) {\n a.negative ^= 1;\n }\n }\n\n if (q) {\n q.words[j] = qj;\n }\n }\n\n if (q) {\n q.strip();\n }\n\n a.strip(); // Denormalize\n\n if (mode !== 'div' && shift !== 0) {\n a.iushrn(shift);\n }\n\n return {\n div: q || null,\n mod: a\n };\n }; // NOTE: 1) `mode` can be set to `mod` to request mod only,\n // to `div` to request div only, or be absent to\n // request both div & mod\n // 2) `positive` is true if unsigned mod is requested\n\n\n BN.prototype.divmod = function divmod(num, mode, positive) {\n assert(!num.isZero());\n\n if (this.isZero()) {\n return {\n div: new BN(0),\n mod: new BN(0)\n };\n }\n\n var div, mod, res;\n\n if (this.negative !== 0 && num.negative === 0) {\n res = this.neg().divmod(num, mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n\n if (positive && mod.negative !== 0) {\n mod.iadd(num);\n }\n }\n\n return {\n div: div,\n mod: mod\n };\n }\n\n if (this.negative === 0 && num.negative !== 0) {\n res = this.divmod(num.neg(), mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n return {\n div: div,\n mod: res.mod\n };\n }\n\n if ((this.negative & num.negative) !== 0) {\n res = this.neg().divmod(num.neg(), mode);\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n\n if (positive && mod.negative !== 0) {\n mod.isub(num);\n }\n }\n\n return {\n div: res.div,\n mod: mod\n };\n } // Both numbers are positive at this point\n // Strip both numbers to approximate shift value\n\n\n if (num.length > this.length || this.cmp(num) < 0) {\n return {\n div: new BN(0),\n mod: this\n };\n } // Very short reduction\n\n\n if (num.length === 1) {\n if (mode === 'div') {\n return {\n div: this.divn(num.words[0]),\n mod: null\n };\n }\n\n if (mode === 'mod') {\n return {\n div: null,\n mod: new BN(this.modn(num.words[0]))\n };\n }\n\n return {\n div: this.divn(num.words[0]),\n mod: new BN(this.modn(num.words[0]))\n };\n }\n\n return this._wordDiv(num, mode);\n }; // Find `this` / `num`\n\n\n BN.prototype.div = function div(num) {\n return this.divmod(num, 'div', false).div;\n }; // Find `this` % `num`\n\n\n BN.prototype.mod = function mod(num) {\n return this.divmod(num, 'mod', false).mod;\n };\n\n BN.prototype.umod = function umod(num) {\n return this.divmod(num, 'mod', true).mod;\n }; // Find Round(`this` / `num`)\n\n\n BN.prototype.divRound = function divRound(num) {\n var dm = this.divmod(num); // Fast case - exact division\n\n if (dm.mod.isZero()) return dm.div;\n var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;\n var half = num.ushrn(1);\n var r2 = num.andln(1);\n var cmp = mod.cmp(half); // Round down\n\n if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div; // Round up\n\n return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);\n };\n\n BN.prototype.modn = function modn(num) {\n assert(num <= 0x3ffffff);\n var p = (1 << 26) % num;\n var acc = 0;\n\n for (var i = this.length - 1; i >= 0; i--) {\n acc = (p * acc + (this.words[i] | 0)) % num;\n }\n\n return acc;\n }; // In-place division by number\n\n\n BN.prototype.idivn = function idivn(num) {\n assert(num <= 0x3ffffff);\n var carry = 0;\n\n for (var i = this.length - 1; i >= 0; i--) {\n var w = (this.words[i] | 0) + carry * 0x4000000;\n this.words[i] = w / num | 0;\n carry = w % num;\n }\n\n return this.strip();\n };\n\n BN.prototype.divn = function divn(num) {\n return this.clone().idivn(num);\n };\n\n BN.prototype.egcd = function egcd(p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n var x = this;\n var y = p.clone();\n\n if (x.negative !== 0) {\n x = x.umod(p);\n } else {\n x = x.clone();\n } // A * x + B * y = x\n\n\n var A = new BN(1);\n var B = new BN(0); // C * x + D * y = y\n\n var C = new BN(0);\n var D = new BN(1);\n var g = 0;\n\n while (x.isEven() && y.isEven()) {\n x.iushrn(1);\n y.iushrn(1);\n ++g;\n }\n\n var yp = y.clone();\n var xp = x.clone();\n\n while (!x.isZero()) {\n for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1) {\n ;\n }\n\n if (i > 0) {\n x.iushrn(i);\n\n while (i-- > 0) {\n if (A.isOdd() || B.isOdd()) {\n A.iadd(yp);\n B.isub(xp);\n }\n\n A.iushrn(1);\n B.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1) {\n ;\n }\n\n if (j > 0) {\n y.iushrn(j);\n\n while (j-- > 0) {\n if (C.isOdd() || D.isOdd()) {\n C.iadd(yp);\n D.isub(xp);\n }\n\n C.iushrn(1);\n D.iushrn(1);\n }\n }\n\n if (x.cmp(y) >= 0) {\n x.isub(y);\n A.isub(C);\n B.isub(D);\n } else {\n y.isub(x);\n C.isub(A);\n D.isub(B);\n }\n }\n\n return {\n a: C,\n b: D,\n gcd: y.iushln(g)\n };\n }; // This is reduced incarnation of the binary EEA\n // above, designated to invert members of the\n // _prime_ fields F(p) at a maximal speed\n\n\n BN.prototype._invmp = function _invmp(p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n var a = this;\n var b = p.clone();\n\n if (a.negative !== 0) {\n a = a.umod(p);\n } else {\n a = a.clone();\n }\n\n var x1 = new BN(1);\n var x2 = new BN(0);\n var delta = b.clone();\n\n while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {\n for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1) {\n ;\n }\n\n if (i > 0) {\n a.iushrn(i);\n\n while (i-- > 0) {\n if (x1.isOdd()) {\n x1.iadd(delta);\n }\n\n x1.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1) {\n ;\n }\n\n if (j > 0) {\n b.iushrn(j);\n\n while (j-- > 0) {\n if (x2.isOdd()) {\n x2.iadd(delta);\n }\n\n x2.iushrn(1);\n }\n }\n\n if (a.cmp(b) >= 0) {\n a.isub(b);\n x1.isub(x2);\n } else {\n b.isub(a);\n x2.isub(x1);\n }\n }\n\n var res;\n\n if (a.cmpn(1) === 0) {\n res = x1;\n } else {\n res = x2;\n }\n\n if (res.cmpn(0) < 0) {\n res.iadd(p);\n }\n\n return res;\n };\n\n BN.prototype.gcd = function gcd(num) {\n if (this.isZero()) return num.abs();\n if (num.isZero()) return this.abs();\n var a = this.clone();\n var b = num.clone();\n a.negative = 0;\n b.negative = 0; // Remove common factor of two\n\n for (var shift = 0; a.isEven() && b.isEven(); shift++) {\n a.iushrn(1);\n b.iushrn(1);\n }\n\n do {\n while (a.isEven()) {\n a.iushrn(1);\n }\n\n while (b.isEven()) {\n b.iushrn(1);\n }\n\n var r = a.cmp(b);\n\n if (r < 0) {\n // Swap `a` and `b` to make `a` always bigger than `b`\n var t = a;\n a = b;\n b = t;\n } else if (r === 0 || b.cmpn(1) === 0) {\n break;\n }\n\n a.isub(b);\n } while (true);\n\n return b.iushln(shift);\n }; // Invert number in the field F(num)\n\n\n BN.prototype.invm = function invm(num) {\n return this.egcd(num).a.umod(num);\n };\n\n BN.prototype.isEven = function isEven() {\n return (this.words[0] & 1) === 0;\n };\n\n BN.prototype.isOdd = function isOdd() {\n return (this.words[0] & 1) === 1;\n }; // And first word and num\n\n\n BN.prototype.andln = function andln(num) {\n return this.words[0] & num;\n }; // Increment at the bit position in-line\n\n\n BN.prototype.bincn = function bincn(bit) {\n assert(typeof bit === 'number');\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r; // Fast case: bit is much higher than all existing words\n\n if (this.length <= s) {\n this._expand(s + 1);\n\n this.words[s] |= q;\n return this;\n } // Add bit and propagate, if needed\n\n\n var carry = q;\n\n for (var i = s; carry !== 0 && i < this.length; i++) {\n var w = this.words[i] | 0;\n w += carry;\n carry = w >>> 26;\n w &= 0x3ffffff;\n this.words[i] = w;\n }\n\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n\n return this;\n };\n\n BN.prototype.isZero = function isZero() {\n return this.length === 1 && this.words[0] === 0;\n };\n\n BN.prototype.cmpn = function cmpn(num) {\n var negative = num < 0;\n if (this.negative !== 0 && !negative) return -1;\n if (this.negative === 0 && negative) return 1;\n this.strip();\n var res;\n\n if (this.length > 1) {\n res = 1;\n } else {\n if (negative) {\n num = -num;\n }\n\n assert(num <= 0x3ffffff, 'Number is too big');\n var w = this.words[0] | 0;\n res = w === num ? 0 : w < num ? -1 : 1;\n }\n\n if (this.negative !== 0) return -res | 0;\n return res;\n }; // Compare two numbers and return:\n // 1 - if `this` > `num`\n // 0 - if `this` == `num`\n // -1 - if `this` < `num`\n\n\n BN.prototype.cmp = function cmp(num) {\n if (this.negative !== 0 && num.negative === 0) return -1;\n if (this.negative === 0 && num.negative !== 0) return 1;\n var res = this.ucmp(num);\n if (this.negative !== 0) return -res | 0;\n return res;\n }; // Unsigned comparison\n\n\n BN.prototype.ucmp = function ucmp(num) {\n // At this point both numbers have the same sign\n if (this.length > num.length) return 1;\n if (this.length < num.length) return -1;\n var res = 0;\n\n for (var i = this.length - 1; i >= 0; i--) {\n var a = this.words[i] | 0;\n var b = num.words[i] | 0;\n if (a === b) continue;\n\n if (a < b) {\n res = -1;\n } else if (a > b) {\n res = 1;\n }\n\n break;\n }\n\n return res;\n };\n\n BN.prototype.gtn = function gtn(num) {\n return this.cmpn(num) === 1;\n };\n\n BN.prototype.gt = function gt(num) {\n return this.cmp(num) === 1;\n };\n\n BN.prototype.gten = function gten(num) {\n return this.cmpn(num) >= 0;\n };\n\n BN.prototype.gte = function gte(num) {\n return this.cmp(num) >= 0;\n };\n\n BN.prototype.ltn = function ltn(num) {\n return this.cmpn(num) === -1;\n };\n\n BN.prototype.lt = function lt(num) {\n return this.cmp(num) === -1;\n };\n\n BN.prototype.lten = function lten(num) {\n return this.cmpn(num) <= 0;\n };\n\n BN.prototype.lte = function lte(num) {\n return this.cmp(num) <= 0;\n };\n\n BN.prototype.eqn = function eqn(num) {\n return this.cmpn(num) === 0;\n };\n\n BN.prototype.eq = function eq(num) {\n return this.cmp(num) === 0;\n }; //\n // A reduce context, could be using montgomery or something better, depending\n // on the `m` itself.\n //\n\n\n BN.red = function red(num) {\n return new Red(num);\n };\n\n BN.prototype.toRed = function toRed(ctx) {\n assert(!this.red, 'Already a number in reduction context');\n assert(this.negative === 0, 'red works only with positives');\n return ctx.convertTo(this)._forceRed(ctx);\n };\n\n BN.prototype.fromRed = function fromRed() {\n assert(this.red, 'fromRed works only with numbers in reduction context');\n return this.red.convertFrom(this);\n };\n\n BN.prototype._forceRed = function _forceRed(ctx) {\n this.red = ctx;\n return this;\n };\n\n BN.prototype.forceRed = function forceRed(ctx) {\n assert(!this.red, 'Already a number in reduction context');\n return this._forceRed(ctx);\n };\n\n BN.prototype.redAdd = function redAdd(num) {\n assert(this.red, 'redAdd works only with red numbers');\n return this.red.add(this, num);\n };\n\n BN.prototype.redIAdd = function redIAdd(num) {\n assert(this.red, 'redIAdd works only with red numbers');\n return this.red.iadd(this, num);\n };\n\n BN.prototype.redSub = function redSub(num) {\n assert(this.red, 'redSub works only with red numbers');\n return this.red.sub(this, num);\n };\n\n BN.prototype.redISub = function redISub(num) {\n assert(this.red, 'redISub works only with red numbers');\n return this.red.isub(this, num);\n };\n\n BN.prototype.redShl = function redShl(num) {\n assert(this.red, 'redShl works only with red numbers');\n return this.red.shl(this, num);\n };\n\n BN.prototype.redMul = function redMul(num) {\n assert(this.red, 'redMul works only with red numbers');\n\n this.red._verify2(this, num);\n\n return this.red.mul(this, num);\n };\n\n BN.prototype.redIMul = function redIMul(num) {\n assert(this.red, 'redMul works only with red numbers');\n\n this.red._verify2(this, num);\n\n return this.red.imul(this, num);\n };\n\n BN.prototype.redSqr = function redSqr() {\n assert(this.red, 'redSqr works only with red numbers');\n\n this.red._verify1(this);\n\n return this.red.sqr(this);\n };\n\n BN.prototype.redISqr = function redISqr() {\n assert(this.red, 'redISqr works only with red numbers');\n\n this.red._verify1(this);\n\n return this.red.isqr(this);\n }; // Square root over p\n\n\n BN.prototype.redSqrt = function redSqrt() {\n assert(this.red, 'redSqrt works only with red numbers');\n\n this.red._verify1(this);\n\n return this.red.sqrt(this);\n };\n\n BN.prototype.redInvm = function redInvm() {\n assert(this.red, 'redInvm works only with red numbers');\n\n this.red._verify1(this);\n\n return this.red.invm(this);\n }; // Return negative clone of `this` % `red modulo`\n\n\n BN.prototype.redNeg = function redNeg() {\n assert(this.red, 'redNeg works only with red numbers');\n\n this.red._verify1(this);\n\n return this.red.neg(this);\n };\n\n BN.prototype.redPow = function redPow(num) {\n assert(this.red && !num.red, 'redPow(normalNum)');\n\n this.red._verify1(this);\n\n return this.red.pow(this, num);\n }; // Prime numbers with efficient reduction\n\n\n var primes = {\n k256: null,\n p224: null,\n p192: null,\n p25519: null\n }; // Pseudo-Mersenne prime\n\n function MPrime(name, p) {\n // P = 2 ^ N - K\n this.name = name;\n this.p = new BN(p, 16);\n this.n = this.p.bitLength();\n this.k = new BN(1).iushln(this.n).isub(this.p);\n this.tmp = this._tmp();\n }\n\n MPrime.prototype._tmp = function _tmp() {\n var tmp = new BN(null);\n tmp.words = new Array(Math.ceil(this.n / 13));\n return tmp;\n };\n\n MPrime.prototype.ireduce = function ireduce(num) {\n // Assumes that `num` is less than `P^2`\n // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)\n var r = num;\n var rlen;\n\n do {\n this.split(r, this.tmp);\n r = this.imulK(r);\n r = r.iadd(this.tmp);\n rlen = r.bitLength();\n } while (rlen > this.n);\n\n var cmp = rlen < this.n ? -1 : r.ucmp(this.p);\n\n if (cmp === 0) {\n r.words[0] = 0;\n r.length = 1;\n } else if (cmp > 0) {\n r.isub(this.p);\n } else {\n if (r.strip !== undefined) {\n // r is BN v4 instance\n r.strip();\n } else {\n // r is BN v5 instance\n r._strip();\n }\n }\n\n return r;\n };\n\n MPrime.prototype.split = function split(input, out) {\n input.iushrn(this.n, 0, out);\n };\n\n MPrime.prototype.imulK = function imulK(num) {\n return num.imul(this.k);\n };\n\n function K256() {\n MPrime.call(this, 'k256', 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');\n }\n\n inherits(K256, MPrime);\n\n K256.prototype.split = function split(input, output) {\n // 256 = 9 * 26 + 22\n var mask = 0x3fffff;\n var outLen = Math.min(input.length, 9);\n\n for (var i = 0; i < outLen; i++) {\n output.words[i] = input.words[i];\n }\n\n output.length = outLen;\n\n if (input.length <= 9) {\n input.words[0] = 0;\n input.length = 1;\n return;\n } // Shift by 9 limbs\n\n\n var prev = input.words[9];\n output.words[output.length++] = prev & mask;\n\n for (i = 10; i < input.length; i++) {\n var next = input.words[i] | 0;\n input.words[i - 10] = (next & mask) << 4 | prev >>> 22;\n prev = next;\n }\n\n prev >>>= 22;\n input.words[i - 10] = prev;\n\n if (prev === 0 && input.length > 10) {\n input.length -= 10;\n } else {\n input.length -= 9;\n }\n };\n\n K256.prototype.imulK = function imulK(num) {\n // K = 0x1000003d1 = [ 0x40, 0x3d1 ]\n num.words[num.length] = 0;\n num.words[num.length + 1] = 0;\n num.length += 2; // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390\n\n var lo = 0;\n\n for (var i = 0; i < num.length; i++) {\n var w = num.words[i] | 0;\n lo += w * 0x3d1;\n num.words[i] = lo & 0x3ffffff;\n lo = w * 0x40 + (lo / 0x4000000 | 0);\n } // Fast length reduction\n\n\n if (num.words[num.length - 1] === 0) {\n num.length--;\n\n if (num.words[num.length - 1] === 0) {\n num.length--;\n }\n }\n\n return num;\n };\n\n function P224() {\n MPrime.call(this, 'p224', 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');\n }\n\n inherits(P224, MPrime);\n\n function P192() {\n MPrime.call(this, 'p192', 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');\n }\n\n inherits(P192, MPrime);\n\n function P25519() {\n // 2 ^ 255 - 19\n MPrime.call(this, '25519', '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');\n }\n\n inherits(P25519, MPrime);\n\n P25519.prototype.imulK = function imulK(num) {\n // K = 0x13\n var carry = 0;\n\n for (var i = 0; i < num.length; i++) {\n var hi = (num.words[i] | 0) * 0x13 + carry;\n var lo = hi & 0x3ffffff;\n hi >>>= 26;\n num.words[i] = lo;\n carry = hi;\n }\n\n if (carry !== 0) {\n num.words[num.length++] = carry;\n }\n\n return num;\n }; // Exported mostly for testing purposes, use plain name instead\n\n\n BN._prime = function prime(name) {\n // Cached version of prime\n if (primes[name]) return primes[name];\n var prime;\n\n if (name === 'k256') {\n prime = new K256();\n } else if (name === 'p224') {\n prime = new P224();\n } else if (name === 'p192') {\n prime = new P192();\n } else if (name === 'p25519') {\n prime = new P25519();\n } else {\n throw new Error('Unknown prime ' + name);\n }\n\n primes[name] = prime;\n return prime;\n }; //\n // Base reduction engine\n //\n\n\n function Red(m) {\n if (typeof m === 'string') {\n var prime = BN._prime(m);\n\n this.m = prime.p;\n this.prime = prime;\n } else {\n assert(m.gtn(1), 'modulus must be greater than 1');\n this.m = m;\n this.prime = null;\n }\n }\n\n Red.prototype._verify1 = function _verify1(a) {\n assert(a.negative === 0, 'red works only with positives');\n assert(a.red, 'red works only with red numbers');\n };\n\n Red.prototype._verify2 = function _verify2(a, b) {\n assert((a.negative | b.negative) === 0, 'red works only with positives');\n assert(a.red && a.red === b.red, 'red works only with red numbers');\n };\n\n Red.prototype.imod = function imod(a) {\n if (this.prime) return this.prime.ireduce(a)._forceRed(this);\n return a.umod(this.m)._forceRed(this);\n };\n\n Red.prototype.neg = function neg(a) {\n if (a.isZero()) {\n return a.clone();\n }\n\n return this.m.sub(a)._forceRed(this);\n };\n\n Red.prototype.add = function add(a, b) {\n this._verify2(a, b);\n\n var res = a.add(b);\n\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Red.prototype.iadd = function iadd(a, b) {\n this._verify2(a, b);\n\n var res = a.iadd(b);\n\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n\n return res;\n };\n\n Red.prototype.sub = function sub(a, b) {\n this._verify2(a, b);\n\n var res = a.sub(b);\n\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Red.prototype.isub = function isub(a, b) {\n this._verify2(a, b);\n\n var res = a.isub(b);\n\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n\n return res;\n };\n\n Red.prototype.shl = function shl(a, num) {\n this._verify1(a);\n\n return this.imod(a.ushln(num));\n };\n\n Red.prototype.imul = function imul(a, b) {\n this._verify2(a, b);\n\n return this.imod(a.imul(b));\n };\n\n Red.prototype.mul = function mul(a, b) {\n this._verify2(a, b);\n\n return this.imod(a.mul(b));\n };\n\n Red.prototype.isqr = function isqr(a) {\n return this.imul(a, a.clone());\n };\n\n Red.prototype.sqr = function sqr(a) {\n return this.mul(a, a);\n };\n\n Red.prototype.sqrt = function sqrt(a) {\n if (a.isZero()) return a.clone();\n var mod3 = this.m.andln(3);\n assert(mod3 % 2 === 1); // Fast case\n\n if (mod3 === 3) {\n var pow = this.m.add(new BN(1)).iushrn(2);\n return this.pow(a, pow);\n } // Tonelli-Shanks algorithm (Totally unoptimized and slow)\n //\n // Find Q and S, that Q * 2 ^ S = (P - 1)\n\n\n var q = this.m.subn(1);\n var s = 0;\n\n while (!q.isZero() && q.andln(1) === 0) {\n s++;\n q.iushrn(1);\n }\n\n assert(!q.isZero());\n var one = new BN(1).toRed(this);\n var nOne = one.redNeg(); // Find quadratic non-residue\n // NOTE: Max is such because of generalized Riemann hypothesis.\n\n var lpow = this.m.subn(1).iushrn(1);\n var z = this.m.bitLength();\n z = new BN(2 * z * z).toRed(this);\n\n while (this.pow(z, lpow).cmp(nOne) !== 0) {\n z.redIAdd(nOne);\n }\n\n var c = this.pow(z, q);\n var r = this.pow(a, q.addn(1).iushrn(1));\n var t = this.pow(a, q);\n var m = s;\n\n while (t.cmp(one) !== 0) {\n var tmp = t;\n\n for (var i = 0; tmp.cmp(one) !== 0; i++) {\n tmp = tmp.redSqr();\n }\n\n assert(i < m);\n var b = this.pow(c, new BN(1).iushln(m - i - 1));\n r = r.redMul(b);\n c = b.redSqr();\n t = t.redMul(c);\n m = i;\n }\n\n return r;\n };\n\n Red.prototype.invm = function invm(a) {\n var inv = a._invmp(this.m);\n\n if (inv.negative !== 0) {\n inv.negative = 0;\n return this.imod(inv).redNeg();\n } else {\n return this.imod(inv);\n }\n };\n\n Red.prototype.pow = function pow(a, num) {\n if (num.isZero()) return new BN(1).toRed(this);\n if (num.cmpn(1) === 0) return a.clone();\n var windowSize = 4;\n var wnd = new Array(1 << windowSize);\n wnd[0] = new BN(1).toRed(this);\n wnd[1] = a;\n\n for (var i = 2; i < wnd.length; i++) {\n wnd[i] = this.mul(wnd[i - 1], a);\n }\n\n var res = wnd[0];\n var current = 0;\n var currentLen = 0;\n var start = num.bitLength() % 26;\n\n if (start === 0) {\n start = 26;\n }\n\n for (i = num.length - 1; i >= 0; i--) {\n var word = num.words[i];\n\n for (var j = start - 1; j >= 0; j--) {\n var bit = word >> j & 1;\n\n if (res !== wnd[0]) {\n res = this.sqr(res);\n }\n\n if (bit === 0 && current === 0) {\n currentLen = 0;\n continue;\n }\n\n current <<= 1;\n current |= bit;\n currentLen++;\n if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;\n res = this.mul(res, wnd[current]);\n currentLen = 0;\n current = 0;\n }\n\n start = 26;\n }\n\n return res;\n };\n\n Red.prototype.convertTo = function convertTo(num) {\n var r = num.umod(this.m);\n return r === num ? r.clone() : r;\n };\n\n Red.prototype.convertFrom = function convertFrom(num) {\n var res = num.clone();\n res.red = null;\n return res;\n }; //\n // Montgomery method engine\n //\n\n\n BN.mont = function mont(num) {\n return new Mont(num);\n };\n\n function Mont(m) {\n Red.call(this, m);\n this.shift = this.m.bitLength();\n\n if (this.shift % 26 !== 0) {\n this.shift += 26 - this.shift % 26;\n }\n\n this.r = new BN(1).iushln(this.shift);\n this.r2 = this.imod(this.r.sqr());\n this.rinv = this.r._invmp(this.m);\n this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);\n this.minv = this.minv.umod(this.r);\n this.minv = this.r.sub(this.minv);\n }\n\n inherits(Mont, Red);\n\n Mont.prototype.convertTo = function convertTo(num) {\n return this.imod(num.ushln(this.shift));\n };\n\n Mont.prototype.convertFrom = function convertFrom(num) {\n var r = this.imod(num.mul(this.rinv));\n r.red = null;\n return r;\n };\n\n Mont.prototype.imul = function imul(a, b) {\n if (a.isZero() || b.isZero()) {\n a.words[0] = 0;\n a.length = 1;\n return a;\n }\n\n var t = a.imul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.mul = function mul(a, b) {\n if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);\n var t = a.mul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.invm = function invm(a) {\n // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R\n var res = this.imod(a._invmp(this.m).mul(this.r2));\n return res._forceRed(this);\n };\n})(typeof module === 'undefined' || module, this);","'use strict';\n\nvar inherits = require('inherits');\n\nvar Buffer = require('safer-buffer').Buffer;\n\nvar Node = require('../base/node'); // Import DER constants\n\n\nvar der = require('../constants/der');\n\nfunction DEREncoder(entity) {\n this.enc = 'der';\n this.name = entity.name;\n this.entity = entity; // Construct base tree\n\n this.tree = new DERNode();\n\n this.tree._init(entity.body);\n}\n\nmodule.exports = DEREncoder;\n\nDEREncoder.prototype.encode = function encode(data, reporter) {\n return this.tree._encode(data, reporter).join();\n}; // Tree methods\n\n\nfunction DERNode(parent) {\n Node.call(this, 'der', parent);\n}\n\ninherits(DERNode, Node);\n\nDERNode.prototype._encodeComposite = function encodeComposite(tag, primitive, cls, content) {\n var encodedTag = encodeTag(tag, primitive, cls, this.reporter); // Short form\n\n if (content.length < 0x80) {\n var _header = Buffer.alloc(2);\n\n _header[0] = encodedTag;\n _header[1] = content.length;\n return this._createEncoderBuffer([_header, content]);\n } // Long form\n // Count octets required to store length\n\n\n var lenOctets = 1;\n\n for (var i = content.length; i >= 0x100; i >>= 8) {\n lenOctets++;\n }\n\n var header = Buffer.alloc(1 + 1 + lenOctets);\n header[0] = encodedTag;\n header[1] = 0x80 | lenOctets;\n\n for (var _i = 1 + lenOctets, j = content.length; j > 0; _i--, j >>= 8) {\n header[_i] = j & 0xff;\n }\n\n return this._createEncoderBuffer([header, content]);\n};\n\nDERNode.prototype._encodeStr = function encodeStr(str, tag) {\n if (tag === 'bitstr') {\n return this._createEncoderBuffer([str.unused | 0, str.data]);\n } else if (tag === 'bmpstr') {\n var buf = Buffer.alloc(str.length * 2);\n\n for (var i = 0; i < str.length; i++) {\n buf.writeUInt16BE(str.charCodeAt(i), i * 2);\n }\n\n return this._createEncoderBuffer(buf);\n } else if (tag === 'numstr') {\n if (!this._isNumstr(str)) {\n return this.reporter.error('Encoding of string type: numstr supports ' + 'only digits and space');\n }\n\n return this._createEncoderBuffer(str);\n } else if (tag === 'printstr') {\n if (!this._isPrintstr(str)) {\n return this.reporter.error('Encoding of string type: printstr supports ' + 'only latin upper and lower case letters, ' + 'digits, space, apostrophe, left and rigth ' + 'parenthesis, plus sign, comma, hyphen, ' + 'dot, slash, colon, equal sign, ' + 'question mark');\n }\n\n return this._createEncoderBuffer(str);\n } else if (/str$/.test(tag)) {\n return this._createEncoderBuffer(str);\n } else if (tag === 'objDesc') {\n return this._createEncoderBuffer(str);\n } else {\n return this.reporter.error('Encoding of string type: ' + tag + ' unsupported');\n }\n};\n\nDERNode.prototype._encodeObjid = function encodeObjid(id, values, relative) {\n if (typeof id === 'string') {\n if (!values) return this.reporter.error('string objid given, but no values map found');\n if (!values.hasOwnProperty(id)) return this.reporter.error('objid not found in values map');\n id = values[id].split(/[\\s.]+/g);\n\n for (var i = 0; i < id.length; i++) {\n id[i] |= 0;\n }\n } else if (Array.isArray(id)) {\n id = id.slice();\n\n for (var _i2 = 0; _i2 < id.length; _i2++) {\n id[_i2] |= 0;\n }\n }\n\n if (!Array.isArray(id)) {\n return this.reporter.error('objid() should be either array or string, ' + 'got: ' + JSON.stringify(id));\n }\n\n if (!relative) {\n if (id[1] >= 40) return this.reporter.error('Second objid identifier OOB');\n id.splice(0, 2, id[0] * 40 + id[1]);\n } // Count number of octets\n\n\n var size = 0;\n\n for (var _i3 = 0; _i3 < id.length; _i3++) {\n var ident = id[_i3];\n\n for (size++; ident >= 0x80; ident >>= 7) {\n size++;\n }\n }\n\n var objid = Buffer.alloc(size);\n var offset = objid.length - 1;\n\n for (var _i4 = id.length - 1; _i4 >= 0; _i4--) {\n var _ident = id[_i4];\n objid[offset--] = _ident & 0x7f;\n\n while ((_ident >>= 7) > 0) {\n objid[offset--] = 0x80 | _ident & 0x7f;\n }\n }\n\n return this._createEncoderBuffer(objid);\n};\n\nfunction two(num) {\n if (num < 10) return '0' + num;else return num;\n}\n\nDERNode.prototype._encodeTime = function encodeTime(time, tag) {\n var str;\n var date = new Date(time);\n\n if (tag === 'gentime') {\n str = [two(date.getUTCFullYear()), two(date.getUTCMonth() + 1), two(date.getUTCDate()), two(date.getUTCHours()), two(date.getUTCMinutes()), two(date.getUTCSeconds()), 'Z'].join('');\n } else if (tag === 'utctime') {\n str = [two(date.getUTCFullYear() % 100), two(date.getUTCMonth() + 1), two(date.getUTCDate()), two(date.getUTCHours()), two(date.getUTCMinutes()), two(date.getUTCSeconds()), 'Z'].join('');\n } else {\n this.reporter.error('Encoding ' + tag + ' time is not supported yet');\n }\n\n return this._encodeStr(str, 'octstr');\n};\n\nDERNode.prototype._encodeNull = function encodeNull() {\n return this._createEncoderBuffer('');\n};\n\nDERNode.prototype._encodeInt = function encodeInt(num, values) {\n if (typeof num === 'string') {\n if (!values) return this.reporter.error('String int or enum given, but no values map');\n\n if (!values.hasOwnProperty(num)) {\n return this.reporter.error('Values map doesn\\'t contain: ' + JSON.stringify(num));\n }\n\n num = values[num];\n } // Bignum, assume big endian\n\n\n if (typeof num !== 'number' && !Buffer.isBuffer(num)) {\n var numArray = num.toArray();\n\n if (!num.sign && numArray[0] & 0x80) {\n numArray.unshift(0);\n }\n\n num = Buffer.from(numArray);\n }\n\n if (Buffer.isBuffer(num)) {\n var _size = num.length;\n if (num.length === 0) _size++;\n\n var _out = Buffer.alloc(_size);\n\n num.copy(_out);\n if (num.length === 0) _out[0] = 0;\n return this._createEncoderBuffer(_out);\n }\n\n if (num < 0x80) return this._createEncoderBuffer(num);\n if (num < 0x100) return this._createEncoderBuffer([0, num]);\n var size = 1;\n\n for (var i = num; i >= 0x100; i >>= 8) {\n size++;\n }\n\n var out = new Array(size);\n\n for (var _i5 = out.length - 1; _i5 >= 0; _i5--) {\n out[_i5] = num & 0xff;\n num >>= 8;\n }\n\n if (out[0] & 0x80) {\n out.unshift(0);\n }\n\n return this._createEncoderBuffer(Buffer.from(out));\n};\n\nDERNode.prototype._encodeBool = function encodeBool(value) {\n return this._createEncoderBuffer(value ? 0xff : 0);\n};\n\nDERNode.prototype._use = function use(entity, obj) {\n if (typeof entity === 'function') entity = entity(obj);\n return entity._getEncoder('der').tree;\n};\n\nDERNode.prototype._skipDefault = function skipDefault(dataBuffer, reporter, parent) {\n var state = this._baseState;\n var i;\n if (state['default'] === null) return false;\n var data = dataBuffer.join();\n if (state.defaultBuffer === undefined) state.defaultBuffer = this._encodeValue(state['default'], reporter, parent).join();\n if (data.length !== state.defaultBuffer.length) return false;\n\n for (i = 0; i < data.length; i++) {\n if (data[i] !== state.defaultBuffer[i]) return false;\n }\n\n return true;\n}; // Utility methods\n\n\nfunction encodeTag(tag, primitive, cls, reporter) {\n var res;\n if (tag === 'seqof') tag = 'seq';else if (tag === 'setof') tag = 'set';\n if (der.tagByName.hasOwnProperty(tag)) res = der.tagByName[tag];else if (typeof tag === 'number' && (tag | 0) === tag) res = tag;else return reporter.error('Unknown tag: ' + tag);\n if (res >= 0x1f) return reporter.error('Multi-octet tag encoding unsupported');\n if (!primitive) res |= 0x20;\n res |= der.tagClassByName[cls || 'universal'] << 6;\n return res;\n}","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nfunction fromUtf8(input) {\n return new TextEncoder().encode(input);\n}\n\nexports.fromUtf8 = fromUtf8;\n\nfunction toUtf8(input) {\n return new TextDecoder(\"utf-8\").decode(input);\n}\n\nexports.toUtf8 = toUtf8;","'use strict';\n\nvar encoders = exports;\nencoders.der = require('./der');\nencoders.pem = require('./pem');","import _regeneratorRuntime from \"/codebuild/output/src1753007849/src/nepal/node_modules/babel-preset-gatsby/node_modules/@babel/runtime/regenerator\";\nimport _slicedToArray from \"/codebuild/output/src1753007849/src/nepal/node_modules/babel-preset-gatsby/node_modules/@babel/runtime/helpers/esm/slicedToArray\";\nimport \"regenerator-runtime/runtime\";\nimport _asyncToGenerator from \"/codebuild/output/src1753007849/src/nepal/node_modules/babel-preset-gatsby/node_modules/@babel/runtime/helpers/esm/asyncToGenerator\";\nimport _defineProperty from \"/codebuild/output/src1753007849/src/nepal/node_modules/babel-preset-gatsby/node_modules/@babel/runtime/helpers/esm/defineProperty\";\nimport _toConsumableArray from \"/codebuild/output/src1753007849/src/nepal/node_modules/babel-preset-gatsby/node_modules/@babel/runtime/helpers/esm/toConsumableArray\";\n\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nimport { isValidElement, useRef, useState, useCallback, useEffect, useMemo, createContext, useContext, createElement, cloneElement } from 'react';\n\nvar isHTMLElement = function isHTMLElement(value) {\n return value instanceof HTMLElement;\n};\n\nvar EVENTS = {\n BLUR: 'blur',\n CHANGE: 'change',\n INPUT: 'input'\n};\nvar VALIDATION_MODE = {\n onBlur: 'onBlur',\n onChange: 'onChange',\n onSubmit: 'onSubmit',\n onTouched: 'onTouched',\n all: 'all'\n};\nvar SELECT = 'select';\nvar UNDEFINED = 'undefined';\nvar INPUT_VALIDATION_RULES = {\n max: 'max',\n min: 'min',\n maxLength: 'maxLength',\n minLength: 'minLength',\n pattern: 'pattern',\n required: 'required',\n validate: 'validate'\n};\n\nfunction attachEventListeners(_ref, shouldAttachChangeEvent, handleChange) {\n var ref = _ref.ref;\n\n if (isHTMLElement(ref) && handleChange) {\n ref.addEventListener(shouldAttachChangeEvent ? EVENTS.CHANGE : EVENTS.INPUT, handleChange);\n ref.addEventListener(EVENTS.BLUR, handleChange);\n }\n}\n\nvar isNullOrUndefined = function isNullOrUndefined(value) {\n return value == null;\n};\n\nvar isObjectType = function isObjectType(value) {\n return typeof value === 'object';\n};\n\nvar isObject = function isObject(value) {\n return !isNullOrUndefined(value) && !Array.isArray(value) && isObjectType(value) && !(value instanceof Date);\n};\n\nvar isKey = function isKey(value) {\n return /^\\w*$/.test(value);\n};\n\nvar compact = function compact(value) {\n return value.filter(Boolean);\n};\n\nvar stringToPath = function stringToPath(input) {\n return compact(input.replace(/[\"|']/g, '').replace(/\\[/g, '.').replace(/\\]/g, '').split('.'));\n};\n\nfunction set(object, path, value) {\n var index = -1;\n var tempPath = isKey(path) ? [path] : stringToPath(path);\n var length = tempPath.length;\n var lastIndex = length - 1;\n\n while (++index < length) {\n var key = tempPath[index];\n var newValue = value;\n\n if (index !== lastIndex) {\n var objValue = object[key];\n newValue = isObject(objValue) || Array.isArray(objValue) ? objValue : !isNaN(+tempPath[index + 1]) ? [] : {};\n }\n\n object[key] = newValue;\n object = object[key];\n }\n\n return object;\n}\n\nvar transformToNestObject = function transformToNestObject(data) {\n var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n for (var key in data) {\n !isKey(key) ? set(value, key, data[key]) : value[key] = data[key];\n }\n\n return value;\n};\n\nvar isUndefined = function isUndefined(val) {\n return val === undefined;\n};\n\nvar _get = function get() {\n var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var path = arguments.length > 1 ? arguments[1] : undefined;\n var defaultValue = arguments.length > 2 ? arguments[2] : undefined;\n var result = compact(path.split(/[,[\\].]+?/)).reduce(function (result, key) {\n return isNullOrUndefined(result) ? result : result[key];\n }, obj);\n return isUndefined(result) || result === obj ? isUndefined(obj[path]) ? defaultValue : obj[path] : result;\n};\n\nvar focusOnErrorField = function focusOnErrorField(fields, fieldErrors) {\n for (var key in fields) {\n if (_get(fieldErrors, key)) {\n var field = fields[key];\n\n if (field) {\n if (field.ref.focus && isUndefined(field.ref.focus())) {\n break;\n } else if (field.options) {\n field.options[0].ref.focus();\n break;\n }\n }\n }\n }\n};\n\nvar removeAllEventListeners = function removeAllEventListeners(ref, validateWithStateUpdate) {\n if (isHTMLElement(ref) && ref.removeEventListener) {\n ref.removeEventListener(EVENTS.INPUT, validateWithStateUpdate);\n ref.removeEventListener(EVENTS.CHANGE, validateWithStateUpdate);\n ref.removeEventListener(EVENTS.BLUR, validateWithStateUpdate);\n }\n};\n\nvar defaultReturn = {\n isValid: false,\n value: null\n};\n\nvar getRadioValue = function getRadioValue(options) {\n return Array.isArray(options) ? options.reduce(function (previous, option) {\n return option && option.ref.checked ? {\n isValid: true,\n value: option.ref.value\n } : previous;\n }, defaultReturn) : defaultReturn;\n};\n\nvar getMultipleSelectValue = function getMultipleSelectValue(options) {\n return _toConsumableArray(options).filter(function (_ref2) {\n var selected = _ref2.selected;\n return selected;\n }).map(function (_ref3) {\n var value = _ref3.value;\n return value;\n });\n};\n\nvar isRadioInput = function isRadioInput(element) {\n return element.type === 'radio';\n};\n\nvar isFileInput = function isFileInput(element) {\n return element.type === 'file';\n};\n\nvar isCheckBoxInput = function isCheckBoxInput(element) {\n return element.type === 'checkbox';\n};\n\nvar isMultipleSelect = function isMultipleSelect(element) {\n return element.type === \"\".concat(SELECT, \"-multiple\");\n};\n\nvar defaultResult = {\n value: false,\n isValid: false\n};\nvar validResult = {\n value: true,\n isValid: true\n};\n\nvar getCheckboxValue = function getCheckboxValue(options) {\n if (Array.isArray(options)) {\n if (options.length > 1) {\n var values = options.filter(function (option) {\n return option && option.ref.checked;\n }).map(function (_ref4) {\n var value = _ref4.ref.value;\n return value;\n });\n return {\n value: values,\n isValid: !!values.length\n };\n }\n\n var _options$0$ref = options[0].ref,\n checked = _options$0$ref.checked,\n value = _options$0$ref.value,\n attributes = _options$0$ref.attributes;\n return checked ? attributes && !isUndefined(attributes.value) ? isUndefined(value) || value === '' ? validResult : {\n value: value,\n isValid: true\n } : validResult : defaultResult;\n }\n\n return defaultResult;\n};\n\nfunction getFieldValue(fieldsRef, name, shallowFieldsStateRef, excludeDisabled, shouldKeepRawValue) {\n var field = fieldsRef.current[name];\n\n if (field) {\n var _field$ref = field.ref,\n value = _field$ref.value,\n disabled = _field$ref.disabled,\n ref = field.ref,\n valueAsNumber = field.valueAsNumber,\n valueAsDate = field.valueAsDate,\n setValueAs = field.setValueAs;\n\n if (disabled && excludeDisabled) {\n return;\n }\n\n if (isFileInput(ref)) {\n return ref.files;\n }\n\n if (isRadioInput(ref)) {\n return getRadioValue(field.options).value;\n }\n\n if (isMultipleSelect(ref)) {\n return getMultipleSelectValue(ref.options);\n }\n\n if (isCheckBoxInput(ref)) {\n return getCheckboxValue(field.options).value;\n }\n\n return shouldKeepRawValue ? value : valueAsNumber ? value === '' ? NaN : +value : valueAsDate ? ref.valueAsDate : setValueAs ? setValueAs(value) : value;\n }\n\n if (shallowFieldsStateRef) {\n return _get(shallowFieldsStateRef.current, name);\n }\n}\n\nfunction isDetached(element) {\n if (!element) {\n return true;\n }\n\n if (!(element instanceof HTMLElement) || element.nodeType === Node.DOCUMENT_NODE) {\n return false;\n }\n\n return isDetached(element.parentNode);\n}\n\nvar isEmptyObject = function isEmptyObject(value) {\n return isObject(value) && !Object.keys(value).length;\n};\n\nvar isBoolean = function isBoolean(value) {\n return typeof value === 'boolean';\n};\n\nfunction baseGet(object, updatePath) {\n var length = updatePath.slice(0, -1).length;\n var index = 0;\n\n while (index < length) {\n object = isUndefined(object) ? index++ : object[updatePath[index++]];\n }\n\n return object;\n}\n\nfunction unset(object, path) {\n var updatePath = isKey(path) ? [path] : stringToPath(path);\n var childObject = updatePath.length == 1 ? object : baseGet(object, updatePath);\n var key = updatePath[updatePath.length - 1];\n var previousObjRef;\n\n if (childObject) {\n delete childObject[key];\n }\n\n for (var k = 0; k < updatePath.slice(0, -1).length; k++) {\n var index = -1;\n var objectRef = void 0;\n var currentPaths = updatePath.slice(0, -(k + 1));\n var currentPathsLength = currentPaths.length - 1;\n\n if (k > 0) {\n previousObjRef = object;\n }\n\n while (++index < currentPaths.length) {\n var item = currentPaths[index];\n objectRef = objectRef ? objectRef[item] : object[item];\n\n if (currentPathsLength === index && (isObject(objectRef) && isEmptyObject(objectRef) || Array.isArray(objectRef) && !objectRef.filter(function (data) {\n return isObject(data) && !isEmptyObject(data) || isBoolean(data);\n }).length)) {\n previousObjRef ? delete previousObjRef[item] : delete object[item];\n }\n\n previousObjRef = objectRef;\n }\n }\n\n return object;\n}\n\nvar isSameRef = function isSameRef(fieldValue, ref) {\n return fieldValue && fieldValue.ref === ref;\n};\n\nfunction findRemovedFieldAndRemoveListener(fieldsRef, handleChange, field, shallowFieldsStateRef, shouldUnregister, forceDelete) {\n var ref = field.ref,\n name = field.ref.name;\n var fieldRef = fieldsRef.current[name];\n\n if (!shouldUnregister) {\n var value = getFieldValue(fieldsRef, name, shallowFieldsStateRef);\n !isUndefined(value) && set(shallowFieldsStateRef.current, name, value);\n }\n\n if (!ref.type || !fieldRef) {\n delete fieldsRef.current[name];\n return;\n }\n\n if (isRadioInput(ref) || isCheckBoxInput(ref)) {\n if (Array.isArray(fieldRef.options) && fieldRef.options.length) {\n compact(fieldRef.options).forEach(function () {\n var option = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var index = arguments.length > 1 ? arguments[1] : undefined;\n\n if (isDetached(option.ref) && isSameRef(option, option.ref) || forceDelete) {\n removeAllEventListeners(option.ref, handleChange);\n unset(fieldRef.options, \"[\".concat(index, \"]\"));\n }\n });\n\n if (fieldRef.options && !compact(fieldRef.options).length) {\n delete fieldsRef.current[name];\n }\n } else {\n delete fieldsRef.current[name];\n }\n } else if (isDetached(ref) && isSameRef(fieldRef, ref) || forceDelete) {\n removeAllEventListeners(ref, handleChange);\n delete fieldsRef.current[name];\n }\n}\n\nvar isPrimitive = function isPrimitive(value) {\n return isNullOrUndefined(value) || !isObjectType(value);\n};\n\nfunction deepMerge(target, source) {\n if (isPrimitive(target) || isPrimitive(source)) {\n return source;\n }\n\n for (var key in source) {\n var targetValue = target[key];\n var sourceValue = source[key];\n\n try {\n target[key] = isObject(targetValue) && isObject(sourceValue) || Array.isArray(targetValue) && Array.isArray(sourceValue) ? deepMerge(targetValue, sourceValue) : sourceValue;\n } catch (_a) {}\n }\n\n return target;\n}\n\nfunction deepEqual(object1, object2, isErrorObject) {\n if (isPrimitive(object1) || isPrimitive(object2) || object1 instanceof Date || object2 instanceof Date) {\n return object1 === object2;\n }\n\n if (!isValidElement(object1)) {\n var keys1 = Object.keys(object1);\n var keys2 = Object.keys(object2);\n\n if (keys1.length !== keys2.length) {\n return false;\n }\n\n for (var _i = 0, _keys = keys1; _i < _keys.length; _i++) {\n var key = _keys[_i];\n var val1 = object1[key];\n\n if (!(isErrorObject && key === 'ref')) {\n var val2 = object2[key];\n\n if ((isObject(val1) || Array.isArray(val1)) && (isObject(val2) || Array.isArray(val2)) ? !deepEqual(val1, val2, isErrorObject) : val1 !== val2) {\n return false;\n }\n }\n }\n }\n\n return true;\n}\n\nfunction setDirtyFields(values, defaultValues, dirtyFields, parentNode, parentName) {\n var index = -1;\n\n while (++index < values.length) {\n for (var key in values[index]) {\n if (Array.isArray(values[index][key])) {\n !dirtyFields[index] && (dirtyFields[index] = {});\n dirtyFields[index][key] = [];\n setDirtyFields(values[index][key], _get(defaultValues[index] || {}, key, []), dirtyFields[index][key], dirtyFields[index], key);\n } else {\n deepEqual(_get(defaultValues[index] || {}, key), values[index][key]) ? set(dirtyFields[index] || {}, key) : dirtyFields[index] = Object.assign(Object.assign({}, dirtyFields[index]), _defineProperty({}, key, true));\n }\n }\n\n parentNode && !dirtyFields.length && delete parentNode[parentName];\n }\n\n return dirtyFields;\n}\n\nvar setFieldArrayDirtyFields = function setFieldArrayDirtyFields(values, defaultValues, dirtyFields) {\n return deepMerge(setDirtyFields(values, defaultValues, dirtyFields.slice(0, values.length)), setDirtyFields(defaultValues, values, dirtyFields.slice(0, values.length)));\n};\n\nvar isString = function isString(value) {\n return typeof value === 'string';\n};\n\nvar getFieldsValues = function getFieldsValues(fieldsRef, shallowFieldsState, shouldUnregister, excludeDisabled, search) {\n var output = {};\n\n var _loop = function _loop(name) {\n if (isUndefined(search) || (isString(search) ? name.startsWith(search) : Array.isArray(search) && search.find(function (data) {\n return name.startsWith(data);\n }))) {\n output[name] = getFieldValue(fieldsRef, name, undefined, excludeDisabled);\n }\n };\n\n for (var name in fieldsRef.current) {\n _loop(name);\n }\n\n return shouldUnregister ? transformToNestObject(output) : deepMerge(shallowFieldsState, transformToNestObject(output));\n};\n\nvar isErrorStateChanged = function isErrorStateChanged(_ref5) {\n var errors = _ref5.errors,\n name = _ref5.name,\n error = _ref5.error,\n validFields = _ref5.validFields,\n fieldsWithValidation = _ref5.fieldsWithValidation;\n var isValid = isUndefined(error);\n\n var previousError = _get(errors, name);\n\n return isValid && !!previousError || !isValid && !deepEqual(previousError, error, true) || isValid && _get(fieldsWithValidation, name) && !_get(validFields, name);\n};\n\nvar isRegex = function isRegex(value) {\n return value instanceof RegExp;\n};\n\nvar getValueAndMessage = function getValueAndMessage(validationData) {\n return isObject(validationData) && !isRegex(validationData) ? validationData : {\n value: validationData,\n message: ''\n };\n};\n\nvar isFunction = function isFunction(value) {\n return typeof value === 'function';\n};\n\nvar isMessage = function isMessage(value) {\n return isString(value) || isValidElement(value);\n};\n\nfunction getValidateError(result, ref) {\n var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'validate';\n\n if (isMessage(result) || isBoolean(result) && !result) {\n return {\n type: type,\n message: isMessage(result) ? result : '',\n ref: ref\n };\n }\n}\n\nvar appendErrors = function appendErrors(name, validateAllFieldCriteria, errors, type, message) {\n return validateAllFieldCriteria ? Object.assign(Object.assign({}, errors[name]), {\n types: Object.assign(Object.assign({}, errors[name] && errors[name].types ? errors[name].types : {}), _defineProperty({}, type, message || true))\n }) : {};\n};\n\nvar validateField = /*#__PURE__*/function () {\n var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(fieldsRef, validateAllFieldCriteria, _ref6, shallowFieldsStateRef) {\n var ref, value, options, required, maxLength, minLength, min, max, pattern, validate, name, error, isRadio, isCheckBox, isRadioOrCheckbox, isEmpty, appendErrorsCurry, getMinMaxMessage, _ref8, _value, message, exceedMax, exceedMin, maxOutput, minOutput, valueNumber, valueDate, maxLengthOutput, minLengthOutput, _exceedMax, _exceedMin, _getValueAndMessage, patternValue, _message, fieldValue, validateRef, result, validateError, validationResult, _i2, _Object$entries, _Object$entries$_i, key, validateFunction, validateResult, _validateError;\n\n return _regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n ref = _ref6.ref, value = _ref6.ref.value, options = _ref6.options, required = _ref6.required, maxLength = _ref6.maxLength, minLength = _ref6.minLength, min = _ref6.min, max = _ref6.max, pattern = _ref6.pattern, validate = _ref6.validate;\n name = ref.name;\n error = {};\n isRadio = isRadioInput(ref);\n isCheckBox = isCheckBoxInput(ref);\n isRadioOrCheckbox = isRadio || isCheckBox;\n isEmpty = value === '';\n appendErrorsCurry = appendErrors.bind(null, name, validateAllFieldCriteria, error);\n\n getMinMaxMessage = function getMinMaxMessage(exceedMax, maxLengthMessage, minLengthMessage) {\n var maxType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : INPUT_VALIDATION_RULES.maxLength;\n var minType = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : INPUT_VALIDATION_RULES.minLength;\n var message = exceedMax ? maxLengthMessage : minLengthMessage;\n error[name] = Object.assign({\n type: exceedMax ? maxType : minType,\n message: message,\n ref: ref\n }, exceedMax ? appendErrorsCurry(maxType, message) : appendErrorsCurry(minType, message));\n };\n\n if (!(required && (!isRadio && !isCheckBox && (isEmpty || isNullOrUndefined(value)) || isBoolean(value) && !value || isCheckBox && !getCheckboxValue(options).isValid || isRadio && !getRadioValue(options).isValid))) {\n _context.next = 15;\n break;\n }\n\n _ref8 = isMessage(required) ? {\n value: !!required,\n message: required\n } : getValueAndMessage(required), _value = _ref8.value, message = _ref8.message;\n\n if (!_value) {\n _context.next = 15;\n break;\n }\n\n error[name] = Object.assign({\n type: INPUT_VALIDATION_RULES.required,\n message: message,\n ref: isRadioOrCheckbox ? ((fieldsRef.current[name].options || [])[0] || {}).ref : ref\n }, appendErrorsCurry(INPUT_VALIDATION_RULES.required, message));\n\n if (validateAllFieldCriteria) {\n _context.next = 15;\n break;\n }\n\n return _context.abrupt(\"return\", error);\n\n case 15:\n if (!((!isNullOrUndefined(min) || !isNullOrUndefined(max)) && value !== '')) {\n _context.next = 23;\n break;\n }\n\n maxOutput = getValueAndMessage(max);\n minOutput = getValueAndMessage(min);\n\n if (!isNaN(value)) {\n valueNumber = ref.valueAsNumber || parseFloat(value);\n\n if (!isNullOrUndefined(maxOutput.value)) {\n exceedMax = valueNumber > maxOutput.value;\n }\n\n if (!isNullOrUndefined(minOutput.value)) {\n exceedMin = valueNumber < minOutput.value;\n }\n } else {\n valueDate = ref.valueAsDate || new Date(value);\n\n if (isString(maxOutput.value)) {\n exceedMax = valueDate > new Date(maxOutput.value);\n }\n\n if (isString(minOutput.value)) {\n exceedMin = valueDate < new Date(minOutput.value);\n }\n }\n\n if (!(exceedMax || exceedMin)) {\n _context.next = 23;\n break;\n }\n\n getMinMaxMessage(!!exceedMax, maxOutput.message, minOutput.message, INPUT_VALIDATION_RULES.max, INPUT_VALIDATION_RULES.min);\n\n if (validateAllFieldCriteria) {\n _context.next = 23;\n break;\n }\n\n return _context.abrupt(\"return\", error);\n\n case 23:\n if (!(isString(value) && !isEmpty && (maxLength || minLength))) {\n _context.next = 32;\n break;\n }\n\n maxLengthOutput = getValueAndMessage(maxLength);\n minLengthOutput = getValueAndMessage(minLength);\n _exceedMax = !isNullOrUndefined(maxLengthOutput.value) && value.length > maxLengthOutput.value;\n _exceedMin = !isNullOrUndefined(minLengthOutput.value) && value.length < minLengthOutput.value;\n\n if (!(_exceedMax || _exceedMin)) {\n _context.next = 32;\n break;\n }\n\n getMinMaxMessage(_exceedMax, maxLengthOutput.message, minLengthOutput.message);\n\n if (validateAllFieldCriteria) {\n _context.next = 32;\n break;\n }\n\n return _context.abrupt(\"return\", error);\n\n case 32:\n if (!(isString(value) && pattern && !isEmpty)) {\n _context.next = 38;\n break;\n }\n\n _getValueAndMessage = getValueAndMessage(pattern), patternValue = _getValueAndMessage.value, _message = _getValueAndMessage.message;\n\n if (!(isRegex(patternValue) && !patternValue.test(value))) {\n _context.next = 38;\n break;\n }\n\n error[name] = Object.assign({\n type: INPUT_VALIDATION_RULES.pattern,\n message: _message,\n ref: ref\n }, appendErrorsCurry(INPUT_VALIDATION_RULES.pattern, _message));\n\n if (validateAllFieldCriteria) {\n _context.next = 38;\n break;\n }\n\n return _context.abrupt(\"return\", error);\n\n case 38:\n if (!validate) {\n _context.next = 71;\n break;\n }\n\n fieldValue = getFieldValue(fieldsRef, name, shallowFieldsStateRef, false, true);\n validateRef = isRadioOrCheckbox && options ? options[0].ref : ref;\n\n if (!isFunction(validate)) {\n _context.next = 52;\n break;\n }\n\n _context.next = 44;\n return validate(fieldValue);\n\n case 44:\n result = _context.sent;\n validateError = getValidateError(result, validateRef);\n\n if (!validateError) {\n _context.next = 50;\n break;\n }\n\n error[name] = Object.assign(Object.assign({}, validateError), appendErrorsCurry(INPUT_VALIDATION_RULES.validate, validateError.message));\n\n if (validateAllFieldCriteria) {\n _context.next = 50;\n break;\n }\n\n return _context.abrupt(\"return\", error);\n\n case 50:\n _context.next = 71;\n break;\n\n case 52:\n if (!isObject(validate)) {\n _context.next = 71;\n break;\n }\n\n validationResult = {};\n _i2 = 0, _Object$entries = Object.entries(validate);\n\n case 55:\n if (!(_i2 < _Object$entries.length)) {\n _context.next = 67;\n break;\n }\n\n _Object$entries$_i = _slicedToArray(_Object$entries[_i2], 2), key = _Object$entries$_i[0], validateFunction = _Object$entries$_i[1];\n\n if (!(!isEmptyObject(validationResult) && !validateAllFieldCriteria)) {\n _context.next = 59;\n break;\n }\n\n return _context.abrupt(\"break\", 67);\n\n case 59:\n _context.next = 61;\n return validateFunction(fieldValue);\n\n case 61:\n validateResult = _context.sent;\n _validateError = getValidateError(validateResult, validateRef, key);\n\n if (_validateError) {\n validationResult = Object.assign(Object.assign({}, _validateError), appendErrorsCurry(key, _validateError.message));\n\n if (validateAllFieldCriteria) {\n error[name] = validationResult;\n }\n }\n\n case 64:\n _i2++;\n _context.next = 55;\n break;\n\n case 67:\n if (isEmptyObject(validationResult)) {\n _context.next = 71;\n break;\n }\n\n error[name] = Object.assign({\n ref: validateRef\n }, validationResult);\n\n if (validateAllFieldCriteria) {\n _context.next = 71;\n break;\n }\n\n return _context.abrupt(\"return\", error);\n\n case 71:\n return _context.abrupt(\"return\", error);\n\n case 72:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n\n return function validateField(_x, _x2, _x3, _x4) {\n return _ref7.apply(this, arguments);\n };\n}();\n\nvar getPath = function getPath(rootPath, values) {\n var paths = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];\n\n for (var property in values) {\n var rootName = rootPath + (isObject(values) ? \".\".concat(property) : \"[\".concat(property, \"]\"));\n isPrimitive(values[property]) ? paths.push(rootName) : getPath(rootName, values[property], paths);\n }\n\n return paths;\n};\n\nvar assignWatchFields = function assignWatchFields(fieldValues, fieldName, watchFields, inputValue, isSingleField) {\n var value = undefined;\n watchFields.add(fieldName);\n\n if (!isEmptyObject(fieldValues)) {\n value = _get(fieldValues, fieldName);\n\n if (isObject(value) || Array.isArray(value)) {\n getPath(fieldName, value).forEach(function (name) {\n return watchFields.add(name);\n });\n }\n }\n\n return isUndefined(value) ? isSingleField ? inputValue : _get(inputValue, fieldName) : value;\n};\n\nvar skipValidation = function skipValidation(_ref9) {\n var isOnBlur = _ref9.isOnBlur,\n isOnChange = _ref9.isOnChange,\n isOnTouch = _ref9.isOnTouch,\n isTouched = _ref9.isTouched,\n isReValidateOnBlur = _ref9.isReValidateOnBlur,\n isReValidateOnChange = _ref9.isReValidateOnChange,\n isBlurEvent = _ref9.isBlurEvent,\n isSubmitted = _ref9.isSubmitted,\n isOnAll = _ref9.isOnAll;\n\n if (isOnAll) {\n return false;\n } else if (!isSubmitted && isOnTouch) {\n return !(isTouched || isBlurEvent);\n } else if (isSubmitted ? isReValidateOnBlur : isOnBlur) {\n return !isBlurEvent;\n } else if (isSubmitted ? isReValidateOnChange : isOnChange) {\n return isBlurEvent;\n }\n\n return true;\n};\n\nvar getFieldArrayParentName = function getFieldArrayParentName(name) {\n return name.substring(0, name.indexOf('['));\n};\n\nvar isMatchFieldArrayName = function isMatchFieldArrayName(name, searchName) {\n return RegExp(\"^\".concat(searchName, \"([|.)\\\\d+\").replace(/\\[/g, '\\\\[').replace(/\\]/g, '\\\\]')).test(name);\n};\n\nvar isNameInFieldArray = function isNameInFieldArray(names, name) {\n return _toConsumableArray(names).some(function (current) {\n return isMatchFieldArrayName(name, current);\n });\n};\n\nvar isSelectInput = function isSelectInput(element) {\n return element.type === \"\".concat(SELECT, \"-one\");\n};\n\nfunction onDomRemove(fieldsRef, removeFieldEventListenerAndRef) {\n var observer = new MutationObserver(function () {\n for (var _i3 = 0, _Object$values = Object.values(fieldsRef.current); _i3 < _Object$values.length; _i3++) {\n var field = _Object$values[_i3];\n\n if (field && field.options) {\n var _iterator = _createForOfIteratorHelper(field.options),\n _step;\n\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var option = _step.value;\n\n if (option && option.ref && isDetached(option.ref)) {\n removeFieldEventListenerAndRef(field);\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n } else if (field && isDetached(field.ref)) {\n removeFieldEventListenerAndRef(field);\n }\n }\n });\n observer.observe(window.document, {\n childList: true,\n subtree: true\n });\n return observer;\n}\n\nvar isWeb = typeof window !== UNDEFINED && typeof document !== UNDEFINED;\n\nfunction cloneObject(data) {\n var _a;\n\n var copy;\n\n if (isPrimitive(data) || isWeb && (data instanceof File || isHTMLElement(data))) {\n return data;\n }\n\n if (!['Set', 'Map', 'Object', 'Date', 'Array'].includes((_a = data.constructor) === null || _a === void 0 ? void 0 : _a.name)) {\n return data;\n }\n\n if (data instanceof Date) {\n copy = new Date(data.getTime());\n return copy;\n }\n\n if (data instanceof Set) {\n copy = new Set();\n\n var _iterator2 = _createForOfIteratorHelper(data),\n _step2;\n\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var item = _step2.value;\n copy.add(item);\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n\n return copy;\n }\n\n if (data instanceof Map) {\n copy = new Map();\n\n var _iterator3 = _createForOfIteratorHelper(data.keys()),\n _step3;\n\n try {\n for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {\n var key = _step3.value;\n copy.set(key, cloneObject(data.get(key)));\n }\n } catch (err) {\n _iterator3.e(err);\n } finally {\n _iterator3.f();\n }\n\n return copy;\n }\n\n copy = Array.isArray(data) ? [] : {};\n\n for (var _key in data) {\n copy[_key] = cloneObject(data[_key]);\n }\n\n return copy;\n}\n\nvar modeChecker = function modeChecker(mode) {\n return {\n isOnSubmit: !mode || mode === VALIDATION_MODE.onSubmit,\n isOnBlur: mode === VALIDATION_MODE.onBlur,\n isOnChange: mode === VALIDATION_MODE.onChange,\n isOnAll: mode === VALIDATION_MODE.all,\n isOnTouch: mode === VALIDATION_MODE.onTouched\n };\n};\n\nvar isRadioOrCheckboxFunction = function isRadioOrCheckboxFunction(ref) {\n return isRadioInput(ref) || isCheckBoxInput(ref);\n};\n\nvar isWindowUndefined = typeof window === UNDEFINED;\nvar isProxyEnabled = isWeb ? 'Proxy' in window : typeof Proxy !== UNDEFINED;\n\nfunction useForm() {\n var _ref10 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n _ref10$mode = _ref10.mode,\n mode = _ref10$mode === void 0 ? VALIDATION_MODE.onSubmit : _ref10$mode,\n _ref10$reValidateMode = _ref10.reValidateMode,\n reValidateMode = _ref10$reValidateMode === void 0 ? VALIDATION_MODE.onChange : _ref10$reValidateMode,\n resolver = _ref10.resolver,\n context = _ref10.context,\n _ref10$defaultValues = _ref10.defaultValues,\n defaultValues = _ref10$defaultValues === void 0 ? {} : _ref10$defaultValues,\n _ref10$shouldFocusErr = _ref10.shouldFocusError,\n shouldFocusError = _ref10$shouldFocusErr === void 0 ? true : _ref10$shouldFocusErr,\n _ref10$shouldUnregist = _ref10.shouldUnregister,\n shouldUnregister = _ref10$shouldUnregist === void 0 ? true : _ref10$shouldUnregist,\n criteriaMode = _ref10.criteriaMode;\n\n var fieldsRef = useRef({});\n var fieldArrayDefaultValuesRef = useRef({});\n var fieldArrayValuesRef = useRef({});\n var watchFieldsRef = useRef(new Set());\n var useWatchFieldsRef = useRef({});\n var useWatchRenderFunctionsRef = useRef({});\n var fieldsWithValidationRef = useRef({});\n var validFieldsRef = useRef({});\n var defaultValuesRef = useRef(defaultValues);\n var isUnMount = useRef(false);\n var isWatchAllRef = useRef(false);\n var handleChangeRef = useRef();\n var shallowFieldsStateRef = useRef({});\n var resetFieldArrayFunctionRef = useRef({});\n var contextRef = useRef(context);\n var resolverRef = useRef(resolver);\n var fieldArrayNamesRef = useRef(new Set());\n var modeRef = useRef(modeChecker(mode));\n var _modeRef$current = modeRef.current,\n isOnSubmit = _modeRef$current.isOnSubmit,\n isOnTouch = _modeRef$current.isOnTouch;\n var isValidateAllFieldCriteria = criteriaMode === VALIDATION_MODE.all;\n\n var _useState = useState({\n isDirty: false,\n isValidating: false,\n dirtyFields: {},\n isSubmitted: false,\n submitCount: 0,\n touched: {},\n isSubmitting: false,\n isSubmitSuccessful: false,\n isValid: !isOnSubmit,\n errors: {}\n }),\n _useState2 = _slicedToArray(_useState, 2),\n formState = _useState2[0],\n setFormState = _useState2[1];\n\n var readFormStateRef = useRef({\n isDirty: !isProxyEnabled,\n dirtyFields: !isProxyEnabled,\n touched: !isProxyEnabled || isOnTouch,\n isValidating: !isProxyEnabled,\n isSubmitting: !isProxyEnabled,\n isValid: !isProxyEnabled\n });\n var formStateRef = useRef(formState);\n var observerRef = useRef();\n var _useRef$current = useRef(modeChecker(reValidateMode)).current,\n isReValidateOnBlur = _useRef$current.isOnBlur,\n isReValidateOnChange = _useRef$current.isOnChange;\n contextRef.current = context;\n resolverRef.current = resolver;\n formStateRef.current = formState;\n shallowFieldsStateRef.current = shouldUnregister ? {} : isEmptyObject(shallowFieldsStateRef.current) ? cloneObject(defaultValues) : shallowFieldsStateRef.current;\n var updateFormState = useCallback(function () {\n var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (!isUnMount.current) {\n formStateRef.current = Object.assign(Object.assign({}, formStateRef.current), state);\n setFormState(formStateRef.current);\n }\n }, []);\n\n var updateIsValidating = function updateIsValidating() {\n return readFormStateRef.current.isValidating && updateFormState({\n isValidating: true\n });\n };\n\n var shouldRenderBaseOnError = useCallback(function (name, error) {\n var shouldRender = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n var state = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n var isValid = arguments.length > 4 ? arguments[4] : undefined;\n var shouldReRender = shouldRender || isErrorStateChanged({\n errors: formStateRef.current.errors,\n error: error,\n name: name,\n validFields: validFieldsRef.current,\n fieldsWithValidation: fieldsWithValidationRef.current\n });\n\n var previousError = _get(formStateRef.current.errors, name);\n\n if (error) {\n unset(validFieldsRef.current, name);\n shouldReRender = shouldReRender || !previousError || !deepEqual(previousError, error, true);\n set(formStateRef.current.errors, name, error);\n } else {\n if (_get(fieldsWithValidationRef.current, name) || resolverRef.current) {\n set(validFieldsRef.current, name, true);\n shouldReRender = shouldReRender || previousError;\n }\n\n unset(formStateRef.current.errors, name);\n }\n\n if (shouldReRender && !isNullOrUndefined(shouldRender) || !isEmptyObject(state) || readFormStateRef.current.isValidating) {\n updateFormState(Object.assign(Object.assign(Object.assign({}, state), resolverRef.current ? {\n isValid: !!isValid\n } : {}), {\n isValidating: false\n }));\n }\n }, []);\n var setFieldValue = useCallback(function (name, rawValue) {\n var _fieldsRef$current$na = fieldsRef.current[name],\n ref = _fieldsRef$current$na.ref,\n options = _fieldsRef$current$na.options;\n var value = isWeb && isHTMLElement(ref) && isNullOrUndefined(rawValue) ? '' : rawValue;\n\n if (isRadioInput(ref)) {\n (options || []).forEach(function (_ref11) {\n var radioRef = _ref11.ref;\n return radioRef.checked = radioRef.value === value;\n });\n } else if (isFileInput(ref) && !isString(value)) {\n ref.files = value;\n } else if (isMultipleSelect(ref)) {\n _toConsumableArray(ref.options).forEach(function (selectRef) {\n return selectRef.selected = value.includes(selectRef.value);\n });\n } else if (isCheckBoxInput(ref) && options) {\n options.length > 1 ? options.forEach(function (_ref12) {\n var checkboxRef = _ref12.ref;\n return checkboxRef.checked = Array.isArray(value) ? !!value.find(function (data) {\n return data === checkboxRef.value;\n }) : value === checkboxRef.value;\n }) : options[0].ref.checked = !!value;\n } else {\n ref.value = value;\n }\n }, []);\n var isFormDirty = useCallback(function (name, data) {\n if (readFormStateRef.current.isDirty) {\n var formValues = getValues();\n name && data && set(formValues, name, data);\n return !deepEqual(formValues, defaultValuesRef.current);\n }\n\n return false;\n }, []);\n var updateAndGetDirtyState = useCallback(function (name) {\n var shouldRender = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n\n if (readFormStateRef.current.isDirty || readFormStateRef.current.dirtyFields) {\n var isFieldDirty = !deepEqual(_get(defaultValuesRef.current, name), getFieldValue(fieldsRef, name, shallowFieldsStateRef));\n\n var isDirtyFieldExist = _get(formStateRef.current.dirtyFields, name);\n\n var previousIsDirty = formStateRef.current.isDirty;\n isFieldDirty ? set(formStateRef.current.dirtyFields, name, true) : unset(formStateRef.current.dirtyFields, name);\n var state = {\n isDirty: isFormDirty(),\n dirtyFields: formStateRef.current.dirtyFields\n };\n\n var isChanged = readFormStateRef.current.isDirty && previousIsDirty !== state.isDirty || readFormStateRef.current.dirtyFields && isDirtyFieldExist !== _get(formStateRef.current.dirtyFields, name);\n\n isChanged && shouldRender && updateFormState(state);\n return isChanged ? state : {};\n }\n\n return {};\n }, []);\n var executeValidation = useCallback( /*#__PURE__*/function () {\n var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(name, skipReRender) {\n var error;\n return _regeneratorRuntime.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n if (!(process.env.NODE_ENV !== 'production')) {\n _context2.next = 4;\n break;\n }\n\n if (fieldsRef.current[name]) {\n _context2.next = 4;\n break;\n }\n\n console.warn('📋 Field is missing with `name` attribute: ', name);\n return _context2.abrupt(\"return\", false);\n\n case 4:\n _context2.next = 6;\n return validateField(fieldsRef, isValidateAllFieldCriteria, fieldsRef.current[name], shallowFieldsStateRef);\n\n case 6:\n _context2.t0 = name;\n error = _context2.sent[_context2.t0];\n shouldRenderBaseOnError(name, error, skipReRender);\n return _context2.abrupt(\"return\", isUndefined(error));\n\n case 10:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n\n return function (_x5, _x6) {\n return _ref13.apply(this, arguments);\n };\n }(), [shouldRenderBaseOnError, isValidateAllFieldCriteria]);\n var executeSchemaOrResolverValidation = useCallback( /*#__PURE__*/function () {\n var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(names) {\n var _yield$resolverRef$cu, errors, previousFormIsValid, isInputsValid, _error;\n\n return _regeneratorRuntime.wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n _context3.next = 2;\n return resolverRef.current(getValues(), contextRef.current, isValidateAllFieldCriteria);\n\n case 2:\n _yield$resolverRef$cu = _context3.sent;\n errors = _yield$resolverRef$cu.errors;\n previousFormIsValid = formStateRef.current.isValid;\n\n if (!Array.isArray(names)) {\n _context3.next = 11;\n break;\n }\n\n isInputsValid = names.map(function (name) {\n var error = _get(errors, name);\n\n error ? set(formStateRef.current.errors, name, error) : unset(formStateRef.current.errors, name);\n return !error;\n }).every(Boolean);\n updateFormState({\n isValid: isEmptyObject(errors),\n isValidating: false\n });\n return _context3.abrupt(\"return\", isInputsValid);\n\n case 11:\n _error = _get(errors, names);\n shouldRenderBaseOnError(names, _error, previousFormIsValid !== isEmptyObject(errors), {}, isEmptyObject(errors));\n return _context3.abrupt(\"return\", !_error);\n\n case 14:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n\n return function (_x7) {\n return _ref14.apply(this, arguments);\n };\n }(), [shouldRenderBaseOnError, isValidateAllFieldCriteria]);\n var trigger = useCallback( /*#__PURE__*/function () {\n var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(name) {\n var fields, result;\n return _regeneratorRuntime.wrap(function _callee5$(_context5) {\n while (1) {\n switch (_context5.prev = _context5.next) {\n case 0:\n fields = name || Object.keys(fieldsRef.current);\n updateIsValidating();\n\n if (!resolverRef.current) {\n _context5.next = 4;\n break;\n }\n\n return _context5.abrupt(\"return\", executeSchemaOrResolverValidation(fields));\n\n case 4:\n if (!Array.isArray(fields)) {\n _context5.next = 11;\n break;\n }\n\n !name && (formStateRef.current.errors = {});\n _context5.next = 8;\n return Promise.all(fields.map( /*#__PURE__*/function () {\n var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data) {\n return _regeneratorRuntime.wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n _context4.next = 2;\n return executeValidation(data, null);\n\n case 2:\n return _context4.abrupt(\"return\", _context4.sent);\n\n case 3:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n\n return function (_x9) {\n return _ref16.apply(this, arguments);\n };\n }()));\n\n case 8:\n result = _context5.sent;\n updateFormState({\n isValidating: false\n });\n return _context5.abrupt(\"return\", result.every(Boolean));\n\n case 11:\n _context5.next = 13;\n return executeValidation(fields);\n\n case 13:\n return _context5.abrupt(\"return\", _context5.sent);\n\n case 14:\n case \"end\":\n return _context5.stop();\n }\n }\n }, _callee5);\n }));\n\n return function (_x8) {\n return _ref15.apply(this, arguments);\n };\n }(), [executeSchemaOrResolverValidation, executeValidation]);\n var setInternalValues = useCallback(function (name, value, _ref17) {\n var shouldDirty = _ref17.shouldDirty,\n shouldValidate = _ref17.shouldValidate;\n var data = {};\n set(data, name, value);\n\n var _iterator4 = _createForOfIteratorHelper(getPath(name, value)),\n _step4;\n\n try {\n for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {\n var fieldName = _step4.value;\n\n if (fieldsRef.current[fieldName]) {\n setFieldValue(fieldName, _get(data, fieldName));\n shouldDirty && updateAndGetDirtyState(fieldName);\n shouldValidate && trigger(fieldName);\n }\n }\n } catch (err) {\n _iterator4.e(err);\n } finally {\n _iterator4.f();\n }\n }, [trigger, setFieldValue, updateAndGetDirtyState]);\n var setInternalValue = useCallback(function (name, value, config) {\n !shouldUnregister && !isPrimitive(value) && set(shallowFieldsStateRef.current, name, Array.isArray(value) ? _toConsumableArray(value) : Object.assign({}, value));\n\n if (fieldsRef.current[name]) {\n setFieldValue(name, value);\n config.shouldDirty && updateAndGetDirtyState(name);\n config.shouldValidate && trigger(name);\n } else if (!isPrimitive(value)) {\n setInternalValues(name, value, config);\n\n if (fieldArrayNamesRef.current.has(name)) {\n var parentName = getFieldArrayParentName(name) || name;\n set(fieldArrayDefaultValuesRef.current, name, value);\n resetFieldArrayFunctionRef.current[parentName](_defineProperty({}, parentName, _get(fieldArrayDefaultValuesRef.current, parentName)));\n\n if ((readFormStateRef.current.isDirty || readFormStateRef.current.dirtyFields) && config.shouldDirty) {\n set(formStateRef.current.dirtyFields, name, setFieldArrayDirtyFields(value, _get(defaultValuesRef.current, name, []), _get(formStateRef.current.dirtyFields, name, [])));\n updateFormState({\n isDirty: !deepEqual(Object.assign(Object.assign({}, getValues()), _defineProperty({}, name, value)), defaultValuesRef.current)\n });\n }\n }\n }\n\n !shouldUnregister && set(shallowFieldsStateRef.current, name, value);\n }, [updateAndGetDirtyState, setFieldValue, setInternalValues]);\n\n var isFieldWatched = function isFieldWatched(name) {\n return isWatchAllRef.current || watchFieldsRef.current.has(name) || watchFieldsRef.current.has((name.match(/\\w+/) || [])[0]);\n };\n\n var renderWatchedInputs = function renderWatchedInputs(name) {\n var found = true;\n\n if (!isEmptyObject(useWatchFieldsRef.current)) {\n for (var key in useWatchFieldsRef.current) {\n if (!name || !useWatchFieldsRef.current[key].size || useWatchFieldsRef.current[key].has(name) || useWatchFieldsRef.current[key].has(getFieldArrayParentName(name))) {\n useWatchRenderFunctionsRef.current[key]();\n found = false;\n }\n }\n }\n\n return found;\n };\n\n function setValue(name, value, config) {\n setInternalValue(name, value, config || {});\n isFieldWatched(name) && updateFormState();\n renderWatchedInputs(name);\n }\n\n handleChangeRef.current = handleChangeRef.current ? handleChangeRef.current : /*#__PURE__*/function () {\n var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref18) {\n var type, target, name, field, error, isValid, isBlurEvent, shouldSkipValidation, state, shouldRender, _yield$resolverRef$cu2, errors, previousFormIsValid, parentNodeName, currentError;\n\n return _regeneratorRuntime.wrap(function _callee6$(_context6) {\n while (1) {\n switch (_context6.prev = _context6.next) {\n case 0:\n type = _ref18.type, target = _ref18.target;\n name = target.name;\n field = fieldsRef.current[name];\n\n if (!field) {\n _context6.next = 32;\n break;\n }\n\n isBlurEvent = type === EVENTS.BLUR;\n shouldSkipValidation = skipValidation(Object.assign({\n isBlurEvent: isBlurEvent,\n isReValidateOnChange: isReValidateOnChange,\n isReValidateOnBlur: isReValidateOnBlur,\n isTouched: !!_get(formStateRef.current.touched, name),\n isSubmitted: formStateRef.current.isSubmitted\n }, modeRef.current));\n state = updateAndGetDirtyState(name, false);\n shouldRender = !isEmptyObject(state) || !isBlurEvent && isFieldWatched(name);\n\n if (isBlurEvent && !_get(formStateRef.current.touched, name) && readFormStateRef.current.touched) {\n set(formStateRef.current.touched, name, true);\n state = Object.assign(Object.assign({}, state), {\n touched: formStateRef.current.touched\n });\n }\n\n if (!shouldUnregister && isCheckBoxInput(target)) {\n set(shallowFieldsStateRef.current, name, getFieldValue(fieldsRef, name));\n }\n\n if (!shouldSkipValidation) {\n _context6.next = 13;\n break;\n }\n\n !isBlurEvent && renderWatchedInputs(name);\n return _context6.abrupt(\"return\", (!isEmptyObject(state) || shouldRender && isEmptyObject(state)) && updateFormState(state));\n\n case 13:\n updateIsValidating();\n\n if (!resolverRef.current) {\n _context6.next = 26;\n break;\n }\n\n _context6.next = 17;\n return resolverRef.current(getValues(), contextRef.current, isValidateAllFieldCriteria);\n\n case 17:\n _yield$resolverRef$cu2 = _context6.sent;\n errors = _yield$resolverRef$cu2.errors;\n previousFormIsValid = formStateRef.current.isValid;\n error = _get(errors, name);\n\n if (isCheckBoxInput(target) && !error && resolverRef.current) {\n parentNodeName = getFieldArrayParentName(name);\n currentError = _get(errors, parentNodeName, {});\n currentError.type && currentError.message && (error = currentError);\n\n if (parentNodeName && (currentError || _get(formStateRef.current.errors, parentNodeName))) {\n name = parentNodeName;\n }\n }\n\n isValid = isEmptyObject(errors);\n previousFormIsValid !== isValid && (shouldRender = true);\n _context6.next = 30;\n break;\n\n case 26:\n _context6.next = 28;\n return validateField(fieldsRef, isValidateAllFieldCriteria, field, shallowFieldsStateRef);\n\n case 28:\n _context6.t0 = name;\n error = _context6.sent[_context6.t0];\n\n case 30:\n !isBlurEvent && renderWatchedInputs(name);\n shouldRenderBaseOnError(name, error, shouldRender, state, isValid);\n\n case 32:\n case \"end\":\n return _context6.stop();\n }\n }\n }, _callee6);\n }));\n\n return function (_x10) {\n return _ref19.apply(this, arguments);\n };\n }();\n\n function setFieldArrayDefaultValues(data) {\n if (!shouldUnregister) {\n var copy = cloneObject(data);\n\n var _iterator5 = _createForOfIteratorHelper(fieldArrayNamesRef.current),\n _step5;\n\n try {\n for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {\n var value = _step5.value;\n\n if (isKey(value) && !copy[value]) {\n copy = Object.assign(Object.assign({}, copy), _defineProperty({}, value, []));\n }\n }\n } catch (err) {\n _iterator5.e(err);\n } finally {\n _iterator5.f();\n }\n\n return copy;\n }\n\n return data;\n }\n\n function getValues(payload) {\n if (isString(payload)) {\n return getFieldValue(fieldsRef, payload, shallowFieldsStateRef);\n }\n\n if (Array.isArray(payload)) {\n var data = {};\n\n var _iterator6 = _createForOfIteratorHelper(payload),\n _step6;\n\n try {\n for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {\n var _name = _step6.value;\n set(data, _name, getFieldValue(fieldsRef, _name, shallowFieldsStateRef));\n }\n } catch (err) {\n _iterator6.e(err);\n } finally {\n _iterator6.f();\n }\n\n return data;\n }\n\n return setFieldArrayDefaultValues(getFieldsValues(fieldsRef, cloneObject(shallowFieldsStateRef.current), shouldUnregister));\n }\n\n var validateResolver = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {\n var values,\n newDefaultValues,\n _ref21,\n errors,\n isValid,\n _args7 = arguments;\n\n return _regeneratorRuntime.wrap(function _callee7$(_context7) {\n while (1) {\n switch (_context7.prev = _context7.next) {\n case 0:\n values = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};\n newDefaultValues = isEmptyObject(fieldsRef.current) ? defaultValuesRef.current : {};\n _context7.next = 4;\n return resolverRef.current(Object.assign(Object.assign(Object.assign({}, newDefaultValues), getValues()), values), contextRef.current, isValidateAllFieldCriteria);\n\n case 4:\n _context7.t0 = _context7.sent;\n\n if (_context7.t0) {\n _context7.next = 7;\n break;\n }\n\n _context7.t0 = {};\n\n case 7:\n _ref21 = _context7.t0;\n errors = _ref21.errors;\n isValid = isEmptyObject(errors);\n formStateRef.current.isValid !== isValid && updateFormState({\n isValid: isValid\n });\n\n case 11:\n case \"end\":\n return _context7.stop();\n }\n }\n }, _callee7);\n })), [isValidateAllFieldCriteria]);\n var removeFieldEventListener = useCallback(function (field, forceDelete) {\n findRemovedFieldAndRemoveListener(fieldsRef, handleChangeRef.current, field, shallowFieldsStateRef, shouldUnregister, forceDelete);\n\n if (shouldUnregister) {\n unset(validFieldsRef.current, field.ref.name);\n unset(fieldsWithValidationRef.current, field.ref.name);\n }\n }, [shouldUnregister]);\n var updateWatchedValue = useCallback(function (name) {\n if (isWatchAllRef.current) {\n updateFormState();\n } else {\n var _iterator7 = _createForOfIteratorHelper(watchFieldsRef.current),\n _step7;\n\n try {\n for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {\n var watchField = _step7.value;\n\n if (watchField.startsWith(name)) {\n updateFormState();\n break;\n }\n }\n } catch (err) {\n _iterator7.e(err);\n } finally {\n _iterator7.f();\n }\n\n renderWatchedInputs(name);\n }\n }, []);\n var removeFieldEventListenerAndRef = useCallback(function (field, forceDelete) {\n if (field) {\n removeFieldEventListener(field, forceDelete);\n\n if (shouldUnregister && !compact(field.options || []).length) {\n unset(formStateRef.current.errors, field.ref.name);\n set(formStateRef.current.dirtyFields, field.ref.name, true);\n updateFormState({\n isDirty: isFormDirty()\n });\n readFormStateRef.current.isValid && resolverRef.current && validateResolver();\n updateWatchedValue(field.ref.name);\n }\n }\n }, [validateResolver, removeFieldEventListener]);\n\n function clearErrors(name) {\n name && (Array.isArray(name) ? name : [name]).forEach(function (inputName) {\n return fieldsRef.current[inputName] && isKey(inputName) ? delete formStateRef.current.errors[inputName] : unset(formStateRef.current.errors, inputName);\n });\n updateFormState({\n errors: name ? formStateRef.current.errors : {}\n });\n }\n\n function setError(name, error) {\n var ref = (fieldsRef.current[name] || {}).ref;\n set(formStateRef.current.errors, name, Object.assign(Object.assign({}, error), {\n ref: ref\n }));\n updateFormState({\n isValid: false\n });\n error.shouldFocus && ref && ref.focus && ref.focus();\n }\n\n var watchInternal = useCallback(function (fieldNames, defaultValue, watchId) {\n var watchFields = watchId ? useWatchFieldsRef.current[watchId] : watchFieldsRef.current;\n var fieldValues = getFieldsValues(fieldsRef, cloneObject(shallowFieldsStateRef.current), shouldUnregister, false, fieldNames);\n\n if (isString(fieldNames)) {\n var parentNodeName = getFieldArrayParentName(fieldNames) || fieldNames;\n\n if (fieldArrayNamesRef.current.has(parentNodeName)) {\n fieldValues = Object.assign(Object.assign({}, fieldArrayValuesRef.current), fieldValues);\n }\n\n return assignWatchFields(fieldValues, fieldNames, watchFields, isUndefined(_get(defaultValuesRef.current, fieldNames)) ? defaultValue : _get(defaultValuesRef.current, fieldNames), true);\n }\n\n var combinedDefaultValues = isUndefined(defaultValue) ? defaultValuesRef.current : defaultValue;\n\n if (Array.isArray(fieldNames)) {\n return fieldNames.reduce(function (previous, name) {\n return Object.assign(Object.assign({}, previous), _defineProperty({}, name, assignWatchFields(fieldValues, name, watchFields, combinedDefaultValues)));\n }, {});\n }\n\n isWatchAllRef.current = isUndefined(watchId);\n return transformToNestObject(!isEmptyObject(fieldValues) && fieldValues || combinedDefaultValues);\n }, []);\n\n function watch(fieldNames, defaultValue) {\n return watchInternal(fieldNames, defaultValue);\n }\n\n function unregister(name) {\n var _iterator8 = _createForOfIteratorHelper(Array.isArray(name) ? name : [name]),\n _step8;\n\n try {\n for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {\n var fieldName = _step8.value;\n removeFieldEventListenerAndRef(fieldsRef.current[fieldName], true);\n }\n } catch (err) {\n _iterator8.e(err);\n } finally {\n _iterator8.f();\n }\n }\n\n function registerFieldRef(ref) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n if (process.env.NODE_ENV !== 'production') {\n if (!ref.name) {\n return console.warn('📋 Field is missing `name` attribute', ref, \"https://react-hook-form.com/api#useForm\");\n }\n\n if (fieldArrayNamesRef.current.has(ref.name.split(/\\[\\d+\\]$/)[0]) && !RegExp(\"^\".concat(ref.name.split(/\\[\\d+\\]$/)[0], \"[\\\\d+].\\\\w+\").replace(/\\[/g, '\\\\[').replace(/\\]/g, '\\\\]')).test(ref.name)) {\n return console.warn('📋 `name` prop should be in object shape: name=\"test[index].name\"', ref, 'https://react-hook-form.com/api#useFieldArray');\n }\n }\n\n var name = ref.name,\n type = ref.type,\n value = ref.value;\n var fieldRefAndValidationOptions = Object.assign({\n ref: ref\n }, options);\n var fields = fieldsRef.current;\n var isRadioOrCheckbox = isRadioOrCheckboxFunction(ref);\n var isFieldArray = isNameInFieldArray(fieldArrayNamesRef.current, name);\n\n var compareRef = function compareRef(currentRef) {\n return isWeb && (!isHTMLElement(ref) || currentRef === ref);\n };\n\n var field = fields[name];\n var isEmptyDefaultValue = true;\n var defaultValue;\n\n if (field && (isRadioOrCheckbox ? Array.isArray(field.options) && compact(field.options).find(function (option) {\n return value === option.ref.value && compareRef(option.ref);\n }) : compareRef(field.ref))) {\n fields[name] = Object.assign(Object.assign({}, field), options);\n return;\n }\n\n if (type) {\n field = isRadioOrCheckbox ? Object.assign({\n options: [].concat(_toConsumableArray(compact(field && field.options || [])), [{\n ref: ref\n }]),\n ref: {\n type: type,\n name: name\n }\n }, options) : Object.assign({}, fieldRefAndValidationOptions);\n } else {\n field = fieldRefAndValidationOptions;\n }\n\n fields[name] = field;\n var isEmptyUnmountFields = isUndefined(_get(shallowFieldsStateRef.current, name));\n\n if (!isEmptyObject(defaultValuesRef.current) || !isEmptyUnmountFields) {\n defaultValue = _get(isEmptyUnmountFields ? defaultValuesRef.current : shallowFieldsStateRef.current, name);\n isEmptyDefaultValue = isUndefined(defaultValue);\n\n if (!isEmptyDefaultValue && !isFieldArray) {\n setFieldValue(name, defaultValue);\n }\n }\n\n if (!isEmptyObject(options)) {\n set(fieldsWithValidationRef.current, name, true);\n\n if (!isOnSubmit && readFormStateRef.current.isValid) {\n validateField(fieldsRef, isValidateAllFieldCriteria, field, shallowFieldsStateRef).then(function (error) {\n var previousFormIsValid = formStateRef.current.isValid;\n isEmptyObject(error) ? set(validFieldsRef.current, name, true) : unset(validFieldsRef.current, name);\n previousFormIsValid !== isEmptyObject(error) && updateFormState();\n });\n }\n }\n\n if (shouldUnregister && !(isFieldArray && isEmptyDefaultValue)) {\n !isFieldArray && unset(formStateRef.current.dirtyFields, name);\n }\n\n if (type) {\n attachEventListeners(isRadioOrCheckbox && field.options ? field.options[field.options.length - 1] : field, isRadioOrCheckbox || isSelectInput(ref), handleChangeRef.current);\n }\n }\n\n function register(refOrRegisterOptions, options) {\n if (!isWindowUndefined) {\n if (isString(refOrRegisterOptions)) {\n registerFieldRef({\n name: refOrRegisterOptions\n }, options);\n } else if (isObject(refOrRegisterOptions) && 'name' in refOrRegisterOptions) {\n registerFieldRef(refOrRegisterOptions, options);\n } else {\n return function (ref) {\n return ref && registerFieldRef(ref, refOrRegisterOptions);\n };\n }\n }\n }\n\n var handleSubmit = useCallback(function (onValid, onInvalid) {\n return /*#__PURE__*/function () {\n var _ref22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(e) {\n var fieldErrors, fieldValues, _yield$resolverRef$cu3, errors, values, _i4, _Object$values2, field, _name2, fieldError;\n\n return _regeneratorRuntime.wrap(function _callee8$(_context8) {\n while (1) {\n switch (_context8.prev = _context8.next) {\n case 0:\n if (e && e.preventDefault) {\n e.preventDefault();\n e.persist();\n }\n\n fieldErrors = {};\n fieldValues = setFieldArrayDefaultValues(getFieldsValues(fieldsRef, cloneObject(shallowFieldsStateRef.current), shouldUnregister, true));\n readFormStateRef.current.isSubmitting && updateFormState({\n isSubmitting: true\n });\n _context8.prev = 4;\n\n if (!resolverRef.current) {\n _context8.next = 15;\n break;\n }\n\n _context8.next = 8;\n return resolverRef.current(fieldValues, contextRef.current, isValidateAllFieldCriteria);\n\n case 8:\n _yield$resolverRef$cu3 = _context8.sent;\n errors = _yield$resolverRef$cu3.errors;\n values = _yield$resolverRef$cu3.values;\n formStateRef.current.errors = fieldErrors = errors;\n fieldValues = values;\n _context8.next = 27;\n break;\n\n case 15:\n _i4 = 0, _Object$values2 = Object.values(fieldsRef.current);\n\n case 16:\n if (!(_i4 < _Object$values2.length)) {\n _context8.next = 27;\n break;\n }\n\n field = _Object$values2[_i4];\n\n if (!field) {\n _context8.next = 24;\n break;\n }\n\n _name2 = field.ref.name;\n _context8.next = 22;\n return validateField(fieldsRef, isValidateAllFieldCriteria, field, shallowFieldsStateRef);\n\n case 22:\n fieldError = _context8.sent;\n\n if (fieldError[_name2]) {\n set(fieldErrors, _name2, fieldError[_name2]);\n unset(validFieldsRef.current, _name2);\n } else if (_get(fieldsWithValidationRef.current, _name2)) {\n unset(formStateRef.current.errors, _name2);\n set(validFieldsRef.current, _name2, true);\n }\n\n case 24:\n _i4++;\n _context8.next = 16;\n break;\n\n case 27:\n if (!(isEmptyObject(fieldErrors) && Object.keys(formStateRef.current.errors).every(function (name) {\n return name in fieldsRef.current;\n }))) {\n _context8.next = 33;\n break;\n }\n\n updateFormState({\n errors: {},\n isSubmitting: true\n });\n _context8.next = 31;\n return onValid(fieldValues, e);\n\n case 31:\n _context8.next = 39;\n break;\n\n case 33:\n formStateRef.current.errors = Object.assign(Object.assign({}, formStateRef.current.errors), fieldErrors);\n _context8.t0 = onInvalid;\n\n if (!_context8.t0) {\n _context8.next = 38;\n break;\n }\n\n _context8.next = 38;\n return onInvalid(formStateRef.current.errors, e);\n\n case 38:\n shouldFocusError && focusOnErrorField(fieldsRef.current, formStateRef.current.errors);\n\n case 39:\n _context8.prev = 39;\n formStateRef.current.isSubmitting = false;\n updateFormState({\n isSubmitted: true,\n isSubmitting: false,\n isSubmitSuccessful: isEmptyObject(formStateRef.current.errors),\n submitCount: formStateRef.current.submitCount + 1\n });\n return _context8.finish(39);\n\n case 43:\n case \"end\":\n return _context8.stop();\n }\n }\n }, _callee8, null, [[4,, 39, 43]]);\n }));\n\n return function (_x11) {\n return _ref22.apply(this, arguments);\n };\n }();\n }, [shouldFocusError, isValidateAllFieldCriteria]);\n\n var resetRefs = function resetRefs(_ref23) {\n var errors = _ref23.errors,\n isDirty = _ref23.isDirty,\n isSubmitted = _ref23.isSubmitted,\n touched = _ref23.touched,\n isValid = _ref23.isValid,\n submitCount = _ref23.submitCount,\n dirtyFields = _ref23.dirtyFields;\n\n if (!isValid) {\n validFieldsRef.current = {};\n fieldsWithValidationRef.current = {};\n }\n\n fieldArrayDefaultValuesRef.current = {};\n watchFieldsRef.current = new Set();\n isWatchAllRef.current = false;\n updateFormState({\n submitCount: submitCount ? formStateRef.current.submitCount : 0,\n isDirty: isDirty ? formStateRef.current.isDirty : false,\n isSubmitted: isSubmitted ? formStateRef.current.isSubmitted : false,\n isValid: isValid ? formStateRef.current.isValid : false,\n dirtyFields: dirtyFields ? formStateRef.current.dirtyFields : {},\n touched: touched ? formStateRef.current.touched : {},\n errors: errors ? formStateRef.current.errors : {},\n isSubmitting: false,\n isSubmitSuccessful: false\n });\n };\n\n var reset = function reset(values) {\n var omitResetState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n if (isWeb) {\n for (var _i5 = 0, _Object$values3 = Object.values(fieldsRef.current); _i5 < _Object$values3.length; _i5++) {\n var field = _Object$values3[_i5];\n\n if (field) {\n var _ref24 = field.ref,\n options = field.options;\n var inputRef = isRadioOrCheckboxFunction(_ref24) && Array.isArray(options) ? options[0].ref : _ref24;\n\n if (isHTMLElement(inputRef)) {\n try {\n inputRef.closest('form').reset();\n break;\n } catch (_a) {}\n }\n }\n }\n }\n\n fieldsRef.current = {};\n defaultValuesRef.current = Object.assign({}, values || defaultValuesRef.current);\n values && renderWatchedInputs('');\n Object.values(resetFieldArrayFunctionRef.current).forEach(function (resetFieldArray) {\n return isFunction(resetFieldArray) && resetFieldArray();\n });\n shallowFieldsStateRef.current = shouldUnregister ? {} : cloneObject(values || defaultValuesRef.current);\n resetRefs(omitResetState);\n };\n\n useEffect(function () {\n resolver && readFormStateRef.current.isValid && validateResolver();\n observerRef.current = observerRef.current || !isWeb ? observerRef.current : onDomRemove(fieldsRef, removeFieldEventListenerAndRef);\n }, [removeFieldEventListenerAndRef, defaultValuesRef.current]);\n useEffect(function () {\n return function () {\n observerRef.current && observerRef.current.disconnect();\n isUnMount.current = true;\n\n if (process.env.NODE_ENV !== 'production') {\n return;\n }\n\n Object.values(fieldsRef.current).forEach(function (field) {\n return removeFieldEventListenerAndRef(field, true);\n });\n };\n }, []);\n\n if (!resolver && readFormStateRef.current.isValid) {\n formState.isValid = deepEqual(validFieldsRef.current, fieldsWithValidationRef.current) && isEmptyObject(formStateRef.current.errors);\n }\n\n var commonProps = {\n trigger: trigger,\n setValue: useCallback(setValue, [setInternalValue, trigger]),\n getValues: useCallback(getValues, []),\n register: useCallback(register, [defaultValuesRef.current]),\n unregister: useCallback(unregister, []),\n formState: isProxyEnabled ? new Proxy(formState, {\n get: function get(obj, prop) {\n if (process.env.NODE_ENV !== 'production') {\n if (prop === 'isValid' && isOnSubmit) {\n console.warn('📋 `formState.isValid` is applicable with `onTouched`, `onChange` or `onBlur` mode. https://react-hook-form.com/api#formState');\n }\n }\n\n if (prop in obj) {\n readFormStateRef.current[prop] = true;\n return obj[prop];\n }\n\n return undefined;\n }\n }) : formState\n };\n var control = useMemo(function () {\n return Object.assign({\n isFormDirty: isFormDirty,\n updateWatchedValue: updateWatchedValue,\n shouldUnregister: shouldUnregister,\n updateFormState: updateFormState,\n removeFieldEventListener: removeFieldEventListener,\n watchInternal: watchInternal,\n mode: modeRef.current,\n reValidateMode: {\n isReValidateOnBlur: isReValidateOnBlur,\n isReValidateOnChange: isReValidateOnChange\n },\n validateResolver: resolver ? validateResolver : undefined,\n fieldsRef: fieldsRef,\n resetFieldArrayFunctionRef: resetFieldArrayFunctionRef,\n useWatchFieldsRef: useWatchFieldsRef,\n useWatchRenderFunctionsRef: useWatchRenderFunctionsRef,\n fieldArrayDefaultValuesRef: fieldArrayDefaultValuesRef,\n validFieldsRef: validFieldsRef,\n fieldsWithValidationRef: fieldsWithValidationRef,\n fieldArrayNamesRef: fieldArrayNamesRef,\n readFormStateRef: readFormStateRef,\n formStateRef: formStateRef,\n defaultValuesRef: defaultValuesRef,\n shallowFieldsStateRef: shallowFieldsStateRef,\n fieldArrayValuesRef: fieldArrayValuesRef\n }, commonProps);\n }, [defaultValuesRef.current, updateWatchedValue, shouldUnregister, removeFieldEventListener, watchInternal]);\n return Object.assign({\n watch: watch,\n control: control,\n handleSubmit: handleSubmit,\n reset: useCallback(reset, []),\n clearErrors: useCallback(clearErrors, []),\n setError: useCallback(setError, []),\n errors: formState.errors\n }, commonProps);\n}\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\n\n\nfunction __rest(s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n}\n\nvar FormContext = createContext(null);\nFormContext.displayName = 'RHFContext';\n\nvar useFormContext = function useFormContext() {\n return useContext(FormContext);\n};\n\nvar FormProvider = function FormProvider(_a) {\n var children = _a.children,\n props = __rest(_a, [\"children\"]);\n\n return createElement(FormContext.Provider, {\n value: Object.assign({}, props)\n }, children);\n};\n\nvar generateId = function generateId() {\n var d = typeof performance === UNDEFINED ? Date.now() : performance.now() * 1000;\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = (Math.random() * 16 + d) % 16 | 0;\n return (c == 'x' ? r : r & 0x3 | 0x8).toString(16);\n });\n};\n\nfunction removeAtIndexes(data, indexes) {\n var i = 0;\n\n var temp = _toConsumableArray(data);\n\n var _iterator9 = _createForOfIteratorHelper(indexes),\n _step9;\n\n try {\n for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {\n var index = _step9.value;\n temp.splice(index - i, 1);\n i++;\n }\n } catch (err) {\n _iterator9.e(err);\n } finally {\n _iterator9.f();\n }\n\n return compact(temp).length ? temp : [];\n}\n\nvar removeArrayAt = function removeArrayAt(data, index) {\n return isUndefined(index) ? [] : removeAtIndexes(data, (Array.isArray(index) ? index : [index]).sort(function (a, b) {\n return a - b;\n }));\n};\n\nvar moveArrayAt = function moveArrayAt(data, from, to) {\n if (Array.isArray(data)) {\n if (isUndefined(data[to])) {\n data[to] = undefined;\n }\n\n data.splice(to, 0, data.splice(from, 1)[0]);\n return data;\n }\n\n return [];\n};\n\nvar swapArrayAt = function swapArrayAt(data, indexA, indexB) {\n var temp = [data[indexB], data[indexA]];\n data[indexA] = temp[0];\n data[indexB] = temp[1];\n};\n\nfunction prepend(data, value) {\n return [].concat(_toConsumableArray(Array.isArray(value) ? value : [value || undefined]), _toConsumableArray(data));\n}\n\nfunction insert(data, index, value) {\n return [].concat(_toConsumableArray(data.slice(0, index)), _toConsumableArray(Array.isArray(value) ? value : [value || undefined]), _toConsumableArray(data.slice(index)));\n}\n\nvar fillEmptyArray = function fillEmptyArray(value) {\n return Array.isArray(value) ? Array(value.length).fill(undefined) : undefined;\n};\n\nvar fillBooleanArray = function fillBooleanArray(value) {\n return (Array.isArray(value) ? value : [value]).map(function (data) {\n if (isObject(data)) {\n var object = {};\n\n for (var key in data) {\n object[key] = true;\n }\n\n return object;\n }\n\n return true;\n });\n};\n\nvar mapIds = function mapIds() {\n var values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var keyName = arguments.length > 1 ? arguments[1] : undefined;\n var skipWarn = arguments.length > 2 ? arguments[2] : undefined;\n\n if (process.env.NODE_ENV !== 'production') {\n if (!skipWarn) {\n var _iterator10 = _createForOfIteratorHelper(values),\n _step10;\n\n try {\n for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {\n var value = _step10.value;\n\n if (typeof value === 'object') {\n if (keyName in value) {\n console.warn(\"\\uD83D\\uDCCB useFieldArray fieldValues contain the keyName `\".concat(keyName, \"` which is reserved for use by useFieldArray. https://react-hook-form.com/api#useFieldArray\"));\n break;\n }\n } else {\n console.warn(\"\\uD83D\\uDCCB useFieldArray input's name should be in object shape instead of flat array. https://react-hook-form.com/api#useFieldArray\");\n break;\n }\n }\n } catch (err) {\n _iterator10.e(err);\n } finally {\n _iterator10.f();\n }\n }\n }\n\n return values.map(function (value) {\n return Object.assign(_defineProperty({}, keyName, value[keyName] || generateId()), value);\n });\n};\n\nvar useFieldArray = function useFieldArray(_ref25) {\n var control = _ref25.control,\n name = _ref25.name,\n _ref25$keyName = _ref25.keyName,\n keyName = _ref25$keyName === void 0 ? 'id' : _ref25$keyName;\n var methods = useFormContext();\n\n if (process.env.NODE_ENV !== 'production') {\n if (!control && !methods) {\n throw new Error('📋 useFieldArray is missing `control` prop. https://react-hook-form.com/api#useFieldArray');\n }\n }\n\n var focusIndexRef = useRef(-1);\n var isUnMount = useRef(false);\n\n var _ref26 = control || methods.control,\n isFormDirty = _ref26.isFormDirty,\n updateWatchedValue = _ref26.updateWatchedValue,\n resetFieldArrayFunctionRef = _ref26.resetFieldArrayFunctionRef,\n fieldArrayNamesRef = _ref26.fieldArrayNamesRef,\n fieldsRef = _ref26.fieldsRef,\n defaultValuesRef = _ref26.defaultValuesRef,\n removeFieldEventListener = _ref26.removeFieldEventListener,\n formStateRef = _ref26.formStateRef,\n shallowFieldsStateRef = _ref26.shallowFieldsStateRef,\n updateFormState = _ref26.updateFormState,\n readFormStateRef = _ref26.readFormStateRef,\n validFieldsRef = _ref26.validFieldsRef,\n fieldsWithValidationRef = _ref26.fieldsWithValidationRef,\n fieldArrayDefaultValuesRef = _ref26.fieldArrayDefaultValuesRef,\n validateResolver = _ref26.validateResolver,\n getValues = _ref26.getValues,\n shouldUnregister = _ref26.shouldUnregister,\n fieldArrayValuesRef = _ref26.fieldArrayValuesRef;\n\n var getDefaultValues = function getDefaultValues(values) {\n return _get(shouldUnregister ? values : shallowFieldsStateRef.current, name, []);\n };\n\n var fieldArrayParentName = getFieldArrayParentName(name);\n var memoizedDefaultValues = useRef(_toConsumableArray(_get(fieldArrayDefaultValuesRef.current, fieldArrayParentName) ? getDefaultValues(fieldArrayDefaultValuesRef.current) : getDefaultValues(defaultValuesRef.current)));\n\n var _useState3 = useState(mapIds(memoizedDefaultValues.current, keyName)),\n _useState4 = _slicedToArray(_useState3, 2),\n fields = _useState4[0],\n setFields = _useState4[1];\n\n set(fieldArrayValuesRef.current, name, compact(fields));\n\n var omitKey = function omitKey(fields) {\n return fields.map(function () {\n var _a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var _b = keyName,\n omitted = _a[_b],\n rest = __rest(_a, [typeof _b === \"symbol\" ? _b : _b + \"\"]);\n\n return rest;\n });\n };\n\n fieldArrayNamesRef.current.add(name);\n var getFieldArrayValue = useCallback(function () {\n return _get(fieldArrayValuesRef.current, name, []);\n }, [name]);\n\n var getCurrentFieldsValues = function getCurrentFieldsValues() {\n return mapIds(_get(getValues(), name, getFieldArrayValue()).map(function (item, index) {\n return Object.assign(Object.assign({}, getFieldArrayValue()[index]), item);\n }), keyName, true);\n };\n\n fieldArrayNamesRef.current.add(name);\n\n if (fieldArrayParentName && !_get(fieldArrayDefaultValuesRef.current, fieldArrayParentName)) {\n set(fieldArrayDefaultValuesRef.current, fieldArrayParentName, cloneObject(_get(defaultValuesRef.current, fieldArrayParentName)));\n }\n\n var setFieldAndValidState = function setFieldAndValidState(fieldsValues) {\n setFields(fieldsValues);\n set(fieldArrayValuesRef.current, name, fieldsValues);\n\n if (readFormStateRef.current.isValid && validateResolver) {\n var values = getValues();\n set(values, name, fieldsValues);\n validateResolver(values);\n }\n };\n\n var resetFields = function resetFields() {\n for (var key in fieldsRef.current) {\n if (isMatchFieldArrayName(key, name)) {\n removeFieldEventListener(fieldsRef.current[key], true);\n delete fieldsRef.current[key];\n }\n }\n };\n\n var cleanup = function cleanup(ref) {\n return !compact(_get(ref, name, [])).length && unset(ref, name);\n };\n\n var updateDirtyFieldsWithDefaultValues = function updateDirtyFieldsWithDefaultValues(updatedFieldArrayValues) {\n if (updatedFieldArrayValues) {\n set(formStateRef.current.dirtyFields, name, setFieldArrayDirtyFields(omitKey(updatedFieldArrayValues), _get(defaultValuesRef.current, name, []), _get(formStateRef.current.dirtyFields, name, [])));\n }\n };\n\n var batchStateUpdate = function batchStateUpdate(method, args, updatedFieldValues) {\n var updatedFormValues = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];\n var shouldSet = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;\n var shouldUpdateValid = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;\n\n if (_get(shallowFieldsStateRef.current, name)) {\n var output = method(_get(shallowFieldsStateRef.current, name), args.argA, args.argB);\n shouldSet && set(shallowFieldsStateRef.current, name, output);\n }\n\n if (_get(fieldArrayDefaultValuesRef.current, name)) {\n var _output = method(_get(fieldArrayDefaultValuesRef.current, name), args.argA, args.argB);\n\n shouldSet && set(fieldArrayDefaultValuesRef.current, name, _output);\n }\n\n if (Array.isArray(_get(formStateRef.current.errors, name))) {\n var _output2 = method(_get(formStateRef.current.errors, name), args.argA, args.argB);\n\n shouldSet && set(formStateRef.current.errors, name, _output2);\n cleanup(formStateRef.current.errors);\n }\n\n if (readFormStateRef.current.touched && _get(formStateRef.current.touched, name)) {\n var _output3 = method(_get(formStateRef.current.touched, name), args.argA, args.argB);\n\n shouldSet && set(formStateRef.current.touched, name, _output3);\n cleanup(formStateRef.current.touched);\n }\n\n if (readFormStateRef.current.dirtyFields || readFormStateRef.current.isDirty) {\n set(formStateRef.current.dirtyFields, name, setFieldArrayDirtyFields(omitKey(updatedFormValues), _get(defaultValuesRef.current, name, []), _get(formStateRef.current.dirtyFields, name, [])));\n updateDirtyFieldsWithDefaultValues(updatedFieldValues);\n cleanup(formStateRef.current.dirtyFields);\n }\n\n if (shouldUpdateValid && readFormStateRef.current.isValid && !validateResolver) {\n set(validFieldsRef.current, name, method(_get(validFieldsRef.current, name, []), args.argA));\n cleanup(validFieldsRef.current);\n set(fieldsWithValidationRef.current, name, method(_get(fieldsWithValidationRef.current, name, []), args.argA));\n cleanup(fieldsWithValidationRef.current);\n }\n\n if (!isUnMount.current && readFormStateRef.current.isDirty) {\n updateFormState({\n isDirty: isFormDirty(name, omitKey(updatedFormValues))\n });\n }\n };\n\n var append = function append(value) {\n var shouldFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n var appendValue = Array.isArray(value) ? value : [value];\n var updateFormValues = [].concat(_toConsumableArray(getCurrentFieldsValues()), _toConsumableArray(mapIds(appendValue, keyName)));\n setFieldAndValidState(updateFormValues);\n\n if (readFormStateRef.current.dirtyFields || readFormStateRef.current.isDirty) {\n updateDirtyFieldsWithDefaultValues(updateFormValues);\n updateFormState({\n isDirty: true,\n dirtyFields: formStateRef.current.dirtyFields\n });\n }\n\n !shouldUnregister && set(shallowFieldsStateRef.current, name, [].concat(_toConsumableArray(_get(shallowFieldsStateRef.current, name) || []), _toConsumableArray(cloneObject(appendValue))));\n focusIndexRef.current = shouldFocus ? _get(fieldArrayValuesRef.current, name).length - 1 : -1;\n };\n\n var prepend$1 = function prepend$1(value) {\n var shouldFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n var emptyArray = fillEmptyArray(value);\n var updatedFieldArrayValues = prepend(getCurrentFieldsValues(), mapIds(Array.isArray(value) ? value : [value], keyName));\n setFieldAndValidState(updatedFieldArrayValues);\n resetFields();\n batchStateUpdate(prepend, {\n argA: emptyArray,\n argC: fillBooleanArray(value)\n }, updatedFieldArrayValues);\n focusIndexRef.current = shouldFocus ? 0 : -1;\n };\n\n var remove = function remove(index) {\n var fieldValues = getCurrentFieldsValues();\n var updatedFieldValues = removeArrayAt(fieldValues, index);\n setFieldAndValidState(updatedFieldValues);\n resetFields();\n batchStateUpdate(removeArrayAt, {\n argA: index,\n argC: index\n }, updatedFieldValues, removeArrayAt(fieldValues, index), true, true);\n };\n\n var insert$1 = function insert$1(index, value) {\n var shouldFocus = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n var emptyArray = fillEmptyArray(value);\n var fieldValues = getCurrentFieldsValues();\n var updatedFieldArrayValues = insert(fieldValues, index, mapIds(Array.isArray(value) ? value : [value], keyName));\n setFieldAndValidState(updatedFieldArrayValues);\n resetFields();\n batchStateUpdate(insert, {\n argA: index,\n argB: emptyArray,\n argC: index,\n argD: fillBooleanArray(value)\n }, updatedFieldArrayValues, insert(fieldValues, index));\n focusIndexRef.current = shouldFocus ? index : -1;\n };\n\n var swap = function swap(indexA, indexB) {\n var fieldValues = getCurrentFieldsValues();\n swapArrayAt(fieldValues, indexA, indexB);\n resetFields();\n setFieldAndValidState(_toConsumableArray(fieldValues));\n batchStateUpdate(swapArrayAt, {\n argA: indexA,\n argB: indexB,\n argC: indexA,\n argD: indexB\n }, undefined, fieldValues, false);\n };\n\n var move = function move(from, to) {\n var fieldValues = getCurrentFieldsValues();\n moveArrayAt(fieldValues, from, to);\n resetFields();\n setFieldAndValidState(_toConsumableArray(fieldValues));\n batchStateUpdate(moveArrayAt, {\n argA: from,\n argB: to,\n argC: from,\n argD: to\n }, undefined, fieldValues, false);\n };\n\n useEffect(function () {\n if (process.env.NODE_ENV !== 'production') {\n if (!name) {\n console.warn('📋 useFieldArray is missing `name` attribute. https://react-hook-form.com/api#useFieldArray');\n }\n }\n\n var defaultValues = _get(fieldArrayDefaultValuesRef.current, name);\n\n if (defaultValues && fields.length < defaultValues.length) {\n set(fieldArrayDefaultValuesRef.current, name, defaultValues.slice(1));\n }\n\n updateWatchedValue(name);\n\n if (focusIndexRef.current > -1) {\n for (var key in fieldsRef.current) {\n var field = fieldsRef.current[key];\n\n if (key.startsWith(\"\".concat(name, \"[\").concat(focusIndexRef.current, \"]\")) && field.ref.focus) {\n field.ref.focus();\n break;\n }\n }\n }\n\n focusIndexRef.current = -1;\n }, [fields, name]);\n useEffect(function () {\n var resetFunctions = resetFieldArrayFunctionRef.current;\n var fieldArrayNames = fieldArrayNamesRef.current;\n\n if (!getFieldArrayParentName(name)) {\n resetFunctions[name] = function (data) {\n resetFields();\n !data && unset(fieldArrayDefaultValuesRef.current, name);\n unset(shallowFieldsStateRef.current, name);\n memoizedDefaultValues.current = _get(data || defaultValuesRef.current, name);\n\n if (!isUnMount.current) {\n setFields(mapIds(memoizedDefaultValues.current, keyName));\n }\n };\n }\n\n return function () {\n isUnMount.current = true;\n shouldUnregister && remove();\n resetFields();\n delete resetFunctions[name];\n unset(fieldArrayValuesRef.current, name);\n fieldArrayNames.delete(name);\n };\n }, []);\n return {\n swap: useCallback(swap, [name]),\n move: useCallback(move, [name]),\n prepend: useCallback(prepend$1, [name]),\n append: useCallback(append, [name]),\n remove: useCallback(remove, [name]),\n insert: useCallback(insert$1, [name]),\n fields: compact(fields)\n };\n};\n\nvar getInputValue = function getInputValue(event) {\n return isPrimitive(event) || !isObject(event.target) || isObject(event.target) && !event.type ? event : isUndefined(event.target.value) ? event.target.checked : event.target.value;\n};\n\nfunction useController(_ref27) {\n var name = _ref27.name,\n rules = _ref27.rules,\n defaultValue = _ref27.defaultValue,\n control = _ref27.control,\n onFocus = _ref27.onFocus;\n var methods = useFormContext();\n\n if (process.env.NODE_ENV !== 'production') {\n if (!control && !methods) {\n throw new Error('📋 Controller is missing `control` prop. https://react-hook-form.com/api#Controller');\n }\n }\n\n var _ref28 = control || methods.control,\n defaultValuesRef = _ref28.defaultValuesRef,\n setValue = _ref28.setValue,\n register = _ref28.register,\n unregister = _ref28.unregister,\n trigger = _ref28.trigger,\n mode = _ref28.mode,\n _ref28$reValidateMode = _ref28.reValidateMode,\n isReValidateOnBlur = _ref28$reValidateMode.isReValidateOnBlur,\n isReValidateOnChange = _ref28$reValidateMode.isReValidateOnChange,\n formState = _ref28.formState,\n _ref28$formStateRef$c = _ref28.formStateRef.current,\n isSubmitted = _ref28$formStateRef$c.isSubmitted,\n touched = _ref28$formStateRef$c.touched,\n errors = _ref28$formStateRef$c.errors,\n updateFormState = _ref28.updateFormState,\n readFormStateRef = _ref28.readFormStateRef,\n fieldsRef = _ref28.fieldsRef,\n fieldArrayNamesRef = _ref28.fieldArrayNamesRef,\n shallowFieldsStateRef = _ref28.shallowFieldsStateRef;\n\n var isNotFieldArray = !isNameInFieldArray(fieldArrayNamesRef.current, name);\n\n var getInitialValue = function getInitialValue() {\n return !isUndefined(_get(shallowFieldsStateRef.current, name)) && isNotFieldArray ? _get(shallowFieldsStateRef.current, name) : isUndefined(defaultValue) ? _get(defaultValuesRef.current, name) : defaultValue;\n };\n\n var _useState5 = useState(getInitialValue()),\n _useState6 = _slicedToArray(_useState5, 2),\n value = _useState6[0],\n setInputStateValue = _useState6[1];\n\n var valueRef = useRef(value);\n var ref = useRef({\n focus: function focus() {\n return null;\n }\n });\n var onFocusRef = useRef(onFocus || function () {\n if (isFunction(ref.current.focus)) {\n ref.current.focus();\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (!isFunction(ref.current.focus)) {\n console.warn(\"\\uD83D\\uDCCB 'ref' from Controller render prop must be attached to a React component or a DOM Element whose ref provides a 'focus()' method\");\n }\n }\n });\n var shouldValidate = useCallback(function (isBlurEvent) {\n return !skipValidation(Object.assign({\n isBlurEvent: isBlurEvent,\n isReValidateOnBlur: isReValidateOnBlur,\n isReValidateOnChange: isReValidateOnChange,\n isSubmitted: isSubmitted,\n isTouched: !!_get(touched, name)\n }, mode));\n }, [isReValidateOnBlur, isReValidateOnChange, isSubmitted, touched, name, mode]);\n var commonTask = useCallback(function (_ref29) {\n var _ref30 = _slicedToArray(_ref29, 1),\n event = _ref30[0];\n\n var data = getInputValue(event);\n setInputStateValue(data);\n valueRef.current = data;\n return data;\n }, []);\n var registerField = useCallback(function (shouldUpdateValue) {\n if (process.env.NODE_ENV !== 'production') {\n if (!name) {\n return console.warn('📋 Field is missing `name` prop. https://react-hook-form.com/api#Controller');\n }\n }\n\n if (fieldsRef.current[name]) {\n fieldsRef.current[name] = Object.assign({\n ref: fieldsRef.current[name].ref\n }, rules);\n } else {\n register(Object.defineProperties({\n name: name,\n focus: onFocusRef.current\n }, {\n value: {\n set: function set(data) {\n setInputStateValue(data);\n valueRef.current = data;\n },\n get: function get() {\n return valueRef.current;\n }\n }\n }), rules);\n shouldUpdateValue = isUndefined(_get(defaultValuesRef.current, name));\n }\n\n shouldUpdateValue && isNotFieldArray && setInputStateValue(getInitialValue());\n }, [rules, name, register]);\n useEffect(function () {\n return function () {\n return unregister(name);\n };\n }, [name]);\n useEffect(function () {\n if (process.env.NODE_ENV !== 'production') {\n if (isUndefined(value)) {\n console.warn(\"\\uD83D\\uDCCB \".concat(name, \" is missing in the 'defaultValue' prop of either its Controller (https://react-hook-form.com/api#Controller) or useForm (https://react-hook-form.com/api#useForm)\"));\n }\n\n if (!isNotFieldArray && isUndefined(defaultValue)) {\n console.warn('📋 Controller is missing `defaultValue` prop when using `useFieldArray`. https://react-hook-form.com/api#Controller');\n }\n }\n\n registerField();\n }, [registerField]);\n useEffect(function () {\n !fieldsRef.current[name] && registerField(true);\n });\n var onBlur = useCallback(function () {\n if (readFormStateRef.current.touched && !_get(touched, name)) {\n set(touched, name, true);\n updateFormState({\n touched: touched\n });\n }\n\n shouldValidate(true) && trigger(name);\n }, [name, updateFormState, shouldValidate, trigger, readFormStateRef]);\n var onChange = useCallback(function () {\n for (var _len = arguments.length, event = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {\n event[_key2] = arguments[_key2];\n }\n\n return setValue(name, commonTask(event), {\n shouldValidate: shouldValidate(),\n shouldDirty: true\n });\n }, [setValue, name, shouldValidate]);\n return {\n field: {\n onChange: onChange,\n onBlur: onBlur,\n name: name,\n value: value,\n ref: ref\n },\n meta: Object.defineProperties({\n invalid: !!_get(errors, name)\n }, {\n isDirty: {\n get: function get() {\n return !!_get(formState.dirtyFields, name);\n }\n },\n isTouched: {\n get: function get() {\n return !!_get(formState.touched, name);\n }\n }\n })\n };\n}\n\nfunction useWatch(_ref31) {\n var control = _ref31.control,\n name = _ref31.name,\n defaultValue = _ref31.defaultValue;\n var methods = useFormContext();\n\n if (process.env.NODE_ENV !== 'production') {\n if (!control && !methods) {\n throw new Error('📋 useWatch is missing `control` prop. https://react-hook-form.com/api#useWatch');\n }\n }\n\n var _ref32 = control || methods.control,\n useWatchFieldsRef = _ref32.useWatchFieldsRef,\n useWatchRenderFunctionsRef = _ref32.useWatchRenderFunctionsRef,\n watchInternal = _ref32.watchInternal,\n defaultValuesRef = _ref32.defaultValuesRef;\n\n var updateValue = useState()[1];\n var idRef = useRef();\n var defaultValueRef = useRef(defaultValue);\n useEffect(function () {\n if (process.env.NODE_ENV !== 'production') {\n if (name === '') {\n console.warn('📋 useWatch is missing `name` attribute. https://react-hook-form.com/api#useWatch');\n }\n }\n\n var id = idRef.current = generateId();\n var watchFieldsHookRender = useWatchRenderFunctionsRef.current;\n var watchFieldsHook = useWatchFieldsRef.current;\n watchFieldsHook[id] = new Set();\n\n watchFieldsHookRender[id] = function () {\n return updateValue({});\n };\n\n watchInternal(name, defaultValueRef.current, id);\n return function () {\n delete watchFieldsHook[id];\n delete watchFieldsHookRender[id];\n };\n }, [name, useWatchRenderFunctionsRef, useWatchFieldsRef, watchInternal, defaultValueRef]);\n return idRef.current ? watchInternal(name, defaultValueRef.current, idRef.current) : isUndefined(defaultValue) ? isString(name) ? _get(defaultValuesRef.current, name) : Array.isArray(name) ? name.reduce(function (previous, inputName) {\n return Object.assign(Object.assign({}, previous), _defineProperty({}, inputName, _get(defaultValuesRef.current, inputName)));\n }, {}) : defaultValuesRef.current : defaultValue;\n}\n\nvar Controller = function Controller(props) {\n var rules = props.rules,\n as = props.as,\n render = props.render,\n defaultValue = props.defaultValue,\n control = props.control,\n onFocus = props.onFocus,\n rest = __rest(props, [\"rules\", \"as\", \"render\", \"defaultValue\", \"control\", \"onFocus\"]);\n\n var _useController = useController(props),\n field = _useController.field,\n meta = _useController.meta;\n\n var componentProps = Object.assign(Object.assign({}, rest), field);\n return as ? isValidElement(as) ? cloneElement(as, componentProps) : createElement(as, componentProps) : render ? render(field, meta) : null;\n};\n\nexport { Controller, FormProvider, appendErrors, _get as get, transformToNestObject, useController, useFieldArray, useForm, useFormContext, useWatch };","exports = module.exports = require('./lib/_stream_readable.js');\nexports.Stream = exports;\nexports.Readable = exports;\nexports.Writable = require('./lib/_stream_writable.js');\nexports.Duplex = require('./lib/_stream_duplex.js');\nexports.Transform = require('./lib/_stream_transform.js');\nexports.PassThrough = require('./lib/_stream_passthrough.js');\nexports.finished = require('./lib/internal/streams/end-of-stream.js');\nexports.pipeline = require('./lib/internal/streams/pipeline.js');","var Buffer = require('safe-buffer').Buffer;\n\nvar xor = require('buffer-xor');\n\nfunction encryptStart(self, data, decrypt) {\n var len = data.length;\n var out = xor(data, self._cache);\n self._cache = self._cache.slice(len);\n self._prev = Buffer.concat([self._prev, decrypt ? data : out]);\n return out;\n}\n\nexports.encrypt = function (self, data, decrypt) {\n var out = Buffer.allocUnsafe(0);\n var len;\n\n while (data.length) {\n if (self._cache.length === 0) {\n self._cache = self._cipher.encryptBlock(self._prev);\n self._prev = Buffer.allocUnsafe(0);\n }\n\n if (self._cache.length <= data.length) {\n len = self._cache.length;\n out = Buffer.concat([out, encryptStart(self, data.slice(0, len), decrypt)]);\n data = data.slice(len);\n } else {\n out = Buffer.concat([out, encryptStart(self, data, decrypt)]);\n break;\n }\n }\n\n return out;\n};","import { apiRunner } from \"./api-runner-browser\"\n\nif (\n window.location.protocol !== `https:` &&\n window.location.hostname !== `localhost`\n) {\n console.error(\n `Service workers can only be used over HTTPS, or on localhost for development`\n )\n} else if (`serviceWorker` in navigator) {\n navigator.serviceWorker\n .register(`${__BASE_PATH__}/sw.js`)\n .then(function (reg) {\n reg.addEventListener(`updatefound`, () => {\n apiRunner(`onServiceWorkerUpdateFound`, { serviceWorker: reg })\n // The updatefound event implies that reg.installing is set; see\n // https://w3c.github.io/ServiceWorker/#service-worker-registration-updatefound-event\n const installingWorker = reg.installing\n console.log(`installingWorker`, installingWorker)\n installingWorker.addEventListener(`statechange`, () => {\n switch (installingWorker.state) {\n case `installed`:\n if (navigator.serviceWorker.controller) {\n // At this point, the old content will have been purged and the fresh content will\n // have been added to the cache.\n\n // We set a flag so Gatsby Link knows to refresh the page on next navigation attempt\n window.___swUpdated = true\n // We call the onServiceWorkerUpdateReady API so users can show update prompts.\n apiRunner(`onServiceWorkerUpdateReady`, { serviceWorker: reg })\n\n // If resources failed for the current page, reload.\n if (window.___failedResources) {\n console.log(`resources failed, SW updated - reloading`)\n window.location.reload()\n }\n } else {\n // At this point, everything has been precached.\n // It's the perfect time to display a \"Content is cached for offline use.\" message.\n console.log(`Content is now available offline!`)\n\n // Post to service worker that install is complete.\n // Delay to allow time for the event listener to be added --\n // otherwise fetch is called too soon and resources aren't cached.\n apiRunner(`onServiceWorkerInstalled`, { serviceWorker: reg })\n }\n break\n\n case `redundant`:\n console.error(`The installing service worker became redundant.`)\n apiRunner(`onServiceWorkerRedundant`, { serviceWorker: reg })\n break\n\n case `activated`:\n apiRunner(`onServiceWorkerActive`, { serviceWorker: reg })\n break\n }\n })\n })\n })\n .catch(function (e) {\n console.error(`Error during service worker registration:`, e)\n })\n}\n","import { API_CONNECTORS, CONNECTORS } from \"../store/models/connectors\"\n\nexport const hasTestApiKey = project => {\n switch (project?.connector?.type) {\n case CONNECTORS.api:\n case CONNECTORS.zapier:\n return true\n default:\n return false\n }\n}\n\nexport const hasApiKey = connectorId => {\n switch (connectorId) {\n case CONNECTORS.api:\n case CONNECTORS.figma:\n case CONNECTORS.zapier:\n return true;\n default:\n return false;\n }\n}\n\nexport const isEmailable = project => {\n switch (project?.connector?.type) {\n default:\n return false\n }\n}\n\nexport const isResourceable = project => {\n switch (project?.connector?.type) {\n case CONNECTORS.azurerepos:\n case CONNECTORS.bitbucket:\n case CONNECTORS.github:\n case CONNECTORS.gitlab:\n return true\n default:\n return false\n }\n}\n\nexport const isContentable = project => {\n switch (project?.connector?.type) {\n case CONNECTORS.contentful:\n case CONNECTORS.googleSheets:\n case CONNECTORS.hubspotcms:\n case CONNECTORS.intercom:\n case CONNECTORS.mailchimp:\n case CONNECTORS.salesforceknowledge:\n case CONNECTORS.shopify:\n case CONNECTORS.zendesk:\n return true\n default:\n return false\n }\n}\n\nexport const isCuistoProject = project => {\n return project.connector.isCuisto\n}\n\nexport const isWebhookable = project => {\n switch (project?.connector?.type) {\n case CONNECTORS.api:\n return true\n default:\n return false\n }\n}\n\nexport const isAPI = project =>\n API_CONNECTORS.includes(project?.connector?.type)\n","'use strict';\n\nmodule.exports = {\n isString: function isString(arg) {\n return typeof arg === 'string';\n },\n isObject: function isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n },\n isNull: function isNull(arg) {\n return arg === null;\n },\n isNullOrUndefined: function isNullOrUndefined(arg) {\n return arg == null;\n }\n};","// prefer default export if available\nconst preferDefault = m => (m && m.default) || m\n\nexports.components = {\n \"component---src-pages-404-js\": () => import(\"./../../../src/pages/404.js\" /* webpackChunkName: \"component---src-pages-404-js\" */),\n \"component---src-pages-akeneo-callback-js\": () => import(\"./../../../src/pages/akeneo/callback.js\" /* webpackChunkName: \"component---src-pages-akeneo-callback-js\" */),\n \"component---src-pages-azure-callback-js\": () => import(\"./../../../src/pages/azure/callback.js\" /* webpackChunkName: \"component---src-pages-azure-callback-js\" */),\n \"component---src-pages-bitbucket-callback-js\": () => import(\"./../../../src/pages/bitbucket/callback.js\" /* webpackChunkName: \"component---src-pages-bitbucket-callback-js\" */),\n \"component---src-pages-dropbox-callback-js\": () => import(\"./../../../src/pages/dropbox/callback.js\" /* webpackChunkName: \"component---src-pages-dropbox-callback-js\" */),\n \"component---src-pages-github-callback-js\": () => import(\"./../../../src/pages/github/callback.js\" /* webpackChunkName: \"component---src-pages-github-callback-js\" */),\n \"component---src-pages-github-signup-js\": () => import(\"./../../../src/pages/github/signup.js\" /* webpackChunkName: \"component---src-pages-github-signup-js\" */),\n \"component---src-pages-googledocs-callback-js\": () => import(\"./../../../src/pages/googledocs/callback.js\" /* webpackChunkName: \"component---src-pages-googledocs-callback-js\" */),\n \"component---src-pages-googlesheets-callback-js\": () => import(\"./../../../src/pages/googlesheets/callback.js\" /* webpackChunkName: \"component---src-pages-googlesheets-callback-js\" */),\n \"component---src-pages-hubspot-cms-callback-js\": () => import(\"./../../../src/pages/hubspot-cms/callback.js\" /* webpackChunkName: \"component---src-pages-hubspot-cms-callback-js\" */),\n \"component---src-pages-index-js\": () => import(\"./../../../src/pages/index.js\" /* webpackChunkName: \"component---src-pages-index-js\" */),\n \"component---src-pages-intercom-callback-js\": () => import(\"./../../../src/pages/intercom/callback.js\" /* webpackChunkName: \"component---src-pages-intercom-callback-js\" */),\n \"component---src-pages-lokalise-callback-js\": () => import(\"./../../../src/pages/lokalise/callback.js\" /* webpackChunkName: \"component---src-pages-lokalise-callback-js\" */),\n \"component---src-pages-mailchimp-callback-js\": () => import(\"./../../../src/pages/mailchimp/callback.js\" /* webpackChunkName: \"component---src-pages-mailchimp-callback-js\" */),\n \"component---src-pages-memsource-callback-js\": () => import(\"./../../../src/pages/memsource/callback.js\" /* webpackChunkName: \"component---src-pages-memsource-callback-js\" */),\n \"component---src-pages-protemos-js\": () => import(\"./../../../src/pages/protemos.js\" /* webpackChunkName: \"component---src-pages-protemos-js\" */),\n \"component---src-pages-salesforce-knowledge-callback-js\": () => import(\"./../../../src/pages/salesforce-knowledge/callback.js\" /* webpackChunkName: \"component---src-pages-salesforce-knowledge-callback-js\" */),\n \"component---src-pages-shopify-callback-js\": () => import(\"./../../../src/pages/shopify/callback.js\" /* webpackChunkName: \"component---src-pages-shopify-callback-js\" */),\n \"component---src-pages-storage-clear-js\": () => import(\"./../../../src/pages/storage/clear.js\" /* webpackChunkName: \"component---src-pages-storage-clear-js\" */),\n \"component---src-pages-wpml-callback-js\": () => import(\"./../../../src/pages/wpml/callback.js\" /* webpackChunkName: \"component---src-pages-wpml-callback-js\" */),\n \"component---src-pages-zendesk-callback-js\": () => import(\"./../../../src/pages/zendesk/callback.js\" /* webpackChunkName: \"component---src-pages-zendesk-callback-js\" */)\n}\n\n","/*\n * Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nvar __read = this && this.__read || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o),\n r,\n ar = [],\n e;\n\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {\n ar.push(r.value);\n }\n } catch (error) {\n e = {\n error: error\n };\n } finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n\n return ar;\n};\n\nvar __spread = this && this.__spread || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) {\n ar = ar.concat(__read(arguments[i]));\n }\n\n return ar;\n};\n\nvar LOG_LEVELS = {\n VERBOSE: 1,\n DEBUG: 2,\n INFO: 3,\n WARN: 4,\n ERROR: 5\n};\n/**\n * Write logs\n * @class Logger\n */\n\nvar ConsoleLogger =\n/** @class */\nfunction () {\n /**\n * @constructor\n * @param {string} name - Name of the logger\n */\n function ConsoleLogger(name, level) {\n if (level === void 0) {\n level = 'WARN';\n }\n\n this.name = name;\n this.level = level;\n }\n\n ConsoleLogger.prototype._padding = function (n) {\n return n < 10 ? '0' + n : '' + n;\n };\n\n ConsoleLogger.prototype._ts = function () {\n var dt = new Date();\n return [this._padding(dt.getMinutes()), this._padding(dt.getSeconds())].join(':') + '.' + dt.getMilliseconds();\n };\n /**\n * Write log\n * @method\n * @memeberof Logger\n * @param {string} type - log type, default INFO\n * @param {string|object} msg - Logging message or object\n */\n\n\n ConsoleLogger.prototype._log = function (type) {\n var msg = [];\n\n for (var _i = 1; _i < arguments.length; _i++) {\n msg[_i - 1] = arguments[_i];\n }\n\n var logger_level_name = this.level;\n\n if (ConsoleLogger.LOG_LEVEL) {\n logger_level_name = ConsoleLogger.LOG_LEVEL;\n }\n\n if (typeof window !== 'undefined' && window.LOG_LEVEL) {\n logger_level_name = window.LOG_LEVEL;\n }\n\n var logger_level = LOG_LEVELS[logger_level_name];\n var type_level = LOG_LEVELS[type];\n\n if (!(type_level >= logger_level)) {\n // Do nothing if type is not greater than or equal to logger level (handle undefined)\n return;\n }\n\n var log = console.log.bind(console);\n\n if (type === 'ERROR' && console.error) {\n log = console.error.bind(console);\n }\n\n if (type === 'WARN' && console.warn) {\n log = console.warn.bind(console);\n }\n\n var prefix = \"[\" + type + \"] \" + this._ts() + \" \" + this.name;\n\n if (msg.length === 1 && typeof msg[0] === 'string') {\n log(prefix + \" - \" + msg[0]);\n } else if (msg.length === 1) {\n log(prefix, msg[0]);\n } else if (typeof msg[0] === 'string') {\n var obj = msg.slice(1);\n\n if (obj.length === 1) {\n obj = obj[0];\n }\n\n log(prefix + \" - \" + msg[0], obj);\n } else {\n log(prefix, msg);\n }\n };\n /**\n * Write General log. Default to INFO\n * @method\n * @memeberof Logger\n * @param {string|object} msg - Logging message or object\n */\n\n\n ConsoleLogger.prototype.log = function () {\n var msg = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n msg[_i] = arguments[_i];\n }\n\n this._log.apply(this, __spread(['INFO'], msg));\n };\n /**\n * Write INFO log\n * @method\n * @memeberof Logger\n * @param {string|object} msg - Logging message or object\n */\n\n\n ConsoleLogger.prototype.info = function () {\n var msg = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n msg[_i] = arguments[_i];\n }\n\n this._log.apply(this, __spread(['INFO'], msg));\n };\n /**\n * Write WARN log\n * @method\n * @memeberof Logger\n * @param {string|object} msg - Logging message or object\n */\n\n\n ConsoleLogger.prototype.warn = function () {\n var msg = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n msg[_i] = arguments[_i];\n }\n\n this._log.apply(this, __spread(['WARN'], msg));\n };\n /**\n * Write ERROR log\n * @method\n * @memeberof Logger\n * @param {string|object} msg - Logging message or object\n */\n\n\n ConsoleLogger.prototype.error = function () {\n var msg = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n msg[_i] = arguments[_i];\n }\n\n this._log.apply(this, __spread(['ERROR'], msg));\n };\n /**\n * Write DEBUG log\n * @method\n * @memeberof Logger\n * @param {string|object} msg - Logging message or object\n */\n\n\n ConsoleLogger.prototype.debug = function () {\n var msg = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n msg[_i] = arguments[_i];\n }\n\n this._log.apply(this, __spread(['DEBUG'], msg));\n };\n /**\n * Write VERBOSE log\n * @method\n * @memeberof Logger\n * @param {string|object} msg - Logging message or object\n */\n\n\n ConsoleLogger.prototype.verbose = function () {\n var msg = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n msg[_i] = arguments[_i];\n }\n\n this._log.apply(this, __spread(['VERBOSE'], msg));\n };\n\n ConsoleLogger.LOG_LEVEL = null;\n return ConsoleLogger;\n}();\n\nexport { ConsoleLogger };","'use strict';\n\nvar utils = require('../utils');\n\nvar assert = utils.assert;\nvar parseBytes = utils.parseBytes;\nvar cachedProperty = utils.cachedProperty;\n/**\n* @param {EDDSA} eddsa - instance\n* @param {Object} params - public/private key parameters\n*\n* @param {Array} [params.secret] - secret seed bytes\n* @param {Point} [params.pub] - public key point (aka `A` in eddsa terms)\n* @param {Array} [params.pub] - public key point encoded as bytes\n*\n*/\n\nfunction KeyPair(eddsa, params) {\n this.eddsa = eddsa;\n this._secret = parseBytes(params.secret);\n if (eddsa.isPoint(params.pub)) this._pub = params.pub;else this._pubBytes = parseBytes(params.pub);\n}\n\nKeyPair.fromPublic = function fromPublic(eddsa, pub) {\n if (pub instanceof KeyPair) return pub;\n return new KeyPair(eddsa, {\n pub: pub\n });\n};\n\nKeyPair.fromSecret = function fromSecret(eddsa, secret) {\n if (secret instanceof KeyPair) return secret;\n return new KeyPair(eddsa, {\n secret: secret\n });\n};\n\nKeyPair.prototype.secret = function secret() {\n return this._secret;\n};\n\ncachedProperty(KeyPair, 'pubBytes', function pubBytes() {\n return this.eddsa.encodePoint(this.pub());\n});\ncachedProperty(KeyPair, 'pub', function pub() {\n if (this._pubBytes) return this.eddsa.decodePoint(this._pubBytes);\n return this.eddsa.g.mul(this.priv());\n});\ncachedProperty(KeyPair, 'privBytes', function privBytes() {\n var eddsa = this.eddsa;\n var hash = this.hash();\n var lastIx = eddsa.encodingLength - 1;\n var a = hash.slice(0, eddsa.encodingLength);\n a[0] &= 248;\n a[lastIx] &= 127;\n a[lastIx] |= 64;\n return a;\n});\ncachedProperty(KeyPair, 'priv', function priv() {\n return this.eddsa.decodeInt(this.privBytes());\n});\ncachedProperty(KeyPair, 'hash', function hash() {\n return this.eddsa.hash().update(this.secret()).digest();\n});\ncachedProperty(KeyPair, 'messagePrefix', function messagePrefix() {\n return this.hash().slice(this.eddsa.encodingLength);\n});\n\nKeyPair.prototype.sign = function sign(message) {\n assert(this._secret, 'KeyPair can only verify');\n return this.eddsa.sign(message, this);\n};\n\nKeyPair.prototype.verify = function verify(message, sig) {\n return this.eddsa.verify(message, sig, this);\n};\n\nKeyPair.prototype.getSecret = function getSecret(enc) {\n assert(this._secret, 'KeyPair is public only');\n return utils.encode(this.secret(), enc);\n};\n\nKeyPair.prototype.getPublic = function getPublic(enc) {\n return utils.encode(this.pubBytes(), enc);\n};\n\nmodule.exports = KeyPair;","/* @generated */\n// prettier-ignore\nif (Intl.RelativeTimeFormat && typeof Intl.RelativeTimeFormat.__addLocaleData === 'function') {\n Intl.RelativeTimeFormat.__addLocaleData({\n \"data\": {\n \"ar-AE\": {\n \"year\": {\n \"0\": \"هذه السنة\",\n \"1\": \"السنة التالية\",\n \"future\": {\n \"zero\": \"خلال {0} سنة\",\n \"one\": \"خلال سنة واحدة\",\n \"two\": \"خلال سنتين\",\n \"few\": \"خلال {0} سنوات\",\n \"many\": \"خلال {0} سنة\",\n \"other\": \"خلال {0} سنة\"\n },\n \"past\": {\n \"zero\": \"قبل {0} سنة\",\n \"one\": \"قبل سنة واحدة\",\n \"two\": \"قبل سنتين\",\n \"few\": \"قبل {0} سنوات\",\n \"many\": \"قبل {0} سنة\",\n \"other\": \"قبل {0} سنة\"\n },\n \"-1\": \"السنة الماضية\"\n },\n \"year-short\": {\n \"0\": \"هذه السنة\",\n \"1\": \"السنة التالية\",\n \"future\": {\n \"zero\": \"خلال {0} سنة\",\n \"one\": \"خلال سنة واحدة\",\n \"two\": \"خلال سنتين\",\n \"few\": \"خلال {0} سنوات\",\n \"many\": \"خلال {0} سنة\",\n \"other\": \"خلال {0} سنة\"\n },\n \"past\": {\n \"zero\": \"قبل {0} سنة\",\n \"one\": \"قبل سنة واحدة\",\n \"two\": \"قبل سنتين\",\n \"few\": \"قبل {0} سنوات\",\n \"many\": \"قبل {0} سنة\",\n \"other\": \"قبل {0} سنة\"\n },\n \"-1\": \"السنة الماضية\"\n },\n \"year-narrow\": {\n \"0\": \"هذه السنة\",\n \"1\": \"السنة التالية\",\n \"future\": {\n \"zero\": \"خلال {0} سنة\",\n \"one\": \"خلال سنة واحدة\",\n \"two\": \"خلال سنتين\",\n \"few\": \"خلال {0} سنوات\",\n \"many\": \"خلال {0} سنة\",\n \"other\": \"خلال {0} سنة\"\n },\n \"past\": {\n \"zero\": \"قبل {0} سنة\",\n \"one\": \"قبل سنة واحدة\",\n \"two\": \"قبل سنتين\",\n \"few\": \"قبل {0} سنوات\",\n \"many\": \"قبل {0} سنة\",\n \"other\": \"قبل {0} سنة\"\n },\n \"-1\": \"السنة الماضية\"\n }\n },\n \"ar-DZ\": {\n \"nu\": [\"latn\"]\n },\n \"ar-EH\": {\n \"nu\": [\"latn\"]\n },\n \"ar-LY\": {\n \"nu\": [\"latn\"]\n },\n \"ar-MA\": {\n \"nu\": [\"latn\"]\n },\n \"ar-TN\": {\n \"nu\": [\"latn\"]\n },\n \"ar\": {\n \"nu\": [\"arab\"],\n \"year\": {\n \"0\": \"السنة الحالية\",\n \"1\": \"السنة القادمة\",\n \"future\": {\n \"zero\": \"خلال {0} سنة\",\n \"one\": \"خلال سنة واحدة\",\n \"two\": \"خلال سنتين\",\n \"few\": \"خلال {0} سنوات\",\n \"many\": \"خلال {0} سنة\",\n \"other\": \"خلال {0} سنة\"\n },\n \"past\": {\n \"zero\": \"قبل {0} سنة\",\n \"one\": \"قبل سنة واحدة\",\n \"two\": \"قبل سنتين\",\n \"few\": \"قبل {0} سنوات\",\n \"many\": \"قبل {0} سنة\",\n \"other\": \"قبل {0} سنة\"\n },\n \"-1\": \"السنة الماضية\"\n },\n \"year-short\": {\n \"0\": \"السنة الحالية\",\n \"1\": \"السنة القادمة\",\n \"future\": {\n \"zero\": \"خلال {0} سنة\",\n \"one\": \"خلال سنة واحدة\",\n \"two\": \"خلال سنتين\",\n \"few\": \"خلال {0} سنوات\",\n \"many\": \"خلال {0} سنة\",\n \"other\": \"خلال {0} سنة\"\n },\n \"past\": {\n \"zero\": \"قبل {0} سنة\",\n \"one\": \"قبل سنة واحدة\",\n \"two\": \"قبل سنتين\",\n \"few\": \"قبل {0} سنوات\",\n \"many\": \"قبل {0} سنة\",\n \"other\": \"قبل {0} سنة\"\n },\n \"-1\": \"السنة الماضية\"\n },\n \"year-narrow\": {\n \"0\": \"السنة الحالية\",\n \"1\": \"السنة القادمة\",\n \"future\": {\n \"zero\": \"خلال {0} سنة\",\n \"one\": \"خلال سنة واحدة\",\n \"two\": \"خلال سنتين\",\n \"few\": \"خلال {0} سنوات\",\n \"many\": \"خلال {0} سنة\",\n \"other\": \"خلال {0} سنة\"\n },\n \"past\": {\n \"zero\": \"قبل {0} سنة\",\n \"one\": \"قبل سنة واحدة\",\n \"two\": \"قبل سنتين\",\n \"few\": \"قبل {0} سنوات\",\n \"many\": \"قبل {0} سنة\",\n \"other\": \"قبل {0} سنة\"\n },\n \"-1\": \"السنة الماضية\"\n },\n \"quarter\": {\n \"0\": \"هذا الربع\",\n \"1\": \"الربع القادم\",\n \"future\": {\n \"zero\": \"خلال {0} ربع سنة\",\n \"one\": \"خلال ربع سنة واحد\",\n \"two\": \"خلال ربعي سنة\",\n \"few\": \"خلال {0} أرباع سنة\",\n \"many\": \"خلال {0} ربع سنة\",\n \"other\": \"خلال {0} ربع سنة\"\n },\n \"past\": {\n \"zero\": \"قبل {0} ربع سنة\",\n \"one\": \"قبل ربع سنة واحد\",\n \"two\": \"قبل ربعي سنة\",\n \"few\": \"قبل {0} أرباع سنة\",\n \"many\": \"قبل {0} ربع سنة\",\n \"other\": \"قبل {0} ربع سنة\"\n },\n \"-1\": \"الربع الأخير\"\n },\n \"quarter-short\": {\n \"0\": \"هذا الربع\",\n \"1\": \"الربع القادم\",\n \"future\": {\n \"zero\": \"خلال {0} ربع سنة\",\n \"one\": \"خلال ربع سنة واحد\",\n \"two\": \"خلال ربعي سنة\",\n \"few\": \"خلال {0} أرباع سنة\",\n \"many\": \"خلال {0} ربع سنة\",\n \"other\": \"خلال {0} ربع سنة\"\n },\n \"past\": {\n \"zero\": \"قبل {0} ربع سنة\",\n \"one\": \"قبل ربع سنة واحد\",\n \"two\": \"قبل ربعي سنة\",\n \"few\": \"قبل {0} أرباع سنة\",\n \"many\": \"قبل {0} ربع سنة\",\n \"other\": \"قبل {0} ربع سنة\"\n },\n \"-1\": \"الربع الأخير\"\n },\n \"quarter-narrow\": {\n \"0\": \"هذا الربع\",\n \"1\": \"الربع القادم\",\n \"future\": {\n \"zero\": \"خلال {0} ربع سنة\",\n \"one\": \"خلال ربع سنة واحد\",\n \"two\": \"خلال ربعي سنة\",\n \"few\": \"خلال {0} أرباع سنة\",\n \"many\": \"خلال {0} ربع سنة\",\n \"other\": \"خلال {0} ربع سنة\"\n },\n \"past\": {\n \"zero\": \"قبل {0} ربع سنة\",\n \"one\": \"قبل ربع سنة واحد\",\n \"two\": \"قبل ربعي سنة\",\n \"few\": \"قبل {0} أرباع سنة\",\n \"many\": \"قبل {0} ربع سنة\",\n \"other\": \"قبل {0} ربع سنة\"\n },\n \"-1\": \"الربع الأخير\"\n },\n \"month\": {\n \"0\": \"هذا الشهر\",\n \"1\": \"الشهر القادم\",\n \"future\": {\n \"zero\": \"خلال {0} شهر\",\n \"one\": \"خلال شهر واحد\",\n \"two\": \"خلال شهرين\",\n \"few\": \"خلال {0} أشهر\",\n \"many\": \"خلال {0} شهرًا\",\n \"other\": \"خلال {0} شهر\"\n },\n \"past\": {\n \"zero\": \"قبل {0} شهر\",\n \"one\": \"قبل شهر واحد\",\n \"two\": \"قبل شهرين\",\n \"few\": \"قبل {0} أشهر\",\n \"many\": \"قبل {0} شهرًا\",\n \"other\": \"قبل {0} شهر\"\n },\n \"-1\": \"الشهر الماضي\"\n },\n \"month-short\": {\n \"0\": \"هذا الشهر\",\n \"1\": \"الشهر القادم\",\n \"future\": {\n \"zero\": \"خلال {0} شهر\",\n \"one\": \"خلال شهر واحد\",\n \"two\": \"خلال شهرين\",\n \"few\": \"خلال {0} أشهر\",\n \"many\": \"خلال {0} شهرًا\",\n \"other\": \"خلال {0} شهر\"\n },\n \"past\": {\n \"zero\": \"قبل {0} شهر\",\n \"one\": \"قبل شهر واحد\",\n \"two\": \"قبل شهرين\",\n \"few\": \"خلال {0} أشهر\",\n \"many\": \"قبل {0} شهرًا\",\n \"other\": \"قبل {0} شهر\"\n },\n \"-1\": \"الشهر الماضي\"\n },\n \"month-narrow\": {\n \"0\": \"هذا الشهر\",\n \"1\": \"الشهر القادم\",\n \"future\": {\n \"zero\": \"خلال {0} شهر\",\n \"one\": \"خلال شهر واحد\",\n \"two\": \"خلال شهرين\",\n \"few\": \"خلال {0} أشهر\",\n \"many\": \"خلال {0} شهرًا\",\n \"other\": \"خلال {0} شهر\"\n },\n \"past\": {\n \"zero\": \"قبل {0} شهر\",\n \"one\": \"قبل شهر واحد\",\n \"two\": \"قبل شهرين\",\n \"few\": \"قبل {0} أشهر\",\n \"many\": \"قبل {0} شهرًا\",\n \"other\": \"قبل {0} شهر\"\n },\n \"-1\": \"الشهر الماضي\"\n },\n \"week\": {\n \"0\": \"هذا الأسبوع\",\n \"1\": \"الأسبوع القادم\",\n \"future\": {\n \"zero\": \"خلال {0} أسبوع\",\n \"one\": \"خلال أسبوع واحد\",\n \"two\": \"خلال أسبوعين\",\n \"few\": \"خلال {0} أسابيع\",\n \"many\": \"خلال {0} أسبوعًا\",\n \"other\": \"خلال {0} أسبوع\"\n },\n \"past\": {\n \"zero\": \"قبل {0} أسبوع\",\n \"one\": \"قبل أسبوع واحد\",\n \"two\": \"قبل أسبوعين\",\n \"few\": \"قبل {0} أسابيع\",\n \"many\": \"قبل {0} أسبوعًا\",\n \"other\": \"قبل {0} أسبوع\"\n },\n \"-1\": \"الأسبوع الماضي\"\n },\n \"week-short\": {\n \"0\": \"هذا الأسبوع\",\n \"1\": \"الأسبوع القادم\",\n \"future\": {\n \"zero\": \"خلال {0} أسبوع\",\n \"one\": \"خلال أسبوع واحد\",\n \"two\": \"خلال {0} أسبوعين\",\n \"few\": \"خلال {0} أسابيع\",\n \"many\": \"خلال {0} أسبوعًا\",\n \"other\": \"خلال {0} أسبوع\"\n },\n \"past\": {\n \"zero\": \"قبل {0} أسبوع\",\n \"one\": \"قبل أسبوع واحد\",\n \"two\": \"قبل أسبوعين\",\n \"few\": \"قبل {0} أسابيع\",\n \"many\": \"قبل {0} أسبوعًا\",\n \"other\": \"قبل {0} أسبوع\"\n },\n \"-1\": \"الأسبوع الماضي\"\n },\n \"week-narrow\": {\n \"0\": \"هذا الأسبوع\",\n \"1\": \"الأسبوع القادم\",\n \"future\": {\n \"zero\": \"خلال {0} أسبوع\",\n \"one\": \"خلال أسبوع واحد\",\n \"two\": \"خلال أسبوعين\",\n \"few\": \"خلال {0} أسابيع\",\n \"many\": \"خلال {0} أسبوعًا\",\n \"other\": \"خلال {0} أسبوع\"\n },\n \"past\": {\n \"zero\": \"قبل {0} أسبوع\",\n \"one\": \"قبل أسبوع واحد\",\n \"two\": \"قبل أسبوعين\",\n \"few\": \"قبل {0} أسابيع\",\n \"many\": \"قبل {0} أسبوعًا\",\n \"other\": \"قبل {0} أسبوع\"\n },\n \"-1\": \"الأسبوع الماضي\"\n },\n \"day\": {\n \"0\": \"اليوم\",\n \"1\": \"غدًا\",\n \"2\": \"بعد الغد\",\n \"future\": {\n \"zero\": \"خلال {0} يوم\",\n \"one\": \"خلال يوم واحد\",\n \"two\": \"خلال يومين\",\n \"few\": \"خلال {0} أيام\",\n \"many\": \"خلال {0} يومًا\",\n \"other\": \"خلال {0} يوم\"\n },\n \"past\": {\n \"zero\": \"قبل {0} يوم\",\n \"one\": \"قبل يوم واحد\",\n \"two\": \"قبل يومين\",\n \"few\": \"قبل {0} أيام\",\n \"many\": \"قبل {0} يومًا\",\n \"other\": \"قبل {0} يوم\"\n },\n \"-2\": \"أول أمس\",\n \"-1\": \"أمس\"\n },\n \"day-short\": {\n \"0\": \"اليوم\",\n \"1\": \"غدًا\",\n \"2\": \"بعد الغد\",\n \"future\": {\n \"zero\": \"خلال {0} يوم\",\n \"one\": \"خلال يوم واحد\",\n \"two\": \"خلال يومين\",\n \"few\": \"خلال {0} أيام\",\n \"many\": \"خلال {0} يومًا\",\n \"other\": \"خلال {0} يوم\"\n },\n \"past\": {\n \"zero\": \"قبل {0} يوم\",\n \"one\": \"قبل يوم واحد\",\n \"two\": \"قبل يومين\",\n \"few\": \"قبل {0} أيام\",\n \"many\": \"قبل {0} يومًا\",\n \"other\": \"قبل {0} يوم\"\n },\n \"-2\": \"أول أمس\",\n \"-1\": \"أمس\"\n },\n \"day-narrow\": {\n \"0\": \"اليوم\",\n \"1\": \"غدًا\",\n \"2\": \"بعد الغد\",\n \"future\": {\n \"zero\": \"خلال {0} يوم\",\n \"one\": \"خلال يوم واحد\",\n \"two\": \"خلال يومين\",\n \"few\": \"خلال {0} أيام\",\n \"many\": \"خلال {0} يومًا\",\n \"other\": \"خلال {0} يوم\"\n },\n \"past\": {\n \"zero\": \"قبل {0} يوم\",\n \"one\": \"قبل يوم واحد\",\n \"two\": \"قبل يومين\",\n \"few\": \"قبل {0} أيام\",\n \"many\": \"قبل {0} يومًا\",\n \"other\": \"قبل {0} يوم\"\n },\n \"-2\": \"أول أمس\",\n \"-1\": \"أمس\"\n },\n \"hour\": {\n \"0\": \"الساعة الحالية\",\n \"future\": {\n \"zero\": \"خلال {0} ساعة\",\n \"one\": \"خلال ساعة واحدة\",\n \"two\": \"خلال ساعتين\",\n \"few\": \"خلال {0} ساعات\",\n \"many\": \"خلال {0} ساعة\",\n \"other\": \"خلال {0} ساعة\"\n },\n \"past\": {\n \"zero\": \"قبل {0} ساعة\",\n \"one\": \"قبل ساعة واحدة\",\n \"two\": \"قبل ساعتين\",\n \"few\": \"قبل {0} ساعات\",\n \"many\": \"قبل {0} ساعة\",\n \"other\": \"قبل {0} ساعة\"\n }\n },\n \"hour-short\": {\n \"0\": \"الساعة الحالية\",\n \"future\": {\n \"zero\": \"خلال {0} ساعة\",\n \"one\": \"خلال ساعة واحدة\",\n \"two\": \"خلال ساعتين\",\n \"few\": \"خلال {0} ساعات\",\n \"many\": \"خلال {0} ساعة\",\n \"other\": \"خلال {0} ساعة\"\n },\n \"past\": {\n \"zero\": \"قبل {0} ساعة\",\n \"one\": \"قبل ساعة واحدة\",\n \"two\": \"قبل ساعتين\",\n \"few\": \"قبل {0} ساعات\",\n \"many\": \"قبل {0} ساعة\",\n \"other\": \"قبل {0} ساعة\"\n }\n },\n \"hour-narrow\": {\n \"0\": \"الساعة الحالية\",\n \"future\": {\n \"zero\": \"خلال {0} ساعة\",\n \"one\": \"خلال ساعة واحدة\",\n \"two\": \"خلال ساعتين\",\n \"few\": \"خلال {0} ساعات\",\n \"many\": \"خلال {0} ساعة\",\n \"other\": \"خلال {0} ساعة\"\n },\n \"past\": {\n \"zero\": \"قبل {0} ساعة\",\n \"one\": \"قبل ساعة واحدة\",\n \"two\": \"قبل ساعتين\",\n \"few\": \"قبل {0} ساعات\",\n \"many\": \"قبل {0} ساعة\",\n \"other\": \"قبل {0} ساعة\"\n }\n },\n \"minute\": {\n \"0\": \"هذه الدقيقة\",\n \"future\": {\n \"zero\": \"خلال {0} دقيقة\",\n \"one\": \"خلال دقيقة واحدة\",\n \"two\": \"خلال دقيقتين\",\n \"few\": \"خلال {0} دقائق\",\n \"many\": \"خلال {0} دقيقة\",\n \"other\": \"خلال {0} دقيقة\"\n },\n \"past\": {\n \"zero\": \"قبل {0} دقيقة\",\n \"one\": \"قبل دقيقة واحدة\",\n \"two\": \"قبل دقيقتين\",\n \"few\": \"قبل {0} دقائق\",\n \"many\": \"قبل {0} دقيقة\",\n \"other\": \"قبل {0} دقيقة\"\n }\n },\n \"minute-short\": {\n \"0\": \"هذه الدقيقة\",\n \"future\": {\n \"zero\": \"خلال {0} دقيقة\",\n \"one\": \"خلال دقيقة واحدة\",\n \"two\": \"خلال دقيقتين\",\n \"few\": \"خلال {0} دقائق\",\n \"many\": \"خلال {0} دقيقة\",\n \"other\": \"خلال {0} دقيقة\"\n },\n \"past\": {\n \"zero\": \"قبل {0} دقيقة\",\n \"one\": \"قبل دقيقة واحدة\",\n \"two\": \"قبل دقيقتين\",\n \"few\": \"قبل {0} دقائق\",\n \"many\": \"قبل {0} دقيقة\",\n \"other\": \"قبل {0} دقيقة\"\n }\n },\n \"minute-narrow\": {\n \"0\": \"هذه الدقيقة\",\n \"future\": {\n \"zero\": \"خلال {0} دقيقة\",\n \"one\": \"خلال دقيقة واحدة\",\n \"two\": \"خلال دقيقتين\",\n \"few\": \"خلال {0} دقائق\",\n \"many\": \"خلال {0} دقيقة\",\n \"other\": \"خلال {0} دقيقة\"\n },\n \"past\": {\n \"zero\": \"قبل {0} دقيقة\",\n \"one\": \"قبل دقيقة واحدة\",\n \"two\": \"قبل دقيقتين\",\n \"few\": \"قبل {0} دقائق\",\n \"many\": \"قبل {0} دقيقة\",\n \"other\": \"قبل {0} دقيقة\"\n }\n },\n \"second\": {\n \"0\": \"الآن\",\n \"future\": {\n \"zero\": \"خلال {0} ثانية\",\n \"one\": \"خلال ثانية واحدة\",\n \"two\": \"خلال ثانيتين\",\n \"few\": \"خلال {0} ثوانٍ\",\n \"many\": \"خلال {0} ثانية\",\n \"other\": \"خلال {0} ثانية\"\n },\n \"past\": {\n \"zero\": \"قبل {0} ثانية\",\n \"one\": \"قبل ثانية واحدة\",\n \"two\": \"قبل ثانيتين\",\n \"few\": \"قبل {0} ثوانِ\",\n \"many\": \"قبل {0} ثانية\",\n \"other\": \"قبل {0} ثانية\"\n }\n },\n \"second-short\": {\n \"0\": \"الآن\",\n \"future\": {\n \"zero\": \"خلال {0} ثانية\",\n \"one\": \"خلال ثانية واحدة\",\n \"two\": \"خلال ثانيتين\",\n \"few\": \"خلال {0} ثوانٍ\",\n \"many\": \"خلال {0} ثانية\",\n \"other\": \"خلال {0} ثانية\"\n },\n \"past\": {\n \"zero\": \"قبل {0} ثانية\",\n \"one\": \"قبل ثانية واحدة\",\n \"two\": \"قبل ثانيتين\",\n \"few\": \"قبل {0} ثوانٍ\",\n \"many\": \"قبل {0} ثانية\",\n \"other\": \"قبل {0} ثانية\"\n }\n },\n \"second-narrow\": {\n \"0\": \"الآن\",\n \"future\": {\n \"zero\": \"خلال {0} ثانية\",\n \"one\": \"خلال ثانية واحدة\",\n \"two\": \"خلال ثانيتين\",\n \"few\": \"خلال {0} ثوانٍ\",\n \"many\": \"خلال {0} ثانية\",\n \"other\": \"خلال {0} ثانية\"\n },\n \"past\": {\n \"zero\": \"قبل {0} ثانية\",\n \"one\": \"قبل ثانية واحدة\",\n \"two\": \"قبل ثانيتين\",\n \"few\": \"قبل {0} ثوانٍ\",\n \"many\": \"قبل {0} ثانية\",\n \"other\": \"قبل {0} ثانية\"\n }\n }\n }\n },\n \"availableLocales\": [\"ar-AE\", \"ar-BH\", \"ar-DJ\", \"ar-DZ\", \"ar-EG\", \"ar-EH\", \"ar-ER\", \"ar-IL\", \"ar-IQ\", \"ar-JO\", \"ar-KM\", \"ar-KW\", \"ar-LB\", \"ar-LY\", \"ar-MA\", \"ar-MR\", \"ar-OM\", \"ar-PS\", \"ar-QA\", \"ar-SA\", \"ar-SD\", \"ar-SO\", \"ar-SS\", \"ar-SY\", \"ar-TD\", \"ar-TN\", \"ar-YE\", \"ar\"],\n \"aliases\": {},\n \"parentLocales\": {}\n });\n}","var DESCRIPTORS = require('../internals/descriptors');\nvar definePropertyModule = require('../internals/object-define-property');\nvar anObject = require('../internals/an-object');\nvar objectKeys = require('../internals/object-keys');\n\n// `Object.defineProperties` method\n// https://tc39.github.io/ecma262/#sec-object.defineproperties\nmodule.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) {\n anObject(O);\n var keys = objectKeys(Properties);\n var length = keys.length;\n var index = 0;\n var key;\n while (length > index) definePropertyModule.f(O, key = keys[index++], Properties[key]);\n return O;\n};\n","(function (module, exports) {\n 'use strict'; // Utils\n\n function assert(val, msg) {\n if (!val) throw new Error(msg || 'Assertion failed');\n } // Could use `inherits` module, but don't want to move from single file\n // architecture yet.\n\n\n function inherits(ctor, superCtor) {\n ctor.super_ = superCtor;\n\n var TempCtor = function TempCtor() {};\n\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n } // BN\n\n\n function BN(number, base, endian) {\n if (BN.isBN(number)) {\n return number;\n }\n\n this.negative = 0;\n this.words = null;\n this.length = 0; // Reduction context\n\n this.red = null;\n\n if (number !== null) {\n if (base === 'le' || base === 'be') {\n endian = base;\n base = 10;\n }\n\n this._init(number || 0, base || 10, endian || 'be');\n }\n }\n\n if (typeof module === 'object') {\n module.exports = BN;\n } else {\n exports.BN = BN;\n }\n\n BN.BN = BN;\n BN.wordSize = 26;\n var Buffer;\n\n try {\n Buffer = require('buffer').Buffer;\n } catch (e) {}\n\n BN.isBN = function isBN(num) {\n if (num instanceof BN) {\n return true;\n }\n\n return num !== null && typeof num === 'object' && num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);\n };\n\n BN.max = function max(left, right) {\n if (left.cmp(right) > 0) return left;\n return right;\n };\n\n BN.min = function min(left, right) {\n if (left.cmp(right) < 0) return left;\n return right;\n };\n\n BN.prototype._init = function init(number, base, endian) {\n if (typeof number === 'number') {\n return this._initNumber(number, base, endian);\n }\n\n if (typeof number === 'object') {\n return this._initArray(number, base, endian);\n }\n\n if (base === 'hex') {\n base = 16;\n }\n\n assert(base === (base | 0) && base >= 2 && base <= 36);\n number = number.toString().replace(/\\s+/g, '');\n var start = 0;\n\n if (number[0] === '-') {\n start++;\n }\n\n if (base === 16) {\n this._parseHex(number, start);\n } else {\n this._parseBase(number, base, start);\n }\n\n if (number[0] === '-') {\n this.negative = 1;\n }\n\n this._strip();\n\n if (endian !== 'le') return;\n\n this._initArray(this.toArray(), base, endian);\n };\n\n BN.prototype._initNumber = function _initNumber(number, base, endian) {\n if (number < 0) {\n this.negative = 1;\n number = -number;\n }\n\n if (number < 0x4000000) {\n this.words = [number & 0x3ffffff];\n this.length = 1;\n } else if (number < 0x10000000000000) {\n this.words = [number & 0x3ffffff, number / 0x4000000 & 0x3ffffff];\n this.length = 2;\n } else {\n assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)\n\n this.words = [number & 0x3ffffff, number / 0x4000000 & 0x3ffffff, 1];\n this.length = 3;\n }\n\n if (endian !== 'le') return; // Reverse the bytes\n\n this._initArray(this.toArray(), base, endian);\n };\n\n BN.prototype._initArray = function _initArray(number, base, endian) {\n // Perhaps a Uint8Array\n assert(typeof number.length === 'number');\n\n if (number.length <= 0) {\n this.words = [0];\n this.length = 1;\n return this;\n }\n\n this.length = Math.ceil(number.length / 3);\n this.words = new Array(this.length);\n\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n var j, w;\n var off = 0;\n\n if (endian === 'be') {\n for (i = number.length - 1, j = 0; i >= 0; i -= 3) {\n w = number[i] | number[i - 1] << 8 | number[i - 2] << 16;\n this.words[j] |= w << off & 0x3ffffff;\n this.words[j + 1] = w >>> 26 - off & 0x3ffffff;\n off += 24;\n\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n } else if (endian === 'le') {\n for (i = 0, j = 0; i < number.length; i += 3) {\n w = number[i] | number[i + 1] << 8 | number[i + 2] << 16;\n this.words[j] |= w << off & 0x3ffffff;\n this.words[j + 1] = w >>> 26 - off & 0x3ffffff;\n off += 24;\n\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n }\n\n return this._strip();\n };\n\n function parseHex(str, start, end) {\n var r = 0;\n var len = Math.min(str.length, end);\n var z = 0;\n\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n r <<= 4;\n var b; // 'a' - 'f'\n\n if (c >= 49 && c <= 54) {\n b = c - 49 + 0xa; // 'A' - 'F'\n } else if (c >= 17 && c <= 22) {\n b = c - 17 + 0xa; // '0' - '9'\n } else {\n b = c;\n }\n\n r |= b;\n z |= b;\n }\n\n assert(!(z & 0xf0), 'Invalid character in ' + str);\n return r;\n }\n\n BN.prototype._parseHex = function _parseHex(number, start) {\n // Create possibly bigger array to ensure that it fits the number\n this.length = Math.ceil((number.length - start) / 6);\n this.words = new Array(this.length);\n\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n var j, w; // Scan 24-bit chunks and add them to the number\n\n var off = 0;\n\n for (i = number.length - 6, j = 0; i >= start; i -= 6) {\n w = parseHex(number, i, i + 6);\n this.words[j] |= w << off & 0x3ffffff; // NOTE: `0x3fffff` is intentional here, 26bits max shift + 24bit hex limb\n\n this.words[j + 1] |= w >>> 26 - off & 0x3fffff;\n off += 24;\n\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n\n if (i + 6 !== start) {\n w = parseHex(number, start, i + 6);\n this.words[j] |= w << off & 0x3ffffff;\n this.words[j + 1] |= w >>> 26 - off & 0x3fffff;\n }\n\n this._strip();\n };\n\n function parseBase(str, start, end, mul) {\n var r = 0;\n var b = 0;\n var len = Math.min(str.length, end);\n\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n r *= mul; // 'a'\n\n if (c >= 49) {\n b = c - 49 + 0xa; // 'A'\n } else if (c >= 17) {\n b = c - 17 + 0xa; // '0' - '9'\n } else {\n b = c;\n }\n\n assert(c >= 0 && b < mul, 'Invalid character');\n r += b;\n }\n\n return r;\n }\n\n BN.prototype._parseBase = function _parseBase(number, base, start) {\n // Initialize as zero\n this.words = [0];\n this.length = 1; // Find length of limb in base\n\n for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {\n limbLen++;\n }\n\n limbLen--;\n limbPow = limbPow / base | 0;\n var total = number.length - start;\n var mod = total % limbLen;\n var end = Math.min(total, total - mod) + start;\n var word = 0;\n\n for (var i = start; i < end; i += limbLen) {\n word = parseBase(number, i, i + limbLen, base);\n this.imuln(limbPow);\n\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n if (mod !== 0) {\n var pow = 1;\n word = parseBase(number, i, number.length, base);\n\n for (i = 0; i < mod; i++) {\n pow *= base;\n }\n\n this.imuln(pow);\n\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n };\n\n BN.prototype.copy = function copy(dest) {\n dest.words = new Array(this.length);\n\n for (var i = 0; i < this.length; i++) {\n dest.words[i] = this.words[i];\n }\n\n dest.length = this.length;\n dest.negative = this.negative;\n dest.red = this.red;\n };\n\n function move(dest, src) {\n dest.words = src.words;\n dest.length = src.length;\n dest.negative = src.negative;\n dest.red = src.red;\n }\n\n BN.prototype._move = function _move(dest) {\n move(dest, this);\n };\n\n BN.prototype.clone = function clone() {\n var r = new BN(null);\n this.copy(r);\n return r;\n };\n\n BN.prototype._expand = function _expand(size) {\n while (this.length < size) {\n this.words[this.length++] = 0;\n }\n\n return this;\n }; // Remove leading `0` from `this`\n\n\n BN.prototype._strip = function strip() {\n while (this.length > 1 && this.words[this.length - 1] === 0) {\n this.length--;\n }\n\n return this._normSign();\n };\n\n BN.prototype._normSign = function _normSign() {\n // -0 = 0\n if (this.length === 1 && this.words[0] === 0) {\n this.negative = 0;\n }\n\n return this;\n }; // Check Symbol.for because not everywhere where Symbol defined\n // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#Browser_compatibility\n\n\n if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') {\n try {\n BN.prototype[Symbol.for('nodejs.util.inspect.custom')] = inspect;\n } catch (e) {\n BN.prototype.inspect = inspect;\n }\n } else {\n BN.prototype.inspect = inspect;\n }\n\n function inspect() {\n return (this.red ? '';\n }\n /*\n var zeros = [];\n var groupSizes = [];\n var groupBases = [];\n var s = '';\n var i = -1;\n while (++i < BN.wordSize) {\n zeros[i] = s;\n s += '0';\n }\n groupSizes[0] = 0;\n groupSizes[1] = 0;\n groupBases[0] = 0;\n groupBases[1] = 0;\n var base = 2 - 1;\n while (++base < 36 + 1) {\n var groupSize = 0;\n var groupBase = 1;\n while (groupBase < (1 << BN.wordSize) / base) {\n groupBase *= base;\n groupSize += 1;\n }\n groupSizes[base] = groupSize;\n groupBases[base] = groupBase;\n }\n */\n\n\n var zeros = ['', '0', '00', '000', '0000', '00000', '000000', '0000000', '00000000', '000000000', '0000000000', '00000000000', '000000000000', '0000000000000', '00000000000000', '000000000000000', '0000000000000000', '00000000000000000', '000000000000000000', '0000000000000000000', '00000000000000000000', '000000000000000000000', '0000000000000000000000', '00000000000000000000000', '000000000000000000000000', '0000000000000000000000000'];\n var groupSizes = [0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5];\n var groupBases = [0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176];\n\n BN.prototype.toString = function toString(base, padding) {\n base = base || 10;\n padding = padding | 0 || 1;\n var out;\n\n if (base === 16 || base === 'hex') {\n out = '';\n var off = 0;\n var carry = 0;\n\n for (var i = 0; i < this.length; i++) {\n var w = this.words[i];\n var word = ((w << off | carry) & 0xffffff).toString(16);\n carry = w >>> 24 - off & 0xffffff;\n\n if (carry !== 0 || i !== this.length - 1) {\n out = zeros[6 - word.length] + word + out;\n } else {\n out = word + out;\n }\n\n off += 2;\n\n if (off >= 26) {\n off -= 26;\n i--;\n }\n }\n\n if (carry !== 0) {\n out = carry.toString(16) + out;\n }\n\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n\n if (this.negative !== 0) {\n out = '-' + out;\n }\n\n return out;\n }\n\n if (base === (base | 0) && base >= 2 && base <= 36) {\n // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));\n var groupSize = groupSizes[base]; // var groupBase = Math.pow(base, groupSize);\n\n var groupBase = groupBases[base];\n out = '';\n var c = this.clone();\n c.negative = 0;\n\n while (!c.isZero()) {\n var r = c.modrn(groupBase).toString(base);\n c = c.idivn(groupBase);\n\n if (!c.isZero()) {\n out = zeros[groupSize - r.length] + r + out;\n } else {\n out = r + out;\n }\n }\n\n if (this.isZero()) {\n out = '0' + out;\n }\n\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n\n if (this.negative !== 0) {\n out = '-' + out;\n }\n\n return out;\n }\n\n assert(false, 'Base should be between 2 and 36');\n };\n\n BN.prototype.toNumber = function toNumber() {\n var ret = this.words[0];\n\n if (this.length === 2) {\n ret += this.words[1] * 0x4000000;\n } else if (this.length === 3 && this.words[2] === 0x01) {\n // NOTE: at this stage it is known that the top bit is set\n ret += 0x10000000000000 + this.words[1] * 0x4000000;\n } else if (this.length > 2) {\n assert(false, 'Number can only safely store up to 53 bits');\n }\n\n return this.negative !== 0 ? -ret : ret;\n };\n\n BN.prototype.toJSON = function toJSON() {\n return this.toString(16, 2);\n };\n\n if (Buffer) {\n BN.prototype.toBuffer = function toBuffer(endian, length) {\n return this.toArrayLike(Buffer, endian, length);\n };\n }\n\n BN.prototype.toArray = function toArray(endian, length) {\n return this.toArrayLike(Array, endian, length);\n };\n\n var allocate = function allocate(ArrayType, size) {\n if (ArrayType.allocUnsafe) {\n return ArrayType.allocUnsafe(size);\n }\n\n return new ArrayType(size);\n };\n\n BN.prototype.toArrayLike = function toArrayLike(ArrayType, endian, length) {\n this._strip();\n\n var byteLength = this.byteLength();\n var reqLength = length || Math.max(1, byteLength);\n assert(byteLength <= reqLength, 'byte array longer than desired length');\n assert(reqLength > 0, 'Requested array length <= 0');\n var res = allocate(ArrayType, reqLength);\n var postfix = endian === 'le' ? 'LE' : 'BE';\n this['_toArrayLike' + postfix](res, byteLength);\n return res;\n };\n\n BN.prototype._toArrayLikeLE = function _toArrayLikeLE(res, byteLength) {\n var position = 0;\n var carry = 0;\n\n for (var i = 0, shift = 0; i < this.length; i++) {\n var word = this.words[i] << shift | carry;\n res[position++] = word & 0xff;\n\n if (position < res.length) {\n res[position++] = word >> 8 & 0xff;\n }\n\n if (position < res.length) {\n res[position++] = word >> 16 & 0xff;\n }\n\n if (shift === 6) {\n if (position < res.length) {\n res[position++] = word >> 24 & 0xff;\n }\n\n carry = 0;\n shift = 0;\n } else {\n carry = word >>> 24;\n shift += 2;\n }\n }\n\n if (position < res.length) {\n res[position++] = carry;\n\n while (position < res.length) {\n res[position++] = 0;\n }\n }\n };\n\n BN.prototype._toArrayLikeBE = function _toArrayLikeBE(res, byteLength) {\n var position = res.length - 1;\n var carry = 0;\n\n for (var i = 0, shift = 0; i < this.length; i++) {\n var word = this.words[i] << shift | carry;\n res[position--] = word & 0xff;\n\n if (position >= 0) {\n res[position--] = word >> 8 & 0xff;\n }\n\n if (position >= 0) {\n res[position--] = word >> 16 & 0xff;\n }\n\n if (shift === 6) {\n if (position >= 0) {\n res[position--] = word >> 24 & 0xff;\n }\n\n carry = 0;\n shift = 0;\n } else {\n carry = word >>> 24;\n shift += 2;\n }\n }\n\n if (position >= 0) {\n res[position--] = carry;\n\n while (position >= 0) {\n res[position--] = 0;\n }\n }\n };\n\n if (Math.clz32) {\n BN.prototype._countBits = function _countBits(w) {\n return 32 - Math.clz32(w);\n };\n } else {\n BN.prototype._countBits = function _countBits(w) {\n var t = w;\n var r = 0;\n\n if (t >= 0x1000) {\n r += 13;\n t >>>= 13;\n }\n\n if (t >= 0x40) {\n r += 7;\n t >>>= 7;\n }\n\n if (t >= 0x8) {\n r += 4;\n t >>>= 4;\n }\n\n if (t >= 0x02) {\n r += 2;\n t >>>= 2;\n }\n\n return r + t;\n };\n }\n\n BN.prototype._zeroBits = function _zeroBits(w) {\n // Short-cut\n if (w === 0) return 26;\n var t = w;\n var r = 0;\n\n if ((t & 0x1fff) === 0) {\n r += 13;\n t >>>= 13;\n }\n\n if ((t & 0x7f) === 0) {\n r += 7;\n t >>>= 7;\n }\n\n if ((t & 0xf) === 0) {\n r += 4;\n t >>>= 4;\n }\n\n if ((t & 0x3) === 0) {\n r += 2;\n t >>>= 2;\n }\n\n if ((t & 0x1) === 0) {\n r++;\n }\n\n return r;\n }; // Return number of used bits in a BN\n\n\n BN.prototype.bitLength = function bitLength() {\n var w = this.words[this.length - 1];\n\n var hi = this._countBits(w);\n\n return (this.length - 1) * 26 + hi;\n };\n\n function toBitArray(num) {\n var w = new Array(num.bitLength());\n\n for (var bit = 0; bit < w.length; bit++) {\n var off = bit / 26 | 0;\n var wbit = bit % 26;\n w[bit] = num.words[off] >>> wbit & 0x01;\n }\n\n return w;\n } // Number of trailing zero bits\n\n\n BN.prototype.zeroBits = function zeroBits() {\n if (this.isZero()) return 0;\n var r = 0;\n\n for (var i = 0; i < this.length; i++) {\n var b = this._zeroBits(this.words[i]);\n\n r += b;\n if (b !== 26) break;\n }\n\n return r;\n };\n\n BN.prototype.byteLength = function byteLength() {\n return Math.ceil(this.bitLength() / 8);\n };\n\n BN.prototype.toTwos = function toTwos(width) {\n if (this.negative !== 0) {\n return this.abs().inotn(width).iaddn(1);\n }\n\n return this.clone();\n };\n\n BN.prototype.fromTwos = function fromTwos(width) {\n if (this.testn(width - 1)) {\n return this.notn(width).iaddn(1).ineg();\n }\n\n return this.clone();\n };\n\n BN.prototype.isNeg = function isNeg() {\n return this.negative !== 0;\n }; // Return negative clone of `this`\n\n\n BN.prototype.neg = function neg() {\n return this.clone().ineg();\n };\n\n BN.prototype.ineg = function ineg() {\n if (!this.isZero()) {\n this.negative ^= 1;\n }\n\n return this;\n }; // Or `num` with `this` in-place\n\n\n BN.prototype.iuor = function iuor(num) {\n while (this.length < num.length) {\n this.words[this.length++] = 0;\n }\n\n for (var i = 0; i < num.length; i++) {\n this.words[i] = this.words[i] | num.words[i];\n }\n\n return this._strip();\n };\n\n BN.prototype.ior = function ior(num) {\n assert((this.negative | num.negative) === 0);\n return this.iuor(num);\n }; // Or `num` with `this`\n\n\n BN.prototype.or = function or(num) {\n if (this.length > num.length) return this.clone().ior(num);\n return num.clone().ior(this);\n };\n\n BN.prototype.uor = function uor(num) {\n if (this.length > num.length) return this.clone().iuor(num);\n return num.clone().iuor(this);\n }; // And `num` with `this` in-place\n\n\n BN.prototype.iuand = function iuand(num) {\n // b = min-length(num, this)\n var b;\n\n if (this.length > num.length) {\n b = num;\n } else {\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = this.words[i] & num.words[i];\n }\n\n this.length = b.length;\n return this._strip();\n };\n\n BN.prototype.iand = function iand(num) {\n assert((this.negative | num.negative) === 0);\n return this.iuand(num);\n }; // And `num` with `this`\n\n\n BN.prototype.and = function and(num) {\n if (this.length > num.length) return this.clone().iand(num);\n return num.clone().iand(this);\n };\n\n BN.prototype.uand = function uand(num) {\n if (this.length > num.length) return this.clone().iuand(num);\n return num.clone().iuand(this);\n }; // Xor `num` with `this` in-place\n\n\n BN.prototype.iuxor = function iuxor(num) {\n // a.length > b.length\n var a;\n var b;\n\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = a.words[i] ^ b.words[i];\n }\n\n if (this !== a) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = a.length;\n return this._strip();\n };\n\n BN.prototype.ixor = function ixor(num) {\n assert((this.negative | num.negative) === 0);\n return this.iuxor(num);\n }; // Xor `num` with `this`\n\n\n BN.prototype.xor = function xor(num) {\n if (this.length > num.length) return this.clone().ixor(num);\n return num.clone().ixor(this);\n };\n\n BN.prototype.uxor = function uxor(num) {\n if (this.length > num.length) return this.clone().iuxor(num);\n return num.clone().iuxor(this);\n }; // Not ``this`` with ``width`` bitwidth\n\n\n BN.prototype.inotn = function inotn(width) {\n assert(typeof width === 'number' && width >= 0);\n var bytesNeeded = Math.ceil(width / 26) | 0;\n var bitsLeft = width % 26; // Extend the buffer with leading zeroes\n\n this._expand(bytesNeeded);\n\n if (bitsLeft > 0) {\n bytesNeeded--;\n } // Handle complete words\n\n\n for (var i = 0; i < bytesNeeded; i++) {\n this.words[i] = ~this.words[i] & 0x3ffffff;\n } // Handle the residue\n\n\n if (bitsLeft > 0) {\n this.words[i] = ~this.words[i] & 0x3ffffff >> 26 - bitsLeft;\n } // And remove leading zeroes\n\n\n return this._strip();\n };\n\n BN.prototype.notn = function notn(width) {\n return this.clone().inotn(width);\n }; // Set `bit` of `this`\n\n\n BN.prototype.setn = function setn(bit, val) {\n assert(typeof bit === 'number' && bit >= 0);\n var off = bit / 26 | 0;\n var wbit = bit % 26;\n\n this._expand(off + 1);\n\n if (val) {\n this.words[off] = this.words[off] | 1 << wbit;\n } else {\n this.words[off] = this.words[off] & ~(1 << wbit);\n }\n\n return this._strip();\n }; // Add `num` to `this` in-place\n\n\n BN.prototype.iadd = function iadd(num) {\n var r; // negative + positive\n\n if (this.negative !== 0 && num.negative === 0) {\n this.negative = 0;\n r = this.isub(num);\n this.negative ^= 1;\n return this._normSign(); // positive + negative\n } else if (this.negative === 0 && num.negative !== 0) {\n num.negative = 0;\n r = this.isub(num);\n num.negative = 1;\n return r._normSign();\n } // a.length > b.length\n\n\n var a, b;\n\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) + (b.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n\n this.length = a.length;\n\n if (carry !== 0) {\n this.words[this.length] = carry;\n this.length++; // Copy the rest of the words\n } else if (a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n return this;\n }; // Add `num` to `this`\n\n\n BN.prototype.add = function add(num) {\n var res;\n\n if (num.negative !== 0 && this.negative === 0) {\n num.negative = 0;\n res = this.sub(num);\n num.negative ^= 1;\n return res;\n } else if (num.negative === 0 && this.negative !== 0) {\n this.negative = 0;\n res = num.sub(this);\n this.negative = 1;\n return res;\n }\n\n if (this.length > num.length) return this.clone().iadd(num);\n return num.clone().iadd(this);\n }; // Subtract `num` from `this` in-place\n\n\n BN.prototype.isub = function isub(num) {\n // this - (-num) = this + num\n if (num.negative !== 0) {\n num.negative = 0;\n var r = this.iadd(num);\n num.negative = 1;\n return r._normSign(); // -this - num = -(this + num)\n } else if (this.negative !== 0) {\n this.negative = 0;\n this.iadd(num);\n this.negative = 1;\n return this._normSign();\n } // At this point both numbers are positive\n\n\n var cmp = this.cmp(num); // Optimization - zeroify\n\n if (cmp === 0) {\n this.negative = 0;\n this.length = 1;\n this.words[0] = 0;\n return this;\n } // a > b\n\n\n var a, b;\n\n if (cmp > 0) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) - (b.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n } // Copy rest of the words\n\n\n if (carry === 0 && i < a.length && a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = Math.max(this.length, i);\n\n if (a !== this) {\n this.negative = 1;\n }\n\n return this._strip();\n }; // Subtract `num` from `this`\n\n\n BN.prototype.sub = function sub(num) {\n return this.clone().isub(num);\n };\n\n function smallMulTo(self, num, out) {\n out.negative = num.negative ^ self.negative;\n var len = self.length + num.length | 0;\n out.length = len;\n len = len - 1 | 0; // Peel one iteration (compiler can't do it, because of code complexity)\n\n var a = self.words[0] | 0;\n var b = num.words[0] | 0;\n var r = a * b;\n var lo = r & 0x3ffffff;\n var carry = r / 0x4000000 | 0;\n out.words[0] = lo;\n\n for (var k = 1; k < len; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = carry >>> 26;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = k - j | 0;\n a = self.words[i] | 0;\n b = num.words[j] | 0;\n r = a * b + rword;\n ncarry += r / 0x4000000 | 0;\n rword = r & 0x3ffffff;\n }\n\n out.words[k] = rword | 0;\n carry = ncarry | 0;\n }\n\n if (carry !== 0) {\n out.words[k] = carry | 0;\n } else {\n out.length--;\n }\n\n return out._strip();\n } // TODO(indutny): it may be reasonable to omit it for users who don't need\n // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit\n // multiplication (like elliptic secp256k1).\n\n\n var comb10MulTo = function comb10MulTo(self, num, out) {\n var a = self.words;\n var b = num.words;\n var o = out.words;\n var c = 0;\n var lo;\n var mid;\n var hi;\n var a0 = a[0] | 0;\n var al0 = a0 & 0x1fff;\n var ah0 = a0 >>> 13;\n var a1 = a[1] | 0;\n var al1 = a1 & 0x1fff;\n var ah1 = a1 >>> 13;\n var a2 = a[2] | 0;\n var al2 = a2 & 0x1fff;\n var ah2 = a2 >>> 13;\n var a3 = a[3] | 0;\n var al3 = a3 & 0x1fff;\n var ah3 = a3 >>> 13;\n var a4 = a[4] | 0;\n var al4 = a4 & 0x1fff;\n var ah4 = a4 >>> 13;\n var a5 = a[5] | 0;\n var al5 = a5 & 0x1fff;\n var ah5 = a5 >>> 13;\n var a6 = a[6] | 0;\n var al6 = a6 & 0x1fff;\n var ah6 = a6 >>> 13;\n var a7 = a[7] | 0;\n var al7 = a7 & 0x1fff;\n var ah7 = a7 >>> 13;\n var a8 = a[8] | 0;\n var al8 = a8 & 0x1fff;\n var ah8 = a8 >>> 13;\n var a9 = a[9] | 0;\n var al9 = a9 & 0x1fff;\n var ah9 = a9 >>> 13;\n var b0 = b[0] | 0;\n var bl0 = b0 & 0x1fff;\n var bh0 = b0 >>> 13;\n var b1 = b[1] | 0;\n var bl1 = b1 & 0x1fff;\n var bh1 = b1 >>> 13;\n var b2 = b[2] | 0;\n var bl2 = b2 & 0x1fff;\n var bh2 = b2 >>> 13;\n var b3 = b[3] | 0;\n var bl3 = b3 & 0x1fff;\n var bh3 = b3 >>> 13;\n var b4 = b[4] | 0;\n var bl4 = b4 & 0x1fff;\n var bh4 = b4 >>> 13;\n var b5 = b[5] | 0;\n var bl5 = b5 & 0x1fff;\n var bh5 = b5 >>> 13;\n var b6 = b[6] | 0;\n var bl6 = b6 & 0x1fff;\n var bh6 = b6 >>> 13;\n var b7 = b[7] | 0;\n var bl7 = b7 & 0x1fff;\n var bh7 = b7 >>> 13;\n var b8 = b[8] | 0;\n var bl8 = b8 & 0x1fff;\n var bh8 = b8 >>> 13;\n var b9 = b[9] | 0;\n var bl9 = b9 & 0x1fff;\n var bh9 = b9 >>> 13;\n out.negative = self.negative ^ num.negative;\n out.length = 19;\n /* k = 0 */\n\n lo = Math.imul(al0, bl0);\n mid = Math.imul(al0, bh0);\n mid = mid + Math.imul(ah0, bl0) | 0;\n hi = Math.imul(ah0, bh0);\n var w0 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w0 >>> 26) | 0;\n w0 &= 0x3ffffff;\n /* k = 1 */\n\n lo = Math.imul(al1, bl0);\n mid = Math.imul(al1, bh0);\n mid = mid + Math.imul(ah1, bl0) | 0;\n hi = Math.imul(ah1, bh0);\n lo = lo + Math.imul(al0, bl1) | 0;\n mid = mid + Math.imul(al0, bh1) | 0;\n mid = mid + Math.imul(ah0, bl1) | 0;\n hi = hi + Math.imul(ah0, bh1) | 0;\n var w1 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w1 >>> 26) | 0;\n w1 &= 0x3ffffff;\n /* k = 2 */\n\n lo = Math.imul(al2, bl0);\n mid = Math.imul(al2, bh0);\n mid = mid + Math.imul(ah2, bl0) | 0;\n hi = Math.imul(ah2, bh0);\n lo = lo + Math.imul(al1, bl1) | 0;\n mid = mid + Math.imul(al1, bh1) | 0;\n mid = mid + Math.imul(ah1, bl1) | 0;\n hi = hi + Math.imul(ah1, bh1) | 0;\n lo = lo + Math.imul(al0, bl2) | 0;\n mid = mid + Math.imul(al0, bh2) | 0;\n mid = mid + Math.imul(ah0, bl2) | 0;\n hi = hi + Math.imul(ah0, bh2) | 0;\n var w2 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w2 >>> 26) | 0;\n w2 &= 0x3ffffff;\n /* k = 3 */\n\n lo = Math.imul(al3, bl0);\n mid = Math.imul(al3, bh0);\n mid = mid + Math.imul(ah3, bl0) | 0;\n hi = Math.imul(ah3, bh0);\n lo = lo + Math.imul(al2, bl1) | 0;\n mid = mid + Math.imul(al2, bh1) | 0;\n mid = mid + Math.imul(ah2, bl1) | 0;\n hi = hi + Math.imul(ah2, bh1) | 0;\n lo = lo + Math.imul(al1, bl2) | 0;\n mid = mid + Math.imul(al1, bh2) | 0;\n mid = mid + Math.imul(ah1, bl2) | 0;\n hi = hi + Math.imul(ah1, bh2) | 0;\n lo = lo + Math.imul(al0, bl3) | 0;\n mid = mid + Math.imul(al0, bh3) | 0;\n mid = mid + Math.imul(ah0, bl3) | 0;\n hi = hi + Math.imul(ah0, bh3) | 0;\n var w3 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w3 >>> 26) | 0;\n w3 &= 0x3ffffff;\n /* k = 4 */\n\n lo = Math.imul(al4, bl0);\n mid = Math.imul(al4, bh0);\n mid = mid + Math.imul(ah4, bl0) | 0;\n hi = Math.imul(ah4, bh0);\n lo = lo + Math.imul(al3, bl1) | 0;\n mid = mid + Math.imul(al3, bh1) | 0;\n mid = mid + Math.imul(ah3, bl1) | 0;\n hi = hi + Math.imul(ah3, bh1) | 0;\n lo = lo + Math.imul(al2, bl2) | 0;\n mid = mid + Math.imul(al2, bh2) | 0;\n mid = mid + Math.imul(ah2, bl2) | 0;\n hi = hi + Math.imul(ah2, bh2) | 0;\n lo = lo + Math.imul(al1, bl3) | 0;\n mid = mid + Math.imul(al1, bh3) | 0;\n mid = mid + Math.imul(ah1, bl3) | 0;\n hi = hi + Math.imul(ah1, bh3) | 0;\n lo = lo + Math.imul(al0, bl4) | 0;\n mid = mid + Math.imul(al0, bh4) | 0;\n mid = mid + Math.imul(ah0, bl4) | 0;\n hi = hi + Math.imul(ah0, bh4) | 0;\n var w4 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w4 >>> 26) | 0;\n w4 &= 0x3ffffff;\n /* k = 5 */\n\n lo = Math.imul(al5, bl0);\n mid = Math.imul(al5, bh0);\n mid = mid + Math.imul(ah5, bl0) | 0;\n hi = Math.imul(ah5, bh0);\n lo = lo + Math.imul(al4, bl1) | 0;\n mid = mid + Math.imul(al4, bh1) | 0;\n mid = mid + Math.imul(ah4, bl1) | 0;\n hi = hi + Math.imul(ah4, bh1) | 0;\n lo = lo + Math.imul(al3, bl2) | 0;\n mid = mid + Math.imul(al3, bh2) | 0;\n mid = mid + Math.imul(ah3, bl2) | 0;\n hi = hi + Math.imul(ah3, bh2) | 0;\n lo = lo + Math.imul(al2, bl3) | 0;\n mid = mid + Math.imul(al2, bh3) | 0;\n mid = mid + Math.imul(ah2, bl3) | 0;\n hi = hi + Math.imul(ah2, bh3) | 0;\n lo = lo + Math.imul(al1, bl4) | 0;\n mid = mid + Math.imul(al1, bh4) | 0;\n mid = mid + Math.imul(ah1, bl4) | 0;\n hi = hi + Math.imul(ah1, bh4) | 0;\n lo = lo + Math.imul(al0, bl5) | 0;\n mid = mid + Math.imul(al0, bh5) | 0;\n mid = mid + Math.imul(ah0, bl5) | 0;\n hi = hi + Math.imul(ah0, bh5) | 0;\n var w5 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w5 >>> 26) | 0;\n w5 &= 0x3ffffff;\n /* k = 6 */\n\n lo = Math.imul(al6, bl0);\n mid = Math.imul(al6, bh0);\n mid = mid + Math.imul(ah6, bl0) | 0;\n hi = Math.imul(ah6, bh0);\n lo = lo + Math.imul(al5, bl1) | 0;\n mid = mid + Math.imul(al5, bh1) | 0;\n mid = mid + Math.imul(ah5, bl1) | 0;\n hi = hi + Math.imul(ah5, bh1) | 0;\n lo = lo + Math.imul(al4, bl2) | 0;\n mid = mid + Math.imul(al4, bh2) | 0;\n mid = mid + Math.imul(ah4, bl2) | 0;\n hi = hi + Math.imul(ah4, bh2) | 0;\n lo = lo + Math.imul(al3, bl3) | 0;\n mid = mid + Math.imul(al3, bh3) | 0;\n mid = mid + Math.imul(ah3, bl3) | 0;\n hi = hi + Math.imul(ah3, bh3) | 0;\n lo = lo + Math.imul(al2, bl4) | 0;\n mid = mid + Math.imul(al2, bh4) | 0;\n mid = mid + Math.imul(ah2, bl4) | 0;\n hi = hi + Math.imul(ah2, bh4) | 0;\n lo = lo + Math.imul(al1, bl5) | 0;\n mid = mid + Math.imul(al1, bh5) | 0;\n mid = mid + Math.imul(ah1, bl5) | 0;\n hi = hi + Math.imul(ah1, bh5) | 0;\n lo = lo + Math.imul(al0, bl6) | 0;\n mid = mid + Math.imul(al0, bh6) | 0;\n mid = mid + Math.imul(ah0, bl6) | 0;\n hi = hi + Math.imul(ah0, bh6) | 0;\n var w6 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w6 >>> 26) | 0;\n w6 &= 0x3ffffff;\n /* k = 7 */\n\n lo = Math.imul(al7, bl0);\n mid = Math.imul(al7, bh0);\n mid = mid + Math.imul(ah7, bl0) | 0;\n hi = Math.imul(ah7, bh0);\n lo = lo + Math.imul(al6, bl1) | 0;\n mid = mid + Math.imul(al6, bh1) | 0;\n mid = mid + Math.imul(ah6, bl1) | 0;\n hi = hi + Math.imul(ah6, bh1) | 0;\n lo = lo + Math.imul(al5, bl2) | 0;\n mid = mid + Math.imul(al5, bh2) | 0;\n mid = mid + Math.imul(ah5, bl2) | 0;\n hi = hi + Math.imul(ah5, bh2) | 0;\n lo = lo + Math.imul(al4, bl3) | 0;\n mid = mid + Math.imul(al4, bh3) | 0;\n mid = mid + Math.imul(ah4, bl3) | 0;\n hi = hi + Math.imul(ah4, bh3) | 0;\n lo = lo + Math.imul(al3, bl4) | 0;\n mid = mid + Math.imul(al3, bh4) | 0;\n mid = mid + Math.imul(ah3, bl4) | 0;\n hi = hi + Math.imul(ah3, bh4) | 0;\n lo = lo + Math.imul(al2, bl5) | 0;\n mid = mid + Math.imul(al2, bh5) | 0;\n mid = mid + Math.imul(ah2, bl5) | 0;\n hi = hi + Math.imul(ah2, bh5) | 0;\n lo = lo + Math.imul(al1, bl6) | 0;\n mid = mid + Math.imul(al1, bh6) | 0;\n mid = mid + Math.imul(ah1, bl6) | 0;\n hi = hi + Math.imul(ah1, bh6) | 0;\n lo = lo + Math.imul(al0, bl7) | 0;\n mid = mid + Math.imul(al0, bh7) | 0;\n mid = mid + Math.imul(ah0, bl7) | 0;\n hi = hi + Math.imul(ah0, bh7) | 0;\n var w7 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w7 >>> 26) | 0;\n w7 &= 0x3ffffff;\n /* k = 8 */\n\n lo = Math.imul(al8, bl0);\n mid = Math.imul(al8, bh0);\n mid = mid + Math.imul(ah8, bl0) | 0;\n hi = Math.imul(ah8, bh0);\n lo = lo + Math.imul(al7, bl1) | 0;\n mid = mid + Math.imul(al7, bh1) | 0;\n mid = mid + Math.imul(ah7, bl1) | 0;\n hi = hi + Math.imul(ah7, bh1) | 0;\n lo = lo + Math.imul(al6, bl2) | 0;\n mid = mid + Math.imul(al6, bh2) | 0;\n mid = mid + Math.imul(ah6, bl2) | 0;\n hi = hi + Math.imul(ah6, bh2) | 0;\n lo = lo + Math.imul(al5, bl3) | 0;\n mid = mid + Math.imul(al5, bh3) | 0;\n mid = mid + Math.imul(ah5, bl3) | 0;\n hi = hi + Math.imul(ah5, bh3) | 0;\n lo = lo + Math.imul(al4, bl4) | 0;\n mid = mid + Math.imul(al4, bh4) | 0;\n mid = mid + Math.imul(ah4, bl4) | 0;\n hi = hi + Math.imul(ah4, bh4) | 0;\n lo = lo + Math.imul(al3, bl5) | 0;\n mid = mid + Math.imul(al3, bh5) | 0;\n mid = mid + Math.imul(ah3, bl5) | 0;\n hi = hi + Math.imul(ah3, bh5) | 0;\n lo = lo + Math.imul(al2, bl6) | 0;\n mid = mid + Math.imul(al2, bh6) | 0;\n mid = mid + Math.imul(ah2, bl6) | 0;\n hi = hi + Math.imul(ah2, bh6) | 0;\n lo = lo + Math.imul(al1, bl7) | 0;\n mid = mid + Math.imul(al1, bh7) | 0;\n mid = mid + Math.imul(ah1, bl7) | 0;\n hi = hi + Math.imul(ah1, bh7) | 0;\n lo = lo + Math.imul(al0, bl8) | 0;\n mid = mid + Math.imul(al0, bh8) | 0;\n mid = mid + Math.imul(ah0, bl8) | 0;\n hi = hi + Math.imul(ah0, bh8) | 0;\n var w8 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w8 >>> 26) | 0;\n w8 &= 0x3ffffff;\n /* k = 9 */\n\n lo = Math.imul(al9, bl0);\n mid = Math.imul(al9, bh0);\n mid = mid + Math.imul(ah9, bl0) | 0;\n hi = Math.imul(ah9, bh0);\n lo = lo + Math.imul(al8, bl1) | 0;\n mid = mid + Math.imul(al8, bh1) | 0;\n mid = mid + Math.imul(ah8, bl1) | 0;\n hi = hi + Math.imul(ah8, bh1) | 0;\n lo = lo + Math.imul(al7, bl2) | 0;\n mid = mid + Math.imul(al7, bh2) | 0;\n mid = mid + Math.imul(ah7, bl2) | 0;\n hi = hi + Math.imul(ah7, bh2) | 0;\n lo = lo + Math.imul(al6, bl3) | 0;\n mid = mid + Math.imul(al6, bh3) | 0;\n mid = mid + Math.imul(ah6, bl3) | 0;\n hi = hi + Math.imul(ah6, bh3) | 0;\n lo = lo + Math.imul(al5, bl4) | 0;\n mid = mid + Math.imul(al5, bh4) | 0;\n mid = mid + Math.imul(ah5, bl4) | 0;\n hi = hi + Math.imul(ah5, bh4) | 0;\n lo = lo + Math.imul(al4, bl5) | 0;\n mid = mid + Math.imul(al4, bh5) | 0;\n mid = mid + Math.imul(ah4, bl5) | 0;\n hi = hi + Math.imul(ah4, bh5) | 0;\n lo = lo + Math.imul(al3, bl6) | 0;\n mid = mid + Math.imul(al3, bh6) | 0;\n mid = mid + Math.imul(ah3, bl6) | 0;\n hi = hi + Math.imul(ah3, bh6) | 0;\n lo = lo + Math.imul(al2, bl7) | 0;\n mid = mid + Math.imul(al2, bh7) | 0;\n mid = mid + Math.imul(ah2, bl7) | 0;\n hi = hi + Math.imul(ah2, bh7) | 0;\n lo = lo + Math.imul(al1, bl8) | 0;\n mid = mid + Math.imul(al1, bh8) | 0;\n mid = mid + Math.imul(ah1, bl8) | 0;\n hi = hi + Math.imul(ah1, bh8) | 0;\n lo = lo + Math.imul(al0, bl9) | 0;\n mid = mid + Math.imul(al0, bh9) | 0;\n mid = mid + Math.imul(ah0, bl9) | 0;\n hi = hi + Math.imul(ah0, bh9) | 0;\n var w9 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w9 >>> 26) | 0;\n w9 &= 0x3ffffff;\n /* k = 10 */\n\n lo = Math.imul(al9, bl1);\n mid = Math.imul(al9, bh1);\n mid = mid + Math.imul(ah9, bl1) | 0;\n hi = Math.imul(ah9, bh1);\n lo = lo + Math.imul(al8, bl2) | 0;\n mid = mid + Math.imul(al8, bh2) | 0;\n mid = mid + Math.imul(ah8, bl2) | 0;\n hi = hi + Math.imul(ah8, bh2) | 0;\n lo = lo + Math.imul(al7, bl3) | 0;\n mid = mid + Math.imul(al7, bh3) | 0;\n mid = mid + Math.imul(ah7, bl3) | 0;\n hi = hi + Math.imul(ah7, bh3) | 0;\n lo = lo + Math.imul(al6, bl4) | 0;\n mid = mid + Math.imul(al6, bh4) | 0;\n mid = mid + Math.imul(ah6, bl4) | 0;\n hi = hi + Math.imul(ah6, bh4) | 0;\n lo = lo + Math.imul(al5, bl5) | 0;\n mid = mid + Math.imul(al5, bh5) | 0;\n mid = mid + Math.imul(ah5, bl5) | 0;\n hi = hi + Math.imul(ah5, bh5) | 0;\n lo = lo + Math.imul(al4, bl6) | 0;\n mid = mid + Math.imul(al4, bh6) | 0;\n mid = mid + Math.imul(ah4, bl6) | 0;\n hi = hi + Math.imul(ah4, bh6) | 0;\n lo = lo + Math.imul(al3, bl7) | 0;\n mid = mid + Math.imul(al3, bh7) | 0;\n mid = mid + Math.imul(ah3, bl7) | 0;\n hi = hi + Math.imul(ah3, bh7) | 0;\n lo = lo + Math.imul(al2, bl8) | 0;\n mid = mid + Math.imul(al2, bh8) | 0;\n mid = mid + Math.imul(ah2, bl8) | 0;\n hi = hi + Math.imul(ah2, bh8) | 0;\n lo = lo + Math.imul(al1, bl9) | 0;\n mid = mid + Math.imul(al1, bh9) | 0;\n mid = mid + Math.imul(ah1, bl9) | 0;\n hi = hi + Math.imul(ah1, bh9) | 0;\n var w10 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w10 >>> 26) | 0;\n w10 &= 0x3ffffff;\n /* k = 11 */\n\n lo = Math.imul(al9, bl2);\n mid = Math.imul(al9, bh2);\n mid = mid + Math.imul(ah9, bl2) | 0;\n hi = Math.imul(ah9, bh2);\n lo = lo + Math.imul(al8, bl3) | 0;\n mid = mid + Math.imul(al8, bh3) | 0;\n mid = mid + Math.imul(ah8, bl3) | 0;\n hi = hi + Math.imul(ah8, bh3) | 0;\n lo = lo + Math.imul(al7, bl4) | 0;\n mid = mid + Math.imul(al7, bh4) | 0;\n mid = mid + Math.imul(ah7, bl4) | 0;\n hi = hi + Math.imul(ah7, bh4) | 0;\n lo = lo + Math.imul(al6, bl5) | 0;\n mid = mid + Math.imul(al6, bh5) | 0;\n mid = mid + Math.imul(ah6, bl5) | 0;\n hi = hi + Math.imul(ah6, bh5) | 0;\n lo = lo + Math.imul(al5, bl6) | 0;\n mid = mid + Math.imul(al5, bh6) | 0;\n mid = mid + Math.imul(ah5, bl6) | 0;\n hi = hi + Math.imul(ah5, bh6) | 0;\n lo = lo + Math.imul(al4, bl7) | 0;\n mid = mid + Math.imul(al4, bh7) | 0;\n mid = mid + Math.imul(ah4, bl7) | 0;\n hi = hi + Math.imul(ah4, bh7) | 0;\n lo = lo + Math.imul(al3, bl8) | 0;\n mid = mid + Math.imul(al3, bh8) | 0;\n mid = mid + Math.imul(ah3, bl8) | 0;\n hi = hi + Math.imul(ah3, bh8) | 0;\n lo = lo + Math.imul(al2, bl9) | 0;\n mid = mid + Math.imul(al2, bh9) | 0;\n mid = mid + Math.imul(ah2, bl9) | 0;\n hi = hi + Math.imul(ah2, bh9) | 0;\n var w11 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w11 >>> 26) | 0;\n w11 &= 0x3ffffff;\n /* k = 12 */\n\n lo = Math.imul(al9, bl3);\n mid = Math.imul(al9, bh3);\n mid = mid + Math.imul(ah9, bl3) | 0;\n hi = Math.imul(ah9, bh3);\n lo = lo + Math.imul(al8, bl4) | 0;\n mid = mid + Math.imul(al8, bh4) | 0;\n mid = mid + Math.imul(ah8, bl4) | 0;\n hi = hi + Math.imul(ah8, bh4) | 0;\n lo = lo + Math.imul(al7, bl5) | 0;\n mid = mid + Math.imul(al7, bh5) | 0;\n mid = mid + Math.imul(ah7, bl5) | 0;\n hi = hi + Math.imul(ah7, bh5) | 0;\n lo = lo + Math.imul(al6, bl6) | 0;\n mid = mid + Math.imul(al6, bh6) | 0;\n mid = mid + Math.imul(ah6, bl6) | 0;\n hi = hi + Math.imul(ah6, bh6) | 0;\n lo = lo + Math.imul(al5, bl7) | 0;\n mid = mid + Math.imul(al5, bh7) | 0;\n mid = mid + Math.imul(ah5, bl7) | 0;\n hi = hi + Math.imul(ah5, bh7) | 0;\n lo = lo + Math.imul(al4, bl8) | 0;\n mid = mid + Math.imul(al4, bh8) | 0;\n mid = mid + Math.imul(ah4, bl8) | 0;\n hi = hi + Math.imul(ah4, bh8) | 0;\n lo = lo + Math.imul(al3, bl9) | 0;\n mid = mid + Math.imul(al3, bh9) | 0;\n mid = mid + Math.imul(ah3, bl9) | 0;\n hi = hi + Math.imul(ah3, bh9) | 0;\n var w12 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w12 >>> 26) | 0;\n w12 &= 0x3ffffff;\n /* k = 13 */\n\n lo = Math.imul(al9, bl4);\n mid = Math.imul(al9, bh4);\n mid = mid + Math.imul(ah9, bl4) | 0;\n hi = Math.imul(ah9, bh4);\n lo = lo + Math.imul(al8, bl5) | 0;\n mid = mid + Math.imul(al8, bh5) | 0;\n mid = mid + Math.imul(ah8, bl5) | 0;\n hi = hi + Math.imul(ah8, bh5) | 0;\n lo = lo + Math.imul(al7, bl6) | 0;\n mid = mid + Math.imul(al7, bh6) | 0;\n mid = mid + Math.imul(ah7, bl6) | 0;\n hi = hi + Math.imul(ah7, bh6) | 0;\n lo = lo + Math.imul(al6, bl7) | 0;\n mid = mid + Math.imul(al6, bh7) | 0;\n mid = mid + Math.imul(ah6, bl7) | 0;\n hi = hi + Math.imul(ah6, bh7) | 0;\n lo = lo + Math.imul(al5, bl8) | 0;\n mid = mid + Math.imul(al5, bh8) | 0;\n mid = mid + Math.imul(ah5, bl8) | 0;\n hi = hi + Math.imul(ah5, bh8) | 0;\n lo = lo + Math.imul(al4, bl9) | 0;\n mid = mid + Math.imul(al4, bh9) | 0;\n mid = mid + Math.imul(ah4, bl9) | 0;\n hi = hi + Math.imul(ah4, bh9) | 0;\n var w13 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w13 >>> 26) | 0;\n w13 &= 0x3ffffff;\n /* k = 14 */\n\n lo = Math.imul(al9, bl5);\n mid = Math.imul(al9, bh5);\n mid = mid + Math.imul(ah9, bl5) | 0;\n hi = Math.imul(ah9, bh5);\n lo = lo + Math.imul(al8, bl6) | 0;\n mid = mid + Math.imul(al8, bh6) | 0;\n mid = mid + Math.imul(ah8, bl6) | 0;\n hi = hi + Math.imul(ah8, bh6) | 0;\n lo = lo + Math.imul(al7, bl7) | 0;\n mid = mid + Math.imul(al7, bh7) | 0;\n mid = mid + Math.imul(ah7, bl7) | 0;\n hi = hi + Math.imul(ah7, bh7) | 0;\n lo = lo + Math.imul(al6, bl8) | 0;\n mid = mid + Math.imul(al6, bh8) | 0;\n mid = mid + Math.imul(ah6, bl8) | 0;\n hi = hi + Math.imul(ah6, bh8) | 0;\n lo = lo + Math.imul(al5, bl9) | 0;\n mid = mid + Math.imul(al5, bh9) | 0;\n mid = mid + Math.imul(ah5, bl9) | 0;\n hi = hi + Math.imul(ah5, bh9) | 0;\n var w14 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w14 >>> 26) | 0;\n w14 &= 0x3ffffff;\n /* k = 15 */\n\n lo = Math.imul(al9, bl6);\n mid = Math.imul(al9, bh6);\n mid = mid + Math.imul(ah9, bl6) | 0;\n hi = Math.imul(ah9, bh6);\n lo = lo + Math.imul(al8, bl7) | 0;\n mid = mid + Math.imul(al8, bh7) | 0;\n mid = mid + Math.imul(ah8, bl7) | 0;\n hi = hi + Math.imul(ah8, bh7) | 0;\n lo = lo + Math.imul(al7, bl8) | 0;\n mid = mid + Math.imul(al7, bh8) | 0;\n mid = mid + Math.imul(ah7, bl8) | 0;\n hi = hi + Math.imul(ah7, bh8) | 0;\n lo = lo + Math.imul(al6, bl9) | 0;\n mid = mid + Math.imul(al6, bh9) | 0;\n mid = mid + Math.imul(ah6, bl9) | 0;\n hi = hi + Math.imul(ah6, bh9) | 0;\n var w15 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w15 >>> 26) | 0;\n w15 &= 0x3ffffff;\n /* k = 16 */\n\n lo = Math.imul(al9, bl7);\n mid = Math.imul(al9, bh7);\n mid = mid + Math.imul(ah9, bl7) | 0;\n hi = Math.imul(ah9, bh7);\n lo = lo + Math.imul(al8, bl8) | 0;\n mid = mid + Math.imul(al8, bh8) | 0;\n mid = mid + Math.imul(ah8, bl8) | 0;\n hi = hi + Math.imul(ah8, bh8) | 0;\n lo = lo + Math.imul(al7, bl9) | 0;\n mid = mid + Math.imul(al7, bh9) | 0;\n mid = mid + Math.imul(ah7, bl9) | 0;\n hi = hi + Math.imul(ah7, bh9) | 0;\n var w16 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w16 >>> 26) | 0;\n w16 &= 0x3ffffff;\n /* k = 17 */\n\n lo = Math.imul(al9, bl8);\n mid = Math.imul(al9, bh8);\n mid = mid + Math.imul(ah9, bl8) | 0;\n hi = Math.imul(ah9, bh8);\n lo = lo + Math.imul(al8, bl9) | 0;\n mid = mid + Math.imul(al8, bh9) | 0;\n mid = mid + Math.imul(ah8, bl9) | 0;\n hi = hi + Math.imul(ah8, bh9) | 0;\n var w17 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w17 >>> 26) | 0;\n w17 &= 0x3ffffff;\n /* k = 18 */\n\n lo = Math.imul(al9, bl9);\n mid = Math.imul(al9, bh9);\n mid = mid + Math.imul(ah9, bl9) | 0;\n hi = Math.imul(ah9, bh9);\n var w18 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w18 >>> 26) | 0;\n w18 &= 0x3ffffff;\n o[0] = w0;\n o[1] = w1;\n o[2] = w2;\n o[3] = w3;\n o[4] = w4;\n o[5] = w5;\n o[6] = w6;\n o[7] = w7;\n o[8] = w8;\n o[9] = w9;\n o[10] = w10;\n o[11] = w11;\n o[12] = w12;\n o[13] = w13;\n o[14] = w14;\n o[15] = w15;\n o[16] = w16;\n o[17] = w17;\n o[18] = w18;\n\n if (c !== 0) {\n o[19] = c;\n out.length++;\n }\n\n return out;\n }; // Polyfill comb\n\n\n if (!Math.imul) {\n comb10MulTo = smallMulTo;\n }\n\n function bigMulTo(self, num, out) {\n out.negative = num.negative ^ self.negative;\n out.length = self.length + num.length;\n var carry = 0;\n var hncarry = 0;\n\n for (var k = 0; k < out.length - 1; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = hncarry;\n hncarry = 0;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = k - j;\n var a = self.words[i] | 0;\n var b = num.words[j] | 0;\n var r = a * b;\n var lo = r & 0x3ffffff;\n ncarry = ncarry + (r / 0x4000000 | 0) | 0;\n lo = lo + rword | 0;\n rword = lo & 0x3ffffff;\n ncarry = ncarry + (lo >>> 26) | 0;\n hncarry += ncarry >>> 26;\n ncarry &= 0x3ffffff;\n }\n\n out.words[k] = rword;\n carry = ncarry;\n ncarry = hncarry;\n }\n\n if (carry !== 0) {\n out.words[k] = carry;\n } else {\n out.length--;\n }\n\n return out._strip();\n }\n\n function jumboMulTo(self, num, out) {\n // Temporary disable, see https://github.com/indutny/bn.js/issues/211\n // var fftm = new FFTM();\n // return fftm.mulp(self, num, out);\n return bigMulTo(self, num, out);\n }\n\n BN.prototype.mulTo = function mulTo(num, out) {\n var res;\n var len = this.length + num.length;\n\n if (this.length === 10 && num.length === 10) {\n res = comb10MulTo(this, num, out);\n } else if (len < 63) {\n res = smallMulTo(this, num, out);\n } else if (len < 1024) {\n res = bigMulTo(this, num, out);\n } else {\n res = jumboMulTo(this, num, out);\n }\n\n return res;\n }; // Cooley-Tukey algorithm for FFT\n // slightly revisited to rely on looping instead of recursion\n\n\n function FFTM(x, y) {\n this.x = x;\n this.y = y;\n }\n\n FFTM.prototype.makeRBT = function makeRBT(N) {\n var t = new Array(N);\n var l = BN.prototype._countBits(N) - 1;\n\n for (var i = 0; i < N; i++) {\n t[i] = this.revBin(i, l, N);\n }\n\n return t;\n }; // Returns binary-reversed representation of `x`\n\n\n FFTM.prototype.revBin = function revBin(x, l, N) {\n if (x === 0 || x === N - 1) return x;\n var rb = 0;\n\n for (var i = 0; i < l; i++) {\n rb |= (x & 1) << l - i - 1;\n x >>= 1;\n }\n\n return rb;\n }; // Performs \"tweedling\" phase, therefore 'emulating'\n // behaviour of the recursive algorithm\n\n\n FFTM.prototype.permute = function permute(rbt, rws, iws, rtws, itws, N) {\n for (var i = 0; i < N; i++) {\n rtws[i] = rws[rbt[i]];\n itws[i] = iws[rbt[i]];\n }\n };\n\n FFTM.prototype.transform = function transform(rws, iws, rtws, itws, N, rbt) {\n this.permute(rbt, rws, iws, rtws, itws, N);\n\n for (var s = 1; s < N; s <<= 1) {\n var l = s << 1;\n var rtwdf = Math.cos(2 * Math.PI / l);\n var itwdf = Math.sin(2 * Math.PI / l);\n\n for (var p = 0; p < N; p += l) {\n var rtwdf_ = rtwdf;\n var itwdf_ = itwdf;\n\n for (var j = 0; j < s; j++) {\n var re = rtws[p + j];\n var ie = itws[p + j];\n var ro = rtws[p + j + s];\n var io = itws[p + j + s];\n var rx = rtwdf_ * ro - itwdf_ * io;\n io = rtwdf_ * io + itwdf_ * ro;\n ro = rx;\n rtws[p + j] = re + ro;\n itws[p + j] = ie + io;\n rtws[p + j + s] = re - ro;\n itws[p + j + s] = ie - io;\n /* jshint maxdepth : false */\n\n if (j !== l) {\n rx = rtwdf * rtwdf_ - itwdf * itwdf_;\n itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;\n rtwdf_ = rx;\n }\n }\n }\n }\n };\n\n FFTM.prototype.guessLen13b = function guessLen13b(n, m) {\n var N = Math.max(m, n) | 1;\n var odd = N & 1;\n var i = 0;\n\n for (N = N / 2 | 0; N; N = N >>> 1) {\n i++;\n }\n\n return 1 << i + 1 + odd;\n };\n\n FFTM.prototype.conjugate = function conjugate(rws, iws, N) {\n if (N <= 1) return;\n\n for (var i = 0; i < N / 2; i++) {\n var t = rws[i];\n rws[i] = rws[N - i - 1];\n rws[N - i - 1] = t;\n t = iws[i];\n iws[i] = -iws[N - i - 1];\n iws[N - i - 1] = -t;\n }\n };\n\n FFTM.prototype.normalize13b = function normalize13b(ws, N) {\n var carry = 0;\n\n for (var i = 0; i < N / 2; i++) {\n var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + Math.round(ws[2 * i] / N) + carry;\n ws[i] = w & 0x3ffffff;\n\n if (w < 0x4000000) {\n carry = 0;\n } else {\n carry = w / 0x4000000 | 0;\n }\n }\n\n return ws;\n };\n\n FFTM.prototype.convert13b = function convert13b(ws, len, rws, N) {\n var carry = 0;\n\n for (var i = 0; i < len; i++) {\n carry = carry + (ws[i] | 0);\n rws[2 * i] = carry & 0x1fff;\n carry = carry >>> 13;\n rws[2 * i + 1] = carry & 0x1fff;\n carry = carry >>> 13;\n } // Pad with zeroes\n\n\n for (i = 2 * len; i < N; ++i) {\n rws[i] = 0;\n }\n\n assert(carry === 0);\n assert((carry & ~0x1fff) === 0);\n };\n\n FFTM.prototype.stub = function stub(N) {\n var ph = new Array(N);\n\n for (var i = 0; i < N; i++) {\n ph[i] = 0;\n }\n\n return ph;\n };\n\n FFTM.prototype.mulp = function mulp(x, y, out) {\n var N = 2 * this.guessLen13b(x.length, y.length);\n var rbt = this.makeRBT(N);\n\n var _ = this.stub(N);\n\n var rws = new Array(N);\n var rwst = new Array(N);\n var iwst = new Array(N);\n var nrws = new Array(N);\n var nrwst = new Array(N);\n var niwst = new Array(N);\n var rmws = out.words;\n rmws.length = N;\n this.convert13b(x.words, x.length, rws, N);\n this.convert13b(y.words, y.length, nrws, N);\n this.transform(rws, _, rwst, iwst, N, rbt);\n this.transform(nrws, _, nrwst, niwst, N, rbt);\n\n for (var i = 0; i < N; i++) {\n var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];\n iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];\n rwst[i] = rx;\n }\n\n this.conjugate(rwst, iwst, N);\n this.transform(rwst, iwst, rmws, _, N, rbt);\n this.conjugate(rmws, _, N);\n this.normalize13b(rmws, N);\n out.negative = x.negative ^ y.negative;\n out.length = x.length + y.length;\n return out._strip();\n }; // Multiply `this` by `num`\n\n\n BN.prototype.mul = function mul(num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return this.mulTo(num, out);\n }; // Multiply employing FFT\n\n\n BN.prototype.mulf = function mulf(num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return jumboMulTo(this, num, out);\n }; // In-place Multiplication\n\n\n BN.prototype.imul = function imul(num) {\n return this.clone().mulTo(num, this);\n };\n\n BN.prototype.imuln = function imuln(num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n assert(typeof num === 'number');\n assert(num < 0x4000000); // Carry\n\n var carry = 0;\n\n for (var i = 0; i < this.length; i++) {\n var w = (this.words[i] | 0) * num;\n var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);\n carry >>= 26;\n carry += w / 0x4000000 | 0; // NOTE: lo is 27bit maximum\n\n carry += lo >>> 26;\n this.words[i] = lo & 0x3ffffff;\n }\n\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n\n return isNegNum ? this.ineg() : this;\n };\n\n BN.prototype.muln = function muln(num) {\n return this.clone().imuln(num);\n }; // `this` * `this`\n\n\n BN.prototype.sqr = function sqr() {\n return this.mul(this);\n }; // `this` * `this` in-place\n\n\n BN.prototype.isqr = function isqr() {\n return this.imul(this.clone());\n }; // Math.pow(`this`, `num`)\n\n\n BN.prototype.pow = function pow(num) {\n var w = toBitArray(num);\n if (w.length === 0) return new BN(1); // Skip leading zeroes\n\n var res = this;\n\n for (var i = 0; i < w.length; i++, res = res.sqr()) {\n if (w[i] !== 0) break;\n }\n\n if (++i < w.length) {\n for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {\n if (w[i] === 0) continue;\n res = res.mul(q);\n }\n }\n\n return res;\n }; // Shift-left in-place\n\n\n BN.prototype.iushln = function iushln(bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n var carryMask = 0x3ffffff >>> 26 - r << 26 - r;\n var i;\n\n if (r !== 0) {\n var carry = 0;\n\n for (i = 0; i < this.length; i++) {\n var newCarry = this.words[i] & carryMask;\n var c = (this.words[i] | 0) - newCarry << r;\n this.words[i] = c | carry;\n carry = newCarry >>> 26 - r;\n }\n\n if (carry) {\n this.words[i] = carry;\n this.length++;\n }\n }\n\n if (s !== 0) {\n for (i = this.length - 1; i >= 0; i--) {\n this.words[i + s] = this.words[i];\n }\n\n for (i = 0; i < s; i++) {\n this.words[i] = 0;\n }\n\n this.length += s;\n }\n\n return this._strip();\n };\n\n BN.prototype.ishln = function ishln(bits) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushln(bits);\n }; // Shift-right in-place\n // NOTE: `hint` is a lowest bit before trailing zeroes\n // NOTE: if `extended` is present - it will be filled with destroyed bits\n\n\n BN.prototype.iushrn = function iushrn(bits, hint, extended) {\n assert(typeof bits === 'number' && bits >= 0);\n var h;\n\n if (hint) {\n h = (hint - hint % 26) / 26;\n } else {\n h = 0;\n }\n\n var r = bits % 26;\n var s = Math.min((bits - r) / 26, this.length);\n var mask = 0x3ffffff ^ 0x3ffffff >>> r << r;\n var maskedWords = extended;\n h -= s;\n h = Math.max(0, h); // Extended mode, copy masked part\n\n if (maskedWords) {\n for (var i = 0; i < s; i++) {\n maskedWords.words[i] = this.words[i];\n }\n\n maskedWords.length = s;\n }\n\n if (s === 0) {// No-op, we should not move anything at all\n } else if (this.length > s) {\n this.length -= s;\n\n for (i = 0; i < this.length; i++) {\n this.words[i] = this.words[i + s];\n }\n } else {\n this.words[0] = 0;\n this.length = 1;\n }\n\n var carry = 0;\n\n for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {\n var word = this.words[i] | 0;\n this.words[i] = carry << 26 - r | word >>> r;\n carry = word & mask;\n } // Push carried bits as a mask\n\n\n if (maskedWords && carry !== 0) {\n maskedWords.words[maskedWords.length++] = carry;\n }\n\n if (this.length === 0) {\n this.words[0] = 0;\n this.length = 1;\n }\n\n return this._strip();\n };\n\n BN.prototype.ishrn = function ishrn(bits, hint, extended) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushrn(bits, hint, extended);\n }; // Shift-left\n\n\n BN.prototype.shln = function shln(bits) {\n return this.clone().ishln(bits);\n };\n\n BN.prototype.ushln = function ushln(bits) {\n return this.clone().iushln(bits);\n }; // Shift-right\n\n\n BN.prototype.shrn = function shrn(bits) {\n return this.clone().ishrn(bits);\n };\n\n BN.prototype.ushrn = function ushrn(bits) {\n return this.clone().iushrn(bits);\n }; // Test if n bit is set\n\n\n BN.prototype.testn = function testn(bit) {\n assert(typeof bit === 'number' && bit >= 0);\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r; // Fast case: bit is much higher than all existing words\n\n if (this.length <= s) return false; // Check bit and return\n\n var w = this.words[s];\n return !!(w & q);\n }; // Return only lowers bits of number (in-place)\n\n\n BN.prototype.imaskn = function imaskn(bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n assert(this.negative === 0, 'imaskn works only with positive numbers');\n\n if (this.length <= s) {\n return this;\n }\n\n if (r !== 0) {\n s++;\n }\n\n this.length = Math.min(s, this.length);\n\n if (r !== 0) {\n var mask = 0x3ffffff ^ 0x3ffffff >>> r << r;\n this.words[this.length - 1] &= mask;\n }\n\n return this._strip();\n }; // Return only lowers bits of number\n\n\n BN.prototype.maskn = function maskn(bits) {\n return this.clone().imaskn(bits);\n }; // Add plain number `num` to `this`\n\n\n BN.prototype.iaddn = function iaddn(num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.isubn(-num); // Possible sign change\n\n if (this.negative !== 0) {\n if (this.length === 1 && (this.words[0] | 0) <= num) {\n this.words[0] = num - (this.words[0] | 0);\n this.negative = 0;\n return this;\n }\n\n this.negative = 0;\n this.isubn(num);\n this.negative = 1;\n return this;\n } // Add without checks\n\n\n return this._iaddn(num);\n };\n\n BN.prototype._iaddn = function _iaddn(num) {\n this.words[0] += num; // Carry\n\n for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {\n this.words[i] -= 0x4000000;\n\n if (i === this.length - 1) {\n this.words[i + 1] = 1;\n } else {\n this.words[i + 1]++;\n }\n }\n\n this.length = Math.max(this.length, i + 1);\n return this;\n }; // Subtract plain number `num` from `this`\n\n\n BN.prototype.isubn = function isubn(num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.iaddn(-num);\n\n if (this.negative !== 0) {\n this.negative = 0;\n this.iaddn(num);\n this.negative = 1;\n return this;\n }\n\n this.words[0] -= num;\n\n if (this.length === 1 && this.words[0] < 0) {\n this.words[0] = -this.words[0];\n this.negative = 1;\n } else {\n // Carry\n for (var i = 0; i < this.length && this.words[i] < 0; i++) {\n this.words[i] += 0x4000000;\n this.words[i + 1] -= 1;\n }\n }\n\n return this._strip();\n };\n\n BN.prototype.addn = function addn(num) {\n return this.clone().iaddn(num);\n };\n\n BN.prototype.subn = function subn(num) {\n return this.clone().isubn(num);\n };\n\n BN.prototype.iabs = function iabs() {\n this.negative = 0;\n return this;\n };\n\n BN.prototype.abs = function abs() {\n return this.clone().iabs();\n };\n\n BN.prototype._ishlnsubmul = function _ishlnsubmul(num, mul, shift) {\n var len = num.length + shift;\n var i;\n\n this._expand(len);\n\n var w;\n var carry = 0;\n\n for (i = 0; i < num.length; i++) {\n w = (this.words[i + shift] | 0) + carry;\n var right = (num.words[i] | 0) * mul;\n w -= right & 0x3ffffff;\n carry = (w >> 26) - (right / 0x4000000 | 0);\n this.words[i + shift] = w & 0x3ffffff;\n }\n\n for (; i < this.length - shift; i++) {\n w = (this.words[i + shift] | 0) + carry;\n carry = w >> 26;\n this.words[i + shift] = w & 0x3ffffff;\n }\n\n if (carry === 0) return this._strip(); // Subtraction overflow\n\n assert(carry === -1);\n carry = 0;\n\n for (i = 0; i < this.length; i++) {\n w = -(this.words[i] | 0) + carry;\n carry = w >> 26;\n this.words[i] = w & 0x3ffffff;\n }\n\n this.negative = 1;\n return this._strip();\n };\n\n BN.prototype._wordDiv = function _wordDiv(num, mode) {\n var shift = this.length - num.length;\n var a = this.clone();\n var b = num; // Normalize\n\n var bhi = b.words[b.length - 1] | 0;\n\n var bhiBits = this._countBits(bhi);\n\n shift = 26 - bhiBits;\n\n if (shift !== 0) {\n b = b.ushln(shift);\n a.iushln(shift);\n bhi = b.words[b.length - 1] | 0;\n } // Initialize quotient\n\n\n var m = a.length - b.length;\n var q;\n\n if (mode !== 'mod') {\n q = new BN(null);\n q.length = m + 1;\n q.words = new Array(q.length);\n\n for (var i = 0; i < q.length; i++) {\n q.words[i] = 0;\n }\n }\n\n var diff = a.clone()._ishlnsubmul(b, 1, m);\n\n if (diff.negative === 0) {\n a = diff;\n\n if (q) {\n q.words[m] = 1;\n }\n }\n\n for (var j = m - 1; j >= 0; j--) {\n var qj = (a.words[b.length + j] | 0) * 0x4000000 + (a.words[b.length + j - 1] | 0); // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max\n // (0x7ffffff)\n\n qj = Math.min(qj / bhi | 0, 0x3ffffff);\n\n a._ishlnsubmul(b, qj, j);\n\n while (a.negative !== 0) {\n qj--;\n a.negative = 0;\n\n a._ishlnsubmul(b, 1, j);\n\n if (!a.isZero()) {\n a.negative ^= 1;\n }\n }\n\n if (q) {\n q.words[j] = qj;\n }\n }\n\n if (q) {\n q._strip();\n }\n\n a._strip(); // Denormalize\n\n\n if (mode !== 'div' && shift !== 0) {\n a.iushrn(shift);\n }\n\n return {\n div: q || null,\n mod: a\n };\n }; // NOTE: 1) `mode` can be set to `mod` to request mod only,\n // to `div` to request div only, or be absent to\n // request both div & mod\n // 2) `positive` is true if unsigned mod is requested\n\n\n BN.prototype.divmod = function divmod(num, mode, positive) {\n assert(!num.isZero());\n\n if (this.isZero()) {\n return {\n div: new BN(0),\n mod: new BN(0)\n };\n }\n\n var div, mod, res;\n\n if (this.negative !== 0 && num.negative === 0) {\n res = this.neg().divmod(num, mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n\n if (positive && mod.negative !== 0) {\n mod.iadd(num);\n }\n }\n\n return {\n div: div,\n mod: mod\n };\n }\n\n if (this.negative === 0 && num.negative !== 0) {\n res = this.divmod(num.neg(), mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n return {\n div: div,\n mod: res.mod\n };\n }\n\n if ((this.negative & num.negative) !== 0) {\n res = this.neg().divmod(num.neg(), mode);\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n\n if (positive && mod.negative !== 0) {\n mod.isub(num);\n }\n }\n\n return {\n div: res.div,\n mod: mod\n };\n } // Both numbers are positive at this point\n // Strip both numbers to approximate shift value\n\n\n if (num.length > this.length || this.cmp(num) < 0) {\n return {\n div: new BN(0),\n mod: this\n };\n } // Very short reduction\n\n\n if (num.length === 1) {\n if (mode === 'div') {\n return {\n div: this.divn(num.words[0]),\n mod: null\n };\n }\n\n if (mode === 'mod') {\n return {\n div: null,\n mod: new BN(this.modrn(num.words[0]))\n };\n }\n\n return {\n div: this.divn(num.words[0]),\n mod: new BN(this.modrn(num.words[0]))\n };\n }\n\n return this._wordDiv(num, mode);\n }; // Find `this` / `num`\n\n\n BN.prototype.div = function div(num) {\n return this.divmod(num, 'div', false).div;\n }; // Find `this` % `num`\n\n\n BN.prototype.mod = function mod(num) {\n return this.divmod(num, 'mod', false).mod;\n };\n\n BN.prototype.umod = function umod(num) {\n return this.divmod(num, 'mod', true).mod;\n }; // Find Round(`this` / `num`)\n\n\n BN.prototype.divRound = function divRound(num) {\n var dm = this.divmod(num); // Fast case - exact division\n\n if (dm.mod.isZero()) return dm.div;\n var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;\n var half = num.ushrn(1);\n var r2 = num.andln(1);\n var cmp = mod.cmp(half); // Round down\n\n if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div; // Round up\n\n return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);\n };\n\n BN.prototype.modrn = function modrn(num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n assert(num <= 0x3ffffff);\n var p = (1 << 26) % num;\n var acc = 0;\n\n for (var i = this.length - 1; i >= 0; i--) {\n acc = (p * acc + (this.words[i] | 0)) % num;\n }\n\n return isNegNum ? -acc : acc;\n }; // WARNING: DEPRECATED\n\n\n BN.prototype.modn = function modn(num) {\n return this.modrn(num);\n }; // In-place division by number\n\n\n BN.prototype.idivn = function idivn(num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n assert(num <= 0x3ffffff);\n var carry = 0;\n\n for (var i = this.length - 1; i >= 0; i--) {\n var w = (this.words[i] | 0) + carry * 0x4000000;\n this.words[i] = w / num | 0;\n carry = w % num;\n }\n\n this._strip();\n\n return isNegNum ? this.ineg() : this;\n };\n\n BN.prototype.divn = function divn(num) {\n return this.clone().idivn(num);\n };\n\n BN.prototype.egcd = function egcd(p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n var x = this;\n var y = p.clone();\n\n if (x.negative !== 0) {\n x = x.umod(p);\n } else {\n x = x.clone();\n } // A * x + B * y = x\n\n\n var A = new BN(1);\n var B = new BN(0); // C * x + D * y = y\n\n var C = new BN(0);\n var D = new BN(1);\n var g = 0;\n\n while (x.isEven() && y.isEven()) {\n x.iushrn(1);\n y.iushrn(1);\n ++g;\n }\n\n var yp = y.clone();\n var xp = x.clone();\n\n while (!x.isZero()) {\n for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1) {\n ;\n }\n\n if (i > 0) {\n x.iushrn(i);\n\n while (i-- > 0) {\n if (A.isOdd() || B.isOdd()) {\n A.iadd(yp);\n B.isub(xp);\n }\n\n A.iushrn(1);\n B.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1) {\n ;\n }\n\n if (j > 0) {\n y.iushrn(j);\n\n while (j-- > 0) {\n if (C.isOdd() || D.isOdd()) {\n C.iadd(yp);\n D.isub(xp);\n }\n\n C.iushrn(1);\n D.iushrn(1);\n }\n }\n\n if (x.cmp(y) >= 0) {\n x.isub(y);\n A.isub(C);\n B.isub(D);\n } else {\n y.isub(x);\n C.isub(A);\n D.isub(B);\n }\n }\n\n return {\n a: C,\n b: D,\n gcd: y.iushln(g)\n };\n }; // This is reduced incarnation of the binary EEA\n // above, designated to invert members of the\n // _prime_ fields F(p) at a maximal speed\n\n\n BN.prototype._invmp = function _invmp(p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n var a = this;\n var b = p.clone();\n\n if (a.negative !== 0) {\n a = a.umod(p);\n } else {\n a = a.clone();\n }\n\n var x1 = new BN(1);\n var x2 = new BN(0);\n var delta = b.clone();\n\n while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {\n for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1) {\n ;\n }\n\n if (i > 0) {\n a.iushrn(i);\n\n while (i-- > 0) {\n if (x1.isOdd()) {\n x1.iadd(delta);\n }\n\n x1.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1) {\n ;\n }\n\n if (j > 0) {\n b.iushrn(j);\n\n while (j-- > 0) {\n if (x2.isOdd()) {\n x2.iadd(delta);\n }\n\n x2.iushrn(1);\n }\n }\n\n if (a.cmp(b) >= 0) {\n a.isub(b);\n x1.isub(x2);\n } else {\n b.isub(a);\n x2.isub(x1);\n }\n }\n\n var res;\n\n if (a.cmpn(1) === 0) {\n res = x1;\n } else {\n res = x2;\n }\n\n if (res.cmpn(0) < 0) {\n res.iadd(p);\n }\n\n return res;\n };\n\n BN.prototype.gcd = function gcd(num) {\n if (this.isZero()) return num.abs();\n if (num.isZero()) return this.abs();\n var a = this.clone();\n var b = num.clone();\n a.negative = 0;\n b.negative = 0; // Remove common factor of two\n\n for (var shift = 0; a.isEven() && b.isEven(); shift++) {\n a.iushrn(1);\n b.iushrn(1);\n }\n\n do {\n while (a.isEven()) {\n a.iushrn(1);\n }\n\n while (b.isEven()) {\n b.iushrn(1);\n }\n\n var r = a.cmp(b);\n\n if (r < 0) {\n // Swap `a` and `b` to make `a` always bigger than `b`\n var t = a;\n a = b;\n b = t;\n } else if (r === 0 || b.cmpn(1) === 0) {\n break;\n }\n\n a.isub(b);\n } while (true);\n\n return b.iushln(shift);\n }; // Invert number in the field F(num)\n\n\n BN.prototype.invm = function invm(num) {\n return this.egcd(num).a.umod(num);\n };\n\n BN.prototype.isEven = function isEven() {\n return (this.words[0] & 1) === 0;\n };\n\n BN.prototype.isOdd = function isOdd() {\n return (this.words[0] & 1) === 1;\n }; // And first word and num\n\n\n BN.prototype.andln = function andln(num) {\n return this.words[0] & num;\n }; // Increment at the bit position in-line\n\n\n BN.prototype.bincn = function bincn(bit) {\n assert(typeof bit === 'number');\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r; // Fast case: bit is much higher than all existing words\n\n if (this.length <= s) {\n this._expand(s + 1);\n\n this.words[s] |= q;\n return this;\n } // Add bit and propagate, if needed\n\n\n var carry = q;\n\n for (var i = s; carry !== 0 && i < this.length; i++) {\n var w = this.words[i] | 0;\n w += carry;\n carry = w >>> 26;\n w &= 0x3ffffff;\n this.words[i] = w;\n }\n\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n\n return this;\n };\n\n BN.prototype.isZero = function isZero() {\n return this.length === 1 && this.words[0] === 0;\n };\n\n BN.prototype.cmpn = function cmpn(num) {\n var negative = num < 0;\n if (this.negative !== 0 && !negative) return -1;\n if (this.negative === 0 && negative) return 1;\n\n this._strip();\n\n var res;\n\n if (this.length > 1) {\n res = 1;\n } else {\n if (negative) {\n num = -num;\n }\n\n assert(num <= 0x3ffffff, 'Number is too big');\n var w = this.words[0] | 0;\n res = w === num ? 0 : w < num ? -1 : 1;\n }\n\n if (this.negative !== 0) return -res | 0;\n return res;\n }; // Compare two numbers and return:\n // 1 - if `this` > `num`\n // 0 - if `this` == `num`\n // -1 - if `this` < `num`\n\n\n BN.prototype.cmp = function cmp(num) {\n if (this.negative !== 0 && num.negative === 0) return -1;\n if (this.negative === 0 && num.negative !== 0) return 1;\n var res = this.ucmp(num);\n if (this.negative !== 0) return -res | 0;\n return res;\n }; // Unsigned comparison\n\n\n BN.prototype.ucmp = function ucmp(num) {\n // At this point both numbers have the same sign\n if (this.length > num.length) return 1;\n if (this.length < num.length) return -1;\n var res = 0;\n\n for (var i = this.length - 1; i >= 0; i--) {\n var a = this.words[i] | 0;\n var b = num.words[i] | 0;\n if (a === b) continue;\n\n if (a < b) {\n res = -1;\n } else if (a > b) {\n res = 1;\n }\n\n break;\n }\n\n return res;\n };\n\n BN.prototype.gtn = function gtn(num) {\n return this.cmpn(num) === 1;\n };\n\n BN.prototype.gt = function gt(num) {\n return this.cmp(num) === 1;\n };\n\n BN.prototype.gten = function gten(num) {\n return this.cmpn(num) >= 0;\n };\n\n BN.prototype.gte = function gte(num) {\n return this.cmp(num) >= 0;\n };\n\n BN.prototype.ltn = function ltn(num) {\n return this.cmpn(num) === -1;\n };\n\n BN.prototype.lt = function lt(num) {\n return this.cmp(num) === -1;\n };\n\n BN.prototype.lten = function lten(num) {\n return this.cmpn(num) <= 0;\n };\n\n BN.prototype.lte = function lte(num) {\n return this.cmp(num) <= 0;\n };\n\n BN.prototype.eqn = function eqn(num) {\n return this.cmpn(num) === 0;\n };\n\n BN.prototype.eq = function eq(num) {\n return this.cmp(num) === 0;\n }; //\n // A reduce context, could be using montgomery or something better, depending\n // on the `m` itself.\n //\n\n\n BN.red = function red(num) {\n return new Red(num);\n };\n\n BN.prototype.toRed = function toRed(ctx) {\n assert(!this.red, 'Already a number in reduction context');\n assert(this.negative === 0, 'red works only with positives');\n return ctx.convertTo(this)._forceRed(ctx);\n };\n\n BN.prototype.fromRed = function fromRed() {\n assert(this.red, 'fromRed works only with numbers in reduction context');\n return this.red.convertFrom(this);\n };\n\n BN.prototype._forceRed = function _forceRed(ctx) {\n this.red = ctx;\n return this;\n };\n\n BN.prototype.forceRed = function forceRed(ctx) {\n assert(!this.red, 'Already a number in reduction context');\n return this._forceRed(ctx);\n };\n\n BN.prototype.redAdd = function redAdd(num) {\n assert(this.red, 'redAdd works only with red numbers');\n return this.red.add(this, num);\n };\n\n BN.prototype.redIAdd = function redIAdd(num) {\n assert(this.red, 'redIAdd works only with red numbers');\n return this.red.iadd(this, num);\n };\n\n BN.prototype.redSub = function redSub(num) {\n assert(this.red, 'redSub works only with red numbers');\n return this.red.sub(this, num);\n };\n\n BN.prototype.redISub = function redISub(num) {\n assert(this.red, 'redISub works only with red numbers');\n return this.red.isub(this, num);\n };\n\n BN.prototype.redShl = function redShl(num) {\n assert(this.red, 'redShl works only with red numbers');\n return this.red.shl(this, num);\n };\n\n BN.prototype.redMul = function redMul(num) {\n assert(this.red, 'redMul works only with red numbers');\n\n this.red._verify2(this, num);\n\n return this.red.mul(this, num);\n };\n\n BN.prototype.redIMul = function redIMul(num) {\n assert(this.red, 'redMul works only with red numbers');\n\n this.red._verify2(this, num);\n\n return this.red.imul(this, num);\n };\n\n BN.prototype.redSqr = function redSqr() {\n assert(this.red, 'redSqr works only with red numbers');\n\n this.red._verify1(this);\n\n return this.red.sqr(this);\n };\n\n BN.prototype.redISqr = function redISqr() {\n assert(this.red, 'redISqr works only with red numbers');\n\n this.red._verify1(this);\n\n return this.red.isqr(this);\n }; // Square root over p\n\n\n BN.prototype.redSqrt = function redSqrt() {\n assert(this.red, 'redSqrt works only with red numbers');\n\n this.red._verify1(this);\n\n return this.red.sqrt(this);\n };\n\n BN.prototype.redInvm = function redInvm() {\n assert(this.red, 'redInvm works only with red numbers');\n\n this.red._verify1(this);\n\n return this.red.invm(this);\n }; // Return negative clone of `this` % `red modulo`\n\n\n BN.prototype.redNeg = function redNeg() {\n assert(this.red, 'redNeg works only with red numbers');\n\n this.red._verify1(this);\n\n return this.red.neg(this);\n };\n\n BN.prototype.redPow = function redPow(num) {\n assert(this.red && !num.red, 'redPow(normalNum)');\n\n this.red._verify1(this);\n\n return this.red.pow(this, num);\n }; // Prime numbers with efficient reduction\n\n\n var primes = {\n k256: null,\n p224: null,\n p192: null,\n p25519: null\n }; // Pseudo-Mersenne prime\n\n function MPrime(name, p) {\n // P = 2 ^ N - K\n this.name = name;\n this.p = new BN(p, 16);\n this.n = this.p.bitLength();\n this.k = new BN(1).iushln(this.n).isub(this.p);\n this.tmp = this._tmp();\n }\n\n MPrime.prototype._tmp = function _tmp() {\n var tmp = new BN(null);\n tmp.words = new Array(Math.ceil(this.n / 13));\n return tmp;\n };\n\n MPrime.prototype.ireduce = function ireduce(num) {\n // Assumes that `num` is less than `P^2`\n // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)\n var r = num;\n var rlen;\n\n do {\n this.split(r, this.tmp);\n r = this.imulK(r);\n r = r.iadd(this.tmp);\n rlen = r.bitLength();\n } while (rlen > this.n);\n\n var cmp = rlen < this.n ? -1 : r.ucmp(this.p);\n\n if (cmp === 0) {\n r.words[0] = 0;\n r.length = 1;\n } else if (cmp > 0) {\n r.isub(this.p);\n } else {\n if (r.strip !== undefined) {\n // r is a BN v4 instance\n r.strip();\n } else {\n // r is a BN v5 instance\n r._strip();\n }\n }\n\n return r;\n };\n\n MPrime.prototype.split = function split(input, out) {\n input.iushrn(this.n, 0, out);\n };\n\n MPrime.prototype.imulK = function imulK(num) {\n return num.imul(this.k);\n };\n\n function K256() {\n MPrime.call(this, 'k256', 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');\n }\n\n inherits(K256, MPrime);\n\n K256.prototype.split = function split(input, output) {\n // 256 = 9 * 26 + 22\n var mask = 0x3fffff;\n var outLen = Math.min(input.length, 9);\n\n for (var i = 0; i < outLen; i++) {\n output.words[i] = input.words[i];\n }\n\n output.length = outLen;\n\n if (input.length <= 9) {\n input.words[0] = 0;\n input.length = 1;\n return;\n } // Shift by 9 limbs\n\n\n var prev = input.words[9];\n output.words[output.length++] = prev & mask;\n\n for (i = 10; i < input.length; i++) {\n var next = input.words[i] | 0;\n input.words[i - 10] = (next & mask) << 4 | prev >>> 22;\n prev = next;\n }\n\n prev >>>= 22;\n input.words[i - 10] = prev;\n\n if (prev === 0 && input.length > 10) {\n input.length -= 10;\n } else {\n input.length -= 9;\n }\n };\n\n K256.prototype.imulK = function imulK(num) {\n // K = 0x1000003d1 = [ 0x40, 0x3d1 ]\n num.words[num.length] = 0;\n num.words[num.length + 1] = 0;\n num.length += 2; // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390\n\n var lo = 0;\n\n for (var i = 0; i < num.length; i++) {\n var w = num.words[i] | 0;\n lo += w * 0x3d1;\n num.words[i] = lo & 0x3ffffff;\n lo = w * 0x40 + (lo / 0x4000000 | 0);\n } // Fast length reduction\n\n\n if (num.words[num.length - 1] === 0) {\n num.length--;\n\n if (num.words[num.length - 1] === 0) {\n num.length--;\n }\n }\n\n return num;\n };\n\n function P224() {\n MPrime.call(this, 'p224', 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');\n }\n\n inherits(P224, MPrime);\n\n function P192() {\n MPrime.call(this, 'p192', 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');\n }\n\n inherits(P192, MPrime);\n\n function P25519() {\n // 2 ^ 255 - 19\n MPrime.call(this, '25519', '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');\n }\n\n inherits(P25519, MPrime);\n\n P25519.prototype.imulK = function imulK(num) {\n // K = 0x13\n var carry = 0;\n\n for (var i = 0; i < num.length; i++) {\n var hi = (num.words[i] | 0) * 0x13 + carry;\n var lo = hi & 0x3ffffff;\n hi >>>= 26;\n num.words[i] = lo;\n carry = hi;\n }\n\n if (carry !== 0) {\n num.words[num.length++] = carry;\n }\n\n return num;\n }; // Exported mostly for testing purposes, use plain name instead\n\n\n BN._prime = function prime(name) {\n // Cached version of prime\n if (primes[name]) return primes[name];\n var prime;\n\n if (name === 'k256') {\n prime = new K256();\n } else if (name === 'p224') {\n prime = new P224();\n } else if (name === 'p192') {\n prime = new P192();\n } else if (name === 'p25519') {\n prime = new P25519();\n } else {\n throw new Error('Unknown prime ' + name);\n }\n\n primes[name] = prime;\n return prime;\n }; //\n // Base reduction engine\n //\n\n\n function Red(m) {\n if (typeof m === 'string') {\n var prime = BN._prime(m);\n\n this.m = prime.p;\n this.prime = prime;\n } else {\n assert(m.gtn(1), 'modulus must be greater than 1');\n this.m = m;\n this.prime = null;\n }\n }\n\n Red.prototype._verify1 = function _verify1(a) {\n assert(a.negative === 0, 'red works only with positives');\n assert(a.red, 'red works only with red numbers');\n };\n\n Red.prototype._verify2 = function _verify2(a, b) {\n assert((a.negative | b.negative) === 0, 'red works only with positives');\n assert(a.red && a.red === b.red, 'red works only with red numbers');\n };\n\n Red.prototype.imod = function imod(a) {\n if (this.prime) return this.prime.ireduce(a)._forceRed(this);\n move(a, a.umod(this.m)._forceRed(this));\n return a;\n };\n\n Red.prototype.neg = function neg(a) {\n if (a.isZero()) {\n return a.clone();\n }\n\n return this.m.sub(a)._forceRed(this);\n };\n\n Red.prototype.add = function add(a, b) {\n this._verify2(a, b);\n\n var res = a.add(b);\n\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Red.prototype.iadd = function iadd(a, b) {\n this._verify2(a, b);\n\n var res = a.iadd(b);\n\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n\n return res;\n };\n\n Red.prototype.sub = function sub(a, b) {\n this._verify2(a, b);\n\n var res = a.sub(b);\n\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Red.prototype.isub = function isub(a, b) {\n this._verify2(a, b);\n\n var res = a.isub(b);\n\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n\n return res;\n };\n\n Red.prototype.shl = function shl(a, num) {\n this._verify1(a);\n\n return this.imod(a.ushln(num));\n };\n\n Red.prototype.imul = function imul(a, b) {\n this._verify2(a, b);\n\n return this.imod(a.imul(b));\n };\n\n Red.prototype.mul = function mul(a, b) {\n this._verify2(a, b);\n\n return this.imod(a.mul(b));\n };\n\n Red.prototype.isqr = function isqr(a) {\n return this.imul(a, a.clone());\n };\n\n Red.prototype.sqr = function sqr(a) {\n return this.mul(a, a);\n };\n\n Red.prototype.sqrt = function sqrt(a) {\n if (a.isZero()) return a.clone();\n var mod3 = this.m.andln(3);\n assert(mod3 % 2 === 1); // Fast case\n\n if (mod3 === 3) {\n var pow = this.m.add(new BN(1)).iushrn(2);\n return this.pow(a, pow);\n } // Tonelli-Shanks algorithm (Totally unoptimized and slow)\n //\n // Find Q and S, that Q * 2 ^ S = (P - 1)\n\n\n var q = this.m.subn(1);\n var s = 0;\n\n while (!q.isZero() && q.andln(1) === 0) {\n s++;\n q.iushrn(1);\n }\n\n assert(!q.isZero());\n var one = new BN(1).toRed(this);\n var nOne = one.redNeg(); // Find quadratic non-residue\n // NOTE: Max is such because of generalized Riemann hypothesis.\n\n var lpow = this.m.subn(1).iushrn(1);\n var z = this.m.bitLength();\n z = new BN(2 * z * z).toRed(this);\n\n while (this.pow(z, lpow).cmp(nOne) !== 0) {\n z.redIAdd(nOne);\n }\n\n var c = this.pow(z, q);\n var r = this.pow(a, q.addn(1).iushrn(1));\n var t = this.pow(a, q);\n var m = s;\n\n while (t.cmp(one) !== 0) {\n var tmp = t;\n\n for (var i = 0; tmp.cmp(one) !== 0; i++) {\n tmp = tmp.redSqr();\n }\n\n assert(i < m);\n var b = this.pow(c, new BN(1).iushln(m - i - 1));\n r = r.redMul(b);\n c = b.redSqr();\n t = t.redMul(c);\n m = i;\n }\n\n return r;\n };\n\n Red.prototype.invm = function invm(a) {\n var inv = a._invmp(this.m);\n\n if (inv.negative !== 0) {\n inv.negative = 0;\n return this.imod(inv).redNeg();\n } else {\n return this.imod(inv);\n }\n };\n\n Red.prototype.pow = function pow(a, num) {\n if (num.isZero()) return new BN(1).toRed(this);\n if (num.cmpn(1) === 0) return a.clone();\n var windowSize = 4;\n var wnd = new Array(1 << windowSize);\n wnd[0] = new BN(1).toRed(this);\n wnd[1] = a;\n\n for (var i = 2; i < wnd.length; i++) {\n wnd[i] = this.mul(wnd[i - 1], a);\n }\n\n var res = wnd[0];\n var current = 0;\n var currentLen = 0;\n var start = num.bitLength() % 26;\n\n if (start === 0) {\n start = 26;\n }\n\n for (i = num.length - 1; i >= 0; i--) {\n var word = num.words[i];\n\n for (var j = start - 1; j >= 0; j--) {\n var bit = word >> j & 1;\n\n if (res !== wnd[0]) {\n res = this.sqr(res);\n }\n\n if (bit === 0 && current === 0) {\n currentLen = 0;\n continue;\n }\n\n current <<= 1;\n current |= bit;\n currentLen++;\n if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;\n res = this.mul(res, wnd[current]);\n currentLen = 0;\n current = 0;\n }\n\n start = 26;\n }\n\n return res;\n };\n\n Red.prototype.convertTo = function convertTo(num) {\n var r = num.umod(this.m);\n return r === num ? r.clone() : r;\n };\n\n Red.prototype.convertFrom = function convertFrom(num) {\n var res = num.clone();\n res.red = null;\n return res;\n }; //\n // Montgomery method engine\n //\n\n\n BN.mont = function mont(num) {\n return new Mont(num);\n };\n\n function Mont(m) {\n Red.call(this, m);\n this.shift = this.m.bitLength();\n\n if (this.shift % 26 !== 0) {\n this.shift += 26 - this.shift % 26;\n }\n\n this.r = new BN(1).iushln(this.shift);\n this.r2 = this.imod(this.r.sqr());\n this.rinv = this.r._invmp(this.m);\n this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);\n this.minv = this.minv.umod(this.r);\n this.minv = this.r.sub(this.minv);\n }\n\n inherits(Mont, Red);\n\n Mont.prototype.convertTo = function convertTo(num) {\n return this.imod(num.ushln(this.shift));\n };\n\n Mont.prototype.convertFrom = function convertFrom(num) {\n var r = this.imod(num.mul(this.rinv));\n r.red = null;\n return r;\n };\n\n Mont.prototype.imul = function imul(a, b) {\n if (a.isZero() || b.isZero()) {\n a.words[0] = 0;\n a.length = 1;\n return a;\n }\n\n var t = a.imul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.mul = function mul(a, b) {\n if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);\n var t = a.mul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.invm = function invm(a) {\n // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R\n var res = this.imod(a._invmp(this.m).mul(this.r2));\n return res._forceRed(this);\n };\n})(typeof module === 'undefined' || module, this);","/*! safe-buffer. MIT License. Feross Aboukhadijeh */\n\n/* eslint-disable node/no-deprecated-api */\nvar buffer = require('buffer');\n\nvar Buffer = buffer.Buffer; // alternative to using Object.keys for old browsers\n\nfunction copyProps(src, dst) {\n for (var key in src) {\n dst[key] = src[key];\n }\n}\n\nif (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {\n module.exports = buffer;\n} else {\n // Copy properties from require('buffer')\n copyProps(buffer, exports);\n exports.Buffer = SafeBuffer;\n}\n\nfunction SafeBuffer(arg, encodingOrOffset, length) {\n return Buffer(arg, encodingOrOffset, length);\n}\n\nSafeBuffer.prototype = Object.create(Buffer.prototype); // Copy static methods from Buffer\n\ncopyProps(Buffer, SafeBuffer);\n\nSafeBuffer.from = function (arg, encodingOrOffset, length) {\n if (typeof arg === 'number') {\n throw new TypeError('Argument must not be a number');\n }\n\n return Buffer(arg, encodingOrOffset, length);\n};\n\nSafeBuffer.alloc = function (size, fill, encoding) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number');\n }\n\n var buf = Buffer(size);\n\n if (fill !== undefined) {\n if (typeof encoding === 'string') {\n buf.fill(fill, encoding);\n } else {\n buf.fill(fill);\n }\n } else {\n buf.fill(0);\n }\n\n return buf;\n};\n\nSafeBuffer.allocUnsafe = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number');\n }\n\n return Buffer(size);\n};\n\nSafeBuffer.allocUnsafeSlow = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number');\n }\n\n return buffer.SlowBuffer(size);\n};","// based on the aes implimentation in triple sec\n// https://github.com/keybase/triplesec\n// which is in turn based on the one from crypto-js\n// https://code.google.com/p/crypto-js/\nvar Buffer = require('safe-buffer').Buffer;\n\nfunction asUInt32Array(buf) {\n if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf);\n var len = buf.length / 4 | 0;\n var out = new Array(len);\n\n for (var i = 0; i < len; i++) {\n out[i] = buf.readUInt32BE(i * 4);\n }\n\n return out;\n}\n\nfunction scrubVec(v) {\n for (var i = 0; i < v.length; v++) {\n v[i] = 0;\n }\n}\n\nfunction cryptBlock(M, keySchedule, SUB_MIX, SBOX, nRounds) {\n var SUB_MIX0 = SUB_MIX[0];\n var SUB_MIX1 = SUB_MIX[1];\n var SUB_MIX2 = SUB_MIX[2];\n var SUB_MIX3 = SUB_MIX[3];\n var s0 = M[0] ^ keySchedule[0];\n var s1 = M[1] ^ keySchedule[1];\n var s2 = M[2] ^ keySchedule[2];\n var s3 = M[3] ^ keySchedule[3];\n var t0, t1, t2, t3;\n var ksRow = 4;\n\n for (var round = 1; round < nRounds; round++) {\n t0 = SUB_MIX0[s0 >>> 24] ^ SUB_MIX1[s1 >>> 16 & 0xff] ^ SUB_MIX2[s2 >>> 8 & 0xff] ^ SUB_MIX3[s3 & 0xff] ^ keySchedule[ksRow++];\n t1 = SUB_MIX0[s1 >>> 24] ^ SUB_MIX1[s2 >>> 16 & 0xff] ^ SUB_MIX2[s3 >>> 8 & 0xff] ^ SUB_MIX3[s0 & 0xff] ^ keySchedule[ksRow++];\n t2 = SUB_MIX0[s2 >>> 24] ^ SUB_MIX1[s3 >>> 16 & 0xff] ^ SUB_MIX2[s0 >>> 8 & 0xff] ^ SUB_MIX3[s1 & 0xff] ^ keySchedule[ksRow++];\n t3 = SUB_MIX0[s3 >>> 24] ^ SUB_MIX1[s0 >>> 16 & 0xff] ^ SUB_MIX2[s1 >>> 8 & 0xff] ^ SUB_MIX3[s2 & 0xff] ^ keySchedule[ksRow++];\n s0 = t0;\n s1 = t1;\n s2 = t2;\n s3 = t3;\n }\n\n t0 = (SBOX[s0 >>> 24] << 24 | SBOX[s1 >>> 16 & 0xff] << 16 | SBOX[s2 >>> 8 & 0xff] << 8 | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];\n t1 = (SBOX[s1 >>> 24] << 24 | SBOX[s2 >>> 16 & 0xff] << 16 | SBOX[s3 >>> 8 & 0xff] << 8 | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];\n t2 = (SBOX[s2 >>> 24] << 24 | SBOX[s3 >>> 16 & 0xff] << 16 | SBOX[s0 >>> 8 & 0xff] << 8 | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];\n t3 = (SBOX[s3 >>> 24] << 24 | SBOX[s0 >>> 16 & 0xff] << 16 | SBOX[s1 >>> 8 & 0xff] << 8 | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];\n t0 = t0 >>> 0;\n t1 = t1 >>> 0;\n t2 = t2 >>> 0;\n t3 = t3 >>> 0;\n return [t0, t1, t2, t3];\n} // AES constants\n\n\nvar RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];\n\nvar G = function () {\n // Compute double table\n var d = new Array(256);\n\n for (var j = 0; j < 256; j++) {\n if (j < 128) {\n d[j] = j << 1;\n } else {\n d[j] = j << 1 ^ 0x11b;\n }\n }\n\n var SBOX = [];\n var INV_SBOX = [];\n var SUB_MIX = [[], [], [], []];\n var INV_SUB_MIX = [[], [], [], []]; // Walk GF(2^8)\n\n var x = 0;\n var xi = 0;\n\n for (var i = 0; i < 256; ++i) {\n // Compute sbox\n var sx = xi ^ xi << 1 ^ xi << 2 ^ xi << 3 ^ xi << 4;\n sx = sx >>> 8 ^ sx & 0xff ^ 0x63;\n SBOX[x] = sx;\n INV_SBOX[sx] = x; // Compute multiplication\n\n var x2 = d[x];\n var x4 = d[x2];\n var x8 = d[x4]; // Compute sub bytes, mix columns tables\n\n var t = d[sx] * 0x101 ^ sx * 0x1010100;\n SUB_MIX[0][x] = t << 24 | t >>> 8;\n SUB_MIX[1][x] = t << 16 | t >>> 16;\n SUB_MIX[2][x] = t << 8 | t >>> 24;\n SUB_MIX[3][x] = t; // Compute inv sub bytes, inv mix columns tables\n\n t = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100;\n INV_SUB_MIX[0][sx] = t << 24 | t >>> 8;\n INV_SUB_MIX[1][sx] = t << 16 | t >>> 16;\n INV_SUB_MIX[2][sx] = t << 8 | t >>> 24;\n INV_SUB_MIX[3][sx] = t;\n\n if (x === 0) {\n x = xi = 1;\n } else {\n x = x2 ^ d[d[d[x8 ^ x2]]];\n xi ^= d[d[xi]];\n }\n }\n\n return {\n SBOX: SBOX,\n INV_SBOX: INV_SBOX,\n SUB_MIX: SUB_MIX,\n INV_SUB_MIX: INV_SUB_MIX\n };\n}();\n\nfunction AES(key) {\n this._key = asUInt32Array(key);\n\n this._reset();\n}\n\nAES.blockSize = 4 * 4;\nAES.keySize = 256 / 8;\nAES.prototype.blockSize = AES.blockSize;\nAES.prototype.keySize = AES.keySize;\n\nAES.prototype._reset = function () {\n var keyWords = this._key;\n var keySize = keyWords.length;\n var nRounds = keySize + 6;\n var ksRows = (nRounds + 1) * 4;\n var keySchedule = [];\n\n for (var k = 0; k < keySize; k++) {\n keySchedule[k] = keyWords[k];\n }\n\n for (k = keySize; k < ksRows; k++) {\n var t = keySchedule[k - 1];\n\n if (k % keySize === 0) {\n t = t << 8 | t >>> 24;\n t = G.SBOX[t >>> 24] << 24 | G.SBOX[t >>> 16 & 0xff] << 16 | G.SBOX[t >>> 8 & 0xff] << 8 | G.SBOX[t & 0xff];\n t ^= RCON[k / keySize | 0] << 24;\n } else if (keySize > 6 && k % keySize === 4) {\n t = G.SBOX[t >>> 24] << 24 | G.SBOX[t >>> 16 & 0xff] << 16 | G.SBOX[t >>> 8 & 0xff] << 8 | G.SBOX[t & 0xff];\n }\n\n keySchedule[k] = keySchedule[k - keySize] ^ t;\n }\n\n var invKeySchedule = [];\n\n for (var ik = 0; ik < ksRows; ik++) {\n var ksR = ksRows - ik;\n var tt = keySchedule[ksR - (ik % 4 ? 0 : 4)];\n\n if (ik < 4 || ksR <= 4) {\n invKeySchedule[ik] = tt;\n } else {\n invKeySchedule[ik] = G.INV_SUB_MIX[0][G.SBOX[tt >>> 24]] ^ G.INV_SUB_MIX[1][G.SBOX[tt >>> 16 & 0xff]] ^ G.INV_SUB_MIX[2][G.SBOX[tt >>> 8 & 0xff]] ^ G.INV_SUB_MIX[3][G.SBOX[tt & 0xff]];\n }\n }\n\n this._nRounds = nRounds;\n this._keySchedule = keySchedule;\n this._invKeySchedule = invKeySchedule;\n};\n\nAES.prototype.encryptBlockRaw = function (M) {\n M = asUInt32Array(M);\n return cryptBlock(M, this._keySchedule, G.SUB_MIX, G.SBOX, this._nRounds);\n};\n\nAES.prototype.encryptBlock = function (M) {\n var out = this.encryptBlockRaw(M);\n var buf = Buffer.allocUnsafe(16);\n buf.writeUInt32BE(out[0], 0);\n buf.writeUInt32BE(out[1], 4);\n buf.writeUInt32BE(out[2], 8);\n buf.writeUInt32BE(out[3], 12);\n return buf;\n};\n\nAES.prototype.decryptBlock = function (M) {\n M = asUInt32Array(M); // swap\n\n var m1 = M[1];\n M[1] = M[3];\n M[3] = m1;\n var out = cryptBlock(M, this._invKeySchedule, G.INV_SUB_MIX, G.INV_SBOX, this._nRounds);\n var buf = Buffer.allocUnsafe(16);\n buf.writeUInt32BE(out[0], 0);\n buf.writeUInt32BE(out[3], 4);\n buf.writeUInt32BE(out[2], 8);\n buf.writeUInt32BE(out[1], 12);\n return buf;\n};\n\nAES.prototype.scrub = function () {\n scrubVec(this._keySchedule);\n scrubVec(this._invKeySchedule);\n scrubVec(this._key);\n};\n\nmodule.exports.AES = AES;","/* @generated */\n// prettier-ignore\nif (Intl.PluralRules && typeof Intl.PluralRules.__addLocaleData === 'function') {\n Intl.PluralRules.__addLocaleData({\n \"data\": {\n \"ar\": {\n \"categories\": {\n \"cardinal\": [\"zero\", \"one\", \"two\", \"few\", \"many\", \"other\"],\n \"ordinal\": [\"other\"]\n },\n \"fn\": function fn(n, ord) {\n var s = String(n).split('.'),\n t0 = Number(s[0]) == n,\n n100 = t0 && s[0].slice(-2);\n if (ord) return 'other';\n return n == 0 ? 'zero' : n == 1 ? 'one' : n == 2 ? 'two' : n100 >= 3 && n100 <= 10 ? 'few' : n100 >= 11 && n100 <= 99 ? 'many' : 'other';\n }\n }\n },\n \"aliases\": {},\n \"parentLocales\": {},\n \"availableLocales\": [\"ar\"]\n });\n}","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nfunction isArray(arg) {\n if (Array.isArray) {\n return Array.isArray(arg);\n }\n\n return objectToString(arg) === '[object Array]';\n}\n\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\n\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\n\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\n\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\n\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\n\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\n\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\n\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return objectToString(re) === '[object RegExp]';\n}\n\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return objectToString(d) === '[object Date]';\n}\n\nexports.isDate = isDate;\n\nfunction isError(e) {\n return objectToString(e) === '[object Error]' || e instanceof Error;\n}\n\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\n\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null || typeof arg === 'boolean' || typeof arg === 'number' || typeof arg === 'string' || typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\n\nexports.isPrimitive = isPrimitive;\nexports.isBuffer = Buffer.isBuffer;\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}","var Buffer = require('safe-buffer').Buffer;\n\nvar ZEROES = Buffer.alloc(16, 0);\n\nfunction toArray(buf) {\n return [buf.readUInt32BE(0), buf.readUInt32BE(4), buf.readUInt32BE(8), buf.readUInt32BE(12)];\n}\n\nfunction fromArray(out) {\n var buf = Buffer.allocUnsafe(16);\n buf.writeUInt32BE(out[0] >>> 0, 0);\n buf.writeUInt32BE(out[1] >>> 0, 4);\n buf.writeUInt32BE(out[2] >>> 0, 8);\n buf.writeUInt32BE(out[3] >>> 0, 12);\n return buf;\n}\n\nfunction GHASH(key) {\n this.h = key;\n this.state = Buffer.alloc(16, 0);\n this.cache = Buffer.allocUnsafe(0);\n} // from http://bitwiseshiftleft.github.io/sjcl/doc/symbols/src/core_gcm.js.html\n// by Juho Vähä-Herttua\n\n\nGHASH.prototype.ghash = function (block) {\n var i = -1;\n\n while (++i < block.length) {\n this.state[i] ^= block[i];\n }\n\n this._multiply();\n};\n\nGHASH.prototype._multiply = function () {\n var Vi = toArray(this.h);\n var Zi = [0, 0, 0, 0];\n var j, xi, lsbVi;\n var i = -1;\n\n while (++i < 128) {\n xi = (this.state[~~(i / 8)] & 1 << 7 - i % 8) !== 0;\n\n if (xi) {\n // Z_i+1 = Z_i ^ V_i\n Zi[0] ^= Vi[0];\n Zi[1] ^= Vi[1];\n Zi[2] ^= Vi[2];\n Zi[3] ^= Vi[3];\n } // Store the value of LSB(V_i)\n\n\n lsbVi = (Vi[3] & 1) !== 0; // V_i+1 = V_i >> 1\n\n for (j = 3; j > 0; j--) {\n Vi[j] = Vi[j] >>> 1 | (Vi[j - 1] & 1) << 31;\n }\n\n Vi[0] = Vi[0] >>> 1; // If LSB(V_i) is 1, V_i+1 = (V_i >> 1) ^ R\n\n if (lsbVi) {\n Vi[0] = Vi[0] ^ 0xe1 << 24;\n }\n }\n\n this.state = fromArray(Zi);\n};\n\nGHASH.prototype.update = function (buf) {\n this.cache = Buffer.concat([this.cache, buf]);\n var chunk;\n\n while (this.cache.length >= 16) {\n chunk = this.cache.slice(0, 16);\n this.cache = this.cache.slice(16);\n this.ghash(chunk);\n }\n};\n\nGHASH.prototype.final = function (abl, bl) {\n if (this.cache.length) {\n this.ghash(Buffer.concat([this.cache, ZEROES], 16));\n }\n\n this.ghash(fromArray([0, abl, 0, bl]));\n return this.state;\n};\n\nmodule.exports = GHASH;","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor;\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n }\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor;\n\n var TempCtor = function TempCtor() {};\n\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n };\n}","import React from \"react\"\nimport { Controller } from \"react-hook-form\"\nimport { Form } from \"react-bootstrap\"\nimport InputGroup from 'react-bootstrap/InputGroup';\n\nconst WithInputGroup = ({ prependInputGroupText, appendInputGroupText, children }) => {\n return (\n \n {prependInputGroupText && (\n \n {prependInputGroupText}\n \n )}\n\n {appendInputGroupText && (\n \n {appendInputGroupText}\n \n )}\n\n {children}\n \n )\n}\n\nconst Input = ({\n autocomplete,\n name,\n type,\n control,\n errors,\n validations,\n defaultValue,\n placeholder,\n plaintext = false,\n readOnly = false,\n isDisabled = false,\n}) => (\n)\nconst InputField = (props) => \n\nexport default InputField\n","/* @generated */\n// prettier-ignore\nif (Intl.PluralRules && typeof Intl.PluralRules.__addLocaleData === 'function') {\n Intl.PluralRules.__addLocaleData({\n \"data\": {\n \"pt\": {\n \"categories\": {\n \"cardinal\": [\"one\", \"other\"],\n \"ordinal\": [\"other\"]\n },\n \"fn\": function fn(n, ord) {\n var s = String(n).split('.'),\n i = s[0];\n if (ord) return 'other';\n return i == 0 || i == 1 ? 'one' : 'other';\n }\n }\n },\n \"aliases\": {},\n \"parentLocales\": {\n \"pt-AO\": \"pt-PT\",\n \"pt-CH\": \"pt-PT\",\n \"pt-CV\": \"pt-PT\",\n \"pt-FR\": \"pt-PT\",\n \"pt-GQ\": \"pt-PT\",\n \"pt-GW\": \"pt-PT\",\n \"pt-LU\": \"pt-PT\",\n \"pt-MO\": \"pt-PT\",\n \"pt-MZ\": \"pt-PT\",\n \"pt-ST\": \"pt-PT\",\n \"pt-TL\": \"pt-PT\"\n },\n \"availableLocales\": [\"pt\"]\n });\n}","'use strict';\n\nvar utils = require('../utils');\n\nvar BN = require('bn.js');\n\nvar inherits = require('inherits');\n\nvar Base = require('./base');\n\nvar assert = utils.assert;\n\nfunction EdwardsCurve(conf) {\n // NOTE: Important as we are creating point in Base.call()\n this.twisted = (conf.a | 0) !== 1;\n this.mOneA = this.twisted && (conf.a | 0) === -1;\n this.extended = this.mOneA;\n Base.call(this, 'edwards', conf);\n this.a = new BN(conf.a, 16).umod(this.red.m);\n this.a = this.a.toRed(this.red);\n this.c = new BN(conf.c, 16).toRed(this.red);\n this.c2 = this.c.redSqr();\n this.d = new BN(conf.d, 16).toRed(this.red);\n this.dd = this.d.redAdd(this.d);\n assert(!this.twisted || this.c.fromRed().cmpn(1) === 0);\n this.oneC = (conf.c | 0) === 1;\n}\n\ninherits(EdwardsCurve, Base);\nmodule.exports = EdwardsCurve;\n\nEdwardsCurve.prototype._mulA = function _mulA(num) {\n if (this.mOneA) return num.redNeg();else return this.a.redMul(num);\n};\n\nEdwardsCurve.prototype._mulC = function _mulC(num) {\n if (this.oneC) return num;else return this.c.redMul(num);\n}; // Just for compatibility with Short curve\n\n\nEdwardsCurve.prototype.jpoint = function jpoint(x, y, z, t) {\n return this.point(x, y, z, t);\n};\n\nEdwardsCurve.prototype.pointFromX = function pointFromX(x, odd) {\n x = new BN(x, 16);\n if (!x.red) x = x.toRed(this.red);\n var x2 = x.redSqr();\n var rhs = this.c2.redSub(this.a.redMul(x2));\n var lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2));\n var y2 = rhs.redMul(lhs.redInvm());\n var y = y2.redSqrt();\n if (y.redSqr().redSub(y2).cmp(this.zero) !== 0) throw new Error('invalid point');\n var isOdd = y.fromRed().isOdd();\n if (odd && !isOdd || !odd && isOdd) y = y.redNeg();\n return this.point(x, y);\n};\n\nEdwardsCurve.prototype.pointFromY = function pointFromY(y, odd) {\n y = new BN(y, 16);\n if (!y.red) y = y.toRed(this.red); // x^2 = (y^2 - c^2) / (c^2 d y^2 - a)\n\n var y2 = y.redSqr();\n var lhs = y2.redSub(this.c2);\n var rhs = y2.redMul(this.d).redMul(this.c2).redSub(this.a);\n var x2 = lhs.redMul(rhs.redInvm());\n\n if (x2.cmp(this.zero) === 0) {\n if (odd) throw new Error('invalid point');else return this.point(this.zero, y);\n }\n\n var x = x2.redSqrt();\n if (x.redSqr().redSub(x2).cmp(this.zero) !== 0) throw new Error('invalid point');\n if (x.fromRed().isOdd() !== odd) x = x.redNeg();\n return this.point(x, y);\n};\n\nEdwardsCurve.prototype.validate = function validate(point) {\n if (point.isInfinity()) return true; // Curve: A * X^2 + Y^2 = C^2 * (1 + D * X^2 * Y^2)\n\n point.normalize();\n var x2 = point.x.redSqr();\n var y2 = point.y.redSqr();\n var lhs = x2.redMul(this.a).redAdd(y2);\n var rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2)));\n return lhs.cmp(rhs) === 0;\n};\n\nfunction Point(curve, x, y, z, t) {\n Base.BasePoint.call(this, curve, 'projective');\n\n if (x === null && y === null && z === null) {\n this.x = this.curve.zero;\n this.y = this.curve.one;\n this.z = this.curve.one;\n this.t = this.curve.zero;\n this.zOne = true;\n } else {\n this.x = new BN(x, 16);\n this.y = new BN(y, 16);\n this.z = z ? new BN(z, 16) : this.curve.one;\n this.t = t && new BN(t, 16);\n if (!this.x.red) this.x = this.x.toRed(this.curve.red);\n if (!this.y.red) this.y = this.y.toRed(this.curve.red);\n if (!this.z.red) this.z = this.z.toRed(this.curve.red);\n if (this.t && !this.t.red) this.t = this.t.toRed(this.curve.red);\n this.zOne = this.z === this.curve.one; // Use extended coordinates\n\n if (this.curve.extended && !this.t) {\n this.t = this.x.redMul(this.y);\n if (!this.zOne) this.t = this.t.redMul(this.z.redInvm());\n }\n }\n}\n\ninherits(Point, Base.BasePoint);\n\nEdwardsCurve.prototype.pointFromJSON = function pointFromJSON(obj) {\n return Point.fromJSON(this, obj);\n};\n\nEdwardsCurve.prototype.point = function point(x, y, z, t) {\n return new Point(this, x, y, z, t);\n};\n\nPoint.fromJSON = function fromJSON(curve, obj) {\n return new Point(curve, obj[0], obj[1], obj[2]);\n};\n\nPoint.prototype.inspect = function inspect() {\n if (this.isInfinity()) return '';\n return '';\n};\n\nPoint.prototype.isInfinity = function isInfinity() {\n // XXX This code assumes that zero is always zero in red\n return this.x.cmpn(0) === 0 && (this.y.cmp(this.z) === 0 || this.zOne && this.y.cmp(this.curve.c) === 0);\n};\n\nPoint.prototype._extDbl = function _extDbl() {\n // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html\n // #doubling-dbl-2008-hwcd\n // 4M + 4S\n // A = X1^2\n var a = this.x.redSqr(); // B = Y1^2\n\n var b = this.y.redSqr(); // C = 2 * Z1^2\n\n var c = this.z.redSqr();\n c = c.redIAdd(c); // D = a * A\n\n var d = this.curve._mulA(a); // E = (X1 + Y1)^2 - A - B\n\n\n var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b); // G = D + B\n\n var g = d.redAdd(b); // F = G - C\n\n var f = g.redSub(c); // H = D - B\n\n var h = d.redSub(b); // X3 = E * F\n\n var nx = e.redMul(f); // Y3 = G * H\n\n var ny = g.redMul(h); // T3 = E * H\n\n var nt = e.redMul(h); // Z3 = F * G\n\n var nz = f.redMul(g);\n return this.curve.point(nx, ny, nz, nt);\n};\n\nPoint.prototype._projDbl = function _projDbl() {\n // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html\n // #doubling-dbl-2008-bbjlp\n // #doubling-dbl-2007-bl\n // and others\n // Generally 3M + 4S or 2M + 4S\n // B = (X1 + Y1)^2\n var b = this.x.redAdd(this.y).redSqr(); // C = X1^2\n\n var c = this.x.redSqr(); // D = Y1^2\n\n var d = this.y.redSqr();\n var nx;\n var ny;\n var nz;\n\n if (this.curve.twisted) {\n // E = a * C\n var e = this.curve._mulA(c); // F = E + D\n\n\n var f = e.redAdd(d);\n\n if (this.zOne) {\n // X3 = (B - C - D) * (F - 2)\n nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two)); // Y3 = F * (E - D)\n\n ny = f.redMul(e.redSub(d)); // Z3 = F^2 - 2 * F\n\n nz = f.redSqr().redSub(f).redSub(f);\n } else {\n // H = Z1^2\n var h = this.z.redSqr(); // J = F - 2 * H\n\n var j = f.redSub(h).redISub(h); // X3 = (B-C-D)*J\n\n nx = b.redSub(c).redISub(d).redMul(j); // Y3 = F * (E - D)\n\n ny = f.redMul(e.redSub(d)); // Z3 = F * J\n\n nz = f.redMul(j);\n }\n } else {\n // E = C + D\n var e = c.redAdd(d); // H = (c * Z1)^2\n\n var h = this.curve._mulC(this.z).redSqr(); // J = E - 2 * H\n\n\n var j = e.redSub(h).redSub(h); // X3 = c * (B - E) * J\n\n nx = this.curve._mulC(b.redISub(e)).redMul(j); // Y3 = c * E * (C - D)\n\n ny = this.curve._mulC(e).redMul(c.redISub(d)); // Z3 = E * J\n\n nz = e.redMul(j);\n }\n\n return this.curve.point(nx, ny, nz);\n};\n\nPoint.prototype.dbl = function dbl() {\n if (this.isInfinity()) return this; // Double in extended coordinates\n\n if (this.curve.extended) return this._extDbl();else return this._projDbl();\n};\n\nPoint.prototype._extAdd = function _extAdd(p) {\n // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html\n // #addition-add-2008-hwcd-3\n // 8M\n // A = (Y1 - X1) * (Y2 - X2)\n var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x)); // B = (Y1 + X1) * (Y2 + X2)\n\n var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x)); // C = T1 * k * T2\n\n var c = this.t.redMul(this.curve.dd).redMul(p.t); // D = Z1 * 2 * Z2\n\n var d = this.z.redMul(p.z.redAdd(p.z)); // E = B - A\n\n var e = b.redSub(a); // F = D - C\n\n var f = d.redSub(c); // G = D + C\n\n var g = d.redAdd(c); // H = B + A\n\n var h = b.redAdd(a); // X3 = E * F\n\n var nx = e.redMul(f); // Y3 = G * H\n\n var ny = g.redMul(h); // T3 = E * H\n\n var nt = e.redMul(h); // Z3 = F * G\n\n var nz = f.redMul(g);\n return this.curve.point(nx, ny, nz, nt);\n};\n\nPoint.prototype._projAdd = function _projAdd(p) {\n // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html\n // #addition-add-2008-bbjlp\n // #addition-add-2007-bl\n // 10M + 1S\n // A = Z1 * Z2\n var a = this.z.redMul(p.z); // B = A^2\n\n var b = a.redSqr(); // C = X1 * X2\n\n var c = this.x.redMul(p.x); // D = Y1 * Y2\n\n var d = this.y.redMul(p.y); // E = d * C * D\n\n var e = this.curve.d.redMul(c).redMul(d); // F = B - E\n\n var f = b.redSub(e); // G = B + E\n\n var g = b.redAdd(e); // X3 = A * F * ((X1 + Y1) * (X2 + Y2) - C - D)\n\n var tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d);\n var nx = a.redMul(f).redMul(tmp);\n var ny;\n var nz;\n\n if (this.curve.twisted) {\n // Y3 = A * G * (D - a * C)\n ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c))); // Z3 = F * G\n\n nz = f.redMul(g);\n } else {\n // Y3 = A * G * (D - C)\n ny = a.redMul(g).redMul(d.redSub(c)); // Z3 = c * F * G\n\n nz = this.curve._mulC(f).redMul(g);\n }\n\n return this.curve.point(nx, ny, nz);\n};\n\nPoint.prototype.add = function add(p) {\n if (this.isInfinity()) return p;\n if (p.isInfinity()) return this;\n if (this.curve.extended) return this._extAdd(p);else return this._projAdd(p);\n};\n\nPoint.prototype.mul = function mul(k) {\n if (this._hasDoubles(k)) return this.curve._fixedNafMul(this, k);else return this.curve._wnafMul(this, k);\n};\n\nPoint.prototype.mulAdd = function mulAdd(k1, p, k2) {\n return this.curve._wnafMulAdd(1, [this, p], [k1, k2], 2, false);\n};\n\nPoint.prototype.jmulAdd = function jmulAdd(k1, p, k2) {\n return this.curve._wnafMulAdd(1, [this, p], [k1, k2], 2, true);\n};\n\nPoint.prototype.normalize = function normalize() {\n if (this.zOne) return this; // Normalize coordinates\n\n var zi = this.z.redInvm();\n this.x = this.x.redMul(zi);\n this.y = this.y.redMul(zi);\n if (this.t) this.t = this.t.redMul(zi);\n this.z = this.curve.one;\n this.zOne = true;\n return this;\n};\n\nPoint.prototype.neg = function neg() {\n return this.curve.point(this.x.redNeg(), this.y, this.z, this.t && this.t.redNeg());\n};\n\nPoint.prototype.getX = function getX() {\n this.normalize();\n return this.x.fromRed();\n};\n\nPoint.prototype.getY = function getY() {\n this.normalize();\n return this.y.fromRed();\n};\n\nPoint.prototype.eq = function eq(other) {\n return this === other || this.getX().cmp(other.getX()) === 0 && this.getY().cmp(other.getY()) === 0;\n};\n\nPoint.prototype.eqXToP = function eqXToP(x) {\n var rx = x.toRed(this.curve.red).redMul(this.z);\n if (this.x.cmp(rx) === 0) return true;\n var xc = x.clone();\n var t = this.curve.redN.redMul(this.z);\n\n for (;;) {\n xc.iadd(this.curve.n);\n if (xc.cmp(this.curve.p) >= 0) return false;\n rx.redIAdd(t);\n if (this.x.cmp(rx) === 0) return true;\n }\n}; // Compatibility with BaseCurve\n\n\nPoint.prototype.toP = Point.prototype.normalize;\nPoint.prototype.mixedAdd = Point.prototype.add;","\"use strict\";\n\nvar __importDefault = this && this.__importDefault || function (mod) {\n return mod && mod.__esModule ? mod : {\n \"default\": mod\n };\n};\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar react_1 = require(\"react\");\n\nvar context_1 = __importDefault(require(\"./context\")); // tslint:disable:max-line-length\n\n/**\n * `useLDClient` is a custom hook which returns the underlying [LaunchDarkly JavaScript SDK client object](https://launchdarkly.github.io/js-client-sdk/interfaces/_launchdarkly_js_client_sdk_.ldclient.html).\n * Like the `useFlags` custom hook, `useLDClient` also uses the `useContext` primitive to access the LaunchDarkly\n * context set up by `withLDProvider`. You will still need to use the `withLDProvider` HOC\n * to initialise the react sdk to use this custom hook.\n *\n * @return The `launchdarkly-js-client-sdk` `LDClient` object\n */\n// tslint:enable:max-line-length\n\n\nvar useLDClient = function useLDClient() {\n var ldClient = react_1.useContext(context_1.default).ldClient;\n return ldClient;\n};\n\nexports.default = useLDClient;","/* @generated */\n// prettier-ignore\nif (Intl.PluralRules && typeof Intl.PluralRules.__addLocaleData === 'function') {\n Intl.PluralRules.__addLocaleData({\n \"data\": {\n \"zh\": {\n \"categories\": {\n \"cardinal\": [\"other\"],\n \"ordinal\": [\"other\"]\n },\n \"fn\": function fn(n, ord) {\n return 'other';\n }\n }\n },\n \"aliases\": {\n \"zh-CN\": \"zh-Hans-CN\",\n \"zh-guoyu\": \"zh\",\n \"zh-hakka\": \"hak\",\n \"zh-HK\": \"zh-Hant-HK\",\n \"zh-min-nan\": \"nan\",\n \"zh-MO\": \"zh-Hant-MO\",\n \"zh-SG\": \"zh-Hans-SG\",\n \"zh-TW\": \"zh-Hant-TW\",\n \"zh-xiang\": \"hsn\",\n \"zh-min\": \"nan-x-zh-min\"\n },\n \"parentLocales\": {\n \"zh-Hant-MO\": \"zh-Hant-HK\"\n },\n \"availableLocales\": [\"zh\"]\n });\n}","'use strict';\n\nmodule.exports = function (str) {\n return encodeURIComponent(str).replace(/[!'()*]/g, function (x) {\n return \"%\".concat(x.charCodeAt(0).toString(16).toUpperCase());\n });\n};","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.isUnicodeLanguageSubtag = exports.isUnicodeScriptSubtag = exports.isUnicodeRegionSubtag = exports.isStructurallyValidLanguageTag = exports.parseUnicodeLanguageId = exports.parseUnicodeLocaleId = exports.getCanonicalLocales = void 0;\n\nvar tslib_1 = require(\"tslib\");\n\nvar parser_1 = require(\"./src/parser\");\n\nvar emitter_1 = require(\"./src/emitter\");\n\nvar canonicalizer_1 = require(\"./src/canonicalizer\");\n/**\n * https://tc39.es/ecma402/#sec-canonicalizelocalelist\n * @param locales\n */\n\n\nfunction CanonicalizeLocaleList(locales) {\n if (locales === undefined) {\n return [];\n }\n\n var seen = [];\n\n if (typeof locales === 'string') {\n locales = [locales];\n }\n\n for (var _i = 0, locales_1 = locales; _i < locales_1.length; _i++) {\n var locale = locales_1[_i];\n var canonicalizedTag = emitter_1.emitUnicodeLocaleId(canonicalizer_1.canonicalizeUnicodeLocaleId(parser_1.parseUnicodeLocaleId(locale)));\n\n if (seen.indexOf(canonicalizedTag) < 0) {\n seen.push(canonicalizedTag);\n }\n }\n\n return seen;\n}\n\nfunction getCanonicalLocales(locales) {\n return CanonicalizeLocaleList(locales);\n}\n\nexports.getCanonicalLocales = getCanonicalLocales;\n\nvar parser_2 = require(\"./src/parser\");\n\nObject.defineProperty(exports, \"parseUnicodeLocaleId\", {\n enumerable: true,\n get: function get() {\n return parser_2.parseUnicodeLocaleId;\n }\n});\nObject.defineProperty(exports, \"parseUnicodeLanguageId\", {\n enumerable: true,\n get: function get() {\n return parser_2.parseUnicodeLanguageId;\n }\n});\nObject.defineProperty(exports, \"isStructurallyValidLanguageTag\", {\n enumerable: true,\n get: function get() {\n return parser_2.isStructurallyValidLanguageTag;\n }\n});\nObject.defineProperty(exports, \"isUnicodeRegionSubtag\", {\n enumerable: true,\n get: function get() {\n return parser_2.isUnicodeRegionSubtag;\n }\n});\nObject.defineProperty(exports, \"isUnicodeScriptSubtag\", {\n enumerable: true,\n get: function get() {\n return parser_2.isUnicodeScriptSubtag;\n }\n});\nObject.defineProperty(exports, \"isUnicodeLanguageSubtag\", {\n enumerable: true,\n get: function get() {\n return parser_2.isUnicodeLanguageSubtag;\n }\n});\n\ntslib_1.__exportStar(require(\"./src/types\"), exports);\n\ntslib_1.__exportStar(require(\"./src/emitter\"), exports);","/* eslint-disable */\n// this is an auto generated file. This will be overwritten\n\nexport const adminAddMember = /* GraphQL */ `\n mutation AdminAddMember($organizationID: ID!, $sub: ID!) {\n adminAddMember(organizationID: $organizationID, sub: $sub)\n }\n`;\nexport const adminRemoveMember = /* GraphQL */ `\n mutation AdminRemoveMember($organizationID: ID!, $sub: ID!) {\n adminRemoveMember(organizationID: $organizationID, sub: $sub)\n }\n`;\nexport const createAccessRequest = /* GraphQL */ `\n mutation CreateAccessRequest(\n $input: CreateAccessRequestInput!\n $condition: ModelAccessRequestConditionInput\n ) {\n createAccessRequest(input: $input, condition: $condition) {\n id\n itemId\n organizationID\n owner\n type\n createdAt\n updatedAt\n }\n }\n`;\nexport const updateAccessRequest = /* GraphQL */ `\n mutation UpdateAccessRequest(\n $input: UpdateAccessRequestInput!\n $condition: ModelAccessRequestConditionInput\n ) {\n updateAccessRequest(input: $input, condition: $condition) {\n id\n itemId\n organizationID\n owner\n type\n createdAt\n updatedAt\n }\n }\n`;\nexport const deleteAccessRequest = /* GraphQL */ `\n mutation DeleteAccessRequest(\n $input: DeleteAccessRequestInput!\n $condition: ModelAccessRequestConditionInput\n ) {\n deleteAccessRequest(input: $input, condition: $condition) {\n id\n itemId\n organizationID\n owner\n type\n createdAt\n updatedAt\n }\n }\n`;\nexport const createIntegration = /* GraphQL */ `\n mutation CreateIntegration(\n $input: CreateIntegrationInput!\n $condition: ModelIntegrationConditionInput\n ) {\n createIntegration(input: $input, condition: $condition) {\n emailAddresses\n id\n groups\n name\n templateID\n integrationTypeID\n integrationType {\n id\n metadata {\n logo\n logoSquare\n name\n }\n status\n type\n }\n memoq_apiKey\n memoq_creatorUserID\n memoq_webServiceAPIAccessPoint\n memsource_accessToken\n memsource_clientId\n memsource_domain\n memsource_secretToken\n vendorID\n organizationID\n trados_accountId\n trados_languageCloudAccountId\n trados_clientId\n trados_clientSecret\n trados_webhookSecret\n textmaster_apiKey\n textmaster_apiSecret\n plunet_baseUrl\n plunet_username\n plunet_password\n protemos_apiKey\n createdAt\n updatedAt\n owner\n }\n }\n`;\nexport const updateIntegration = /* GraphQL */ `\n mutation UpdateIntegration(\n $input: UpdateIntegrationInput!\n $condition: ModelIntegrationConditionInput\n ) {\n updateIntegration(input: $input, condition: $condition) {\n emailAddresses\n id\n groups\n name\n templateID\n integrationTypeID\n integrationType {\n id\n metadata {\n logo\n logoSquare\n name\n }\n status\n type\n }\n memoq_apiKey\n memoq_creatorUserID\n memoq_webServiceAPIAccessPoint\n memsource_accessToken\n memsource_clientId\n memsource_domain\n memsource_secretToken\n vendorID\n organizationID\n trados_accountId\n trados_languageCloudAccountId\n trados_clientId\n trados_clientSecret\n trados_webhookSecret\n textmaster_apiKey\n textmaster_apiSecret\n protemos_apiKey\n createdAt\n updatedAt\n owner\n }\n }\n`;\nexport const deleteIntegration = /* GraphQL */ `\n mutation DeleteIntegration(\n $input: DeleteIntegrationInput!\n $condition: ModelIntegrationConditionInput\n ) {\n deleteIntegration(input: $input, condition: $condition) {\n id\n groups\n name\n templateID\n integrationTypeID\n integrationType {\n id\n status\n type\n createdAt\n updatedAt\n }\n memoq_apiKey\n memoq_creatorUserID\n memoq_webServiceAPIAccessPoint\n memsource_accessToken\n memsource_clientId\n memsource_domain\n memsource_secretToken\n vendorID\n organizationID\n trados_accountId\n trados_languageCloudAccountId\n trados_clientId\n trados_clientSecret\n trados_webhookSecret\n textmaster_apiKey\n textmaster_apiSecret\n protemos_apiKey\n createdAt\n updatedAt\n owner\n }\n }\n`;\nexport const createOrganization = /* GraphQL */ `\n mutation CreateOrganization(\n $input: CreateOrganizationInput!\n $condition: ModelOrganizationConditionInput\n ) {\n createOrganization(input: $input, condition: $condition) {\n connectors {\n azurerepos {\n refreshToken\n }\n bitbucket {\n clientKey\n }\n contentful {\n environmentIDs\n spaceID\n spaceName\n }\n github {\n installationIDs\n }\n gitlab {\n accessToken\n }\n googledocs {\n refreshToken\n userId\n }\n googlesheets {\n refreshToken\n userId\n }\n hubspotcms {\n hubDomain\n hubId\n refreshToken\n }\n intercom {\n accessToken\n workspaceId\n }\n salesforceknowledge {\n accessToken\n instanceUrl\n refreshToken\n }\n shopify {\n accessToken\n storeId\n }\n mailchimp {\n accessToken\n accountId\n accountName\n serverId\n }\n zendesk {\n accessToken\n domain\n }\n }\n customerID\n groups\n id\n integrationID\n name\n onboarding {\n isCompleted\n stage\n type\n }\n owner\n type\n integrationTemplateID\n vendorID\n createdAt\n updatedAt\n }\n }\n`;\nexport const updateOrganization = /* GraphQL */ `\n mutation UpdateOrganization(\n $input: UpdateOrganizationInput!\n $condition: ModelOrganizationConditionInput\n ) {\n updateOrganization(input: $input, condition: $condition) {\n connectors {\n azurerepos {\n refreshToken\n }\n bitbucket {\n clientKey\n }\n contentful {\n environmentIDs\n spaceID\n spaceName\n }\n github {\n installationIDs\n }\n gitlab {\n accessToken\n }\n googledocs {\n refreshToken\n userId\n }\n googlesheets {\n refreshToken\n userId\n }\n hubspotcms {\n hubDomain\n hubId\n refreshToken\n }\n intercom {\n accessToken\n workspaceId\n }\n salesforceknowledge {\n accessToken\n instanceUrl\n refreshToken\n }\n shopify {\n accessToken\n storeId\n }\n mailchimp {\n accessToken\n accountId\n accountName\n serverId\n }\n zendesk {\n accessToken\n domain\n }\n }\n customerID\n groups\n id\n integrationID\n name\n onboarding {\n isCompleted\n stage\n type\n }\n owner\n type\n integrationTemplateID\n vendorID\n createdAt\n updatedAt\n }\n }\n`;\nexport const deleteOrganization = /* GraphQL */ `\n mutation DeleteOrganization(\n $input: DeleteOrganizationInput!\n $condition: ModelOrganizationConditionInput\n ) {\n deleteOrganization(input: $input, condition: $condition) {\n connectors {\n azurerepos {\n refreshToken\n }\n bitbucket {\n clientKey\n }\n contentful {\n environmentIDs\n spaceID\n spaceName\n }\n github {\n installationIDs\n }\n gitlab {\n accessToken\n }\n googledocs {\n refreshToken\n userId\n }\n googlesheets {\n refreshToken\n userId\n }\n hubspotcms {\n hubDomain\n hubId\n refreshToken\n }\n intercom {\n accessToken\n workspaceId\n }\n salesforceknowledge {\n accessToken\n instanceUrl\n refreshToken\n }\n shopify {\n accessToken\n storeId\n }\n mailchimp {\n accessToken\n accountId\n accountName\n serverId\n }\n zendesk {\n accessToken\n domain\n }\n }\n customerID\n groups\n id\n integrationID\n name\n onboarding {\n isCompleted\n stage\n type\n }\n owner\n type\n integrationTemplateID\n vendorID\n createdAt\n updatedAt\n }\n }\n`;\nexport const createProject = /* GraphQL */ `\n mutation CreateProject(\n $input: CreateProjectInput!\n $condition: ModelProjectConditionInput\n ) {\n createProject(input: $input, condition: $condition) {\n autoUpdateFrequency\n connector {\n isCuisto\n branch\n mode\n organization\n project\n repository\n type\n url\n userId\n webhookURL\n }\n cuistoConfig\n resourcesExcluded\n format {\n framework\n id\n isVisible\n name\n parser\n path\n createdAt\n updatedAt\n }\n formatID\n groups\n id\n isActive\n liveApiKey\n locales {\n items {\n audit {\n completion\n duration\n missingSegments\n missingWords\n price\n segments\n words\n }\n code\n groups\n id\n inProgress\n isActive\n isSource\n locale {\n id\n language\n region\n tag\n createdAt\n updatedAt\n }\n localeID\n organizationID\n owner\n project {\n resourcesExcluded\n formatID\n groups\n id\n isActive\n liveApiKey\n name\n organizationID\n owner\n providerID\n integrationTemplateID\n translationBrief\n testApiKey\n createdAt\n updatedAt\n }\n projectID\n stateUpdatedAt\n createdAt\n updatedAt\n }\n nextToken\n }\n name\n organization {\n connectors {\n azurerepos {\n refreshToken\n }\n bitbucket {\n clientKey\n }\n contentful {\n environmentIDs\n spaceID\n spaceName\n }\n github {\n installationIDs\n }\n gitlab {\n accessToken\n }\n googledocs {\n refreshToken\n userId\n }\n googlesheets {\n refreshToken\n userId\n }\n hubspotcms {\n hubDomain\n hubId\n refreshToken\n }\n intercom {\n accessToken\n workspaceId\n }\n salesforceknowledge {\n accessToken\n instanceUrl\n refreshToken\n }\n shopify {\n accessToken\n storeId\n }\n mailchimp {\n accessToken\n accountId\n accountName\n serverId\n }\n zendesk {\n accessToken\n domain\n }\n }\n customerID\n groups\n id\n integrationID\n name\n onboarding {\n isCompleted\n stage\n type\n }\n owner\n type\n integrationTemplateID\n vendorID\n createdAt\n updatedAt\n }\n organizationID\n owner\n providerID\n resourcePatterns {\n path\n }\n resources {\n path\n projectLocaleID\n }\n textmasterProjectSettings {\n autoLaunch\n expertiseId\n subExpertiseId\n }\n integrationTemplateID\n translationBrief\n testApiKey\n createdAt\n updatedAt\n }\n }\n`;\nexport const updateProject = /* GraphQL */ `\n mutation UpdateProject(\n $input: UpdateProjectInput!\n $condition: ModelProjectConditionInput\n ) {\n updateProject(input: $input, condition: $condition) {\n connector {\n branch\n mode\n organization\n project\n repository\n type\n url\n webhookURL\n }\n resourcesExcluded\n format {\n framework\n id\n isVisible\n name\n parser\n path\n createdAt\n updatedAt\n }\n formatID\n groups\n id\n isActive\n liveApiKey\n locales {\n items {\n audit {\n completion\n duration\n missingSegments\n missingWords\n price\n segments\n words\n }\n code\n groups\n id\n inProgress\n isActive\n isSource\n locale {\n id\n language\n region\n tag\n createdAt\n updatedAt\n }\n localeID\n organizationID\n owner\n project {\n resourcesExcluded\n formatID\n groups\n id\n isActive\n liveApiKey\n name\n organizationID\n owner\n providerID\n integrationTemplateID\n translationBrief\n testApiKey\n createdAt\n updatedAt\n }\n projectID\n stateUpdatedAt\n createdAt\n updatedAt\n }\n nextToken\n }\n name\n organization {\n connectors {\n azurerepos {\n refreshToken\n }\n bitbucket {\n clientKey\n }\n contentful {\n environmentIDs\n spaceID\n spaceName\n }\n github {\n installationIDs\n }\n gitlab {\n accessToken\n }\n googledocs {\n refreshToken\n userId\n }\n googlesheets {\n refreshToken\n userId\n }\n hubspotcms {\n hubDomain\n hubId\n refreshToken\n }\n intercom {\n accessToken\n workspaceId\n }\n salesforceknowledge {\n accessToken\n instanceUrl\n refreshToken\n }\n shopify {\n accessToken\n storeId\n }\n mailchimp {\n accessToken\n accountId\n accountName\n serverId\n }\n zendesk {\n accessToken\n domain\n }\n }\n customerID\n groups\n id\n integrationID\n name\n onboarding {\n isCompleted\n stage\n type\n }\n owner\n type\n integrationTemplateID\n vendorID\n createdAt\n updatedAt\n }\n organizationID\n owner\n providerID\n autoUpdateFrequency\n resourcePatterns {\n path\n }\n resources {\n path\n projectLocaleID\n }\n textmasterProjectSettings {\n autoLaunch\n expertiseId\n subExpertiseId\n }\n integrationTemplateID\n translationBrief\n testApiKey\n createdAt\n updatedAt\n }\n }\n`;\nexport const deleteProject = /* GraphQL */ `\n mutation DeleteProject(\n $input: DeleteProjectInput!\n $condition: ModelProjectConditionInput\n ) {\n deleteProject(input: $input, condition: $condition) {\n connector {\n branch\n mode\n organization\n project\n repository\n type\n url\n webhookURL\n }\n resourcesExcluded\n format {\n framework\n id\n isVisible\n name\n parser\n path\n createdAt\n updatedAt\n }\n formatID\n groups\n id\n isActive\n liveApiKey\n locales {\n items {\n audit {\n completion\n duration\n missingSegments\n missingWords\n price\n segments\n words\n }\n code\n groups\n id\n inProgress\n isActive\n isSource\n locale {\n id\n language\n region\n tag\n createdAt\n updatedAt\n }\n localeID\n organizationID\n owner\n project {\n resourcesExcluded\n formatID\n groups\n id\n isActive\n liveApiKey\n name\n organizationID\n owner\n providerID\n integrationTemplateID\n translationBrief\n testApiKey\n createdAt\n updatedAt\n }\n projectID\n stateUpdatedAt\n createdAt\n updatedAt\n }\n nextToken\n }\n name\n organization {\n connectors {\n azurerepos {\n refreshToken\n }\n bitbucket {\n clientKey\n }\n contentful {\n environmentIDs\n spaceID\n spaceName\n }\n github {\n installationIDs\n }\n gitlab {\n accessToken\n }\n googledocs {\n refreshToken\n userId\n }\n googlesheets {\n refreshToken\n userId\n }\n hubspotcms {\n hubDomain\n hubId\n refreshToken\n }\n intercom {\n accessToken\n workspaceId\n }\n salesforceknowledge {\n accessToken\n instanceUrl\n refreshToken\n }\n shopify {\n accessToken\n storeId\n }\n mailchimp {\n accessToken\n accountId\n accountName\n serverId\n }\n zendesk {\n accessToken\n domain\n }\n }\n customerID\n groups\n id\n integrationID\n name\n onboarding {\n isCompleted\n stage\n type\n }\n owner\n type\n integrationTemplateID\n vendorID\n createdAt\n updatedAt\n }\n organizationID\n owner\n providerID\n resourcePatterns {\n path\n }\n resources {\n path\n projectLocaleID\n }\n textmasterProjectSettings {\n autoLaunch\n expertiseId\n subExpertiseId\n }\n integrationTemplateID\n translationBrief\n testApiKey\n createdAt\n updatedAt\n }\n }\n`;\nexport const createProjectLocale = /* GraphQL */ `\n mutation CreateProjectLocale(\n $input: CreateProjectLocaleInput!\n $condition: ModelProjectLocaleConditionInput\n ) {\n createProjectLocale(input: $input, condition: $condition) {\n audit {\n completion\n duration\n missingSegments\n missingWords\n price\n segments\n words\n }\n code\n groups\n id\n inProgress\n isActive\n isSource\n locale {\n id\n language\n region\n tag\n createdAt\n updatedAt\n }\n localeID\n organizationID\n owner\n project {\n connector {\n branch\n mode\n organization\n project\n repository\n type\n url\n webhookURL\n }\n resourcesExcluded\n format {\n framework\n id\n isVisible\n name\n parser\n path\n createdAt\n updatedAt\n }\n formatID\n groups\n id\n isActive\n liveApiKey\n locales {\n items {\n code\n groups\n id\n inProgress\n isActive\n isSource\n localeID\n organizationID\n owner\n projectID\n stateUpdatedAt\n createdAt\n updatedAt\n }\n nextToken\n }\n name\n organization {\n customerID\n groups\n id\n integrationID\n name\n onboarding {\n isCompleted\n stage\n type\n }\n owner\n type\n integrationTemplateID\n vendorID\n createdAt\n updatedAt\n }\n organizationID\n owner\n providerID\n resourcePatterns {\n path\n }\n resources {\n path\n projectLocaleID\n }\n textmasterProjectSettings {\n autoLaunch\n expertiseId\n subExpertiseId\n }\n integrationTemplateID\n translationBrief\n testApiKey\n createdAt\n updatedAt\n }\n projectID\n stateUpdatedAt\n createdAt\n updatedAt\n }\n }\n`;\nexport const updateProjectLocale = /* GraphQL */ `\n mutation UpdateProjectLocale(\n $input: UpdateProjectLocaleInput!\n $condition: ModelProjectLocaleConditionInput\n ) {\n updateProjectLocale(input: $input, condition: $condition) {\n audit {\n completion\n duration\n missingSegments\n missingWords\n price\n segments\n words\n }\n code\n groups\n id\n inProgress\n isActive\n isSource\n locale {\n id\n language\n region\n tag\n createdAt\n updatedAt\n }\n localeID\n organizationID\n owner\n project {\n connector {\n branch\n mode\n organization\n project\n repository\n type\n url\n webhookURL\n }\n resourcesExcluded\n format {\n framework\n id\n isVisible\n name\n parser\n path\n createdAt\n updatedAt\n }\n formatID\n groups\n id\n isActive\n liveApiKey\n locales {\n items {\n code\n groups\n id\n inProgress\n isActive\n isSource\n localeID\n organizationID\n owner\n projectID\n stateUpdatedAt\n createdAt\n updatedAt\n }\n nextToken\n }\n name\n organization {\n customerID\n groups\n id\n integrationID\n name\n onboarding {\n isCompleted\n stage\n type\n }\n owner\n type\n integrationTemplateID\n vendorID\n createdAt\n updatedAt\n }\n organizationID\n owner\n providerID\n resourcePatterns {\n path\n }\n resources {\n path\n projectLocaleID\n }\n textmasterProjectSettings {\n autoLaunch\n expertiseId\n subExpertiseId\n }\n integrationTemplateID\n translationBrief\n testApiKey\n createdAt\n updatedAt\n }\n projectID\n stateUpdatedAt\n createdAt\n updatedAt\n }\n }\n`;\nexport const deleteProjectLocale = /* GraphQL */ `\n mutation DeleteProjectLocale(\n $input: DeleteProjectLocaleInput!\n $condition: ModelProjectLocaleConditionInput\n ) {\n deleteProjectLocale(input: $input, condition: $condition) {\n audit {\n completion\n duration\n missingSegments\n missingWords\n price\n segments\n words\n }\n code\n groups\n id\n inProgress\n isActive\n isSource\n locale {\n id\n language\n region\n tag\n createdAt\n updatedAt\n }\n localeID\n organizationID\n owner\n project {\n connector {\n branch\n mode\n organization\n project\n repository\n type\n url\n webhookURL\n }\n resourcesExcluded\n format {\n framework\n id\n isVisible\n name\n parser\n path\n createdAt\n updatedAt\n }\n formatID\n groups\n id\n isActive\n liveApiKey\n locales {\n items {\n code\n groups\n id\n inProgress\n isActive\n isSource\n localeID\n organizationID\n owner\n projectID\n stateUpdatedAt\n createdAt\n updatedAt\n }\n nextToken\n }\n name\n organization {\n customerID\n groups\n id\n integrationID\n name\n onboarding {\n isCompleted\n stage\n type\n }\n owner\n type\n integrationTemplateID\n vendorID\n createdAt\n updatedAt\n }\n organizationID\n owner\n providerID\n resourcePatterns {\n path\n }\n resources {\n path\n projectLocaleID\n }\n textmasterProjectSettings {\n autoLaunch\n expertiseId\n subExpertiseId\n }\n integrationTemplateID\n translationBrief\n testApiKey\n createdAt\n updatedAt\n }\n projectID\n stateUpdatedAt\n createdAt\n updatedAt\n }\n }\n`;\nexport const createVendor = /* GraphQL */ `\n mutation CreateVendor(\n $input: CreateVendorInput!\n $condition: ModelVendorConditionInput\n ) {\n createVendor(input: $input, condition: $condition) {\n defaultIntegrationID\n defaultIntegration {\n id\n groups\n name\n templateID\n integrationTypeID\n integrationType {\n id\n status\n type\n createdAt\n updatedAt\n }\n memoq_apiKey\n memoq_creatorUserID\n memoq_webServiceAPIAccessPoint\n memsource_accessToken\n memsource_clientId\n memsource_domain\n memsource_secretToken\n vendorID\n organizationID\n trados_accountId\n trados_languageCloudAccountId\n trados_clientId\n trados_clientSecret\n trados_webhookSecret\n textmaster_apiKey\n textmaster_apiSecret\n protemos_apiKey\n createdAt\n updatedAt\n owner\n }\n groups\n id\n integrations {\n items {\n id\n groups\n name\n templateID\n integrationTypeID\n integrationType {\n id\n status\n type\n createdAt\n updatedAt\n }\n memoq_apiKey\n memoq_creatorUserID\n memoq_webServiceAPIAccessPoint\n memsource_accessToken\n memsource_clientId\n memsource_domain\n memsource_secretToken\n vendorID\n organizationID\n trados_accountId\n trados_languageCloudAccountId\n trados_clientId\n trados_clientSecret\n trados_webhookSecret\n textmaster_apiKey\n textmaster_apiSecret\n protemos_apiKey\n createdAt\n updatedAt\n owner\n }\n nextToken\n }\n integrationMode\n integrationTypeIDs\n name\n createdAt\n updatedAt\n }\n }\n`;\nexport const updateVendor = /* GraphQL */ `\n mutation UpdateVendor(\n $input: UpdateVendorInput!\n $condition: ModelVendorConditionInput\n ) {\n updateVendor(input: $input, condition: $condition) {\n defaultIntegrationID\n defaultIntegration {\n id\n groups\n name\n templateID\n integrationTypeID\n integrationType {\n id\n status\n type\n createdAt\n updatedAt\n }\n memoq_apiKey\n memoq_creatorUserID\n memoq_webServiceAPIAccessPoint\n memsource_accessToken\n memsource_clientId\n memsource_domain\n memsource_secretToken\n vendorID\n organizationID\n trados_accountId\n trados_languageCloudAccountId\n trados_clientId\n trados_clientSecret\n trados_webhookSecret\n textmaster_apiKey\n textmaster_apiSecret\n protemos_apiKey\n createdAt\n updatedAt\n owner\n }\n groups\n id\n integrations {\n items {\n id\n groups\n name\n templateID\n integrationTypeID\n integrationType {\n id\n status\n type\n createdAt\n updatedAt\n }\n memoq_apiKey\n memoq_creatorUserID\n memoq_webServiceAPIAccessPoint\n memsource_accessToken\n memsource_clientId\n memsource_domain\n memsource_secretToken\n vendorID\n organizationID\n trados_accountId\n trados_languageCloudAccountId\n trados_clientId\n trados_clientSecret\n trados_webhookSecret\n textmaster_apiKey\n textmaster_apiSecret\n protemos_apiKey\n createdAt\n updatedAt\n owner\n }\n nextToken\n }\n integrationMode\n integrationTypeIDs\n name\n createdAt\n updatedAt\n }\n }\n`;\nexport const deleteVendor = /* GraphQL */ `\n mutation DeleteVendor(\n $input: DeleteVendorInput!\n $condition: ModelVendorConditionInput\n ) {\n deleteVendor(input: $input, condition: $condition) {\n defaultIntegrationID\n defaultIntegration {\n id\n groups\n name\n templateID\n integrationTypeID\n integrationType {\n id\n status\n type\n createdAt\n updatedAt\n }\n memoq_apiKey\n memoq_creatorUserID\n memoq_webServiceAPIAccessPoint\n memsource_accessToken\n memsource_clientId\n memsource_domain\n memsource_secretToken\n vendorID\n organizationID\n trados_accountId\n trados_languageCloudAccountId\n trados_clientId\n trados_clientSecret\n trados_webhookSecret\n textmaster_apiKey\n textmaster_apiSecret\n protemos_apiKey\n createdAt\n updatedAt\n owner\n }\n groups\n id\n integrations {\n items {\n id\n groups\n name\n templateID\n integrationTypeID\n integrationType {\n id\n status\n type\n createdAt\n updatedAt\n }\n memoq_apiKey\n memoq_creatorUserID\n memoq_webServiceAPIAccessPoint\n memsource_accessToken\n memsource_clientId\n memsource_domain\n memsource_secretToken\n vendorID\n organizationID\n trados_accountId\n trados_languageCloudAccountId\n trados_clientId\n trados_clientSecret\n trados_webhookSecret\n textmaster_apiKey\n textmaster_apiSecret\n protemos_apiKey\n createdAt\n updatedAt\n owner\n }\n nextToken\n }\n integrationMode\n integrationTypeIDs\n name\n createdAt\n updatedAt\n }\n }\n`;\n","import { action, thunk } from \"easy-peasy\"\nimport { API, graphqlOperation } from \"aws-amplify\"\nimport { listAccessRequests } from \"../../graphql/locale-queries\"\nimport { createAccessRequest } from \"../../graphql/locale-mutations\"\n\nexport default {\n items: [],\n\n // thunks\n fetch: thunk(async (actions, userID) => {\n try {\n const accessRequests = []\n let nextToken\n do {\n const { data } = await API.graphql(\n graphqlOperation(listAccessRequests, {\n filter: { owner: { eq: userID } },\n nextToken,\n })\n )\n nextToken = data.listAccessRequests.nextToken\n accessRequests.push(...data.listAccessRequests.items)\n } while (nextToken)\n actions.set(accessRequests)\n } catch (e) {\n console.error(e)\n }\n }),\n\n create: thunk(async (actions, payload) => {\n const { data } = await API.graphql(\n graphqlOperation(createAccessRequest, { input: { ...payload } })\n )\n actions.push(data.createAccessRequest)\n }),\n\n // actions\n set: action((state, accessRequests) => {\n state.items = accessRequests\n }),\n\n push: action((state, accessRequest) => {\n state.items.push(accessRequest)\n }),\n}\n","import { action, thunk } from \"easy-peasy\"\nimport { API } from \"aws-amplify\"\n\nexport default {\n items: [],\n\n fetch: thunk(async (actions, { gitOrganization, gitProject, gitRepository, organizationID }) => {\n try {\n const params = {\n queryStringParameters: {\n gitOrganization,\n gitProject,\n gitRepository,\n organizationID,\n },\n }\n const branches = await API.get(\"nepal\", \"/azure/branches\", params)\n actions.set(branches)\n } catch (e) {\n console.error(e)\n }\n }),\n\n // actions\n set: action((state, branches) => {\n state.items = branches\n }),\n}\n","import { action, thunk } from \"easy-peasy\"\nimport { API } from \"aws-amplify\"\n\nexport default {\n items: [],\n\n fetch: thunk(async (actions, { organizationID }) => {\n try {\n const params = {\n queryStringParameters: {\n organizationID,\n },\n }\n const azureRepos = await API.get(\"nepal\", \"/azure/repos\", params)\n actions.set(azureRepos)\n } catch (e) {\n console.error(e)\n }\n }),\n\n // actions\n set: action((state, azureRepos) => {\n state.items = azureRepos\n }),\n}\n","import { action, thunk } from \"easy-peasy\"\nimport { API } from \"aws-amplify\"\n\nexport default {\n items: [],\n\n fetch: thunk(async (actions, { repoName, organizationID }) => {\n try {\n const params = {\n queryStringParameters: {\n repoName,\n organizationID,\n },\n }\n const branches = await API.get(\"nepal\", \"/bitbucket/branches\", params)\n actions.set(branches)\n } catch (e) {\n console.error(e)\n }\n }),\n\n // actions\n set: action((state, branches) => {\n state.items = branches\n }),\n}\n","import { action, thunk } from \"easy-peasy\"\nimport { API } from \"aws-amplify\"\n\nexport default {\n items: [],\n\n fetch: thunk(async (actions, { organizationID }) => {\n try {\n const params = {\n queryStringParameters: {\n organizationID,\n },\n }\n const repositories = await API.get(\"nepal\", \"/bitbucket/repos\", params)\n actions.set(repositories)\n } catch (e) {\n console.error(e)\n }\n }),\n\n // actions\n set: action((state, repositories) => {\n state.items = repositories\n }),\n}\n","import API from \"@aws-amplify/api\";\nimport { byName } from \"../../utils/sort\"\nimport { action, thunk } from \"easy-peasy\";\nimport { INTEGRATION_IDS } from \"../../models/integrationType\";\n\nexport default {\n items: [],\n\n fetch: thunk(async (actions, integration) => {\n let data = [];\n switch (integration?.integrationTypeID) {\n case INTEGRATION_IDS.protemos:\n data = await actions.fetchProtemosClients(integration)\n data = data.sort(byName)\n break;\n case INTEGRATION_IDS.plunet:\n data = await actions.fetchPlunetCustomers(integration)\n data = data.sort(byName)\n break;\n default:\n data = [];\n }\n actions.set(data)\n return data\n }),\n\n fetchProtemosClients: thunk((_, integration) => (\n API.get(\"nepal\", `/protemos/${integration.id}/clients`)\n )),\n\n fetchPlunetCustomers: thunk((_, integration) => (\n API.get(\"nepal\", `/plunet/${integration.id}/customers`)\n )),\n\n set: action((state, payload) => {\n state.items = payload\n })\n}\n","const SORT_DIRECTION = {\n ASC: \"ASC\",\n DESC: \"DESC\"\n}\n\nexport default SORT_DIRECTION\n","import { action, computed, thunk } from \"easy-peasy\"\nimport { API, graphqlOperation } from \"aws-amplify\"\nimport { listContentResourcesByOrganization } from \"../../graphql/locale-queries\"\nimport SORT_DIRECTION from \"../../helpers/sortDirection\"\nimport {\n filterContentByConnector,\n getTotal,\n groupByNamespace,\n isContentNamespace,\n} from \"../../helpers/contentResource\"\n\nexport default {\n items: [],\n namespaces: [],\n nextToken: null,\n\n total: computed(state => getTotal(state.resources)),\n resources: computed(state => groupByNamespace(state.items)),\n\n hasMore: computed(\n state => !!state.nextToken && state.queryItems.length === 0\n ),\n\n insertContentResource: action((state, payload) => {\n state.items = [payload.data, ...state.items]\n\n if (!isContentNamespace(payload.connectorID, payload.data)) state.total++\n }),\n\n updateContentResource: action((state, payload) => {\n state.items = state.items.map(i =>\n i.id === payload.data.id ? payload.data : i\n )\n }),\n\n deleteContentResource: action((state, payload) => {\n state.items = state.items.filter(i => i.id !== payload.data.id)\n\n if (!isContentNamespace(payload.data.connectorID, payload.data))\n state.total--\n }),\n\n searchResourcesByTitle: thunk(async (actions, payload) => {\n try {\n let nextToken\n let items = []\n\n do {\n const { data } = await API.graphql(\n graphqlOperation(listContentResourcesByOrganization, {\n nextToken,\n connectorIDTitle: {\n beginsWith: { connectorID: payload.connector },\n },\n filter: {\n title: { contains: payload?.search || \"\" },\n },\n sortDirection: SORT_DIRECTION.ASC,\n organizationID: payload.organization,\n })\n )\n nextToken = data.listContentResourcesByOrganization.nextToken\n\n items = [...items, ...data.listContentResourcesByOrganization.items]\n } while (nextToken)\n\n return items\n } catch (error) {\n console.error(error)\n return []\n }\n }),\n\n fetch: thunk(async (actions, payload, { getState }) => {\n try {\n const { connector, organization, intl } = payload\n\n let items = []\n let nextToken\n do {\n const { data } = await API.graphql(\n graphqlOperation(listContentResourcesByOrganization, {\n nextToken,\n connectorIDTitle: {\n beginsWith: { connectorID: connector },\n },\n sortDirection: SORT_DIRECTION.ASC,\n organizationID: organization,\n })\n )\n nextToken = data.listContentResourcesByOrganization.nextToken\n items = [...items, ...data.listContentResourcesByOrganization.items]\n } while (nextToken)\n\n const filteredItems = items.filter(filterContentByConnector(connector))\n const namespace = items.filter(\n namespace => !filteredItems.find(i => i.id === namespace.id)\n )\n\n actions.setNamespace({ namespace, connector, intl })\n actions.set({ items, connector })\n } catch (e) {\n console.error(e)\n }\n }),\n\n setNamespace: action((state, payload) => {\n const joinNamespaceNames = item =>\n [...(item.namespace || []), item.title].join(\" / \")\n\n state.namespaces = payload.namespace\n .sort((a, b) =>\n joinNamespaceNames(a).localeCompare(\n joinNamespaceNames(b),\n payload.intl?.locale,\n { numeric: true }\n )\n )\n .map(namespace => ({\n id: namespace.id,\n value: namespace.id,\n label: joinNamespaceNames(namespace),\n }))\n }),\n\n setToken: action((state, nextToken) => {\n state.nextToken = nextToken\n }),\n\n set: action((state, payload) => {\n const { items } = payload\n state.items = items\n }),\n}\n","import React from \"react\"\nimport { FormattedMessage } from \"gatsby-plugin-intl\"\nimport { INSTANCE_MODES } from \"../../models/instanceMode\"\n\nexport class DefaultText {\n constructor(text) {\n this.brandName = text?.brandName || \"LSP\"\n this.serviceName = text?.serviceName || this.brandName\n }\n\n get pushToService() {\n return (\n \n )\n }\n\n get quoteModalTitle() {\n return (\n \n )\n }\n\n get quoteModalSuccessTitle() {\n return (\n \n )\n }\n\n get quoteDescription() {\n return (\n \n )\n }\n\n get toastPushSuccess() {\n return (\n \n )\n }\n\n quoteDescriptionSuccess(connectorType) {\n return (\n \n )\n }\n}\n\nexport class DefaultConfig {\n projectTemplates = false\n activateProjectOnCreate = true\n instanceMode = INSTANCE_MODES.PROOFREADING\n}\n\nconst configFn = (text = {}, config = {}) => ({\n text: new DefaultText(text),\n config: new DefaultConfig(config),\n})\n\nexport default configFn\n","import defaultConfig from \"../config/partners/default\"\n\nexport const partnerConfig = (_, vendorData = {}) =>\n defaultConfig({ brandName: vendorData?.name })\n","import * as Sentry from \"@sentry/gatsby\"\nimport { action, computed, thunk } from \"easy-peasy\"\nimport { API, graphqlOperation } from \"aws-amplify\"\nimport { getIntegration } from \"../../graphql/locale-queries\"\nimport { updateOrganization } from \"../../graphql/locale-mutations\"\nimport { ORG_TYPES } from \"../../models/organization\"\nimport { partnerConfig } from \"../../helpers/partner\"\nimport { INTEGRATION_MODES } from \"../../models/integrationModes\"\n\nexport default {\n plans: [],\n isDefaultSet: false,\n isLoaded: false,\n\n item: {},\n hasPaidSubscriptions: computed(state => state.plans.length > 0),\n\n partnerConfig: computed(\n [state => state.item, (_, storeState) => storeState.vendor.item],\n (currentOrg, vendorData) =>\n partnerConfig(currentOrg.type, vendorData)?.config || {}\n ),\n partnerText: computed(\n [state => state.item, (_, storeState) => storeState.vendor.item],\n (currentOrg, vendorData) =>\n partnerConfig(currentOrg.type, vendorData)?.text || {}\n ),\n workspaceType: computed(state => state.item.type),\n isLanguageTeam: computed(\n state => state.item?.type && state.item.type === ORG_TYPES.locale\n ),\n isPartner: computed(\n state => state.item?.type && state.item.type !== ORG_TYPES.locale\n ),\n isRWS: computed(state => state.item.type === ORG_TYPES.rws),\n\n isSharedMode: computed(state => state.item?.vendor?.integrationMode === INTEGRATION_MODES.shared),\n isDedicatedMode: computed(state => state.item?.vendor?.integrationMode === INTEGRATION_MODES.dedicated),\n\n // thunks\n fetchPaidSubscription: thunk(async (actions, { id: organizationID }) => {\n if (!organizationID) return;\n try {\n const { plans } = await API.get(\"nepal\", \"/chargebee/subscriptions\", {\n queryStringParameters: { organizationID }\n });\n\n actions.setPlans(plans);\n } catch (err) {\n console.error(err);\n }\n }),\n\n fetch: thunk(async (actions, orgId, helpers) => {\n let currOrg = null\n\n try {\n await helpers.getStoreActions().organizations.fetch();\n actions.setIsDefaultSet(false);\n const organizations = helpers.getStoreState().organizations.items\n\n const orgById = orgId && organizations.find(org => orgId === org.id)\n\n if (orgById) {\n currOrg = orgById\n } else if (helpers.getStoreState().currentOrg.item?.id) {\n currOrg = organizations.find(\n org => helpers.getStoreState().currentOrg.item.id === org.id\n )\n actions.setIsDefaultSet(false);\n } else {\n currOrg = organizations[0];\n actions.setIsDefaultSet(true);\n }\n currOrg = currOrg || {}\n actions.setIsLoaded(true);\n actions.fetchPaidSubscription(currOrg)\n helpers.getStoreActions().currentOrg.set(currOrg);\n helpers.getStoreActions().onboarding.setAttrs({ ...currOrg.onboarding, organization: currOrg })\n } catch (e) {\n console.error(e)\n }\n\n try {\n actions.setIntegration({});\n if(currOrg && ( currOrg.vendor?.integrationMode === INTEGRATION_MODES.dedicated || !helpers.getStoreState().currentOrg.isPartner ) && currOrg.integrationID) {\n const { data } = await API.graphql(\n graphqlOperation(getIntegration, { id: currOrg.integrationID }),\n );\n actions.setIntegration(data.getIntegration);\n }\n } catch(e) {\n console.error(e)\n }\n }),\n\n\n updateDefaultIntegration: thunk(async (actions, { id, integration }) => {\n const input = {\n id,\n integrationID: integration.id,\n };\n\n actions.updateProperty({\n integration,\n integrationID: integration.id,\n })\n\n await API.graphql(graphqlOperation(updateOrganization, { input }))\n }),\n\n updateStatus: thunk(async (actions, input, helpers) => {\n actions.updateProperty(input)\n helpers.getStoreActions().organizations.updateOrgById(input)\n return API.patch(\"nepal\", `/organizations/${input.id}/status`, {\n body: {\n status: input.status\n },\n })\n }),\n\n update: thunk(async (actions, input, helpers) => {\n actions.updateProperty(input)\n helpers.getStoreActions().organizations.updateOrgById(input)\n return API.graphql(\n graphqlOperation(updateOrganization, { input })\n )\n }),\n\n updateConnectors: thunk(async (_, { connectorID, connectorAuth, organizationID }) => {\n API.put(\"nepal\", `/organizations/${organizationID}/connectors/${connectorID}`, { body: connectorAuth })\n }),\n\n updateProperty: action((state, input) => {\n state.item = {\n ...state.item,\n ...input,\n }\n }),\n\n reset: action(state => {\n state.item = {}\n state.hasPaidSubscriptions = false\n }),\n\n // actions\n set: action((state, org) => {\n Sentry.setContext(\"organization\", {\n id: org.id,\n name: org.name,\n owner: org.owner,\n onboarding: org.onboarding,\n createdAt: org.createdAt,\n });\n state.item = org\n }),\n\n setIntegration: action((state, integration) => {\n state.item.integration = integration;\n if (integration.id) {\n state.item.integration.integrationType.configuration = integration.integrationType.configuration\n ? JSON.parse(state.item.integration.integrationType.configuration) : {}\n }\n }),\n\n setPlans: action((state, plans) => {\n state.plans = plans\n }),\n\n setIsDefaultSet: action((state, isDefault) => {\n state.isDefaultSet = isDefault;\n }),\n\n setIsLoaded: action((state, isLoaded) => {\n state.isLoaded = isLoaded;\n })\n}\n","import * as Sentry from \"@sentry/gatsby\"\nimport { action, computed, persist, thunk } from \"easy-peasy\"\nimport { Auth, API } from \"aws-amplify\"\n\nconst defaultItem = {\n id: \"\",\n email: \"\",\n given_name: \"\",\n phone_number: \"\",\n \"custom:type\": \"\"\n}\n\nconst USER_TYPES = {\n vendor: \"vendor\"\n}\n\nexport default {\n item: defaultItem,\n isLoggedIn: false,\n isVendor: computed(\n [state => state.item, (_, storeState) => storeState.appMode.asClient],\n (user, asClient) => user[\"custom:type\"]?.startsWith(USER_TYPES.vendor) && !asClient\n ),\n\n vendorLSP: computed(state => state.item[\"custom:type\"]?.split(\"#\")?.[1]),\n\n // thunks\n fetch: thunk(async actions => {\n try {\n const data = await Auth.currentUserInfo()\n actions.set({ id: data.username, ...data.attributes })\n actions.setIsLoggedIn(true)\n } catch (err) {\n actions.setIsLoggedIn(false)\n throw err\n }\n }),\n\n update: thunk( async (actions, { given_name, phone_number }, helper ) => {\n const user = helper.getStoreState().currentUser.item;\n actions.set({ ...user, given_name, phone_number })\n await API.post('nepal', '/user/profile', {\n body : { given_name, phone_number }\n });\n }),\n\n signOut: thunk(async actions => {\n actions.setIsLoggedIn(false)\n actions.set(defaultItem)\n await Auth.signOut()\n }),\n\n // actions\n set: action((state, payload) => {\n Sentry.setUser({\n id: payload.sub,\n email: payload.email,\n });\n state.item = payload\n }),\n\n setIsLoggedIn: action((state, payload) => {\n state.isLoggedIn = payload\n }),\n}\n","import { action, thunk, persist, computed } from \"easy-peasy\"\nimport { API, graphqlOperation } from \"aws-amplify\"\nimport { getVendor, listVendors } from \"../../graphql/locale-queries\"\nimport { updateVendor } from \"../../graphql/locale-mutations\"\nimport { INTEGRATION_MODES } from \"../../models/integrationModes\"\nimport { INTEGRATION_TYPES } from \"../../models/integrationType\"\nimport Onboarding from \"../../models/onboarding\"\n\nexport default persist({\n item: {},\n\n integrationById: computed(state => id =>\n state.item?.integrations?.items.find(i => i.id === id)\n ),\n\n defaultIntegration: computed(state =>\n state.item?.defaultIntegration || {}\n ),\n\n integrations: computed(state =>\n (state.item?.integrations?.items || []).map((integration) => {\n integration.integrationType.configuration = typeof integration.integrationType.configuration === \"string\"\n ? JSON.parse(integration.integrationType.configuration)\n : integration.integrationType.configuration || {}\n\n return integration\n })\n ),\n bmsIntegrations: computed(state =>\n (state.item?.integrations?.items || []).filter(integration => integration.integrationType.type === INTEGRATION_TYPES.bms || integration.integrationType.type === INTEGRATION_TYPES.hybrid).map((integration) => {\n integration.integrationType.configuration = typeof integration.integrationType.configuration === \"string\"\n ? JSON.parse(integration.integrationType.configuration)\n : integration.integrationType.configuration || {}\n\n return integration\n })\n ),\n tmsIntegrations: computed(state =>\n (state.item?.integrations?.items || []).filter(integration => integration.integrationType.type === INTEGRATION_TYPES.tms).map((integration) => {\n integration.integrationType.configuration = typeof integration.integrationType.configuration === \"string\"\n ? JSON.parse(integration.integrationType.configuration)\n : integration.integrationType.configuration || {}\n\n return integration\n })\n ),\n\n isDedicatedIntegrationMode: computed(state =>\n state.item.integrationMode === INTEGRATION_MODES.dedicated\n ),\n\n isSharedIntegrationMode: computed(state =>\n state.item.integrationMode === INTEGRATION_MODES.shared\n ),\n\n id: computed(state =>\n state.item?.id || null\n ),\n\n fetch: thunk(async (actions, payload) => {\n const { id } = payload || {}\n try {\n const { data: { getVendor: vendor } } = await API.graphql(graphqlOperation(getVendor, { id }))\n actions.set(vendor)\n return vendor\n } catch (error) {\n console.error(error)\n actions.set({})\n return null\n }\n }),\n\n find: thunk(async (actions, payload, helpers) => {\n let vendor = null\n let nextToken = null\n let vendors = [];\n do {\n try {\n const { data } = await API.graphql(graphqlOperation(listVendors))\n nextToken = data.listVendors.nextToken\n vendors = data.listVendors.items\n } catch (error) {\n nextToken = error.data.listVendors.nextToken\n vendors = error.data.listVendors.items\n console.log(error)\n }\n\n vendor = vendors.find((item) => (item));\n if (vendor) {\n break;\n }\n } while(nextToken);\n actions.set(vendor)\n helpers.getStoreActions().onboarding.setAttrs({\n ...new Onboarding({ vendor, ...vendor.onboarding || {} }),\n vendor\n })\n }),\n\n update: thunk(async (actions, input) => {\n actions.updateItem(input)\n await API.graphql(graphqlOperation(updateVendor, { input }))\n }),\n\n updateDefaultIntegration: thunk(async (actions, { id, integration }) => {\n const input = {\n id,\n defaultIntegrationID: integration.id,\n };\n actions.updateItem({\n defaultIntegration: integration,\n defaultIntegrationID: integration.id,\n })\n await API.graphql(graphqlOperation(updateVendor, { input }))\n }),\n\n\n addIntegration: action((state, payload) => {\n const integrations = state.item?.integrations || { items: [] }\n integrations.items.push(payload);\n state.item = {\n ...state.item,\n integrations,\n }\n }),\n\n updateItem: action((state, item) => {\n state.item = {\n ...state.item,\n ...item\n }\n }),\n\n set: action((state, payload) => {\n state.item = payload\n }),\n})\n","import { computed } from \"easy-peasy\";\n\nexport default {\n items: [\n {\n id: \"596da90cc4f05c000170ffd0\",\n label: \"Arts & Culture\",\n options: [\n {\n id: \"596da90cc4f05c000170ffd0\",\n name: \"Arts & Culture\"\n },\n {\n id: \"596da90cc4f05c000170ffe2\",\n name: \"Fine Arts & Graphic Design\"\n },\n {\n id: \"596da90cc4f05c000170ffe5\",\n name: \"History & Geography\"\n },\n {\n id: \"596da90cc4f05c000170ffe8\",\n name: \"Literature & Poetry\"\n },\n {\n id: \"596da90cc4f05c000170ffeb\",\n name: \"Performing Arts (dance, theatre…)\"\n },\n {\n id: \"596da90cc4f05c000170ffee\",\n name: \"Philosophy\"\n },\n {\n id: \"596da90cc4f05c000170fff1\",\n name: \"Religion\"\n }\n ]\n },\n {\n id: \"57ce805b39775e0003e221fe\",\n name: \"Economics & Research\"\n },\n {\n id: \"596da90cc4f05c000170ffd3\",\n name: \"Environment & Ecology\"\n },\n {\n id: \"596da90cc4f05c000170ffd6\",\n name: \"Fashion & Textile\"\n },\n {\n id: \"57ce805b39775e0003e221ad\",\n label: \"Finance\",\n options: [\n {\n id: \"57ce805b39775e0003e221ad\",\n name: \"Finance\"\n },\n {\n id: \"57ce805b39775e0003e221b0\",\n name: \"Asset Management\"\n },\n {\n id: \"57ce805b39775e0003e221b3\",\n name: \"Banking\"\n },\n {\n id: \"57ce805b39775e0003e221b6\",\n name: \"Corporate Finance\"\n },\n {\n id: \"57ce805b39775e0003e221b9\",\n name: \"Insurance\"\n },\n {\n id: \"57ce805b39775e0003e221bc\",\n name: \"Private Equity / Mergers & Acquisitions\"\n },\n {\n id: \"57ce805b39775e0003e221bf\",\n name: \"Stock Exchange & Financial Markets\"\n }\n ]\n },\n {\n id: \"596da90cc4f05c000170ffd9\",\n label: \"Well-being and beauty\",\n options: [\n {\n id: \"596da90cc4f05c000170ffd9\",\n name: \"Well-being and beauty\"\n },\n {\n id: \"596da90cc4f05c000170fff4\",\n name: \"Beauty & Cosmetics\"\n },\n {\n id: \"596da90cc4f05c000170fff7\",\n name: \"Wellness & Pharmaceutical\"\n }\n ]\n },\n {\n id: \"596da90cc4f05c000170ffdc\",\n name: \"Human Resources\"\n },\n {\n id: \"57ce805b39775e0003e22198\",\n label: \"IT & Software\",\n options: [\n {\n id: \"57ce805b39775e0003e22198\",\n name: \"IT & Software\"\n },\n {\n id: \"57ce805b39775e0003e2219b\",\n name: \"Hacking & Security\"\n },\n {\n id: \"57ce805b39775e0003e2219e\",\n name: \"Hardware\"\n },\n {\n id: \"57ce805b39775e0003e221a1\",\n name: \"Hosting & Architecture\"\n },\n {\n id: \"57ce805b39775e0003e221a4\",\n name: \"Networks & Connectivity\"\n },\n {\n id: \"57ce805b39775e0003e221a7\",\n name: \"Programming\"\n },\n {\n id: \"57ce805b39775e0003e221aa\",\n name: \"SaaS, Apps & Software\"\n },\n {\n id: \"596da90dc4f05c000170fffa\",\n name: \"Social Media\"\n }\n ]\n },\n {\n id: \"57ce805b39775e0003e221c2\",\n label: \"Legal\",\n options: [\n {\n id: \"57ce805b39775e0003e221c2\",\n name: \"Legal\"\n },\n {\n id: \"57ce805b39775e0003e221c5\",\n name: \"Contract Law & Litigation\"\n },\n {\n id: \"57ce805b39775e0003e221c8\",\n name: \"Corporate Law \"\n },\n {\n id: \"57ce805b39775e0003e221cb\",\n name: \"Equity Markets\"\n },\n {\n id: \"57ce805b39775e0003e221ce\",\n name: \"Intellectual Property\"\n },\n {\n id: \"57ce805b39775e0003e221d1\",\n name: \"Labour And Social Law\"\n },\n {\n id: \"57ce805b39775e0003e221d4\",\n name: \"Public Law\"\n },\n {\n id: \"57ce805b39775e0003e221d7\",\n name: \"Tax Law\"\n },\n {\n id: \"596da90dc4f05c000170fffd\",\n name: \"Economic and Finance Law\"\n }\n ]\n },\n {\n id: \"5a0ac8941bb64e000d644a28\",\n label: \"Lifestyle & Hobbies\",\n options: [\n {\n id: \"5a0ac8941bb64e000d644a28\",\n name: \"Lifestyle & Hobbies\"\n },\n {\n id: \"5a0ac8941bb64e000d644a2b\",\n name: \"Plants & Gardening\"\n },\n {\n id: \"5a37914d6b6032000dd30a96\",\n name: \"Music\"\n }\n ]\n },\n {\n id: \"57ce805a39775e0003e22186\",\n label: \"Luxury\",\n options: [\n {\n id: \"57ce805a39775e0003e22186\",\n name: \"Luxury\"\n },\n {\n id: \"57ce805a39775e0003e22189\",\n name: \"Haute Couture\"\n },\n {\n id: \"57ce805b39775e0003e2218c\",\n name: \"Jewellery\"\n },\n {\n id: \"57ce805b39775e0003e2218f\",\n name: \"Leather goods\"\n },\n {\n id: \"57ce805b39775e0003e22192\",\n name: \"Watchmaking\"\n },\n {\n id: \"57ce805b39775e0003e22195\",\n name: \"Yachting & Private Jet\"\n },\n {\n id: \"596da90dc4f05c0001710000\",\n name: \"Cosmetics\"\n },\n {\n id: \"5a003b7b9e56fa000edcf69d\",\n name: \"Shoes\"\n }\n ]\n },\n {\n id: \"57ce805a39775e0003e22177\",\n label: \"Marketing & Web-marketing\",\n options: [\n {\n id: \"57ce805a39775e0003e22177\",\n name: \"Marketing & Web-marketing\"\n },\n {\n id: \"57ce805a39775e0003e2217a\",\n name: \"Offline Advertising\"\n },\n {\n id: \"57ce805a39775e0003e2217d\",\n name: \"SEO / SEM / Analytics\"\n },\n {\n id: \"57ce805a39775e0003e22180\",\n name: \"Social Media & e-Reputation\"\n },\n {\n id: \"57ce805a39775e0003e22183\",\n name: \"Surveys & Opinion Polls\"\n }\n ]\n },\n {\n id: \"57ce805b39775e0003e221da\",\n label: \"Technical\",\n options: [\n {\n id: \"57ce805b39775e0003e221da\",\n name: \"Technical\"\n },\n {\n id: \"57ce805b39775e0003e221dd\",\n name: \"Aeronautics & Aerospace\"\n },\n {\n id: \"57ce805b39775e0003e221e0\",\n name: \"Agribusiness & Nutrition\"\n },\n {\n id: \"57ce805b39775e0003e221e3\",\n name: \"Agronomy\"\n },\n {\n id: \"57ce805b39775e0003e221e6\",\n name: \"Automotive\"\n },\n {\n id: \"57ce805b39775e0003e221e9\",\n name: \"Building & Construction\"\n },\n {\n id: \"57ce805b39775e0003e221ec\",\n name: \"Electricty & Electronics\"\n },\n {\n id: \"57ce805b39775e0003e221ef\",\n name: \"Energy & Natural Resources\"\n },\n {\n id: \"57ce805b39775e0003e221f2\",\n name: \"Heavy Industry\"\n },\n {\n id: \"57ce805b39775e0003e221f5\",\n name: \"Mechanics & Heavy Machinery\"\n },\n {\n id: \"57ce805b39775e0003e221f8\",\n name: \"Military & Civil Defense\"\n },\n {\n id: \"57ce805b39775e0003e221fb\",\n name: \"Transportation & Logistics\"\n },\n {\n id: \"596da90dc4f05c0001710003\",\n name: \"Chemicals\"\n },\n {\n id: \"596da90dc4f05c0001710006\",\n name: \"Physics\"\n }\n ]\n },\n {\n id: \"596da90cc4f05c000170ffdf\",\n name: \"Wines & Spirits\"\n }\n ],\n\n expertises: computed((state) => (\n state.items.reduce((acc, { id, name, options }) => {\n if (options) {\n acc.push(...options)\n }\n\n if (name) {\n acc.push({ id, name })\n }\n\n return acc\n }, [])\n ))\n}\n","import { action, thunk } from \"easy-peasy\"\nimport { API } from \"aws-amplify\"\n\nexport default {\n items: [],\n\n fetch: thunk(async (actions, { repoName, organizationID }) => {\n try {\n const params = {\n queryStringParameters: {\n repoName,\n organizationID,\n },\n }\n const branches = await API.get(\"nepal\", \"/github/branches\", params)\n actions.set(branches)\n } catch (e) {\n console.error(e)\n }\n }),\n\n // actions\n set: action((state, branches) => {\n state.items = branches\n }),\n}\n","import { action, thunk } from \"easy-peasy\"\nimport { API } from \"aws-amplify\"\n\nexport default {\n items: [],\n\n fetch: thunk(async (actions, { organizationID }) => {\n try {\n const params = {\n queryStringParameters: {\n organizationID,\n },\n }\n const githubRepos = await API.get(\"nepal\", \"/github/repos\", params)\n actions.set(githubRepos)\n } catch (e) {\n console.error(e)\n }\n }),\n\n // actions\n set: action((state, githubRepos) => {\n state.items = githubRepos\n }),\n}\n","import { action, thunk } from \"easy-peasy\"\nimport { API } from \"aws-amplify\"\n\nexport default {\n items: [],\n\n fetch: thunk(async (actions, { repoName, organizationID }) => {\n try {\n const params = {\n queryStringParameters: {\n repoName,\n organizationID,\n },\n }\n const branches = await API.get(\"nepal\", \"/gitlab/branches\", params)\n actions.set(branches)\n } catch (e) {\n console.error(e)\n }\n }),\n\n // actions\n set: action((state, branches) => {\n state.items = branches\n }),\n}\n","import { action, thunk } from \"easy-peasy\"\nimport { API } from \"aws-amplify\"\n\nexport default {\n items: [],\n\n fetch: thunk(async (actions, { organizationID }) => {\n try {\n const params = {\n queryStringParameters: {\n organizationID,\n },\n }\n const gitlabRepos = await API.get(\"nepal\", \"/gitlab/repos\", params)\n actions.set(gitlabRepos)\n } catch (e) {\n console.error(e)\n }\n }),\n\n // actions\n set: action((state, gitlabRepos) => {\n state.items = gitlabRepos\n }),\n}\n","import { action, thunk } from \"easy-peasy\"\nimport { API } from \"aws-amplify\"\n\nexport default {\n items: [],\n isLoading: false,\n fetch: thunk(async (actions, { organizationID, userId }) => {\n try {\n const params = {\n queryStringParameters: {\n organizationID,\n userId,\n connectorId: \"googledocs\",\n mimeType: \"application/vnd.google-apps.document\"\n }\n }\n actions.setLoading(true);\n const files = await API.get(\"nepal\", \"/googledrive/files\", params);\n actions.setLoading(false);\n actions.setItems(files)\n } catch (e) {\n console.error(e)\n }\n }),\n\n // actions\n setItems: action((state, items) => {\n state.items = items\n }),\n setLoading: action((state, payload)=>{\n state.isLoading = payload\n })\n}","import { action, thunk } from \"easy-peasy\"\nimport { API } from \"aws-amplify\"\n\nexport default {\n items: [],\n isLoading: false,\n fetch: thunk(async (actions, { organizationID, userId }) => {\n try {\n const params = {\n queryStringParameters: {\n organizationID,\n userId,\n connectorId: \"googlesheets\",\n mimeType: \"application/vnd.google-apps.spreadsheet\"\n }\n }\n actions.setLoading(true);\n const files = await API.get(\"nepal\", \"/googledrive/files\", params);\n actions.setLoading(false);\n actions.setItems(files)\n } catch (e) {\n console.error(e)\n }\n }),\n\n // actions\n setItems: action((state, items) => {\n state.items = items\n }),\n setLoading: action((state, payload)=>{\n state.isLoading = payload\n })\n}","import { action, thunk } from \"easy-peasy\"\nimport { API } from \"aws-amplify\"\n\nexport default {\n items: [],\n\n fetch: thunk(async (actions, { organizationID, type, hubId }) => {\n try {\n if (type === undefined) return\n const params = {\n queryStringParameters: {\n organizationID,\n hubId\n }\n }\n const route = type === \"Blog\" ? \"/hubspot-cms/blogs\" : \"/hubspot-cms/domains\"\n const hubspotcmsResources = await API.get(\"nepal\", route, params)\n actions.setItems(hubspotcmsResources)\n } catch (e) {\n console.error(e)\n }\n }),\n\n // actions\n setItems: action((state, items) => {\n state.items = items\n }),\n}\n","import { action } from \"easy-peasy\";\n\nexport default {\n hours: null,\n set: action((state, payload) => {\n state.hours = payload\n })\n}\n","import { action, computed, thunk } from \"easy-peasy\"\nimport { API, graphqlOperation } from \"aws-amplify\"\nimport { getIntegration, listIntegrationsByOrganization, listIntegrationsByVendor } from \"../../graphql/locale-queries\"\nimport { createIntegration, updateIntegration } from \"../../graphql/locale-mutations\"\nexport default {\n item: {},\n items: [],\n publicIntegrations: [],\n\n availableIntegrations: computed((state) => [...state.items, ...state.publicIntegrations]),\n find: thunk(async (actions, id) => {\n try {\n const { data } = await API.graphql(graphqlOperation(getIntegration, { id }))\n actions.setItem(data.getIntegration);\n } catch (err) {\n console.error(err);\n }\n\n return null;\n }),\n\n fetch: thunk(async (actions, { organizationID, vendorID }) => {\n const data = organizationID\n ? (await API.graphql(graphqlOperation(listIntegrationsByOrganization, { organizationID }))).data.listIntegrationsByOrganization.items\n : (await API.graphql(graphqlOperation(listIntegrationsByVendor, { vendorID }))).data.listIntegrationsByVendor.items\n\n const dataWithParsedConfig = data.map((integration) => {\n integration.integrationType.configuration = integration.integrationType.configuration\n ? JSON.parse(integration.integrationType.configuration)\n : {}\n\n return integration\n })\n\n actions.setItems(dataWithParsedConfig || [])\n }),\n\n fetchPublicIntegrations: thunk(async (actions, { organizationID }) => {\n const data = await API.get(\"nepal\", \"/public-integrations\", {\n queryStringParameters: {\n organizationID,\n }\n })\n actions.setPublicIntegrations(data || [])\n }),\n\n fetchAvailableIntegrations: thunk(async (actions, params) => {\n await actions.fetch(params)\n await actions.fetchPublicIntegrations(params)\n }),\n\n update: thunk(async (actions, input) => {\n try {\n actions.updateItem(input)\n const { data } = await API.graphql(graphqlOperation(updateIntegration, { input }))\n return data.updateIntegration\n } catch (error) {\n console.error(error)\n }\n }),\n\n create: thunk(async (_, input, helpers) => {\n try {\n const { data } = await API.graphql(graphqlOperation(createIntegration, { input }))\n if (data.createIntegration.vendorID) {\n helpers.getStoreActions().currentVendor.addIntegration(data.createIntegration)\n }\n return data.createIntegration\n } catch (e) {\n console.error(e)\n }\n }),\n\n reset: action(state => {\n state.item = {}\n }),\n\n setItem: action((state, payload) => {\n state.item = payload\n }),\n\n\n setItems: action((state, payload) => {\n state.items = payload\n }),\n\n setPublicIntegrations: action((state, payload) => {\n state.publicIntegrations = payload;\n }),\n\n updateItem: action((state, payload) => {\n state.item = {\n ...state.item,\n ...payload,\n }\n }),\n}\n","import { action, thunk, computed } from \"easy-peasy\"\nimport { API, graphqlOperation } from \"aws-amplify\"\nimport { getIntegrationType, listIntegrationTypes } from \"../../graphql/locale-queries\"\nimport { INTEGRATION_STATUSES, INTEGRATION_TYPES, INTEGRATION_PUBLIC_STATUSES } from \"../../models/integrationType\"\n\nexport default {\n item: {},\n items: [],\n\n find: computed(state => id => state.items.find(integrationType => integrationType.id === id) || {}),\n public: computed(\n [state => state.items, (_, storeState) => ({\n currentOrg: storeState.currentOrg.item,\n currentVendor: storeState.currentVendor.item,\n isLanguageTeam: storeState.currentOrg.isLanguageTeam,\n isSharedIntegrationMode: storeState.currentVendor.isSharedIntegrationMode,\n })],\n (items, { currentVendor, currentOrg, isLanguageTeam, isSharedIntegrationMode }) => {\n const integrationTypeIds = currentVendor.id\n ? currentVendor.integrationTypeIDs\n : (currentOrg?.vendor?.integrationTypeIDs || [])\n\n return items.filter(({ id, status }) => (\n isLanguageTeam || isSharedIntegrationMode\n ? status !== INTEGRATION_STATUSES.private\n : integrationTypeIds.includes(id)\n ))\n },\n ),\n publicTMS: computed(state => state.items.filter(integrationType => INTEGRATION_PUBLIC_STATUSES.includes(integrationType.status) && integrationType.type === INTEGRATION_TYPES.tms) || []),\n\n fetch: thunk(async (actions, id) => {\n try {\n const { data: { getIntegrationType: integrationType } } = await API.graphql(graphqlOperation(getIntegrationType, { id }))\n integrationType.name = integrationType.metadata?.name || integrationType.name\n integrationType.logo = integrationType.metadata?.logo\n integrationType.logoSquare = integrationType.metadata?.logoSquare\n actions.setItem(integrationType)\n } catch (e) {\n console.error(e)\n }\n }),\n\n fetchAll: thunk(async actions => {\n try {\n let nextToken\n const integrationTypes = []\n do {\n const { data } = await API.graphql(graphqlOperation(listIntegrationTypes, { nextToken }))\n nextToken = data.listIntegrationTypes.nextToken\n integrationTypes.push(...data.listIntegrationTypes.items)\n } while (nextToken)\n integrationTypes.forEach(integrationType => {\n integrationType.name = integrationType.metadata?.name || integrationType.name\n integrationType.logo = integrationType.metadata?.logo\n integrationType.logoSquare = integrationType.metadata?.logoSquare\n })\n actions.setItems(integrationTypes)\n } catch (e) {\n console.error(e)\n }\n }),\n\n reset: action((state, payload) => {\n state.item = {}\n }),\n\n setItem: action((state, payload) => {\n state.item = payload\n }),\n\n setItems: action((state, payload) => {\n state.items = payload\n }),\n}\n","import { action, thunk } from \"easy-peasy\"\nimport { API } from \"aws-amplify\"\n\nexport default {\n items: [],\n teams: [],\n teamUsers: [],\n\n fetch: thunk(async (actions, { organizationID }) => {\n try {\n const params = {\n queryStringParameters: {\n organizationID,\n },\n }\n const projects = await API.get(\"nepal\", \"/lokalise/projects\", params)\n actions.set(projects)\n } catch (e) {\n console.error(e)\n }\n }),\n\n fetchTeams: thunk(async (actions, { organizationID }) => {\n try {\n const params = {\n queryStringParameters: {\n organizationID,\n },\n }\n const teams = await API.get(\"nepal\", \"/lokalise/teams\", params)\n actions.setTeams(teams)\n } catch (e) {\n console.error(e)\n }\n }),\n\n fetchTeamUsers: thunk(async (actions, { organizationID, teamID }) => {\n try {\n const params = {\n queryStringParameters: {\n organizationID,\n },\n }\n actions.setTeamUsers([])\n const teamUsers = await API.get(\"nepal\", `/lokalise/teams/${teamID}/users`, params)\n actions.setTeamUsers(teamUsers)\n } catch (e) {\n console.error(e)\n }\n }),\n\n addWebhook: thunk(async (_, { projectID, organizationID }) => {\n const data = await API.post(\"nepal\", \"/lokalise/projects/webhooks\", {\n queryStringParameters: { organizationID },\n body: {\n projectID\n },\n })\n\n return data.webhook.secret\n }),\n\n // actions\n set: action((state, projects) => {\n state.items = projects\n }),\n\n setTeams: action((state, teams) => {\n state.teams = teams;\n }),\n\n setTeamUsers: action((state, teamUsers) => {\n state.teamUsers = teamUsers\n }),\n}\n","import { action, thunk } from \"easy-peasy\"\nimport { API } from \"aws-amplify\"\n\nexport default {\n items: [],\n isLoading: false,\n fetch: thunk(async (actions, { organizationID, accountId }) => {\n try {\n const params = {\n queryStringParameters: {\n organizationID,\n accountId\n }\n }\n actions.setLoading(true);\n const mailchimpResources = await API.get(\"nepal\", \"/mailchimp/campaign-folders\", params);\n actions.setLoading(false);\n actions.setItems(mailchimpResources)\n } catch (e) {\n console.error(e)\n }\n }),\n\n // actions\n setItems: action((state, items) => {\n state.items = items\n }),\n setLoading: action((state, payload)=>{\n state.isLoading = payload\n })\n}\n","import { action, computed, persist } from \"easy-peasy\"\nimport Onboarding from \"../../models/onboarding\"\n\nexport default persist({\n attrs: null,\n isLoading: false,\n\n item: computed(state => state.attrs ? new Onboarding(state.attrs) : null),\n\n setAttrs: action((state, attrs) => {\n state.attrs = attrs\n }),\n\n setLoading: action((state, isLoading) => {\n state.isLoading = isLoading\n })\n})\n","import { action, thunk } from \"easy-peasy\"\nimport { API, graphqlOperation } from \"aws-amplify\"\nimport { listOrganizations } from \"../../graphql/locale-queries\"\nimport Organization from \"../../models/organization\"\n\nexport default {\n items: [],\n\n // thunks\n fetch: thunk(async actions => {\n try {\n const organizations = []\n let nextToken\n do {\n const { data } = await API.graphql(\n graphqlOperation(listOrganizations, { nextToken })\n )\n nextToken = data.listOrganizations.nextToken\n organizations.push(...data.listOrganizations.items)\n } while (nextToken)\n\n actions.set(organizations)\n } catch (e) {\n console.error(e)\n }\n }),\n\n create: thunk(async (actions, input, helpers) => {\n try {\n let { organization: org } = await API.post(\n \"nepal\", \"/workspace\", { body: input }\n );\n await actions.fetch()\n const currentOrg = helpers.getStoreState().organizations.items\n .find((row) => row.id === org.id)\n helpers.getStoreActions().currentOrg.set(currentOrg)\n return currentOrg\n } catch (err) {\n console.log(err)\n }\n }),\n\n updateOrgById: action((state, payload) => {\n state.items = state.items.map(item =>\n item.id === payload.id ? { ...item, ...payload } : item\n )\n }),\n\n // actions\n set: action((state, orgs) => {\n state.items = orgs.map((org) => new Organization(org))\n })\n}\n","import { action, thunk } from \"easy-peasy\"\nimport { API } from \"aws-amplify\"\nimport ProjectLocale from \"../../models/projectLocale\"\nimport Project from \"../../models/project\"\n\nexport default {\n item: null,\n\n // Thunks\n triggerInstance: thunk(\n async (_actions, { integration, template, mode, projectLocaleIDs }, helper) => {\n const { item } = helper.getState()\n return API.post(\"nepal\", \"/instance/trigger\", {\n body: {\n projectID: item.id,\n mode: mode,\n projectLocaleIDs,\n integrationID: integration?.id,\n projectTemplateID: integration && template ? template.id : undefined,\n },\n })\n }\n ),\n\n triggerProInstance: thunk(\n async (_actions, { mode, paymentSourceID, projectLocaleIDs }, helper) => {\n const { item } = helper.getState()\n return API.post(\"nepal\", \"/instances/pro\", {\n body: {\n paymentSourceID,\n projectID: item.id,\n mode,\n projectLocaleIDs,\n },\n })\n }\n ),\n\n triggerAIInstance: thunk(\n async (_actions, { mode, projectLocaleIDs }, helper) => {\n const { item } = helper.getState()\n return API.post(\"nepal\", \"/instances/ai\", {\n body: {\n projectID: item.id,\n mode,\n projectLocaleIDs,\n },\n })\n }\n ),\n\n // Actions\n set: action((state, project) => (state.item = project)),\n\n updateLocale: action((state, projectLocale) => {\n const index = state.item.locales.items.findIndex((locale) => (locale.id === projectLocale.id))\n\n let items = [];\n\n if (index === -1) {\n items = state.item.locales.items.push(projectLocale)\n } else {\n state.item.locales.items[index] = projectLocale\n items = state.item.locales.items\n }\n\n state.item = new Project({\n ...state.item,\n locales: {\n items\n }\n })\n })\n}\n","import { action, thunk, computed } from \"easy-peasy\"\nimport { API, graphqlOperation } from \"aws-amplify\"\nimport { listProjectLocales } from \"../../graphql/locale-queries\"\nimport {\n createProjectLocale,\n updateProjectLocale,\n deleteProjectLocale,\n} from \"../../graphql/locale-mutations\"\n\nexport default {\n items: [],\n\n // computed\n byId: computed(state => id =>\n state.items.find(locale => String(locale.id) === String(id))\n ),\n\n source: computed(state => state.items.find(locale => locale.isSource)),\n\n targets: computed(state => state.items.filter(locale => !locale.isSource)),\n\n // thunks\n fetch: thunk(async (actions, projectID) => {\n try {\n const filter = {\n projectID: { eq: projectID }\n }\n const { data } = await API.graphql(graphqlOperation(listProjectLocales, { filter }))\n const projectLocales = data.listProjectLocales.items\n actions.set(projectLocales)\n return projectLocales\n } catch (e) {\n console.error(e)\n }\n }),\n\n create: thunk(async (actions, payload) => {\n const input = { ...payload }\n const { data } = await API.graphql(\n graphqlOperation(createProjectLocale, { input })\n )\n actions.push(data.createProjectLocale)\n return data.createProjectLocale\n }),\n\n update: thunk(async (actions, payload) => {\n const input = { ...payload }\n const condition = { id: payload.localeID }\n const { data } = await API.graphql(\n graphqlOperation(updateProjectLocale, { input, ...condition })\n )\n actions.updateProjectLocale(data.updateProjectLocale)\n }),\n\n delete: thunk(async (actions, projectLocale) => {\n const input = {\n id: projectLocale.id,\n }\n const { data } = await API.graphql(\n graphqlOperation(deleteProjectLocale, { input })\n )\n actions.remove(data.deleteProjectLocale)\n }),\n\n deleteProjectLocales: thunk(async (actions, projectLocales) => {\n projectLocales.forEach(projectLocale => {\n const input = {\n id: projectLocale.id,\n }\n API.graphql(graphqlOperation(deleteProjectLocale, { input }))\n })\n }),\n\n // actions\n set: action((state, projectLocales) => {\n state.items = projectLocales\n }),\n\n push: action((state, projectLocale) => {\n state.items = state.items.concat([projectLocale])\n }),\n\n updateProjectLocale: action((state, projectLocale) => {\n state.items = state.items.map(l =>\n l.id === projectLocale.id ? projectLocale : l\n )\n }),\n\n remove: action((state, projectLocale) => {\n state.items = state.items.filter(l => l.id !== projectLocale.id)\n }),\n}\n","import { action, thunk, computed } from \"easy-peasy\"\nimport { API, graphqlOperation } from \"aws-amplify\"\nimport {\n getProject,\n listProjectsByOrganizationID,\n} from \"../../graphql/locale-queries\"\nimport { listProjects } from \"../../graphql/custom-queries\"\nimport Project from \"../../models/project\"\nimport {\n createProject,\n updateProject,\n deleteProject,\n} from \"../../graphql/locale-mutations\"\nimport { redirect } from \"../../config/routes\"\nimport { byName } from \"../../utils/sort\"\n\nexport default {\n items: [],\n\n // computed\n byId: computed(state => id =>\n state.items.find(project => String(project.id) === String(id))\n ),\n\n listByOrganization: thunk(async (actions, organizationID) => {\n const { data: projects } = await API.graphql(\n graphqlOperation(listProjectsByOrganizationID, { organizationID })\n )\n actions.set(projects.listProjectsByOrganizationID.items)\n return projects.listProjectsByOrganizationID.items\n }),\n\n // thunks\n fetch: thunk(async (actions, id, helper) => {\n try {\n if (id) {\n const projectData = await API.graphql(\n graphqlOperation(getProject, { id })\n )\n\n const state = helper.getState()\n state.items.length === 0\n ? actions.push(projectData.data.getProject)\n : actions.updateProject(projectData.data.getProject)\n helper.getStoreActions().project.set(state.byId(id))\n } else {\n const projects = []\n const currentOrgId = helper.getStoreState().currentOrg.item.id\n\n let nextToken\n if (currentOrgId) {\n do {\n const { data } = await API.graphql(\n graphqlOperation(listProjects, {\n filter: {\n organizationID: { eq: currentOrgId },\n },\n nextToken,\n })\n )\n nextToken = data.listProjects.nextToken\n projects.push(...data.listProjects.items)\n } while (nextToken)\n }\n actions.set(projects)\n }\n } catch (e) {\n console.error(e)\n }\n }),\n\n create: thunk(async (actions, input) => {\n try {\n const { data } = await API.graphql(\n graphqlOperation(createProject, { input })\n )\n actions.push(data.createProject)\n return data.createProject.id\n } catch (e) {\n console.error(e)\n }\n }),\n\n update: thunk(async (actions, payload) => {\n const input = { ...payload }\n actions.updateProject(payload)\n const { data } = await API.graphql(\n graphqlOperation(updateProject, { input })\n )\n }),\n\n delete: thunk(async (actions, projectId) => {\n const input = { id: projectId }\n try {\n await API.graphql(graphqlOperation(deleteProject, { input }))\n actions.removeAndRedirect(projectId)\n } catch (e) {\n console.error(e)\n }\n }),\n\n addResource: thunk(async (actions, payload, helpers) => {\n const state = helpers.getState()\n let { resources, projectID: id } = payload\n const project = state.byId(id)\n if (project.resources) {\n resources = project.resources.concat(resources)\n }\n const input = { id, resources }\n const { data } = await API.graphql(\n graphqlOperation(updateProject, { input })\n )\n actions.updateProject(data.updateProject)\n }),\n\n editResource: thunk(async (actions, payload, helpers) => {\n const state = helpers.getState()\n let { resources: editResources, projectID: id } = payload\n const project = state.byId(id)\n const resources = project.resources\n editResources.forEach((resource, index) => (resources[index] = resource))\n const input = { id, resources }\n const { data } = await API.graphql(\n graphqlOperation(updateProject, { input })\n )\n actions.updateProject(data.updateProject)\n }),\n\n removeResource: thunk(async (actions, payload, helpers) => {\n const state = helpers.getState()\n const project = state.byId(payload.projectID)\n\n project.resources.splice(payload.resourceIndex, 1)\n\n const input = {\n id: payload.projectID,\n resources: project.resources,\n }\n const { data } = await API.graphql(\n graphqlOperation(updateProject, { input })\n )\n\n actions.updateProject(data.updateProject)\n }),\n\n addResourcePatterns: thunk(async (actions, payload, helpers) => {\n const state = helpers.getState()\n const { resourcePatterns: newResourcePatterns, projectID: id } = payload\n const project = state.byId(id)\n const resourcePatterns = [\n ...(project.resourcePatterns || []),\n ...newResourcePatterns,\n ]\n const input = { id, resourcePatterns }\n const { data } = await API.graphql(\n graphqlOperation(updateProject, { input })\n )\n actions.updateProject(data.updateProject)\n }),\n\n editResourcePatterns: thunk(async (actions, payload, helpers) => {\n const state = helpers.getState()\n const { resourcePatterns: editResourcePatterns, projectID: id } = payload\n const project = state.byId(id)\n const resourcePatterns = project.resourcePatterns\n editResourcePatterns.forEach(\n (resource, index) => (resourcePatterns[index] = resource)\n )\n const input = { id, resourcePatterns }\n const { data } = await API.graphql(\n graphqlOperation(updateProject, { input })\n )\n actions.updateProject(data.updateProject)\n }),\n\n removeResourcePattern: thunk(async (actions, payload, helpers) => {\n const state = helpers.getState()\n const project = state.byId(payload.projectID)\n const { resourcePatterns } = project\n\n resourcePatterns.splice(payload.index, 1)\n const input = {\n id: payload.projectID,\n resourcePatterns,\n }\n const { data } = await API.graphql(\n graphqlOperation(updateProject, { input })\n )\n\n actions.updateProject(data.updateProject)\n }),\n\n // actions\n set: action((state, projects) => {\n state.items = projects\n .map(project => state.byId(project.id) || new Project(project))\n .sort(byName)\n }),\n\n push: action((state, project) => {\n state.items = state.items.concat([new Project(project)]).sort(byName)\n }),\n\n updateProjectLocale: action((state, updateProjectLocale) => {\n state.items = state.items\n .map(p =>\n p.id === updateProjectLocale.projectID\n ? new Project({\n ...p,\n locales: {\n items: p.locales.items.map(locale =>\n locale.id === updateProjectLocale.id\n ? {\n ...locale,\n ...updateProjectLocale,\n audit: {\n ...locale.audit,\n ...updateProjectLocale.audit,\n },\n }\n : locale\n ),\n },\n })\n : p\n )\n .sort(byName)\n }),\n\n updateProject: action((state, updatedProject) => {\n state.items = state.items\n .map(project =>\n project.id === updatedProject.id\n ? new Project({\n ...project,\n ...updatedProject,\n connector: { ...project.connector, ...updateProject.connector },\n })\n : project\n )\n .sort(byName)\n }),\n\n pushAndRedirect: action((state, project) => {\n state.items = state.items.concat([new Project(project)]).sort(byName)\n redirect(\"PROJECT\", { id: project.id })\n }),\n\n removeAndRedirect: action((state, projectId) => {\n window.location = \"/\"\n // redirect(\"PROJECT\", { id: projectId })\n // state.items = state.items.filter(item => item.id !== projectId)\n }),\n}\n","export const listContentResourcesIDByOrganization = /* GraphQL */ `\n query ListContentResourcesByOrganization(\n $organizationID: ID!\n $connectorIDTitle: ModelContentResourceByOrganizationConnectorTitleCompositeKeyConditionInput\n $sortDirection: ModelSortDirection\n $filter: ModelContentResourceFilterInput\n $limit: Int\n $nextToken: String\n ) {\n listContentResourcesByOrganization(\n organizationID: $organizationID\n connectorIDTitle: $connectorIDTitle\n sortDirection: $sortDirection\n filter: $filter\n limit: $limit\n nextToken: $nextToken\n ) {\n items {\n id\n providerType\n parentId\n namespace\n translatable\n title\n }\n nextToken\n }\n }\n`;\n\nexport const listProjects = /* GraphQL */ `\n query ListProjects(\n $filter: ModelProjectFilterInput\n $limit: Int\n $nextToken: String\n ) {\n listProjects(filter: $filter, limit: $limit, nextToken: $nextToken) {\n items {\n connector {\n isCuisto\n branch\n mode\n organization\n project\n repository\n type\n url\n webhookURL\n }\n format {\n framework\n id\n name\n }\n formatID\n id\n name\n organizationID\n owner\n createdAt\n updatedAt\n format {\n id\n }\n }\n nextToken\n }\n }\n`;\n","import API from \"@aws-amplify/api\";\nimport { action, thunk } from \"easy-peasy\";\nimport { INTEGRATION_IDS } from \"../../models/integrationType\";\n\nexport default {\n items: [],\n\n fetch: thunk(async (actions, input) => {\n let data = [];\n switch (input?.integrationTypeID) {\n case INTEGRATION_IDS.memsource:\n data = await actions.fetchMemsourceProjectTemplates(input);\n break;\n case INTEGRATION_IDS.trados:\n data = await actions.fetchTradosProjectTemplates(input)\n break;\n case INTEGRATION_IDS.memoq:\n data = await actions.fetchMemoQProjectTemplates(input)\n break;\n default:\n data = [];\n }\n\n actions.set(data)\n return data\n }),\n\n fetchMemsourceProjectTemplates: thunk((_, integration) => (\n API.get(\"nepal\", `/${integration.integrationTypeID}/projectTemplates`, {\n queryStringParameters: {\n integrationID: integration.id,\n },\n }\n ))),\n\n fetchMemoQProjectTemplates: thunk((actions, integration) => (\n API.get(\"nepal\", `/${integration.integrationTypeID}/projectTemplates`, {\n queryStringParameters: {\n apiKey: integration?.memoq_apiKey,\n webServiceAPIAccessPoint: integration?.memoq_webServiceAPIAccessPoint,\n },\n })\n )),\n\n fetchTradosProjectTemplates: thunk((actions, integration) => (\n API.get(\"nepal\", `/${integration.integrationTypeID}/projectTemplates`, {\n queryStringParameters: {\n accountId: integration?.trados_languageCloudAccountId,\n clientId: integration?.trados_clientId,\n clientSecret: integration?.trados_clientSecret,\n },\n })\n )),\n\n set: action((state, payload) => {\n state.items = payload\n })\n}\n","import { action, computed } from \"easy-peasy\"\nimport { byCode } from \"../../utils/sort\"\nimport { SERVICE_MODES, SERVICE_TYPES } from \"../../models/service\"\n\nexport default {\n items: [],\n mode: SERVICE_MODES.SYNCHRONIZATION,\n serviceType: SERVICE_TYPES.PRO,\n\n // computed\n areAllChecked: computed(state => state.items.every(item => item.isChecked)),\n checkedItems: computed(state => state.items.filter(item => item.isChecked)),\n isServiceTypePro: computed(state => state.serviceType === SERVICE_TYPES.PRO),\n isServiceTypeAI: computed(\n state => state.serviceType === SERVICE_TYPES.LOCALE_AI\n ),\n isServiceTypeConnectorCloud: computed(\n state => state.serviceType === SERVICE_TYPES.CONNECTOR_CLOUD\n ),\n isProofreadingMode: computed(\n state => state.mode === SERVICE_MODES.PROOFREADING\n ),\n isSynchronizationMode: computed(\n state => state.mode === SERVICE_MODES.SYNCHRONIZATION\n ),\n words: computed(state => {\n return state.checkedItems.reduce((acc, item) => (acc += item.words), 0)\n }),\n\n // actions\n checkAllItems: action(state => {\n state.items = state.items.map(item => {\n item.isChecked = true\n return item\n })\n }),\n\n checkItem: action((state, { id }) => {\n state.items = state.items.map(item => {\n if (item.id === id) item.isChecked = true\n return item\n })\n }),\n\n setItems: action((state, project) => {\n const targets = state.isSynchronizationMode\n ? project.translatableLocales\n : project.targetLocales\n state.items = targets.sort(byCode).map(target => {\n const { id, code, locale, missingWords, words } = target\n return {\n id,\n code,\n locale,\n words: state.isSynchronizationMode ? missingWords : project.sourceLocale.words,\n }\n })\n }),\n\n setMode: action((state, mode) => {\n state.mode = mode\n }),\n\n setServiceType: action((state, serviceType) => {\n state.serviceType = serviceType\n }),\n\n uncheckAllItems: action(state => {\n state.items = state.items.map(item => {\n item.isChecked = false\n return item\n })\n }),\n\n uncheckItem: action((state, { id }) => {\n state.items = state.items.map(item => {\n if (item.id === id) item.isChecked = false\n return item\n })\n }),\n}\n","import { computed } from \"easy-peasy\"\n\nexport default {\n items: [\n { name: \"Abkhazian\", language: \"ab\", region: \"\", id: \"ab\" },\n { name: \"Afar\", language: \"aa\", region: \"\", id: \"aa\" },\n { name: \"Afrikaans\", language: \"af\", region: \"\", id: \"af\" },\n { name: \"Albanian\", language: \"sq\", region: \"\", id: \"sq\" },\n { name: \"Amharic\", language: \"am\", region: \"\", id: \"am\" },\n { name: \"Arabic\", language: \"ar\", region: \"\", id: \"ar\" },\n { name: \"Armenian\", language: \"hy\", region: \"\", id: \"hy\" },\n { name: \"Assamese\", language: \"as\", region: \"\", id: \"as\" },\n { name: \"Aymara\", language: \"ay\", region: \"\", id: \"ay\" },\n { name: \"Azerbaijani\", language: \"az\", region: \"\", id: \"az\" },\n { name: \"Bashkir\", language: \"ba\", region: \"\", id: \"ba\" },\n { name: \"Basque\", language: \"eu\", region: \"\", id: \"eu\" },\n { name: \"Belarusian\", language: \"be\", region: \"\", id: \"be\" },\n { name: \"Bengali\", language: \"bn\", region: \"\", id: \"bn\" },\n { name: \"Bhutani\", language: \"dz\", region: \"\", id: \"dz\" },\n { name: \"Bihari\", language: \"bh\", region: \"\", id: \"bh\" },\n { name: \"Bislama\", language: \"bi\", region: \"\", id: \"bi\" },\n { name: \"Bosnian\", language: \"bos\", region: \"\", id: \"bos\" },\n { name: \"Breton\", language: \"br\", region: \"\", id: \"br\" },\n { name: \"Bulgarian\", language: \"bg\", region: \"\", id: \"bg\" },\n { name: \"Burmese\", language: \"bur\", region: \"\", id: \"bur\" },\n { name: \"Catalan\", language: \"ca\", region: \"\", id: \"ca\" },\n { name: \"Cebuano\", language: \"ceb\", region: \"\", id: \"ceb\" },\n { name: \"Chechen\", language: \"che\", region: \"\", id: \"che\" },\n { name: \"Chinese (Simplified)\", language: \"zh\", region: \"S\", id: \"zh-S\" },\n { name: \"Chinese (Traditional)\", language: \"zh\", region: \"T\", id: \"zh-T\" },\n { name: \"Corsican\", language: \"co\", region: \"\", id: \"co\" },\n { name: \"Croatian\", language: \"hr\", region: \"\", id: \"hr\" },\n { name: \"Czech\", language: \"cs\", region: \"\", id: \"cs\" },\n { name: \"Danish\", language: \"da\", region: \"\", id: \"da\" },\n { name: \"Dutch\", language: \"nl\", region: \"\", id: \"nl\" },\n { name: \"English\", language: \"en\", region: \"\", id: \"en\" },\n { name: \"English (Australia)\", language: \"en\", region: \"AU\", id: \"en-AU\" },\n {\n name: \"English (United Kingdom)\",\n language: \"en\",\n region: \"GB\",\n id: \"en-GB\",\n },\n {\n name: \"English (United States)\",\n language: \"en\",\n region: \"US\",\n id: \"en-US\",\n },\n { name: \"Esperanto\", language: \"eo\", region: \"\", id: \"eo\" },\n { name: \"Estonian\", language: \"et\", region: \"\", id: \"et\" },\n { name: \"Faroese\", language: \"fo\", region: \"\", id: \"fo\" },\n { name: \"Fiji\", language: \"fj\", region: \"\", id: \"fj\" },\n { name: \"Filipino\", language: \"fil\", region: \"\", id: \"fil\" },\n { name: \"Finnish\", language: \"fi\", region: \"\", id: \"fi\" },\n { name: \"Flemish\", language: \"fl\", region: \"\", id: \"fl\" },\n { name: \"French\", language: \"fr\", region: \"\", id: \"fr\" },\n { name: \"French (Belgium)\", language: \"fr\", region: \"NL\", id: \"fr-NL\" },\n { name: \"French (Canada)\", language: \"fr\", region: \"CA\", id: \"fr-CA\" },\n { name: \"Frisian\", language: \"fy\", region: \"\", id: \"fy\" },\n { name: \"Galician\", language: \"gl\", region: \"\", id: \"gl\" },\n { name: \"Georgian\", language: \"ka\", region: \"\", id: \"ka\" },\n { name: \"German\", language: \"de\", region: \"\", id: \"de\" },\n { name: \"German (Austria)\", language: \"de\", region: \"AT\", id: \"de-AT\" },\n { name: \"German (Swiss)\", language: \"de\", region: \"CH\", id: \"de-CH\" },\n { name: \"Greek\", language: \"el\", region: \"\", id: \"el\" },\n { name: \"Greenlandic\", language: \"kl\", region: \"\", id: \"kl\" },\n { name: \"Guarani\", language: \"gn\", region: \"\", id: \"gn\" },\n { name: \"Gujarati\", language: \"gu\", region: \"\", id: \"gu\" },\n { name: \"Hausa\", language: \"ha\", region: \"\", id: \"ha\" },\n { name: \"Hebrew\", language: \"he\", region: \"\", id: \"he\" },\n { name: \"Hindi\", language: \"hi\", region: \"\", id: \"hi\" },\n { name: \"Hmong\", language: \"hm\", region: \"\", id: \"hm\" },\n { name: \"Hungarian\", language: \"hu\", region: \"\", id: \"hu\" },\n { name: \"Icelandic\", language: \"is\", region: \"\", id: \"is\" },\n { name: \"Indonesian\", language: \"id\", region: \"\", id: \"id\" },\n { name: \"Interlingua\", language: \"ia\", region: \"\", id: \"ia\" },\n { name: \"Interlingue\", language: \"ie\", region: \"\", id: \"ie\" },\n { name: \"Inuktitut\", language: \"iu\", region: \"\", id: \"iu\" },\n { name: \"Inupiak\", language: \"ik\", region: \"\", id: \"ik\" },\n { name: \"Irish\", language: \"ga\", region: \"\", id: \"ga\" },\n { name: \"Italian\", language: \"it\", region: \"\", id: \"it\" },\n { name: \"Japanese\", language: \"ja\", region: \"\", id: \"ja\" },\n { name: \"Javanese\", language: \"jw\", region: \"\", id: \"jw\" },\n { name: \"Kannada\", language: \"kn\", region: \"\", id: \"kn\" },\n { name: \"Kashmiri\", language: \"ks\", region: \"\", id: \"ks\" },\n { name: \"Kazakh\", language: \"kk\", region: \"\", id: \"kk\" },\n { name: \"Khmer-Cambodian\", language: \"km\", region: \"\", id: \"km\" },\n { name: \"Kinyarwanda\", language: \"rw\", region: \"\", id: \"rw\" },\n { name: \"Kirghiz\", language: \"ky\", region: \"\", id: \"ky\" },\n { name: \"Kirundi\", language: \"rn\", region: \"\", id: \"rn\" },\n { name: \"Korean\", language: \"ko\", region: \"\", id: \"ko\" },\n { name: \"Kurdish\", language: \"ku\", region: \"\", id: \"ku\" },\n { name: \"Laothian\", language: \"lo\", region: \"\", id: \"lo\" },\n { name: \"Latin\", language: \"la\", region: \"\", id: \"la\" },\n { name: \"Latvian\", language: \"lv\", region: \"\", id: \"lv\" },\n { name: \"Lingala\", language: \"ln\", region: \"\", id: \"ln\" },\n { name: \"Lithuanian\", language: \"lt\", region: \"\", id: \"lt\" },\n { name: \"Macedonian\", language: \"mk\", region: \"\", id: \"mk\" },\n { name: \"Malagasy\", language: \"mg\", region: \"\", id: \"mg\" },\n { name: \"Malay\", language: \"ms\", region: \"\", id: \"ms\" },\n { name: \"Malayalam\", language: \"ml\", region: \"\", id: \"ml\" },\n { name: \"Maltese\", language: \"mt\", region: \"\", id: \"mt\" },\n { name: \"Maori\", language: \"mi\", region: \"\", id: \"mi\" },\n { name: \"Marathi\", language: \"mr\", region: \"\", id: \"mr\" },\n { name: \"Moldavian\", language: \"mo\", region: \"\", id: \"mo\" },\n { name: \"Mongolian\", language: \"mn\", region: \"\", id: \"mn\" },\n { name: \"Montenegrin\", language: \"sr\", region: \"ME\", id: \"sr-ME\" },\n { name: \"Nauru\", language: \"na\", region: \"\", id: \"na\" },\n { name: \"Nepali\", language: \"ne\", region: \"\", id: \"ne\" },\n { name: \"Norwegian (Bokmål)\", language: \"no\", region: \"\", id: \"no\" },\n { name: \"Norwegian (Nynorsk)\", language: \"nn\", region: \"\", id: \"nn\" },\n { name: \"Occitan\", language: \"oc\", region: \"\", id: \"oc\" },\n { name: \"Oriya\", language: \"or\", region: \"\", id: \"or\" },\n { name: \"Oromo\", language: \"om\", region: \"\", id: \"om\" },\n { name: \"Pashto\", language: \"ps\", region: \"\", id: \"ps\" },\n { name: \"Persian\", language: \"fa\", region: \"\", id: \"fa\" },\n { name: \"Polish\", language: \"pl\", region: \"\", id: \"pl\" },\n { name: \"Portuguese\", language: \"pt\", region: \"\", id: \"pt\" },\n { name: \"Portuguese (Brazil)\", language: \"pt\", region: \"BR\", id: \"pt-BR\" },\n {\n name: \"Portuguese (Latin America)\",\n language: \"pla\",\n region: \"\",\n id: \"pla\",\n },\n { name: \"Punjabi\", language: \"pa\", region: \"\", id: \"pa\" },\n { name: \"Quechua\", language: \"qu\", region: \"\", id: \"qu\" },\n { name: \"Rhaeto-Romance\", language: \"rm\", region: \"\", id: \"rm\" },\n { name: \"Romanian\", language: \"ro\", region: \"\", id: \"ro\" },\n { name: \"Russian\", language: \"ru\", region: \"\", id: \"ru\" },\n { name: \"Samoan\", language: \"sm\", region: \"\", id: \"sm\" },\n { name: \"Sangho\", language: \"sg\", region: \"\", id: \"sg\" },\n { name: \"Sanskrit\", language: \"sa\", region: \"\", id: \"sa\" },\n { name: \"Scots\", language: \"sco\", region: \"\", id: \"sco\" },\n { name: \"Serbian\", language: \"sr\", region: \"\", id: \"sr\" },\n { name: \"Sesotho\", language: \"st\", region: \"\", id: \"st\" },\n { name: \"Setswana\", language: \"tn\", region: \"\", id: \"tn\" },\n { name: \"Shona\", language: \"sn\", region: \"\", id: \"sn\" },\n { name: \"Sindhi\", language: \"sd\", region: \"\", id: \"sd\" },\n { name: \"Sinhalese\", language: \"si\", region: \"\", id: \"si\" },\n { name: \"Siswati\", language: \"ss\", region: \"\", id: \"ss\" },\n { name: \"Slovak\", language: \"sk\", region: \"\", id: \"sk\" },\n { name: \"Slovenian\", language: \"sl\", region: \"\", id: \"sl\" },\n { name: \"Somali\", language: \"so\", region: \"\", id: \"so\" },\n { name: \"Spanish\", language: \"es\", region: \"\", id: \"es\" },\n {\n name: \"Spanish (Latin America)\",\n language: \"es\",\n region: \"SLA\",\n id: \"es-SLA\",\n },\n { name: \"Spanish (Mexico)\", language: \"es\", region: \"MX\", id: \"es-MX\" },\n {\n name: \"Spanish (United States)\",\n language: \"es\",\n region: \"US\",\n id: \"es-US\",\n },\n { name: \"Sundanese\", language: \"su\", region: \"\", id: \"su\" },\n { name: \"Swahili\", language: \"sw\", region: \"\", id: \"sw\" },\n { name: \"Swedish\", language: \"sv\", region: \"\", id: \"sv\" },\n { name: \"Swedish (Finland)\", language: \"sv\", region: \"FI\", id: \"sv-FI\" },\n { name: \"Tagalog\", language: \"tl\", region: \"\", id: \"tl\" },\n { name: \"Tajik\", language: \"tg\", region: \"\", id: \"tg\" },\n { name: \"Tamil\", language: \"ta\", region: \"\", id: \"ta\" },\n { name: \"Tatar\", language: \"tt\", region: \"\", id: \"tt\" },\n { name: \"Telugu\", language: \"te\", region: \"\", id: \"te\" },\n { name: \"Thai\", language: \"th\", region: \"\", id: \"th\" },\n { name: \"Tibetan\", language: \"bo\", region: \"\", id: \"bo\" },\n { name: \"Tigrinya\", language: \"ti\", region: \"\", id: \"ti\" },\n { name: \"Tonga\", language: \"to\", region: \"\", id: \"to\" },\n { name: \"Tsonga\", language: \"ts\", region: \"\", id: \"ts\" },\n { name: \"Turkish\", language: \"tr\", region: \"\", id: \"tr\" },\n { name: \"Turkmen\", language: \"tk\", region: \"\", id: \"tk\" },\n { name: \"Twi\", language: \"tw\", region: \"\", id: \"tw\" },\n { name: \"Uighur\", language: \"ug\", region: \"\", id: \"ug\" },\n { name: \"Ukrainian\", language: \"uk\", region: \"\", id: \"uk\" },\n { name: \"Urdu\", language: \"ur\", region: \"\", id: \"ur\" },\n { name: \"Uzbek\", language: \"uz\", region: \"\", id: \"uz\" },\n { name: \"Vietnamese\", language: \"vi\", region: \"\", id: \"vi\" },\n { name: \"Volapuk\", language: \"vo\", region: \"\", id: \"vo\" },\n { name: \"Welsh\", language: \"cy\", region: \"\", id: \"cy\" },\n { name: \"Wolof\", language: \"wo\", region: \"\", id: \"wo\" },\n { name: \"Xhosa\", language: \"xh\", region: \"\", id: \"xh\" },\n { name: \"Yiddish\", language: \"yi\", region: \"\", id: \"yi\" },\n { name: \"Yoruba\", language: \"yo\", region: \"\", id: \"yo\" },\n { name: \"Zarma\", language: \"dje\", region: \"\", id: \"dje\" },\n { name: \"Zhuang\", language: \"za\", region: \"\", id: \"za\" },\n { name: \"Zulu\", language: \"zu\", region: \"\", id: \"zu\" },\n ],\n\n // computed\n byId: computed(state => id => state.items.find(locale => locale.id === id)),\n}\n","import { action, thunk } from \"easy-peasy\"\nimport { API } from \"aws-amplify\"\n\nexport default {\n item: {},\n chargeableWords: {},\n\n fetch: thunk(async (actions, { workspaceType: slug }) => {\n try {\n if (slug === undefined) return\n const params = {\n queryStringParameters: {\n slug\n }\n }\n const vendorData = await API.get(\"nepal\", \"/contentful/vendor-data\", params)\n actions.setItem(vendorData)\n } catch (e) {\n console.error(e)\n }\n }),\n\n // actions\n setItem: action((state, item) => {\n state.item = item\n }),\n\n setChargeableWordCount: action((state, { month, wordCount}) => {\n state.chargeableWords[month] = wordCount\n }),\n\n chargeableWordCount: thunk(async (actions, { vendorID: vendor, month }) => {\n try {\n const { data: { wordCount } } = await API.get(\"nepal\", \"/vendors/usage\", {\n queryStringParameters: { vendor, month }\n });\n actions.setChargeableWordCount({ month, wordCount })\n } catch (e) {\n console.error(e)\n }\n }),\n}\n","export default function _classPrivateFieldBase(receiver, privateKey) {\n if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) {\n throw new TypeError(\"attempted to use private field on non-instance\");\n }\n\n return receiver;\n}","import { by } from \"../utils/sort\" ;\nimport { extractGivenName } from \"../helpers/email\";\nexport default class Team {\n #ownerID = null;\n #members = [];\n\n constructor (members, ownerID) {\n this.#members = members;\n this.#ownerID = ownerID;\n }\n\n get owner() {\n return this.#members.find((member) => member.sub === this.#ownerID);\n }\n\n get invitees () {\n return this.#members\n .filter((member) => member.sub !== this.#ownerID)\n .map((row) => {\n row.given_name = row.given_name || extractGivenName(row.email)\n return row;\n })\n .sort(by, \"given_name\");\n }\n\n get members () {\n return this.#members;\n }\n}\n","import { action, thunk } from \"easy-peasy\"\nimport { API } from \"aws-amplify\"\nimport Team from \"../../models/team\"\n\nexport default {\n item: null,\n loading: true,\n\n // thunks\n fetch: thunk(async (actions, input) => {\n try {\n const data = await API.get(\n \"nepal\", `/team/organizations/${input.organizationID}/members`,\n );\n actions.set(new Team(data, input.ownerID));\n return true;\n } catch (err) {\n console.error(err)\n return false;\n }\n }),\n\n create: thunk(async (_actions, input) => {\n try {\n await API.post(\n \"nepal\", `/team/organizations/${input.organizationID}/members`,\n { body: { ...input } }\n );\n return true;\n } catch (_err) {\n return false;\n }\n\n }),\n\n delete: thunk(async (actions, input) => {\n try {\n await API.del(\n \"nepal\", `/team/organizations/${input.organizationID}/members/${input.userId}`,\n );\n actions.remove(input.userId)\n return true;\n } catch (_err) {\n return false;\n }\n }),\n\n remove: action ((state, sub) => {\n state.item = state.item.filter((member) => {\n return member.sub !== sub;\n });\n }),\n\n // actions\n set: action((state, team) => {\n state.item = [team.owner, ...team.invitees].filter(Boolean);\n state.loading = false;\n })\n}\n","import { computed, action, thunk } from \"easy-peasy\"\nimport { API, graphqlOperation } from \"aws-amplify\"\nimport { listOrganizationsByVendorID } from \"../../graphql/locale-queries\"\n\nexport default {\n items: [],\n\n byID: computed(state => id => state.items.find(item => item.id === id)),\n\n fetch: thunk(async (actions, { vendorID }) => {\n try {\n let clients = []\n let nextToken\n do {\n const { data } = await API.graphql(graphqlOperation(listOrganizationsByVendorID, {\n vendorID,\n nextToken,\n }))\n clients = [...clients, ...data.listOrganizationsByVendorID.items]\n nextToken = data.listOrganizationsByVendorID.nextToken\n } while (nextToken)\n actions.set(clients)\n return clients\n } catch (error) {\n console.error(error)\n actions.set([])\n return null\n }\n }),\n\n set: action((state, payload) => {\n state.items = payload.sort((first, second) => first.name?.localeCompare(second.name, undefined, { numeric: true }))\n }),\n}\n","import { action, persist } from \"easy-peasy\"\n\nexport default persist({\n asClient: false,\n\n setAsClient: action((state, payload) => {\n state.asClient = payload\n }),\n})\n","import { action, thunk } from \"easy-peasy\"\nimport { API } from \"aws-amplify\"\nimport Team from \"../../models/team\"\n\nexport default {\n item: null,\n loading: true,\n\n // thunks\n fetch: thunk(async (actions, input) => {\n try {\n const data = await API.get(\n \"nepal\", `/team/vendors/${input.vendorID}/members`,\n );\n\n actions.set(new Team(data, input.ownerID));\n return true;\n } catch (err) {\n console.error(err)\n return false;\n }\n }),\n\n create: thunk(async (_actions, input) => {\n try {\n await API.post(\n \"nepal\", `/team/vendors/${input.vendorID}/members`,\n { body: { ...input } }\n );\n return true;\n } catch (_err) {\n return false;\n }\n\n }),\n\n delete: thunk(async (actions, input) => {\n try {\n await API.del(\n \"nepal\", `/team/vendors/${input.vendorID}/members/${input.userId}`,\n );\n actions.remove(input.userId)\n return true;\n } catch (_err) {\n return false;\n }\n }),\n\n remove: action ((state, sub) => {\n state.item = state.item.filter((member) => {\n return member.sub !== sub;\n });\n }),\n\n // actions\n set: action((state, team) => {\n state.item = [team.owner, ...team.invitees].filter(Boolean);\n state.loading = false;\n })\n}\n","import { action, createStore, persist } from \"easy-peasy\"\n\nimport accessRequests from \"./models/accessRequests\"\nimport azureBranches from \"./models/azure/branches\"\nimport azureRepos from \"./models/azure/repos\"\nimport billing from \"./models/billing\"\nimport bitbucketBranches from \"./models/bitbucket/branches\"\nimport bitbucketRepos from \"./models/bitbucket/repos\"\nimport bms from \"./models/bms\"\nimport connectors from \"./models/connectors\"\nimport contentResources from \"./models/contentResources\"\nimport currentOrg from \"./models/currentOrg\"\nimport currentUser from \"./models/currentUser\"\nimport currentVendor from \"./models/currentVendor\"\nimport expertises from \"./models/expertises\"\nimport formats from \"./models/formats\"\nimport githubBranches from \"./models/github/branches\"\nimport githubRepos from \"./models/github/repos\"\nimport gitlabBranches from \"./models/gitlab/branches\"\nimport gitlabRepos from \"./models/gitlab/repos\"\nimport googledocs from \"./models/googledocs\"\nimport googlesheets from \"./models/googlesheets\"\nimport hubspotcms from \"./models/hubspotcms\"\nimport hoursUsage from \"./models/hoursUsage\"\nimport integrations from \"./models/integrations\"\nimport integrationTypes from \"./models/integrationTypes\"\nimport locales from \"./models/locales\"\nimport lokalise from \"./models/lokalise\"\nimport mailchimp from \"./models/mailchimp\"\nimport onboarding from \"./models/onboarding\"\nimport organizations from \"./models/organizations\"\nimport project from \"./models/project\"\nimport projectLocales from \"./models/projectLocales\"\nimport projects from \"./models/projects\"\nimport projectTemplates from \"./models/projectTemplates\"\nimport projectWizard from \"./models/projectWizard\"\nimport quote from \"./models/quote\"\nimport staticLocales from \"./models/staticLocales\"\nimport vendor from \"./models/vendor\"\nimport team from \"./models/team\"\nimport clients from \"./models/clients\"\nimport appMode from \"./models/appMode\"\nimport vendorTeam from \"./models/vendorTeam\"\n\nlet initialState = {}\n\nexport const models = {\n accessRequests,\n appMode,\n azureBranches,\n azureRepos,\n bitbucketBranches,\n bitbucketRepos,\n bms,\n billing,\n clients,\n connectors,\n contentResources,\n currentOrg: persist(currentOrg),\n currentUser,\n currentVendor,\n expertises,\n formats,\n githubBranches,\n githubRepos,\n gitlabBranches,\n gitlabRepos,\n googledocs,\n googlesheets,\n hoursUsage,\n hubspotcms,\n integrations,\n integrationTypes,\n mailchimp,\n locales,\n lokalise,\n onboarding,\n organizations,\n project,\n projectLocales,\n projects,\n projectTemplates,\n projectWizard,\n quote,\n staticLocales,\n team,\n vendor,\n vendorTeam,\n}\n\nconst store = createStore({\n ...models,\n reset: action(() => ({\n ...initialState,\n appMode: {\n asClient: false,\n },\n })),\n})\ninitialState = store.getState()\n\nexport default store\n","function removeEventListener(node, eventName, handler, options) {\n var capture = options && typeof options !== 'boolean' ? options.capture : options;\n node.removeEventListener(eventName, handler, capture);\n\n if (handler.__once) {\n node.removeEventListener(eventName, handler.__once, capture);\n }\n}\n\nexport default removeEventListener;","module.exports = {\n doubles: {\n step: 4,\n points: [['e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a', 'f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821'], ['8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508', '11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf'], ['175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739', 'd3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695'], ['363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640', '4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9'], ['8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c', '4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36'], ['723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda', '96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f'], ['eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa', '5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999'], ['100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0', 'cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09'], ['e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d', '9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d'], ['feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d', 'e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088'], ['da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1', '9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d'], ['53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0', '5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8'], ['8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047', '10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a'], ['385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862', '283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453'], ['6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7', '7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160'], ['3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd', '56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0'], ['85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83', '7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6'], ['948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a', '53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589'], ['6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8', 'bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17'], ['e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d', '4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda'], ['e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725', '7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd'], ['213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754', '4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2'], ['4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c', '17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6'], ['fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6', '6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f'], ['76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39', 'c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01'], ['c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891', '893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3'], ['d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b', 'febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f'], ['b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03', '2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7'], ['e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d', 'eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78'], ['a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070', '7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1'], ['90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4', 'e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150'], ['8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da', '662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82'], ['e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11', '1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc'], ['8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e', 'efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b'], ['e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41', '2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51'], ['b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef', '67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45'], ['d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8', 'db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120'], ['324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d', '648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84'], ['4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96', '35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d'], ['9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd', 'ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d'], ['6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5', '9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8'], ['a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266', '40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8'], ['7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71', '34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac'], ['928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac', 'c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f'], ['85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751', '1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962'], ['ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e', '493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907'], ['827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241', 'c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec'], ['eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3', 'be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d'], ['e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f', '4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414'], ['1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19', 'aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd'], ['146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be', 'b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0'], ['fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9', '6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811'], ['da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2', '8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1'], ['a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13', '7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c'], ['174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c', 'ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73'], ['959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba', '2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd'], ['d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151', 'e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405'], ['64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073', 'd99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589'], ['8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458', '38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e'], ['13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b', '69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27'], ['bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366', 'd3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1'], ['8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa', '40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482'], ['8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0', '620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945'], ['dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787', '7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573'], ['f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e', 'ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82']]\n },\n naf: {\n wnd: 7,\n points: [['f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9', '388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672'], ['2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4', 'd8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6'], ['5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc', '6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da'], ['acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe', 'cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37'], ['774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb', 'd984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b'], ['f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8', 'ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81'], ['d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e', '581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58'], ['defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34', '4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77'], ['2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c', '85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a'], ['352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5', '321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c'], ['2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f', '2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67'], ['9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714', '73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402'], ['daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729', 'a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55'], ['c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db', '2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482'], ['6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4', 'e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82'], ['1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5', 'b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396'], ['605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479', '2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49'], ['62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d', '80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf'], ['80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f', '1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a'], ['7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb', 'd0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7'], ['d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9', 'eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933'], ['49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963', '758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a'], ['77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74', '958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6'], ['f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530', 'e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37'], ['463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b', '5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e'], ['f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247', 'cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6'], ['caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1', 'cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476'], ['2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120', '4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40'], ['7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435', '91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61'], ['754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18', '673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683'], ['e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8', '59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5'], ['186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb', '3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b'], ['df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f', '55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417'], ['5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143', 'efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868'], ['290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba', 'e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a'], ['af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45', 'f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6'], ['766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a', '744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996'], ['59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e', 'c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e'], ['f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8', 'e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d'], ['7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c', '30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2'], ['948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519', 'e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e'], ['7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab', '100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437'], ['3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca', 'ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311'], ['d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf', '8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4'], ['1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610', '68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575'], ['733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4', 'f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d'], ['15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c', 'd56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d'], ['a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940', 'edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629'], ['e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980', 'a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06'], ['311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3', '66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374'], ['34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf', '9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee'], ['f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63', '4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1'], ['d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448', 'fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b'], ['32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf', '5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661'], ['7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5', '8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6'], ['ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6', '8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e'], ['16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5', '5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d'], ['eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99', 'f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc'], ['78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51', 'f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4'], ['494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5', '42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c'], ['a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5', '204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b'], ['c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997', '4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913'], ['841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881', '73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154'], ['5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5', '39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865'], ['36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66', 'd2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc'], ['336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726', 'ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224'], ['8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede', '6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e'], ['1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94', '60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6'], ['85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31', '3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511'], ['29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51', 'b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b'], ['a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252', 'ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2'], ['4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5', 'cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c'], ['d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b', '6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3'], ['ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4', '322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d'], ['af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f', '6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700'], ['e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889', '2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4'], ['591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246', 'b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196'], ['11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984', '998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4'], ['3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a', 'b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257'], ['cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030', 'bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13'], ['c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197', '6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096'], ['c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593', 'c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38'], ['a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef', '21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f'], ['347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38', '60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448'], ['da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a', '49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a'], ['c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111', '5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4'], ['4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502', '7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437'], ['3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea', 'be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7'], ['cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26', '8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d'], ['b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986', '39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a'], ['d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e', '62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54'], ['48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4', '25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77'], ['dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda', 'ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517'], ['6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859', 'cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10'], ['e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f', 'f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125'], ['eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c', '6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e'], ['13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942', 'fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1'], ['ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a', '1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2'], ['b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80', '5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423'], ['ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d', '438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8'], ['8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1', 'cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758'], ['52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63', 'c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375'], ['e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352', '6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d'], ['7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193', 'ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec'], ['5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00', '9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0'], ['32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58', 'ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c'], ['e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7', 'd3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4'], ['8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8', 'c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f'], ['4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e', '67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649'], ['3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d', 'cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826'], ['674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b', '299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5'], ['d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f', 'f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87'], ['30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6', '462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b'], ['be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297', '62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc'], ['93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a', '7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c'], ['b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c', 'ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f'], ['d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52', '4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a'], ['d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb', 'bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46'], ['463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065', 'bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f'], ['7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917', '603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03'], ['74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9', 'cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08'], ['30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3', '553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8'], ['9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57', '712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373'], ['176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66', 'ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3'], ['75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8', '9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8'], ['809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721', '9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1'], ['1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180', '4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9']]\n }\n};","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\n/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf-style format (only %s is supported) and arguments\n * to provide information about what broke and what you were\n * expecting.\n *\n * The invariant message will be stripped in production, but the invariant\n * will remain to ensure logic does not differ in production.\n */\n\nvar invariant = function(condition, format, a, b, c, d, e, f) {\n if (process.env.NODE_ENV !== 'production') {\n if (format === undefined) {\n throw new Error('invariant requires an error message argument');\n }\n }\n\n if (!condition) {\n var error;\n if (format === undefined) {\n error = new Error(\n 'Minified exception occurred; use the non-minified dev environment ' +\n 'for the full error message and additional helpful warnings.'\n );\n } else {\n var args = [a, b, c, d, e, f];\n var argIndex = 0;\n error = new Error(\n format.replace(/%s/g, function() { return args[argIndex++]; })\n );\n error.name = 'Invariant Violation';\n }\n\n error.framesToPop = 1; // we don't care about invariant's own frame\n throw error;\n }\n};\n\nmodule.exports = invariant;\n","import { DateTime, Duration } from \"luxon\"\n\nexport const LOCALE_STATE = {\n CALCULATING: \"calculating\",\n COMPLETE: \"complete\",\n IN_PROGRESS: \"inProgress\",\n INCOMPLETE: \"incomplete\",\n MISSING: \"missing\",\n SOURCE: \"source\",\n}\n\nexport default class ProjectLocale {\n constructor(attrs) {\n this.audit = attrs.audit || {\n completion: null,\n duration: null,\n missingSegments: null,\n missingWords: null,\n segments: null,\n words: null,\n }\n this.code = attrs.code || null\n this.id = attrs.id || null\n this.isActive = attrs.isActive || false\n this.isSource = attrs.isSource || false\n this.locale = attrs.locale || null\n this.localeID = attrs.localeID || null\n this.organizationID = attrs.organizationID || null\n this.owner = attrs.owner || null\n this.project = attrs.project || null\n this.projectID = attrs.projectID || null\n this.inProgress = attrs.inProgress\n this.groups = attrs.groups\n this.stateUpdatedAt = attrs.stateUpdatedAt || null\n this.createdAt = attrs.createdAt || null\n this.updatedAt = attrs.updatedAt || null\n }\n\n get completion() {\n return this.audit.completion;\n }\n\n get duration() {\n return this.audit.duration ? Duration.fromISO(this.audit.duration) : null\n }\n\n get hasQuoteInProgress() {\n return this.quotesInProgress.length > 0;\n }\n\n get isCalculating() {\n return this.hasQuoteInProgress || this.state === undefined\n }\n\n get instancesInProgress() {\n return JSON.parse(this.inProgress).instances\n }\n\n get isCompleted() {\n return this.completion === 100\n }\n\n get isIncomplete() {\n return this.completion > 0 && this.completion < 100\n }\n\n get isInProgress() {\n return this.instancesInProgress.length > 0\n }\n\n get isMissing() {\n return this.completion === 0\n }\n\n get isQuoteComplete() {\n return !this.hasQuoteInProgress\n }\n\n get isTranslatable() {\n return [LOCALE_STATE.INCOMPLETE, LOCALE_STATE.MISSING].includes(this.state)\n }\n\n get isPushable() {\n return ![undefined, LOCALE_STATE.CALCULATING].includes(this.state)\n }\n\n lastDelivered(intl) {\n if (!this.stateUpdatedAt) return\n return intl.formatMessage(\n {\n id: \"models.projectLocale.lastDelivered\",\n defaultMessage: \"Updated {lastDelivered}\",\n },\n {\n lastDelivered: DateTime.now().toRelative({\n base: DateTime.fromISO(this.stateUpdatedAt),\n locale: intl.locale,\n style: \"narrow\",\n }),\n }\n )\n }\n\n get missingSegments() {\n return this.audit.missingSegments\n }\n\n get missingWords() {\n return this.audit.missingWords\n }\n\n get quotesInProgress() {\n return JSON.parse(this.inProgress).quotes\n }\n\n get segments() {\n return this.audit.segments\n }\n\n get state() {\n if (this.isSource) return LOCALE_STATE.SOURCE\n if (this.hasQuoteInProgress) return LOCALE_STATE.CALCULATING\n if (this.isInProgress) return LOCALE_STATE.IN_PROGRESS\n if (this.isCompleted) return LOCALE_STATE.COMPLETE\n if (this.isIncomplete) return LOCALE_STATE.INCOMPLETE\n if (this.isMissing) return LOCALE_STATE.MISSING\n }\n\n get words() {\n return this.audit.words\n }\n}\n","// from https://github.com/indutny/self-signed/blob/gh-pages/lib/asn1.js\n// Fedor, you are amazing.\n'use strict';\n\nvar asn1 = require('asn1.js');\n\nexports.certificate = require('./certificate');\nvar RSAPrivateKey = asn1.define('RSAPrivateKey', function () {\n this.seq().obj(this.key('version').int(), this.key('modulus').int(), this.key('publicExponent').int(), this.key('privateExponent').int(), this.key('prime1').int(), this.key('prime2').int(), this.key('exponent1').int(), this.key('exponent2').int(), this.key('coefficient').int());\n});\nexports.RSAPrivateKey = RSAPrivateKey;\nvar RSAPublicKey = asn1.define('RSAPublicKey', function () {\n this.seq().obj(this.key('modulus').int(), this.key('publicExponent').int());\n});\nexports.RSAPublicKey = RSAPublicKey;\nvar PublicKey = asn1.define('SubjectPublicKeyInfo', function () {\n this.seq().obj(this.key('algorithm').use(AlgorithmIdentifier), this.key('subjectPublicKey').bitstr());\n});\nexports.PublicKey = PublicKey;\nvar AlgorithmIdentifier = asn1.define('AlgorithmIdentifier', function () {\n this.seq().obj(this.key('algorithm').objid(), this.key('none').null_().optional(), this.key('curve').objid().optional(), this.key('params').seq().obj(this.key('p').int(), this.key('q').int(), this.key('g').int()).optional());\n});\nvar PrivateKeyInfo = asn1.define('PrivateKeyInfo', function () {\n this.seq().obj(this.key('version').int(), this.key('algorithm').use(AlgorithmIdentifier), this.key('subjectPrivateKey').octstr());\n});\nexports.PrivateKey = PrivateKeyInfo;\nvar EncryptedPrivateKeyInfo = asn1.define('EncryptedPrivateKeyInfo', function () {\n this.seq().obj(this.key('algorithm').seq().obj(this.key('id').objid(), this.key('decrypt').seq().obj(this.key('kde').seq().obj(this.key('id').objid(), this.key('kdeparams').seq().obj(this.key('salt').octstr(), this.key('iters').int())), this.key('cipher').seq().obj(this.key('algo').objid(), this.key('iv').octstr()))), this.key('subjectPrivateKey').octstr());\n});\nexports.EncryptedPrivateKey = EncryptedPrivateKeyInfo;\nvar DSAPrivateKey = asn1.define('DSAPrivateKey', function () {\n this.seq().obj(this.key('version').int(), this.key('p').int(), this.key('q').int(), this.key('g').int(), this.key('pub_key').int(), this.key('priv_key').int());\n});\nexports.DSAPrivateKey = DSAPrivateKey;\nexports.DSAparam = asn1.define('DSAparam', function () {\n this.int();\n});\nvar ECPrivateKey = asn1.define('ECPrivateKey', function () {\n this.seq().obj(this.key('version').int(), this.key('privateKey').octstr(), this.key('parameters').optional().explicit(0).use(ECParameters), this.key('publicKey').optional().explicit(1).bitstr());\n});\nexports.ECPrivateKey = ECPrivateKey;\nvar ECParameters = asn1.define('ECParameters', function () {\n this.choice({\n namedCurve: this.objid()\n });\n});\nexports.signature = asn1.define('signature', function () {\n this.seq().obj(this.key('r').int(), this.key('s').int());\n});","'use strict';\n\nvar curve = exports;\ncurve.base = require('./base');\ncurve.short = require('./short');\ncurve.mont = require('./mont');\ncurve.edwards = require('./edwards');","'use strict';\n\nvar _Object$setPrototypeO;\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nvar finished = require('./end-of-stream');\n\nvar kLastResolve = Symbol('lastResolve');\nvar kLastReject = Symbol('lastReject');\nvar kError = Symbol('error');\nvar kEnded = Symbol('ended');\nvar kLastPromise = Symbol('lastPromise');\nvar kHandlePromise = Symbol('handlePromise');\nvar kStream = Symbol('stream');\n\nfunction createIterResult(value, done) {\n return {\n value: value,\n done: done\n };\n}\n\nfunction readAndResolve(iter) {\n var resolve = iter[kLastResolve];\n\n if (resolve !== null) {\n var data = iter[kStream].read(); // we defer if data is null\n // we can be expecting either 'end' or\n // 'error'\n\n if (data !== null) {\n iter[kLastPromise] = null;\n iter[kLastResolve] = null;\n iter[kLastReject] = null;\n resolve(createIterResult(data, false));\n }\n }\n}\n\nfunction onReadable(iter) {\n // we wait for the next tick, because it might\n // emit an error with process.nextTick\n process.nextTick(readAndResolve, iter);\n}\n\nfunction wrapForNext(lastPromise, iter) {\n return function (resolve, reject) {\n lastPromise.then(function () {\n if (iter[kEnded]) {\n resolve(createIterResult(undefined, true));\n return;\n }\n\n iter[kHandlePromise](resolve, reject);\n }, reject);\n };\n}\n\nvar AsyncIteratorPrototype = Object.getPrototypeOf(function () {});\nvar ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {\n get stream() {\n return this[kStream];\n },\n\n next: function next() {\n var _this = this; // if we have detected an error in the meanwhile\n // reject straight away\n\n\n var error = this[kError];\n\n if (error !== null) {\n return Promise.reject(error);\n }\n\n if (this[kEnded]) {\n return Promise.resolve(createIterResult(undefined, true));\n }\n\n if (this[kStream].destroyed) {\n // We need to defer via nextTick because if .destroy(err) is\n // called, the error will be emitted via nextTick, and\n // we cannot guarantee that there is no error lingering around\n // waiting to be emitted.\n return new Promise(function (resolve, reject) {\n process.nextTick(function () {\n if (_this[kError]) {\n reject(_this[kError]);\n } else {\n resolve(createIterResult(undefined, true));\n }\n });\n });\n } // if we have multiple next() calls\n // we will wait for the previous Promise to finish\n // this logic is optimized to support for await loops,\n // where next() is only called once at a time\n\n\n var lastPromise = this[kLastPromise];\n var promise;\n\n if (lastPromise) {\n promise = new Promise(wrapForNext(lastPromise, this));\n } else {\n // fast path needed to support multiple this.push()\n // without triggering the next() queue\n var data = this[kStream].read();\n\n if (data !== null) {\n return Promise.resolve(createIterResult(data, false));\n }\n\n promise = new Promise(this[kHandlePromise]);\n }\n\n this[kLastPromise] = promise;\n return promise;\n }\n}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () {\n return this;\n}), _defineProperty(_Object$setPrototypeO, \"return\", function _return() {\n var _this2 = this; // destroy(err, cb) is a private API\n // we can guarantee we have that here, because we control the\n // Readable class this is attached to\n\n\n return new Promise(function (resolve, reject) {\n _this2[kStream].destroy(null, function (err) {\n if (err) {\n reject(err);\n return;\n }\n\n resolve(createIterResult(undefined, true));\n });\n });\n}), _Object$setPrototypeO), AsyncIteratorPrototype);\n\nvar createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) {\n var _Object$create;\n\n var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {\n value: stream,\n writable: true\n }), _defineProperty(_Object$create, kLastResolve, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kLastReject, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kError, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kEnded, {\n value: stream._readableState.endEmitted,\n writable: true\n }), _defineProperty(_Object$create, kHandlePromise, {\n value: function value(resolve, reject) {\n var data = iterator[kStream].read();\n\n if (data) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(data, false));\n } else {\n iterator[kLastResolve] = resolve;\n iterator[kLastReject] = reject;\n }\n },\n writable: true\n }), _Object$create));\n iterator[kLastPromise] = null;\n finished(stream, function (err) {\n if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') {\n var reject = iterator[kLastReject]; // reject if we are waiting for data in the Promise\n // returned by next() and store the error\n\n if (reject !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n reject(err);\n }\n\n iterator[kError] = err;\n return;\n }\n\n var resolve = iterator[kLastResolve];\n\n if (resolve !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(undefined, true));\n }\n\n iterator[kEnded] = true;\n });\n stream.on('readable', onReadable.bind(null, iterator));\n return iterator;\n};\n\nmodule.exports = createReadableStreamAsyncIterator;","'use strict';\n\nvar base = exports;\nbase.Reporter = require('./reporter').Reporter;\nbase.DecoderBuffer = require('./buffer').DecoderBuffer;\nbase.EncoderBuffer = require('./buffer').EncoderBuffer;\nbase.Node = require('./node');","/**\n * Safe chained function\n *\n * Will only create a new function if needed,\n * otherwise will pass back existing functions or null.\n *\n * @param {function} functions to chain\n * @returns {function|null}\n */\nfunction createChainedFunction() {\n for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {\n funcs[_key] = arguments[_key];\n }\n\n return funcs.filter(function (f) {\n return f != null;\n }).reduce(function (acc, f) {\n if (typeof f !== 'function') {\n throw new Error('Invalid Argument Type, must only provide functions, undefined, or null.');\n }\n\n if (acc === null) return f;\n return function chainedFunction() {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n } // @ts-ignore\n\n\n acc.apply(this, args); // @ts-ignore\n\n f.apply(this, args);\n };\n }, null);\n}\n\nexport default createChainedFunction;","var AuthCipher = require('./authCipher');\n\nvar Buffer = require('safe-buffer').Buffer;\n\nvar MODES = require('./modes');\n\nvar StreamCipher = require('./streamCipher');\n\nvar Transform = require('cipher-base');\n\nvar aes = require('./aes');\n\nvar ebtk = require('evp_bytestokey');\n\nvar inherits = require('inherits');\n\nfunction Decipher(mode, key, iv) {\n Transform.call(this);\n this._cache = new Splitter();\n this._last = void 0;\n this._cipher = new aes.AES(key);\n this._prev = Buffer.from(iv);\n this._mode = mode;\n this._autopadding = true;\n}\n\ninherits(Decipher, Transform);\n\nDecipher.prototype._update = function (data) {\n this._cache.add(data);\n\n var chunk;\n var thing;\n var out = [];\n\n while (chunk = this._cache.get(this._autopadding)) {\n thing = this._mode.decrypt(this, chunk);\n out.push(thing);\n }\n\n return Buffer.concat(out);\n};\n\nDecipher.prototype._final = function () {\n var chunk = this._cache.flush();\n\n if (this._autopadding) {\n return unpad(this._mode.decrypt(this, chunk));\n } else if (chunk) {\n throw new Error('data not multiple of block length');\n }\n};\n\nDecipher.prototype.setAutoPadding = function (setTo) {\n this._autopadding = !!setTo;\n return this;\n};\n\nfunction Splitter() {\n this.cache = Buffer.allocUnsafe(0);\n}\n\nSplitter.prototype.add = function (data) {\n this.cache = Buffer.concat([this.cache, data]);\n};\n\nSplitter.prototype.get = function (autoPadding) {\n var out;\n\n if (autoPadding) {\n if (this.cache.length > 16) {\n out = this.cache.slice(0, 16);\n this.cache = this.cache.slice(16);\n return out;\n }\n } else {\n if (this.cache.length >= 16) {\n out = this.cache.slice(0, 16);\n this.cache = this.cache.slice(16);\n return out;\n }\n }\n\n return null;\n};\n\nSplitter.prototype.flush = function () {\n if (this.cache.length) return this.cache;\n};\n\nfunction unpad(last) {\n var padded = last[15];\n\n if (padded < 1 || padded > 16) {\n throw new Error('unable to decrypt data');\n }\n\n var i = -1;\n\n while (++i < padded) {\n if (last[i + (16 - padded)] !== padded) {\n throw new Error('unable to decrypt data');\n }\n }\n\n if (padded === 16) return;\n return last.slice(0, 16 - padded);\n}\n\nfunction createDecipheriv(suite, password, iv) {\n var config = MODES[suite.toLowerCase()];\n if (!config) throw new TypeError('invalid suite type');\n if (typeof iv === 'string') iv = Buffer.from(iv);\n if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length);\n if (typeof password === 'string') password = Buffer.from(password);\n if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length);\n\n if (config.type === 'stream') {\n return new StreamCipher(config.module, password, iv, true);\n } else if (config.type === 'auth') {\n return new AuthCipher(config.module, password, iv, true);\n }\n\n return new Decipher(config.module, password, iv);\n}\n\nfunction createDecipher(suite, password) {\n var config = MODES[suite.toLowerCase()];\n if (!config) throw new TypeError('invalid suite type');\n var keys = ebtk(password, false, config.key, config.iv);\n return createDecipheriv(suite, keys.key, keys.iv);\n}\n\nexports.createDecipher = createDecipher;\nexports.createDecipheriv = createDecipheriv;","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n'use strict';\n\nmodule.exports = Readable;\n/**/\n\nvar Duplex;\n/**/\n\nReadable.ReadableState = ReadableState;\n/**/\n\nvar EE = require('events').EventEmitter;\n\nvar EElistenerCount = function EElistenerCount(emitter, type) {\n return emitter.listeners(type).length;\n};\n/**/\n\n/**/\n\n\nvar Stream = require('./internal/streams/stream');\n/**/\n\n\nvar Buffer = require('buffer').Buffer;\n\nvar OurUint8Array = global.Uint8Array || function () {};\n\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\n\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n/**/\n\n\nvar debugUtil = require('util');\n\nvar debug;\n\nif (debugUtil && debugUtil.debuglog) {\n debug = debugUtil.debuglog('stream');\n} else {\n debug = function debug() {};\n}\n/**/\n\n\nvar BufferList = require('./internal/streams/buffer_list');\n\nvar destroyImpl = require('./internal/streams/destroy');\n\nvar _require = require('./internal/streams/state'),\n getHighWaterMark = _require.getHighWaterMark;\n\nvar _require$codes = require('../errors').codes,\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; // Lazy loaded to improve the startup performance.\n\n\nvar StringDecoder;\nvar createReadableStreamAsyncIterator;\nvar from;\n\nrequire('inherits')(Readable, Stream);\n\nvar errorOrDestroy = destroyImpl.errorOrDestroy;\nvar kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];\n\nfunction prependListener(emitter, event, fn) {\n // Sadly this is not cacheable as some libraries bundle their own\n // event emitter implementation with them.\n if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); // This is a hack to make sure that our error handler is attached before any\n // userland ones. NEVER DO THIS. This is here only because this code needs\n // to continue to work with older versions of Node.js that do not include\n // the prependListener() method. The goal is to eventually remove this hack.\n\n if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];\n}\n\nfunction ReadableState(options, stream, isDuplex) {\n Duplex = Duplex || require('./_stream_duplex');\n options = options || {}; // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n\n this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); // A linked list is used to store data chunks instead of an array because the\n // linked list can remove elements from the beginning faster than\n // array.shift()\n\n this.buffer = new BufferList();\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted\n // immediately, or on a later tick. We set this to true at first, because\n // any actions that shouldn't happen until \"later\" should generally also\n // not happen before the first read call.\n\n this.sync = true; // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n this.resumeScheduled = false;\n this.paused = true; // Should close be emitted on destroy. Defaults to true.\n\n this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'end' (and potentially 'finish')\n\n this.autoDestroy = !!options.autoDestroy; // has it been destroyed\n\n this.destroyed = false; // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n\n this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s\n\n this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled\n\n this.readingMore = false;\n this.decoder = null;\n this.encoding = null;\n\n if (options.encoding) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\n\nfunction Readable(options) {\n Duplex = Duplex || require('./_stream_duplex');\n if (!(this instanceof Readable)) return new Readable(options); // Checking for a Stream.Duplex instance is faster here instead of inside\n // the ReadableState constructor, at least with V8 6.5\n\n var isDuplex = this instanceof Duplex;\n this._readableState = new ReadableState(options, this, isDuplex); // legacy\n\n this.readable = true;\n\n if (options) {\n if (typeof options.read === 'function') this._read = options.read;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n }\n\n Stream.call(this);\n}\n\nObject.defineProperty(Readable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._readableState === undefined) {\n return false;\n }\n\n return this._readableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._readableState) {\n return;\n } // backward compatibility, the user is explicitly\n // managing destroyed\n\n\n this._readableState.destroyed = value;\n }\n});\nReadable.prototype.destroy = destroyImpl.destroy;\nReadable.prototype._undestroy = destroyImpl.undestroy;\n\nReadable.prototype._destroy = function (err, cb) {\n cb(err);\n}; // Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\n\n\nReadable.prototype.push = function (chunk, encoding) {\n var state = this._readableState;\n var skipChunkCheck;\n\n if (!state.objectMode) {\n if (typeof chunk === 'string') {\n encoding = encoding || state.defaultEncoding;\n\n if (encoding !== state.encoding) {\n chunk = Buffer.from(chunk, encoding);\n encoding = '';\n }\n\n skipChunkCheck = true;\n }\n } else {\n skipChunkCheck = true;\n }\n\n return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);\n}; // Unshift should *always* be something directly out of read()\n\n\nReadable.prototype.unshift = function (chunk) {\n return readableAddChunk(this, chunk, null, true, false);\n};\n\nfunction readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {\n debug('readableAddChunk', chunk);\n var state = stream._readableState;\n\n if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else {\n var er;\n if (!skipChunkCheck) er = chunkInvalid(state, chunk);\n\n if (er) {\n errorOrDestroy(stream, er);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (addToFront) {\n if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true);\n } else if (state.ended) {\n errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());\n } else if (state.destroyed) {\n return false;\n } else {\n state.reading = false;\n\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk);\n if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);\n } else {\n addChunk(stream, state, chunk, false);\n }\n }\n } else if (!addToFront) {\n state.reading = false;\n maybeReadMore(stream, state);\n }\n } // We can push more data if we are below the highWaterMark.\n // Also, if we have no data yet, we can stand some more bytes.\n // This is to work around cases where hwm=0, such as the repl.\n\n\n return !state.ended && (state.length < state.highWaterMark || state.length === 0);\n}\n\nfunction addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync) {\n state.awaitDrain = 0;\n stream.emit('data', chunk);\n } else {\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);\n if (state.needReadable) emitReadable(stream);\n }\n\n maybeReadMore(stream, state);\n}\n\nfunction chunkInvalid(state, chunk) {\n var er;\n\n if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk);\n }\n\n return er;\n}\n\nReadable.prototype.isPaused = function () {\n return this._readableState.flowing === false;\n}; // backwards compatibility.\n\n\nReadable.prototype.setEncoding = function (enc) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n var decoder = new StringDecoder(enc);\n this._readableState.decoder = decoder; // If setEncoding(null), decoder.encoding equals utf8\n\n this._readableState.encoding = this._readableState.decoder.encoding; // Iterate over current buffer to convert already stored Buffers:\n\n var p = this._readableState.buffer.head;\n var content = '';\n\n while (p !== null) {\n content += decoder.write(p.data);\n p = p.next;\n }\n\n this._readableState.buffer.clear();\n\n if (content !== '') this._readableState.buffer.push(content);\n this._readableState.length = content.length;\n return this;\n}; // Don't raise the hwm > 1GB\n\n\nvar MAX_HWM = 0x40000000;\n\nfunction computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE.\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2 to prevent increasing hwm excessively in\n // tiny amounts\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n\n return n;\n} // This function is designed to be inlinable, so please take care when making\n// changes to the function body.\n\n\nfunction howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.\n\n\nReadable.prototype.read = function (n) {\n debug('read', n);\n n = parseInt(n, 10);\n var state = this._readableState;\n var nOrig = n;\n if (n !== 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n\n if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {\n debug('read: emitReadable', state.length, state.ended);\n if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);\n return null;\n }\n\n n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up.\n\n if (n === 0 && state.ended) {\n if (state.length === 0) endReadable(this);\n return null;\n } // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n // if we need a readable event, then we need to do some reading.\n\n\n var doRead = state.needReadable;\n debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some\n\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug('length less than watermark', doRead);\n } // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n\n\n if (state.ended || state.reading) {\n doRead = false;\n debug('reading or ended', doRead);\n } else if (doRead) {\n debug('do read');\n state.reading = true;\n state.sync = true; // if the length is currently zero, then we *need* a readable event.\n\n if (state.length === 0) state.needReadable = true; // call internal read method\n\n this._read(state.highWaterMark);\n\n state.sync = false; // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n\n if (!state.reading) n = howMuchToRead(nOrig, state);\n }\n\n var ret;\n if (n > 0) ret = fromList(n, state);else ret = null;\n\n if (ret === null) {\n state.needReadable = state.length <= state.highWaterMark;\n n = 0;\n } else {\n state.length -= n;\n state.awaitDrain = 0;\n }\n\n if (state.length === 0) {\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (!state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick.\n\n if (nOrig !== n && state.ended) endReadable(this);\n }\n\n if (ret !== null) this.emit('data', ret);\n return ret;\n};\n\nfunction onEofChunk(stream, state) {\n debug('onEofChunk');\n if (state.ended) return;\n\n if (state.decoder) {\n var chunk = state.decoder.end();\n\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n\n state.ended = true;\n\n if (state.sync) {\n // if we are sync, wait until next tick to emit the data.\n // Otherwise we risk emitting data in the flow()\n // the readable code triggers during a read() call\n emitReadable(stream);\n } else {\n // emit 'readable' now to make sure it gets picked up.\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n state.emittedReadable = true;\n emitReadable_(stream);\n }\n }\n} // Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\n\n\nfunction emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}\n\nfunction emitReadable_(stream) {\n var state = stream._readableState;\n debug('emitReadable_', state.destroyed, state.length, state.ended);\n\n if (!state.destroyed && (state.length || state.ended)) {\n stream.emit('readable');\n state.emittedReadable = false;\n } // The stream needs another readable event if\n // 1. It is not flowing, as the flow mechanism will take\n // care of it.\n // 2. It is not ended.\n // 3. It is below the highWaterMark, so we can schedule\n // another readable later.\n\n\n state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;\n flow(stream);\n} // at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\n\n\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n process.nextTick(maybeReadMore_, stream, state);\n }\n}\n\nfunction maybeReadMore_(stream, state) {\n // Attempt to read more data if we should.\n //\n // The conditions for reading more data are (one of):\n // - Not enough data buffered (state.length < state.highWaterMark). The loop\n // is responsible for filling the buffer with enough data if such data\n // is available. If highWaterMark is 0 and we are not in the flowing mode\n // we should _not_ attempt to buffer any extra data. We'll get more data\n // when the stream consumer calls read() instead.\n // - No data in the buffer, and the stream is in flowing mode. In this mode\n // the loop below is responsible for ensuring read() is called. Failing to\n // call read here would abort the flow and there's no other mechanism for\n // continuing the flow if the stream consumer has just subscribed to the\n // 'data' event.\n //\n // In addition to the above conditions to keep reading data, the following\n // conditions prevent the data from being read:\n // - The stream has ended (state.ended).\n // - There is already a pending 'read' operation (state.reading). This is a\n // case where the the stream has called the implementation defined _read()\n // method, but they are processing the call asynchronously and have _not_\n // called push() with new data. In this case we skip performing more\n // read()s. The execution ends in this method again after the _read() ends\n // up calling push() with more data.\n while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {\n var len = state.length;\n debug('maybeReadMore read 0');\n stream.read(0);\n if (len === state.length) // didn't get any data, stop spinning.\n break;\n }\n\n state.readingMore = false;\n} // abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\n\n\nReadable.prototype._read = function (n) {\n errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()'));\n};\n\nReadable.prototype.pipe = function (dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n\n default:\n state.pipes.push(dest);\n break;\n }\n\n state.pipesCount += 1;\n debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n var endFn = doEnd ? onend : unpipe;\n if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn);\n dest.on('unpipe', onunpipe);\n\n function onunpipe(readable, unpipeInfo) {\n debug('onunpipe');\n\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true;\n cleanup();\n }\n }\n }\n\n function onend() {\n debug('onend');\n dest.end();\n } // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n\n\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n var cleanedUp = false;\n\n function cleanup() {\n debug('cleanup'); // cleanup event handlers once the pipe is broken\n\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', unpipe);\n src.removeListener('data', ondata);\n cleanedUp = true; // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n\n if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();\n }\n\n src.on('data', ondata);\n\n function ondata(chunk) {\n debug('ondata');\n var ret = dest.write(chunk);\n debug('dest.write', ret);\n\n if (ret === false) {\n // If the user unpiped during `dest.write()`, it is possible\n // to get stuck in a permanently paused state if that write\n // also returned false.\n // => Check whether `dest` is still a piping destination.\n if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {\n debug('false write response, pause', state.awaitDrain);\n state.awaitDrain++;\n }\n\n src.pause();\n }\n } // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n\n\n function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er);\n } // Make sure our error handler is attached before userland ones.\n\n\n prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once.\n\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n\n dest.once('close', onclose);\n\n function onfinish() {\n debug('onfinish');\n dest.removeListener('close', onclose);\n unpipe();\n }\n\n dest.once('finish', onfinish);\n\n function unpipe() {\n debug('unpipe');\n src.unpipe(dest);\n } // tell the dest that it's being piped to\n\n\n dest.emit('pipe', src); // start the flow if it hasn't been started already.\n\n if (!state.flowing) {\n debug('pipe resume');\n src.resume();\n }\n\n return dest;\n};\n\nfunction pipeOnDrain(src) {\n return function pipeOnDrainFunctionResult() {\n var state = src._readableState;\n debug('pipeOnDrain', state.awaitDrain);\n if (state.awaitDrain) state.awaitDrain--;\n\n if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {\n state.flowing = true;\n flow(src);\n }\n };\n}\n\nReadable.prototype.unpipe = function (dest) {\n var state = this._readableState;\n var unpipeInfo = {\n hasUnpiped: false\n }; // if we're not piping anywhere, then do nothing.\n\n if (state.pipesCount === 0) return this; // just one destination. most common case.\n\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes) return this;\n if (!dest) dest = state.pipes; // got a match.\n\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest) dest.emit('unpipe', this, unpipeInfo);\n return this;\n } // slow case. multiple pipe destinations.\n\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n\n for (var i = 0; i < len; i++) {\n dests[i].emit('unpipe', this, {\n hasUnpiped: false\n });\n }\n\n return this;\n } // try to find the right one.\n\n\n var index = indexOf(state.pipes, dest);\n if (index === -1) return this;\n state.pipes.splice(index, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1) state.pipes = state.pipes[0];\n dest.emit('unpipe', this, unpipeInfo);\n return this;\n}; // set up data events if they are asked for\n// Ensure readable listeners eventually get something\n\n\nReadable.prototype.on = function (ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n var state = this._readableState;\n\n if (ev === 'data') {\n // update readableListening so that resume() may be a no-op\n // a few lines down. This is needed to support once('readable').\n state.readableListening = this.listenerCount('readable') > 0; // Try start flowing on next tick if stream isn't explicitly paused\n\n if (state.flowing !== false) this.resume();\n } else if (ev === 'readable') {\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true;\n state.flowing = false;\n state.emittedReadable = false;\n debug('on readable', state.length, state.reading);\n\n if (state.length) {\n emitReadable(this);\n } else if (!state.reading) {\n process.nextTick(nReadingNextTick, this);\n }\n }\n }\n\n return res;\n};\n\nReadable.prototype.addListener = Readable.prototype.on;\n\nReadable.prototype.removeListener = function (ev, fn) {\n var res = Stream.prototype.removeListener.call(this, ev, fn);\n\n if (ev === 'readable') {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this);\n }\n\n return res;\n};\n\nReadable.prototype.removeAllListeners = function (ev) {\n var res = Stream.prototype.removeAllListeners.apply(this, arguments);\n\n if (ev === 'readable' || ev === undefined) {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this);\n }\n\n return res;\n};\n\nfunction updateReadableListening(self) {\n var state = self._readableState;\n state.readableListening = self.listenerCount('readable') > 0;\n\n if (state.resumeScheduled && !state.paused) {\n // flowing needs to be set to true now, otherwise\n // the upcoming resume will not flow.\n state.flowing = true; // crude way to check if we should resume\n } else if (self.listenerCount('data') > 0) {\n self.resume();\n }\n}\n\nfunction nReadingNextTick(self) {\n debug('readable nexttick read 0');\n self.read(0);\n} // pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\n\n\nReadable.prototype.resume = function () {\n var state = this._readableState;\n\n if (!state.flowing) {\n debug('resume'); // we flow only if there is no one listening\n // for readable, but we still have to call\n // resume()\n\n state.flowing = !state.readableListening;\n resume(this, state);\n }\n\n state.paused = false;\n return this;\n};\n\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n process.nextTick(resume_, stream, state);\n }\n}\n\nfunction resume_(stream, state) {\n debug('resume', state.reading);\n\n if (!state.reading) {\n stream.read(0);\n }\n\n state.resumeScheduled = false;\n stream.emit('resume');\n flow(stream);\n if (state.flowing && !state.reading) stream.read(0);\n}\n\nReadable.prototype.pause = function () {\n debug('call pause flowing=%j', this._readableState.flowing);\n\n if (this._readableState.flowing !== false) {\n debug('pause');\n this._readableState.flowing = false;\n this.emit('pause');\n }\n\n this._readableState.paused = true;\n return this;\n};\n\nfunction flow(stream) {\n var state = stream._readableState;\n debug('flow', state.flowing);\n\n while (state.flowing && stream.read() !== null) {\n ;\n }\n} // wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\n\n\nReadable.prototype.wrap = function (stream) {\n var _this = this;\n\n var state = this._readableState;\n var paused = false;\n stream.on('end', function () {\n debug('wrapped end');\n\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) _this.push(chunk);\n }\n\n _this.push(null);\n });\n stream.on('data', function (chunk) {\n debug('wrapped data');\n if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode\n\n if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;\n\n var ret = _this.push(chunk);\n\n if (!ret) {\n paused = true;\n stream.pause();\n }\n }); // proxy all the other methods.\n // important when wrapping filters and duplexes.\n\n for (var i in stream) {\n if (this[i] === undefined && typeof stream[i] === 'function') {\n this[i] = function methodWrap(method) {\n return function methodWrapReturnFunction() {\n return stream[method].apply(stream, arguments);\n };\n }(i);\n }\n } // proxy certain important events.\n\n\n for (var n = 0; n < kProxyEvents.length; n++) {\n stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));\n } // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n\n\n this._read = function (n) {\n debug('wrapped _read', n);\n\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n\n return this;\n};\n\nif (typeof Symbol === 'function') {\n Readable.prototype[Symbol.asyncIterator] = function () {\n if (createReadableStreamAsyncIterator === undefined) {\n createReadableStreamAsyncIterator = require('./internal/streams/async_iterator');\n }\n\n return createReadableStreamAsyncIterator(this);\n };\n}\n\nObject.defineProperty(Readable.prototype, 'readableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.highWaterMark;\n }\n});\nObject.defineProperty(Readable.prototype, 'readableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState && this._readableState.buffer;\n }\n});\nObject.defineProperty(Readable.prototype, 'readableFlowing', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.flowing;\n },\n set: function set(state) {\n if (this._readableState) {\n this._readableState.flowing = state;\n }\n }\n}); // exposed for testing purposes only.\n\nReadable._fromList = fromList;\nObject.defineProperty(Readable.prototype, 'readableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.length;\n }\n}); // Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\n\nfunction fromList(n, state) {\n // nothing buffered\n if (state.length === 0) return null;\n var ret;\n if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {\n // read it all, truncate the list\n if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else {\n // read part of list\n ret = state.buffer.consume(n, state.decoder);\n }\n return ret;\n}\n\nfunction endReadable(stream) {\n var state = stream._readableState;\n debug('endReadable', state.endEmitted);\n\n if (!state.endEmitted) {\n state.ended = true;\n process.nextTick(endReadableNT, state, stream);\n }\n}\n\nfunction endReadableNT(state, stream) {\n debug('endReadableNT', state.endEmitted, state.length); // Check that we didn't get one last unshift.\n\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the writable side is ready for autoDestroy as well\n var wState = stream._writableState;\n\n if (!wState || wState.autoDestroy && wState.finished) {\n stream.destroy();\n }\n }\n }\n}\n\nif (typeof Symbol === 'function') {\n Readable.from = function (iterable, opts) {\n if (from === undefined) {\n from = require('./internal/streams/from');\n }\n\n return from(Readable, iterable, opts);\n };\n}\n\nfunction indexOf(xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n\n return -1;\n}","/*******************************************************************************\n * Copyright (c) 2013 IBM Corp.\n *\n * All rights reserved. This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v1.0\n * and Eclipse Distribution License v1.0 which accompany this distribution.\n *\n * The Eclipse Public License is available at\n * http://www.eclipse.org/legal/epl-v10.html\n * and the Eclipse Distribution License is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * Contributors:\n * Andrew Banks - initial API and implementation and initial documentation\n *******************************************************************************/\n// Only expose a single object name in the global namespace.\n// Everything must go through this module. Global Paho module\n// only has a single public function, client, which returns\n// a Paho client object given connection details.\n\n/**\n * Send and receive messages using web browsers.\n *
\n * This programming interface lets a JavaScript client application use the MQTT V3.1 or\n * V3.1.1 protocol to connect to an MQTT-supporting messaging server.\n *\n * The function supported includes:\n *
\n *
Connecting to and disconnecting from a server. The server is identified by its host name and port number.\n *
Specifying options that relate to the communications link with the server,\n * for example the frequency of keep-alive heartbeats, and whether SSL/TLS is required.\n *
Subscribing to and receiving messages from MQTT Topics.\n *
Publishing messages to MQTT Topics.\n *
\n *
\n * The API consists of two main objects:\n *
\n *
{@link Paho.Client}
\n *
This contains methods that provide the functionality of the API,\n * including provision of callbacks that notify the application when a message\n * arrives from or is delivered to the messaging server,\n * or when the status of its connection to the messaging server changes.
\n *
{@link Paho.Message}
\n *
This encapsulates the payload of the message along with various attributes\n * associated with its delivery, in particular the destination to which it has\n * been (or is about to be) sent.
\n *
\n *
\n * The programming interface validates parameters passed to it, and will throw\n * an Error containing an error message intended for developer use, if it detects\n * an error with any parameter.\n *
\n * Example:\n *\n *
\nvar client = new Paho.MQTT.Client(location.hostname, Number(location.port), \"clientId\");\nclient.onConnectionLost = onConnectionLost;\nclient.onMessageArrived = onMessageArrived;\nclient.connect({onSuccess:onConnect});\n\nfunction onConnect() {\n // Once a connection has been made, make a subscription and send a message.\n console.log(\"onConnect\");\n client.subscribe(\"/World\");\n var message = new Paho.MQTT.Message(\"Hello\");\n message.destinationName = \"/World\";\n client.send(message);\n};\nfunction onConnectionLost(responseObject) {\n if (responseObject.errorCode !== 0)\n\tconsole.log(\"onConnectionLost:\"+responseObject.errorMessage);\n};\nfunction onMessageArrived(message) {\n console.log(\"onMessageArrived:\"+message.payloadString);\n client.disconnect();\n};\n *
\n * @namespace Paho\n */\n\n/* jshint shadow:true */\n(function ExportLibrary(root, factory) {\n if (typeof exports === \"object\" && typeof module === \"object\") {\n module.exports = factory();\n } else if (typeof define === \"function\" && define.amd) {\n define(factory);\n } else if (typeof exports === \"object\") {\n exports = factory();\n } else {\n //if (typeof root.Paho === \"undefined\"){\n //\troot.Paho = {};\n //}\n root.Paho = factory();\n }\n})(this, function LibraryFactory() {\n var PahoMQTT = function (global) {\n // Private variables below, these are only visible inside the function closure\n // which is used to define the module.\n var version = \"@VERSION@-@BUILDLEVEL@\";\n /**\n * @private\n */\n\n var localStorage = global.localStorage || function () {\n var data = {};\n return {\n setItem: function setItem(key, item) {\n data[key] = item;\n },\n getItem: function getItem(key) {\n return data[key];\n },\n removeItem: function removeItem(key) {\n delete data[key];\n }\n };\n }();\n /**\n * Unique message type identifiers, with associated\n * associated integer values.\n * @private\n */\n\n\n var MESSAGE_TYPE = {\n CONNECT: 1,\n CONNACK: 2,\n PUBLISH: 3,\n PUBACK: 4,\n PUBREC: 5,\n PUBREL: 6,\n PUBCOMP: 7,\n SUBSCRIBE: 8,\n SUBACK: 9,\n UNSUBSCRIBE: 10,\n UNSUBACK: 11,\n PINGREQ: 12,\n PINGRESP: 13,\n DISCONNECT: 14\n }; // Collection of utility methods used to simplify module code\n // and promote the DRY pattern.\n\n /**\n * Validate an object's parameter names to ensure they\n * match a list of expected variables name for this option\n * type. Used to ensure option object passed into the API don't\n * contain erroneous parameters.\n * @param {Object} obj - User options object\n * @param {Object} keys - valid keys and types that may exist in obj.\n * @throws {Error} Invalid option parameter found.\n * @private\n */\n\n var validate = function validate(obj, keys) {\n for (var key in obj) {\n if (obj.hasOwnProperty(key)) {\n if (keys.hasOwnProperty(key)) {\n if (typeof obj[key] !== keys[key]) throw new Error(format(ERROR.INVALID_TYPE, [typeof obj[key], key]));\n } else {\n var errorStr = \"Unknown property, \" + key + \". Valid properties are:\";\n\n for (var validKey in keys) {\n if (keys.hasOwnProperty(validKey)) errorStr = errorStr + \" \" + validKey;\n }\n\n throw new Error(errorStr);\n }\n }\n }\n };\n /**\n * Return a new function which runs the user function bound\n * to a fixed scope.\n * @param {function} User function\n * @param {object} Function scope\n * @return {function} User function bound to another scope\n * @private\n */\n\n\n var scope = function scope(f, _scope) {\n return function () {\n return f.apply(_scope, arguments);\n };\n };\n /**\n * Unique message type identifiers, with associated\n * associated integer values.\n * @private\n */\n\n\n var ERROR = {\n OK: {\n code: 0,\n text: \"AMQJSC0000I OK.\"\n },\n CONNECT_TIMEOUT: {\n code: 1,\n text: \"AMQJSC0001E Connect timed out.\"\n },\n SUBSCRIBE_TIMEOUT: {\n code: 2,\n text: \"AMQJS0002E Subscribe timed out.\"\n },\n UNSUBSCRIBE_TIMEOUT: {\n code: 3,\n text: \"AMQJS0003E Unsubscribe timed out.\"\n },\n PING_TIMEOUT: {\n code: 4,\n text: \"AMQJS0004E Ping timed out.\"\n },\n INTERNAL_ERROR: {\n code: 5,\n text: \"AMQJS0005E Internal error. Error Message: {0}, Stack trace: {1}\"\n },\n CONNACK_RETURNCODE: {\n code: 6,\n text: \"AMQJS0006E Bad Connack return code:{0} {1}.\"\n },\n SOCKET_ERROR: {\n code: 7,\n text: \"AMQJS0007E Socket error:{0}.\"\n },\n SOCKET_CLOSE: {\n code: 8,\n text: \"AMQJS0008I Socket closed.\"\n },\n MALFORMED_UTF: {\n code: 9,\n text: \"AMQJS0009E Malformed UTF data:{0} {1} {2}.\"\n },\n UNSUPPORTED: {\n code: 10,\n text: \"AMQJS0010E {0} is not supported by this browser.\"\n },\n INVALID_STATE: {\n code: 11,\n text: \"AMQJS0011E Invalid state {0}.\"\n },\n INVALID_TYPE: {\n code: 12,\n text: \"AMQJS0012E Invalid type {0} for {1}.\"\n },\n INVALID_ARGUMENT: {\n code: 13,\n text: \"AMQJS0013E Invalid argument {0} for {1}.\"\n },\n UNSUPPORTED_OPERATION: {\n code: 14,\n text: \"AMQJS0014E Unsupported operation.\"\n },\n INVALID_STORED_DATA: {\n code: 15,\n text: \"AMQJS0015E Invalid data in local storage key={0} value={1}.\"\n },\n INVALID_MQTT_MESSAGE_TYPE: {\n code: 16,\n text: \"AMQJS0016E Invalid MQTT message type {0}.\"\n },\n MALFORMED_UNICODE: {\n code: 17,\n text: \"AMQJS0017E Malformed Unicode string:{0} {1}.\"\n },\n BUFFER_FULL: {\n code: 18,\n text: \"AMQJS0018E Message buffer is full, maximum buffer size: {0}.\"\n }\n };\n /** CONNACK RC Meaning. */\n\n var CONNACK_RC = {\n 0: \"Connection Accepted\",\n 1: \"Connection Refused: unacceptable protocol version\",\n 2: \"Connection Refused: identifier rejected\",\n 3: \"Connection Refused: server unavailable\",\n 4: \"Connection Refused: bad user name or password\",\n 5: \"Connection Refused: not authorized\"\n };\n /**\n * Format an error message text.\n * @private\n * @param {error} ERROR value above.\n * @param {substitutions} [array] substituted into the text.\n * @return the text with the substitutions made.\n */\n\n var format = function format(error, substitutions) {\n var text = error.text;\n\n if (substitutions) {\n var field, start;\n\n for (var i = 0; i < substitutions.length; i++) {\n field = \"{\" + i + \"}\";\n start = text.indexOf(field);\n\n if (start > 0) {\n var part1 = text.substring(0, start);\n var part2 = text.substring(start + field.length);\n text = part1 + substitutions[i] + part2;\n }\n }\n }\n\n return text;\n }; //MQTT protocol and version 6 M Q I s d p 3\n\n\n var MqttProtoIdentifierv3 = [0x00, 0x06, 0x4d, 0x51, 0x49, 0x73, 0x64, 0x70, 0x03]; //MQTT proto/version for 311 4 M Q T T 4\n\n var MqttProtoIdentifierv4 = [0x00, 0x04, 0x4d, 0x51, 0x54, 0x54, 0x04];\n /**\n * Construct an MQTT wire protocol message.\n * @param type MQTT packet type.\n * @param options optional wire message attributes.\n *\n * Optional properties\n *\n * messageIdentifier: message ID in the range [0..65535]\n * payloadMessage:\tApplication Message - PUBLISH only\n * connectStrings:\tarray of 0 or more Strings to be put into the CONNECT payload\n * topics:\t\t\tarray of strings (SUBSCRIBE, UNSUBSCRIBE)\n * requestQoS:\t\tarray of QoS values [0..2]\n *\n * \"Flag\" properties\n * cleanSession:\ttrue if present / false if absent (CONNECT)\n * willMessage: \ttrue if present / false if absent (CONNECT)\n * isRetained:\t\ttrue if present / false if absent (CONNECT)\n * userName:\t\ttrue if present / false if absent (CONNECT)\n * password:\t\ttrue if present / false if absent (CONNECT)\n * keepAliveInterval:\tinteger [0..65535] (CONNECT)\n *\n * @private\n * @ignore\n */\n\n var WireMessage = function WireMessage(type, options) {\n this.type = type;\n\n for (var name in options) {\n if (options.hasOwnProperty(name)) {\n this[name] = options[name];\n }\n }\n };\n\n WireMessage.prototype.encode = function () {\n // Compute the first byte of the fixed header\n var first = (this.type & 0x0f) << 4;\n /*\n * Now calculate the length of the variable header + payload by adding up the lengths\n * of all the component parts\n */\n\n var remLength = 0;\n var topicStrLength = [];\n var destinationNameLength = 0;\n var willMessagePayloadBytes; // if the message contains a messageIdentifier then we need two bytes for that\n\n if (this.messageIdentifier !== undefined) remLength += 2;\n\n switch (this.type) {\n // If this a Connect then we need to include 12 bytes for its header\n case MESSAGE_TYPE.CONNECT:\n switch (this.mqttVersion) {\n case 3:\n remLength += MqttProtoIdentifierv3.length + 3;\n break;\n\n case 4:\n remLength += MqttProtoIdentifierv4.length + 3;\n break;\n }\n\n remLength += UTF8Length(this.clientId) + 2;\n\n if (this.willMessage !== undefined) {\n remLength += UTF8Length(this.willMessage.destinationName) + 2; // Will message is always a string, sent as UTF-8 characters with a preceding length.\n\n willMessagePayloadBytes = this.willMessage.payloadBytes;\n if (!(willMessagePayloadBytes instanceof Uint8Array)) willMessagePayloadBytes = new Uint8Array(payloadBytes);\n remLength += willMessagePayloadBytes.byteLength + 2;\n }\n\n if (this.userName !== undefined) remLength += UTF8Length(this.userName) + 2;\n if (this.password !== undefined) remLength += UTF8Length(this.password) + 2;\n break;\n // Subscribe, Unsubscribe can both contain topic strings\n\n case MESSAGE_TYPE.SUBSCRIBE:\n first |= 0x02; // Qos = 1;\n\n for (var i = 0; i < this.topics.length; i++) {\n topicStrLength[i] = UTF8Length(this.topics[i]);\n remLength += topicStrLength[i] + 2;\n }\n\n remLength += this.requestedQos.length; // 1 byte for each topic's Qos\n // QoS on Subscribe only\n\n break;\n\n case MESSAGE_TYPE.UNSUBSCRIBE:\n first |= 0x02; // Qos = 1;\n\n for (var i = 0; i < this.topics.length; i++) {\n topicStrLength[i] = UTF8Length(this.topics[i]);\n remLength += topicStrLength[i] + 2;\n }\n\n break;\n\n case MESSAGE_TYPE.PUBREL:\n first |= 0x02; // Qos = 1;\n\n break;\n\n case MESSAGE_TYPE.PUBLISH:\n if (this.payloadMessage.duplicate) first |= 0x08;\n first = first |= this.payloadMessage.qos << 1;\n if (this.payloadMessage.retained) first |= 0x01;\n destinationNameLength = UTF8Length(this.payloadMessage.destinationName);\n remLength += destinationNameLength + 2;\n var payloadBytes = this.payloadMessage.payloadBytes;\n remLength += payloadBytes.byteLength;\n if (payloadBytes instanceof ArrayBuffer) payloadBytes = new Uint8Array(payloadBytes);else if (!(payloadBytes instanceof Uint8Array)) payloadBytes = new Uint8Array(payloadBytes.buffer);\n break;\n\n case MESSAGE_TYPE.DISCONNECT:\n break;\n\n default:\n break;\n } // Now we can allocate a buffer for the message\n\n\n var mbi = encodeMBI(remLength); // Convert the length to MQTT MBI format\n\n var pos = mbi.length + 1; // Offset of start of variable header\n\n var buffer = new ArrayBuffer(remLength + pos);\n var byteStream = new Uint8Array(buffer); // view it as a sequence of bytes\n //Write the fixed header into the buffer\n\n byteStream[0] = first;\n byteStream.set(mbi, 1); // If this is a PUBLISH then the variable header starts with a topic\n\n if (this.type == MESSAGE_TYPE.PUBLISH) pos = writeString(this.payloadMessage.destinationName, destinationNameLength, byteStream, pos); // If this is a CONNECT then the variable header contains the protocol name/version, flags and keepalive time\n else if (this.type == MESSAGE_TYPE.CONNECT) {\n switch (this.mqttVersion) {\n case 3:\n byteStream.set(MqttProtoIdentifierv3, pos);\n pos += MqttProtoIdentifierv3.length;\n break;\n\n case 4:\n byteStream.set(MqttProtoIdentifierv4, pos);\n pos += MqttProtoIdentifierv4.length;\n break;\n }\n\n var connectFlags = 0;\n if (this.cleanSession) connectFlags = 0x02;\n\n if (this.willMessage !== undefined) {\n connectFlags |= 0x04;\n connectFlags |= this.willMessage.qos << 3;\n\n if (this.willMessage.retained) {\n connectFlags |= 0x20;\n }\n }\n\n if (this.userName !== undefined) connectFlags |= 0x80;\n if (this.password !== undefined) connectFlags |= 0x40;\n byteStream[pos++] = connectFlags;\n pos = writeUint16(this.keepAliveInterval, byteStream, pos);\n } // Output the messageIdentifier - if there is one\n\n if (this.messageIdentifier !== undefined) pos = writeUint16(this.messageIdentifier, byteStream, pos);\n\n switch (this.type) {\n case MESSAGE_TYPE.CONNECT:\n pos = writeString(this.clientId, UTF8Length(this.clientId), byteStream, pos);\n\n if (this.willMessage !== undefined) {\n pos = writeString(this.willMessage.destinationName, UTF8Length(this.willMessage.destinationName), byteStream, pos);\n pos = writeUint16(willMessagePayloadBytes.byteLength, byteStream, pos);\n byteStream.set(willMessagePayloadBytes, pos);\n pos += willMessagePayloadBytes.byteLength;\n }\n\n if (this.userName !== undefined) pos = writeString(this.userName, UTF8Length(this.userName), byteStream, pos);\n if (this.password !== undefined) pos = writeString(this.password, UTF8Length(this.password), byteStream, pos);\n break;\n\n case MESSAGE_TYPE.PUBLISH:\n // PUBLISH has a text or binary payload, if text do not add a 2 byte length field, just the UTF characters.\n byteStream.set(payloadBytes, pos);\n break;\n // \t case MESSAGE_TYPE.PUBREC:\n // \t case MESSAGE_TYPE.PUBREL:\n // \t case MESSAGE_TYPE.PUBCOMP:\n // \t \tbreak;\n\n case MESSAGE_TYPE.SUBSCRIBE:\n // SUBSCRIBE has a list of topic strings and request QoS\n for (var i = 0; i < this.topics.length; i++) {\n pos = writeString(this.topics[i], topicStrLength[i], byteStream, pos);\n byteStream[pos++] = this.requestedQos[i];\n }\n\n break;\n\n case MESSAGE_TYPE.UNSUBSCRIBE:\n // UNSUBSCRIBE has a list of topic strings\n for (var i = 0; i < this.topics.length; i++) {\n pos = writeString(this.topics[i], topicStrLength[i], byteStream, pos);\n }\n\n break;\n\n default: // Do nothing.\n\n }\n\n return buffer;\n };\n\n function decodeMessage(input, pos) {\n var startingPos = pos;\n var first = input[pos];\n var type = first >> 4;\n var messageInfo = first &= 0x0f;\n pos += 1; // Decode the remaining length (MBI format)\n\n var digit;\n var remLength = 0;\n var multiplier = 1;\n\n do {\n if (pos == input.length) {\n return [null, startingPos];\n }\n\n digit = input[pos++];\n remLength += (digit & 0x7F) * multiplier;\n multiplier *= 128;\n } while ((digit & 0x80) !== 0);\n\n var endPos = pos + remLength;\n\n if (endPos > input.length) {\n return [null, startingPos];\n }\n\n var wireMessage = new WireMessage(type);\n\n switch (type) {\n case MESSAGE_TYPE.CONNACK:\n var connectAcknowledgeFlags = input[pos++];\n if (connectAcknowledgeFlags & 0x01) wireMessage.sessionPresent = true;\n wireMessage.returnCode = input[pos++];\n break;\n\n case MESSAGE_TYPE.PUBLISH:\n var qos = messageInfo >> 1 & 0x03;\n var len = readUint16(input, pos);\n pos += 2;\n var topicName = parseUTF8(input, pos, len);\n pos += len; // If QoS 1 or 2 there will be a messageIdentifier\n\n if (qos > 0) {\n wireMessage.messageIdentifier = readUint16(input, pos);\n pos += 2;\n }\n\n var message = new Message(input.subarray(pos, endPos));\n if ((messageInfo & 0x01) == 0x01) message.retained = true;\n if ((messageInfo & 0x08) == 0x08) message.duplicate = true;\n message.qos = qos;\n message.destinationName = topicName;\n wireMessage.payloadMessage = message;\n break;\n\n case MESSAGE_TYPE.PUBACK:\n case MESSAGE_TYPE.PUBREC:\n case MESSAGE_TYPE.PUBREL:\n case MESSAGE_TYPE.PUBCOMP:\n case MESSAGE_TYPE.UNSUBACK:\n wireMessage.messageIdentifier = readUint16(input, pos);\n break;\n\n case MESSAGE_TYPE.SUBACK:\n wireMessage.messageIdentifier = readUint16(input, pos);\n pos += 2;\n wireMessage.returnCode = input.subarray(pos, endPos);\n break;\n\n default:\n break;\n }\n\n return [wireMessage, endPos];\n }\n\n function writeUint16(input, buffer, offset) {\n buffer[offset++] = input >> 8; //MSB\n\n buffer[offset++] = input % 256; //LSB\n\n return offset;\n }\n\n function writeString(input, utf8Length, buffer, offset) {\n offset = writeUint16(utf8Length, buffer, offset);\n stringToUTF8(input, buffer, offset);\n return offset + utf8Length;\n }\n\n function readUint16(buffer, offset) {\n return 256 * buffer[offset] + buffer[offset + 1];\n }\n /**\n * Encodes an MQTT Multi-Byte Integer\n * @private\n */\n\n\n function encodeMBI(number) {\n var output = new Array(1);\n var numBytes = 0;\n\n do {\n var digit = number % 128;\n number = number >> 7;\n\n if (number > 0) {\n digit |= 0x80;\n }\n\n output[numBytes++] = digit;\n } while (number > 0 && numBytes < 4);\n\n return output;\n }\n /**\n * Takes a String and calculates its length in bytes when encoded in UTF8.\n * @private\n */\n\n\n function UTF8Length(input) {\n var output = 0;\n\n for (var i = 0; i < input.length; i++) {\n var charCode = input.charCodeAt(i);\n\n if (charCode > 0x7FF) {\n // Surrogate pair means its a 4 byte character\n if (0xD800 <= charCode && charCode <= 0xDBFF) {\n i++;\n output++;\n }\n\n output += 3;\n } else if (charCode > 0x7F) output += 2;else output++;\n }\n\n return output;\n }\n /**\n * Takes a String and writes it into an array as UTF8 encoded bytes.\n * @private\n */\n\n\n function stringToUTF8(input, output, start) {\n var pos = start;\n\n for (var i = 0; i < input.length; i++) {\n var charCode = input.charCodeAt(i); // Check for a surrogate pair.\n\n if (0xD800 <= charCode && charCode <= 0xDBFF) {\n var lowCharCode = input.charCodeAt(++i);\n\n if (isNaN(lowCharCode)) {\n throw new Error(format(ERROR.MALFORMED_UNICODE, [charCode, lowCharCode]));\n }\n\n charCode = (charCode - 0xD800 << 10) + (lowCharCode - 0xDC00) + 0x10000;\n }\n\n if (charCode <= 0x7F) {\n output[pos++] = charCode;\n } else if (charCode <= 0x7FF) {\n output[pos++] = charCode >> 6 & 0x1F | 0xC0;\n output[pos++] = charCode & 0x3F | 0x80;\n } else if (charCode <= 0xFFFF) {\n output[pos++] = charCode >> 12 & 0x0F | 0xE0;\n output[pos++] = charCode >> 6 & 0x3F | 0x80;\n output[pos++] = charCode & 0x3F | 0x80;\n } else {\n output[pos++] = charCode >> 18 & 0x07 | 0xF0;\n output[pos++] = charCode >> 12 & 0x3F | 0x80;\n output[pos++] = charCode >> 6 & 0x3F | 0x80;\n output[pos++] = charCode & 0x3F | 0x80;\n }\n }\n\n return output;\n }\n\n function parseUTF8(input, offset, length) {\n var output = \"\";\n var utf16;\n var pos = offset;\n\n while (pos < offset + length) {\n var byte1 = input[pos++];\n if (byte1 < 128) utf16 = byte1;else {\n var byte2 = input[pos++] - 128;\n if (byte2 < 0) throw new Error(format(ERROR.MALFORMED_UTF, [byte1.toString(16), byte2.toString(16), \"\"]));\n if (byte1 < 0xE0) // 2 byte character\n utf16 = 64 * (byte1 - 0xC0) + byte2;else {\n var byte3 = input[pos++] - 128;\n if (byte3 < 0) throw new Error(format(ERROR.MALFORMED_UTF, [byte1.toString(16), byte2.toString(16), byte3.toString(16)]));\n if (byte1 < 0xF0) // 3 byte character\n utf16 = 4096 * (byte1 - 0xE0) + 64 * byte2 + byte3;else {\n var byte4 = input[pos++] - 128;\n if (byte4 < 0) throw new Error(format(ERROR.MALFORMED_UTF, [byte1.toString(16), byte2.toString(16), byte3.toString(16), byte4.toString(16)]));\n if (byte1 < 0xF8) // 4 byte character\n utf16 = 262144 * (byte1 - 0xF0) + 4096 * byte2 + 64 * byte3 + byte4;else // longer encodings are not supported\n throw new Error(format(ERROR.MALFORMED_UTF, [byte1.toString(16), byte2.toString(16), byte3.toString(16), byte4.toString(16)]));\n }\n }\n }\n\n if (utf16 > 0xFFFF) // 4 byte character - express as a surrogate pair\n {\n utf16 -= 0x10000;\n output += String.fromCharCode(0xD800 + (utf16 >> 10)); // lead character\n\n utf16 = 0xDC00 + (utf16 & 0x3FF); // trail character\n }\n\n output += String.fromCharCode(utf16);\n }\n\n return output;\n }\n /**\n * Repeat keepalive requests, monitor responses.\n * @ignore\n */\n\n\n var Pinger = function Pinger(client, keepAliveInterval) {\n this._client = client;\n this._keepAliveInterval = keepAliveInterval * 1000;\n this.isReset = false;\n var pingReq = new WireMessage(MESSAGE_TYPE.PINGREQ).encode();\n\n var doTimeout = function doTimeout(pinger) {\n return function () {\n return doPing.apply(pinger);\n };\n };\n /** @ignore */\n\n\n var doPing = function doPing() {\n if (!this.isReset) {\n this._client._trace(\"Pinger.doPing\", \"Timed out\");\n\n this._client._disconnected(ERROR.PING_TIMEOUT.code, format(ERROR.PING_TIMEOUT));\n } else {\n this.isReset = false;\n\n this._client._trace(\"Pinger.doPing\", \"send PINGREQ\");\n\n this._client.socket.send(pingReq);\n\n this.timeout = setTimeout(doTimeout(this), this._keepAliveInterval);\n }\n };\n\n this.reset = function () {\n this.isReset = true;\n clearTimeout(this.timeout);\n if (this._keepAliveInterval > 0) this.timeout = setTimeout(doTimeout(this), this._keepAliveInterval);\n };\n\n this.cancel = function () {\n clearTimeout(this.timeout);\n };\n };\n /**\n * Monitor request completion.\n * @ignore\n */\n\n\n var Timeout = function Timeout(client, timeoutSeconds, action, args) {\n if (!timeoutSeconds) timeoutSeconds = 30;\n\n var doTimeout = function doTimeout(action, client, args) {\n return function () {\n return action.apply(client, args);\n };\n };\n\n this.timeout = setTimeout(doTimeout(action, client, args), timeoutSeconds * 1000);\n\n this.cancel = function () {\n clearTimeout(this.timeout);\n };\n };\n /**\n * Internal implementation of the Websockets MQTT V3.1 client.\n *\n * @name Paho.ClientImpl @constructor\n * @param {String} host the DNS nameof the webSocket host.\n * @param {Number} port the port number for that host.\n * @param {String} clientId the MQ client identifier.\n */\n\n\n var ClientImpl = function ClientImpl(uri, host, port, path, clientId) {\n // Check dependencies are satisfied in this browser.\n if (!(\"WebSocket\" in global && global.WebSocket !== null)) {\n throw new Error(format(ERROR.UNSUPPORTED, [\"WebSocket\"]));\n }\n\n if (!(\"ArrayBuffer\" in global && global.ArrayBuffer !== null)) {\n throw new Error(format(ERROR.UNSUPPORTED, [\"ArrayBuffer\"]));\n }\n\n this._trace(\"Paho.Client\", uri, host, port, path, clientId);\n\n this.host = host;\n this.port = port;\n this.path = path;\n this.uri = uri;\n this.clientId = clientId;\n this._wsuri = null; // Local storagekeys are qualified with the following string.\n // The conditional inclusion of path in the key is for backward\n // compatibility to when the path was not configurable and assumed to\n // be /mqtt\n\n this._localKey = host + \":\" + port + (path != \"/mqtt\" ? \":\" + path : \"\") + \":\" + clientId + \":\"; // Create private instance-only message queue\n // Internal queue of messages to be sent, in sending order.\n\n this._msg_queue = [];\n this._buffered_msg_queue = []; // Messages we have sent and are expecting a response for, indexed by their respective message ids.\n\n this._sentMessages = {}; // Messages we have received and acknowleged and are expecting a confirm message for\n // indexed by their respective message ids.\n\n this._receivedMessages = {}; // Internal list of callbacks to be executed when messages\n // have been successfully sent over web socket, e.g. disconnect\n // when it doesn't have to wait for ACK, just message is dispatched.\n\n this._notify_msg_sent = {}; // Unique identifier for SEND messages, incrementing\n // counter as messages are sent.\n\n this._message_identifier = 1; // Used to determine the transmission sequence of stored sent messages.\n\n this._sequence = 0; // Load the local state, if any, from the saved version, only restore state relevant to this client.\n\n for (var key in localStorage) {\n if (key.indexOf(\"Sent:\" + this._localKey) === 0 || key.indexOf(\"Received:\" + this._localKey) === 0) this.restore(key);\n }\n }; // Messaging Client public instance members.\n\n\n ClientImpl.prototype.host = null;\n ClientImpl.prototype.port = null;\n ClientImpl.prototype.path = null;\n ClientImpl.prototype.uri = null;\n ClientImpl.prototype.clientId = null; // Messaging Client private instance members.\n\n ClientImpl.prototype.socket = null;\n /* true once we have received an acknowledgement to a CONNECT packet. */\n\n ClientImpl.prototype.connected = false;\n /* The largest message identifier allowed, may not be larger than 2**16 but\n * if set smaller reduces the maximum number of outbound messages allowed.\n */\n\n ClientImpl.prototype.maxMessageIdentifier = 65536;\n ClientImpl.prototype.connectOptions = null;\n ClientImpl.prototype.hostIndex = null;\n ClientImpl.prototype.onConnected = null;\n ClientImpl.prototype.onConnectionLost = null;\n ClientImpl.prototype.onMessageDelivered = null;\n ClientImpl.prototype.onMessageArrived = null;\n ClientImpl.prototype.traceFunction = null;\n ClientImpl.prototype._msg_queue = null;\n ClientImpl.prototype._buffered_msg_queue = null;\n ClientImpl.prototype._connectTimeout = null;\n /* The sendPinger monitors how long we allow before we send data to prove to the server that we are alive. */\n\n ClientImpl.prototype.sendPinger = null;\n /* The receivePinger monitors how long we allow before we require evidence that the server is alive. */\n\n ClientImpl.prototype.receivePinger = null;\n ClientImpl.prototype._reconnectInterval = 1; // Reconnect Delay, starts at 1 second\n\n ClientImpl.prototype._reconnecting = false;\n ClientImpl.prototype._reconnectTimeout = null;\n ClientImpl.prototype.disconnectedPublishing = false;\n ClientImpl.prototype.disconnectedBufferSize = 5000;\n ClientImpl.prototype.receiveBuffer = null;\n ClientImpl.prototype._traceBuffer = null;\n ClientImpl.prototype._MAX_TRACE_ENTRIES = 100;\n\n ClientImpl.prototype.connect = function (connectOptions) {\n var connectOptionsMasked = this._traceMask(connectOptions, \"password\");\n\n this._trace(\"Client.connect\", connectOptionsMasked, this.socket, this.connected);\n\n if (this.connected) throw new Error(format(ERROR.INVALID_STATE, [\"already connected\"]));\n if (this.socket) throw new Error(format(ERROR.INVALID_STATE, [\"already connected\"]));\n\n if (this._reconnecting) {\n // connect() function is called while reconnect is in progress.\n // Terminate the auto reconnect process to use new connect options.\n this._reconnectTimeout.cancel();\n\n this._reconnectTimeout = null;\n this._reconnecting = false;\n }\n\n this.connectOptions = connectOptions;\n this._reconnectInterval = 1;\n this._reconnecting = false;\n\n if (connectOptions.uris) {\n this.hostIndex = 0;\n\n this._doConnect(connectOptions.uris[0]);\n } else {\n this._doConnect(this.uri);\n }\n };\n\n ClientImpl.prototype.subscribe = function (filter, subscribeOptions) {\n this._trace(\"Client.subscribe\", filter, subscribeOptions);\n\n if (!this.connected) throw new Error(format(ERROR.INVALID_STATE, [\"not connected\"]));\n var wireMessage = new WireMessage(MESSAGE_TYPE.SUBSCRIBE);\n wireMessage.topics = filter.constructor === Array ? filter : [filter];\n if (subscribeOptions.qos === undefined) subscribeOptions.qos = 0;\n wireMessage.requestedQos = [];\n\n for (var i = 0; i < wireMessage.topics.length; i++) {\n wireMessage.requestedQos[i] = subscribeOptions.qos;\n }\n\n if (subscribeOptions.onSuccess) {\n wireMessage.onSuccess = function (grantedQos) {\n subscribeOptions.onSuccess({\n invocationContext: subscribeOptions.invocationContext,\n grantedQos: grantedQos\n });\n };\n }\n\n if (subscribeOptions.onFailure) {\n wireMessage.onFailure = function (errorCode) {\n subscribeOptions.onFailure({\n invocationContext: subscribeOptions.invocationContext,\n errorCode: errorCode,\n errorMessage: format(errorCode)\n });\n };\n }\n\n if (subscribeOptions.timeout) {\n wireMessage.timeOut = new Timeout(this, subscribeOptions.timeout, subscribeOptions.onFailure, [{\n invocationContext: subscribeOptions.invocationContext,\n errorCode: ERROR.SUBSCRIBE_TIMEOUT.code,\n errorMessage: format(ERROR.SUBSCRIBE_TIMEOUT)\n }]);\n } // All subscriptions return a SUBACK.\n\n\n this._requires_ack(wireMessage);\n\n this._schedule_message(wireMessage);\n };\n /** @ignore */\n\n\n ClientImpl.prototype.unsubscribe = function (filter, unsubscribeOptions) {\n this._trace(\"Client.unsubscribe\", filter, unsubscribeOptions);\n\n if (!this.connected) throw new Error(format(ERROR.INVALID_STATE, [\"not connected\"]));\n var wireMessage = new WireMessage(MESSAGE_TYPE.UNSUBSCRIBE);\n wireMessage.topics = filter.constructor === Array ? filter : [filter];\n\n if (unsubscribeOptions.onSuccess) {\n wireMessage.callback = function () {\n unsubscribeOptions.onSuccess({\n invocationContext: unsubscribeOptions.invocationContext\n });\n };\n }\n\n if (unsubscribeOptions.timeout) {\n wireMessage.timeOut = new Timeout(this, unsubscribeOptions.timeout, unsubscribeOptions.onFailure, [{\n invocationContext: unsubscribeOptions.invocationContext,\n errorCode: ERROR.UNSUBSCRIBE_TIMEOUT.code,\n errorMessage: format(ERROR.UNSUBSCRIBE_TIMEOUT)\n }]);\n } // All unsubscribes return a SUBACK.\n\n\n this._requires_ack(wireMessage);\n\n this._schedule_message(wireMessage);\n };\n\n ClientImpl.prototype.send = function (message) {\n this._trace(\"Client.send\", message);\n\n var wireMessage = new WireMessage(MESSAGE_TYPE.PUBLISH);\n wireMessage.payloadMessage = message;\n\n if (this.connected) {\n // Mark qos 1 & 2 message as \"ACK required\"\n // For qos 0 message, invoke onMessageDelivered callback if there is one.\n // Then schedule the message.\n if (message.qos > 0) {\n this._requires_ack(wireMessage);\n } else if (this.onMessageDelivered) {\n this._notify_msg_sent[wireMessage] = this.onMessageDelivered(wireMessage.payloadMessage);\n }\n\n this._schedule_message(wireMessage);\n } else {\n // Currently disconnected, will not schedule this message\n // Check if reconnecting is in progress and disconnected publish is enabled.\n if (this._reconnecting && this.disconnectedPublishing) {\n // Check the limit which include the \"required ACK\" messages\n var messageCount = Object.keys(this._sentMessages).length + this._buffered_msg_queue.length;\n\n if (messageCount > this.disconnectedBufferSize) {\n throw new Error(format(ERROR.BUFFER_FULL, [this.disconnectedBufferSize]));\n } else {\n if (message.qos > 0) {\n // Mark this message as \"ACK required\"\n this._requires_ack(wireMessage);\n } else {\n wireMessage.sequence = ++this._sequence; // Add messages in fifo order to array, by adding to start\n\n this._buffered_msg_queue.unshift(wireMessage);\n }\n }\n } else {\n throw new Error(format(ERROR.INVALID_STATE, [\"not connected\"]));\n }\n }\n };\n\n ClientImpl.prototype.disconnect = function () {\n this._trace(\"Client.disconnect\");\n\n if (this._reconnecting) {\n // disconnect() function is called while reconnect is in progress.\n // Terminate the auto reconnect process.\n this._reconnectTimeout.cancel();\n\n this._reconnectTimeout = null;\n this._reconnecting = false;\n }\n\n if (!this.socket) throw new Error(format(ERROR.INVALID_STATE, [\"not connecting or connected\"]));\n var wireMessage = new WireMessage(MESSAGE_TYPE.DISCONNECT); // Run the disconnected call back as soon as the message has been sent,\n // in case of a failure later on in the disconnect processing.\n // as a consequence, the _disconected call back may be run several times.\n\n this._notify_msg_sent[wireMessage] = scope(this._disconnected, this);\n\n this._schedule_message(wireMessage);\n };\n\n ClientImpl.prototype.getTraceLog = function () {\n if (this._traceBuffer !== null) {\n this._trace(\"Client.getTraceLog\", new Date());\n\n this._trace(\"Client.getTraceLog in flight messages\", this._sentMessages.length);\n\n for (var key in this._sentMessages) {\n this._trace(\"_sentMessages \", key, this._sentMessages[key]);\n }\n\n for (var key in this._receivedMessages) {\n this._trace(\"_receivedMessages \", key, this._receivedMessages[key]);\n }\n\n return this._traceBuffer;\n }\n };\n\n ClientImpl.prototype.startTrace = function () {\n if (this._traceBuffer === null) {\n this._traceBuffer = [];\n }\n\n this._trace(\"Client.startTrace\", new Date(), version);\n };\n\n ClientImpl.prototype.stopTrace = function () {\n delete this._traceBuffer;\n };\n\n ClientImpl.prototype._doConnect = function (wsurl) {\n // When the socket is open, this client will send the CONNECT WireMessage using the saved parameters.\n if (this.connectOptions.useSSL) {\n var uriParts = wsurl.split(\":\");\n uriParts[0] = \"wss\";\n wsurl = uriParts.join(\":\");\n }\n\n this._wsuri = wsurl;\n this.connected = false;\n\n if (this.connectOptions.mqttVersion < 4) {\n this.socket = new WebSocket(wsurl, [\"mqttv3.1\"]);\n } else {\n this.socket = new WebSocket(wsurl, [\"mqtt\"]);\n }\n\n this.socket.binaryType = \"arraybuffer\";\n this.socket.onopen = scope(this._on_socket_open, this);\n this.socket.onmessage = scope(this._on_socket_message, this);\n this.socket.onerror = scope(this._on_socket_error, this);\n this.socket.onclose = scope(this._on_socket_close, this);\n this.sendPinger = new Pinger(this, this.connectOptions.keepAliveInterval);\n this.receivePinger = new Pinger(this, this.connectOptions.keepAliveInterval);\n\n if (this._connectTimeout) {\n this._connectTimeout.cancel();\n\n this._connectTimeout = null;\n }\n\n this._connectTimeout = new Timeout(this, this.connectOptions.timeout, this._disconnected, [ERROR.CONNECT_TIMEOUT.code, format(ERROR.CONNECT_TIMEOUT)]);\n }; // Schedule a new message to be sent over the WebSockets\n // connection. CONNECT messages cause WebSocket connection\n // to be started. All other messages are queued internally\n // until this has happened. When WS connection starts, process\n // all outstanding messages.\n\n\n ClientImpl.prototype._schedule_message = function (message) {\n // Add messages in fifo order to array, by adding to start\n this._msg_queue.unshift(message); // Process outstanding messages in the queue if we have an open socket, and have received CONNACK.\n\n\n if (this.connected) {\n this._process_queue();\n }\n };\n\n ClientImpl.prototype.store = function (prefix, wireMessage) {\n var storedMessage = {\n type: wireMessage.type,\n messageIdentifier: wireMessage.messageIdentifier,\n version: 1\n };\n\n switch (wireMessage.type) {\n case MESSAGE_TYPE.PUBLISH:\n if (wireMessage.pubRecReceived) storedMessage.pubRecReceived = true; // Convert the payload to a hex string.\n\n storedMessage.payloadMessage = {};\n var hex = \"\";\n var messageBytes = wireMessage.payloadMessage.payloadBytes;\n\n for (var i = 0; i < messageBytes.length; i++) {\n if (messageBytes[i] <= 0xF) hex = hex + \"0\" + messageBytes[i].toString(16);else hex = hex + messageBytes[i].toString(16);\n }\n\n storedMessage.payloadMessage.payloadHex = hex;\n storedMessage.payloadMessage.qos = wireMessage.payloadMessage.qos;\n storedMessage.payloadMessage.destinationName = wireMessage.payloadMessage.destinationName;\n if (wireMessage.payloadMessage.duplicate) storedMessage.payloadMessage.duplicate = true;\n if (wireMessage.payloadMessage.retained) storedMessage.payloadMessage.retained = true; // Add a sequence number to sent messages.\n\n if (prefix.indexOf(\"Sent:\") === 0) {\n if (wireMessage.sequence === undefined) wireMessage.sequence = ++this._sequence;\n storedMessage.sequence = wireMessage.sequence;\n }\n\n break;\n\n default:\n throw Error(format(ERROR.INVALID_STORED_DATA, [prefix + this._localKey + wireMessage.messageIdentifier, storedMessage]));\n }\n\n localStorage.setItem(prefix + this._localKey + wireMessage.messageIdentifier, JSON.stringify(storedMessage));\n };\n\n ClientImpl.prototype.restore = function (key) {\n var value = localStorage.getItem(key);\n var storedMessage = JSON.parse(value);\n var wireMessage = new WireMessage(storedMessage.type, storedMessage);\n\n switch (storedMessage.type) {\n case MESSAGE_TYPE.PUBLISH:\n // Replace the payload message with a Message object.\n var hex = storedMessage.payloadMessage.payloadHex;\n var buffer = new ArrayBuffer(hex.length / 2);\n var byteStream = new Uint8Array(buffer);\n var i = 0;\n\n while (hex.length >= 2) {\n var x = parseInt(hex.substring(0, 2), 16);\n hex = hex.substring(2, hex.length);\n byteStream[i++] = x;\n }\n\n var payloadMessage = new Message(byteStream);\n payloadMessage.qos = storedMessage.payloadMessage.qos;\n payloadMessage.destinationName = storedMessage.payloadMessage.destinationName;\n if (storedMessage.payloadMessage.duplicate) payloadMessage.duplicate = true;\n if (storedMessage.payloadMessage.retained) payloadMessage.retained = true;\n wireMessage.payloadMessage = payloadMessage;\n break;\n\n default:\n throw Error(format(ERROR.INVALID_STORED_DATA, [key, value]));\n }\n\n if (key.indexOf(\"Sent:\" + this._localKey) === 0) {\n wireMessage.payloadMessage.duplicate = true;\n this._sentMessages[wireMessage.messageIdentifier] = wireMessage;\n } else if (key.indexOf(\"Received:\" + this._localKey) === 0) {\n this._receivedMessages[wireMessage.messageIdentifier] = wireMessage;\n }\n };\n\n ClientImpl.prototype._process_queue = function () {\n var message = null; // Send all queued messages down socket connection\n\n while (message = this._msg_queue.pop()) {\n this._socket_send(message); // Notify listeners that message was successfully sent\n\n\n if (this._notify_msg_sent[message]) {\n this._notify_msg_sent[message]();\n\n delete this._notify_msg_sent[message];\n }\n }\n };\n /**\n * Expect an ACK response for this message. Add message to the set of in progress\n * messages and set an unused identifier in this message.\n * @ignore\n */\n\n\n ClientImpl.prototype._requires_ack = function (wireMessage) {\n var messageCount = Object.keys(this._sentMessages).length;\n if (messageCount > this.maxMessageIdentifier) throw Error(\"Too many messages:\" + messageCount);\n\n while (this._sentMessages[this._message_identifier] !== undefined) {\n this._message_identifier++;\n }\n\n wireMessage.messageIdentifier = this._message_identifier;\n this._sentMessages[wireMessage.messageIdentifier] = wireMessage;\n\n if (wireMessage.type === MESSAGE_TYPE.PUBLISH) {\n this.store(\"Sent:\", wireMessage);\n }\n\n if (this._message_identifier === this.maxMessageIdentifier) {\n this._message_identifier = 1;\n }\n };\n /**\n * Called when the underlying websocket has been opened.\n * @ignore\n */\n\n\n ClientImpl.prototype._on_socket_open = function () {\n // Create the CONNECT message object.\n var wireMessage = new WireMessage(MESSAGE_TYPE.CONNECT, this.connectOptions);\n wireMessage.clientId = this.clientId;\n\n this._socket_send(wireMessage);\n };\n /**\n * Called when the underlying websocket has received a complete packet.\n * @ignore\n */\n\n\n ClientImpl.prototype._on_socket_message = function (event) {\n this._trace(\"Client._on_socket_message\", event.data);\n\n var messages = this._deframeMessages(event.data);\n\n for (var i = 0; i < messages.length; i += 1) {\n this._handleMessage(messages[i]);\n }\n };\n\n ClientImpl.prototype._deframeMessages = function (data) {\n var byteArray = new Uint8Array(data);\n var messages = [];\n\n if (this.receiveBuffer) {\n var newData = new Uint8Array(this.receiveBuffer.length + byteArray.length);\n newData.set(this.receiveBuffer);\n newData.set(byteArray, this.receiveBuffer.length);\n byteArray = newData;\n delete this.receiveBuffer;\n }\n\n try {\n var offset = 0;\n\n while (offset < byteArray.length) {\n var result = decodeMessage(byteArray, offset);\n var wireMessage = result[0];\n offset = result[1];\n\n if (wireMessage !== null) {\n messages.push(wireMessage);\n } else {\n break;\n }\n }\n\n if (offset < byteArray.length) {\n this.receiveBuffer = byteArray.subarray(offset);\n }\n } catch (error) {\n var errorStack = error.hasOwnProperty(\"stack\") == \"undefined\" ? error.stack.toString() : \"No Error Stack Available\";\n\n this._disconnected(ERROR.INTERNAL_ERROR.code, format(ERROR.INTERNAL_ERROR, [error.message, errorStack]));\n\n return;\n }\n\n return messages;\n };\n\n ClientImpl.prototype._handleMessage = function (wireMessage) {\n this._trace(\"Client._handleMessage\", wireMessage);\n\n try {\n switch (wireMessage.type) {\n case MESSAGE_TYPE.CONNACK:\n this._connectTimeout.cancel();\n\n if (this._reconnectTimeout) this._reconnectTimeout.cancel(); // If we have started using clean session then clear up the local state.\n\n if (this.connectOptions.cleanSession) {\n for (var key in this._sentMessages) {\n var sentMessage = this._sentMessages[key];\n localStorage.removeItem(\"Sent:\" + this._localKey + sentMessage.messageIdentifier);\n }\n\n this._sentMessages = {};\n\n for (var key in this._receivedMessages) {\n var receivedMessage = this._receivedMessages[key];\n localStorage.removeItem(\"Received:\" + this._localKey + receivedMessage.messageIdentifier);\n }\n\n this._receivedMessages = {};\n } // Client connected and ready for business.\n\n\n if (wireMessage.returnCode === 0) {\n this.connected = true; // Jump to the end of the list of uris and stop looking for a good host.\n\n if (this.connectOptions.uris) this.hostIndex = this.connectOptions.uris.length;\n } else {\n this._disconnected(ERROR.CONNACK_RETURNCODE.code, format(ERROR.CONNACK_RETURNCODE, [wireMessage.returnCode, CONNACK_RC[wireMessage.returnCode]]));\n\n break;\n } // Resend messages.\n\n\n var sequencedMessages = [];\n\n for (var msgId in this._sentMessages) {\n if (this._sentMessages.hasOwnProperty(msgId)) sequencedMessages.push(this._sentMessages[msgId]);\n } // Also schedule qos 0 buffered messages if any\n\n\n if (this._buffered_msg_queue.length > 0) {\n var msg = null;\n\n while (msg = this._buffered_msg_queue.pop()) {\n sequencedMessages.push(msg);\n if (this.onMessageDelivered) this._notify_msg_sent[msg] = this.onMessageDelivered(msg.payloadMessage);\n }\n } // Sort sentMessages into the original sent order.\n\n\n var sequencedMessages = sequencedMessages.sort(function (a, b) {\n return a.sequence - b.sequence;\n });\n\n for (var i = 0, len = sequencedMessages.length; i < len; i++) {\n var sentMessage = sequencedMessages[i];\n\n if (sentMessage.type == MESSAGE_TYPE.PUBLISH && sentMessage.pubRecReceived) {\n var pubRelMessage = new WireMessage(MESSAGE_TYPE.PUBREL, {\n messageIdentifier: sentMessage.messageIdentifier\n });\n\n this._schedule_message(pubRelMessage);\n } else {\n this._schedule_message(sentMessage);\n }\n } // Execute the connectOptions.onSuccess callback if there is one.\n // Will also now return if this connection was the result of an automatic\n // reconnect and which URI was successfully connected to.\n\n\n if (this.connectOptions.onSuccess) {\n this.connectOptions.onSuccess({\n invocationContext: this.connectOptions.invocationContext\n });\n }\n\n var reconnected = false;\n\n if (this._reconnecting) {\n reconnected = true;\n this._reconnectInterval = 1;\n this._reconnecting = false;\n } // Execute the onConnected callback if there is one.\n\n\n this._connected(reconnected, this._wsuri); // Process all queued messages now that the connection is established.\n\n\n this._process_queue();\n\n break;\n\n case MESSAGE_TYPE.PUBLISH:\n this._receivePublish(wireMessage);\n\n break;\n\n case MESSAGE_TYPE.PUBACK:\n var sentMessage = this._sentMessages[wireMessage.messageIdentifier]; // If this is a re flow of a PUBACK after we have restarted receivedMessage will not exist.\n\n if (sentMessage) {\n delete this._sentMessages[wireMessage.messageIdentifier];\n localStorage.removeItem(\"Sent:\" + this._localKey + wireMessage.messageIdentifier);\n if (this.onMessageDelivered) this.onMessageDelivered(sentMessage.payloadMessage);\n }\n\n break;\n\n case MESSAGE_TYPE.PUBREC:\n var sentMessage = this._sentMessages[wireMessage.messageIdentifier]; // If this is a re flow of a PUBREC after we have restarted receivedMessage will not exist.\n\n if (sentMessage) {\n sentMessage.pubRecReceived = true;\n var pubRelMessage = new WireMessage(MESSAGE_TYPE.PUBREL, {\n messageIdentifier: wireMessage.messageIdentifier\n });\n this.store(\"Sent:\", sentMessage);\n\n this._schedule_message(pubRelMessage);\n }\n\n break;\n\n case MESSAGE_TYPE.PUBREL:\n var receivedMessage = this._receivedMessages[wireMessage.messageIdentifier];\n localStorage.removeItem(\"Received:\" + this._localKey + wireMessage.messageIdentifier); // If this is a re flow of a PUBREL after we have restarted receivedMessage will not exist.\n\n if (receivedMessage) {\n this._receiveMessage(receivedMessage);\n\n delete this._receivedMessages[wireMessage.messageIdentifier];\n } // Always flow PubComp, we may have previously flowed PubComp but the server lost it and restarted.\n\n\n var pubCompMessage = new WireMessage(MESSAGE_TYPE.PUBCOMP, {\n messageIdentifier: wireMessage.messageIdentifier\n });\n\n this._schedule_message(pubCompMessage);\n\n break;\n\n case MESSAGE_TYPE.PUBCOMP:\n var sentMessage = this._sentMessages[wireMessage.messageIdentifier];\n delete this._sentMessages[wireMessage.messageIdentifier];\n localStorage.removeItem(\"Sent:\" + this._localKey + wireMessage.messageIdentifier);\n if (this.onMessageDelivered) this.onMessageDelivered(sentMessage.payloadMessage);\n break;\n\n case MESSAGE_TYPE.SUBACK:\n var sentMessage = this._sentMessages[wireMessage.messageIdentifier];\n\n if (sentMessage) {\n if (sentMessage.timeOut) sentMessage.timeOut.cancel(); // This will need to be fixed when we add multiple topic support\n\n if (wireMessage.returnCode[0] === 0x80) {\n if (sentMessage.onFailure) {\n sentMessage.onFailure(wireMessage.returnCode);\n }\n } else if (sentMessage.onSuccess) {\n sentMessage.onSuccess(wireMessage.returnCode);\n }\n\n delete this._sentMessages[wireMessage.messageIdentifier];\n }\n\n break;\n\n case MESSAGE_TYPE.UNSUBACK:\n var sentMessage = this._sentMessages[wireMessage.messageIdentifier];\n\n if (sentMessage) {\n if (sentMessage.timeOut) sentMessage.timeOut.cancel();\n\n if (sentMessage.callback) {\n sentMessage.callback();\n }\n\n delete this._sentMessages[wireMessage.messageIdentifier];\n }\n\n break;\n\n case MESSAGE_TYPE.PINGRESP:\n /* The sendPinger or receivePinger may have sent a ping, the receivePinger has already been reset. */\n this.sendPinger.reset();\n break;\n\n case MESSAGE_TYPE.DISCONNECT:\n // Clients do not expect to receive disconnect packets.\n this._disconnected(ERROR.INVALID_MQTT_MESSAGE_TYPE.code, format(ERROR.INVALID_MQTT_MESSAGE_TYPE, [wireMessage.type]));\n\n break;\n\n default:\n this._disconnected(ERROR.INVALID_MQTT_MESSAGE_TYPE.code, format(ERROR.INVALID_MQTT_MESSAGE_TYPE, [wireMessage.type]));\n\n }\n } catch (error) {\n var errorStack = error.hasOwnProperty(\"stack\") == \"undefined\" ? error.stack.toString() : \"No Error Stack Available\";\n\n this._disconnected(ERROR.INTERNAL_ERROR.code, format(ERROR.INTERNAL_ERROR, [error.message, errorStack]));\n\n return;\n }\n };\n /** @ignore */\n\n\n ClientImpl.prototype._on_socket_error = function (error) {\n if (!this._reconnecting) {\n this._disconnected(ERROR.SOCKET_ERROR.code, format(ERROR.SOCKET_ERROR, [error.data]));\n }\n };\n /** @ignore */\n\n\n ClientImpl.prototype._on_socket_close = function () {\n if (!this._reconnecting) {\n this._disconnected(ERROR.SOCKET_CLOSE.code, format(ERROR.SOCKET_CLOSE));\n }\n };\n /** @ignore */\n\n\n ClientImpl.prototype._socket_send = function (wireMessage) {\n if (wireMessage.type == 1) {\n var wireMessageMasked = this._traceMask(wireMessage, \"password\");\n\n this._trace(\"Client._socket_send\", wireMessageMasked);\n } else this._trace(\"Client._socket_send\", wireMessage);\n\n this.socket.send(wireMessage.encode());\n /* We have proved to the server we are alive. */\n\n this.sendPinger.reset();\n };\n /** @ignore */\n\n\n ClientImpl.prototype._receivePublish = function (wireMessage) {\n switch (wireMessage.payloadMessage.qos) {\n case \"undefined\":\n case 0:\n this._receiveMessage(wireMessage);\n\n break;\n\n case 1:\n var pubAckMessage = new WireMessage(MESSAGE_TYPE.PUBACK, {\n messageIdentifier: wireMessage.messageIdentifier\n });\n\n this._schedule_message(pubAckMessage);\n\n this._receiveMessage(wireMessage);\n\n break;\n\n case 2:\n this._receivedMessages[wireMessage.messageIdentifier] = wireMessage;\n this.store(\"Received:\", wireMessage);\n var pubRecMessage = new WireMessage(MESSAGE_TYPE.PUBREC, {\n messageIdentifier: wireMessage.messageIdentifier\n });\n\n this._schedule_message(pubRecMessage);\n\n break;\n\n default:\n throw Error(\"Invaild qos=\" + wireMessage.payloadMessage.qos);\n }\n };\n /** @ignore */\n\n\n ClientImpl.prototype._receiveMessage = function (wireMessage) {\n if (this.onMessageArrived) {\n this.onMessageArrived(wireMessage.payloadMessage);\n }\n };\n /**\n * Client has connected.\n * @param {reconnect} [boolean] indicate if this was a result of reconnect operation.\n * @param {uri} [string] fully qualified WebSocket URI of the server.\n */\n\n\n ClientImpl.prototype._connected = function (reconnect, uri) {\n // Execute the onConnected callback if there is one.\n if (this.onConnected) this.onConnected(reconnect, uri);\n };\n /**\n * Attempts to reconnect the client to the server.\n * For each reconnect attempt, will double the reconnect interval\n * up to 128 seconds.\n */\n\n\n ClientImpl.prototype._reconnect = function () {\n this._trace(\"Client._reconnect\");\n\n if (!this.connected) {\n this._reconnecting = true;\n this.sendPinger.cancel();\n this.receivePinger.cancel();\n if (this._reconnectInterval < 128) this._reconnectInterval = this._reconnectInterval * 2;\n\n if (this.connectOptions.uris) {\n this.hostIndex = 0;\n\n this._doConnect(this.connectOptions.uris[0]);\n } else {\n this._doConnect(this.uri);\n }\n }\n };\n /**\n * Client has disconnected either at its own request or because the server\n * or network disconnected it. Remove all non-durable state.\n * @param {errorCode} [number] the error number.\n * @param {errorText} [string] the error text.\n * @ignore\n */\n\n\n ClientImpl.prototype._disconnected = function (errorCode, errorText) {\n this._trace(\"Client._disconnected\", errorCode, errorText);\n\n if (errorCode !== undefined && this._reconnecting) {\n //Continue automatic reconnect process\n this._reconnectTimeout = new Timeout(this, this._reconnectInterval, this._reconnect);\n return;\n }\n\n this.sendPinger.cancel();\n this.receivePinger.cancel();\n\n if (this._connectTimeout) {\n this._connectTimeout.cancel();\n\n this._connectTimeout = null;\n } // Clear message buffers.\n\n\n this._msg_queue = [];\n this._buffered_msg_queue = [];\n this._notify_msg_sent = {};\n\n if (this.socket) {\n // Cancel all socket callbacks so that they cannot be driven again by this socket.\n this.socket.onopen = null;\n this.socket.onmessage = null;\n this.socket.onerror = null;\n this.socket.onclose = null;\n if (this.socket.readyState === 1) this.socket.close();\n delete this.socket;\n }\n\n if (this.connectOptions.uris && this.hostIndex < this.connectOptions.uris.length - 1) {\n // Try the next host.\n this.hostIndex++;\n\n this._doConnect(this.connectOptions.uris[this.hostIndex]);\n } else {\n if (errorCode === undefined) {\n errorCode = ERROR.OK.code;\n errorText = format(ERROR.OK);\n } // Run any application callbacks last as they may attempt to reconnect and hence create a new socket.\n\n\n if (this.connected) {\n this.connected = false; // Execute the connectionLostCallback if there is one, and we were connected.\n\n if (this.onConnectionLost) {\n this.onConnectionLost({\n errorCode: errorCode,\n errorMessage: errorText,\n reconnect: this.connectOptions.reconnect,\n uri: this._wsuri\n });\n }\n\n if (errorCode !== ERROR.OK.code && this.connectOptions.reconnect) {\n // Start automatic reconnect process for the very first time since last successful connect.\n this._reconnectInterval = 1;\n\n this._reconnect();\n\n return;\n }\n } else {\n // Otherwise we never had a connection, so indicate that the connect has failed.\n if (this.connectOptions.mqttVersion === 4 && this.connectOptions.mqttVersionExplicit === false) {\n this._trace(\"Failed to connect V4, dropping back to V3\");\n\n this.connectOptions.mqttVersion = 3;\n\n if (this.connectOptions.uris) {\n this.hostIndex = 0;\n\n this._doConnect(this.connectOptions.uris[0]);\n } else {\n this._doConnect(this.uri);\n }\n } else if (this.connectOptions.onFailure) {\n this.connectOptions.onFailure({\n invocationContext: this.connectOptions.invocationContext,\n errorCode: errorCode,\n errorMessage: errorText\n });\n }\n }\n }\n };\n /** @ignore */\n\n\n ClientImpl.prototype._trace = function () {\n // Pass trace message back to client's callback function\n if (this.traceFunction) {\n var args = Array.prototype.slice.call(arguments);\n\n for (var i in args) {\n if (typeof args[i] !== \"undefined\") args.splice(i, 1, JSON.stringify(args[i]));\n }\n\n var record = args.join(\"\");\n this.traceFunction({\n severity: \"Debug\",\n message: record\n });\n } //buffer style trace\n\n\n if (this._traceBuffer !== null) {\n for (var i = 0, max = arguments.length; i < max; i++) {\n if (this._traceBuffer.length == this._MAX_TRACE_ENTRIES) {\n this._traceBuffer.shift();\n }\n\n if (i === 0) this._traceBuffer.push(arguments[i]);else if (typeof arguments[i] === \"undefined\") this._traceBuffer.push(arguments[i]);else this._traceBuffer.push(\" \" + JSON.stringify(arguments[i]));\n }\n }\n };\n /** @ignore */\n\n\n ClientImpl.prototype._traceMask = function (traceObject, masked) {\n var traceObjectMasked = {};\n\n for (var attr in traceObject) {\n if (traceObject.hasOwnProperty(attr)) {\n if (attr == masked) traceObjectMasked[attr] = \"******\";else traceObjectMasked[attr] = traceObject[attr];\n }\n }\n\n return traceObjectMasked;\n }; // ------------------------------------------------------------------------\n // Public Programming interface.\n // ------------------------------------------------------------------------\n\n /**\n * The JavaScript application communicates to the server using a {@link Paho.Client} object.\n *
\n * Most applications will create just one Client object and then call its connect() method,\n * however applications can create more than one Client object if they wish.\n * In this case the combination of host, port and clientId attributes must be different for each Client object.\n *
\n * The send, subscribe and unsubscribe methods are implemented as asynchronous JavaScript methods\n * (even though the underlying protocol exchange might be synchronous in nature).\n * This means they signal their completion by calling back to the application,\n * via Success or Failure callback functions provided by the application on the method in question.\n * Such callbacks are called at most once per method invocation and do not persist beyond the lifetime\n * of the script that made the invocation.\n *
\n * In contrast there are some callback functions, most notably onMessageArrived,\n * that are defined on the {@link Paho.Client} object.\n * These may get called multiple times, and aren't directly related to specific method invocations made by the client.\n *\n * @name Paho.Client\n *\n * @constructor\n *\n * @param {string} host - the address of the messaging server, as a fully qualified WebSocket URI, as a DNS name or dotted decimal IP address.\n * @param {number} port - the port number to connect to - only required if host is not a URI\n * @param {string} path - the path on the host to connect to - only used if host is not a URI. Default: '/mqtt'.\n * @param {string} clientId - the Messaging client identifier, between 1 and 23 characters in length.\n *\n * @property {string} host - read only the server's DNS hostname or dotted decimal IP address.\n * @property {number} port - read only the server's port.\n * @property {string} path - read only the server's path.\n * @property {string} clientId - read only used when connecting to the server.\n * @property {function} onConnectionLost - called when a connection has been lost.\n * after a connect() method has succeeded.\n * Establish the call back used when a connection has been lost. The connection may be\n * lost because the client initiates a disconnect or because the server or network\n * cause the client to be disconnected. The disconnect call back may be called without\n * the connectionComplete call back being invoked if, for example the client fails to\n * connect.\n * A single response object parameter is passed to the onConnectionLost callback containing the following fields:\n *
\n *
errorCode\n *
errorMessage\n *
\n * @property {function} onMessageDelivered - called when a message has been delivered.\n * All processing that this Client will ever do has been completed. So, for example,\n * in the case of a Qos=2 message sent by this client, the PubComp flow has been received from the server\n * and the message has been removed from persistent storage before this callback is invoked.\n * Parameters passed to the onMessageDelivered callback are:\n * \n *
{@link Paho.Message} that was delivered.\n *
\n * @property {function} onMessageArrived - called when a message has arrived in this Paho.client.\n * Parameters passed to the onMessageArrived callback are:\n * \n *
{@link Paho.Message} that has arrived.\n *
\n * @property {function} onConnected - called when a connection is successfully made to the server.\n * after a connect() method.\n * Parameters passed to the onConnected callback are:\n * \n *
reconnect (boolean) - If true, the connection was the result of a reconnect.
\n *
URI (string) - The URI used to connect to the server.
\n * \n * @property {boolean} disconnectedPublishing - if set, will enable disconnected publishing in\n * in the event that the connection to the server is lost.\n * @property {number} disconnectedBufferSize - Used to set the maximum number of messages that the disconnected\n * buffer will hold before rejecting new messages. Default size: 5000 messages\n * @property {function} trace - called whenever trace is called. TODO\n */\n\n\n var Client = function Client(host, port, path, clientId) {\n var uri;\n if (typeof host !== \"string\") throw new Error(format(ERROR.INVALID_TYPE, [typeof host, \"host\"]));\n\n if (arguments.length == 2) {\n // host: must be full ws:// uri\n // port: clientId\n clientId = port;\n uri = host;\n var match = uri.match(/^(wss?):\\/\\/((\\[(.+)\\])|([^\\/]+?))(:(\\d+))?(\\/.*)$/);\n\n if (match) {\n host = match[4] || match[2];\n port = parseInt(match[7]);\n path = match[8];\n } else {\n throw new Error(format(ERROR.INVALID_ARGUMENT, [host, \"host\"]));\n }\n } else {\n if (arguments.length == 3) {\n clientId = path;\n path = \"/mqtt\";\n }\n\n if (typeof port !== \"number\" || port < 0) throw new Error(format(ERROR.INVALID_TYPE, [typeof port, \"port\"]));\n if (typeof path !== \"string\") throw new Error(format(ERROR.INVALID_TYPE, [typeof path, \"path\"]));\n var ipv6AddSBracket = host.indexOf(\":\") !== -1 && host.slice(0, 1) !== \"[\" && host.slice(-1) !== \"]\";\n uri = \"ws://\" + (ipv6AddSBracket ? \"[\" + host + \"]\" : host) + \":\" + port + path;\n }\n\n var clientIdLength = 0;\n\n for (var i = 0; i < clientId.length; i++) {\n var charCode = clientId.charCodeAt(i);\n\n if (0xD800 <= charCode && charCode <= 0xDBFF) {\n i++; // Surrogate pair.\n }\n\n clientIdLength++;\n }\n\n if (typeof clientId !== \"string\" || clientIdLength > 65535) throw new Error(format(ERROR.INVALID_ARGUMENT, [clientId, \"clientId\"]));\n var client = new ClientImpl(uri, host, port, path, clientId); //Public Properties\n\n Object.defineProperties(this, {\n \"host\": {\n get: function get() {\n return host;\n },\n set: function set() {\n throw new Error(format(ERROR.UNSUPPORTED_OPERATION));\n }\n },\n \"port\": {\n get: function get() {\n return port;\n },\n set: function set() {\n throw new Error(format(ERROR.UNSUPPORTED_OPERATION));\n }\n },\n \"path\": {\n get: function get() {\n return path;\n },\n set: function set() {\n throw new Error(format(ERROR.UNSUPPORTED_OPERATION));\n }\n },\n \"uri\": {\n get: function get() {\n return uri;\n },\n set: function set() {\n throw new Error(format(ERROR.UNSUPPORTED_OPERATION));\n }\n },\n \"clientId\": {\n get: function get() {\n return client.clientId;\n },\n set: function set() {\n throw new Error(format(ERROR.UNSUPPORTED_OPERATION));\n }\n },\n \"onConnected\": {\n get: function get() {\n return client.onConnected;\n },\n set: function set(newOnConnected) {\n if (typeof newOnConnected === \"function\") client.onConnected = newOnConnected;else throw new Error(format(ERROR.INVALID_TYPE, [typeof newOnConnected, \"onConnected\"]));\n }\n },\n \"disconnectedPublishing\": {\n get: function get() {\n return client.disconnectedPublishing;\n },\n set: function set(newDisconnectedPublishing) {\n client.disconnectedPublishing = newDisconnectedPublishing;\n }\n },\n \"disconnectedBufferSize\": {\n get: function get() {\n return client.disconnectedBufferSize;\n },\n set: function set(newDisconnectedBufferSize) {\n client.disconnectedBufferSize = newDisconnectedBufferSize;\n }\n },\n \"onConnectionLost\": {\n get: function get() {\n return client.onConnectionLost;\n },\n set: function set(newOnConnectionLost) {\n if (typeof newOnConnectionLost === \"function\") client.onConnectionLost = newOnConnectionLost;else throw new Error(format(ERROR.INVALID_TYPE, [typeof newOnConnectionLost, \"onConnectionLost\"]));\n }\n },\n \"onMessageDelivered\": {\n get: function get() {\n return client.onMessageDelivered;\n },\n set: function set(newOnMessageDelivered) {\n if (typeof newOnMessageDelivered === \"function\") client.onMessageDelivered = newOnMessageDelivered;else throw new Error(format(ERROR.INVALID_TYPE, [typeof newOnMessageDelivered, \"onMessageDelivered\"]));\n }\n },\n \"onMessageArrived\": {\n get: function get() {\n return client.onMessageArrived;\n },\n set: function set(newOnMessageArrived) {\n if (typeof newOnMessageArrived === \"function\") client.onMessageArrived = newOnMessageArrived;else throw new Error(format(ERROR.INVALID_TYPE, [typeof newOnMessageArrived, \"onMessageArrived\"]));\n }\n },\n \"trace\": {\n get: function get() {\n return client.traceFunction;\n },\n set: function set(trace) {\n if (typeof trace === \"function\") {\n client.traceFunction = trace;\n } else {\n throw new Error(format(ERROR.INVALID_TYPE, [typeof trace, \"onTrace\"]));\n }\n }\n }\n });\n /**\n * Connect this Messaging client to its server.\n *\n * @name Paho.Client#connect\n * @function\n * @param {object} connectOptions - Attributes used with the connection.\n * @param {number} connectOptions.timeout - If the connect has not succeeded within this\n * number of seconds, it is deemed to have failed.\n * The default is 30 seconds.\n * @param {string} connectOptions.userName - Authentication username for this connection.\n * @param {string} connectOptions.password - Authentication password for this connection.\n * @param {Paho.Message} connectOptions.willMessage - sent by the server when the client\n * disconnects abnormally.\n * @param {number} connectOptions.keepAliveInterval - the server disconnects this client if\n * there is no activity for this number of seconds.\n * The default value of 60 seconds is assumed if not set.\n * @param {boolean} connectOptions.cleanSession - if true(default) the client and server\n * persistent state is deleted on successful connect.\n * @param {boolean} connectOptions.useSSL - if present and true, use an SSL Websocket connection.\n * @param {object} connectOptions.invocationContext - passed to the onSuccess callback or onFailure callback.\n * @param {function} connectOptions.onSuccess - called when the connect acknowledgement\n * has been received from the server.\n * A single response object parameter is passed to the onSuccess callback containing the following fields:\n * \n *
invocationContext as passed in to the onSuccess method in the connectOptions.\n *
\n * @param {function} connectOptions.onFailure - called when the connect request has failed or timed out.\n * A single response object parameter is passed to the onFailure callback containing the following fields:\n * \n *
invocationContext as passed in to the onFailure method in the connectOptions.\n *
errorCode a number indicating the nature of the error.\n *
errorMessage text describing the error.\n *
\n * @param {array} connectOptions.hosts - If present this contains either a set of hostnames or fully qualified\n * WebSocket URIs (ws://iot.eclipse.org:80/ws), that are tried in order in place\n * of the host and port paramater on the construtor. The hosts are tried one at at time in order until\n * one of then succeeds.\n * @param {array} connectOptions.ports - If present the set of ports matching the hosts. If hosts contains URIs, this property\n * is not used.\n * @param {boolean} connectOptions.reconnect - Sets whether the client will automatically attempt to reconnect\n * to the server if the connection is lost.\n *
\n *
If set to false, the client will not attempt to automatically reconnect to the server in the event that the\n * connection is lost.
\n *
If set to true, in the event that the connection is lost, the client will attempt to reconnect to the server.\n * It will initially wait 1 second before it attempts to reconnect, for every failed reconnect attempt, the delay\n * will double until it is at 2 minutes at which point the delay will stay at 2 minutes.
\n *
\n * @param {number} connectOptions.mqttVersion - The version of MQTT to use to connect to the MQTT Broker.\n *
\n *
3 - MQTT V3.1
\n *
4 - MQTT V3.1.1
\n *
\n * @param {boolean} connectOptions.mqttVersionExplicit - If set to true, will force the connection to use the\n * selected MQTT Version or will fail to connect.\n * @param {array} connectOptions.uris - If present, should contain a list of fully qualified WebSocket uris\n * (e.g. ws://iot.eclipse.org:80/ws), that are tried in order in place of the host and port parameter of the construtor.\n * The uris are tried one at a time in order until one of them succeeds. Do not use this in conjunction with hosts as\n * the hosts array will be converted to uris and will overwrite this property.\n * @throws {InvalidState} If the client is not in disconnected state. The client must have received connectionLost\n * or disconnected before calling connect for a second or subsequent time.\n */\n\n this.connect = function (connectOptions) {\n connectOptions = connectOptions || {};\n validate(connectOptions, {\n timeout: \"number\",\n userName: \"string\",\n password: \"string\",\n willMessage: \"object\",\n keepAliveInterval: \"number\",\n cleanSession: \"boolean\",\n useSSL: \"boolean\",\n invocationContext: \"object\",\n onSuccess: \"function\",\n onFailure: \"function\",\n hosts: \"object\",\n ports: \"object\",\n reconnect: \"boolean\",\n mqttVersion: \"number\",\n mqttVersionExplicit: \"boolean\",\n uris: \"object\"\n }); // If no keep alive interval is set, assume 60 seconds.\n\n if (connectOptions.keepAliveInterval === undefined) connectOptions.keepAliveInterval = 60;\n\n if (connectOptions.mqttVersion > 4 || connectOptions.mqttVersion < 3) {\n throw new Error(format(ERROR.INVALID_ARGUMENT, [connectOptions.mqttVersion, \"connectOptions.mqttVersion\"]));\n }\n\n if (connectOptions.mqttVersion === undefined) {\n connectOptions.mqttVersionExplicit = false;\n connectOptions.mqttVersion = 4;\n } else {\n connectOptions.mqttVersionExplicit = true;\n } //Check that if password is set, so is username\n\n\n if (connectOptions.password !== undefined && connectOptions.userName === undefined) throw new Error(format(ERROR.INVALID_ARGUMENT, [connectOptions.password, \"connectOptions.password\"]));\n\n if (connectOptions.willMessage) {\n if (!(connectOptions.willMessage instanceof Message)) throw new Error(format(ERROR.INVALID_TYPE, [connectOptions.willMessage, \"connectOptions.willMessage\"])); // The will message must have a payload that can be represented as a string.\n // Cause the willMessage to throw an exception if this is not the case.\n\n connectOptions.willMessage.stringPayload = null;\n if (typeof connectOptions.willMessage.destinationName === \"undefined\") throw new Error(format(ERROR.INVALID_TYPE, [typeof connectOptions.willMessage.destinationName, \"connectOptions.willMessage.destinationName\"]));\n }\n\n if (typeof connectOptions.cleanSession === \"undefined\") connectOptions.cleanSession = true;\n\n if (connectOptions.hosts) {\n if (!(connectOptions.hosts instanceof Array)) throw new Error(format(ERROR.INVALID_ARGUMENT, [connectOptions.hosts, \"connectOptions.hosts\"]));\n if (connectOptions.hosts.length < 1) throw new Error(format(ERROR.INVALID_ARGUMENT, [connectOptions.hosts, \"connectOptions.hosts\"]));\n var usingURIs = false;\n\n for (var i = 0; i < connectOptions.hosts.length; i++) {\n if (typeof connectOptions.hosts[i] !== \"string\") throw new Error(format(ERROR.INVALID_TYPE, [typeof connectOptions.hosts[i], \"connectOptions.hosts[\" + i + \"]\"]));\n\n if (/^(wss?):\\/\\/((\\[(.+)\\])|([^\\/]+?))(:(\\d+))?(\\/.*)$/.test(connectOptions.hosts[i])) {\n if (i === 0) {\n usingURIs = true;\n } else if (!usingURIs) {\n throw new Error(format(ERROR.INVALID_ARGUMENT, [connectOptions.hosts[i], \"connectOptions.hosts[\" + i + \"]\"]));\n }\n } else if (usingURIs) {\n throw new Error(format(ERROR.INVALID_ARGUMENT, [connectOptions.hosts[i], \"connectOptions.hosts[\" + i + \"]\"]));\n }\n }\n\n if (!usingURIs) {\n if (!connectOptions.ports) throw new Error(format(ERROR.INVALID_ARGUMENT, [connectOptions.ports, \"connectOptions.ports\"]));\n if (!(connectOptions.ports instanceof Array)) throw new Error(format(ERROR.INVALID_ARGUMENT, [connectOptions.ports, \"connectOptions.ports\"]));\n if (connectOptions.hosts.length !== connectOptions.ports.length) throw new Error(format(ERROR.INVALID_ARGUMENT, [connectOptions.ports, \"connectOptions.ports\"]));\n connectOptions.uris = [];\n\n for (var i = 0; i < connectOptions.hosts.length; i++) {\n if (typeof connectOptions.ports[i] !== \"number\" || connectOptions.ports[i] < 0) throw new Error(format(ERROR.INVALID_TYPE, [typeof connectOptions.ports[i], \"connectOptions.ports[\" + i + \"]\"]));\n var host = connectOptions.hosts[i];\n var port = connectOptions.ports[i];\n var ipv6 = host.indexOf(\":\") !== -1;\n uri = \"ws://\" + (ipv6 ? \"[\" + host + \"]\" : host) + \":\" + port + path;\n connectOptions.uris.push(uri);\n }\n } else {\n connectOptions.uris = connectOptions.hosts;\n }\n }\n\n client.connect(connectOptions);\n };\n /**\n * Subscribe for messages, request receipt of a copy of messages sent to the destinations described by the filter.\n *\n * @name Paho.Client#subscribe\n * @function\n * @param {string} filter describing the destinations to receive messages from.\n * \n * @param {object} subscribeOptions - used to control the subscription\n *\n * @param {number} subscribeOptions.qos - the maximum qos of any publications sent\n * as a result of making this subscription.\n * @param {object} subscribeOptions.invocationContext - passed to the onSuccess callback\n * or onFailure callback.\n * @param {function} subscribeOptions.onSuccess - called when the subscribe acknowledgement\n * has been received from the server.\n * A single response object parameter is passed to the onSuccess callback containing the following fields:\n * \n *
invocationContext if set in the subscribeOptions.\n *
\n * @param {function} subscribeOptions.onFailure - called when the subscribe request has failed or timed out.\n * A single response object parameter is passed to the onFailure callback containing the following fields:\n * \n *
invocationContext - if set in the subscribeOptions.\n *
errorCode - a number indicating the nature of the error.\n *
errorMessage - text describing the error.\n *
\n * @param {number} subscribeOptions.timeout - which, if present, determines the number of\n * seconds after which the onFailure calback is called.\n * The presence of a timeout does not prevent the onSuccess\n * callback from being called when the subscribe completes.\n * @throws {InvalidState} if the client is not in connected state.\n */\n\n\n this.subscribe = function (filter, subscribeOptions) {\n if (typeof filter !== \"string\" && filter.constructor !== Array) throw new Error(\"Invalid argument:\" + filter);\n subscribeOptions = subscribeOptions || {};\n validate(subscribeOptions, {\n qos: \"number\",\n invocationContext: \"object\",\n onSuccess: \"function\",\n onFailure: \"function\",\n timeout: \"number\"\n });\n if (subscribeOptions.timeout && !subscribeOptions.onFailure) throw new Error(\"subscribeOptions.timeout specified with no onFailure callback.\");\n if (typeof subscribeOptions.qos !== \"undefined\" && !(subscribeOptions.qos === 0 || subscribeOptions.qos === 1 || subscribeOptions.qos === 2)) throw new Error(format(ERROR.INVALID_ARGUMENT, [subscribeOptions.qos, \"subscribeOptions.qos\"]));\n client.subscribe(filter, subscribeOptions);\n };\n /**\n * Unsubscribe for messages, stop receiving messages sent to destinations described by the filter.\n *\n * @name Paho.Client#unsubscribe\n * @function\n * @param {string} filter - describing the destinations to receive messages from.\n * @param {object} unsubscribeOptions - used to control the subscription\n * @param {object} unsubscribeOptions.invocationContext - passed to the onSuccess callback\n \t\t\t\t\t\t\t\t\t or onFailure callback.\n * @param {function} unsubscribeOptions.onSuccess - called when the unsubscribe acknowledgement has been received from the server.\n * A single response object parameter is passed to the\n * onSuccess callback containing the following fields:\n * \n *
invocationContext - if set in the unsubscribeOptions.\n *
\n * @param {function} unsubscribeOptions.onFailure called when the unsubscribe request has failed or timed out.\n * A single response object parameter is passed to the onFailure callback containing the following fields:\n * \n *
invocationContext - if set in the unsubscribeOptions.\n *
errorCode - a number indicating the nature of the error.\n *
errorMessage - text describing the error.\n *
\n * @param {number} unsubscribeOptions.timeout - which, if present, determines the number of seconds\n * after which the onFailure callback is called. The presence of\n * a timeout does not prevent the onSuccess callback from being\n * called when the unsubscribe completes\n * @throws {InvalidState} if the client is not in connected state.\n */\n\n\n this.unsubscribe = function (filter, unsubscribeOptions) {\n if (typeof filter !== \"string\" && filter.constructor !== Array) throw new Error(\"Invalid argument:\" + filter);\n unsubscribeOptions = unsubscribeOptions || {};\n validate(unsubscribeOptions, {\n invocationContext: \"object\",\n onSuccess: \"function\",\n onFailure: \"function\",\n timeout: \"number\"\n });\n if (unsubscribeOptions.timeout && !unsubscribeOptions.onFailure) throw new Error(\"unsubscribeOptions.timeout specified with no onFailure callback.\");\n client.unsubscribe(filter, unsubscribeOptions);\n };\n /**\n * Send a message to the consumers of the destination in the Message.\n *\n * @name Paho.Client#send\n * @function\n * @param {string|Paho.Message} topic - mandatory The name of the destination to which the message is to be sent.\n * \t\t\t\t\t - If it is the only parameter, used as Paho.Message object.\n * @param {String|ArrayBuffer} payload - The message data to be sent.\n * @param {number} qos The Quality of Service used to deliver the message.\n * \t\t
\n * \t\t\t
0 Best effort (default).\n * \t\t\t
1 At least once.\n * \t\t\t
2 Exactly once.\n * \t\t
\n * @param {Boolean} retained If true, the message is to be retained by the server and delivered\n * to both current and future subscriptions.\n * If false the server only delivers the message to current subscribers, this is the default for new Messages.\n * A received message has the retained boolean set to true if the message was published\n * with the retained boolean set to true\n * and the subscrption was made after the message has been published.\n * @throws {InvalidState} if the client is not connected.\n */\n\n\n this.send = function (topic, payload, qos, retained) {\n var message;\n\n if (arguments.length === 0) {\n throw new Error(\"Invalid argument.\" + \"length\");\n } else if (arguments.length == 1) {\n if (!(topic instanceof Message) && typeof topic !== \"string\") throw new Error(\"Invalid argument:\" + typeof topic);\n message = topic;\n if (typeof message.destinationName === \"undefined\") throw new Error(format(ERROR.INVALID_ARGUMENT, [message.destinationName, \"Message.destinationName\"]));\n client.send(message);\n } else {\n //parameter checking in Message object\n message = new Message(payload);\n message.destinationName = topic;\n if (arguments.length >= 3) message.qos = qos;\n if (arguments.length >= 4) message.retained = retained;\n client.send(message);\n }\n };\n /**\n * Publish a message to the consumers of the destination in the Message.\n * Synonym for Paho.Mqtt.Client#send\n *\n * @name Paho.Client#publish\n * @function\n * @param {string|Paho.Message} topic - mandatory The name of the topic to which the message is to be published.\n * \t\t\t\t\t - If it is the only parameter, used as Paho.Message object.\n * @param {String|ArrayBuffer} payload - The message data to be published.\n * @param {number} qos The Quality of Service used to deliver the message.\n * \t\t
\n * \t\t\t
0 Best effort (default).\n * \t\t\t
1 At least once.\n * \t\t\t
2 Exactly once.\n * \t\t
\n * @param {Boolean} retained If true, the message is to be retained by the server and delivered\n * to both current and future subscriptions.\n * If false the server only delivers the message to current subscribers, this is the default for new Messages.\n * A received message has the retained boolean set to true if the message was published\n * with the retained boolean set to true\n * and the subscrption was made after the message has been published.\n * @throws {InvalidState} if the client is not connected.\n */\n\n\n this.publish = function (topic, payload, qos, retained) {\n var message;\n\n if (arguments.length === 0) {\n throw new Error(\"Invalid argument.\" + \"length\");\n } else if (arguments.length == 1) {\n if (!(topic instanceof Message) && typeof topic !== \"string\") throw new Error(\"Invalid argument:\" + typeof topic);\n message = topic;\n if (typeof message.destinationName === \"undefined\") throw new Error(format(ERROR.INVALID_ARGUMENT, [message.destinationName, \"Message.destinationName\"]));\n client.send(message);\n } else {\n //parameter checking in Message object\n message = new Message(payload);\n message.destinationName = topic;\n if (arguments.length >= 3) message.qos = qos;\n if (arguments.length >= 4) message.retained = retained;\n client.send(message);\n }\n };\n /**\n * Normal disconnect of this Messaging client from its server.\n *\n * @name Paho.Client#disconnect\n * @function\n * @throws {InvalidState} if the client is already disconnected.\n */\n\n\n this.disconnect = function () {\n client.disconnect();\n };\n /**\n * Get the contents of the trace log.\n *\n * @name Paho.Client#getTraceLog\n * @function\n * @return {Object[]} tracebuffer containing the time ordered trace records.\n */\n\n\n this.getTraceLog = function () {\n return client.getTraceLog();\n };\n /**\n * Start tracing.\n *\n * @name Paho.Client#startTrace\n * @function\n */\n\n\n this.startTrace = function () {\n client.startTrace();\n };\n /**\n * Stop tracing.\n *\n * @name Paho.Client#stopTrace\n * @function\n */\n\n\n this.stopTrace = function () {\n client.stopTrace();\n };\n\n this.isConnected = function () {\n return client.connected;\n };\n };\n /**\n * An application message, sent or received.\n *
\n * All attributes may be null, which implies the default values.\n *\n * @name Paho.Message\n * @constructor\n * @param {String|ArrayBuffer} payload The message data to be sent.\n *
\n * @property {string} payloadString read only The payload as a string if the payload consists of valid UTF-8 characters.\n * @property {ArrayBuffer} payloadBytes read only The payload as an ArrayBuffer.\n *
\n * @property {string} destinationName mandatory The name of the destination to which the message is to be sent\n * (for messages about to be sent) or the name of the destination from which the message has been received.\n * (for messages received by the onMessage function).\n *
\n * @property {number} qos The Quality of Service used to deliver the message.\n *
\n *
0 Best effort (default).\n *
1 At least once.\n *
2 Exactly once.\n *
\n *
\n * @property {Boolean} retained If true, the message is to be retained by the server and delivered\n * to both current and future subscriptions.\n * If false the server only delivers the message to current subscribers, this is the default for new Messages.\n * A received message has the retained boolean set to true if the message was published\n * with the retained boolean set to true\n * and the subscrption was made after the message has been published.\n *
\n * @property {Boolean} duplicate read only If true, this message might be a duplicate of one which has already been received.\n * This is only set on messages received from the server.\n *\n */\n\n\n var Message = function Message(newPayload) {\n var payload;\n\n if (typeof newPayload === \"string\" || newPayload instanceof ArrayBuffer || ArrayBuffer.isView(newPayload) && !(newPayload instanceof DataView)) {\n payload = newPayload;\n } else {\n throw format(ERROR.INVALID_ARGUMENT, [newPayload, \"newPayload\"]);\n }\n\n var destinationName;\n var qos = 0;\n var retained = false;\n var duplicate = false;\n Object.defineProperties(this, {\n \"payloadString\": {\n enumerable: true,\n get: function get() {\n if (typeof payload === \"string\") return payload;else return parseUTF8(payload, 0, payload.length);\n }\n },\n \"payloadBytes\": {\n enumerable: true,\n get: function get() {\n if (typeof payload === \"string\") {\n var buffer = new ArrayBuffer(UTF8Length(payload));\n var byteStream = new Uint8Array(buffer);\n stringToUTF8(payload, byteStream, 0);\n return byteStream;\n } else {\n return payload;\n }\n }\n },\n \"destinationName\": {\n enumerable: true,\n get: function get() {\n return destinationName;\n },\n set: function set(newDestinationName) {\n if (typeof newDestinationName === \"string\") destinationName = newDestinationName;else throw new Error(format(ERROR.INVALID_ARGUMENT, [newDestinationName, \"newDestinationName\"]));\n }\n },\n \"qos\": {\n enumerable: true,\n get: function get() {\n return qos;\n },\n set: function set(newQos) {\n if (newQos === 0 || newQos === 1 || newQos === 2) qos = newQos;else throw new Error(\"Invalid argument:\" + newQos);\n }\n },\n \"retained\": {\n enumerable: true,\n get: function get() {\n return retained;\n },\n set: function set(newRetained) {\n if (typeof newRetained === \"boolean\") retained = newRetained;else throw new Error(format(ERROR.INVALID_ARGUMENT, [newRetained, \"newRetained\"]));\n }\n },\n \"topic\": {\n enumerable: true,\n get: function get() {\n return destinationName;\n },\n set: function set(newTopic) {\n destinationName = newTopic;\n }\n },\n \"duplicate\": {\n enumerable: true,\n get: function get() {\n return duplicate;\n },\n set: function set(newDuplicate) {\n duplicate = newDuplicate;\n }\n }\n });\n }; // Module contents.\n\n\n return {\n Client: Client,\n Message: Message\n }; // eslint-disable-next-line no-nested-ternary\n }(typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {});\n\n return PahoMQTT;\n});","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport classNames from 'classnames';\nimport React, { useContext } from 'react';\nimport FormContext from './FormContext';\nimport { useBootstrapPrefix } from './ThemeProvider';\nvar FormCheckInput = /*#__PURE__*/React.forwardRef(function (_ref, ref) {\n var id = _ref.id,\n bsPrefix = _ref.bsPrefix,\n bsCustomPrefix = _ref.bsCustomPrefix,\n className = _ref.className,\n _ref$type = _ref.type,\n type = _ref$type === void 0 ? 'checkbox' : _ref$type,\n _ref$isValid = _ref.isValid,\n isValid = _ref$isValid === void 0 ? false : _ref$isValid,\n _ref$isInvalid = _ref.isInvalid,\n isInvalid = _ref$isInvalid === void 0 ? false : _ref$isInvalid,\n isStatic = _ref.isStatic,\n _ref$as = _ref.as,\n Component = _ref$as === void 0 ? 'input' : _ref$as,\n props = _objectWithoutPropertiesLoose(_ref, [\"id\", \"bsPrefix\", \"bsCustomPrefix\", \"className\", \"type\", \"isValid\", \"isInvalid\", \"isStatic\", \"as\"]);\n\n var _useContext = useContext(FormContext),\n controlId = _useContext.controlId,\n custom = _useContext.custom;\n\n var _ref2 = custom ? [bsCustomPrefix, 'custom-control-input'] : [bsPrefix, 'form-check-input'],\n prefix = _ref2[0],\n defaultPrefix = _ref2[1];\n\n bsPrefix = useBootstrapPrefix(prefix, defaultPrefix);\n return /*#__PURE__*/React.createElement(Component, _extends({}, props, {\n ref: ref,\n type: type,\n id: id || controlId,\n className: classNames(className, bsPrefix, isValid && 'is-valid', isInvalid && 'is-invalid', isStatic && 'position-static')\n }));\n});\nFormCheckInput.displayName = 'FormCheckInput';\nexport default FormCheckInput;","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport classNames from 'classnames';\nimport React, { useContext } from 'react';\nimport FormContext from './FormContext';\nimport { useBootstrapPrefix } from './ThemeProvider';\nvar FormCheckLabel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {\n var bsPrefix = _ref.bsPrefix,\n bsCustomPrefix = _ref.bsCustomPrefix,\n className = _ref.className,\n htmlFor = _ref.htmlFor,\n props = _objectWithoutPropertiesLoose(_ref, [\"bsPrefix\", \"bsCustomPrefix\", \"className\", \"htmlFor\"]);\n\n var _useContext = useContext(FormContext),\n controlId = _useContext.controlId,\n custom = _useContext.custom;\n\n var _ref2 = custom ? [bsCustomPrefix, 'custom-control-label'] : [bsPrefix, 'form-check-label'],\n prefix = _ref2[0],\n defaultPrefix = _ref2[1];\n\n bsPrefix = useBootstrapPrefix(prefix, defaultPrefix);\n return /*#__PURE__*/React.createElement(\"label\", _extends({}, props, {\n ref: ref,\n htmlFor: htmlFor || controlId,\n className: classNames(className, bsPrefix)\n }));\n});\nFormCheckLabel.displayName = 'FormCheckLabel';\nexport default FormCheckLabel;","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport classNames from 'classnames';\nimport all from 'prop-types-extra/lib/all';\nimport React, { useContext, useMemo } from 'react';\nimport Feedback from './Feedback';\nimport FormCheckInput from './FormCheckInput';\nimport FormCheckLabel from './FormCheckLabel';\nimport FormContext from './FormContext';\nimport { useBootstrapPrefix } from './ThemeProvider';\nvar FormCheck = /*#__PURE__*/React.forwardRef(function (_ref, ref) {\n var id = _ref.id,\n bsPrefix = _ref.bsPrefix,\n bsCustomPrefix = _ref.bsCustomPrefix,\n _ref$inline = _ref.inline,\n inline = _ref$inline === void 0 ? false : _ref$inline,\n _ref$disabled = _ref.disabled,\n disabled = _ref$disabled === void 0 ? false : _ref$disabled,\n _ref$isValid = _ref.isValid,\n isValid = _ref$isValid === void 0 ? false : _ref$isValid,\n _ref$isInvalid = _ref.isInvalid,\n isInvalid = _ref$isInvalid === void 0 ? false : _ref$isInvalid,\n _ref$feedbackTooltip = _ref.feedbackTooltip,\n feedbackTooltip = _ref$feedbackTooltip === void 0 ? false : _ref$feedbackTooltip,\n feedback = _ref.feedback,\n className = _ref.className,\n style = _ref.style,\n _ref$title = _ref.title,\n title = _ref$title === void 0 ? '' : _ref$title,\n _ref$type = _ref.type,\n type = _ref$type === void 0 ? 'checkbox' : _ref$type,\n label = _ref.label,\n children = _ref.children,\n propCustom = _ref.custom,\n _ref$as = _ref.as,\n as = _ref$as === void 0 ? 'input' : _ref$as,\n props = _objectWithoutPropertiesLoose(_ref, [\"id\", \"bsPrefix\", \"bsCustomPrefix\", \"inline\", \"disabled\", \"isValid\", \"isInvalid\", \"feedbackTooltip\", \"feedback\", \"className\", \"style\", \"title\", \"type\", \"label\", \"children\", \"custom\", \"as\"]);\n\n var custom = type === 'switch' ? true : propCustom;\n\n var _ref2 = custom ? [bsCustomPrefix, 'custom-control'] : [bsPrefix, 'form-check'],\n prefix = _ref2[0],\n defaultPrefix = _ref2[1];\n\n bsPrefix = useBootstrapPrefix(prefix, defaultPrefix);\n\n var _useContext = useContext(FormContext),\n controlId = _useContext.controlId;\n\n var innerFormContext = useMemo(function () {\n return {\n controlId: id || controlId,\n custom: custom\n };\n }, [controlId, custom, id]);\n var hasLabel = custom || label != null && label !== false && !children;\n var input = /*#__PURE__*/React.createElement(FormCheckInput, _extends({}, props, {\n type: type === 'switch' ? 'checkbox' : type,\n ref: ref,\n isValid: isValid,\n isInvalid: isInvalid,\n isStatic: !hasLabel,\n disabled: disabled,\n as: as\n }));\n return /*#__PURE__*/React.createElement(FormContext.Provider, {\n value: innerFormContext\n }, /*#__PURE__*/React.createElement(\"div\", {\n style: style,\n className: classNames(className, bsPrefix, custom && \"custom-\" + type, inline && bsPrefix + \"-inline\")\n }, children || /*#__PURE__*/React.createElement(React.Fragment, null, input, hasLabel && /*#__PURE__*/React.createElement(FormCheckLabel, {\n title: title\n }, label), (isValid || isInvalid) && /*#__PURE__*/React.createElement(Feedback, {\n type: isValid ? 'valid' : 'invalid',\n tooltip: feedbackTooltip\n }, feedback))));\n});\nFormCheck.displayName = 'FormCheck';\nFormCheck.Input = FormCheckInput;\nFormCheck.Label = FormCheckLabel;\nexport default FormCheck;","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport classNames from 'classnames';\nimport React, { useContext } from 'react';\nimport FormContext from './FormContext';\nimport { useBootstrapPrefix } from './ThemeProvider';\nvar FormFileInput = /*#__PURE__*/React.forwardRef(function (_ref, ref) {\n var id = _ref.id,\n bsPrefix = _ref.bsPrefix,\n bsCustomPrefix = _ref.bsCustomPrefix,\n className = _ref.className,\n isValid = _ref.isValid,\n isInvalid = _ref.isInvalid,\n lang = _ref.lang,\n _ref$as = _ref.as,\n Component = _ref$as === void 0 ? 'input' : _ref$as,\n props = _objectWithoutPropertiesLoose(_ref, [\"id\", \"bsPrefix\", \"bsCustomPrefix\", \"className\", \"isValid\", \"isInvalid\", \"lang\", \"as\"]);\n\n var _useContext = useContext(FormContext),\n controlId = _useContext.controlId,\n custom = _useContext.custom;\n\n var type = 'file';\n\n var _ref2 = custom ? [bsCustomPrefix, 'custom-file-input'] : [bsPrefix, 'form-control-file'],\n prefix = _ref2[0],\n defaultPrefix = _ref2[1];\n\n bsPrefix = useBootstrapPrefix(prefix, defaultPrefix);\n return /*#__PURE__*/React.createElement(Component, _extends({}, props, {\n ref: ref,\n id: id || controlId,\n type: type,\n lang: lang,\n className: classNames(className, bsPrefix, isValid && 'is-valid', isInvalid && 'is-invalid')\n }));\n});\nFormFileInput.displayName = 'FormFileInput';\nexport default FormFileInput;","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport classNames from 'classnames';\nimport React, { useContext } from 'react';\nimport FormContext from './FormContext';\nimport { useBootstrapPrefix } from './ThemeProvider';\nvar FormFileLabel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {\n var bsPrefix = _ref.bsPrefix,\n bsCustomPrefix = _ref.bsCustomPrefix,\n className = _ref.className,\n htmlFor = _ref.htmlFor,\n props = _objectWithoutPropertiesLoose(_ref, [\"bsPrefix\", \"bsCustomPrefix\", \"className\", \"htmlFor\"]);\n\n var _useContext = useContext(FormContext),\n controlId = _useContext.controlId,\n custom = _useContext.custom;\n\n var _ref2 = custom ? [bsCustomPrefix, 'custom-file-label'] : [bsPrefix, 'form-file-label'],\n prefix = _ref2[0],\n defaultPrefix = _ref2[1];\n\n bsPrefix = useBootstrapPrefix(prefix, defaultPrefix);\n return /*#__PURE__*/React.createElement(\"label\", _extends({}, props, {\n ref: ref,\n htmlFor: htmlFor || controlId,\n className: classNames(className, bsPrefix),\n \"data-browse\": props['data-browse']\n }));\n});\nFormFileLabel.displayName = 'FormFileLabel';\nexport default FormFileLabel;","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport classNames from 'classnames';\nimport React, { useContext, useMemo } from 'react';\nimport all from 'prop-types-extra/lib/all';\nimport Feedback from './Feedback';\nimport FormFileInput from './FormFileInput';\nimport FormFileLabel from './FormFileLabel';\nimport FormContext from './FormContext';\nimport { useBootstrapPrefix } from './ThemeProvider';\nvar FormFile = /*#__PURE__*/React.forwardRef(function (_ref, ref) {\n var id = _ref.id,\n bsPrefix = _ref.bsPrefix,\n bsCustomPrefix = _ref.bsCustomPrefix,\n _ref$disabled = _ref.disabled,\n disabled = _ref$disabled === void 0 ? false : _ref$disabled,\n _ref$isValid = _ref.isValid,\n isValid = _ref$isValid === void 0 ? false : _ref$isValid,\n _ref$isInvalid = _ref.isInvalid,\n isInvalid = _ref$isInvalid === void 0 ? false : _ref$isInvalid,\n _ref$feedbackTooltip = _ref.feedbackTooltip,\n feedbackTooltip = _ref$feedbackTooltip === void 0 ? false : _ref$feedbackTooltip,\n feedback = _ref.feedback,\n className = _ref.className,\n style = _ref.style,\n label = _ref.label,\n children = _ref.children,\n custom = _ref.custom,\n lang = _ref.lang,\n dataBrowse = _ref['data-browse'],\n _ref$as = _ref.as,\n Component = _ref$as === void 0 ? 'div' : _ref$as,\n _ref$inputAs = _ref.inputAs,\n inputAs = _ref$inputAs === void 0 ? 'input' : _ref$inputAs,\n props = _objectWithoutPropertiesLoose(_ref, [\"id\", \"bsPrefix\", \"bsCustomPrefix\", \"disabled\", \"isValid\", \"isInvalid\", \"feedbackTooltip\", \"feedback\", \"className\", \"style\", \"label\", \"children\", \"custom\", \"lang\", \"data-browse\", \"as\", \"inputAs\"]);\n\n var _ref2 = custom ? [bsCustomPrefix, 'custom'] : [bsPrefix, 'form-file'],\n prefix = _ref2[0],\n defaultPrefix = _ref2[1];\n\n bsPrefix = useBootstrapPrefix(prefix, defaultPrefix);\n var type = 'file';\n\n var _useContext = useContext(FormContext),\n controlId = _useContext.controlId;\n\n var innerFormContext = useMemo(function () {\n return {\n controlId: id || controlId,\n custom: custom\n };\n }, [controlId, custom, id]);\n var hasLabel = label != null && label !== false && !children;\n var input = /*#__PURE__*/React.createElement(FormFileInput, _extends({}, props, {\n ref: ref,\n isValid: isValid,\n isInvalid: isInvalid,\n disabled: disabled,\n as: inputAs,\n lang: lang\n }));\n return /*#__PURE__*/React.createElement(FormContext.Provider, {\n value: innerFormContext\n }, /*#__PURE__*/React.createElement(Component, {\n style: style,\n className: classNames(className, bsPrefix, custom && \"custom-\" + type)\n }, children || /*#__PURE__*/React.createElement(React.Fragment, null, custom ? /*#__PURE__*/React.createElement(React.Fragment, null, input, hasLabel && /*#__PURE__*/React.createElement(FormFileLabel, {\n \"data-browse\": dataBrowse\n }, label)) : /*#__PURE__*/React.createElement(React.Fragment, null, hasLabel && /*#__PURE__*/React.createElement(FormFileLabel, null, label), input), (isValid || isInvalid) && /*#__PURE__*/React.createElement(Feedback, {\n type: isValid ? 'valid' : 'invalid',\n tooltip: feedbackTooltip\n }, feedback))));\n});\nFormFile.displayName = 'FormFile';\nFormFile.Input = FormFileInput;\nFormFile.Label = FormFileLabel;\nexport default FormFile;","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport classNames from 'classnames';\nimport React, { useMemo } from 'react';\nimport FormContext from './FormContext';\nimport { useBootstrapPrefix } from './ThemeProvider';\nvar FormGroup = /*#__PURE__*/React.forwardRef(function (_ref, ref) {\n var bsPrefix = _ref.bsPrefix,\n className = _ref.className,\n children = _ref.children,\n controlId = _ref.controlId,\n _ref$as = _ref.as,\n Component = _ref$as === void 0 ? 'div' : _ref$as,\n props = _objectWithoutPropertiesLoose(_ref, [\"bsPrefix\", \"className\", \"children\", \"controlId\", \"as\"]);\n\n bsPrefix = useBootstrapPrefix(bsPrefix, 'form-group');\n var context = useMemo(function () {\n return {\n controlId: controlId\n };\n }, [controlId]);\n return /*#__PURE__*/React.createElement(FormContext.Provider, {\n value: context\n }, /*#__PURE__*/React.createElement(Component, _extends({}, props, {\n ref: ref,\n className: classNames(className, bsPrefix)\n }), children));\n});\nFormGroup.displayName = 'FormGroup';\nexport default FormGroup;","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport classNames from 'classnames';\nimport React, { useContext } from 'react';\nimport warning from 'warning';\nimport Col from './Col';\nimport FormContext from './FormContext';\nimport { useBootstrapPrefix } from './ThemeProvider';\nvar defaultProps = {\n column: false,\n srOnly: false\n};\nvar FormLabel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {\n var _ref$as = _ref.as,\n Component = _ref$as === void 0 ? 'label' : _ref$as,\n bsPrefix = _ref.bsPrefix,\n column = _ref.column,\n srOnly = _ref.srOnly,\n className = _ref.className,\n htmlFor = _ref.htmlFor,\n props = _objectWithoutPropertiesLoose(_ref, [\"as\", \"bsPrefix\", \"column\", \"srOnly\", \"className\", \"htmlFor\"]);\n\n var _useContext = useContext(FormContext),\n controlId = _useContext.controlId;\n\n bsPrefix = useBootstrapPrefix(bsPrefix, 'form-label');\n var columnClass = 'col-form-label';\n if (typeof column === 'string') columnClass = columnClass + \" \" + columnClass + \"-\" + column;\n var classes = classNames(className, bsPrefix, srOnly && 'sr-only', column && columnClass);\n process.env.NODE_ENV !== \"production\" ? warning(controlId == null || !htmlFor, '`controlId` is ignored on `` when `htmlFor` is specified.') : void 0;\n htmlFor = htmlFor || controlId;\n if (column) return /*#__PURE__*/React.createElement(Col, _extends({\n as: \"label\",\n className: classes,\n htmlFor: htmlFor\n }, props));\n return (\n /*#__PURE__*/\n // eslint-disable-next-line jsx-a11y/label-has-for, jsx-a11y/label-has-associated-control\n React.createElement(Component, _extends({\n ref: ref,\n className: classes,\n htmlFor: htmlFor\n }, props))\n );\n});\nFormLabel.displayName = 'FormLabel';\nFormLabel.defaultProps = defaultProps;\nexport default FormLabel;","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport classNames from 'classnames';\nimport React from 'react';\nimport { useBootstrapPrefix } from './ThemeProvider';\nvar FormText = /*#__PURE__*/React.forwardRef( // Need to define the default \"as\" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595\nfunction (_ref, ref) {\n var bsPrefix = _ref.bsPrefix,\n className = _ref.className,\n _ref$as = _ref.as,\n Component = _ref$as === void 0 ? 'small' : _ref$as,\n muted = _ref.muted,\n props = _objectWithoutPropertiesLoose(_ref, [\"bsPrefix\", \"className\", \"as\", \"muted\"]);\n\n bsPrefix = useBootstrapPrefix(bsPrefix, 'form-text');\n return /*#__PURE__*/React.createElement(Component, _extends({}, props, {\n ref: ref,\n className: classNames(className, bsPrefix, muted && 'text-muted')\n }));\n});\nFormText.displayName = 'FormText';\nexport default FormText;","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport React from 'react';\nimport FormCheck from './FormCheck';\nvar Switch = /*#__PURE__*/React.forwardRef(function (props, ref) {\n return /*#__PURE__*/React.createElement(FormCheck, _extends({}, props, {\n ref: ref,\n type: \"switch\"\n }));\n});\nSwitch.displayName = 'Switch';\nSwitch.Input = FormCheck.Input;\nSwitch.Label = FormCheck.Label;\nexport default Switch;","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport classNames from 'classnames';\nimport React from 'react';\nimport FormCheck from './FormCheck';\nimport FormFile from './FormFile';\nimport FormControl from './FormControl';\nimport FormGroup from './FormGroup';\nimport FormLabel from './FormLabel';\nimport FormText from './FormText';\nimport Switch from './Switch';\nimport { useBootstrapPrefix } from './ThemeProvider';\nimport createWithBsPrefix from './createWithBsPrefix';\nvar FormRow = createWithBsPrefix('form-row');\nvar defaultProps = {\n inline: false\n};\nvar FormImpl = /*#__PURE__*/React.forwardRef(function (_ref, ref) {\n var bsPrefix = _ref.bsPrefix,\n inline = _ref.inline,\n className = _ref.className,\n validated = _ref.validated,\n _ref$as = _ref.as,\n Component = _ref$as === void 0 ? 'form' : _ref$as,\n props = _objectWithoutPropertiesLoose(_ref, [\"bsPrefix\", \"inline\", \"className\", \"validated\", \"as\"]);\n\n bsPrefix = useBootstrapPrefix(bsPrefix, 'form');\n return /*#__PURE__*/React.createElement(Component, _extends({}, props, {\n ref: ref,\n className: classNames(className, validated && 'was-validated', inline && bsPrefix + \"-inline\")\n }));\n});\nFormImpl.displayName = 'Form';\nFormImpl.defaultProps = defaultProps;\nFormImpl.Row = FormRow;\nFormImpl.Group = FormGroup;\nFormImpl.Control = FormControl;\nFormImpl.Check = FormCheck;\nFormImpl.File = FormFile;\nFormImpl.Switch = Switch;\nFormImpl.Label = FormLabel;\nFormImpl.Text = FormText;\nexport default FormImpl;","module.exports = require('events').EventEmitter;","// Ported from https://github.com/mafintosh/end-of-stream with\n// permission from the author, Mathias Buus (@mafintosh).\n'use strict';\n\nvar ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE;\n\nfunction once(callback) {\n var called = false;\n return function () {\n if (called) return;\n called = true;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n callback.apply(this, args);\n };\n}\n\nfunction noop() {}\n\nfunction isRequest(stream) {\n return stream.setHeader && typeof stream.abort === 'function';\n}\n\nfunction eos(stream, opts, callback) {\n if (typeof opts === 'function') return eos(stream, null, opts);\n if (!opts) opts = {};\n callback = once(callback || noop);\n var readable = opts.readable || opts.readable !== false && stream.readable;\n var writable = opts.writable || opts.writable !== false && stream.writable;\n\n var onlegacyfinish = function onlegacyfinish() {\n if (!stream.writable) onfinish();\n };\n\n var writableEnded = stream._writableState && stream._writableState.finished;\n\n var onfinish = function onfinish() {\n writable = false;\n writableEnded = true;\n if (!readable) callback.call(stream);\n };\n\n var readableEnded = stream._readableState && stream._readableState.endEmitted;\n\n var onend = function onend() {\n readable = false;\n readableEnded = true;\n if (!writable) callback.call(stream);\n };\n\n var onerror = function onerror(err) {\n callback.call(stream, err);\n };\n\n var onclose = function onclose() {\n var err;\n\n if (readable && !readableEnded) {\n if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n\n if (writable && !writableEnded) {\n if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n };\n\n var onrequest = function onrequest() {\n stream.req.on('finish', onfinish);\n };\n\n if (isRequest(stream)) {\n stream.on('complete', onfinish);\n stream.on('abort', onclose);\n if (stream.req) onrequest();else stream.on('request', onrequest);\n } else if (writable && !stream._writableState) {\n // legacy streams\n stream.on('end', onlegacyfinish);\n stream.on('close', onlegacyfinish);\n }\n\n stream.on('end', onend);\n stream.on('finish', onfinish);\n if (opts.error !== false) stream.on('error', onerror);\n stream.on('close', onclose);\n return function () {\n stream.removeListener('complete', onfinish);\n stream.removeListener('abort', onclose);\n stream.removeListener('request', onrequest);\n if (stream.req) stream.req.removeListener('finish', onfinish);\n stream.removeListener('end', onlegacyfinish);\n stream.removeListener('close', onlegacyfinish);\n stream.removeListener('finish', onfinish);\n stream.removeListener('end', onend);\n stream.removeListener('error', onerror);\n stream.removeListener('close', onclose);\n };\n}\n\nmodule.exports = eos;","import { ConsoleLogger as Logger } from './Logger';\nvar logger = new Logger('Parser');\nexport var parseMobileHubConfig = function parseMobileHubConfig(config) {\n var amplifyConfig = {}; // Analytics\n\n if (config['aws_mobile_analytics_app_id']) {\n var Analytics = {\n AWSPinpoint: {\n appId: config['aws_mobile_analytics_app_id'],\n region: config['aws_mobile_analytics_app_region']\n }\n };\n amplifyConfig.Analytics = Analytics;\n } // Auth\n\n\n if (config['aws_cognito_identity_pool_id'] || config['aws_user_pools_id']) {\n amplifyConfig.Auth = {\n userPoolId: config['aws_user_pools_id'],\n userPoolWebClientId: config['aws_user_pools_web_client_id'],\n region: config['aws_cognito_region'],\n identityPoolId: config['aws_cognito_identity_pool_id'],\n identityPoolRegion: config['aws_cognito_region'],\n mandatorySignIn: config['aws_mandatory_sign_in'] === 'enable'\n };\n } // Storage\n\n\n var storageConfig;\n\n if (config['aws_user_files_s3_bucket']) {\n storageConfig = {\n AWSS3: {\n bucket: config['aws_user_files_s3_bucket'],\n region: config['aws_user_files_s3_bucket_region'],\n dangerouslyConnectToHttpEndpointForTesting: config['aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing']\n }\n };\n } else {\n storageConfig = config ? config.Storage || config : {};\n }\n\n amplifyConfig.Analytics = Object.assign({}, amplifyConfig.Analytics, config.Analytics);\n amplifyConfig.Auth = Object.assign({}, amplifyConfig.Auth, config.Auth);\n amplifyConfig.Storage = Object.assign({}, storageConfig);\n logger.debug('parse config', config, 'to amplifyconfig', amplifyConfig);\n return amplifyConfig;\n};\n/**\n * @deprecated use per-function export\n */\n\nvar Parser =\n/** @class */\nfunction () {\n function Parser() {}\n\n Parser.parseMobilehubConfig = parseMobileHubConfig;\n return Parser;\n}();\n\nexport { Parser };\n/**\n * @deprecated use per-function export\n */\n\nexport default Parser;","import _extends from \"@babel/runtime/helpers/esm/extends\";\nexport function toModifierMap(modifiers) {\n var result = {};\n\n if (!Array.isArray(modifiers)) {\n return modifiers || result;\n } // eslint-disable-next-line no-unused-expressions\n\n\n modifiers == null ? void 0 : modifiers.forEach(function (m) {\n result[m.name] = m;\n });\n return result;\n}\nexport function toModifierArray(map) {\n if (map === void 0) {\n map = {};\n }\n\n if (Array.isArray(map)) return map;\n return Object.keys(map).map(function (k) {\n map[k].name = k;\n return map[k];\n });\n}\nexport default function mergeOptionsWithPopperConfig(_ref) {\n var _modifiers$preventOve, _modifiers$preventOve2, _modifiers$offset, _modifiers$arrow;\n\n var enabled = _ref.enabled,\n enableEvents = _ref.enableEvents,\n placement = _ref.placement,\n flip = _ref.flip,\n offset = _ref.offset,\n fixed = _ref.fixed,\n containerPadding = _ref.containerPadding,\n arrowElement = _ref.arrowElement,\n _ref$popperConfig = _ref.popperConfig,\n popperConfig = _ref$popperConfig === void 0 ? {} : _ref$popperConfig;\n var modifiers = toModifierMap(popperConfig.modifiers);\n return _extends({}, popperConfig, {\n placement: placement,\n enabled: enabled,\n strategy: fixed ? 'fixed' : popperConfig.strategy,\n modifiers: toModifierArray(_extends({}, modifiers, {\n eventListeners: {\n enabled: enableEvents\n },\n preventOverflow: _extends({}, modifiers.preventOverflow, {\n options: containerPadding ? _extends({\n padding: containerPadding\n }, (_modifiers$preventOve = modifiers.preventOverflow) == null ? void 0 : _modifiers$preventOve.options) : (_modifiers$preventOve2 = modifiers.preventOverflow) == null ? void 0 : _modifiers$preventOve2.options\n }),\n offset: {\n options: _extends({\n offset: offset\n }, (_modifiers$offset = modifiers.offset) == null ? void 0 : _modifiers$offset.options)\n },\n arrow: _extends({}, modifiers.arrow, {\n enabled: !!arrowElement,\n options: _extends({}, (_modifiers$arrow = modifiers.arrow) == null ? void 0 : _modifiers$arrow.options, {\n element: arrowElement\n })\n }),\n flip: _extends({\n enabled: !!flip\n }, modifiers.flip)\n }))\n });\n}","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nvar __assign = this && this.__assign || function () {\n __assign = Object.assign || function (t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return __assign.apply(this, arguments);\n};\n\nvar __read = this && this.__read || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o),\n r,\n ar = [],\n e;\n\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {\n ar.push(r.value);\n }\n } catch (error) {\n e = {\n error: error\n };\n } finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n\n return ar;\n};\n\nvar __spread = this && this.__spread || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) {\n ar = ar.concat(__read(arguments[i]));\n }\n\n return ar;\n};\n\nimport { ConsoleLogger as Logger } from './Logger';\nvar logger = new Logger('Hub');\nvar AMPLIFY_SYMBOL = typeof Symbol !== 'undefined' && typeof Symbol.for === 'function' ? Symbol.for('amplify_default') : '@@amplify_default';\n\nfunction isLegacyCallback(callback) {\n return callback.onHubCapsule !== undefined;\n}\n\nvar HubClass =\n/** @class */\nfunction () {\n function HubClass(name) {\n this.listeners = [];\n this.patterns = [];\n this.protectedChannels = ['core', 'auth', 'api', 'analytics', 'interactions', 'pubsub', 'storage', 'xr'];\n this.name = name;\n } // Note - Need to pass channel as a reference for removal to work and not anonymous function\n\n\n HubClass.prototype.remove = function (channel, listener) {\n if (channel instanceof RegExp) {\n var pattern_1 = this.patterns.find(function (_a) {\n var pattern = _a.pattern;\n return pattern.source === channel.source;\n });\n\n if (!pattern_1) {\n logger.warn(\"No listeners for \" + channel);\n return;\n }\n\n this.patterns = __spread(this.patterns.filter(function (x) {\n return x !== pattern_1;\n }));\n } else {\n var holder = this.listeners[channel];\n\n if (!holder) {\n logger.warn(\"No listeners for \" + channel);\n return;\n }\n\n this.listeners[channel] = __spread(holder.filter(function (_a) {\n var callback = _a.callback;\n return callback !== listener;\n }));\n }\n };\n\n HubClass.prototype.dispatch = function (channel, payload, source, ampSymbol) {\n if (source === void 0) {\n source = '';\n }\n\n if (this.protectedChannels.indexOf(channel) > -1) {\n var hasAccess = ampSymbol === AMPLIFY_SYMBOL;\n\n if (!hasAccess) {\n logger.warn(\"WARNING: \" + channel + \" is protected and dispatching on it can have unintended consequences\");\n }\n }\n\n var capsule = {\n channel: channel,\n payload: __assign({}, payload),\n source: source,\n patternInfo: []\n };\n\n try {\n this._toListeners(capsule);\n } catch (e) {\n logger.error(e);\n }\n };\n\n HubClass.prototype.listen = function (channel, callback, listenerName) {\n var _this = this;\n\n if (listenerName === void 0) {\n listenerName = 'noname';\n }\n\n var cb; // Check for legacy onHubCapsule callback for backwards compatability\n\n if (isLegacyCallback(callback)) {\n logger.warn(\"WARNING onHubCapsule is Deprecated. Please pass in a callback.\");\n cb = callback.onHubCapsule.bind(callback);\n } else if (typeof callback !== 'function') {\n throw new Error('No callback supplied to Hub');\n } else {\n cb = callback;\n }\n\n if (channel instanceof RegExp) {\n this.patterns.push({\n pattern: channel,\n callback: cb\n });\n } else {\n var holder = this.listeners[channel];\n\n if (!holder) {\n holder = [];\n this.listeners[channel] = holder;\n }\n\n holder.push({\n name: listenerName,\n callback: cb\n });\n }\n\n return function () {\n _this.remove(channel, cb);\n };\n };\n\n HubClass.prototype._toListeners = function (capsule) {\n var channel = capsule.channel,\n payload = capsule.payload;\n var holder = this.listeners[channel];\n\n if (holder) {\n holder.forEach(function (listener) {\n logger.debug(\"Dispatching to \" + channel + \" with \", payload);\n\n try {\n listener.callback(capsule);\n } catch (e) {\n logger.error(e);\n }\n });\n }\n\n if (this.patterns.length > 0) {\n if (!payload.message) {\n logger.warn(\"Cannot perform pattern matching without a message key\");\n return;\n }\n\n var payloadStr_1 = payload.message;\n this.patterns.forEach(function (pattern) {\n var match = payloadStr_1.match(pattern.pattern);\n\n if (match) {\n var _a = __read(match),\n groups = _a.slice(1);\n\n var dispatchingCapsule = __assign(__assign({}, capsule), {\n patternInfo: groups\n });\n\n try {\n pattern.callback(dispatchingCapsule);\n } catch (e) {\n logger.error(e);\n }\n }\n });\n }\n };\n\n return HubClass;\n}();\n\nexport { HubClass };\n/*We export a __default__ instance of HubClass to use it as a\npsuedo Singleton for the main messaging bus, however you can still create\nyour own instance of HubClass() for a separate \"private bus\" of events.*/\n\nexport var Hub = new HubClass('__default__');\n/**\n * @deprecated use named import\n */\n\nexport default Hub;","import { __assign } from \"tslib\";\nexport var AmbiguousRoleResolutionType;\n\n(function (AmbiguousRoleResolutionType) {\n AmbiguousRoleResolutionType[\"AUTHENTICATED_ROLE\"] = \"AuthenticatedRole\";\n AmbiguousRoleResolutionType[\"DENY\"] = \"Deny\";\n})(AmbiguousRoleResolutionType || (AmbiguousRoleResolutionType = {}));\n\nexport var CognitoIdentityProvider;\n\n(function (CognitoIdentityProvider) {\n CognitoIdentityProvider.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(CognitoIdentityProvider || (CognitoIdentityProvider = {}));\n\nexport var CreateIdentityPoolInput;\n\n(function (CreateIdentityPoolInput) {\n CreateIdentityPoolInput.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(CreateIdentityPoolInput || (CreateIdentityPoolInput = {}));\n\nexport var IdentityPool;\n\n(function (IdentityPool) {\n IdentityPool.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(IdentityPool || (IdentityPool = {}));\n\nexport var InternalErrorException;\n\n(function (InternalErrorException) {\n InternalErrorException.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(InternalErrorException || (InternalErrorException = {}));\n\nexport var InvalidParameterException;\n\n(function (InvalidParameterException) {\n InvalidParameterException.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(InvalidParameterException || (InvalidParameterException = {}));\n\nexport var LimitExceededException;\n\n(function (LimitExceededException) {\n LimitExceededException.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(LimitExceededException || (LimitExceededException = {}));\n\nexport var NotAuthorizedException;\n\n(function (NotAuthorizedException) {\n NotAuthorizedException.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(NotAuthorizedException || (NotAuthorizedException = {}));\n\nexport var ResourceConflictException;\n\n(function (ResourceConflictException) {\n ResourceConflictException.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(ResourceConflictException || (ResourceConflictException = {}));\n\nexport var TooManyRequestsException;\n\n(function (TooManyRequestsException) {\n TooManyRequestsException.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(TooManyRequestsException || (TooManyRequestsException = {}));\n\nexport var DeleteIdentitiesInput;\n\n(function (DeleteIdentitiesInput) {\n DeleteIdentitiesInput.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(DeleteIdentitiesInput || (DeleteIdentitiesInput = {}));\n\nexport var ErrorCode;\n\n(function (ErrorCode) {\n ErrorCode[\"ACCESS_DENIED\"] = \"AccessDenied\";\n ErrorCode[\"INTERNAL_SERVER_ERROR\"] = \"InternalServerError\";\n})(ErrorCode || (ErrorCode = {}));\n\nexport var UnprocessedIdentityId;\n\n(function (UnprocessedIdentityId) {\n UnprocessedIdentityId.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(UnprocessedIdentityId || (UnprocessedIdentityId = {}));\n\nexport var DeleteIdentitiesResponse;\n\n(function (DeleteIdentitiesResponse) {\n DeleteIdentitiesResponse.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(DeleteIdentitiesResponse || (DeleteIdentitiesResponse = {}));\n\nexport var DeleteIdentityPoolInput;\n\n(function (DeleteIdentityPoolInput) {\n DeleteIdentityPoolInput.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(DeleteIdentityPoolInput || (DeleteIdentityPoolInput = {}));\n\nexport var ResourceNotFoundException;\n\n(function (ResourceNotFoundException) {\n ResourceNotFoundException.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(ResourceNotFoundException || (ResourceNotFoundException = {}));\n\nexport var DescribeIdentityInput;\n\n(function (DescribeIdentityInput) {\n DescribeIdentityInput.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(DescribeIdentityInput || (DescribeIdentityInput = {}));\n\nexport var IdentityDescription;\n\n(function (IdentityDescription) {\n IdentityDescription.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(IdentityDescription || (IdentityDescription = {}));\n\nexport var DescribeIdentityPoolInput;\n\n(function (DescribeIdentityPoolInput) {\n DescribeIdentityPoolInput.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(DescribeIdentityPoolInput || (DescribeIdentityPoolInput = {}));\n\nexport var ExternalServiceException;\n\n(function (ExternalServiceException) {\n ExternalServiceException.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(ExternalServiceException || (ExternalServiceException = {}));\n\nexport var GetCredentialsForIdentityInput;\n\n(function (GetCredentialsForIdentityInput) {\n GetCredentialsForIdentityInput.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(GetCredentialsForIdentityInput || (GetCredentialsForIdentityInput = {}));\n\nexport var Credentials;\n\n(function (Credentials) {\n Credentials.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(Credentials || (Credentials = {}));\n\nexport var GetCredentialsForIdentityResponse;\n\n(function (GetCredentialsForIdentityResponse) {\n GetCredentialsForIdentityResponse.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(GetCredentialsForIdentityResponse || (GetCredentialsForIdentityResponse = {}));\n\nexport var InvalidIdentityPoolConfigurationException;\n\n(function (InvalidIdentityPoolConfigurationException) {\n InvalidIdentityPoolConfigurationException.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(InvalidIdentityPoolConfigurationException || (InvalidIdentityPoolConfigurationException = {}));\n\nexport var GetIdInput;\n\n(function (GetIdInput) {\n GetIdInput.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(GetIdInput || (GetIdInput = {}));\n\nexport var GetIdResponse;\n\n(function (GetIdResponse) {\n GetIdResponse.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(GetIdResponse || (GetIdResponse = {}));\n\nexport var GetIdentityPoolRolesInput;\n\n(function (GetIdentityPoolRolesInput) {\n GetIdentityPoolRolesInput.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(GetIdentityPoolRolesInput || (GetIdentityPoolRolesInput = {}));\n\nexport var MappingRuleMatchType;\n\n(function (MappingRuleMatchType) {\n MappingRuleMatchType[\"CONTAINS\"] = \"Contains\";\n MappingRuleMatchType[\"EQUALS\"] = \"Equals\";\n MappingRuleMatchType[\"NOT_EQUAL\"] = \"NotEqual\";\n MappingRuleMatchType[\"STARTS_WITH\"] = \"StartsWith\";\n})(MappingRuleMatchType || (MappingRuleMatchType = {}));\n\nexport var MappingRule;\n\n(function (MappingRule) {\n MappingRule.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(MappingRule || (MappingRule = {}));\n\nexport var RulesConfigurationType;\n\n(function (RulesConfigurationType) {\n RulesConfigurationType.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(RulesConfigurationType || (RulesConfigurationType = {}));\n\nexport var RoleMappingType;\n\n(function (RoleMappingType) {\n RoleMappingType[\"RULES\"] = \"Rules\";\n RoleMappingType[\"TOKEN\"] = \"Token\";\n})(RoleMappingType || (RoleMappingType = {}));\n\nexport var RoleMapping;\n\n(function (RoleMapping) {\n RoleMapping.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(RoleMapping || (RoleMapping = {}));\n\nexport var GetIdentityPoolRolesResponse;\n\n(function (GetIdentityPoolRolesResponse) {\n GetIdentityPoolRolesResponse.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(GetIdentityPoolRolesResponse || (GetIdentityPoolRolesResponse = {}));\n\nexport var GetOpenIdTokenInput;\n\n(function (GetOpenIdTokenInput) {\n GetOpenIdTokenInput.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(GetOpenIdTokenInput || (GetOpenIdTokenInput = {}));\n\nexport var GetOpenIdTokenResponse;\n\n(function (GetOpenIdTokenResponse) {\n GetOpenIdTokenResponse.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(GetOpenIdTokenResponse || (GetOpenIdTokenResponse = {}));\n\nexport var DeveloperUserAlreadyRegisteredException;\n\n(function (DeveloperUserAlreadyRegisteredException) {\n DeveloperUserAlreadyRegisteredException.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(DeveloperUserAlreadyRegisteredException || (DeveloperUserAlreadyRegisteredException = {}));\n\nexport var GetOpenIdTokenForDeveloperIdentityInput;\n\n(function (GetOpenIdTokenForDeveloperIdentityInput) {\n GetOpenIdTokenForDeveloperIdentityInput.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(GetOpenIdTokenForDeveloperIdentityInput || (GetOpenIdTokenForDeveloperIdentityInput = {}));\n\nexport var GetOpenIdTokenForDeveloperIdentityResponse;\n\n(function (GetOpenIdTokenForDeveloperIdentityResponse) {\n GetOpenIdTokenForDeveloperIdentityResponse.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(GetOpenIdTokenForDeveloperIdentityResponse || (GetOpenIdTokenForDeveloperIdentityResponse = {}));\n\nexport var ListIdentitiesInput;\n\n(function (ListIdentitiesInput) {\n ListIdentitiesInput.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(ListIdentitiesInput || (ListIdentitiesInput = {}));\n\nexport var ListIdentitiesResponse;\n\n(function (ListIdentitiesResponse) {\n ListIdentitiesResponse.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(ListIdentitiesResponse || (ListIdentitiesResponse = {}));\n\nexport var ListIdentityPoolsInput;\n\n(function (ListIdentityPoolsInput) {\n ListIdentityPoolsInput.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(ListIdentityPoolsInput || (ListIdentityPoolsInput = {}));\n\nexport var IdentityPoolShortDescription;\n\n(function (IdentityPoolShortDescription) {\n IdentityPoolShortDescription.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(IdentityPoolShortDescription || (IdentityPoolShortDescription = {}));\n\nexport var ListIdentityPoolsResponse;\n\n(function (ListIdentityPoolsResponse) {\n ListIdentityPoolsResponse.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(ListIdentityPoolsResponse || (ListIdentityPoolsResponse = {}));\n\nexport var ListTagsForResourceInput;\n\n(function (ListTagsForResourceInput) {\n ListTagsForResourceInput.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(ListTagsForResourceInput || (ListTagsForResourceInput = {}));\n\nexport var ListTagsForResourceResponse;\n\n(function (ListTagsForResourceResponse) {\n ListTagsForResourceResponse.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(ListTagsForResourceResponse || (ListTagsForResourceResponse = {}));\n\nexport var LookupDeveloperIdentityInput;\n\n(function (LookupDeveloperIdentityInput) {\n LookupDeveloperIdentityInput.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(LookupDeveloperIdentityInput || (LookupDeveloperIdentityInput = {}));\n\nexport var LookupDeveloperIdentityResponse;\n\n(function (LookupDeveloperIdentityResponse) {\n LookupDeveloperIdentityResponse.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(LookupDeveloperIdentityResponse || (LookupDeveloperIdentityResponse = {}));\n\nexport var MergeDeveloperIdentitiesInput;\n\n(function (MergeDeveloperIdentitiesInput) {\n MergeDeveloperIdentitiesInput.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(MergeDeveloperIdentitiesInput || (MergeDeveloperIdentitiesInput = {}));\n\nexport var MergeDeveloperIdentitiesResponse;\n\n(function (MergeDeveloperIdentitiesResponse) {\n MergeDeveloperIdentitiesResponse.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(MergeDeveloperIdentitiesResponse || (MergeDeveloperIdentitiesResponse = {}));\n\nexport var ConcurrentModificationException;\n\n(function (ConcurrentModificationException) {\n ConcurrentModificationException.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(ConcurrentModificationException || (ConcurrentModificationException = {}));\n\nexport var SetIdentityPoolRolesInput;\n\n(function (SetIdentityPoolRolesInput) {\n SetIdentityPoolRolesInput.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(SetIdentityPoolRolesInput || (SetIdentityPoolRolesInput = {}));\n\nexport var TagResourceInput;\n\n(function (TagResourceInput) {\n TagResourceInput.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(TagResourceInput || (TagResourceInput = {}));\n\nexport var TagResourceResponse;\n\n(function (TagResourceResponse) {\n TagResourceResponse.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(TagResourceResponse || (TagResourceResponse = {}));\n\nexport var UnlinkDeveloperIdentityInput;\n\n(function (UnlinkDeveloperIdentityInput) {\n UnlinkDeveloperIdentityInput.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(UnlinkDeveloperIdentityInput || (UnlinkDeveloperIdentityInput = {}));\n\nexport var UnlinkIdentityInput;\n\n(function (UnlinkIdentityInput) {\n UnlinkIdentityInput.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(UnlinkIdentityInput || (UnlinkIdentityInput = {}));\n\nexport var UntagResourceInput;\n\n(function (UntagResourceInput) {\n UntagResourceInput.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(UntagResourceInput || (UntagResourceInput = {}));\n\nexport var UntagResourceResponse;\n\n(function (UntagResourceResponse) {\n UntagResourceResponse.filterSensitiveLog = function (obj) {\n return __assign({}, obj);\n };\n})(UntagResourceResponse || (UntagResourceResponse = {}));","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\n\n/* global Reflect, Promise */\nvar _extendStatics = function extendStatics(d, b) {\n _extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) {\n if (b.hasOwnProperty(p)) d[p] = b[p];\n }\n };\n\n return _extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n _extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nvar _assign = function __assign() {\n _assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return _assign.apply(this, arguments);\n};\n\nexport { _assign as __assign };\nexport function __rest(s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n}\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {\n if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n }\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\nexport function __param(paramIndex, decorator) {\n return function (target, key) {\n decorator(target, key, paramIndex);\n };\n}\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\nexport function __generator(thisArg, body) {\n var _ = {\n label: 0,\n sent: function sent() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n },\n f,\n y,\n t,\n g;\n return g = {\n next: verb(0),\n \"throw\": verb(1),\n \"return\": verb(2)\n }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () {\n return this;\n }), g;\n\n function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n\n while (_) {\n try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n\n case 7:\n op = _.ops.pop();\n\n _.trys.pop();\n\n continue;\n\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n\n if (t && _.label < t[2]) {\n _.label = t[2];\n\n _.ops.push(op);\n\n break;\n }\n\n if (t[2]) _.ops.pop();\n\n _.trys.pop();\n\n continue;\n }\n\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n }\n\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n}\nexport function __createBinding(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}\nexport function __exportStar(m, exports) {\n for (var p in m) {\n if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\n }\n}\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator,\n m = s && o[s],\n i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function next() {\n if (o && i >= o.length) o = void 0;\n return {\n value: o && o[i++],\n done: !o\n };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o),\n r,\n ar = [],\n e;\n\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {\n ar.push(r.value);\n }\n } catch (error) {\n e = {\n error: error\n };\n } finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n\n return ar;\n}\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++) {\n ar = ar.concat(__read(arguments[i]));\n }\n\n return ar;\n}\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) {\n s += arguments[i].length;\n }\n\n for (var r = Array(s), k = 0, i = 0; i < il; i++) {\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {\n r[k] = a[j];\n }\n }\n\n return r;\n}\n;\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []),\n i,\n q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () {\n return this;\n }, i;\n\n function verb(n) {\n if (g[n]) i[n] = function (v) {\n return new Promise(function (a, b) {\n q.push([n, v, a, b]) > 1 || resume(n, v);\n });\n };\n }\n\n function resume(n, v) {\n try {\n step(g[n](v));\n } catch (e) {\n settle(q[0][3], e);\n }\n }\n\n function step(r) {\n r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);\n }\n\n function fulfill(value) {\n resume(\"next\", value);\n }\n\n function reject(value) {\n resume(\"throw\", value);\n }\n\n function settle(f, v) {\n if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);\n }\n}\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) {\n throw e;\n }), verb(\"return\"), i[Symbol.iterator] = function () {\n return this;\n }, i;\n\n function verb(n, f) {\n i[n] = o[n] ? function (v) {\n return (p = !p) ? {\n value: __await(o[n](v)),\n done: n === \"return\"\n } : f ? f(v) : v;\n } : f;\n }\n}\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator],\n i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () {\n return this;\n }, i);\n\n function verb(n) {\n i[n] = o[n] && function (v) {\n return new Promise(function (resolve, reject) {\n v = o[n](v), settle(resolve, reject, v.done, v.value);\n });\n };\n }\n\n function settle(resolve, reject, d, v) {\n Promise.resolve(v).then(function (v) {\n resolve({\n value: v,\n done: d\n });\n }, reject);\n }\n}\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) {\n Object.defineProperty(cooked, \"raw\", {\n value: raw\n });\n } else {\n cooked.raw = raw;\n }\n\n return cooked;\n}\n;\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) {\n if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n }\n result.default = mod;\n return result;\n}\nexport function __importDefault(mod) {\n return mod && mod.__esModule ? mod : {\n default: mod\n };\n}\nexport function __classPrivateFieldGet(receiver, privateMap) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to get private field on non-instance\");\n }\n\n return privateMap.get(receiver);\n}\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to set private field on non-instance\");\n }\n\n privateMap.set(receiver, value);\n return value;\n}","import { __awaiter, __generator, __rest } from \"tslib\";\nexport var deserializerMiddleware = function deserializerMiddleware(options, deserializer) {\n return function (next, context) {\n return function (args) {\n return __awaiter(void 0, void 0, void 0, function () {\n var logger, outputFilterSensitiveLog, response, parsed, $metadata, outputWithoutMetadata;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n logger = context.logger, outputFilterSensitiveLog = context.outputFilterSensitiveLog;\n return [4\n /*yield*/\n , next(args)];\n\n case 1:\n response = _a.sent().response;\n\n if (typeof (logger === null || logger === void 0 ? void 0 : logger.debug) === \"function\") {\n logger.debug({\n httpResponse: response\n });\n }\n\n return [4\n /*yield*/\n , deserializer(response, options)];\n\n case 2:\n parsed = _a.sent();\n $metadata = parsed.$metadata, outputWithoutMetadata = __rest(parsed, [\"$metadata\"]);\n\n if (typeof (logger === null || logger === void 0 ? void 0 : logger.info) === \"function\") {\n logger.info({\n output: outputFilterSensitiveLog(outputWithoutMetadata)\n });\n }\n\n return [2\n /*return*/\n , {\n response: response,\n output: parsed\n }];\n }\n });\n });\n };\n };\n};","import { deserializerMiddleware } from \"./deserializerMiddleware\";\nimport { serializerMiddleware } from \"./serializerMiddleware\";\nexport var deserializerMiddlewareOption = {\n name: \"deserializerMiddleware\",\n step: \"deserialize\",\n tags: [\"DESERIALIZER\"]\n};\nexport var serializerMiddlewareOption = {\n name: \"serializerMiddleware\",\n step: \"serialize\",\n tags: [\"SERIALIZER\"]\n};\nexport function getSerdePlugin(config, serializer, deserializer) {\n return {\n applyToStack: function applyToStack(commandStack) {\n commandStack.add(deserializerMiddleware(config, deserializer), deserializerMiddlewareOption);\n commandStack.add(serializerMiddleware(config, serializer), serializerMiddlewareOption);\n }\n };\n}","import { __assign, __awaiter, __generator } from \"tslib\";\nexport var serializerMiddleware = function serializerMiddleware(options, serializer) {\n return function (next, context) {\n return function (args) {\n return __awaiter(void 0, void 0, void 0, function () {\n var logger, inputFilterSensitiveLog, request;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n logger = context.logger, inputFilterSensitiveLog = context.inputFilterSensitiveLog;\n\n if (typeof (logger === null || logger === void 0 ? void 0 : logger.info) === \"function\") {\n logger.info({\n input: inputFilterSensitiveLog(args.input)\n });\n }\n\n return [4\n /*yield*/\n , serializer(args.input, options)];\n\n case 1:\n request = _a.sent();\n\n if (typeof (logger === null || logger === void 0 ? void 0 : logger.debug) === \"function\") {\n logger.debug({\n httpRequest: request\n });\n }\n\n return [2\n /*return*/\n , next(__assign(__assign({}, args), {\n request: request\n }))];\n }\n });\n });\n };\n };\n};","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\n\n/* global Reflect, Promise */\nvar _extendStatics = function extendStatics(d, b) {\n _extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) {\n if (b.hasOwnProperty(p)) d[p] = b[p];\n }\n };\n\n return _extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n _extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nvar _assign = function __assign() {\n _assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return _assign.apply(this, arguments);\n};\n\nexport { _assign as __assign };\nexport function __rest(s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n}\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {\n if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n }\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\nexport function __param(paramIndex, decorator) {\n return function (target, key) {\n decorator(target, key, paramIndex);\n };\n}\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\nexport function __generator(thisArg, body) {\n var _ = {\n label: 0,\n sent: function sent() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n },\n f,\n y,\n t,\n g;\n return g = {\n next: verb(0),\n \"throw\": verb(1),\n \"return\": verb(2)\n }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () {\n return this;\n }), g;\n\n function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n\n while (_) {\n try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n\n case 7:\n op = _.ops.pop();\n\n _.trys.pop();\n\n continue;\n\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n\n if (t && _.label < t[2]) {\n _.label = t[2];\n\n _.ops.push(op);\n\n break;\n }\n\n if (t[2]) _.ops.pop();\n\n _.trys.pop();\n\n continue;\n }\n\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n }\n\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n}\nexport function __createBinding(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}\nexport function __exportStar(m, exports) {\n for (var p in m) {\n if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\n }\n}\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator,\n m = s && o[s],\n i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function next() {\n if (o && i >= o.length) o = void 0;\n return {\n value: o && o[i++],\n done: !o\n };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o),\n r,\n ar = [],\n e;\n\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {\n ar.push(r.value);\n }\n } catch (error) {\n e = {\n error: error\n };\n } finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n\n return ar;\n}\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++) {\n ar = ar.concat(__read(arguments[i]));\n }\n\n return ar;\n}\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) {\n s += arguments[i].length;\n }\n\n for (var r = Array(s), k = 0, i = 0; i < il; i++) {\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {\n r[k] = a[j];\n }\n }\n\n return r;\n}\n;\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []),\n i,\n q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () {\n return this;\n }, i;\n\n function verb(n) {\n if (g[n]) i[n] = function (v) {\n return new Promise(function (a, b) {\n q.push([n, v, a, b]) > 1 || resume(n, v);\n });\n };\n }\n\n function resume(n, v) {\n try {\n step(g[n](v));\n } catch (e) {\n settle(q[0][3], e);\n }\n }\n\n function step(r) {\n r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);\n }\n\n function fulfill(value) {\n resume(\"next\", value);\n }\n\n function reject(value) {\n resume(\"throw\", value);\n }\n\n function settle(f, v) {\n if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);\n }\n}\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) {\n throw e;\n }), verb(\"return\"), i[Symbol.iterator] = function () {\n return this;\n }, i;\n\n function verb(n, f) {\n i[n] = o[n] ? function (v) {\n return (p = !p) ? {\n value: __await(o[n](v)),\n done: n === \"return\"\n } : f ? f(v) : v;\n } : f;\n }\n}\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator],\n i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () {\n return this;\n }, i);\n\n function verb(n) {\n i[n] = o[n] && function (v) {\n return new Promise(function (resolve, reject) {\n v = o[n](v), settle(resolve, reject, v.done, v.value);\n });\n };\n }\n\n function settle(resolve, reject, d, v) {\n Promise.resolve(v).then(function (v) {\n resolve({\n value: v,\n done: d\n });\n }, reject);\n }\n}\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) {\n Object.defineProperty(cooked, \"raw\", {\n value: raw\n });\n } else {\n cooked.raw = raw;\n }\n\n return cooked;\n}\n;\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) {\n if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n }\n result.default = mod;\n return result;\n}\nexport function __importDefault(mod) {\n return mod && mod.__esModule ? mod : {\n default: mod\n };\n}\nexport function __classPrivateFieldGet(receiver, privateMap) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to get private field on non-instance\");\n }\n\n return privateMap.get(receiver);\n}\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to set private field on non-instance\");\n }\n\n privateMap.set(receiver, value);\n return value;\n}","import { __assign, __read, __spread, __values } from \"tslib\";\nexport var constructStack = function constructStack() {\n var absoluteEntries = [];\n var relativeEntries = [];\n var entriesNameSet = new Set();\n\n var sort = function sort(entries) {\n return entries.sort(function (a, b) {\n return stepWeights[b.step] - stepWeights[a.step] || priorityWeights[b.priority || \"normal\"] - priorityWeights[a.priority || \"normal\"];\n });\n };\n\n var removeByName = function removeByName(toRemove) {\n var isRemoved = false;\n\n var filterCb = function filterCb(entry) {\n if (entry.name && entry.name === toRemove) {\n isRemoved = true;\n entriesNameSet.delete(toRemove);\n return false;\n }\n\n return true;\n };\n\n absoluteEntries = absoluteEntries.filter(filterCb);\n relativeEntries = relativeEntries.filter(filterCb);\n return isRemoved;\n };\n\n var removeByReference = function removeByReference(toRemove) {\n var isRemoved = false;\n\n var filterCb = function filterCb(entry) {\n if (entry.middleware === toRemove) {\n isRemoved = true;\n if (entry.name) entriesNameSet.delete(entry.name);\n return false;\n }\n\n return true;\n };\n\n absoluteEntries = absoluteEntries.filter(filterCb);\n relativeEntries = relativeEntries.filter(filterCb);\n return isRemoved;\n };\n\n var cloneTo = function cloneTo(toStack) {\n absoluteEntries.forEach(function (entry) {\n //@ts-ignore\n toStack.add(entry.middleware, __assign({}, entry));\n });\n relativeEntries.forEach(function (entry) {\n //@ts-ignore\n toStack.addRelativeTo(entry.middleware, __assign({}, entry));\n });\n return toStack;\n };\n\n var expandRelativeMiddlewareList = function expandRelativeMiddlewareList(from) {\n var expandedMiddlewareList = [];\n from.before.forEach(function (entry) {\n if (entry.before.length === 0 && entry.after.length === 0) {\n expandedMiddlewareList.push(entry);\n } else {\n expandedMiddlewareList.push.apply(expandedMiddlewareList, __spread(expandRelativeMiddlewareList(entry)));\n }\n });\n expandedMiddlewareList.push(from);\n from.after.reverse().forEach(function (entry) {\n if (entry.before.length === 0 && entry.after.length === 0) {\n expandedMiddlewareList.push(entry);\n } else {\n expandedMiddlewareList.push.apply(expandedMiddlewareList, __spread(expandRelativeMiddlewareList(entry)));\n }\n });\n return expandedMiddlewareList;\n };\n /**\n * Get a final list of middleware in the order of being executed in the resolved handler.\n */\n\n\n var getMiddlewareList = function getMiddlewareList() {\n var normalizedAbsoluteEntries = [];\n var normalizedRelativeEntries = [];\n var normalizedEntriesNameMap = {};\n absoluteEntries.forEach(function (entry) {\n var normalizedEntry = __assign(__assign({}, entry), {\n before: [],\n after: []\n });\n\n if (normalizedEntry.name) normalizedEntriesNameMap[normalizedEntry.name] = normalizedEntry;\n normalizedAbsoluteEntries.push(normalizedEntry);\n });\n relativeEntries.forEach(function (entry) {\n var normalizedEntry = __assign(__assign({}, entry), {\n before: [],\n after: []\n });\n\n if (normalizedEntry.name) normalizedEntriesNameMap[normalizedEntry.name] = normalizedEntry;\n normalizedRelativeEntries.push(normalizedEntry);\n });\n normalizedRelativeEntries.forEach(function (entry) {\n if (entry.toMiddleware) {\n var toMiddleware = normalizedEntriesNameMap[entry.toMiddleware];\n\n if (toMiddleware === undefined) {\n throw new Error(entry.toMiddleware + \" is not found when adding \" + (entry.name || \"anonymous\") + \" middleware \" + entry.relation + \" \" + entry.toMiddleware);\n }\n\n if (entry.relation === \"after\") {\n toMiddleware.after.push(entry);\n }\n\n if (entry.relation === \"before\") {\n toMiddleware.before.push(entry);\n }\n }\n });\n var mainChain = sort(normalizedAbsoluteEntries).map(expandRelativeMiddlewareList).reduce(function (wholeList, expendedMiddlewareList) {\n // TODO: Replace it with Array.flat();\n wholeList.push.apply(wholeList, __spread(expendedMiddlewareList));\n return wholeList;\n }, []);\n return mainChain.map(function (entry) {\n return entry.middleware;\n });\n };\n\n var stack = {\n add: function add(middleware, options) {\n if (options === void 0) {\n options = {};\n }\n\n var name = options.name;\n\n var entry = __assign({\n step: \"initialize\",\n priority: \"normal\",\n middleware: middleware\n }, options);\n\n if (name) {\n if (entriesNameSet.has(name)) {\n throw new Error(\"Duplicate middleware name '\" + name + \"'\");\n }\n\n entriesNameSet.add(name);\n }\n\n absoluteEntries.push(entry);\n },\n addRelativeTo: function addRelativeTo(middleware, options) {\n var name = options.name;\n\n var entry = __assign({\n middleware: middleware\n }, options);\n\n if (name) {\n if (entriesNameSet.has(name)) {\n throw new Error(\"Duplicated middleware name '\" + name + \"'\");\n }\n\n entriesNameSet.add(name);\n }\n\n relativeEntries.push(entry);\n },\n clone: function clone() {\n return cloneTo(constructStack());\n },\n use: function use(plugin) {\n plugin.applyToStack(stack);\n },\n remove: function remove(toRemove) {\n if (typeof toRemove === \"string\") return removeByName(toRemove);else return removeByReference(toRemove);\n },\n removeByTag: function removeByTag(toRemove) {\n var isRemoved = false;\n\n var filterCb = function filterCb(entry) {\n var tags = entry.tags,\n name = entry.name;\n\n if (tags && tags.includes(toRemove)) {\n if (name) entriesNameSet.delete(name);\n isRemoved = true;\n return false;\n }\n\n return true;\n };\n\n absoluteEntries = absoluteEntries.filter(filterCb);\n relativeEntries = relativeEntries.filter(filterCb);\n return isRemoved;\n },\n concat: function concat(from) {\n var cloned = cloneTo(constructStack());\n cloned.use(from);\n return cloned;\n },\n applyToStack: cloneTo,\n resolve: function resolve(handler, context) {\n var e_1, _a;\n\n try {\n for (var _b = __values(getMiddlewareList().reverse()), _c = _b.next(); !_c.done; _c = _b.next()) {\n var middleware = _c.value;\n handler = middleware(handler, context);\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n\n return handler;\n }\n };\n return stack;\n};\nvar stepWeights = {\n initialize: 5,\n serialize: 4,\n build: 3,\n finalizeRequest: 2,\n deserialize: 1\n};\nvar priorityWeights = {\n high: 3,\n normal: 2,\n low: 1\n};","import { constructStack } from \"@aws-sdk/middleware-stack\";\n\nvar Client =\n/** @class */\nfunction () {\n function Client(config) {\n this.middlewareStack = constructStack();\n this.config = config;\n }\n\n Client.prototype.send = function (command, optionsOrCb, cb) {\n var options = typeof optionsOrCb !== \"function\" ? optionsOrCb : undefined;\n var callback = typeof optionsOrCb === \"function\" ? optionsOrCb : cb;\n var handler = command.resolveMiddleware(this.middlewareStack, this.config, options);\n\n if (callback) {\n handler(command).then(function (result) {\n return callback(null, result.output);\n }, function (err) {\n return callback(err);\n }).catch( // prevent any errors thrown in the callback from triggering an\n // unhandled promise rejection\n function () {});\n } else {\n return handler(command).then(function (result) {\n return result.output;\n });\n }\n };\n\n Client.prototype.destroy = function () {\n if (this.config.requestHandler.destroy) this.config.requestHandler.destroy();\n };\n\n return Client;\n}();\n\nexport { Client };","import { constructStack } from \"@aws-sdk/middleware-stack\";\n\nvar Command =\n/** @class */\nfunction () {\n function Command() {\n this.middlewareStack = constructStack();\n }\n\n return Command;\n}();\n\nexport { Command };","/**\n * The XML parser will set one K:V for a member that could\n * return multiple entries but only has one.\n */\nexport var getArrayIfSingleItem = function getArrayIfSingleItem(mayBeArray) {\n return Array.isArray(mayBeArray) ? mayBeArray : [mayBeArray];\n};","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\n\n/* global Reflect, Promise */\nvar _extendStatics = function extendStatics(d, b) {\n _extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) {\n if (b.hasOwnProperty(p)) d[p] = b[p];\n }\n };\n\n return _extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n _extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nvar _assign = function __assign() {\n _assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return _assign.apply(this, arguments);\n};\n\nexport { _assign as __assign };\nexport function __rest(s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n}\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {\n if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n }\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\nexport function __param(paramIndex, decorator) {\n return function (target, key) {\n decorator(target, key, paramIndex);\n };\n}\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\nexport function __generator(thisArg, body) {\n var _ = {\n label: 0,\n sent: function sent() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n },\n f,\n y,\n t,\n g;\n return g = {\n next: verb(0),\n \"throw\": verb(1),\n \"return\": verb(2)\n }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () {\n return this;\n }), g;\n\n function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n\n while (_) {\n try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n\n case 7:\n op = _.ops.pop();\n\n _.trys.pop();\n\n continue;\n\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n\n if (t && _.label < t[2]) {\n _.label = t[2];\n\n _.ops.push(op);\n\n break;\n }\n\n if (t[2]) _.ops.pop();\n\n _.trys.pop();\n\n continue;\n }\n\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n }\n\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n}\nexport function __createBinding(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}\nexport function __exportStar(m, exports) {\n for (var p in m) {\n if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\n }\n}\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator,\n m = s && o[s],\n i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function next() {\n if (o && i >= o.length) o = void 0;\n return {\n value: o && o[i++],\n done: !o\n };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o),\n r,\n ar = [],\n e;\n\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {\n ar.push(r.value);\n }\n } catch (error) {\n e = {\n error: error\n };\n } finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n\n return ar;\n}\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++) {\n ar = ar.concat(__read(arguments[i]));\n }\n\n return ar;\n}\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) {\n s += arguments[i].length;\n }\n\n for (var r = Array(s), k = 0, i = 0; i < il; i++) {\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {\n r[k] = a[j];\n }\n }\n\n return r;\n}\n;\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []),\n i,\n q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () {\n return this;\n }, i;\n\n function verb(n) {\n if (g[n]) i[n] = function (v) {\n return new Promise(function (a, b) {\n q.push([n, v, a, b]) > 1 || resume(n, v);\n });\n };\n }\n\n function resume(n, v) {\n try {\n step(g[n](v));\n } catch (e) {\n settle(q[0][3], e);\n }\n }\n\n function step(r) {\n r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);\n }\n\n function fulfill(value) {\n resume(\"next\", value);\n }\n\n function reject(value) {\n resume(\"throw\", value);\n }\n\n function settle(f, v) {\n if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);\n }\n}\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) {\n throw e;\n }), verb(\"return\"), i[Symbol.iterator] = function () {\n return this;\n }, i;\n\n function verb(n, f) {\n i[n] = o[n] ? function (v) {\n return (p = !p) ? {\n value: __await(o[n](v)),\n done: n === \"return\"\n } : f ? f(v) : v;\n } : f;\n }\n}\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator],\n i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () {\n return this;\n }, i);\n\n function verb(n) {\n i[n] = o[n] && function (v) {\n return new Promise(function (resolve, reject) {\n v = o[n](v), settle(resolve, reject, v.done, v.value);\n });\n };\n }\n\n function settle(resolve, reject, d, v) {\n Promise.resolve(v).then(function (v) {\n resolve({\n value: v,\n done: d\n });\n }, reject);\n }\n}\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) {\n Object.defineProperty(cooked, \"raw\", {\n value: raw\n });\n } else {\n cooked.raw = raw;\n }\n\n return cooked;\n}\n;\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) {\n if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n }\n result.default = mod;\n return result;\n}\nexport function __importDefault(mod) {\n return mod && mod.__esModule ? mod : {\n default: mod\n };\n}\nexport function __classPrivateFieldGet(receiver, privateMap) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to get private field on non-instance\");\n }\n\n return privateMap.get(receiver);\n}\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to set private field on non-instance\");\n }\n\n privateMap.set(receiver, value);\n return value;\n}","/**\n * Lazy String holder for JSON typed contents.\n */\nimport { __extends, __read, __spread } from \"tslib\";\n/**\n * Because of https://github.com/microsoft/tslib/issues/95,\n * TS 'extends' shim doesn't support extending native types like String.\n * So here we create StringWrapper that duplicate everything from String\n * class including its prototype chain. So we can extend from here.\n */\n// @ts-ignore StringWrapper implementation is not a simple constructor\n\nexport var StringWrapper = function StringWrapper() {\n //@ts-ignore 'this' cannot be assigned to any, but Object.getPrototypeOf accepts any\n var Class = Object.getPrototypeOf(this).constructor;\n var Constructor = Function.bind.apply(String, __spread([null], arguments)); //@ts-ignore Call wrapped String constructor directly, don't bother typing it.\n\n var instance = new Constructor();\n Object.setPrototypeOf(instance, Class.prototype);\n return instance;\n};\nStringWrapper.prototype = Object.create(String.prototype, {\n constructor: {\n value: StringWrapper,\n enumerable: false,\n writable: true,\n configurable: true\n }\n});\nObject.setPrototypeOf(StringWrapper, String);\n\nvar LazyJsonString =\n/** @class */\nfunction (_super) {\n __extends(LazyJsonString, _super);\n\n function LazyJsonString() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n\n LazyJsonString.prototype.deserializeJSON = function () {\n return JSON.parse(_super.prototype.toString.call(this));\n };\n\n LazyJsonString.prototype.toJSON = function () {\n return _super.prototype.toString.call(this);\n };\n\n LazyJsonString.fromObject = function (object) {\n if (object instanceof LazyJsonString) {\n return object;\n } else if (object instanceof String || typeof object === \"string\") {\n return new LazyJsonString(object);\n }\n\n return new LazyJsonString(JSON.stringify(object));\n };\n\n return LazyJsonString;\n}(StringWrapper);\n\nexport { LazyJsonString };","export var SENSITIVE_STRING = \"***SensitiveInformation***\";","import { __extends } from \"tslib\";\nimport { GetCredentialsForIdentityInput, GetCredentialsForIdentityResponse } from \"../models/models_0\";\nimport { deserializeAws_json1_1GetCredentialsForIdentityCommand, serializeAws_json1_1GetCredentialsForIdentityCommand } from \"../protocols/Aws_json1_1\";\nimport { getSerdePlugin } from \"@aws-sdk/middleware-serde\";\nimport { Command as $Command } from \"@aws-sdk/smithy-client\";\n\nvar GetCredentialsForIdentityCommand =\n/** @class */\nfunction (_super) {\n __extends(GetCredentialsForIdentityCommand, _super); // Start section: command_properties\n // End section: command_properties\n\n\n function GetCredentialsForIdentityCommand(input) {\n var _this = // Start section: command_constructor\n _super.call(this) || this;\n\n _this.input = input;\n return _this; // End section: command_constructor\n }\n\n GetCredentialsForIdentityCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {\n this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));\n var stack = clientStack.concat(this.middlewareStack);\n var logger = configuration.logger;\n var clientName = \"CognitoIdentityClient\";\n var commandName = \"GetCredentialsForIdentityCommand\";\n var handlerExecutionContext = {\n logger: logger,\n clientName: clientName,\n commandName: commandName,\n inputFilterSensitiveLog: GetCredentialsForIdentityInput.filterSensitiveLog,\n outputFilterSensitiveLog: GetCredentialsForIdentityResponse.filterSensitiveLog\n };\n\n if (typeof logger.info === \"function\") {\n logger.info({\n clientName: clientName,\n commandName: commandName\n });\n }\n\n var requestHandler = configuration.requestHandler;\n return stack.resolve(function (request) {\n return requestHandler.handle(request.request, options || {});\n }, handlerExecutionContext);\n };\n\n GetCredentialsForIdentityCommand.prototype.serialize = function (input, context) {\n return serializeAws_json1_1GetCredentialsForIdentityCommand(input, context);\n };\n\n GetCredentialsForIdentityCommand.prototype.deserialize = function (output, context) {\n return deserializeAws_json1_1GetCredentialsForIdentityCommand(output, context);\n };\n\n return GetCredentialsForIdentityCommand;\n}($Command);\n\nexport { GetCredentialsForIdentityCommand };","import { __extends } from \"tslib\";\n/**\n * An error representing a failure of an individual credential provider.\n *\n * This error class has special meaning to the {@link chain} method. If a\n * provider in the chain is rejected with an error, the chain will only proceed\n * to the next provider if the value of the `tryNextLink` property on the error\n * is truthy. This allows individual providers to halt the chain and also\n * ensures the chain will stop if an entirely unexpected error is encountered.\n */\n\nvar ProviderError =\n/** @class */\nfunction (_super) {\n __extends(ProviderError, _super);\n\n function ProviderError(message, tryNextLink) {\n if (tryNextLink === void 0) {\n tryNextLink = true;\n }\n\n var _this = _super.call(this, message) || this;\n\n _this.tryNextLink = tryNextLink;\n return _this;\n }\n\n return ProviderError;\n}(Error);\n\nexport { ProviderError };","import { __read } from \"tslib\";\n/**\n * @internal\n */\n\nexport function resolveLogins(logins) {\n return Promise.all(Object.keys(logins).reduce(function (arr, name) {\n var tokenOrProvider = logins[name];\n\n if (typeof tokenOrProvider === \"string\") {\n arr.push([name, tokenOrProvider]);\n } else {\n arr.push(tokenOrProvider().then(function (token) {\n return [name, token];\n }));\n }\n\n return arr;\n }, [])).then(function (resolvedPairs) {\n return resolvedPairs.reduce(function (logins, _a) {\n var _b = __read(_a, 2),\n key = _b[0],\n value = _b[1];\n\n logins[key] = value;\n return logins;\n }, {});\n });\n}","import { __awaiter, __generator } from \"tslib\";\nimport { GetCredentialsForIdentityCommand } from \"@aws-sdk/client-cognito-identity\";\nimport { ProviderError } from \"@aws-sdk/property-provider\";\nimport { resolveLogins } from \"./resolveLogins\";\n/**\n * Retrieves temporary AWS credentials using Amazon Cognito's\n * `GetCredentialsForIdentity` operation.\n *\n * Results from this function call are not cached internally.\n */\n\nexport function fromCognitoIdentity(parameters) {\n var _this = this;\n\n return function () {\n return __awaiter(_this, void 0, void 0, function () {\n var _a, _b, _c, AccessKeyId, Expiration, _d, SecretKey, SessionToken, _e, _f, _g, _h;\n\n var _j;\n\n return __generator(this, function (_k) {\n switch (_k.label) {\n case 0:\n _f = (_e = parameters.client).send;\n _g = GetCredentialsForIdentityCommand.bind;\n _j = {\n CustomRoleArn: parameters.customRoleArn,\n IdentityId: parameters.identityId\n };\n if (!parameters.logins) return [3\n /*break*/\n , 2];\n return [4\n /*yield*/\n , resolveLogins(parameters.logins)];\n\n case 1:\n _h = _k.sent();\n return [3\n /*break*/\n , 3];\n\n case 2:\n _h = undefined;\n _k.label = 3;\n\n case 3:\n return [4\n /*yield*/\n , _f.apply(_e, [new (_g.apply(GetCredentialsForIdentityCommand, [void 0, (_j.Logins = _h, _j)]))()])];\n\n case 4:\n _a = _k.sent().Credentials, _b = _a === void 0 ? throwOnMissingCredentials() : _a, _c = _b.AccessKeyId, AccessKeyId = _c === void 0 ? throwOnMissingAccessKeyId() : _c, Expiration = _b.Expiration, _d = _b.SecretKey, SecretKey = _d === void 0 ? throwOnMissingSecretKey() : _d, SessionToken = _b.SessionToken;\n return [2\n /*return*/\n , {\n identityId: parameters.identityId,\n accessKeyId: AccessKeyId,\n secretAccessKey: SecretKey,\n sessionToken: SessionToken,\n expiration: Expiration\n }];\n }\n });\n });\n };\n}\n\nfunction throwOnMissingAccessKeyId() {\n throw new ProviderError(\"Response from Amazon Cognito contained no access key ID\");\n}\n\nfunction throwOnMissingCredentials() {\n throw new ProviderError(\"Response from Amazon Cognito contained no credentials\");\n}\n\nfunction throwOnMissingSecretKey() {\n throw new ProviderError(\"Response from Amazon Cognito contained no secret key\");\n}","import { __extends } from \"tslib\";\nimport { GetIdInput, GetIdResponse } from \"../models/models_0\";\nimport { deserializeAws_json1_1GetIdCommand, serializeAws_json1_1GetIdCommand } from \"../protocols/Aws_json1_1\";\nimport { getSerdePlugin } from \"@aws-sdk/middleware-serde\";\nimport { Command as $Command } from \"@aws-sdk/smithy-client\";\n\nvar GetIdCommand =\n/** @class */\nfunction (_super) {\n __extends(GetIdCommand, _super); // Start section: command_properties\n // End section: command_properties\n\n\n function GetIdCommand(input) {\n var _this = // Start section: command_constructor\n _super.call(this) || this;\n\n _this.input = input;\n return _this; // End section: command_constructor\n }\n\n GetIdCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {\n this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));\n var stack = clientStack.concat(this.middlewareStack);\n var logger = configuration.logger;\n var clientName = \"CognitoIdentityClient\";\n var commandName = \"GetIdCommand\";\n var handlerExecutionContext = {\n logger: logger,\n clientName: clientName,\n commandName: commandName,\n inputFilterSensitiveLog: GetIdInput.filterSensitiveLog,\n outputFilterSensitiveLog: GetIdResponse.filterSensitiveLog\n };\n\n if (typeof logger.info === \"function\") {\n logger.info({\n clientName: clientName,\n commandName: commandName\n });\n }\n\n var requestHandler = configuration.requestHandler;\n return stack.resolve(function (request) {\n return requestHandler.handle(request.request, options || {});\n }, handlerExecutionContext);\n };\n\n GetIdCommand.prototype.serialize = function (input, context) {\n return serializeAws_json1_1GetIdCommand(input, context);\n };\n\n GetIdCommand.prototype.deserialize = function (output, context) {\n return deserializeAws_json1_1GetIdCommand(output, context);\n };\n\n return GetIdCommand;\n}($Command);\n\nexport { GetIdCommand };","var STORE_NAME = \"IdentityIds\";\n\nvar IndexedDbStorage =\n/** @class */\nfunction () {\n function IndexedDbStorage(dbName) {\n if (dbName === void 0) {\n dbName = \"aws:cognito-identity-ids\";\n }\n\n this.dbName = dbName;\n }\n\n IndexedDbStorage.prototype.getItem = function (key) {\n return this.withObjectStore(\"readonly\", function (store) {\n var req = store.get(key);\n return new Promise(function (resolve) {\n req.onerror = function () {\n return resolve(null);\n };\n\n req.onsuccess = function () {\n return resolve(req.result ? req.result.value : null);\n };\n });\n }).catch(function () {\n return null;\n });\n };\n\n IndexedDbStorage.prototype.removeItem = function (key) {\n return this.withObjectStore(\"readwrite\", function (store) {\n var req = store.delete(key);\n return new Promise(function (resolve, reject) {\n req.onerror = function () {\n return reject(req.error);\n };\n\n req.onsuccess = function () {\n return resolve();\n };\n });\n });\n };\n\n IndexedDbStorage.prototype.setItem = function (id, value) {\n return this.withObjectStore(\"readwrite\", function (store) {\n var req = store.put({\n id: id,\n value: value\n });\n return new Promise(function (resolve, reject) {\n req.onerror = function () {\n return reject(req.error);\n };\n\n req.onsuccess = function () {\n return resolve();\n };\n });\n });\n };\n\n IndexedDbStorage.prototype.getDb = function () {\n var openDbRequest = self.indexedDB.open(this.dbName, 1);\n return new Promise(function (resolve, reject) {\n openDbRequest.onsuccess = function () {\n resolve(openDbRequest.result);\n };\n\n openDbRequest.onerror = function () {\n reject(openDbRequest.error);\n };\n\n openDbRequest.onblocked = function () {\n reject(new Error(\"Unable to access DB\"));\n };\n\n openDbRequest.onupgradeneeded = function () {\n var db = openDbRequest.result;\n\n db.onerror = function () {\n reject(new Error(\"Failed to create object store\"));\n };\n\n db.createObjectStore(STORE_NAME, {\n keyPath: \"id\"\n });\n };\n });\n };\n\n IndexedDbStorage.prototype.withObjectStore = function (mode, action) {\n return this.getDb().then(function (db) {\n var tx = db.transaction(STORE_NAME, mode);\n\n tx.oncomplete = function () {\n return db.close();\n };\n\n return new Promise(function (resolve, reject) {\n tx.onerror = function () {\n return reject(tx.error);\n };\n\n resolve(action(tx.objectStore(STORE_NAME)));\n }).catch(function (err) {\n db.close();\n throw err;\n });\n });\n };\n\n return IndexedDbStorage;\n}();\n\nexport { IndexedDbStorage };","import { IndexedDbStorage } from \"./IndexedDbStorage\";\nimport { InMemoryStorage } from \"./InMemoryStorage\";\nvar inMemoryStorage = new InMemoryStorage();\nexport function localStorage() {\n if (typeof self === \"object\" && self.indexedDB) {\n return new IndexedDbStorage();\n }\n\n if (typeof window === \"object\" && window.localStorage) {\n return window.localStorage;\n }\n\n return inMemoryStorage;\n}","var InMemoryStorage =\n/** @class */\nfunction () {\n function InMemoryStorage(store) {\n if (store === void 0) {\n store = {};\n }\n\n this.store = store;\n }\n\n InMemoryStorage.prototype.getItem = function (key) {\n if (key in this.store) {\n return this.store[key];\n }\n\n return null;\n };\n\n InMemoryStorage.prototype.removeItem = function (key) {\n delete this.store[key];\n };\n\n InMemoryStorage.prototype.setItem = function (key, value) {\n this.store[key] = value;\n };\n\n return InMemoryStorage;\n}();\n\nexport { InMemoryStorage };","import { __awaiter, __generator } from \"tslib\";\nimport { GetIdCommand } from \"@aws-sdk/client-cognito-identity\";\nimport { ProviderError } from \"@aws-sdk/property-provider\";\nimport { fromCognitoIdentity } from \"./fromCognitoIdentity\";\nimport { localStorage } from \"./localStorage\";\nimport { resolveLogins } from \"./resolveLogins\";\n/**\n * Retrieves or generates a unique identifier using Amazon Cognito's `GetId`\n * operation, then generates temporary AWS credentials using Amazon Cognito's\n * `GetCredentialsForIdentity` operation.\n *\n * Results from `GetId` are cached internally, but results from\n * `GetCredentialsForIdentity` are not.\n */\n\nexport function fromCognitoIdentityPool(_a) {\n var _this = this;\n\n var accountId = _a.accountId,\n _b = _a.cache,\n cache = _b === void 0 ? localStorage() : _b,\n client = _a.client,\n customRoleArn = _a.customRoleArn,\n identityPoolId = _a.identityPoolId,\n logins = _a.logins,\n _c = _a.userIdentifier,\n userIdentifier = _c === void 0 ? !logins || Object.keys(logins).length === 0 ? \"ANONYMOUS\" : undefined : _c;\n var cacheKey = userIdentifier ? \"aws:cognito-identity-credentials:\" + identityPoolId + \":\" + userIdentifier : undefined;\n\n var _provider = function provider() {\n return __awaiter(_this, void 0, void 0, function () {\n var identityId, _a, _b, IdentityId, _c, _d, _e, _f;\n\n var _g;\n\n return __generator(this, function (_h) {\n switch (_h.label) {\n case 0:\n _a = cacheKey;\n if (!_a) return [3\n /*break*/\n , 2];\n return [4\n /*yield*/\n , cache.getItem(cacheKey)];\n\n case 1:\n _a = _h.sent();\n _h.label = 2;\n\n case 2:\n identityId = _a;\n if (!!identityId) return [3\n /*break*/\n , 7];\n _d = (_c = client).send;\n _e = GetIdCommand.bind;\n _g = {\n AccountId: accountId,\n IdentityPoolId: identityPoolId\n };\n if (!logins) return [3\n /*break*/\n , 4];\n return [4\n /*yield*/\n , resolveLogins(logins)];\n\n case 3:\n _f = _h.sent();\n return [3\n /*break*/\n , 5];\n\n case 4:\n _f = undefined;\n _h.label = 5;\n\n case 5:\n return [4\n /*yield*/\n , _d.apply(_c, [new (_e.apply(GetIdCommand, [void 0, (_g.Logins = _f, _g)]))()])];\n\n case 6:\n _b = _h.sent().IdentityId, IdentityId = _b === void 0 ? throwOnMissingId() : _b;\n identityId = IdentityId;\n\n if (cacheKey) {\n Promise.resolve(cache.setItem(cacheKey, identityId)).catch(function () {});\n }\n\n _h.label = 7;\n\n case 7:\n _provider = fromCognitoIdentity({\n client: client,\n customRoleArn: customRoleArn,\n logins: logins,\n identityId: identityId\n });\n return [2\n /*return*/\n , _provider()];\n }\n });\n });\n };\n\n return function () {\n return _provider().catch(function (err) {\n return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n if (cacheKey) {\n Promise.resolve(cache.removeItem(cacheKey)).catch(function () {});\n }\n\n throw err;\n });\n });\n });\n };\n}\n\nfunction throwOnMissingId() {\n throw new ProviderError(\"Response from Amazon Cognito contained no identity ID\");\n}","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\n\n/* global Reflect, Promise */\nvar _extendStatics = function extendStatics(d, b) {\n _extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) {\n if (b.hasOwnProperty(p)) d[p] = b[p];\n }\n };\n\n return _extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n _extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nvar _assign = function __assign() {\n _assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return _assign.apply(this, arguments);\n};\n\nexport { _assign as __assign };\nexport function __rest(s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n}\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {\n if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n }\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\nexport function __param(paramIndex, decorator) {\n return function (target, key) {\n decorator(target, key, paramIndex);\n };\n}\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\nexport function __generator(thisArg, body) {\n var _ = {\n label: 0,\n sent: function sent() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n },\n f,\n y,\n t,\n g;\n return g = {\n next: verb(0),\n \"throw\": verb(1),\n \"return\": verb(2)\n }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () {\n return this;\n }), g;\n\n function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n\n while (_) {\n try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n\n case 7:\n op = _.ops.pop();\n\n _.trys.pop();\n\n continue;\n\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n\n if (t && _.label < t[2]) {\n _.label = t[2];\n\n _.ops.push(op);\n\n break;\n }\n\n if (t[2]) _.ops.pop();\n\n _.trys.pop();\n\n continue;\n }\n\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n }\n\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n}\nexport function __createBinding(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}\nexport function __exportStar(m, exports) {\n for (var p in m) {\n if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\n }\n}\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator,\n m = s && o[s],\n i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function next() {\n if (o && i >= o.length) o = void 0;\n return {\n value: o && o[i++],\n done: !o\n };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o),\n r,\n ar = [],\n e;\n\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {\n ar.push(r.value);\n }\n } catch (error) {\n e = {\n error: error\n };\n } finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n\n return ar;\n}\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++) {\n ar = ar.concat(__read(arguments[i]));\n }\n\n return ar;\n}\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) {\n s += arguments[i].length;\n }\n\n for (var r = Array(s), k = 0, i = 0; i < il; i++) {\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {\n r[k] = a[j];\n }\n }\n\n return r;\n}\n;\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []),\n i,\n q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () {\n return this;\n }, i;\n\n function verb(n) {\n if (g[n]) i[n] = function (v) {\n return new Promise(function (a, b) {\n q.push([n, v, a, b]) > 1 || resume(n, v);\n });\n };\n }\n\n function resume(n, v) {\n try {\n step(g[n](v));\n } catch (e) {\n settle(q[0][3], e);\n }\n }\n\n function step(r) {\n r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);\n }\n\n function fulfill(value) {\n resume(\"next\", value);\n }\n\n function reject(value) {\n resume(\"throw\", value);\n }\n\n function settle(f, v) {\n if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);\n }\n}\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) {\n throw e;\n }), verb(\"return\"), i[Symbol.iterator] = function () {\n return this;\n }, i;\n\n function verb(n, f) {\n i[n] = o[n] ? function (v) {\n return (p = !p) ? {\n value: __await(o[n](v)),\n done: n === \"return\"\n } : f ? f(v) : v;\n } : f;\n }\n}\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator],\n i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () {\n return this;\n }, i);\n\n function verb(n) {\n i[n] = o[n] && function (v) {\n return new Promise(function (resolve, reject) {\n v = o[n](v), settle(resolve, reject, v.done, v.value);\n });\n };\n }\n\n function settle(resolve, reject, d, v) {\n Promise.resolve(v).then(function (v) {\n resolve({\n value: v,\n done: d\n });\n }, reject);\n }\n}\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) {\n Object.defineProperty(cooked, \"raw\", {\n value: raw\n });\n } else {\n cooked.raw = raw;\n }\n\n return cooked;\n}\n;\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) {\n if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n }\n result.default = mod;\n return result;\n}\nexport function __importDefault(mod) {\n return mod && mod.__esModule ? mod : {\n default: mod\n };\n}\nexport function __classPrivateFieldGet(receiver, privateMap) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to get private field on non-instance\");\n }\n\n return privateMap.get(receiver);\n}\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to set private field on non-instance\");\n }\n\n privateMap.set(receiver, value);\n return value;\n}","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\n\n/* global Reflect, Promise */\nvar _extendStatics = function extendStatics(d, b) {\n _extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) {\n if (b.hasOwnProperty(p)) d[p] = b[p];\n }\n };\n\n return _extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n _extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nvar _assign = function __assign() {\n _assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return _assign.apply(this, arguments);\n};\n\nexport { _assign as __assign };\nexport function __rest(s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n}\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {\n if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n }\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\nexport function __param(paramIndex, decorator) {\n return function (target, key) {\n decorator(target, key, paramIndex);\n };\n}\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\nexport function __generator(thisArg, body) {\n var _ = {\n label: 0,\n sent: function sent() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n },\n f,\n y,\n t,\n g;\n return g = {\n next: verb(0),\n \"throw\": verb(1),\n \"return\": verb(2)\n }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () {\n return this;\n }), g;\n\n function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n\n while (_) {\n try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n\n case 7:\n op = _.ops.pop();\n\n _.trys.pop();\n\n continue;\n\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n\n if (t && _.label < t[2]) {\n _.label = t[2];\n\n _.ops.push(op);\n\n break;\n }\n\n if (t[2]) _.ops.pop();\n\n _.trys.pop();\n\n continue;\n }\n\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n }\n\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n}\nexport function __createBinding(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}\nexport function __exportStar(m, exports) {\n for (var p in m) {\n if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\n }\n}\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator,\n m = s && o[s],\n i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function next() {\n if (o && i >= o.length) o = void 0;\n return {\n value: o && o[i++],\n done: !o\n };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o),\n r,\n ar = [],\n e;\n\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {\n ar.push(r.value);\n }\n } catch (error) {\n e = {\n error: error\n };\n } finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n\n return ar;\n}\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++) {\n ar = ar.concat(__read(arguments[i]));\n }\n\n return ar;\n}\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) {\n s += arguments[i].length;\n }\n\n for (var r = Array(s), k = 0, i = 0; i < il; i++) {\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {\n r[k] = a[j];\n }\n }\n\n return r;\n}\n;\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []),\n i,\n q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () {\n return this;\n }, i;\n\n function verb(n) {\n if (g[n]) i[n] = function (v) {\n return new Promise(function (a, b) {\n q.push([n, v, a, b]) > 1 || resume(n, v);\n });\n };\n }\n\n function resume(n, v) {\n try {\n step(g[n](v));\n } catch (e) {\n settle(q[0][3], e);\n }\n }\n\n function step(r) {\n r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);\n }\n\n function fulfill(value) {\n resume(\"next\", value);\n }\n\n function reject(value) {\n resume(\"throw\", value);\n }\n\n function settle(f, v) {\n if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);\n }\n}\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) {\n throw e;\n }), verb(\"return\"), i[Symbol.iterator] = function () {\n return this;\n }, i;\n\n function verb(n, f) {\n i[n] = o[n] ? function (v) {\n return (p = !p) ? {\n value: __await(o[n](v)),\n done: n === \"return\"\n } : f ? f(v) : v;\n } : f;\n }\n}\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator],\n i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () {\n return this;\n }, i);\n\n function verb(n) {\n i[n] = o[n] && function (v) {\n return new Promise(function (resolve, reject) {\n v = o[n](v), settle(resolve, reject, v.done, v.value);\n });\n };\n }\n\n function settle(resolve, reject, d, v) {\n Promise.resolve(v).then(function (v) {\n resolve({\n value: v,\n done: d\n });\n }, reject);\n }\n}\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) {\n Object.defineProperty(cooked, \"raw\", {\n value: raw\n });\n } else {\n cooked.raw = raw;\n }\n\n return cooked;\n}\n;\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) {\n if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n }\n result.default = mod;\n return result;\n}\nexport function __importDefault(mod) {\n return mod && mod.__esModule ? mod : {\n default: mod\n };\n}\nexport function __classPrivateFieldGet(receiver, privateMap) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to get private field on non-instance\");\n }\n\n return privateMap.get(receiver);\n}\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to set private field on non-instance\");\n }\n\n privateMap.set(receiver, value);\n return value;\n}","export var escapeUri = function escapeUri(uri) {\n // AWS percent-encodes some extra non-standard characters in a URI\n return encodeURIComponent(uri).replace(/[!'()*]/g, hexEncode);\n};\n\nvar hexEncode = function hexEncode(c) {\n return \"%\" + c.charCodeAt(0).toString(16).toUpperCase();\n};","var alphabetByEncoding = {};\nvar alphabetByValue = new Array(64);\n\nfor (var i = 0, start = \"A\".charCodeAt(0), limit = \"Z\".charCodeAt(0); i + start <= limit; i++) {\n var char = String.fromCharCode(i + start);\n alphabetByEncoding[char] = i;\n alphabetByValue[i] = char;\n}\n\nfor (var i = 0, start = \"a\".charCodeAt(0), limit = \"z\".charCodeAt(0); i + start <= limit; i++) {\n var char = String.fromCharCode(i + start);\n var index = i + 26;\n alphabetByEncoding[char] = index;\n alphabetByValue[index] = char;\n}\n\nfor (var i = 0; i < 10; i++) {\n alphabetByEncoding[i.toString(10)] = i + 52;\n var char = i.toString(10);\n var index = i + 52;\n alphabetByEncoding[char] = index;\n alphabetByValue[index] = char;\n}\n\nalphabetByEncoding[\"+\"] = 62;\nalphabetByValue[62] = \"+\";\nalphabetByEncoding[\"/\"] = 63;\nalphabetByValue[63] = \"/\";\nvar bitsPerLetter = 6;\nvar bitsPerByte = 8;\nvar maxLetterValue = 63;\n/**\n * Converts a base-64 encoded string to a Uint8Array of bytes.\n *\n * @param input The base-64 encoded string\n *\n * @see https://tools.ietf.org/html/rfc4648#section-4\n */\n\nexport function fromBase64(input) {\n var totalByteLength = input.length / 4 * 3;\n\n if (input.substr(-2) === \"==\") {\n totalByteLength -= 2;\n } else if (input.substr(-1) === \"=\") {\n totalByteLength--;\n }\n\n var out = new ArrayBuffer(totalByteLength);\n var dataView = new DataView(out);\n\n for (var i = 0; i < input.length; i += 4) {\n var bits = 0;\n var bitLength = 0;\n\n for (var j = i, limit = i + 3; j <= limit; j++) {\n if (input[j] !== \"=\") {\n bits |= alphabetByEncoding[input[j]] << (limit - j) * bitsPerLetter;\n bitLength += bitsPerLetter;\n } else {\n bits >>= bitsPerLetter;\n }\n }\n\n var chunkOffset = i / 4 * 3;\n bits >>= bitLength % bitsPerByte;\n var byteLength = Math.floor(bitLength / bitsPerByte);\n\n for (var k = 0; k < byteLength; k++) {\n var offset = (byteLength - k - 1) * bitsPerByte;\n dataView.setUint8(chunkOffset + k, (bits & 255 << offset) >> offset);\n }\n }\n\n return new Uint8Array(out);\n}\n/**\n * Converts a Uint8Array of binary data to a base-64 encoded string.\n *\n * @param input The binary data to encode\n *\n * @see https://tools.ietf.org/html/rfc4648#section-4\n */\n\nexport function toBase64(input) {\n var str = \"\";\n\n for (var i = 0; i < input.length; i += 3) {\n var bits = 0;\n var bitLength = 0;\n\n for (var j = i, limit = Math.min(i + 3, input.length); j < limit; j++) {\n bits |= input[j] << (limit - j - 1) * bitsPerByte;\n bitLength += bitsPerByte;\n }\n\n var bitClusterCount = Math.ceil(bitLength / bitsPerLetter);\n bits <<= bitClusterCount * bitsPerLetter - bitLength;\n\n for (var k = 1; k <= bitClusterCount; k++) {\n var offset = (bitClusterCount - k) * bitsPerLetter;\n str += alphabetByValue[(bits & maxLetterValue << offset) >> offset];\n }\n\n str += \"==\".slice(0, 4 - bitClusterCount);\n }\n\n return str;\n}","import { __values } from \"tslib\";\nimport { HttpResponse } from \"@aws-sdk/protocol-http\";\nimport { buildQueryString } from \"@aws-sdk/querystring-builder\";\nimport { requestTimeout } from \"./request-timeout\";\n\nvar FetchHttpHandler =\n/** @class */\nfunction () {\n function FetchHttpHandler(httpOptions) {\n if (httpOptions === void 0) {\n httpOptions = {};\n }\n\n this.httpOptions = httpOptions;\n }\n\n FetchHttpHandler.prototype.destroy = function () {// Do nothing. TLS and HTTP/2 connection pooling is handled by the\n // browser.\n };\n\n FetchHttpHandler.prototype.handle = function (request, options) {\n var abortSignal = options === null || options === void 0 ? void 0 : options.abortSignal;\n var requestTimeoutInMs = this.httpOptions.requestTimeout; // if the request was already aborted, prevent doing extra work\n\n if (abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.aborted) {\n var abortError = new Error(\"Request aborted\");\n abortError.name = \"AbortError\";\n return Promise.reject(abortError);\n }\n\n var path = request.path;\n\n if (request.query) {\n var queryString = buildQueryString(request.query);\n\n if (queryString) {\n path += \"?\" + queryString;\n }\n }\n\n var port = request.port;\n var url = request.protocol + \"//\" + request.hostname + (port ? \":\" + port : \"\") + path;\n var requestOptions = {\n body: request.body,\n headers: new Headers(request.headers),\n method: request.method\n }; // some browsers support abort signal\n\n if (typeof AbortController !== \"undefined\") {\n requestOptions[\"signal\"] = abortSignal;\n }\n\n var fetchRequest = new Request(url, requestOptions);\n var raceOfPromises = [fetch(fetchRequest).then(function (response) {\n var e_1, _a;\n\n var fetchHeaders = response.headers;\n var transformedHeaders = {};\n\n try {\n for (var _b = __values(fetchHeaders.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {\n var pair = _c.value;\n transformedHeaders[pair[0]] = pair[1];\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n\n var hasReadableStream = response.body !== undefined; // Return the response with buffered body\n\n if (!hasReadableStream) {\n return response.blob().then(function (body) {\n return {\n response: new HttpResponse({\n headers: transformedHeaders,\n statusCode: response.status,\n body: body\n })\n };\n });\n } // Return the response with streaming body\n\n\n return {\n response: new HttpResponse({\n headers: transformedHeaders,\n statusCode: response.status,\n body: response.body\n })\n };\n }), requestTimeout(requestTimeoutInMs)];\n\n if (abortSignal) {\n raceOfPromises.push(new Promise(function (resolve, reject) {\n abortSignal.onabort = function () {\n var abortError = new Error(\"Request aborted\");\n abortError.name = \"AbortError\";\n reject(abortError);\n };\n }));\n }\n\n return Promise.race(raceOfPromises);\n };\n\n return FetchHttpHandler;\n}();\n\nexport { FetchHttpHandler };","import { __values } from \"tslib\";\nimport { escapeUri } from \"@aws-sdk/util-uri-escape\";\nexport function buildQueryString(query) {\n var e_1, _a;\n\n var parts = [];\n\n try {\n for (var _b = __values(Object.keys(query).sort()), _c = _b.next(); !_c.done; _c = _b.next()) {\n var key = _c.value;\n var value = query[key];\n key = escapeUri(key);\n\n if (Array.isArray(value)) {\n for (var i = 0, iLen = value.length; i < iLen; i++) {\n parts.push(key + \"=\" + escapeUri(value[i]));\n }\n } else {\n var qsEntry = key;\n\n if (value || typeof value === \"string\") {\n qsEntry += \"=\" + escapeUri(value);\n }\n\n parts.push(qsEntry);\n }\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n\n return parts.join(\"&\");\n}","export function requestTimeout(timeoutInMs) {\n if (timeoutInMs === void 0) {\n timeoutInMs = 0;\n }\n\n return new Promise(function (resolve, reject) {\n if (timeoutInMs) {\n setTimeout(function () {\n var timeoutError = new Error(\"Request did not complete within \" + timeoutInMs + \" ms\");\n timeoutError.name = \"TimeoutError\";\n reject(timeoutError);\n }, timeoutInMs);\n }\n });\n}","import { __awaiter, __generator } from \"tslib\";\nimport { fromBase64 } from \"@aws-sdk/util-base64-browser\"; //reference: https://snack.expo.io/r1JCSWRGU\n\nexport var streamCollector = function streamCollector(stream) {\n if (typeof Blob === \"function\" && stream instanceof Blob) {\n return collectBlob(stream);\n }\n\n return collectStream(stream);\n};\n\nfunction collectBlob(blob) {\n return __awaiter(this, void 0, void 0, function () {\n var base64, arrayBuffer;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4\n /*yield*/\n , readToBase64(blob)];\n\n case 1:\n base64 = _a.sent();\n arrayBuffer = fromBase64(base64);\n return [2\n /*return*/\n , new Uint8Array(arrayBuffer)];\n }\n });\n });\n}\n\nfunction collectStream(stream) {\n return __awaiter(this, void 0, void 0, function () {\n var res, reader, isDone, _a, done, value, prior;\n\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n res = new Uint8Array(0);\n reader = stream.getReader();\n isDone = false;\n _b.label = 1;\n\n case 1:\n if (!!isDone) return [3\n /*break*/\n , 3];\n return [4\n /*yield*/\n , reader.read()];\n\n case 2:\n _a = _b.sent(), done = _a.done, value = _a.value;\n\n if (value) {\n prior = res;\n res = new Uint8Array(prior.length + value.length);\n res.set(prior);\n res.set(value, prior.length);\n }\n\n isDone = done;\n return [3\n /*break*/\n , 1];\n\n case 3:\n return [2\n /*return*/\n , res];\n }\n });\n });\n}\n\nfunction readToBase64(blob) {\n return new Promise(function (resolve, reject) {\n var reader = new FileReader();\n\n reader.onloadend = function () {\n var _a; // reference: https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL\n // response from readAsDataURL is always prepended with \"data:*/*;base64,\"\n\n\n if (reader.readyState !== 2) {\n return reject(new Error(\"Reader aborted too early\"));\n }\n\n var result = (_a = reader.result) !== null && _a !== void 0 ? _a : \"\"; // Response can include only 'data:' for empty blob, return empty string in this case.\n // Otherwise, return the string after ','\n\n var commaIndex = result.indexOf(\",\");\n var dataOffset = commaIndex > -1 ? commaIndex + 1 : result.length;\n resolve(result.substring(dataOffset));\n };\n\n reader.onabort = function () {\n return reject(new Error(\"Read aborted\"));\n };\n\n reader.onerror = function () {\n return reject(reader.error);\n }; // reader.readAsArrayBuffer is not always available\n\n\n reader.readAsDataURL(blob);\n });\n}","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\n\n/* global Reflect, Promise */\nvar _extendStatics = function extendStatics(d, b) {\n _extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) {\n if (b.hasOwnProperty(p)) d[p] = b[p];\n }\n };\n\n return _extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n _extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nvar _assign = function __assign() {\n _assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return _assign.apply(this, arguments);\n};\n\nexport { _assign as __assign };\nexport function __rest(s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n}\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {\n if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n }\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\nexport function __param(paramIndex, decorator) {\n return function (target, key) {\n decorator(target, key, paramIndex);\n };\n}\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\nexport function __generator(thisArg, body) {\n var _ = {\n label: 0,\n sent: function sent() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n },\n f,\n y,\n t,\n g;\n return g = {\n next: verb(0),\n \"throw\": verb(1),\n \"return\": verb(2)\n }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () {\n return this;\n }), g;\n\n function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n\n while (_) {\n try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n\n case 7:\n op = _.ops.pop();\n\n _.trys.pop();\n\n continue;\n\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n\n if (t && _.label < t[2]) {\n _.label = t[2];\n\n _.ops.push(op);\n\n break;\n }\n\n if (t[2]) _.ops.pop();\n\n _.trys.pop();\n\n continue;\n }\n\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n }\n\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n}\nexport function __createBinding(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}\nexport function __exportStar(m, exports) {\n for (var p in m) {\n if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\n }\n}\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator,\n m = s && o[s],\n i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function next() {\n if (o && i >= o.length) o = void 0;\n return {\n value: o && o[i++],\n done: !o\n };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o),\n r,\n ar = [],\n e;\n\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {\n ar.push(r.value);\n }\n } catch (error) {\n e = {\n error: error\n };\n } finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n\n return ar;\n}\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++) {\n ar = ar.concat(__read(arguments[i]));\n }\n\n return ar;\n}\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) {\n s += arguments[i].length;\n }\n\n for (var r = Array(s), k = 0, i = 0; i < il; i++) {\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {\n r[k] = a[j];\n }\n }\n\n return r;\n}\n;\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []),\n i,\n q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () {\n return this;\n }, i;\n\n function verb(n) {\n if (g[n]) i[n] = function (v) {\n return new Promise(function (a, b) {\n q.push([n, v, a, b]) > 1 || resume(n, v);\n });\n };\n }\n\n function resume(n, v) {\n try {\n step(g[n](v));\n } catch (e) {\n settle(q[0][3], e);\n }\n }\n\n function step(r) {\n r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);\n }\n\n function fulfill(value) {\n resume(\"next\", value);\n }\n\n function reject(value) {\n resume(\"throw\", value);\n }\n\n function settle(f, v) {\n if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);\n }\n}\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) {\n throw e;\n }), verb(\"return\"), i[Symbol.iterator] = function () {\n return this;\n }, i;\n\n function verb(n, f) {\n i[n] = o[n] ? function (v) {\n return (p = !p) ? {\n value: __await(o[n](v)),\n done: n === \"return\"\n } : f ? f(v) : v;\n } : f;\n }\n}\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator],\n i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () {\n return this;\n }, i);\n\n function verb(n) {\n i[n] = o[n] && function (v) {\n return new Promise(function (resolve, reject) {\n v = o[n](v), settle(resolve, reject, v.done, v.value);\n });\n };\n }\n\n function settle(resolve, reject, d, v) {\n Promise.resolve(v).then(function (v) {\n resolve({\n value: v,\n done: d\n });\n }, reject);\n }\n}\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) {\n Object.defineProperty(cooked, \"raw\", {\n value: raw\n });\n } else {\n cooked.raw = raw;\n }\n\n return cooked;\n}\n;\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) {\n if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n }\n result.default = mod;\n return result;\n}\nexport function __importDefault(mod) {\n return mod && mod.__esModule ? mod : {\n default: mod\n };\n}\nexport function __classPrivateFieldGet(receiver, privateMap) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to get private field on non-instance\");\n }\n\n return privateMap.get(receiver);\n}\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to set private field on non-instance\");\n }\n\n privateMap.set(receiver, value);\n return value;\n}","import { __awaiter, __generator } from \"tslib\";\nexport var retryMiddleware = function retryMiddleware(options) {\n return function (next) {\n return function (args) {\n return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2\n /*return*/\n , options.retryStrategy.retry(next, args)];\n });\n });\n };\n };\n};\nexport var retryMiddlewareOptions = {\n name: \"retryMiddleware\",\n tags: [\"RETRY\"],\n step: \"finalizeRequest\",\n priority: \"high\"\n};\nexport var getRetryPlugin = function getRetryPlugin(options) {\n return {\n applyToStack: function applyToStack(clientStack) {\n clientStack.add(retryMiddleware(options), retryMiddlewareOptions);\n }\n };\n};","/**\n * Errors encountered when the client clock and server clock cannot agree on the\n * current time.\n *\n * These errors are retryable, assuming the SDK has enabled clock skew\n * correction.\n */\nexport var CLOCK_SKEW_ERROR_CODES = [\"AuthFailure\", \"InvalidSignatureException\", \"RequestExpired\", \"RequestInTheFuture\", \"RequestTimeTooSkewed\", \"SignatureDoesNotMatch\"];\n/**\n * Errors that indicate the SDK is being throttled.\n *\n * These errors are always retryable.\n */\n\nexport var THROTTLING_ERROR_CODES = [\"Throttling\", \"ThrottlingException\", \"ThrottledException\", \"RequestThrottledException\", \"TooManyRequestsException\", \"ProvisionedThroughputExceededException\", \"TransactionInProgressException\", \"RequestLimitExceeded\", \"BandwidthLimitExceeded\", \"LimitExceededException\", \"RequestThrottled\", \"SlowDown\", \"PriorRequestNotComplete\", \"EC2ThrottledException\"];\n/**\n * Error codes that indicate transient issues\n */\n\nexport var TRANSIENT_ERROR_CODES = [\"AbortError\", \"TimeoutError\", \"RequestTimeout\", \"RequestTimeoutException\"];\n/**\n * Error codes that indicate transient issues\n */\n\nexport var TRANSIENT_ERROR_STATUS_CODES = [500, 502, 503, 504];","import { CLOCK_SKEW_ERROR_CODES, THROTTLING_ERROR_CODES, TRANSIENT_ERROR_CODES, TRANSIENT_ERROR_STATUS_CODES } from \"./constants\";\nexport var isRetryableByTrait = function isRetryableByTrait(error) {\n return error.$retryable !== undefined;\n};\nexport var isClockSkewError = function isClockSkewError(error) {\n return CLOCK_SKEW_ERROR_CODES.includes(error.name);\n};\nexport var isThrottlingError = function isThrottlingError(error) {\n var _a;\n\n return THROTTLING_ERROR_CODES.includes(error.name) || ((_a = error.$retryable) === null || _a === void 0 ? void 0 : _a.throttling) == true;\n};\nexport var isTransientError = function isTransientError(error) {\n var _a;\n\n return TRANSIENT_ERROR_CODES.includes(error.name) || TRANSIENT_ERROR_STATUS_CODES.includes(((_a = error.$metadata) === null || _a === void 0 ? void 0 : _a.httpStatusCode) || 0);\n};","import { MAXIMUM_RETRY_DELAY } from \"./constants\";\n/**\n * Calculate a capped, fully-jittered exponential backoff time.\n */\n\nexport var defaultDelayDecider = function defaultDelayDecider(delayBase, attempts) {\n return Math.floor(Math.min(MAXIMUM_RETRY_DELAY, Math.random() * Math.pow(2, attempts) * delayBase));\n};","/**\n * The base number of milliseconds to use in calculating a suitable cool-down\n * time when a retryable error is encountered.\n */\nexport var DEFAULT_RETRY_DELAY_BASE = 100;\n/**\n * The maximum amount of time (in milliseconds) that will be used as a delay\n * between retry attempts.\n */\n\nexport var MAXIMUM_RETRY_DELAY = 20 * 1000;\n/**\n * The retry delay base (in milliseconds) to use when a throttling error is\n * encountered.\n */\n\nexport var THROTTLING_RETRY_DELAY_BASE = 500;\n/**\n * Initial number of retry tokens in Retry Quota\n */\n\nexport var INITIAL_RETRY_TOKENS = 500;\n/**\n * The total amount of retry tokens to be decremented from retry token balance.\n */\n\nexport var RETRY_COST = 5;\n/**\n * The total amount of retry tokens to be decremented from retry token balance\n * when a throttling error is encountered.\n */\n\nexport var TIMEOUT_RETRY_COST = 10;\n/**\n * The total amount of retry token to be incremented from retry token balance\n * if an SDK operation invocation succeeds without requiring a retry request.\n */\n\nexport var NO_RETRY_INCREMENT = 1;","import { isClockSkewError, isRetryableByTrait, isThrottlingError, isTransientError } from \"@aws-sdk/service-error-classification\";\nexport var defaultRetryDecider = function defaultRetryDecider(error) {\n if (!error) {\n return false;\n }\n\n return isRetryableByTrait(error) || isClockSkewError(error) || isThrottlingError(error) || isTransientError(error);\n};","import { __awaiter, __generator } from \"tslib\";\nimport { HttpRequest } from \"@aws-sdk/protocol-http\";\nimport { isThrottlingError } from \"@aws-sdk/service-error-classification\";\nimport { v4 } from \"uuid\";\nimport { DEFAULT_RETRY_DELAY_BASE, INITIAL_RETRY_TOKENS, THROTTLING_RETRY_DELAY_BASE } from \"./constants\";\nimport { getDefaultRetryQuota } from \"./defaultRetryQuota\";\nimport { defaultDelayDecider } from \"./delayDecider\";\nimport { defaultRetryDecider } from \"./retryDecider\";\n/**\n * The default value for how many HTTP requests an SDK should make for a\n * single SDK operation invocation before giving up\n */\n\nexport var DEFAULT_MAX_ATTEMPTS = 3;\n/**\n * The default retry algorithm to use.\n */\n\nexport var DEFAULT_RETRY_MODE = \"standard\";\n\nvar StandardRetryStrategy =\n/** @class */\nfunction () {\n function StandardRetryStrategy(maxAttemptsProvider, options) {\n var _a, _b, _c;\n\n this.maxAttemptsProvider = maxAttemptsProvider;\n this.retryDecider = (_a = options === null || options === void 0 ? void 0 : options.retryDecider) !== null && _a !== void 0 ? _a : defaultRetryDecider;\n this.delayDecider = (_b = options === null || options === void 0 ? void 0 : options.delayDecider) !== null && _b !== void 0 ? _b : defaultDelayDecider;\n this.retryQuota = (_c = options === null || options === void 0 ? void 0 : options.retryQuota) !== null && _c !== void 0 ? _c : getDefaultRetryQuota(INITIAL_RETRY_TOKENS);\n }\n\n StandardRetryStrategy.prototype.shouldRetry = function (error, attempts, maxAttempts) {\n return attempts < maxAttempts && this.retryDecider(error) && this.retryQuota.hasRetryTokens(error);\n };\n\n StandardRetryStrategy.prototype.getMaxAttempts = function () {\n return __awaiter(this, void 0, void 0, function () {\n var maxAttempts, error_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2,, 3]);\n\n return [4\n /*yield*/\n , this.maxAttemptsProvider()];\n\n case 1:\n maxAttempts = _a.sent();\n return [3\n /*break*/\n , 3];\n\n case 2:\n error_1 = _a.sent();\n maxAttempts = DEFAULT_MAX_ATTEMPTS;\n return [3\n /*break*/\n , 3];\n\n case 3:\n return [2\n /*return*/\n , maxAttempts];\n }\n });\n });\n };\n\n StandardRetryStrategy.prototype.retry = function (next, args) {\n return __awaiter(this, void 0, void 0, function () {\n var retryTokenAmount, attempts, totalDelay, maxAttempts, request, _loop_1, this_1, state_1;\n\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n attempts = 0;\n totalDelay = 0;\n return [4\n /*yield*/\n , this.getMaxAttempts()];\n\n case 1:\n maxAttempts = _a.sent();\n request = args.request;\n\n if (HttpRequest.isInstance(request)) {\n request.headers[\"amz-sdk-invocation-id\"] = v4();\n }\n\n _loop_1 = function _loop_1() {\n var _a, response, output, err_1, delay_1;\n\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n _b.trys.push([0, 2,, 5]);\n\n if (HttpRequest.isInstance(request)) {\n request.headers[\"amz-sdk-request\"] = \"attempt=\" + (attempts + 1) + \"; max=\" + maxAttempts;\n }\n\n return [4\n /*yield*/\n , next(args)];\n\n case 1:\n _a = _b.sent(), response = _a.response, output = _a.output;\n this_1.retryQuota.releaseRetryTokens(retryTokenAmount);\n output.$metadata.attempts = attempts + 1;\n output.$metadata.totalRetryDelay = totalDelay;\n return [2\n /*return*/\n , {\n value: {\n response: response,\n output: output\n }\n }];\n\n case 2:\n err_1 = _b.sent();\n attempts++;\n if (!this_1.shouldRetry(err_1, attempts, maxAttempts)) return [3\n /*break*/\n , 4];\n retryTokenAmount = this_1.retryQuota.retrieveRetryTokens(err_1);\n delay_1 = this_1.delayDecider(isThrottlingError(err_1) ? THROTTLING_RETRY_DELAY_BASE : DEFAULT_RETRY_DELAY_BASE, attempts);\n totalDelay += delay_1;\n return [4\n /*yield*/\n , new Promise(function (resolve) {\n return setTimeout(resolve, delay_1);\n })];\n\n case 3:\n _b.sent();\n\n return [2\n /*return*/\n , \"continue\"];\n\n case 4:\n if (!err_1.$metadata) {\n err_1.$metadata = {};\n }\n\n err_1.$metadata.attempts = attempts;\n err_1.$metadata.totalRetryDelay = totalDelay;\n throw err_1;\n\n case 5:\n return [2\n /*return*/\n ];\n }\n });\n };\n\n this_1 = this;\n _a.label = 2;\n\n case 2:\n if (!true) return [3\n /*break*/\n , 4];\n return [5\n /*yield**/\n , _loop_1()];\n\n case 3:\n state_1 = _a.sent();\n if (typeof state_1 === \"object\") return [2\n /*return*/\n , state_1.value];\n return [3\n /*break*/\n , 2];\n\n case 4:\n return [2\n /*return*/\n ];\n }\n });\n });\n };\n\n return StandardRetryStrategy;\n}();\n\nexport { StandardRetryStrategy };","import { NO_RETRY_INCREMENT, RETRY_COST, TIMEOUT_RETRY_COST } from \"./constants\";\nexport var getDefaultRetryQuota = function getDefaultRetryQuota(initialRetryTokens) {\n var MAX_CAPACITY = initialRetryTokens;\n var availableCapacity = initialRetryTokens;\n\n var getCapacityAmount = function getCapacityAmount(error) {\n return error.name === \"TimeoutError\" ? TIMEOUT_RETRY_COST : RETRY_COST;\n };\n\n var hasRetryTokens = function hasRetryTokens(error) {\n return getCapacityAmount(error) <= availableCapacity;\n };\n\n var retrieveRetryTokens = function retrieveRetryTokens(error) {\n if (!hasRetryTokens(error)) {\n // retryStrategy should stop retrying, and return last error\n throw new Error(\"No retry token available\");\n }\n\n var capacityAmount = getCapacityAmount(error);\n availableCapacity -= capacityAmount;\n return capacityAmount;\n };\n\n var releaseRetryTokens = function releaseRetryTokens(capacityReleaseAmount) {\n availableCapacity += capacityReleaseAmount !== null && capacityReleaseAmount !== void 0 ? capacityReleaseAmount : NO_RETRY_INCREMENT;\n availableCapacity = Math.min(availableCapacity, MAX_CAPACITY);\n };\n\n return Object.freeze({\n hasRetryTokens: hasRetryTokens,\n retrieveRetryTokens: retrieveRetryTokens,\n releaseRetryTokens: releaseRetryTokens\n });\n};","import { __assign } from \"tslib\";\nimport { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE, StandardRetryStrategy } from \"./defaultStrategy\";\nexport var ENV_MAX_ATTEMPTS = \"AWS_MAX_ATTEMPTS\";\nexport var CONFIG_MAX_ATTEMPTS = \"max_attempts\";\nexport var NODE_MAX_ATTEMPT_CONFIG_OPTIONS = {\n environmentVariableSelector: function environmentVariableSelector(env) {\n var value = env[ENV_MAX_ATTEMPTS];\n if (!value) return undefined;\n var maxAttempt = parseInt(value);\n\n if (Number.isNaN(maxAttempt)) {\n throw new Error(\"Environment variable \" + ENV_MAX_ATTEMPTS + \" mast be a number, got \\\"\" + value + \"\\\"\");\n }\n\n return maxAttempt;\n },\n configFileSelector: function configFileSelector(profile) {\n var value = profile[CONFIG_MAX_ATTEMPTS];\n if (!value) return undefined;\n var maxAttempt = parseInt(value);\n\n if (Number.isNaN(maxAttempt)) {\n throw new Error(\"Shared config file entry \" + CONFIG_MAX_ATTEMPTS + \" mast be a number, got \\\"\" + value + \"\\\"\");\n }\n\n return maxAttempt;\n },\n default: DEFAULT_MAX_ATTEMPTS\n};\nexport var resolveRetryConfig = function resolveRetryConfig(input) {\n var maxAttempts = normalizeMaxAttempts(input.maxAttempts);\n return __assign(__assign({}, input), {\n maxAttempts: maxAttempts,\n retryStrategy: input.retryStrategy || new StandardRetryStrategy(maxAttempts)\n });\n};\n\nvar normalizeMaxAttempts = function normalizeMaxAttempts(maxAttempts) {\n if (maxAttempts === void 0) {\n maxAttempts = DEFAULT_MAX_ATTEMPTS;\n }\n\n if (typeof maxAttempts === \"number\") {\n var promisified_1 = Promise.resolve(maxAttempts);\n return function () {\n return promisified_1;\n };\n }\n\n return maxAttempts;\n};\n\nexport var ENV_RETRY_MODE = \"AWS_RETRY_MODE\";\nexport var CONFIG_RETRY_MODE = \"retry_mode\";\nexport var NODE_RETRY_MODE_CONFIG_OPTIONS = {\n environmentVariableSelector: function environmentVariableSelector(env) {\n return env[ENV_RETRY_MODE];\n },\n configFileSelector: function configFileSelector(profile) {\n return profile[CONFIG_RETRY_MODE];\n },\n default: DEFAULT_RETRY_MODE\n};","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\n\n/* global Reflect, Promise */\nvar _extendStatics = function extendStatics(d, b) {\n _extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) {\n if (b.hasOwnProperty(p)) d[p] = b[p];\n }\n };\n\n return _extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n _extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nvar _assign = function __assign() {\n _assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return _assign.apply(this, arguments);\n};\n\nexport { _assign as __assign };\nexport function __rest(s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n}\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {\n if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n }\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\nexport function __param(paramIndex, decorator) {\n return function (target, key) {\n decorator(target, key, paramIndex);\n };\n}\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\nexport function __generator(thisArg, body) {\n var _ = {\n label: 0,\n sent: function sent() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n },\n f,\n y,\n t,\n g;\n return g = {\n next: verb(0),\n \"throw\": verb(1),\n \"return\": verb(2)\n }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () {\n return this;\n }), g;\n\n function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n\n while (_) {\n try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n\n case 7:\n op = _.ops.pop();\n\n _.trys.pop();\n\n continue;\n\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n\n if (t && _.label < t[2]) {\n _.label = t[2];\n\n _.ops.push(op);\n\n break;\n }\n\n if (t[2]) _.ops.pop();\n\n _.trys.pop();\n\n continue;\n }\n\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n }\n\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n}\nexport function __createBinding(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}\nexport function __exportStar(m, exports) {\n for (var p in m) {\n if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\n }\n}\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator,\n m = s && o[s],\n i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function next() {\n if (o && i >= o.length) o = void 0;\n return {\n value: o && o[i++],\n done: !o\n };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o),\n r,\n ar = [],\n e;\n\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {\n ar.push(r.value);\n }\n } catch (error) {\n e = {\n error: error\n };\n } finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n\n return ar;\n}\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++) {\n ar = ar.concat(__read(arguments[i]));\n }\n\n return ar;\n}\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) {\n s += arguments[i].length;\n }\n\n for (var r = Array(s), k = 0, i = 0; i < il; i++) {\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {\n r[k] = a[j];\n }\n }\n\n return r;\n}\n;\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []),\n i,\n q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () {\n return this;\n }, i;\n\n function verb(n) {\n if (g[n]) i[n] = function (v) {\n return new Promise(function (a, b) {\n q.push([n, v, a, b]) > 1 || resume(n, v);\n });\n };\n }\n\n function resume(n, v) {\n try {\n step(g[n](v));\n } catch (e) {\n settle(q[0][3], e);\n }\n }\n\n function step(r) {\n r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);\n }\n\n function fulfill(value) {\n resume(\"next\", value);\n }\n\n function reject(value) {\n resume(\"throw\", value);\n }\n\n function settle(f, v) {\n if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);\n }\n}\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) {\n throw e;\n }), verb(\"return\"), i[Symbol.iterator] = function () {\n return this;\n }, i;\n\n function verb(n, f) {\n i[n] = o[n] ? function (v) {\n return (p = !p) ? {\n value: __await(o[n](v)),\n done: n === \"return\"\n } : f ? f(v) : v;\n } : f;\n }\n}\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator],\n i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () {\n return this;\n }, i);\n\n function verb(n) {\n i[n] = o[n] && function (v) {\n return new Promise(function (resolve, reject) {\n v = o[n](v), settle(resolve, reject, v.done, v.value);\n });\n };\n }\n\n function settle(resolve, reject, d, v) {\n Promise.resolve(v).then(function (v) {\n resolve({\n value: v,\n done: d\n });\n }, reject);\n }\n}\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) {\n Object.defineProperty(cooked, \"raw\", {\n value: raw\n });\n } else {\n cooked.raw = raw;\n }\n\n return cooked;\n}\n;\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) {\n if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n }\n result.default = mod;\n return result;\n}\nexport function __importDefault(mod) {\n return mod && mod.__esModule ? mod : {\n default: mod\n };\n}\nexport function __classPrivateFieldGet(receiver, privateMap) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to get private field on non-instance\");\n }\n\n return privateMap.get(receiver);\n}\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to set private field on non-instance\");\n }\n\n privateMap.set(receiver, value);\n return value;\n}","import { fromUtf8 as jsFromUtf8, toUtf8 as jsToUtf8 } from \"./pureJs\";\nimport { fromUtf8 as textEncoderFromUtf8, toUtf8 as textEncoderToUtf8 } from \"./whatwgEncodingApi\";\nexport var fromUtf8 = function fromUtf8(input) {\n return typeof TextEncoder === \"function\" ? textEncoderFromUtf8(input) : jsFromUtf8(input);\n};\nexport var toUtf8 = function toUtf8(input) {\n return typeof TextDecoder === \"function\" ? textEncoderToUtf8(input) : jsToUtf8(input);\n};","export var invalidFunction = function invalidFunction(message) {\n return function () {\n throw new Error(message);\n };\n};","export function defaultUserAgent(packageName, packageVersion) {\n var originUserAgent = typeof navigator !== \"undefined\" && typeof navigator.userAgent === \"string\" ? navigator.userAgent : \"\";\n return \"aws-sdk-js-v3-\" + packageName + \"/\" + packageVersion + \" \" + originUserAgent;\n}","// Partition default templates\nvar AWS_TEMPLATE = \"cognito-identity.{region}.amazonaws.com\";\nvar AWS_CN_TEMPLATE = \"cognito-identity.{region}.amazonaws.com.cn\";\nvar AWS_ISO_TEMPLATE = \"cognito-identity.{region}.c2s.ic.gov\";\nvar AWS_ISO_B_TEMPLATE = \"cognito-identity.{region}.sc2s.sgov.gov\";\nvar AWS_US_GOV_TEMPLATE = \"cognito-identity.{region}.amazonaws.com\"; // Partition regions\n\nvar AWS_REGIONS = new Set([\"ap-east-1\", \"ap-northeast-1\", \"ap-northeast-2\", \"ap-south-1\", \"ap-southeast-1\", \"ap-southeast-2\", \"ca-central-1\", \"eu-central-1\", \"eu-north-1\", \"eu-west-1\", \"eu-west-2\", \"eu-west-3\", \"me-south-1\", \"sa-east-1\", \"us-east-1\", \"us-east-2\", \"us-west-1\", \"us-west-2\"]);\nvar AWS_CN_REGIONS = new Set([\"cn-north-1\", \"cn-northwest-1\"]);\nvar AWS_ISO_REGIONS = new Set([\"us-iso-east-1\"]);\nvar AWS_ISO_B_REGIONS = new Set([\"us-isob-east-1\"]);\nvar AWS_US_GOV_REGIONS = new Set([\"us-gov-east-1\", \"us-gov-west-1\"]);\nexport var defaultRegionInfoProvider = function defaultRegionInfoProvider(region, options) {\n var regionInfo = undefined;\n\n switch (region) {\n // First, try to match exact region names.\n case \"ap-northeast-1\":\n regionInfo = {\n hostname: \"cognito-identity.ap-northeast-1.amazonaws.com\",\n partition: \"aws\"\n };\n break;\n\n case \"ap-northeast-2\":\n regionInfo = {\n hostname: \"cognito-identity.ap-northeast-2.amazonaws.com\",\n partition: \"aws\"\n };\n break;\n\n case \"ap-south-1\":\n regionInfo = {\n hostname: \"cognito-identity.ap-south-1.amazonaws.com\",\n partition: \"aws\"\n };\n break;\n\n case \"ap-southeast-1\":\n regionInfo = {\n hostname: \"cognito-identity.ap-southeast-1.amazonaws.com\",\n partition: \"aws\"\n };\n break;\n\n case \"ap-southeast-2\":\n regionInfo = {\n hostname: \"cognito-identity.ap-southeast-2.amazonaws.com\",\n partition: \"aws\"\n };\n break;\n\n case \"ca-central-1\":\n regionInfo = {\n hostname: \"cognito-identity.ca-central-1.amazonaws.com\",\n partition: \"aws\"\n };\n break;\n\n case \"cn-north-1\":\n regionInfo = {\n hostname: \"cognito-identity.cn-north-1.amazonaws.com.cn\",\n partition: \"aws-cn\"\n };\n break;\n\n case \"eu-central-1\":\n regionInfo = {\n hostname: \"cognito-identity.eu-central-1.amazonaws.com\",\n partition: \"aws\"\n };\n break;\n\n case \"eu-west-1\":\n regionInfo = {\n hostname: \"cognito-identity.eu-west-1.amazonaws.com\",\n partition: \"aws\"\n };\n break;\n\n case \"eu-west-2\":\n regionInfo = {\n hostname: \"cognito-identity.eu-west-2.amazonaws.com\",\n partition: \"aws\"\n };\n break;\n\n case \"us-east-1\":\n regionInfo = {\n hostname: \"cognito-identity.us-east-1.amazonaws.com\",\n partition: \"aws\"\n };\n break;\n\n case \"us-east-2\":\n regionInfo = {\n hostname: \"cognito-identity.us-east-2.amazonaws.com\",\n partition: \"aws\"\n };\n break;\n\n case \"us-west-2\":\n regionInfo = {\n hostname: \"cognito-identity.us-west-2.amazonaws.com\",\n partition: \"aws\"\n };\n break;\n // Next, try to match partition endpoints.\n\n default:\n if (AWS_REGIONS.has(region)) {\n regionInfo = {\n hostname: AWS_TEMPLATE.replace(\"{region}\", region),\n partition: \"aws\"\n };\n }\n\n if (AWS_CN_REGIONS.has(region)) {\n regionInfo = {\n hostname: AWS_CN_TEMPLATE.replace(\"{region}\", region),\n partition: \"aws-cn\"\n };\n }\n\n if (AWS_ISO_REGIONS.has(region)) {\n regionInfo = {\n hostname: AWS_ISO_TEMPLATE.replace(\"{region}\", region),\n partition: \"aws-iso\"\n };\n }\n\n if (AWS_ISO_B_REGIONS.has(region)) {\n regionInfo = {\n hostname: AWS_ISO_B_TEMPLATE.replace(\"{region}\", region),\n partition: \"aws-iso-b\"\n };\n }\n\n if (AWS_US_GOV_REGIONS.has(region)) {\n regionInfo = {\n hostname: AWS_US_GOV_TEMPLATE.replace(\"{region}\", region),\n partition: \"aws-us-gov\"\n };\n } // Finally, assume it's an AWS partition endpoint.\n\n\n if (regionInfo === undefined) {\n regionInfo = {\n hostname: AWS_TEMPLATE.replace(\"{region}\", region),\n partition: \"aws\"\n };\n }\n\n }\n\n return Promise.resolve(regionInfo);\n};","import { defaultRegionInfoProvider } from \"./endpoints\";\nexport var ClientSharedValues = {\n apiVersion: \"2014-06-30\",\n disableHostPrefix: false,\n logger: {},\n regionInfoProvider: defaultRegionInfoProvider,\n signingName: \"cognito-identity\"\n};","import { __assign } from \"tslib\";\nimport packageInfo from \"./package.json\";\nimport { Sha256 } from \"@aws-crypto/sha256-browser\";\nimport { FetchHttpHandler, streamCollector } from \"@aws-sdk/fetch-http-handler\";\nimport { invalidFunction } from \"@aws-sdk/invalid-dependency\";\nimport { DEFAULT_MAX_ATTEMPTS } from \"@aws-sdk/middleware-retry\";\nimport { parseUrl } from \"@aws-sdk/url-parser-browser\";\nimport { fromBase64, toBase64 } from \"@aws-sdk/util-base64-browser\";\nimport { calculateBodyLength } from \"@aws-sdk/util-body-length-browser\";\nimport { defaultUserAgent } from \"@aws-sdk/util-user-agent-browser\";\nimport { fromUtf8, toUtf8 } from \"@aws-sdk/util-utf8-browser\";\nimport { ClientSharedValues } from \"./runtimeConfig.shared\";\nexport var ClientDefaultValues = __assign(__assign({}, ClientSharedValues), {\n runtime: \"browser\",\n base64Decoder: fromBase64,\n base64Encoder: toBase64,\n bodyLengthChecker: calculateBodyLength,\n credentialDefaultProvider: function credentialDefaultProvider() {},\n defaultUserAgent: defaultUserAgent(packageInfo.name, packageInfo.version),\n maxAttempts: DEFAULT_MAX_ATTEMPTS,\n region: invalidFunction(\"Region is missing\"),\n requestHandler: new FetchHttpHandler(),\n sha256: Sha256,\n streamCollector: streamCollector,\n urlParser: parseUrl,\n utf8Decoder: fromUtf8,\n utf8Encoder: toUtf8\n});","export function calculateBodyLength(body) {\n if (typeof body === \"string\") {\n var len = body.length;\n\n for (var i = len - 1; i >= 0; i--) {\n var code = body.charCodeAt(i);\n if (code > 0x7f && code <= 0x7ff) len++;else if (code > 0x7ff && code <= 0xffff) len += 2;\n }\n\n return len;\n } else if (typeof body.byteLength === \"number\") {\n // handles Uint8Array, ArrayBuffer, Buffer, and ArrayBufferView\n return body.byteLength;\n } else if (typeof body.size === \"number\") {\n // handles browser File object\n return body.size;\n }\n}","import { parseQueryString } from \"@aws-sdk/querystring-parser\";\nexport var parseUrl = function parseUrl(url) {\n var _a = new URL(url),\n hostname = _a.hostname,\n pathname = _a.pathname,\n port = _a.port,\n protocol = _a.protocol,\n search = _a.search;\n\n var query;\n\n if (search) {\n query = parseQueryString(search);\n }\n\n return {\n hostname: hostname,\n port: port ? parseInt(port) : undefined,\n protocol: protocol,\n path: pathname,\n query: query\n };\n};","import { __read, __values } from \"tslib\";\nexport function parseQueryString(querystring) {\n var e_1, _a;\n\n var query = {};\n querystring = querystring.replace(/^\\?/, \"\");\n\n if (querystring) {\n try {\n for (var _b = __values(querystring.split(\"&\")), _c = _b.next(); !_c.done; _c = _b.next()) {\n var pair = _c.value;\n\n var _d = __read(pair.split(\"=\"), 2),\n key = _d[0],\n _e = _d[1],\n value = _e === void 0 ? null : _e;\n\n key = decodeURIComponent(key);\n\n if (value) {\n value = decodeURIComponent(value);\n }\n\n if (!(key in query)) {\n query[key] = value;\n } else if (Array.isArray(query[key])) {\n query[key].push(value);\n } else {\n query[key] = [query[key], value];\n }\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n }\n\n return query;\n}","export function fromUtf8(input) {\n return new TextEncoder().encode(input);\n}\nexport function toUtf8(input) {\n return new TextDecoder(\"utf-8\").decode(input);\n}","/**\n * Converts a JS string from its native UCS-2/UTF-16 representation into a\n * Uint8Array of the bytes used to represent the equivalent characters in UTF-8.\n *\n * Cribbed from the `goog.crypt.stringToUtf8ByteArray` function in the Google\n * Closure library, though updated to use typed arrays.\n */\nexport var fromUtf8 = function fromUtf8(input) {\n var bytes = [];\n\n for (var i = 0, len = input.length; i < len; i++) {\n var value = input.charCodeAt(i);\n\n if (value < 0x80) {\n bytes.push(value);\n } else if (value < 0x800) {\n bytes.push(value >> 6 | 192, value & 63 | 128);\n } else if (i + 1 < input.length && (value & 0xfc00) === 0xd800 && (input.charCodeAt(i + 1) & 0xfc00) === 0xdc00) {\n var surrogatePair = 0x10000 + ((value & 1023) << 10) + (input.charCodeAt(++i) & 1023);\n bytes.push(surrogatePair >> 18 | 240, surrogatePair >> 12 & 63 | 128, surrogatePair >> 6 & 63 | 128, surrogatePair & 63 | 128);\n } else {\n bytes.push(value >> 12 | 224, value >> 6 & 63 | 128, value & 63 | 128);\n }\n }\n\n return Uint8Array.from(bytes);\n};\n/**\n * Converts a typed array of bytes containing UTF-8 data into a native JS\n * string.\n *\n * Partly cribbed from the `goog.crypt.utf8ByteArrayToString` function in the\n * Google Closure library, though updated to use typed arrays and to better\n * handle astral plane code points.\n */\n\nexport var toUtf8 = function toUtf8(input) {\n var decoded = \"\";\n\n for (var i = 0, len = input.length; i < len; i++) {\n var byte = input[i];\n\n if (byte < 0x80) {\n decoded += String.fromCharCode(byte);\n } else if (192 <= byte && byte < 224) {\n var nextByte = input[++i];\n decoded += String.fromCharCode((byte & 31) << 6 | nextByte & 63);\n } else if (240 <= byte && byte < 365) {\n var surrogatePair = [byte, input[++i], input[++i], input[++i]];\n var encoded = \"%\" + surrogatePair.map(function (byteValue) {\n return byteValue.toString(16);\n }).join(\"%\");\n decoded += decodeURIComponent(encoded);\n } else {\n decoded += String.fromCharCode((byte & 15) << 12 | (input[++i] & 63) << 6 | input[++i] & 63);\n }\n }\n\n return decoded;\n};","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\n\n/* global Reflect, Promise */\nvar _extendStatics = function extendStatics(d, b) {\n _extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) {\n if (b.hasOwnProperty(p)) d[p] = b[p];\n }\n };\n\n return _extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n _extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nvar _assign = function __assign() {\n _assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return _assign.apply(this, arguments);\n};\n\nexport { _assign as __assign };\nexport function __rest(s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n}\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {\n if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n }\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\nexport function __param(paramIndex, decorator) {\n return function (target, key) {\n decorator(target, key, paramIndex);\n };\n}\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\nexport function __generator(thisArg, body) {\n var _ = {\n label: 0,\n sent: function sent() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n },\n f,\n y,\n t,\n g;\n return g = {\n next: verb(0),\n \"throw\": verb(1),\n \"return\": verb(2)\n }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () {\n return this;\n }), g;\n\n function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n\n while (_) {\n try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n\n case 7:\n op = _.ops.pop();\n\n _.trys.pop();\n\n continue;\n\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n\n if (t && _.label < t[2]) {\n _.label = t[2];\n\n _.ops.push(op);\n\n break;\n }\n\n if (t[2]) _.ops.pop();\n\n _.trys.pop();\n\n continue;\n }\n\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n }\n\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n}\nexport function __createBinding(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}\nexport function __exportStar(m, exports) {\n for (var p in m) {\n if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\n }\n}\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator,\n m = s && o[s],\n i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function next() {\n if (o && i >= o.length) o = void 0;\n return {\n value: o && o[i++],\n done: !o\n };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o),\n r,\n ar = [],\n e;\n\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {\n ar.push(r.value);\n }\n } catch (error) {\n e = {\n error: error\n };\n } finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n\n return ar;\n}\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++) {\n ar = ar.concat(__read(arguments[i]));\n }\n\n return ar;\n}\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) {\n s += arguments[i].length;\n }\n\n for (var r = Array(s), k = 0, i = 0; i < il; i++) {\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {\n r[k] = a[j];\n }\n }\n\n return r;\n}\n;\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []),\n i,\n q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () {\n return this;\n }, i;\n\n function verb(n) {\n if (g[n]) i[n] = function (v) {\n return new Promise(function (a, b) {\n q.push([n, v, a, b]) > 1 || resume(n, v);\n });\n };\n }\n\n function resume(n, v) {\n try {\n step(g[n](v));\n } catch (e) {\n settle(q[0][3], e);\n }\n }\n\n function step(r) {\n r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);\n }\n\n function fulfill(value) {\n resume(\"next\", value);\n }\n\n function reject(value) {\n resume(\"throw\", value);\n }\n\n function settle(f, v) {\n if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);\n }\n}\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) {\n throw e;\n }), verb(\"return\"), i[Symbol.iterator] = function () {\n return this;\n }, i;\n\n function verb(n, f) {\n i[n] = o[n] ? function (v) {\n return (p = !p) ? {\n value: __await(o[n](v)),\n done: n === \"return\"\n } : f ? f(v) : v;\n } : f;\n }\n}\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator],\n i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () {\n return this;\n }, i);\n\n function verb(n) {\n i[n] = o[n] && function (v) {\n return new Promise(function (resolve, reject) {\n v = o[n](v), settle(resolve, reject, v.done, v.value);\n });\n };\n }\n\n function settle(resolve, reject, d, v) {\n Promise.resolve(v).then(function (v) {\n resolve({\n value: v,\n done: d\n });\n }, reject);\n }\n}\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) {\n Object.defineProperty(cooked, \"raw\", {\n value: raw\n });\n } else {\n cooked.raw = raw;\n }\n\n return cooked;\n}\n;\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) {\n if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n }\n result.default = mod;\n return result;\n}\nexport function __importDefault(mod) {\n return mod && mod.__esModule ? mod : {\n default: mod\n };\n}\nexport function __classPrivateFieldGet(receiver, privateMap) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to get private field on non-instance\");\n }\n\n return privateMap.get(receiver);\n}\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to set private field on non-instance\");\n }\n\n privateMap.set(receiver, value);\n return value;\n}","import { __assign, __awaiter, __generator } from \"tslib\";\nexport var resolveEndpointsConfig = function resolveEndpointsConfig(input) {\n var _a;\n\n return __assign(__assign({}, input), {\n tls: (_a = input.tls) !== null && _a !== void 0 ? _a : true,\n endpoint: input.endpoint ? normalizeEndpoint(input) : function () {\n return getEndPointFromRegion(input);\n },\n isCustomEndpoint: input.endpoint ? true : false\n });\n};\n\nvar normalizeEndpoint = function normalizeEndpoint(input) {\n var endpoint = input.endpoint,\n urlParser = input.urlParser;\n\n if (typeof endpoint === \"string\") {\n var promisified_1 = Promise.resolve(urlParser(endpoint));\n return function () {\n return promisified_1;\n };\n } else if (typeof endpoint === \"object\") {\n var promisified_2 = Promise.resolve(endpoint);\n return function () {\n return promisified_2;\n };\n }\n\n return endpoint;\n};\n\nvar getEndPointFromRegion = function getEndPointFromRegion(input) {\n return __awaiter(void 0, void 0, void 0, function () {\n var _a, tls, region, dnsHostRegex, hostname;\n\n var _b;\n\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n _a = input.tls, tls = _a === void 0 ? true : _a;\n return [4\n /*yield*/\n , input.region()];\n\n case 1:\n region = _c.sent();\n dnsHostRegex = new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/);\n\n if (!dnsHostRegex.test(region)) {\n throw new Error(\"Invalid region in client config\");\n }\n\n return [4\n /*yield*/\n , input.regionInfoProvider(region)];\n\n case 2:\n hostname = ((_b = _c.sent()) !== null && _b !== void 0 ? _b : {}).hostname;\n\n if (!hostname) {\n throw new Error(\"Cannot resolve hostname from client config\");\n }\n\n return [2\n /*return*/\n , input.urlParser((tls ? \"https:\" : \"http:\") + \"//\" + hostname)];\n }\n });\n });\n};","import { __assign } from \"tslib\";\nexport var REGION_ENV_NAME = \"AWS_REGION\";\nexport var REGION_INI_NAME = \"region\";\nexport var NODE_REGION_CONFIG_OPTIONS = {\n environmentVariableSelector: function environmentVariableSelector(env) {\n return env[REGION_ENV_NAME];\n },\n configFileSelector: function configFileSelector(profile) {\n return profile[REGION_INI_NAME];\n },\n default: function _default() {\n throw new Error(\"Region is missing\");\n }\n};\nexport var NODE_REGION_CONFIG_FILE_OPTIONS = {\n preferredFile: \"credentials\"\n};\nexport var resolveRegionConfig = function resolveRegionConfig(input) {\n if (!input.region) {\n throw new Error(\"Region is missing\");\n }\n\n return __assign(__assign({}, input), {\n region: normalizeRegion(input.region)\n });\n};\n\nvar normalizeRegion = function normalizeRegion(region) {\n if (typeof region === \"string\") {\n var promisified_1 = Promise.resolve(region);\n return function () {\n return promisified_1;\n };\n }\n\n return region;\n};","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\n\n/* global Reflect, Promise */\nvar _extendStatics = function extendStatics(d, b) {\n _extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) {\n if (b.hasOwnProperty(p)) d[p] = b[p];\n }\n };\n\n return _extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n _extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nvar _assign = function __assign() {\n _assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return _assign.apply(this, arguments);\n};\n\nexport { _assign as __assign };\nexport function __rest(s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n}\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {\n if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n }\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\nexport function __param(paramIndex, decorator) {\n return function (target, key) {\n decorator(target, key, paramIndex);\n };\n}\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\nexport function __generator(thisArg, body) {\n var _ = {\n label: 0,\n sent: function sent() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n },\n f,\n y,\n t,\n g;\n return g = {\n next: verb(0),\n \"throw\": verb(1),\n \"return\": verb(2)\n }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () {\n return this;\n }), g;\n\n function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n\n while (_) {\n try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n\n case 7:\n op = _.ops.pop();\n\n _.trys.pop();\n\n continue;\n\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n\n if (t && _.label < t[2]) {\n _.label = t[2];\n\n _.ops.push(op);\n\n break;\n }\n\n if (t[2]) _.ops.pop();\n\n _.trys.pop();\n\n continue;\n }\n\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n }\n\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n}\nexport function __createBinding(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}\nexport function __exportStar(m, exports) {\n for (var p in m) {\n if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\n }\n}\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator,\n m = s && o[s],\n i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function next() {\n if (o && i >= o.length) o = void 0;\n return {\n value: o && o[i++],\n done: !o\n };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o),\n r,\n ar = [],\n e;\n\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {\n ar.push(r.value);\n }\n } catch (error) {\n e = {\n error: error\n };\n } finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n\n return ar;\n}\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++) {\n ar = ar.concat(__read(arguments[i]));\n }\n\n return ar;\n}\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) {\n s += arguments[i].length;\n }\n\n for (var r = Array(s), k = 0, i = 0; i < il; i++) {\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {\n r[k] = a[j];\n }\n }\n\n return r;\n}\n;\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []),\n i,\n q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () {\n return this;\n }, i;\n\n function verb(n) {\n if (g[n]) i[n] = function (v) {\n return new Promise(function (a, b) {\n q.push([n, v, a, b]) > 1 || resume(n, v);\n });\n };\n }\n\n function resume(n, v) {\n try {\n step(g[n](v));\n } catch (e) {\n settle(q[0][3], e);\n }\n }\n\n function step(r) {\n r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);\n }\n\n function fulfill(value) {\n resume(\"next\", value);\n }\n\n function reject(value) {\n resume(\"throw\", value);\n }\n\n function settle(f, v) {\n if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);\n }\n}\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) {\n throw e;\n }), verb(\"return\"), i[Symbol.iterator] = function () {\n return this;\n }, i;\n\n function verb(n, f) {\n i[n] = o[n] ? function (v) {\n return (p = !p) ? {\n value: __await(o[n](v)),\n done: n === \"return\"\n } : f ? f(v) : v;\n } : f;\n }\n}\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator],\n i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () {\n return this;\n }, i);\n\n function verb(n) {\n i[n] = o[n] && function (v) {\n return new Promise(function (resolve, reject) {\n v = o[n](v), settle(resolve, reject, v.done, v.value);\n });\n };\n }\n\n function settle(resolve, reject, d, v) {\n Promise.resolve(v).then(function (v) {\n resolve({\n value: v,\n done: d\n });\n }, reject);\n }\n}\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) {\n Object.defineProperty(cooked, \"raw\", {\n value: raw\n });\n } else {\n cooked.raw = raw;\n }\n\n return cooked;\n}\n;\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) {\n if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n }\n result.default = mod;\n return result;\n}\nexport function __importDefault(mod) {\n return mod && mod.__esModule ? mod : {\n default: mod\n };\n}\nexport function __classPrivateFieldGet(receiver, privateMap) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to get private field on non-instance\");\n }\n\n return privateMap.get(receiver);\n}\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to set private field on non-instance\");\n }\n\n privateMap.set(receiver, value);\n return value;\n}","import { __assign, __awaiter, __generator } from \"tslib\";\nimport { HttpRequest } from \"@aws-sdk/protocol-http\";\nvar CONTENT_LENGTH_HEADER = \"content-length\";\nexport function contentLengthMiddleware(bodyLengthChecker) {\n var _this = this;\n\n return function (next) {\n return function (args) {\n return __awaiter(_this, void 0, void 0, function () {\n var request, body, headers, length;\n\n var _a;\n\n return __generator(this, function (_b) {\n request = args.request;\n\n if (HttpRequest.isInstance(request)) {\n body = request.body, headers = request.headers;\n\n if (body && Object.keys(headers).map(function (str) {\n return str.toLowerCase();\n }).indexOf(CONTENT_LENGTH_HEADER) === -1) {\n length = bodyLengthChecker(body);\n\n if (length !== undefined) {\n request.headers = __assign(__assign({}, request.headers), (_a = {}, _a[CONTENT_LENGTH_HEADER] = String(length), _a));\n }\n }\n }\n\n return [2\n /*return*/\n , next(__assign(__assign({}, args), {\n request: request\n }))];\n });\n });\n };\n };\n}\nexport var contentLengthMiddlewareOptions = {\n step: \"build\",\n tags: [\"SET_CONTENT_LENGTH\", \"CONTENT_LENGTH\"],\n name: \"contentLengthMiddleware\"\n};\nexport var getContentLengthPlugin = function getContentLengthPlugin(options) {\n return {\n applyToStack: function applyToStack(clientStack) {\n clientStack.add(contentLengthMiddleware(options.bodyLengthChecker), contentLengthMiddlewareOptions);\n }\n };\n};","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\n\n/* global Reflect, Promise */\nvar _extendStatics = function extendStatics(d, b) {\n _extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) {\n if (b.hasOwnProperty(p)) d[p] = b[p];\n }\n };\n\n return _extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n _extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nvar _assign = function __assign() {\n _assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return _assign.apply(this, arguments);\n};\n\nexport { _assign as __assign };\nexport function __rest(s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n}\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {\n if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n }\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\nexport function __param(paramIndex, decorator) {\n return function (target, key) {\n decorator(target, key, paramIndex);\n };\n}\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\nexport function __generator(thisArg, body) {\n var _ = {\n label: 0,\n sent: function sent() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n },\n f,\n y,\n t,\n g;\n return g = {\n next: verb(0),\n \"throw\": verb(1),\n \"return\": verb(2)\n }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () {\n return this;\n }), g;\n\n function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n\n while (_) {\n try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n\n case 7:\n op = _.ops.pop();\n\n _.trys.pop();\n\n continue;\n\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n\n if (t && _.label < t[2]) {\n _.label = t[2];\n\n _.ops.push(op);\n\n break;\n }\n\n if (t[2]) _.ops.pop();\n\n _.trys.pop();\n\n continue;\n }\n\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n }\n\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n}\nexport function __createBinding(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}\nexport function __exportStar(m, exports) {\n for (var p in m) {\n if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\n }\n}\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator,\n m = s && o[s],\n i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function next() {\n if (o && i >= o.length) o = void 0;\n return {\n value: o && o[i++],\n done: !o\n };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o),\n r,\n ar = [],\n e;\n\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {\n ar.push(r.value);\n }\n } catch (error) {\n e = {\n error: error\n };\n } finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n\n return ar;\n}\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++) {\n ar = ar.concat(__read(arguments[i]));\n }\n\n return ar;\n}\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) {\n s += arguments[i].length;\n }\n\n for (var r = Array(s), k = 0, i = 0; i < il; i++) {\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {\n r[k] = a[j];\n }\n }\n\n return r;\n}\n;\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []),\n i,\n q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () {\n return this;\n }, i;\n\n function verb(n) {\n if (g[n]) i[n] = function (v) {\n return new Promise(function (a, b) {\n q.push([n, v, a, b]) > 1 || resume(n, v);\n });\n };\n }\n\n function resume(n, v) {\n try {\n step(g[n](v));\n } catch (e) {\n settle(q[0][3], e);\n }\n }\n\n function step(r) {\n r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);\n }\n\n function fulfill(value) {\n resume(\"next\", value);\n }\n\n function reject(value) {\n resume(\"throw\", value);\n }\n\n function settle(f, v) {\n if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);\n }\n}\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) {\n throw e;\n }), verb(\"return\"), i[Symbol.iterator] = function () {\n return this;\n }, i;\n\n function verb(n, f) {\n i[n] = o[n] ? function (v) {\n return (p = !p) ? {\n value: __await(o[n](v)),\n done: n === \"return\"\n } : f ? f(v) : v;\n } : f;\n }\n}\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator],\n i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () {\n return this;\n }, i);\n\n function verb(n) {\n i[n] = o[n] && function (v) {\n return new Promise(function (resolve, reject) {\n v = o[n](v), settle(resolve, reject, v.done, v.value);\n });\n };\n }\n\n function settle(resolve, reject, d, v) {\n Promise.resolve(v).then(function (v) {\n resolve({\n value: v,\n done: d\n });\n }, reject);\n }\n}\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) {\n Object.defineProperty(cooked, \"raw\", {\n value: raw\n });\n } else {\n cooked.raw = raw;\n }\n\n return cooked;\n}\n;\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) {\n if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n }\n result.default = mod;\n return result;\n}\nexport function __importDefault(mod) {\n return mod && mod.__esModule ? mod : {\n default: mod\n };\n}\nexport function __classPrivateFieldGet(receiver, privateMap) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to get private field on non-instance\");\n }\n\n return privateMap.get(receiver);\n}\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to set private field on non-instance\");\n }\n\n privateMap.set(receiver, value);\n return value;\n}","import { __awaiter, __generator } from \"tslib\";\nimport { HttpRequest } from \"@aws-sdk/protocol-http\";\nexport function resolveHostHeaderConfig(input) {\n return input;\n}\nexport var hostHeaderMiddleware = function hostHeaderMiddleware(options) {\n return function (next) {\n return function (args) {\n return __awaiter(void 0, void 0, void 0, function () {\n var request, _a, handlerProtocol;\n\n return __generator(this, function (_b) {\n if (!HttpRequest.isInstance(args.request)) return [2\n /*return*/\n , next(args)];\n request = args.request;\n _a = (options.requestHandler.metadata || {}).handlerProtocol, handlerProtocol = _a === void 0 ? \"\" : _a; //For H2 request, remove 'host' header and use ':authority' header instead\n //reference: https://nodejs.org/dist/latest-v13.x/docs/api/errors.html#ERR_HTTP2_INVALID_CONNECTION_HEADERS\n\n if (handlerProtocol.indexOf(\"h2\") >= 0 && !request.headers[\":authority\"]) {\n delete request.headers[\"host\"];\n request.headers[\":authority\"] = \"\"; //non-H2 request and 'host' header is not set, set the 'host' header to request's hostname.\n } else if (!request.headers[\"host\"]) {\n request.headers[\"host\"] = request.hostname;\n }\n\n return [2\n /*return*/\n , next(args)];\n });\n });\n };\n };\n};\nexport var hostHeaderMiddlewareOptions = {\n name: \"hostHeaderMiddleware\",\n step: \"build\",\n priority: \"low\",\n tags: [\"HOST\"]\n};\nexport var getHostHeaderPlugin = function getHostHeaderPlugin(options) {\n return {\n applyToStack: function applyToStack(clientStack) {\n clientStack.add(hostHeaderMiddleware(options), hostHeaderMiddlewareOptions);\n }\n };\n};","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\n\n/* global Reflect, Promise */\nvar _extendStatics = function extendStatics(d, b) {\n _extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) {\n if (b.hasOwnProperty(p)) d[p] = b[p];\n }\n };\n\n return _extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n _extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nvar _assign = function __assign() {\n _assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return _assign.apply(this, arguments);\n};\n\nexport { _assign as __assign };\nexport function __rest(s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n}\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {\n if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n }\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\nexport function __param(paramIndex, decorator) {\n return function (target, key) {\n decorator(target, key, paramIndex);\n };\n}\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\nexport function __generator(thisArg, body) {\n var _ = {\n label: 0,\n sent: function sent() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n },\n f,\n y,\n t,\n g;\n return g = {\n next: verb(0),\n \"throw\": verb(1),\n \"return\": verb(2)\n }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () {\n return this;\n }), g;\n\n function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n\n while (_) {\n try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n\n case 7:\n op = _.ops.pop();\n\n _.trys.pop();\n\n continue;\n\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n\n if (t && _.label < t[2]) {\n _.label = t[2];\n\n _.ops.push(op);\n\n break;\n }\n\n if (t[2]) _.ops.pop();\n\n _.trys.pop();\n\n continue;\n }\n\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n }\n\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n}\nexport function __createBinding(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}\nexport function __exportStar(m, exports) {\n for (var p in m) {\n if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\n }\n}\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator,\n m = s && o[s],\n i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function next() {\n if (o && i >= o.length) o = void 0;\n return {\n value: o && o[i++],\n done: !o\n };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o),\n r,\n ar = [],\n e;\n\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {\n ar.push(r.value);\n }\n } catch (error) {\n e = {\n error: error\n };\n } finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n\n return ar;\n}\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++) {\n ar = ar.concat(__read(arguments[i]));\n }\n\n return ar;\n}\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) {\n s += arguments[i].length;\n }\n\n for (var r = Array(s), k = 0, i = 0; i < il; i++) {\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {\n r[k] = a[j];\n }\n }\n\n return r;\n}\n;\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []),\n i,\n q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () {\n return this;\n }, i;\n\n function verb(n) {\n if (g[n]) i[n] = function (v) {\n return new Promise(function (a, b) {\n q.push([n, v, a, b]) > 1 || resume(n, v);\n });\n };\n }\n\n function resume(n, v) {\n try {\n step(g[n](v));\n } catch (e) {\n settle(q[0][3], e);\n }\n }\n\n function step(r) {\n r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);\n }\n\n function fulfill(value) {\n resume(\"next\", value);\n }\n\n function reject(value) {\n resume(\"throw\", value);\n }\n\n function settle(f, v) {\n if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);\n }\n}\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) {\n throw e;\n }), verb(\"return\"), i[Symbol.iterator] = function () {\n return this;\n }, i;\n\n function verb(n, f) {\n i[n] = o[n] ? function (v) {\n return (p = !p) ? {\n value: __await(o[n](v)),\n done: n === \"return\"\n } : f ? f(v) : v;\n } : f;\n }\n}\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator],\n i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () {\n return this;\n }, i);\n\n function verb(n) {\n i[n] = o[n] && function (v) {\n return new Promise(function (resolve, reject) {\n v = o[n](v), settle(resolve, reject, v.done, v.value);\n });\n };\n }\n\n function settle(resolve, reject, d, v) {\n Promise.resolve(v).then(function (v) {\n resolve({\n value: v,\n done: d\n });\n }, reject);\n }\n}\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) {\n Object.defineProperty(cooked, \"raw\", {\n value: raw\n });\n } else {\n cooked.raw = raw;\n }\n\n return cooked;\n}\n;\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) {\n if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n }\n result.default = mod;\n return result;\n}\nexport function __importDefault(mod) {\n return mod && mod.__esModule ? mod : {\n default: mod\n };\n}\nexport function __classPrivateFieldGet(receiver, privateMap) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to get private field on non-instance\");\n }\n\n return privateMap.get(receiver);\n}\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to set private field on non-instance\");\n }\n\n privateMap.set(receiver, value);\n return value;\n}","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\n\n/* global Reflect, Promise */\nvar _extendStatics = function extendStatics(d, b) {\n _extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) {\n if (b.hasOwnProperty(p)) d[p] = b[p];\n }\n };\n\n return _extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n _extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nvar _assign = function __assign() {\n _assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return _assign.apply(this, arguments);\n};\n\nexport { _assign as __assign };\nexport function __rest(s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n}\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {\n if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n }\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\nexport function __param(paramIndex, decorator) {\n return function (target, key) {\n decorator(target, key, paramIndex);\n };\n}\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\nexport function __generator(thisArg, body) {\n var _ = {\n label: 0,\n sent: function sent() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n },\n f,\n y,\n t,\n g;\n return g = {\n next: verb(0),\n \"throw\": verb(1),\n \"return\": verb(2)\n }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () {\n return this;\n }), g;\n\n function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n\n while (_) {\n try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n\n case 7:\n op = _.ops.pop();\n\n _.trys.pop();\n\n continue;\n\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n\n if (t && _.label < t[2]) {\n _.label = t[2];\n\n _.ops.push(op);\n\n break;\n }\n\n if (t[2]) _.ops.pop();\n\n _.trys.pop();\n\n continue;\n }\n\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n }\n\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n}\nexport function __createBinding(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}\nexport function __exportStar(m, exports) {\n for (var p in m) {\n if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\n }\n}\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator,\n m = s && o[s],\n i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function next() {\n if (o && i >= o.length) o = void 0;\n return {\n value: o && o[i++],\n done: !o\n };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o),\n r,\n ar = [],\n e;\n\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {\n ar.push(r.value);\n }\n } catch (error) {\n e = {\n error: error\n };\n } finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n\n return ar;\n}\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++) {\n ar = ar.concat(__read(arguments[i]));\n }\n\n return ar;\n}\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) {\n s += arguments[i].length;\n }\n\n for (var r = Array(s), k = 0, i = 0; i < il; i++) {\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {\n r[k] = a[j];\n }\n }\n\n return r;\n}\n;\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []),\n i,\n q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () {\n return this;\n }, i;\n\n function verb(n) {\n if (g[n]) i[n] = function (v) {\n return new Promise(function (a, b) {\n q.push([n, v, a, b]) > 1 || resume(n, v);\n });\n };\n }\n\n function resume(n, v) {\n try {\n step(g[n](v));\n } catch (e) {\n settle(q[0][3], e);\n }\n }\n\n function step(r) {\n r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);\n }\n\n function fulfill(value) {\n resume(\"next\", value);\n }\n\n function reject(value) {\n resume(\"throw\", value);\n }\n\n function settle(f, v) {\n if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);\n }\n}\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) {\n throw e;\n }), verb(\"return\"), i[Symbol.iterator] = function () {\n return this;\n }, i;\n\n function verb(n, f) {\n i[n] = o[n] ? function (v) {\n return (p = !p) ? {\n value: __await(o[n](v)),\n done: n === \"return\"\n } : f ? f(v) : v;\n } : f;\n }\n}\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator],\n i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () {\n return this;\n }, i);\n\n function verb(n) {\n i[n] = o[n] && function (v) {\n return new Promise(function (resolve, reject) {\n v = o[n](v), settle(resolve, reject, v.done, v.value);\n });\n };\n }\n\n function settle(resolve, reject, d, v) {\n Promise.resolve(v).then(function (v) {\n resolve({\n value: v,\n done: d\n });\n }, reject);\n }\n}\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) {\n Object.defineProperty(cooked, \"raw\", {\n value: raw\n });\n } else {\n cooked.raw = raw;\n }\n\n return cooked;\n}\n;\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) {\n if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n }\n result.default = mod;\n return result;\n}\nexport function __importDefault(mod) {\n return mod && mod.__esModule ? mod : {\n default: mod\n };\n}\nexport function __classPrivateFieldGet(receiver, privateMap) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to get private field on non-instance\");\n }\n\n return privateMap.get(receiver);\n}\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to set private field on non-instance\");\n }\n\n privateMap.set(receiver, value);\n return value;\n}","export var ALGORITHM_QUERY_PARAM = \"X-Amz-Algorithm\";\nexport var CREDENTIAL_QUERY_PARAM = \"X-Amz-Credential\";\nexport var AMZ_DATE_QUERY_PARAM = \"X-Amz-Date\";\nexport var SIGNED_HEADERS_QUERY_PARAM = \"X-Amz-SignedHeaders\";\nexport var EXPIRES_QUERY_PARAM = \"X-Amz-Expires\";\nexport var SIGNATURE_QUERY_PARAM = \"X-Amz-Signature\";\nexport var TOKEN_QUERY_PARAM = \"X-Amz-Security-Token\";\nexport var AUTH_HEADER = \"authorization\";\nexport var AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase();\nexport var DATE_HEADER = \"date\";\nexport var GENERATED_HEADERS = [AUTH_HEADER, AMZ_DATE_HEADER, DATE_HEADER];\nexport var SIGNATURE_HEADER = SIGNATURE_QUERY_PARAM.toLowerCase();\nexport var SHA256_HEADER = \"x-amz-content-sha256\";\nexport var TOKEN_HEADER = TOKEN_QUERY_PARAM.toLowerCase();\nexport var HOST_HEADER = \"host\";\nexport var ALWAYS_UNSIGNABLE_HEADERS = {\n authorization: true,\n \"cache-control\": true,\n connection: true,\n expect: true,\n from: true,\n \"keep-alive\": true,\n \"max-forwards\": true,\n pragma: true,\n referer: true,\n te: true,\n trailer: true,\n \"transfer-encoding\": true,\n upgrade: true,\n \"user-agent\": true,\n \"x-amzn-trace-id\": true\n};\nexport var PROXY_HEADER_PATTERN = /^proxy-/;\nexport var SEC_HEADER_PATTERN = /^sec-/;\nexport var UNSIGNABLE_PATTERNS = [/^proxy-/i, /^sec-/i];\nexport var ALGORITHM_IDENTIFIER = \"AWS4-HMAC-SHA256\";\nexport var EVENT_ALGORITHM_IDENTIFIER = \"AWS4-HMAC-SHA256-PAYLOAD\";\nexport var UNSIGNED_PAYLOAD = \"UNSIGNED-PAYLOAD\";\nexport var MAX_CACHE_SIZE = 50;\nexport var KEY_TYPE_IDENTIFIER = \"aws4_request\";\nexport var MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7;","import { __values } from \"tslib\";\nimport { KEY_TYPE_IDENTIFIER, MAX_CACHE_SIZE } from \"./constants\";\nvar signingKeyCache = {};\nvar cacheQueue = [];\n/**\n * Create a string describing the scope of credentials used to sign a request.\n *\n * @param shortDate The current calendar date in the form YYYYMMDD.\n * @param region The AWS region in which the service resides.\n * @param service The service to which the signed request is being sent.\n */\n\nexport function createScope(shortDate, region, service) {\n return shortDate + \"/\" + region + \"/\" + service + \"/\" + KEY_TYPE_IDENTIFIER;\n}\n/**\n * Derive a signing key from its composite parts\n *\n * @param sha256Constructor A constructor function that can instantiate SHA-256\n * hash objects.\n * @param credentials The credentials with which the request will be\n * signed.\n * @param shortDate The current calendar date in the form YYYYMMDD.\n * @param region The AWS region in which the service resides.\n * @param service The service to which the signed request is being\n * sent.\n */\n\nexport function getSigningKey(sha256Constructor, credentials, shortDate, region, service) {\n var cacheKey = shortDate + \":\" + region + \":\" + service + \":\" + (credentials.accessKeyId + \":\" + credentials.sessionToken);\n\n if (cacheKey in signingKeyCache) {\n return signingKeyCache[cacheKey];\n }\n\n cacheQueue.push(cacheKey);\n\n while (cacheQueue.length > MAX_CACHE_SIZE) {\n delete signingKeyCache[cacheQueue.shift()];\n }\n\n return signingKeyCache[cacheKey] = new Promise(function (resolve, reject) {\n var e_1, _a;\n\n var keyPromise = Promise.resolve(\"AWS4\" + credentials.secretAccessKey);\n\n var _loop_1 = function _loop_1(signable) {\n keyPromise = keyPromise.then(function (intermediateKey) {\n return hmac(sha256Constructor, intermediateKey, signable);\n });\n keyPromise.catch(function () {});\n };\n\n try {\n for (var _b = __values([shortDate, region, service, KEY_TYPE_IDENTIFIER]), _c = _b.next(); !_c.done; _c = _b.next()) {\n var signable = _c.value;\n\n _loop_1(signable);\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n\n keyPromise.then(resolve, function (reason) {\n delete signingKeyCache[cacheKey];\n reject(reason);\n });\n });\n}\n/**\n * @internal\n */\n\nexport function clearCredentialCache() {\n cacheQueue.length = 0;\n Object.keys(signingKeyCache).forEach(function (cacheKey) {\n delete signingKeyCache[cacheKey];\n });\n}\n\nfunction hmac(ctor, secret, data) {\n var hash = new ctor(secret);\n hash.update(data);\n return hash.digest();\n}","var SHORT_TO_HEX = {};\nvar HEX_TO_SHORT = {};\n\nfor (var i = 0; i < 256; i++) {\n var encodedByte = i.toString(16).toLowerCase();\n\n if (encodedByte.length === 1) {\n encodedByte = \"0\" + encodedByte;\n }\n\n SHORT_TO_HEX[i] = encodedByte;\n HEX_TO_SHORT[encodedByte] = i;\n}\n/**\n * Converts a hexadecimal encoded string to a Uint8Array of bytes.\n *\n * @param encoded The hexadecimal encoded string\n */\n\n\nexport function fromHex(encoded) {\n if (encoded.length % 2 !== 0) {\n throw new Error(\"Hex encoded strings must have an even number length\");\n }\n\n var out = new Uint8Array(encoded.length / 2);\n\n for (var i = 0; i < encoded.length; i += 2) {\n var encodedByte = encoded.substr(i, 2).toLowerCase();\n\n if (encodedByte in HEX_TO_SHORT) {\n out[i / 2] = HEX_TO_SHORT[encodedByte];\n } else {\n throw new Error(\"Cannot decode unrecognized sequence \" + encodedByte + \" as hexadecimal\");\n }\n }\n\n return out;\n}\n/**\n * Converts a Uint8Array of binary data to a hexadecimal encoded string.\n *\n * @param bytes The binary data to encode\n */\n\nexport function toHex(bytes) {\n var out = \"\";\n\n for (var i = 0; i < bytes.byteLength; i++) {\n out += SHORT_TO_HEX[bytes[i]];\n }\n\n return out;\n}","import { __values } from \"tslib\";\nimport { ALWAYS_UNSIGNABLE_HEADERS, PROXY_HEADER_PATTERN, SEC_HEADER_PATTERN } from \"./constants\";\n/**\n * @internal\n */\n\nexport function getCanonicalHeaders(_a, unsignableHeaders, signableHeaders) {\n var e_1, _b;\n\n var headers = _a.headers;\n var canonical = {};\n\n try {\n for (var _c = __values(Object.keys(headers).sort()), _d = _c.next(); !_d.done; _d = _c.next()) {\n var headerName = _d.value;\n var canonicalHeaderName = headerName.toLowerCase();\n\n if (canonicalHeaderName in ALWAYS_UNSIGNABLE_HEADERS || (unsignableHeaders === null || unsignableHeaders === void 0 ? void 0 : unsignableHeaders.has(canonicalHeaderName)) || PROXY_HEADER_PATTERN.test(canonicalHeaderName) || SEC_HEADER_PATTERN.test(canonicalHeaderName)) {\n if (!signableHeaders || signableHeaders && !signableHeaders.has(canonicalHeaderName)) {\n continue;\n }\n }\n\n canonical[canonicalHeaderName] = headers[headerName].trim().replace(/\\s+/g, \" \");\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_d && !_d.done && (_b = _c.return)) _b.call(_c);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n\n return canonical;\n}","import { __awaiter, __generator, __values } from \"tslib\";\nimport { isArrayBuffer } from \"@aws-sdk/is-array-buffer\";\nimport { toHex } from \"@aws-sdk/util-hex-encoding\";\nimport { SHA256_HEADER, UNSIGNED_PAYLOAD } from \"./constants\";\n/**\n * @internal\n */\n\nexport function getPayloadHash(_a, hashConstructor) {\n var headers = _a.headers,\n body = _a.body;\n return __awaiter(this, void 0, void 0, function () {\n var _b, _c, headerName, hashCtor, _d;\n\n var e_1, _e;\n\n return __generator(this, function (_f) {\n switch (_f.label) {\n case 0:\n try {\n for (_b = __values(Object.keys(headers)), _c = _b.next(); !_c.done; _c = _b.next()) {\n headerName = _c.value;\n\n if (headerName.toLowerCase() === SHA256_HEADER) {\n return [2\n /*return*/\n , headers[headerName]];\n }\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_e = _b.return)) _e.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n\n if (!(body == undefined)) return [3\n /*break*/\n , 1];\n return [2\n /*return*/\n , \"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\"];\n\n case 1:\n if (!(typeof body === \"string\" || ArrayBuffer.isView(body) || isArrayBuffer(body))) return [3\n /*break*/\n , 3];\n hashCtor = new hashConstructor();\n hashCtor.update(body);\n _d = toHex;\n return [4\n /*yield*/\n , hashCtor.digest()];\n\n case 2:\n return [2\n /*return*/\n , _d.apply(void 0, [_f.sent()])];\n\n case 3:\n // As any defined body that is not a string or binary data is a stream, this\n // body is unsignable. Attempt to send the request with an unsigned payload,\n // which may or may not be accepted by the service.\n return [2\n /*return*/\n , UNSIGNED_PAYLOAD];\n }\n });\n });\n}","export var isArrayBuffer = function isArrayBuffer(arg) {\n return typeof ArrayBuffer === \"function\" && arg instanceof ArrayBuffer || Object.prototype.toString.call(arg) === \"[object ArrayBuffer]\";\n};","import { __assign, __read, __rest, __spread } from \"tslib\";\n/**\n * @internal\n */\n\nexport function cloneRequest(_a) {\n var headers = _a.headers,\n query = _a.query,\n rest = __rest(_a, [\"headers\", \"query\"]);\n\n return __assign(__assign({}, rest), {\n headers: __assign({}, headers),\n query: query ? cloneQuery(query) : undefined\n });\n}\n\nfunction cloneQuery(query) {\n return Object.keys(query).reduce(function (carry, paramName) {\n var _a;\n\n var param = query[paramName];\n return __assign(__assign({}, carry), (_a = {}, _a[paramName] = Array.isArray(param) ? __spread(param) : param, _a));\n }, {});\n}","import { __values } from \"tslib\";\nimport { cloneRequest } from \"./cloneRequest\";\nimport { GENERATED_HEADERS } from \"./constants\";\n/**\n * @internal\n */\n\nexport function prepareRequest(request) {\n var e_1, _a; // Create a clone of the request object that does not clone the body\n\n\n request = typeof request.clone === \"function\" ? request.clone() : cloneRequest(request);\n\n try {\n for (var _b = __values(Object.keys(request.headers)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var headerName = _c.value;\n\n if (GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) {\n delete request.headers[headerName];\n }\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n\n return request;\n}","export function iso8601(time) {\n return toDate(time).toISOString().replace(/\\.\\d{3}Z$/, \"Z\");\n}\nexport function toDate(time) {\n if (typeof time === \"number\") {\n return new Date(time * 1000);\n }\n\n if (typeof time === \"string\") {\n if (Number(time)) {\n return new Date(Number(time) * 1000);\n }\n\n return new Date(time);\n }\n\n return time;\n}","import { __awaiter, __generator } from \"tslib\";\nimport { toHex } from \"@aws-sdk/util-hex-encoding\";\nimport { ALGORITHM_IDENTIFIER, ALGORITHM_QUERY_PARAM, AMZ_DATE_HEADER, AMZ_DATE_QUERY_PARAM, AUTH_HEADER, CREDENTIAL_QUERY_PARAM, EVENT_ALGORITHM_IDENTIFIER, EXPIRES_QUERY_PARAM, MAX_PRESIGNED_TTL, SHA256_HEADER, SIGNATURE_QUERY_PARAM, SIGNED_HEADERS_QUERY_PARAM, TOKEN_HEADER, TOKEN_QUERY_PARAM } from \"./constants\";\nimport { createScope, getSigningKey } from \"./credentialDerivation\";\nimport { getCanonicalHeaders } from \"./getCanonicalHeaders\";\nimport { getCanonicalQuery } from \"./getCanonicalQuery\";\nimport { getPayloadHash } from \"./getPayloadHash\";\nimport { hasHeader } from \"./hasHeader\";\nimport { moveHeadersToQuery } from \"./moveHeadersToQuery\";\nimport { prepareRequest } from \"./prepareRequest\";\nimport { iso8601 } from \"./utilDate\";\n\nvar SignatureV4 =\n/** @class */\nfunction () {\n function SignatureV4(_a) {\n var applyChecksum = _a.applyChecksum,\n credentials = _a.credentials,\n region = _a.region,\n service = _a.service,\n sha256 = _a.sha256,\n _b = _a.uriEscapePath,\n uriEscapePath = _b === void 0 ? true : _b;\n this.service = service;\n this.sha256 = sha256;\n this.uriEscapePath = uriEscapePath; // default to true if applyChecksum isn't set\n\n this.applyChecksum = typeof applyChecksum === \"boolean\" ? applyChecksum : true;\n this.regionProvider = normalizeRegionProvider(region);\n this.credentialProvider = normalizeCredentialsProvider(credentials);\n }\n\n SignatureV4.prototype.presign = function (originalRequest, options) {\n if (options === void 0) {\n options = {};\n }\n\n return __awaiter(this, void 0, void 0, function () {\n var _a, signingDate, _b, expiresIn, unsignableHeaders, signableHeaders, signingRegion, signingService, credentials, region, _c, _d, longDate, shortDate, scope, request, canonicalHeaders, _e, _f, _g, _h, _j, _k;\n\n return __generator(this, function (_l) {\n switch (_l.label) {\n case 0:\n _a = options.signingDate, signingDate = _a === void 0 ? new Date() : _a, _b = options.expiresIn, expiresIn = _b === void 0 ? 3600 : _b, unsignableHeaders = options.unsignableHeaders, signableHeaders = options.signableHeaders, signingRegion = options.signingRegion, signingService = options.signingService;\n return [4\n /*yield*/\n , this.credentialProvider()];\n\n case 1:\n credentials = _l.sent();\n if (!(signingRegion !== null && signingRegion !== void 0)) return [3\n /*break*/\n , 2];\n _c = signingRegion;\n return [3\n /*break*/\n , 4];\n\n case 2:\n return [4\n /*yield*/\n , this.regionProvider()];\n\n case 3:\n _c = _l.sent();\n _l.label = 4;\n\n case 4:\n region = _c;\n _d = formatDate(signingDate), longDate = _d.longDate, shortDate = _d.shortDate;\n\n if (expiresIn > MAX_PRESIGNED_TTL) {\n return [2\n /*return*/\n , Promise.reject(\"Signature version 4 presigned URLs\" + \" must have an expiration date less than one week in\" + \" the future\")];\n }\n\n scope = createScope(shortDate, region, signingService !== null && signingService !== void 0 ? signingService : this.service);\n request = moveHeadersToQuery(prepareRequest(originalRequest));\n\n if (credentials.sessionToken) {\n request.query[TOKEN_QUERY_PARAM] = credentials.sessionToken;\n }\n\n request.query[ALGORITHM_QUERY_PARAM] = ALGORITHM_IDENTIFIER;\n request.query[CREDENTIAL_QUERY_PARAM] = credentials.accessKeyId + \"/\" + scope;\n request.query[AMZ_DATE_QUERY_PARAM] = longDate;\n request.query[EXPIRES_QUERY_PARAM] = expiresIn.toString(10);\n canonicalHeaders = getCanonicalHeaders(request, unsignableHeaders, signableHeaders);\n request.query[SIGNED_HEADERS_QUERY_PARAM] = getCanonicalHeaderList(canonicalHeaders);\n _e = request.query;\n _f = SIGNATURE_QUERY_PARAM;\n _g = this.getSignature;\n _h = [longDate, scope, this.getSigningKey(credentials, region, shortDate, signingService)];\n _j = this.createCanonicalRequest;\n _k = [request, canonicalHeaders];\n return [4\n /*yield*/\n , getPayloadHash(originalRequest, this.sha256)];\n\n case 5:\n return [4\n /*yield*/\n , _g.apply(this, _h.concat([_j.apply(this, _k.concat([_l.sent()]))]))];\n\n case 6:\n _e[_f] = _l.sent();\n return [2\n /*return*/\n , request];\n }\n });\n });\n };\n\n SignatureV4.prototype.sign = function (toSign, options) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n if (typeof toSign === \"string\") {\n return [2\n /*return*/\n , this.signString(toSign, options)];\n } else if (toSign.headers && toSign.payload) {\n return [2\n /*return*/\n , this.signEvent(toSign, options)];\n } else {\n return [2\n /*return*/\n , this.signRequest(toSign, options)];\n }\n\n return [2\n /*return*/\n ];\n });\n });\n };\n\n SignatureV4.prototype.signEvent = function (_a, _b) {\n var headers = _a.headers,\n payload = _a.payload;\n var _c = _b.signingDate,\n signingDate = _c === void 0 ? new Date() : _c,\n priorSignature = _b.priorSignature,\n signingRegion = _b.signingRegion,\n signingService = _b.signingService;\n return __awaiter(this, void 0, void 0, function () {\n var region, _d, _e, shortDate, longDate, scope, hashedPayload, hash, hashedHeaders, _f, stringToSign;\n\n return __generator(this, function (_g) {\n switch (_g.label) {\n case 0:\n if (!(signingRegion !== null && signingRegion !== void 0)) return [3\n /*break*/\n , 1];\n _d = signingRegion;\n return [3\n /*break*/\n , 3];\n\n case 1:\n return [4\n /*yield*/\n , this.regionProvider()];\n\n case 2:\n _d = _g.sent();\n _g.label = 3;\n\n case 3:\n region = _d;\n _e = formatDate(signingDate), shortDate = _e.shortDate, longDate = _e.longDate;\n scope = createScope(shortDate, region, signingService !== null && signingService !== void 0 ? signingService : this.service);\n return [4\n /*yield*/\n , getPayloadHash({\n headers: {},\n body: payload\n }, this.sha256)];\n\n case 4:\n hashedPayload = _g.sent();\n hash = new this.sha256();\n hash.update(headers);\n _f = toHex;\n return [4\n /*yield*/\n , hash.digest()];\n\n case 5:\n hashedHeaders = _f.apply(void 0, [_g.sent()]);\n stringToSign = [EVENT_ALGORITHM_IDENTIFIER, longDate, scope, priorSignature, hashedHeaders, hashedPayload].join(\"\\n\");\n return [2\n /*return*/\n , this.signString(stringToSign, {\n signingDate: signingDate,\n signingRegion: region,\n signingService: signingService\n })];\n }\n });\n });\n };\n\n SignatureV4.prototype.signString = function (stringToSign, _a) {\n var _b = _a === void 0 ? {} : _a,\n _c = _b.signingDate,\n signingDate = _c === void 0 ? new Date() : _c,\n signingRegion = _b.signingRegion,\n signingService = _b.signingService;\n\n return __awaiter(this, void 0, void 0, function () {\n var credentials, region, _d, shortDate, hash, _e, _f, _g;\n\n return __generator(this, function (_h) {\n switch (_h.label) {\n case 0:\n return [4\n /*yield*/\n , this.credentialProvider()];\n\n case 1:\n credentials = _h.sent();\n if (!(signingRegion !== null && signingRegion !== void 0)) return [3\n /*break*/\n , 2];\n _d = signingRegion;\n return [3\n /*break*/\n , 4];\n\n case 2:\n return [4\n /*yield*/\n , this.regionProvider()];\n\n case 3:\n _d = _h.sent();\n _h.label = 4;\n\n case 4:\n region = _d;\n shortDate = formatDate(signingDate).shortDate;\n _f = (_e = this.sha256).bind;\n return [4\n /*yield*/\n , this.getSigningKey(credentials, region, shortDate, signingService)];\n\n case 5:\n hash = new (_f.apply(_e, [void 0, _h.sent()]))();\n hash.update(stringToSign);\n _g = toHex;\n return [4\n /*yield*/\n , hash.digest()];\n\n case 6:\n return [2\n /*return*/\n , _g.apply(void 0, [_h.sent()])];\n }\n });\n });\n };\n\n SignatureV4.prototype.signRequest = function (requestToSign, _a) {\n var _b = _a === void 0 ? {} : _a,\n _c = _b.signingDate,\n signingDate = _c === void 0 ? new Date() : _c,\n signableHeaders = _b.signableHeaders,\n unsignableHeaders = _b.unsignableHeaders,\n signingRegion = _b.signingRegion,\n signingService = _b.signingService;\n\n return __awaiter(this, void 0, void 0, function () {\n var credentials, region, _d, request, _e, longDate, shortDate, scope, payloadHash, canonicalHeaders, signature;\n\n return __generator(this, function (_f) {\n switch (_f.label) {\n case 0:\n return [4\n /*yield*/\n , this.credentialProvider()];\n\n case 1:\n credentials = _f.sent();\n if (!(signingRegion !== null && signingRegion !== void 0)) return [3\n /*break*/\n , 2];\n _d = signingRegion;\n return [3\n /*break*/\n , 4];\n\n case 2:\n return [4\n /*yield*/\n , this.regionProvider()];\n\n case 3:\n _d = _f.sent();\n _f.label = 4;\n\n case 4:\n region = _d;\n request = prepareRequest(requestToSign);\n _e = formatDate(signingDate), longDate = _e.longDate, shortDate = _e.shortDate;\n scope = createScope(shortDate, region, signingService !== null && signingService !== void 0 ? signingService : this.service);\n request.headers[AMZ_DATE_HEADER] = longDate;\n\n if (credentials.sessionToken) {\n request.headers[TOKEN_HEADER] = credentials.sessionToken;\n }\n\n return [4\n /*yield*/\n , getPayloadHash(request, this.sha256)];\n\n case 5:\n payloadHash = _f.sent();\n\n if (!hasHeader(SHA256_HEADER, request.headers) && this.applyChecksum) {\n request.headers[SHA256_HEADER] = payloadHash;\n }\n\n canonicalHeaders = getCanonicalHeaders(request, unsignableHeaders, signableHeaders);\n return [4\n /*yield*/\n , this.getSignature(longDate, scope, this.getSigningKey(credentials, region, shortDate, signingService), this.createCanonicalRequest(request, canonicalHeaders, payloadHash))];\n\n case 6:\n signature = _f.sent();\n request.headers[AUTH_HEADER] = ALGORITHM_IDENTIFIER + \" \" + (\"Credential=\" + credentials.accessKeyId + \"/\" + scope + \", \") + (\"SignedHeaders=\" + getCanonicalHeaderList(canonicalHeaders) + \", \") + (\"Signature=\" + signature);\n return [2\n /*return*/\n , request];\n }\n });\n });\n };\n\n SignatureV4.prototype.createCanonicalRequest = function (request, canonicalHeaders, payloadHash) {\n var sortedHeaders = Object.keys(canonicalHeaders).sort();\n return request.method + \"\\n\" + this.getCanonicalPath(request) + \"\\n\" + getCanonicalQuery(request) + \"\\n\" + sortedHeaders.map(function (name) {\n return name + \":\" + canonicalHeaders[name];\n }).join(\"\\n\") + \"\\n\\n\" + sortedHeaders.join(\";\") + \"\\n\" + payloadHash;\n };\n\n SignatureV4.prototype.createStringToSign = function (longDate, credentialScope, canonicalRequest) {\n return __awaiter(this, void 0, void 0, function () {\n var hash, hashedRequest;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n hash = new this.sha256();\n hash.update(canonicalRequest);\n return [4\n /*yield*/\n , hash.digest()];\n\n case 1:\n hashedRequest = _a.sent();\n return [2\n /*return*/\n , ALGORITHM_IDENTIFIER + \"\\n\" + longDate + \"\\n\" + credentialScope + \"\\n\" + toHex(hashedRequest)];\n }\n });\n });\n };\n\n SignatureV4.prototype.getCanonicalPath = function (_a) {\n var path = _a.path;\n\n if (this.uriEscapePath) {\n var doubleEncoded = encodeURIComponent(path.replace(/^\\//, \"\"));\n return \"/\" + doubleEncoded.replace(/%2F/g, \"/\");\n }\n\n return path;\n };\n\n SignatureV4.prototype.getSignature = function (longDate, credentialScope, keyPromise, canonicalRequest) {\n return __awaiter(this, void 0, void 0, function () {\n var stringToSign, hash, _a, _b, _c;\n\n return __generator(this, function (_d) {\n switch (_d.label) {\n case 0:\n return [4\n /*yield*/\n , this.createStringToSign(longDate, credentialScope, canonicalRequest)];\n\n case 1:\n stringToSign = _d.sent();\n _b = (_a = this.sha256).bind;\n return [4\n /*yield*/\n , keyPromise];\n\n case 2:\n hash = new (_b.apply(_a, [void 0, _d.sent()]))();\n hash.update(stringToSign);\n _c = toHex;\n return [4\n /*yield*/\n , hash.digest()];\n\n case 3:\n return [2\n /*return*/\n , _c.apply(void 0, [_d.sent()])];\n }\n });\n });\n };\n\n SignatureV4.prototype.getSigningKey = function (credentials, region, shortDate, service) {\n return getSigningKey(this.sha256, credentials, shortDate, region, service || this.service);\n };\n\n return SignatureV4;\n}();\n\nexport { SignatureV4 };\n\nvar formatDate = function formatDate(now) {\n var longDate = iso8601(now).replace(/[\\-:]/g, \"\");\n return {\n longDate: longDate,\n shortDate: longDate.substr(0, 8)\n };\n};\n\nvar getCanonicalHeaderList = function getCanonicalHeaderList(headers) {\n return Object.keys(headers).sort().join(\";\");\n};\n\nvar normalizeRegionProvider = function normalizeRegionProvider(region) {\n if (typeof region === \"string\") {\n var promisified_1 = Promise.resolve(region);\n return function () {\n return promisified_1;\n };\n } else {\n return region;\n }\n};\n\nvar normalizeCredentialsProvider = function normalizeCredentialsProvider(credentials) {\n if (typeof credentials === \"object\") {\n var promisified_2 = Promise.resolve(credentials);\n return function () {\n return promisified_2;\n };\n } else {\n return credentials;\n }\n};","import { __assign, __values } from \"tslib\";\nimport { cloneRequest } from \"./cloneRequest\";\n/**\n * @internal\n */\n\nexport function moveHeadersToQuery(request) {\n var e_1, _a;\n\n var _b = typeof request.clone === \"function\" ? request.clone() : cloneRequest(request),\n headers = _b.headers,\n _c = _b.query,\n query = _c === void 0 ? {} : _c;\n\n try {\n for (var _d = __values(Object.keys(headers)), _e = _d.next(); !_e.done; _e = _d.next()) {\n var name = _e.value;\n var lname = name.toLowerCase();\n\n if (lname.substr(0, 6) === \"x-amz-\") {\n query[name] = headers[name];\n delete headers[name];\n }\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_e && !_e.done && (_a = _d.return)) _a.call(_d);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n\n return __assign(__assign({}, request), {\n headers: headers,\n query: query\n });\n}","import { __values } from \"tslib\";\nexport function hasHeader(soughtHeader, headers) {\n var e_1, _a;\n\n soughtHeader = soughtHeader.toLowerCase();\n\n try {\n for (var _b = __values(Object.keys(headers)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var headerName = _c.value;\n\n if (soughtHeader === headerName.toLowerCase()) {\n return true;\n }\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n\n return false;\n}","import { __values } from \"tslib\";\nimport { escapeUri } from \"@aws-sdk/util-uri-escape\";\nimport { SIGNATURE_HEADER } from \"./constants\";\n/**\n * @internal\n */\n\nexport function getCanonicalQuery(_a) {\n var e_1, _b;\n\n var _c = _a.query,\n query = _c === void 0 ? {} : _c;\n var keys = [];\n var serialized = {};\n\n var _loop_1 = function _loop_1(key) {\n if (key.toLowerCase() === SIGNATURE_HEADER) {\n return \"continue\";\n }\n\n keys.push(key);\n var value = query[key];\n\n if (typeof value === \"string\") {\n serialized[key] = escapeUri(key) + \"=\" + escapeUri(value);\n } else if (Array.isArray(value)) {\n serialized[key] = value.slice(0).sort().reduce(function (encoded, value) {\n return encoded.concat([escapeUri(key) + \"=\" + escapeUri(value)]);\n }, []).join(\"&\");\n }\n };\n\n try {\n for (var _d = __values(Object.keys(query).sort()), _e = _d.next(); !_e.done; _e = _d.next()) {\n var key = _e.value;\n\n _loop_1(key);\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_e && !_e.done && (_b = _d.return)) _b.call(_d);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n\n return keys.map(function (key) {\n return serialized[key];\n }).filter(function (serialized) {\n return serialized;\n }) // omit any falsy values\n .join(\"&\");\n}","import { __assign, __awaiter, __generator, __read } from \"tslib\";\nimport { SignatureV4 } from \"@aws-sdk/signature-v4\";\nexport function resolveAwsAuthConfig(input) {\n var _this = this;\n\n var credentials = input.credentials || input.credentialDefaultProvider(input);\n var normalizedCreds = normalizeProvider(credentials);\n var _a = input.signingEscapePath,\n signingEscapePath = _a === void 0 ? true : _a,\n _b = input.systemClockOffset,\n systemClockOffset = _b === void 0 ? input.systemClockOffset || 0 : _b,\n sha256 = input.sha256;\n var signer;\n\n if (input.signer) {\n //if signer is supplied by user, normalize it to a function returning a promise for signer.\n signer = normalizeProvider(input.signer);\n } else {\n //construct a provider inferring signing from region.\n signer = function signer() {\n return normalizeProvider(input.region)().then(function (region) {\n return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4\n /*yield*/\n , input.regionInfoProvider(region)];\n\n case 1:\n return [2\n /*return*/\n , [_a.sent() || {}, region]];\n }\n });\n });\n }).then(function (_a) {\n var _b = __read(_a, 2),\n regionInfo = _b[0],\n region = _b[1];\n\n var _c = regionInfo.signingRegion,\n signingRegion = _c === void 0 ? input.signingRegion : _c,\n _d = regionInfo.signingService,\n signingService = _d === void 0 ? input.signingName : _d; //update client's singing region and signing service config if they are resolved.\n //signing region resolving order: user supplied signingRegion -> endpoints.json inferred region -> client region\n\n input.signingRegion = input.signingRegion || signingRegion || region;\n input.signingName = input.signingName || signingService;\n return new SignatureV4({\n credentials: normalizedCreds,\n region: input.signingRegion,\n service: input.signingName,\n sha256: sha256,\n uriEscapePath: signingEscapePath\n });\n });\n };\n }\n\n return __assign(__assign({}, input), {\n systemClockOffset: systemClockOffset,\n signingEscapePath: signingEscapePath,\n credentials: normalizedCreds,\n signer: signer\n });\n}\n\nfunction normalizeProvider(input) {\n if (typeof input === \"object\") {\n var promisified_1 = Promise.resolve(input);\n return function () {\n return promisified_1;\n };\n }\n\n return input;\n}","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\n\n/* global Reflect, Promise */\nvar _extendStatics = function extendStatics(d, b) {\n _extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) {\n if (b.hasOwnProperty(p)) d[p] = b[p];\n }\n };\n\n return _extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n _extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nvar _assign = function __assign() {\n _assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return _assign.apply(this, arguments);\n};\n\nexport { _assign as __assign };\nexport function __rest(s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n}\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {\n if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n }\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\nexport function __param(paramIndex, decorator) {\n return function (target, key) {\n decorator(target, key, paramIndex);\n };\n}\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\nexport function __generator(thisArg, body) {\n var _ = {\n label: 0,\n sent: function sent() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n },\n f,\n y,\n t,\n g;\n return g = {\n next: verb(0),\n \"throw\": verb(1),\n \"return\": verb(2)\n }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () {\n return this;\n }), g;\n\n function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n\n while (_) {\n try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n\n case 7:\n op = _.ops.pop();\n\n _.trys.pop();\n\n continue;\n\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n\n if (t && _.label < t[2]) {\n _.label = t[2];\n\n _.ops.push(op);\n\n break;\n }\n\n if (t[2]) _.ops.pop();\n\n _.trys.pop();\n\n continue;\n }\n\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n }\n\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n}\nexport function __createBinding(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}\nexport function __exportStar(m, exports) {\n for (var p in m) {\n if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\n }\n}\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator,\n m = s && o[s],\n i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function next() {\n if (o && i >= o.length) o = void 0;\n return {\n value: o && o[i++],\n done: !o\n };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o),\n r,\n ar = [],\n e;\n\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {\n ar.push(r.value);\n }\n } catch (error) {\n e = {\n error: error\n };\n } finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n\n return ar;\n}\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++) {\n ar = ar.concat(__read(arguments[i]));\n }\n\n return ar;\n}\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) {\n s += arguments[i].length;\n }\n\n for (var r = Array(s), k = 0, i = 0; i < il; i++) {\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {\n r[k] = a[j];\n }\n }\n\n return r;\n}\n;\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []),\n i,\n q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () {\n return this;\n }, i;\n\n function verb(n) {\n if (g[n]) i[n] = function (v) {\n return new Promise(function (a, b) {\n q.push([n, v, a, b]) > 1 || resume(n, v);\n });\n };\n }\n\n function resume(n, v) {\n try {\n step(g[n](v));\n } catch (e) {\n settle(q[0][3], e);\n }\n }\n\n function step(r) {\n r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);\n }\n\n function fulfill(value) {\n resume(\"next\", value);\n }\n\n function reject(value) {\n resume(\"throw\", value);\n }\n\n function settle(f, v) {\n if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);\n }\n}\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) {\n throw e;\n }), verb(\"return\"), i[Symbol.iterator] = function () {\n return this;\n }, i;\n\n function verb(n, f) {\n i[n] = o[n] ? function (v) {\n return (p = !p) ? {\n value: __await(o[n](v)),\n done: n === \"return\"\n } : f ? f(v) : v;\n } : f;\n }\n}\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator],\n i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () {\n return this;\n }, i);\n\n function verb(n) {\n i[n] = o[n] && function (v) {\n return new Promise(function (resolve, reject) {\n v = o[n](v), settle(resolve, reject, v.done, v.value);\n });\n };\n }\n\n function settle(resolve, reject, d, v) {\n Promise.resolve(v).then(function (v) {\n resolve({\n value: v,\n done: d\n });\n }, reject);\n }\n}\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) {\n Object.defineProperty(cooked, \"raw\", {\n value: raw\n });\n } else {\n cooked.raw = raw;\n }\n\n return cooked;\n}\n;\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) {\n if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n }\n result.default = mod;\n return result;\n}\nexport function __importDefault(mod) {\n return mod && mod.__esModule ? mod : {\n default: mod\n };\n}\nexport function __classPrivateFieldGet(receiver, privateMap) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to get private field on non-instance\");\n }\n\n return privateMap.get(receiver);\n}\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to set private field on non-instance\");\n }\n\n privateMap.set(receiver, value);\n return value;\n}","import { __assign } from \"tslib\";\nimport { HttpRequest } from \"@aws-sdk/protocol-http\";\nexport function userAgentMiddleware(options) {\n return function (next) {\n return function (args) {\n var request = args.request;\n if (!HttpRequest.isInstance(request)) return next(args);\n var headers = request.headers;\n var userAgentHeader = options.runtime === \"node\" ? \"user-agent\" : \"x-amz-user-agent\";\n\n if (!headers[userAgentHeader]) {\n headers[userAgentHeader] = \"\" + options.defaultUserAgent;\n } else {\n headers[userAgentHeader] += \" \" + options.defaultUserAgent;\n }\n\n if (options.customUserAgent) {\n headers[userAgentHeader] += \" \" + options.customUserAgent;\n }\n\n return next(__assign(__assign({}, args), {\n request: request\n }));\n };\n };\n}\nexport var getUserAgentMiddlewareOptions = {\n name: \"getUserAgentMiddleware\",\n step: \"build\",\n tags: [\"SET_USER_AGENT\", \"USER_AGENT\"]\n};\nexport var getUserAgentPlugin = function getUserAgentPlugin(config) {\n return {\n applyToStack: function applyToStack(clientStack) {\n clientStack.add(userAgentMiddleware(config), getUserAgentMiddlewareOptions);\n }\n };\n};","import { __assign, __extends } from \"tslib\";\nimport { ClientDefaultValues as __ClientDefaultValues } from \"./runtimeConfig\";\nimport { resolveEndpointsConfig, resolveRegionConfig } from \"@aws-sdk/config-resolver\";\nimport { getContentLengthPlugin } from \"@aws-sdk/middleware-content-length\";\nimport { getHostHeaderPlugin, resolveHostHeaderConfig } from \"@aws-sdk/middleware-host-header\";\nimport { getLoggerPlugin } from \"@aws-sdk/middleware-logger\";\nimport { getRetryPlugin, resolveRetryConfig } from \"@aws-sdk/middleware-retry\";\nimport { resolveAwsAuthConfig } from \"@aws-sdk/middleware-signing\";\nimport { getUserAgentPlugin, resolveUserAgentConfig } from \"@aws-sdk/middleware-user-agent\";\nimport { Client as __Client } from \"@aws-sdk/smithy-client\";\n/**\n * Amazon Cognito Federated Identities\n *
Amazon Cognito Federated Identities is a web service that delivers scoped temporary\n * credentials to mobile devices and other untrusted environments. It uniquely identifies a\n * device and supplies the user with a consistent identity over the lifetime of an\n * application.
\n *
Using Amazon Cognito Federated Identities, you can enable authentication with one or\n * more third-party identity providers (Facebook, Google, or Login with Amazon) or an Amazon\n * Cognito user pool, and you can also choose to support unauthenticated access from your app.\n * Cognito delivers a unique identifier for each user and acts as an OpenID token provider\n * trusted by AWS Security Token Service (STS) to access temporary, limited-privilege AWS\n * credentials.
\n *
For a description of the authentication flow from the Amazon Cognito Developer Guide\n * see Authentication Flow.