Webpack build for branch stable: e5bd6ec150

This commit is contained in:
Travis CI 2018-04-27 14:27:29 +00:00
parent 27be0542c7
commit b5f4c4f777
2 changed files with 78 additions and 43 deletions

View file

@ -16119,65 +16119,97 @@ for (var i = 0, len = code.length; i < len; ++i) {
revLookup['-'.charCodeAt(0)] = 62 revLookup['-'.charCodeAt(0)] = 62
revLookup['_'.charCodeAt(0)] = 63 revLookup['_'.charCodeAt(0)] = 63
function placeHoldersCount (b64) { function getLens (b64) {
var len = b64.length var len = b64.length
if (len % 4 > 0) { if (len % 4 > 0) {
throw new Error('Invalid string. Length must be a multiple of 4') throw new Error('Invalid string. Length must be a multiple of 4')
} }
// the number of equal signs (place holders) // Trim off extra bytes after placeholder bytes are found
// if there are two placeholders, than the two characters before it // See: https://github.com/beatgammit/base64-js/issues/42
// represent one byte var validLen = b64.indexOf('=')
// if there is only one, then the three characters before it represent 2 bytes if (validLen === -1) validLen = len
// this is just a cheap hack to not do indexOf twice
return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0 var placeHoldersLen = validLen === len
? 0
: 4 - (validLen % 4)
return [validLen, placeHoldersLen]
} }
// base64 is 4/3 + up to two characters of the original data
function byteLength (b64) { function byteLength (b64) {
// base64 is 4/3 + up to two characters of the original data var lens = getLens(b64)
return (b64.length * 3 / 4) - placeHoldersCount(b64) var validLen = lens[0]
var placeHoldersLen = lens[1]
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
}
function _byteLength (b64, validLen, placeHoldersLen) {
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
} }
function toByteArray (b64) { function toByteArray (b64) {
var i, l, tmp, placeHolders, arr var tmp
var len = b64.length var lens = getLens(b64)
placeHolders = placeHoldersCount(b64) var validLen = lens[0]
var placeHoldersLen = lens[1]
arr = new Arr((len * 3 / 4) - placeHolders) var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
var curByte = 0
// if there are placeholders, only get up to the last complete 4 chars // if there are placeholders, only get up to the last complete 4 chars
l = placeHolders > 0 ? len - 4 : len var len = placeHoldersLen > 0
? validLen - 4
: validLen
var L = 0 for (var i = 0; i < len; i += 4) {
tmp =
for (i = 0; i < l; i += 4) { (revLookup[b64.charCodeAt(i)] << 18) |
tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)] (revLookup[b64.charCodeAt(i + 1)] << 12) |
arr[L++] = (tmp >> 16) & 0xFF (revLookup[b64.charCodeAt(i + 2)] << 6) |
arr[L++] = (tmp >> 8) & 0xFF revLookup[b64.charCodeAt(i + 3)]
arr[L++] = tmp & 0xFF arr[curByte++] = (tmp >> 16) & 0xFF
arr[curByte++] = (tmp >> 8) & 0xFF
arr[curByte++] = tmp & 0xFF
} }
if (placeHolders === 2) { if (placeHoldersLen === 2) {
tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4) tmp =
arr[L++] = tmp & 0xFF (revLookup[b64.charCodeAt(i)] << 2) |
} else if (placeHolders === 1) { (revLookup[b64.charCodeAt(i + 1)] >> 4)
tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2) arr[curByte++] = tmp & 0xFF
arr[L++] = (tmp >> 8) & 0xFF }
arr[L++] = tmp & 0xFF
if (placeHoldersLen === 1) {
tmp =
(revLookup[b64.charCodeAt(i)] << 10) |
(revLookup[b64.charCodeAt(i + 1)] << 4) |
(revLookup[b64.charCodeAt(i + 2)] >> 2)
arr[curByte++] = (tmp >> 8) & 0xFF
arr[curByte++] = tmp & 0xFF
} }
return arr return arr
} }
function tripletToBase64 (num) { function tripletToBase64 (num) {
return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F] return lookup[num >> 18 & 0x3F] +
lookup[num >> 12 & 0x3F] +
lookup[num >> 6 & 0x3F] +
lookup[num & 0x3F]
} }
function encodeChunk (uint8, start, end) { function encodeChunk (uint8, start, end) {
var tmp var tmp
var output = [] var output = []
for (var i = start; i < end; i += 3) { for (var i = start; i < end; i += 3) {
tmp = ((uint8[i] << 16) & 0xFF0000) + ((uint8[i + 1] << 8) & 0xFF00) + (uint8[i + 2] & 0xFF) tmp =
((uint8[i] << 16) & 0xFF0000) +
((uint8[i + 1] << 8) & 0xFF00) +
(uint8[i + 2] & 0xFF)
output.push(tripletToBase64(tmp)) output.push(tripletToBase64(tmp))
} }
return output.join('') return output.join('')
@ -16187,31 +16219,34 @@ function fromByteArray (uint8) {
var tmp var tmp
var len = uint8.length var len = uint8.length
var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
var output = ''
var parts = [] var parts = []
var maxChunkLength = 16383 // must be multiple of 3 var maxChunkLength = 16383 // must be multiple of 3
// go through the array every three bytes, we'll deal with trailing stuff later // go through the array every three bytes, we'll deal with trailing stuff later
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength))) parts.push(encodeChunk(
uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
))
} }
// pad the end with zeros, but make sure to not forget the extra bytes // pad the end with zeros, but make sure to not forget the extra bytes
if (extraBytes === 1) { if (extraBytes === 1) {
tmp = uint8[len - 1] tmp = uint8[len - 1]
output += lookup[tmp >> 2] parts.push(
output += lookup[(tmp << 4) & 0x3F] lookup[tmp >> 2] +
output += '==' lookup[(tmp << 4) & 0x3F] +
'=='
)
} else if (extraBytes === 2) { } else if (extraBytes === 2) {
tmp = (uint8[len - 2] << 8) + (uint8[len - 1]) tmp = (uint8[len - 2] << 8) + uint8[len - 1]
output += lookup[tmp >> 10] parts.push(
output += lookup[(tmp >> 4) & 0x3F] lookup[tmp >> 10] +
output += lookup[(tmp << 2) & 0x3F] lookup[(tmp >> 4) & 0x3F] +
output += '=' lookup[(tmp << 2) & 0x3F] +
'='
)
} }
parts.push(output)
return parts.join('') return parts.join('')
} }

File diff suppressed because one or more lines are too long