forked from external-repos/squoosh
Compare commits
126 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b4c7792a93 | ||
|
|
2a31a1bd84 | ||
|
|
2c560659a7 | ||
|
|
8155fc2f1f | ||
|
|
c5446f234c | ||
|
|
bb6893e025 | ||
|
|
83d5357ac0 | ||
|
|
90706159fc | ||
|
|
c78f0c3747 | ||
|
|
0ba4b7cbd6 | ||
|
|
259597a70b | ||
|
|
18b2bd1135 | ||
|
|
e60ffddfd7 | ||
|
|
d808c72798 | ||
|
|
fcde9633ab | ||
|
|
e581075f64 | ||
|
|
eb08d0049a | ||
|
|
eed44dff97 | ||
|
|
93474b025e | ||
|
|
5df81ad062 | ||
|
|
e00814ebe2 | ||
|
|
4dab94686a | ||
|
|
d9f65701e1 | ||
|
|
2c9f447399 | ||
|
|
0e76dffaad | ||
|
|
246d3ed6b3 | ||
|
|
df28fd434c | ||
|
|
7e97b36249 | ||
|
|
c2218bce90 | ||
|
|
045cb14c54 | ||
|
|
44a5b4921a | ||
|
|
18f7591c6a | ||
|
|
b8d0d5202d | ||
|
|
e26d8895a4 | ||
|
|
b5ad52cfcf | ||
|
|
e1dd2796c1 | ||
|
|
98bc151907 | ||
|
|
36d23644aa | ||
|
|
3697635bae | ||
|
|
de1eb76226 | ||
|
|
fd87ae7d2a | ||
|
|
5df7dd7590 | ||
|
|
013946b137 | ||
|
|
81c183b0d6 | ||
|
|
f523db6403 | ||
|
|
cc6ea9e11c | ||
|
|
bd4b67037b | ||
|
|
8c5c97e106 | ||
|
|
a9d3bd71b5 | ||
|
|
0d0a9b4cdf | ||
|
|
f583770696 | ||
|
|
bae243ccdb | ||
|
|
02c113a68f | ||
|
|
600eead007 | ||
|
|
05416768d5 | ||
|
|
35d31f2324 | ||
|
|
82fadac70e | ||
|
|
47f9d22dd8 | ||
|
|
9420dba3bc | ||
|
|
e462875807 | ||
|
|
0747d2c419 | ||
|
|
4c658b79ef | ||
|
|
685558847f | ||
|
|
63ac34a662 | ||
|
|
42f9e4aed2 | ||
|
|
e14790f0b9 | ||
|
|
dfee848a39 | ||
|
|
a437afdf2b | ||
|
|
4768bc17ba | ||
|
|
0934c6c00f | ||
|
|
9d81a9cd57 | ||
|
|
239ffeb7a7 | ||
|
|
95570c8b3c | ||
|
|
6e52ac2a73 | ||
|
|
fd5c557065 | ||
|
|
0abb6f18ba | ||
|
|
4e5a810770 | ||
|
|
8a81792bd5 | ||
|
|
3f57f9fef1 | ||
|
|
549e1fc50a | ||
|
|
f3749a4e24 | ||
|
|
e316b0d667 | ||
|
|
8f2dcb5f48 | ||
|
|
5715fb7b1b | ||
|
|
cd33a2f759 | ||
|
|
ee561bb00e | ||
|
|
75275a5596 | ||
|
|
8cd811cafd | ||
|
|
4e090ea2f8 | ||
|
|
6b007a0235 | ||
|
|
c23d1091e7 | ||
|
|
d4f8b7f38b | ||
|
|
2c923e5239 | ||
|
|
fe52c9b307 | ||
|
|
3745a3fff1 | ||
|
|
d89e846896 | ||
|
|
db6dea846a | ||
|
|
8036579a3c | ||
|
|
0807fa4b9a | ||
|
|
3cda8285a1 | ||
|
|
0218d0aac5 | ||
|
|
cfba6e7bd5 | ||
|
|
c6015e2e8d | ||
|
|
94a2a7b32f | ||
|
|
03f33847a3 | ||
|
|
563b558204 | ||
|
|
3c92f2d531 | ||
|
|
f5ab9a9a59 | ||
|
|
7893660679 | ||
|
|
15dac42a7f | ||
|
|
53298a23ad | ||
|
|
7ffa45ba86 | ||
|
|
ee99cf6e0b | ||
|
|
2edb8cbd7e | ||
|
|
0ac3d17969 | ||
|
|
1baa823d77 | ||
|
|
368ad9505e | ||
|
|
08c267a98b | ||
|
|
0c3ef3fdf5 | ||
|
|
17dcc9c7d4 | ||
|
|
ac9a7767d2 | ||
|
|
c29006d593 | ||
|
|
e1ab43b76f | ||
|
|
409df481db | ||
|
|
02807aab32 | ||
|
|
34cb55978f |
@@ -7,3 +7,6 @@ end_of_line = lf
|
|||||||
charset = utf-8
|
charset = utf-8
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[Makefile]
|
||||||
|
indent_style = tab
|
||||||
|
|||||||
@@ -16,3 +16,8 @@
|
|||||||
# But it isn't a big deal if the user gets an old version.
|
# But it isn't a big deal if the user gets an old version.
|
||||||
/assets/*
|
/assets/*
|
||||||
Cache-Control: must-revalidate, max-age=3600
|
Cache-Control: must-revalidate, max-age=3600
|
||||||
|
|
||||||
|
# COOP+COEP for WebAssembly threads.
|
||||||
|
/*
|
||||||
|
Cross-Origin-Embedder-Policy: require-corp
|
||||||
|
Cross-Origin-Opener-Policy: same-origin
|
||||||
|
|||||||
84
codecs/avif/Makefile
Normal file
84
codecs/avif/Makefile
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
CODEC_URL = https://github.com/AOMediaCodec/libavif/archive/31d7c6d1e32cf467ac24fb8c7a76c4902a4c00db.tar.gz
|
||||||
|
CODEC_PACKAGE = node_modules/libavif.tar.gz
|
||||||
|
|
||||||
|
LIBAOM_URL = https://aomedia.googlesource.com/aom/+archive/v2.0.0.tar.gz
|
||||||
|
LIBAOM_PACKAGE = node_modules/libaom.tar.gz
|
||||||
|
|
||||||
|
export CODEC_DIR = node_modules/libavif
|
||||||
|
BUILD_DIR := node_modules/build
|
||||||
|
ENC_BUILD_DIR := $(BUILD_DIR)/enc
|
||||||
|
ENC_MT_BUILD_DIR := $(BUILD_DIR)/enc-mt
|
||||||
|
DEC_BUILD_DIR := $(BUILD_DIR)/dec
|
||||||
|
export LIBAOM_DIR = node_modules/libaom
|
||||||
|
|
||||||
|
OUT_ENC_JS = enc/avif_enc.js
|
||||||
|
OUT_ENC_MT_JS = enc/avif_enc_mt.js
|
||||||
|
OUT_DEC_JS = dec/avif_dec.js
|
||||||
|
|
||||||
|
OUT_ENC_CPP = enc/avif_enc.cpp
|
||||||
|
OUT_DEC_CPP = dec/avif_dec.cpp
|
||||||
|
|
||||||
|
HELPER_MAKEFLAGS := -f helper.Makefile
|
||||||
|
|
||||||
|
.PHONY: all clean
|
||||||
|
|
||||||
|
all: $(OUT_ENC_JS) $(OUT_DEC_JS) $(OUT_ENC_MT_JS)
|
||||||
|
|
||||||
|
$(OUT_ENC_JS): $(OUT_ENC_CPP) $(CODEC_DIR)/CMakeLists.txt $(LIBAOM_DIR)/CMakeLists.txt
|
||||||
|
$(MAKE) \
|
||||||
|
$(HELPER_MAKEFLAGS) \
|
||||||
|
BUILD_DIR=$(ENC_BUILD_DIR) \
|
||||||
|
OUT_JS=$@ \
|
||||||
|
OUT_CPP=$< \
|
||||||
|
LIBAOM_FLAGS="\
|
||||||
|
-DCONFIG_AV1_DECODER=0 \
|
||||||
|
-DCONFIG_MULTITHREAD=0 \
|
||||||
|
-DCONFIG_AV1_HIGHBITDEPTH=0 \
|
||||||
|
" \
|
||||||
|
LIBAVIF_FLAGS="-DAVIF_CODEC_AOM_DECODE=0"
|
||||||
|
|
||||||
|
$(OUT_ENC_MT_JS): $(OUT_ENC_CPP) $(CODEC_DIR)/CMakeLists.txt $(LIBAOM_DIR)/CMakeLists.txt
|
||||||
|
$(MAKE) \
|
||||||
|
$(HELPER_MAKEFLAGS) \
|
||||||
|
BUILD_DIR=$(ENC_MT_BUILD_DIR) \
|
||||||
|
OUT_JS=$@ \
|
||||||
|
OUT_CPP=$< \
|
||||||
|
LIBAOM_FLAGS="\
|
||||||
|
-DCONFIG_AV1_DECODER=0 \
|
||||||
|
-DCONFIG_AV1_HIGHBITDEPTH=0 \
|
||||||
|
" \
|
||||||
|
LIBAVIF_FLAGS="-DAVIF_CODEC_AOM_DECODE=0" \
|
||||||
|
OUT_FLAGS="-pthread"
|
||||||
|
|
||||||
|
$(OUT_DEC_JS): $(OUT_DEC_CPP) $(CODEC_DIR)/CMakeLists.txt $(LIBAOM_DIR)/CMakeLists.txt
|
||||||
|
$(MAKE) \
|
||||||
|
$(HELPER_MAKEFLAGS) \
|
||||||
|
BUILD_DIR=$(DEC_BUILD_DIR) \
|
||||||
|
OUT_JS=$@ \
|
||||||
|
OUT_CPP=$< \
|
||||||
|
LIBAOM_FLAGS="\
|
||||||
|
-DCONFIG_AV1_ENCODER=0 \
|
||||||
|
-DCONFIG_MULTITHREAD=0 \
|
||||||
|
" \
|
||||||
|
LIBAVIF_FLAGS="-DAVIF_CODEC_AOM_ENCODE=0"
|
||||||
|
|
||||||
|
$(CODEC_PACKAGE):
|
||||||
|
mkdir -p $(@D)
|
||||||
|
curl -sL $(CODEC_URL) -o $@
|
||||||
|
|
||||||
|
$(LIBAOM_PACKAGE):
|
||||||
|
mkdir -p $(@D)
|
||||||
|
curl -sL $(LIBAOM_URL) -o $@
|
||||||
|
|
||||||
|
$(CODEC_DIR)/CMakeLists.txt: $(CODEC_PACKAGE)
|
||||||
|
mkdir -p $(@D)
|
||||||
|
tar xzm --strip 1 -C $(@D) -f $(CODEC_PACKAGE)
|
||||||
|
|
||||||
|
$(LIBAOM_DIR)/CMakeLists.txt: $(LIBAOM_PACKAGE)
|
||||||
|
mkdir -p $(@D)
|
||||||
|
tar xzm -C $(@D) -f $(LIBAOM_PACKAGE)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(MAKE) $(HELPER_MAKEFLAGS) BUILD_DIR=$(ENC_BUILD_DIR) OUT_JS=$(OUT_ENC_JS) clean
|
||||||
|
$(MAKE) $(HELPER_MAKEFLAGS) BUILD_DIR=$(ENC_MT_BUILD_DIR) OUT_JS=$(OUT_ENC_MT_JS) clean
|
||||||
|
$(MAKE) $(HELPER_MAKEFLAGS) BUILD_DIR=$(DEC_BUILD_DIR) OUT_JS=$(OUT_DEC_JS) clean
|
||||||
14
codecs/avif/dec/README.md
Normal file
14
codecs/avif/dec/README.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# AVIF decoder
|
||||||
|
|
||||||
|
- Source: <https://github.com/AOMediaCodec/libavif>
|
||||||
|
- Version: v0.5.4
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
See `example.html`
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### `RawImage decode(std::string buffer)`
|
||||||
|
|
||||||
|
Decodes the given avif buffer into raw RGBA. `RawImage` is a class with 3 fields: `buffer`, `width`, and `height`.
|
||||||
48
codecs/avif/dec/avif_dec.cpp
Normal file
48
codecs/avif/dec/avif_dec.cpp
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
#include <emscripten/bind.h>
|
||||||
|
#include <emscripten/val.h>
|
||||||
|
#include "avif/avif.h"
|
||||||
|
|
||||||
|
using namespace emscripten;
|
||||||
|
|
||||||
|
thread_local const val Uint8ClampedArray = val::global("Uint8ClampedArray");
|
||||||
|
thread_local const val ImageData = val::global("ImageData");
|
||||||
|
|
||||||
|
val decode(std::string avifimage) {
|
||||||
|
avifImage* image = avifImageCreateEmpty();
|
||||||
|
avifDecoder* decoder = avifDecoderCreate();
|
||||||
|
avifResult decodeResult =
|
||||||
|
avifDecoderReadMemory(decoder, image, (uint8_t*)avifimage.c_str(), avifimage.length());
|
||||||
|
// image is an independent copy of decoded data, decoder may be destroyed here
|
||||||
|
avifDecoderDestroy(decoder);
|
||||||
|
|
||||||
|
val result = val::null();
|
||||||
|
|
||||||
|
if (decodeResult == AVIF_RESULT_OK) {
|
||||||
|
// Convert to interleaved RGB(A)/BGR(A) using a libavif-allocated buffer.
|
||||||
|
avifRGBImage rgb;
|
||||||
|
avifRGBImageSetDefaults(&rgb,
|
||||||
|
image); // Defaults to AVIF_RGB_FORMAT_RGBA which is what we want.
|
||||||
|
rgb.depth = 8; // Does not need to match image->depth. We always want 8-bit pixels.
|
||||||
|
|
||||||
|
avifRGBImageAllocatePixels(&rgb);
|
||||||
|
avifImageYUVToRGB(image, &rgb);
|
||||||
|
|
||||||
|
// We want to create a *copy* of the decoded data to be owned by the JavaScript side.
|
||||||
|
// For that, we perform `new Uint8Array(wasmMemBuffer, wasmPtr, wasmSize).slice()`:
|
||||||
|
result = ImageData.new_(
|
||||||
|
Uint8ClampedArray.new_(typed_memory_view(rgb.rowBytes * rgb.height, rgb.pixels)), rgb.width,
|
||||||
|
rgb.height);
|
||||||
|
|
||||||
|
// Now we can safely free the RGB pixels:
|
||||||
|
avifRGBImageFreePixels(&rgb);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Image has been converted to RGB, we don't need the original anymore.
|
||||||
|
avifImageDestroy(image);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_BINDINGS(my_module) {
|
||||||
|
function("decode", &decode);
|
||||||
|
}
|
||||||
6
codecs/avif/dec/avif_dec.d.ts
vendored
Normal file
6
codecs/avif/dec/avif_dec.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
interface AVIFModule extends EmscriptenWasm.Module {
|
||||||
|
decode(data: BufferSource): ImageData | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function(opts: EmscriptenWasm.ModuleOpts): Promise<AVIFModule>;
|
||||||
|
|
||||||
71
codecs/avif/dec/avif_dec.js
Normal file
71
codecs/avif/dec/avif_dec.js
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
|
||||||
|
var avif_dec = (function() {
|
||||||
|
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
|
||||||
|
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
|
||||||
|
return (
|
||||||
|
function(avif_dec) {
|
||||||
|
avif_dec = avif_dec || {};
|
||||||
|
|
||||||
|
|
||||||
|
var d;d||(d=typeof avif_dec !== 'undefined' ? avif_dec : {});var aa,ba;d.ready=new Promise(function(a,b){aa=a;ba=b});var r={},t;for(t in d)d.hasOwnProperty(t)&&(r[t]=d[t]);var u=!1,v=!1,ca=!1,da=!1;u="object"===typeof window;v="function"===typeof importScripts;ca="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;da=!u&&!ca&&!v;var w="",x,z,ea,fa;
|
||||||
|
if(ca)w=v?require("path").dirname(w)+"/":__dirname+"/",x=function(a,b){ea||(ea=require("fs"));fa||(fa=require("path"));a=fa.normalize(a);return ea.readFileSync(a,b?null:"utf8")},z=function(a){a=x(a,!0);a.buffer||(a=new Uint8Array(a));a.buffer||A("Assertion failed: undefined");return a},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(a){throw a;}),process.on("unhandledRejection",A),d.inspect=function(){return"[Emscripten Module object]"};
|
||||||
|
else if(da)"undefined"!=typeof read&&(x=function(a){return read(a)}),z=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");"object"===typeof a||A("Assertion failed: undefined");return a},"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!==typeof printErr?printErr:print);else if(u||v)v?w=self.location.href:document.currentScript&&(w=document.currentScript.src),_scriptDir&&
|
||||||
|
(w=_scriptDir),0!==w.indexOf("blob:")?w=w.substr(0,w.lastIndexOf("/")+1):w="",x=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},v&&(z=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var ha=d.print||console.log.bind(console),B=d.printErr||console.warn.bind(console);for(t in r)r.hasOwnProperty(t)&&(d[t]=r[t]);r=null;var ia=0,D;d.wasmBinary&&(D=d.wasmBinary);var noExitRuntime;
|
||||||
|
d.noExitRuntime&&(noExitRuntime=d.noExitRuntime);"object"!==typeof WebAssembly&&A("no native wasm support detected");var E,ja=new WebAssembly.Table({initial:645,maximum:645,element:"anyfunc"}),ka=!1,la="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
|
||||||
|
function ma(a,b,c){var e=b+c;for(c=b;a[c]&&!(c>=e);)++c;if(16<c-b&&a.subarray&&la)return la.decode(a.subarray(b,c));for(e="";b<c;){var f=a[b++];if(f&128){var g=a[b++]&63;if(192==(f&224))e+=String.fromCharCode((f&31)<<6|g);else{var h=a[b++]&63;f=224==(f&240)?(f&15)<<12|g<<6|h:(f&7)<<18|g<<12|h<<6|a[b++]&63;65536>f?e+=String.fromCharCode(f):(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else e+=String.fromCharCode(f)}return e}
|
||||||
|
function na(a,b,c){var e=F;if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var h=a.charCodeAt(++f);g=65536+((g&1023)<<10)|h&1023}if(127>=g){if(b>=c)break;e[b++]=g}else{if(2047>=g){if(b+1>=c)break;e[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;e[b++]=224|g>>12}else{if(b+3>=c)break;e[b++]=240|g>>18;e[b++]=128|g>>12&63}e[b++]=128|g>>6&63}e[b++]=128|g&63}}e[b]=0}}var oa="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;
|
||||||
|
function pa(a,b){var c=a>>1;for(var e=c+b/2;!(c>=e)&&G[c];)++c;c<<=1;if(32<c-a&&oa)return oa.decode(F.subarray(a,c));c=0;for(e="";;){var f=H[a+2*c>>1];if(0==f||c==b/2)return e;++c;e+=String.fromCharCode(f)}}function qa(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var e=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)H[b>>1]=a.charCodeAt(f),b+=2;H[b>>1]=0;return b-e}function ra(a){return 2*a.length}
|
||||||
|
function sa(a,b){for(var c=0,e="";!(c>=b/4);){var f=I[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023)):e+=String.fromCharCode(f)}return e}function ta(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var e=b;c=e+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var h=a.charCodeAt(++f);g=65536+((g&1023)<<10)|h&1023}I[b>>2]=g;b+=4;if(b+4>c)break}I[b>>2]=0;return b-e}
|
||||||
|
function ua(a){for(var b=0,c=0;c<a.length;++c){var e=a.charCodeAt(c);55296<=e&&57343>=e&&++c;b+=4}return b}var J,va,F,H,G,I,L,wa,xa;function ya(a){J=a;d.HEAP8=va=new Int8Array(a);d.HEAP16=H=new Int16Array(a);d.HEAP32=I=new Int32Array(a);d.HEAPU8=F=new Uint8Array(a);d.HEAPU16=G=new Uint16Array(a);d.HEAPU32=L=new Uint32Array(a);d.HEAPF32=wa=new Float32Array(a);d.HEAPF64=xa=new Float64Array(a)}var za=d.INITIAL_MEMORY||16777216;d.wasmMemory?E=d.wasmMemory:E=new WebAssembly.Memory({initial:za/65536,maximum:32768});
|
||||||
|
E&&(J=E.buffer);za=J.byteLength;ya(J);I[153920]=5858720;function Aa(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(d);else{var c=b.fa;"number"===typeof c?void 0===b.ba?d.dynCall_v(c):d.dynCall_vi(c,b.ba):c(void 0===b.ba?null:b.ba)}}}var Ba=[],Ca=[],Da=[],Ea=[];function Fa(){var a=d.preRun.shift();Ba.unshift(a)}var M=0,Ga=null,N=null;d.preloadedImages={};d.preloadedAudios={};
|
||||||
|
function A(a){if(d.onAbort)d.onAbort(a);B(a);ka=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");ba(a);throw a;}function Ha(a){var b=O;return String.prototype.startsWith?b.startsWith(a):0===b.indexOf(a)}function Ia(){return Ha("data:application/octet-stream;base64,")}var O="avif_dec.wasm";if(!Ia()){var Ja=O;O=d.locateFile?d.locateFile(Ja,w):w+Ja}
|
||||||
|
function Ka(){try{if(D)return new Uint8Array(D);if(z)return z(O);throw"both async and sync fetching of the wasm failed";}catch(a){A(a)}}function La(){return D||!u&&!v||"function"!==typeof fetch||Ha("file://")?new Promise(function(a){a(Ka())}):fetch(O,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+O+"'";return a.arrayBuffer()}).catch(function(){return Ka()})}Ca.push({fa:function(){Ma()}});
|
||||||
|
function Na(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var Oa=void 0;function Q(a){for(var b="";F[a];)b+=Oa[F[a++]];return b}var R={},S={},Pa={};function Qa(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}
|
||||||
|
function Ra(a,b){a=Qa(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function Sa(a){var b=Error,c=Ra(a,function(e){this.name=a;this.message=e;e=Error(e).stack;void 0!==e&&(this.stack=this.toString()+"\n"+e.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}
|
||||||
|
var Ta=void 0;function T(a){throw new Ta(a);}var Ua=void 0;function Va(a,b){function c(l){l=b(l);if(l.length!==e.length)throw new Ua("Mismatched type converter count");for(var k=0;k<e.length;++k)U(e[k],l[k])}var e=[];e.forEach(function(l){Pa[l]=a});var f=Array(a.length),g=[],h=0;a.forEach(function(l,k){S.hasOwnProperty(l)?f[k]=S[l]:(g.push(l),R.hasOwnProperty(l)||(R[l]=[]),R[l].push(function(){f[k]=S[l];++h;h===g.length&&c(f)}))});0===g.length&&c(f)}
|
||||||
|
function U(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var e=b.name;a||T('type "'+e+'" must have a positive integer typeid pointer');if(S.hasOwnProperty(a)){if(c.ga)return;T("Cannot register type '"+e+"' twice")}S[a]=b;delete Pa[a];R.hasOwnProperty(a)&&(b=R[a],delete R[a],b.forEach(function(f){f()}))}var Wa=[],V=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||||
|
function Xa(a){4<a&&0===--V[a].da&&(V[a]=void 0,Wa.push(a))}function $a(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Wa.length?Wa.pop():V.length;V[b]={da:1,value:a};return b}}function ab(a){return this.fromWireType(L[a>>2])}function bb(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
||||||
|
function cb(a,b){switch(b){case 2:return function(c){return this.fromWireType(wa[c>>2])};case 3:return function(c){return this.fromWireType(xa[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function db(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Ra(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
||||||
|
function eb(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function fb(a,b){var c=d;if(void 0===c[a].$){var e=c[a];c[a]=function(){c[a].$.hasOwnProperty(arguments.length)||T("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].$+")!");return c[a].$[arguments.length].apply(this,arguments)};c[a].$=[];c[a].$[e.ea]=e}}
|
||||||
|
function gb(a,b,c){d.hasOwnProperty(a)?((void 0===c||void 0!==d[a].$&&void 0!==d[a].$[c])&&T("Cannot register public name '"+a+"' twice"),fb(a,a),d.hasOwnProperty(c)&&T("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),d[a].$[c]=b):(d[a]=b,void 0!==c&&(d[a].ia=c))}function hb(a,b){for(var c=[],e=0;e<a;e++)c.push(I[(b>>2)+e]);return c}
|
||||||
|
function ib(a,b){a=Q(a);var c=d["dynCall_"+a];for(var e=[],f=1;f<a.length;++f)e.push("a"+f);f="return function dynCall_"+(a+"_"+b)+"("+e.join(", ")+") {\n";f+=" return dynCall(rawFunction"+(e.length?", ":"")+e.join(", ")+");\n";c=(new Function("dynCall","rawFunction",f+"};\n"))(c,b);"function"!==typeof c&&T("unknown function pointer with signature "+a+": "+b);return c}var jb=void 0;function kb(a){a=lb(a);var b=Q(a);W(a);return b}
|
||||||
|
function mb(a,b){function c(g){f[g]||S[g]||(Pa[g]?Pa[g].forEach(c):(e.push(g),f[g]=!0))}var e=[],f={};b.forEach(c);throw new jb(a+": "+e.map(kb).join([", "]));}function nb(a,b,c){switch(b){case 0:return c?function(e){return va[e]}:function(e){return F[e]};case 1:return c?function(e){return H[e>>1]}:function(e){return G[e>>1]};case 2:return c?function(e){return I[e>>2]}:function(e){return L[e>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var ob={};
|
||||||
|
function pb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function qb(a,b){var c=S[a];void 0===c&&T(b+" has unknown type "+kb(a));return c}for(var rb={},sb=[null,[],[]],tb=Array(256),ub=0;256>ub;++ub)tb[ub]=String.fromCharCode(ub);Oa=tb;Ta=d.BindingError=Sa("BindingError");Ua=d.InternalError=Sa("InternalError");d.count_emval_handles=function(){for(var a=0,b=5;b<V.length;++b)void 0!==V[b]&&++a;return a};
|
||||||
|
d.get_first_emval=function(){for(var a=5;a<V.length;++a)if(void 0!==V[a])return V[a];return null};jb=d.UnboundTypeError=Sa("UnboundTypeError");
|
||||||
|
var Ab={k:function(){},s:function(a,b,c,e,f){var g=Na(c);b=Q(b);U(a,{name:b,fromWireType:function(h){return!!h},toWireType:function(h,l){return l?e:f},argPackAdvance:8,readValueFromPointer:function(h){if(1===c)var l=va;else if(2===c)l=H;else if(4===c)l=I;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(l[h>>g])},aa:null})},A:function(a,b){b=Q(b);U(a,{name:b,fromWireType:function(c){var e=V[c].value;Xa(c);return e},toWireType:function(c,e){return $a(e)},argPackAdvance:8,
|
||||||
|
readValueFromPointer:ab,aa:null})},r:function(a,b,c){c=Na(c);b=Q(b);U(a,{name:b,fromWireType:function(e){return e},toWireType:function(e,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+bb(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:cb(b,c),aa:null})},u:function(a,b,c,e,f,g){var h=hb(b,c);a=Q(a);f=ib(e,f);gb(a,function(){mb("Cannot call "+a+" due to unbound types",h)},b-1);Va(h,function(l){var k=[l[0],null].concat(l.slice(1)),m=l=a,p=
|
||||||
|
f,q=k.length;2>q&&T("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var y=null!==k[1]&&!1,C=!1,n=1;n<k.length;++n)if(null!==k[n]&&void 0===k[n].aa){C=!0;break}var Ya="void"!==k[0].name,K="",P="";for(n=0;n<q-2;++n)K+=(0!==n?", ":"")+"arg"+n,P+=(0!==n?", ":"")+"arg"+n+"Wired";m="return function "+Qa(m)+"("+K+") {\nif (arguments.length !== "+(q-2)+") {\nthrowBindingError('function "+m+" called with ' + arguments.length + ' arguments, expected "+(q-2)+" args!');\n}\n";
|
||||||
|
C&&(m+="var destructors = [];\n");var Za=C?"destructors":"null";K="throwBindingError invoker fn runDestructors retType classParam".split(" ");p=[T,p,g,eb,k[0],k[1]];y&&(m+="var thisWired = classParam.toWireType("+Za+", this);\n");for(n=0;n<q-2;++n)m+="var arg"+n+"Wired = argType"+n+".toWireType("+Za+", arg"+n+"); // "+k[n+2].name+"\n",K.push("argType"+n),p.push(k[n+2]);y&&(P="thisWired"+(0<P.length?", ":"")+P);m+=(Ya?"var rv = ":"")+"invoker(fn"+(0<P.length?", ":"")+P+");\n";if(C)m+="runDestructors(destructors);\n";
|
||||||
|
else for(n=y?1:2;n<k.length;++n)q=1===n?"thisWired":"arg"+(n-2)+"Wired",null!==k[n].aa&&(m+=q+"_dtor("+q+"); // "+k[n].name+"\n",K.push(q+"_dtor"),p.push(k[n].aa));Ya&&(m+="var ret = retType.fromWireType(rv);\nreturn ret;\n");K.push(m+"}\n");k=db(K).apply(null,p);n=b-1;if(!d.hasOwnProperty(l))throw new Ua("Replacing nonexistant public symbol");void 0!==d[l].$&&void 0!==n?d[l].$[n]=k:(d[l]=k,d[l].ea=n);return[]})},e:function(a,b,c,e,f){function g(m){return m}b=Q(b);-1===f&&(f=4294967295);var h=Na(c);
|
||||||
|
if(0===e){var l=32-8*c;g=function(m){return m<<l>>>l}}var k=-1!=b.indexOf("unsigned");U(a,{name:b,fromWireType:g,toWireType:function(m,p){if("number"!==typeof p&&"boolean"!==typeof p)throw new TypeError('Cannot convert "'+bb(p)+'" to '+this.name);if(p<e||p>f)throw new TypeError('Passing a number "'+bb(p)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+e+", "+f+"]!");return k?p>>>0:p|0},argPackAdvance:8,readValueFromPointer:nb(b,h,0!==e),aa:null})},
|
||||||
|
d:function(a,b,c){function e(g){g>>=2;var h=L;return new f(J,h[g+1],h[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=Q(c);U(a,{name:c,fromWireType:e,argPackAdvance:8,readValueFromPointer:e},{ga:!0})},m:function(a,b){b=Q(b);var c="std::string"===b;U(a,{name:b,fromWireType:function(e){var f=L[e>>2];if(c)for(var g=e+4,h=0;h<=f;++h){var l=e+4+h;if(h==f||0==F[l]){g=g?ma(F,g,l-g):"";if(void 0===k)var k=g;else k+=String.fromCharCode(0),k+=g;
|
||||||
|
g=l+1}}else{k=Array(f);for(h=0;h<f;++h)k[h]=String.fromCharCode(F[e+4+h]);k=k.join("")}W(e);return k},toWireType:function(e,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||T("Cannot pass non-string to std::string");var h=(c&&g?function(){for(var m=0,p=0;p<f.length;++p){var q=f.charCodeAt(p);55296<=q&&57343>=q&&(q=65536+((q&1023)<<10)|f.charCodeAt(++p)&1023);127>=q?++m:m=2047>=q?m+2:65535>=
|
||||||
|
q?m+3:m+4}return m}:function(){return f.length})(),l=vb(4+h+1);L[l>>2]=h;if(c&&g)na(f,l+4,h+1);else if(g)for(g=0;g<h;++g){var k=f.charCodeAt(g);255<k&&(W(l),T("String has UTF-16 code units that do not fit in 8 bits"));F[l+4+g]=k}else for(g=0;g<h;++g)F[l+4+g]=f[g];null!==e&&e.push(W,l);return l},argPackAdvance:8,readValueFromPointer:ab,aa:function(e){W(e)}})},l:function(a,b,c){c=Q(c);if(2===b){var e=pa;var f=qa;var g=ra;var h=function(){return G};var l=1}else 4===b&&(e=sa,f=ta,g=ua,h=function(){return L},
|
||||||
|
l=2);U(a,{name:c,fromWireType:function(k){for(var m=L[k>>2],p=h(),q,y=k+4,C=0;C<=m;++C){var n=k+4+C*b;if(C==m||0==p[n>>l])y=e(y,n-y),void 0===q?q=y:(q+=String.fromCharCode(0),q+=y),y=n+b}W(k);return q},toWireType:function(k,m){"string"!==typeof m&&T("Cannot pass non-string to C++ string type "+c);var p=g(m),q=vb(4+p+b);L[q>>2]=p>>l;f(m,q+4,p+b);null!==k&&k.push(W,q);return q},argPackAdvance:8,readValueFromPointer:ab,aa:function(k){W(k)}})},t:function(a,b){b=Q(b);U(a,{ha:!0,name:b,argPackAdvance:0,
|
||||||
|
fromWireType:function(){},toWireType:function(){}})},i:Xa,j:function(a){if(0===a)return $a(pb());var b=ob[a];a=void 0===b?Q(a):b;return $a(pb()[a])},n:function(a){4<a&&(V[a].da+=1)},o:function(a,b,c,e){a||T("Cannot use deleted val. handle = "+a);a=V[a].value;var f=rb[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var h="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)h+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+
|
||||||
|
g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",h+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(qb,d,$a);rb[b]=f}return f(a,c,e)},c:function(){A()},h:function(a,b){X(a,b||1);throw"longjmp";},y:function(a,b,c){F.copyWithin(a,b,b+c)},g:function(a){a>>>=0;var b=F.length;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var e=b*
|
||||||
|
(1+.2/c);e=Math.min(e,a+100663296);e=Math.max(16777216,a,e);0<e%65536&&(e+=65536-e%65536);a:{try{E.grow(Math.min(2147483648,e)-J.byteLength+65535>>>16);ya(E.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},z:function(){return 0},v:function(){},q:function(a,b,c,e){for(var f=0,g=0;g<c;g++){for(var h=I[b+8*g>>2],l=I[b+(8*g+4)>>2],k=0;k<l;k++){var m=F[h+k],p=sb[a];0===m||10===m?((1===a?ha:B)(ma(p,0)),p.length=0):p.push(m)}f+=l}I[e>>2]=f;return 0},a:function(){return ia|0},f:wb,w:xb,
|
||||||
|
p:yb,x:zb,memory:E,b:function(a){ia=a|0},table:ja};
|
||||||
|
(function(){function a(f){d.asm=f.exports;M--;d.monitorRunDependencies&&d.monitorRunDependencies(M);0==M&&(null!==Ga&&(clearInterval(Ga),Ga=null),N&&(f=N,N=null,f()))}function b(f){a(f.instance)}function c(f){return La().then(function(g){return WebAssembly.instantiate(g,e)}).then(f,function(g){B("failed to asynchronously prepare wasm: "+g);A(g)})}var e={a:Ab};M++;d.monitorRunDependencies&&d.monitorRunDependencies(M);if(d.instantiateWasm)try{return d.instantiateWasm(e,a)}catch(f){return B("Module.instantiateWasm callback failed with error: "+
|
||||||
|
f),!1}(function(){if(D||"function"!==typeof WebAssembly.instantiateStreaming||Ia()||Ha("file://")||"function"!==typeof fetch)return c(b);fetch(O,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(b,function(g){B("wasm streaming compile failed: "+g);B("falling back to ArrayBuffer instantiation");return c(b)})})})();return{}})();
|
||||||
|
var Ma=d.___wasm_call_ctors=function(){return(Ma=d.___wasm_call_ctors=d.asm.B).apply(null,arguments)},vb=d._malloc=function(){return(vb=d._malloc=d.asm.C).apply(null,arguments)},W=d._free=function(){return(W=d._free=d.asm.D).apply(null,arguments)},lb=d.___getTypeName=function(){return(lb=d.___getTypeName=d.asm.E).apply(null,arguments)};d.___embind_register_native_and_builtin_types=function(){return(d.___embind_register_native_and_builtin_types=d.asm.F).apply(null,arguments)};
|
||||||
|
var X=d._setThrew=function(){return(X=d._setThrew=d.asm.G).apply(null,arguments)},Y=d.stackSave=function(){return(Y=d.stackSave=d.asm.H).apply(null,arguments)},Z=d.stackRestore=function(){return(Z=d.stackRestore=d.asm.I).apply(null,arguments)};d.dynCall_vi=function(){return(d.dynCall_vi=d.asm.J).apply(null,arguments)};
|
||||||
|
var Bb=d.dynCall_viiii=function(){return(Bb=d.dynCall_viiii=d.asm.K).apply(null,arguments)},Cb=d.dynCall_viiiiiii=function(){return(Cb=d.dynCall_viiiiiii=d.asm.L).apply(null,arguments)},Db=d.dynCall_iii=function(){return(Db=d.dynCall_iii=d.asm.M).apply(null,arguments)},Eb=d.dynCall_iiiii=function(){return(Eb=d.dynCall_iiiii=d.asm.N).apply(null,arguments)};d.dynCall_vii=function(){return(d.dynCall_vii=d.asm.O).apply(null,arguments)};
|
||||||
|
d.dynCall_iiijii=function(){return(d.dynCall_iiijii=d.asm.P).apply(null,arguments)};d.dynCall_ii=function(){return(d.dynCall_ii=d.asm.Q).apply(null,arguments)};d.dynCall_viiiiii=function(){return(d.dynCall_viiiiii=d.asm.R).apply(null,arguments)};d.dynCall_viiiiiiiiiii=function(){return(d.dynCall_viiiiiiiiiii=d.asm.S).apply(null,arguments)};d.dynCall_viiiiiiiiiiii=function(){return(d.dynCall_viiiiiiiiiiii=d.asm.T).apply(null,arguments)};
|
||||||
|
d.dynCall_viii=function(){return(d.dynCall_viii=d.asm.U).apply(null,arguments)};d.dynCall_viiiii=function(){return(d.dynCall_viiiii=d.asm.V).apply(null,arguments)};d.dynCall_iiii=function(){return(d.dynCall_iiii=d.asm.W).apply(null,arguments)};d.dynCall_iidiiii=function(){return(d.dynCall_iidiiii=d.asm.X).apply(null,arguments)};d.dynCall_viiiiiiiiii=function(){return(d.dynCall_viiiiiiiiii=d.asm.Y).apply(null,arguments)};d.dynCall_jiji=function(){return(d.dynCall_jiji=d.asm.Z).apply(null,arguments)};
|
||||||
|
function zb(a,b,c,e,f,g,h,l){var k=Y();try{Cb(a,b,c,e,f,g,h,l)}catch(m){Z(k);if(m!==m+0&&"longjmp"!==m)throw m;X(1,0)}}function yb(a,b,c,e,f){var g=Y();try{Bb(a,b,c,e,f)}catch(h){Z(g);if(h!==h+0&&"longjmp"!==h)throw h;X(1,0)}}function wb(a,b,c){var e=Y();try{return Db(a,b,c)}catch(f){Z(e);if(f!==f+0&&"longjmp"!==f)throw f;X(1,0)}}function xb(a,b,c,e,f){var g=Y();try{return Eb(a,b,c,e,f)}catch(h){Z(g);if(h!==h+0&&"longjmp"!==h)throw h;X(1,0)}}var Fb;N=function Gb(){Fb||Hb();Fb||(N=Gb)};
|
||||||
|
function Hb(){function a(){if(!Fb&&(Fb=!0,d.calledRun=!0,!ka)){Aa(Ca);Aa(Da);aa(d);if(d.onRuntimeInitialized)d.onRuntimeInitialized();if(d.postRun)for("function"==typeof d.postRun&&(d.postRun=[d.postRun]);d.postRun.length;){var b=d.postRun.shift();Ea.unshift(b)}Aa(Ea)}}if(!(0<M)){if(d.preRun)for("function"==typeof d.preRun&&(d.preRun=[d.preRun]);d.preRun.length;)Fa();Aa(Ba);0<M||(d.setStatus?(d.setStatus("Running..."),setTimeout(function(){setTimeout(function(){d.setStatus("")},1);a()},1)):a())}}
|
||||||
|
d.run=Hb;if(d.preInit)for("function"==typeof d.preInit&&(d.preInit=[d.preInit]);0<d.preInit.length;)d.preInit.pop()();noExitRuntime=!0;Hb();
|
||||||
|
|
||||||
|
|
||||||
|
return avif_dec.ready
|
||||||
|
}
|
||||||
|
);
|
||||||
|
})();
|
||||||
|
if (typeof exports === 'object' && typeof module === 'object')
|
||||||
|
module.exports = avif_dec;
|
||||||
|
else if (typeof define === 'function' && define['amd'])
|
||||||
|
define([], function() { return avif_dec; });
|
||||||
|
else if (typeof exports === 'object')
|
||||||
|
exports["avif_dec"] = avif_dec;
|
||||||
|
|
||||||
BIN
codecs/avif/dec/avif_dec.wasm
Normal file
BIN
codecs/avif/dec/avif_dec.wasm
Normal file
Binary file not shown.
37
codecs/avif/enc/README.md
Normal file
37
codecs/avif/enc/README.md
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
# AVIF encoder
|
||||||
|
|
||||||
|
- Source: <https://github.com/AOMediaCodec/libavif>
|
||||||
|
- Version: v0.5.4
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
Run example.js
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### `Uint8Array encode(std::string image_in, int image_width, int image_height, AvifOptions opts)`
|
||||||
|
|
||||||
|
Encodes the given image with given dimension to AVIF. Options looks like this:
|
||||||
|
|
||||||
|
```c++
|
||||||
|
struct AvifOptions {
|
||||||
|
// 0 = lossless
|
||||||
|
// 63 = worst quality
|
||||||
|
int minQuantizer;
|
||||||
|
int maxQuantizer;
|
||||||
|
|
||||||
|
// [0 - 6]
|
||||||
|
// Creates 2^n tiles in that dimension
|
||||||
|
int tileRowsLog2;
|
||||||
|
int tileColsLog2;
|
||||||
|
|
||||||
|
// 0 = slowest
|
||||||
|
// 10 = fastest
|
||||||
|
int speed;
|
||||||
|
|
||||||
|
// 0 = 4:2:0
|
||||||
|
// 1 = 4:2:2
|
||||||
|
// 2 = 4:4:4
|
||||||
|
int subsample;
|
||||||
|
};
|
||||||
|
```
|
||||||
107
codecs/avif/enc/avif_enc.cpp
Normal file
107
codecs/avif/enc/avif_enc.cpp
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
#include <emscripten/bind.h>
|
||||||
|
#include <emscripten/val.h>
|
||||||
|
#include <emscripten/threading.h>
|
||||||
|
#include "avif/avif.h"
|
||||||
|
|
||||||
|
using namespace emscripten;
|
||||||
|
|
||||||
|
struct AvifOptions {
|
||||||
|
// [0 - 63]
|
||||||
|
// 0 = lossless
|
||||||
|
// 63 = worst quality
|
||||||
|
int minQuantizer;
|
||||||
|
int maxQuantizer;
|
||||||
|
int minQuantizerAlpha;
|
||||||
|
int maxQuantizerAlpha;
|
||||||
|
// [0 - 6]
|
||||||
|
// Creates 2^n tiles in that dimension
|
||||||
|
int tileRowsLog2;
|
||||||
|
int tileColsLog2;
|
||||||
|
// [0 - 10]
|
||||||
|
// 0 = slowest
|
||||||
|
// 10 = fastest
|
||||||
|
int speed;
|
||||||
|
// 0 = 4:0:0
|
||||||
|
// 1 = 4:2:0
|
||||||
|
// 2 = 4:2:2
|
||||||
|
// 3 = 4:4:4
|
||||||
|
int subsample;
|
||||||
|
};
|
||||||
|
|
||||||
|
thread_local const val Uint8Array = val::global("Uint8Array");
|
||||||
|
|
||||||
|
val encode(std::string buffer, int width, int height, AvifOptions options) {
|
||||||
|
avifRWData output = AVIF_DATA_EMPTY;
|
||||||
|
int depth = 8;
|
||||||
|
avifPixelFormat format;
|
||||||
|
switch (options.subsample) {
|
||||||
|
case 0:
|
||||||
|
format = AVIF_PIXEL_FORMAT_YUV400;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
format = AVIF_PIXEL_FORMAT_YUV420;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
format = AVIF_PIXEL_FORMAT_YUV422;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
format = AVIF_PIXEL_FORMAT_YUV444;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
avifImage* image = avifImageCreate(width, height, depth, format);
|
||||||
|
|
||||||
|
if (
|
||||||
|
options.maxQuantizer == AVIF_QUANTIZER_LOSSLESS &&
|
||||||
|
options.minQuantizer == AVIF_QUANTIZER_LOSSLESS &&
|
||||||
|
options.minQuantizerAlpha == AVIF_QUANTIZER_LOSSLESS &&
|
||||||
|
options.maxQuantizerAlpha == AVIF_QUANTIZER_LOSSLESS &&
|
||||||
|
format == AVIF_PIXEL_FORMAT_YUV444
|
||||||
|
) {
|
||||||
|
image->matrixCoefficients = AVIF_MATRIX_COEFFICIENTS_IDENTITY;
|
||||||
|
} else {
|
||||||
|
image->matrixCoefficients = AVIF_MATRIX_COEFFICIENTS_BT709;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t* rgba = (uint8_t*)buffer.c_str();
|
||||||
|
|
||||||
|
avifRGBImage srcRGB;
|
||||||
|
avifRGBImageSetDefaults(&srcRGB, image);
|
||||||
|
srcRGB.pixels = rgba;
|
||||||
|
srcRGB.rowBytes = width * 4;
|
||||||
|
avifImageRGBToYUV(image, &srcRGB);
|
||||||
|
|
||||||
|
avifEncoder* encoder = avifEncoderCreate();
|
||||||
|
encoder->maxThreads = emscripten_num_logical_cores();
|
||||||
|
encoder->minQuantizer = options.minQuantizer;
|
||||||
|
encoder->maxQuantizer = options.maxQuantizer;
|
||||||
|
encoder->minQuantizerAlpha = options.minQuantizerAlpha;
|
||||||
|
encoder->maxQuantizerAlpha = options.maxQuantizerAlpha;
|
||||||
|
encoder->tileRowsLog2 = options.tileRowsLog2;
|
||||||
|
encoder->tileColsLog2 = options.tileColsLog2;
|
||||||
|
encoder->speed = options.speed;
|
||||||
|
avifResult encodeResult = avifEncoderWrite(encoder, image, &output);
|
||||||
|
auto js_result = val::null();
|
||||||
|
if (encodeResult == AVIF_RESULT_OK) {
|
||||||
|
js_result = Uint8Array.new_(typed_memory_view(output.size, output.data));
|
||||||
|
}
|
||||||
|
|
||||||
|
avifImageDestroy(image);
|
||||||
|
avifEncoderDestroy(encoder);
|
||||||
|
avifRWDataFree(&output);
|
||||||
|
return js_result;
|
||||||
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_BINDINGS(my_module) {
|
||||||
|
value_object<AvifOptions>("AvifOptions")
|
||||||
|
.field("minQuantizer", &AvifOptions::minQuantizer)
|
||||||
|
.field("maxQuantizer", &AvifOptions::maxQuantizer)
|
||||||
|
.field("minQuantizerAlpha", &AvifOptions::minQuantizerAlpha)
|
||||||
|
.field("maxQuantizerAlpha", &AvifOptions::maxQuantizerAlpha)
|
||||||
|
.field("tileRowsLog2", &AvifOptions::tileRowsLog2)
|
||||||
|
.field("tileColsLog2", &AvifOptions::tileColsLog2)
|
||||||
|
.field("speed", &AvifOptions::speed)
|
||||||
|
.field("subsample", &AvifOptions::subsample);
|
||||||
|
|
||||||
|
function("encode", &encode);
|
||||||
|
}
|
||||||
7
codecs/avif/enc/avif_enc.d.ts
vendored
Normal file
7
codecs/avif/enc/avif_enc.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { EncodeOptions } from '../../../src/codecs/avif/encoder-meta';
|
||||||
|
|
||||||
|
interface AVIFModule extends EmscriptenWasm.Module {
|
||||||
|
encode(data: BufferSource, width: number, height: number, options: EncodeOptions): Uint8Array | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function(opts: EmscriptenWasm.ModuleOpts): Promise<AVIFModule>;
|
||||||
113
codecs/avif/enc/avif_enc.js
Normal file
113
codecs/avif/enc/avif_enc.js
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
|
||||||
|
var avif_enc = (function() {
|
||||||
|
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
|
||||||
|
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
|
||||||
|
return (
|
||||||
|
function(avif_enc) {
|
||||||
|
avif_enc = avif_enc || {};
|
||||||
|
|
||||||
|
|
||||||
|
var f;f||(f=typeof avif_enc !== 'undefined' ? avif_enc : {});var aa,ba;f.ready=new Promise(function(a,b){aa=a;ba=b});var ca={},m;for(m in f)f.hasOwnProperty(m)&&(ca[m]=f[m]);var da=!1,r=!1,ea=!1,fa=!1;da="object"===typeof window;r="function"===typeof importScripts;ea="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;fa=!da&&!ea&&!r;var v="",ha,ia,ja,ka;
|
||||||
|
if(ea)v=r?require("path").dirname(v)+"/":__dirname+"/",ha=function(a,b){ja||(ja=require("fs"));ka||(ka=require("path"));a=ka.normalize(a);return ja.readFileSync(a,b?null:"utf8")},ia=function(a){a=ha(a,!0);a.buffer||(a=new Uint8Array(a));assert(a.buffer);return a},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(a){throw a;}),process.on("unhandledRejection",x),f.inspect=function(){return"[Emscripten Module object]"};else if(fa)"undefined"!=
|
||||||
|
typeof read&&(ha=function(a){return read(a)}),ia=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");assert("object"===typeof a);return a},"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!==typeof printErr?printErr:print);else if(da||r)r?v=self.location.href:document.currentScript&&(v=document.currentScript.src),_scriptDir&&(v=_scriptDir),0!==v.indexOf("blob:")?v=v.substr(0,
|
||||||
|
v.lastIndexOf("/")+1):v="",ha=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},r&&(ia=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var la=f.print||console.log.bind(console),z=f.printErr||console.warn.bind(console);for(m in ca)ca.hasOwnProperty(m)&&(f[m]=ca[m]);ca=null;var ma=0,na;f.wasmBinary&&(na=f.wasmBinary);var noExitRuntime;f.noExitRuntime&&(noExitRuntime=f.noExitRuntime);
|
||||||
|
"object"!==typeof WebAssembly&&x("no native wasm support detected");var A,oa=new WebAssembly.Table({initial:862,maximum:862,element:"anyfunc"}),pa=!1;function assert(a,b){a||x("Assertion failed: "+b)}var ra="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
|
||||||
|
function B(a,b,c){var d=b+c;for(c=b;a[c]&&!(c>=d);)++c;if(16<c-b&&a.subarray&&ra)return ra.decode(a.subarray(b,c));for(d="";b<c;){var e=a[b++];if(e&128){var g=a[b++]&63;if(192==(e&224))d+=String.fromCharCode((e&31)<<6|g);else{var h=a[b++]&63;e=224==(e&240)?(e&15)<<12|g<<6|h:(e&7)<<18|g<<12|h<<6|a[b++]&63;65536>e?d+=String.fromCharCode(e):(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023))}}else d+=String.fromCharCode(e)}return d}
|
||||||
|
function sa(a,b,c,d){if(!(0<d))return 0;var e=c;d=c+d-1;for(var g=0;g<a.length;++g){var h=a.charCodeAt(g);if(55296<=h&&57343>=h){var k=a.charCodeAt(++g);h=65536+((h&1023)<<10)|k&1023}if(127>=h){if(c>=d)break;b[c++]=h}else{if(2047>=h){if(c+1>=d)break;b[c++]=192|h>>6}else{if(65535>=h){if(c+2>=d)break;b[c++]=224|h>>12}else{if(c+3>=d)break;b[c++]=240|h>>18;b[c++]=128|h>>12&63}b[c++]=128|h>>6&63}b[c++]=128|h&63}}b[c]=0;return c-e}
|
||||||
|
function ta(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&(d=65536+((d&1023)<<10)|a.charCodeAt(++c)&1023);127>=d?++b:b=2047>=d?b+2:65535>=d?b+3:b+4}return b}var ua="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function va(a,b){var c=a>>1;for(var d=c+b/2;!(c>=d)&&wa[c];)++c;c<<=1;if(32<c-a&&ua)return ua.decode(C.subarray(a,c));c=0;for(d="";;){var e=E[a+2*c>>1];if(0==e||c==b/2)return d;++c;d+=String.fromCharCode(e)}}
|
||||||
|
function xa(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var e=0;e<c;++e)E[b>>1]=a.charCodeAt(e),b+=2;E[b>>1]=0;return b-d}function ya(a){return 2*a.length}function za(a,b){for(var c=0,d="";!(c>=b/4);){var e=F[a+4*c>>2];if(0==e)break;++c;65536<=e?(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023)):d+=String.fromCharCode(e)}return d}
|
||||||
|
function Aa(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var e=0;e<a.length;++e){var g=a.charCodeAt(e);if(55296<=g&&57343>=g){var h=a.charCodeAt(++e);g=65536+((g&1023)<<10)|h&1023}F[b>>2]=g;b+=4;if(b+4>c)break}F[b>>2]=0;return b-d}function Ba(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&++c;b+=4}return b}var G,H,C,E,wa,F,I,Ca,Da;
|
||||||
|
function Ea(a){G=a;f.HEAP8=H=new Int8Array(a);f.HEAP16=E=new Int16Array(a);f.HEAP32=F=new Int32Array(a);f.HEAPU8=C=new Uint8Array(a);f.HEAPU16=wa=new Uint16Array(a);f.HEAPU32=I=new Uint32Array(a);f.HEAPF32=Ca=new Float32Array(a);f.HEAPF64=Da=new Float64Array(a)}var Fa=f.INITIAL_MEMORY||16777216;f.wasmMemory?A=f.wasmMemory:A=new WebAssembly.Memory({initial:Fa/65536,maximum:32768});A&&(G=A.buffer);Fa=G.byteLength;Ea(G);F[219532]=6121168;
|
||||||
|
function Ga(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(f);else{var c=b.ib;"number"===typeof c?void 0===b.Pa?f.dynCall_v(c):f.dynCall_vi(c,b.Pa):c(void 0===b.Pa?null:b.Pa)}}}var Ha=[],Ia=[],Ja=[],Ka=[];function La(){var a=f.preRun.shift();Ha.unshift(a)}var Ma=Math.abs,Na=Math.ceil,Oa=Math.floor,Pa=Math.min,J=0,Qa=null,Ra=null;f.preloadedImages={};f.preloadedAudios={};
|
||||||
|
function x(a){if(f.onAbort)f.onAbort(a);z(a);pa=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");ba(a);throw a;}function Sa(a){var b=K;return String.prototype.startsWith?b.startsWith(a):0===b.indexOf(a)}function Ta(){return Sa("data:application/octet-stream;base64,")}var K="avif_enc.wasm";if(!Ta()){var Ua=K;K=f.locateFile?f.locateFile(Ua,v):v+Ua}
|
||||||
|
function Va(){try{if(na)return new Uint8Array(na);if(ia)return ia(K);throw"both async and sync fetching of the wasm failed";}catch(a){x(a)}}function Wa(){return na||!da&&!r||"function"!==typeof fetch||Sa("file://")?new Promise(function(a){a(Va())}):fetch(K,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+K+"'";return a.arrayBuffer()}).catch(function(){return Va()})}var Xa,Ya;Ia.push({ib:function(){Za()}});
|
||||||
|
function $a(a,b){for(var c=0,d=a.length-1;0<=d;d--){var e=a[d];"."===e?a.splice(d,1):".."===e?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c;c--)a.unshift("..");return a}function ab(a){var b="/"===a.charAt(0),c="/"===a.substr(-1);(a=$a(a.split("/").filter(function(d){return!!d}),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a}
|
||||||
|
function bb(a){var b=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);a=b[0];b=b[1];if(!a&&!b)return".";b&&(b=b.substr(0,b.length-1));return a+b}function cb(a){if("/"===a)return"/";var b=a.lastIndexOf("/");return-1===b?a:a.substr(b+1)}
|
||||||
|
function db(){for(var a="",b=!1,c=arguments.length-1;-1<=c&&!b;c--){b=0<=c?arguments[c]:"/";if("string"!==typeof b)throw new TypeError("Arguments to path.resolve must be strings");if(!b)return"";a=b+"/"+a;b="/"===b.charAt(0)}a=$a(a.split("/").filter(function(d){return!!d}),!b).join("/");return(b?"/":"")+a||"."}var eb=[];function fb(a,b){eb[a]={input:[],output:[],Ma:b};gb(a,hb)}
|
||||||
|
var hb={open:function(a){var b=eb[a.node.rdev];if(!b)throw new L(43);a.tty=b;a.seekable=!1},close:function(a){a.tty.Ma.flush(a.tty)},flush:function(a){a.tty.Ma.flush(a.tty)},read:function(a,b,c,d){if(!a.tty||!a.tty.Ma.$a)throw new L(60);for(var e=0,g=0;g<d;g++){try{var h=a.tty.Ma.$a(a.tty)}catch(k){throw new L(29);}if(void 0===h&&0===e)throw new L(6);if(null===h||void 0===h)break;e++;b[c+g]=h}e&&(a.node.timestamp=Date.now());return e},write:function(a,b,c,d){if(!a.tty||!a.tty.Ma.Ra)throw new L(60);
|
||||||
|
try{for(var e=0;e<d;e++)a.tty.Ma.Ra(a.tty,b[c+e])}catch(g){throw new L(29);}d&&(a.node.timestamp=Date.now());return e}},ib={$a:function(a){if(!a.input.length){var b=null;if(ea){var c=Buffer.eb?Buffer.eb(256):new Buffer(256),d=0;try{d=ja.readSync(process.stdin.fd,c,0,256,null)}catch(e){if(-1!=e.toString().indexOf("EOF"))d=0;else throw e;}0<d?b=c.slice(0,d).toString("utf-8"):b=null}else"undefined"!=typeof window&&"function"==typeof window.prompt?(b=window.prompt("Input: "),null!==b&&(b+="\n")):"function"==
|
||||||
|
typeof readline&&(b=readline(),null!==b&&(b+="\n"));if(!b)return null;c=Array(ta(b)+1);b=sa(b,c,0,c.length);c.length=b;a.input=c}return a.input.shift()},Ra:function(a,b){null===b||10===b?(la(B(a.output,0)),a.output=[]):0!=b&&a.output.push(b)},flush:function(a){a.output&&0<a.output.length&&(la(B(a.output,0)),a.output=[])}},jb={Ra:function(a,b){null===b||10===b?(z(B(a.output,0)),a.output=[]):0!=b&&a.output.push(b)},flush:function(a){a.output&&0<a.output.length&&(z(B(a.output,0)),a.output=[])}},M={Ea:null,
|
||||||
|
Ia:function(){return M.createNode(null,"/",16895,0)},createNode:function(a,b,c,d){if(24576===(c&61440)||4096===(c&61440))throw new L(63);M.Ea||(M.Ea={dir:{node:{Ja:M.Ba.Ja,Ga:M.Ba.Ga,lookup:M.Ba.lookup,Na:M.Ba.Na,rename:M.Ba.rename,unlink:M.Ba.unlink,rmdir:M.Ba.rmdir,readdir:M.Ba.readdir,symlink:M.Ba.symlink},stream:{La:M.Ca.La}},file:{node:{Ja:M.Ba.Ja,Ga:M.Ba.Ga},stream:{La:M.Ca.La,read:M.Ca.read,write:M.Ca.write,Ua:M.Ca.Ua,ab:M.Ca.ab,cb:M.Ca.cb}},link:{node:{Ja:M.Ba.Ja,Ga:M.Ba.Ga,readlink:M.Ba.readlink},
|
||||||
|
stream:{}},Va:{node:{Ja:M.Ba.Ja,Ga:M.Ba.Ga},stream:kb}});c=lb(a,b,c,d);16384===(c.mode&61440)?(c.Ba=M.Ea.dir.node,c.Ca=M.Ea.dir.stream,c.Aa={}):32768===(c.mode&61440)?(c.Ba=M.Ea.file.node,c.Ca=M.Ea.file.stream,c.Da=0,c.Aa=null):40960===(c.mode&61440)?(c.Ba=M.Ea.link.node,c.Ca=M.Ea.link.stream):8192===(c.mode&61440)&&(c.Ba=M.Ea.Va.node,c.Ca=M.Ea.Va.stream);c.timestamp=Date.now();a&&(a.Aa[b]=c);return c},zb:function(a){if(a.Aa&&a.Aa.subarray){for(var b=[],c=0;c<a.Da;++c)b.push(a.Aa[c]);return b}return a.Aa},
|
||||||
|
Ab:function(a){return a.Aa?a.Aa.subarray?a.Aa.subarray(0,a.Da):new Uint8Array(a.Aa):new Uint8Array(0)},Wa:function(a,b){var c=a.Aa?a.Aa.length:0;c>=b||(b=Math.max(b,c*(1048576>c?2:1.125)>>>0),0!=c&&(b=Math.max(b,256)),c=a.Aa,a.Aa=new Uint8Array(b),0<a.Da&&a.Aa.set(c.subarray(0,a.Da),0))},sb:function(a,b){if(a.Da!=b)if(0==b)a.Aa=null,a.Da=0;else{if(!a.Aa||a.Aa.subarray){var c=a.Aa;a.Aa=new Uint8Array(b);c&&a.Aa.set(c.subarray(0,Math.min(b,a.Da)))}else if(a.Aa||(a.Aa=[]),a.Aa.length>b)a.Aa.length=b;
|
||||||
|
else for(;a.Aa.length<b;)a.Aa.push(0);a.Da=b}},Ba:{Ja:function(a){var b={};b.dev=8192===(a.mode&61440)?a.id:1;b.ino=a.id;b.mode=a.mode;b.nlink=1;b.uid=0;b.gid=0;b.rdev=a.rdev;16384===(a.mode&61440)?b.size=4096:32768===(a.mode&61440)?b.size=a.Da:40960===(a.mode&61440)?b.size=a.link.length:b.size=0;b.atime=new Date(a.timestamp);b.mtime=new Date(a.timestamp);b.ctime=new Date(a.timestamp);b.gb=4096;b.blocks=Math.ceil(b.size/b.gb);return b},Ga:function(a,b){void 0!==b.mode&&(a.mode=b.mode);void 0!==b.timestamp&&
|
||||||
|
(a.timestamp=b.timestamp);void 0!==b.size&&M.sb(a,b.size)},lookup:function(){throw mb[44];},Na:function(a,b,c,d){return M.createNode(a,b,c,d)},rename:function(a,b,c){if(16384===(a.mode&61440)){try{var d=nb(b,c)}catch(g){}if(d)for(var e in d.Aa)throw new L(55);}delete a.parent.Aa[a.name];a.name=c;b.Aa[c]=a;a.parent=b},unlink:function(a,b){delete a.Aa[b]},rmdir:function(a,b){var c=nb(a,b),d;for(d in c.Aa)throw new L(55);delete a.Aa[b]},readdir:function(a){var b=[".",".."],c;for(c in a.Aa)a.Aa.hasOwnProperty(c)&&
|
||||||
|
b.push(c);return b},symlink:function(a,b,c){a=M.createNode(a,b,41471,0);a.link=c;return a},readlink:function(a){if(40960!==(a.mode&61440))throw new L(28);return a.link}},Ca:{read:function(a,b,c,d,e){var g=a.node.Aa;if(e>=a.node.Da)return 0;a=Math.min(a.node.Da-e,d);if(8<a&&g.subarray)b.set(g.subarray(e,e+a),c);else for(d=0;d<a;d++)b[c+d]=g[e+d];return a},write:function(a,b,c,d,e,g){b.buffer===H.buffer&&(g=!1);if(!d)return 0;a=a.node;a.timestamp=Date.now();if(b.subarray&&(!a.Aa||a.Aa.subarray)){if(g)return a.Aa=
|
||||||
|
b.subarray(c,c+d),a.Da=d;if(0===a.Da&&0===e)return a.Aa=b.slice(c,c+d),a.Da=d;if(e+d<=a.Da)return a.Aa.set(b.subarray(c,c+d),e),d}M.Wa(a,e+d);if(a.Aa.subarray&&b.subarray)a.Aa.set(b.subarray(c,c+d),e);else for(g=0;g<d;g++)a.Aa[e+g]=b[c+g];a.Da=Math.max(a.Da,e+d);return d},La:function(a,b,c){1===c?b+=a.position:2===c&&32768===(a.node.mode&61440)&&(b+=a.node.Da);if(0>b)throw new L(28);return b},Ua:function(a,b,c){M.Wa(a.node,b+c);a.node.Da=Math.max(a.node.Da,b+c)},ab:function(a,b,c,d,e,g){assert(0===
|
||||||
|
b);if(32768!==(a.node.mode&61440))throw new L(43);a=a.node.Aa;if(g&2||a.buffer!==G){if(0<d||d+c<a.length)a.subarray?a=a.subarray(d,d+c):a=Array.prototype.slice.call(a,d,d+c);d=!0;g=16384*Math.ceil(c/16384);for(b=ob(g);c<g;)H[b+c++]=0;c=b;if(!c)throw new L(48);H.set(a,c)}else d=!1,c=a.byteOffset;return{Eb:c,yb:d}},cb:function(a,b,c,d,e){if(32768!==(a.node.mode&61440))throw new L(43);if(e&2)return 0;M.Ca.write(a,b,0,d,c,!1);return 0}}},pb=null,qb={},rb=[],sb=1,tb=null,ub=!0,vb={},L=null,mb={};
|
||||||
|
function N(a,b){a=db("/",a);b=b||{};if(!a)return{path:"",node:null};var c={Za:!0,Sa:0},d;for(d in c)void 0===b[d]&&(b[d]=c[d]);if(8<b.Sa)throw new L(32);a=$a(a.split("/").filter(function(h){return!!h}),!1);var e=pb;c="/";for(d=0;d<a.length;d++){var g=d===a.length-1;if(g&&b.parent)break;e=nb(e,a[d]);c=ab(c+"/"+a[d]);e.Oa&&(!g||g&&b.Za)&&(e=e.Oa.root);if(!g||b.Ya)for(g=0;40960===(e.mode&61440);)if(e=wb(c),c=db(bb(c),e),e=N(c,{Sa:b.Sa}).node,40<g++)throw new L(32);}return{path:c,node:e}}
|
||||||
|
function xb(a){for(var b;;){if(a===a.parent)return a=a.Ia.bb,b?"/"!==a[a.length-1]?a+"/"+b:a+b:a;b=b?a.name+"/"+b:a.name;a=a.parent}}function yb(a,b){for(var c=0,d=0;d<b.length;d++)c=(c<<5)-c+b.charCodeAt(d)|0;return(a+c>>>0)%tb.length}function nb(a,b){var c;if(c=(c=zb(a,"x"))?c:a.Ba.lookup?0:2)throw new L(c,a);for(c=tb[yb(a.id,b)];c;c=c.pb){var d=c.name;if(c.parent.id===a.id&&d===b)return c}return a.Ba.lookup(a,b)}
|
||||||
|
function lb(a,b,c,d){a=new Ab(a,b,c,d);b=yb(a.parent.id,a.name);a.pb=tb[b];return tb[b]=a}var Bb={r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218};function Cb(a){var b=["r","w","rw"][a&3];a&512&&(b+="w");return b}function zb(a,b){if(ub)return 0;if(-1===b.indexOf("r")||a.mode&292){if(-1!==b.indexOf("w")&&!(a.mode&146)||-1!==b.indexOf("x")&&!(a.mode&73))return 2}else return 2;return 0}
|
||||||
|
function Db(a,b){try{return nb(a,b),20}catch(c){}return zb(a,"wx")}function Eb(a){var b=4096;for(a=a||0;a<=b;a++)if(!rb[a])return a;throw new L(33);}function Fb(a,b){Gb||(Gb=function(){},Gb.prototype={});var c=new Gb,d;for(d in a)c[d]=a[d];a=c;b=Eb(b);a.fd=b;return rb[b]=a}var kb={open:function(a){a.Ca=qb[a.node.rdev].Ca;a.Ca.open&&a.Ca.open(a)},La:function(){throw new L(70);}};function gb(a,b){qb[a]={Ca:b}}
|
||||||
|
function Hb(a,b){var c="/"===b,d=!b;if(c&&pb)throw new L(10);if(!c&&!d){var e=N(b,{Za:!1});b=e.path;e=e.node;if(e.Oa)throw new L(10);if(16384!==(e.mode&61440))throw new L(54);}b={type:a,Db:{},bb:b,ob:[]};a=a.Ia(b);a.Ia=b;b.root=a;c?pb=a:e&&(e.Oa=b,e.Ia&&e.Ia.ob.push(b))}function Ib(a,b,c){var d=N(a,{parent:!0}).node;a=cb(a);if(!a||"."===a||".."===a)throw new L(28);var e=Db(d,a);if(e)throw new L(e);if(!d.Ba.Na)throw new L(63);return d.Ba.Na(d,a,b,c)}function O(a){Ib(a,16895,0)}
|
||||||
|
function Jb(a,b,c){"undefined"===typeof c&&(c=b,b=438);Ib(a,b|8192,c)}function Kb(a,b){if(!db(a))throw new L(44);var c=N(b,{parent:!0}).node;if(!c)throw new L(44);b=cb(b);var d=Db(c,b);if(d)throw new L(d);if(!c.Ba.symlink)throw new L(63);c.Ba.symlink(c,b,a)}function wb(a){a=N(a).node;if(!a)throw new L(44);if(!a.Ba.readlink)throw new L(28);return db(xb(a.parent),a.Ba.readlink(a))}
|
||||||
|
function Lb(a,b,c,d){if(""===a)throw new L(44);if("string"===typeof b){var e=Bb[b];if("undefined"===typeof e)throw Error("Unknown file open mode: "+b);b=e}c=b&64?("undefined"===typeof c?438:c)&4095|32768:0;if("object"===typeof a)var g=a;else{a=ab(a);try{g=N(a,{Ya:!(b&131072)}).node}catch(k){}}e=!1;if(b&64)if(g){if(b&128)throw new L(20);}else g=Ib(a,c,0),e=!0;if(!g)throw new L(44);8192===(g.mode&61440)&&(b&=-513);if(b&65536&&16384!==(g.mode&61440))throw new L(54);if(!e&&(c=g?40960===(g.mode&61440)?
|
||||||
|
32:16384===(g.mode&61440)&&("r"!==Cb(b)||b&512)?31:zb(g,Cb(b)):44))throw new L(c);if(b&512){c=g;var h;"string"===typeof c?h=N(c,{Ya:!0}).node:h=c;if(!h.Ba.Ga)throw new L(63);if(16384===(h.mode&61440))throw new L(31);if(32768!==(h.mode&61440))throw new L(28);if(c=zb(h,"w"))throw new L(c);h.Ba.Ga(h,{size:0,timestamp:Date.now()})}b&=-131713;d=Fb({node:g,path:xb(g),flags:b,seekable:!0,position:0,Ca:g.Ca,xb:[],error:!1},d);d.Ca.open&&d.Ca.open(d);!f.logReadFiles||b&1||(Mb||(Mb={}),a in Mb||(Mb[a]=1,z("FS.trackingDelegate error on read file: "+
|
||||||
|
a)));try{vb.onOpenFile&&(g=0,1!==(b&2097155)&&(g|=1),0!==(b&2097155)&&(g|=2),vb.onOpenFile(a,g))}catch(k){z("FS.trackingDelegate['onOpenFile']('"+a+"', flags) threw an exception: "+k.message)}return d}function Nb(a,b,c){if(null===a.fd)throw new L(8);if(!a.seekable||!a.Ca.La)throw new L(70);if(0!=c&&1!=c&&2!=c)throw new L(28);a.position=a.Ca.La(a,b,c);a.xb=[]}
|
||||||
|
function Ob(){L||(L=function(a,b){this.node=b;this.tb=function(c){this.Ka=c};this.tb(a);this.message="FS error"},L.prototype=Error(),L.prototype.constructor=L,[44].forEach(function(a){mb[a]=new L(a);mb[a].stack="<generic error, no stack>"}))}var Pb;function Qb(a,b){var c=0;a&&(c|=365);b&&(c|=146);return c}
|
||||||
|
function Rb(a,b,c){a=ab("/dev/"+a);var d=Qb(!!b,!!c);Sb||(Sb=64);var e=Sb++<<8|0;gb(e,{open:function(g){g.seekable=!1},close:function(){c&&c.buffer&&c.buffer.length&&c(10)},read:function(g,h,k,l){for(var n=0,p=0;p<l;p++){try{var t=b()}catch(u){throw new L(29);}if(void 0===t&&0===n)throw new L(6);if(null===t||void 0===t)break;n++;h[k+p]=t}n&&(g.node.timestamp=Date.now());return n},write:function(g,h,k,l){for(var n=0;n<l;n++)try{c(h[k+n])}catch(p){throw new L(29);}l&&(g.node.timestamp=Date.now());return n}});
|
||||||
|
Jb(a,d,e)}var Sb,Q={},Gb,Mb,Tb=void 0;function Ub(){Tb+=4;return F[Tb-4>>2]}function Vb(a){a=rb[a];if(!a)throw new L(8);return a}var Wb={};function Xb(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Yb(a){return this.fromWireType(I[a>>2])}var Zb={},R={},$b={};function ac(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}
|
||||||
|
function bc(a,b){a=ac(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function cc(a){var b=Error,c=bc(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}
|
||||||
|
var dc=void 0;function ec(a,b,c){function d(k){k=c(k);if(k.length!==a.length)throw new dc("Mismatched type converter count");for(var l=0;l<a.length;++l)S(a[l],k[l])}a.forEach(function(k){$b[k]=b});var e=Array(b.length),g=[],h=0;b.forEach(function(k,l){R.hasOwnProperty(k)?e[l]=R[k]:(g.push(k),Zb.hasOwnProperty(k)||(Zb[k]=[]),Zb[k].push(function(){e[l]=R[k];++h;h===g.length&&d(e)}))});0===g.length&&d(e)}
|
||||||
|
function fc(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var hc=void 0;function T(a){for(var b="";C[a];)b+=hc[C[a++]];return b}var ic=void 0;function U(a){throw new ic(a);}
|
||||||
|
function S(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||U('type "'+d+'" must have a positive integer typeid pointer');if(R.hasOwnProperty(a)){if(c.mb)return;U("Cannot register type '"+d+"' twice")}R[a]=b;delete $b[a];Zb.hasOwnProperty(a)&&(b=Zb[a],delete Zb[a],b.forEach(function(e){e()}))}var jc=[],V=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||||
|
function kc(a){4<a&&0===--V[a].Ta&&(V[a]=void 0,jc.push(a))}function lc(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=jc.length?jc.pop():V.length;V[b]={Ta:1,value:a};return b}}function mc(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
||||||
|
function nc(a,b){switch(b){case 2:return function(c){return this.fromWireType(Ca[c>>2])};case 3:return function(c){return this.fromWireType(Da[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function oc(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=bc(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
||||||
|
function pc(a,b){var c=f;if(void 0===c[a].Fa){var d=c[a];c[a]=function(){c[a].Fa.hasOwnProperty(arguments.length)||U("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].Fa+")!");return c[a].Fa[arguments.length].apply(this,arguments)};c[a].Fa=[];c[a].Fa[d.fb]=d}}
|
||||||
|
function qc(a,b,c){f.hasOwnProperty(a)?((void 0===c||void 0!==f[a].Fa&&void 0!==f[a].Fa[c])&&U("Cannot register public name '"+a+"' twice"),pc(a,a),f.hasOwnProperty(c)&&U("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),f[a].Fa[c]=b):(f[a]=b,void 0!==c&&(f[a].Cb=c))}function rc(a,b){for(var c=[],d=0;d<a;d++)c.push(F[(b>>2)+d]);return c}
|
||||||
|
function sc(a,b){a=T(a);var c=f["dynCall_"+a];for(var d=[],e=1;e<a.length;++e)d.push("a"+e);e="return function dynCall_"+(a+"_"+b)+"("+d.join(", ")+") {\n";e+=" return dynCall(rawFunction"+(d.length?", ":"")+d.join(", ")+");\n";c=(new Function("dynCall","rawFunction",e+"};\n"))(c,b);"function"!==typeof c&&U("unknown function pointer with signature "+a+": "+b);return c}var tc=void 0;function uc(a){a=vc(a);var b=T(a);W(a);return b}
|
||||||
|
function wc(a,b){function c(g){e[g]||R[g]||($b[g]?$b[g].forEach(c):(d.push(g),e[g]=!0))}var d=[],e={};b.forEach(c);throw new tc(a+": "+d.map(uc).join([", "]));}function xc(a,b,c){switch(b){case 0:return c?function(d){return H[d]}:function(d){return C[d]};case 1:return c?function(d){return E[d>>1]}:function(d){return wa[d>>1]};case 2:return c?function(d){return F[d>>2]}:function(d){return I[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var yc={};
|
||||||
|
function zc(){return"object"===typeof globalThis?globalThis:Function("return this")()}function Ac(a,b){var c=R[a];void 0===c&&U(b+" has unknown type "+uc(a));return c}var Bc={};function Ab(a,b,c,d){a||(a=this);this.parent=a;this.Ia=a.Ia;this.Oa=null;this.id=sb++;this.name=b;this.mode=c;this.Ba={};this.Ca={};this.rdev=d}
|
||||||
|
Object.defineProperties(Ab.prototype,{read:{get:function(){return 365===(this.mode&365)},set:function(a){a?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146===(this.mode&146)},set:function(a){a?this.mode|=146:this.mode&=-147}}});Ob();tb=Array(4096);Hb(M,"/");O("/tmp");O("/home");O("/home/web_user");
|
||||||
|
(function(){O("/dev");gb(259,{read:function(){return 0},write:function(d,e,g,h){return h}});Jb("/dev/null",259);fb(1280,ib);fb(1536,jb);Jb("/dev/tty",1280);Jb("/dev/tty1",1536);if("object"===typeof crypto&&"function"===typeof crypto.getRandomValues){var a=new Uint8Array(1);var b=function(){crypto.getRandomValues(a);return a[0]}}else if(ea)try{var c=require("crypto");b=function(){return c.randomBytes(1)[0]}}catch(d){}b||(b=function(){x("random_device")});Rb("random",b);Rb("urandom",b);O("/dev/shm");
|
||||||
|
O("/dev/shm/tmp")})();O("/proc");O("/proc/self");O("/proc/self/fd");Hb({Ia:function(){var a=lb("/proc/self","fd",16895,73);a.Ba={lookup:function(b,c){var d=rb[+c];if(!d)throw new L(8);b={parent:null,Ia:{bb:"fake"},Ba:{readlink:function(){return d.path}}};return b.parent=b}};return a}},"/proc/self/fd");dc=f.InternalError=cc("InternalError");for(var Cc=Array(256),Dc=0;256>Dc;++Dc)Cc[Dc]=String.fromCharCode(Dc);hc=Cc;ic=f.BindingError=cc("BindingError");
|
||||||
|
f.count_emval_handles=function(){for(var a=0,b=5;b<V.length;++b)void 0!==V[b]&&++a;return a};f.get_first_emval=function(){for(var a=5;a<V.length;++a)if(void 0!==V[a])return V[a];return null};tc=f.UnboundTypeError=cc("UnboundTypeError");
|
||||||
|
var Nc={O:function(){},u:function(a,b,c){Tb=c;try{var d=Vb(a);switch(b){case 0:var e=Ub();return 0>e?-28:Lb(d.path,d.flags,0,e).fd;case 1:case 2:return 0;case 3:return d.flags;case 4:return e=Ub(),d.flags|=e,0;case 12:return e=Ub(),E[e+0>>1]=2,0;case 13:case 14:return 0;case 16:case 8:return-28;case 9:return F[Ec()>>2]=28,-1;default:return-28}}catch(g){return"undefined"!==typeof Q&&g instanceof L||x(g),-g.Ka}},H:function(a,b,c){Tb=c;try{var d=Vb(a);switch(b){case 21509:case 21505:return d.tty?0:-59;
|
||||||
|
case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:return d.tty?0:-59;case 21519:if(!d.tty)return-59;var e=Ub();return F[e>>2]=0;case 21520:return d.tty?-28:-59;case 21531:a=e=Ub();if(!d.Ca.nb)throw new L(59);return d.Ca.nb(d,b,a);case 21523:return d.tty?0:-59;case 21524:return d.tty?0:-59;default:x("bad ioctl syscall "+b)}}catch(g){return"undefined"!==typeof Q&&g instanceof L||x(g),-g.Ka}},I:function(a,b,c){Tb=c;try{var d=a?B(C,a,void 0):"",e=Ub();return Lb(d,b,e).fd}catch(g){return"undefined"!==
|
||||||
|
typeof Q&&g instanceof L||x(g),-g.Ka}},A:function(a){var b=Wb[a];delete Wb[a];var c=b.qb,d=b.rb,e=b.Xa,g=e.map(function(h){return h.lb}).concat(e.map(function(h){return h.vb}));ec([a],g,function(h){var k={};e.forEach(function(l,n){var p=h[n],t=l.jb,u=l.kb,w=h[n+e.length],q=l.ub,D=l.wb;k[l.hb]={read:function(y){return p.fromWireType(t(u,y))},write:function(y,P){var qa=[];q(D,y,w.toWireType(qa,P));Xb(qa)}}});return[{name:b.name,fromWireType:function(l){var n={},p;for(p in k)n[p]=k[p].read(l);d(l);return n},
|
||||||
|
toWireType:function(l,n){for(var p in k)if(!(p in n))throw new TypeError('Missing field: "'+p+'"');var t=c();for(p in k)k[p].write(t,n[p]);null!==l&&l.push(d,t);return t},argPackAdvance:8,readValueFromPointer:Yb,Ha:d}]})},K:function(a,b,c,d,e){var g=fc(c);b=T(b);S(a,{name:b,fromWireType:function(h){return!!h},toWireType:function(h,k){return k?d:e},argPackAdvance:8,readValueFromPointer:function(h){if(1===c)var k=H;else if(2===c)k=E;else if(4===c)k=F;else throw new TypeError("Unknown boolean type size: "+
|
||||||
|
b);return this.fromWireType(k[h>>g])},Ha:null})},J:function(a,b){b=T(b);S(a,{name:b,fromWireType:function(c){var d=V[c].value;kc(c);return d},toWireType:function(c,d){return lc(d)},argPackAdvance:8,readValueFromPointer:Yb,Ha:null})},w:function(a,b,c){c=fc(c);b=T(b);S(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,e){if("number"!==typeof e&&"boolean"!==typeof e)throw new TypeError('Cannot convert "'+mc(e)+'" to '+this.name);return e},argPackAdvance:8,readValueFromPointer:nc(b,c),
|
||||||
|
Ha:null})},z:function(a,b,c,d,e,g){var h=rc(b,c);a=T(a);e=sc(d,e);qc(a,function(){wc("Cannot call "+a+" due to unbound types",h)},b-1);ec([],h,function(k){var l=[k[0],null].concat(k.slice(1)),n=k=a,p=e,t=l.length;2>t&&U("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var u=null!==l[1]&&!1,w=!1,q=1;q<l.length;++q)if(null!==l[q]&&void 0===l[q].Ha){w=!0;break}var D="void"!==l[0].name,y="",P="";for(q=0;q<t-2;++q)y+=(0!==q?", ":"")+"arg"+q,P+=(0!==q?", ":"")+"arg"+
|
||||||
|
q+"Wired";n="return function "+ac(n)+"("+y+") {\nif (arguments.length !== "+(t-2)+") {\nthrowBindingError('function "+n+" called with ' + arguments.length + ' arguments, expected "+(t-2)+" args!');\n}\n";w&&(n+="var destructors = [];\n");var qa=w?"destructors":"null";y="throwBindingError invoker fn runDestructors retType classParam".split(" ");p=[U,p,g,Xb,l[0],l[1]];u&&(n+="var thisWired = classParam.toWireType("+qa+", this);\n");for(q=0;q<t-2;++q)n+="var arg"+q+"Wired = argType"+q+".toWireType("+
|
||||||
|
qa+", arg"+q+"); // "+l[q+2].name+"\n",y.push("argType"+q),p.push(l[q+2]);u&&(P="thisWired"+(0<P.length?", ":"")+P);n+=(D?"var rv = ":"")+"invoker(fn"+(0<P.length?", ":"")+P+");\n";if(w)n+="runDestructors(destructors);\n";else for(q=u?1:2;q<l.length;++q)t=1===q?"thisWired":"arg"+(q-2)+"Wired",null!==l[q].Ha&&(n+=t+"_dtor("+t+"); // "+l[q].name+"\n",y.push(t+"_dtor"),p.push(l[q].Ha));D&&(n+="var ret = retType.fromWireType(rv);\nreturn ret;\n");y.push(n+"}\n");l=oc(y).apply(null,p);q=b-1;if(!f.hasOwnProperty(k))throw new dc("Replacing nonexistant public symbol");
|
||||||
|
void 0!==f[k].Fa&&void 0!==q?f[k].Fa[q]=l:(f[k]=l,f[k].fb=q);return[]})},i:function(a,b,c,d,e){function g(n){return n}b=T(b);-1===e&&(e=4294967295);var h=fc(c);if(0===d){var k=32-8*c;g=function(n){return n<<k>>>k}}var l=-1!=b.indexOf("unsigned");S(a,{name:b,fromWireType:g,toWireType:function(n,p){if("number"!==typeof p&&"boolean"!==typeof p)throw new TypeError('Cannot convert "'+mc(p)+'" to '+this.name);if(p<d||p>e)throw new TypeError('Passing a number "'+mc(p)+'" from JS side to C/C++ side to an argument of type "'+
|
||||||
|
b+'", which is outside the valid range ['+d+", "+e+"]!");return l?p>>>0:p|0},argPackAdvance:8,readValueFromPointer:xc(b,h,0!==d),Ha:null})},e:function(a,b,c){function d(g){g>>=2;var h=I;return new e(G,h[g+1],h[g])}var e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=T(c);S(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{mb:!0})},x:function(a,b){b=T(b);var c="std::string"===b;S(a,{name:b,fromWireType:function(d){var e=I[d>>2];
|
||||||
|
if(c)for(var g=d+4,h=0;h<=e;++h){var k=d+4+h;if(h==e||0==C[k]){g=g?B(C,g,k-g):"";if(void 0===l)var l=g;else l+=String.fromCharCode(0),l+=g;g=k+1}}else{l=Array(e);for(h=0;h<e;++h)l[h]=String.fromCharCode(C[d+4+h]);l=l.join("")}W(d);return l},toWireType:function(d,e){e instanceof ArrayBuffer&&(e=new Uint8Array(e));var g="string"===typeof e;g||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int8Array||U("Cannot pass non-string to std::string");var h=(c&&g?function(){return ta(e)}:
|
||||||
|
function(){return e.length})(),k=ob(4+h+1);I[k>>2]=h;if(c&&g)sa(e,C,k+4,h+1);else if(g)for(g=0;g<h;++g){var l=e.charCodeAt(g);255<l&&(W(k),U("String has UTF-16 code units that do not fit in 8 bits"));C[k+4+g]=l}else for(g=0;g<h;++g)C[k+4+g]=e[g];null!==d&&d.push(W,k);return k},argPackAdvance:8,readValueFromPointer:Yb,Ha:function(d){W(d)}})},q:function(a,b,c){c=T(c);if(2===b){var d=va;var e=xa;var g=ya;var h=function(){return wa};var k=1}else 4===b&&(d=za,e=Aa,g=Ba,h=function(){return I},k=2);S(a,
|
||||||
|
{name:c,fromWireType:function(l){for(var n=I[l>>2],p=h(),t,u=l+4,w=0;w<=n;++w){var q=l+4+w*b;if(w==n||0==p[q>>k])u=d(u,q-u),void 0===t?t=u:(t+=String.fromCharCode(0),t+=u),u=q+b}W(l);return t},toWireType:function(l,n){"string"!==typeof n&&U("Cannot pass non-string to C++ string type "+c);var p=g(n),t=ob(4+p+b);I[t>>2]=p>>k;e(n,t+4,p+b);null!==l&&l.push(W,t);return t},argPackAdvance:8,readValueFromPointer:Yb,Ha:function(l){W(l)}})},C:function(a,b,c,d,e,g){Wb[a]={name:T(b),qb:sc(c,d),rb:sc(e,g),Xa:[]}},
|
||||||
|
j:function(a,b,c,d,e,g,h,k,l,n){Wb[a].Xa.push({hb:T(b),lb:c,jb:sc(d,e),kb:g,vb:h,ub:sc(k,l),wb:n})},L:function(a,b){b=T(b);S(a,{Bb:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},n:kc,N:function(a){if(0===a)return lc(zc());var b=yc[a];a=void 0===b?T(a):b;return lc(zc()[a])},y:function(a){4<a&&(V[a].Ta+=1)},E:function(a,b,c,d){a||U("Cannot use deleted val. handle = "+a);a=V[a].value;var e=Bc[b];if(!e){e="";for(var g=0;g<b;++g)e+=(0!==g?", ":"")+"arg"+g;var h="return function emval_allocator_"+
|
||||||
|
b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)h+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";e=(new Function("requireRegisteredType","Module","__emval_register",h+("var obj = new constructor("+e+");\nreturn __emval_register(obj);\n}\n")))(Ac,f,lc);Bc[b]=e}return e(a,c,d)},g:function(){x()},d:function(a,b){X(a,b||1);throw"longjmp";
|
||||||
|
},F:function(a,b,c){C.copyWithin(a,b,b+c)},l:function(a){a>>>=0;var b=C.length;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(16777216,a,d);0<d%65536&&(d+=65536-d%65536);a:{try{A.grow(Math.min(2147483648,d)-G.byteLength+65535>>>16);Ea(A.buffer);var e=1;break a}catch(g){}e=void 0}if(e)return!0}return!1},v:function(a){try{var b=Vb(a);if(null===b.fd)throw new L(8);b.Qa&&(b.Qa=null);try{b.Ca.close&&b.Ca.close(b)}catch(c){throw c;}finally{rb[b.fd]=
|
||||||
|
null}b.fd=null;return 0}catch(c){return"undefined"!==typeof Q&&c instanceof L||x(c),c.Ka}},G:function(a,b,c,d){try{a:{for(var e=Vb(a),g=a=0;g<c;g++){var h=F[b+(8*g+4)>>2],k=e,l=F[b+8*g>>2],n=h,p=void 0,t=H;if(0>n||0>p)throw new L(28);if(null===k.fd)throw new L(8);if(1===(k.flags&2097155))throw new L(8);if(16384===(k.node.mode&61440))throw new L(31);if(!k.Ca.read)throw new L(28);var u="undefined"!==typeof p;if(!u)p=k.position;else if(!k.seekable)throw new L(70);var w=k.Ca.read(k,t,l,n,p);u||(k.position+=
|
||||||
|
w);var q=w;if(0>q){var D=-1;break a}a+=q;if(q<h)break}D=a}F[d>>2]=D;return 0}catch(y){return"undefined"!==typeof Q&&y instanceof L||x(y),y.Ka}},B:function(a,b,c,d,e){try{var g=Vb(a);a=4294967296*c+(b>>>0);if(-9007199254740992>=a||9007199254740992<=a)return-61;Nb(g,a,d);Ya=[g.position>>>0,(Xa=g.position,1<=+Ma(Xa)?0<Xa?(Pa(+Oa(Xa/4294967296),4294967295)|0)>>>0:~~+Na((Xa-+(~~Xa>>>0))/4294967296)>>>0:0)];F[e>>2]=Ya[0];F[e+4>>2]=Ya[1];g.Qa&&0===a&&0===d&&(g.Qa=null);return 0}catch(h){return"undefined"!==
|
||||||
|
typeof Q&&h instanceof L||x(h),h.Ka}},t:function(a,b,c,d){try{a:{for(var e=Vb(a),g=a=0;g<c;g++){var h=e,k=F[b+8*g>>2],l=F[b+(8*g+4)>>2],n=void 0,p=H;if(0>l||0>n)throw new L(28);if(null===h.fd)throw new L(8);if(0===(h.flags&2097155))throw new L(8);if(16384===(h.node.mode&61440))throw new L(31);if(!h.Ca.write)throw new L(28);h.seekable&&h.flags&1024&&Nb(h,0,2);var t="undefined"!==typeof n;if(!t)n=h.position;else if(!h.seekable)throw new L(70);var u=h.Ca.write(h,p,k,l,n,void 0);t||(h.position+=u);try{if(h.path&&
|
||||||
|
vb.onWriteToFile)vb.onWriteToFile(h.path)}catch(D){z("FS.trackingDelegate['onWriteToFile']('"+h.path+"') threw an exception: "+D.message)}var w=u;if(0>w){var q=-1;break a}a+=w}q=a}F[d>>2]=q;return 0}catch(D){return"undefined"!==typeof Q&&D instanceof L||x(D),D.Ka}},b:function(){return ma|0},s:Fc,D:Gc,r:Hc,m:Ic,p:Jc,f:Kc,c:Lc,o:Mc,memory:A,k:function(a){a=+a;return 0<=a?+Oa(a+.5):+Na(a-.5)},h:function(a){a=+a;return 0<=a?+Oa(a+.5):+Na(a-.5)},a:function(a){ma=a|0},table:oa,M:function(a){var b=Date.now()/
|
||||||
|
1E3|0;a&&(F[a>>2]=b);return b}};
|
||||||
|
(function(){function a(e){f.asm=e.exports;J--;f.monitorRunDependencies&&f.monitorRunDependencies(J);0==J&&(null!==Qa&&(clearInterval(Qa),Qa=null),Ra&&(e=Ra,Ra=null,e()))}function b(e){a(e.instance)}function c(e){return Wa().then(function(g){return WebAssembly.instantiate(g,d)}).then(e,function(g){z("failed to asynchronously prepare wasm: "+g);x(g)})}var d={a:Nc};J++;f.monitorRunDependencies&&f.monitorRunDependencies(J);if(f.instantiateWasm)try{return f.instantiateWasm(d,a)}catch(e){return z("Module.instantiateWasm callback failed with error: "+
|
||||||
|
e),!1}(function(){if(na||"function"!==typeof WebAssembly.instantiateStreaming||Ta()||Sa("file://")||"function"!==typeof fetch)return c(b);fetch(K,{credentials:"same-origin"}).then(function(e){return WebAssembly.instantiateStreaming(e,d).then(b,function(g){z("wasm streaming compile failed: "+g);z("falling back to ArrayBuffer instantiation");return c(b)})})})();return{}})();
|
||||||
|
var Za=f.___wasm_call_ctors=function(){return(Za=f.___wasm_call_ctors=f.asm.P).apply(null,arguments)},ob=f._malloc=function(){return(ob=f._malloc=f.asm.Q).apply(null,arguments)},W=f._free=function(){return(W=f._free=f.asm.R).apply(null,arguments)},vc=f.___getTypeName=function(){return(vc=f.___getTypeName=f.asm.S).apply(null,arguments)};f.___embind_register_native_and_builtin_types=function(){return(f.___embind_register_native_and_builtin_types=f.asm.T).apply(null,arguments)};
|
||||||
|
var Ec=f.___errno_location=function(){return(Ec=f.___errno_location=f.asm.U).apply(null,arguments)},X=f._setThrew=function(){return(X=f._setThrew=f.asm.V).apply(null,arguments)},Y=f.stackSave=function(){return(Y=f.stackSave=f.asm.W).apply(null,arguments)},Z=f.stackRestore=function(){return(Z=f.stackRestore=f.asm.X).apply(null,arguments)},Oc=f.dynCall_vi=function(){return(Oc=f.dynCall_vi=f.asm.Y).apply(null,arguments)},Pc=f.dynCall_vii=function(){return(Pc=f.dynCall_vii=f.asm.Z).apply(null,arguments)};
|
||||||
|
f.dynCall_viii=function(){return(f.dynCall_viii=f.asm._).apply(null,arguments)};
|
||||||
|
var Qc=f.dynCall_viiii=function(){return(Qc=f.dynCall_viiii=f.asm.$).apply(null,arguments)},Rc=f.dynCall_viiiiiiiiii=function(){return(Rc=f.dynCall_viiiiiiiiii=f.asm.aa).apply(null,arguments)},Sc=f.dynCall_iii=function(){return(Sc=f.dynCall_iii=f.asm.ba).apply(null,arguments)},Tc=f.dynCall_iiii=function(){return(Tc=f.dynCall_iiii=f.asm.ca).apply(null,arguments)},Uc=f.dynCall_iiiii=function(){return(Uc=f.dynCall_iiiii=f.asm.da).apply(null,arguments)},Vc=f.dynCall_iiiiiiiii=function(){return(Vc=f.dynCall_iiiiiiiii=
|
||||||
|
f.asm.ea).apply(null,arguments)};f.dynCall_i=function(){return(f.dynCall_i=f.asm.fa).apply(null,arguments)};f.dynCall_iiiiii=function(){return(f.dynCall_iiiiii=f.asm.ga).apply(null,arguments)};f.dynCall_viiiii=function(){return(f.dynCall_viiiii=f.asm.ha).apply(null,arguments)};f.dynCall_iiiiiii=function(){return(f.dynCall_iiiiiii=f.asm.ia).apply(null,arguments)};f.dynCall_viiiiii=function(){return(f.dynCall_viiiiii=f.asm.ja).apply(null,arguments)};
|
||||||
|
f.dynCall_viiiiiii=function(){return(f.dynCall_viiiiiii=f.asm.ka).apply(null,arguments)};f.dynCall_viiiiiiiiiii=function(){return(f.dynCall_viiiiiiiiiii=f.asm.la).apply(null,arguments)};f.dynCall_iiiiiiii=function(){return(f.dynCall_iiiiiiii=f.asm.ma).apply(null,arguments)};f.dynCall_iiiiiiiiii=function(){return(f.dynCall_iiiiiiiiii=f.asm.na).apply(null,arguments)};f.dynCall_iiiiiiiiiiii=function(){return(f.dynCall_iiiiiiiiiiii=f.asm.oa).apply(null,arguments)};
|
||||||
|
f.dynCall_viiiiiiii=function(){return(f.dynCall_viiiiiiii=f.asm.pa).apply(null,arguments)};f.dynCall_jiiiiiiiii=function(){return(f.dynCall_jiiiiiiiii=f.asm.qa).apply(null,arguments)};f.dynCall_jiji=function(){return(f.dynCall_jiji=f.asm.ra).apply(null,arguments)};f.dynCall_ii=function(){return(f.dynCall_ii=f.asm.sa).apply(null,arguments)};f.dynCall_iidiiii=function(){return(f.dynCall_iidiiii=f.asm.ta).apply(null,arguments)};
|
||||||
|
f.dynCall_viiiiiiiiiiiii=function(){return(f.dynCall_viiiiiiiiiiiii=f.asm.ua).apply(null,arguments)};f.dynCall_jiiiiiiii=function(){return(f.dynCall_jiiiiiiii=f.asm.va).apply(null,arguments)};f.dynCall_ff=function(){return(f.dynCall_ff=f.asm.wa).apply(null,arguments)};f.dynCall_jiiiiii=function(){return(f.dynCall_jiiiiii=f.asm.xa).apply(null,arguments)};f.dynCall_jiiiii=function(){return(f.dynCall_jiiiii=f.asm.ya).apply(null,arguments)};
|
||||||
|
f.dynCall_iiijii=function(){return(f.dynCall_iiijii=f.asm.za).apply(null,arguments)};function Jc(a,b){var c=Y();try{Oc(a,b)}catch(d){Z(c);if(d!==d+0&&"longjmp"!==d)throw d;X(1,0)}}function Lc(a,b,c,d,e){var g=Y();try{Qc(a,b,c,d,e)}catch(h){Z(g);if(h!==h+0&&"longjmp"!==h)throw h;X(1,0)}}function Kc(a,b,c){var d=Y();try{Pc(a,b,c)}catch(e){Z(d);if(e!==e+0&&"longjmp"!==e)throw e;X(1,0)}}
|
||||||
|
function Ic(a,b,c,d,e,g,h,k,l){var n=Y();try{return Vc(a,b,c,d,e,g,h,k,l)}catch(p){Z(n);if(p!==p+0&&"longjmp"!==p)throw p;X(1,0)}}function Fc(a,b,c){var d=Y();try{return Sc(a,b,c)}catch(e){Z(d);if(e!==e+0&&"longjmp"!==e)throw e;X(1,0)}}function Hc(a,b,c,d,e){var g=Y();try{return Uc(a,b,c,d,e)}catch(h){Z(g);if(h!==h+0&&"longjmp"!==h)throw h;X(1,0)}}function Gc(a,b,c,d){var e=Y();try{return Tc(a,b,c,d)}catch(g){Z(e);if(g!==g+0&&"longjmp"!==g)throw g;X(1,0)}}
|
||||||
|
function Mc(a,b,c,d,e,g,h,k,l,n,p){var t=Y();try{Rc(a,b,c,d,e,g,h,k,l,n,p)}catch(u){Z(t);if(u!==u+0&&"longjmp"!==u)throw u;X(1,0)}}var Wc;Ra=function Xc(){Wc||Yc();Wc||(Ra=Xc)};
|
||||||
|
function Yc(){function a(){if(!Wc&&(Wc=!0,f.calledRun=!0,!pa)){f.noFSInit||Pb||(Pb=!0,Ob(),f.stdin=f.stdin,f.stdout=f.stdout,f.stderr=f.stderr,f.stdin?Rb("stdin",f.stdin):Kb("/dev/tty","/dev/stdin"),f.stdout?Rb("stdout",null,f.stdout):Kb("/dev/tty","/dev/stdout"),f.stderr?Rb("stderr",null,f.stderr):Kb("/dev/tty1","/dev/stderr"),Lb("/dev/stdin","r"),Lb("/dev/stdout","w"),Lb("/dev/stderr","w"));Ga(Ia);ub=!1;Ga(Ja);aa(f);if(f.onRuntimeInitialized)f.onRuntimeInitialized();if(f.postRun)for("function"==
|
||||||
|
typeof f.postRun&&(f.postRun=[f.postRun]);f.postRun.length;){var b=f.postRun.shift();Ka.unshift(b)}Ga(Ka)}}if(!(0<J)){if(f.preRun)for("function"==typeof f.preRun&&(f.preRun=[f.preRun]);f.preRun.length;)La();Ga(Ha);0<J||(f.setStatus?(f.setStatus("Running..."),setTimeout(function(){setTimeout(function(){f.setStatus("")},1);a()},1)):a())}}f.run=Yc;if(f.preInit)for("function"==typeof f.preInit&&(f.preInit=[f.preInit]);0<f.preInit.length;)f.preInit.pop()();noExitRuntime=!0;Yc();
|
||||||
|
|
||||||
|
|
||||||
|
return avif_enc.ready
|
||||||
|
}
|
||||||
|
);
|
||||||
|
})();
|
||||||
|
if (typeof exports === 'object' && typeof module === 'object')
|
||||||
|
module.exports = avif_enc;
|
||||||
|
else if (typeof define === 'function' && define['amd'])
|
||||||
|
define([], function() { return avif_enc; });
|
||||||
|
else if (typeof exports === 'object')
|
||||||
|
exports["avif_enc"] = avif_enc;
|
||||||
|
|
||||||
BIN
codecs/avif/enc/avif_enc.wasm
Normal file
BIN
codecs/avif/enc/avif_enc.wasm
Normal file
Binary file not shown.
155
codecs/avif/enc/avif_enc_mt.js
Normal file
155
codecs/avif/enc/avif_enc_mt.js
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
|
||||||
|
var avif_enc_mt = (function() {
|
||||||
|
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
|
||||||
|
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
|
||||||
|
return (
|
||||||
|
function(avif_enc_mt) {
|
||||||
|
avif_enc_mt = avif_enc_mt || {};
|
||||||
|
|
||||||
|
|
||||||
|
function e(){m.buffer!=n&&p(m.buffer);return aa}function t(){m.buffer!=n&&p(m.buffer);return ba}function ca(){m.buffer!=n&&p(m.buffer);return da}function ea(){m.buffer!=n&&p(m.buffer);return fa}function w(){m.buffer!=n&&p(m.buffer);return ha}function x(){m.buffer!=n&&p(m.buffer);return ia}function ja(){m.buffer!=n&&p(m.buffer);return ka}function la(){m.buffer!=n&&p(m.buffer);return ma}var z;z||(z=typeof avif_enc_mt !== 'undefined' ? avif_enc_mt : {});var na,oa;
|
||||||
|
z.ready=new Promise(function(a,b){na=a;oa=b});var pa={},A;for(A in z)z.hasOwnProperty(A)&&(pa[A]=z[A]);var qa=!1,D=!1,F=!1,ra=!1;qa="object"===typeof window;D="function"===typeof importScripts;F="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;ra=!qa&&!F&&!D;var G=z.ENVIRONMENT_IS_PTHREAD||!1;G&&(n=z.buffer,sa=z.DYNAMIC_BASE,ta=z.DYNAMICTOP_PTR);var H="";function ua(a){return z.locateFile?z.locateFile(a,H):H+a}var va,wa,I,xa;
|
||||||
|
if(F){H=D?require("path").dirname(H)+"/":__dirname+"/";va=function(a,b){I||(I=require("fs"));xa||(xa=require("path"));a=xa.normalize(a);return I.readFileSync(a,b?null:"utf8")};wa=function(a){a=va(a,!0);a.buffer||(a=new Uint8Array(a));assert(a.buffer);return a};1<process.argv.length&&process.argv[1].replace(/\\/g,"/");process.argv.slice(2);process.on("uncaughtException",function(a){if(!(a instanceof ya))throw a;});process.on("unhandledRejection",J);z.inspect=function(){return"[Emscripten Module object]"};
|
||||||
|
var za;try{za=require("worker_threads")}catch(a){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),a;}global.Worker=za.Worker}else if(ra)"undefined"!=typeof read&&(va=function(a){return read(a)}),wa=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");assert("object"===typeof a);return a},"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,
|
||||||
|
console.warn=console.error="undefined"!==typeof printErr?printErr:print);else if(qa||D)D?H=self.location.href:document.currentScript&&(H=document.currentScript.src),_scriptDir&&(H=_scriptDir),0!==H.indexOf("blob:")?H=H.substr(0,H.lastIndexOf("/")+1):H="",F?(va=function(a,b){I||(I=require("fs"));xa||(xa=require("path"));a=xa.normalize(a);return I.readFileSync(a,b?null:"utf8")},wa=function(a){a=va(a,!0);a.buffer||(a=new Uint8Array(a));assert(a.buffer);return a}):(va=function(a){var b=new XMLHttpRequest;
|
||||||
|
b.open("GET",a,!1);b.send(null);return b.responseText},D&&(wa=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)}));F&&"undefined"===typeof performance&&(global.performance=require("perf_hooks").performance);var Aa=z.print||console.log.bind(console),K=z.printErr||console.warn.bind(console);for(A in pa)pa.hasOwnProperty(A)&&(z[A]=pa[A]);pa=null;var Ca,Da=0,Ea;z.wasmBinary&&(Ea=z.wasmBinary);var noExitRuntime;
|
||||||
|
z.noExitRuntime&&(noExitRuntime=z.noExitRuntime);"object"!==typeof WebAssembly&&J("no native wasm support detected");var m,Fa=new WebAssembly.Table({initial:874,maximum:874,element:"anyfunc"}),Ga,threadInfoStruct=0,selfThreadId=0,Ha=!1;function assert(a,b){a||J("Assertion failed: "+b)}
|
||||||
|
function Ia(a,b,c){c=b+c;for(var d="";!(b>=c);){var f=a[b++];if(!f)break;if(f&128){var g=a[b++]&63;if(192==(f&224))d+=String.fromCharCode((f&31)<<6|g);else{var h=a[b++]&63;f=224==(f&240)?(f&15)<<12|g<<6|h:(f&7)<<18|g<<12|h<<6|a[b++]&63;65536>f?d+=String.fromCharCode(f):(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else d+=String.fromCharCode(f)}return d}function Ja(a,b){return a?Ia(t(),a,b):""}
|
||||||
|
function Ka(a,b,c,d){if(!(0<d))return 0;var f=c;d=c+d-1;for(var g=0;g<a.length;++g){var h=a.charCodeAt(g);if(55296<=h&&57343>=h){var l=a.charCodeAt(++g);h=65536+((h&1023)<<10)|l&1023}if(127>=h){if(c>=d)break;b[c++]=h}else{if(2047>=h){if(c+1>=d)break;b[c++]=192|h>>6}else{if(65535>=h){if(c+2>=d)break;b[c++]=224|h>>12}else{if(c+3>=d)break;b[c++]=240|h>>18;b[c++]=128|h>>12&63}b[c++]=128|h>>6&63}b[c++]=128|h&63}}b[c]=0;return c-f}function La(a,b,c){Ka(a,t(),b,c)}
|
||||||
|
function Ma(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&(d=65536+((d&1023)<<10)|a.charCodeAt(++c)&1023);127>=d?++b:b=2047>=d?b+2:65535>=d?b+3:b+4}return b}function Na(a,b){for(var c=0,d="";;){var f=ca()[a+2*c>>1];if(0==f||c==b/2)return d;++c;d+=String.fromCharCode(f)}}function Oa(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f){var g=a.charCodeAt(f);ca()[b>>1]=g;b+=2}ca()[b>>1]=0;return b-d}
|
||||||
|
function Pa(a){return 2*a.length}function Qa(a,b){for(var c=0,d="";!(c>=b/4);){var f=w()[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023)):d+=String.fromCharCode(f)}return d}function Ra(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var h=a.charCodeAt(++f);g=65536+((g&1023)<<10)|h&1023}w()[b>>2]=g;b+=4;if(b+4>c)break}w()[b>>2]=0;return b-d}
|
||||||
|
function Sa(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&++c;b+=4}return b}var n,aa,ba,da,fa,ha,ia,ka,ma;function p(a){n=a;z.HEAP8=aa=new Int8Array(a);z.HEAP16=da=new Int16Array(a);z.HEAP32=ha=new Int32Array(a);z.HEAPU8=ba=new Uint8Array(a);z.HEAPU16=fa=new Uint16Array(a);z.HEAPU32=ia=new Uint32Array(a);z.HEAPF32=ka=new Float32Array(a);z.HEAPF64=ma=new Float64Array(a)}var sa=6123216,ta=879408,Ta=z.INITIAL_MEMORY||16777216;
|
||||||
|
if(G)m=z.wasmMemory,n=z.buffer;else if(z.wasmMemory)m=z.wasmMemory;else if(m=new WebAssembly.Memory({initial:Ta/65536,maximum:32768,shared:!0}),!(m.buffer instanceof SharedArrayBuffer))throw K("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),F&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),
|
||||||
|
Error("bad memory");m&&(n=m.buffer);Ta=n.byteLength;p(n);G||(w()[ta>>2]=sa);function Ua(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(z);else{var c=b.yc;"number"===typeof c?void 0===b.Mb?z.dynCall_v(c):z.dynCall_vi(c,b.Mb):c(void 0===b.Mb?null:b.Mb)}}}var Va=[],Wa=[],Xa=[],Ya=[];function Za(){var a=z.preRun.shift();Va.unshift(a)}var $a=Math.abs,ab=Math.ceil,bb=Math.floor,cb=Math.min,db=0,eb=null,fb=null;z.preloadedImages={};z.preloadedAudios={};
|
||||||
|
function J(a){if(z.onAbort)z.onAbort(a);G&&console.error("Pthread aborting at "+Error().stack);K(a);Ha=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");oa(a);throw a;}function gb(a){var b=hb;return String.prototype.startsWith?b.startsWith(a):0===b.indexOf(a)}function ib(){return gb("data:application/octet-stream;base64,")}var hb="avif_enc_mt.wasm";ib()||(hb=ua(hb));
|
||||||
|
function jb(){try{if(Ea)return new Uint8Array(Ea);if(wa)return wa(hb);throw"both async and sync fetching of the wasm failed";}catch(a){J(a)}}function kb(){return Ea||!qa&&!D||"function"!==typeof fetch||gb("file://")?new Promise(function(a){a(jb())}):fetch(hb,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+hb+"'";return a.arrayBuffer()}).catch(function(){return jb()})}
|
||||||
|
var lb,mb,ob={575937:function(a,b){setTimeout(function(){nb(a,b)},0)},576015:function(){throw"Canceled!";}};G||Wa.push({yc:function(){pb()}});var qb=0,rb=0,sb=0;function tb(a,b,c){qb=a|0;sb=b|0;rb=c|0}z.registerPthreadPtr=tb;
|
||||||
|
function ub(a,b){if(0>=a||a>e().length||a&1||0>b)return-28;if(0==b)return 0;2147483647<=b&&(b=Infinity);var c=Atomics.load(w(),220080),d=0;if(c==a&&Atomics.compareExchange(w(),220080,c,0)==c&&(--b,d=1,0>=b))return 1;a=Atomics.notify(w(),a>>2,b);if(0<=a)return a+d;throw"Atomics.notify returned an unexpected value "+a;}z._emscripten_futex_wake=ub;
|
||||||
|
function vb(a){if(G)throw"Internal Error! cleanupThread() can only ever be called from main application thread!";if(!a)throw"Internal Error! Null pthread_ptr in cleanupThread!";w()[a+12>>2]=0;(a=L.Ab[a])&&L.Tb(a.worker)}
|
||||||
|
var L={bd:1,nd:{rc:0,sc:0},xb:[],Fb:[],Gc:function(){tb(L.vb,!D,1);wb(L.vb)},Fc:function(){for(var a=navigator.hardwareConcurrency,b=0;b<a;++b)L.cc();L.vb=879568;for(b=0;58>b;++b)x()[L.vb/4+b]=0;w()[L.vb+12>>2]=L.vb;a=L.vb+156;w()[a>>2]=a;for(b=0;128>b;++b)x()[219952+b]=0;Atomics.store(x(),L.vb+104>>2,879808);Atomics.store(x(),L.vb+40>>2,L.vb);Atomics.store(x(),L.vb+44>>2,42)},Hc:function(){L.receiveObjectTransfer=L.Qc;L.setThreadStatus=L.Tc;L.threadCancel=L.Yc;L.threadExit=L.Zc},Ab:{},Ub:[],Tc:function(){},
|
||||||
|
qc:function(){for(;0<L.Ub.length;)L.Ub.pop()();G&&threadInfoStruct&&xb()},Zc:function(a){var b=qb|0;b&&(Atomics.store(x(),b+4>>2,a),Atomics.store(x(),b+0>>2,1),Atomics.store(x(),b+60>>2,1),Atomics.store(x(),b+64>>2,0),L.qc(),ub(b+0,2147483647),tb(0,0,0),threadInfoStruct=0,G&&postMessage({cmd:"exit"}))},Yc:function(){L.qc();Atomics.store(x(),threadInfoStruct+4>>2,-1);Atomics.store(x(),threadInfoStruct+0>>2,1);ub(threadInfoStruct+0,2147483647);threadInfoStruct=selfThreadId=0;tb(0,0,0);postMessage({cmd:"cancelDone"})},
|
||||||
|
vd:function(){for(var a in L.Ab){var b=L.Ab[a];b&&b.worker&&L.Tb(b.worker)}L.Ab={};for(a=0;a<L.xb.length;++a){var c=L.xb[a];c.terminate()}L.xb=[];for(a=0;a<L.Fb.length;++a)c=L.Fb[a],b=c.wb,L.Xb(b),c.terminate();L.Fb=[]},Xb:function(a){if(a){if(a.threadInfoStruct){var b=w()[a.threadInfoStruct+104>>2];w()[a.threadInfoStruct+104>>2]=0;M(b);M(a.threadInfoStruct)}a.threadInfoStruct=0;a.Vb&&a.Ib&&M(a.Ib);a.Ib=0;a.worker&&(a.worker.wb=null)}},Tb:function(a){delete L.Ab[a.wb.tc];L.xb.push(a);L.Fb.splice(L.Fb.indexOf(a),
|
||||||
|
1);L.Xb(a.wb);a.wb=void 0},Qc:function(){},lc:function(a,b){a.onmessage=function(c){var d=c.data,f=d.cmd;a.wb&&(L.Wb=a.wb.threadInfoStruct);if(d.targetThread&&d.targetThread!=(qb|0)){var g=L.Ab[d.ud];g?g.worker.postMessage(c.data,d.transferList):console.error('Internal error! Worker sent a message "'+f+'" to target pthread '+d.targetThread+", but that thread no longer exists!")}else if("processQueuedMainThreadWork"===f)yb();else if("spawnThread"===f)zb(c.data);else if("cleanupThread"===f)vb(d.thread);
|
||||||
|
else if("killThread"===f){c=d.thread;if(G)throw"Internal Error! killThread() can only ever be called from main application thread!";if(!c)throw"Internal Error! Null pthread_ptr in killThread!";w()[c+12>>2]=0;c=L.Ab[c];c.worker.terminate();L.Xb(c);L.Fb.splice(L.Fb.indexOf(c.worker),1);c.worker.wb=void 0}else if("cancelThread"===f){c=d.thread;if(G)throw"Internal Error! cancelThread() can only ever be called from main application thread!";if(!c)throw"Internal Error! Null pthread_ptr in cancelThread!";
|
||||||
|
L.Ab[c].worker.postMessage({cmd:"cancel"})}else"loaded"===f?(a.loaded=!0,b&&b(a),a.Nb&&(a.Nb(),delete a.Nb)):"print"===f?Aa("Thread "+d.threadId+": "+d.text):"printErr"===f?K("Thread "+d.threadId+": "+d.text):"alert"===f?alert("Thread "+d.threadId+": "+d.text):"exit"===f?a.wb&&Atomics.load(x(),a.wb.tc+68>>2)&&L.Tb(a):"cancelDone"===f?L.Tb(a):"objectTransfer"!==f&&("setimmediate"===c.data.target?a.postMessage(c.data):K("worker sent an unknown command "+f));L.Wb=void 0};a.onerror=function(c){K("pthread sent an error! "+
|
||||||
|
c.filename+":"+c.lineno+": "+c.message)};F&&(a.on("message",function(c){a.onmessage({data:c})}),a.on("error",function(c){a.onerror(c)}),a.on("exit",function(){console.log("worker exited - TODO: update the worker queue?")}));a.postMessage({cmd:"load",urlOrBlob:z.mainScriptUrlOrBlob||_scriptDir,wasmMemory:m,wasmModule:Ga,DYNAMIC_BASE:sa,DYNAMICTOP_PTR:ta})},cc:function(){var a=ua("avif_enc_mt.worker.js");L.xb.push(new Worker(a))},zc:function(){0==L.xb.length&&(L.cc(),L.lc(L.xb[0]));return 0<L.xb.length?
|
||||||
|
L.xb.pop():null},dd:function(a){for(a=performance.now()+a;performance.now()<a;);}};z.establishStackSpace=function(a){N(a)};z.getNoExitRuntime=function(){return noExitRuntime};var Ab;F?Ab=function(){var a=process.hrtime();return 1E3*a[0]+a[1]/1E6}:G?Ab=function(){return performance.now()-z.__performance_now_clock_drift}:"undefined"!==typeof dateNow?Ab=dateNow:Ab=function(){return performance.now()};function Bb(a,b){L.Ub.push(function(){Cb(a,b)})}
|
||||||
|
function Db(a,b){for(var c=0,d=a.length-1;0<=d;d--){var f=a[d];"."===f?a.splice(d,1):".."===f?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c;c--)a.unshift("..");return a}function Eb(a){var b="/"===a.charAt(0),c="/"===a.substr(-1);(a=Db(a.split("/").filter(function(d){return!!d}),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a}
|
||||||
|
function Fb(a){var b=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);a=b[0];b=b[1];if(!a&&!b)return".";b&&(b=b.substr(0,b.length-1));return a+b}function Gb(a){if("/"===a)return"/";var b=a.lastIndexOf("/");return-1===b?a:a.substr(b+1)}
|
||||||
|
function Hb(){for(var a="",b=!1,c=arguments.length-1;-1<=c&&!b;c--){b=0<=c?arguments[c]:"/";if("string"!==typeof b)throw new TypeError("Arguments to path.resolve must be strings");if(!b)return"";a=b+"/"+a;b="/"===b.charAt(0)}a=Db(a.split("/").filter(function(d){return!!d}),!b).join("/");return(b?"/":"")+a||"."}var Ib=[];function Jb(a,b){Ib[a]={input:[],output:[],Jb:b};Kb(a,Lb)}
|
||||||
|
var Lb={open:function(a){var b=Ib[a.node.rdev];if(!b)throw new P(43);a.tty=b;a.seekable=!1},close:function(a){a.tty.Jb.flush(a.tty)},flush:function(a){a.tty.Jb.flush(a.tty)},read:function(a,b,c,d){if(!a.tty||!a.tty.Jb.kc)throw new P(60);for(var f=0,g=0;g<d;g++){try{var h=a.tty.Jb.kc(a.tty)}catch(l){throw new P(29);}if(void 0===h&&0===f)throw new P(6);if(null===h||void 0===h)break;f++;b[c+g]=h}f&&(a.node.timestamp=Date.now());return f},write:function(a,b,c,d){if(!a.tty||!a.tty.Jb.Zb)throw new P(60);
|
||||||
|
try{for(var f=0;f<d;f++)a.tty.Jb.Zb(a.tty,b[c+f])}catch(g){throw new P(29);}d&&(a.node.timestamp=Date.now());return f}},Mb={kc:function(a){if(!a.input.length){var b=null;if(F){var c=Buffer.Pc?Buffer.Pc(256):new Buffer(256),d=0;try{d=I.readSync(process.stdin.fd,c,0,256,null)}catch(f){if(-1!=f.toString().indexOf("EOF"))d=0;else throw f;}0<d?b=c.slice(0,d).toString("utf-8"):b=null}else"undefined"!=typeof window&&"function"==typeof window.prompt?(b=window.prompt("Input: "),null!==b&&(b+="\n")):"function"==
|
||||||
|
typeof readline&&(b=readline(),null!==b&&(b+="\n"));if(!b)return null;c=Array(Ma(b)+1);b=Ka(b,c,0,c.length);c.length=b;a.input=c}return a.input.shift()},Zb:function(a,b){null===b||10===b?(Aa(Ia(a.output,0)),a.output=[]):0!=b&&a.output.push(b)},flush:function(a){a.output&&0<a.output.length&&(Aa(Ia(a.output,0)),a.output=[])}},Nb={Zb:function(a,b){null===b||10===b?(K(Ia(a.output,0)),a.output=[]):0!=b&&a.output.push(b)},flush:function(a){a.output&&0<a.output.length&&(K(Ia(a.output,0)),a.output=[])}},
|
||||||
|
Q={yb:null,Db:function(){return Q.createNode(null,"/",16895,0)},createNode:function(a,b,c,d){if(24576===(c&61440)||4096===(c&61440))throw new P(63);Q.yb||(Q.yb={dir:{node:{Eb:Q.sb.Eb,Bb:Q.sb.Bb,lookup:Q.sb.lookup,Rb:Q.sb.Rb,rename:Q.sb.rename,unlink:Q.sb.unlink,rmdir:Q.sb.rmdir,readdir:Q.sb.readdir,symlink:Q.sb.symlink},stream:{Hb:Q.tb.Hb}},file:{node:{Eb:Q.sb.Eb,Bb:Q.sb.Bb},stream:{Hb:Q.tb.Hb,read:Q.tb.read,write:Q.tb.write,bc:Q.tb.bc,mc:Q.tb.mc,oc:Q.tb.oc}},link:{node:{Eb:Q.sb.Eb,Bb:Q.sb.Bb,readlink:Q.sb.readlink},
|
||||||
|
stream:{}},dc:{node:{Eb:Q.sb.Eb,Bb:Q.sb.Bb},stream:Ob}});c=Pb(a,b,c,d);16384===(c.mode&61440)?(c.sb=Q.yb.dir.node,c.tb=Q.yb.dir.stream,c.rb={}):32768===(c.mode&61440)?(c.sb=Q.yb.file.node,c.tb=Q.yb.file.stream,c.ub=0,c.rb=null):40960===(c.mode&61440)?(c.sb=Q.yb.link.node,c.tb=Q.yb.link.stream):8192===(c.mode&61440)&&(c.sb=Q.yb.dc.node,c.tb=Q.yb.dc.stream);c.timestamp=Date.now();a&&(a.rb[b]=c);return c},jd:function(a){if(a.rb&&a.rb.subarray){for(var b=[],c=0;c<a.ub;++c)b.push(a.rb[c]);return b}return a.rb},
|
||||||
|
kd:function(a){return a.rb?a.rb.subarray?a.rb.subarray(0,a.ub):new Uint8Array(a.rb):new Uint8Array(0)},fc:function(a,b){var c=a.rb?a.rb.length:0;c>=b||(b=Math.max(b,c*(1048576>c?2:1.125)>>>0),0!=c&&(b=Math.max(b,256)),c=a.rb,a.rb=new Uint8Array(b),0<a.ub&&a.rb.set(c.subarray(0,a.ub),0))},Rc:function(a,b){if(a.ub!=b)if(0==b)a.rb=null,a.ub=0;else{if(!a.rb||a.rb.subarray){var c=a.rb;a.rb=new Uint8Array(b);c&&a.rb.set(c.subarray(0,Math.min(b,a.ub)))}else if(a.rb||(a.rb=[]),a.rb.length>b)a.rb.length=b;
|
||||||
|
else for(;a.rb.length<b;)a.rb.push(0);a.ub=b}},sb:{Eb:function(a){var b={};b.dev=8192===(a.mode&61440)?a.id:1;b.ino=a.id;b.mode=a.mode;b.nlink=1;b.uid=0;b.gid=0;b.rdev=a.rdev;16384===(a.mode&61440)?b.size=4096:32768===(a.mode&61440)?b.size=a.ub:40960===(a.mode&61440)?b.size=a.link.length:b.size=0;b.atime=new Date(a.timestamp);b.mtime=new Date(a.timestamp);b.ctime=new Date(a.timestamp);b.vc=4096;b.blocks=Math.ceil(b.size/b.vc);return b},Bb:function(a,b){void 0!==b.mode&&(a.mode=b.mode);void 0!==b.timestamp&&
|
||||||
|
(a.timestamp=b.timestamp);void 0!==b.size&&Q.Rc(a,b.size)},lookup:function(){throw Qb[44];},Rb:function(a,b,c,d){return Q.createNode(a,b,c,d)},rename:function(a,b,c){if(16384===(a.mode&61440)){try{var d=Rb(b,c)}catch(g){}if(d)for(var f in d.rb)throw new P(55);}delete a.parent.rb[a.name];a.name=c;b.rb[c]=a;a.parent=b},unlink:function(a,b){delete a.rb[b]},rmdir:function(a,b){var c=Rb(a,b),d;for(d in c.rb)throw new P(55);delete a.rb[b]},readdir:function(a){var b=[".",".."],c;for(c in a.rb)a.rb.hasOwnProperty(c)&&
|
||||||
|
b.push(c);return b},symlink:function(a,b,c){a=Q.createNode(a,b,41471,0);a.link=c;return a},readlink:function(a){if(40960!==(a.mode&61440))throw new P(28);return a.link}},tb:{read:function(a,b,c,d,f){var g=a.node.rb;if(f>=a.node.ub)return 0;a=Math.min(a.node.ub-f,d);if(8<a&&g.subarray)b.set(g.subarray(f,f+a),c);else for(d=0;d<a;d++)b[c+d]=g[f+d];return a},write:function(a,b,c,d,f,g){b.buffer===e().buffer&&(g=!1);if(!d)return 0;a=a.node;a.timestamp=Date.now();if(b.subarray&&(!a.rb||a.rb.subarray)){if(g)return a.rb=
|
||||||
|
b.subarray(c,c+d),a.ub=d;if(0===a.ub&&0===f)return a.rb=b.slice(c,c+d),a.ub=d;if(f+d<=a.ub)return a.rb.set(b.subarray(c,c+d),f),d}Q.fc(a,f+d);if(a.rb.subarray&&b.subarray)a.rb.set(b.subarray(c,c+d),f);else for(g=0;g<d;g++)a.rb[f+g]=b[c+g];a.ub=Math.max(a.ub,f+d);return d},Hb:function(a,b,c){1===c?b+=a.position:2===c&&32768===(a.node.mode&61440)&&(b+=a.node.ub);if(0>b)throw new P(28);return b},bc:function(a,b,c){Q.fc(a.node,b+c);a.node.ub=Math.max(a.node.ub,b+c)},mc:function(a,b,c,d,f,g){assert(0===
|
||||||
|
b);if(32768!==(a.node.mode&61440))throw new P(43);a=a.node.rb;if(g&2||a.buffer!==n){if(0<d||d+c<a.length)a.subarray?a=a.subarray(d,d+c):a=Array.prototype.slice.call(a,d,d+c);d=!0;g=16384*Math.ceil(c/16384);for(b=R(g);c<g;)e()[b+c++]=0;c=b;if(!c)throw new P(48);e().set(a,c)}else d=!1,c=a.byteOffset;return{sd:c,cd:d}},oc:function(a,b,c,d,f){if(32768!==(a.node.mode&61440))throw new P(43);if(f&2)return 0;Q.tb.write(a,b,0,d,c,!1);return 0}}},Sb=null,Tb={},Ub=[],Vb=1,Wb=null,Xb=!0,Yb={},P=null,Qb={};
|
||||||
|
function Zb(a,b){a=Hb("/",a);b=b||{};if(!a)return{path:"",node:null};var c={jc:!0,$b:0},d;for(d in c)void 0===b[d]&&(b[d]=c[d]);if(8<b.$b)throw new P(32);a=Db(a.split("/").filter(function(h){return!!h}),!1);var f=Sb;c="/";for(d=0;d<a.length;d++){var g=d===a.length-1;if(g&&b.parent)break;f=Rb(f,a[d]);c=Eb(c+"/"+a[d]);f.Sb&&(!g||g&&b.jc)&&(f=f.Sb.root);if(!g||b.ic)for(g=0;40960===(f.mode&61440);)if(f=$b(c),c=Hb(Fb(c),f),f=Zb(c,{$b:b.$b}).node,40<g++)throw new P(32);}return{path:c,node:f}}
|
||||||
|
function ac(a){for(var b;;){if(a===a.parent)return a=a.Db.nc,b?"/"!==a[a.length-1]?a+"/"+b:a+b:a;b=b?a.name+"/"+b:a.name;a=a.parent}}function bc(a,b){for(var c=0,d=0;d<b.length;d++)c=(c<<5)-c+b.charCodeAt(d)|0;return(a+c>>>0)%Wb.length}function Rb(a,b){var c;if(c=(c=cc(a,"x"))?c:a.sb.lookup?0:2)throw new P(c,a);for(c=Wb[bc(a.id,b)];c;c=c.Lc){var d=c.name;if(c.parent.id===a.id&&d===b)return c}return a.sb.lookup(a,b)}
|
||||||
|
function Pb(a,b,c,d){a=new dc(a,b,c,d);b=bc(a.parent.id,a.name);a.Lc=Wb[b];return Wb[b]=a}var ec={r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218};function fc(a){var b=["r","w","rw"][a&3];a&512&&(b+="w");return b}function cc(a,b){if(Xb)return 0;if(-1===b.indexOf("r")||a.mode&292){if(-1!==b.indexOf("w")&&!(a.mode&146)||-1!==b.indexOf("x")&&!(a.mode&73))return 2}else return 2;return 0}
|
||||||
|
function hc(a,b){try{return Rb(a,b),20}catch(c){}return cc(a,"wx")}function ic(a){var b=4096;for(a=a||0;a<=b;a++)if(!Ub[a])return a;throw new P(33);}function jc(a,b){kc||(kc=function(){},kc.prototype={});var c=new kc,d;for(d in a)c[d]=a[d];a=c;b=ic(b);a.fd=b;return Ub[b]=a}var Ob={open:function(a){a.tb=Tb[a.node.rdev].tb;a.tb.open&&a.tb.open(a)},Hb:function(){throw new P(70);}};function Kb(a,b){Tb[a]={tb:b}}
|
||||||
|
function lc(a,b){var c="/"===b,d=!b;if(c&&Sb)throw new P(10);if(!c&&!d){var f=Zb(b,{jc:!1});b=f.path;f=f.node;if(f.Sb)throw new P(10);if(16384!==(f.mode&61440))throw new P(54);}b={type:a,qd:{},nc:b,Kc:[]};a=a.Db(b);a.Db=b;b.root=a;c?Sb=a:f&&(f.Sb=b,f.Db&&f.Db.Kc.push(b))}function mc(a,b,c){var d=Zb(a,{parent:!0}).node;a=Gb(a);if(!a||"."===a||".."===a)throw new P(28);var f=hc(d,a);if(f)throw new P(f);if(!d.sb.Rb)throw new P(63);return d.sb.Rb(d,a,b,c)}function S(a){mc(a,16895,0)}
|
||||||
|
function nc(a,b,c){"undefined"===typeof c&&(c=b,b=438);mc(a,b|8192,c)}function oc(a,b){if(!Hb(a))throw new P(44);var c=Zb(b,{parent:!0}).node;if(!c)throw new P(44);b=Gb(b);var d=hc(c,b);if(d)throw new P(d);if(!c.sb.symlink)throw new P(63);c.sb.symlink(c,b,a)}function $b(a){a=Zb(a).node;if(!a)throw new P(44);if(!a.sb.readlink)throw new P(28);return Hb(ac(a.parent),a.sb.readlink(a))}
|
||||||
|
function pc(a,b,c,d){if(""===a)throw new P(44);if("string"===typeof b){var f=ec[b];if("undefined"===typeof f)throw Error("Unknown file open mode: "+b);b=f}c=b&64?("undefined"===typeof c?438:c)&4095|32768:0;if("object"===typeof a)var g=a;else{a=Eb(a);try{g=Zb(a,{ic:!(b&131072)}).node}catch(l){}}f=!1;if(b&64)if(g){if(b&128)throw new P(20);}else g=mc(a,c,0),f=!0;if(!g)throw new P(44);8192===(g.mode&61440)&&(b&=-513);if(b&65536&&16384!==(g.mode&61440))throw new P(54);if(!f&&(c=g?40960===(g.mode&61440)?
|
||||||
|
32:16384===(g.mode&61440)&&("r"!==fc(b)||b&512)?31:cc(g,fc(b)):44))throw new P(c);if(b&512){c=g;var h;"string"===typeof c?h=Zb(c,{ic:!0}).node:h=c;if(!h.sb.Bb)throw new P(63);if(16384===(h.mode&61440))throw new P(31);if(32768!==(h.mode&61440))throw new P(28);if(c=cc(h,"w"))throw new P(c);h.sb.Bb(h,{size:0,timestamp:Date.now()})}b&=-131713;d=jc({node:g,path:ac(g),flags:b,seekable:!0,position:0,tb:g.tb,ad:[],error:!1},d);d.tb.open&&d.tb.open(d);!z.logReadFiles||b&1||(qc||(qc={}),a in qc||(qc[a]=1,K("FS.trackingDelegate error on read file: "+
|
||||||
|
a)));try{Yb.onOpenFile&&(g=0,1!==(b&2097155)&&(g|=1),0!==(b&2097155)&&(g|=2),Yb.onOpenFile(a,g))}catch(l){K("FS.trackingDelegate['onOpenFile']('"+a+"', flags) threw an exception: "+l.message)}return d}function rc(a,b,c){if(null===a.fd)throw new P(8);if(!a.seekable||!a.tb.Hb)throw new P(70);if(0!=c&&1!=c&&2!=c)throw new P(28);a.position=a.tb.Hb(a,b,c);a.ad=[]}
|
||||||
|
function sc(){P||(P=function(a,b){this.node=b;this.Sc=function(c){this.Gb=c};this.Sc(a);this.message="FS error"},P.prototype=Error(),P.prototype.constructor=P,[44].forEach(function(a){Qb[a]=new P(a);Qb[a].stack="<generic error, no stack>"}))}var tc;function uc(a,b){var c=0;a&&(c|=365);b&&(c|=146);return c}
|
||||||
|
function vc(a,b,c){a=Eb("/dev/"+a);var d=uc(!!b,!!c);wc||(wc=64);var f=wc++<<8|0;Kb(f,{open:function(g){g.seekable=!1},close:function(){c&&c.buffer&&c.buffer.length&&c(10)},read:function(g,h,l,k){for(var q=0,r=0;r<k;r++){try{var v=b()}catch(y){throw new P(29);}if(void 0===v&&0===q)throw new P(6);if(null===v||void 0===v)break;q++;h[l+r]=v}q&&(g.node.timestamp=Date.now());return q},write:function(g,h,l,k){for(var q=0;q<k;q++)try{c(h[l+q])}catch(r){throw new P(29);}k&&(g.node.timestamp=Date.now());return q}});
|
||||||
|
nc(a,d,f)}var wc,xc={},kc,qc,yc=void 0;function zc(){yc+=4;return w()[yc-4>>2]}function Ac(a){a=Ub[a];if(!a)throw new P(8);return a}
|
||||||
|
function Bc(a,b,c){if(G)return T(1,1,a,b,c);yc=c;try{var d=Ac(a);switch(b){case 0:var f=zc();return 0>f?-28:pc(d.path,d.flags,0,f).fd;case 1:case 2:return 0;case 3:return d.flags;case 4:return f=zc(),d.flags|=f,0;case 12:return f=zc(),ca()[f+0>>1]=2,0;case 13:case 14:return 0;case 16:case 8:return-28;case 9:return w()[Cc()>>2]=28,-1;default:return-28}}catch(g){return"undefined"!==typeof xc&&g instanceof P||J(g),-g.Gb}}
|
||||||
|
function Dc(a,b,c){if(G)return T(2,1,a,b,c);yc=c;try{var d=Ac(a);switch(b){case 21509:case 21505:return d.tty?0:-59;case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:return d.tty?0:-59;case 21519:if(!d.tty)return-59;var f=zc();return w()[f>>2]=0;case 21520:return d.tty?-28:-59;case 21531:a=f=zc();if(!d.tb.Ic)throw new P(59);return d.tb.Ic(d,b,a);case 21523:return d.tty?0:-59;case 21524:return d.tty?0:-59;default:J("bad ioctl syscall "+b)}}catch(g){return"undefined"!==typeof xc&&g instanceof
|
||||||
|
P||J(g),-g.Gb}}function Ec(a,b,c){if(G)return T(3,1,a,b,c);yc=c;try{var d=Ja(a),f=zc();return pc(d,b,f).fd}catch(g){return"undefined"!==typeof xc&&g instanceof P||J(g),-g.Gb}}var Fc={};function Gc(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Hc(a){return this.fromWireType(x()[a>>2])}var Ic={},Jc={},Kc={};function Lc(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}
|
||||||
|
function Mc(a,b){a=Lc(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function Nc(a){var b=Error,c=Mc(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}
|
||||||
|
var Oc=void 0;function Pc(a,b,c){function d(l){l=c(l);if(l.length!==a.length)throw new Oc("Mismatched type converter count");for(var k=0;k<a.length;++k)U(a[k],l[k])}a.forEach(function(l){Kc[l]=b});var f=Array(b.length),g=[],h=0;b.forEach(function(l,k){Jc.hasOwnProperty(l)?f[k]=Jc[l]:(g.push(l),Ic.hasOwnProperty(l)||(Ic[l]=[]),Ic[l].push(function(){f[k]=Jc[l];++h;h===g.length&&d(f)}))});0===g.length&&d(f)}
|
||||||
|
function Qc(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var Rc=void 0;function V(a){for(var b="";t()[a];)b+=Rc[t()[a++]];return b}var Sc=void 0;function W(a){throw new Sc(a);}
|
||||||
|
function U(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||W('type "'+d+'" must have a positive integer typeid pointer');if(Jc.hasOwnProperty(a)){if(c.Dc)return;W("Cannot register type '"+d+"' twice")}Jc[a]=b;delete Kc[a];Ic.hasOwnProperty(a)&&(b=Ic[a],delete Ic[a],b.forEach(function(f){f()}))}var Tc=[],X=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||||
|
function Uc(a){4<a&&0===--X[a].ac&&(X[a]=void 0,Tc.push(a))}function Vc(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Tc.length?Tc.pop():X.length;X[b]={ac:1,value:a};return b}}function Wc(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
||||||
|
function Xc(a,b){switch(b){case 2:return function(c){return this.fromWireType(ja()[c>>2])};case 3:return function(c){return this.fromWireType(la()[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function Yc(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Mc(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
||||||
|
function Zc(a,b){var c=z;if(void 0===c[a].zb){var d=c[a];c[a]=function(){c[a].zb.hasOwnProperty(arguments.length)||W("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].zb+")!");return c[a].zb[arguments.length].apply(this,arguments)};c[a].zb=[];c[a].zb[d.uc]=d}}
|
||||||
|
function $c(a,b,c){z.hasOwnProperty(a)?((void 0===c||void 0!==z[a].zb&&void 0!==z[a].zb[c])&&W("Cannot register public name '"+a+"' twice"),Zc(a,a),z.hasOwnProperty(c)&&W("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),z[a].zb[c]=b):(z[a]=b,void 0!==c&&(z[a].pd=c))}function ad(a,b){for(var c=[],d=0;d<a;d++)c.push(w()[(b>>2)+d]);return c}
|
||||||
|
function bd(a,b){a=V(a);var c=z["dynCall_"+a];for(var d=[],f=1;f<a.length;++f)d.push("a"+f);f="return function dynCall_"+(a+"_"+b)+"("+d.join(", ")+") {\n";f+=" return dynCall(rawFunction"+(d.length?", ":"")+d.join(", ")+");\n";c=(new Function("dynCall","rawFunction",f+"};\n"))(c,b);"function"!==typeof c&&W("unknown function pointer with signature "+a+": "+b);return c}var cd=void 0;function dd(a){a=ed(a);var b=V(a);M(a);return b}
|
||||||
|
function fd(a,b){function c(g){f[g]||Jc[g]||(Kc[g]?Kc[g].forEach(c):(d.push(g),f[g]=!0))}var d=[],f={};b.forEach(c);throw new cd(a+": "+d.map(dd).join([", "]));}function gd(a,b,c){switch(b){case 0:return c?function(d){return e()[d]}:function(d){return t()[d]};case 1:return c?function(d){return ca()[d>>1]}:function(d){return ea()[d>>1]};case 2:return c?function(d){return w()[d>>2]}:function(d){return x()[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var hd={};
|
||||||
|
function id(){return"object"===typeof globalThis?globalThis:Function("return this")()}function jd(a,b){var c=Jc[a];void 0===c&&W(b+" has unknown type "+dd(a));return c}var kd={};
|
||||||
|
function ld(){F||D||(Ca||(Ca={}),Ca["Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread"]||(Ca["Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread"]=1,K("Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread")))}
|
||||||
|
function md(a,b,c){if(0>=a||a>e().length||a&1)return-28;if(D){a=Atomics.wait(w(),a>>2,b,c);if("timed-out"===a)return-73;if("not-equal"===a)return-6;if("ok"===a)return 0;throw"Atomics.wait returned an unexpected value "+a;}var d=Atomics.load(w(),a>>2);if(b!=d)return-6;b=performance.now();c=b+c;Atomics.store(w(),220080,a);for(d=a;a==d;){b=performance.now();if(b>c)return-73;yb();a=Atomics.load(w(),220080)}return 0}
|
||||||
|
function T(a,b){for(var c=arguments.length-2,d=Y(),f=nd(8*c),g=f>>3,h=0;h<c;h++)la()[g+h]=arguments[2+h];c=od(a,c,f,b);N(d);return c}var pd=[],qd=[],rd=[0,"undefined"!==typeof document?document:0,"undefined"!==typeof window?window:0];function sd(a){a=2<a?Ja(a):a;return rd[a]||("undefined"!==typeof document?document.querySelector(a):void 0)}
|
||||||
|
function td(a,b,c){var d=sd(a);if(!d)return-4;d.Qb&&(w()[d.Qb>>2]=b,w()[d.Qb+4>>2]=c);if(d.pc||!d.gd)d.pc&&(d=d.pc),a=!1,d.Pb&&d.Pb.Ob&&(a=d.Pb.Ob.getParameter(2978),a=0===a[0]&&0===a[1]&&a[2]===d.width&&a[3]===d.height),d.width=b,d.height=c,a&&d.Pb.Ob.viewport(0,0,b,c);else{if(d.Qb){d=w()[d.Qb+8>>2];a=a?Ja(a):"";var f=Y(),g=nd(12),h=0;if(a){h=Ma(a)+1;var l=R(h);La(a,l,h);h=l}w()[g>>2]=h;w()[g+4>>2]=b;w()[g+8>>2]=c;ud(0,d,657457152,0,h,g);N(f);return 1}return-4}return 0}
|
||||||
|
function vd(a,b,c){return G?T(4,1,a,b,c):td(a,b,c)}function wd(a){var b=a.getExtension("ANGLE_instanced_arrays");b&&(a.vertexAttribDivisor=function(c,d){b.vertexAttribDivisorANGLE(c,d)},a.drawArraysInstanced=function(c,d,f,g){b.drawArraysInstancedANGLE(c,d,f,g)},a.drawElementsInstanced=function(c,d,f,g,h){b.drawElementsInstancedANGLE(c,d,f,g,h)})}
|
||||||
|
function xd(a){var b=a.getExtension("OES_vertex_array_object");b&&(a.createVertexArray=function(){return b.createVertexArrayOES()},a.deleteVertexArray=function(c){b.deleteVertexArrayOES(c)},a.bindVertexArray=function(c){b.bindVertexArrayOES(c)},a.isVertexArray=function(c){return b.isVertexArrayOES(c)})}function yd(a){var b=a.getExtension("WEBGL_draw_buffers");b&&(a.drawBuffers=function(c,d){b.drawBuffersWEBGL(c,d)})}
|
||||||
|
function zd(a){a||(a=Ad);if(!a.Ec){a.Ec=!0;var b=a.Ob;wd(b);xd(b);yd(b);b.hd=b.getExtension("EXT_disjoint_timer_query");var c="OES_texture_float OES_texture_half_float OES_standard_derivatives OES_vertex_array_object WEBGL_compressed_texture_s3tc WEBGL_depth_texture OES_element_index_uint EXT_texture_filter_anisotropic EXT_frag_depth WEBGL_draw_buffers ANGLE_instanced_arrays OES_texture_float_linear OES_texture_half_float_linear EXT_blend_minmax EXT_shader_texture_lod EXT_texture_norm16 WEBGL_compressed_texture_pvrtc EXT_color_buffer_half_float WEBGL_color_buffer_float EXT_sRGB WEBGL_compressed_texture_etc1 EXT_disjoint_timer_query WEBGL_compressed_texture_etc WEBGL_compressed_texture_astc EXT_color_buffer_float WEBGL_compressed_texture_s3tc_srgb EXT_disjoint_timer_query_webgl2 WEBKIT_WEBGL_compressed_texture_pvrtc".split(" ");
|
||||||
|
(b.getSupportedExtensions()||[]).forEach(function(d){-1!=c.indexOf(d)&&b.getExtension(d)})}}var Ad,Bd=["default","low-power","high-performance"];function Cd(a){if(G)return T(5,1,a);try{var b=Ac(a);if(null===b.fd)throw new P(8);b.Yb&&(b.Yb=null);try{b.tb.close&&b.tb.close(b)}catch(c){throw c;}finally{Ub[b.fd]=null}b.fd=null;return 0}catch(c){return"undefined"!==typeof xc&&c instanceof P||J(c),c.Gb}}
|
||||||
|
function Dd(a,b,c,d){if(G)return T(6,1,a,b,c,d);try{a:{for(var f=Ac(a),g=a=0;g<c;g++){var h=w()[b+8*g>>2],l=w()[b+(8*g+4)>>2],k=f,q=e(),r=h,v=l,y=void 0;if(0>v||0>y)throw new P(28);if(null===k.fd)throw new P(8);if(1===(k.flags&2097155))throw new P(8);if(16384===(k.node.mode&61440))throw new P(31);if(!k.tb.read)throw new P(28);var B="undefined"!==typeof y;if(!B)y=k.position;else if(!k.seekable)throw new P(70);var u=k.tb.read(k,q,r,v,y);B||(k.position+=u);var O=u;if(0>O){var E=-1;break a}a+=O;if(O<
|
||||||
|
l)break}E=a}w()[d>>2]=E;return 0}catch(C){return"undefined"!==typeof xc&&C instanceof P||J(C),C.Gb}}
|
||||||
|
function Ed(a,b,c,d,f){if(G)return T(7,1,a,b,c,d,f);try{var g=Ac(a);a=4294967296*c+(b>>>0);if(-9007199254740992>=a||9007199254740992<=a)return-61;rc(g,a,d);mb=[g.position>>>0,(lb=g.position,1<=+$a(lb)?0<lb?(cb(+bb(lb/4294967296),4294967295)|0)>>>0:~~+ab((lb-+(~~lb>>>0))/4294967296)>>>0:0)];w()[f>>2]=mb[0];w()[f+4>>2]=mb[1];g.Yb&&0===a&&0===d&&(g.Yb=null);return 0}catch(h){return"undefined"!==typeof xc&&h instanceof P||J(h),h.Gb}}
|
||||||
|
function Fd(a,b,c,d){if(G)return T(8,1,a,b,c,d);try{a:{for(var f=Ac(a),g=a=0;g<c;g++){var h=w()[b+8*g>>2],l=w()[b+(8*g+4)>>2],k=f,q=e(),r=h,v=l,y=void 0;if(0>v||0>y)throw new P(28);if(null===k.fd)throw new P(8);if(0===(k.flags&2097155))throw new P(8);if(16384===(k.node.mode&61440))throw new P(31);if(!k.tb.write)throw new P(28);k.seekable&&k.flags&1024&&rc(k,0,2);var B="undefined"!==typeof y;if(!B)y=k.position;else if(!k.seekable)throw new P(70);var u=k.tb.write(k,q,r,v,y,void 0);B||(k.position+=u);
|
||||||
|
try{if(k.path&&Yb.onWriteToFile)Yb.onWriteToFile(k.path)}catch(C){K("FS.trackingDelegate['onWriteToFile']('"+k.path+"') threw an exception: "+C.message)}var O=u;if(0>O){var E=-1;break a}a+=O}E=a}w()[d>>2]=E;return 0}catch(C){return"undefined"!==typeof xc&&C instanceof P||J(C),C.Gb}}
|
||||||
|
function zb(a){if(G)throw"Internal Error! spawnThread() can only ever be called from main application thread!";var b=L.zc();if(void 0!==b.wb)throw"Internal error!";if(!a.Kb)throw"Internal error, no pthread ptr!";L.Fb.push(b);for(var c=R(512),d=0;128>d;++d)w()[c+4*d>>2]=0;var f=a.Ib+a.Lb;d=L.Ab[a.Kb]={worker:b,Ib:a.Ib,Lb:a.Lb,Vb:a.Vb,tc:a.Kb,threadInfoStruct:a.Kb};var g=d.threadInfoStruct>>2;Atomics.store(x(),g,0);Atomics.store(x(),g+1,0);Atomics.store(x(),g+2,0);Atomics.store(x(),g+17,a.detached);
|
||||||
|
Atomics.store(x(),g+26,c);Atomics.store(x(),g+12,0);Atomics.store(x(),g+10,d.threadInfoStruct);Atomics.store(x(),g+11,42);Atomics.store(x(),g+27,a.Lb);Atomics.store(x(),g+21,a.Lb);Atomics.store(x(),g+20,f);Atomics.store(x(),g+29,f);Atomics.store(x(),g+30,a.detached);Atomics.store(x(),g+32,a.rc);Atomics.store(x(),g+33,a.sc);c=Gd()+40;Atomics.store(x(),g+44,c);b.wb=d;var h={cmd:"run",start_routine:a.Xc,arg:a.Mb,threadInfoStruct:a.Kb,selfThreadId:a.Kb,parentThreadId:a.Mc,stackBase:a.Ib,stackSize:a.Lb};
|
||||||
|
b.Nb=function(){h.time=performance.now();b.postMessage(h,a.$c)};b.loaded&&(b.Nb(),delete b.Nb)}function Hd(){return qb|0}z._pthread_self=Hd;
|
||||||
|
function Id(a,b){if(!a)return K("pthread_join attempted on a null thread pointer!"),71;if(G&&selfThreadId==a)return K("PThread "+a+" is attempting to join to itself!"),16;if(!G&&L.vb==a)return K("Main thread "+a+" is attempting to join to itself!"),16;if(w()[a+12>>2]!==a)return K("pthread_join attempted on thread "+a+", which does not point to a valid thread, or does not exist anymore!"),71;if(Atomics.load(x(),a+68>>2))return K("Attempted to join thread "+a+", which was already detached!"),28;for(ld();;){var c=
|
||||||
|
Atomics.load(x(),a+0>>2);if(1==c)return c=Atomics.load(x(),a+4>>2),b&&(w()[b>>2]=c),Atomics.store(x(),a+68>>2,1),G?postMessage({cmd:"cleanupThread",thread:a}):vb(a),0;if(G&&threadInfoStruct&&!Atomics.load(x(),threadInfoStruct+60>>2)&&2==Atomics.load(x(),threadInfoStruct+0>>2))throw"Canceled!";G||yb();md(a+0,c,G?100:1)}}G?L.Hc():L.Fc();function dc(a,b,c,d){a||(a=this);this.parent=a;this.Db=a.Db;this.Sb=null;this.id=Vb++;this.name=b;this.mode=c;this.sb={};this.tb={};this.rdev=d}
|
||||||
|
Object.defineProperties(dc.prototype,{read:{get:function(){return 365===(this.mode&365)},set:function(a){a?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146===(this.mode&146)},set:function(a){a?this.mode|=146:this.mode&=-147}}});sc();Wb=Array(4096);lc(Q,"/");S("/tmp");S("/home");S("/home/web_user");
|
||||||
|
(function(){S("/dev");Kb(259,{read:function(){return 0},write:function(d,f,g,h){return h}});nc("/dev/null",259);Jb(1280,Mb);Jb(1536,Nb);nc("/dev/tty",1280);nc("/dev/tty1",1536);if("object"===typeof crypto&&"function"===typeof crypto.getRandomValues){var a=new Uint8Array(1);var b=function(){crypto.getRandomValues(a);return a[0]}}else if(F)try{var c=require("crypto");b=function(){return c.randomBytes(1)[0]}}catch(d){}b||(b=function(){J("random_device")});vc("random",b);vc("urandom",b);S("/dev/shm");
|
||||||
|
S("/dev/shm/tmp")})();S("/proc");S("/proc/self");S("/proc/self/fd");lc({Db:function(){var a=Pb("/proc/self","fd",16895,73);a.sb={lookup:function(b,c){var d=Ub[+c];if(!d)throw new P(8);b={parent:null,Db:{nc:"fake"},sb:{readlink:function(){return d.path}}};return b.parent=b}};return a}},"/proc/self/fd");Oc=z.InternalError=Nc("InternalError");for(var Jd=Array(256),Kd=0;256>Kd;++Kd)Jd[Kd]=String.fromCharCode(Kd);Rc=Jd;Sc=z.BindingError=Nc("BindingError");
|
||||||
|
z.count_emval_handles=function(){for(var a=0,b=5;b<X.length;++b)void 0!==X[b]&&++a;return a};z.get_first_emval=function(){for(var a=5;a<X.length;++a)if(void 0!==X[a])return X[a];return null};cd=z.UnboundTypeError=Nc("UnboundTypeError");
|
||||||
|
var Ld=[null,Bc,Dc,Ec,vd,Cd,Dd,Ed,Fd],Vd={n:function(a,b,c,d){J("Assertion failed: "+Ja(a)+", at: "+[b?Ja(b):"unknown filename",c,d?Ja(d):"unknown function"])},ga:function(a,b){return Bb(a,b)},D:Bc,Z:Dc,_:Ec,K:function(a){var b=Fc[a];delete Fc[a];var c=b.Nc,d=b.Oc,f=b.hc,g=f.map(function(h){return h.Cc}).concat(f.map(function(h){return h.Vc}));Pc([a],g,function(h){var l={};f.forEach(function(k,q){var r=h[q],v=k.Ac,y=k.Bc,B=h[q+f.length],u=k.Uc,O=k.Wc;l[k.xc]={read:function(E){return r.fromWireType(v(y,
|
||||||
|
E))},write:function(E,C){var Ba=[];u(O,E,B.toWireType(Ba,C));Gc(Ba)}}});return[{name:b.name,fromWireType:function(k){var q={},r;for(r in l)q[r]=l[r].read(k);d(k);return q},toWireType:function(k,q){for(var r in l)if(!(r in q))throw new TypeError('Missing field: "'+r+'"');var v=c();for(r in l)l[r].write(v,q[r]);null!==k&&k.push(d,v);return v},argPackAdvance:8,readValueFromPointer:Hc,Cb:d}]})},ba:function(a,b,c,d,f){var g=Qc(c);b=V(b);U(a,{name:b,fromWireType:function(h){return!!h},toWireType:function(h,
|
||||||
|
l){return l?d:f},argPackAdvance:8,readValueFromPointer:function(h){if(1===c)var l=e();else if(2===c)l=ca();else if(4===c)l=w();else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(l[h>>g])},Cb:null})},aa:function(a,b){b=V(b);U(a,{name:b,fromWireType:function(c){var d=X[c].value;Uc(c);return d},toWireType:function(c,d){return Vc(d)},argPackAdvance:8,readValueFromPointer:Hc,Cb:null})},F:function(a,b,c){c=Qc(c);b=V(b);U(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,
|
||||||
|
f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+Wc(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:Xc(b,c),Cb:null})},J:function(a,b,c,d,f,g){var h=ad(b,c);a=V(a);f=bd(d,f);$c(a,function(){fd("Cannot call "+a+" due to unbound types",h)},b-1);Pc([],h,function(l){var k=[l[0],null].concat(l.slice(1)),q=l=a,r=f,v=k.length;2>v&&W("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var y=null!==k[1]&&!1,B=!1,
|
||||||
|
u=1;u<k.length;++u)if(null!==k[u]&&void 0===k[u].Cb){B=!0;break}var O="void"!==k[0].name,E="",C="";for(u=0;u<v-2;++u)E+=(0!==u?", ":"")+"arg"+u,C+=(0!==u?", ":"")+"arg"+u+"Wired";q="return function "+Lc(q)+"("+E+") {\nif (arguments.length !== "+(v-2)+") {\nthrowBindingError('function "+q+" called with ' + arguments.length + ' arguments, expected "+(v-2)+" args!');\n}\n";B&&(q+="var destructors = [];\n");var Ba=B?"destructors":"null";E="throwBindingError invoker fn runDestructors retType classParam".split(" ");
|
||||||
|
r=[W,r,g,Gc,k[0],k[1]];y&&(q+="var thisWired = classParam.toWireType("+Ba+", this);\n");for(u=0;u<v-2;++u)q+="var arg"+u+"Wired = argType"+u+".toWireType("+Ba+", arg"+u+"); // "+k[u+2].name+"\n",E.push("argType"+u),r.push(k[u+2]);y&&(C="thisWired"+(0<C.length?", ":"")+C);q+=(O?"var rv = ":"")+"invoker(fn"+(0<C.length?", ":"")+C+");\n";if(B)q+="runDestructors(destructors);\n";else for(u=y?1:2;u<k.length;++u)v=1===u?"thisWired":"arg"+(u-2)+"Wired",null!==k[u].Cb&&(q+=v+"_dtor("+v+"); // "+k[u].name+
|
||||||
|
"\n",E.push(v+"_dtor"),r.push(k[u].Cb));O&&(q+="var ret = retType.fromWireType(rv);\nreturn ret;\n");E.push(q+"}\n");k=Yc(E).apply(null,r);u=b-1;if(!z.hasOwnProperty(l))throw new Oc("Replacing nonexistant public symbol");void 0!==z[l].zb&&void 0!==u?z[l].zb[u]=k:(z[l]=k,z[l].uc=u);return[]})},o:function(a,b,c,d,f){function g(q){return q}b=V(b);-1===f&&(f=4294967295);var h=Qc(c);if(0===d){var l=32-8*c;g=function(q){return q<<l>>>l}}var k=-1!=b.indexOf("unsigned");U(a,{name:b,fromWireType:g,toWireType:function(q,
|
||||||
|
r){if("number"!==typeof r&&"boolean"!==typeof r)throw new TypeError('Cannot convert "'+Wc(r)+'" to '+this.name);if(r<d||r>f)throw new TypeError('Passing a number "'+Wc(r)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+f+"]!");return k?r>>>0:r|0},argPackAdvance:8,readValueFromPointer:gd(b,h,0!==d),Cb:null})},j:function(a,b,c){function d(g){g>>=2;var h=x();return new f(n,h[g+1],h[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,
|
||||||
|
Uint32Array,Float32Array,Float64Array][b];c=V(c);U(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{Dc:!0})},G:function(a,b){b=V(b);var c="std::string"===b;U(a,{name:b,fromWireType:function(d){var f=x()[d>>2];if(c)for(var g=d+4,h=0;h<=f;++h){var l=d+4+h;if(h==f||0==t()[l]){g=Ja(g,l-g);if(void 0===k)var k=g;else k+=String.fromCharCode(0),k+=g;g=l+1}}else{k=Array(f);for(h=0;h<f;++h)k[h]=String.fromCharCode(t()[d+4+h]);k=k.join("")}M(d);return k},toWireType:function(d,f){f instanceof
|
||||||
|
ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||W("Cannot pass non-string to std::string");var h=(c&&g?function(){return Ma(f)}:function(){return f.length})(),l=R(4+h+1);x()[l>>2]=h;if(c&&g)La(f,l+4,h+1);else if(g)for(g=0;g<h;++g){var k=f.charCodeAt(g);255<k&&(M(l),W("String has UTF-16 code units that do not fit in 8 bits"));t()[l+4+g]=k}else for(g=0;g<h;++g)t()[l+4+g]=f[g];null!==d&&d.push(M,l);return l},
|
||||||
|
argPackAdvance:8,readValueFromPointer:Hc,Cb:function(d){M(d)}})},x:function(a,b,c){c=V(c);if(2===b){var d=Na;var f=Oa;var g=Pa;var h=function(){return ea()};var l=1}else 4===b&&(d=Qa,f=Ra,g=Sa,h=function(){return x()},l=2);U(a,{name:c,fromWireType:function(k){for(var q=x()[k>>2],r=h(),v,y=k+4,B=0;B<=q;++B){var u=k+4+B*b;if(B==q||0==r[u>>l])y=d(y,u-y),void 0===v?v=y:(v+=String.fromCharCode(0),v+=y),y=u+b}M(k);return v},toWireType:function(k,q){"string"!==typeof q&&W("Cannot pass non-string to C++ string type "+
|
||||||
|
c);var r=g(q),v=R(4+r+b);x()[v>>2]=r>>l;f(q,v+4,r+b);null!==k&&k.push(M,v);return v},argPackAdvance:8,readValueFromPointer:Hc,Cb:function(k){M(k)}})},N:function(a,b,c,d,f,g){Fc[a]={name:V(b),Nc:bd(c,d),Oc:bd(f,g),hc:[]}},p:function(a,b,c,d,f,g,h,l,k,q){Fc[a].hc.push({xc:V(b),Cc:c,Ac:bd(d,f),Bc:g,Vc:h,Uc:bd(l,k),Wc:q})},ca:function(a,b){b=V(b);U(a,{md:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},T:function(a,b){if(a==b)postMessage({cmd:"processQueuedMainThreadWork"});
|
||||||
|
else if(G)postMessage({targetThread:a,cmd:"processThreadQueue"});else{a=(a=L.Ab[a])&&a.worker;if(!a)return;a.postMessage({cmd:"processThreadQueue"})}return 1},w:Uc,$:function(a){if(0===a)return Vc(id());var b=hd[a];a=void 0===b?V(a):b;return Vc(id()[a])},I:function(a){4<a&&(X[a].ac+=1)},U:function(a,b,c,d){a||W("Cannot use deleted val. handle = "+a);a=X[a].value;var f=kd[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var h="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";
|
||||||
|
for(g=0;g<b;++g)h+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",h+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(jd,z,Vc);kd[b]=f}return f(a,c,d)},k:function(){J()},u:function(a,b,c){qd.length=0;var d;for(c>>=2;d=t()[b++];)(d=105>d)&&c&1&&c++,
|
||||||
|
qd.push(d?la()[c++>>1]:w()[c]),++c;return ob[a].apply(null,qd)},X:ld,A:function(){},g:md,h:ub,e:Ab,r:function(){return sb|0},V:function(){return rb|0},i:function(a,b){Z(a,b||1);throw"longjmp";},P:function(a,b,c){t().copyWithin(a,b,b+c)},fa:function(){return navigator.hardwareConcurrency},Q:function(a,b,c){pd.length=b;c>>=3;for(var d=0;d<b;d++)pd[d]=la()[c+d];return(0>a?ob[-a-1]:Ld[a]).apply(null,pd)},s:function(a){a>>>=0;var b=t().length;if(a<=b||2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=
|
||||||
|
b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(16777216,a,d);0<d%65536&&(d+=65536-d%65536);a:{try{m.grow(Math.min(2147483648,d)-n.byteLength+65535>>>16);p(m.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},R:function(a,b,c){return sd(a)?td(a,b,c):vd(a,b,c)},f:function(){},S:function(a,b){var c={};b>>=2;c.alpha=!!w()[b];c.depth=!!w()[b+1];c.stencil=!!w()[b+2];c.antialias=!!w()[b+3];c.premultipliedAlpha=!!w()[b+4];c.preserveDrawingBuffer=!!w()[b+5];var d=w()[b+6];c.powerPreference=
|
||||||
|
Bd[d];c.failIfMajorPerformanceCaveat=!!w()[b+7];c.Jc=w()[b+8];c.od=w()[b+9];c.ec=w()[b+10];c.wc=w()[b+11];c.rd=w()[b+12];c.td=w()[b+13];(a=sd(a))?c.wc?c=-1:(a=a.getContext("webgl",c))?(b=R(8),w()[b+4>>2]=qb|0,d={ld:b,attributes:c,version:c.Jc,Ob:a},a.canvas&&(a.canvas.Pb=d),("undefined"===typeof c.ec||c.ec)&&zd(d),c=b):c=0:c=-4;return c},E:Cd,Y:Dd,L:Ed,C:Fd,b:function(){return Da|0},O:function(){L.Gc()},z:Md,M:Nd,y:Od,t:Pd,v:Qd,l:Rd,c:Sd,memory:m||z.wasmMemory,W:function(a){var b=L.Ub.pop();a&&b()},
|
||||||
|
B:Bb,H:function(a,b,c,d){if("undefined"===typeof SharedArrayBuffer)return K("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;if(!a)return K("pthread_create called with a null thread pointer!"),28;var f=[];if(G&&0===f.length)return Td(687865856,a,b,c,d);var g=0,h=0,l=0,k=0;if(b){var q=w()[b>>2];q+=81920;g=w()[b+8>>2];h=0!==w()[b+12>>2];if(0===w()[b+16>>2]){var r=w()[b+20>>2],v=w()[b+24>>2];l=b+20;k=b+24;var y=L.Wb?L.Wb:qb|0;if(l||k)if(y)if(w()[y+12>>2]!==y)K("pthread_getschedparam attempted on thread "+
|
||||||
|
y+", which does not point to a valid thread, or does not exist anymore!");else{var B=Atomics.load(x(),y+108+20>>2);y=Atomics.load(x(),y+108+24>>2);l&&(w()[l>>2]=B);k&&(w()[k>>2]=y)}else K("pthread_getschedparam called with a null thread pointer!");l=w()[b+20>>2];k=w()[b+24>>2];w()[b+20>>2]=r;w()[b+24>>2]=v}else l=w()[b+20>>2],k=w()[b+24>>2]}else q=2097152;(b=0==g)?g=Ud(16,q):(g-=q,assert(0<g));r=R(232);for(v=0;58>v;++v)x()[(r>>2)+v]=0;w()[a>>2]=r;w()[r+12>>2]=r;a=r+156;w()[a>>2]=a;c={Ib:g,Lb:q,Vb:b,
|
||||||
|
rc:l,sc:k,detached:h,Xc:c,Kb:r,Mc:qb|0,Mb:d,$c:f};G?(c.ed="spawnThread",postMessage(c,f)):zb(c);return 0},da:function(a,b){return Id(a,b)},d:Hd,q:function(a){a=+a;return 0<=a?+bb(a+.5):+ab(a-.5)},m:function(a){a=+a;return 0<=a?+bb(a+.5):+ab(a-.5)},a:function(a){Da=a|0},table:Fa,ea:function(a){var b=Date.now()/1E3|0;a&&(w()[a>>2]=b);return b}};
|
||||||
|
(function(){function a(f,g){z.asm=f.exports;Ga=g;if(!G){var h=L.xb.length;L.xb.forEach(function(l){L.lc(l,function(){if(!--h&&(db--,z.monitorRunDependencies&&z.monitorRunDependencies(db),0==db&&(null!==eb&&(clearInterval(eb),eb=null),fb))){var k=fb;fb=null;k()}})})}}function b(f){a(f.instance,f.module)}function c(f){return kb().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){K("failed to asynchronously prepare wasm: "+g);J(g)})}var d={a:Vd};G||(assert(!G,"addRunDependency cannot be used in a pthread worker"),
|
||||||
|
db++,z.monitorRunDependencies&&z.monitorRunDependencies(db));if(z.instantiateWasm)try{return z.instantiateWasm(d,a)}catch(f){return K("Module.instantiateWasm callback failed with error: "+f),!1}(function(){if(Ea||"function"!==typeof WebAssembly.instantiateStreaming||ib()||gb("file://")||"function"!==typeof fetch)return c(b);fetch(hb,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(b,function(g){K("wasm streaming compile failed: "+g);K("falling back to ArrayBuffer instantiation");
|
||||||
|
return c(b)})})})();return{}})();var pb=z.___wasm_call_ctors=function(){return(pb=z.___wasm_call_ctors=z.asm.ha).apply(null,arguments)},R=z._malloc=function(){return(R=z._malloc=z.asm.ia).apply(null,arguments)},M=z._free=function(){return(M=z._free=z.asm.ja).apply(null,arguments)},ed=z.___getTypeName=function(){return(ed=z.___getTypeName=z.asm.ka).apply(null,arguments)};
|
||||||
|
z.___embind_register_native_and_builtin_types=function(){return(z.___embind_register_native_and_builtin_types=z.asm.la).apply(null,arguments)};var Gd=z._emscripten_get_global_libc=function(){return(Gd=z._emscripten_get_global_libc=z.asm.ma).apply(null,arguments)},Cc=z.___errno_location=function(){return(Cc=z.___errno_location=z.asm.na).apply(null,arguments)};z.___em_js__initPthreadsJS=function(){return(z.___em_js__initPthreadsJS=z.asm.oa).apply(null,arguments)};
|
||||||
|
var Z=z._setThrew=function(){return(Z=z._setThrew=z.asm.pa).apply(null,arguments)},Y=z.stackSave=function(){return(Y=z.stackSave=z.asm.qa).apply(null,arguments)},N=z.stackRestore=function(){return(N=z.stackRestore=z.asm.ra).apply(null,arguments)},nd=z.stackAlloc=function(){return(nd=z.stackAlloc=z.asm.sa).apply(null,arguments)},Ud=z._memalign=function(){return(Ud=z._memalign=z.asm.ta).apply(null,arguments)};
|
||||||
|
z._emscripten_main_browser_thread_id=function(){return(z._emscripten_main_browser_thread_id=z.asm.ua).apply(null,arguments)};var xb=z.___pthread_tsd_run_dtors=function(){return(xb=z.___pthread_tsd_run_dtors=z.asm.va).apply(null,arguments)},yb=z._emscripten_main_thread_process_queued_calls=function(){return(yb=z._emscripten_main_thread_process_queued_calls=z.asm.wa).apply(null,arguments)};
|
||||||
|
z._emscripten_current_thread_process_queued_calls=function(){return(z._emscripten_current_thread_process_queued_calls=z.asm.xa).apply(null,arguments)};var wb=z._emscripten_register_main_browser_thread_id=function(){return(wb=z._emscripten_register_main_browser_thread_id=z.asm.ya).apply(null,arguments)},nb=z._do_emscripten_dispatch_to_thread=function(){return(nb=z._do_emscripten_dispatch_to_thread=z.asm.za).apply(null,arguments)};
|
||||||
|
z._emscripten_async_run_in_main_thread=function(){return(z._emscripten_async_run_in_main_thread=z.asm.Aa).apply(null,arguments)};z._emscripten_sync_run_in_main_thread=function(){return(z._emscripten_sync_run_in_main_thread=z.asm.Ba).apply(null,arguments)};z._emscripten_sync_run_in_main_thread_0=function(){return(z._emscripten_sync_run_in_main_thread_0=z.asm.Ca).apply(null,arguments)};
|
||||||
|
z._emscripten_sync_run_in_main_thread_1=function(){return(z._emscripten_sync_run_in_main_thread_1=z.asm.Da).apply(null,arguments)};z._emscripten_sync_run_in_main_thread_2=function(){return(z._emscripten_sync_run_in_main_thread_2=z.asm.Ea).apply(null,arguments)};z._emscripten_sync_run_in_main_thread_xprintf_varargs=function(){return(z._emscripten_sync_run_in_main_thread_xprintf_varargs=z.asm.Fa).apply(null,arguments)};
|
||||||
|
z._emscripten_sync_run_in_main_thread_3=function(){return(z._emscripten_sync_run_in_main_thread_3=z.asm.Ga).apply(null,arguments)};var Td=z._emscripten_sync_run_in_main_thread_4=function(){return(Td=z._emscripten_sync_run_in_main_thread_4=z.asm.Ha).apply(null,arguments)};z._emscripten_sync_run_in_main_thread_5=function(){return(z._emscripten_sync_run_in_main_thread_5=z.asm.Ia).apply(null,arguments)};
|
||||||
|
z._emscripten_sync_run_in_main_thread_6=function(){return(z._emscripten_sync_run_in_main_thread_6=z.asm.Ja).apply(null,arguments)};z._emscripten_sync_run_in_main_thread_7=function(){return(z._emscripten_sync_run_in_main_thread_7=z.asm.Ka).apply(null,arguments)};
|
||||||
|
var od=z._emscripten_run_in_main_runtime_thread_js=function(){return(od=z._emscripten_run_in_main_runtime_thread_js=z.asm.La).apply(null,arguments)},ud=z.__emscripten_call_on_thread=function(){return(ud=z.__emscripten_call_on_thread=z.asm.Ma).apply(null,arguments)};z._emscripten_tls_init=function(){return(z._emscripten_tls_init=z.asm.Na).apply(null,arguments)};
|
||||||
|
var Cb=z.dynCall_vi=function(){return(Cb=z.dynCall_vi=z.asm.Oa).apply(null,arguments)},Wd=z.dynCall_vii=function(){return(Wd=z.dynCall_vii=z.asm.Pa).apply(null,arguments)};z.dynCall_viii=function(){return(z.dynCall_viii=z.asm.Qa).apply(null,arguments)};var Xd=z.dynCall_viiii=function(){return(Xd=z.dynCall_viiii=z.asm.Ra).apply(null,arguments)};z.dynCall_viiiiiiiiii=function(){return(z.dynCall_viiiiiiiiii=z.asm.Sa).apply(null,arguments)};
|
||||||
|
var Yd=z.dynCall_iii=function(){return(Yd=z.dynCall_iii=z.asm.Ta).apply(null,arguments)},Zd=z.dynCall_iiii=function(){return(Zd=z.dynCall_iiii=z.asm.Ua).apply(null,arguments)},$d=z.dynCall_iiiii=function(){return($d=z.dynCall_iiiii=z.asm.Va).apply(null,arguments)},ae=z.dynCall_iiiiiiiii=function(){return(ae=z.dynCall_iiiiiiiii=z.asm.Wa).apply(null,arguments)};z.dynCall_i=function(){return(z.dynCall_i=z.asm.Xa).apply(null,arguments)};
|
||||||
|
z.dynCall_iiiiii=function(){return(z.dynCall_iiiiii=z.asm.Ya).apply(null,arguments)};z.dynCall_viiiii=function(){return(z.dynCall_viiiii=z.asm.Za).apply(null,arguments)};z.dynCall_iiiiiii=function(){return(z.dynCall_iiiiiii=z.asm._a).apply(null,arguments)};z.dynCall_viiiiii=function(){return(z.dynCall_viiiiii=z.asm.$a).apply(null,arguments)};z.dynCall_viiiiiii=function(){return(z.dynCall_viiiiiii=z.asm.ab).apply(null,arguments)};
|
||||||
|
z.dynCall_viiiiiiiiiii=function(){return(z.dynCall_viiiiiiiiiii=z.asm.bb).apply(null,arguments)};z.dynCall_ii=function(){return(z.dynCall_ii=z.asm.cb).apply(null,arguments)};z.dynCall_v=function(){return(z.dynCall_v=z.asm.db).apply(null,arguments)};z.dynCall_iiiiiiii=function(){return(z.dynCall_iiiiiiii=z.asm.eb).apply(null,arguments)};z.dynCall_iiiiiiiiii=function(){return(z.dynCall_iiiiiiiiii=z.asm.fb).apply(null,arguments)};
|
||||||
|
z.dynCall_iiiiiiiiiiii=function(){return(z.dynCall_iiiiiiiiiiii=z.asm.gb).apply(null,arguments)};z.dynCall_viiiiiiii=function(){return(z.dynCall_viiiiiiii=z.asm.hb).apply(null,arguments)};z.dynCall_jiiiiiiiii=function(){return(z.dynCall_jiiiiiiiii=z.asm.ib).apply(null,arguments)};z.dynCall_jiji=function(){return(z.dynCall_jiji=z.asm.jb).apply(null,arguments)};z.dynCall_iidiiii=function(){return(z.dynCall_iidiiii=z.asm.kb).apply(null,arguments)};
|
||||||
|
z.dynCall_viiiiiiiiiiiii=function(){return(z.dynCall_viiiiiiiiiiiii=z.asm.lb).apply(null,arguments)};z.dynCall_jiiiiiiii=function(){return(z.dynCall_jiiiiiiii=z.asm.mb).apply(null,arguments)};z.dynCall_ff=function(){return(z.dynCall_ff=z.asm.nb).apply(null,arguments)};z.dynCall_jiiiiii=function(){return(z.dynCall_jiiiiii=z.asm.ob).apply(null,arguments)};z.dynCall_jiiiii=function(){return(z.dynCall_jiiiii=z.asm.pb).apply(null,arguments)};
|
||||||
|
z.dynCall_iiijii=function(){return(z.dynCall_iiijii=z.asm.qb).apply(null,arguments)};function Qd(a,b){var c=Y();try{Cb(a,b)}catch(d){N(c);if(d!==d+0&&"longjmp"!==d)throw d;Z(1,0)}}function Sd(a,b,c,d,f){var g=Y();try{Xd(a,b,c,d,f)}catch(h){N(g);if(h!==h+0&&"longjmp"!==h)throw h;Z(1,0)}}function Rd(a,b,c){var d=Y();try{Wd(a,b,c)}catch(f){N(d);if(f!==f+0&&"longjmp"!==f)throw f;Z(1,0)}}
|
||||||
|
function Pd(a,b,c,d,f,g,h,l,k){var q=Y();try{return ae(a,b,c,d,f,g,h,l,k)}catch(r){N(q);if(r!==r+0&&"longjmp"!==r)throw r;Z(1,0)}}function Md(a,b,c){var d=Y();try{return Yd(a,b,c)}catch(f){N(d);if(f!==f+0&&"longjmp"!==f)throw f;Z(1,0)}}function Od(a,b,c,d,f){var g=Y();try{return $d(a,b,c,d,f)}catch(h){N(g);if(h!==h+0&&"longjmp"!==h)throw h;Z(1,0)}}function Nd(a,b,c,d){var f=Y();try{return Zd(a,b,c,d)}catch(g){N(f);if(g!==g+0&&"longjmp"!==g)throw g;Z(1,0)}}z.PThread=L;z.PThread=L;z._pthread_self=Hd;
|
||||||
|
z.wasmMemory=m;z.ExitStatus=ya;var be;function ya(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}fb=function ce(){be||de();be||(fb=ce)};
|
||||||
|
function de(){function a(){if(!be&&(be=!0,z.calledRun=!0,!Ha)){z.noFSInit||tc||(tc=!0,sc(),z.stdin=z.stdin,z.stdout=z.stdout,z.stderr=z.stderr,z.stdin?vc("stdin",z.stdin):oc("/dev/tty","/dev/stdin"),z.stdout?vc("stdout",null,z.stdout):oc("/dev/tty","/dev/stdout"),z.stderr?vc("stderr",null,z.stderr):oc("/dev/tty1","/dev/stderr"),pc("/dev/stdin","r"),pc("/dev/stdout","w"),pc("/dev/stderr","w"));Ua(Wa);G||(Xb=!1,Ua(Xa));na(z);if(z.onRuntimeInitialized)z.onRuntimeInitialized();if(!G){if(z.postRun)for("function"==
|
||||||
|
typeof z.postRun&&(z.postRun=[z.postRun]);z.postRun.length;){var b=z.postRun.shift();Ya.unshift(b)}Ua(Ya)}}}if(!(0<db)){if(!G){if(z.preRun)for("function"==typeof z.preRun&&(z.preRun=[z.preRun]);z.preRun.length;)Za();Ua(Va)}0<db||(z.setStatus?(z.setStatus("Running..."),setTimeout(function(){setTimeout(function(){z.setStatus("")},1);a()},1)):a())}}z.run=de;if(z.preInit)for("function"==typeof z.preInit&&(z.preInit=[z.preInit]);0<z.preInit.length;)z.preInit.pop()();G||(noExitRuntime=!0);
|
||||||
|
G?(z.___embind_register_native_and_builtin_types(),na(z)):de();
|
||||||
|
|
||||||
|
|
||||||
|
return avif_enc_mt.ready
|
||||||
|
}
|
||||||
|
);
|
||||||
|
})();
|
||||||
|
if (typeof exports === 'object' && typeof module === 'object')
|
||||||
|
module.exports = avif_enc_mt;
|
||||||
|
else if (typeof define === 'function' && define['amd'])
|
||||||
|
define([], function() { return avif_enc_mt; });
|
||||||
|
else if (typeof exports === 'object')
|
||||||
|
exports["avif_enc_mt"] = avif_enc_mt;
|
||||||
|
|
||||||
BIN
codecs/avif/enc/avif_enc_mt.wasm
Normal file
BIN
codecs/avif/enc/avif_enc_mt.wasm
Normal file
Binary file not shown.
1
codecs/avif/enc/avif_enc_mt.worker.js
Normal file
1
codecs/avif/enc/avif_enc_mt.worker.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
var threadInfoStruct=0;var selfThreadId=0;var parentThreadId=0;var Module={};function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:selfThreadId})}var err=threadPrintErr;this.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);Module["wasmModule"]=null;receiveInstance(instance);return instance.exports};this.onmessage=function(e){try{if(e.data.cmd==="load"){Module["DYNAMIC_BASE"]=e.data.DYNAMIC_BASE;Module["DYNAMICTOP_PTR"]=e.data.DYNAMICTOP_PTR;Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob==="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}avif_enc_mt(Module).then(function(instance){Module=instance;postMessage({"cmd":"loaded"})})}else if(e.data.cmd==="objectTransfer"){Module["PThread"].receiveObjectTransfer(e.data)}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;threadInfoStruct=e.data.threadInfoStruct;Module["registerPthreadPtr"](threadInfoStruct,/*isMainBrowserThread=*/0,/*isMainRuntimeThread=*/0);selfThreadId=e.data.selfThreadId;parentThreadId=e.data.parentThreadId;var max=e.data.stackBase;var top=e.data.stackBase+e.data.stackSize;Module["establishStackSpace"](top,max);Module["_emscripten_tls_init"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].setThreadStatus(Module["_pthread_self"](),1);/*EM_THREAD_STATUS_RUNNING*/try{var result=Module["dynCall_ii"](e.data.start_routine,e.data.arg);if(!Module["getNoExitRuntime"]())Module["PThread"].threadExit(result)}catch(ex){if(ex==="Canceled!"){Module["PThread"].threadCancel()}else if(ex!="unwind"){Atomics.store(Module["HEAPU32"],(threadInfoStruct+4)>>/*C_STRUCTS.pthread.threadExitCode*/2,(ex instanceof Module["ExitStatus"])?ex.status:-2);/*A custom entry specific to Emscripten denoting that the thread crashed.*/Atomics.store(Module["HEAPU32"],(threadInfoStruct+0)>>/*C_STRUCTS.pthread.threadStatus*/2,1);Module["_emscripten_futex_wake"](threadInfoStruct+0,/*C_STRUCTS.pthread.threadStatus*/2147483647);if(!(ex instanceof Module["ExitStatus"]))throw ex}}}else if(e.data.cmd==="cancel"){if(threadInfoStruct){Module["PThread"].threadCancel()}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(threadInfoStruct){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex.stack)err(ex.stack);throw ex}};if(typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string"){self={location:{href:__filename}};var onmessage=this.onmessage;var nodeWorkerThreads=require("worker_threads");global.Worker=nodeWorkerThreads.Worker;var parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",function(data){onmessage({data:data})});var nodeFS=require("fs");var nodeRead=function(filename){return nodeFS.readFileSync(filename,"utf8")};function globalEval(x){global.require=require;global.Module=Module;eval.call(null,x)}importScripts=function(f){globalEval(nodeRead(f))};postMessage=function(msg){parentPort.postMessage(msg)};if(typeof performance==="undefined"){performance={now:function(){return Date.now()}}}}
|
||||||
72
codecs/avif/helper.Makefile
Normal file
72
codecs/avif/helper.Makefile
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
# This is a helper Makefile for building LibAVIF + LibAOM with given params.
|
||||||
|
#
|
||||||
|
# Params that must be supplied by the caller:
|
||||||
|
# $(CODEC_DIR)
|
||||||
|
# $(LIBAOM_DIR)
|
||||||
|
# $(BUILD_DIR)
|
||||||
|
# $(OUT_JS)
|
||||||
|
# $(OUT_CPP)
|
||||||
|
# $(LIBAOM_FLAGS)
|
||||||
|
# $(LIBAVIF_FLAGS)
|
||||||
|
|
||||||
|
CODEC_BUILD_DIR := $(BUILD_DIR)/libavif
|
||||||
|
CODEC_OUT := $(CODEC_BUILD_DIR)/libavif.a
|
||||||
|
|
||||||
|
LIBAOM_BUILD_DIR := $(BUILD_DIR)/libaom
|
||||||
|
LIBAOM_OUT := $(LIBAOM_BUILD_DIR)/libaom.a
|
||||||
|
|
||||||
|
OUT_WASM = $(OUT_JS:.js=.wasm)
|
||||||
|
OUT_WORKER=$(OUT_JS:.js=.worker.js)
|
||||||
|
|
||||||
|
.PHONY: all clean
|
||||||
|
|
||||||
|
all: $(OUT_JS)
|
||||||
|
|
||||||
|
$(OUT_JS): $(OUT_CPP) $(LIBAOM_OUT) $(CODEC_OUT)
|
||||||
|
$(CXX) \
|
||||||
|
-I $(CODEC_DIR)/include \
|
||||||
|
$(CXXFLAGS) \
|
||||||
|
$(LDFLAGS) \
|
||||||
|
$(OUT_FLAGS) \
|
||||||
|
--bind \
|
||||||
|
--closure 1 \
|
||||||
|
-s ALLOW_MEMORY_GROWTH=1 \
|
||||||
|
-s MODULARIZE=1 \
|
||||||
|
-s 'EXPORT_NAME="$(basename $(@F))"' \
|
||||||
|
-o $@ \
|
||||||
|
$+
|
||||||
|
|
||||||
|
$(CODEC_OUT): $(CODEC_DIR)/CMakeLists.txt $(LIBAOM_OUT)
|
||||||
|
emcmake cmake \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DBUILD_SHARED_LIBS=0 \
|
||||||
|
-DAVIF_CODEC_AOM=1 \
|
||||||
|
-DAOM_LIBRARY=$(LIBAOM_OUT) \
|
||||||
|
-DAOM_INCLUDE_DIR=$(LIBAOM_DIR) \
|
||||||
|
$(LIBAVIF_FLAGS) \
|
||||||
|
-B $(CODEC_BUILD_DIR) \
|
||||||
|
$(CODEC_DIR) && \
|
||||||
|
$(MAKE) -C $(CODEC_BUILD_DIR)
|
||||||
|
|
||||||
|
$(LIBAOM_OUT): $(LIBAOM_DIR)/CMakeLists.txt
|
||||||
|
emcmake cmake \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DENABLE_CCACHE=0 \
|
||||||
|
-DAOM_TARGET_CPU=generic \
|
||||||
|
-DENABLE_DOCS=0 \
|
||||||
|
-DENABLE_TESTS=0 \
|
||||||
|
-DENABLE_EXAMPLES=0 \
|
||||||
|
-DENABLE_TOOLS=0 \
|
||||||
|
-DCONFIG_ACCOUNTING=1 \
|
||||||
|
-DCONFIG_INSPECTION=0 \
|
||||||
|
-DCONFIG_RUNTIME_CPU_DETECT=0 \
|
||||||
|
-DCONFIG_WEBM_IO=0 \
|
||||||
|
$(LIBAOM_FLAGS) \
|
||||||
|
-B $(LIBAOM_BUILD_DIR) \
|
||||||
|
$(LIBAOM_DIR) && \
|
||||||
|
$(MAKE) -C $(LIBAOM_BUILD_DIR)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM) $(OUT_JS) $(OUT_WASM) $(OUT_WORKER)
|
||||||
|
$(MAKE) -C $(CODEC_BUILD_DIR) clean
|
||||||
|
$(MAKE) -C $(LIBAOM_BUILD_DIR) clean
|
||||||
6
codecs/avif/package.json
Normal file
6
codecs/avif/package.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"name": "avif",
|
||||||
|
"scripts": {
|
||||||
|
"build": "../build-cpp.sh"
|
||||||
|
}
|
||||||
|
}
|
||||||
4
codecs/build-rust-nightly.sh
Normal file
4
codecs/build-rust-nightly.sh
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
set -e
|
||||||
|
|
||||||
|
docker build -t squoosh-rust-nightly --build-arg RUST_IMG=rustlang/rust:nightly - < ../rust.Dockerfile
|
||||||
|
docker run --rm -v $PWD:/src squoosh-rust-nightly "$@"
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
FROM emscripten/emsdk:1.39.19
|
FROM emscripten/emsdk:1.40.0
|
||||||
RUN apt-get update && apt-get install -qqy autoconf libtool pkg-config
|
RUN apt-get update && apt-get install -qqy autoconf libtool pkg-config
|
||||||
ENV CFLAGS "-Os -flto"
|
ENV CFLAGS "-O3 -flto"
|
||||||
ENV CXXFLAGS "${CFLAGS} -std=c++17"
|
ENV CXXFLAGS "${CFLAGS} -std=c++17"
|
||||||
ENV LDFLAGS "${CFLAGS}"
|
ENV LDFLAGS "${CFLAGS} -s PTHREAD_POOL_SIZE=navigator.hardwareConcurrency"
|
||||||
# Build and cache standard libraries with these flags
|
# Build and cache standard libraries with these flags
|
||||||
RUN emcc ${CXXFLAGS} --bind -xc++ /dev/null -o /dev/null
|
RUN emcc ${CXXFLAGS} --bind -xc++ /dev/null -o /dev/null
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|||||||
201
codecs/hqx/LICENSE.codec.md
Normal file
201
codecs/hqx/LICENSE.codec.md
Normal file
@@ -0,0 +1,201 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
5
codecs/hqx/README.md
Normal file
5
codecs/hqx/README.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# HQX
|
||||||
|
|
||||||
|
- Source: <https://github.com/CryZe/wasmboy-rs>
|
||||||
|
- Version: v0.1.2
|
||||||
|
- License: Apache 2.0
|
||||||
641
codecs/imagequant/LICENSE.codec.md
Normal file
641
codecs/imagequant/LICENSE.codec.md
Normal file
@@ -0,0 +1,641 @@
|
|||||||
|
|
||||||
|
libimagequant is derived from code by Jef Poskanzer and Greg Roelofs
|
||||||
|
licensed under pngquant's original license (at the end of this file),
|
||||||
|
and contains extensive changes and additions by Kornel Lesiński
|
||||||
|
licensed under GPL v3 or later.
|
||||||
|
|
||||||
|
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
libimagequant © 2009-2018 by Kornel Lesiński.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
© 1989, 1991 by Jef Poskanzer.
|
||||||
|
© 1997, 2000, 2002 by Greg Roelofs.
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and distribute this software and its
|
||||||
|
documentation for any purpose and without fee is hereby granted, provided
|
||||||
|
that the above copyright notice appear in all copies and that both that
|
||||||
|
copyright notice and this permission notice appear in supporting
|
||||||
|
documentation. This software is provided "as is" without express or
|
||||||
|
implied warranty.
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
- Source: <https://github.com/ImageOptim/libimagequant>
|
- Source: <https://github.com/ImageOptim/libimagequant>
|
||||||
- Version: v2.12.1
|
- Version: v2.12.1
|
||||||
|
- License: GPL3
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
const rawImage = Module.zx_quantize(image.data, image.width, image.height, 1.0);
|
const rawImage = Module.zx_quantize(image.data, image.width, image.height, 1.0);
|
||||||
console.log('done');
|
console.log('done');
|
||||||
|
|
||||||
const imageData = new ImageData(new Uint8ClampedArray(rawImage.buffer), rawImage.width, rawImage.height);
|
const imageData = new ImageData(new Uint8ClampedArray(rawImage.buffer), image.width, image.height);
|
||||||
const canvas = document.createElement('canvas');
|
const canvas = document.createElement('canvas');
|
||||||
canvas.width = image.width;
|
canvas.width = image.width;
|
||||||
canvas.height = image.height;
|
canvas.height = image.height;
|
||||||
|
|||||||
2
codecs/imagequant/imagequant.d.ts
vendored
2
codecs/imagequant/imagequant.d.ts
vendored
@@ -3,4 +3,4 @@ interface QuantizerModule extends EmscriptenWasm.Module {
|
|||||||
zx_quantize(data: BufferSource, width: number, height: number, dither: number): Uint8ClampedArray;
|
zx_quantize(data: BufferSource, width: number, height: number, dither: number): Uint8ClampedArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function(opts: EmscriptenWasm.ModuleOpts): QuantizerModule;
|
export default function(opts: EmscriptenWasm.ModuleOpts): Promise<QuantizerModule>;
|
||||||
|
|||||||
@@ -7,51 +7,51 @@ function(imagequant) {
|
|||||||
imagequant = imagequant || {};
|
imagequant = imagequant || {};
|
||||||
|
|
||||||
|
|
||||||
var d;d||(d=typeof imagequant !== 'undefined' ? imagequant : {});var aa;d.ready=new Promise(function(a){aa=a});var r={},t;for(t in d)d.hasOwnProperty(t)&&(r[t]=d[t]);var u=!1,v=!1,ba=!1,ca=!1;u="object"===typeof window;v="function"===typeof importScripts;ba="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;ca=!u&&!ba&&!v;var w="",x,z,da,ea;
|
var d;d||(d=typeof imagequant !== 'undefined' ? imagequant : {});var aa,ba;d.ready=new Promise(function(a,b){aa=a;ba=b});var r={},t;for(t in d)d.hasOwnProperty(t)&&(r[t]=d[t]);var u=!1,v=!1,ca=!1,da=!1;u="object"===typeof window;v="function"===typeof importScripts;ca="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;da=!u&&!ca&&!v;var w="",x,z,ea,fa;
|
||||||
if(ba)w=v?require("path").dirname(w)+"/":__dirname+"/",x=function(a,b){da||(da=require("fs"));ea||(ea=require("path"));a=ea.normalize(a);return da.readFileSync(a,b?null:"utf8")},z=function(a){a=x(a,!0);a.buffer||(a=new Uint8Array(a));a.buffer||A("Assertion failed: undefined");return a},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(a){throw a;}),process.on("unhandledRejection",A),d.inspect=function(){return"[Emscripten Module object]"};
|
if(ca)w=v?require("path").dirname(w)+"/":__dirname+"/",x=function(a,b){ea||(ea=require("fs"));fa||(fa=require("path"));a=fa.normalize(a);return ea.readFileSync(a,b?null:"utf8")},z=function(a){a=x(a,!0);a.buffer||(a=new Uint8Array(a));a.buffer||A("Assertion failed: undefined");return a},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(a){throw a;}),process.on("unhandledRejection",A),d.inspect=function(){return"[Emscripten Module object]"};
|
||||||
else if(ca)"undefined"!=typeof read&&(x=function(a){return read(a)}),z=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");"object"===typeof a||A("Assertion failed: undefined");return a},"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!==typeof printErr?printErr:print);else if(u||v)v?w=self.location.href:document.currentScript&&(w=document.currentScript.src),_scriptDir&&
|
else if(da)"undefined"!=typeof read&&(x=function(a){return read(a)}),z=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");"object"===typeof a||A("Assertion failed: undefined");return a},"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!==typeof printErr?printErr:print);else if(u||v)v?w=self.location.href:document.currentScript&&(w=document.currentScript.src),_scriptDir&&
|
||||||
(w=_scriptDir),0!==w.indexOf("blob:")?w=w.substr(0,w.lastIndexOf("/")+1):w="",x=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},v&&(z=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var fa=d.print||console.log.bind(console),B=d.printErr||console.warn.bind(console);for(t in r)r.hasOwnProperty(t)&&(d[t]=r[t]);r=null;var D;d.wasmBinary&&(D=d.wasmBinary);var noExitRuntime;
|
(w=_scriptDir),0!==w.indexOf("blob:")?w=w.substr(0,w.lastIndexOf("/")+1):w="",x=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},v&&(z=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var ha=d.print||console.log.bind(console),B=d.printErr||console.warn.bind(console);for(t in r)r.hasOwnProperty(t)&&(d[t]=r[t]);r=null;var D;d.wasmBinary&&(D=d.wasmBinary);var noExitRuntime;
|
||||||
d.noExitRuntime&&(noExitRuntime=d.noExitRuntime);"object"!==typeof WebAssembly&&A("no native wasm support detected");var E,ha=new WebAssembly.Table({initial:46,maximum:46,element:"anyfunc"}),ia=!1,ja="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
|
d.noExitRuntime&&(noExitRuntime=d.noExitRuntime);"object"!==typeof WebAssembly&&A("no native wasm support detected");var E,ia=new WebAssembly.Table({initial:39,maximum:39,element:"anyfunc"}),ja=!1,ka="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
|
||||||
function ka(a,b,c){var e=b+c;for(c=b;a[c]&&!(c>=e);)++c;if(16<c-b&&a.subarray&&ja)return ja.decode(a.subarray(b,c));for(e="";b<c;){var f=a[b++];if(f&128){var g=a[b++]&63;if(192==(f&224))e+=String.fromCharCode((f&31)<<6|g);else{var l=a[b++]&63;f=224==(f&240)?(f&15)<<12|g<<6|l:(f&7)<<18|g<<12|l<<6|a[b++]&63;65536>f?e+=String.fromCharCode(f):(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else e+=String.fromCharCode(f)}return e}
|
function la(a,b,c){var e=b+c;for(c=b;a[c]&&!(c>=e);)++c;if(16<c-b&&a.subarray&&ka)return ka.decode(a.subarray(b,c));for(e="";b<c;){var f=a[b++];if(f&128){var g=a[b++]&63;if(192==(f&224))e+=String.fromCharCode((f&31)<<6|g);else{var l=a[b++]&63;f=224==(f&240)?(f&15)<<12|g<<6|l:(f&7)<<18|g<<12|l<<6|a[b++]&63;65536>f?e+=String.fromCharCode(f):(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else e+=String.fromCharCode(f)}return e}
|
||||||
function la(a,b,c){var e=F;if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}if(127>=g){if(b>=c)break;e[b++]=g}else{if(2047>=g){if(b+1>=c)break;e[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;e[b++]=224|g>>12}else{if(b+3>=c)break;e[b++]=240|g>>18;e[b++]=128|g>>12&63}e[b++]=128|g>>6&63}e[b++]=128|g&63}}e[b]=0}}var ma="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;
|
function ma(a,b,c){var e=F;if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}if(127>=g){if(b>=c)break;e[b++]=g}else{if(2047>=g){if(b+1>=c)break;e[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;e[b++]=224|g>>12}else{if(b+3>=c)break;e[b++]=240|g>>18;e[b++]=128|g>>12&63}e[b++]=128|g>>6&63}e[b++]=128|g&63}}e[b]=0}}var na="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;
|
||||||
function na(a,b){var c=a>>1;for(var e=c+b/2;!(c>=e)&&G[c];)++c;c<<=1;if(32<c-a&&ma)return ma.decode(F.subarray(a,c));c=0;for(e="";;){var f=H[a+2*c>>1];if(0==f||c==b/2)return e;++c;e+=String.fromCharCode(f)}}function oa(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var e=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)H[b>>1]=a.charCodeAt(f),b+=2;H[b>>1]=0;return b-e}function pa(a){return 2*a.length}
|
function oa(a,b){var c=a>>1;for(var e=c+b/2;!(c>=e)&&G[c];)++c;c<<=1;if(32<c-a&&na)return na.decode(F.subarray(a,c));c=0;for(e="";;){var f=H[a+2*c>>1];if(0==f||c==b/2)return e;++c;e+=String.fromCharCode(f)}}function pa(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var e=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)H[b>>1]=a.charCodeAt(f),b+=2;H[b>>1]=0;return b-e}function qa(a){return 2*a.length}
|
||||||
function qa(a,b){for(var c=0,e="";!(c>=b/4);){var f=I[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023)):e+=String.fromCharCode(f)}return e}function ra(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var e=b;c=e+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}I[b>>2]=g;b+=4;if(b+4>c)break}I[b>>2]=0;return b-e}
|
function ra(a,b){for(var c=0,e="";!(c>=b/4);){var f=I[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023)):e+=String.fromCharCode(f)}return e}function sa(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var e=b;c=e+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}I[b>>2]=g;b+=4;if(b+4>c)break}I[b>>2]=0;return b-e}
|
||||||
function sa(a){for(var b=0,c=0;c<a.length;++c){var e=a.charCodeAt(c);55296<=e&&57343>=e&&++c;b+=4}return b}var J,ta,F,H,G,I,L,ua,va;function wa(a){J=a;d.HEAP8=ta=new Int8Array(a);d.HEAP16=H=new Int16Array(a);d.HEAP32=I=new Int32Array(a);d.HEAPU8=F=new Uint8Array(a);d.HEAPU16=G=new Uint16Array(a);d.HEAPU32=L=new Uint32Array(a);d.HEAPF32=ua=new Float32Array(a);d.HEAPF64=va=new Float64Array(a)}var xa=d.INITIAL_MEMORY||16777216;d.wasmMemory?E=d.wasmMemory:E=new WebAssembly.Memory({initial:xa/65536,maximum:32768});
|
function ta(a){for(var b=0,c=0;c<a.length;++c){var e=a.charCodeAt(c);55296<=e&&57343>=e&&++c;b+=4}return b}var J,ua,F,H,G,I,L,va,wa;function xa(a){J=a;d.HEAP8=ua=new Int8Array(a);d.HEAP16=H=new Int16Array(a);d.HEAP32=I=new Int32Array(a);d.HEAPU8=F=new Uint8Array(a);d.HEAPU16=G=new Uint16Array(a);d.HEAPU32=L=new Uint32Array(a);d.HEAPF32=va=new Float32Array(a);d.HEAPF64=wa=new Float64Array(a)}var ya=d.INITIAL_MEMORY||16777216;d.wasmMemory?E=d.wasmMemory:E=new WebAssembly.Memory({initial:ya/65536,maximum:32768});
|
||||||
E&&(J=E.buffer);xa=J.byteLength;wa(J);I[1472]=5248928;function M(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(d);else{var c=b.Y;"number"===typeof c?void 0===b.U?d.dynCall_v(c):d.dynCall_vi(c,b.U):c(void 0===b.U?null:b.U)}}}var ya=[],za=[],Aa=[],Ba=[];function Ca(){var a=d.preRun.shift();ya.unshift(a)}var N=0,Da=null,O=null;d.preloadedImages={};d.preloadedAudios={};
|
E&&(J=E.buffer);ya=J.byteLength;xa(J);I[1408]=5248672;function M(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(d);else{var c=b.W;"number"===typeof c?void 0===b.T?d.dynCall_v(c):d.dynCall_vi(c,b.T):c(void 0===b.T?null:b.T)}}}var za=[],Aa=[],Ba=[],Ca=[];function Da(){var a=d.preRun.shift();za.unshift(a)}var N=0,Ea=null,O=null;d.preloadedImages={};d.preloadedAudios={};
|
||||||
function A(a){if(d.onAbort)d.onAbort(a);fa(a);B(a);ia=!0;throw new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");}function Ea(a){var b=Q;return String.prototype.startsWith?b.startsWith(a):0===b.indexOf(a)}function Fa(){return Ea("data:application/octet-stream;base64,")}var Q="imagequant.wasm";if(!Fa()){var Ga=Q;Q=d.locateFile?d.locateFile(Ga,w):w+Ga}
|
function A(a){if(d.onAbort)d.onAbort(a);B(a);ja=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");ba(a);throw a;}function Fa(a){var b=Q;return String.prototype.startsWith?b.startsWith(a):0===b.indexOf(a)}function Ga(){return Fa("data:application/octet-stream;base64,")}var Q="imagequant.wasm";if(!Ga()){var Ha=Q;Q=d.locateFile?d.locateFile(Ha,w):w+Ha}
|
||||||
function Ha(){try{if(D)return new Uint8Array(D);if(z)return z(Q);throw"both async and sync fetching of the wasm failed";}catch(a){A(a)}}function Ia(){return D||!u&&!v||"function"!==typeof fetch||Ea("file://")?new Promise(function(a){a(Ha())}):fetch(Q,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+Q+"'";return a.arrayBuffer()}).catch(function(){return Ha()})}za.push({Y:function(){Ja()}});function R(){return 0<R.W}
|
function Ia(){try{if(D)return new Uint8Array(D);if(z)return z(Q);throw"both async and sync fetching of the wasm failed";}catch(a){A(a)}}function Ja(){return D||!u&&!v||"function"!==typeof fetch||Fa("file://")?new Promise(function(a){a(Ia())}):fetch(Q,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+Q+"'";return a.arrayBuffer()}).catch(function(){return Ia()})}Aa.push({W:function(){Ka()}});
|
||||||
function Ka(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var La=void 0;function S(a){for(var b="";F[a];)b+=La[F[a++]];return b}var T={},U={},V={};function Ma(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}
|
function La(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var Ma=void 0;function R(a){for(var b="";F[a];)b+=Ma[F[a++]];return b}var S={},T={},U={};function Na(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}
|
||||||
function Na(a,b){a=Ma(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function Oa(a){var b=Error,c=Na(a,function(e){this.name=a;this.message=e;e=Error(e).stack;void 0!==e&&(this.stack=this.toString()+"\n"+e.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}
|
function Oa(a,b){a=Na(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function Pa(a){var b=Error,c=Oa(a,function(e){this.name=a;this.message=e;e=Error(e).stack;void 0!==e&&(this.stack=this.toString()+"\n"+e.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}
|
||||||
var Pa=void 0;function W(a){throw new Pa(a);}var Qa=void 0;function Ra(a,b){function c(k){k=b(k);if(k.length!==e.length)throw new Qa("Mismatched type converter count");for(var h=0;h<e.length;++h)X(e[h],k[h])}var e=[];e.forEach(function(k){V[k]=a});var f=Array(a.length),g=[],l=0;a.forEach(function(k,h){U.hasOwnProperty(k)?f[h]=U[k]:(g.push(k),T.hasOwnProperty(k)||(T[k]=[]),T[k].push(function(){f[h]=U[k];++l;l===g.length&&c(f)}))});0===g.length&&c(f)}
|
var Qa=void 0;function V(a){throw new Qa(a);}var Ra=void 0;function Sa(a,b){function c(k){k=b(k);if(k.length!==e.length)throw new Ra("Mismatched type converter count");for(var h=0;h<e.length;++h)W(e[h],k[h])}var e=[];e.forEach(function(k){U[k]=a});var f=Array(a.length),g=[],l=0;a.forEach(function(k,h){T.hasOwnProperty(k)?f[h]=T[k]:(g.push(k),S.hasOwnProperty(k)||(S[k]=[]),S[k].push(function(){f[h]=T[k];++l;l===g.length&&c(f)}))});0===g.length&&c(f)}
|
||||||
function X(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var e=b.name;a||W('type "'+e+'" must have a positive integer typeid pointer');if(U.hasOwnProperty(a)){if(c.Z)return;W("Cannot register type '"+e+"' twice")}U[a]=b;delete V[a];T.hasOwnProperty(a)&&(b=T[a],delete T[a],b.forEach(function(f){f()}))}var Sa=[],Y=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
function W(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var e=b.name;a||V('type "'+e+'" must have a positive integer typeid pointer');if(T.hasOwnProperty(a)){if(c.X)return;V("Cannot register type '"+e+"' twice")}T[a]=b;delete U[a];S.hasOwnProperty(a)&&(b=S[a],delete S[a],b.forEach(function(f){f()}))}var Ta=[],X=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||||
function Ta(a){4<a&&0===--Y[a].V&&(Y[a]=void 0,Sa.push(a))}function Ua(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Sa.length?Sa.pop():Y.length;Y[b]={V:1,value:a};return b}}function Xa(a){return this.fromWireType(L[a>>2])}function Ya(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
function Wa(a){4<a&&0===--X[a].U&&(X[a]=void 0,Ta.push(a))}function Y(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Ta.length?Ta.pop():X.length;X[b]={U:1,value:a};return b}}function Xa(a){return this.fromWireType(L[a>>2])}function Ya(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
||||||
function Za(a,b){switch(b){case 2:return function(c){return this.fromWireType(ua[c>>2])};case 3:return function(c){return this.fromWireType(va[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function $a(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Na(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
function Za(a,b){switch(b){case 2:return function(c){return this.fromWireType(va[c>>2])};case 3:return function(c){return this.fromWireType(wa[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function $a(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Oa(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
||||||
function ab(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function bb(a,b){var c=d;if(void 0===c[a].S){var e=c[a];c[a]=function(){c[a].S.hasOwnProperty(arguments.length)||W("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].S+")!");return c[a].S[arguments.length].apply(this,arguments)};c[a].S=[];c[a].S[e.X]=e}}
|
function ab(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function bb(a,b){var c=d;if(void 0===c[a].R){var e=c[a];c[a]=function(){c[a].R.hasOwnProperty(arguments.length)||V("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].R+")!");return c[a].R[arguments.length].apply(this,arguments)};c[a].R=[];c[a].R[e.V]=e}}
|
||||||
function cb(a,b,c){d.hasOwnProperty(a)?((void 0===c||void 0!==d[a].S&&void 0!==d[a].S[c])&&W("Cannot register public name '"+a+"' twice"),bb(a,a),d.hasOwnProperty(c)&&W("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),d[a].S[c]=b):(d[a]=b,void 0!==c&&(d[a].aa=c))}function db(a,b){for(var c=[],e=0;e<a;e++)c.push(I[(b>>2)+e]);return c}
|
function cb(a,b,c){d.hasOwnProperty(a)?((void 0===c||void 0!==d[a].R&&void 0!==d[a].R[c])&&V("Cannot register public name '"+a+"' twice"),bb(a,a),d.hasOwnProperty(c)&&V("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),d[a].R[c]=b):(d[a]=b,void 0!==c&&(d[a].Z=c))}function db(a,b){for(var c=[],e=0;e<a;e++)c.push(I[(b>>2)+e]);return c}
|
||||||
function eb(a,b){a=S(a);var c=d["dynCall_"+a];for(var e=[],f=1;f<a.length;++f)e.push("a"+f);f="return function dynCall_"+(a+"_"+b)+"("+e.join(", ")+") {\n";f+=" return dynCall(rawFunction"+(e.length?", ":"")+e.join(", ")+");\n";c=(new Function("dynCall","rawFunction",f+"};\n"))(c,b);"function"!==typeof c&&W("unknown function pointer with signature "+a+": "+b);return c}var fb=void 0;function gb(a){a=hb(a);var b=S(a);Z(a);return b}
|
function eb(a,b){a=R(a);var c=d["dynCall_"+a];for(var e=[],f=1;f<a.length;++f)e.push("a"+f);f="return function dynCall_"+(a+"_"+b)+"("+e.join(", ")+") {\n";f+=" return dynCall(rawFunction"+(e.length?", ":"")+e.join(", ")+");\n";c=(new Function("dynCall","rawFunction",f+"};\n"))(c,b);"function"!==typeof c&&V("unknown function pointer with signature "+a+": "+b);return c}var fb=void 0;function gb(a){a=hb(a);var b=R(a);Z(a);return b}
|
||||||
function ib(a,b){function c(g){f[g]||U[g]||(V[g]?V[g].forEach(c):(e.push(g),f[g]=!0))}var e=[],f={};b.forEach(c);throw new fb(a+": "+e.map(gb).join([", "]));}function jb(a,b,c){switch(b){case 0:return c?function(e){return ta[e]}:function(e){return F[e]};case 1:return c?function(e){return H[e>>1]}:function(e){return G[e>>1]};case 2:return c?function(e){return I[e>>2]}:function(e){return L[e>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var kb={};
|
function ib(a,b){function c(g){f[g]||T[g]||(U[g]?U[g].forEach(c):(e.push(g),f[g]=!0))}var e=[],f={};b.forEach(c);throw new fb(a+": "+e.map(gb).join([", "]));}function jb(a,b,c){switch(b){case 0:return c?function(e){return ua[e]}:function(e){return F[e]};case 1:return c?function(e){return H[e>>1]}:function(e){return G[e>>1]};case 2:return c?function(e){return I[e>>2]}:function(e){return L[e>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var kb={};
|
||||||
function lb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function mb(a,b){var c=U[a];void 0===c&&W(b+" has unknown type "+gb(a));return c}for(var nb={},ob=[null,[],[]],pb=Array(256),qb=0;256>qb;++qb)pb[qb]=String.fromCharCode(qb);La=pb;Pa=d.BindingError=Oa("BindingError");Qa=d.InternalError=Oa("InternalError");d.count_emval_handles=function(){for(var a=0,b=5;b<Y.length;++b)void 0!==Y[b]&&++a;return a};
|
function lb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function mb(a,b){var c=T[a];void 0===c&&V(b+" has unknown type "+gb(a));return c}for(var nb={},ob=[null,[],[]],pb=Array(256),qb=0;256>qb;++qb)pb[qb]=String.fromCharCode(qb);Ma=pb;Qa=d.BindingError=Pa("BindingError");Ra=d.InternalError=Pa("InternalError");d.count_emval_handles=function(){for(var a=0,b=5;b<X.length;++b)void 0!==X[b]&&++a;return a};
|
||||||
d.get_first_emval=function(){for(var a=5;a<Y.length;++a)if(void 0!==Y[a])return Y[a];return null};fb=d.UnboundTypeError=Oa("UnboundTypeError");
|
d.get_first_emval=function(){for(var a=5;a<X.length;++a)if(void 0!==X[a])return X[a];return null};fb=d.UnboundTypeError=Pa("UnboundTypeError");
|
||||||
var sb={n:function(a){return rb(a)},w:function(){},m:function(a){"uncaught_exception"in R?R.W++:R.W=1;throw a;},u:function(a,b,c,e,f){var g=Ka(c);b=S(b);X(a,{name:b,fromWireType:function(l){return!!l},toWireType:function(l,k){return k?e:f},argPackAdvance:8,readValueFromPointer:function(l){if(1===c)var k=ta;else if(2===c)k=H;else if(4===c)k=I;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[l>>g])},T:null})},t:function(a,b){b=S(b);X(a,{name:b,fromWireType:function(c){var e=
|
var sb={n:function(){},o:function(a,b,c,e,f){var g=La(c);b=R(b);W(a,{name:b,fromWireType:function(l){return!!l},toWireType:function(l,k){return k?e:f},argPackAdvance:8,readValueFromPointer:function(l){if(1===c)var k=ua;else if(2===c)k=H;else if(4===c)k=I;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[l>>g])},S:null})},u:function(a,b){b=R(b);W(a,{name:b,fromWireType:function(c){var e=X[c].value;Wa(c);return e},toWireType:function(c,e){return Y(e)},argPackAdvance:8,
|
||||||
Y[c].value;Ta(c);return e},toWireType:function(c,e){return Ua(e)},argPackAdvance:8,readValueFromPointer:Xa,T:null})},h:function(a,b,c){c=Ka(c);b=S(b);X(a,{name:b,fromWireType:function(e){return e},toWireType:function(e,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+Ya(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:Za(b,c),T:null})},d:function(a,b,c,e,f,g){var l=db(b,c);a=S(a);f=eb(e,f);cb(a,function(){ib("Cannot call "+a+" due to unbound types",
|
readValueFromPointer:Xa,S:null})},l:function(a,b,c){c=La(c);b=R(b);W(a,{name:b,fromWireType:function(e){return e},toWireType:function(e,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+Ya(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:Za(b,c),S:null})},e:function(a,b,c,e,f,g){var l=db(b,c);a=R(a);f=eb(e,f);cb(a,function(){ib("Cannot call "+a+" due to unbound types",l)},b-1);Sa(l,function(k){var h=[k[0],null].concat(k.slice(1)),n=k=a,p=f,
|
||||||
l)},b-1);Ra(l,function(k){var h=[k[0],null].concat(k.slice(1)),n=k=a,p=f,q=h.length;2>q&&W("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var y=null!==h[1]&&!1,C=!1,m=1;m<h.length;++m)if(null!==h[m]&&void 0===h[m].T){C=!0;break}var Va="void"!==h[0].name,K="",P="";for(m=0;m<q-2;++m)K+=(0!==m?", ":"")+"arg"+m,P+=(0!==m?", ":"")+"arg"+m+"Wired";n="return function "+Ma(n)+"("+K+") {\nif (arguments.length !== "+(q-2)+") {\nthrowBindingError('function "+n+" called with ' + arguments.length + ' arguments, expected "+
|
q=h.length;2>q&&V("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var y=null!==h[1]&&!1,C=!1,m=1;m<h.length;++m)if(null!==h[m]&&void 0===h[m].S){C=!0;break}var Ua="void"!==h[0].name,K="",P="";for(m=0;m<q-2;++m)K+=(0!==m?", ":"")+"arg"+m,P+=(0!==m?", ":"")+"arg"+m+"Wired";n="return function "+Na(n)+"("+K+") {\nif (arguments.length !== "+(q-2)+") {\nthrowBindingError('function "+n+" called with ' + arguments.length + ' arguments, expected "+(q-2)+" args!');\n}\n";
|
||||||
(q-2)+" args!');\n}\n";C&&(n+="var destructors = [];\n");var Wa=C?"destructors":"null";K="throwBindingError invoker fn runDestructors retType classParam".split(" ");p=[W,p,g,ab,h[0],h[1]];y&&(n+="var thisWired = classParam.toWireType("+Wa+", this);\n");for(m=0;m<q-2;++m)n+="var arg"+m+"Wired = argType"+m+".toWireType("+Wa+", arg"+m+"); // "+h[m+2].name+"\n",K.push("argType"+m),p.push(h[m+2]);y&&(P="thisWired"+(0<P.length?", ":"")+P);n+=(Va?"var rv = ":"")+"invoker(fn"+(0<P.length?", ":"")+P+");\n";
|
C&&(n+="var destructors = [];\n");var Va=C?"destructors":"null";K="throwBindingError invoker fn runDestructors retType classParam".split(" ");p=[V,p,g,ab,h[0],h[1]];y&&(n+="var thisWired = classParam.toWireType("+Va+", this);\n");for(m=0;m<q-2;++m)n+="var arg"+m+"Wired = argType"+m+".toWireType("+Va+", arg"+m+"); // "+h[m+2].name+"\n",K.push("argType"+m),p.push(h[m+2]);y&&(P="thisWired"+(0<P.length?", ":"")+P);n+=(Ua?"var rv = ":"")+"invoker(fn"+(0<P.length?", ":"")+P+");\n";if(C)n+="runDestructors(destructors);\n";
|
||||||
if(C)n+="runDestructors(destructors);\n";else for(m=y?1:2;m<h.length;++m)q=1===m?"thisWired":"arg"+(m-2)+"Wired",null!==h[m].T&&(n+=q+"_dtor("+q+"); // "+h[m].name+"\n",K.push(q+"_dtor"),p.push(h[m].T));Va&&(n+="var ret = retType.fromWireType(rv);\nreturn ret;\n");K.push(n+"}\n");h=$a(K).apply(null,p);m=b-1;if(!d.hasOwnProperty(k))throw new Qa("Replacing nonexistant public symbol");void 0!==d[k].S&&void 0!==m?d[k].S[m]=h:(d[k]=h,d[k].X=m);return[]})},b:function(a,b,c,e,f){function g(n){return n}b=
|
else for(m=y?1:2;m<h.length;++m)q=1===m?"thisWired":"arg"+(m-2)+"Wired",null!==h[m].S&&(n+=q+"_dtor("+q+"); // "+h[m].name+"\n",K.push(q+"_dtor"),p.push(h[m].S));Ua&&(n+="var ret = retType.fromWireType(rv);\nreturn ret;\n");K.push(n+"}\n");h=$a(K).apply(null,p);m=b-1;if(!d.hasOwnProperty(k))throw new Ra("Replacing nonexistant public symbol");void 0!==d[k].R&&void 0!==m?d[k].R[m]=h:(d[k]=h,d[k].V=m);return[]})},b:function(a,b,c,e,f){function g(n){return n}b=R(b);-1===f&&(f=4294967295);var l=La(c);
|
||||||
S(b);-1===f&&(f=4294967295);var l=Ka(c);if(0===e){var k=32-8*c;g=function(n){return n<<k>>>k}}var h=-1!=b.indexOf("unsigned");X(a,{name:b,fromWireType:g,toWireType:function(n,p){if("number"!==typeof p&&"boolean"!==typeof p)throw new TypeError('Cannot convert "'+Ya(p)+'" to '+this.name);if(p<e||p>f)throw new TypeError('Passing a number "'+Ya(p)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+e+", "+f+"]!");return h?p>>>0:p|0},argPackAdvance:8,readValueFromPointer:jb(b,
|
if(0===e){var k=32-8*c;g=function(n){return n<<k>>>k}}var h=-1!=b.indexOf("unsigned");W(a,{name:b,fromWireType:g,toWireType:function(n,p){if("number"!==typeof p&&"boolean"!==typeof p)throw new TypeError('Cannot convert "'+Ya(p)+'" to '+this.name);if(p<e||p>f)throw new TypeError('Passing a number "'+Ya(p)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+e+", "+f+"]!");return h?p>>>0:p|0},argPackAdvance:8,readValueFromPointer:jb(b,l,0!==e),S:null})},
|
||||||
l,0!==e),T:null})},a:function(a,b,c){function e(g){g>>=2;var l=L;return new f(J,l[g+1],l[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=S(c);X(a,{name:c,fromWireType:e,argPackAdvance:8,readValueFromPointer:e},{Z:!0})},i:function(a,b){b=S(b);var c="std::string"===b;X(a,{name:b,fromWireType:function(e){var f=L[e>>2];if(c)for(var g=e+4,l=0;l<=f;++l){var k=e+4+l;if(0==F[k]||l==f){g=g?ka(F,g,k-g):"";if(void 0===h)var h=g;else h+=String.fromCharCode(0),
|
a:function(a,b,c){function e(g){g>>=2;var l=L;return new f(J,l[g+1],l[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=R(c);W(a,{name:c,fromWireType:e,argPackAdvance:8,readValueFromPointer:e},{X:!0})},h:function(a,b){b=R(b);var c="std::string"===b;W(a,{name:b,fromWireType:function(e){var f=L[e>>2];if(c)for(var g=e+4,l=0;l<=f;++l){var k=e+4+l;if(l==f||0==F[k]){g=g?la(F,g,k-g):"";if(void 0===h)var h=g;else h+=String.fromCharCode(0),h+=g;g=
|
||||||
h+=g;g=k+1}}else{h=Array(f);for(l=0;l<f;++l)h[l]=String.fromCharCode(F[e+4+l]);h=h.join("")}Z(e);return h},toWireType:function(e,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||W("Cannot pass non-string to std::string");var l=(c&&g?function(){for(var n=0,p=0;p<f.length;++p){var q=f.charCodeAt(p);55296<=q&&57343>=q&&(q=65536+((q&1023)<<10)|f.charCodeAt(++p)&1023);127>=q?++n:n=2047>=q?n+
|
k+1}}else{h=Array(f);for(l=0;l<f;++l)h[l]=String.fromCharCode(F[e+4+l]);h=h.join("")}Z(e);return h},toWireType:function(e,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||V("Cannot pass non-string to std::string");var l=(c&&g?function(){for(var n=0,p=0;p<f.length;++p){var q=f.charCodeAt(p);55296<=q&&57343>=q&&(q=65536+((q&1023)<<10)|f.charCodeAt(++p)&1023);127>=q?++n:n=2047>=q?n+2:65535>=
|
||||||
2:65535>=q?n+3:n+4}return n}:function(){return f.length})(),k=rb(4+l+1);L[k>>2]=l;if(c&&g)la(f,k+4,l+1);else if(g)for(g=0;g<l;++g){var h=f.charCodeAt(g);255<h&&(Z(k),W("String has UTF-16 code units that do not fit in 8 bits"));F[k+4+g]=h}else for(g=0;g<l;++g)F[k+4+g]=f[g];null!==e&&e.push(Z,k);return k},argPackAdvance:8,readValueFromPointer:Xa,T:function(e){Z(e)}})},e:function(a,b,c){c=S(c);if(2===b){var e=na;var f=oa;var g=pa;var l=function(){return G};var k=1}else 4===b&&(e=qa,f=ra,g=sa,l=function(){return L},
|
q?n+3:n+4}return n}:function(){return f.length})(),k=rb(4+l+1);L[k>>2]=l;if(c&&g)ma(f,k+4,l+1);else if(g)for(g=0;g<l;++g){var h=f.charCodeAt(g);255<h&&(Z(k),V("String has UTF-16 code units that do not fit in 8 bits"));F[k+4+g]=h}else for(g=0;g<l;++g)F[k+4+g]=f[g];null!==e&&e.push(Z,k);return k},argPackAdvance:8,readValueFromPointer:Xa,S:function(e){Z(e)}})},g:function(a,b,c){c=R(c);if(2===b){var e=oa;var f=pa;var g=qa;var l=function(){return G};var k=1}else 4===b&&(e=ra,f=sa,g=ta,l=function(){return L},
|
||||||
k=2);X(a,{name:c,fromWireType:function(h){for(var n=L[h>>2],p=l(),q,y=h+4,C=0;C<=n;++C){var m=h+4+C*b;if(0==p[m>>k]||C==n)y=e(y,m-y),void 0===q?q=y:(q+=String.fromCharCode(0),q+=y),y=m+b}Z(h);return q},toWireType:function(h,n){"string"!==typeof n&&W("Cannot pass non-string to C++ string type "+c);var p=g(n),q=rb(4+p+b);L[q>>2]=p>>k;f(n,q+4,p+b);null!==h&&h.push(Z,q);return q},argPackAdvance:8,readValueFromPointer:Xa,T:function(h){Z(h)}})},j:function(a,b){b=S(b);X(a,{$:!0,name:b,argPackAdvance:0,fromWireType:function(){},
|
k=2);W(a,{name:c,fromWireType:function(h){for(var n=L[h>>2],p=l(),q,y=h+4,C=0;C<=n;++C){var m=h+4+C*b;if(C==n||0==p[m>>k])y=e(y,m-y),void 0===q?q=y:(q+=String.fromCharCode(0),q+=y),y=m+b}Z(h);return q},toWireType:function(h,n){"string"!==typeof n&&V("Cannot pass non-string to C++ string type "+c);var p=g(n),q=rb(4+p+b);L[q>>2]=p>>k;f(n,q+4,p+b);null!==h&&h.push(Z,q);return q},argPackAdvance:8,readValueFromPointer:Xa,S:function(h){Z(h)}})},p:function(a,b){b=R(b);W(a,{Y:!0,name:b,argPackAdvance:0,fromWireType:function(){},
|
||||||
toWireType:function(){}})},r:Ta,v:function(a){if(0===a)return Ua(lb());var b=kb[a];a=void 0===b?S(a):b;return Ua(lb()[a])},k:function(a){4<a&&(Y[a].V+=1)},l:function(a,b,c,e){a||W("Cannot use deleted val. handle = "+a);a=Y[a].value;var f=nb[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var l="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)l+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+g+'], "parameter '+g+
|
toWireType:function(){}})},f:Wa,m:function(a){if(0===a)return Y(lb());var b=kb[a];a=void 0===b?R(a):b;return Y(lb()[a])},i:function(a){4<a&&(X[a].U+=1)},j:function(a,b,c,e){a||V("Cannot use deleted val. handle = "+a);a=X[a].value;var f=nb[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var l="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)l+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+g+'], "parameter '+g+'");\nvar arg'+
|
||||||
'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",l+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(mb,d,Ua);nb[b]=f}return f(a,c,e)},f:function(){A()},q:function(a,b,c){F.copyWithin(a,b,b+c)},c:function(a){a>>>=0;var b=F.length;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var e=b*(1+.2/c);e=Math.min(e,a+100663296);e=Math.max(16777216,a,e);0<e%
|
g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",l+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(mb,d,Y);nb[b]=f}return f(a,c,e)},d:function(){A()},s:function(a,b,c){F.copyWithin(a,b,b+c)},c:function(a){a>>>=0;var b=F.length;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var e=b*(1+.2/c);e=Math.min(e,a+100663296);e=Math.max(16777216,a,e);0<e%65536&&(e+=65536-
|
||||||
65536&&(e+=65536-e%65536);a:{try{E.grow(Math.min(2147483648,e)-J.byteLength+65535>>>16);wa(E.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},s:function(){return 0},o:function(){},g:function(a,b,c,e){for(var f=0,g=0;g<c;g++){for(var l=I[b+8*g>>2],k=I[b+(8*g+4)>>2],h=0;h<k;h++){var n=F[l+h],p=ob[a];0===n||10===n?((1===a?fa:B)(ka(p,0)),p.length=0):p.push(n)}f+=k}I[e>>2]=f;return 0},memory:E,p:function(){},table:ha};
|
e%65536);a:{try{E.grow(Math.min(2147483648,e)-J.byteLength+65535>>>16);xa(E.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},t:function(){return 0},q:function(){},k:function(a,b,c,e){for(var f=0,g=0;g<c;g++){for(var l=I[b+8*g>>2],k=I[b+(8*g+4)>>2],h=0;h<k;h++){var n=F[l+h],p=ob[a];0===n||10===n?((1===a?ha:B)(la(p,0)),p.length=0):p.push(n)}f+=k}I[e>>2]=f;return 0},memory:E,r:function(){},table:ia};
|
||||||
(function(){function a(f){d.asm=f.exports;N--;d.monitorRunDependencies&&d.monitorRunDependencies(N);0==N&&(null!==Da&&(clearInterval(Da),Da=null),O&&(f=O,O=null,f()))}function b(f){a(f.instance)}function c(f){return Ia().then(function(g){return WebAssembly.instantiate(g,e)}).then(f,function(g){B("failed to asynchronously prepare wasm: "+g);A(g)})}var e={a:sb};N++;d.monitorRunDependencies&&d.monitorRunDependencies(N);if(d.instantiateWasm)try{return d.instantiateWasm(e,a)}catch(f){return B("Module.instantiateWasm callback failed with error: "+
|
(function(){function a(f){d.asm=f.exports;N--;d.monitorRunDependencies&&d.monitorRunDependencies(N);0==N&&(null!==Ea&&(clearInterval(Ea),Ea=null),O&&(f=O,O=null,f()))}function b(f){a(f.instance)}function c(f){return Ja().then(function(g){return WebAssembly.instantiate(g,e)}).then(f,function(g){B("failed to asynchronously prepare wasm: "+g);A(g)})}var e={a:sb};N++;d.monitorRunDependencies&&d.monitorRunDependencies(N);if(d.instantiateWasm)try{return d.instantiateWasm(e,a)}catch(f){return B("Module.instantiateWasm callback failed with error: "+
|
||||||
f),!1}(function(){if(D||"function"!==typeof WebAssembly.instantiateStreaming||Fa()||Ea("file://")||"function"!==typeof fetch)return c(b);fetch(Q,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(b,function(g){B("wasm streaming compile failed: "+g);B("falling back to ArrayBuffer instantiation");return c(b)})})})();return{}})();
|
f),!1}(function(){if(D||"function"!==typeof WebAssembly.instantiateStreaming||Ga()||Fa("file://")||"function"!==typeof fetch)return c(b);fetch(Q,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(b,function(g){B("wasm streaming compile failed: "+g);B("falling back to ArrayBuffer instantiation");return c(b)})})})();return{}})();
|
||||||
var Ja=d.___wasm_call_ctors=function(){return(Ja=d.___wasm_call_ctors=d.asm.x).apply(null,arguments)},rb=d._malloc=function(){return(rb=d._malloc=d.asm.y).apply(null,arguments)},Z=d._free=function(){return(Z=d._free=d.asm.z).apply(null,arguments)},hb=d.___getTypeName=function(){return(hb=d.___getTypeName=d.asm.A).apply(null,arguments)};d.___embind_register_native_and_builtin_types=function(){return(d.___embind_register_native_and_builtin_types=d.asm.B).apply(null,arguments)};
|
var Ka=d.___wasm_call_ctors=function(){return(Ka=d.___wasm_call_ctors=d.asm.v).apply(null,arguments)},rb=d._malloc=function(){return(rb=d._malloc=d.asm.w).apply(null,arguments)},Z=d._free=function(){return(Z=d._free=d.asm.x).apply(null,arguments)},hb=d.___getTypeName=function(){return(hb=d.___getTypeName=d.asm.y).apply(null,arguments)};d.___embind_register_native_and_builtin_types=function(){return(d.___embind_register_native_and_builtin_types=d.asm.z).apply(null,arguments)};
|
||||||
d.dynCall_iiiiiif=function(){return(d.dynCall_iiiiiif=d.asm.C).apply(null,arguments)};d.dynCall_viiiiif=function(){return(d.dynCall_viiiiif=d.asm.D).apply(null,arguments)};d.dynCall_iiiiif=function(){return(d.dynCall_iiiiif=d.asm.E).apply(null,arguments)};d.dynCall_viiiif=function(){return(d.dynCall_viiiif=d.asm.F).apply(null,arguments)};d.dynCall_ii=function(){return(d.dynCall_ii=d.asm.G).apply(null,arguments)};d.dynCall_i=function(){return(d.dynCall_i=d.asm.H).apply(null,arguments)};
|
d.dynCall_iiiiiif=function(){return(d.dynCall_iiiiiif=d.asm.A).apply(null,arguments)};d.dynCall_viiiiif=function(){return(d.dynCall_viiiiif=d.asm.B).apply(null,arguments)};d.dynCall_iiiiif=function(){return(d.dynCall_iiiiif=d.asm.C).apply(null,arguments)};d.dynCall_viiiif=function(){return(d.dynCall_viiiif=d.asm.D).apply(null,arguments)};d.dynCall_ii=function(){return(d.dynCall_ii=d.asm.E).apply(null,arguments)};d.dynCall_i=function(){return(d.dynCall_i=d.asm.F).apply(null,arguments)};
|
||||||
d.dynCall_vi=function(){return(d.dynCall_vi=d.asm.I).apply(null,arguments)};d.dynCall_iii=function(){return(d.dynCall_iii=d.asm.J).apply(null,arguments)};d.dynCall_vif=function(){return(d.dynCall_vif=d.asm.K).apply(null,arguments)};d.dynCall_iidiiii=function(){return(d.dynCall_iidiiii=d.asm.L).apply(null,arguments)};d.dynCall_vii=function(){return(d.dynCall_vii=d.asm.M).apply(null,arguments)};d.dynCall_iiii=function(){return(d.dynCall_iiii=d.asm.N).apply(null,arguments)};
|
d.dynCall_vi=function(){return(d.dynCall_vi=d.asm.G).apply(null,arguments)};d.dynCall_vif=function(){return(d.dynCall_vif=d.asm.H).apply(null,arguments)};d.dynCall_iii=function(){return(d.dynCall_iii=d.asm.I).apply(null,arguments)};d.dynCall_iidiiii=function(){return(d.dynCall_iidiiii=d.asm.J).apply(null,arguments)};d.dynCall_vii=function(){return(d.dynCall_vii=d.asm.K).apply(null,arguments)};d.dynCall_iiii=function(){return(d.dynCall_iiii=d.asm.L).apply(null,arguments)};
|
||||||
d.dynCall_jiji=function(){return(d.dynCall_jiji=d.asm.O).apply(null,arguments)};d.dynCall_viiiiii=function(){return(d.dynCall_viiiiii=d.asm.P).apply(null,arguments)};d.dynCall_viiiii=function(){return(d.dynCall_viiiii=d.asm.Q).apply(null,arguments)};d.dynCall_viiii=function(){return(d.dynCall_viiii=d.asm.R).apply(null,arguments)};var tb;O=function ub(){tb||vb();tb||(O=ub)};
|
d.dynCall_jiji=function(){return(d.dynCall_jiji=d.asm.M).apply(null,arguments)};d.dynCall_viiiiii=function(){return(d.dynCall_viiiiii=d.asm.N).apply(null,arguments)};d.dynCall_viiiii=function(){return(d.dynCall_viiiii=d.asm.O).apply(null,arguments)};d.dynCall_viiii=function(){return(d.dynCall_viiii=d.asm.P).apply(null,arguments)};var tb;O=function ub(){tb||vb();tb||(O=ub)};
|
||||||
function vb(){function a(){if(!tb&&(tb=!0,d.calledRun=!0,!ia)){M(za);M(Aa);aa(d);if(d.onRuntimeInitialized)d.onRuntimeInitialized();if(d.postRun)for("function"==typeof d.postRun&&(d.postRun=[d.postRun]);d.postRun.length;){var b=d.postRun.shift();Ba.unshift(b)}M(Ba)}}if(!(0<N)){if(d.preRun)for("function"==typeof d.preRun&&(d.preRun=[d.preRun]);d.preRun.length;)Ca();M(ya);0<N||(d.setStatus?(d.setStatus("Running..."),setTimeout(function(){setTimeout(function(){d.setStatus("")},1);a()},1)):a())}}
|
function vb(){function a(){if(!tb&&(tb=!0,d.calledRun=!0,!ja)){M(Aa);M(Ba);aa(d);if(d.onRuntimeInitialized)d.onRuntimeInitialized();if(d.postRun)for("function"==typeof d.postRun&&(d.postRun=[d.postRun]);d.postRun.length;){var b=d.postRun.shift();Ca.unshift(b)}M(Ca)}}if(!(0<N)){if(d.preRun)for("function"==typeof d.preRun&&(d.preRun=[d.preRun]);d.preRun.length;)Da();M(za);0<N||(d.setStatus?(d.setStatus("Running..."),setTimeout(function(){setTimeout(function(){d.setStatus("")},1);a()},1)):a())}}
|
||||||
d.run=vb;if(d.preInit)for("function"==typeof d.preInit&&(d.preInit=[d.preInit]);0<d.preInit.length;)d.preInit.pop()();noExitRuntime=!0;vb();
|
d.run=vb;if(d.preInit)for("function"==typeof d.preInit&&(d.preInit=[d.preInit]);0<d.preInit.length;)d.preInit.pop()();noExitRuntime=!0;vb();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
66
codecs/jxl/Makefile
Normal file
66
codecs/jxl/Makefile
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
CODEC_URL = https://gitlab.com/wg1/jpeg-xl.git
|
||||||
|
CODEC_VERSION = 4d70bd58fbcb758b61446aba447fedd9177a00c9
|
||||||
|
CODEC_DIR = node_modules/jxl
|
||||||
|
CODEC_BUILD_DIR := $(CODEC_DIR)/build
|
||||||
|
CODEC_OUT := $(CODEC_BUILD_DIR)/lib/libjxl.a
|
||||||
|
|
||||||
|
OUT_JS = enc/jxl_enc.js dec/jxl_dec.js
|
||||||
|
OUT_WASM = $(OUT_JS:.js=.wasm)
|
||||||
|
|
||||||
|
.PHONY: all clean
|
||||||
|
|
||||||
|
all: $(OUT_JS)
|
||||||
|
|
||||||
|
%.js: %.cpp $(LIBAOM_OUT) $(CODEC_OUT)
|
||||||
|
$(CXX) \
|
||||||
|
-I $(CODEC_DIR) \
|
||||||
|
-I $(CODEC_DIR)/lib \
|
||||||
|
-I $(CODEC_DIR)/lib/include \
|
||||||
|
-I $(CODEC_BUILD_DIR)/lib/include \
|
||||||
|
-I $(CODEC_DIR)/third_party/highway \
|
||||||
|
-I $(CODEC_DIR)/third_party/skcms \
|
||||||
|
-I $(CODEC_DIR)/third_party/brunsli \
|
||||||
|
-I $(CODEC_DIR)/third_party/brunsli/c/include \
|
||||||
|
${CXXFLAGS} \
|
||||||
|
${LDFLAGS} \
|
||||||
|
--bind \
|
||||||
|
--closure 1 \
|
||||||
|
-s ALLOW_MEMORY_GROWTH=1 \
|
||||||
|
-s MODULARIZE=1 \
|
||||||
|
-s 'EXPORT_NAME="$(basename $(@F))"' \
|
||||||
|
-o $@ \
|
||||||
|
$+ \
|
||||||
|
$(CODEC_BUILD_DIR)/artifacts/libbrunslienc-static.bc \
|
||||||
|
$(CODEC_BUILD_DIR)/artifacts/libbrunslicommon-static.bc \
|
||||||
|
$(CODEC_BUILD_DIR)/artifacts/libbrunslidec-static.bc \
|
||||||
|
$(CODEC_BUILD_DIR)/third_party/brotli/libbrotlidec-static.a \
|
||||||
|
$(CODEC_BUILD_DIR)/third_party/brotli/libbrotlienc-static.a \
|
||||||
|
$(CODEC_BUILD_DIR)/third_party/brotli/libbrotlicommon-static.a \
|
||||||
|
$(CODEC_BUILD_DIR)/third_party/libskcms.a \
|
||||||
|
$(CODEC_BUILD_DIR)/third_party/highway/libhwy.a
|
||||||
|
|
||||||
|
$(CODEC_OUT): $(CODEC_DIR)/CMakeLists.txt
|
||||||
|
mkdir -p $(CODEC_BUILD_DIR)
|
||||||
|
cd $(CODEC_BUILD_DIR) && \
|
||||||
|
emcmake cmake ../ && \
|
||||||
|
$(MAKE) jxl-static
|
||||||
|
|
||||||
|
$(CODEC_DIR)/CMakeLists.txt: $(CODEC_DIR)
|
||||||
|
|
||||||
|
$(CODEC_DIR):
|
||||||
|
# The JXL repository doesn’t have version tags or anything yet,
|
||||||
|
# so we have to pin to a specific commit for now. This implies we
|
||||||
|
# can’t use --recursive, as we will change commit after checkout (it
|
||||||
|
# seems you can’t clone a specific commit directly), and it also means
|
||||||
|
# we can’t use --depth 1 because we want to change commits.
|
||||||
|
# The JXL code base also relies on submodules so we can’t just download
|
||||||
|
# a .tar.gz from GitLab.
|
||||||
|
mkdir -p $@
|
||||||
|
git clone $(CODEC_URL) $@
|
||||||
|
cd $@ && \
|
||||||
|
git reset --hard $(CODEC_VERSION) && \
|
||||||
|
git submodule update --init --recursive
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM) $(OUT_JS) $(OUT_WASM)
|
||||||
|
$(MAKE) -C $(CODEC_BUILD_DIR) clean
|
||||||
80
codecs/jxl/dec/jxl_dec.cpp
Normal file
80
codecs/jxl/dec/jxl_dec.cpp
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
#include <emscripten/bind.h>
|
||||||
|
#include <emscripten/val.h>
|
||||||
|
|
||||||
|
#include <jxl/decode.h>
|
||||||
|
#include "lib/jxl/color_encoding_internal.h"
|
||||||
|
|
||||||
|
#include "skcms.h"
|
||||||
|
|
||||||
|
using namespace emscripten;
|
||||||
|
|
||||||
|
thread_local const val Uint8ClampedArray = val::global("Uint8ClampedArray");
|
||||||
|
thread_local const val ImageData = val::global("ImageData");
|
||||||
|
|
||||||
|
// R, G, B, A
|
||||||
|
#define COMPONENTS_PER_PIXEL 4
|
||||||
|
|
||||||
|
#define EXPECT_TRUE(a) \
|
||||||
|
if (!(a)) \
|
||||||
|
return val::null();
|
||||||
|
|
||||||
|
#define EXPECT_EQ(a, b) EXPECT_TRUE((a) == (b));
|
||||||
|
|
||||||
|
val decode(std::string data) {
|
||||||
|
std::unique_ptr<JxlDecoder,
|
||||||
|
std::integral_constant<decltype(&JxlDecoderDestroy), JxlDecoderDestroy>>
|
||||||
|
dec(JxlDecoderCreate(nullptr));
|
||||||
|
EXPECT_EQ(JXL_DEC_SUCCESS,
|
||||||
|
JxlDecoderSubscribeEvents(
|
||||||
|
dec.get(), JXL_DEC_BASIC_INFO | JXL_DEC_COLOR_ENCODING | JXL_DEC_FULL_IMAGE));
|
||||||
|
|
||||||
|
auto next_in = (const uint8_t*)data.c_str();
|
||||||
|
auto avail_in = data.size();
|
||||||
|
EXPECT_EQ(JXL_DEC_BASIC_INFO, JxlDecoderProcessInput(dec.get(), &next_in, &avail_in));
|
||||||
|
JxlBasicInfo info;
|
||||||
|
EXPECT_EQ(JXL_DEC_SUCCESS, JxlDecoderGetBasicInfo(dec.get(), &info));
|
||||||
|
size_t pixel_count = info.xsize * info.ysize;
|
||||||
|
size_t component_count = pixel_count * COMPONENTS_PER_PIXEL;
|
||||||
|
|
||||||
|
EXPECT_EQ(JXL_DEC_COLOR_ENCODING, JxlDecoderProcessInput(dec.get(), &next_in, &avail_in));
|
||||||
|
size_t icc_size;
|
||||||
|
EXPECT_EQ(JXL_DEC_SUCCESS,
|
||||||
|
JxlDecoderGetICCProfileSize(dec.get(), JXL_COLOR_PROFILE_TARGET_DATA, &icc_size));
|
||||||
|
std::vector<uint8_t> icc_profile(icc_size);
|
||||||
|
EXPECT_EQ(JXL_DEC_SUCCESS,
|
||||||
|
JxlDecoderGetColorAsICCProfile(dec.get(), JXL_COLOR_PROFILE_TARGET_DATA,
|
||||||
|
icc_profile.data(), icc_profile.size()));
|
||||||
|
|
||||||
|
auto float_pixels = std::make_unique<float[]>(component_count);
|
||||||
|
static const JxlPixelFormat format = {COMPONENTS_PER_PIXEL, JXL_LITTLE_ENDIAN, JXL_TYPE_FLOAT};
|
||||||
|
EXPECT_EQ(JXL_DEC_SUCCESS, JxlDecoderSetImageOutBuffer(dec.get(), &format, float_pixels.get(),
|
||||||
|
component_count * sizeof(float)));
|
||||||
|
EXPECT_EQ(JXL_DEC_FULL_IMAGE, JxlDecoderProcessInput(dec.get(), &next_in, &avail_in));
|
||||||
|
|
||||||
|
auto byte_pixels = std::make_unique<uint8_t[]>(component_count);
|
||||||
|
// Convert to sRGB.
|
||||||
|
skcms_ICCProfile jxl_profile;
|
||||||
|
// If the image is encoded in its original color space, the decoded data will be in the color
|
||||||
|
// space defined by the decoded ICC profile. Otherwise, it is in Linear sRGB. TODO: the decoded
|
||||||
|
// color profile should also be Linear sRGB if !uses_original_profile.
|
||||||
|
if (info.uses_original_profile) {
|
||||||
|
EXPECT_TRUE(skcms_Parse(icc_profile.data(), icc_profile.size(), &jxl_profile));
|
||||||
|
} else {
|
||||||
|
auto s = jxl::ColorEncoding::LinearSRGB(/*gray=*/false);
|
||||||
|
EXPECT_TRUE(s.CreateICC());
|
||||||
|
EXPECT_TRUE(skcms_Parse(s.ICC().data(), s.ICC().size(), &jxl_profile));
|
||||||
|
}
|
||||||
|
EXPECT_TRUE(skcms_Transform(
|
||||||
|
float_pixels.get(), skcms_PixelFormat_RGBA_ffff,
|
||||||
|
info.alpha_premultiplied ? skcms_AlphaFormat_PremulAsEncoded : skcms_AlphaFormat_Unpremul,
|
||||||
|
&jxl_profile, byte_pixels.get(), skcms_PixelFormat_RGBA_8888, skcms_AlphaFormat_Unpremul,
|
||||||
|
skcms_sRGB_profile(), pixel_count));
|
||||||
|
|
||||||
|
return ImageData.new_(
|
||||||
|
Uint8ClampedArray.new_(typed_memory_view(component_count, byte_pixels.get())), info.xsize,
|
||||||
|
info.ysize);
|
||||||
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_BINDINGS(my_module) {
|
||||||
|
function("decode", &decode);
|
||||||
|
}
|
||||||
5
codecs/jxl/dec/jxl_dec.d.ts
vendored
Normal file
5
codecs/jxl/dec/jxl_dec.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
interface JXLModule extends EmscriptenWasm.Module {
|
||||||
|
decode(data: BufferSource): ImageData | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function(opts: EmscriptenWasm.ModuleOpts): Promise<JXLModule>;
|
||||||
69
codecs/jxl/dec/jxl_dec.js
Normal file
69
codecs/jxl/dec/jxl_dec.js
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
|
||||||
|
var jxl_dec = (function() {
|
||||||
|
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
|
||||||
|
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
|
||||||
|
return (
|
||||||
|
function(jxl_dec) {
|
||||||
|
jxl_dec = jxl_dec || {};
|
||||||
|
|
||||||
|
|
||||||
|
var d;d||(d=typeof jxl_dec !== 'undefined' ? jxl_dec : {});var aa,ba;d.ready=new Promise(function(a,b){aa=a;ba=b});var r={},t;for(t in d)d.hasOwnProperty(t)&&(r[t]=d[t]);var ca="./this.program",u=!1,v=!1,da=!1,ea=!1;u="object"===typeof window;v="function"===typeof importScripts;da="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;ea=!u&&!da&&!v;var w="",x,z,fa,ha;
|
||||||
|
if(da)w=v?require("path").dirname(w)+"/":__dirname+"/",x=function(a,b){fa||(fa=require("fs"));ha||(ha=require("path"));a=ha.normalize(a);return fa.readFileSync(a,b?null:"utf8")},z=function(a){a=x(a,!0);a.buffer||(a=new Uint8Array(a));a.buffer||A("Assertion failed: undefined");return a},1<process.argv.length&&(ca=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",function(a){throw a;}),process.on("unhandledRejection",A),d.inspect=function(){return"[Emscripten Module object]"};
|
||||||
|
else if(ea)"undefined"!=typeof read&&(x=function(a){return read(a)}),z=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");"object"===typeof a||A("Assertion failed: undefined");return a},"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!==typeof printErr?printErr:print);else if(u||v)v?w=self.location.href:document.currentScript&&(w=document.currentScript.src),_scriptDir&&
|
||||||
|
(w=_scriptDir),0!==w.indexOf("blob:")?w=w.substr(0,w.lastIndexOf("/")+1):w="",x=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},v&&(z=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var ia=d.print||console.log.bind(console),B=d.printErr||console.warn.bind(console);for(t in r)r.hasOwnProperty(t)&&(d[t]=r[t]);r=null;d.thisProgram&&(ca=d.thisProgram);var D;
|
||||||
|
d.wasmBinary&&(D=d.wasmBinary);var noExitRuntime;d.noExitRuntime&&(noExitRuntime=d.noExitRuntime);"object"!==typeof WebAssembly&&A("no native wasm support detected");var E,ja=new WebAssembly.Table({initial:273,maximum:273,element:"anyfunc"}),ka=!1,la="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
|
||||||
|
function ma(a,b,c){var e=b+c;for(c=b;a[c]&&!(c>=e);)++c;if(16<c-b&&a.subarray&&la)return la.decode(a.subarray(b,c));for(e="";b<c;){var f=a[b++];if(f&128){var g=a[b++]&63;if(192==(f&224))e+=String.fromCharCode((f&31)<<6|g);else{var l=a[b++]&63;f=224==(f&240)?(f&15)<<12|g<<6|l:(f&7)<<18|g<<12|l<<6|a[b++]&63;65536>f?e+=String.fromCharCode(f):(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else e+=String.fromCharCode(f)}return e}
|
||||||
|
function na(a,b,c){var e=F;if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}if(127>=g){if(b>=c)break;e[b++]=g}else{if(2047>=g){if(b+1>=c)break;e[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;e[b++]=224|g>>12}else{if(b+3>=c)break;e[b++]=240|g>>18;e[b++]=128|g>>12&63}e[b++]=128|g>>6&63}e[b++]=128|g&63}}e[b]=0}}var oa="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;
|
||||||
|
function pa(a,b){var c=a>>1;for(var e=c+b/2;!(c>=e)&&G[c];)++c;c<<=1;if(32<c-a&&oa)return oa.decode(F.subarray(a,c));c=0;for(e="";;){var f=H[a+2*c>>1];if(0==f||c==b/2)return e;++c;e+=String.fromCharCode(f)}}function qa(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var e=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)H[b>>1]=a.charCodeAt(f),b+=2;H[b>>1]=0;return b-e}function ra(a){return 2*a.length}
|
||||||
|
function sa(a,b){for(var c=0,e="";!(c>=b/4);){var f=I[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023)):e+=String.fromCharCode(f)}return e}function ta(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var e=b;c=e+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}I[b>>2]=g;b+=4;if(b+4>c)break}I[b>>2]=0;return b-e}
|
||||||
|
function ua(a){for(var b=0,c=0;c<a.length;++c){var e=a.charCodeAt(c);55296<=e&&57343>=e&&++c;b+=4}return b}var J,L,F,H,G,I,M,va,wa;function xa(a){J=a;d.HEAP8=L=new Int8Array(a);d.HEAP16=H=new Int16Array(a);d.HEAP32=I=new Int32Array(a);d.HEAPU8=F=new Uint8Array(a);d.HEAPU16=G=new Uint16Array(a);d.HEAPU32=M=new Uint32Array(a);d.HEAPF32=va=new Float32Array(a);d.HEAPF64=wa=new Float64Array(a)}var ya=d.INITIAL_MEMORY||16777216;d.wasmMemory?E=d.wasmMemory:E=new WebAssembly.Memory({initial:ya/65536,maximum:32768});
|
||||||
|
E&&(J=E.buffer);ya=J.byteLength;xa(J);I[755496]=8265024;function N(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(d);else{var c=b.$;"number"===typeof c?void 0===b.X?d.dynCall_v(c):d.dynCall_vi(c,b.X):c(void 0===b.X?null:b.X)}}}var za=[],Aa=[],Ba=[],Ca=[];function Da(){var a=d.preRun.shift();za.unshift(a)}var Ea=Math.ceil,Fa=Math.floor,O=0,Ga=null,Q=null;d.preloadedImages={};d.preloadedAudios={};
|
||||||
|
function A(a){if(d.onAbort)d.onAbort(a);B(a);ka=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");ba(a);throw a;}function Ha(a){var b=R;return String.prototype.startsWith?b.startsWith(a):0===b.indexOf(a)}function Ia(){return Ha("data:application/octet-stream;base64,")}var R="jxl_dec.wasm";if(!Ia()){var Ja=R;R=d.locateFile?d.locateFile(Ja,w):w+Ja}
|
||||||
|
function Ka(){try{if(D)return new Uint8Array(D);if(z)return z(R);throw"both async and sync fetching of the wasm failed";}catch(a){A(a)}}function La(){return D||!u&&!v||"function"!==typeof fetch||Ha("file://")?new Promise(function(a){a(Ka())}):fetch(R,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+R+"'";return a.arrayBuffer()}).catch(function(){return Ka()})}Aa.push({$:function(){Ma()}});
|
||||||
|
function Na(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var Oa=void 0;function S(a){for(var b="";F[a];)b+=Oa[F[a++]];return b}var T={},U={},V={};function Pa(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}
|
||||||
|
function Qa(a,b){a=Pa(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function Ra(a){var b=Error,c=Qa(a,function(e){this.name=a;this.message=e;e=Error(e).stack;void 0!==e&&(this.stack=this.toString()+"\n"+e.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}
|
||||||
|
var Sa=void 0;function W(a){throw new Sa(a);}var Ta=void 0;function Ua(a,b){function c(k){k=b(k);if(k.length!==e.length)throw new Ta("Mismatched type converter count");for(var h=0;h<e.length;++h)X(e[h],k[h])}var e=[];e.forEach(function(k){V[k]=a});var f=Array(a.length),g=[],l=0;a.forEach(function(k,h){U.hasOwnProperty(k)?f[h]=U[k]:(g.push(k),T.hasOwnProperty(k)||(T[k]=[]),T[k].push(function(){f[h]=U[k];++l;l===g.length&&c(f)}))});0===g.length&&c(f)}
|
||||||
|
function X(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var e=b.name;a||W('type "'+e+'" must have a positive integer typeid pointer');if(U.hasOwnProperty(a)){if(c.aa)return;W("Cannot register type '"+e+"' twice")}U[a]=b;delete V[a];T.hasOwnProperty(a)&&(b=T[a],delete T[a],b.forEach(function(f){f()}))}var Va=[],Y=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||||
|
function Wa(a){4<a&&0===--Y[a].Y&&(Y[a]=void 0,Va.push(a))}function Xa(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Va.length?Va.pop():Y.length;Y[b]={Y:1,value:a};return b}}function Ya(a){return this.fromWireType(M[a>>2])}function Za(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
||||||
|
function bb(a,b){switch(b){case 2:return function(c){return this.fromWireType(va[c>>2])};case 3:return function(c){return this.fromWireType(wa[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function cb(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Qa(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
||||||
|
function db(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function eb(a,b){var c=d;if(void 0===c[a].V){var e=c[a];c[a]=function(){c[a].V.hasOwnProperty(arguments.length)||W("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].V+")!");return c[a].V[arguments.length].apply(this,arguments)};c[a].V=[];c[a].V[e.Z]=e}}
|
||||||
|
function fb(a,b,c){d.hasOwnProperty(a)?((void 0===c||void 0!==d[a].V&&void 0!==d[a].V[c])&&W("Cannot register public name '"+a+"' twice"),eb(a,a),d.hasOwnProperty(c)&&W("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),d[a].V[c]=b):(d[a]=b,void 0!==c&&(d[a].da=c))}function gb(a,b){for(var c=[],e=0;e<a;e++)c.push(I[(b>>2)+e]);return c}
|
||||||
|
function hb(a,b){a=S(a);var c=d["dynCall_"+a];for(var e=[],f=1;f<a.length;++f)e.push("a"+f);f="return function dynCall_"+(a+"_"+b)+"("+e.join(", ")+") {\n";f+=" return dynCall(rawFunction"+(e.length?", ":"")+e.join(", ")+");\n";c=(new Function("dynCall","rawFunction",f+"};\n"))(c,b);"function"!==typeof c&&W("unknown function pointer with signature "+a+": "+b);return c}var ib=void 0;function jb(a){a=kb(a);var b=S(a);Z(a);return b}
|
||||||
|
function lb(a,b){function c(g){f[g]||U[g]||(V[g]?V[g].forEach(c):(e.push(g),f[g]=!0))}var e=[],f={};b.forEach(c);throw new ib(a+": "+e.map(jb).join([", "]));}function mb(a,b,c){switch(b){case 0:return c?function(e){return L[e]}:function(e){return F[e]};case 1:return c?function(e){return H[e>>1]}:function(e){return G[e>>1]};case 2:return c?function(e){return I[e>>2]}:function(e){return M[e>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var nb={};
|
||||||
|
function ob(){return"object"===typeof globalThis?globalThis:Function("return this")()}function pb(a,b){var c=U[a];void 0===c&&W(b+" has unknown type "+jb(a));return c}var qb={},rb={};function sb(){if(!tb){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"===typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:ca||"./this.program"},b;for(b in rb)a[b]=rb[b];var c=[];for(b in a)c.push(b+"="+a[b]);tb=c}return tb}
|
||||||
|
for(var tb,ub=[null,[],[]],vb=Array(256),wb=0;256>wb;++wb)vb[wb]=String.fromCharCode(wb);Oa=vb;Sa=d.BindingError=Ra("BindingError");Ta=d.InternalError=Ra("InternalError");d.count_emval_handles=function(){for(var a=0,b=5;b<Y.length;++b)void 0!==Y[b]&&++a;return a};d.get_first_emval=function(){for(var a=5;a<Y.length;++a)if(void 0!==Y[a])return Y[a];return null};ib=d.UnboundTypeError=Ra("UnboundTypeError");
|
||||||
|
var yb={f:function(){},p:function(a,b,c,e,f){var g=Na(c);b=S(b);X(a,{name:b,fromWireType:function(l){return!!l},toWireType:function(l,k){return k?e:f},argPackAdvance:8,readValueFromPointer:function(l){if(1===c)var k=L;else if(2===c)k=H;else if(4===c)k=I;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[l>>g])},W:null})},y:function(a,b){b=S(b);X(a,{name:b,fromWireType:function(c){var e=Y[c].value;Wa(c);return e},toWireType:function(c,e){return Xa(e)},argPackAdvance:8,
|
||||||
|
readValueFromPointer:Ya,W:null})},o:function(a,b,c){c=Na(c);b=S(b);X(a,{name:b,fromWireType:function(e){return e},toWireType:function(e,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+Za(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:bb(b,c),W:null})},r:function(a,b,c,e,f,g){var l=gb(b,c);a=S(a);f=hb(e,f);fb(a,function(){lb("Cannot call "+a+" due to unbound types",l)},b-1);Ua(l,function(k){var h=[k[0],null].concat(k.slice(1)),n=k=a,p=f,
|
||||||
|
q=h.length;2>q&&W("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var y=null!==h[1]&&!1,C=!1,m=1;m<h.length;++m)if(null!==h[m]&&void 0===h[m].W){C=!0;break}var $a="void"!==h[0].name,K="",P="";for(m=0;m<q-2;++m)K+=(0!==m?", ":"")+"arg"+m,P+=(0!==m?", ":"")+"arg"+m+"Wired";n="return function "+Pa(n)+"("+K+") {\nif (arguments.length !== "+(q-2)+") {\nthrowBindingError('function "+n+" called with ' + arguments.length + ' arguments, expected "+(q-2)+" args!');\n}\n";
|
||||||
|
C&&(n+="var destructors = [];\n");var ab=C?"destructors":"null";K="throwBindingError invoker fn runDestructors retType classParam".split(" ");p=[W,p,g,db,h[0],h[1]];y&&(n+="var thisWired = classParam.toWireType("+ab+", this);\n");for(m=0;m<q-2;++m)n+="var arg"+m+"Wired = argType"+m+".toWireType("+ab+", arg"+m+"); // "+h[m+2].name+"\n",K.push("argType"+m),p.push(h[m+2]);y&&(P="thisWired"+(0<P.length?", ":"")+P);n+=($a?"var rv = ":"")+"invoker(fn"+(0<P.length?", ":"")+P+");\n";if(C)n+="runDestructors(destructors);\n";
|
||||||
|
else for(m=y?1:2;m<h.length;++m)q=1===m?"thisWired":"arg"+(m-2)+"Wired",null!==h[m].W&&(n+=q+"_dtor("+q+"); // "+h[m].name+"\n",K.push(q+"_dtor"),p.push(h[m].W));$a&&(n+="var ret = retType.fromWireType(rv);\nreturn ret;\n");K.push(n+"}\n");h=cb(K).apply(null,p);m=b-1;if(!d.hasOwnProperty(k))throw new Ta("Replacing nonexistant public symbol");void 0!==d[k].V&&void 0!==m?d[k].V[m]=h:(d[k]=h,d[k].Z=m);return[]})},b:function(a,b,c,e,f){function g(n){return n}b=S(b);-1===f&&(f=4294967295);var l=Na(c);
|
||||||
|
if(0===e){var k=32-8*c;g=function(n){return n<<k>>>k}}var h=-1!=b.indexOf("unsigned");X(a,{name:b,fromWireType:g,toWireType:function(n,p){if("number"!==typeof p&&"boolean"!==typeof p)throw new TypeError('Cannot convert "'+Za(p)+'" to '+this.name);if(p<e||p>f)throw new TypeError('Passing a number "'+Za(p)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+e+", "+f+"]!");return h?p>>>0:p|0},argPackAdvance:8,readValueFromPointer:mb(b,l,0!==e),W:null})},
|
||||||
|
a:function(a,b,c){function e(g){g>>=2;var l=M;return new f(J,l[g+1],l[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=S(c);X(a,{name:c,fromWireType:e,argPackAdvance:8,readValueFromPointer:e},{aa:!0})},h:function(a,b){b=S(b);var c="std::string"===b;X(a,{name:b,fromWireType:function(e){var f=M[e>>2];if(c)for(var g=e+4,l=0;l<=f;++l){var k=e+4+l;if(l==f||0==F[k]){g=g?ma(F,g,k-g):"";if(void 0===h)var h=g;else h+=String.fromCharCode(0),h+=g;
|
||||||
|
g=k+1}}else{h=Array(f);for(l=0;l<f;++l)h[l]=String.fromCharCode(F[e+4+l]);h=h.join("")}Z(e);return h},toWireType:function(e,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||W("Cannot pass non-string to std::string");var l=(c&&g?function(){for(var n=0,p=0;p<f.length;++p){var q=f.charCodeAt(p);55296<=q&&57343>=q&&(q=65536+((q&1023)<<10)|f.charCodeAt(++p)&1023);127>=q?++n:n=2047>=q?n+2:65535>=
|
||||||
|
q?n+3:n+4}return n}:function(){return f.length})(),k=xb(4+l+1);M[k>>2]=l;if(c&&g)na(f,k+4,l+1);else if(g)for(g=0;g<l;++g){var h=f.charCodeAt(g);255<h&&(Z(k),W("String has UTF-16 code units that do not fit in 8 bits"));F[k+4+g]=h}else for(g=0;g<l;++g)F[k+4+g]=f[g];null!==e&&e.push(Z,k);return k},argPackAdvance:8,readValueFromPointer:Ya,W:function(e){Z(e)}})},g:function(a,b,c){c=S(c);if(2===b){var e=pa;var f=qa;var g=ra;var l=function(){return G};var k=1}else 4===b&&(e=sa,f=ta,g=ua,l=function(){return M},
|
||||||
|
k=2);X(a,{name:c,fromWireType:function(h){for(var n=M[h>>2],p=l(),q,y=h+4,C=0;C<=n;++C){var m=h+4+C*b;if(C==n||0==p[m>>k])y=e(y,m-y),void 0===q?q=y:(q+=String.fromCharCode(0),q+=y),y=m+b}Z(h);return q},toWireType:function(h,n){"string"!==typeof n&&W("Cannot pass non-string to C++ string type "+c);var p=g(n),q=xb(4+p+b);M[q>>2]=p>>k;f(n,q+4,p+b);null!==h&&h.push(Z,q);return q},argPackAdvance:8,readValueFromPointer:Ya,W:function(h){Z(h)}})},q:function(a,b){b=S(b);X(a,{ba:!0,name:b,argPackAdvance:0,
|
||||||
|
fromWireType:function(){},toWireType:function(){}})},d:Wa,e:function(a){if(0===a)return Xa(ob());var b=nb[a];a=void 0===b?S(a):b;return Xa(ob()[a])},j:function(a){4<a&&(Y[a].Y+=1)},k:function(a,b,c,e){a||W("Cannot use deleted val. handle = "+a);a=Y[a].value;var f=qb[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var l="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)l+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+
|
||||||
|
g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",l+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(pb,d,Xa);qb[b]=f}return f(a,c,e)},i:function(){A()},u:function(a,b,c){F.copyWithin(a,b,b+c)},c:function(a){a>>>=0;var b=F.length;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var e=b*(1+.2/c);e=Math.min(e,a+100663296);e=Math.max(16777216,
|
||||||
|
a,e);0<e%65536&&(e+=65536-e%65536);a:{try{E.grow(Math.min(2147483648,e)-J.byteLength+65535>>>16);xa(E.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},v:function(a,b){var c=0;sb().forEach(function(e,f){var g=b+c;f=I[a+4*f>>2]=g;for(g=0;g<e.length;++g)L[f++>>0]=e.charCodeAt(g);L[f>>0]=0;c+=e.length+1});return 0},w:function(a,b){var c=sb();I[a>>2]=c.length;var e=0;c.forEach(function(f){e+=f.length+1});I[b>>2]=e;return 0},x:function(){return 0},s:function(){},n:function(a,b,c,e){for(var f=
|
||||||
|
0,g=0;g<c;g++){for(var l=I[b+8*g>>2],k=I[b+(8*g+4)>>2],h=0;h<k;h++){var n=F[l+h],p=ub[a];0===n||10===n?((1===a?ia:B)(ma(p,0)),p.length=0):p.push(n)}f+=k}I[e>>2]=f;return 0},memory:E,l:function(a){a=+a;return 0<=a?+Fa(a+.5):+Ea(a-.5)},m:function(a){a=+a;return 0<=a?+Fa(a+.5):+Ea(a-.5)},t:function(){},table:ja};
|
||||||
|
(function(){function a(f){d.asm=f.exports;O--;d.monitorRunDependencies&&d.monitorRunDependencies(O);0==O&&(null!==Ga&&(clearInterval(Ga),Ga=null),Q&&(f=Q,Q=null,f()))}function b(f){a(f.instance)}function c(f){return La().then(function(g){return WebAssembly.instantiate(g,e)}).then(f,function(g){B("failed to asynchronously prepare wasm: "+g);A(g)})}var e={a:yb};O++;d.monitorRunDependencies&&d.monitorRunDependencies(O);if(d.instantiateWasm)try{return d.instantiateWasm(e,a)}catch(f){return B("Module.instantiateWasm callback failed with error: "+
|
||||||
|
f),!1}(function(){if(D||"function"!==typeof WebAssembly.instantiateStreaming||Ia()||Ha("file://")||"function"!==typeof fetch)return c(b);fetch(R,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(b,function(g){B("wasm streaming compile failed: "+g);B("falling back to ArrayBuffer instantiation");return c(b)})})})();return{}})();
|
||||||
|
var Ma=d.___wasm_call_ctors=function(){return(Ma=d.___wasm_call_ctors=d.asm.z).apply(null,arguments)},xb=d._malloc=function(){return(xb=d._malloc=d.asm.A).apply(null,arguments)},Z=d._free=function(){return(Z=d._free=d.asm.B).apply(null,arguments)},kb=d.___getTypeName=function(){return(kb=d.___getTypeName=d.asm.C).apply(null,arguments)};d.___embind_register_native_and_builtin_types=function(){return(d.___embind_register_native_and_builtin_types=d.asm.D).apply(null,arguments)};
|
||||||
|
d.dynCall_iii=function(){return(d.dynCall_iii=d.asm.E).apply(null,arguments)};d.dynCall_vii=function(){return(d.dynCall_vii=d.asm.F).apply(null,arguments)};d.dynCall_vi=function(){return(d.dynCall_vi=d.asm.G).apply(null,arguments)};d.dynCall_iidiiii=function(){return(d.dynCall_iidiiii=d.asm.H).apply(null,arguments)};d.dynCall_iiiiiii=function(){return(d.dynCall_iiiiiii=d.asm.I).apply(null,arguments)};d.dynCall_viii=function(){return(d.dynCall_viii=d.asm.J).apply(null,arguments)};
|
||||||
|
d.dynCall_ii=function(){return(d.dynCall_ii=d.asm.K).apply(null,arguments)};d.dynCall_viiii=function(){return(d.dynCall_viiii=d.asm.L).apply(null,arguments)};d.dynCall_v=function(){return(d.dynCall_v=d.asm.M).apply(null,arguments)};d.dynCall_viiiiiii=function(){return(d.dynCall_viiiiiii=d.asm.N).apply(null,arguments)};d.dynCall_viiiiii=function(){return(d.dynCall_viiiiii=d.asm.O).apply(null,arguments)};d.dynCall_iiii=function(){return(d.dynCall_iiii=d.asm.P).apply(null,arguments)};
|
||||||
|
d.dynCall_iiiii=function(){return(d.dynCall_iiiii=d.asm.Q).apply(null,arguments)};d.dynCall_iiji=function(){return(d.dynCall_iiji=d.asm.R).apply(null,arguments)};d.dynCall_iifi=function(){return(d.dynCall_iifi=d.asm.S).apply(null,arguments)};d.dynCall_jiji=function(){return(d.dynCall_jiji=d.asm.T).apply(null,arguments)};d.dynCall_viiiii=function(){return(d.dynCall_viiiii=d.asm.U).apply(null,arguments)};var zb;Q=function Ab(){zb||Bb();zb||(Q=Ab)};
|
||||||
|
function Bb(){function a(){if(!zb&&(zb=!0,d.calledRun=!0,!ka)){N(Aa);N(Ba);aa(d);if(d.onRuntimeInitialized)d.onRuntimeInitialized();if(d.postRun)for("function"==typeof d.postRun&&(d.postRun=[d.postRun]);d.postRun.length;){var b=d.postRun.shift();Ca.unshift(b)}N(Ca)}}if(!(0<O)){if(d.preRun)for("function"==typeof d.preRun&&(d.preRun=[d.preRun]);d.preRun.length;)Da();N(za);0<O||(d.setStatus?(d.setStatus("Running..."),setTimeout(function(){setTimeout(function(){d.setStatus("")},1);a()},1)):a())}}
|
||||||
|
d.run=Bb;if(d.preInit)for("function"==typeof d.preInit&&(d.preInit=[d.preInit]);0<d.preInit.length;)d.preInit.pop()();noExitRuntime=!0;Bb();
|
||||||
|
|
||||||
|
|
||||||
|
return jxl_dec.ready
|
||||||
|
}
|
||||||
|
);
|
||||||
|
})();
|
||||||
|
if (typeof exports === 'object' && typeof module === 'object')
|
||||||
|
module.exports = jxl_dec;
|
||||||
|
else if (typeof define === 'function' && define['amd'])
|
||||||
|
define([], function() { return jxl_dec; });
|
||||||
|
else if (typeof exports === 'object')
|
||||||
|
exports["jxl_dec"] = jxl_dec;
|
||||||
|
|
||||||
BIN
codecs/jxl/dec/jxl_dec.wasm
Normal file
BIN
codecs/jxl/dec/jxl_dec.wasm
Normal file
Binary file not shown.
56
codecs/jxl/enc/jxl_enc.cpp
Normal file
56
codecs/jxl/enc/jxl_enc.cpp
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
#include <emscripten/bind.h>
|
||||||
|
#include <emscripten/val.h>
|
||||||
|
|
||||||
|
#include "lib/jxl/enc_file.h"
|
||||||
|
#include "lib/jxl/external_image.h"
|
||||||
|
|
||||||
|
using namespace emscripten;
|
||||||
|
|
||||||
|
thread_local const val Uint8Array = val::global("Uint8Array");
|
||||||
|
|
||||||
|
struct JXLOptions {
|
||||||
|
// 1 = slowest
|
||||||
|
// 7 = fastest
|
||||||
|
int speed;
|
||||||
|
float quality;
|
||||||
|
};
|
||||||
|
|
||||||
|
val encode(std::string image, int width, int height, JXLOptions options) {
|
||||||
|
jxl::CompressParams cparams;
|
||||||
|
jxl::PassesEncoderState passes_enc_state;
|
||||||
|
jxl::CodecInOut io;
|
||||||
|
jxl::PaddedBytes bytes;
|
||||||
|
jxl::ImageBundle* main = &io.Main();
|
||||||
|
|
||||||
|
cparams.speed_tier = static_cast<jxl::SpeedTier>(options.speed);
|
||||||
|
cparams.butteraugli_distance = options.quality;
|
||||||
|
|
||||||
|
io.metadata.SetAlphaBits(8);
|
||||||
|
|
||||||
|
uint8_t* inBuffer = (uint8_t*)image.c_str();
|
||||||
|
|
||||||
|
auto result = jxl::ConvertImage(
|
||||||
|
jxl::Span<const uint8_t>(reinterpret_cast<const uint8_t*>(image.data()), image.size()), width,
|
||||||
|
height, jxl::ColorEncoding::SRGB(/*is_gray=*/false), /*has_alpha=*/true,
|
||||||
|
/*alpha_is_premultiplied=*/false, /*bits_per_alpha=*/8, /*bits_per_sample=*/8,
|
||||||
|
/*big_endian=*/false, /*flipped_y=*/false, /*pool=*/nullptr, main);
|
||||||
|
|
||||||
|
if (!result) {
|
||||||
|
return val::null();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto js_result = val::null();
|
||||||
|
if (EncodeFile(cparams, &io, &passes_enc_state, &bytes)) {
|
||||||
|
js_result = Uint8Array.new_(typed_memory_view(bytes.size(), bytes.data()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return js_result;
|
||||||
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_BINDINGS(my_module) {
|
||||||
|
value_object<JXLOptions>("JXLOptions")
|
||||||
|
.field("speed", &JXLOptions::speed)
|
||||||
|
.field("quality", &JXLOptions::quality);
|
||||||
|
|
||||||
|
function("encode", &encode);
|
||||||
|
}
|
||||||
7
codecs/jxl/enc/jxl_enc.d.ts
vendored
Normal file
7
codecs/jxl/enc/jxl_enc.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { EncodeOptions } from '../../../src/codecs/jxl/encoder-meta';
|
||||||
|
|
||||||
|
interface JXLModule extends EmscriptenWasm.Module {
|
||||||
|
encode(data: BufferSource, width: number, height: number, options: EncodeOptions): Uint8Array | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function(opts: EmscriptenWasm.ModuleOpts): Promise<JXLModule>;
|
||||||
115
codecs/jxl/enc/jxl_enc.js
Normal file
115
codecs/jxl/enc/jxl_enc.js
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
|
||||||
|
var jxl_enc = (function() {
|
||||||
|
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
|
||||||
|
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
|
||||||
|
return (
|
||||||
|
function(jxl_enc) {
|
||||||
|
jxl_enc = jxl_enc || {};
|
||||||
|
|
||||||
|
|
||||||
|
var f;f||(f=typeof jxl_enc !== 'undefined' ? jxl_enc : {});var aa,ba;f.ready=new Promise(function(a,b){aa=a;ba=b});var p={},t;for(t in f)f.hasOwnProperty(t)&&(p[t]=f[t]);var ca="./this.program",da=!1,w=!1,ea=!1,fa=!1;da="object"===typeof window;w="function"===typeof importScripts;ea="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;fa=!da&&!ea&&!w;var z="",ha,ia,ka,la;
|
||||||
|
if(ea)z=w?require("path").dirname(z)+"/":__dirname+"/",ha=function(a,b){ka||(ka=require("fs"));la||(la=require("path"));a=la.normalize(a);return ka.readFileSync(a,b?null:"utf8")},ia=function(a){a=ha(a,!0);a.buffer||(a=new Uint8Array(a));assert(a.buffer);return a},1<process.argv.length&&(ca=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",function(a){throw a;}),process.on("unhandledRejection",A),f.inspect=function(){return"[Emscripten Module object]"};else if(fa)"undefined"!=
|
||||||
|
typeof read&&(ha=function(a){return read(a)}),ia=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");assert("object"===typeof a);return a},"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!==typeof printErr?printErr:print);else if(da||w)w?z=self.location.href:document.currentScript&&(z=document.currentScript.src),_scriptDir&&(z=_scriptDir),0!==z.indexOf("blob:")?z=z.substr(0,
|
||||||
|
z.lastIndexOf("/")+1):z="",ha=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},w&&(ia=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var ma=f.print||console.log.bind(console),B=f.printErr||console.warn.bind(console);for(t in p)p.hasOwnProperty(t)&&(f[t]=p[t]);p=null;f.thisProgram&&(ca=f.thisProgram);var na;f.wasmBinary&&(na=f.wasmBinary);var noExitRuntime;
|
||||||
|
f.noExitRuntime&&(noExitRuntime=f.noExitRuntime);"object"!==typeof WebAssembly&&A("no native wasm support detected");var C,oa=new WebAssembly.Table({initial:780,maximum:780,element:"anyfunc"}),pa=!1;function assert(a,b){a||A("Assertion failed: "+b)}var qa="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
|
||||||
|
function D(a,b,c){var d=b+c;for(c=b;a[c]&&!(c>=d);)++c;if(16<c-b&&a.subarray&&qa)return qa.decode(a.subarray(b,c));for(d="";b<c;){var e=a[b++];if(e&128){var g=a[b++]&63;if(192==(e&224))d+=String.fromCharCode((e&31)<<6|g);else{var k=a[b++]&63;e=224==(e&240)?(e&15)<<12|g<<6|k:(e&7)<<18|g<<12|k<<6|a[b++]&63;65536>e?d+=String.fromCharCode(e):(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023))}}else d+=String.fromCharCode(e)}return d}
|
||||||
|
function ra(a,b,c,d){if(!(0<d))return 0;var e=c;d=c+d-1;for(var g=0;g<a.length;++g){var k=a.charCodeAt(g);if(55296<=k&&57343>=k){var m=a.charCodeAt(++g);k=65536+((k&1023)<<10)|m&1023}if(127>=k){if(c>=d)break;b[c++]=k}else{if(2047>=k){if(c+1>=d)break;b[c++]=192|k>>6}else{if(65535>=k){if(c+2>=d)break;b[c++]=224|k>>12}else{if(c+3>=d)break;b[c++]=240|k>>18;b[c++]=128|k>>12&63}b[c++]=128|k>>6&63}b[c++]=128|k&63}}b[c]=0;return c-e}
|
||||||
|
function sa(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&(d=65536+((d&1023)<<10)|a.charCodeAt(++c)&1023);127>=d?++b:b=2047>=d?b+2:65535>=d?b+3:b+4}return b}var ta="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function ua(a,b){var c=a>>1;for(var d=c+b/2;!(c>=d)&&va[c];)++c;c<<=1;if(32<c-a&&ta)return ta.decode(E.subarray(a,c));c=0;for(d="";;){var e=G[a+2*c>>1];if(0==e||c==b/2)return d;++c;d+=String.fromCharCode(e)}}
|
||||||
|
function wa(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var e=0;e<c;++e)G[b>>1]=a.charCodeAt(e),b+=2;G[b>>1]=0;return b-d}function xa(a){return 2*a.length}function ya(a,b){for(var c=0,d="";!(c>=b/4);){var e=H[a+4*c>>2];if(0==e)break;++c;65536<=e?(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023)):d+=String.fromCharCode(e)}return d}
|
||||||
|
function za(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var e=0;e<a.length;++e){var g=a.charCodeAt(e);if(55296<=g&&57343>=g){var k=a.charCodeAt(++e);g=65536+((g&1023)<<10)|k&1023}H[b>>2]=g;b+=4;if(b+4>c)break}H[b>>2]=0;return b-d}function Aa(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&++c;b+=4}return b}var I,J,E,G,va,H,K,Ba,Ca;
|
||||||
|
function Da(a){I=a;f.HEAP8=J=new Int8Array(a);f.HEAP16=G=new Int16Array(a);f.HEAP32=H=new Int32Array(a);f.HEAPU8=E=new Uint8Array(a);f.HEAPU16=va=new Uint16Array(a);f.HEAPU32=K=new Uint32Array(a);f.HEAPF32=Ba=new Float32Array(a);f.HEAPF64=Ca=new Float64Array(a)}var Ea=f.INITIAL_MEMORY||16777216;f.wasmMemory?C=f.wasmMemory:C=new WebAssembly.Memory({initial:Ea/65536,maximum:32768});C&&(I=C.buffer);Ea=I.byteLength;Da(I);H[771892]=8330608;
|
||||||
|
function Fa(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(f);else{var c=b.eb;"number"===typeof c?void 0===b.Ma?f.dynCall_v(c):f.dynCall_vi(c,b.Ma):c(void 0===b.Ma?null:b.Ma)}}}var Ga=[],Ha=[],Ia=[],Ja=[];function Ka(){var a=f.preRun.shift();Ga.unshift(a)}var La=Math.abs,Ma=Math.ceil,Na=Math.floor,Oa=Math.min,L=0,Pa=null,Qa=null;f.preloadedImages={};f.preloadedAudios={};
|
||||||
|
function A(a){if(f.onAbort)f.onAbort(a);B(a);pa=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");ba(a);throw a;}function Ra(a){var b=M;return String.prototype.startsWith?b.startsWith(a):0===b.indexOf(a)}function Sa(){return Ra("data:application/octet-stream;base64,")}var M="jxl_enc.wasm";if(!Sa()){var Ta=M;M=f.locateFile?f.locateFile(Ta,z):z+Ta}
|
||||||
|
function Ua(){try{if(na)return new Uint8Array(na);if(ia)return ia(M);throw"both async and sync fetching of the wasm failed";}catch(a){A(a)}}function Va(){return na||!da&&!w||"function"!==typeof fetch||Ra("file://")?new Promise(function(a){a(Ua())}):fetch(M,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+M+"'";return a.arrayBuffer()}).catch(function(){return Ua()})}var N,Wa;Ha.push({eb:function(){Xa()}});function Ya(){return 0<Ya.Ia}
|
||||||
|
function Za(a,b){for(var c=0,d=a.length-1;0<=d;d--){var e=a[d];"."===e?a.splice(d,1):".."===e?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c;c--)a.unshift("..");return a}function $a(a){var b="/"===a.charAt(0),c="/"===a.substr(-1);(a=Za(a.split("/").filter(function(d){return!!d}),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a}
|
||||||
|
function ab(a){var b=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);a=b[0];b=b[1];if(!a&&!b)return".";b&&(b=b.substr(0,b.length-1));return a+b}function bb(a){if("/"===a)return"/";var b=a.lastIndexOf("/");return-1===b?a:a.substr(b+1)}
|
||||||
|
function cb(){for(var a="",b=!1,c=arguments.length-1;-1<=c&&!b;c--){b=0<=c?arguments[c]:"/";if("string"!==typeof b)throw new TypeError("Arguments to path.resolve must be strings");if(!b)return"";a=b+"/"+a;b="/"===b.charAt(0)}a=Za(a.split("/").filter(function(d){return!!d}),!b).join("/");return(b?"/":"")+a||"."}var db=[];function eb(a,b){db[a]={input:[],output:[],Ba:b};fb(a,gb)}
|
||||||
|
var gb={open:function(a){var b=db[a.node.rdev];if(!b)throw new O(43);a.tty=b;a.seekable=!1},close:function(a){a.tty.Ba.flush(a.tty)},flush:function(a){a.tty.Ba.flush(a.tty)},read:function(a,b,c,d){if(!a.tty||!a.tty.Ba.Xa)throw new O(60);for(var e=0,g=0;g<d;g++){try{var k=a.tty.Ba.Xa(a.tty)}catch(m){throw new O(29);}if(void 0===k&&0===e)throw new O(6);if(null===k||void 0===k)break;e++;b[c+g]=k}e&&(a.node.timestamp=Date.now());return e},write:function(a,b,c,d){if(!a.tty||!a.tty.Ba.Oa)throw new O(60);
|
||||||
|
try{for(var e=0;e<d;e++)a.tty.Ba.Oa(a.tty,b[c+e])}catch(g){throw new O(29);}d&&(a.node.timestamp=Date.now());return e}},ib={Xa:function(a){if(!a.input.length){var b=null;if(ea){var c=Buffer.Ia?Buffer.Ia(256):new Buffer(256),d=0;try{d=ka.readSync(process.stdin.fd,c,0,256,null)}catch(e){if(-1!=e.toString().indexOf("EOF"))d=0;else throw e;}0<d?b=c.slice(0,d).toString("utf-8"):b=null}else"undefined"!=typeof window&&"function"==typeof window.prompt?(b=window.prompt("Input: "),null!==b&&(b+="\n")):"function"==
|
||||||
|
typeof readline&&(b=readline(),null!==b&&(b+="\n"));if(!b)return null;a.input=hb(b,!0)}return a.input.shift()},Oa:function(a,b){null===b||10===b?(ma(D(a.output,0)),a.output=[]):0!=b&&a.output.push(b)},flush:function(a){a.output&&0<a.output.length&&(ma(D(a.output,0)),a.output=[])}},jb={Oa:function(a,b){null===b||10===b?(B(D(a.output,0)),a.output=[]):0!=b&&a.output.push(b)},flush:function(a){a.output&&0<a.output.length&&(B(D(a.output,0)),a.output=[])}},P={ta:null,ya:function(){return P.createNode(null,
|
||||||
|
"/",16895,0)},createNode:function(a,b,c,d){if(24576===(c&61440)||4096===(c&61440))throw new O(63);P.ta||(P.ta={dir:{node:{za:P.pa.za,va:P.pa.va,lookup:P.pa.lookup,Fa:P.pa.Fa,rename:P.pa.rename,unlink:P.pa.unlink,rmdir:P.pa.rmdir,readdir:P.pa.readdir,symlink:P.pa.symlink},stream:{Aa:P.qa.Aa}},file:{node:{za:P.pa.za,va:P.pa.va},stream:{Aa:P.qa.Aa,read:P.qa.read,write:P.qa.write,Ra:P.qa.Ra,Ya:P.qa.Ya,Ha:P.qa.Ha}},link:{node:{za:P.pa.za,va:P.pa.va,readlink:P.pa.readlink},stream:{}},Sa:{node:{za:P.pa.za,
|
||||||
|
va:P.pa.va},stream:kb}});c=lb(a,b,c,d);16384===(c.mode&61440)?(c.pa=P.ta.dir.node,c.qa=P.ta.dir.stream,c.oa={}):32768===(c.mode&61440)?(c.pa=P.ta.file.node,c.qa=P.ta.file.stream,c.ra=0,c.oa=null):40960===(c.mode&61440)?(c.pa=P.ta.link.node,c.qa=P.ta.link.stream):8192===(c.mode&61440)&&(c.pa=P.ta.Sa.node,c.qa=P.ta.Sa.stream);c.timestamp=Date.now();a&&(a.oa[b]=c);return c},xb:function(a){if(a.oa&&a.oa.subarray){for(var b=[],c=0;c<a.ra;++c)b.push(a.oa[c]);return b}return a.oa},yb:function(a){return a.oa?
|
||||||
|
a.oa.subarray?a.oa.subarray(0,a.ra):new Uint8Array(a.oa):new Uint8Array(0)},Ta:function(a,b){var c=a.oa?a.oa.length:0;c>=b||(b=Math.max(b,c*(1048576>c?2:1.125)>>>0),0!=c&&(b=Math.max(b,256)),c=a.oa,a.oa=new Uint8Array(b),0<a.ra&&a.oa.set(c.subarray(0,a.ra),0))},nb:function(a,b){if(a.ra!=b)if(0==b)a.oa=null,a.ra=0;else{if(!a.oa||a.oa.subarray){var c=a.oa;a.oa=new Uint8Array(b);c&&a.oa.set(c.subarray(0,Math.min(b,a.ra)))}else if(a.oa||(a.oa=[]),a.oa.length>b)a.oa.length=b;else for(;a.oa.length<b;)a.oa.push(0);
|
||||||
|
a.ra=b}},pa:{za:function(a){var b={};b.dev=8192===(a.mode&61440)?a.id:1;b.ino=a.id;b.mode=a.mode;b.nlink=1;b.uid=0;b.gid=0;b.rdev=a.rdev;16384===(a.mode&61440)?b.size=4096:32768===(a.mode&61440)?b.size=a.ra:40960===(a.mode&61440)?b.size=a.link.length:b.size=0;b.atime=new Date(a.timestamp);b.mtime=new Date(a.timestamp);b.ctime=new Date(a.timestamp);b.bb=4096;b.blocks=Math.ceil(b.size/b.bb);return b},va:function(a,b){void 0!==b.mode&&(a.mode=b.mode);void 0!==b.timestamp&&(a.timestamp=b.timestamp);void 0!==
|
||||||
|
b.size&&P.nb(a,b.size)},lookup:function(){throw mb[44];},Fa:function(a,b,c,d){return P.createNode(a,b,c,d)},rename:function(a,b,c){if(16384===(a.mode&61440)){try{var d=nb(b,c)}catch(g){}if(d)for(var e in d.oa)throw new O(55);}delete a.parent.oa[a.name];a.name=c;b.oa[c]=a;a.parent=b},unlink:function(a,b){delete a.oa[b]},rmdir:function(a,b){var c=nb(a,b),d;for(d in c.oa)throw new O(55);delete a.oa[b]},readdir:function(a){var b=[".",".."],c;for(c in a.oa)a.oa.hasOwnProperty(c)&&b.push(c);return b},symlink:function(a,
|
||||||
|
b,c){a=P.createNode(a,b,41471,0);a.link=c;return a},readlink:function(a){if(40960!==(a.mode&61440))throw new O(28);return a.link}},qa:{read:function(a,b,c,d,e){var g=a.node.oa;if(e>=a.node.ra)return 0;a=Math.min(a.node.ra-e,d);if(8<a&&g.subarray)b.set(g.subarray(e,e+a),c);else for(d=0;d<a;d++)b[c+d]=g[e+d];return a},write:function(a,b,c,d,e,g){b.buffer===J.buffer&&(g=!1);if(!d)return 0;a=a.node;a.timestamp=Date.now();if(b.subarray&&(!a.oa||a.oa.subarray)){if(g)return a.oa=b.subarray(c,c+d),a.ra=d;
|
||||||
|
if(0===a.ra&&0===e)return a.oa=b.slice(c,c+d),a.ra=d;if(e+d<=a.ra)return a.oa.set(b.subarray(c,c+d),e),d}P.Ta(a,e+d);if(a.oa.subarray&&b.subarray)a.oa.set(b.subarray(c,c+d),e);else for(g=0;g<d;g++)a.oa[e+g]=b[c+g];a.ra=Math.max(a.ra,e+d);return d},Aa:function(a,b,c){1===c?b+=a.position:2===c&&32768===(a.node.mode&61440)&&(b+=a.node.ra);if(0>b)throw new O(28);return b},Ra:function(a,b,c){P.Ta(a.node,b+c);a.node.ra=Math.max(a.node.ra,b+c)},Ya:function(a,b,c,d,e,g){assert(0===b);if(32768!==(a.node.mode&
|
||||||
|
61440))throw new O(43);a=a.node.oa;if(g&2||a.buffer!==I){if(0<d||d+c<a.length)a.subarray?a=a.subarray(d,d+c):a=Array.prototype.slice.call(a,d,d+c);d=!0;g=16384*Math.ceil(c/16384);for(b=ob(g);c<g;)J[b+c++]=0;c=b;if(!c)throw new O(48);J.set(a,c)}else d=!1,c=a.byteOffset;return{Fb:c,$a:d}},Ha:function(a,b,c,d,e){if(32768!==(a.node.mode&61440))throw new O(43);if(e&2)return 0;P.qa.write(a,b,0,d,c,!1);return 0}}},pb=null,qb={},Q=[],rb=1,sb=null,tb=!0,ub={},O=null,mb={};
|
||||||
|
function R(a,b){a=cb("/",a);b=b||{};if(!a)return{path:"",node:null};var c={Wa:!0,Pa:0},d;for(d in c)void 0===b[d]&&(b[d]=c[d]);if(8<b.Pa)throw new O(32);a=Za(a.split("/").filter(function(k){return!!k}),!1);var e=pb;c="/";for(d=0;d<a.length;d++){var g=d===a.length-1;if(g&&b.parent)break;e=nb(e,a[d]);c=$a(c+"/"+a[d]);e.Ga&&(!g||g&&b.Wa)&&(e=e.Ga.root);if(!g||b.Va)for(g=0;40960===(e.mode&61440);)if(e=vb(c),c=cb(ab(c),e),e=R(c,{Pa:b.Pa}).node,40<g++)throw new O(32);}return{path:c,node:e}}
|
||||||
|
function wb(a){for(var b;;){if(a===a.parent)return a=a.ya.Za,b?"/"!==a[a.length-1]?a+"/"+b:a+b:a;b=b?a.name+"/"+b:a.name;a=a.parent}}function xb(a,b){for(var c=0,d=0;d<b.length;d++)c=(c<<5)-c+b.charCodeAt(d)|0;return(a+c>>>0)%sb.length}function nb(a,b){var c;if(c=(c=yb(a,"x"))?c:a.pa.lookup?0:2)throw new O(c,a);for(c=sb[xb(a.id,b)];c;c=c.kb){var d=c.name;if(c.parent.id===a.id&&d===b)return c}return a.pa.lookup(a,b)}
|
||||||
|
function lb(a,b,c,d){a=new zb(a,b,c,d);b=xb(a.parent.id,a.name);a.kb=sb[b];return sb[b]=a}var Ab={r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218};function Bb(a){var b=["r","w","rw"][a&3];a&512&&(b+="w");return b}function yb(a,b){if(tb)return 0;if(-1===b.indexOf("r")||a.mode&292){if(-1!==b.indexOf("w")&&!(a.mode&146)||-1!==b.indexOf("x")&&!(a.mode&73))return 2}else return 2;return 0}
|
||||||
|
function Cb(a,b){try{return nb(a,b),20}catch(c){}return yb(a,"wx")}function Db(){var a=4096;for(var b=0;b<=a;b++)if(!Q[b])return b;throw new O(33);}function Eb(a){Fb||(Fb=function(){},Fb.prototype={});var b=new Fb,c;for(c in a)b[c]=a[c];a=b;b=Db();a.fd=b;return Q[b]=a}var kb={open:function(a){a.qa=qb[a.node.rdev].qa;a.qa.open&&a.qa.open(a)},Aa:function(){throw new O(70);}};function fb(a,b){qb[a]={qa:b}}
|
||||||
|
function Gb(a,b){var c="/"===b,d=!b;if(c&&pb)throw new O(10);if(!c&&!d){var e=R(b,{Wa:!1});b=e.path;e=e.node;if(e.Ga)throw new O(10);if(16384!==(e.mode&61440))throw new O(54);}b={type:a,Db:{},Za:b,jb:[]};a=a.ya(b);a.ya=b;b.root=a;c?pb=a:e&&(e.Ga=b,e.ya&&e.ya.jb.push(b))}function Hb(a,b,c){var d=R(a,{parent:!0}).node;a=bb(a);if(!a||"."===a||".."===a)throw new O(28);var e=Cb(d,a);if(e)throw new O(e);if(!d.pa.Fa)throw new O(63);return d.pa.Fa(d,a,b,c)}function S(a){Hb(a,16895,0)}
|
||||||
|
function Ib(a,b,c){"undefined"===typeof c&&(c=b,b=438);Hb(a,b|8192,c)}function Jb(a,b){if(!cb(a))throw new O(44);var c=R(b,{parent:!0}).node;if(!c)throw new O(44);b=bb(b);var d=Cb(c,b);if(d)throw new O(d);if(!c.pa.symlink)throw new O(63);c.pa.symlink(c,b,a)}function vb(a){a=R(a).node;if(!a)throw new O(44);if(!a.pa.readlink)throw new O(28);return cb(wb(a.parent),a.pa.readlink(a))}
|
||||||
|
function Kb(a,b){if(""===a)throw new O(44);if("string"===typeof b){var c=Ab[b];if("undefined"===typeof c)throw Error("Unknown file open mode: "+b);b=c}var d=b&64?("undefined"===typeof d?438:d)&4095|32768:0;if("object"===typeof a)var e=a;else{a=$a(a);try{e=R(a,{Va:!(b&131072)}).node}catch(k){}}c=!1;if(b&64)if(e){if(b&128)throw new O(20);}else e=Hb(a,d,0),c=!0;if(!e)throw new O(44);8192===(e.mode&61440)&&(b&=-513);if(b&65536&&16384!==(e.mode&61440))throw new O(54);if(!c&&(d=e?40960===(e.mode&61440)?
|
||||||
|
32:16384===(e.mode&61440)&&("r"!==Bb(b)||b&512)?31:yb(e,Bb(b)):44))throw new O(d);if(b&512){d=e;var g;"string"===typeof d?g=R(d,{Va:!0}).node:g=d;if(!g.pa.va)throw new O(63);if(16384===(g.mode&61440))throw new O(31);if(32768!==(g.mode&61440))throw new O(28);if(d=yb(g,"w"))throw new O(d);g.pa.va(g,{size:0,timestamp:Date.now()})}b&=-131713;e=Eb({node:e,path:wb(e),flags:b,seekable:!0,position:0,qa:e.qa,wb:[],error:!1});e.qa.open&&e.qa.open(e);!f.logReadFiles||b&1||(Lb||(Lb={}),a in Lb||(Lb[a]=1,B("FS.trackingDelegate error on read file: "+
|
||||||
|
a)));try{ub.onOpenFile&&(e=0,1!==(b&2097155)&&(e|=1),0!==(b&2097155)&&(e|=2),ub.onOpenFile(a,e))}catch(k){B("FS.trackingDelegate['onOpenFile']('"+a+"', flags) threw an exception: "+k.message)}}function Mb(a,b,c){if(null===a.fd)throw new O(8);if(!a.seekable||!a.qa.Aa)throw new O(70);if(0!=c&&1!=c&&2!=c)throw new O(28);a.position=a.qa.Aa(a,b,c);a.wb=[]}
|
||||||
|
function Nb(){O||(O=function(a,b){this.node=b;this.ob=function(c){this.Ea=c};this.ob(a);this.message="FS error"},O.prototype=Error(),O.prototype.constructor=O,[44].forEach(function(a){mb[a]=new O(a);mb[a].stack="<generic error, no stack>"}))}var Ob;function Pb(a,b){var c=0;a&&(c|=365);b&&(c|=146);return c}
|
||||||
|
function Qb(a,b,c){a=$a("/dev/"+a);var d=Pb(!!b,!!c);Rb||(Rb=64);var e=Rb++<<8|0;fb(e,{open:function(g){g.seekable=!1},close:function(){c&&c.buffer&&c.buffer.length&&c(10)},read:function(g,k,m,l){for(var q=0,r=0;r<l;r++){try{var u=b()}catch(x){throw new O(29);}if(void 0===u&&0===q)throw new O(6);if(null===u||void 0===u)break;q++;k[m+r]=u}q&&(g.node.timestamp=Date.now());return q},write:function(g,k,m,l){for(var q=0;q<l;q++)try{c(k[m+q])}catch(r){throw new O(29);}l&&(g.node.timestamp=Date.now());return q}});
|
||||||
|
Ib(a,d,e)}var Rb,Sb={},Fb,Lb,Tb={};function Ub(a){a=Q[a];if(!a)throw new O(8);return a}var Vb={};function Wb(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Xb(a){return this.fromWireType(K[a>>2])}var T={},U={},Yb={};function Zb(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}
|
||||||
|
function $b(a,b){a=Zb(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function ac(a){var b=Error,c=$b(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}
|
||||||
|
var bc=void 0;function cc(a,b,c){function d(m){m=c(m);if(m.length!==a.length)throw new bc("Mismatched type converter count");for(var l=0;l<a.length;++l)V(a[l],m[l])}a.forEach(function(m){Yb[m]=b});var e=Array(b.length),g=[],k=0;b.forEach(function(m,l){U.hasOwnProperty(m)?e[l]=U[m]:(g.push(m),T.hasOwnProperty(m)||(T[m]=[]),T[m].push(function(){e[l]=U[m];++k;k===g.length&&d(e)}))});0===g.length&&d(e)}
|
||||||
|
function dc(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var ec=void 0;function W(a){for(var b="";E[a];)b+=ec[E[a++]];return b}var fc=void 0;function X(a){throw new fc(a);}
|
||||||
|
function V(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||X('type "'+d+'" must have a positive integer typeid pointer');if(U.hasOwnProperty(a)){if(c.ib)return;X("Cannot register type '"+d+"' twice")}U[a]=b;delete Yb[a];T.hasOwnProperty(a)&&(b=T[a],delete T[a],b.forEach(function(e){e()}))}var hc=[],Y=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||||
|
function ic(a){4<a&&0===--Y[a].Qa&&(Y[a]=void 0,hc.push(a))}function jc(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=hc.length?hc.pop():Y.length;Y[b]={Qa:1,value:a};return b}}function kc(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
||||||
|
function lc(a,b){switch(b){case 2:return function(c){return this.fromWireType(Ba[c>>2])};case 3:return function(c){return this.fromWireType(Ca[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function mc(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=$b(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
||||||
|
function nc(a,b){var c=f;if(void 0===c[a].ua){var d=c[a];c[a]=function(){c[a].ua.hasOwnProperty(arguments.length)||X("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].ua+")!");return c[a].ua[arguments.length].apply(this,arguments)};c[a].ua=[];c[a].ua[d.ab]=d}}
|
||||||
|
function oc(a,b,c){f.hasOwnProperty(a)?((void 0===c||void 0!==f[a].ua&&void 0!==f[a].ua[c])&&X("Cannot register public name '"+a+"' twice"),nc(a,a),f.hasOwnProperty(c)&&X("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),f[a].ua[c]=b):(f[a]=b,void 0!==c&&(f[a].Cb=c))}function pc(a,b){for(var c=[],d=0;d<a;d++)c.push(H[(b>>2)+d]);return c}
|
||||||
|
function qc(a,b){a=W(a);var c=f["dynCall_"+a];for(var d=[],e=1;e<a.length;++e)d.push("a"+e);e="return function dynCall_"+(a+"_"+b)+"("+d.join(", ")+") {\n";e+=" return dynCall(rawFunction"+(d.length?", ":"")+d.join(", ")+");\n";c=(new Function("dynCall","rawFunction",e+"};\n"))(c,b);"function"!==typeof c&&X("unknown function pointer with signature "+a+": "+b);return c}var rc=void 0;function sc(a){a=tc(a);var b=W(a);Z(a);return b}
|
||||||
|
function uc(a,b){function c(g){e[g]||U[g]||(Yb[g]?Yb[g].forEach(c):(d.push(g),e[g]=!0))}var d=[],e={};b.forEach(c);throw new rc(a+": "+d.map(sc).join([", "]));}function vc(a,b,c){switch(b){case 0:return c?function(d){return J[d]}:function(d){return E[d]};case 1:return c?function(d){return G[d>>1]}:function(d){return va[d>>1]};case 2:return c?function(d){return H[d>>2]}:function(d){return K[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var wc={};
|
||||||
|
function xc(){return"object"===typeof globalThis?globalThis:Function("return this")()}function yc(a,b){var c=U[a];void 0===c&&X(b+" has unknown type "+sc(a));return c}var zc={},Ac={};function Bc(){if(!Cc){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"===typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:ca||"./this.program"},b;for(b in Ac)a[b]=Ac[b];var c=[];for(b in a)c.push(b+"="+a[b]);Cc=c}return Cc}var Cc;
|
||||||
|
function Dc(a){return 0===a%4&&(0!==a%100||0===a%400)}function Ec(a,b){for(var c=0,d=0;d<=b;c+=a[d++]);return c}var Fc=[31,29,31,30,31,30,31,31,30,31,30,31],Gc=[31,28,31,30,31,30,31,31,30,31,30,31];function Hc(a,b){for(a=new Date(a.getTime());0<b;){var c=a.getMonth(),d=(Dc(a.getFullYear())?Fc:Gc)[c];if(b>d-a.getDate())b-=d-a.getDate()+1,a.setDate(1),11>c?a.setMonth(c+1):(a.setMonth(0),a.setFullYear(a.getFullYear()+1));else{a.setDate(a.getDate()+b);break}}return a}
|
||||||
|
function Ic(a,b,c,d){function e(h,n,v){for(h="number"===typeof h?h.toString():h||"";h.length<n;)h=v[0]+h;return h}function g(h,n){return e(h,n,"0")}function k(h,n){function v(F){return 0>F?-1:0<F?1:0}var y;0===(y=v(h.getFullYear()-n.getFullYear()))&&0===(y=v(h.getMonth()-n.getMonth()))&&(y=v(h.getDate()-n.getDate()));return y}function m(h){switch(h.getDay()){case 0:return new Date(h.getFullYear()-1,11,29);case 1:return h;case 2:return new Date(h.getFullYear(),0,3);case 3:return new Date(h.getFullYear(),
|
||||||
|
0,2);case 4:return new Date(h.getFullYear(),0,1);case 5:return new Date(h.getFullYear()-1,11,31);case 6:return new Date(h.getFullYear()-1,11,30)}}function l(h){h=Hc(new Date(h.sa+1900,0,1),h.La);var n=new Date(h.getFullYear()+1,0,4),v=m(new Date(h.getFullYear(),0,4));n=m(n);return 0>=k(v,h)?0>=k(n,h)?h.getFullYear()+1:h.getFullYear():h.getFullYear()-1}var q=H[d+40>>2];d={ub:H[d>>2],tb:H[d+4>>2],Ja:H[d+8>>2],Da:H[d+12>>2],Ca:H[d+16>>2],sa:H[d+20>>2],Ka:H[d+24>>2],La:H[d+28>>2],Gb:H[d+32>>2],sb:H[d+
|
||||||
|
36>>2],vb:q?q?D(E,q,void 0):"":""};c=c?D(E,c,void 0):"";q={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var r in q)c=c.replace(new RegExp(r,"g"),q[r]);var u="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),
|
||||||
|
x="January February March April May June July August September October November December".split(" ");q={"%a":function(h){return u[h.Ka].substring(0,3)},"%A":function(h){return u[h.Ka]},"%b":function(h){return x[h.Ca].substring(0,3)},"%B":function(h){return x[h.Ca]},"%C":function(h){return g((h.sa+1900)/100|0,2)},"%d":function(h){return g(h.Da,2)},"%e":function(h){return e(h.Da,2," ")},"%g":function(h){return l(h).toString().substring(2)},"%G":function(h){return l(h)},"%H":function(h){return g(h.Ja,
|
||||||
|
2)},"%I":function(h){h=h.Ja;0==h?h=12:12<h&&(h-=12);return g(h,2)},"%j":function(h){return g(h.Da+Ec(Dc(h.sa+1900)?Fc:Gc,h.Ca-1),3)},"%m":function(h){return g(h.Ca+1,2)},"%M":function(h){return g(h.tb,2)},"%n":function(){return"\n"},"%p":function(h){return 0<=h.Ja&&12>h.Ja?"AM":"PM"},"%S":function(h){return g(h.ub,2)},"%t":function(){return"\t"},"%u":function(h){return h.Ka||7},"%U":function(h){var n=new Date(h.sa+1900,0,1),v=0===n.getDay()?n:Hc(n,7-n.getDay());h=new Date(h.sa+1900,h.Ca,h.Da);return 0>
|
||||||
|
k(v,h)?g(Math.ceil((31-v.getDate()+(Ec(Dc(h.getFullYear())?Fc:Gc,h.getMonth()-1)-31)+h.getDate())/7),2):0===k(v,n)?"01":"00"},"%V":function(h){var n=new Date(h.sa+1901,0,4),v=m(new Date(h.sa+1900,0,4));n=m(n);var y=Hc(new Date(h.sa+1900,0,1),h.La);return 0>k(y,v)?"53":0>=k(n,y)?"01":g(Math.ceil((v.getFullYear()<h.sa+1900?h.La+32-v.getDate():h.La+1-v.getDate())/7),2)},"%w":function(h){return h.Ka},"%W":function(h){var n=new Date(h.sa,0,1),v=1===n.getDay()?n:Hc(n,0===n.getDay()?1:7-n.getDay()+1);h=
|
||||||
|
new Date(h.sa+1900,h.Ca,h.Da);return 0>k(v,h)?g(Math.ceil((31-v.getDate()+(Ec(Dc(h.getFullYear())?Fc:Gc,h.getMonth()-1)-31)+h.getDate())/7),2):0===k(v,n)?"01":"00"},"%y":function(h){return(h.sa+1900).toString().substring(2)},"%Y":function(h){return h.sa+1900},"%z":function(h){h=h.sb;var n=0<=h;h=Math.abs(h)/60;return(n?"+":"-")+String("0000"+(h/60*100+h%60)).slice(-4)},"%Z":function(h){return h.vb},"%%":function(){return"%"}};for(r in q)0<=c.indexOf(r)&&(c=c.replace(new RegExp(r,"g"),q[r](d)));r=
|
||||||
|
hb(c,!1);if(r.length>b)return 0;J.set(r,a);return r.length-1}function zb(a,b,c,d){a||(a=this);this.parent=a;this.ya=a.ya;this.Ga=null;this.id=rb++;this.name=b;this.mode=c;this.pa={};this.qa={};this.rdev=d}Object.defineProperties(zb.prototype,{read:{get:function(){return 365===(this.mode&365)},set:function(a){a?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146===(this.mode&146)},set:function(a){a?this.mode|=146:this.mode&=-147}}});Nb();sb=Array(4096);Gb(P,"/");S("/tmp");S("/home");
|
||||||
|
S("/home/web_user");
|
||||||
|
(function(){S("/dev");fb(259,{read:function(){return 0},write:function(d,e,g,k){return k}});Ib("/dev/null",259);eb(1280,ib);eb(1536,jb);Ib("/dev/tty",1280);Ib("/dev/tty1",1536);if("object"===typeof crypto&&"function"===typeof crypto.getRandomValues){var a=new Uint8Array(1);var b=function(){crypto.getRandomValues(a);return a[0]}}else if(ea)try{var c=require("crypto");b=function(){return c.randomBytes(1)[0]}}catch(d){}b||(b=function(){A("random_device")});Qb("random",b);Qb("urandom",b);S("/dev/shm");
|
||||||
|
S("/dev/shm/tmp")})();S("/proc");S("/proc/self");S("/proc/self/fd");Gb({ya:function(){var a=lb("/proc/self","fd",16895,73);a.pa={lookup:function(b,c){var d=Q[+c];if(!d)throw new O(8);b={parent:null,ya:{Za:"fake"},pa:{readlink:function(){return d.path}}};return b.parent=b}};return a}},"/proc/self/fd");bc=f.InternalError=ac("InternalError");for(var Jc=Array(256),Kc=0;256>Kc;++Kc)Jc[Kc]=String.fromCharCode(Kc);ec=Jc;fc=f.BindingError=ac("BindingError");
|
||||||
|
f.count_emval_handles=function(){for(var a=0,b=5;b<Y.length;++b)void 0!==Y[b]&&++a;return a};f.get_first_emval=function(){for(var a=5;a<Y.length;++a)if(void 0!==Y[a])return Y[a];return null};rc=f.UnboundTypeError=ac("UnboundTypeError");function hb(a,b){var c=Array(sa(a)+1);a=ra(a,c,0,c.length);b&&(c.length=a);return c}
|
||||||
|
var Mc={t:function(a){return ob(a)},G:function(){},q:function(a){"uncaught_exception"in Ya?Ya.Ia++:Ya.Ia=1;throw a;},x:function(){H[Lc()>>2]=63;return-1},w:function(a,b){try{if(-1===(a|0)||0===b)var c=-28;else{var d=Tb[a];if(d&&b===d.Ab){var e=Q[d.fd];if(d.Eb&2){var g=d.flags,k=d.offset,m=E.slice(a,a+b);e&&e.qa.Ha&&e.qa.Ha(e,m,k,b,g)}Tb[a]=null;d.$a&&Z(d.Bb)}c=0}return c}catch(l){return"undefined"!==typeof Sb&&l instanceof O||A(l),-l.Ea}},n:function(a){var b=Vb[a];delete Vb[a];var c=b.lb,d=b.mb,e=
|
||||||
|
b.Ua,g=e.map(function(k){return k.hb}).concat(e.map(function(k){return k.qb}));cc([a],g,function(k){var m={};e.forEach(function(l,q){var r=k[q],u=l.fb,x=l.gb,h=k[q+e.length],n=l.pb,v=l.rb;m[l.cb]={read:function(y){return r.fromWireType(u(x,y))},write:function(y,F){var ja=[];n(v,y,h.toWireType(ja,F));Wb(ja)}}});return[{name:b.name,fromWireType:function(l){var q={},r;for(r in m)q[r]=m[r].read(l);d(l);return q},toWireType:function(l,q){for(var r in m)if(!(r in q))throw new TypeError('Missing field: "'+
|
||||||
|
r+'"');var u=c();for(r in m)m[r].write(u,q[r]);null!==l&&l.push(d,u);return u},argPackAdvance:8,readValueFromPointer:Xb,wa:d}]})},C:function(a,b,c,d,e){var g=dc(c);b=W(b);V(a,{name:b,fromWireType:function(k){return!!k},toWireType:function(k,m){return m?d:e},argPackAdvance:8,readValueFromPointer:function(k){if(1===c)var m=J;else if(2===c)m=G;else if(4===c)m=H;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(m[k>>g])},wa:null})},B:function(a,b){b=W(b);V(a,{name:b,fromWireType:function(c){var d=
|
||||||
|
Y[c].value;ic(c);return d},toWireType:function(c,d){return jc(d)},argPackAdvance:8,readValueFromPointer:Xb,wa:null})},j:function(a,b,c){c=dc(c);b=W(b);V(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,e){if("number"!==typeof e&&"boolean"!==typeof e)throw new TypeError('Cannot convert "'+kc(e)+'" to '+this.name);return e},argPackAdvance:8,readValueFromPointer:lc(b,c),wa:null})},m:function(a,b,c,d,e,g){var k=pc(b,c);a=W(a);e=qc(d,e);oc(a,function(){uc("Cannot call "+a+" due to unbound types",
|
||||||
|
k)},b-1);cc([],k,function(m){var l=[m[0],null].concat(m.slice(1)),q=m=a,r=e,u=l.length;2>u&&X("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var x=null!==l[1]&&!1,h=!1,n=1;n<l.length;++n)if(null!==l[n]&&void 0===l[n].wa){h=!0;break}var v="void"!==l[0].name,y="",F="";for(n=0;n<u-2;++n)y+=(0!==n?", ":"")+"arg"+n,F+=(0!==n?", ":"")+"arg"+n+"Wired";q="return function "+Zb(q)+"("+y+") {\nif (arguments.length !== "+(u-2)+") {\nthrowBindingError('function "+q+" called with ' + arguments.length + ' arguments, expected "+
|
||||||
|
(u-2)+" args!');\n}\n";h&&(q+="var destructors = [];\n");var ja=h?"destructors":"null";y="throwBindingError invoker fn runDestructors retType classParam".split(" ");r=[X,r,g,Wb,l[0],l[1]];x&&(q+="var thisWired = classParam.toWireType("+ja+", this);\n");for(n=0;n<u-2;++n)q+="var arg"+n+"Wired = argType"+n+".toWireType("+ja+", arg"+n+"); // "+l[n+2].name+"\n",y.push("argType"+n),r.push(l[n+2]);x&&(F="thisWired"+(0<F.length?", ":"")+F);q+=(v?"var rv = ":"")+"invoker(fn"+(0<F.length?", ":"")+F+");\n";
|
||||||
|
if(h)q+="runDestructors(destructors);\n";else for(n=x?1:2;n<l.length;++n)u=1===n?"thisWired":"arg"+(n-2)+"Wired",null!==l[n].wa&&(q+=u+"_dtor("+u+"); // "+l[n].name+"\n",y.push(u+"_dtor"),r.push(l[n].wa));v&&(q+="var ret = retType.fromWireType(rv);\nreturn ret;\n");y.push(q+"}\n");l=mc(y).apply(null,r);n=b-1;if(!f.hasOwnProperty(m))throw new bc("Replacing nonexistant public symbol");void 0!==f[m].ua&&void 0!==n?f[m].ua[n]=l:(f[m]=l,f[m].ab=n);return[]})},b:function(a,b,c,d,e){function g(q){return q}
|
||||||
|
b=W(b);-1===e&&(e=4294967295);var k=dc(c);if(0===d){var m=32-8*c;g=function(q){return q<<m>>>m}}var l=-1!=b.indexOf("unsigned");V(a,{name:b,fromWireType:g,toWireType:function(q,r){if("number"!==typeof r&&"boolean"!==typeof r)throw new TypeError('Cannot convert "'+kc(r)+'" to '+this.name);if(r<d||r>e)throw new TypeError('Passing a number "'+kc(r)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+e+"]!");return l?r>>>0:r|0},argPackAdvance:8,readValueFromPointer:vc(b,
|
||||||
|
k,0!==d),wa:null})},a:function(a,b,c){function d(g){g>>=2;var k=K;return new e(I,k[g+1],k[g])}var e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=W(c);V(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{ib:!0})},k:function(a,b){b=W(b);var c="std::string"===b;V(a,{name:b,fromWireType:function(d){var e=K[d>>2];if(c)for(var g=d+4,k=0;k<=e;++k){var m=d+4+k;if(k==e||0==E[m]){g=g?D(E,g,m-g):"";if(void 0===l)var l=g;else l+=String.fromCharCode(0),
|
||||||
|
l+=g;g=m+1}}else{l=Array(e);for(k=0;k<e;++k)l[k]=String.fromCharCode(E[d+4+k]);l=l.join("")}Z(d);return l},toWireType:function(d,e){e instanceof ArrayBuffer&&(e=new Uint8Array(e));var g="string"===typeof e;g||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int8Array||X("Cannot pass non-string to std::string");var k=(c&&g?function(){return sa(e)}:function(){return e.length})(),m=ob(4+k+1);K[m>>2]=k;if(c&&g)ra(e,E,m+4,k+1);else if(g)for(g=0;g<k;++g){var l=e.charCodeAt(g);255<l&&
|
||||||
|
(Z(m),X("String has UTF-16 code units that do not fit in 8 bits"));E[m+4+g]=l}else for(g=0;g<k;++g)E[m+4+g]=e[g];null!==d&&d.push(Z,m);return m},argPackAdvance:8,readValueFromPointer:Xb,wa:function(d){Z(d)}})},g:function(a,b,c){c=W(c);if(2===b){var d=ua;var e=wa;var g=xa;var k=function(){return va};var m=1}else 4===b&&(d=ya,e=za,g=Aa,k=function(){return K},m=2);V(a,{name:c,fromWireType:function(l){for(var q=K[l>>2],r=k(),u,x=l+4,h=0;h<=q;++h){var n=l+4+h*b;if(h==q||0==r[n>>m])x=d(x,n-x),void 0===
|
||||||
|
u?u=x:(u+=String.fromCharCode(0),u+=x),x=n+b}Z(l);return u},toWireType:function(l,q){"string"!==typeof q&&X("Cannot pass non-string to C++ string type "+c);var r=g(q),u=ob(4+r+b);K[u>>2]=r>>m;e(q,u+4,r+b);null!==l&&l.push(Z,u);return u},argPackAdvance:8,readValueFromPointer:Xb,wa:function(l){Z(l)}})},o:function(a,b,c,d,e,g){Vb[a]={name:W(b),lb:qc(c,d),mb:qc(e,g),Ua:[]}},h:function(a,b,c,d,e,g,k,m,l,q){Vb[a].Ua.push({cb:W(b),hb:c,fb:qc(d,e),gb:g,qb:k,pb:qc(m,l),rb:q})},D:function(a,b){b=W(b);V(a,{zb:!0,
|
||||||
|
name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},e:ic,F:function(a){if(0===a)return jc(xc());var b=wc[a];a=void 0===b?W(a):b;return jc(xc()[a])},E:function(a){4<a&&(Y[a].Qa+=1)},p:function(a,b,c,d){a||X("Cannot use deleted val. handle = "+a);a=Y[a].value;var e=zc[b];if(!e){e="";for(var g=0;g<b;++g)e+=(0!==g?", ":"")+"arg"+g;var k="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)k+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+
|
||||||
|
g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";e=(new Function("requireRegisteredType","Module","__emval_register",k+("var obj = new constructor("+e+");\nreturn __emval_register(obj);\n}\n")))(yc,f,jc);zc[b]=e}return e(a,c,d)},l:function(){A()},u:function(a,b,c){E.copyWithin(a,b,b+c)},d:function(a){a>>>=0;var b=E.length;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(16777216,
|
||||||
|
a,d);0<d%65536&&(d+=65536-d%65536);a:{try{C.grow(Math.min(2147483648,d)-I.byteLength+65535>>>16);Da(C.buffer);var e=1;break a}catch(g){}e=void 0}if(e)return!0}return!1},y:function(a,b){var c=0;Bc().forEach(function(d,e){var g=b+c;e=H[a+4*e>>2]=g;for(g=0;g<d.length;++g)J[e++>>0]=d.charCodeAt(g);J[e>>0]=0;c+=d.length+1});return 0},z:function(a,b){var c=Bc();H[a>>2]=c.length;var d=0;c.forEach(function(e){d+=e.length+1});H[b>>2]=d;return 0},A:function(a){try{var b=Ub(a);if(null===b.fd)throw new O(8);
|
||||||
|
b.Na&&(b.Na=null);try{b.qa.close&&b.qa.close(b)}catch(c){throw c;}finally{Q[b.fd]=null}b.fd=null;return 0}catch(c){return"undefined"!==typeof Sb&&c instanceof O||A(c),c.Ea}},r:function(a,b,c,d,e){try{var g=Ub(a);a=4294967296*c+(b>>>0);if(-9007199254740992>=a||9007199254740992<=a)return-61;Mb(g,a,d);Wa=[g.position>>>0,(N=g.position,1<=+La(N)?0<N?(Oa(+Na(N/4294967296),4294967295)|0)>>>0:~~+Ma((N-+(~~N>>>0))/4294967296)>>>0:0)];H[e>>2]=Wa[0];H[e+4>>2]=Wa[1];g.Na&&0===a&&0===d&&(g.Na=null);return 0}catch(k){return"undefined"!==
|
||||||
|
typeof Sb&&k instanceof O||A(k),k.Ea}},i:function(a,b,c,d){try{a:{for(var e=Ub(a),g=a=0;g<c;g++){var k=e,m=H[b+8*g>>2],l=H[b+(8*g+4)>>2],q=void 0,r=J;if(0>l||0>q)throw new O(28);if(null===k.fd)throw new O(8);if(0===(k.flags&2097155))throw new O(8);if(16384===(k.node.mode&61440))throw new O(31);if(!k.qa.write)throw new O(28);k.seekable&&k.flags&1024&&Mb(k,0,2);var u="undefined"!==typeof q;if(!u)q=k.position;else if(!k.seekable)throw new O(70);var x=k.qa.write(k,r,m,l,q,void 0);u||(k.position+=x);try{if(k.path&&
|
||||||
|
ub.onWriteToFile)ub.onWriteToFile(k.path)}catch(v){B("FS.trackingDelegate['onWriteToFile']('"+k.path+"') threw an exception: "+v.message)}var h=x;if(0>h){var n=-1;break a}a+=h}n=a}H[d>>2]=n;return 0}catch(v){return"undefined"!==typeof Sb&&v instanceof O||A(v),v.Ea}},memory:C,f:function(a){a=+a;return 0<=a?+Na(a+.5):+Ma(a-.5)},c:function(a){a=+a;return 0<=a?+Na(a+.5):+Ma(a-.5)},s:function(){},v:function(a,b,c,d){return Ic(a,b,c,d)},table:oa};
|
||||||
|
(function(){function a(e){f.asm=e.exports;L--;f.monitorRunDependencies&&f.monitorRunDependencies(L);0==L&&(null!==Pa&&(clearInterval(Pa),Pa=null),Qa&&(e=Qa,Qa=null,e()))}function b(e){a(e.instance)}function c(e){return Va().then(function(g){return WebAssembly.instantiate(g,d)}).then(e,function(g){B("failed to asynchronously prepare wasm: "+g);A(g)})}var d={a:Mc};L++;f.monitorRunDependencies&&f.monitorRunDependencies(L);if(f.instantiateWasm)try{return f.instantiateWasm(d,a)}catch(e){return B("Module.instantiateWasm callback failed with error: "+
|
||||||
|
e),!1}(function(){if(na||"function"!==typeof WebAssembly.instantiateStreaming||Sa()||Ra("file://")||"function"!==typeof fetch)return c(b);fetch(M,{credentials:"same-origin"}).then(function(e){return WebAssembly.instantiateStreaming(e,d).then(b,function(g){B("wasm streaming compile failed: "+g);B("falling back to ArrayBuffer instantiation");return c(b)})})})();return{}})();
|
||||||
|
var Xa=f.___wasm_call_ctors=function(){return(Xa=f.___wasm_call_ctors=f.asm.H).apply(null,arguments)},ob=f._malloc=function(){return(ob=f._malloc=f.asm.I).apply(null,arguments)},Z=f._free=function(){return(Z=f._free=f.asm.J).apply(null,arguments)},Lc=f.___errno_location=function(){return(Lc=f.___errno_location=f.asm.K).apply(null,arguments)},tc=f.___getTypeName=function(){return(tc=f.___getTypeName=f.asm.L).apply(null,arguments)};
|
||||||
|
f.___embind_register_native_and_builtin_types=function(){return(f.___embind_register_native_and_builtin_types=f.asm.M).apply(null,arguments)};f.dynCall_i=function(){return(f.dynCall_i=f.asm.N).apply(null,arguments)};f.dynCall_vi=function(){return(f.dynCall_vi=f.asm.O).apply(null,arguments)};f.dynCall_iii=function(){return(f.dynCall_iii=f.asm.P).apply(null,arguments)};f.dynCall_viii=function(){return(f.dynCall_viii=f.asm.Q).apply(null,arguments)};
|
||||||
|
f.dynCall_fii=function(){return(f.dynCall_fii=f.asm.R).apply(null,arguments)};f.dynCall_viif=function(){return(f.dynCall_viif=f.asm.S).apply(null,arguments)};f.dynCall_iiiiii=function(){return(f.dynCall_iiiiii=f.asm.T).apply(null,arguments)};f.dynCall_viiiii=function(){return(f.dynCall_viiiii=f.asm.U).apply(null,arguments)};f.dynCall_iidiiii=function(){return(f.dynCall_iidiiii=f.asm.V).apply(null,arguments)};f.dynCall_vii=function(){return(f.dynCall_vii=f.asm.W).apply(null,arguments)};
|
||||||
|
f.dynCall_ii=function(){return(f.dynCall_ii=f.asm.X).apply(null,arguments)};f.dynCall_iiiiiii=function(){return(f.dynCall_iiiiiii=f.asm.Y).apply(null,arguments)};f.dynCall_viiii=function(){return(f.dynCall_viiii=f.asm.Z).apply(null,arguments)};f.dynCall_iiii=function(){return(f.dynCall_iiii=f.asm._).apply(null,arguments)};f.dynCall_viiiiiii=function(){return(f.dynCall_viiiiiii=f.asm.$).apply(null,arguments)};f.dynCall_viijii=function(){return(f.dynCall_viijii=f.asm.aa).apply(null,arguments)};
|
||||||
|
f.dynCall_v=function(){return(f.dynCall_v=f.asm.ba).apply(null,arguments)};f.dynCall_iiiii=function(){return(f.dynCall_iiiii=f.asm.ca).apply(null,arguments)};f.dynCall_fi=function(){return(f.dynCall_fi=f.asm.da).apply(null,arguments)};f.dynCall_viiiiii=function(){return(f.dynCall_viiiiii=f.asm.ea).apply(null,arguments)};f.dynCall_iiji=function(){return(f.dynCall_iiji=f.asm.fa).apply(null,arguments)};f.dynCall_iifi=function(){return(f.dynCall_iifi=f.asm.ga).apply(null,arguments)};
|
||||||
|
f.dynCall_jiji=function(){return(f.dynCall_jiji=f.asm.ha).apply(null,arguments)};f.dynCall_iiiiiiiii=function(){return(f.dynCall_iiiiiiiii=f.asm.ia).apply(null,arguments)};f.dynCall_iiiiiiii=function(){return(f.dynCall_iiiiiiii=f.asm.ja).apply(null,arguments)};f.dynCall_iiiiiijj=function(){return(f.dynCall_iiiiiijj=f.asm.ka).apply(null,arguments)};f.dynCall_iiiiij=function(){return(f.dynCall_iiiiij=f.asm.la).apply(null,arguments)};
|
||||||
|
f.dynCall_iiiiid=function(){return(f.dynCall_iiiiid=f.asm.ma).apply(null,arguments)};f.dynCall_iiiiijj=function(){return(f.dynCall_iiiiijj=f.asm.na).apply(null,arguments)};var Nc;Qa=function Oc(){Nc||Pc();Nc||(Qa=Oc)};
|
||||||
|
function Pc(){function a(){if(!Nc&&(Nc=!0,f.calledRun=!0,!pa)){f.noFSInit||Ob||(Ob=!0,Nb(),f.stdin=f.stdin,f.stdout=f.stdout,f.stderr=f.stderr,f.stdin?Qb("stdin",f.stdin):Jb("/dev/tty","/dev/stdin"),f.stdout?Qb("stdout",null,f.stdout):Jb("/dev/tty","/dev/stdout"),f.stderr?Qb("stderr",null,f.stderr):Jb("/dev/tty1","/dev/stderr"),Kb("/dev/stdin","r"),Kb("/dev/stdout","w"),Kb("/dev/stderr","w"));Fa(Ha);tb=!1;Fa(Ia);aa(f);if(f.onRuntimeInitialized)f.onRuntimeInitialized();if(f.postRun)for("function"==
|
||||||
|
typeof f.postRun&&(f.postRun=[f.postRun]);f.postRun.length;){var b=f.postRun.shift();Ja.unshift(b)}Fa(Ja)}}if(!(0<L)){if(f.preRun)for("function"==typeof f.preRun&&(f.preRun=[f.preRun]);f.preRun.length;)Ka();Fa(Ga);0<L||(f.setStatus?(f.setStatus("Running..."),setTimeout(function(){setTimeout(function(){f.setStatus("")},1);a()},1)):a())}}f.run=Pc;if(f.preInit)for("function"==typeof f.preInit&&(f.preInit=[f.preInit]);0<f.preInit.length;)f.preInit.pop()();noExitRuntime=!0;Pc();
|
||||||
|
|
||||||
|
|
||||||
|
return jxl_enc.ready
|
||||||
|
}
|
||||||
|
);
|
||||||
|
})();
|
||||||
|
if (typeof exports === 'object' && typeof module === 'object')
|
||||||
|
module.exports = jxl_enc;
|
||||||
|
else if (typeof define === 'function' && define['amd'])
|
||||||
|
define([], function() { return jxl_enc; });
|
||||||
|
else if (typeof exports === 'object')
|
||||||
|
exports["jxl_enc"] = jxl_enc;
|
||||||
|
|
||||||
BIN
codecs/jxl/enc/jxl_enc.wasm
Normal file
BIN
codecs/jxl/enc/jxl_enc.wasm
Normal file
Binary file not shown.
6
codecs/jxl/package.json
Normal file
6
codecs/jxl/package.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"name": "jxl",
|
||||||
|
"scripts": {
|
||||||
|
"build": "../build-cpp.sh"
|
||||||
|
}
|
||||||
|
}
|
||||||
132
codecs/mozjpeg_enc/LICENSE.codec.md
Normal file
132
codecs/mozjpeg_enc/LICENSE.codec.md
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
libjpeg-turbo Licenses
|
||||||
|
======================
|
||||||
|
|
||||||
|
libjpeg-turbo is covered by three compatible BSD-style open source licenses:
|
||||||
|
|
||||||
|
- The IJG (Independent JPEG Group) License, which is listed in
|
||||||
|
[README.ijg](README.ijg)
|
||||||
|
|
||||||
|
This license applies to the libjpeg API library and associated programs
|
||||||
|
(any code inherited from libjpeg, and any modifications to that code.)
|
||||||
|
|
||||||
|
- The Modified (3-clause) BSD License, which is listed below
|
||||||
|
|
||||||
|
This license covers the TurboJPEG API library and associated programs, as
|
||||||
|
well as the build system.
|
||||||
|
|
||||||
|
- The [zlib License](https://opensource.org/licenses/Zlib)
|
||||||
|
|
||||||
|
This license is a subset of the other two, and it covers the libjpeg-turbo
|
||||||
|
SIMD extensions.
|
||||||
|
|
||||||
|
|
||||||
|
Complying with the libjpeg-turbo Licenses
|
||||||
|
=========================================
|
||||||
|
|
||||||
|
This section provides a roll-up of the libjpeg-turbo licensing terms, to the
|
||||||
|
best of our understanding.
|
||||||
|
|
||||||
|
1. If you are distributing a modified version of the libjpeg-turbo source,
|
||||||
|
then:
|
||||||
|
|
||||||
|
1. You cannot alter or remove any existing copyright or license notices
|
||||||
|
from the source.
|
||||||
|
|
||||||
|
**Origin**
|
||||||
|
- Clause 1 of the IJG License
|
||||||
|
- Clause 1 of the Modified BSD License
|
||||||
|
- Clauses 1 and 3 of the zlib License
|
||||||
|
|
||||||
|
2. You must add your own copyright notice to the header of each source
|
||||||
|
file you modified, so others can tell that you modified that file (if
|
||||||
|
there is not an existing copyright header in that file, then you can
|
||||||
|
simply add a notice stating that you modified the file.)
|
||||||
|
|
||||||
|
**Origin**
|
||||||
|
- Clause 1 of the IJG License
|
||||||
|
- Clause 2 of the zlib License
|
||||||
|
|
||||||
|
3. You must include the IJG README file, and you must not alter any of the
|
||||||
|
copyright or license text in that file.
|
||||||
|
|
||||||
|
**Origin**
|
||||||
|
- Clause 1 of the IJG License
|
||||||
|
|
||||||
|
2. If you are distributing only libjpeg-turbo binaries without the source, or
|
||||||
|
if you are distributing an application that statically links with
|
||||||
|
libjpeg-turbo, then:
|
||||||
|
|
||||||
|
1. Your product documentation must include a message stating:
|
||||||
|
|
||||||
|
This software is based in part on the work of the Independent JPEG
|
||||||
|
Group.
|
||||||
|
|
||||||
|
**Origin**
|
||||||
|
- Clause 2 of the IJG license
|
||||||
|
|
||||||
|
2. If your binary distribution includes or uses the TurboJPEG API, then
|
||||||
|
your product documentation must include the text of the Modified BSD
|
||||||
|
License (see below.)
|
||||||
|
|
||||||
|
**Origin**
|
||||||
|
- Clause 2 of the Modified BSD License
|
||||||
|
|
||||||
|
3. You cannot use the name of the IJG or The libjpeg-turbo Project or the
|
||||||
|
contributors thereof in advertising, publicity, etc.
|
||||||
|
|
||||||
|
**Origin**
|
||||||
|
- IJG License
|
||||||
|
- Clause 3 of the Modified BSD License
|
||||||
|
|
||||||
|
4. The IJG and The libjpeg-turbo Project do not warrant libjpeg-turbo to be
|
||||||
|
free of defects, nor do we accept any liability for undesirable
|
||||||
|
consequences resulting from your use of the software.
|
||||||
|
|
||||||
|
**Origin**
|
||||||
|
- IJG License
|
||||||
|
- Modified BSD License
|
||||||
|
- zlib License
|
||||||
|
|
||||||
|
|
||||||
|
The Modified (3-clause) BSD License
|
||||||
|
===================================
|
||||||
|
|
||||||
|
Copyright (C)2009-2020 D. R. Commander. All Rights Reserved.
|
||||||
|
Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
- Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
- Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
- Neither the name of the libjpeg-turbo Project nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from this
|
||||||
|
software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
|
||||||
|
Why Three Licenses?
|
||||||
|
===================
|
||||||
|
|
||||||
|
The zlib License could have been used instead of the Modified (3-clause) BSD
|
||||||
|
License, and since the IJG License effectively subsumes the distribution
|
||||||
|
conditions of the zlib License, this would have effectively placed
|
||||||
|
libjpeg-turbo binary distributions under the IJG License. However, the IJG
|
||||||
|
License specifically refers to the Independent JPEG Group and does not extend
|
||||||
|
attribution and endorsement protections to other entities. Thus, it was
|
||||||
|
desirable to choose a license that granted us the same protections for new code
|
||||||
|
that were granted to the IJG for code derived from their software.
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
- Source: <https://github.com/mozilla/mozjpeg>
|
- Source: <https://github.com/mozilla/mozjpeg>
|
||||||
- Version: v3.3.1
|
- Version: v3.3.1
|
||||||
|
- License: BSD
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
|
|||||||
2
codecs/mozjpeg_enc/mozjpeg_enc.d.ts
vendored
2
codecs/mozjpeg_enc/mozjpeg_enc.d.ts
vendored
@@ -4,4 +4,4 @@ interface MozJPEGModule extends EmscriptenWasm.Module {
|
|||||||
encode(data: BufferSource, width: number, height: number, options: EncodeOptions): Uint8Array;
|
encode(data: BufferSource, width: number, height: number, options: EncodeOptions): Uint8Array;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function(opts: EmscriptenWasm.ModuleOpts): MozJPEGModule;
|
export default function(opts: EmscriptenWasm.ModuleOpts): Promise<MozJPEGModule>;
|
||||||
|
|||||||
@@ -7,55 +7,55 @@ function(mozjpeg_enc) {
|
|||||||
mozjpeg_enc = mozjpeg_enc || {};
|
mozjpeg_enc = mozjpeg_enc || {};
|
||||||
|
|
||||||
|
|
||||||
var d;d||(d=typeof mozjpeg_enc !== 'undefined' ? mozjpeg_enc : {});var aa;d.ready=new Promise(function(a){aa=a});var r={},t;for(t in d)d.hasOwnProperty(t)&&(r[t]=d[t]);var ba="./this.program";function u(a,b){throw b;}var v=!1,w=!1,ca=!1,da=!1;v="object"===typeof window;w="function"===typeof importScripts;ca="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;da=!v&&!ca&&!w;var x="",B,C,ea,fa;
|
var d;d||(d=typeof mozjpeg_enc !== 'undefined' ? mozjpeg_enc : {});var aa,ba;d.ready=new Promise(function(a,b){aa=a;ba=b});var r={},t;for(t in d)d.hasOwnProperty(t)&&(r[t]=d[t]);var ca="./this.program";function u(a,b){throw b;}var v=!1,w=!1,da=!1,ea=!1;v="object"===typeof window;w="function"===typeof importScripts;da="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;ea=!v&&!da&&!w;var x="",B,C,fa,ha;
|
||||||
if(ca)x=w?require("path").dirname(x)+"/":__dirname+"/",B=function(a,b){ea||(ea=require("fs"));fa||(fa=require("path"));a=fa.normalize(a);return ea.readFileSync(a,b?null:"utf8")},C=function(a){a=B(a,!0);a.buffer||(a=new Uint8Array(a));a.buffer||D("Assertion failed: undefined");return a},1<process.argv.length&&(ba=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",function(a){if(!(a instanceof ha))throw a;}),process.on("unhandledRejection",D),u=function(a){process.exit(a)},
|
if(da)x=w?require("path").dirname(x)+"/":__dirname+"/",B=function(a,b){fa||(fa=require("fs"));ha||(ha=require("path"));a=ha.normalize(a);return fa.readFileSync(a,b?null:"utf8")},C=function(a){a=B(a,!0);a.buffer||(a=new Uint8Array(a));a.buffer||D("Assertion failed: undefined");return a},1<process.argv.length&&(ca=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",function(a){if(!(a instanceof ja))throw a;}),process.on("unhandledRejection",D),u=function(a){process.exit(a)},
|
||||||
d.inspect=function(){return"[Emscripten Module object]"};else if(da)"undefined"!=typeof read&&(B=function(a){return read(a)}),C=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");"object"===typeof a||D("Assertion failed: undefined");return a},"function"===typeof quit&&(u=function(a){quit(a)}),"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!==typeof printErr?printErr:
|
d.inspect=function(){return"[Emscripten Module object]"};else if(ea)"undefined"!=typeof read&&(B=function(a){return read(a)}),C=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");"object"===typeof a||D("Assertion failed: undefined");return a},"function"===typeof quit&&(u=function(a){quit(a)}),"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!==typeof printErr?printErr:
|
||||||
print);else if(v||w)w?x=self.location.href:document.currentScript&&(x=document.currentScript.src),_scriptDir&&(x=_scriptDir),0!==x.indexOf("blob:")?x=x.substr(0,x.lastIndexOf("/")+1):x="",B=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},w&&(C=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var ia=d.print||console.log.bind(console),E=d.printErr||console.warn.bind(console);
|
print);else if(v||w)w?x=self.location.href:document.currentScript&&(x=document.currentScript.src),_scriptDir&&(x=_scriptDir),0!==x.indexOf("blob:")?x=x.substr(0,x.lastIndexOf("/")+1):x="",B=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},w&&(C=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var ka=d.print||console.log.bind(console),E=d.printErr||console.warn.bind(console);
|
||||||
for(t in r)r.hasOwnProperty(t)&&(d[t]=r[t]);r=null;d.thisProgram&&(ba=d.thisProgram);d.quit&&(u=d.quit);var G;d.wasmBinary&&(G=d.wasmBinary);var noExitRuntime;d.noExitRuntime&&(noExitRuntime=d.noExitRuntime);"object"!==typeof WebAssembly&&D("no native wasm support detected");var H,ja=new WebAssembly.Table({initial:122,maximum:122,element:"anyfunc"}),la=!1,ma="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
|
for(t in r)r.hasOwnProperty(t)&&(d[t]=r[t]);r=null;d.thisProgram&&(ca=d.thisProgram);d.quit&&(u=d.quit);var G;d.wasmBinary&&(G=d.wasmBinary);var noExitRuntime;d.noExitRuntime&&(noExitRuntime=d.noExitRuntime);"object"!==typeof WebAssembly&&D("no native wasm support detected");var H,la=new WebAssembly.Table({initial:115,maximum:115,element:"anyfunc"}),ma=!1,na="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
|
||||||
function na(a,b,c){var e=b+c;for(c=b;a[c]&&!(c>=e);)++c;if(16<c-b&&a.subarray&&ma)return ma.decode(a.subarray(b,c));for(e="";b<c;){var f=a[b++];if(f&128){var g=a[b++]&63;if(192==(f&224))e+=String.fromCharCode((f&31)<<6|g);else{var l=a[b++]&63;f=224==(f&240)?(f&15)<<12|g<<6|l:(f&7)<<18|g<<12|l<<6|a[b++]&63;65536>f?e+=String.fromCharCode(f):(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else e+=String.fromCharCode(f)}return e}
|
function oa(a,b,c){var e=b+c;for(c=b;a[c]&&!(c>=e);)++c;if(16<c-b&&a.subarray&&na)return na.decode(a.subarray(b,c));for(e="";b<c;){var f=a[b++];if(f&128){var g=a[b++]&63;if(192==(f&224))e+=String.fromCharCode((f&31)<<6|g);else{var l=a[b++]&63;f=224==(f&240)?(f&15)<<12|g<<6|l:(f&7)<<18|g<<12|l<<6|a[b++]&63;65536>f?e+=String.fromCharCode(f):(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else e+=String.fromCharCode(f)}return e}
|
||||||
function oa(a,b,c){var e=I;if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}if(127>=g){if(b>=c)break;e[b++]=g}else{if(2047>=g){if(b+1>=c)break;e[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;e[b++]=224|g>>12}else{if(b+3>=c)break;e[b++]=240|g>>18;e[b++]=128|g>>12&63}e[b++]=128|g>>6&63}e[b++]=128|g&63}}e[b]=0}}var pa="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;
|
function pa(a,b,c){var e=I;if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}if(127>=g){if(b>=c)break;e[b++]=g}else{if(2047>=g){if(b+1>=c)break;e[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;e[b++]=224|g>>12}else{if(b+3>=c)break;e[b++]=240|g>>18;e[b++]=128|g>>12&63}e[b++]=128|g>>6&63}e[b++]=128|g&63}}e[b]=0}}var qa="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;
|
||||||
function qa(a,b){var c=a>>1;for(var e=c+b/2;!(c>=e)&&ra[c];)++c;c<<=1;if(32<c-a&&pa)return pa.decode(I.subarray(a,c));c=0;for(e="";;){var f=J[a+2*c>>1];if(0==f||c==b/2)return e;++c;e+=String.fromCharCode(f)}}function sa(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var e=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)J[b>>1]=a.charCodeAt(f),b+=2;J[b>>1]=0;return b-e}function ta(a){return 2*a.length}
|
function ra(a,b){var c=a>>1;for(var e=c+b/2;!(c>=e)&&sa[c];)++c;c<<=1;if(32<c-a&&qa)return qa.decode(I.subarray(a,c));c=0;for(e="";;){var f=J[a+2*c>>1];if(0==f||c==b/2)return e;++c;e+=String.fromCharCode(f)}}function ta(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var e=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)J[b>>1]=a.charCodeAt(f),b+=2;J[b>>1]=0;return b-e}function ua(a){return 2*a.length}
|
||||||
function ua(a,b){for(var c=0,e="";!(c>=b/4);){var f=K[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023)):e+=String.fromCharCode(f)}return e}function va(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var e=b;c=e+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}K[b>>2]=g;b+=4;if(b+4>c)break}K[b>>2]=0;return b-e}
|
function va(a,b){for(var c=0,e="";!(c>=b/4);){var f=K[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023)):e+=String.fromCharCode(f)}return e}function wa(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var e=b;c=e+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}K[b>>2]=g;b+=4;if(b+4>c)break}K[b>>2]=0;return b-e}
|
||||||
function wa(a){for(var b=0,c=0;c<a.length;++c){var e=a.charCodeAt(c);55296<=e&&57343>=e&&++c;b+=4}return b}var L,M,I,J,ra,K,N,xa,ya;function za(a){L=a;d.HEAP8=M=new Int8Array(a);d.HEAP16=J=new Int16Array(a);d.HEAP32=K=new Int32Array(a);d.HEAPU8=I=new Uint8Array(a);d.HEAPU16=ra=new Uint16Array(a);d.HEAPU32=N=new Uint32Array(a);d.HEAPF32=xa=new Float32Array(a);d.HEAPF64=ya=new Float64Array(a)}var Aa=d.INITIAL_MEMORY||16777216;d.wasmMemory?H=d.wasmMemory:H=new WebAssembly.Memory({initial:Aa/65536,maximum:32768});
|
function xa(a){for(var b=0,c=0;c<a.length;++c){var e=a.charCodeAt(c);55296<=e&&57343>=e&&++c;b+=4}return b}var L,M,I,J,sa,K,N,ya,za;function Aa(a){L=a;d.HEAP8=M=new Int8Array(a);d.HEAP16=J=new Int16Array(a);d.HEAP32=K=new Int32Array(a);d.HEAPU8=I=new Uint8Array(a);d.HEAPU16=sa=new Uint16Array(a);d.HEAPU32=N=new Uint32Array(a);d.HEAPF32=ya=new Float32Array(a);d.HEAPF64=za=new Float64Array(a)}var Ba=d.INITIAL_MEMORY||16777216;d.wasmMemory?H=d.wasmMemory:H=new WebAssembly.Memory({initial:Ba/65536,maximum:32768});
|
||||||
H&&(L=H.buffer);Aa=L.byteLength;za(L);K[22876]=5334544;function Ba(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(d);else{var c=b.ga;"number"===typeof c?void 0===b.$?d.dynCall_v(c):d.dynCall_vi(c,b.$):c(void 0===b.$?null:b.$)}}}var Ca=[],Da=[],Ea=[],Fa=[];function Ga(){var a=d.preRun.shift();Ca.unshift(a)}var O=0,Ha=null,P=null;d.preloadedImages={};d.preloadedAudios={};
|
H&&(L=H.buffer);Ba=L.byteLength;Aa(L);K[21680]=5329760;function Ca(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(d);else{var c=b.da;"number"===typeof c?void 0===b.Y?d.dynCall_v(c):d.dynCall_vi(c,b.Y):c(void 0===b.Y?null:b.Y)}}}var Da=[],Ea=[],Fa=[],Ga=[];function Ha(){var a=d.preRun.shift();Da.unshift(a)}var O=0,Ia=null,P=null;d.preloadedImages={};d.preloadedAudios={};
|
||||||
function D(a){if(d.onAbort)d.onAbort(a);ia(a);E(a);la=!0;throw new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");}function Ia(a){var b=Q;return String.prototype.startsWith?b.startsWith(a):0===b.indexOf(a)}function Ja(){return Ia("data:application/octet-stream;base64,")}var Q="mozjpeg_enc.wasm";if(!Ja()){var Ka=Q;Q=d.locateFile?d.locateFile(Ka,x):x+Ka}
|
function D(a){if(d.onAbort)d.onAbort(a);E(a);ma=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");ba(a);throw a;}function Ja(a){var b=Q;return String.prototype.startsWith?b.startsWith(a):0===b.indexOf(a)}function Ka(){return Ja("data:application/octet-stream;base64,")}var Q="mozjpeg_enc.wasm";if(!Ka()){var La=Q;Q=d.locateFile?d.locateFile(La,x):x+La}
|
||||||
function La(){try{if(G)return new Uint8Array(G);if(C)return C(Q);throw"both async and sync fetching of the wasm failed";}catch(a){D(a)}}function Ma(){return G||!v&&!w||"function"!==typeof fetch||Ia("file://")?new Promise(function(a){a(La())}):fetch(Q,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+Q+"'";return a.arrayBuffer()}).catch(function(){return La()})}Da.push({ga:function(){Na()}});function Oa(){return 0<Oa.ba}var Pa={};
|
function Ma(){try{if(G)return new Uint8Array(G);if(C)return C(Q);throw"both async and sync fetching of the wasm failed";}catch(a){D(a)}}function Na(){return G||!v&&!w||"function"!==typeof fetch||Ja("file://")?new Promise(function(a){a(Ma())}):fetch(Q,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+Q+"'";return a.arrayBuffer()}).catch(function(){return Ma()})}Ea.push({da:function(){Oa()}});var Pa={};
|
||||||
function Qa(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Ra(a){return this.fromWireType(N[a>>2])}var R={},S={},Sa={};function Ta(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}function Ua(a,b){a=Ta(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}
|
function Qa(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Ra(a){return this.fromWireType(N[a>>2])}var R={},S={},Sa={};function Ta(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}function Ua(a,b){a=Ta(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}
|
||||||
function Va(a){var b=Error,c=Ua(a,function(e){this.name=a;this.message=e;e=Error(e).stack;void 0!==e&&(this.stack=this.toString()+"\n"+e.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}var Wa=void 0;
|
function Va(a){var b=Error,c=Ua(a,function(e){this.name=a;this.message=e;e=Error(e).stack;void 0!==e&&(this.stack=this.toString()+"\n"+e.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}var Wa=void 0;
|
||||||
function Xa(a,b,c){function e(k){k=c(k);if(k.length!==a.length)throw new Wa("Mismatched type converter count");for(var h=0;h<a.length;++h)T(a[h],k[h])}a.forEach(function(k){Sa[k]=b});var f=Array(b.length),g=[],l=0;b.forEach(function(k,h){S.hasOwnProperty(k)?f[h]=S[k]:(g.push(k),R.hasOwnProperty(k)||(R[k]=[]),R[k].push(function(){f[h]=S[k];++l;l===g.length&&e(f)}))});0===g.length&&e(f)}
|
function Xa(a,b,c){function e(k){k=c(k);if(k.length!==a.length)throw new Wa("Mismatched type converter count");for(var h=0;h<a.length;++h)T(a[h],k[h])}a.forEach(function(k){Sa[k]=b});var f=Array(b.length),g=[],l=0;b.forEach(function(k,h){S.hasOwnProperty(k)?f[h]=S[k]:(g.push(k),R.hasOwnProperty(k)||(R[k]=[]),R[k].push(function(){f[h]=S[k];++l;l===g.length&&e(f)}))});0===g.length&&e(f)}
|
||||||
function Ya(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var Za=void 0;function U(a){for(var b="";I[a];)b+=Za[I[a++]];return b}var $a=void 0;function V(a){throw new $a(a);}
|
function Ya(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var Za=void 0;function U(a){for(var b="";I[a];)b+=Za[I[a++]];return b}var $a=void 0;function V(a){throw new $a(a);}
|
||||||
function T(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var e=b.name;a||V('type "'+e+'" must have a positive integer typeid pointer');if(S.hasOwnProperty(a)){if(c.ka)return;V("Cannot register type '"+e+"' twice")}S[a]=b;delete Sa[a];R.hasOwnProperty(a)&&(b=R[a],delete R[a],b.forEach(function(f){f()}))}var ab=[],X=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
function T(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var e=b.name;a||V('type "'+e+'" must have a positive integer typeid pointer');if(S.hasOwnProperty(a)){if(c.ha)return;V("Cannot register type '"+e+"' twice")}S[a]=b;delete Sa[a];R.hasOwnProperty(a)&&(b=R[a],delete R[a],b.forEach(function(f){f()}))}var ab=[],X=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||||
function bb(a){4<a&&0===--X[a].aa&&(X[a]=void 0,ab.push(a))}function cb(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=ab.length?ab.pop():X.length;X[b]={aa:1,value:a};return b}}function db(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
function bb(a){4<a&&0===--X[a].Z&&(X[a]=void 0,ab.push(a))}function cb(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=ab.length?ab.pop():X.length;X[b]={Z:1,value:a};return b}}function db(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
||||||
function eb(a,b){switch(b){case 2:return function(c){return this.fromWireType(xa[c>>2])};case 3:return function(c){return this.fromWireType(ya[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function fb(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Ua(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
function eb(a,b){switch(b){case 2:return function(c){return this.fromWireType(ya[c>>2])};case 3:return function(c){return this.fromWireType(za[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function fb(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Ua(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
||||||
function gb(a,b){var c=d;if(void 0===c[a].Y){var e=c[a];c[a]=function(){c[a].Y.hasOwnProperty(arguments.length)||V("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].Y+")!");return c[a].Y[arguments.length].apply(this,arguments)};c[a].Y=[];c[a].Y[e.ea]=e}}
|
function gb(a,b){var c=d;if(void 0===c[a].W){var e=c[a];c[a]=function(){c[a].W.hasOwnProperty(arguments.length)||V("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].W+")!");return c[a].W[arguments.length].apply(this,arguments)};c[a].W=[];c[a].W[e.aa]=e}}
|
||||||
function hb(a,b,c){d.hasOwnProperty(a)?((void 0===c||void 0!==d[a].Y&&void 0!==d[a].Y[c])&&V("Cannot register public name '"+a+"' twice"),gb(a,a),d.hasOwnProperty(c)&&V("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),d[a].Y[c]=b):(d[a]=b,void 0!==c&&(d[a].ra=c))}function ib(a,b){for(var c=[],e=0;e<a;e++)c.push(K[(b>>2)+e]);return c}
|
function hb(a,b,c){d.hasOwnProperty(a)?((void 0===c||void 0!==d[a].W&&void 0!==d[a].W[c])&&V("Cannot register public name '"+a+"' twice"),gb(a,a),d.hasOwnProperty(c)&&V("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),d[a].W[c]=b):(d[a]=b,void 0!==c&&(d[a].oa=c))}function ib(a,b){for(var c=[],e=0;e<a;e++)c.push(K[(b>>2)+e]);return c}
|
||||||
function Y(a,b){a=U(a);var c=d["dynCall_"+a];for(var e=[],f=1;f<a.length;++f)e.push("a"+f);f="return function dynCall_"+(a+"_"+b)+"("+e.join(", ")+") {\n";f+=" return dynCall(rawFunction"+(e.length?", ":"")+e.join(", ")+");\n";c=(new Function("dynCall","rawFunction",f+"};\n"))(c,b);"function"!==typeof c&&V("unknown function pointer with signature "+a+": "+b);return c}var jb=void 0;function kb(a){a=lb(a);var b=U(a);Z(a);return b}
|
function Y(a,b){a=U(a);var c=d["dynCall_"+a];for(var e=[],f=1;f<a.length;++f)e.push("a"+f);f="return function dynCall_"+(a+"_"+b)+"("+e.join(", ")+") {\n";f+=" return dynCall(rawFunction"+(e.length?", ":"")+e.join(", ")+");\n";c=(new Function("dynCall","rawFunction",f+"};\n"))(c,b);"function"!==typeof c&&V("unknown function pointer with signature "+a+": "+b);return c}var jb=void 0;function kb(a){a=lb(a);var b=U(a);Z(a);return b}
|
||||||
function mb(a,b){function c(g){f[g]||S[g]||(Sa[g]?Sa[g].forEach(c):(e.push(g),f[g]=!0))}var e=[],f={};b.forEach(c);throw new jb(a+": "+e.map(kb).join([", "]));}function nb(a,b,c){switch(b){case 0:return c?function(e){return M[e]}:function(e){return I[e]};case 1:return c?function(e){return J[e>>1]}:function(e){return ra[e>>1]};case 2:return c?function(e){return K[e>>2]}:function(e){return N[e>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var ob={};
|
function mb(a,b){function c(g){f[g]||S[g]||(Sa[g]?Sa[g].forEach(c):(e.push(g),f[g]=!0))}var e=[],f={};b.forEach(c);throw new jb(a+": "+e.map(kb).join([", "]));}function nb(a,b,c){switch(b){case 0:return c?function(e){return M[e]}:function(e){return I[e]};case 1:return c?function(e){return J[e>>1]}:function(e){return sa[e>>1]};case 2:return c?function(e){return K[e>>2]}:function(e){return N[e>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var ob={};
|
||||||
function pb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function qb(a,b){var c=S[a];void 0===c&&V(b+" has unknown type "+kb(a));return c}var rb={},sb={};function tb(){if(!ub){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"===typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:ba||"./this.program"},b;for(b in sb)a[b]=sb[b];var c=[];for(b in a)c.push(b+"="+a[b]);ub=c}return ub}
|
function pb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function qb(a,b){var c=S[a];void 0===c&&V(b+" has unknown type "+kb(a));return c}var rb={},sb={};function tb(){if(!ub){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"===typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:ca||"./this.program"},b;for(b in sb)a[b]=sb[b];var c=[];for(b in a)c.push(b+"="+a[b]);ub=c}return ub}
|
||||||
var ub,vb=[null,[],[]];Wa=d.InternalError=Va("InternalError");for(var wb=Array(256),xb=0;256>xb;++xb)wb[xb]=String.fromCharCode(xb);Za=wb;$a=d.BindingError=Va("BindingError");d.count_emval_handles=function(){for(var a=0,b=5;b<X.length;++b)void 0!==X[b]&&++a;return a};d.get_first_emval=function(){for(var a=5;a<X.length;++a)if(void 0!==X[a])return X[a];return null};jb=d.UnboundTypeError=Va("UnboundTypeError");
|
var ub,vb=[null,[],[]];Wa=d.InternalError=Va("InternalError");for(var wb=Array(256),xb=0;256>xb;++xb)wb[xb]=String.fromCharCode(xb);Za=wb;$a=d.BindingError=Va("BindingError");d.count_emval_handles=function(){for(var a=0,b=5;b<X.length;++b)void 0!==X[b]&&++a;return a};d.get_first_emval=function(){for(var a=5;a<X.length;++a)if(void 0!==X[a])return X[a];return null};jb=d.UnboundTypeError=Va("UnboundTypeError");
|
||||||
var zb={j:function(a){return yb(a)},C:function(){},A:function(a){"uncaught_exception"in Oa?Oa.ba++:Oa.ba=1;throw a;},l:function(a){var b=Pa[a];delete Pa[a];var c=b.la,e=b.ma,f=b.da,g=f.map(function(l){return l.ja}).concat(f.map(function(l){return l.oa}));Xa([a],g,function(l){var k={};f.forEach(function(h,m){var n=l[m],q=h.ha,y=h.ia,z=l[m+f.length],p=h.na,ka=h.pa;k[h.fa]={read:function(A){return n.fromWireType(q(y,A))},write:function(A,F){var W=[];p(ka,A,z.toWireType(W,F));Qa(W)}}});return[{name:b.name,
|
var zb={A:function(){},n:function(a){var b=Pa[a];delete Pa[a];var c=b.ia,e=b.ja,f=b.$,g=f.map(function(l){return l.ga}).concat(f.map(function(l){return l.la}));Xa([a],g,function(l){var k={};f.forEach(function(h,m){var n=l[m],q=h.ea,y=h.fa,z=l[m+f.length],p=h.ka,ia=h.ma;k[h.ba]={read:function(A){return n.fromWireType(q(y,A))},write:function(A,F){var W=[];p(ia,A,z.toWireType(W,F));Qa(W)}}});return[{name:b.name,fromWireType:function(h){var m={},n;for(n in k)m[n]=k[n].read(h);e(h);return m},toWireType:function(h,
|
||||||
fromWireType:function(h){var m={},n;for(n in k)m[n]=k[n].read(h);e(h);return m},toWireType:function(h,m){for(var n in k)if(!(n in m))throw new TypeError('Missing field: "'+n+'"');var q=c();for(n in k)k[n].write(q,m[n]);null!==h&&h.push(e,q);return q},argPackAdvance:8,readValueFromPointer:Ra,Z:e}]})},x:function(a,b,c,e,f){var g=Ya(c);b=U(b);T(a,{name:b,fromWireType:function(l){return!!l},toWireType:function(l,k){return k?e:f},argPackAdvance:8,readValueFromPointer:function(l){if(1===c)var k=M;else if(2===
|
m){for(var n in k)if(!(n in m))throw new TypeError('Missing field: "'+n+'"');var q=c();for(n in k)k[n].write(q,m[n]);null!==h&&h.push(e,q);return q},argPackAdvance:8,readValueFromPointer:Ra,X:e}]})},x:function(a,b,c,e,f){var g=Ya(c);b=U(b);T(a,{name:b,fromWireType:function(l){return!!l},toWireType:function(l,k){return k?e:f},argPackAdvance:8,readValueFromPointer:function(l){if(1===c)var k=M;else if(2===c)k=J;else if(4===c)k=K;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[l>>
|
||||||
c)k=J;else if(4===c)k=K;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[l>>g])},Z:null})},w:function(a,b){b=U(b);T(a,{name:b,fromWireType:function(c){var e=X[c].value;bb(c);return e},toWireType:function(c,e){return cb(e)},argPackAdvance:8,readValueFromPointer:Ra,Z:null})},h:function(a,b,c){c=Ya(c);b=U(b);T(a,{name:b,fromWireType:function(e){return e},toWireType:function(e,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+db(f)+
|
g])},X:null})},w:function(a,b){b=U(b);T(a,{name:b,fromWireType:function(c){var e=X[c].value;bb(c);return e},toWireType:function(c,e){return cb(e)},argPackAdvance:8,readValueFromPointer:Ra,X:null})},j:function(a,b,c){c=Ya(c);b=U(b);T(a,{name:b,fromWireType:function(e){return e},toWireType:function(e,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+db(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:eb(b,c),X:null})},f:function(a,b,c,e,f,g){var l=
|
||||||
'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:eb(b,c),Z:null})},e:function(a,b,c,e,f,g){var l=ib(b,c);a=U(a);f=Y(e,f);hb(a,function(){mb("Cannot call "+a+" due to unbound types",l)},b-1);Xa([],l,function(k){var h=[k[0],null].concat(k.slice(1)),m=k=a,n=f,q=h.length;2>q&&V("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var y=null!==h[1]&&!1,z=!1,p=1;p<h.length;++p)if(null!==h[p]&&void 0===h[p].Z){z=!0;break}var ka="void"!==h[0].name,A="",F=
|
ib(b,c);a=U(a);f=Y(e,f);hb(a,function(){mb("Cannot call "+a+" due to unbound types",l)},b-1);Xa([],l,function(k){var h=[k[0],null].concat(k.slice(1)),m=k=a,n=f,q=h.length;2>q&&V("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var y=null!==h[1]&&!1,z=!1,p=1;p<h.length;++p)if(null!==h[p]&&void 0===h[p].X){z=!0;break}var ia="void"!==h[0].name,A="",F="";for(p=0;p<q-2;++p)A+=(0!==p?", ":"")+"arg"+p,F+=(0!==p?", ":"")+"arg"+p+"Wired";m="return function "+Ta(m)+"("+
|
||||||
"";for(p=0;p<q-2;++p)A+=(0!==p?", ":"")+"arg"+p,F+=(0!==p?", ":"")+"arg"+p+"Wired";m="return function "+Ta(m)+"("+A+") {\nif (arguments.length !== "+(q-2)+") {\nthrowBindingError('function "+m+" called with ' + arguments.length + ' arguments, expected "+(q-2)+" args!');\n}\n";z&&(m+="var destructors = [];\n");var W=z?"destructors":"null";A="throwBindingError invoker fn runDestructors retType classParam".split(" ");n=[V,n,g,Qa,h[0],h[1]];y&&(m+="var thisWired = classParam.toWireType("+W+", this);\n");
|
A+") {\nif (arguments.length !== "+(q-2)+") {\nthrowBindingError('function "+m+" called with ' + arguments.length + ' arguments, expected "+(q-2)+" args!');\n}\n";z&&(m+="var destructors = [];\n");var W=z?"destructors":"null";A="throwBindingError invoker fn runDestructors retType classParam".split(" ");n=[V,n,g,Qa,h[0],h[1]];y&&(m+="var thisWired = classParam.toWireType("+W+", this);\n");for(p=0;p<q-2;++p)m+="var arg"+p+"Wired = argType"+p+".toWireType("+W+", arg"+p+"); // "+h[p+2].name+"\n",A.push("argType"+
|
||||||
for(p=0;p<q-2;++p)m+="var arg"+p+"Wired = argType"+p+".toWireType("+W+", arg"+p+"); // "+h[p+2].name+"\n",A.push("argType"+p),n.push(h[p+2]);y&&(F="thisWired"+(0<F.length?", ":"")+F);m+=(ka?"var rv = ":"")+"invoker(fn"+(0<F.length?", ":"")+F+");\n";if(z)m+="runDestructors(destructors);\n";else for(p=y?1:2;p<h.length;++p)q=1===p?"thisWired":"arg"+(p-2)+"Wired",null!==h[p].Z&&(m+=q+"_dtor("+q+"); // "+h[p].name+"\n",A.push(q+"_dtor"),n.push(h[p].Z));ka&&(m+="var ret = retType.fromWireType(rv);\nreturn ret;\n");
|
p),n.push(h[p+2]);y&&(F="thisWired"+(0<F.length?", ":"")+F);m+=(ia?"var rv = ":"")+"invoker(fn"+(0<F.length?", ":"")+F+");\n";if(z)m+="runDestructors(destructors);\n";else for(p=y?1:2;p<h.length;++p)q=1===p?"thisWired":"arg"+(p-2)+"Wired",null!==h[p].X&&(m+=q+"_dtor("+q+"); // "+h[p].name+"\n",A.push(q+"_dtor"),n.push(h[p].X));ia&&(m+="var ret = retType.fromWireType(rv);\nreturn ret;\n");A.push(m+"}\n");h=fb(A).apply(null,n);p=b-1;if(!d.hasOwnProperty(k))throw new Wa("Replacing nonexistant public symbol");
|
||||||
A.push(m+"}\n");h=fb(A).apply(null,n);p=b-1;if(!d.hasOwnProperty(k))throw new Wa("Replacing nonexistant public symbol");void 0!==d[k].Y&&void 0!==p?d[k].Y[p]=h:(d[k]=h,d[k].ea=p);return[]})},b:function(a,b,c,e,f){function g(m){return m}b=U(b);-1===f&&(f=4294967295);var l=Ya(c);if(0===e){var k=32-8*c;g=function(m){return m<<k>>>k}}var h=-1!=b.indexOf("unsigned");T(a,{name:b,fromWireType:g,toWireType:function(m,n){if("number"!==typeof n&&"boolean"!==typeof n)throw new TypeError('Cannot convert "'+db(n)+
|
void 0!==d[k].W&&void 0!==p?d[k].W[p]=h:(d[k]=h,d[k].aa=p);return[]})},c:function(a,b,c,e,f){function g(m){return m}b=U(b);-1===f&&(f=4294967295);var l=Ya(c);if(0===e){var k=32-8*c;g=function(m){return m<<k>>>k}}var h=-1!=b.indexOf("unsigned");T(a,{name:b,fromWireType:g,toWireType:function(m,n){if("number"!==typeof n&&"boolean"!==typeof n)throw new TypeError('Cannot convert "'+db(n)+'" to '+this.name);if(n<e||n>f)throw new TypeError('Passing a number "'+db(n)+'" from JS side to C/C++ side to an argument of type "'+
|
||||||
'" to '+this.name);if(n<e||n>f)throw new TypeError('Passing a number "'+db(n)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+e+", "+f+"]!");return h?n>>>0:n|0},argPackAdvance:8,readValueFromPointer:nb(b,l,0!==e),Z:null})},a:function(a,b,c){function e(g){g>>=2;var l=N;return new f(L,l[g+1],l[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=U(c);T(a,{name:c,fromWireType:e,argPackAdvance:8,
|
b+'", which is outside the valid range ['+e+", "+f+"]!");return h?n>>>0:n|0},argPackAdvance:8,readValueFromPointer:nb(b,l,0!==e),X:null})},b:function(a,b,c){function e(g){g>>=2;var l=N;return new f(L,l[g+1],l[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=U(c);T(a,{name:c,fromWireType:e,argPackAdvance:8,readValueFromPointer:e},{ha:!0})},k:function(a,b){b=U(b);var c="std::string"===b;T(a,{name:b,fromWireType:function(e){var f=N[e>>2];if(c)for(var g=
|
||||||
readValueFromPointer:e},{ka:!0})},i:function(a,b){b=U(b);var c="std::string"===b;T(a,{name:b,fromWireType:function(e){var f=N[e>>2];if(c)for(var g=e+4,l=0;l<=f;++l){var k=e+4+l;if(0==I[k]||l==f){g=g?na(I,g,k-g):"";if(void 0===h)var h=g;else h+=String.fromCharCode(0),h+=g;g=k+1}}else{h=Array(f);for(l=0;l<f;++l)h[l]=String.fromCharCode(I[e+4+l]);h=h.join("")}Z(e);return h},toWireType:function(e,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||
|
e+4,l=0;l<=f;++l){var k=e+4+l;if(l==f||0==I[k]){g=g?oa(I,g,k-g):"";if(void 0===h)var h=g;else h+=String.fromCharCode(0),h+=g;g=k+1}}else{h=Array(f);for(l=0;l<f;++l)h[l]=String.fromCharCode(I[e+4+l]);h=h.join("")}Z(e);return h},toWireType:function(e,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||V("Cannot pass non-string to std::string");var l=(c&&g?function(){for(var m=0,n=0;n<f.length;++n){var q=
|
||||||
f instanceof Uint8ClampedArray||f instanceof Int8Array||V("Cannot pass non-string to std::string");var l=(c&&g?function(){for(var m=0,n=0;n<f.length;++n){var q=f.charCodeAt(n);55296<=q&&57343>=q&&(q=65536+((q&1023)<<10)|f.charCodeAt(++n)&1023);127>=q?++m:m=2047>=q?m+2:65535>=q?m+3:m+4}return m}:function(){return f.length})(),k=yb(4+l+1);N[k>>2]=l;if(c&&g)oa(f,k+4,l+1);else if(g)for(g=0;g<l;++g){var h=f.charCodeAt(g);255<h&&(Z(k),V("String has UTF-16 code units that do not fit in 8 bits"));I[k+4+g]=
|
f.charCodeAt(n);55296<=q&&57343>=q&&(q=65536+((q&1023)<<10)|f.charCodeAt(++n)&1023);127>=q?++m:m=2047>=q?m+2:65535>=q?m+3:m+4}return m}:function(){return f.length})(),k=yb(4+l+1);N[k>>2]=l;if(c&&g)pa(f,k+4,l+1);else if(g)for(g=0;g<l;++g){var h=f.charCodeAt(g);255<h&&(Z(k),V("String has UTF-16 code units that do not fit in 8 bits"));I[k+4+g]=h}else for(g=0;g<l;++g)I[k+4+g]=f[g];null!==e&&e.push(Z,k);return k},argPackAdvance:8,readValueFromPointer:Ra,X:function(e){Z(e)}})},e:function(a,b,c){c=U(c);
|
||||||
h}else for(g=0;g<l;++g)I[k+4+g]=f[g];null!==e&&e.push(Z,k);return k},argPackAdvance:8,readValueFromPointer:Ra,Z:function(e){Z(e)}})},d:function(a,b,c){c=U(c);if(2===b){var e=qa;var f=sa;var g=ta;var l=function(){return ra};var k=1}else 4===b&&(e=ua,f=va,g=wa,l=function(){return N},k=2);T(a,{name:c,fromWireType:function(h){for(var m=N[h>>2],n=l(),q,y=h+4,z=0;z<=m;++z){var p=h+4+z*b;if(0==n[p>>k]||z==m)y=e(y,p-y),void 0===q?q=y:(q+=String.fromCharCode(0),q+=y),y=p+b}Z(h);return q},toWireType:function(h,
|
if(2===b){var e=ra;var f=ta;var g=ua;var l=function(){return sa};var k=1}else 4===b&&(e=va,f=wa,g=xa,l=function(){return N},k=2);T(a,{name:c,fromWireType:function(h){for(var m=N[h>>2],n=l(),q,y=h+4,z=0;z<=m;++z){var p=h+4+z*b;if(z==m||0==n[p>>k])y=e(y,p-y),void 0===q?q=y:(q+=String.fromCharCode(0),q+=y),y=p+b}Z(h);return q},toWireType:function(h,m){"string"!==typeof m&&V("Cannot pass non-string to C++ string type "+c);var n=g(m),q=yb(4+n+b);N[q>>2]=n>>k;f(m,q+4,n+b);null!==h&&h.push(Z,q);return q},
|
||||||
m){"string"!==typeof m&&V("Cannot pass non-string to C++ string type "+c);var n=g(m),q=yb(4+n+b);N[q>>2]=n>>k;f(m,q+4,n+b);null!==h&&h.push(Z,q);return q},argPackAdvance:8,readValueFromPointer:Ra,Z:function(h){Z(h)}})},m:function(a,b,c,e,f,g){Pa[a]={name:U(b),la:Y(c,e),ma:Y(f,g),da:[]}},f:function(a,b,c,e,f,g,l,k,h,m){Pa[a].da.push({fa:U(b),ja:c,ha:Y(e,f),ia:g,oa:l,na:Y(k,h),pa:m})},y:function(a,b){b=U(b);T(a,{qa:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},v:bb,
|
argPackAdvance:8,readValueFromPointer:Ra,X:function(h){Z(h)}})},o:function(a,b,c,e,f,g){Pa[a]={name:U(b),ia:Y(c,e),ja:Y(f,g),$:[]}},a:function(a,b,c,e,f,g,l,k,h,m){Pa[a].$.push({ba:U(b),ga:c,ea:Y(e,f),fa:g,la:l,ka:Y(k,h),ma:m})},y:function(a,b){b=U(b);T(a,{na:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},h:bb,z:function(a){if(0===a)return cb(pb());var b=ob[a];a=void 0===b?U(a):b;return cb(pb()[a])},m:function(a){4<a&&(X[a].Z+=1)},p:function(a,b,c,e){a||V("Cannot use deleted val. handle = "+
|
||||||
B:function(a){if(0===a)return cb(pb());var b=ob[a];a=void 0===b?U(a):b;return cb(pb()[a])},k:function(a){4<a&&(X[a].aa+=1)},n:function(a,b,c,e){a||V("Cannot use deleted val. handle = "+a);a=X[a].value;var f=rb[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var l="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)l+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+
|
a);a=X[a].value;var f=rb[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var l="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)l+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",l+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(qb,
|
||||||
g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",l+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(qb,d,cb);rb[b]=f}return f(a,c,e)},r:function(){D()},q:function(a,b,c){I.copyWithin(a,b,b+c)},c:function(a){a>>>=0;var b=I.length;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var e=b*(1+.2/c);e=Math.min(e,a+100663296);e=Math.max(16777216,a,e);0<e%65536&&(e+=65536-e%65536);a:{try{H.grow(Math.min(2147483648,
|
d,cb);rb[b]=f}return f(a,c,e)},g:function(){D()},s:function(a,b,c){I.copyWithin(a,b,b+c)},d:function(a){a>>>=0;var b=I.length;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var e=b*(1+.2/c);e=Math.min(e,a+100663296);e=Math.max(16777216,a,e);0<e%65536&&(e+=65536-e%65536);a:{try{H.grow(Math.min(2147483648,e)-L.byteLength+65535>>>16);Aa(H.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},t:function(a,b){var c=0;tb().forEach(function(e,f){var g=b+c;f=K[a+4*f>>2]=g;for(g=0;g<e.length;++g)M[f++>>
|
||||||
e)-L.byteLength+65535>>>16);za(H.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},s:function(a,b){var c=0;tb().forEach(function(e,f){var g=b+c;f=K[a+4*f>>2]=g;for(g=0;g<e.length;++g)M[f++>>0]=e.charCodeAt(g);M[f>>0]=0;c+=e.length+1});return 0},t:function(a,b){var c=tb();K[a>>2]=c.length;var e=0;c.forEach(function(f){e+=f.length+1});K[b>>2]=e;return 0},z:function(a){if(!noExitRuntime&&(la=!0,d.onExit))d.onExit(a);u(a,new ha(a))},u:function(){return 0},o:function(){},g:function(a,
|
0]=e.charCodeAt(g);M[f>>0]=0;c+=e.length+1});return 0},u:function(a,b){var c=tb();K[a>>2]=c.length;var e=0;c.forEach(function(f){e+=f.length+1});K[b>>2]=e;return 0},l:function(a){if(!noExitRuntime&&(ma=!0,d.onExit))d.onExit(a);u(a,new ja(a))},v:function(){return 0},q:function(){},i:function(a,b,c,e){for(var f=0,g=0;g<c;g++){for(var l=K[b+8*g>>2],k=K[b+(8*g+4)>>2],h=0;h<k;h++){var m=I[l+h],n=vb[a];0===m||10===m?((1===a?ka:E)(oa(n,0)),n.length=0):n.push(m)}f+=k}K[e>>2]=f;return 0},memory:H,r:function(){},
|
||||||
b,c,e){for(var f=0,g=0;g<c;g++){for(var l=K[b+8*g>>2],k=K[b+(8*g+4)>>2],h=0;h<k;h++){var m=I[l+h],n=vb[a];0===m||10===m?((1===a?ia:E)(na(n,0)),n.length=0):n.push(m)}f+=k}K[e>>2]=f;return 0},memory:H,p:function(){},table:ja};
|
table:la};
|
||||||
(function(){function a(f){d.asm=f.exports;O--;d.monitorRunDependencies&&d.monitorRunDependencies(O);0==O&&(null!==Ha&&(clearInterval(Ha),Ha=null),P&&(f=P,P=null,f()))}function b(f){a(f.instance)}function c(f){return Ma().then(function(g){return WebAssembly.instantiate(g,e)}).then(f,function(g){E("failed to asynchronously prepare wasm: "+g);D(g)})}var e={a:zb};O++;d.monitorRunDependencies&&d.monitorRunDependencies(O);if(d.instantiateWasm)try{return d.instantiateWasm(e,a)}catch(f){return E("Module.instantiateWasm callback failed with error: "+
|
(function(){function a(f){d.asm=f.exports;O--;d.monitorRunDependencies&&d.monitorRunDependencies(O);0==O&&(null!==Ia&&(clearInterval(Ia),Ia=null),P&&(f=P,P=null,f()))}function b(f){a(f.instance)}function c(f){return Na().then(function(g){return WebAssembly.instantiate(g,e)}).then(f,function(g){E("failed to asynchronously prepare wasm: "+g);D(g)})}var e={a:zb};O++;d.monitorRunDependencies&&d.monitorRunDependencies(O);if(d.instantiateWasm)try{return d.instantiateWasm(e,a)}catch(f){return E("Module.instantiateWasm callback failed with error: "+f),
|
||||||
f),!1}(function(){if(G||"function"!==typeof WebAssembly.instantiateStreaming||Ja()||Ia("file://")||"function"!==typeof fetch)return c(b);fetch(Q,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(b,function(g){E("wasm streaming compile failed: "+g);E("falling back to ArrayBuffer instantiation");return c(b)})})})();return{}})();
|
!1}(function(){if(G||"function"!==typeof WebAssembly.instantiateStreaming||Ka()||Ja("file://")||"function"!==typeof fetch)return c(b);fetch(Q,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(b,function(g){E("wasm streaming compile failed: "+g);E("falling back to ArrayBuffer instantiation");return c(b)})})})();return{}})();
|
||||||
var Na=d.___wasm_call_ctors=function(){return(Na=d.___wasm_call_ctors=d.asm.D).apply(null,arguments)},Z=d._free=function(){return(Z=d._free=d.asm.E).apply(null,arguments)},yb=d._malloc=function(){return(yb=d._malloc=d.asm.F).apply(null,arguments)},lb=d.___getTypeName=function(){return(lb=d.___getTypeName=d.asm.G).apply(null,arguments)};d.___embind_register_native_and_builtin_types=function(){return(d.___embind_register_native_and_builtin_types=d.asm.H).apply(null,arguments)};
|
var Oa=d.___wasm_call_ctors=function(){return(Oa=d.___wasm_call_ctors=d.asm.B).apply(null,arguments)},Z=d._free=function(){return(Z=d._free=d.asm.C).apply(null,arguments)},yb=d._malloc=function(){return(yb=d._malloc=d.asm.D).apply(null,arguments)},lb=d.___getTypeName=function(){return(lb=d.___getTypeName=d.asm.E).apply(null,arguments)};d.___embind_register_native_and_builtin_types=function(){return(d.___embind_register_native_and_builtin_types=d.asm.F).apply(null,arguments)};
|
||||||
d.dynCall_i=function(){return(d.dynCall_i=d.asm.I).apply(null,arguments)};d.dynCall_vi=function(){return(d.dynCall_vi=d.asm.J).apply(null,arguments)};d.dynCall_iii=function(){return(d.dynCall_iii=d.asm.K).apply(null,arguments)};d.dynCall_viii=function(){return(d.dynCall_viii=d.asm.L).apply(null,arguments)};d.dynCall_ii=function(){return(d.dynCall_ii=d.asm.M).apply(null,arguments)};d.dynCall_iiiiii=function(){return(d.dynCall_iiiiii=d.asm.N).apply(null,arguments)};
|
d.dynCall_i=function(){return(d.dynCall_i=d.asm.G).apply(null,arguments)};d.dynCall_vi=function(){return(d.dynCall_vi=d.asm.H).apply(null,arguments)};d.dynCall_iii=function(){return(d.dynCall_iii=d.asm.I).apply(null,arguments)};d.dynCall_viii=function(){return(d.dynCall_viii=d.asm.J).apply(null,arguments)};d.dynCall_ii=function(){return(d.dynCall_ii=d.asm.K).apply(null,arguments)};d.dynCall_iiiiii=function(){return(d.dynCall_iiiiii=d.asm.L).apply(null,arguments)};
|
||||||
d.dynCall_viiiii=function(){return(d.dynCall_viiiii=d.asm.O).apply(null,arguments)};d.dynCall_vii=function(){return(d.dynCall_vii=d.asm.P).apply(null,arguments)};d.dynCall_iiiiiii=function(){return(d.dynCall_iiiiiii=d.asm.Q).apply(null,arguments)};d.dynCall_iiiii=function(){return(d.dynCall_iiiii=d.asm.R).apply(null,arguments)};d.dynCall_iiii=function(){return(d.dynCall_iiii=d.asm.S).apply(null,arguments)};d.dynCall_viiiiiiii=function(){return(d.dynCall_viiiiiiii=d.asm.T).apply(null,arguments)};
|
d.dynCall_viiiii=function(){return(d.dynCall_viiiii=d.asm.M).apply(null,arguments)};d.dynCall_vii=function(){return(d.dynCall_vii=d.asm.N).apply(null,arguments)};d.dynCall_iiiiiii=function(){return(d.dynCall_iiiiiii=d.asm.O).apply(null,arguments)};d.dynCall_iiiii=function(){return(d.dynCall_iiiii=d.asm.P).apply(null,arguments)};d.dynCall_iiii=function(){return(d.dynCall_iiii=d.asm.Q).apply(null,arguments)};d.dynCall_viiii=function(){return(d.dynCall_viiii=d.asm.R).apply(null,arguments)};
|
||||||
d.dynCall_viiii=function(){return(d.dynCall_viiii=d.asm.U).apply(null,arguments)};d.dynCall_viiiiiii=function(){return(d.dynCall_viiiiiii=d.asm.V).apply(null,arguments)};d.dynCall_jiji=function(){return(d.dynCall_jiji=d.asm.W).apply(null,arguments)};d.dynCall_viiiiii=function(){return(d.dynCall_viiiiii=d.asm.X).apply(null,arguments)};var Ab;function ha(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}P=function Bb(){Ab||Cb();Ab||(P=Bb)};
|
d.dynCall_viiiiiiii=function(){return(d.dynCall_viiiiiiii=d.asm.S).apply(null,arguments)};d.dynCall_viiiiiii=function(){return(d.dynCall_viiiiiii=d.asm.T).apply(null,arguments)};d.dynCall_jiji=function(){return(d.dynCall_jiji=d.asm.U).apply(null,arguments)};d.dynCall_viiiiii=function(){return(d.dynCall_viiiiii=d.asm.V).apply(null,arguments)};var Ab;function ja(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}P=function Bb(){Ab||Cb();Ab||(P=Bb)};
|
||||||
function Cb(){function a(){if(!Ab&&(Ab=!0,d.calledRun=!0,!la)){Ba(Da);Ba(Ea);aa(d);if(d.onRuntimeInitialized)d.onRuntimeInitialized();if(d.postRun)for("function"==typeof d.postRun&&(d.postRun=[d.postRun]);d.postRun.length;){var b=d.postRun.shift();Fa.unshift(b)}Ba(Fa)}}if(!(0<O)){if(d.preRun)for("function"==typeof d.preRun&&(d.preRun=[d.preRun]);d.preRun.length;)Ga();Ba(Ca);0<O||(d.setStatus?(d.setStatus("Running..."),setTimeout(function(){setTimeout(function(){d.setStatus("")},1);a()},1)):a())}}
|
function Cb(){function a(){if(!Ab&&(Ab=!0,d.calledRun=!0,!ma)){Ca(Ea);Ca(Fa);aa(d);if(d.onRuntimeInitialized)d.onRuntimeInitialized();if(d.postRun)for("function"==typeof d.postRun&&(d.postRun=[d.postRun]);d.postRun.length;){var b=d.postRun.shift();Ga.unshift(b)}Ca(Ga)}}if(!(0<O)){if(d.preRun)for("function"==typeof d.preRun&&(d.preRun=[d.preRun]);d.preRun.length;)Ha();Ca(Da);0<O||(d.setStatus?(d.setStatus("Running..."),setTimeout(function(){setTimeout(function(){d.setStatus("")},1);a()},1)):a())}}
|
||||||
d.run=Cb;if(d.preInit)for("function"==typeof d.preInit&&(d.preInit=[d.preInit]);0<d.preInit.length;)d.preInit.pop()();noExitRuntime=!0;Cb();
|
d.run=Cb;if(d.preInit)for("function"==typeof d.preInit&&(d.preInit=[d.preInit]);0<d.preInit.length;)d.preInit.pop()();noExitRuntime=!0;Cb();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
198
codecs/oxipng/Cargo.lock
generated
198
codecs/oxipng/Cargo.lock
generated
@@ -1,16 +1,22 @@
|
|||||||
# This file is automatically @generated by Cargo.
|
# This file is automatically @generated by Cargo.
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "adler32"
|
name = "adler"
|
||||||
version = "1.1.0"
|
version = "0.2.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "567b077b825e468cc974f0020d4082ee6e03132512f207ef1a02fd5d00d1f32d"
|
checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "adler32"
|
||||||
|
version = "1.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "autocfg"
|
name = "autocfg"
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
|
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bit-vec"
|
name = "bit-vec"
|
||||||
@@ -38,9 +44,9 @@ checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bytemuck"
|
name = "bytemuck"
|
||||||
version = "1.2.0"
|
version = "1.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "37fa13df2292ecb479ec23aa06f4507928bef07839be9ef15281411076629431"
|
checksum = "41aa2ec95ca3b5c54cf73c91acf06d24f4495d5f1b1c12506ae3483d646177ac"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "byteorder"
|
name = "byteorder"
|
||||||
@@ -50,9 +56,9 @@ checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.0.58"
|
version = "1.0.60"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518"
|
checksum = "ef611cc68ff783f18535d77ddd080185275713d852c4f5cbb6122c462a7a825c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
@@ -96,6 +102,16 @@ dependencies = [
|
|||||||
"cfg-if",
|
"cfg-if",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crossbeam-channel"
|
||||||
|
version = "0.4.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87"
|
||||||
|
dependencies = [
|
||||||
|
"crossbeam-utils",
|
||||||
|
"maybe-uninit",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossbeam-deque"
|
name = "crossbeam-deque"
|
||||||
version = "0.7.3"
|
version = "0.7.3"
|
||||||
@@ -122,17 +138,6 @@ dependencies = [
|
|||||||
"scopeguard",
|
"scopeguard",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "crossbeam-queue"
|
|
||||||
version = "0.2.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
"crossbeam-utils",
|
|
||||||
"maybe-uninit",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossbeam-utils"
|
name = "crossbeam-utils"
|
||||||
version = "0.7.2"
|
version = "0.7.2"
|
||||||
@@ -156,24 +161,30 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "either"
|
name = "either"
|
||||||
version = "1.5.3"
|
version = "1.6.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3"
|
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hashbrown"
|
||||||
|
version = "0.9.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "00d63df3d41950fb462ed38308eea019113ad1508da725bbedcd0fa5a85ef5f7"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hermit-abi"
|
name = "hermit-abi"
|
||||||
version = "0.1.15"
|
version = "0.1.16"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9"
|
checksum = "4c30f6d0bc6b00693347368a67d41b58f2fb851215ff1da49e90fe2c5c667151"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "image"
|
name = "image"
|
||||||
version = "0.23.7"
|
version = "0.23.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a2397fc43bd5648b7117aabb3c5e62d0e62c194826ec77b0b4d0c41e62744635"
|
checksum = "974e194911d1f7efe3cd8a8f9db3b767e43536327e899e8bc9a12ef5711b74d2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
@@ -185,11 +196,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "1.4.0"
|
version = "1.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c398b2b113b55809ceb9ee3e753fcbac793f1956663f3c36549c1346015c2afe"
|
checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
|
"hashbrown",
|
||||||
"rayon",
|
"rayon",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -210,24 +222,33 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.72"
|
version = "0.2.77"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a9f8082297d534141b30c8d39e9b1773713ab50fdbe4ff30f750d063b3bfd701"
|
checksum = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libdeflater"
|
name = "libdeflate-sys"
|
||||||
version = "0.2.0"
|
version = "0.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "66dca08b13369865b2f6dca1dd05f833985cbe6c12a676b04d55f78b85e80246"
|
checksum = "21e39efa87b84db3e13ff4e2dfac1e57220abcbd7fe8ec44d238f7f4f787cc1f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "libdeflater"
|
||||||
version = "0.4.8"
|
version = "0.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
|
checksum = "a4810980d791f26d470e2d7d91a3d4d22aa3a4b709fb7e9c5e43ee54f83a01f2"
|
||||||
|
dependencies = [
|
||||||
|
"libdeflate-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "log"
|
||||||
|
version = "0.4.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
]
|
]
|
||||||
@@ -240,9 +261,9 @@ checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memoffset"
|
name = "memoffset"
|
||||||
version = "0.5.5"
|
version = "0.5.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c198b026e1bbf08a937e94c6c60f9ec4a2267f5b0d2eec9c1b21b061ce2be55f"
|
checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
]
|
]
|
||||||
@@ -256,6 +277,16 @@ dependencies = [
|
|||||||
"adler32",
|
"adler32",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "miniz_oxide"
|
||||||
|
version = "0.4.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c60c0dfe32c10b43a144bad8fc83538c52f58302c92300ea7ec7bf7b38d5a7b9"
|
||||||
|
dependencies = [
|
||||||
|
"adler",
|
||||||
|
"autocfg",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-integer"
|
name = "num-integer"
|
||||||
version = "0.1.43"
|
version = "0.1.43"
|
||||||
@@ -308,42 +339,50 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "oxipng"
|
name = "once_cell"
|
||||||
version = "3.0.0"
|
version = "1.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d5fd695858078338d73862ff3755f820eff0bf4f3304e4b52f22aba53463183a"
|
checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "oxipng"
|
||||||
|
version = "3.0.1"
|
||||||
|
source = "git+https://github.com/RReverser/oxipng?branch=crossbeam#0df4a32921f7b88d2be4649deb1b6fb7e5707ad8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bit-vec",
|
"bit-vec",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"cloudflare-zlib",
|
"cloudflare-zlib",
|
||||||
"crc",
|
"crc",
|
||||||
|
"crossbeam-channel",
|
||||||
"image",
|
"image",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"itertools",
|
"itertools",
|
||||||
"libdeflater",
|
"libdeflater",
|
||||||
"log",
|
"log",
|
||||||
"miniz_oxide",
|
"miniz_oxide 0.4.2",
|
||||||
|
"rayon",
|
||||||
"rgb",
|
"rgb",
|
||||||
|
"rustc_version",
|
||||||
"zopfli",
|
"zopfli",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "png"
|
name = "png"
|
||||||
version = "0.16.6"
|
version = "0.16.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c150bf7479fafe3dd8740dbe48cc33b2a3efb7b0fe3483aced8bbc39f6d0238d"
|
checksum = "dfe7f9f1c730833200b134370e1d5098964231af8450bce9b78ee3ab5278b970"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"crc32fast",
|
"crc32fast",
|
||||||
"deflate",
|
"deflate",
|
||||||
"miniz_oxide",
|
"miniz_oxide 0.3.7",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.18"
|
version = "1.0.21"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa"
|
checksum = "36e28516df94f3dd551a587da5357459d9b36d945a7c37c3557928c1c2ff2a2c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-xid",
|
"unicode-xid",
|
||||||
]
|
]
|
||||||
@@ -359,9 +398,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rayon"
|
name = "rayon"
|
||||||
version = "1.3.1"
|
version = "1.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "62f02856753d04e03e26929f820d0a0a337ebe71f849801eea335d464b349080"
|
checksum = "dcf6960dc9a5b4ee8d3e4c5787b4a112a8818e0290a42ff664ad60692fdf2032"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
"crossbeam-deque",
|
"crossbeam-deque",
|
||||||
@@ -371,12 +410,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rayon-core"
|
name = "rayon-core"
|
||||||
version = "1.7.1"
|
version = "1.8.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e92e15d89083484e11353891f1af602cc661426deb9564c298b270c726973280"
|
checksum = "e8c4fec834fb6e6d2dd5eece3c7b432a52f0ba887cf40e595190c4107edc08bf"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"crossbeam-channel",
|
||||||
"crossbeam-deque",
|
"crossbeam-deque",
|
||||||
"crossbeam-queue",
|
|
||||||
"crossbeam-utils",
|
"crossbeam-utils",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"num_cpus",
|
"num_cpus",
|
||||||
@@ -384,33 +423,60 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rgb"
|
name = "rgb"
|
||||||
version = "0.8.20"
|
version = "0.8.25"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "90ef54b45ae131327a88597e2463fee4098ad6c88ba7b6af4b3987db8aad4098"
|
checksum = "287f3c3f8236abb92d8b7e36797f19159df4b58f0a658cc3fb6dd3004b1f3bd3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustc_version"
|
||||||
|
version = "0.2.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
|
||||||
|
dependencies = [
|
||||||
|
"semver",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "scopeguard"
|
name = "scopeguard"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "semver"
|
||||||
|
version = "0.9.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
|
||||||
|
dependencies = [
|
||||||
|
"semver-parser",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "semver-parser"
|
||||||
|
version = "0.7.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "squoosh-oxipng"
|
name = "squoosh-oxipng"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"crossbeam-channel",
|
||||||
"log",
|
"log",
|
||||||
|
"once_cell",
|
||||||
"oxipng",
|
"oxipng",
|
||||||
|
"rayon",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.34"
|
version = "1.0.41"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "936cae2873c940d92e697597c5eee105fb570cd5689c695806f672883653349b"
|
checksum = "6690e3e9f692504b941dc6c3b188fd28df054f7fb8469ab40680df52fdcc842b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -431,9 +497,9 @@ checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen"
|
name = "wasm-bindgen"
|
||||||
version = "0.2.64"
|
version = "0.2.68"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6a634620115e4a229108b71bde263bb4220c483b3f07f5ba514ee8d15064c4c2"
|
checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"wasm-bindgen-macro",
|
"wasm-bindgen-macro",
|
||||||
@@ -441,9 +507,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-backend"
|
name = "wasm-bindgen-backend"
|
||||||
version = "0.2.64"
|
version = "0.2.68"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3e53963b583d18a5aa3aaae4b4c1cb535218246131ba22a71f05b518098571df"
|
checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bumpalo",
|
"bumpalo",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
@@ -456,9 +522,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-macro"
|
name = "wasm-bindgen-macro"
|
||||||
version = "0.2.64"
|
version = "0.2.68"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3fcfd5ef6eec85623b4c6e844293d4516470d8f19cd72d0d12246017eb9060b8"
|
checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quote",
|
"quote",
|
||||||
"wasm-bindgen-macro-support",
|
"wasm-bindgen-macro-support",
|
||||||
@@ -466,9 +532,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-macro-support"
|
name = "wasm-bindgen-macro-support"
|
||||||
version = "0.2.64"
|
version = "0.2.68"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9adff9ee0e94b926ca81b57f57f86d5545cdcb1d259e21ec9bdd95b901754c75"
|
checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -479,9 +545,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-shared"
|
name = "wasm-bindgen-shared"
|
||||||
version = "0.2.64"
|
version = "0.2.68"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7f7b90ea6c632dd06fd765d44542e234d5e63d9bb917ecd64d79778a13bd79ae"
|
checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zopfli"
|
name = "zopfli"
|
||||||
|
|||||||
@@ -12,7 +12,20 @@ crate-type = ["cdylib"]
|
|||||||
oxipng = { version = "3.0.0", default-features = false }
|
oxipng = { version = "3.0.0", default-features = false }
|
||||||
wasm-bindgen = "0.2.64"
|
wasm-bindgen = "0.2.64"
|
||||||
log = { version = "0.4", features = ["release_max_level_off"] }
|
log = { version = "0.4", features = ["release_max_level_off"] }
|
||||||
|
rayon = { version = "1.3.0", optional = true }
|
||||||
|
once_cell = { version = "1.3.1", optional = true }
|
||||||
|
crossbeam-channel = { version = "0.4.2", optional = true }
|
||||||
|
|
||||||
|
[patch.crates-io]
|
||||||
|
# TODO: replace with upstream version once https://github.com/shssoichiro/oxipng/pull/327 is merged.
|
||||||
|
oxipng = { git = "https://github.com/RReverser/oxipng", branch = "crossbeam" }
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
lto = true
|
lto = true
|
||||||
opt-level = "s"
|
opt-level = "s"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
parallel = ["oxipng/parallel", "rayon", "crossbeam-channel", "once_cell"]
|
||||||
|
|
||||||
|
[package.metadata.wasm-pack.profile.release]
|
||||||
|
wasm-opt = ["-O", "--no-validation"]
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
FROM rust
|
|
||||||
RUN rustup target add wasm32-unknown-unknown
|
|
||||||
RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
|
||||||
|
|
||||||
RUN mkdir /opt/wabt && \
|
|
||||||
curl -L https://github.com/WebAssembly/wabt/releases/download/1.0.17/wabt-1.0.17-ubuntu.tar.gz | tar -xzf - -C /opt/wabt --strip 1
|
|
||||||
|
|
||||||
RUN mkdir /opt/wasi-sdk && \
|
|
||||||
curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-11/wasi-sdk-11.0-linux.tar.gz | tar -xzf - -C /opt/wasi-sdk --strip 1
|
|
||||||
|
|
||||||
ENV PATH="/opt/wabt/bin:/opt/wasi-sdk/bin:${PATH}"
|
|
||||||
WORKDIR /src
|
|
||||||
20
codecs/oxipng/LICENSE.codec.md
Normal file
20
codecs/oxipng/LICENSE.codec.md
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
Copyright (c) 2016 Joshua Holmer
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
of the Software, and to permit persons to whom the Software is furnished to do
|
||||||
|
so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
5
codecs/oxipng/README.md
Normal file
5
codecs/oxipng/README.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# OxiPNG
|
||||||
|
|
||||||
|
- Source: <https://github.com/shssoichiro/oxipng>
|
||||||
|
- Version: v3.0.0
|
||||||
|
- License: MIT
|
||||||
9
codecs/oxipng/build.sh
Normal file
9
codecs/oxipng/build.sh
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
rm -rf pkg,{-parallel}
|
||||||
|
wasm-pack build
|
||||||
|
RUSTFLAGS='-C target-feature=+atomics,+bulk-memory' wasm-pack build -t web -d pkg-parallel -- -Z build-std=panic_abort,std --features=parallel
|
||||||
|
sed -i "s|input = import.meta.url.replace(/\\\.js$/, '_bg.wasm');||" pkg{,-parallel}/squoosh_oxipng.js
|
||||||
|
rm pkg{,-parallel}/.gitignore
|
||||||
10
codecs/oxipng/index.ts
Normal file
10
codecs/oxipng/index.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { threads } from 'wasm-feature-detect';
|
||||||
|
|
||||||
|
async function init() {
|
||||||
|
if (await threads()) {
|
||||||
|
return (await import('./spawn')).default;
|
||||||
|
}
|
||||||
|
return import('./pkg');
|
||||||
|
}
|
||||||
|
|
||||||
|
export default init();
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "oxipng",
|
"name": "oxipng",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "../build-rust.sh"
|
"build": "../build-rust-nightly.sh ./build.sh"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
5
codecs/oxipng/pkg-parallel/README.md
Normal file
5
codecs/oxipng/pkg-parallel/README.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# OxiPNG
|
||||||
|
|
||||||
|
- Source: <https://github.com/shssoichiro/oxipng>
|
||||||
|
- Version: v3.0.0
|
||||||
|
- License: MIT
|
||||||
15
codecs/oxipng/pkg-parallel/package.json
Normal file
15
codecs/oxipng/pkg-parallel/package.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"name": "squoosh-oxipng",
|
||||||
|
"collaborators": [
|
||||||
|
"Ingvar Stepanyan <me@rreverser.com>"
|
||||||
|
],
|
||||||
|
"version": "0.1.0",
|
||||||
|
"files": [
|
||||||
|
"squoosh_oxipng_bg.wasm",
|
||||||
|
"squoosh_oxipng.js",
|
||||||
|
"squoosh_oxipng.d.ts"
|
||||||
|
],
|
||||||
|
"module": "squoosh_oxipng.js",
|
||||||
|
"types": "squoosh_oxipng.d.ts",
|
||||||
|
"sideEffects": false
|
||||||
|
}
|
||||||
46
codecs/oxipng/pkg-parallel/squoosh_oxipng.d.ts
vendored
Normal file
46
codecs/oxipng/pkg-parallel/squoosh_oxipng.d.ts
vendored
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
/**
|
||||||
|
* @param {number} num
|
||||||
|
* @returns {any}
|
||||||
|
*/
|
||||||
|
export function worker_initializer(num: number): any;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export function start_main_thread(): void;
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export function start_worker_thread(): void;
|
||||||
|
/**
|
||||||
|
* @param {Uint8Array} data
|
||||||
|
* @param {number} level
|
||||||
|
* @returns {Uint8Array}
|
||||||
|
*/
|
||||||
|
export function optimise(data: Uint8Array, level: number): Uint8Array;
|
||||||
|
|
||||||
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
||||||
|
|
||||||
|
export interface InitOutput {
|
||||||
|
readonly malloc: (a: number) => number;
|
||||||
|
readonly free: (a: number) => void;
|
||||||
|
readonly worker_initializer: (a: number) => number;
|
||||||
|
readonly start_main_thread: () => void;
|
||||||
|
readonly start_worker_thread: () => void;
|
||||||
|
readonly optimise: (a: number, b: number, c: number, d: number) => void;
|
||||||
|
readonly __wbindgen_export_0: WebAssembly.Memory;
|
||||||
|
readonly __wbindgen_malloc: (a: number) => number;
|
||||||
|
readonly __wbindgen_free: (a: number, b: number) => void;
|
||||||
|
readonly __wbindgen_start: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
||||||
|
* for everything else, calls `WebAssembly.instantiate` directly.
|
||||||
|
*
|
||||||
|
* @param {InitInput | Promise<InitInput>} module_or_path
|
||||||
|
* @param {WebAssembly.Memory} maybe_memory
|
||||||
|
*
|
||||||
|
* @returns {Promise<InitOutput>}
|
||||||
|
*/
|
||||||
|
export default function init (module_or_path?: InitInput | Promise<InitInput>, maybe_memory: WebAssembly.Memory): Promise<InitOutput>;
|
||||||
|
|
||||||
180
codecs/oxipng/pkg-parallel/squoosh_oxipng.js
Normal file
180
codecs/oxipng/pkg-parallel/squoosh_oxipng.js
Normal file
@@ -0,0 +1,180 @@
|
|||||||
|
|
||||||
|
let wasm;
|
||||||
|
let memory;
|
||||||
|
|
||||||
|
const heap = new Array(32).fill(undefined);
|
||||||
|
|
||||||
|
heap.push(undefined, null, true, false);
|
||||||
|
|
||||||
|
let heap_next = heap.length;
|
||||||
|
|
||||||
|
function addHeapObject(obj) {
|
||||||
|
if (heap_next === heap.length) heap.push(heap.length + 1);
|
||||||
|
const idx = heap_next;
|
||||||
|
heap_next = heap[idx];
|
||||||
|
|
||||||
|
heap[idx] = obj;
|
||||||
|
return idx;
|
||||||
|
}
|
||||||
|
|
||||||
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
||||||
|
|
||||||
|
cachedTextDecoder.decode();
|
||||||
|
|
||||||
|
let cachegetUint8Memory0 = null;
|
||||||
|
function getUint8Memory0() {
|
||||||
|
if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.__wbindgen_export_0.buffer) {
|
||||||
|
cachegetUint8Memory0 = new Uint8Array(wasm.__wbindgen_export_0.buffer);
|
||||||
|
}
|
||||||
|
return cachegetUint8Memory0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getStringFromWasm0(ptr, len) {
|
||||||
|
return cachedTextDecoder.decode(getUint8Memory0().slice(ptr, ptr + len));
|
||||||
|
}
|
||||||
|
|
||||||
|
function getObject(idx) { return heap[idx]; }
|
||||||
|
|
||||||
|
function dropObject(idx) {
|
||||||
|
if (idx < 36) return;
|
||||||
|
heap[idx] = heap_next;
|
||||||
|
heap_next = idx;
|
||||||
|
}
|
||||||
|
|
||||||
|
function takeObject(idx) {
|
||||||
|
const ret = getObject(idx);
|
||||||
|
dropObject(idx);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param {number} num
|
||||||
|
* @returns {any}
|
||||||
|
*/
|
||||||
|
export function worker_initializer(num) {
|
||||||
|
var ret = wasm.worker_initializer(num);
|
||||||
|
return takeObject(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export function start_main_thread() {
|
||||||
|
wasm.start_main_thread();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
export function start_worker_thread() {
|
||||||
|
wasm.start_worker_thread();
|
||||||
|
}
|
||||||
|
|
||||||
|
let WASM_VECTOR_LEN = 0;
|
||||||
|
|
||||||
|
function passArray8ToWasm0(arg, malloc) {
|
||||||
|
const ptr = malloc(arg.length * 1);
|
||||||
|
getUint8Memory0().set(arg, ptr / 1);
|
||||||
|
WASM_VECTOR_LEN = arg.length;
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
let cachegetInt32Memory0 = null;
|
||||||
|
function getInt32Memory0() {
|
||||||
|
if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.__wbindgen_export_0.buffer) {
|
||||||
|
cachegetInt32Memory0 = new Int32Array(wasm.__wbindgen_export_0.buffer);
|
||||||
|
}
|
||||||
|
return cachegetInt32Memory0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getArrayU8FromWasm0(ptr, len) {
|
||||||
|
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param {Uint8Array} data
|
||||||
|
* @param {number} level
|
||||||
|
* @returns {Uint8Array}
|
||||||
|
*/
|
||||||
|
export function optimise(data, level) {
|
||||||
|
try {
|
||||||
|
const retptr = wasm.__wbindgen_export_1.value - 16;
|
||||||
|
wasm.__wbindgen_export_1.value = retptr;
|
||||||
|
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
||||||
|
var len0 = WASM_VECTOR_LEN;
|
||||||
|
wasm.optimise(retptr, ptr0, len0, level);
|
||||||
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||||
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||||
|
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
||||||
|
wasm.__wbindgen_free(r0, r1 * 1);
|
||||||
|
return v1;
|
||||||
|
} finally {
|
||||||
|
wasm.__wbindgen_export_1.value += 16;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function load(module, imports, maybe_memory) {
|
||||||
|
if (typeof Response === 'function' && module instanceof Response) {
|
||||||
|
memory = imports.wbg.memory = new WebAssembly.Memory({initial:17,maximum:16384,shared:true});
|
||||||
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
||||||
|
try {
|
||||||
|
return await WebAssembly.instantiateStreaming(module, imports);
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
if (module.headers.get('Content-Type') != 'application/wasm') {
|
||||||
|
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const bytes = await module.arrayBuffer();
|
||||||
|
return await WebAssembly.instantiate(bytes, imports);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
memory = imports.wbg.memory = maybe_memory;
|
||||||
|
const instance = await WebAssembly.instantiate(module, imports);
|
||||||
|
|
||||||
|
if (instance instanceof WebAssembly.Instance) {
|
||||||
|
return { instance, module };
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function init(input, maybe_memory) {
|
||||||
|
if (typeof input === 'undefined') {
|
||||||
|
|
||||||
|
}
|
||||||
|
const imports = {};
|
||||||
|
imports.wbg = {};
|
||||||
|
imports.wbg.__wbindgen_module = function() {
|
||||||
|
var ret = init.__wbindgen_wasm_module;
|
||||||
|
return addHeapObject(ret);
|
||||||
|
};
|
||||||
|
imports.wbg.__wbindgen_memory = function() {
|
||||||
|
var ret = wasm.__wbindgen_export_0;
|
||||||
|
return addHeapObject(ret);
|
||||||
|
};
|
||||||
|
imports.wbg.__wbg_of_6510501edc06d65e = function(arg0, arg1) {
|
||||||
|
var ret = Array.of(takeObject(arg0), takeObject(arg1));
|
||||||
|
return addHeapObject(ret);
|
||||||
|
};
|
||||||
|
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
||||||
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
||||||
|
};
|
||||||
|
|
||||||
|
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
||||||
|
input = fetch(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
const { instance, module } = await load(await input, imports, maybe_memory);
|
||||||
|
|
||||||
|
wasm = instance.exports;
|
||||||
|
init.__wbindgen_wasm_module = module;
|
||||||
|
wasm.__wbindgen_start();
|
||||||
|
return wasm;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default init;
|
||||||
|
|
||||||
BIN
codecs/oxipng/pkg-parallel/squoosh_oxipng_bg.wasm
Normal file
BIN
codecs/oxipng/pkg-parallel/squoosh_oxipng_bg.wasm
Normal file
Binary file not shown.
12
codecs/oxipng/pkg-parallel/squoosh_oxipng_bg.wasm.d.ts
vendored
Normal file
12
codecs/oxipng/pkg-parallel/squoosh_oxipng_bg.wasm.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
export function malloc(a: number): number;
|
||||||
|
export function free(a: number): void;
|
||||||
|
export function worker_initializer(a: number): number;
|
||||||
|
export function start_main_thread(): void;
|
||||||
|
export function start_worker_thread(): void;
|
||||||
|
export function optimise(a: number, b: number, c: number, d: number): void;
|
||||||
|
export const __wbindgen_export_0: WebAssembly.Memory;
|
||||||
|
export function __wbindgen_malloc(a: number): number;
|
||||||
|
export function __wbindgen_free(a: number, b: number): void;
|
||||||
|
export function __wbindgen_start(): void;
|
||||||
5
codecs/oxipng/pkg/README.md
Normal file
5
codecs/oxipng/pkg/README.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# OxiPNG
|
||||||
|
|
||||||
|
- Source: <https://github.com/shssoichiro/oxipng>
|
||||||
|
- Version: v3.0.0
|
||||||
|
- License: MIT
|
||||||
@@ -44,14 +44,20 @@ function getArrayU8FromWasm0(ptr, len) {
|
|||||||
* @returns {Uint8Array}
|
* @returns {Uint8Array}
|
||||||
*/
|
*/
|
||||||
export function optimise(data, level) {
|
export function optimise(data, level) {
|
||||||
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
try {
|
||||||
var len0 = WASM_VECTOR_LEN;
|
const retptr = wasm.__wbindgen_export_0.value - 16;
|
||||||
wasm.optimise(8, ptr0, len0, level);
|
wasm.__wbindgen_export_0.value = retptr;
|
||||||
var r0 = getInt32Memory0()[8 / 4 + 0];
|
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
||||||
var r1 = getInt32Memory0()[8 / 4 + 1];
|
var len0 = WASM_VECTOR_LEN;
|
||||||
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
wasm.optimise(retptr, ptr0, len0, level);
|
||||||
wasm.__wbindgen_free(r0, r1 * 1);
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||||
return v1;
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||||
|
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
||||||
|
wasm.__wbindgen_free(r0, r1 * 1);
|
||||||
|
return v1;
|
||||||
|
} finally {
|
||||||
|
wasm.__wbindgen_export_0.value += 16;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const __wbindgen_throw = function(arg0, arg1) {
|
export const __wbindgen_throw = function(arg0, arg1) {
|
||||||
|
|||||||
Binary file not shown.
1
codecs/oxipng/rust-toolchain
Normal file
1
codecs/oxipng/rust-toolchain
Normal file
@@ -0,0 +1 @@
|
|||||||
|
nightly
|
||||||
52
codecs/oxipng/spawn.ts
Normal file
52
codecs/oxipng/spawn.ts
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
import initOxiPNG, {
|
||||||
|
worker_initializer,
|
||||||
|
start_main_thread,
|
||||||
|
optimise,
|
||||||
|
} from './pkg-parallel';
|
||||||
|
// @ts-ignore
|
||||||
|
import wasmUrl from './pkg-parallel/squoosh_oxipng_bg.wasm';
|
||||||
|
import { WorkerInit } from './worker';
|
||||||
|
|
||||||
|
function initWorker(worker: Worker, workerInit: WorkerInit) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
worker.postMessage(workerInit);
|
||||||
|
worker.addEventListener('message', () => resolve(), { once: true });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function startMainThread() {
|
||||||
|
const num = navigator.hardwareConcurrency;
|
||||||
|
|
||||||
|
// First, let browser fetch and spawn Workers for our pool in the background.
|
||||||
|
// This is fairly expensive, so we want to start it as early as possible.
|
||||||
|
const workers = Array.from({ length: num }, () => new Worker('./worker', { type: 'module' }));
|
||||||
|
|
||||||
|
// Meanwhile, asynchronously compile, instantiate and initialise Wasm on our main thread.
|
||||||
|
await initOxiPNG(fetch(wasmUrl), undefined as any);
|
||||||
|
|
||||||
|
// Get module+memory from the Wasm instance.
|
||||||
|
//
|
||||||
|
// Ideally we wouldn't go via Wasm bindings here, since both are just JS variables, but memory is
|
||||||
|
// currently not exposed on the Wasm instance correctly by wasm-bindgen.
|
||||||
|
const workerInit: WorkerInit = worker_initializer(num);
|
||||||
|
|
||||||
|
// Once done, we want to send module+memory to each Worker so that they instantiate Wasm too.
|
||||||
|
// While doing so, we need to wait for Workers to acknowledge that they have received our message.
|
||||||
|
// Ideally this shouldn't be necessary, but Chromium currently doesn't conform to the spec:
|
||||||
|
// https://bugs.chromium.org/p/chromium/issues/detail?id=1075645
|
||||||
|
//
|
||||||
|
// If we didn't do this ping-pong game, the `start_main_thread` below would block the current
|
||||||
|
// thread on an atomic before even *sending* the `postMessage` containing memory,
|
||||||
|
// so Workers would never be able to unblock us back.
|
||||||
|
await Promise.all(workers.map(worker => initWorker(worker, workerInit)));
|
||||||
|
|
||||||
|
// Finally, instantiate rayon pool - this will use shared Wasm memory to send tasks to the
|
||||||
|
// Workers and then block until they're all ready.
|
||||||
|
start_main_thread();
|
||||||
|
|
||||||
|
return {
|
||||||
|
optimise,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export default startMainThread();
|
||||||
@@ -1,9 +1,12 @@
|
|||||||
mod malloc_shim;
|
|
||||||
|
|
||||||
use wasm_bindgen::prelude::*;
|
use wasm_bindgen::prelude::*;
|
||||||
use oxipng::AlphaOptim;
|
use oxipng::AlphaOptim;
|
||||||
|
|
||||||
#[wasm_bindgen(catch)]
|
mod malloc_shim;
|
||||||
|
|
||||||
|
#[cfg(feature = "parallel")]
|
||||||
|
pub mod parallel;
|
||||||
|
|
||||||
|
#[wasm_bindgen]
|
||||||
pub fn optimise(data: &[u8], level: u8) -> Vec<u8> {
|
pub fn optimise(data: &[u8], level: u8) -> Vec<u8> {
|
||||||
let mut options = oxipng::Options::from_preset(level);
|
let mut options = oxipng::Options::from_preset(level);
|
||||||
options.alphas.insert(AlphaOptim::Black);
|
options.alphas.insert(AlphaOptim::Black);
|
||||||
|
|||||||
61
codecs/oxipng/src/parallel.rs
Normal file
61
codecs/oxipng/src/parallel.rs
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
use crossbeam_channel::{Sender, Receiver, bounded};
|
||||||
|
use once_cell::sync::OnceCell;
|
||||||
|
use wasm_bindgen::prelude::*;
|
||||||
|
use wasm_bindgen::JsValue;
|
||||||
|
|
||||||
|
#[wasm_bindgen]
|
||||||
|
extern "C" {
|
||||||
|
#[wasm_bindgen(js_namespace = Array, js_name = of)]
|
||||||
|
fn array_of_2(a: JsValue, b: JsValue) -> JsValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is one of the parts that work around Chromium incorrectly implementing postMessage:
|
||||||
|
// https://bugs.chromium.org/p/chromium/issues/detail?id=1075645
|
||||||
|
//
|
||||||
|
// rayon::ThreadPoolBuilder (used below) executes spawn handler to populate the worker pool,
|
||||||
|
// and then blocks the current thread until each worker unblocks its (opaque) lock.
|
||||||
|
//
|
||||||
|
// Normally, we could use postMessage directly inside the spawn handler to
|
||||||
|
// post module + memory + threadPtr to each worker, and the block the current thread.
|
||||||
|
//
|
||||||
|
// However, that bug means that postMessage is currently delayed until the next event loop,
|
||||||
|
// which will never spin since we block the current thread, and so the other workers will
|
||||||
|
// never be able to unblock us.
|
||||||
|
//
|
||||||
|
// To work around this problem, we:
|
||||||
|
// 1) Expose `worker_initializer` that returns module + memory pair (without threadPtr)
|
||||||
|
// that workers can be initialised with to become native threads.
|
||||||
|
// JavaScript can postMessage this pair in advance, and asynchronously wait for workers
|
||||||
|
// to acknowledge the receipt.
|
||||||
|
// 2) Create a global communication channel on the Rust side using crossbeam.
|
||||||
|
// It will be used to send threadPtr to the pre-initialised workers
|
||||||
|
// instead of postMessage.
|
||||||
|
// 3) Provide a separate `start_main_thread` that expects all workers to be ready,
|
||||||
|
// and just uses the provided channel to send `threadPtr`s using the
|
||||||
|
// shared memory and blocks the current thread until they're all grabbed.
|
||||||
|
// 4) Provide a `worker_initializer` that is expected to be invoked from various workers,
|
||||||
|
// reads one `threadPtr` from the shared channel and starts running it.
|
||||||
|
static CHANNEL: OnceCell<(Sender<rayon::ThreadBuilder>, Receiver<rayon::ThreadBuilder>)> = OnceCell::new();
|
||||||
|
|
||||||
|
#[wasm_bindgen]
|
||||||
|
pub fn worker_initializer(num: usize) -> JsValue {
|
||||||
|
CHANNEL.get_or_init(|| bounded(num));
|
||||||
|
array_of_2(wasm_bindgen::module(), wasm_bindgen::memory())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[wasm_bindgen]
|
||||||
|
pub fn start_main_thread() {
|
||||||
|
let (sender, _) = CHANNEL.get().unwrap();
|
||||||
|
|
||||||
|
rayon::ThreadPoolBuilder::new()
|
||||||
|
.num_threads(sender.capacity().unwrap())
|
||||||
|
.spawn_handler(|thread| Ok(sender.send(thread).unwrap_throw()))
|
||||||
|
.build_global()
|
||||||
|
.unwrap_throw()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[wasm_bindgen]
|
||||||
|
pub fn start_worker_thread() {
|
||||||
|
let (_, receiver) = CHANNEL.get().unwrap();
|
||||||
|
receiver.recv().unwrap_throw().run()
|
||||||
|
}
|
||||||
24
codecs/oxipng/worker.ts
Normal file
24
codecs/oxipng/worker.ts
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
/// <reference lib="webworker" />
|
||||||
|
|
||||||
|
import initOxiPNG, { start_worker_thread } from './pkg-parallel';
|
||||||
|
|
||||||
|
export type WorkerInit = [WebAssembly.Module, WebAssembly.Memory];
|
||||||
|
|
||||||
|
addEventListener(
|
||||||
|
'message',
|
||||||
|
async (event) => {
|
||||||
|
// Tell the "main" thread that we've received the message.
|
||||||
|
//
|
||||||
|
// At this point, the "main" thread can run Wasm that
|
||||||
|
// will synchronously block waiting on other atomics.
|
||||||
|
//
|
||||||
|
// Note that we don't need to wait for Wasm instantiation here - it's
|
||||||
|
// better to start main thread as early as possible, and then it blocks
|
||||||
|
// on a shared atomic anyway until Worker is fully ready.
|
||||||
|
postMessage(null);
|
||||||
|
|
||||||
|
await initOxiPNG(...(event.data as WorkerInit));
|
||||||
|
start_worker_thread();
|
||||||
|
},
|
||||||
|
{ once: true },
|
||||||
|
);
|
||||||
21
codecs/resize/LICENSE.codec.md
Normal file
21
codecs/resize/LICENSE.codec.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2015 PistonDevelopers
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
5
codecs/resize/README.md
Normal file
5
codecs/resize/README.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# Resize
|
||||||
|
|
||||||
|
- Source: <https://github.com/PistonDevelopers/resize>
|
||||||
|
- Version: v0.3.0
|
||||||
|
- License: MIT
|
||||||
@@ -1,9 +1,13 @@
|
|||||||
|
ARG RUST_IMG=rust:1.44-stretch
|
||||||
|
|
||||||
FROM emscripten/emsdk:1.39.19 AS wasm-tools
|
FROM emscripten/emsdk:1.39.19 AS wasm-tools
|
||||||
WORKDIR /opt/wasm-tools
|
WORKDIR /opt/wasm-tools
|
||||||
RUN wget -qO- https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1/wasm-pack-v0.9.1-x86_64-unknown-linux-musl.tar.gz | tar -xzf - --strip 1
|
RUN wget -qO- https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1/wasm-pack-v0.9.1-x86_64-unknown-linux-musl.tar.gz | tar -xzf - --strip 1
|
||||||
|
|
||||||
FROM rust:1.44-stretch AS rust
|
FROM $RUST_IMG AS rust
|
||||||
|
ARG RUST_IMG
|
||||||
RUN rustup target add wasm32-unknown-unknown
|
RUN rustup target add wasm32-unknown-unknown
|
||||||
|
RUN if [ "$RUST_IMG" = "rustlang/rust:nightly" ] ; then rustup component add rust-src ; fi
|
||||||
COPY --from=wasm-tools /emsdk/upstream/bin/wasm-opt /emsdk/upstream/bin/clang /usr/local/bin/
|
COPY --from=wasm-tools /emsdk/upstream/bin/wasm-opt /emsdk/upstream/bin/clang /usr/local/bin/
|
||||||
COPY --from=wasm-tools /emsdk/upstream/lib/ /usr/local/lib/
|
COPY --from=wasm-tools /emsdk/upstream/lib/ /usr/local/lib/
|
||||||
COPY --from=wasm-tools /emsdk/upstream/emscripten/system/include/libc/ /wasm32/include/
|
COPY --from=wasm-tools /emsdk/upstream/emscripten/system/include/libc/ /wasm32/include/
|
||||||
|
|||||||
29
codecs/webp/LICENSE.codec.md
Normal file
29
codecs/webp/LICENSE.codec.md
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
Copyright (c) 2010, Google Inc. All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in
|
||||||
|
the documentation and/or other materials provided with the
|
||||||
|
distribution.
|
||||||
|
|
||||||
|
* Neither the name of Google nor the names of its contributors may
|
||||||
|
be used to endorse or promote products derived from this software
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
5
codecs/webp/README.md
Normal file
5
codecs/webp/README.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# WebP
|
||||||
|
|
||||||
|
- Source: https://github.com/webmproject/libwebp
|
||||||
|
- Version: v1.0.2
|
||||||
|
- License: BSD
|
||||||
@@ -1,22 +1,20 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<script src='webp_dec.js'></script>
|
<script src='webp_dec.js'></script>
|
||||||
<script>
|
<script>
|
||||||
const Module = webp_dec();
|
|
||||||
|
|
||||||
async function loadFile(src) {
|
async function loadFile(src) {
|
||||||
const resp = await fetch(src);
|
const resp = await fetch(src);
|
||||||
return await resp.arrayBuffer();
|
return await resp.arrayBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
Module.onRuntimeInitialized = async _ => {
|
webp_dec().then(async module => {
|
||||||
console.log('Version:', Module.version().toString(16));
|
console.log('Version:', module.version().toString(16));
|
||||||
const image = await loadFile('../../example.webp');
|
const image = await loadFile('../../example.webp');
|
||||||
const imageData = Module.decode(image);
|
const imageData = module.decode(image);
|
||||||
const canvas = document.createElement('canvas');
|
const canvas = document.createElement('canvas');
|
||||||
canvas.width = result.width;
|
canvas.width = imageData.width;
|
||||||
canvas.height = result.height;
|
canvas.height = imageData.height;
|
||||||
document.body.appendChild(canvas);
|
document.body.appendChild(canvas);
|
||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
ctx.putImageData(imageData, 0, 0);
|
ctx.putImageData(imageData, 0, 0);
|
||||||
};
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ val decode(std::string buffer) {
|
|||||||
int width, height;
|
int width, height;
|
||||||
std::unique_ptr<uint8_t[]> rgba(
|
std::unique_ptr<uint8_t[]> rgba(
|
||||||
WebPDecodeRGBA((const uint8_t*)buffer.c_str(), buffer.size(), &width, &height));
|
WebPDecodeRGBA((const uint8_t*)buffer.c_str(), buffer.size(), &width, &height));
|
||||||
return ImageData.new_(Uint8ClampedArray.new_(typed_memory_view(width * height * 4, rgba.get())), width, height);
|
return rgba ? ImageData.new_(Uint8ClampedArray.new_(typed_memory_view(width * height * 4, rgba.get())), width, height) : val::null();
|
||||||
}
|
}
|
||||||
|
|
||||||
EMSCRIPTEN_BINDINGS(my_module) {
|
EMSCRIPTEN_BINDINGS(my_module) {
|
||||||
|
|||||||
4
codecs/webp/dec/webp_dec.d.ts
vendored
4
codecs/webp/dec/webp_dec.d.ts
vendored
@@ -1,5 +1,5 @@
|
|||||||
interface WebPModule extends EmscriptenWasm.Module {
|
interface WebPModule extends EmscriptenWasm.Module {
|
||||||
decode(data: BufferSource): ImageData;
|
decode(data: BufferSource): ImageData | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function(opts: EmscriptenWasm.ModuleOpts): WebPModule;
|
export default function(opts: EmscriptenWasm.ModuleOpts): Promise<WebPModule>;
|
||||||
|
|||||||
@@ -7,51 +7,51 @@ function(webp_dec) {
|
|||||||
webp_dec = webp_dec || {};
|
webp_dec = webp_dec || {};
|
||||||
|
|
||||||
|
|
||||||
var d;d||(d=typeof webp_dec !== 'undefined' ? webp_dec : {});var aa;d.ready=new Promise(function(a){aa=a});var t={},u;for(u in d)d.hasOwnProperty(u)&&(t[u]=d[u]);var v=!1,w=!1,ba=!1,ca=!1;v="object"===typeof window;w="function"===typeof importScripts;ba="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;ca=!v&&!ba&&!w;var x="",z,A,da,ea;
|
var d;d||(d=typeof webp_dec !== 'undefined' ? webp_dec : {});var aa,ba;d.ready=new Promise(function(a,b){aa=a;ba=b});var t={},u;for(u in d)d.hasOwnProperty(u)&&(t[u]=d[u]);var v=!1,w=!1,ca=!1,da=!1;v="object"===typeof window;w="function"===typeof importScripts;ca="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;da=!v&&!ca&&!w;var x="",z,A,ea,fa;
|
||||||
if(ba)x=w?require("path").dirname(x)+"/":__dirname+"/",z=function(a,b){da||(da=require("fs"));ea||(ea=require("path"));a=ea.normalize(a);return da.readFileSync(a,b?null:"utf8")},A=function(a){a=z(a,!0);a.buffer||(a=new Uint8Array(a));a.buffer||B("Assertion failed: undefined");return a},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(a){throw a;}),process.on("unhandledRejection",B),d.inspect=function(){return"[Emscripten Module object]"};
|
if(ca)x=w?require("path").dirname(x)+"/":__dirname+"/",z=function(a,b){ea||(ea=require("fs"));fa||(fa=require("path"));a=fa.normalize(a);return ea.readFileSync(a,b?null:"utf8")},A=function(a){a=z(a,!0);a.buffer||(a=new Uint8Array(a));a.buffer||B("Assertion failed: undefined");return a},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(a){throw a;}),process.on("unhandledRejection",B),d.inspect=function(){return"[Emscripten Module object]"};
|
||||||
else if(ca)"undefined"!=typeof read&&(z=function(a){return read(a)}),A=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");"object"===typeof a||B("Assertion failed: undefined");return a},"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!==typeof printErr?printErr:print);else if(v||w)w?x=self.location.href:document.currentScript&&(x=document.currentScript.src),_scriptDir&&
|
else if(da)"undefined"!=typeof read&&(z=function(a){return read(a)}),A=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");"object"===typeof a||B("Assertion failed: undefined");return a},"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!==typeof printErr?printErr:print);else if(v||w)w?x=self.location.href:document.currentScript&&(x=document.currentScript.src),_scriptDir&&
|
||||||
(x=_scriptDir),0!==x.indexOf("blob:")?x=x.substr(0,x.lastIndexOf("/")+1):x="",z=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},w&&(A=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var fa=d.print||console.log.bind(console),C=d.printErr||console.warn.bind(console);for(u in t)t.hasOwnProperty(u)&&(d[u]=t[u]);t=null;var D;d.wasmBinary&&(D=d.wasmBinary);var noExitRuntime;
|
(x=_scriptDir),0!==x.indexOf("blob:")?x=x.substr(0,x.lastIndexOf("/")+1):x="",z=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},w&&(A=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});d.print||console.log.bind(console);var C=d.printErr||console.warn.bind(console);for(u in t)t.hasOwnProperty(u)&&(d[u]=t[u]);t=null;var D;d.wasmBinary&&(D=d.wasmBinary);var noExitRuntime;
|
||||||
d.noExitRuntime&&(noExitRuntime=d.noExitRuntime);"object"!==typeof WebAssembly&&B("no native wasm support detected");var E,ha=new WebAssembly.Table({initial:130,maximum:130,element:"anyfunc"}),ia=!1,ja="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
|
d.noExitRuntime&&(noExitRuntime=d.noExitRuntime);"object"!==typeof WebAssembly&&B("no native wasm support detected");var E,ha=new WebAssembly.Table({initial:123,maximum:123,element:"anyfunc"}),ia=!1,ja="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
|
||||||
function ka(a,b,c){var e=F;if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var n=a.charCodeAt(++f);g=65536+((g&1023)<<10)|n&1023}if(127>=g){if(b>=c)break;e[b++]=g}else{if(2047>=g){if(b+1>=c)break;e[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;e[b++]=224|g>>12}else{if(b+3>=c)break;e[b++]=240|g>>18;e[b++]=128|g>>12&63}e[b++]=128|g>>6&63}e[b++]=128|g&63}}e[b]=0}}var la="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;
|
function ka(a,b,c){var e=F;if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var n=a.charCodeAt(++f);g=65536+((g&1023)<<10)|n&1023}if(127>=g){if(b>=c)break;e[b++]=g}else{if(2047>=g){if(b+1>=c)break;e[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;e[b++]=224|g>>12}else{if(b+3>=c)break;e[b++]=240|g>>18;e[b++]=128|g>>12&63}e[b++]=128|g>>6&63}e[b++]=128|g&63}}e[b]=0}}var la="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;
|
||||||
function ma(a,b){var c=a>>1;for(var e=c+b/2;!(c>=e)&&G[c];)++c;c<<=1;if(32<c-a&&la)return la.decode(F.subarray(a,c));c=0;for(e="";;){var f=H[a+2*c>>1];if(0==f||c==b/2)return e;++c;e+=String.fromCharCode(f)}}function na(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var e=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)H[b>>1]=a.charCodeAt(f),b+=2;H[b>>1]=0;return b-e}function oa(a){return 2*a.length}
|
function ma(a,b){var c=a>>1;for(var e=c+b/2;!(c>=e)&&G[c];)++c;c<<=1;if(32<c-a&&la)return la.decode(F.subarray(a,c));c=0;for(e="";;){var f=H[a+2*c>>1];if(0==f||c==b/2)return e;++c;e+=String.fromCharCode(f)}}function na(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var e=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)H[b>>1]=a.charCodeAt(f),b+=2;H[b>>1]=0;return b-e}function oa(a){return 2*a.length}
|
||||||
function pa(a,b){for(var c=0,e="";!(c>=b/4);){var f=I[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023)):e+=String.fromCharCode(f)}return e}function qa(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var e=b;c=e+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var n=a.charCodeAt(++f);g=65536+((g&1023)<<10)|n&1023}I[b>>2]=g;b+=4;if(b+4>c)break}I[b>>2]=0;return b-e}
|
function pa(a,b){for(var c=0,e="";!(c>=b/4);){var f=I[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023)):e+=String.fromCharCode(f)}return e}function qa(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var e=b;c=e+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var n=a.charCodeAt(++f);g=65536+((g&1023)<<10)|n&1023}I[b>>2]=g;b+=4;if(b+4>c)break}I[b>>2]=0;return b-e}
|
||||||
function ra(a){for(var b=0,c=0;c<a.length;++c){var e=a.charCodeAt(c);55296<=e&&57343>=e&&++c;b+=4}return b}var J,sa,F,H,G,I,L,ta,ua;function va(a){J=a;d.HEAP8=sa=new Int8Array(a);d.HEAP16=H=new Int16Array(a);d.HEAP32=I=new Int32Array(a);d.HEAPU8=F=new Uint8Array(a);d.HEAPU16=G=new Uint16Array(a);d.HEAPU32=L=new Uint32Array(a);d.HEAPF32=ta=new Float32Array(a);d.HEAPF64=ua=new Float64Array(a)}var wa=d.INITIAL_MEMORY||16777216;d.wasmMemory?E=d.wasmMemory:E=new WebAssembly.Memory({initial:wa/65536,maximum:32768});
|
function ra(a){for(var b=0,c=0;c<a.length;++c){var e=a.charCodeAt(c);55296<=e&&57343>=e&&++c;b+=4}return b}var J,sa,F,H,G,I,L,ta,ua;function va(a){J=a;d.HEAP8=sa=new Int8Array(a);d.HEAP16=H=new Int16Array(a);d.HEAP32=I=new Int32Array(a);d.HEAPU8=F=new Uint8Array(a);d.HEAPU16=G=new Uint16Array(a);d.HEAPU32=L=new Uint32Array(a);d.HEAPF32=ta=new Float32Array(a);d.HEAPF64=ua=new Float64Array(a)}var wa=d.INITIAL_MEMORY||16777216;d.wasmMemory?E=d.wasmMemory:E=new WebAssembly.Memory({initial:wa/65536,maximum:32768});
|
||||||
E&&(J=E.buffer);wa=J.byteLength;va(J);I[3260]=5256080;function M(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(d);else{var c=b.P;"number"===typeof c?void 0===b.L?d.dynCall_v(c):d.dynCall_vi(c,b.L):c(void 0===b.L?null:b.L)}}}var xa=[],ya=[],za=[],Aa=[];function Ba(){var a=d.preRun.shift();xa.unshift(a)}var N=0,Ca=null,P=null;d.preloadedImages={};d.preloadedAudios={};
|
E&&(J=E.buffer);wa=J.byteLength;va(J);I[3188]=5255792;function M(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(d);else{var c=b.M;"number"===typeof c?void 0===b.J?d.dynCall_v(c):d.dynCall_vi(c,b.J):c(void 0===b.J?null:b.J)}}}var xa=[],ya=[],za=[],Aa=[];function Ba(){var a=d.preRun.shift();xa.unshift(a)}var N=0,Ca=null,P=null;d.preloadedImages={};d.preloadedAudios={};
|
||||||
function B(a){if(d.onAbort)d.onAbort(a);fa(a);C(a);ia=!0;throw new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");}function Da(a){var b=Q;return String.prototype.startsWith?b.startsWith(a):0===b.indexOf(a)}function Ea(){return Da("data:application/octet-stream;base64,")}var Q="webp_dec.wasm";if(!Ea()){var Fa=Q;Q=d.locateFile?d.locateFile(Fa,x):x+Fa}
|
function B(a){if(d.onAbort)d.onAbort(a);C(a);ia=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");ba(a);throw a;}function Da(a){var b=Q;return String.prototype.startsWith?b.startsWith(a):0===b.indexOf(a)}function Ea(){return Da("data:application/octet-stream;base64,")}var Q="webp_dec.wasm";if(!Ea()){var Fa=Q;Q=d.locateFile?d.locateFile(Fa,x):x+Fa}
|
||||||
function Ga(){try{if(D)return new Uint8Array(D);if(A)return A(Q);throw"both async and sync fetching of the wasm failed";}catch(a){B(a)}}function Ha(){return D||!v&&!w||"function"!==typeof fetch||Da("file://")?new Promise(function(a){a(Ga())}):fetch(Q,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+Q+"'";return a.arrayBuffer()}).catch(function(){return Ga()})}ya.push({P:function(){Ia()}});function R(){return 0<R.N}
|
function Ga(){try{if(D)return new Uint8Array(D);if(A)return A(Q);throw"both async and sync fetching of the wasm failed";}catch(a){B(a)}}function Ha(){return D||!v&&!w||"function"!==typeof fetch||Da("file://")?new Promise(function(a){a(Ga())}):fetch(Q,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+Q+"'";return a.arrayBuffer()}).catch(function(){return Ga()})}ya.push({M:function(){Ia()}});
|
||||||
function Ja(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var Ka=void 0;function S(a){for(var b="";F[a];)b+=Ka[F[a++]];return b}var T={},U={},V={};function La(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}
|
function Ja(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var Ka=void 0;function R(a){for(var b="";F[a];)b+=Ka[F[a++]];return b}var S={},T={},U={};function La(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}
|
||||||
function Ma(a,b){a=La(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function Na(a){var b=Error,c=Ma(a,function(e){this.name=a;this.message=e;e=Error(e).stack;void 0!==e&&(this.stack=this.toString()+"\n"+e.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}
|
function Ma(a,b){a=La(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function Na(a){var b=Error,c=Ma(a,function(e){this.name=a;this.message=e;e=Error(e).stack;void 0!==e&&(this.stack=this.toString()+"\n"+e.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}
|
||||||
var Oa=void 0;function W(a){throw new Oa(a);}var Pa=void 0;function Qa(a,b){function c(k){k=b(k);if(k.length!==e.length)throw new Pa("Mismatched type converter count");for(var h=0;h<e.length;++h)X(e[h],k[h])}var e=[];e.forEach(function(k){V[k]=a});var f=Array(a.length),g=[],n=0;a.forEach(function(k,h){U.hasOwnProperty(k)?f[h]=U[k]:(g.push(k),T.hasOwnProperty(k)||(T[k]=[]),T[k].push(function(){f[h]=U[k];++n;n===g.length&&c(f)}))});0===g.length&&c(f)}
|
var Oa=void 0;function V(a){throw new Oa(a);}var Pa=void 0;function Qa(a,b){function c(k){k=b(k);if(k.length!==e.length)throw new Pa("Mismatched type converter count");for(var h=0;h<e.length;++h)W(e[h],k[h])}var e=[];e.forEach(function(k){U[k]=a});var f=Array(a.length),g=[],n=0;a.forEach(function(k,h){T.hasOwnProperty(k)?f[h]=T[k]:(g.push(k),S.hasOwnProperty(k)||(S[k]=[]),S[k].push(function(){f[h]=T[k];++n;n===g.length&&c(f)}))});0===g.length&&c(f)}
|
||||||
function X(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var e=b.name;a||W('type "'+e+'" must have a positive integer typeid pointer');if(U.hasOwnProperty(a)){if(c.R)return;W("Cannot register type '"+e+"' twice")}U[a]=b;delete V[a];T.hasOwnProperty(a)&&(b=T[a],delete T[a],b.forEach(function(f){f()}))}var Ra=[],Y=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
function W(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var e=b.name;a||V('type "'+e+'" must have a positive integer typeid pointer');if(T.hasOwnProperty(a)){if(c.N)return;V("Cannot register type '"+e+"' twice")}T[a]=b;delete U[a];S.hasOwnProperty(a)&&(b=S[a],delete S[a],b.forEach(function(f){f()}))}var Ra=[],X=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||||
function Sa(a){4<a&&0===--Y[a].M&&(Y[a]=void 0,Ra.push(a))}function Va(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Ra.length?Ra.pop():Y.length;Y[b]={M:1,value:a};return b}}function Wa(a){return this.fromWireType(L[a>>2])}function Xa(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
function Sa(a){4<a&&0===--X[a].K&&(X[a]=void 0,Ra.push(a))}function Y(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Ra.length?Ra.pop():X.length;X[b]={K:1,value:a};return b}}function Va(a){return this.fromWireType(L[a>>2])}function Wa(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
||||||
function Ya(a,b){switch(b){case 2:return function(c){return this.fromWireType(ta[c>>2])};case 3:return function(c){return this.fromWireType(ua[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function Za(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Ma(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
function Xa(a,b){switch(b){case 2:return function(c){return this.fromWireType(ta[c>>2])};case 3:return function(c){return this.fromWireType(ua[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function Ya(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Ma(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
||||||
function $a(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function ab(a,b){var c=d;if(void 0===c[a].J){var e=c[a];c[a]=function(){c[a].J.hasOwnProperty(arguments.length)||W("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].J+")!");return c[a].J[arguments.length].apply(this,arguments)};c[a].J=[];c[a].J[e.O]=e}}
|
function Za(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function $a(a,b){var c=d;if(void 0===c[a].H){var e=c[a];c[a]=function(){c[a].H.hasOwnProperty(arguments.length)||V("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].H+")!");return c[a].H[arguments.length].apply(this,arguments)};c[a].H=[];c[a].H[e.L]=e}}
|
||||||
function bb(a,b,c){d.hasOwnProperty(a)?((void 0===c||void 0!==d[a].J&&void 0!==d[a].J[c])&&W("Cannot register public name '"+a+"' twice"),ab(a,a),d.hasOwnProperty(c)&&W("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),d[a].J[c]=b):(d[a]=b,void 0!==c&&(d[a].T=c))}function cb(a,b){for(var c=[],e=0;e<a;e++)c.push(I[(b>>2)+e]);return c}
|
function ab(a,b,c){d.hasOwnProperty(a)?((void 0===c||void 0!==d[a].H&&void 0!==d[a].H[c])&&V("Cannot register public name '"+a+"' twice"),$a(a,a),d.hasOwnProperty(c)&&V("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),d[a].H[c]=b):(d[a]=b,void 0!==c&&(d[a].P=c))}function bb(a,b){for(var c=[],e=0;e<a;e++)c.push(I[(b>>2)+e]);return c}
|
||||||
function db(a,b){a=S(a);var c=d["dynCall_"+a];for(var e=[],f=1;f<a.length;++f)e.push("a"+f);f="return function dynCall_"+(a+"_"+b)+"("+e.join(", ")+") {\n";f+=" return dynCall(rawFunction"+(e.length?", ":"")+e.join(", ")+");\n";c=(new Function("dynCall","rawFunction",f+"};\n"))(c,b);"function"!==typeof c&&W("unknown function pointer with signature "+a+": "+b);return c}var eb=void 0;function fb(a){a=gb(a);var b=S(a);Z(a);return b}
|
function cb(a,b){a=R(a);var c=d["dynCall_"+a];for(var e=[],f=1;f<a.length;++f)e.push("a"+f);f="return function dynCall_"+(a+"_"+b)+"("+e.join(", ")+") {\n";f+=" return dynCall(rawFunction"+(e.length?", ":"")+e.join(", ")+");\n";c=(new Function("dynCall","rawFunction",f+"};\n"))(c,b);"function"!==typeof c&&V("unknown function pointer with signature "+a+": "+b);return c}var db=void 0;function eb(a){a=fb(a);var b=R(a);Z(a);return b}
|
||||||
function hb(a,b){function c(g){f[g]||U[g]||(V[g]?V[g].forEach(c):(e.push(g),f[g]=!0))}var e=[],f={};b.forEach(c);throw new eb(a+": "+e.map(fb).join([", "]));}function ib(a,b,c){switch(b){case 0:return c?function(e){return sa[e]}:function(e){return F[e]};case 1:return c?function(e){return H[e>>1]}:function(e){return G[e>>1]};case 2:return c?function(e){return I[e>>2]}:function(e){return L[e>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var jb={};
|
function gb(a,b){function c(g){f[g]||T[g]||(U[g]?U[g].forEach(c):(e.push(g),f[g]=!0))}var e=[],f={};b.forEach(c);throw new db(a+": "+e.map(eb).join([", "]));}function hb(a,b,c){switch(b){case 0:return c?function(e){return sa[e]}:function(e){return F[e]};case 1:return c?function(e){return H[e>>1]}:function(e){return G[e>>1]};case 2:return c?function(e){return I[e>>2]}:function(e){return L[e>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var ib={};
|
||||||
function kb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function lb(a,b){var c=U[a];void 0===c&&W(b+" has unknown type "+fb(a));return c}for(var mb={},nb=Array(256),ob=0;256>ob;++ob)nb[ob]=String.fromCharCode(ob);Ka=nb;Oa=d.BindingError=Na("BindingError");Pa=d.InternalError=Na("InternalError");d.count_emval_handles=function(){for(var a=0,b=5;b<Y.length;++b)void 0!==Y[b]&&++a;return a};
|
function jb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function kb(a,b){var c=T[a];void 0===c&&V(b+" has unknown type "+eb(a));return c}for(var lb={},mb=Array(256),nb=0;256>nb;++nb)mb[nb]=String.fromCharCode(nb);Ka=mb;Oa=d.BindingError=Na("BindingError");Pa=d.InternalError=Na("InternalError");d.count_emval_handles=function(){for(var a=0,b=5;b<X.length;++b)void 0!==X[b]&&++a;return a};
|
||||||
d.get_first_emval=function(){for(var a=5;a<Y.length;++a)if(void 0!==Y[a])return Y[a];return null};eb=d.UnboundTypeError=Na("UnboundTypeError");
|
d.get_first_emval=function(){for(var a=5;a<X.length;++a)if(void 0!==X[a])return X[a];return null};db=d.UnboundTypeError=Na("UnboundTypeError");
|
||||||
var qb={m:function(a){return pb(a)},i:function(){},l:function(a){"uncaught_exception"in R?R.N++:R.N=1;throw a;},j:function(a,b,c,e,f){var g=Ja(c);b=S(b);X(a,{name:b,fromWireType:function(n){return!!n},toWireType:function(n,k){return k?e:f},argPackAdvance:8,readValueFromPointer:function(n){if(1===c)var k=sa;else if(2===c)k=H;else if(4===c)k=I;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[n>>g])},K:null})},r:function(a,b){b=S(b);X(a,{name:b,fromWireType:function(c){var e=
|
var pb={f:function(){},n:function(a,b,c,e,f){var g=Ja(c);b=R(b);W(a,{name:b,fromWireType:function(n){return!!n},toWireType:function(n,k){return k?e:f},argPackAdvance:8,readValueFromPointer:function(n){if(1===c)var k=sa;else if(2===c)k=H;else if(4===c)k=I;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[n>>g])},I:null})},q:function(a,b){b=R(b);W(a,{name:b,fromWireType:function(c){var e=X[c].value;Sa(c);return e},toWireType:function(c,e){return Y(e)},argPackAdvance:8,
|
||||||
Y[c].value;Sa(c);return e},toWireType:function(c,e){return Va(e)},argPackAdvance:8,readValueFromPointer:Wa,K:null})},g:function(a,b,c){c=Ja(c);b=S(b);X(a,{name:b,fromWireType:function(e){return e},toWireType:function(e,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+Xa(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:Ya(b,c),K:null})},e:function(a,b,c,e,f,g){var n=cb(b,c);a=S(a);f=db(e,f);bb(a,function(){hb("Cannot call "+a+" due to unbound types",
|
readValueFromPointer:Va,I:null})},m:function(a,b,c){c=Ja(c);b=R(b);W(a,{name:b,fromWireType:function(e){return e},toWireType:function(e,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+Wa(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:Xa(b,c),I:null})},i:function(a,b,c,e,f,g){var n=bb(b,c);a=R(a);f=cb(e,f);ab(a,function(){gb("Cannot call "+a+" due to unbound types",n)},b-1);Qa(n,function(k){var h=[k[0],null].concat(k.slice(1)),p=k=a,q=f,
|
||||||
n)},b-1);Qa(n,function(k){var h=[k[0],null].concat(k.slice(1)),p=k=a,q=f,m=h.length;2>m&&W("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var r=null!==h[1]&&!1,y=!1,l=1;l<h.length;++l)if(null!==h[l]&&void 0===h[l].K){y=!0;break}var Ta="void"!==h[0].name,K="",O="";for(l=0;l<m-2;++l)K+=(0!==l?", ":"")+"arg"+l,O+=(0!==l?", ":"")+"arg"+l+"Wired";p="return function "+La(p)+"("+K+") {\nif (arguments.length !== "+(m-2)+") {\nthrowBindingError('function "+p+" called with ' + arguments.length + ' arguments, expected "+
|
m=h.length;2>m&&V("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var r=null!==h[1]&&!1,y=!1,l=1;l<h.length;++l)if(null!==h[l]&&void 0===h[l].I){y=!0;break}var Ta="void"!==h[0].name,K="",O="";for(l=0;l<m-2;++l)K+=(0!==l?", ":"")+"arg"+l,O+=(0!==l?", ":"")+"arg"+l+"Wired";p="return function "+La(p)+"("+K+") {\nif (arguments.length !== "+(m-2)+") {\nthrowBindingError('function "+p+" called with ' + arguments.length + ' arguments, expected "+(m-2)+" args!');\n}\n";
|
||||||
(m-2)+" args!');\n}\n";y&&(p+="var destructors = [];\n");var Ua=y?"destructors":"null";K="throwBindingError invoker fn runDestructors retType classParam".split(" ");q=[W,q,g,$a,h[0],h[1]];r&&(p+="var thisWired = classParam.toWireType("+Ua+", this);\n");for(l=0;l<m-2;++l)p+="var arg"+l+"Wired = argType"+l+".toWireType("+Ua+", arg"+l+"); // "+h[l+2].name+"\n",K.push("argType"+l),q.push(h[l+2]);r&&(O="thisWired"+(0<O.length?", ":"")+O);p+=(Ta?"var rv = ":"")+"invoker(fn"+(0<O.length?", ":"")+O+");\n";
|
y&&(p+="var destructors = [];\n");var Ua=y?"destructors":"null";K="throwBindingError invoker fn runDestructors retType classParam".split(" ");q=[V,q,g,Za,h[0],h[1]];r&&(p+="var thisWired = classParam.toWireType("+Ua+", this);\n");for(l=0;l<m-2;++l)p+="var arg"+l+"Wired = argType"+l+".toWireType("+Ua+", arg"+l+"); // "+h[l+2].name+"\n",K.push("argType"+l),q.push(h[l+2]);r&&(O="thisWired"+(0<O.length?", ":"")+O);p+=(Ta?"var rv = ":"")+"invoker(fn"+(0<O.length?", ":"")+O+");\n";if(y)p+="runDestructors(destructors);\n";
|
||||||
if(y)p+="runDestructors(destructors);\n";else for(l=r?1:2;l<h.length;++l)m=1===l?"thisWired":"arg"+(l-2)+"Wired",null!==h[l].K&&(p+=m+"_dtor("+m+"); // "+h[l].name+"\n",K.push(m+"_dtor"),q.push(h[l].K));Ta&&(p+="var ret = retType.fromWireType(rv);\nreturn ret;\n");K.push(p+"}\n");h=Za(K).apply(null,q);l=b-1;if(!d.hasOwnProperty(k))throw new Pa("Replacing nonexistant public symbol");void 0!==d[k].J&&void 0!==l?d[k].J[l]=h:(d[k]=h,d[k].O=l);return[]})},b:function(a,b,c,e,f){function g(p){return p}b=
|
else for(l=r?1:2;l<h.length;++l)m=1===l?"thisWired":"arg"+(l-2)+"Wired",null!==h[l].I&&(p+=m+"_dtor("+m+"); // "+h[l].name+"\n",K.push(m+"_dtor"),q.push(h[l].I));Ta&&(p+="var ret = retType.fromWireType(rv);\nreturn ret;\n");K.push(p+"}\n");h=Ya(K).apply(null,q);l=b-1;if(!d.hasOwnProperty(k))throw new Pa("Replacing nonexistant public symbol");void 0!==d[k].H&&void 0!==l?d[k].H[l]=h:(d[k]=h,d[k].L=l);return[]})},b:function(a,b,c,e,f){function g(p){return p}b=R(b);-1===f&&(f=4294967295);var n=Ja(c);
|
||||||
S(b);-1===f&&(f=4294967295);var n=Ja(c);if(0===e){var k=32-8*c;g=function(p){return p<<k>>>k}}var h=-1!=b.indexOf("unsigned");X(a,{name:b,fromWireType:g,toWireType:function(p,q){if("number"!==typeof q&&"boolean"!==typeof q)throw new TypeError('Cannot convert "'+Xa(q)+'" to '+this.name);if(q<e||q>f)throw new TypeError('Passing a number "'+Xa(q)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+e+", "+f+"]!");return h?q>>>0:q|0},argPackAdvance:8,readValueFromPointer:ib(b,
|
if(0===e){var k=32-8*c;g=function(p){return p<<k>>>k}}var h=-1!=b.indexOf("unsigned");W(a,{name:b,fromWireType:g,toWireType:function(p,q){if("number"!==typeof q&&"boolean"!==typeof q)throw new TypeError('Cannot convert "'+Wa(q)+'" to '+this.name);if(q<e||q>f)throw new TypeError('Passing a number "'+Wa(q)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+e+", "+f+"]!");return h?q>>>0:q|0},argPackAdvance:8,readValueFromPointer:hb(b,n,0!==e),I:null})},
|
||||||
n,0!==e),K:null})},a:function(a,b,c){function e(g){g>>=2;var n=L;return new f(J,n[g+1],n[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=S(c);X(a,{name:c,fromWireType:e,argPackAdvance:8,readValueFromPointer:e},{R:!0})},h:function(a,b){b=S(b);var c="std::string"===b;X(a,{name:b,fromWireType:function(e){var f=L[e>>2];if(c)for(var g=e+4,n=0;n<=f;++n){var k=e+4+n;if(0==F[k]||n==f){if(g){var h=g;var p=F,q=h+(k-g);for(g=h;p[g]&&!(g>=q);)++g;
|
a:function(a,b,c){function e(g){g>>=2;var n=L;return new f(J,n[g+1],n[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=R(c);W(a,{name:c,fromWireType:e,argPackAdvance:8,readValueFromPointer:e},{N:!0})},h:function(a,b){b=R(b);var c="std::string"===b;W(a,{name:b,fromWireType:function(e){var f=L[e>>2];if(c)for(var g=e+4,n=0;n<=f;++n){var k=e+4+n;if(n==f||0==F[k]){if(g){var h=g;var p=F,q=h+(k-g);for(g=h;p[g]&&!(g>=q);)++g;if(16<g-h&&p.subarray&&
|
||||||
if(16<g-h&&p.subarray&&ja)h=ja.decode(p.subarray(h,g));else{for(q="";h<g;){var m=p[h++];if(m&128){var r=p[h++]&63;if(192==(m&224))q+=String.fromCharCode((m&31)<<6|r);else{var y=p[h++]&63;m=224==(m&240)?(m&15)<<12|r<<6|y:(m&7)<<18|r<<12|y<<6|p[h++]&63;65536>m?q+=String.fromCharCode(m):(m-=65536,q+=String.fromCharCode(55296|m>>10,56320|m&1023))}}else q+=String.fromCharCode(m)}h=q}}else h="";if(void 0===l)var l=h;else l+=String.fromCharCode(0),l+=h;g=k+1}}else{l=Array(f);for(n=0;n<f;++n)l[n]=String.fromCharCode(F[e+
|
ja)h=ja.decode(p.subarray(h,g));else{for(q="";h<g;){var m=p[h++];if(m&128){var r=p[h++]&63;if(192==(m&224))q+=String.fromCharCode((m&31)<<6|r);else{var y=p[h++]&63;m=224==(m&240)?(m&15)<<12|r<<6|y:(m&7)<<18|r<<12|y<<6|p[h++]&63;65536>m?q+=String.fromCharCode(m):(m-=65536,q+=String.fromCharCode(55296|m>>10,56320|m&1023))}}else q+=String.fromCharCode(m)}h=q}}else h="";if(void 0===l)var l=h;else l+=String.fromCharCode(0),l+=h;g=k+1}}else{l=Array(f);for(n=0;n<f;++n)l[n]=String.fromCharCode(F[e+4+n]);
|
||||||
4+n]);l=l.join("")}Z(e);return l},toWireType:function(e,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||W("Cannot pass non-string to std::string");var n=(c&&g?function(){for(var p=0,q=0;q<f.length;++q){var m=f.charCodeAt(q);55296<=m&&57343>=m&&(m=65536+((m&1023)<<10)|f.charCodeAt(++q)&1023);127>=m?++p:p=2047>=m?p+2:65535>=m?p+3:p+4}return p}:function(){return f.length})(),k=pb(4+n+1);L[k>>
|
l=l.join("")}Z(e);return l},toWireType:function(e,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||V("Cannot pass non-string to std::string");var n=(c&&g?function(){for(var p=0,q=0;q<f.length;++q){var m=f.charCodeAt(q);55296<=m&&57343>=m&&(m=65536+((m&1023)<<10)|f.charCodeAt(++q)&1023);127>=m?++p:p=2047>=m?p+2:65535>=m?p+3:p+4}return p}:function(){return f.length})(),k=ob(4+n+1);L[k>>2]=
|
||||||
2]=n;if(c&&g)ka(f,k+4,n+1);else if(g)for(g=0;g<n;++g){var h=f.charCodeAt(g);255<h&&(Z(k),W("String has UTF-16 code units that do not fit in 8 bits"));F[k+4+g]=h}else for(g=0;g<n;++g)F[k+4+g]=f[g];null!==e&&e.push(Z,k);return k},argPackAdvance:8,readValueFromPointer:Wa,K:function(e){Z(e)}})},d:function(a,b,c){c=S(c);if(2===b){var e=ma;var f=na;var g=oa;var n=function(){return G};var k=1}else 4===b&&(e=pa,f=qa,g=ra,n=function(){return L},k=2);X(a,{name:c,fromWireType:function(h){for(var p=L[h>>2],q=
|
n;if(c&&g)ka(f,k+4,n+1);else if(g)for(g=0;g<n;++g){var h=f.charCodeAt(g);255<h&&(Z(k),V("String has UTF-16 code units that do not fit in 8 bits"));F[k+4+g]=h}else for(g=0;g<n;++g)F[k+4+g]=f[g];null!==e&&e.push(Z,k);return k},argPackAdvance:8,readValueFromPointer:Va,I:function(e){Z(e)}})},g:function(a,b,c){c=R(c);if(2===b){var e=ma;var f=na;var g=oa;var n=function(){return G};var k=1}else 4===b&&(e=pa,f=qa,g=ra,n=function(){return L},k=2);W(a,{name:c,fromWireType:function(h){for(var p=L[h>>2],q=n(),
|
||||||
n(),m,r=h+4,y=0;y<=p;++y){var l=h+4+y*b;if(0==q[l>>k]||y==p)r=e(r,l-r),void 0===m?m=r:(m+=String.fromCharCode(0),m+=r),r=l+b}Z(h);return m},toWireType:function(h,p){"string"!==typeof p&&W("Cannot pass non-string to C++ string type "+c);var q=g(p),m=pb(4+q+b);L[m>>2]=q>>k;f(p,m+4,q+b);null!==h&&h.push(Z,m);return m},argPackAdvance:8,readValueFromPointer:Wa,K:function(h){Z(h)}})},k:function(a,b){b=S(b);X(a,{S:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},o:Sa,s:function(a){if(0===
|
m,r=h+4,y=0;y<=p;++y){var l=h+4+y*b;if(y==p||0==q[l>>k])r=e(r,l-r),void 0===m?m=r:(m+=String.fromCharCode(0),m+=r),r=l+b}Z(h);return m},toWireType:function(h,p){"string"!==typeof p&&V("Cannot pass non-string to C++ string type "+c);var q=g(p),m=ob(4+q+b);L[m>>2]=q>>k;f(p,m+4,q+b);null!==h&&h.push(Z,m);return m},argPackAdvance:8,readValueFromPointer:Va,I:function(h){Z(h)}})},o:function(a,b){b=R(b);W(a,{O:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},d:Sa,e:function(a){if(0===
|
||||||
a)return Va(kb());var b=jb[a];a=void 0===b?S(a):b;return Va(kb()[a])},n:function(a){4<a&&(Y[a].M+=1)},f:function(a,b,c,e){a||W("Cannot use deleted val. handle = "+a);a=Y[a].value;var f=mb[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var n="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)n+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+
|
a)return Y(jb());var b=ib[a];a=void 0===b?R(a):b;return Y(jb()[a])},j:function(a){4<a&&(X[a].K+=1)},k:function(a,b,c,e){a||V("Cannot use deleted val. handle = "+a);a=X[a].value;var f=lb[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var n="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)n+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+
|
||||||
g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",n+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(lb,d,Va);mb[b]=f}return f(a,c,e)},q:function(){B()},p:function(a,b,c){F.copyWithin(a,b,b+c)},c:function(a){a>>>=0;var b=F.length;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var e=b*(1+.2/c);e=Math.min(e,a+100663296);e=Math.max(16777216,a,e);0<e%65536&&(e+=65536-e%65536);a:{try{E.grow(Math.min(2147483648,e)-J.byteLength+65535>>>
|
g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",n+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(kb,d,Y);lb[b]=f}return f(a,c,e)},l:function(){B()},p:function(a,b,c){F.copyWithin(a,b,b+c)},c:function(a){a>>>=0;var b=F.length;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var e=b*(1+.2/c);e=Math.min(e,a+100663296);e=Math.max(16777216,a,e);0<e%65536&&(e+=65536-e%65536);a:{try{E.grow(Math.min(2147483648,e)-J.byteLength+65535>>>
|
||||||
16);va(E.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},memory:E,table:ha};
|
16);va(E.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},memory:E,table:ha};
|
||||||
(function(){function a(f){d.asm=f.exports;N--;d.monitorRunDependencies&&d.monitorRunDependencies(N);0==N&&(null!==Ca&&(clearInterval(Ca),Ca=null),P&&(f=P,P=null,f()))}function b(f){a(f.instance)}function c(f){return Ha().then(function(g){return WebAssembly.instantiate(g,e)}).then(f,function(g){C("failed to asynchronously prepare wasm: "+g);B(g)})}var e={a:qb};N++;d.monitorRunDependencies&&d.monitorRunDependencies(N);if(d.instantiateWasm)try{return d.instantiateWasm(e,a)}catch(f){return C("Module.instantiateWasm callback failed with error: "+
|
(function(){function a(f){d.asm=f.exports;N--;d.monitorRunDependencies&&d.monitorRunDependencies(N);0==N&&(null!==Ca&&(clearInterval(Ca),Ca=null),P&&(f=P,P=null,f()))}function b(f){a(f.instance)}function c(f){return Ha().then(function(g){return WebAssembly.instantiate(g,e)}).then(f,function(g){C("failed to asynchronously prepare wasm: "+g);B(g)})}var e={a:pb};N++;d.monitorRunDependencies&&d.monitorRunDependencies(N);if(d.instantiateWasm)try{return d.instantiateWasm(e,a)}catch(f){return C("Module.instantiateWasm callback failed with error: "+
|
||||||
f),!1}(function(){if(D||"function"!==typeof WebAssembly.instantiateStreaming||Ea()||Da("file://")||"function"!==typeof fetch)return c(b);fetch(Q,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(b,function(g){C("wasm streaming compile failed: "+g);C("falling back to ArrayBuffer instantiation");return c(b)})})})();return{}})();
|
f),!1}(function(){if(D||"function"!==typeof WebAssembly.instantiateStreaming||Ea()||Da("file://")||"function"!==typeof fetch)return c(b);fetch(Q,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(b,function(g){C("wasm streaming compile failed: "+g);C("falling back to ArrayBuffer instantiation");return c(b)})})})();return{}})();
|
||||||
var Ia=d.___wasm_call_ctors=function(){return(Ia=d.___wasm_call_ctors=d.asm.t).apply(null,arguments)},pb=d._malloc=function(){return(pb=d._malloc=d.asm.u).apply(null,arguments)},Z=d._free=function(){return(Z=d._free=d.asm.v).apply(null,arguments)},gb=d.___getTypeName=function(){return(gb=d.___getTypeName=d.asm.w).apply(null,arguments)};d.___embind_register_native_and_builtin_types=function(){return(d.___embind_register_native_and_builtin_types=d.asm.x).apply(null,arguments)};
|
var Ia=d.___wasm_call_ctors=function(){return(Ia=d.___wasm_call_ctors=d.asm.r).apply(null,arguments)},ob=d._malloc=function(){return(ob=d._malloc=d.asm.s).apply(null,arguments)},Z=d._free=function(){return(Z=d._free=d.asm.t).apply(null,arguments)},fb=d.___getTypeName=function(){return(fb=d.___getTypeName=d.asm.u).apply(null,arguments)};d.___embind_register_native_and_builtin_types=function(){return(d.___embind_register_native_and_builtin_types=d.asm.v).apply(null,arguments)};
|
||||||
d.dynCall_iii=function(){return(d.dynCall_iii=d.asm.y).apply(null,arguments)};d.dynCall_vii=function(){return(d.dynCall_vii=d.asm.z).apply(null,arguments)};d.dynCall_ii=function(){return(d.dynCall_ii=d.asm.A).apply(null,arguments)};d.dynCall_i=function(){return(d.dynCall_i=d.asm.B).apply(null,arguments)};d.dynCall_vi=function(){return(d.dynCall_vi=d.asm.C).apply(null,arguments)};d.dynCall_iiii=function(){return(d.dynCall_iiii=d.asm.D).apply(null,arguments)};
|
d.dynCall_iii=function(){return(d.dynCall_iii=d.asm.w).apply(null,arguments)};d.dynCall_vii=function(){return(d.dynCall_vii=d.asm.x).apply(null,arguments)};d.dynCall_ii=function(){return(d.dynCall_ii=d.asm.y).apply(null,arguments)};d.dynCall_i=function(){return(d.dynCall_i=d.asm.z).apply(null,arguments)};d.dynCall_vi=function(){return(d.dynCall_vi=d.asm.A).apply(null,arguments)};d.dynCall_iiiiiii=function(){return(d.dynCall_iiiiiii=d.asm.B).apply(null,arguments)};
|
||||||
d.dynCall_iiiiiii=function(){return(d.dynCall_iiiiiii=d.asm.E).apply(null,arguments)};d.dynCall_viiii=function(){return(d.dynCall_viiii=d.asm.F).apply(null,arguments)};d.dynCall_viiiii=function(){return(d.dynCall_viiiii=d.asm.G).apply(null,arguments)};d.dynCall_viiiiiiiii=function(){return(d.dynCall_viiiiiiiii=d.asm.H).apply(null,arguments)};d.dynCall_viiiiii=function(){return(d.dynCall_viiiiii=d.asm.I).apply(null,arguments)};var rb;P=function sb(){rb||tb();rb||(P=sb)};
|
d.dynCall_viiiiiiiii=function(){return(d.dynCall_viiiiiiiii=d.asm.C).apply(null,arguments)};d.dynCall_viiiii=function(){return(d.dynCall_viiiii=d.asm.D).apply(null,arguments)};d.dynCall_iiii=function(){return(d.dynCall_iiii=d.asm.E).apply(null,arguments)};d.dynCall_viiii=function(){return(d.dynCall_viiii=d.asm.F).apply(null,arguments)};d.dynCall_viiiiii=function(){return(d.dynCall_viiiiii=d.asm.G).apply(null,arguments)};var qb;P=function rb(){qb||sb();qb||(P=rb)};
|
||||||
function tb(){function a(){if(!rb&&(rb=!0,d.calledRun=!0,!ia)){M(ya);M(za);aa(d);if(d.onRuntimeInitialized)d.onRuntimeInitialized();if(d.postRun)for("function"==typeof d.postRun&&(d.postRun=[d.postRun]);d.postRun.length;){var b=d.postRun.shift();Aa.unshift(b)}M(Aa)}}if(!(0<N)){if(d.preRun)for("function"==typeof d.preRun&&(d.preRun=[d.preRun]);d.preRun.length;)Ba();M(xa);0<N||(d.setStatus?(d.setStatus("Running..."),setTimeout(function(){setTimeout(function(){d.setStatus("")},1);a()},1)):a())}}
|
function sb(){function a(){if(!qb&&(qb=!0,d.calledRun=!0,!ia)){M(ya);M(za);aa(d);if(d.onRuntimeInitialized)d.onRuntimeInitialized();if(d.postRun)for("function"==typeof d.postRun&&(d.postRun=[d.postRun]);d.postRun.length;){var b=d.postRun.shift();Aa.unshift(b)}M(Aa)}}if(!(0<N)){if(d.preRun)for("function"==typeof d.preRun&&(d.preRun=[d.preRun]);d.preRun.length;)Ba();M(xa);0<N||(d.setStatus?(d.setStatus("Running..."),setTimeout(function(){setTimeout(function(){d.setStatus("")},1);a()},1)):a())}}
|
||||||
d.run=tb;if(d.preInit)for("function"==typeof d.preInit&&(d.preInit=[d.preInit]);0<d.preInit.length;)d.preInit.pop()();noExitRuntime=!0;tb();
|
d.run=sb;if(d.preInit)for("function"==typeof d.preInit&&(d.preInit=[d.preInit]);0<d.preInit.length;)d.preInit.pop()();noExitRuntime=!0;sb();
|
||||||
|
|
||||||
|
|
||||||
return webp_dec.ready
|
return webp_dec.ready
|
||||||
|
|||||||
Binary file not shown.
@@ -1,8 +1,6 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<script src='webp_enc.js'></script>
|
<script src='webp_enc.js'></script>
|
||||||
<script>
|
<script>
|
||||||
const module = webp_enc();
|
|
||||||
|
|
||||||
async function loadImage(src) {
|
async function loadImage(src) {
|
||||||
// Load image
|
// Load image
|
||||||
const img = document.createElement('img');
|
const img = document.createElement('img');
|
||||||
@@ -17,7 +15,7 @@
|
|||||||
return ctx.getImageData(0, 0, img.width, img.height);
|
return ctx.getImageData(0, 0, img.width, img.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.onRuntimeInitialized = async _ => {
|
webp_enc().then(async module => {
|
||||||
console.log('Version:', module.version().toString(16));
|
console.log('Version:', module.version().toString(16));
|
||||||
const image = await loadImage('../../example.png');
|
const image = await loadImage('../../example.png');
|
||||||
const result = module.encode(image.data, image.width, image.height, {
|
const result = module.encode(image.data, image.width, image.height, {
|
||||||
@@ -56,5 +54,5 @@
|
|||||||
const img = document.createElement('img');
|
const img = document.createElement('img');
|
||||||
img.src = blobURL;
|
img.src = blobURL;
|
||||||
document.body.appendChild(img);
|
document.body.appendChild(img);
|
||||||
};
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ int version() {
|
|||||||
thread_local const val Uint8Array = val::global("Uint8Array");
|
thread_local const val Uint8Array = val::global("Uint8Array");
|
||||||
|
|
||||||
val encode(std::string img, int width, int height, WebPConfig config) {
|
val encode(std::string img, int width, int height, WebPConfig config) {
|
||||||
uint8_t* img_in = (uint8_t*)img.c_str();
|
auto img_in = (uint8_t*)img.c_str();
|
||||||
|
|
||||||
// A lot of this is duplicated from Encode in picture_enc.c
|
// A lot of this is duplicated from Encode in picture_enc.c
|
||||||
WebPPicture pic;
|
WebPPicture pic;
|
||||||
@@ -23,7 +23,7 @@ val encode(std::string img, int width, int height, WebPConfig config) {
|
|||||||
|
|
||||||
if (!WebPPictureInit(&pic)) {
|
if (!WebPPictureInit(&pic)) {
|
||||||
// shouldn't happen, except if system installation is broken
|
// shouldn't happen, except if system installation is broken
|
||||||
throw std::runtime_error("Unexpected error");
|
return val::null();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only use use_argb if we really need it, as it's slower.
|
// Only use use_argb if we really need it, as it's slower.
|
||||||
@@ -35,15 +35,10 @@ val encode(std::string img, int width, int height, WebPConfig config) {
|
|||||||
|
|
||||||
WebPMemoryWriterInit(&wrt);
|
WebPMemoryWriterInit(&wrt);
|
||||||
|
|
||||||
ok = WebPPictureImportRGBA(&pic, (uint8_t*)img_in, width * 4) && WebPEncode(&config, &pic);
|
ok = WebPPictureImportRGBA(&pic, img_in, width * 4) && WebPEncode(&config, &pic);
|
||||||
WebPPictureFree(&pic);
|
WebPPictureFree(&pic);
|
||||||
if (!ok) {
|
val js_result = ok ? Uint8Array.new_(typed_memory_view(wrt.size, wrt.mem)) : val::null();
|
||||||
WebPMemoryWriterClear(&wrt);
|
WebPMemoryWriterClear(&wrt);
|
||||||
throw std::runtime_error("Encode failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
val js_result = Uint8Array.new_(typed_memory_view(wrt.size, wrt.mem));
|
|
||||||
WebPFree(wrt.mem);
|
|
||||||
return js_result;
|
return js_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
4
codecs/webp/enc/webp_enc.d.ts
vendored
4
codecs/webp/enc/webp_enc.d.ts
vendored
@@ -1,7 +1,7 @@
|
|||||||
import { EncodeOptions } from '../../../src/codecs/webp/encoder-meta';
|
import { EncodeOptions } from '../../../src/codecs/webp/encoder-meta';
|
||||||
|
|
||||||
interface WebPModule extends EmscriptenWasm.Module {
|
interface WebPModule extends EmscriptenWasm.Module {
|
||||||
encode(data: BufferSource, width: number, height: number, options: EncodeOptions): Uint8Array;
|
encode(data: BufferSource, width: number, height: number, options: EncodeOptions): Uint8Array | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function(opts: EmscriptenWasm.ModuleOpts): WebPModule;
|
export default function(opts: EmscriptenWasm.ModuleOpts): Promise<WebPModule>;
|
||||||
|
|||||||
@@ -7,56 +7,56 @@ function(webp_enc) {
|
|||||||
webp_enc = webp_enc || {};
|
webp_enc = webp_enc || {};
|
||||||
|
|
||||||
|
|
||||||
var d;d||(d=typeof webp_enc !== 'undefined' ? webp_enc : {});var aa;d.ready=new Promise(function(a){aa=a});var r={},u;for(u in d)d.hasOwnProperty(u)&&(r[u]=d[u]);var w=!1,x=!1,ba=!1,ca=!1;w="object"===typeof window;x="function"===typeof importScripts;ba="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;ca=!w&&!ba&&!x;var y="",A,B,da,ea;
|
var d;d||(d=typeof webp_enc !== 'undefined' ? webp_enc : {});var aa,ba;d.ready=new Promise(function(a,b){aa=a;ba=b});var r={},u;for(u in d)d.hasOwnProperty(u)&&(r[u]=d[u]);var w=!1,x=!1,ca=!1,da=!1;w="object"===typeof window;x="function"===typeof importScripts;ca="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;da=!w&&!ca&&!x;var y="",A,B,ea,fa;
|
||||||
if(ba)y=x?require("path").dirname(y)+"/":__dirname+"/",A=function(a,b){da||(da=require("fs"));ea||(ea=require("path"));a=ea.normalize(a);return da.readFileSync(a,b?null:"utf8")},B=function(a){a=A(a,!0);a.buffer||(a=new Uint8Array(a));a.buffer||C("Assertion failed: undefined");return a},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(a){throw a;}),process.on("unhandledRejection",C),d.inspect=function(){return"[Emscripten Module object]"};
|
if(ca)y=x?require("path").dirname(y)+"/":__dirname+"/",A=function(a,b){ea||(ea=require("fs"));fa||(fa=require("path"));a=fa.normalize(a);return ea.readFileSync(a,b?null:"utf8")},B=function(a){a=A(a,!0);a.buffer||(a=new Uint8Array(a));a.buffer||C("Assertion failed: undefined");return a},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(a){throw a;}),process.on("unhandledRejection",C),d.inspect=function(){return"[Emscripten Module object]"};
|
||||||
else if(ca)"undefined"!=typeof read&&(A=function(a){return read(a)}),B=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");"object"===typeof a||C("Assertion failed: undefined");return a},"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!==typeof printErr?printErr:print);else if(w||x)x?y=self.location.href:document.currentScript&&(y=document.currentScript.src),_scriptDir&&
|
else if(da)"undefined"!=typeof read&&(A=function(a){return read(a)}),B=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");"object"===typeof a||C("Assertion failed: undefined");return a},"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!==typeof printErr?printErr:print);else if(w||x)x?y=self.location.href:document.currentScript&&(y=document.currentScript.src),_scriptDir&&
|
||||||
(y=_scriptDir),0!==y.indexOf("blob:")?y=y.substr(0,y.lastIndexOf("/")+1):y="",A=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},x&&(B=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var fa=d.print||console.log.bind(console),D=d.printErr||console.warn.bind(console);for(u in r)r.hasOwnProperty(u)&&(d[u]=r[u]);r=null;var E;d.wasmBinary&&(E=d.wasmBinary);var noExitRuntime;
|
(y=_scriptDir),0!==y.indexOf("blob:")?y=y.substr(0,y.lastIndexOf("/")+1):y="",A=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},x&&(B=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});d.print||console.log.bind(console);var D=d.printErr||console.warn.bind(console);for(u in r)r.hasOwnProperty(u)&&(d[u]=r[u]);r=null;var E;d.wasmBinary&&(E=d.wasmBinary);var noExitRuntime;
|
||||||
d.noExitRuntime&&(noExitRuntime=d.noExitRuntime);"object"!==typeof WebAssembly&&C("no native wasm support detected");var G,ha=new WebAssembly.Table({initial:128,maximum:128,element:"anyfunc"}),ia=!1,ja="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
|
d.noExitRuntime&&(noExitRuntime=d.noExitRuntime);"object"!==typeof WebAssembly&&C("no native wasm support detected");var G,ha=new WebAssembly.Table({initial:114,maximum:114,element:"anyfunc"}),ja=!1,ka="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
|
||||||
function la(a,b,c){var e=H;if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}if(127>=g){if(b>=c)break;e[b++]=g}else{if(2047>=g){if(b+1>=c)break;e[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;e[b++]=224|g>>12}else{if(b+3>=c)break;e[b++]=240|g>>18;e[b++]=128|g>>12&63}e[b++]=128|g>>6&63}e[b++]=128|g&63}}e[b]=0}}var ma="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;
|
function la(a,b,c){var e=H;if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}if(127>=g){if(b>=c)break;e[b++]=g}else{if(2047>=g){if(b+1>=c)break;e[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;e[b++]=224|g>>12}else{if(b+3>=c)break;e[b++]=240|g>>18;e[b++]=128|g>>12&63}e[b++]=128|g>>6&63}e[b++]=128|g&63}}e[b]=0}}var ma="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;
|
||||||
function na(a,b){var c=a>>1;for(var e=c+b/2;!(c>=e)&&I[c];)++c;c<<=1;if(32<c-a&&ma)return ma.decode(H.subarray(a,c));c=0;for(e="";;){var f=J[a+2*c>>1];if(0==f||c==b/2)return e;++c;e+=String.fromCharCode(f)}}function oa(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var e=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)J[b>>1]=a.charCodeAt(f),b+=2;J[b>>1]=0;return b-e}function pa(a){return 2*a.length}
|
function na(a,b){var c=a>>1;for(var e=c+b/2;!(c>=e)&&I[c];)++c;c<<=1;if(32<c-a&&ma)return ma.decode(H.subarray(a,c));c=0;for(e="";;){var f=J[a+2*c>>1];if(0==f||c==b/2)return e;++c;e+=String.fromCharCode(f)}}function oa(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var e=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)J[b>>1]=a.charCodeAt(f),b+=2;J[b>>1]=0;return b-e}function pa(a){return 2*a.length}
|
||||||
function qa(a,b){for(var c=0,e="";!(c>=b/4);){var f=K[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023)):e+=String.fromCharCode(f)}return e}function ra(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var e=b;c=e+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}K[b>>2]=g;b+=4;if(b+4>c)break}K[b>>2]=0;return b-e}
|
function qa(a,b){for(var c=0,e="";!(c>=b/4);){var f=K[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023)):e+=String.fromCharCode(f)}return e}function ra(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var e=b;c=e+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}K[b>>2]=g;b+=4;if(b+4>c)break}K[b>>2]=0;return b-e}
|
||||||
function sa(a){for(var b=0,c=0;c<a.length;++c){var e=a.charCodeAt(c);55296<=e&&57343>=e&&++c;b+=4}return b}var L,M,H,J,I,K,N,ta,ua;function va(a){L=a;d.HEAP8=M=new Int8Array(a);d.HEAP16=J=new Int16Array(a);d.HEAP32=K=new Int32Array(a);d.HEAPU8=H=new Uint8Array(a);d.HEAPU16=I=new Uint16Array(a);d.HEAPU32=N=new Uint32Array(a);d.HEAPF32=ta=new Float32Array(a);d.HEAPF64=ua=new Float64Array(a)}var wa=d.INITIAL_MEMORY||16777216;d.wasmMemory?G=d.wasmMemory:G=new WebAssembly.Memory({initial:wa/65536,maximum:32768});
|
function sa(a){for(var b=0,c=0;c<a.length;++c){var e=a.charCodeAt(c);55296<=e&&57343>=e&&++c;b+=4}return b}var L,M,H,J,I,K,N,ta,ua;function va(a){L=a;d.HEAP8=M=new Int8Array(a);d.HEAP16=J=new Int16Array(a);d.HEAP32=K=new Int32Array(a);d.HEAPU8=H=new Uint8Array(a);d.HEAPU16=I=new Uint16Array(a);d.HEAPU32=N=new Uint32Array(a);d.HEAPF32=ta=new Float32Array(a);d.HEAPF64=ua=new Float64Array(a)}var wa=d.INITIAL_MEMORY||16777216;d.wasmMemory?G=d.wasmMemory:G=new WebAssembly.Memory({initial:wa/65536,maximum:32768});
|
||||||
G&&(L=G.buffer);wa=L.byteLength;va(L);K[8668]=5277712;function xa(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(d);else{var c=b.Z;"number"===typeof c?void 0===b.T?d.dynCall_v(c):d.dynCall_vi(c,b.T):c(void 0===b.T?null:b.T)}}}var ya=[],za=[],Aa=[],Ba=[];function Ca(){var a=d.preRun.shift();ya.unshift(a)}var O=0,Da=null,P=null;d.preloadedImages={};d.preloadedAudios={};
|
G&&(L=G.buffer);wa=L.byteLength;va(L);K[8588]=5277392;function xa(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(d);else{var c=b.V;"number"===typeof c?void 0===b.P?d.dynCall_v(c):d.dynCall_vi(c,b.P):c(void 0===b.P?null:b.P)}}}var ya=[],za=[],Aa=[],Ba=[];function Ca(){var a=d.preRun.shift();ya.unshift(a)}var O=0,Da=null,P=null;d.preloadedImages={};d.preloadedAudios={};
|
||||||
function C(a){if(d.onAbort)d.onAbort(a);fa(a);D(a);ia=!0;throw new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");}function Ea(a){var b=Q;return String.prototype.startsWith?b.startsWith(a):0===b.indexOf(a)}function Fa(){return Ea("data:application/octet-stream;base64,")}var Q="webp_enc.wasm";if(!Fa()){var Ga=Q;Q=d.locateFile?d.locateFile(Ga,y):y+Ga}
|
function C(a){if(d.onAbort)d.onAbort(a);D(a);ja=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");ba(a);throw a;}function Ea(a){var b=Q;return String.prototype.startsWith?b.startsWith(a):0===b.indexOf(a)}function Fa(){return Ea("data:application/octet-stream;base64,")}var Q="webp_enc.wasm";if(!Fa()){var Ga=Q;Q=d.locateFile?d.locateFile(Ga,y):y+Ga}
|
||||||
function Ha(){try{if(E)return new Uint8Array(E);if(B)return B(Q);throw"both async and sync fetching of the wasm failed";}catch(a){C(a)}}function Ia(){return E||!w&&!x||"function"!==typeof fetch||Ea("file://")?new Promise(function(a){a(Ha())}):fetch(Q,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+Q+"'";return a.arrayBuffer()}).catch(function(){return Ha()})}za.push({Z:function(){Ja()}});function Ka(){return 0<Ka.V}var La={};
|
function Ha(){try{if(E)return new Uint8Array(E);if(B)return B(Q);throw"both async and sync fetching of the wasm failed";}catch(a){C(a)}}function Ia(){return E||!w&&!x||"function"!==typeof fetch||Ea("file://")?new Promise(function(a){a(Ha())}):fetch(Q,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+Q+"'";return a.arrayBuffer()}).catch(function(){return Ha()})}za.push({V:function(){Ja()}});var Ka={};
|
||||||
function Ma(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Na(a){return this.fromWireType(N[a>>2])}var R={},S={},Oa={};function Pa(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}function Qa(a,b){a=Pa(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}
|
function La(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Ma(a){return this.fromWireType(N[a>>2])}var R={},S={},Na={};function Oa(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}function Pa(a,b){a=Oa(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}
|
||||||
function Ra(a){var b=Error,c=Qa(a,function(e){this.name=a;this.message=e;e=Error(e).stack;void 0!==e&&(this.stack=this.toString()+"\n"+e.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}var Sa=void 0;
|
function Qa(a){var b=Error,c=Pa(a,function(e){this.name=a;this.message=e;e=Error(e).stack;void 0!==e&&(this.stack=this.toString()+"\n"+e.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}var Ra=void 0;
|
||||||
function Ta(a,b,c){function e(k){k=c(k);if(k.length!==a.length)throw new Sa("Mismatched type converter count");for(var h=0;h<a.length;++h)T(a[h],k[h])}a.forEach(function(k){Oa[k]=b});var f=Array(b.length),g=[],l=0;b.forEach(function(k,h){S.hasOwnProperty(k)?f[h]=S[k]:(g.push(k),R.hasOwnProperty(k)||(R[k]=[]),R[k].push(function(){f[h]=S[k];++l;l===g.length&&e(f)}))});0===g.length&&e(f)}
|
function Sa(a,b,c){function e(k){k=c(k);if(k.length!==a.length)throw new Ra("Mismatched type converter count");for(var h=0;h<a.length;++h)T(a[h],k[h])}a.forEach(function(k){Na[k]=b});var f=Array(b.length),g=[],l=0;b.forEach(function(k,h){S.hasOwnProperty(k)?f[h]=S[k]:(g.push(k),R.hasOwnProperty(k)||(R[k]=[]),R[k].push(function(){f[h]=S[k];++l;l===g.length&&e(f)}))});0===g.length&&e(f)}
|
||||||
function Ua(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var Va=void 0;function U(a){for(var b="";H[a];)b+=Va[H[a++]];return b}var Wa=void 0;function V(a){throw new Wa(a);}
|
function Ta(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var Ua=void 0;function U(a){for(var b="";H[a];)b+=Ua[H[a++]];return b}var Va=void 0;function V(a){throw new Va(a);}
|
||||||
function T(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var e=b.name;a||V('type "'+e+'" must have a positive integer typeid pointer');if(S.hasOwnProperty(a)){if(c.da)return;V("Cannot register type '"+e+"' twice")}S[a]=b;delete Oa[a];R.hasOwnProperty(a)&&(b=R[a],delete R[a],b.forEach(function(f){f()}))}var Xa=[],X=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
function T(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var e=b.name;a||V('type "'+e+'" must have a positive integer typeid pointer');if(S.hasOwnProperty(a)){if(c.Z)return;V("Cannot register type '"+e+"' twice")}S[a]=b;delete Na[a];R.hasOwnProperty(a)&&(b=R[a],delete R[a],b.forEach(function(f){f()}))}var Wa=[],X=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||||
function Ya(a){4<a&&0===--X[a].U&&(X[a]=void 0,Xa.push(a))}function Za(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Xa.length?Xa.pop():X.length;X[b]={U:1,value:a};return b}}
|
function Xa(a){4<a&&0===--X[a].R&&(X[a]=void 0,Wa.push(a))}function Ya(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Wa.length?Wa.pop():X.length;X[b]={R:1,value:a};return b}}
|
||||||
function $a(a,b){var c=d;if(void 0===c[a].S){var e=c[a];c[a]=function(){c[a].S.hasOwnProperty(arguments.length)||V("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].S+")!");return c[a].S[arguments.length].apply(this,arguments)};c[a].S=[];c[a].S[e.X]=e}}
|
function Za(a,b){var c=d;if(void 0===c[a].O){var e=c[a];c[a]=function(){c[a].O.hasOwnProperty(arguments.length)||V("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].O+")!");return c[a].O[arguments.length].apply(this,arguments)};c[a].O=[];c[a].O[e.T]=e}}
|
||||||
function ab(a,b,c){d.hasOwnProperty(a)?((void 0===c||void 0!==d[a].S&&void 0!==d[a].S[c])&&V("Cannot register public name '"+a+"' twice"),$a(a,a),d.hasOwnProperty(c)&&V("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),d[a].S[c]=b):(d[a]=b,void 0!==c&&(d[a].ka=c))}
|
function $a(a,b,c){d.hasOwnProperty(a)?((void 0===c||void 0!==d[a].O&&void 0!==d[a].O[c])&&V("Cannot register public name '"+a+"' twice"),Za(a,a),d.hasOwnProperty(c)&&V("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),d[a].O[c]=b):(d[a]=b,void 0!==c&&(d[a].ga=c))}
|
||||||
function bb(a,b,c){switch(b){case 0:return function(e){return this.fromWireType((c?M:H)[e])};case 1:return function(e){return this.fromWireType((c?J:I)[e>>1])};case 2:return function(e){return this.fromWireType((c?K:N)[e>>2])};default:throw new TypeError("Unknown integer type: "+a);}}function cb(a){a=db(a);var b=U(a);Y(a);return b}function eb(a,b){var c=S[a];void 0===c&&V(b+" has unknown type "+cb(a));return c}
|
function ab(a,b,c){switch(b){case 0:return function(e){return this.fromWireType((c?M:H)[e])};case 1:return function(e){return this.fromWireType((c?J:I)[e>>1])};case 2:return function(e){return this.fromWireType((c?K:N)[e>>2])};default:throw new TypeError("Unknown integer type: "+a);}}function bb(a){a=cb(a);var b=U(a);Y(a);return b}function db(a,b){var c=S[a];void 0===c&&V(b+" has unknown type "+bb(a));return c}
|
||||||
function fb(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}function gb(a,b){switch(b){case 2:return function(c){return this.fromWireType(ta[c>>2])};case 3:return function(c){return this.fromWireType(ua[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}
|
function eb(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}function fb(a,b){switch(b){case 2:return function(c){return this.fromWireType(ta[c>>2])};case 3:return function(c){return this.fromWireType(ua[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}
|
||||||
function hb(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Qa(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}function ib(a,b){for(var c=[],e=0;e<a;e++)c.push(K[(b>>2)+e]);return c}
|
function gb(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Pa(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}function hb(a,b){for(var c=[],e=0;e<a;e++)c.push(K[(b>>2)+e]);return c}
|
||||||
function Z(a,b){a=U(a);var c=d["dynCall_"+a];for(var e=[],f=1;f<a.length;++f)e.push("a"+f);f="return function dynCall_"+(a+"_"+b)+"("+e.join(", ")+") {\n";f+=" return dynCall(rawFunction"+(e.length?", ":"")+e.join(", ")+");\n";c=(new Function("dynCall","rawFunction",f+"};\n"))(c,b);"function"!==typeof c&&V("unknown function pointer with signature "+a+": "+b);return c}var jb=void 0;
|
function Z(a,b){a=U(a);var c=d["dynCall_"+a];for(var e=[],f=1;f<a.length;++f)e.push("a"+f);f="return function dynCall_"+(a+"_"+b)+"("+e.join(", ")+") {\n";f+=" return dynCall(rawFunction"+(e.length?", ":"")+e.join(", ")+");\n";c=(new Function("dynCall","rawFunction",f+"};\n"))(c,b);"function"!==typeof c&&V("unknown function pointer with signature "+a+": "+b);return c}var ib=void 0;
|
||||||
function kb(a,b){function c(g){f[g]||S[g]||(Oa[g]?Oa[g].forEach(c):(e.push(g),f[g]=!0))}var e=[],f={};b.forEach(c);throw new jb(a+": "+e.map(cb).join([", "]));}function lb(a,b,c){switch(b){case 0:return c?function(e){return M[e]}:function(e){return H[e]};case 1:return c?function(e){return J[e>>1]}:function(e){return I[e>>1]};case 2:return c?function(e){return K[e>>2]}:function(e){return N[e>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var mb={};
|
function jb(a,b){function c(g){f[g]||S[g]||(Na[g]?Na[g].forEach(c):(e.push(g),f[g]=!0))}var e=[],f={};b.forEach(c);throw new ib(a+": "+e.map(bb).join([", "]));}function kb(a,b,c){switch(b){case 0:return c?function(e){return M[e]}:function(e){return H[e]};case 1:return c?function(e){return J[e>>1]}:function(e){return I[e>>1]};case 2:return c?function(e){return K[e>>2]}:function(e){return N[e>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var lb={};
|
||||||
function nb(){return"object"===typeof globalThis?globalThis:Function("return this")()}var ob={};Sa=d.InternalError=Ra("InternalError");for(var pb=Array(256),qb=0;256>qb;++qb)pb[qb]=String.fromCharCode(qb);Va=pb;Wa=d.BindingError=Ra("BindingError");d.count_emval_handles=function(){for(var a=0,b=5;b<X.length;++b)void 0!==X[b]&&++a;return a};d.get_first_emval=function(){for(var a=5;a<X.length;++a)if(void 0!==X[a])return X[a];return null};jb=d.UnboundTypeError=Ra("UnboundTypeError");
|
function mb(){return"object"===typeof globalThis?globalThis:Function("return this")()}var nb={};Ra=d.InternalError=Qa("InternalError");for(var ob=Array(256),pb=0;256>pb;++pb)ob[pb]=String.fromCharCode(pb);Ua=ob;Va=d.BindingError=Qa("BindingError");d.count_emval_handles=function(){for(var a=0,b=5;b<X.length;++b)void 0!==X[b]&&++a;return a};d.get_first_emval=function(){for(var a=5;a<X.length;++a)if(void 0!==X[a])return X[a];return null};ib=d.UnboundTypeError=Qa("UnboundTypeError");
|
||||||
var sb={j:function(a){return rb(a)},x:function(){},f:function(a){"uncaught_exception"in Ka?Ka.V++:Ka.V=1;throw a;},k:function(a){var b=La[a];delete La[a];var c=b.ea,e=b.fa,f=b.W,g=f.map(function(l){return l.ba}).concat(f.map(function(l){return l.ha}));Ta([a],g,function(l){var k={};f.forEach(function(h,m){var q=l[m],n=h.$,t=h.aa,v=l[m+f.length],p=h.ga,ka=h.ia;k[h.Y]={read:function(z){return q.fromWireType(n(t,z))},write:function(z,F){var W=[];p(ka,z,v.toWireType(W,F));Ma(W)}}});return[{name:b.name,
|
var rb={v:function(){},l:function(a){var b=Ka[a];delete Ka[a];var c=b.$,e=b.aa,f=b.S,g=f.map(function(l){return l.Y}).concat(f.map(function(l){return l.da}));Sa([a],g,function(l){var k={};f.forEach(function(h,m){var q=l[m],n=h.W,t=h.X,v=l[m+f.length],p=h.ba,ia=h.ea;k[h.U]={read:function(z){return q.fromWireType(n(t,z))},write:function(z,F){var W=[];p(ia,z,v.toWireType(W,F));La(W)}}});return[{name:b.name,fromWireType:function(h){var m={},q;for(q in k)m[q]=k[q].read(h);e(h);return m},toWireType:function(h,
|
||||||
fromWireType:function(h){var m={},q;for(q in k)m[q]=k[q].read(h);e(h);return m},toWireType:function(h,m){for(var q in k)if(!(q in m))throw new TypeError('Missing field: "'+q+'"');var n=c();for(q in k)k[q].write(n,m[q]);null!==h&&h.push(e,n);return n},argPackAdvance:8,readValueFromPointer:Na,R:e}]})},u:function(a,b,c,e,f){var g=Ua(c);b=U(b);T(a,{name:b,fromWireType:function(l){return!!l},toWireType:function(l,k){return k?e:f},argPackAdvance:8,readValueFromPointer:function(l){if(1===c)var k=M;else if(2===
|
m){for(var q in k)if(!(q in m))throw new TypeError('Missing field: "'+q+'"');var n=c();for(q in k)k[q].write(n,m[q]);null!==h&&h.push(e,n);return n},argPackAdvance:8,readValueFromPointer:Ma,N:e}]})},r:function(a,b,c,e,f){var g=Ta(c);b=U(b);T(a,{name:b,fromWireType:function(l){return!!l},toWireType:function(l,k){return k?e:f},argPackAdvance:8,readValueFromPointer:function(l){if(1===c)var k=M;else if(2===c)k=J;else if(4===c)k=K;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[l>>
|
||||||
c)k=J;else if(4===c)k=K;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[l>>g])},R:null})},t:function(a,b){b=U(b);T(a,{name:b,fromWireType:function(c){var e=X[c].value;Ya(c);return e},toWireType:function(c,e){return Za(e)},argPackAdvance:8,readValueFromPointer:Na,R:null})},n:function(a,b,c,e){function f(){}c=Ua(c);b=U(b);f.values={};T(a,{name:b,constructor:f,fromWireType:function(g){return this.constructor.values[g]},toWireType:function(g,l){return l.value},argPackAdvance:8,
|
g])},N:null})},q:function(a,b){b=U(b);T(a,{name:b,fromWireType:function(c){var e=X[c].value;Xa(c);return e},toWireType:function(c,e){return Ya(e)},argPackAdvance:8,readValueFromPointer:Ma,N:null})},n:function(a,b,c,e){function f(){}c=Ta(c);b=U(b);f.values={};T(a,{name:b,constructor:f,fromWireType:function(g){return this.constructor.values[g]},toWireType:function(g,l){return l.value},argPackAdvance:8,readValueFromPointer:ab(b,c,e),N:null});$a(b,f)},e:function(a,b,c){var e=db(a,"enum");b=U(b);a=e.constructor;
|
||||||
readValueFromPointer:bb(b,c,e),R:null});ab(b,f)},m:function(a,b,c){var e=eb(a,"enum");b=U(b);a=e.constructor;e=Object.create(e.constructor.prototype,{value:{value:c},constructor:{value:Qa(e.name+"_"+b,function(){})}});a.values[c]=e;a[b]=e},g:function(a,b,c){c=Ua(c);b=U(b);T(a,{name:b,fromWireType:function(e){return e},toWireType:function(e,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+fb(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:gb(b,
|
e=Object.create(e.constructor.prototype,{value:{value:c},constructor:{value:Pa(e.name+"_"+b,function(){})}});a.values[c]=e;a[b]=e},j:function(a,b,c){c=Ta(c);b=U(b);T(a,{name:b,fromWireType:function(e){return e},toWireType:function(e,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+eb(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:fb(b,c),N:null})},h:function(a,b,c,e,f,g){var l=hb(b,c);a=U(a);f=Z(e,f);$a(a,function(){jb("Cannot call "+a+
|
||||||
c),R:null})},i:function(a,b,c,e,f,g){var l=ib(b,c);a=U(a);f=Z(e,f);ab(a,function(){kb("Cannot call "+a+" due to unbound types",l)},b-1);Ta([],l,function(k){var h=[k[0],null].concat(k.slice(1)),m=k=a,q=f,n=h.length;2>n&&V("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var t=null!==h[1]&&!1,v=!1,p=1;p<h.length;++p)if(null!==h[p]&&void 0===h[p].R){v=!0;break}var ka="void"!==h[0].name,z="",F="";for(p=0;p<n-2;++p)z+=(0!==p?", ":"")+"arg"+p,F+=(0!==p?", ":"")+"arg"+
|
" due to unbound types",l)},b-1);Sa([],l,function(k){var h=[k[0],null].concat(k.slice(1)),m=k=a,q=f,n=h.length;2>n&&V("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var t=null!==h[1]&&!1,v=!1,p=1;p<h.length;++p)if(null!==h[p]&&void 0===h[p].N){v=!0;break}var ia="void"!==h[0].name,z="",F="";for(p=0;p<n-2;++p)z+=(0!==p?", ":"")+"arg"+p,F+=(0!==p?", ":"")+"arg"+p+"Wired";m="return function "+Oa(m)+"("+z+") {\nif (arguments.length !== "+(n-2)+") {\nthrowBindingError('function "+
|
||||||
p+"Wired";m="return function "+Pa(m)+"("+z+") {\nif (arguments.length !== "+(n-2)+") {\nthrowBindingError('function "+m+" called with ' + arguments.length + ' arguments, expected "+(n-2)+" args!');\n}\n";v&&(m+="var destructors = [];\n");var W=v?"destructors":"null";z="throwBindingError invoker fn runDestructors retType classParam".split(" ");q=[V,q,g,Ma,h[0],h[1]];t&&(m+="var thisWired = classParam.toWireType("+W+", this);\n");for(p=0;p<n-2;++p)m+="var arg"+p+"Wired = argType"+p+".toWireType("+W+
|
m+" called with ' + arguments.length + ' arguments, expected "+(n-2)+" args!');\n}\n";v&&(m+="var destructors = [];\n");var W=v?"destructors":"null";z="throwBindingError invoker fn runDestructors retType classParam".split(" ");q=[V,q,g,La,h[0],h[1]];t&&(m+="var thisWired = classParam.toWireType("+W+", this);\n");for(p=0;p<n-2;++p)m+="var arg"+p+"Wired = argType"+p+".toWireType("+W+", arg"+p+"); // "+h[p+2].name+"\n",z.push("argType"+p),q.push(h[p+2]);t&&(F="thisWired"+(0<F.length?", ":"")+F);m+=(ia?
|
||||||
", arg"+p+"); // "+h[p+2].name+"\n",z.push("argType"+p),q.push(h[p+2]);t&&(F="thisWired"+(0<F.length?", ":"")+F);m+=(ka?"var rv = ":"")+"invoker(fn"+(0<F.length?", ":"")+F+");\n";if(v)m+="runDestructors(destructors);\n";else for(p=t?1:2;p<h.length;++p)n=1===p?"thisWired":"arg"+(p-2)+"Wired",null!==h[p].R&&(m+=n+"_dtor("+n+"); // "+h[p].name+"\n",z.push(n+"_dtor"),q.push(h[p].R));ka&&(m+="var ret = retType.fromWireType(rv);\nreturn ret;\n");z.push(m+"}\n");h=hb(z).apply(null,q);p=b-1;if(!d.hasOwnProperty(k))throw new Sa("Replacing nonexistant public symbol");
|
"var rv = ":"")+"invoker(fn"+(0<F.length?", ":"")+F+");\n";if(v)m+="runDestructors(destructors);\n";else for(p=t?1:2;p<h.length;++p)n=1===p?"thisWired":"arg"+(p-2)+"Wired",null!==h[p].N&&(m+=n+"_dtor("+n+"); // "+h[p].name+"\n",z.push(n+"_dtor"),q.push(h[p].N));ia&&(m+="var ret = retType.fromWireType(rv);\nreturn ret;\n");z.push(m+"}\n");h=gb(z).apply(null,q);p=b-1;if(!d.hasOwnProperty(k))throw new Ra("Replacing nonexistant public symbol");void 0!==d[k].O&&void 0!==p?d[k].O[p]=h:(d[k]=h,d[k].T=p);
|
||||||
void 0!==d[k].S&&void 0!==p?d[k].S[p]=h:(d[k]=h,d[k].X=p);return[]})},b:function(a,b,c,e,f){function g(m){return m}b=U(b);-1===f&&(f=4294967295);var l=Ua(c);if(0===e){var k=32-8*c;g=function(m){return m<<k>>>k}}var h=-1!=b.indexOf("unsigned");T(a,{name:b,fromWireType:g,toWireType:function(m,q){if("number"!==typeof q&&"boolean"!==typeof q)throw new TypeError('Cannot convert "'+fb(q)+'" to '+this.name);if(q<e||q>f)throw new TypeError('Passing a number "'+fb(q)+'" from JS side to C/C++ side to an argument of type "'+
|
return[]})},c:function(a,b,c,e,f){function g(m){return m}b=U(b);-1===f&&(f=4294967295);var l=Ta(c);if(0===e){var k=32-8*c;g=function(m){return m<<k>>>k}}var h=-1!=b.indexOf("unsigned");T(a,{name:b,fromWireType:g,toWireType:function(m,q){if("number"!==typeof q&&"boolean"!==typeof q)throw new TypeError('Cannot convert "'+eb(q)+'" to '+this.name);if(q<e||q>f)throw new TypeError('Passing a number "'+eb(q)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+
|
||||||
b+'", which is outside the valid range ['+e+", "+f+"]!");return h?q>>>0:q|0},argPackAdvance:8,readValueFromPointer:lb(b,l,0!==e),R:null})},a:function(a,b,c){function e(g){g>>=2;var l=N;return new f(L,l[g+1],l[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=U(c);T(a,{name:c,fromWireType:e,argPackAdvance:8,readValueFromPointer:e},{da:!0})},h:function(a,b){b=U(b);var c="std::string"===b;T(a,{name:b,fromWireType:function(e){var f=N[e>>2];if(c)for(var g=
|
e+", "+f+"]!");return h?q>>>0:q|0},argPackAdvance:8,readValueFromPointer:kb(b,l,0!==e),N:null})},b:function(a,b,c){function e(g){g>>=2;var l=N;return new f(L,l[g+1],l[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=U(c);T(a,{name:c,fromWireType:e,argPackAdvance:8,readValueFromPointer:e},{Z:!0})},k:function(a,b){b=U(b);var c="std::string"===b;T(a,{name:b,fromWireType:function(e){var f=N[e>>2];if(c)for(var g=e+4,l=0;l<=f;++l){var k=e+4+l;
|
||||||
e+4,l=0;l<=f;++l){var k=e+4+l;if(0==H[k]||l==f){if(g){var h=g;var m=H,q=h+(k-g);for(g=h;m[g]&&!(g>=q);)++g;if(16<g-h&&m.subarray&&ja)h=ja.decode(m.subarray(h,g));else{for(q="";h<g;){var n=m[h++];if(n&128){var t=m[h++]&63;if(192==(n&224))q+=String.fromCharCode((n&31)<<6|t);else{var v=m[h++]&63;n=224==(n&240)?(n&15)<<12|t<<6|v:(n&7)<<18|t<<12|v<<6|m[h++]&63;65536>n?q+=String.fromCharCode(n):(n-=65536,q+=String.fromCharCode(55296|n>>10,56320|n&1023))}}else q+=String.fromCharCode(n)}h=q}}else h="";if(void 0===
|
if(l==f||0==H[k]){if(g){var h=g;var m=H,q=h+(k-g);for(g=h;m[g]&&!(g>=q);)++g;if(16<g-h&&m.subarray&&ka)h=ka.decode(m.subarray(h,g));else{for(q="";h<g;){var n=m[h++];if(n&128){var t=m[h++]&63;if(192==(n&224))q+=String.fromCharCode((n&31)<<6|t);else{var v=m[h++]&63;n=224==(n&240)?(n&15)<<12|t<<6|v:(n&7)<<18|t<<12|v<<6|m[h++]&63;65536>n?q+=String.fromCharCode(n):(n-=65536,q+=String.fromCharCode(55296|n>>10,56320|n&1023))}}else q+=String.fromCharCode(n)}h=q}}else h="";if(void 0===p)var p=h;else p+=String.fromCharCode(0),
|
||||||
p)var p=h;else p+=String.fromCharCode(0),p+=h;g=k+1}}else{p=Array(f);for(l=0;l<f;++l)p[l]=String.fromCharCode(H[e+4+l]);p=p.join("")}Y(e);return p},toWireType:function(e,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||V("Cannot pass non-string to std::string");var l=(c&&g?function(){for(var m=0,q=0;q<f.length;++q){var n=f.charCodeAt(q);55296<=n&&57343>=n&&(n=65536+((n&1023)<<10)|f.charCodeAt(++q)&
|
p+=h;g=k+1}}else{p=Array(f);for(l=0;l<f;++l)p[l]=String.fromCharCode(H[e+4+l]);p=p.join("")}Y(e);return p},toWireType:function(e,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||V("Cannot pass non-string to std::string");var l=(c&&g?function(){for(var m=0,q=0;q<f.length;++q){var n=f.charCodeAt(q);55296<=n&&57343>=n&&(n=65536+((n&1023)<<10)|f.charCodeAt(++q)&1023);127>=n?++m:m=2047>=n?m+
|
||||||
1023);127>=n?++m:m=2047>=n?m+2:65535>=n?m+3:m+4}return m}:function(){return f.length})(),k=rb(4+l+1);N[k>>2]=l;if(c&&g)la(f,k+4,l+1);else if(g)for(g=0;g<l;++g){var h=f.charCodeAt(g);255<h&&(Y(k),V("String has UTF-16 code units that do not fit in 8 bits"));H[k+4+g]=h}else for(g=0;g<l;++g)H[k+4+g]=f[g];null!==e&&e.push(Y,k);return k},argPackAdvance:8,readValueFromPointer:Na,R:function(e){Y(e)}})},d:function(a,b,c){c=U(c);if(2===b){var e=na;var f=oa;var g=pa;var l=function(){return I};var k=1}else 4===
|
2:65535>=n?m+3:m+4}return m}:function(){return f.length})(),k=qb(4+l+1);N[k>>2]=l;if(c&&g)la(f,k+4,l+1);else if(g)for(g=0;g<l;++g){var h=f.charCodeAt(g);255<h&&(Y(k),V("String has UTF-16 code units that do not fit in 8 bits"));H[k+4+g]=h}else for(g=0;g<l;++g)H[k+4+g]=f[g];null!==e&&e.push(Y,k);return k},argPackAdvance:8,readValueFromPointer:Ma,N:function(e){Y(e)}})},g:function(a,b,c){c=U(c);if(2===b){var e=na;var f=oa;var g=pa;var l=function(){return I};var k=1}else 4===b&&(e=qa,f=ra,g=sa,l=function(){return N},
|
||||||
b&&(e=qa,f=ra,g=sa,l=function(){return N},k=2);T(a,{name:c,fromWireType:function(h){for(var m=N[h>>2],q=l(),n,t=h+4,v=0;v<=m;++v){var p=h+4+v*b;if(0==q[p>>k]||v==m)t=e(t,p-t),void 0===n?n=t:(n+=String.fromCharCode(0),n+=t),t=p+b}Y(h);return n},toWireType:function(h,m){"string"!==typeof m&&V("Cannot pass non-string to C++ string type "+c);var q=g(m),n=rb(4+q+b);N[n>>2]=q>>k;f(m,n+4,q+b);null!==h&&h.push(Y,n);return n},argPackAdvance:8,readValueFromPointer:Na,R:function(h){Y(h)}})},l:function(a,b,c,
|
k=2);T(a,{name:c,fromWireType:function(h){for(var m=N[h>>2],q=l(),n,t=h+4,v=0;v<=m;++v){var p=h+4+v*b;if(v==m||0==q[p>>k])t=e(t,p-t),void 0===n?n=t:(n+=String.fromCharCode(0),n+=t),t=p+b}Y(h);return n},toWireType:function(h,m){"string"!==typeof m&&V("Cannot pass non-string to C++ string type "+c);var q=g(m),n=qb(4+q+b);N[n>>2]=q>>k;f(m,n+4,q+b);null!==h&&h.push(Y,n);return n},argPackAdvance:8,readValueFromPointer:Ma,N:function(h){Y(h)}})},m:function(a,b,c,e,f,g){Ka[a]={name:U(b),$:Z(c,e),aa:Z(f,g),
|
||||||
e,f,g){La[a]={name:U(b),ea:Z(c,e),fa:Z(f,g),W:[]}},e:function(a,b,c,e,f,g,l,k,h,m){La[a].W.push({Y:U(b),ba:c,$:Z(e,f),aa:g,ha:l,ga:Z(k,h),ia:m})},v:function(a,b){b=U(b);T(a,{ja:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},p:Ya,q:function(a){if(0===a)return Za(nb());var b=mb[a];a=void 0===b?U(a):b;return Za(nb()[a])},w:function(a){4<a&&(X[a].U+=1)},o:function(a,b,c,e){a||V("Cannot use deleted val. handle = "+a);a=X[a].value;var f=ob[b];if(!f){f="";for(var g=0;g<b;++g)f+=
|
S:[]}},a:function(a,b,c,e,f,g,l,k,h,m){Ka[a].S.push({U:U(b),Y:c,W:Z(e,f),X:g,da:l,ba:Z(k,h),ea:m})},s:function(a,b){b=U(b);T(a,{fa:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},f:Xa,u:function(a){if(0===a)return Ya(mb());var b=lb[a];a=void 0===b?U(a):b;return Ya(mb()[a])},t:function(a){4<a&&(X[a].R+=1)},o:function(a,b,c,e){a||V("Cannot use deleted val. handle = "+a);a=X[a].value;var f=nb[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var l="return function emval_allocator_"+
|
||||||
(0!==g?", ":"")+"arg"+g;var l="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)l+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",l+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(eb,d,Za);ob[b]=f}return f(a,
|
b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)l+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",l+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(db,d,Ya);nb[b]=f}return f(a,c,e)},i:function(){C()},p:function(a,b,c){H.copyWithin(a,b,b+c)},
|
||||||
c,e)},s:function(){C()},r:function(a,b,c){H.copyWithin(a,b,b+c)},c:function(a){a>>>=0;var b=H.length;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var e=b*(1+.2/c);e=Math.min(e,a+100663296);e=Math.max(16777216,a,e);0<e%65536&&(e+=65536-e%65536);a:{try{G.grow(Math.min(2147483648,e)-L.byteLength+65535>>>16);va(G.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},memory:G,table:ha};
|
d:function(a){a>>>=0;var b=H.length;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var e=b*(1+.2/c);e=Math.min(e,a+100663296);e=Math.max(16777216,a,e);0<e%65536&&(e+=65536-e%65536);a:{try{G.grow(Math.min(2147483648,e)-L.byteLength+65535>>>16);va(G.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},memory:G,table:ha};
|
||||||
(function(){function a(f){d.asm=f.exports;O--;d.monitorRunDependencies&&d.monitorRunDependencies(O);0==O&&(null!==Da&&(clearInterval(Da),Da=null),P&&(f=P,P=null,f()))}function b(f){a(f.instance)}function c(f){return Ia().then(function(g){return WebAssembly.instantiate(g,e)}).then(f,function(g){D("failed to asynchronously prepare wasm: "+g);C(g)})}var e={a:sb};O++;d.monitorRunDependencies&&d.monitorRunDependencies(O);if(d.instantiateWasm)try{return d.instantiateWasm(e,a)}catch(f){return D("Module.instantiateWasm callback failed with error: "+
|
(function(){function a(f){d.asm=f.exports;O--;d.monitorRunDependencies&&d.monitorRunDependencies(O);0==O&&(null!==Da&&(clearInterval(Da),Da=null),P&&(f=P,P=null,f()))}function b(f){a(f.instance)}function c(f){return Ia().then(function(g){return WebAssembly.instantiate(g,e)}).then(f,function(g){D("failed to asynchronously prepare wasm: "+g);C(g)})}var e={a:rb};O++;d.monitorRunDependencies&&d.monitorRunDependencies(O);if(d.instantiateWasm)try{return d.instantiateWasm(e,a)}catch(f){return D("Module.instantiateWasm callback failed with error: "+
|
||||||
f),!1}(function(){if(E||"function"!==typeof WebAssembly.instantiateStreaming||Fa()||Ea("file://")||"function"!==typeof fetch)return c(b);fetch(Q,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(b,function(g){D("wasm streaming compile failed: "+g);D("falling back to ArrayBuffer instantiation");return c(b)})})})();return{}})();
|
f),!1}(function(){if(E||"function"!==typeof WebAssembly.instantiateStreaming||Fa()||Ea("file://")||"function"!==typeof fetch)return c(b);fetch(Q,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(b,function(g){D("wasm streaming compile failed: "+g);D("falling back to ArrayBuffer instantiation");return c(b)})})})();return{}})();
|
||||||
var Ja=d.___wasm_call_ctors=function(){return(Ja=d.___wasm_call_ctors=d.asm.y).apply(null,arguments)},rb=d._malloc=function(){return(rb=d._malloc=d.asm.z).apply(null,arguments)},Y=d._free=function(){return(Y=d._free=d.asm.A).apply(null,arguments)},db=d.___getTypeName=function(){return(db=d.___getTypeName=d.asm.B).apply(null,arguments)};d.___embind_register_native_and_builtin_types=function(){return(d.___embind_register_native_and_builtin_types=d.asm.C).apply(null,arguments)};
|
var Ja=d.___wasm_call_ctors=function(){return(Ja=d.___wasm_call_ctors=d.asm.w).apply(null,arguments)},qb=d._malloc=function(){return(qb=d._malloc=d.asm.x).apply(null,arguments)},Y=d._free=function(){return(Y=d._free=d.asm.y).apply(null,arguments)},cb=d.___getTypeName=function(){return(cb=d.___getTypeName=d.asm.z).apply(null,arguments)};d.___embind_register_native_and_builtin_types=function(){return(d.___embind_register_native_and_builtin_types=d.asm.A).apply(null,arguments)};
|
||||||
d.dynCall_i=function(){return(d.dynCall_i=d.asm.D).apply(null,arguments)};d.dynCall_vi=function(){return(d.dynCall_vi=d.asm.E).apply(null,arguments)};d.dynCall_iii=function(){return(d.dynCall_iii=d.asm.F).apply(null,arguments)};d.dynCall_viii=function(){return(d.dynCall_viii=d.asm.G).apply(null,arguments)};d.dynCall_fii=function(){return(d.dynCall_fii=d.asm.H).apply(null,arguments)};d.dynCall_viif=function(){return(d.dynCall_viif=d.asm.I).apply(null,arguments)};
|
d.dynCall_i=function(){return(d.dynCall_i=d.asm.B).apply(null,arguments)};d.dynCall_vi=function(){return(d.dynCall_vi=d.asm.C).apply(null,arguments)};d.dynCall_iii=function(){return(d.dynCall_iii=d.asm.D).apply(null,arguments)};d.dynCall_viii=function(){return(d.dynCall_viii=d.asm.E).apply(null,arguments)};d.dynCall_fii=function(){return(d.dynCall_fii=d.asm.F).apply(null,arguments)};d.dynCall_viif=function(){return(d.dynCall_viif=d.asm.G).apply(null,arguments)};
|
||||||
d.dynCall_ii=function(){return(d.dynCall_ii=d.asm.J).apply(null,arguments)};d.dynCall_iiiiii=function(){return(d.dynCall_iiiiii=d.asm.K).apply(null,arguments)};d.dynCall_viiiii=function(){return(d.dynCall_viiiii=d.asm.L).apply(null,arguments)};d.dynCall_iiii=function(){return(d.dynCall_iiii=d.asm.M).apply(null,arguments)};d.dynCall_viiiiiiiii=function(){return(d.dynCall_viiiiiiiii=d.asm.N).apply(null,arguments)};d.dynCall_viiii=function(){return(d.dynCall_viiii=d.asm.O).apply(null,arguments)};
|
d.dynCall_ii=function(){return(d.dynCall_ii=d.asm.H).apply(null,arguments)};d.dynCall_iiiiii=function(){return(d.dynCall_iiiiii=d.asm.I).apply(null,arguments)};d.dynCall_viiiii=function(){return(d.dynCall_viiiii=d.asm.J).apply(null,arguments)};d.dynCall_iiii=function(){return(d.dynCall_iiii=d.asm.K).apply(null,arguments)};d.dynCall_viiii=function(){return(d.dynCall_viiii=d.asm.L).apply(null,arguments)};d.dynCall_viiiiii=function(){return(d.dynCall_viiiiii=d.asm.M).apply(null,arguments)};var sb;
|
||||||
d.dynCall_viiiiii=function(){return(d.dynCall_viiiiii=d.asm.P).apply(null,arguments)};var tb;P=function ub(){tb||vb();tb||(P=ub)};
|
P=function tb(){sb||ub();sb||(P=tb)};
|
||||||
function vb(){function a(){if(!tb&&(tb=!0,d.calledRun=!0,!ia)){xa(za);xa(Aa);aa(d);if(d.onRuntimeInitialized)d.onRuntimeInitialized();if(d.postRun)for("function"==typeof d.postRun&&(d.postRun=[d.postRun]);d.postRun.length;){var b=d.postRun.shift();Ba.unshift(b)}xa(Ba)}}if(!(0<O)){if(d.preRun)for("function"==typeof d.preRun&&(d.preRun=[d.preRun]);d.preRun.length;)Ca();xa(ya);0<O||(d.setStatus?(d.setStatus("Running..."),setTimeout(function(){setTimeout(function(){d.setStatus("")},1);a()},1)):a())}}
|
function ub(){function a(){if(!sb&&(sb=!0,d.calledRun=!0,!ja)){xa(za);xa(Aa);aa(d);if(d.onRuntimeInitialized)d.onRuntimeInitialized();if(d.postRun)for("function"==typeof d.postRun&&(d.postRun=[d.postRun]);d.postRun.length;){var b=d.postRun.shift();Ba.unshift(b)}xa(Ba)}}if(!(0<O)){if(d.preRun)for("function"==typeof d.preRun&&(d.preRun=[d.preRun]);d.preRun.length;)Ca();xa(ya);0<O||(d.setStatus?(d.setStatus("Running..."),setTimeout(function(){setTimeout(function(){d.setStatus("")},1);a()},1)):a())}}
|
||||||
d.run=vb;if(d.preInit)for("function"==typeof d.preInit&&(d.preInit=[d.preInit]);0<d.preInit.length;)d.preInit.pop()();noExitRuntime=!0;vb();
|
d.run=ub;if(d.preInit)for("function"==typeof d.preInit&&(d.preInit=[d.preInit]);0<d.preInit.length;)d.preInit.pop()();noExitRuntime=!0;ub();
|
||||||
|
|
||||||
|
|
||||||
return webp_enc.ready
|
return webp_enc.ready
|
||||||
|
|||||||
Binary file not shown.
47
codecs/wp2/Makefile
Normal file
47
codecs/wp2/Makefile
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
CODEC_URL = https://chromium.googlesource.com/codecs/libwebp2/+archive/c90b5b476004c9a98731ae1c175cebab5de50fbf.tar.gz
|
||||||
|
CODEC_DIR = node_modules/wp2
|
||||||
|
CODEC_BUILD_DIR := $(CODEC_DIR)/.build
|
||||||
|
CODEC_OUT := $(CODEC_BUILD_DIR)/libwebp2.a
|
||||||
|
|
||||||
|
OUT_JS = enc/wp2_enc.js dec/wp2_dec.js
|
||||||
|
OUT_WASM = $(OUT_JS:.js=.wasm)
|
||||||
|
|
||||||
|
.PHONY: all clean
|
||||||
|
|
||||||
|
all: $(OUT_JS)
|
||||||
|
|
||||||
|
%.js: %.cpp $(CODEC_OUT)
|
||||||
|
$(CXX) \
|
||||||
|
-I $(CODEC_DIR) \
|
||||||
|
${CXXFLAGS} \
|
||||||
|
${LDFLAGS} \
|
||||||
|
--bind \
|
||||||
|
--closure 1 \
|
||||||
|
-s ALLOW_MEMORY_GROWTH=1 \
|
||||||
|
-s MODULARIZE=1 \
|
||||||
|
-s 'EXPORT_NAME="$(basename $(@F))"' \
|
||||||
|
-o $@ \
|
||||||
|
$+
|
||||||
|
|
||||||
|
$(CODEC_OUT): $(CODEC_BUILD_DIR)/Makefile
|
||||||
|
cd $(CODEC_BUILD_DIR) && \
|
||||||
|
$(MAKE)
|
||||||
|
|
||||||
|
$(CODEC_BUILD_DIR)/Makefile: $(CODEC_DIR)/CMakeLists.txt
|
||||||
|
mkdir -p $(CODEC_BUILD_DIR)
|
||||||
|
cd $(CODEC_BUILD_DIR) && \
|
||||||
|
emcmake cmake \
|
||||||
|
-DWP2_ENABLE_SIMD=0 \
|
||||||
|
-DWP2_BUILD_TESTS=0 \
|
||||||
|
-DWP2_ENABLE_TESTS=0 \
|
||||||
|
-DWP2_BUILD_EXAMPLES=0 \
|
||||||
|
-DWP2_BUILD_EXTRAS=0 \
|
||||||
|
../
|
||||||
|
|
||||||
|
$(CODEC_DIR)/CMakeLists.txt:
|
||||||
|
mkdir -p $(CODEC_DIR)
|
||||||
|
curl -sL $(CODEC_URL) | tar xz -C $(CODEC_DIR)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM) $(OUT_JS) $(OUT_WASM)
|
||||||
|
$(MAKE) -C $(CODEC_BUILD_DIR) clean
|
||||||
17
codecs/wp2/dec/README.md
Normal file
17
codecs/wp2/dec/README.md
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# WebP2 decoder
|
||||||
|
|
||||||
|
- Source: <https://chromium.googlesource.com/codecs/libwebp2>
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
- Docker
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
N/A
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### `ImageData decode(uint8_t* image_buffer, int image_width, int image_height)`
|
||||||
|
|
||||||
|
Decodes the given WebP2 buffer into raw RGBA represented as an `ImageData`.
|
||||||
24
codecs/wp2/dec/wp2_dec.cpp
Normal file
24
codecs/wp2/dec/wp2_dec.cpp
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#include <emscripten/bind.h>
|
||||||
|
#include <emscripten/val.h>
|
||||||
|
#include <cstdio>
|
||||||
|
#include "src/wp2/decode.h"
|
||||||
|
|
||||||
|
using namespace emscripten;
|
||||||
|
|
||||||
|
thread_local const val Uint8ClampedArray = val::global("Uint8ClampedArray");
|
||||||
|
thread_local const val ImageData = val::global("ImageData");
|
||||||
|
|
||||||
|
val decode(std::string image_in) {
|
||||||
|
WP2::ArgbBuffer buffer(WP2_rgbA_32);
|
||||||
|
WP2Status status = WP2::Decode(image_in, &buffer);
|
||||||
|
if (status != WP2_STATUS_OK) {
|
||||||
|
return val::null();
|
||||||
|
}
|
||||||
|
return ImageData.new_(
|
||||||
|
Uint8ClampedArray.new_(typed_memory_view(buffer.stride * buffer.height, buffer.GetRow8(0))),
|
||||||
|
buffer.width, buffer.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_BINDINGS(my_module) {
|
||||||
|
function("decode", &decode);
|
||||||
|
}
|
||||||
5
codecs/wp2/dec/wp2_dec.d.ts
vendored
Normal file
5
codecs/wp2/dec/wp2_dec.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
interface WP2Module extends EmscriptenWasm.Module {
|
||||||
|
decode(data: BufferSource): ImageData | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function(opts: EmscriptenWasm.ModuleOpts): Promise<WP2Module>;
|
||||||
69
codecs/wp2/dec/wp2_dec.js
Normal file
69
codecs/wp2/dec/wp2_dec.js
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
|
||||||
|
var wp2_dec = (function() {
|
||||||
|
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
|
||||||
|
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
|
||||||
|
return (
|
||||||
|
function(wp2_dec) {
|
||||||
|
wp2_dec = wp2_dec || {};
|
||||||
|
|
||||||
|
|
||||||
|
var d;d||(d=typeof wp2_dec !== 'undefined' ? wp2_dec : {});var aa,ba;d.ready=new Promise(function(a,b){aa=a;ba=b});var r={},t;for(t in d)d.hasOwnProperty(t)&&(r[t]=d[t]);var u=!1,v=!1,ca=!1,da=!1;u="object"===typeof window;v="function"===typeof importScripts;ca="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;da=!u&&!ca&&!v;var w="",x,z,ea,fa;
|
||||||
|
if(ca)w=v?require("path").dirname(w)+"/":__dirname+"/",x=function(a,b){ea||(ea=require("fs"));fa||(fa=require("path"));a=fa.normalize(a);return ea.readFileSync(a,b?null:"utf8")},z=function(a){a=x(a,!0);a.buffer||(a=new Uint8Array(a));a.buffer||A("Assertion failed: undefined");return a},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(a){throw a;}),process.on("unhandledRejection",A),d.inspect=function(){return"[Emscripten Module object]"};
|
||||||
|
else if(da)"undefined"!=typeof read&&(x=function(a){return read(a)}),z=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");"object"===typeof a||A("Assertion failed: undefined");return a},"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!==typeof printErr?printErr:print);else if(u||v)v?w=self.location.href:document.currentScript&&(w=document.currentScript.src),_scriptDir&&
|
||||||
|
(w=_scriptDir),0!==w.indexOf("blob:")?w=w.substr(0,w.lastIndexOf("/")+1):w="",x=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},v&&(z=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var ha=d.print||console.log.bind(console),B=d.printErr||console.warn.bind(console);for(t in r)r.hasOwnProperty(t)&&(d[t]=r[t]);r=null;var D;d.wasmBinary&&(D=d.wasmBinary);var noExitRuntime;
|
||||||
|
d.noExitRuntime&&(noExitRuntime=d.noExitRuntime);"object"!==typeof WebAssembly&&A("no native wasm support detected");var E,ia=new WebAssembly.Table({initial:270,maximum:270,element:"anyfunc"}),ja=!1,ka="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
|
||||||
|
function la(a,b,c){var e=b+c;for(c=b;a[c]&&!(c>=e);)++c;if(16<c-b&&a.subarray&&ka)return ka.decode(a.subarray(b,c));for(e="";b<c;){var f=a[b++];if(f&128){var g=a[b++]&63;if(192==(f&224))e+=String.fromCharCode((f&31)<<6|g);else{var l=a[b++]&63;f=224==(f&240)?(f&15)<<12|g<<6|l:(f&7)<<18|g<<12|l<<6|a[b++]&63;65536>f?e+=String.fromCharCode(f):(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else e+=String.fromCharCode(f)}return e}
|
||||||
|
function ma(a,b,c){var e=F;if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}if(127>=g){if(b>=c)break;e[b++]=g}else{if(2047>=g){if(b+1>=c)break;e[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;e[b++]=224|g>>12}else{if(b+3>=c)break;e[b++]=240|g>>18;e[b++]=128|g>>12&63}e[b++]=128|g>>6&63}e[b++]=128|g&63}}e[b]=0}}var na="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;
|
||||||
|
function oa(a,b){var c=a>>1;for(var e=c+b/2;!(c>=e)&&G[c];)++c;c<<=1;if(32<c-a&&na)return na.decode(F.subarray(a,c));c=0;for(e="";;){var f=H[a+2*c>>1];if(0==f||c==b/2)return e;++c;e+=String.fromCharCode(f)}}function pa(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var e=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)H[b>>1]=a.charCodeAt(f),b+=2;H[b>>1]=0;return b-e}function qa(a){return 2*a.length}
|
||||||
|
function ra(a,b){for(var c=0,e="";!(c>=b/4);){var f=I[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023)):e+=String.fromCharCode(f)}return e}function sa(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var e=b;c=e+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}I[b>>2]=g;b+=4;if(b+4>c)break}I[b>>2]=0;return b-e}
|
||||||
|
function ta(a){for(var b=0,c=0;c<a.length;++c){var e=a.charCodeAt(c);55296<=e&&57343>=e&&++c;b+=4}return b}var J,ua,F,H,G,I,L,va,wa;function xa(a){J=a;d.HEAP8=ua=new Int8Array(a);d.HEAP16=H=new Int16Array(a);d.HEAP32=I=new Int32Array(a);d.HEAPU8=F=new Uint8Array(a);d.HEAPU16=G=new Uint16Array(a);d.HEAPU32=L=new Uint32Array(a);d.HEAPF32=va=new Float32Array(a);d.HEAPF64=wa=new Float64Array(a)}var ya=d.INITIAL_MEMORY||16777216;d.wasmMemory?E=d.wasmMemory:E=new WebAssembly.Memory({initial:ya/65536,maximum:32768});
|
||||||
|
E&&(J=E.buffer);ya=J.byteLength;xa(J);I[32956]=5374864;function M(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(d);else{var c=b.ea;"number"===typeof c?void 0===b.$?d.dynCall_v(c):d.dynCall_vi(c,b.$):c(void 0===b.$?null:b.$)}}}var za=[],Aa=[],Ba=[],Ca=[];function Da(){var a=d.preRun.shift();za.unshift(a)}var Ea=Math.ceil,Fa=Math.floor,N=0,Ga=null,O=null;d.preloadedImages={};d.preloadedAudios={};
|
||||||
|
function A(a){if(d.onAbort)d.onAbort(a);B(a);ja=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");ba(a);throw a;}function Ha(a){var b=Q;return String.prototype.startsWith?b.startsWith(a):0===b.indexOf(a)}function Ia(){return Ha("data:application/octet-stream;base64,")}var Q="wp2_dec.wasm";if(!Ia()){var Ja=Q;Q=d.locateFile?d.locateFile(Ja,w):w+Ja}
|
||||||
|
function Ka(){try{if(D)return new Uint8Array(D);if(z)return z(Q);throw"both async and sync fetching of the wasm failed";}catch(a){A(a)}}function La(){return D||!u&&!v||"function"!==typeof fetch||Ha("file://")?new Promise(function(a){a(Ka())}):fetch(Q,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+Q+"'";return a.arrayBuffer()}).catch(function(){return Ka()})}Aa.push({ea:function(){Ma()}});function R(){return 0<R.ba}
|
||||||
|
function Na(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var Oa=void 0;function S(a){for(var b="";F[a];)b+=Oa[F[a++]];return b}var T={},U={},V={};function Pa(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}
|
||||||
|
function Qa(a,b){a=Pa(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function Ra(a){var b=Error,c=Qa(a,function(e){this.name=a;this.message=e;e=Error(e).stack;void 0!==e&&(this.stack=this.toString()+"\n"+e.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}
|
||||||
|
var Sa=void 0;function W(a){throw new Sa(a);}var Ta=void 0;function Ua(a,b){function c(k){k=b(k);if(k.length!==e.length)throw new Ta("Mismatched type converter count");for(var h=0;h<e.length;++h)X(e[h],k[h])}var e=[];e.forEach(function(k){V[k]=a});var f=Array(a.length),g=[],l=0;a.forEach(function(k,h){U.hasOwnProperty(k)?f[h]=U[k]:(g.push(k),T.hasOwnProperty(k)||(T[k]=[]),T[k].push(function(){f[h]=U[k];++l;l===g.length&&c(f)}))});0===g.length&&c(f)}
|
||||||
|
function X(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var e=b.name;a||W('type "'+e+'" must have a positive integer typeid pointer');if(U.hasOwnProperty(a)){if(c.fa)return;W("Cannot register type '"+e+"' twice")}U[a]=b;delete V[a];T.hasOwnProperty(a)&&(b=T[a],delete T[a],b.forEach(function(f){f()}))}var Va=[],Y=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||||
|
function Wa(a){4<a&&0===--Y[a].aa&&(Y[a]=void 0,Va.push(a))}function Za(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Va.length?Va.pop():Y.length;Y[b]={aa:1,value:a};return b}}function $a(a){return this.fromWireType(L[a>>2])}function ab(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
||||||
|
function bb(a,b){switch(b){case 2:return function(c){return this.fromWireType(va[c>>2])};case 3:return function(c){return this.fromWireType(wa[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function cb(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Qa(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
||||||
|
function db(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function eb(a,b){var c=d;if(void 0===c[a].Y){var e=c[a];c[a]=function(){c[a].Y.hasOwnProperty(arguments.length)||W("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].Y+")!");return c[a].Y[arguments.length].apply(this,arguments)};c[a].Y=[];c[a].Y[e.da]=e}}
|
||||||
|
function fb(a,b,c){d.hasOwnProperty(a)?((void 0===c||void 0!==d[a].Y&&void 0!==d[a].Y[c])&&W("Cannot register public name '"+a+"' twice"),eb(a,a),d.hasOwnProperty(c)&&W("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),d[a].Y[c]=b):(d[a]=b,void 0!==c&&(d[a].ha=c))}function gb(a,b){for(var c=[],e=0;e<a;e++)c.push(I[(b>>2)+e]);return c}
|
||||||
|
function hb(a,b){a=S(a);var c=d["dynCall_"+a];for(var e=[],f=1;f<a.length;++f)e.push("a"+f);f="return function dynCall_"+(a+"_"+b)+"("+e.join(", ")+") {\n";f+=" return dynCall(rawFunction"+(e.length?", ":"")+e.join(", ")+");\n";c=(new Function("dynCall","rawFunction",f+"};\n"))(c,b);"function"!==typeof c&&W("unknown function pointer with signature "+a+": "+b);return c}var ib=void 0;function jb(a){a=kb(a);var b=S(a);Z(a);return b}
|
||||||
|
function lb(a,b){function c(g){f[g]||U[g]||(V[g]?V[g].forEach(c):(e.push(g),f[g]=!0))}var e=[],f={};b.forEach(c);throw new ib(a+": "+e.map(jb).join([", "]));}function mb(a,b,c){switch(b){case 0:return c?function(e){return ua[e]}:function(e){return F[e]};case 1:return c?function(e){return H[e>>1]}:function(e){return G[e>>1]};case 2:return c?function(e){return I[e>>2]}:function(e){return L[e>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var nb={};
|
||||||
|
function ob(){return"object"===typeof globalThis?globalThis:Function("return this")()}function pb(a,b){var c=U[a];void 0===c&&W(b+" has unknown type "+jb(a));return c}for(var qb={},rb=[null,[],[]],sb=Array(256),tb=0;256>tb;++tb)sb[tb]=String.fromCharCode(tb);Oa=sb;Sa=d.BindingError=Ra("BindingError");Ta=d.InternalError=Ra("InternalError");d.count_emval_handles=function(){for(var a=0,b=5;b<Y.length;++b)void 0!==Y[b]&&++a;return a};
|
||||||
|
d.get_first_emval=function(){for(var a=5;a<Y.length;++a)if(void 0!==Y[a])return Y[a];return null};ib=d.UnboundTypeError=Ra("UnboundTypeError");
|
||||||
|
var vb={t:function(a){return ub(a)},g:function(){},s:function(a){"uncaught_exception"in R?R.ba++:R.ba=1;throw a;},y:function(a,b,c,e,f){var g=Na(c);b=S(b);X(a,{name:b,fromWireType:function(l){return!!l},toWireType:function(l,k){return k?e:f},argPackAdvance:8,readValueFromPointer:function(l){if(1===c)var k=ua;else if(2===c)k=H;else if(4===c)k=I;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[l>>g])},Z:null})},x:function(a,b){b=S(b);X(a,{name:b,fromWireType:function(c){var e=
|
||||||
|
Y[c].value;Wa(c);return e},toWireType:function(c,e){return Za(e)},argPackAdvance:8,readValueFromPointer:$a,Z:null})},n:function(a,b,c){c=Na(c);b=S(b);X(a,{name:b,fromWireType:function(e){return e},toWireType:function(e,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+ab(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:bb(b,c),Z:null})},u:function(a,b,c,e,f,g){var l=gb(b,c);a=S(a);f=hb(e,f);fb(a,function(){lb("Cannot call "+a+" due to unbound types",
|
||||||
|
l)},b-1);Ua(l,function(k){var h=[k[0],null].concat(k.slice(1)),n=k=a,p=f,q=h.length;2>q&&W("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var y=null!==h[1]&&!1,C=!1,m=1;m<h.length;++m)if(null!==h[m]&&void 0===h[m].Z){C=!0;break}var Xa="void"!==h[0].name,K="",P="";for(m=0;m<q-2;++m)K+=(0!==m?", ":"")+"arg"+m,P+=(0!==m?", ":"")+"arg"+m+"Wired";n="return function "+Pa(n)+"("+K+") {\nif (arguments.length !== "+(q-2)+") {\nthrowBindingError('function "+n+" called with ' + arguments.length + ' arguments, expected "+
|
||||||
|
(q-2)+" args!');\n}\n";C&&(n+="var destructors = [];\n");var Ya=C?"destructors":"null";K="throwBindingError invoker fn runDestructors retType classParam".split(" ");p=[W,p,g,db,h[0],h[1]];y&&(n+="var thisWired = classParam.toWireType("+Ya+", this);\n");for(m=0;m<q-2;++m)n+="var arg"+m+"Wired = argType"+m+".toWireType("+Ya+", arg"+m+"); // "+h[m+2].name+"\n",K.push("argType"+m),p.push(h[m+2]);y&&(P="thisWired"+(0<P.length?", ":"")+P);n+=(Xa?"var rv = ":"")+"invoker(fn"+(0<P.length?", ":"")+P+");\n";
|
||||||
|
if(C)n+="runDestructors(destructors);\n";else for(m=y?1:2;m<h.length;++m)q=1===m?"thisWired":"arg"+(m-2)+"Wired",null!==h[m].Z&&(n+=q+"_dtor("+q+"); // "+h[m].name+"\n",K.push(q+"_dtor"),p.push(h[m].Z));Xa&&(n+="var ret = retType.fromWireType(rv);\nreturn ret;\n");K.push(n+"}\n");h=cb(K).apply(null,p);m=b-1;if(!d.hasOwnProperty(k))throw new Ta("Replacing nonexistant public symbol");void 0!==d[k].Y&&void 0!==m?d[k].Y[m]=h:(d[k]=h,d[k].da=m);return[]})},b:function(a,b,c,e,f){function g(n){return n}
|
||||||
|
b=S(b);-1===f&&(f=4294967295);var l=Na(c);if(0===e){var k=32-8*c;g=function(n){return n<<k>>>k}}var h=-1!=b.indexOf("unsigned");X(a,{name:b,fromWireType:g,toWireType:function(n,p){if("number"!==typeof p&&"boolean"!==typeof p)throw new TypeError('Cannot convert "'+ab(p)+'" to '+this.name);if(p<e||p>f)throw new TypeError('Passing a number "'+ab(p)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+e+", "+f+"]!");return h?p>>>0:p|0},argPackAdvance:8,readValueFromPointer:mb(b,
|
||||||
|
l,0!==e),Z:null})},a:function(a,b,c){function e(g){g>>=2;var l=L;return new f(J,l[g+1],l[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=S(c);X(a,{name:c,fromWireType:e,argPackAdvance:8,readValueFromPointer:e},{fa:!0})},o:function(a,b){b=S(b);var c="std::string"===b;X(a,{name:b,fromWireType:function(e){var f=L[e>>2];if(c)for(var g=e+4,l=0;l<=f;++l){var k=e+4+l;if(l==f||0==F[k]){g=g?la(F,g,k-g):"";if(void 0===h)var h=g;else h+=String.fromCharCode(0),
|
||||||
|
h+=g;g=k+1}}else{h=Array(f);for(l=0;l<f;++l)h[l]=String.fromCharCode(F[e+4+l]);h=h.join("")}Z(e);return h},toWireType:function(e,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||W("Cannot pass non-string to std::string");var l=(c&&g?function(){for(var n=0,p=0;p<f.length;++p){var q=f.charCodeAt(p);55296<=q&&57343>=q&&(q=65536+((q&1023)<<10)|f.charCodeAt(++p)&1023);127>=q?++n:n=2047>=q?n+
|
||||||
|
2:65535>=q?n+3:n+4}return n}:function(){return f.length})(),k=ub(4+l+1);L[k>>2]=l;if(c&&g)ma(f,k+4,l+1);else if(g)for(g=0;g<l;++g){var h=f.charCodeAt(g);255<h&&(Z(k),W("String has UTF-16 code units that do not fit in 8 bits"));F[k+4+g]=h}else for(g=0;g<l;++g)F[k+4+g]=f[g];null!==e&&e.push(Z,k);return k},argPackAdvance:8,readValueFromPointer:$a,Z:function(e){Z(e)}})},h:function(a,b,c){c=S(c);if(2===b){var e=oa;var f=pa;var g=qa;var l=function(){return G};var k=1}else 4===b&&(e=ra,f=sa,g=ta,l=function(){return L},
|
||||||
|
k=2);X(a,{name:c,fromWireType:function(h){for(var n=L[h>>2],p=l(),q,y=h+4,C=0;C<=n;++C){var m=h+4+C*b;if(C==n||0==p[m>>k])y=e(y,m-y),void 0===q?q=y:(q+=String.fromCharCode(0),q+=y),y=m+b}Z(h);return q},toWireType:function(h,n){"string"!==typeof n&&W("Cannot pass non-string to C++ string type "+c);var p=g(n),q=ub(4+p+b);L[q>>2]=p>>k;f(n,q+4,p+b);null!==h&&h.push(Z,q);return q},argPackAdvance:8,readValueFromPointer:$a,Z:function(h){Z(h)}})},z:function(a,b){b=S(b);X(a,{ga:!0,name:b,argPackAdvance:0,
|
||||||
|
fromWireType:function(){},toWireType:function(){}})},e:Wa,f:function(a){if(0===a)return Za(ob());var b=nb[a];a=void 0===b?S(a):b;return Za(ob()[a])},i:function(a){4<a&&(Y[a].aa+=1)},j:function(a,b,c,e){a||W("Cannot use deleted val. handle = "+a);a=Y[a].value;var f=qb[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var l="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)l+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+
|
||||||
|
g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",l+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(pb,d,Za);qb[b]=f}return f(a,c,e)},l:function(){A()},w:function(a,b,c){F.copyWithin(a,b,b+c)},c:function(a){a>>>=0;var b=F.length;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var e=b*(1+.2/c);e=Math.min(e,a+100663296);e=Math.max(16777216,
|
||||||
|
a,e);0<e%65536&&(e+=65536-e%65536);a:{try{E.grow(Math.min(2147483648,e)-J.byteLength+65535>>>16);xa(E.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},m:function(a,b,c,e){for(var f=0,g=0;g<c;g++){for(var l=I[b+8*g>>2],k=I[b+(8*g+4)>>2],h=0;h<k;h++){var n=F[l+h],p=rb[a];0===n||10===n?((1===a?ha:B)(la(p,0)),p.length=0):p.push(n)}f+=k}I[e>>2]=f;return 0},memory:E,p:function(){return 0},r:function(){return 0},q:function(){},B:function(){return 6},A:function(){},k:function(a){a=+a;return 0<=
|
||||||
|
a?+Fa(a+.5):+Ea(a-.5)},d:function(a){a=+a;return 0<=a?+Fa(a+.5):+Ea(a-.5)},v:function(){},table:ia};
|
||||||
|
(function(){function a(f){d.asm=f.exports;N--;d.monitorRunDependencies&&d.monitorRunDependencies(N);0==N&&(null!==Ga&&(clearInterval(Ga),Ga=null),O&&(f=O,O=null,f()))}function b(f){a(f.instance)}function c(f){return La().then(function(g){return WebAssembly.instantiate(g,e)}).then(f,function(g){B("failed to asynchronously prepare wasm: "+g);A(g)})}var e={a:vb};N++;d.monitorRunDependencies&&d.monitorRunDependencies(N);if(d.instantiateWasm)try{return d.instantiateWasm(e,a)}catch(f){return B("Module.instantiateWasm callback failed with error: "+
|
||||||
|
f),!1}(function(){if(D||"function"!==typeof WebAssembly.instantiateStreaming||Ia()||Ha("file://")||"function"!==typeof fetch)return c(b);fetch(Q,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(b,function(g){B("wasm streaming compile failed: "+g);B("falling back to ArrayBuffer instantiation");return c(b)})})})();return{}})();
|
||||||
|
var Ma=d.___wasm_call_ctors=function(){return(Ma=d.___wasm_call_ctors=d.asm.C).apply(null,arguments)},ub=d._malloc=function(){return(ub=d._malloc=d.asm.D).apply(null,arguments)},Z=d._free=function(){return(Z=d._free=d.asm.E).apply(null,arguments)},kb=d.___getTypeName=function(){return(kb=d.___getTypeName=d.asm.F).apply(null,arguments)};d.___embind_register_native_and_builtin_types=function(){return(d.___embind_register_native_and_builtin_types=d.asm.G).apply(null,arguments)};
|
||||||
|
d.dynCall_iii=function(){return(d.dynCall_iii=d.asm.H).apply(null,arguments)};d.dynCall_vii=function(){return(d.dynCall_vii=d.asm.I).apply(null,arguments)};d.dynCall_vi=function(){return(d.dynCall_vi=d.asm.J).apply(null,arguments)};d.dynCall_viii=function(){return(d.dynCall_viii=d.asm.K).apply(null,arguments)};d.dynCall_viiiiiiii=function(){return(d.dynCall_viiiiiiii=d.asm.L).apply(null,arguments)};d.dynCall_ii=function(){return(d.dynCall_ii=d.asm.M).apply(null,arguments)};
|
||||||
|
d.dynCall_viiiiiii=function(){return(d.dynCall_viiiiiii=d.asm.N).apply(null,arguments)};d.dynCall_viiiiiiiii=function(){return(d.dynCall_viiiiiiiii=d.asm.O).apply(null,arguments)};d.dynCall_viiii=function(){return(d.dynCall_viiii=d.asm.P).apply(null,arguments)};d.dynCall_viiiiii=function(){return(d.dynCall_viiiiii=d.asm.Q).apply(null,arguments)};d.dynCall_iidiiii=function(){return(d.dynCall_iidiiii=d.asm.R).apply(null,arguments)};d.dynCall_v=function(){return(d.dynCall_v=d.asm.S).apply(null,arguments)};
|
||||||
|
d.dynCall_viiiii=function(){return(d.dynCall_viiiii=d.asm.T).apply(null,arguments)};d.dynCall_iiiiii=function(){return(d.dynCall_iiiiii=d.asm.U).apply(null,arguments)};d.dynCall_iiii=function(){return(d.dynCall_iiii=d.asm.V).apply(null,arguments)};d.dynCall_iiiii=function(){return(d.dynCall_iiiii=d.asm.W).apply(null,arguments)};d.dynCall_jiji=function(){return(d.dynCall_jiji=d.asm.X).apply(null,arguments)};var wb;O=function xb(){wb||yb();wb||(O=xb)};
|
||||||
|
function yb(){function a(){if(!wb&&(wb=!0,d.calledRun=!0,!ja)){M(Aa);M(Ba);aa(d);if(d.onRuntimeInitialized)d.onRuntimeInitialized();if(d.postRun)for("function"==typeof d.postRun&&(d.postRun=[d.postRun]);d.postRun.length;){var b=d.postRun.shift();Ca.unshift(b)}M(Ca)}}if(!(0<N)){if(d.preRun)for("function"==typeof d.preRun&&(d.preRun=[d.preRun]);d.preRun.length;)Da();M(za);0<N||(d.setStatus?(d.setStatus("Running..."),setTimeout(function(){setTimeout(function(){d.setStatus("")},1);a()},1)):a())}}
|
||||||
|
d.run=yb;if(d.preInit)for("function"==typeof d.preInit&&(d.preInit=[d.preInit]);0<d.preInit.length;)d.preInit.pop()();noExitRuntime=!0;yb();
|
||||||
|
|
||||||
|
|
||||||
|
return wp2_dec.ready
|
||||||
|
}
|
||||||
|
);
|
||||||
|
})();
|
||||||
|
if (typeof exports === 'object' && typeof module === 'object')
|
||||||
|
module.exports = wp2_dec;
|
||||||
|
else if (typeof define === 'function' && define['amd'])
|
||||||
|
define([], function() { return wp2_dec; });
|
||||||
|
else if (typeof exports === 'object')
|
||||||
|
exports["wp2_dec"] = wp2_dec;
|
||||||
|
|
||||||
BIN
codecs/wp2/dec/wp2_dec.wasm
Normal file
BIN
codecs/wp2/dec/wp2_dec.wasm
Normal file
Binary file not shown.
17
codecs/wp2/enc/README.md
Normal file
17
codecs/wp2/enc/README.md
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# WebP2 encoder
|
||||||
|
|
||||||
|
- Source: <https://chromium.googlesource.com/codecs/libwebp2>
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
- Docker
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
N/A
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### `UInt8Array encode(uint8_t* image_buffer, int image_width, int image_height, WP2::EncoderConfig config)`
|
||||||
|
|
||||||
|
Encodes the given image with given dimension to WebP2.
|
||||||
38
codecs/wp2/enc/wp2_enc.cpp
Normal file
38
codecs/wp2/enc/wp2_enc.cpp
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
#include <emscripten/bind.h>
|
||||||
|
#include <emscripten/val.h>
|
||||||
|
#include <cstdio>
|
||||||
|
#include "src/wp2/encode.h"
|
||||||
|
|
||||||
|
using namespace emscripten;
|
||||||
|
|
||||||
|
thread_local const val Uint8Array = val::global("Uint8Array");
|
||||||
|
|
||||||
|
val encode(std::string image_in, int image_width, int image_height, WP2::EncoderConfig config) {
|
||||||
|
uint8_t* image_buffer = (uint8_t*)image_in.c_str();
|
||||||
|
WP2::ArgbBuffer src = WP2::ArgbBuffer();
|
||||||
|
WP2Status status =
|
||||||
|
src.Import(WP2_rgbA_32, // Format. WP2_RGBA_32 is the same but NOT premultiplied alpha
|
||||||
|
image_width, image_height, image_buffer, 4 * image_width);
|
||||||
|
if (status != WP2_STATUS_OK) {
|
||||||
|
return val::null();
|
||||||
|
}
|
||||||
|
|
||||||
|
WP2::MemoryWriter memory_writer;
|
||||||
|
status = WP2::Encode(src, &memory_writer, config);
|
||||||
|
if (status != WP2_STATUS_OK) {
|
||||||
|
return val::null();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Uint8Array.new_(typed_memory_view(memory_writer.size_, memory_writer.mem_));
|
||||||
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_BINDINGS(my_module) {
|
||||||
|
value_object<WP2::EncoderConfig>("WP2EncoderConfig")
|
||||||
|
.field("quality", &WP2::EncoderConfig::quality)
|
||||||
|
.field("alpha_quality", &WP2::EncoderConfig::alpha_quality)
|
||||||
|
.field("speed", &WP2::EncoderConfig::speed)
|
||||||
|
.field("pass", &WP2::EncoderConfig::pass)
|
||||||
|
.field("sns", &WP2::EncoderConfig::sns);
|
||||||
|
|
||||||
|
function("encode", &encode);
|
||||||
|
}
|
||||||
7
codecs/wp2/enc/wp2_enc.d.ts
vendored
Normal file
7
codecs/wp2/enc/wp2_enc.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { EncodeOptions } from '../../../src/codecs/wp2/encoder-meta';
|
||||||
|
|
||||||
|
interface WP2Module extends EmscriptenWasm.Module {
|
||||||
|
encode(data: BufferSource, width: number, height: number, options: EncodeOptions): Uint8Array | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function(opts: EmscriptenWasm.ModuleOpts): Promise<WP2Module>;
|
||||||
73
codecs/wp2/enc/wp2_enc.js
Normal file
73
codecs/wp2/enc/wp2_enc.js
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
|
||||||
|
var wp2_enc = (function() {
|
||||||
|
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
|
||||||
|
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
|
||||||
|
return (
|
||||||
|
function(wp2_enc) {
|
||||||
|
wp2_enc = wp2_enc || {};
|
||||||
|
|
||||||
|
|
||||||
|
var c;c||(c=typeof wp2_enc !== 'undefined' ? wp2_enc : {});var aa,ba;c.ready=new Promise(function(a,b){aa=a;ba=b});var r={},t;for(t in c)c.hasOwnProperty(t)&&(r[t]=c[t]);var u=!1,v=!1,ca=!1,da=!1;u="object"===typeof window;v="function"===typeof importScripts;ca="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;da=!u&&!ca&&!v;var w="",y,B,ea,fa;
|
||||||
|
if(ca)w=v?require("path").dirname(w)+"/":__dirname+"/",y=function(a,b){ea||(ea=require("fs"));fa||(fa=require("path"));a=fa.normalize(a);return ea.readFileSync(a,b?null:"utf8")},B=function(a){a=y(a,!0);a.buffer||(a=new Uint8Array(a));a.buffer||C("Assertion failed: undefined");return a},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(a){throw a;}),process.on("unhandledRejection",C),c.inspect=function(){return"[Emscripten Module object]"};
|
||||||
|
else if(da)"undefined"!=typeof read&&(y=function(a){return read(a)}),B=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");"object"===typeof a||C("Assertion failed: undefined");return a},"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!==typeof printErr?printErr:print);else if(u||v)v?w=self.location.href:document.currentScript&&(w=document.currentScript.src),_scriptDir&&
|
||||||
|
(w=_scriptDir),0!==w.indexOf("blob:")?w=w.substr(0,w.lastIndexOf("/")+1):w="",y=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},v&&(B=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var ha=c.print||console.log.bind(console),D=c.printErr||console.warn.bind(console);for(t in r)r.hasOwnProperty(t)&&(c[t]=r[t]);r=null;var E;c.wasmBinary&&(E=c.wasmBinary);var noExitRuntime;
|
||||||
|
c.noExitRuntime&&(noExitRuntime=c.noExitRuntime);"object"!==typeof WebAssembly&&C("no native wasm support detected");var F,ia=new WebAssembly.Table({initial:432,maximum:432,element:"anyfunc"}),ka=!1,la="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
|
||||||
|
function H(a,b,d){var e=b+d;for(d=b;a[d]&&!(d>=e);)++d;if(16<d-b&&a.subarray&&la)return la.decode(a.subarray(b,d));for(e="";b<d;){var f=a[b++];if(f&128){var g=a[b++]&63;if(192==(f&224))e+=String.fromCharCode((f&31)<<6|g);else{var l=a[b++]&63;f=224==(f&240)?(f&15)<<12|g<<6|l:(f&7)<<18|g<<12|l<<6|a[b++]&63;65536>f?e+=String.fromCharCode(f):(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else e+=String.fromCharCode(f)}return e}
|
||||||
|
function ma(a,b,d){var e=I;if(0<d){d=b+d-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}if(127>=g){if(b>=d)break;e[b++]=g}else{if(2047>=g){if(b+1>=d)break;e[b++]=192|g>>6}else{if(65535>=g){if(b+2>=d)break;e[b++]=224|g>>12}else{if(b+3>=d)break;e[b++]=240|g>>18;e[b++]=128|g>>12&63}e[b++]=128|g>>6&63}e[b++]=128|g&63}}e[b]=0}}var na="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;
|
||||||
|
function oa(a,b){var d=a>>1;for(var e=d+b/2;!(d>=e)&&J[d];)++d;d<<=1;if(32<d-a&&na)return na.decode(I.subarray(a,d));d=0;for(e="";;){var f=K[a+2*d>>1];if(0==f||d==b/2)return e;++d;e+=String.fromCharCode(f)}}function pa(a,b,d){void 0===d&&(d=2147483647);if(2>d)return 0;d-=2;var e=b;d=d<2*a.length?d/2:a.length;for(var f=0;f<d;++f)K[b>>1]=a.charCodeAt(f),b+=2;K[b>>1]=0;return b-e}function qa(a){return 2*a.length}
|
||||||
|
function ra(a,b){for(var d=0,e="";!(d>=b/4);){var f=L[a+4*d>>2];if(0==f)break;++d;65536<=f?(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023)):e+=String.fromCharCode(f)}return e}function sa(a,b,d){void 0===d&&(d=2147483647);if(4>d)return 0;var e=b;d=e+d-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}L[b>>2]=g;b+=4;if(b+4>d)break}L[b>>2]=0;return b-e}
|
||||||
|
function ta(a){for(var b=0,d=0;d<a.length;++d){var e=a.charCodeAt(d);55296<=e&&57343>=e&&++d;b+=4}return b}var M,ua,I,K,J,L,N,va,wa;function xa(a){M=a;c.HEAP8=ua=new Int8Array(a);c.HEAP16=K=new Int16Array(a);c.HEAP32=L=new Int32Array(a);c.HEAPU8=I=new Uint8Array(a);c.HEAPU16=J=new Uint16Array(a);c.HEAPU32=N=new Uint32Array(a);c.HEAPF32=va=new Float32Array(a);c.HEAPF64=wa=new Float64Array(a)}var ya=c.INITIAL_MEMORY||16777216;c.wasmMemory?F=c.wasmMemory:F=new WebAssembly.Memory({initial:ya/65536,maximum:32768});
|
||||||
|
F&&(M=F.buffer);ya=M.byteLength;xa(M);L[35016]=5383104;function za(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(c);else{var d=b.pa;"number"===typeof d?void 0===b.ja?c.dynCall_v(d):c.dynCall_vi(d,b.ja):d(void 0===b.ja?null:b.ja)}}}var Aa=[],Ba=[],Ca=[],Da=[];function Ea(){var a=c.preRun.shift();Aa.unshift(a)}var Fa=Math.ceil,Ga=Math.floor,O=0,Ha=null,P=null;c.preloadedImages={};c.preloadedAudios={};
|
||||||
|
function C(a){if(c.onAbort)c.onAbort(a);D(a);ka=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");ba(a);throw a;}function Ia(a){var b=Q;return String.prototype.startsWith?b.startsWith(a):0===b.indexOf(a)}function Ja(){return Ia("data:application/octet-stream;base64,")}var Q="wp2_enc.wasm";if(!Ja()){var Ka=Q;Q=c.locateFile?c.locateFile(Ka,w):w+Ka}
|
||||||
|
function La(){try{if(E)return new Uint8Array(E);if(B)return B(Q);throw"both async and sync fetching of the wasm failed";}catch(a){C(a)}}function Ma(){return E||!u&&!v||"function"!==typeof fetch||Ia("file://")?new Promise(function(a){a(La())}):fetch(Q,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+Q+"'";return a.arrayBuffer()}).catch(function(){return La()})}Ba.push({pa:function(){Na()}});function Oa(){return 0<Oa.ma}var Pa={};
|
||||||
|
function Qa(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Ra(a){return this.fromWireType(N[a>>2])}var R={},S={},Sa={};function Ta(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}function Ua(a,b){a=Ta(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}
|
||||||
|
function Va(a){var b=Error,d=Ua(a,function(e){this.name=a;this.message=e;e=Error(e).stack;void 0!==e&&(this.stack=this.toString()+"\n"+e.replace(/^Error(:[^\n]*)?\n/,""))});d.prototype=Object.create(b.prototype);d.prototype.constructor=d;d.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return d}var Wa=void 0;
|
||||||
|
function Xa(a,b,d){function e(k){k=d(k);if(k.length!==a.length)throw new Wa("Mismatched type converter count");for(var h=0;h<a.length;++h)T(a[h],k[h])}a.forEach(function(k){Sa[k]=b});var f=Array(b.length),g=[],l=0;b.forEach(function(k,h){S.hasOwnProperty(k)?f[h]=S[k]:(g.push(k),R.hasOwnProperty(k)||(R[k]=[]),R[k].push(function(){f[h]=S[k];++l;l===g.length&&e(f)}))});0===g.length&&e(f)}
|
||||||
|
function Ya(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var Za=void 0;function U(a){for(var b="";I[a];)b+=Za[I[a++]];return b}var $a=void 0;function V(a){throw new $a(a);}
|
||||||
|
function T(a,b,d){d=d||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var e=b.name;a||V('type "'+e+'" must have a positive integer typeid pointer');if(S.hasOwnProperty(a)){if(d.ta)return;V("Cannot register type '"+e+"' twice")}S[a]=b;delete Sa[a];R.hasOwnProperty(a)&&(b=R[a],delete R[a],b.forEach(function(f){f()}))}var ab=[],X=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||||
|
function bb(a){4<a&&0===--X[a].ka&&(X[a]=void 0,ab.push(a))}function cb(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=ab.length?ab.pop():X.length;X[b]={ka:1,value:a};return b}}function db(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
||||||
|
function eb(a,b){switch(b){case 2:return function(d){return this.fromWireType(va[d>>2])};case 3:return function(d){return this.fromWireType(wa[d>>3])};default:throw new TypeError("Unknown float type: "+a);}}function fb(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var d=Ua(b.name||"unknownFunctionName",function(){});d.prototype=b.prototype;d=new d;a=b.apply(d,a);return a instanceof Object?a:d}
|
||||||
|
function gb(a,b){var d=c;if(void 0===d[a].ha){var e=d[a];d[a]=function(){d[a].ha.hasOwnProperty(arguments.length)||V("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+d[a].ha+")!");return d[a].ha[arguments.length].apply(this,arguments)};d[a].ha=[];d[a].ha[e.na]=e}}
|
||||||
|
function hb(a,b,d){c.hasOwnProperty(a)?((void 0===d||void 0!==c[a].ha&&void 0!==c[a].ha[d])&&V("Cannot register public name '"+a+"' twice"),gb(a,a),c.hasOwnProperty(d)&&V("Cannot register multiple overloads of a function with the same number of arguments ("+d+")!"),c[a].ha[d]=b):(c[a]=b,void 0!==d&&(c[a].Aa=d))}function ib(a,b){for(var d=[],e=0;e<a;e++)d.push(L[(b>>2)+e]);return d}
|
||||||
|
function Y(a,b){a=U(a);var d=c["dynCall_"+a];for(var e=[],f=1;f<a.length;++f)e.push("a"+f);f="return function dynCall_"+(a+"_"+b)+"("+e.join(", ")+") {\n";f+=" return dynCall(rawFunction"+(e.length?", ":"")+e.join(", ")+");\n";d=(new Function("dynCall","rawFunction",f+"};\n"))(d,b);"function"!==typeof d&&V("unknown function pointer with signature "+a+": "+b);return d}var jb=void 0;function kb(a){a=lb(a);var b=U(a);Z(a);return b}
|
||||||
|
function mb(a,b){function d(g){f[g]||S[g]||(Sa[g]?Sa[g].forEach(d):(e.push(g),f[g]=!0))}var e=[],f={};b.forEach(d);throw new jb(a+": "+e.map(kb).join([", "]));}function nb(a,b,d){switch(b){case 0:return d?function(e){return ua[e]}:function(e){return I[e]};case 1:return d?function(e){return K[e>>1]}:function(e){return J[e>>1]};case 2:return d?function(e){return L[e>>2]}:function(e){return N[e>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var ob={};
|
||||||
|
function pb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function qb(a,b){var d=S[a];void 0===d&&V(b+" has unknown type "+kb(a));return d}var rb={},sb=[null,[],[]];Wa=c.InternalError=Va("InternalError");for(var tb=Array(256),ub=0;256>ub;++ub)tb[ub]=String.fromCharCode(ub);Za=tb;$a=c.BindingError=Va("BindingError");c.count_emval_handles=function(){for(var a=0,b=5;b<X.length;++b)void 0!==X[b]&&++a;return a};
|
||||||
|
c.get_first_emval=function(){for(var a=5;a<X.length;++a)if(void 0!==X[a])return X[a];return null};jb=c.UnboundTypeError=Va("UnboundTypeError");
|
||||||
|
var wb={q:function(a,b,d,e){C("Assertion failed: "+(a?H(I,a,void 0):"")+", at: "+[b?b?H(I,b,void 0):"":"unknown filename",d,e?e?H(I,e,void 0):"":"unknown function"])},B:function(a){return vb(a)},H:function(){},A:function(a){"uncaught_exception"in Oa?Oa.ma++:Oa.ma=1;throw a;},p:function(a){var b=Pa[a];delete Pa[a];var d=b.ua,e=b.va,f=b.la,g=f.map(function(l){return l.sa}).concat(f.map(function(l){return l.xa}));Xa([a],g,function(l){var k={};f.forEach(function(h,m){var n=l[m],q=h.qa,x=h.ra,z=l[m+f.length],
|
||||||
|
p=h.wa,ja=h.ya;k[h.oa]={read:function(A){return n.fromWireType(q(x,A))},write:function(A,G){var W=[];p(ja,A,z.toWireType(W,G));Qa(W)}}});return[{name:b.name,fromWireType:function(h){var m={},n;for(n in k)m[n]=k[n].read(h);e(h);return m},toWireType:function(h,m){for(var n in k)if(!(n in m))throw new TypeError('Missing field: "'+n+'"');var q=d();for(n in k)k[n].write(q,m[n]);null!==h&&h.push(e,q);return q},argPackAdvance:8,readValueFromPointer:Ra,ia:e}]})},y:function(a,b,d,e,f){var g=Ya(d);b=U(b);
|
||||||
|
T(a,{name:b,fromWireType:function(l){return!!l},toWireType:function(l,k){return k?e:f},argPackAdvance:8,readValueFromPointer:function(l){if(1===d)var k=ua;else if(2===d)k=K;else if(4===d)k=L;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[l>>g])},ia:null})},x:function(a,b){b=U(b);T(a,{name:b,fromWireType:function(d){var e=X[d].value;bb(d);return e},toWireType:function(d,e){return cb(e)},argPackAdvance:8,readValueFromPointer:Ra,ia:null})},j:function(a,b,d){d=Ya(d);
|
||||||
|
b=U(b);T(a,{name:b,fromWireType:function(e){return e},toWireType:function(e,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+db(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:eb(b,d),ia:null})},o:function(a,b,d,e,f,g){var l=ib(b,d);a=U(a);f=Y(e,f);hb(a,function(){mb("Cannot call "+a+" due to unbound types",l)},b-1);Xa([],l,function(k){var h=[k[0],null].concat(k.slice(1)),m=k=a,n=f,q=h.length;2>q&&V("argTypes array size mismatch! Must at least get return value and 'this' types!");
|
||||||
|
for(var x=null!==h[1]&&!1,z=!1,p=1;p<h.length;++p)if(null!==h[p]&&void 0===h[p].ia){z=!0;break}var ja="void"!==h[0].name,A="",G="";for(p=0;p<q-2;++p)A+=(0!==p?", ":"")+"arg"+p,G+=(0!==p?", ":"")+"arg"+p+"Wired";m="return function "+Ta(m)+"("+A+") {\nif (arguments.length !== "+(q-2)+") {\nthrowBindingError('function "+m+" called with ' + arguments.length + ' arguments, expected "+(q-2)+" args!');\n}\n";z&&(m+="var destructors = [];\n");var W=z?"destructors":"null";A="throwBindingError invoker fn runDestructors retType classParam".split(" ");
|
||||||
|
n=[V,n,g,Qa,h[0],h[1]];x&&(m+="var thisWired = classParam.toWireType("+W+", this);\n");for(p=0;p<q-2;++p)m+="var arg"+p+"Wired = argType"+p+".toWireType("+W+", arg"+p+"); // "+h[p+2].name+"\n",A.push("argType"+p),n.push(h[p+2]);x&&(G="thisWired"+(0<G.length?", ":"")+G);m+=(ja?"var rv = ":"")+"invoker(fn"+(0<G.length?", ":"")+G+");\n";if(z)m+="runDestructors(destructors);\n";else for(p=x?1:2;p<h.length;++p)q=1===p?"thisWired":"arg"+(p-2)+"Wired",null!==h[p].ia&&(m+=q+"_dtor("+q+"); // "+h[p].name+
|
||||||
|
"\n",A.push(q+"_dtor"),n.push(h[p].ia));ja&&(m+="var ret = retType.fromWireType(rv);\nreturn ret;\n");A.push(m+"}\n");h=fb(A).apply(null,n);p=b-1;if(!c.hasOwnProperty(k))throw new Wa("Replacing nonexistant public symbol");void 0!==c[k].ha&&void 0!==p?c[k].ha[p]=h:(c[k]=h,c[k].na=p);return[]})},b:function(a,b,d,e,f){function g(m){return m}b=U(b);-1===f&&(f=4294967295);var l=Ya(d);if(0===e){var k=32-8*d;g=function(m){return m<<k>>>k}}var h=-1!=b.indexOf("unsigned");T(a,{name:b,fromWireType:g,toWireType:function(m,
|
||||||
|
n){if("number"!==typeof n&&"boolean"!==typeof n)throw new TypeError('Cannot convert "'+db(n)+'" to '+this.name);if(n<e||n>f)throw new TypeError('Passing a number "'+db(n)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+e+", "+f+"]!");return h?n>>>0:n|0},argPackAdvance:8,readValueFromPointer:nb(b,l,0!==e),ia:null})},a:function(a,b,d){function e(g){g>>=2;var l=N;return new f(M,l[g+1],l[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,
|
||||||
|
Uint32Array,Float32Array,Float64Array][b];d=U(d);T(a,{name:d,fromWireType:e,argPackAdvance:8,readValueFromPointer:e},{ta:!0})},l:function(a,b){b=U(b);var d="std::string"===b;T(a,{name:b,fromWireType:function(e){var f=N[e>>2];if(d)for(var g=e+4,l=0;l<=f;++l){var k=e+4+l;if(l==f||0==I[k]){g=g?H(I,g,k-g):"";if(void 0===h)var h=g;else h+=String.fromCharCode(0),h+=g;g=k+1}}else{h=Array(f);for(l=0;l<f;++l)h[l]=String.fromCharCode(I[e+4+l]);h=h.join("")}Z(e);return h},toWireType:function(e,f){f instanceof
|
||||||
|
ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||V("Cannot pass non-string to std::string");var l=(d&&g?function(){for(var m=0,n=0;n<f.length;++n){var q=f.charCodeAt(n);55296<=q&&57343>=q&&(q=65536+((q&1023)<<10)|f.charCodeAt(++n)&1023);127>=q?++m:m=2047>=q?m+2:65535>=q?m+3:m+4}return m}:function(){return f.length})(),k=vb(4+l+1);N[k>>2]=l;if(d&&g)ma(f,k+4,l+1);else if(g)for(g=0;g<l;++g){var h=f.charCodeAt(g);
|
||||||
|
255<h&&(Z(k),V("String has UTF-16 code units that do not fit in 8 bits"));I[k+4+g]=h}else for(g=0;g<l;++g)I[k+4+g]=f[g];null!==e&&e.push(Z,k);return k},argPackAdvance:8,readValueFromPointer:Ra,ia:function(e){Z(e)}})},f:function(a,b,d){d=U(d);if(2===b){var e=oa;var f=pa;var g=qa;var l=function(){return J};var k=1}else 4===b&&(e=ra,f=sa,g=ta,l=function(){return N},k=2);T(a,{name:d,fromWireType:function(h){for(var m=N[h>>2],n=l(),q,x=h+4,z=0;z<=m;++z){var p=h+4+z*b;if(z==m||0==n[p>>k])x=e(x,p-x),void 0===
|
||||||
|
q?q=x:(q+=String.fromCharCode(0),q+=x),x=p+b}Z(h);return q},toWireType:function(h,m){"string"!==typeof m&&V("Cannot pass non-string to C++ string type "+d);var n=g(m),q=vb(4+n+b);N[q>>2]=n>>k;f(m,q+4,n+b);null!==h&&h.push(Z,q);return q},argPackAdvance:8,readValueFromPointer:Ra,ia:function(h){Z(h)}})},r:function(a,b,d,e,f,g){Pa[a]={name:U(b),ua:Y(d,e),va:Y(f,g),la:[]}},e:function(a,b,d,e,f,g,l,k,h,m){Pa[a].la.push({oa:U(b),sa:d,qa:Y(e,f),ra:g,xa:l,wa:Y(k,h),ya:m})},z:function(a,b){b=U(b);T(a,{za:!0,
|
||||||
|
name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},k:bb,G:function(a){if(0===a)return cb(pb());var b=ob[a];a=void 0===b?U(a):b;return cb(pb()[a])},n:function(a){4<a&&(X[a].ka+=1)},u:function(a,b,d,e){a||V("Cannot use deleted val. handle = "+a);a=X[a].value;var f=rb[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var l="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)l+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+
|
||||||
|
g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",l+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(qb,c,cb);rb[b]=f}return f(a,d,e)},h:function(){C()},v:function(a,b,d){I.copyWithin(a,b,b+d)},d:function(a){a>>>=0;var b=I.length;if(2147483648<a)return!1;for(var d=1;4>=d;d*=2){var e=b*(1+.2/d);e=Math.min(e,a+100663296);e=Math.max(16777216,
|
||||||
|
a,e);0<e%65536&&(e+=65536-e%65536);a:{try{F.grow(Math.min(2147483648,e)-M.byteLength+65535>>>16);xa(F.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},w:function(){return 0},s:function(){},i:function(a,b,d,e){for(var f=0,g=0;g<d;g++){for(var l=L[b+8*g>>2],k=L[b+(8*g+4)>>2],h=0;h<k;h++){var m=I[l+h],n=sb[a];0===m||10===m?((1===a?ha:D)(H(n,0)),n.length=0):n.push(m)}f+=k}L[e>>2]=f;return 0},memory:F,m:function(){return 0},F:function(){return 0},E:function(){},D:function(){return 6},
|
||||||
|
C:function(){},g:function(a){a=+a;return 0<=a?+Ga(a+.5):+Fa(a-.5)},c:function(a){a=+a;return 0<=a?+Ga(a+.5):+Fa(a-.5)},t:function(){},table:ia};
|
||||||
|
(function(){function a(f){c.asm=f.exports;O--;c.monitorRunDependencies&&c.monitorRunDependencies(O);0==O&&(null!==Ha&&(clearInterval(Ha),Ha=null),P&&(f=P,P=null,f()))}function b(f){a(f.instance)}function d(f){return Ma().then(function(g){return WebAssembly.instantiate(g,e)}).then(f,function(g){D("failed to asynchronously prepare wasm: "+g);C(g)})}var e={a:wb};O++;c.monitorRunDependencies&&c.monitorRunDependencies(O);if(c.instantiateWasm)try{return c.instantiateWasm(e,a)}catch(f){return D("Module.instantiateWasm callback failed with error: "+
|
||||||
|
f),!1}(function(){if(E||"function"!==typeof WebAssembly.instantiateStreaming||Ja()||Ia("file://")||"function"!==typeof fetch)return d(b);fetch(Q,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(b,function(g){D("wasm streaming compile failed: "+g);D("falling back to ArrayBuffer instantiation");return d(b)})})})();return{}})();
|
||||||
|
var Na=c.___wasm_call_ctors=function(){return(Na=c.___wasm_call_ctors=c.asm.I).apply(null,arguments)},vb=c._malloc=function(){return(vb=c._malloc=c.asm.J).apply(null,arguments)},Z=c._free=function(){return(Z=c._free=c.asm.K).apply(null,arguments)},lb=c.___getTypeName=function(){return(lb=c.___getTypeName=c.asm.L).apply(null,arguments)};c.___embind_register_native_and_builtin_types=function(){return(c.___embind_register_native_and_builtin_types=c.asm.M).apply(null,arguments)};
|
||||||
|
c.dynCall_i=function(){return(c.dynCall_i=c.asm.N).apply(null,arguments)};c.dynCall_vi=function(){return(c.dynCall_vi=c.asm.O).apply(null,arguments)};c.dynCall_fii=function(){return(c.dynCall_fii=c.asm.P).apply(null,arguments)};c.dynCall_viif=function(){return(c.dynCall_viif=c.asm.Q).apply(null,arguments)};c.dynCall_iii=function(){return(c.dynCall_iii=c.asm.R).apply(null,arguments)};c.dynCall_viii=function(){return(c.dynCall_viii=c.asm.S).apply(null,arguments)};
|
||||||
|
c.dynCall_iiiiii=function(){return(c.dynCall_iiiiii=c.asm.T).apply(null,arguments)};c.dynCall_viiiii=function(){return(c.dynCall_viiiii=c.asm.U).apply(null,arguments)};c.dynCall_vii=function(){return(c.dynCall_vii=c.asm.V).apply(null,arguments)};c.dynCall_viiiiiii=function(){return(c.dynCall_viiiiiii=c.asm.W).apply(null,arguments)};c.dynCall_viiiiiiiii=function(){return(c.dynCall_viiiiiiiii=c.asm.X).apply(null,arguments)};c.dynCall_ii=function(){return(c.dynCall_ii=c.asm.Y).apply(null,arguments)};
|
||||||
|
c.dynCall_viiiiiiii=function(){return(c.dynCall_viiiiiiii=c.asm.Z).apply(null,arguments)};c.dynCall_viiii=function(){return(c.dynCall_viiii=c.asm._).apply(null,arguments)};c.dynCall_viiiiii=function(){return(c.dynCall_viiiiii=c.asm.$).apply(null,arguments)};c.dynCall_iidiiii=function(){return(c.dynCall_iidiiii=c.asm.aa).apply(null,arguments)};c.dynCall_iiiii=function(){return(c.dynCall_iiiii=c.asm.ba).apply(null,arguments)};c.dynCall_v=function(){return(c.dynCall_v=c.asm.ca).apply(null,arguments)};
|
||||||
|
c.dynCall_fi=function(){return(c.dynCall_fi=c.asm.da).apply(null,arguments)};c.dynCall_iiii=function(){return(c.dynCall_iiii=c.asm.ea).apply(null,arguments)};c.dynCall_iiiiiiiiii=function(){return(c.dynCall_iiiiiiiiii=c.asm.fa).apply(null,arguments)};c.dynCall_jiji=function(){return(c.dynCall_jiji=c.asm.ga).apply(null,arguments)};var xb;P=function yb(){xb||zb();xb||(P=yb)};
|
||||||
|
function zb(){function a(){if(!xb&&(xb=!0,c.calledRun=!0,!ka)){za(Ba);za(Ca);aa(c);if(c.onRuntimeInitialized)c.onRuntimeInitialized();if(c.postRun)for("function"==typeof c.postRun&&(c.postRun=[c.postRun]);c.postRun.length;){var b=c.postRun.shift();Da.unshift(b)}za(Da)}}if(!(0<O)){if(c.preRun)for("function"==typeof c.preRun&&(c.preRun=[c.preRun]);c.preRun.length;)Ea();za(Aa);0<O||(c.setStatus?(c.setStatus("Running..."),setTimeout(function(){setTimeout(function(){c.setStatus("")},1);a()},1)):a())}}
|
||||||
|
c.run=zb;if(c.preInit)for("function"==typeof c.preInit&&(c.preInit=[c.preInit]);0<c.preInit.length;)c.preInit.pop()();noExitRuntime=!0;zb();
|
||||||
|
|
||||||
|
|
||||||
|
return wp2_enc.ready
|
||||||
|
}
|
||||||
|
);
|
||||||
|
})();
|
||||||
|
if (typeof exports === 'object' && typeof module === 'object')
|
||||||
|
module.exports = wp2_enc;
|
||||||
|
else if (typeof define === 'function' && define['amd'])
|
||||||
|
define([], function() { return wp2_enc; });
|
||||||
|
else if (typeof exports === 'object')
|
||||||
|
exports["wp2_enc"] = wp2_enc;
|
||||||
|
|
||||||
BIN
codecs/wp2/enc/wp2_enc.wasm
Normal file
BIN
codecs/wp2/enc/wp2_enc.wasm
Normal file
Binary file not shown.
6
codecs/wp2/package.json
Normal file
6
codecs/wp2/package.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"name": "wp2",
|
||||||
|
"scripts": {
|
||||||
|
"build": "../build-cpp.sh"
|
||||||
|
}
|
||||||
|
}
|
||||||
1
emscripten-wasm.d.ts
vendored
1
emscripten-wasm.d.ts
vendored
@@ -6,6 +6,7 @@ declare namespace EmscriptenWasm {
|
|||||||
// Options object for modularized Emscripten files. Shoe-horned by @surma.
|
// Options object for modularized Emscripten files. Shoe-horned by @surma.
|
||||||
// FIXME: This an incomplete definition!
|
// FIXME: This an incomplete definition!
|
||||||
interface ModuleOpts {
|
interface ModuleOpts {
|
||||||
|
mainScriptUrlOrBlob?: string;
|
||||||
noInitialRun?: boolean;
|
noInitialRun?: boolean;
|
||||||
locateFile?: (url: string) => string;
|
locateFile?: (url: string) => string;
|
||||||
onRuntimeInitialized?: () => void;
|
onRuntimeInitialized?: () => void;
|
||||||
|
|||||||
254
package-lock.json
generated
254
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "squoosh",
|
"name": "squoosh",
|
||||||
"version": "1.11.4",
|
"version": "1.12.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -4639,6 +4639,12 @@
|
|||||||
"minimalistic-crypto-utils": "^1.0.0"
|
"minimalistic-crypto-utils": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"emoji-regex": {
|
||||||
|
"version": "7.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
|
||||||
|
"integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"emojis-list": {
|
"emojis-list": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz",
|
||||||
@@ -6392,22 +6398,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"globule": {
|
"globule": {
|
||||||
"version": "1.3.1",
|
"version": "1.3.2",
|
||||||
"resolved": "https://registry.npmjs.org/globule/-/globule-1.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/globule/-/globule-1.3.2.tgz",
|
||||||
"integrity": "sha512-OVyWOHgw29yosRHCHo7NncwR1hW5ew0W/UrvtwvjefVJeQ26q4/8r8FmPsSF1hJ93IgWkyv16pCTz6WblMzm/g==",
|
"integrity": "sha512-7IDTQTIu2xzXkT+6mlluidnWo+BypnbSoEVVQCGfzqnl5Ik8d3e1d4wycb8Rj9tWW+Z39uPWsdlquqiqPCd/pA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"glob": "~7.1.1",
|
"glob": "~7.1.1",
|
||||||
"lodash": "~4.17.12",
|
"lodash": "~4.17.10",
|
||||||
"minimatch": "~3.0.2"
|
"minimatch": "~3.0.2"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"lodash": {
|
|
||||||
"version": "4.17.15",
|
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
|
|
||||||
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
|
|
||||||
"dev": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"got": {
|
"got": {
|
||||||
@@ -7451,7 +7449,7 @@
|
|||||||
},
|
},
|
||||||
"is-obj": {
|
"is-obj": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "http://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz",
|
||||||
"integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=",
|
"integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
@@ -8603,9 +8601,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"js-base64": {
|
"js-base64": {
|
||||||
"version": "2.5.2",
|
"version": "2.6.4",
|
||||||
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.5.2.tgz",
|
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.6.4.tgz",
|
||||||
"integrity": "sha512-Vg8czh0Q7sFBSUMWWArX/miJeBWYBPpdU/3M/DKSaekLMqrqVPaedp+5mZhie/r0lgrcaYBfwXatEew6gwgiQQ==",
|
"integrity": "sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"js-levenshtein": {
|
"js-levenshtein": {
|
||||||
@@ -9785,9 +9783,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node-sass": {
|
"node-sass": {
|
||||||
"version": "4.13.0",
|
"version": "4.14.1",
|
||||||
"resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.13.0.tgz",
|
"resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.14.1.tgz",
|
||||||
"integrity": "sha512-W1XBrvoJ1dy7VsvTAS5q1V45lREbTlZQqFbiHb3R3OTTCma0XBtuG6xZ6Z4506nR4lmHPTqVRwxT6KgtWC97CA==",
|
"integrity": "sha512-sjCuOlvGyCJS40R8BscF5vhVlQjNN069NtQ1gSxyK1u9iqvn6tf7O1R4GNowVZfiZUCRt5MmMs1xd+4V/7Yr0g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"async-foreach": "^0.1.3",
|
"async-foreach": "^0.1.3",
|
||||||
@@ -9804,15 +9802,15 @@
|
|||||||
"node-gyp": "^3.8.0",
|
"node-gyp": "^3.8.0",
|
||||||
"npmlog": "^4.0.0",
|
"npmlog": "^4.0.0",
|
||||||
"request": "^2.88.0",
|
"request": "^2.88.0",
|
||||||
"sass-graph": "^2.2.4",
|
"sass-graph": "2.2.5",
|
||||||
"stdout-stream": "^1.4.0",
|
"stdout-stream": "^1.4.0",
|
||||||
"true-case-path": "^1.0.2"
|
"true-case-path": "^1.0.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ajv": {
|
"ajv": {
|
||||||
"version": "6.12.0",
|
"version": "6.12.5",
|
||||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.0.tgz",
|
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.5.tgz",
|
||||||
"integrity": "sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw==",
|
"integrity": "sha512-lRF8RORchjpKG50/WFf8xmg7sgCLFiYNNnqdKflk63whMQcWR5ngGjiSXkL9bjxy6B2npOK2HSMN49jEBMSkag==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"fast-deep-equal": "^3.1.1",
|
"fast-deep-equal": "^3.1.1",
|
||||||
@@ -9857,9 +9855,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"fast-deep-equal": {
|
"fast-deep-equal": {
|
||||||
"version": "3.1.1",
|
"version": "3.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||||
"integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==",
|
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"get-stdin": {
|
"get-stdin": {
|
||||||
@@ -9869,25 +9867,25 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"har-validator": {
|
"har-validator": {
|
||||||
"version": "5.1.3",
|
"version": "5.1.5",
|
||||||
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz",
|
||||||
"integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==",
|
"integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"ajv": "^6.5.5",
|
"ajv": "^6.12.3",
|
||||||
"har-schema": "^2.0.0"
|
"har-schema": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lodash": {
|
"lodash": {
|
||||||
"version": "4.17.15",
|
"version": "4.17.20",
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
|
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
|
||||||
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
|
"integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"nan": {
|
"nan": {
|
||||||
"version": "2.14.0",
|
"version": "2.14.1",
|
||||||
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz",
|
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz",
|
||||||
"integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==",
|
"integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"oauth-sign": {
|
"oauth-sign": {
|
||||||
@@ -10246,15 +10244,6 @@
|
|||||||
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
|
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"os-locale": {
|
|
||||||
"version": "1.4.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
|
|
||||||
"integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"lcid": "^1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"os-tmpdir": {
|
"os-tmpdir": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
|
||||||
@@ -12884,15 +12873,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sass-graph": {
|
"sass-graph": {
|
||||||
"version": "2.2.4",
|
"version": "2.2.5",
|
||||||
"resolved": "https://registry.npmjs.org/sass-graph/-/sass-graph-2.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/sass-graph/-/sass-graph-2.2.5.tgz",
|
||||||
"integrity": "sha1-E/vWPNHK8JCLn9k0dq1DpR0eC0k=",
|
"integrity": "sha512-VFWDAHOe6mRuT4mZRd4eKE+d8Uedrk6Xnh7Sh9b4NGufQLQjOrvf/MQoOdx+0s92L89FeyUUNfU597j/3uNpag==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"glob": "^7.0.0",
|
"glob": "^7.0.0",
|
||||||
"lodash": "^4.0.0",
|
"lodash": "^4.0.0",
|
||||||
"scss-tokenizer": "^0.2.3",
|
"scss-tokenizer": "^0.2.3",
|
||||||
"yargs": "^7.0.0"
|
"yargs": "^13.3.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sass-loader": {
|
"sass-loader": {
|
||||||
@@ -15354,6 +15343,12 @@
|
|||||||
"makeerror": "1.0.x"
|
"makeerror": "1.0.x"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"wasm-feature-detect": {
|
||||||
|
"version": "1.2.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/wasm-feature-detect/-/wasm-feature-detect-1.2.9.tgz",
|
||||||
|
"integrity": "sha512-2E9/gtLVLpv2wnZDyYv8WY2dR9gHbmyv5uhZsnOcMSzqc78aGZpKQORPNcnrPwAU23nFUo7GAwKuoTAWRgsJ7Q==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"watchpack": {
|
"watchpack": {
|
||||||
"version": "1.6.0",
|
"version": "1.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz",
|
||||||
@@ -16159,9 +16154,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"which-module": {
|
"which-module": {
|
||||||
"version": "1.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
|
||||||
"integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=",
|
"integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"wide-align": {
|
"wide-align": {
|
||||||
@@ -16289,53 +16284,148 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"yargs": {
|
"yargs": {
|
||||||
"version": "7.1.0",
|
"version": "13.3.2",
|
||||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-7.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz",
|
||||||
"integrity": "sha1-a6MY6xaWFyf10oT46gA+jWFU0Mg=",
|
"integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"camelcase": "^3.0.0",
|
"cliui": "^5.0.0",
|
||||||
"cliui": "^3.2.0",
|
"find-up": "^3.0.0",
|
||||||
"decamelize": "^1.1.1",
|
"get-caller-file": "^2.0.1",
|
||||||
"get-caller-file": "^1.0.1",
|
|
||||||
"os-locale": "^1.4.0",
|
|
||||||
"read-pkg-up": "^1.0.1",
|
|
||||||
"require-directory": "^2.1.1",
|
"require-directory": "^2.1.1",
|
||||||
"require-main-filename": "^1.0.1",
|
"require-main-filename": "^2.0.0",
|
||||||
"set-blocking": "^2.0.0",
|
"set-blocking": "^2.0.0",
|
||||||
"string-width": "^1.0.2",
|
"string-width": "^3.0.0",
|
||||||
"which-module": "^1.0.0",
|
"which-module": "^2.0.0",
|
||||||
"y18n": "^3.2.1",
|
"y18n": "^4.0.0",
|
||||||
"yargs-parser": "^5.0.0"
|
"yargs-parser": "^13.1.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"camelcase": {
|
"ansi-regex": {
|
||||||
"version": "3.0.0",
|
"version": "4.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
|
||||||
"integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=",
|
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"y18n": {
|
"cliui": {
|
||||||
"version": "3.2.1",
|
"version": "5.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
|
||||||
"integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=",
|
"integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"string-width": "^3.1.0",
|
||||||
|
"strip-ansi": "^5.2.0",
|
||||||
|
"wrap-ansi": "^5.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"find-up": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"locate-path": "^3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"get-caller-file": {
|
||||||
|
"version": "2.0.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
|
||||||
|
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
|
},
|
||||||
|
"is-fullwidth-code-point": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
|
||||||
|
"integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"locate-path": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"p-locate": "^3.0.0",
|
||||||
|
"path-exists": "^3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"p-limit": {
|
||||||
|
"version": "2.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
|
||||||
|
"integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"p-try": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"p-locate": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"p-limit": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"p-try": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"require-main-filename": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"string-width": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"emoji-regex": "^7.0.1",
|
||||||
|
"is-fullwidth-code-point": "^2.0.0",
|
||||||
|
"strip-ansi": "^5.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"strip-ansi": {
|
||||||
|
"version": "5.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
|
||||||
|
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"ansi-regex": "^4.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"wrap-ansi": {
|
||||||
|
"version": "5.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz",
|
||||||
|
"integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"ansi-styles": "^3.2.0",
|
||||||
|
"string-width": "^3.0.0",
|
||||||
|
"strip-ansi": "^5.0.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"yargs-parser": {
|
"yargs-parser": {
|
||||||
"version": "5.0.0",
|
"version": "13.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-5.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz",
|
||||||
"integrity": "sha1-J17PDX/+Bcd+ZOfIbkzZS/DhIoo=",
|
"integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"camelcase": "^3.0.0"
|
"camelcase": "^5.0.0",
|
||||||
|
"decamelize": "^1.2.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"camelcase": {
|
"camelcase": {
|
||||||
"version": "3.0.0",
|
"version": "5.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
|
||||||
"integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=",
|
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"name": "squoosh",
|
"name": "squoosh",
|
||||||
"version": "1.11.4",
|
"version": "1.12.0",
|
||||||
"license": "apache-2.0",
|
"license": "apache-2.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "webpack-dev-server --host 0.0.0.0 --hot",
|
"start": "webpack-dev-server --host 0.0.0.0 --hot",
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
"mini-css-extract-plugin": "0.8.0",
|
"mini-css-extract-plugin": "0.8.0",
|
||||||
"minimatch": "3.0.4",
|
"minimatch": "3.0.4",
|
||||||
"node-fetch": "2.6.0",
|
"node-fetch": "2.6.0",
|
||||||
"node-sass": "4.13.0",
|
"node-sass": "4.14.1",
|
||||||
"normalize-path": "^3.0.0",
|
"normalize-path": "^3.0.0",
|
||||||
"optimize-css-assets-webpack-plugin": "5.0.1",
|
"optimize-css-assets-webpack-plugin": "5.0.1",
|
||||||
"pointer-tracker": "2.0.3",
|
"pointer-tracker": "2.0.3",
|
||||||
@@ -68,6 +68,7 @@
|
|||||||
"typed-css-modules": "0.4.2",
|
"typed-css-modules": "0.4.2",
|
||||||
"typescript": "3.5.3",
|
"typescript": "3.5.3",
|
||||||
"url-loader": "2.1.0",
|
"url-loader": "2.1.0",
|
||||||
|
"wasm-feature-detect": "^1.2.9",
|
||||||
"webpack": "4.39.3",
|
"webpack": "4.39.3",
|
||||||
"webpack-bundle-analyzer": "3.4.1",
|
"webpack-bundle-analyzer": "3.4.1",
|
||||||
"webpack-cli": "3.3.4",
|
"webpack-cli": "3.3.4",
|
||||||
|
|||||||
7
src/codecs/avif/decoder-meta.ts
Normal file
7
src/codecs/avif/decoder-meta.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
export const name = 'WASM AVIF Decoder';
|
||||||
|
|
||||||
|
const supportedMimeTypes = ['image/avif'];
|
||||||
|
|
||||||
|
export function canHandleMimeType(mimeType: string): boolean {
|
||||||
|
return supportedMimeTypes.includes(mimeType);
|
||||||
|
}
|
||||||
16
src/codecs/avif/decoder.ts
Normal file
16
src/codecs/avif/decoder.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import avif_dec, { AVIFModule } from '../../../codecs/avif/dec/avif_dec';
|
||||||
|
import wasmUrl from '../../../codecs/avif/dec/avif_dec.wasm';
|
||||||
|
import { initEmscriptenModule } from '../util';
|
||||||
|
|
||||||
|
let emscriptenModule: Promise<AVIFModule>;
|
||||||
|
|
||||||
|
export async function decode(data: ArrayBuffer): Promise<ImageData> {
|
||||||
|
if (!emscriptenModule) emscriptenModule = initEmscriptenModule(avif_dec, wasmUrl);
|
||||||
|
|
||||||
|
const module = await emscriptenModule;
|
||||||
|
const result = module.decode(data);
|
||||||
|
if (!result) {
|
||||||
|
throw new Error('Decoding error');
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
27
src/codecs/avif/encoder-meta.ts
Normal file
27
src/codecs/avif/encoder-meta.ts
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
export interface EncodeOptions {
|
||||||
|
minQuantizer: number;
|
||||||
|
maxQuantizer: number;
|
||||||
|
minQuantizerAlpha: number;
|
||||||
|
maxQuantizerAlpha: number;
|
||||||
|
tileRowsLog2: number;
|
||||||
|
tileColsLog2: number;
|
||||||
|
speed: number;
|
||||||
|
subsample: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const type = 'avif';
|
||||||
|
export const label = 'AVIF';
|
||||||
|
export const mimeType = 'image/avif';
|
||||||
|
export const extension = 'avif';
|
||||||
|
export const defaultOptions: EncodeOptions = {
|
||||||
|
minQuantizer: 33,
|
||||||
|
maxQuantizer: 63,
|
||||||
|
minQuantizerAlpha: 33,
|
||||||
|
maxQuantizerAlpha: 63,
|
||||||
|
tileColsLog2: 0,
|
||||||
|
tileRowsLog2: 0,
|
||||||
|
speed: 8,
|
||||||
|
subsample: 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface EncoderState { type: typeof type; options: EncodeOptions; }
|
||||||
42
src/codecs/avif/encoder.ts
Normal file
42
src/codecs/avif/encoder.ts
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
import mainUrlWithMT from 'file-loader!../../../codecs/avif/enc/avif_enc_mt.js';
|
||||||
|
import { AVIFModule } from '../../../codecs/avif/enc/avif_enc.js';
|
||||||
|
import wasmUrlWithoutMT from '../../../codecs/avif/enc/avif_enc.wasm';
|
||||||
|
import wasmUrlWithMT from '../../../codecs/avif/enc/avif_enc_mt.wasm';
|
||||||
|
import workerUrl from '../../../codecs/avif/enc/avif_enc_mt.worker.js';
|
||||||
|
import { EncodeOptions } from './encoder-meta';
|
||||||
|
import { initEmscriptenModule, ModuleFactory } from '../util';
|
||||||
|
import { threads } from 'wasm-feature-detect';
|
||||||
|
|
||||||
|
declare const avif_enc_mt: ModuleFactory<AVIFModule>;
|
||||||
|
|
||||||
|
let emscriptenModule: Promise<AVIFModule>;
|
||||||
|
|
||||||
|
async function init() {
|
||||||
|
if (await threads()) {
|
||||||
|
importScripts(mainUrlWithMT);
|
||||||
|
return initEmscriptenModule<AVIFModule>(
|
||||||
|
avif_enc_mt,
|
||||||
|
wasmUrlWithMT,
|
||||||
|
workerUrl,
|
||||||
|
mainUrlWithMT,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return initEmscriptenModule(
|
||||||
|
(await import('../../../codecs/avif/enc/avif_enc.js')).default,
|
||||||
|
wasmUrlWithoutMT,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function encode(data: ImageData, options: EncodeOptions): Promise<ArrayBuffer> {
|
||||||
|
if (!emscriptenModule) emscriptenModule = init();
|
||||||
|
|
||||||
|
const module = await emscriptenModule;
|
||||||
|
const result = module.encode(data.data, data.width, data.height, options);
|
||||||
|
|
||||||
|
if (!result) {
|
||||||
|
throw new Error('Encoding error');
|
||||||
|
}
|
||||||
|
|
||||||
|
// wasm can’t run on SharedArrayBuffers, so we hard-cast to ArrayBuffer.
|
||||||
|
return result.buffer as ArrayBuffer;
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user