-
Notifications
You must be signed in to change notification settings - Fork 0
/
base64.js
61 lines (46 loc) · 6.03 KB
/
base64.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
module.exports = loadWebAssembly
loadWebAssembly.supported = typeof WebAssembly !== 'undefined'
function loadWebAssembly (opts) {
if (!loadWebAssembly.supported) return null
var imp = opts && opts.imports
var wasm = toUint8Array('AGFzbQEAAAABGQRgA39/fwBgA39/fwF/YAF/AX9gAn9/AX8CDwEDZW52Bm1lbW9yeQIAAgMHBgAAAQIDAQYPAn8BQcCIBAt/AEHAiAQLB2EFDWJhc2U2NF9lbmNvZGUAAhZiYXNlNjRfZW5jb2RpbmdfbGVuZ3RoAAMWYmFzZTY0X2RlY29kaW5nX2xlbmd0aAAEDWJhc2U2NF9kZWNvZGUABQtfX2hlYXBfYmFzZQMBCv0YBvoCAgJ/AX4CQCACRQ0AIAAgAToAACAAIAJqIgNBf2ogAToAACACQQNJDQAgACABOgACIAAgAToAASADQX1qIAE6AAAgA0F+aiABOgAAIAJBB0kNACAAIAE6AAMgA0F8aiABOgAAIAJBCUkNACAAQQAgAGtBA3EiBGoiAyABQf8BcUGBgoQIbCIANgIAIAMgAiAEa0F8cSICaiIBQXxqIAA2AgAgAkEJSQ0AIAMgADYCCCADIAA2AgQgAUF4aiAANgIAIAFBdGogADYCACACQRlJDQAgAyAANgIYIAMgADYCFCADIAA2AhAgAyAANgIMIAFBcGogADYCACABQWxqIAA2AgAgAUFoaiAANgIAIAFBZGogADYCACACIANBBHFBGHIiAWsiAkEgSQ0AIACtIgVCIIYgBYQhBSABIANqIQEDQCABIAU3AwAgAUEYaiAFNwMAIAFBEGogBTcDACABQQhqIAU3AwAgAUEgaiEBIAJBYGoiAkEfSw0ACwsLhAsBB38CQCACRSABQQNxRXJFBEADQCAAIAEtAAA6AAAg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kACQANAIAIgBEGACGotAABGDQEgBEEBaiIEQcAARw0ACyABIQQMAQsgAyAEOgAKC0EAIQUgAy0ACyIBIQICQAJAA0AgAiAFQYAIai0AAEYNASAFQQFqIgVBwABHDQALIAEhBQwBCyADIAU6AAsLQQAhBiADLQAMIgEhAgJAAkADQCACIAZBgAhqLQAARg0BIAZBAWoiBkHAAEcNAAsgASEGDAELIAMgBjoADAsgAyAGIAVBBnRqOgAPIAMgBUECdkEPcSAEQQR0cjoADiADIARBBHZBA3EgB0ECdHI6AA0gCEF/aiIBRQ0AIAAgCWogA0ENaiABEAEgCCAJakF/aiEJCyADQRBqJAAgCQsLRwEAQYAIC0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWmFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6MDEyMzQ1Njc4OSsvAHYJcHJvZHVjZXJzAQxwcm9jZXNzZWQtYnkBBWNsYW5nVjEwLjAuMCAoaHR0cHM6Ly9naXRodWIuY29tL2xsdm0vbGx2bS1wcm9qZWN0IGQzMjE3MGRiZDViMGQ1NDQzNjUzN2I2Yjc1YmVhZjQ0MzI0ZTBjMjgp')
var ready = null
var mod = {
buffer: wasm,
memory: null,
exports: null,
realloc: realloc,
onload: onload
}
onload(function () {})
return mod
function realloc (size) {
mod.exports.memory.grow(Math.max(0, Math.ceil(Math.abs(size - mod.memory.length) / 65536)))
mod.memory = new Uint8Array(mod.exports.memory.buffer)
}
function onload (cb) {
if (mod.exports) return cb()
if (ready) {
ready.then(cb.bind(null, null)).catch(cb)
return
}
try {
if (opts && opts.async) throw new Error('async')
setup({instance: new WebAssembly.Instance(new WebAssembly.Module(wasm), imp)})
} catch (err) {
ready = WebAssembly.instantiate(wasm, imp).then(setup)
}
onload(cb)
}
function setup (w) {
mod.exports = w.instance.exports
mod.memory = mod.exports.memory && mod.exports.memory.buffer && new Uint8Array(mod.exports.memory.buffer)
}
}
function toUint8Array (s) {
if (typeof atob === 'function') return new Uint8Array(atob(s).split('').map(charCodeAt))
return (require('buf' + 'fer').Buffer).from(s, 'base64')
}
function charCodeAt (c) {
return c.charCodeAt(0)
}