{"ast":null,"code":"/*! 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 (;\n /* no initialization */\n 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 /* no final expression */\n {\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;;\n /* no condition */\n 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;;\n /* no condition */\n 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);","map":null,"metadata":{},"sourceType":"script"}