{“ast”:null,“code”:“'use strict';nnvar utils = require('./utils');nnvar support = require('./support'); // private propertynnnvar _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; // public method for encodingnnexports.encode = function (input) {n var output = [];n var chr1, chr2, chr3, enc1, enc2, enc3, enc4;n var i = 0,n len = input.length,n remainingBytes = len;n var isArray = utils.getTypeOf(input) !== "string";nn while (i < input.length) {n remainingBytes = len - i;nn if (!isArray) {n chr1 = input.charCodeAt(i++);n chr2 = i < len ? input.charCodeAt(i++) : 0;n chr3 = i < len ? input.charCodeAt(i++) : 0;n } else {n chr1 = input;n chr2 = i < len ? input : 0;n chr3 = i < len ? input : 0;n }nn enc1 = chr1 >> 2;n enc2 = (chr1 & 3) << 4 | chr2 >> 4;n enc3 = remainingBytes > 1 ? (chr2 & 15) << 2 | chr3 >> 6 : 64;n enc4 = remainingBytes > 2 ? chr3 & 63 : 64;n output.push(_keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4));n }nn return output.join("");n}; // public method for decodingnnnexports.decode = function (input) {n var chr1, chr2, chr3;n var enc1, enc2, enc3, enc4;n var i = 0,n resultIndex = 0;n var dataUrlPrefix = "data:";nn if (input.substr(0, dataUrlPrefix.length) === dataUrlPrefix) {n // This is a common error: people give a data urln // (data:image/png;base64,iVBOR…) with a {base64: true} andn // wonders why things don't work.n // We can detect that the string input looks like a data url but wen // *can't* be sure it is one: removing everything up to the comma wouldn // be too dangerous.n throw new Error("Invalid base64 input, it looks like a data url.");n }nn input = input.replace(//g, "");n var totalLength = input.length * 3 / 4;nn if (input.charAt(input.length - 1) === _keyStr.charAt(64)) {n totalLength–;n }nn if (input.charAt(input.length - 2) === _keyStr.charAt(64)) {n totalLength–;n }nn if (totalLength % 1 !== 0) {n // totalLength is not an integer, the length does not match a validn // base64 content. That can happen if:n // - the input is not a base64 contentn // - the input is almost a base64 content, with a extra chars at then // beginning or at the endn // - the input uses a base64 variant (base64url for example)n throw new Error("Invalid base64 input, bad content length.");n }nn var output;nn if (support.uint8array) {n output = new Uint8Array(totalLength | 0);n } else {n output = new Array(totalLength | 0);n }nn while (i < input.length) {n enc1 = _keyStr.indexOf(input.charAt(i++));n enc2 = _keyStr.indexOf(input.charAt(i++));n enc3 = _keyStr.indexOf(input.charAt(i++));n enc4 = _keyStr.indexOf(input.charAt(i++));n chr1 = enc1 << 2 | enc2 >> 4;n chr2 = (enc2 & 15) << 4 | enc3 >> 2;n chr3 = (enc3 & 3) << 6 | enc4;n output = chr1;nn if (enc3 !== 64) {n output = chr2;n }nn if (enc4 !== 64) {n output = chr3;n }n }nn return output;n};”,“map”:null,“metadata”:{},“sourceType”:“module”}