Compare commits

...

46 Commits

Author SHA1 Message Date
dc2f2e48c9 Build with older nightly 2020-11-19 12:17:08 +00:00
e691860999 Rebuild with same nightly Rust 2020-11-19 10:15:42 +00:00
fd87ae7d2a Force-rebuild codecs with -O3
Follow-up to https://github.com/GoogleChromeLabs/squoosh/pull/838.

I have no idea what the JS+Wasm diffs in the original PR even represented if they weren't proper rebuilds, but this time I just removed node_modules in all codecs to enforce a proper, clean rebuild for each C++ codec.

(Still think the speed-ups are worth it.)
2020-11-02 17:37:35 +00:00
5df7dd7590 Update helper.Makefile 2020-11-02 13:54:41 +00:00
013946b137 Pass CODEC_DIR and LIBAOM_DIR via export
Slightly simpler than passing them in HELPER_MAKEFLAGS.
2020-11-02 13:54:41 +00:00
81c183b0d6 Restructure the AVIF directories
Change the way AVIF finds AOM from default ([avif source]/ext/aom) to custom paths. This allows us to avoid unpacking same archives into duplicate folders, and instead make multiple builds from the same source.
2020-11-02 13:54:41 +00:00
f523db6403 Try out new flags for building only AVIF encoder/decoder
See the discussion in https://github.com/AOMediaCodec/libavif/issues/254 where this was implemented.

This allows us to avoid using ERROR_ON_UNDEFINED_SYMBOLS and build a truly separate encoder/decoder libs.
2020-11-02 13:54:41 +00:00
cc6ea9e11c Switch to -O3 for C++ codecs 2020-11-02 12:46:12 +00:00
bd4b67037b Further optimize logo.svg (#761)
Co-authored-by: Jake Archibald <jaffathecake@gmail.com>
2020-10-15 15:48:56 +01:00
8c5c97e106 Remove obsolete @ts-ignore 2020-10-07 20:42:48 +01:00
a9d3bd71b5 Bump oxipng
Integrating some upstream fixes from my branch.
2020-10-07 20:42:48 +01:00
0d0a9b4cdf Add COOP+COEP headers 2020-10-07 20:42:48 +01:00
f583770696 Explicitly disable HDR only for encoder 2020-10-07 20:42:48 +01:00
bae243ccdb Add feature detection to OxiPNG 2020-10-07 20:42:48 +01:00
02c113a68f Point oxipng to a patched version
Some upstream changes required for parallel build to work.
2020-10-07 20:42:48 +01:00
600eead007 Disable parallel feature for non-parallel OxiPNG 2020-10-07 20:42:48 +01:00
05416768d5 Update oxipng build system 2020-10-07 20:42:48 +01:00
35d31f2324 Add some comments to explain Rust thread glue 2020-10-07 20:42:48 +01:00
82fadac70e Fixup import.meta in OxiPNG 2020-10-07 20:42:48 +01:00
47f9d22dd8 Switch to crossbeam-channel
Still not perfect due to usage of a static global, but this is much cleaner and more efficient thanks to proper blocking of Workers that wait for new messages instead of a manual spin-loop.
2020-10-07 20:42:48 +01:00
9420dba3bc Parallel OxiPNG improvements
- Refactor to work around Chromium's issue with postMessage queuing. https://bugs.chromium.org/p/chromium/issues/detail?id=1075645
 - Convert codec code to TypeScript.
 - Make separate parallel and non-parallel builds.
 - Switch to nightly Rust for OxiPNG to allow parallel builds (but also reuse it for regular builds to avoid installing two toolchains).
2020-10-07 20:42:48 +01:00
e462875807 Type fix for gesturestart event 2020-10-07 20:42:48 +01:00
0747d2c419 Rework fallback for postMessage issue
Now initialise all workers with module+memory separately, and then instead of using postMessage to send thread pointers, push them into a crossbeam-deque on the Rust side.

Rayon already depends on crossbeam-dequeue, so we're not even adding another dependency, and this model allows us to push "tasks" (thread pointers) on the main thread and pop them on worker threads in arbitrary order without sacrificing correctness.
2020-10-07 20:42:48 +01:00
4c658b79ef OxiPNG + threads PoC 2020-10-07 20:42:48 +01:00
685558847f Multithread AVIF PoC 2020-10-07 20:42:48 +01:00
63ac34a662 Promisify emscripten modules & fix webp examples (#817) 2020-09-30 00:05:59 +01:00
42f9e4aed2 Merge pull request #828 from GoogleChromeLabs/create-dir
Ensure node_modules is created
2020-09-16 10:36:11 +01:00
e14790f0b9 Ensure node_modules is created 2020-09-16 10:24:20 +01:00
dfee848a39 Update example.html (#827)
rawImage is a Uint8ClampedArray and doesn't have width and height property.
2020-09-16 07:42:32 +01:00
a437afdf2b Update AVIF build to produce shipped wasm (#823)
* argh

* It works!

* Silly me

* Changes following feedback
2020-09-15 11:08:20 +01:00
4768bc17ba 1.12.0 2020-08-26 12:57:35 +01:00
0934c6c00f Merge pull request #804 from GoogleChromeLabs/avif-options 2020-08-26 12:53:37 +01:00
9d81a9cd57 Merge branch 'dev' into avif-options 2020-08-26 12:39:40 +01:00
239ffeb7a7 Comment out grayscale and 4:2:0 for now 2020-08-26 12:36:59 +01:00
95570c8b3c Revert "Merge pull request #800 from GoogleChromeLabs/mozjpeg_dec"
This reverts commit 5715fb7b1b, reversing
changes made to 2c923e5239.
2020-08-26 12:28:06 +01:00
6e52ac2a73 Simpler canDecode check 2020-08-26 11:41:21 +01:00
fd5c557065 Cheeky smaller wasms 2020-08-26 11:09:15 +01:00
0abb6f18ba Update options when updating state. 2020-08-25 16:54:01 +01:00
4e5a810770 Avoid caching the decoder if the browser already supports it 2020-08-25 14:31:20 +01:00
8a81792bd5 Finger-in-the-air defaults 2020-08-25 14:13:37 +01:00
3f57f9fef1 Feature test decoding capability 2020-08-25 14:13:21 +01:00
549e1fc50a Use bt709 if not lossless so colour is correct 2020-08-25 14:12:26 +01:00
f3749a4e24 Ensure that mins can't be greater than maxs 2020-08-25 13:39:28 +01:00
e316b0d667 Use identity coefficients for true lossless 2020-08-25 13:39:01 +01:00
8f2dcb5f48 Options mostly working 2020-08-25 13:11:10 +01:00
d4f8b7f38b Add LICENSES to codecs 2020-08-21 13:44:36 +01:00
97 changed files with 2958 additions and 907 deletions

View File

@ -7,3 +7,6 @@ end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[Makefile]
indent_style = tab

View File

@ -16,3 +16,8 @@
# But it isn't a big deal if the user gets an old version.
/assets/*
Cache-Control: must-revalidate, max-age=3600
# COOP+COEP for WebAssembly threads.
/*
Cross-Origin-Embedder-Policy: require-corp
Cross-Origin-Opener-Policy: same-origin

View File

@ -1,76 +1,84 @@
CODEC_URL = https://github.com/AOMediaCodec/libavif/archive/v0.8.0.tar.gz
CODEC_DIR = node_modules/libavif
CODEC_BUILD_DIR := $(CODEC_DIR)/build
CODEC_OUT := $(CODEC_BUILD_DIR)/libavif.a
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_DIR := $(CODEC_DIR)/ext/aom
LIBAOM_BUILD_DIR := $(LIBAOM_DIR)/build.libavif
LIBAOM_OUT := $(LIBAOM_BUILD_DIR)/libaom.a
LIBAOM_PACKAGE = node_modules/libaom.tar.gz
OUT_JS = enc/avif_enc.js dec/avif_dec.js
OUT_WASM = $(OUT_JS:.js=.wasm)
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_JS)
all: $(OUT_ENC_JS) $(OUT_DEC_JS) $(OUT_ENC_MT_JS)
%.js: %.cpp $(LIBAOM_OUT) $(CODEC_OUT)
$(CXX) \
-I $(CODEC_DIR)/include \
${CXXFLAGS} \
${LDFLAGS} \
--bind \
--closure 1 \
-s ALLOW_MEMORY_GROWTH=1 \
-s MODULARIZE=1 \
-s 'EXPORT_NAME="$(basename $(@F))"' \
-o $@ \
$+
$(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"
$(CODEC_OUT): $(CODEC_DIR)/CMakeLists.txt $(LIBAOM_OUT)
mkdir -p $(CODEC_BUILD_DIR)
cd $(CODEC_BUILD_DIR) && \
emcmake cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=0 \
-DAVIF_CODEC_AOM=1 \
-DAVIF_LOCAL_AOM=1 \
../ && \
$(MAKE)
$(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"
$(LIBAOM_OUT): $(LIBAOM_DIR)/CMakeLists.txt
mkdir -p $(LIBAOM_BUILD_DIR)
cd $(LIBAOM_BUILD_DIR) && \
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_MULTITHREAD=0 \
-DCONFIG_RUNTIME_CPU_DETECT=0 \
-DCONFIG_WEBM_IO=0 \
../ && \
$(MAKE)
$(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_DIR)/CMakeLists.txt: $(CODEC_DIR)
$(CODEC_PACKAGE):
mkdir -p $(@D)
curl -sL $(CODEC_URL) -o $@
$(LIBAOM_DIR)/CMakeLists.txt: $(LIBAOM_DIR)
$(LIBAOM_PACKAGE):
mkdir -p $(@D)
curl -sL $(LIBAOM_URL) -o $@
$(CODEC_DIR):
mkdir -p $@
curl -sL $(CODEC_URL) | tar xz --strip 1 -C $@
$(CODEC_DIR)/CMakeLists.txt: $(CODEC_PACKAGE)
mkdir -p $(@D)
tar xzm --strip 1 -C $(@D) -f $(CODEC_PACKAGE)
$(LIBAOM_DIR):
mkdir -p $@
curl -sL $(LIBAOM_URL) | tar xz -C $@
$(LIBAOM_DIR)/CMakeLists.txt: $(LIBAOM_PACKAGE)
mkdir -p $(@D)
tar xzm -C $(@D) -f $(LIBAOM_PACKAGE)
clean:
$(RM) $(OUT_JS) $(OUT_WASM)
$(MAKE) -C $(CODEC_BUILD_DIR) clean
$(MAKE) -C $(LIBAOM_BUILD_DIR) 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

View File

@ -8,15 +8,10 @@ thread_local const val Uint8ClampedArray = val::global("Uint8ClampedArray");
thread_local const val ImageData = val::global("ImageData");
val decode(std::string avifimage) {
// point raw.data and raw.size to the contents of an .avif(s)
avifROData raw = {
.data = (uint8_t*)avifimage.c_str(),
.size = avifimage.length()
};
avifImage* image = avifImageCreateEmpty();
avifDecoder* decoder = avifDecoderCreate();
avifResult decodeResult = avifDecoderRead(decoder, image, &raw);
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);
@ -25,7 +20,8 @@ val decode(std::string avifimage) {
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.
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);
@ -33,7 +29,9 @@ val decode(std::string avifimage) {
// 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);
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);

View File

@ -2,5 +2,5 @@ interface AVIFModule extends EmscriptenWasm.Module {
decode(data: BufferSource): ImageData | null;
}
export default function(opts: EmscriptenWasm.ModuleOpts): AVIFModule;
export default function(opts: EmscriptenWasm.ModuleOpts): Promise<AVIFModule>;

View File

@ -7,95 +7,55 @@ function(avif_dec) {
avif_dec = avif_dec || {};
var e;e||(e=typeof avif_dec !== 'undefined' ? avif_dec : {});var aa,ba;e.ready=new Promise(function(a,b){aa=a;ba=b});var ca={},l;for(l in e)e.hasOwnProperty(l)&&(ca[l]=e[l]);var ea=!1,q=!1,fa=!1,ha=!1;ea="object"===typeof window;q="function"===typeof importScripts;fa="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;ha=!ea&&!fa&&!q;var u="",ia,ja,ka,la;
if(fa)u=q?require("path").dirname(u)+"/":__dirname+"/",ia=function(a,b){ka||(ka=require("fs"));la||(la=require("path"));a=la.normalize(a);return ka.readFileSync(a,b?null:"utf8")},ja=function(a){a=ia(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",w),e.inspect=function(){return"[Emscripten Module object]"};else if(ha)"undefined"!=
typeof read&&(ia=function(a){return read(a)}),ja=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(ea||q)q?u=self.location.href:document.currentScript&&(u=document.currentScript.src),_scriptDir&&(u=_scriptDir),0!==u.indexOf("blob:")?u=u.substr(0,
u.lastIndexOf("/")+1):u="",ia=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},q&&(ja=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var ma=e.print||console.log.bind(console),y=e.printErr||console.warn.bind(console);for(l in ca)ca.hasOwnProperty(l)&&(e[l]=ca[l]);ca=null;var na=0,oa;e.wasmBinary&&(oa=e.wasmBinary);var noExitRuntime;e.noExitRuntime&&(noExitRuntime=e.noExitRuntime);
"object"!==typeof WebAssembly&&w("no native wasm support detected");var z,pa=new WebAssembly.Table({initial:2113,maximum:2113,element:"anyfunc"}),qa=!1;function assert(a,b){a||w("Assertion failed: "+b)}var ra="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
function A(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 f=a[b++];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 sa(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 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-f}
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(B.subarray(a,c));c=0;for(d="";;){var f=C[a+2*c>>1];if(0==f||c==b/2)return d;++c;d+=String.fromCharCode(f)}}
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 f=0;f<c;++f)C[b>>1]=a.charCodeAt(f),b+=2;C[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 f=D[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 Aa(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}D[b>>2]=g;b+=4;if(b+4>c)break}D[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 E,F,B,C,wa,D,I,Ca,Da;
function Ea(a){E=a;e.HEAP8=F=new Int8Array(a);e.HEAP16=C=new Int16Array(a);e.HEAP32=D=new Int32Array(a);e.HEAPU8=B=new Uint8Array(a);e.HEAPU16=wa=new Uint16Array(a);e.HEAPU32=I=new Uint32Array(a);e.HEAPF32=Ca=new Float32Array(a);e.HEAPF64=Da=new Float64Array(a)}var Fa=e.INITIAL_MEMORY||16777216;e.wasmMemory?z=e.wasmMemory:z=new WebAssembly.Memory({initial:Fa/65536,maximum:32768});z&&(E=z.buffer);Fa=E.byteLength;Ea(E);D[224044]=6139216;
function Ga(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(e);else{var c=b.ob;"number"===typeof c?void 0===b.Ya?e.dynCall_v(c):e.dynCall_vi(c,b.Ya):c(void 0===b.Ya?null:b.Ya)}}}var Ha=[],Ia=[],Ja=[],Ka=[];function La(){var a=e.preRun.shift();Ha.unshift(a)}var Ma=Math.abs,Na=Math.ceil,Oa=Math.floor,Pa=Math.min,J=0,Qa=null,Ra=null;e.preloadedImages={};e.preloadedAudios={};
function w(a){if(e.onAbort)e.onAbort(a);y(a);qa=!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_dec.wasm";if(!Ta()){var Ua=K;K=e.locateFile?e.locateFile(Ua,u):u+Ua}
function Va(){try{if(oa)return new Uint8Array(oa);if(ja)return ja(K);throw"both async and sync fetching of the wasm failed";}catch(a){w(a)}}function Wa(){return oa||!ea&&!q||"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 L,Xa;Ia.push({ob:function(){Ya()}});function Za(){return 0<Za.Va}
function $a(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 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:[],Ua:b};gb(a,hb)}
var hb={open:function(a){var b=eb[a.node.rdev];if(!b)throw new M(43);a.tty=b;a.seekable=!1},close:function(a){a.tty.Ua.flush(a.tty)},flush:function(a){a.tty.Ua.flush(a.tty)},read:function(a,b,c,d){if(!a.tty||!a.tty.Ua.ib)throw new M(60);for(var f=0,g=0;g<d;g++){try{var h=a.tty.Ua.ib(a.tty)}catch(k){throw new M(29);}if(void 0===h&&0===f)throw new M(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.Ua.$a)throw new M(60);
try{for(var f=0;f<d;f++)a.tty.Ua.$a(a.tty,b[c+f])}catch(g){throw new M(29);}d&&(a.node.timestamp=Date.now());return f}},ib={ib:function(a){if(!a.input.length){var b=null;if(fa){var c=Buffer.Va?Buffer.Va(256):new Buffer(256),d=0;try{d=ka.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(ta(b)+1);b=sa(b,c,0,c.length);c.length=b;a.input=c}return a.input.shift()},$a:function(a,b){null===b||10===b?(ma(A(a.output,0)),a.output=[]):0!=b&&a.output.push(b)},flush:function(a){a.output&&0<a.output.length&&(ma(A(a.output,0)),a.output=[])}},jb={$a:function(a,b){null===b||10===b?(y(A(a.output,0)),a.output=[]):0!=b&&a.output.push(b)},flush:function(a){a.output&&0<a.output.length&&(y(A(a.output,0)),a.output=[])}},N={Ma:null,
Pa:function(){return N.createNode(null,"/",16895,0)},createNode:function(a,b,c,d){if(24576===(c&61440)||4096===(c&61440))throw new M(63);N.Ma||(N.Ma={dir:{node:{Ra:N.Ja.Ra,Oa:N.Ja.Oa,lookup:N.Ja.lookup,Wa:N.Ja.Wa,rename:N.Ja.rename,unlink:N.Ja.unlink,rmdir:N.Ja.rmdir,readdir:N.Ja.readdir,symlink:N.Ja.symlink},stream:{Ta:N.Ka.Ta}},file:{node:{Ra:N.Ja.Ra,Oa:N.Ja.Oa},stream:{Ta:N.Ka.Ta,read:N.Ka.read,write:N.Ka.write,cb:N.Ka.cb,jb:N.Ka.jb,lb:N.Ka.lb}},link:{node:{Ra:N.Ja.Ra,Oa:N.Ja.Oa,readlink:N.Ja.readlink},
stream:{}},eb:{node:{Ra:N.Ja.Ra,Oa:N.Ja.Oa},stream:kb}});c=lb(a,b,c,d);16384===(c.mode&61440)?(c.Ja=N.Ma.dir.node,c.Ka=N.Ma.dir.stream,c.Ia={}):32768===(c.mode&61440)?(c.Ja=N.Ma.file.node,c.Ka=N.Ma.file.stream,c.La=0,c.Ia=null):40960===(c.mode&61440)?(c.Ja=N.Ma.link.node,c.Ka=N.Ma.link.stream):8192===(c.mode&61440)&&(c.Ja=N.Ma.eb.node,c.Ka=N.Ma.eb.stream);c.timestamp=Date.now();a&&(a.Ia[b]=c);return c},xb:function(a){if(a.Ia&&a.Ia.subarray){for(var b=[],c=0;c<a.La;++c)b.push(a.Ia[c]);return b}return a.Ia},
yb:function(a){return a.Ia?a.Ia.subarray?a.Ia.subarray(0,a.La):new Uint8Array(a.Ia):new Uint8Array(0)},fb:function(a,b){var c=a.Ia?a.Ia.length:0;c>=b||(b=Math.max(b,c*(1048576>c?2:1.125)>>>0),0!=c&&(b=Math.max(b,256)),c=a.Ia,a.Ia=new Uint8Array(b),0<a.La&&a.Ia.set(c.subarray(0,a.La),0))},tb:function(a,b){if(a.La!=b)if(0==b)a.Ia=null,a.La=0;else{if(!a.Ia||a.Ia.subarray){var c=a.Ia;a.Ia=new Uint8Array(b);c&&a.Ia.set(c.subarray(0,Math.min(b,a.La)))}else if(a.Ia||(a.Ia=[]),a.Ia.length>b)a.Ia.length=b;
else for(;a.Ia.length<b;)a.Ia.push(0);a.La=b}},Ja:{Ra: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.La: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.nb=4096;b.blocks=Math.ceil(b.size/b.nb);return b},Oa:function(a,b){void 0!==b.mode&&(a.mode=b.mode);void 0!==b.timestamp&&
(a.timestamp=b.timestamp);void 0!==b.size&&N.tb(a,b.size)},lookup:function(){throw mb[44];},Wa:function(a,b,c,d){return N.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 f in d.Ia)throw new M(55);}delete a.parent.Ia[a.name];a.name=c;b.Ia[c]=a;a.parent=b},unlink:function(a,b){delete a.Ia[b]},rmdir:function(a,b){var c=nb(a,b),d;for(d in c.Ia)throw new M(55);delete a.Ia[b]},readdir:function(a){var b=[".",".."],c;for(c in a.Ia)a.Ia.hasOwnProperty(c)&&
b.push(c);return b},symlink:function(a,b,c){a=N.createNode(a,b,41471,0);a.link=c;return a},readlink:function(a){if(40960!==(a.mode&61440))throw new M(28);return a.link}},Ka:{read:function(a,b,c,d,f){var g=a.node.Ia;if(f>=a.node.La)return 0;a=Math.min(a.node.La-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===F.buffer&&(g=!1);if(!d)return 0;a=a.node;a.timestamp=Date.now();if(b.subarray&&(!a.Ia||a.Ia.subarray)){if(g)return a.Ia=
b.subarray(c,c+d),a.La=d;if(0===a.La&&0===f)return a.Ia=b.slice(c,c+d),a.La=d;if(f+d<=a.La)return a.Ia.set(b.subarray(c,c+d),f),d}N.fb(a,f+d);if(a.Ia.subarray&&b.subarray)a.Ia.set(b.subarray(c,c+d),f);else for(g=0;g<d;g++)a.Ia[f+g]=b[c+g];a.La=Math.max(a.La,f+d);return d},Ta:function(a,b,c){1===c?b+=a.position:2===c&&32768===(a.node.mode&61440)&&(b+=a.node.La);if(0>b)throw new M(28);return b},cb:function(a,b,c){N.fb(a.node,b+c);a.node.La=Math.max(a.node.La,b+c)},jb:function(a,b,c,d,f,g){assert(0===
b);if(32768!==(a.node.mode&61440))throw new M(43);a=a.node.Ia;if(g&2||a.buffer!==E){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;)F[b+c++]=0;c=b;if(!c)throw new M(48);F.set(a,c)}else d=!1,c=a.byteOffset;return{Cb:c,wb:d}},lb:function(a,b,c,d,f){if(32768!==(a.node.mode&61440))throw new M(43);if(f&2)return 0;N.Ka.write(a,b,0,d,c,!1);return 0}}},pb=null,qb={},rb=[],sb=1,tb=null,ub=!0,vb={},M=null,mb={};
function O(a,b){a=db("/",a);b=b||{};if(!a)return{path:"",node:null};var c={hb:!0,ab:0},d;for(d in c)void 0===b[d]&&(b[d]=c[d]);if(8<b.ab)throw new M(32);a=$a(a.split("/").filter(function(h){return!!h}),!1);var f=pb;c="/";for(d=0;d<a.length;d++){var g=d===a.length-1;if(g&&b.parent)break;f=nb(f,a[d]);c=ab(c+"/"+a[d]);f.Xa&&(!g||g&&b.hb)&&(f=f.Xa.root);if(!g||b.gb)for(g=0;40960===(f.mode&61440);)if(f=wb(c),c=db(bb(c),f),f=O(c,{ab:b.ab}).node,40<g++)throw new M(32);}return{path:c,node:f}}
function xb(a){for(var b;;){if(a===a.parent)return a=a.Pa.kb,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.Ja.lookup?0:2)throw new M(c,a);for(c=tb[yb(a.id,b)];c;c=c.sb){var d=c.name;if(c.parent.id===a.id&&d===b)return c}return a.Ja.lookup(a,b)}
function lb(a,b,c,d){a=new Ab(a,b,c,d);b=yb(a.parent.id,a.name);a.sb=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 M(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.Ka=qb[a.node.rdev].Ka;a.Ka.open&&a.Ka.open(a)},Ta:function(){throw new M(70);}};function gb(a,b){qb[a]={Ka:b}}
function Hb(a,b){var c="/"===b,d=!b;if(c&&pb)throw new M(10);if(!c&&!d){var f=O(b,{hb:!1});b=f.path;f=f.node;if(f.Xa)throw new M(10);if(16384!==(f.mode&61440))throw new M(54);}b={type:a,Bb:{},kb:b,rb:[]};a=a.Pa(b);a.Pa=b;b.root=a;c?pb=a:f&&(f.Xa=b,f.Pa&&f.Pa.rb.push(b))}function Ib(a,b,c){var d=O(a,{parent:!0}).node;a=cb(a);if(!a||"."===a||".."===a)throw new M(28);var f=Db(d,a);if(f)throw new M(f);if(!d.Ja.Wa)throw new M(63);return d.Ja.Wa(d,a,b,c)}function P(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 M(44);var c=O(b,{parent:!0}).node;if(!c)throw new M(44);b=cb(b);var d=Db(c,b);if(d)throw new M(d);if(!c.Ja.symlink)throw new M(63);c.Ja.symlink(c,b,a)}function wb(a){a=O(a).node;if(!a)throw new M(44);if(!a.Ja.readlink)throw new M(28);return db(xb(a.parent),a.Ja.readlink(a))}
function Lb(a,b,c,d){if(""===a)throw new M(44);if("string"===typeof b){var f=Bb[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=ab(a);try{g=O(a,{gb:!(b&131072)}).node}catch(k){}}f=!1;if(b&64)if(g){if(b&128)throw new M(20);}else g=Ib(a,c,0),f=!0;if(!g)throw new M(44);8192===(g.mode&61440)&&(b&=-513);if(b&65536&&16384!==(g.mode&61440))throw new M(54);if(!f&&(c=g?40960===(g.mode&61440)?
32:16384===(g.mode&61440)&&("r"!==Cb(b)||b&512)?31:zb(g,Cb(b)):44))throw new M(c);if(b&512){c=g;var h;"string"===typeof c?h=O(c,{gb:!0}).node:h=c;if(!h.Ja.Oa)throw new M(63);if(16384===(h.mode&61440))throw new M(31);if(32768!==(h.mode&61440))throw new M(28);if(c=zb(h,"w"))throw new M(c);h.Ja.Oa(h,{size:0,timestamp:Date.now()})}b&=-131713;d=Fb({node:g,path:xb(g),flags:b,seekable:!0,position:0,Ka:g.Ka,vb:[],error:!1},d);d.Ka.open&&d.Ka.open(d);!e.logReadFiles||b&1||(Mb||(Mb={}),a in Mb||(Mb[a]=1,y("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){y("FS.trackingDelegate['onOpenFile']('"+a+"', flags) threw an exception: "+k.message)}return d}function Nb(a,b,c){if(null===a.fd)throw new M(8);if(!a.seekable||!a.Ka.Ta)throw new M(70);if(0!=c&&1!=c&&2!=c)throw new M(28);a.position=a.Ka.Ta(a,b,c);a.vb=[]}
function Ob(){M||(M=function(a,b){this.node=b;this.ub=function(c){this.Sa=c};this.ub(a);this.message="FS error"},M.prototype=Error(),M.prototype.constructor=M,[44].forEach(function(a){mb[a]=new M(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 f=Sb++<<8|0;gb(f,{open:function(g){g.seekable=!1},close:function(){c&&c.buffer&&c.buffer.length&&c(10)},read:function(g,h,k,m){for(var n=0,r=0;r<m;r++){try{var t=b()}catch(v){throw new M(29);}if(void 0===t&&0===n)throw new M(6);if(null===t||void 0===t)break;n++;h[k+r]=t}n&&(g.node.timestamp=Date.now());return n},write:function(g,h,k,m){for(var n=0;n<m;n++)try{c(h[k+n])}catch(r){throw new M(29);}m&&(g.node.timestamp=Date.now());return n}});
Jb(a,d,f)}var Sb,Q={},Gb,Mb,Tb=void 0;function Ub(){Tb+=4;return D[Tb-4>>2]}function Vb(a){a=rb[a];if(!a)throw new M(8);return a}function Wb(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 Yb=void 0;function R(a){for(var b="";B[a];)b+=Yb[B[a++]];return b}var Zb={},S={},$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 T(a){throw new dc(a);}var ec=void 0;function fc(a,b){function c(k){k=b(k);if(k.length!==d.length)throw new ec("Mismatched type converter count");for(var m=0;m<d.length;++m)U(d[m],k[m])}var d=[];d.forEach(function(k){$b[k]=a});var f=Array(a.length),g=[],h=0;a.forEach(function(k,m){S.hasOwnProperty(k)?f[m]=S[k]:(g.push(k),Zb.hasOwnProperty(k)||(Zb[k]=[]),Zb[k].push(function(){f[m]=S[k];++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 d=b.name;a||T('type "'+d+'" must have a positive integer typeid pointer');if(S.hasOwnProperty(a)){if(c.pb)return;T("Cannot register type '"+d+"' twice")}S[a]=b;delete $b[a];Zb.hasOwnProperty(a)&&(b=Zb[a],delete Zb[a],b.forEach(function(f){f()}))}var hc=[],V=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
function ic(a){4<a&&0===--V[a].bb&&(V[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():V.length;V[b]={bb:1,value:a};return b}}function kc(a){return this.fromWireType(I[a>>2])}function lc(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
function mc(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 nc(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 oc(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function pc(a,b){var c=e;if(void 0===c[a].Na){var d=c[a];c[a]=function(){c[a].Na.hasOwnProperty(arguments.length)||T("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].Na+")!");return c[a].Na[arguments.length].apply(this,arguments)};c[a].Na=[];c[a].Na[d.mb]=d}}
function qc(a,b,c){e.hasOwnProperty(a)?((void 0===c||void 0!==e[a].Na&&void 0!==e[a].Na[c])&&T("Cannot register public name '"+a+"' twice"),pc(a,a),e.hasOwnProperty(c)&&T("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),e[a].Na[c]=b):(e[a]=b,void 0!==c&&(e[a].Ab=c))}function rc(a,b){for(var c=[],d=0;d<a;d++)c.push(D[(b>>2)+d]);return c}
function sc(a,b){a=R(a);var c=e["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&&T("unknown function pointer with signature "+a+": "+b);return c}var tc=void 0;function uc(a){a=vc(a);var b=R(a);W(a);return b}
function wc(a,b){function c(g){f[g]||S[g]||($b[g]?$b[g].forEach(c):(d.push(g),f[g]=!0))}var d=[],f={};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 F[d]}:function(d){return B[d]};case 1:return c?function(d){return C[d>>1]}:function(d){return wa[d>>1]};case 2:return c?function(d){return D[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=S[a];void 0===c&&T(b+" has unknown type "+uc(a));return c}var Bc={};function Ab(a,b,c,d){a||(a=this);this.parent=a;this.Pa=a.Pa;this.Xa=null;this.id=sb++;this.name=b;this.mode=c;this.Ja={};this.Ka={};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(N,"/");P("/tmp");P("/home");P("/home/web_user");
(function(){P("/dev");gb(259,{read:function(){return 0},write:function(d,f,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(fa)try{var c=require("crypto");b=function(){return c.randomBytes(1)[0]}}catch(d){}b||(b=function(){w("random_device")});Rb("random",b);Rb("urandom",b);P("/dev/shm");
P("/dev/shm/tmp")})();P("/proc");P("/proc/self");P("/proc/self/fd");Hb({Pa:function(){var a=lb("/proc/self","fd",16895,73);a.Ja={lookup:function(b,c){var d=rb[+c];if(!d)throw new M(8);b={parent:null,Pa:{kb:"fake"},Ja:{readlink:function(){return d.path}}};return b.parent=b}};return a}},"/proc/self/fd");for(var Cc=Array(256),Dc=0;256>Dc;++Dc)Cc[Dc]=String.fromCharCode(Dc);Yb=Cc;dc=e.BindingError=cc("BindingError");ec=e.InternalError=cc("InternalError");
e.count_emval_handles=function(){for(var a=0,b=5;b<V.length;++b)void 0!==V[b]&&++a;return a};e.get_first_emval=function(){for(var a=5;a<V.length;++a)if(void 0!==V[a])return V[a];return null};tc=e.UnboundTypeError=cc("UnboundTypeError");
var Rc={A:function(a){return ob(a)},x:function(){},z:function(a){"uncaught_exception"in Za?Za.Va++:Za.Va=1;throw a;},t:function(a,b,c){Tb=c;try{var d=Vb(a);switch(b){case 0:var f=Ub();return 0>f?-28:Lb(d.path,d.flags,0,f).fd;case 1:case 2:return 0;case 3:return d.flags;case 4:return f=Ub(),d.flags|=f,0;case 12:return f=Ub(),C[f+0>>1]=2,0;case 13:case 14:return 0;case 16:case 8:return-28;case 9:return D[Ec()>>2]=28,-1;default:return-28}}catch(g){return"undefined"!==typeof Q&&g instanceof M||w(g),-g.Sa}},
M: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 f=Ub();return D[f>>2]=0;case 21520:return d.tty?-28:-59;case 21531:a=f=Ub();if(!d.Ka.qb)throw new M(59);return d.Ka.qb(d,b,a);case 21523:return d.tty?0:-59;case 21524:return d.tty?0:-59;default:w("bad ioctl syscall "+b)}}catch(g){return"undefined"!==typeof Q&&g instanceof M||w(g),-g.Sa}},N:function(a,
b,c){Tb=c;try{var d=a?A(B,a,void 0):"",f=Ub();return Lb(d,b,f).fd}catch(g){return"undefined"!==typeof Q&&g instanceof M||w(g),-g.Sa}},P:function(a,b,c,d,f){var g=Wb(c);b=R(b);U(a,{name:b,fromWireType:function(h){return!!h},toWireType:function(h,k){return k?d:f},argPackAdvance:8,readValueFromPointer:function(h){if(1===c)var k=F;else if(2===c)k=C;else if(4===c)k=D;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[h>>g])},Qa:null})},O:function(a,b){b=R(b);U(a,{name:b,
fromWireType:function(c){var d=V[c].value;ic(c);return d},toWireType:function(c,d){return jc(d)},argPackAdvance:8,readValueFromPointer:kc,Qa:null})},v:function(a,b,c){c=Wb(c);b=R(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 "'+lc(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:mc(b,c),Qa:null})},B:function(a,b,c,d,f,g){var h=rc(b,c);a=R(a);f=sc(d,f);qc(a,function(){wc("Cannot call "+
a+" due to unbound types",h)},b-1);fc(h,function(k){var m=[k[0],null].concat(k.slice(1)),n=k=a,r=f,t=m.length;2>t&&T("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var v=null!==m[1]&&!1,x=!1,p=1;p<m.length;++p)if(null!==m[p]&&void 0===m[p].Qa){x=!0;break}var G="void"!==m[0].name,H="",da="";for(p=0;p<t-2;++p)H+=(0!==p?", ":"")+"arg"+p,da+=(0!==p?", ":"")+"arg"+p+"Wired";n="return function "+ac(n)+"("+H+") {\nif (arguments.length !== "+(t-2)+") {\nthrowBindingError('function "+
n+" called with ' + arguments.length + ' arguments, expected "+(t-2)+" args!');\n}\n";x&&(n+="var destructors = [];\n");var Xb=x?"destructors":"null";H="throwBindingError invoker fn runDestructors retType classParam".split(" ");r=[T,r,g,oc,m[0],m[1]];v&&(n+="var thisWired = classParam.toWireType("+Xb+", this);\n");for(p=0;p<t-2;++p)n+="var arg"+p+"Wired = argType"+p+".toWireType("+Xb+", arg"+p+"); // "+m[p+2].name+"\n",H.push("argType"+p),r.push(m[p+2]);v&&(da="thisWired"+(0<da.length?", ":"")+da);
n+=(G?"var rv = ":"")+"invoker(fn"+(0<da.length?", ":"")+da+");\n";if(x)n+="runDestructors(destructors);\n";else for(p=v?1:2;p<m.length;++p)t=1===p?"thisWired":"arg"+(p-2)+"Wired",null!==m[p].Qa&&(n+=t+"_dtor("+t+"); // "+m[p].name+"\n",H.push(t+"_dtor"),r.push(m[p].Qa));G&&(n+="var ret = retType.fromWireType(rv);\nreturn ret;\n");H.push(n+"}\n");m=nc(H).apply(null,r);p=b-1;if(!e.hasOwnProperty(k))throw new ec("Replacing nonexistant public symbol");void 0!==e[k].Na&&void 0!==p?e[k].Na[p]=m:(e[k]=
m,e[k].mb=p);return[]})},i:function(a,b,c,d,f){function g(n){return n}b=R(b);-1===f&&(f=4294967295);var h=Wb(c);if(0===d){var k=32-8*c;g=function(n){return n<<k>>>k}}var m=-1!=b.indexOf("unsigned");U(a,{name:b,fromWireType:g,toWireType:function(n,r){if("number"!==typeof r&&"boolean"!==typeof r)throw new TypeError('Cannot convert "'+lc(r)+'" to '+this.name);if(r<d||r>f)throw new TypeError('Passing a number "'+lc(r)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+
d+", "+f+"]!");return m?r>>>0:r|0},argPackAdvance:8,readValueFromPointer:xc(b,h,0!==d),Qa:null})},f:function(a,b,c){function d(g){g>>=2;var h=I;return new f(E,h[g+1],h[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=R(c);U(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{pb:!0})},w:function(a,b){b=R(b);var c="std::string"===b;U(a,{name:b,fromWireType:function(d){var f=I[d>>2];if(c)for(var g=d+4,h=0;h<=f;++h){var k=d+4+
h;if(h==f||0==B[k]){g=g?A(B,g,k-g):"";if(void 0===m)var m=g;else m+=String.fromCharCode(0),m+=g;g=k+1}}else{m=Array(f);for(h=0;h<f;++h)m[h]=String.fromCharCode(B[d+4+h]);m=m.join("")}W(d);return m},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||T("Cannot pass non-string to std::string");var h=(c&&g?function(){return ta(f)}:function(){return f.length})(),k=ob(4+h+
1);I[k>>2]=h;if(c&&g)sa(f,B,k+4,h+1);else if(g)for(g=0;g<h;++g){var m=f.charCodeAt(g);255<m&&(W(k),T("String has UTF-16 code units that do not fit in 8 bits"));B[k+4+g]=m}else for(g=0;g<h;++g)B[k+4+g]=f[g];null!==d&&d.push(W,k);return k},argPackAdvance:8,readValueFromPointer:kc,Qa:function(d){W(d)}})},n:function(a,b,c){c=R(c);if(2===b){var d=va;var f=xa;var g=ya;var h=function(){return wa};var k=1}else 4===b&&(d=za,f=Aa,g=Ba,h=function(){return I},k=2);U(a,{name:c,fromWireType:function(m){for(var n=
I[m>>2],r=h(),t,v=m+4,x=0;x<=n;++x){var p=m+4+x*b;if(x==n||0==r[p>>k])v=d(v,p-v),void 0===t?t=v:(t+=String.fromCharCode(0),t+=v),v=p+b}W(m);return t},toWireType:function(m,n){"string"!==typeof n&&T("Cannot pass non-string to C++ string type "+c);var r=g(n),t=ob(4+r+b);I[t>>2]=r>>k;f(n,t+4,r+b);null!==m&&m.push(W,t);return t},argPackAdvance:8,readValueFromPointer:kc,Qa:function(m){W(m)}})},y:function(a,b){b=R(b);U(a,{zb:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},
s:ic,Q:function(a){if(0===a)return jc(zc());var b=yc[a];a=void 0===b?R(a):b;return jc(zc()[a])},F:function(a){4<a&&(V[a].bb+=1)},q:function(a,b,c,d){a||T("Cannot use deleted val. handle = "+a);a=V[a].value;var f=Bc[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")))(Ac,e,jc);Bc[b]=f}return f(a,c,d)},o:function(){w()},d:function(a,b){X(a,b||1);throw"longjmp";},K:function(a,b,c){B.copyWithin(a,b,b+c)},j:function(a){a>>>=0;var b=B.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{z.grow(Math.min(2147483648,d)-E.byteLength+65535>>>16);Ea(z.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},u:function(a){try{var b=Vb(a);if(null===b.fd)throw new M(8);b.Za&&(b.Za=null);try{b.Ka.close&&b.Ka.close(b)}catch(c){throw c;}finally{rb[b.fd]=null}b.fd=null;return 0}catch(c){return"undefined"!==typeof Q&&c instanceof M||w(c),c.Sa}},L:function(a,b,c,d){try{a:{for(var f=Vb(a),g=a=0;g<c;g++){var h=D[b+(8*g+4)>>2],k=f,m=D[b+8*g>>2],
n=h,r=void 0,t=F;if(0>n||0>r)throw new M(28);if(null===k.fd)throw new M(8);if(1===(k.flags&2097155))throw new M(8);if(16384===(k.node.mode&61440))throw new M(31);if(!k.Ka.read)throw new M(28);var v="undefined"!==typeof r;if(!v)r=k.position;else if(!k.seekable)throw new M(70);var x=k.Ka.read(k,t,m,n,r);v||(k.position+=x);var p=x;if(0>p){var G=-1;break a}a+=p;if(p<h)break}G=a}D[d>>2]=G;return 0}catch(H){return"undefined"!==typeof Q&&H instanceof M||w(H),H.Sa}},G:function(a,b,c,d,f){try{var g=Vb(a);
a=4294967296*c+(b>>>0);if(-9007199254740992>=a||9007199254740992<=a)return-61;Nb(g,a,d);Xa=[g.position>>>0,(L=g.position,1<=+Ma(L)?0<L?(Pa(+Oa(L/4294967296),4294967295)|0)>>>0:~~+Na((L-+(~~L>>>0))/4294967296)>>>0:0)];D[f>>2]=Xa[0];D[f+4>>2]=Xa[1];g.Za&&0===a&&0===d&&(g.Za=null);return 0}catch(h){return"undefined"!==typeof Q&&h instanceof M||w(h),h.Sa}},r:function(a,b,c,d){try{a:{for(var f=Vb(a),g=a=0;g<c;g++){var h=f,k=D[b+8*g>>2],m=D[b+(8*g+4)>>2],n=void 0,r=F;if(0>m||0>n)throw new M(28);if(null===
h.fd)throw new M(8);if(0===(h.flags&2097155))throw new M(8);if(16384===(h.node.mode&61440))throw new M(31);if(!h.Ka.write)throw new M(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 M(70);var v=h.Ka.write(h,r,k,m,n,void 0);t||(h.position+=v);try{if(h.path&&vb.onWriteToFile)vb.onWriteToFile(h.path)}catch(G){y("FS.trackingDelegate['onWriteToFile']('"+h.path+"') threw an exception: "+G.message)}var x=v;if(0>x){var p=-1;break a}a+=
x}p=a}D[d>>2]=p;return 0}catch(G){return"undefined"!==typeof Q&&G instanceof M||w(G),G.Sa}},a:function(){return na|0},m:Fc,e:Gc,I:Hc,p:Ic,H:Jc,D:Kc,C:Lc,E:Mc,J:Nc,k:Oc,l:Pc,c:Qc,memory:z,g: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)},b:function(a){na=a|0},table:pa};
(function(){function a(f){e.asm=f.exports;J--;e.monitorRunDependencies&&e.monitorRunDependencies(J);0==J&&(null!==Qa&&(clearInterval(Qa),Qa=null),Ra&&(f=Ra,Ra=null,f()))}function b(f){a(f.instance)}function c(f){return Wa().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){y("failed to asynchronously prepare wasm: "+g);w(g)})}var d={a:Rc};J++;e.monitorRunDependencies&&e.monitorRunDependencies(J);if(e.instantiateWasm)try{return e.instantiateWasm(d,a)}catch(f){return y("Module.instantiateWasm callback failed with error: "+
f),!1}(function(){if(oa||"function"!==typeof WebAssembly.instantiateStreaming||Ta()||Sa("file://")||"function"!==typeof fetch)return c(b);fetch(K,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(b,function(g){y("wasm streaming compile failed: "+g);y("falling back to ArrayBuffer instantiation");return c(b)})})})();return{}})();
var Ya=e.___wasm_call_ctors=function(){return(Ya=e.___wasm_call_ctors=e.asm.R).apply(null,arguments)},ob=e._malloc=function(){return(ob=e._malloc=e.asm.S).apply(null,arguments)},W=e._free=function(){return(W=e._free=e.asm.T).apply(null,arguments)},vc=e.___getTypeName=function(){return(vc=e.___getTypeName=e.asm.U).apply(null,arguments)};e.___embind_register_native_and_builtin_types=function(){return(e.___embind_register_native_and_builtin_types=e.asm.V).apply(null,arguments)};
var Ec=e.___errno_location=function(){return(Ec=e.___errno_location=e.asm.W).apply(null,arguments)},X=e._setThrew=function(){return(X=e._setThrew=e.asm.X).apply(null,arguments)},Y=e.stackSave=function(){return(Y=e.stackSave=e.asm.Y).apply(null,arguments)},Z=e.stackRestore=function(){return(Z=e.stackRestore=e.asm.Z).apply(null,arguments)},Sc=e.dynCall_v=function(){return(Sc=e.dynCall_v=e.asm._).apply(null,arguments)},Tc=e.dynCall_vi=function(){return(Tc=e.dynCall_vi=e.asm.$).apply(null,arguments)},
Uc=e.dynCall_vii=function(){return(Uc=e.dynCall_vii=e.asm.aa).apply(null,arguments)};e.dynCall_viii=function(){return(e.dynCall_viii=e.asm.ba).apply(null,arguments)};var Vc=e.dynCall_viiii=function(){return(Vc=e.dynCall_viiii=e.asm.ca).apply(null,arguments)},Wc=e.dynCall_ii=function(){return(Wc=e.dynCall_ii=e.asm.da).apply(null,arguments)},Xc=e.dynCall_iii=function(){return(Xc=e.dynCall_iii=e.asm.ea).apply(null,arguments)};e.dynCall_iiii=function(){return(e.dynCall_iiii=e.asm.fa).apply(null,arguments)};
var Yc=e.dynCall_iiiii=function(){return(Yc=e.dynCall_iiiii=e.asm.ga).apply(null,arguments)},Zc=e.dynCall_iiiiiiiii=function(){return(Zc=e.dynCall_iiiiiiiii=e.asm.ha).apply(null,arguments)},$c=e.dynCall_iiiiiiiiii=function(){return($c=e.dynCall_iiiiiiiiii=e.asm.ia).apply(null,arguments)},ad=e.dynCall_iiiijj=function(){return(ad=e.dynCall_iiiijj=e.asm.ja).apply(null,arguments)},bd=e.dynCall_ij=function(){return(bd=e.dynCall_ij=e.asm.ka).apply(null,arguments)},cd=e.dynCall_jjij=function(){return(cd=
e.dynCall_jjij=e.asm.la).apply(null,arguments)};e.dynCall_viiiiii=function(){return(e.dynCall_viiiiii=e.asm.ma).apply(null,arguments)};e.dynCall_viiiii=function(){return(e.dynCall_viiiii=e.asm.na).apply(null,arguments)};e.dynCall_viiiiiiii=function(){return(e.dynCall_viiiiiiii=e.asm.oa).apply(null,arguments)};e.dynCall_viiiiiiiiiii=function(){return(e.dynCall_viiiiiiiiiii=e.asm.pa).apply(null,arguments)};e.dynCall_viiiiiiiiiiii=function(){return(e.dynCall_viiiiiiiiiiii=e.asm.qa).apply(null,arguments)};
e.dynCall_viiiiiii=function(){return(e.dynCall_viiiiiii=e.asm.ra).apply(null,arguments)};e.dynCall_viiiiiiiii=function(){return(e.dynCall_viiiiiiiii=e.asm.sa).apply(null,arguments)};e.dynCall_iiiiii=function(){return(e.dynCall_iiiiii=e.asm.ta).apply(null,arguments)};e.dynCall_jiiiiiiiii=function(){return(e.dynCall_jiiiiiiiii=e.asm.ua).apply(null,arguments)};e.dynCall_iiiiiii=function(){return(e.dynCall_iiiiiii=e.asm.va).apply(null,arguments)};
e.dynCall_iiiiiiii=function(){return(e.dynCall_iiiiiiii=e.asm.wa).apply(null,arguments)};e.dynCall_iiiiiiiiiiii=function(){return(e.dynCall_iiiiiiiiiiii=e.asm.xa).apply(null,arguments)};e.dynCall_jiji=function(){return(e.dynCall_jiji=e.asm.ya).apply(null,arguments)};e.dynCall_iidiiii=function(){return(e.dynCall_iidiiii=e.asm.za).apply(null,arguments)};e.dynCall_i=function(){return(e.dynCall_i=e.asm.Aa).apply(null,arguments)};
e.dynCall_viiiiiiiiii=function(){return(e.dynCall_viiiiiiiiii=e.asm.Ba).apply(null,arguments)};e.dynCall_viiiiiiiiiiiii=function(){return(e.dynCall_viiiiiiiiiiiii=e.asm.Ca).apply(null,arguments)};e.dynCall_jiiiiiiii=function(){return(e.dynCall_jiiiiiiii=e.asm.Da).apply(null,arguments)};e.dynCall_ff=function(){return(e.dynCall_ff=e.asm.Ea).apply(null,arguments)};e.dynCall_jiiiiii=function(){return(e.dynCall_jiiiiii=e.asm.Fa).apply(null,arguments)};
e.dynCall_jiiiii=function(){return(e.dynCall_jiiiii=e.asm.Ga).apply(null,arguments)};e.dynCall_iiijii=function(){return(e.dynCall_iiijii=e.asm.Ha).apply(null,arguments)};function Pc(a,b,c){var d=Y();try{Uc(a,b,c)}catch(f){Z(d);if(f!==f+0&&"longjmp"!==f)throw f;X(1,0)}}function Qc(a,b,c,d,f){var g=Y();try{Vc(a,b,c,d,f)}catch(h){Z(g);if(h!==h+0&&"longjmp"!==h)throw h;X(1,0)}}function Gc(a,b,c){var d=Y();try{return Xc(a,b,c)}catch(f){Z(d);if(f!==f+0&&"longjmp"!==f)throw f;X(1,0)}}
function Oc(a,b){var c=Y();try{Tc(a,b)}catch(d){Z(c);if(d!==d+0&&"longjmp"!==d)throw d;X(1,0)}}function Nc(a){var b=Y();try{Sc(a)}catch(c){Z(b);if(c!==c+0&&"longjmp"!==c)throw c;X(1,0)}}function Fc(a,b){var c=Y();try{return Wc(a,b)}catch(d){Z(c);if(d!==d+0&&"longjmp"!==d)throw d;X(1,0)}}function Hc(a,b,c,d,f){var g=Y();try{return Yc(a,b,c,d,f)}catch(h){Z(g);if(h!==h+0&&"longjmp"!==h)throw h;X(1,0)}}
function Jc(a,b,c,d,f,g,h,k,m,n){var r=Y();try{return $c(a,b,c,d,f,g,h,k,m,n)}catch(t){Z(r);if(t!==t+0&&"longjmp"!==t)throw t;X(1,0)}}function Ic(a,b,c,d,f,g,h,k,m){var n=Y();try{return Zc(a,b,c,d,f,g,h,k,m)}catch(r){Z(n);if(r!==r+0&&"longjmp"!==r)throw r;X(1,0)}}function Mc(a,b,c,d,f,g){var h=Y();try{return cd(a,b,c,d,f,g)}catch(k){Z(h);if(k!==k+0&&"longjmp"!==k)throw k;X(1,0)}}
function Kc(a,b,c,d,f,g,h,k){var m=Y();try{return ad(a,b,c,d,f,g,h,k)}catch(n){Z(m);if(n!==n+0&&"longjmp"!==n)throw n;X(1,0)}}function Lc(a,b,c){var d=Y();try{return bd(a,b,c)}catch(f){Z(d);if(f!==f+0&&"longjmp"!==f)throw f;X(1,0)}}var dd;Ra=function ed(){dd||fd();dd||(Ra=ed)};
function fd(){function a(){if(!dd&&(dd=!0,e.calledRun=!0,!qa)){e.noFSInit||Pb||(Pb=!0,Ob(),e.stdin=e.stdin,e.stdout=e.stdout,e.stderr=e.stderr,e.stdin?Rb("stdin",e.stdin):Kb("/dev/tty","/dev/stdin"),e.stdout?Rb("stdout",null,e.stdout):Kb("/dev/tty","/dev/stdout"),e.stderr?Rb("stderr",null,e.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(e);if(e.onRuntimeInitialized)e.onRuntimeInitialized();if(e.postRun)for("function"==
typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var b=e.postRun.shift();Ka.unshift(b)}Ga(Ka)}}if(!(0<J)){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)La();Ga(Ha);0<J||(e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1);a()},1)):a())}}e.run=fd;if(e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);0<e.preInit.length;)e.preInit.pop()();noExitRuntime=!0;fd();
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

Binary file not shown.

View File

@ -1,5 +1,6 @@
#include <emscripten/bind.h>
#include <emscripten/val.h>
#include <emscripten/threading.h>
#include "avif/avif.h"
using namespace emscripten;
@ -10,6 +11,8 @@ struct AvifOptions {
// 63 = worst quality
int minQuantizer;
int maxQuantizer;
int minQuantizerAlpha;
int maxQuantizerAlpha;
// [0 - 6]
// Creates 2^n tiles in that dimension
int tileRowsLog2;
@ -18,9 +21,10 @@ struct AvifOptions {
// 0 = slowest
// 10 = fastest
int speed;
// 0 = 4:2:0
// 1 = 4:2:2
// 2 = 4:4:4
// 0 = 4:0:0
// 1 = 4:2:0
// 2 = 4:2:2
// 3 = 4:4:4
int subsample;
};
@ -32,18 +36,33 @@ val encode(std::string buffer, int width, int height, AvifOptions options) {
avifPixelFormat format;
switch (options.subsample) {
case 0:
format = AVIF_PIXEL_FORMAT_YUV420;
format = AVIF_PIXEL_FORMAT_YUV400;
break;
case 1:
format = AVIF_PIXEL_FORMAT_YUV422;
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;
@ -53,16 +72,18 @@ val encode(std::string buffer, int width, int height, AvifOptions options) {
avifImageRGBToYUV(image, &srcRGB);
avifEncoder* encoder = avifEncoderCreate();
encoder->maxThreads = 1;
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));
js_result = Uint8Array.new_(typed_memory_view(output.size, output.data));
}
avifImageDestroy(image);
@ -75,6 +96,8 @@ 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)

View File

@ -4,4 +4,4 @@ interface AVIFModule extends EmscriptenWasm.Module {
encode(data: BufferSource, width: number, height: number, options: EncodeOptions): Uint8Array | null;
}
export default function(opts: EmscriptenWasm.ModuleOpts): AVIFModule;
export default function(opts: EmscriptenWasm.ModuleOpts): Promise<AVIFModule>;

View File

@ -7,98 +7,97 @@ function(avif_enc) {
avif_enc = avif_enc || {};
var e;e||(e=typeof avif_enc !== 'undefined' ? avif_enc : {});var aa,ba;e.ready=new Promise(function(a,b){aa=a;ba=b});var ca={},m;for(m in e)e.hasOwnProperty(m)&&(ca[m]=e[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 u="",ha,ia,ja,ka;
if(ea)u=r?require("path").dirname(u)+"/":__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),e.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?u=self.location.href:document.currentScript&&(u=document.currentScript.src),_scriptDir&&(u=_scriptDir),0!==u.indexOf("blob:")?u=u.substr(0,
u.lastIndexOf("/")+1):u="",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=e.print||console.log.bind(console),z=e.printErr||console.warn.bind(console);for(m in ca)ca.hasOwnProperty(m)&&(e[m]=ca[m]);ca=null;var ma=0,na;e.wasmBinary&&(na=e.wasmBinary);var noExitRuntime;e.noExitRuntime&&(noExitRuntime=e.noExitRuntime);
"object"!==typeof WebAssembly&&x("no native wasm support detected");var A,oa=new WebAssembly.Table({initial:2116,maximum:2116,element:"anyfunc"}),pa=!1;function assert(a,b){a||x("Assertion failed: "+b)}var qa="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&&qa)return qa.decode(a.subarray(b,c));for(d="";b<c;){var f=a[b++];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 sa(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 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-f}
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 f=D[a+2*c>>1];if(0==f||c==b/2)return d;++c;d+=String.fromCharCode(f)}}
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 f=0;f<c;++f)D[b>>1]=a.charCodeAt(f),b+=2;D[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 f=F[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 Aa(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}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,D,wa,F,I,Ca,Da;
function Ea(a){G=a;e.HEAP8=H=new Int8Array(a);e.HEAP16=D=new Int16Array(a);e.HEAP32=F=new Int32Array(a);e.HEAPU8=C=new Uint8Array(a);e.HEAPU16=wa=new Uint16Array(a);e.HEAPU32=I=new Uint32Array(a);e.HEAPF32=Ca=new Float32Array(a);e.HEAPF64=Da=new Float64Array(a)}var Fa=e.INITIAL_MEMORY||16777216;e.wasmMemory?A=e.wasmMemory:A=new WebAssembly.Memory({initial:Fa/65536,maximum:32768});A&&(G=A.buffer);Fa=G.byteLength;Ea(G);F[224172]=6139728;
function Ga(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(e);else{var c=b.ub;"number"===typeof c?void 0===b.bb?e.dynCall_v(c):e.dynCall_vi(c,b.bb):c(void 0===b.bb?null:b.bb)}}}var Ha=[],Ia=[],Ja=[],Ka=[];function La(){var a=e.preRun.shift();Ha.unshift(a)}var Ma=Math.abs,Na=Math.ceil,Oa=Math.floor,Pa=Math.min,J=0,Qa=null,Ra=null;e.preloadedImages={};e.preloadedAudios={};
function x(a){if(e.onAbort)e.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=e.locateFile?e.locateFile(Ua,u):u+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({ub:function(){Za()}});function $a(){return 0<$a.Za}
function ab(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 bb(a){var b="/"===a.charAt(0),c="/"===a.substr(-1);(a=ab(a.split("/").filter(function(d){return!!d}),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a}
function cb(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 db(a){if("/"===a)return"/";var b=a.lastIndexOf("/");return-1===b?a:a.substr(b+1)}
function eb(){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=ab(a.split("/").filter(function(d){return!!d}),!b).join("/");return(b?"/":"")+a||"."}var fb=[];function gb(a,b){fb[a]={input:[],output:[],Ya:b};hb(a,ib)}
var ib={open:function(a){var b=fb[a.node.rdev];if(!b)throw new L(43);a.tty=b;a.seekable=!1},close:function(a){a.tty.Ya.flush(a.tty)},flush:function(a){a.tty.Ya.flush(a.tty)},read:function(a,b,c,d){if(!a.tty||!a.tty.Ya.nb)throw new L(60);for(var f=0,g=0;g<d;g++){try{var h=a.tty.Ya.nb(a.tty)}catch(k){throw new L(29);}if(void 0===h&&0===f)throw new L(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.Ya.eb)throw new L(60);
try{for(var f=0;f<d;f++)a.tty.Ya.eb(a.tty,b[c+f])}catch(g){throw new L(29);}d&&(a.node.timestamp=Date.now());return f}},jb={nb:function(a){if(!a.input.length){var b=null;if(ea){var c=Buffer.Za?Buffer.Za(256):new Buffer(256),d=0;try{d=ja.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(ta(b)+1);b=sa(b,c,0,c.length);c.length=b;a.input=c}return a.input.shift()},eb: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=[])}},kb={eb: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={Qa:null,
Ua: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.Qa||(M.Qa={dir:{node:{Va:M.Na.Va,Sa:M.Na.Sa,lookup:M.Na.lookup,$a:M.Na.$a,rename:M.Na.rename,unlink:M.Na.unlink,rmdir:M.Na.rmdir,readdir:M.Na.readdir,symlink:M.Na.symlink},stream:{Xa:M.Oa.Xa}},file:{node:{Va:M.Na.Va,Sa:M.Na.Sa},stream:{Xa:M.Oa.Xa,read:M.Oa.read,write:M.Oa.write,hb:M.Oa.hb,ob:M.Oa.ob,qb:M.Oa.qb}},link:{node:{Va:M.Na.Va,Sa:M.Na.Sa,readlink:M.Na.readlink},
stream:{}},ib:{node:{Va:M.Na.Va,Sa:M.Na.Sa},stream:lb}});c=mb(a,b,c,d);16384===(c.mode&61440)?(c.Na=M.Qa.dir.node,c.Oa=M.Qa.dir.stream,c.Ma={}):32768===(c.mode&61440)?(c.Na=M.Qa.file.node,c.Oa=M.Qa.file.stream,c.Pa=0,c.Ma=null):40960===(c.mode&61440)?(c.Na=M.Qa.link.node,c.Oa=M.Qa.link.stream):8192===(c.mode&61440)&&(c.Na=M.Qa.ib.node,c.Oa=M.Qa.ib.stream);c.timestamp=Date.now();a&&(a.Ma[b]=c);return c},Lb:function(a){if(a.Ma&&a.Ma.subarray){for(var b=[],c=0;c<a.Pa;++c)b.push(a.Ma[c]);return b}return a.Ma},
Mb:function(a){return a.Ma?a.Ma.subarray?a.Ma.subarray(0,a.Pa):new Uint8Array(a.Ma):new Uint8Array(0)},jb:function(a,b){var c=a.Ma?a.Ma.length:0;c>=b||(b=Math.max(b,c*(1048576>c?2:1.125)>>>0),0!=c&&(b=Math.max(b,256)),c=a.Ma,a.Ma=new Uint8Array(b),0<a.Pa&&a.Ma.set(c.subarray(0,a.Pa),0))},Eb:function(a,b){if(a.Pa!=b)if(0==b)a.Ma=null,a.Pa=0;else{if(!a.Ma||a.Ma.subarray){var c=a.Ma;a.Ma=new Uint8Array(b);c&&a.Ma.set(c.subarray(0,Math.min(b,a.Pa)))}else if(a.Ma||(a.Ma=[]),a.Ma.length>b)a.Ma.length=b;
else for(;a.Ma.length<b;)a.Ma.push(0);a.Pa=b}},Na:{Va: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.Pa: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.sb=4096;b.blocks=Math.ceil(b.size/b.sb);return b},Sa:function(a,b){void 0!==b.mode&&(a.mode=b.mode);void 0!==b.timestamp&&
(a.timestamp=b.timestamp);void 0!==b.size&&M.Eb(a,b.size)},lookup:function(){throw nb[44];},$a: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=ob(b,c)}catch(g){}if(d)for(var f in d.Ma)throw new L(55);}delete a.parent.Ma[a.name];a.name=c;b.Ma[c]=a;a.parent=b},unlink:function(a,b){delete a.Ma[b]},rmdir:function(a,b){var c=ob(a,b),d;for(d in c.Ma)throw new L(55);delete a.Ma[b]},readdir:function(a){var b=[".",".."],c;for(c in a.Ma)a.Ma.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}},Oa:{read:function(a,b,c,d,f){var g=a.node.Ma;if(f>=a.node.Pa)return 0;a=Math.min(a.node.Pa-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===H.buffer&&(g=!1);if(!d)return 0;a=a.node;a.timestamp=Date.now();if(b.subarray&&(!a.Ma||a.Ma.subarray)){if(g)return a.Ma=
b.subarray(c,c+d),a.Pa=d;if(0===a.Pa&&0===f)return a.Ma=b.slice(c,c+d),a.Pa=d;if(f+d<=a.Pa)return a.Ma.set(b.subarray(c,c+d),f),d}M.jb(a,f+d);if(a.Ma.subarray&&b.subarray)a.Ma.set(b.subarray(c,c+d),f);else for(g=0;g<d;g++)a.Ma[f+g]=b[c+g];a.Pa=Math.max(a.Pa,f+d);return d},Xa:function(a,b,c){1===c?b+=a.position:2===c&&32768===(a.node.mode&61440)&&(b+=a.node.Pa);if(0>b)throw new L(28);return b},hb:function(a,b,c){M.jb(a.node,b+c);a.node.Pa=Math.max(a.node.Pa,b+c)},ob:function(a,b,c,d,f,g){assert(0===
b);if(32768!==(a.node.mode&61440))throw new L(43);a=a.node.Ma;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=pb(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{Qb:c,Kb:d}},qb:function(a,b,c,d,f){if(32768!==(a.node.mode&61440))throw new L(43);if(f&2)return 0;M.Oa.write(a,b,0,d,c,!1);return 0}}},qb=null,rb={},sb=[],tb=1,ub=null,vb=!0,wb={},L=null,nb={};
function N(a,b){a=eb("/",a);b=b||{};if(!a)return{path:"",node:null};var c={mb:!0,fb:0},d;for(d in c)void 0===b[d]&&(b[d]=c[d]);if(8<b.fb)throw new L(32);a=ab(a.split("/").filter(function(h){return!!h}),!1);var f=qb;c="/";for(d=0;d<a.length;d++){var g=d===a.length-1;if(g&&b.parent)break;f=ob(f,a[d]);c=bb(c+"/"+a[d]);f.ab&&(!g||g&&b.mb)&&(f=f.ab.root);if(!g||b.lb)for(g=0;40960===(f.mode&61440);)if(f=xb(c),c=eb(cb(c),f),f=N(c,{fb:b.fb}).node,40<g++)throw new L(32);}return{path:c,node:f}}
function yb(a){for(var b;;){if(a===a.parent)return a=a.Ua.pb,b?"/"!==a[a.length-1]?a+"/"+b:a+b:a;b=b?a.name+"/"+b:a.name;a=a.parent}}function zb(a,b){for(var c=0,d=0;d<b.length;d++)c=(c<<5)-c+b.charCodeAt(d)|0;return(a+c>>>0)%ub.length}function ob(a,b){var c;if(c=(c=Ab(a,"x"))?c:a.Na.lookup?0:2)throw new L(c,a);for(c=ub[zb(a.id,b)];c;c=c.Bb){var d=c.name;if(c.parent.id===a.id&&d===b)return c}return a.Na.lookup(a,b)}
function mb(a,b,c,d){a=new Bb(a,b,c,d);b=zb(a.parent.id,a.name);a.Bb=ub[b];return ub[b]=a}var Cb={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 Db(a){var b=["r","w","rw"][a&3];a&512&&(b+="w");return b}function Ab(a,b){if(vb)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 Eb(a,b){try{return ob(a,b),20}catch(c){}return Ab(a,"wx")}function Fb(a){var b=4096;for(a=a||0;a<=b;a++)if(!sb[a])return a;throw new L(33);}function Gb(a,b){Hb||(Hb=function(){},Hb.prototype={});var c=new Hb,d;for(d in a)c[d]=a[d];a=c;b=Fb(b);a.fd=b;return sb[b]=a}var lb={open:function(a){a.Oa=rb[a.node.rdev].Oa;a.Oa.open&&a.Oa.open(a)},Xa:function(){throw new L(70);}};function hb(a,b){rb[a]={Oa:b}}
function Ib(a,b){var c="/"===b,d=!b;if(c&&qb)throw new L(10);if(!c&&!d){var f=N(b,{mb:!1});b=f.path;f=f.node;if(f.ab)throw new L(10);if(16384!==(f.mode&61440))throw new L(54);}b={type:a,Pb:{},pb:b,Ab:[]};a=a.Ua(b);a.Ua=b;b.root=a;c?qb=a:f&&(f.ab=b,f.Ua&&f.Ua.Ab.push(b))}function Jb(a,b,c){var d=N(a,{parent:!0}).node;a=db(a);if(!a||"."===a||".."===a)throw new L(28);var f=Eb(d,a);if(f)throw new L(f);if(!d.Na.$a)throw new L(63);return d.Na.$a(d,a,b,c)}function O(a){Jb(a,16895,0)}
function Kb(a,b,c){"undefined"===typeof c&&(c=b,b=438);Jb(a,b|8192,c)}function Lb(a,b){if(!eb(a))throw new L(44);var c=N(b,{parent:!0}).node;if(!c)throw new L(44);b=db(b);var d=Eb(c,b);if(d)throw new L(d);if(!c.Na.symlink)throw new L(63);c.Na.symlink(c,b,a)}function xb(a){a=N(a).node;if(!a)throw new L(44);if(!a.Na.readlink)throw new L(28);return eb(yb(a.parent),a.Na.readlink(a))}
function Mb(a,b,c,d){if(""===a)throw new L(44);if("string"===typeof b){var f=Cb[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=bb(a);try{g=N(a,{lb:!(b&131072)}).node}catch(k){}}f=!1;if(b&64)if(g){if(b&128)throw new L(20);}else g=Jb(a,c,0),f=!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(!f&&(c=g?40960===(g.mode&61440)?
32:16384===(g.mode&61440)&&("r"!==Db(b)||b&512)?31:Ab(g,Db(b)):44))throw new L(c);if(b&512){c=g;var h;"string"===typeof c?h=N(c,{lb:!0}).node:h=c;if(!h.Na.Sa)throw new L(63);if(16384===(h.mode&61440))throw new L(31);if(32768!==(h.mode&61440))throw new L(28);if(c=Ab(h,"w"))throw new L(c);h.Na.Sa(h,{size:0,timestamp:Date.now()})}b&=-131713;d=Gb({node:g,path:yb(g),flags:b,seekable:!0,position:0,Oa:g.Oa,Jb:[],error:!1},d);d.Oa.open&&d.Oa.open(d);!e.logReadFiles||b&1||(Nb||(Nb={}),a in Nb||(Nb[a]=1,z("FS.trackingDelegate error on read file: "+
a)));try{wb.onOpenFile&&(g=0,1!==(b&2097155)&&(g|=1),0!==(b&2097155)&&(g|=2),wb.onOpenFile(a,g))}catch(k){z("FS.trackingDelegate['onOpenFile']('"+a+"', flags) threw an exception: "+k.message)}return d}function Ob(a,b,c){if(null===a.fd)throw new L(8);if(!a.seekable||!a.Oa.Xa)throw new L(70);if(0!=c&&1!=c&&2!=c)throw new L(28);a.position=a.Oa.Xa(a,b,c);a.Jb=[]}
function Pb(){L||(L=function(a,b){this.node=b;this.Fb=function(c){this.Wa=c};this.Fb(a);this.message="FS error"},L.prototype=Error(),L.prototype.constructor=L,[44].forEach(function(a){nb[a]=new L(a);nb[a].stack="<generic error, no stack>"}))}var Qb;function Rb(a,b){var c=0;a&&(c|=365);b&&(c|=146);return c}
function Sb(a,b,c){a=bb("/dev/"+a);var d=Rb(!!b,!!c);Tb||(Tb=64);var f=Tb++<<8|0;hb(f,{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(v){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}});
Kb(a,d,f)}var Tb,Q={},Hb,Nb,Ub=void 0;function Vb(){Ub+=4;return F[Ub-4>>2]}function Wb(a){a=sb[a];if(!a)throw new L(8);return a}var Xb={};function Yb(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Zb(a){return this.fromWireType(I[a>>2])}var $b={},R={},ac={};function bc(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 cc(a,b){a=bc(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function dc(a){var b=Error,c=cc(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 ec=void 0;function fc(a,b,c){function d(k){k=c(k);if(k.length!==a.length)throw new ec("Mismatched type converter count");for(var l=0;l<a.length;++l)S(a[l],k[l])}a.forEach(function(k){ac[k]=b});var f=Array(b.length),g=[],h=0;b.forEach(function(k,l){R.hasOwnProperty(k)?f[l]=R[k]:(g.push(k),$b.hasOwnProperty(k)||($b[k]=[]),$b[k].push(function(){f[l]=R[k];++h;h===g.length&&d(f)}))});0===g.length&&d(f)}
function hc(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 ic=void 0;function T(a){for(var b="";C[a];)b+=ic[C[a++]];return b}var jc=void 0;function U(a){throw new jc(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.yb)return;U("Cannot register type '"+d+"' twice")}R[a]=b;delete ac[a];$b.hasOwnProperty(a)&&(b=$b[a],delete $b[a],b.forEach(function(f){f()}))}var kc=[],V=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
function lc(a){4<a&&0===--V[a].gb&&(V[a]=void 0,kc.push(a))}function mc(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=kc.length?kc.pop():V.length;V[b]={gb:1,value:a};return b}}function nc(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
function oc(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 pc(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=cc(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
function qc(a,b){var c=e;if(void 0===c[a].Ra){var d=c[a];c[a]=function(){c[a].Ra.hasOwnProperty(arguments.length)||U("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].Ra+")!");return c[a].Ra[arguments.length].apply(this,arguments)};c[a].Ra=[];c[a].Ra[d.rb]=d}}
function rc(a,b,c){e.hasOwnProperty(a)?((void 0===c||void 0!==e[a].Ra&&void 0!==e[a].Ra[c])&&U("Cannot register public name '"+a+"' twice"),qc(a,a),e.hasOwnProperty(c)&&U("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),e[a].Ra[c]=b):(e[a]=b,void 0!==c&&(e[a].Ob=c))}function sc(a,b){for(var c=[],d=0;d<a;d++)c.push(F[(b>>2)+d]);return c}
function tc(a,b){a=T(a);var c=e["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&&U("unknown function pointer with signature "+a+": "+b);return c}var uc=void 0;function vc(a){a=wc(a);var b=T(a);W(a);return b}
function xc(a,b){function c(g){f[g]||R[g]||(ac[g]?ac[g].forEach(c):(d.push(g),f[g]=!0))}var d=[],f={};b.forEach(c);throw new uc(a+": "+d.map(vc).join([", "]));}function yc(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 D[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 zc={};
function Ac(){return"object"===typeof globalThis?globalThis:Function("return this")()}function Bc(a,b){var c=R[a];void 0===c&&U(b+" has unknown type "+vc(a));return c}var Cc={};function Bb(a,b,c,d){a||(a=this);this.parent=a;this.Ua=a.Ua;this.ab=null;this.id=tb++;this.name=b;this.mode=c;this.Na={};this.Oa={};this.rdev=d}
Object.defineProperties(Bb.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}}});Pb();ub=Array(4096);Ib(M,"/");O("/tmp");O("/home");O("/home/web_user");
(function(){O("/dev");hb(259,{read:function(){return 0},write:function(d,f,g,h){return h}});Kb("/dev/null",259);gb(1280,jb);gb(1536,kb);Kb("/dev/tty",1280);Kb("/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")});Sb("random",b);Sb("urandom",b);O("/dev/shm");
O("/dev/shm/tmp")})();O("/proc");O("/proc/self");O("/proc/self/fd");Ib({Ua:function(){var a=mb("/proc/self","fd",16895,73);a.Na={lookup:function(b,c){var d=sb[+c];if(!d)throw new L(8);b={parent:null,Ua:{pb:"fake"},Na:{readlink:function(){return d.path}}};return b.parent=b}};return a}},"/proc/self/fd");ec=e.InternalError=dc("InternalError");for(var Dc=Array(256),Ec=0;256>Ec;++Ec)Dc[Ec]=String.fromCharCode(Ec);ic=Dc;jc=e.BindingError=dc("BindingError");
e.count_emval_handles=function(){for(var a=0,b=5;b<V.length;++b)void 0!==V[b]&&++a;return a};e.get_first_emval=function(){for(var a=5;a<V.length;++a)if(void 0!==V[a])return V[a];return null};uc=e.UnboundTypeError=dc("UnboundTypeError");
var Sc={w:function(a){return pb(a)},U:function(){},S:function(a){"uncaught_exception"in $a?$a.Za++:$a.Za=1;throw a;},q:function(a,b,c){Ub=c;try{var d=Wb(a);switch(b){case 0:var f=Vb();return 0>f?-28:Mb(d.path,d.flags,0,f).fd;case 1:case 2:return 0;case 3:return d.flags;case 4:return f=Vb(),d.flags|=f,0;case 12:return f=Vb(),D[f+0>>1]=2,0;case 13:case 14:return 0;case 16:case 8:return-28;case 9:return F[Fc()>>2]=28,-1;default:return-28}}catch(g){return"undefined"!==typeof Q&&g instanceof L||x(g),-g.Wa}},
M:function(a,b,c){Ub=c;try{var d=Wb(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=Vb();return F[f>>2]=0;case 21520:return d.tty?-28:-59;case 21531:a=f=Vb();if(!d.Oa.zb)throw new L(59);return d.Oa.zb(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.Wa}},N:function(a,
b,c){Ub=c;try{var d=a?B(C,a,void 0):"",f=Vb();return Mb(d,b,f).fd}catch(g){return"undefined"!==typeof Q&&g instanceof L||x(g),-g.Wa}},A:function(a){var b=Xb[a];delete Xb[a];var c=b.Cb,d=b.Db,f=b.kb,g=f.map(function(h){return h.xb}).concat(f.map(function(h){return h.Hb}));fc([a],g,function(h){var k={};f.forEach(function(l,n){var p=h[n],t=l.vb,v=l.wb,w=h[n+f.length],q=l.Gb,E=l.Ib;k[l.tb]={read:function(y){return p.fromWireType(t(v,y))},write:function(y,P){var ra=[];q(E,y,w.toWireType(ra,P));Yb(ra)}}});
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:Zb,Ta:d}]})},P:function(a,b,c,d,f){var g=hc(c);b=T(b);S(a,{name:b,fromWireType:function(h){return!!h},toWireType:function(h,k){return k?d:f},argPackAdvance:8,readValueFromPointer:function(h){if(1===
c)var k=H;else if(2===c)k=D;else if(4===c)k=F;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[h>>g])},Ta:null})},O:function(a,b){b=T(b);S(a,{name:b,fromWireType:function(c){var d=V[c].value;lc(c);return d},toWireType:function(c,d){return mc(d)},argPackAdvance:8,readValueFromPointer:Zb,Ta:null})},t:function(a,b,c){c=hc(c);b=T(b);S(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+
nc(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:oc(b,c),Ta:null})},y:function(a,b,c,d,f,g){var h=sc(b,c);a=T(a);f=tc(d,f);rc(a,function(){xc("Cannot call "+a+" due to unbound types",h)},b-1);fc([],h,function(k){var l=[k[0],null].concat(k.slice(1)),n=k=a,p=f,t=l.length;2>t&&U("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var v=null!==l[1]&&!1,w=!1,q=1;q<l.length;++q)if(null!==l[q]&&void 0===l[q].Ta){w=!0;break}var E="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 "+bc(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 ra=w?"destructors":"null";y="throwBindingError invoker fn runDestructors retType classParam".split(" ");p=[U,p,g,Yb,l[0],l[1]];v&&(n+="var thisWired = classParam.toWireType("+ra+", this);\n");
for(q=0;q<t-2;++q)n+="var arg"+q+"Wired = argType"+q+".toWireType("+ra+", arg"+q+"); // "+l[q+2].name+"\n",y.push("argType"+q),p.push(l[q+2]);v&&(P="thisWired"+(0<P.length?", ":"")+P);n+=(E?"var rv = ":"")+"invoker(fn"+(0<P.length?", ":"")+P+");\n";if(w)n+="runDestructors(destructors);\n";else for(q=v?1:2;q<l.length;++q)t=1===q?"thisWired":"arg"+(q-2)+"Wired",null!==l[q].Ta&&(n+=t+"_dtor("+t+"); // "+l[q].name+"\n",y.push(t+"_dtor"),p.push(l[q].Ta));E&&(n+="var ret = retType.fromWireType(rv);\nreturn ret;\n");
y.push(n+"}\n");l=pc(y).apply(null,p);q=b-1;if(!e.hasOwnProperty(k))throw new ec("Replacing nonexistant public symbol");void 0!==e[k].Ra&&void 0!==q?e[k].Ra[q]=l:(e[k]=l,e[k].rb=q);return[]})},i:function(a,b,c,d,f){function g(n){return n}b=T(b);-1===f&&(f=4294967295);var h=hc(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 "'+
nc(p)+'" to '+this.name);if(p<d||p>f)throw new TypeError('Passing a number "'+nc(p)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+f+"]!");return l?p>>>0:p|0},argPackAdvance:8,readValueFromPointer:yc(b,h,0!==d),Ta:null})},f:function(a,b,c){function d(g){g>>=2;var h=I;return new f(G,h[g+1],h[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=T(c);S(a,{name:c,fromWireType:d,argPackAdvance:8,
readValueFromPointer:d},{yb:!0})},u:function(a,b){b=T(b);var c="std::string"===b;S(a,{name:b,fromWireType:function(d){var f=I[d>>2];if(c)for(var g=d+4,h=0;h<=f;++h){var k=d+4+h;if(h==f||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(f);for(h=0;h<f;++h)l[h]=String.fromCharCode(C[d+4+h]);l=l.join("")}W(d);return l},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||U("Cannot pass non-string to std::string");var h=(c&&g?function(){return ta(f)}:function(){return f.length})(),k=pb(4+h+1);I[k>>2]=h;if(c&&g)sa(f,C,k+4,h+1);else if(g)for(g=0;g<h;++g){var l=f.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]=f[g];null!==d&&d.push(W,k);return k},argPackAdvance:8,readValueFromPointer:Zb,Ta:function(d){W(d)}})},n:function(a,b,c){c=T(c);if(2===b){var d=
va;var f=xa;var g=ya;var h=function(){return wa};var k=1}else 4===b&&(d=za,f=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,v=l+4,w=0;w<=n;++w){var q=l+4+w*b;if(w==n||0==p[q>>k])v=d(v,q-v),void 0===t?t=v:(t+=String.fromCharCode(0),t+=v),v=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=pb(4+p+b);I[t>>2]=p>>k;f(n,t+4,p+b);null!==l&&l.push(W,t);return t},argPackAdvance:8,
readValueFromPointer:Zb,Ta:function(l){W(l)}})},H:function(a,b,c,d,f,g){Xb[a]={name:T(b),Cb:tc(c,d),Db:tc(f,g),kb:[]}},z:function(a,b,c,d,f,g,h,k,l,n){Xb[a].kb.push({tb:T(b),xb:c,vb:tc(d,f),wb:g,Hb:h,Gb:tc(k,l),Ib:n})},Q:function(a,b){b=T(b);S(a,{Nb:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},s:lc,T:function(a){if(0===a)return mc(Ac());var b=zc[a];a=void 0===b?T(a):b;return mc(Ac()[a])},x:function(a){4<a&&(V[a].gb+=1)},J:function(a,b,c,d){a||U("Cannot use deleted val. handle = "+
a);a=V[a].value;var f=Cc[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")))(Bc,
e,mc);Cc[b]=f}return f(a,c,d)},v:function(){x()},d:function(a,b){X(a,b||1);throw"longjmp";},K:function(a,b,c){C.copyWithin(a,b,b+c)},j: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 f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},r:function(a){try{var b=Wb(a);if(null===b.fd)throw new L(8);
b.cb&&(b.cb=null);try{b.Oa.close&&b.Oa.close(b)}catch(c){throw c;}finally{sb[b.fd]=null}b.fd=null;return 0}catch(c){return"undefined"!==typeof Q&&c instanceof L||x(c),c.Wa}},L:function(a,b,c,d){try{a:{for(var f=Wb(a),g=a=0;g<c;g++){var h=F[b+(8*g+4)>>2],k=f,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.Oa.read)throw new L(28);var v="undefined"!==typeof p;if(!v)p=
k.position;else if(!k.seekable)throw new L(70);var w=k.Oa.read(k,t,l,n,p);v||(k.position+=w);var q=w;if(0>q){var E=-1;break a}a+=q;if(q<h)break}E=a}F[d>>2]=E;return 0}catch(y){return"undefined"!==typeof Q&&y instanceof L||x(y),y.Wa}},E:function(a,b,c,d,f){try{var g=Wb(a);a=4294967296*c+(b>>>0);if(-9007199254740992>=a||9007199254740992<=a)return-61;Ob(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[f>>2]=
Ya[0];F[f+4>>2]=Ya[1];g.cb&&0===a&&0===d&&(g.cb=null);return 0}catch(h){return"undefined"!==typeof Q&&h instanceof L||x(h),h.Wa}},p:function(a,b,c,d){try{a:{for(var f=Wb(a),g=a=0;g<c;g++){var h=f,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.Oa.write)throw new L(28);h.seekable&&h.flags&1024&&Ob(h,0,2);var t="undefined"!==typeof n;if(!t)n=h.position;
else if(!h.seekable)throw new L(70);var v=h.Oa.write(h,p,k,l,n,void 0);t||(h.position+=v);try{if(h.path&&wb.onWriteToFile)wb.onWriteToFile(h.path)}catch(E){z("FS.trackingDelegate['onWriteToFile']('"+h.path+"') threw an exception: "+E.message)}var w=v;if(0>w){var q=-1;break a}a+=w}q=a}F[d>>2]=q;return 0}catch(E){return"undefined"!==typeof Q&&E instanceof L||x(E),E.Wa}},a:function(){return ma|0},m:Gc,e:Hc,G:Ic,o:Jc,F:Kc,C:Lc,B:Mc,D:Nc,I:Oc,k:Pc,l:Qc,c:Rc,memory:A,g: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)},b:function(a){ma=a|0},table:oa,R:function(a){var b=Date.now()/1E3|0;a&&(F[a>>2]=b);return b}};
(function(){function a(f){e.asm=f.exports;J--;e.monitorRunDependencies&&e.monitorRunDependencies(J);0==J&&(null!==Qa&&(clearInterval(Qa),Qa=null),Ra&&(f=Ra,Ra=null,f()))}function b(f){a(f.instance)}function c(f){return Wa().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){z("failed to asynchronously prepare wasm: "+g);x(g)})}var d={a:Sc};J++;e.monitorRunDependencies&&e.monitorRunDependencies(J);if(e.instantiateWasm)try{return e.instantiateWasm(d,a)}catch(f){return z("Module.instantiateWasm callback failed with error: "+
f),!1}(function(){if(na||"function"!==typeof WebAssembly.instantiateStreaming||Ta()||Sa("file://")||"function"!==typeof fetch)return c(b);fetch(K,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(b,function(g){z("wasm streaming compile failed: "+g);z("falling back to ArrayBuffer instantiation");return c(b)})})})();return{}})();
var Za=e.___wasm_call_ctors=function(){return(Za=e.___wasm_call_ctors=e.asm.V).apply(null,arguments)},pb=e._malloc=function(){return(pb=e._malloc=e.asm.W).apply(null,arguments)},W=e._free=function(){return(W=e._free=e.asm.X).apply(null,arguments)},wc=e.___getTypeName=function(){return(wc=e.___getTypeName=e.asm.Y).apply(null,arguments)};e.___embind_register_native_and_builtin_types=function(){return(e.___embind_register_native_and_builtin_types=e.asm.Z).apply(null,arguments)};
var Fc=e.___errno_location=function(){return(Fc=e.___errno_location=e.asm._).apply(null,arguments)},X=e._setThrew=function(){return(X=e._setThrew=e.asm.$).apply(null,arguments)},Y=e.stackSave=function(){return(Y=e.stackSave=e.asm.aa).apply(null,arguments)},Z=e.stackRestore=function(){return(Z=e.stackRestore=e.asm.ba).apply(null,arguments)},Tc=e.dynCall_v=function(){return(Tc=e.dynCall_v=e.asm.ca).apply(null,arguments)},Uc=e.dynCall_vi=function(){return(Uc=e.dynCall_vi=e.asm.da).apply(null,arguments)},
Vc=e.dynCall_vii=function(){return(Vc=e.dynCall_vii=e.asm.ea).apply(null,arguments)};e.dynCall_viii=function(){return(e.dynCall_viii=e.asm.fa).apply(null,arguments)};var Wc=e.dynCall_viiii=function(){return(Wc=e.dynCall_viiii=e.asm.ga).apply(null,arguments)},Xc=e.dynCall_ii=function(){return(Xc=e.dynCall_ii=e.asm.ha).apply(null,arguments)},Yc=e.dynCall_iii=function(){return(Yc=e.dynCall_iii=e.asm.ia).apply(null,arguments)};e.dynCall_iiii=function(){return(e.dynCall_iiii=e.asm.ja).apply(null,arguments)};
var Zc=e.dynCall_iiiii=function(){return(Zc=e.dynCall_iiiii=e.asm.ka).apply(null,arguments)},$c=e.dynCall_iiiiiiiii=function(){return($c=e.dynCall_iiiiiiiii=e.asm.la).apply(null,arguments)},ad=e.dynCall_iiiiiiiiii=function(){return(ad=e.dynCall_iiiiiiiiii=e.asm.ma).apply(null,arguments)},bd=e.dynCall_iiiijj=function(){return(bd=e.dynCall_iiiijj=e.asm.na).apply(null,arguments)},cd=e.dynCall_ij=function(){return(cd=e.dynCall_ij=e.asm.oa).apply(null,arguments)},dd=e.dynCall_jjij=function(){return(dd=
e.dynCall_jjij=e.asm.pa).apply(null,arguments)};e.dynCall_i=function(){return(e.dynCall_i=e.asm.qa).apply(null,arguments)};e.dynCall_iiiiii=function(){return(e.dynCall_iiiiii=e.asm.ra).apply(null,arguments)};e.dynCall_viiiii=function(){return(e.dynCall_viiiii=e.asm.sa).apply(null,arguments)};e.dynCall_viiiiii=function(){return(e.dynCall_viiiiii=e.asm.ta).apply(null,arguments)};e.dynCall_viiiiiiii=function(){return(e.dynCall_viiiiiiii=e.asm.ua).apply(null,arguments)};
e.dynCall_viiiiiiiiiii=function(){return(e.dynCall_viiiiiiiiiii=e.asm.va).apply(null,arguments)};e.dynCall_viiiiiiiiiiii=function(){return(e.dynCall_viiiiiiiiiiii=e.asm.wa).apply(null,arguments)};e.dynCall_viiiiiii=function(){return(e.dynCall_viiiiiii=e.asm.xa).apply(null,arguments)};e.dynCall_viiiiiiiii=function(){return(e.dynCall_viiiiiiiii=e.asm.ya).apply(null,arguments)};e.dynCall_jiiiiiiiii=function(){return(e.dynCall_jiiiiiiiii=e.asm.za).apply(null,arguments)};
e.dynCall_iiiiiii=function(){return(e.dynCall_iiiiiii=e.asm.Aa).apply(null,arguments)};e.dynCall_iiiiiiii=function(){return(e.dynCall_iiiiiiii=e.asm.Ba).apply(null,arguments)};e.dynCall_iiiiiiiiiiii=function(){return(e.dynCall_iiiiiiiiiiii=e.asm.Ca).apply(null,arguments)};e.dynCall_jiji=function(){return(e.dynCall_jiji=e.asm.Da).apply(null,arguments)};e.dynCall_iidiiii=function(){return(e.dynCall_iidiiii=e.asm.Ea).apply(null,arguments)};
e.dynCall_viiiiiiiiii=function(){return(e.dynCall_viiiiiiiiii=e.asm.Fa).apply(null,arguments)};e.dynCall_viiiiiiiiiiiii=function(){return(e.dynCall_viiiiiiiiiiiii=e.asm.Ga).apply(null,arguments)};e.dynCall_jiiiiiiii=function(){return(e.dynCall_jiiiiiiii=e.asm.Ha).apply(null,arguments)};e.dynCall_ff=function(){return(e.dynCall_ff=e.asm.Ia).apply(null,arguments)};e.dynCall_jiiiiii=function(){return(e.dynCall_jiiiiii=e.asm.Ja).apply(null,arguments)};
e.dynCall_jiiiii=function(){return(e.dynCall_jiiiii=e.asm.Ka).apply(null,arguments)};e.dynCall_iiijii=function(){return(e.dynCall_iiijii=e.asm.La).apply(null,arguments)};function Qc(a,b,c){var d=Y();try{Vc(a,b,c)}catch(f){Z(d);if(f!==f+0&&"longjmp"!==f)throw f;X(1,0)}}function Rc(a,b,c,d,f){var g=Y();try{Wc(a,b,c,d,f)}catch(h){Z(g);if(h!==h+0&&"longjmp"!==h)throw h;X(1,0)}}function Hc(a,b,c){var d=Y();try{return Yc(a,b,c)}catch(f){Z(d);if(f!==f+0&&"longjmp"!==f)throw f;X(1,0)}}
function Pc(a,b){var c=Y();try{Uc(a,b)}catch(d){Z(c);if(d!==d+0&&"longjmp"!==d)throw d;X(1,0)}}function Oc(a){var b=Y();try{Tc(a)}catch(c){Z(b);if(c!==c+0&&"longjmp"!==c)throw c;X(1,0)}}function Gc(a,b){var c=Y();try{return Xc(a,b)}catch(d){Z(c);if(d!==d+0&&"longjmp"!==d)throw d;X(1,0)}}function Ic(a,b,c,d,f){var g=Y();try{return Zc(a,b,c,d,f)}catch(h){Z(g);if(h!==h+0&&"longjmp"!==h)throw h;X(1,0)}}
function Kc(a,b,c,d,f,g,h,k,l,n){var p=Y();try{return ad(a,b,c,d,f,g,h,k,l,n)}catch(t){Z(p);if(t!==t+0&&"longjmp"!==t)throw t;X(1,0)}}function Jc(a,b,c,d,f,g,h,k,l){var n=Y();try{return $c(a,b,c,d,f,g,h,k,l)}catch(p){Z(n);if(p!==p+0&&"longjmp"!==p)throw p;X(1,0)}}function Nc(a,b,c,d,f,g){var h=Y();try{return dd(a,b,c,d,f,g)}catch(k){Z(h);if(k!==k+0&&"longjmp"!==k)throw k;X(1,0)}}
function Lc(a,b,c,d,f,g,h,k){var l=Y();try{return bd(a,b,c,d,f,g,h,k)}catch(n){Z(l);if(n!==n+0&&"longjmp"!==n)throw n;X(1,0)}}function Mc(a,b,c){var d=Y();try{return cd(a,b,c)}catch(f){Z(d);if(f!==f+0&&"longjmp"!==f)throw f;X(1,0)}}var ed;Ra=function fd(){ed||gd();ed||(Ra=fd)};
function gd(){function a(){if(!ed&&(ed=!0,e.calledRun=!0,!pa)){e.noFSInit||Qb||(Qb=!0,Pb(),e.stdin=e.stdin,e.stdout=e.stdout,e.stderr=e.stderr,e.stdin?Sb("stdin",e.stdin):Lb("/dev/tty","/dev/stdin"),e.stdout?Sb("stdout",null,e.stdout):Lb("/dev/tty","/dev/stdout"),e.stderr?Sb("stderr",null,e.stderr):Lb("/dev/tty1","/dev/stderr"),Mb("/dev/stdin","r"),Mb("/dev/stdout","w"),Mb("/dev/stderr","w"));Ga(Ia);vb=!1;Ga(Ja);aa(e);if(e.onRuntimeInitialized)e.onRuntimeInitialized();if(e.postRun)for("function"==
typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var b=e.postRun.shift();Ka.unshift(b)}Ga(Ka)}}if(!(0<J)){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)La();Ga(Ha);0<J||(e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1);a()},1)):a())}}e.run=gd;if(e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);0<e.preInit.length;)e.preInit.pop()();noExitRuntime=!0;gd();
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

Binary file not shown.

View 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;

Binary file not shown.

View 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()}}}}

View 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

View File

@ -0,0 +1,4 @@
set -e
docker build -t squoosh-rust-nightly --build-arg RUST_IMG=rustlang/rust@sha256:744aeea5a38f95aa7a96ec37269a65f0c6197a1cdd87d6534e12bb869141d807 - < ../rust.Dockerfile
docker run --rm -v $PWD:/src squoosh-rust-nightly "$@"

View File

@ -1,8 +1,8 @@
FROM emscripten/emsdk:1.40.0
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 LDFLAGS "${CFLAGS}"
ENV LDFLAGS "${CFLAGS} -s PTHREAD_POOL_SIZE=navigator.hardwareConcurrency"
# Build and cache standard libraries with these flags
RUN emcc ${CXXFLAGS} --bind -xc++ /dev/null -o /dev/null
WORKDIR /src

201
codecs/hqx/LICENSE.codec.md Normal file
View 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
View File

@ -0,0 +1,5 @@
# HQX
- Source: <https://github.com/CryZe/wasmboy-rs>
- Version: v0.1.2
- License: Apache 2.0

View 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.

View File

@ -2,6 +2,7 @@
- Source: <https://github.com/ImageOptim/libimagequant>
- Version: v2.12.1
- License: GPL3
## Dependencies

View File

@ -29,7 +29,7 @@
const rawImage = Module.zx_quantize(image.data, image.width, image.height, 1.0);
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');
canvas.width = image.width;
canvas.height = image.height;

View File

@ -3,4 +3,4 @@ interface QuantizerModule extends EmscriptenWasm.Module {
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>;

View File

@ -7,51 +7,51 @@ function(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;
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]"};
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&&
(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;
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;
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=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 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 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 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});
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={};
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 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 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 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}
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)}
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 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 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 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 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 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 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 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};
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");
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=
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",
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-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";
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=
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,
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),
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=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},
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(){},
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+
'");\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%
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};
(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: "+
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{}})();
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)};
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_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_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)};
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())}}
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(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:39,maximum:39,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[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);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 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 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 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 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 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 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(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].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].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=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]||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=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<X.length;++a)if(void 0!==X[a])return X[a];return null};fb=d.UnboundTypeError=Pa("UnboundTypeError");
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,
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,
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";
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";
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);
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})},
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=
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>=
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);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(){}})},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'+
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-
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!==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||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 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.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.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.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,!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();

Binary file not shown.

View File

@ -1,18 +0,0 @@
<!DOCTYPE html>
<script src="mozjpeg_dec.js"></script>
<script>
const module = mozjpeg_dec({
async onRuntimeInitialized() {
const image = await fetch("./original.jpg").then(r => r.arrayBuffer());
const result = this.decode(image);
const canvas = document.createElement("canvas");
canvas.width = result.width;
canvas.height = result.height;
// Draw image onto canvas
const ctx = canvas.getContext("2d");
ctx.putImageData(result, 0, 0);
document.body.append(canvas);
}
});
</script>

View File

@ -1,59 +0,0 @@
#include <emscripten/bind.h>
#include <emscripten/val.h>
#include "config.h"
#include "jpeglib.h"
extern "C" {
#include "cdjpeg.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) {
uint8_t* image_buffer = (uint8_t*)image_in.c_str();
jpeg_decompress_struct cinfo;
jpeg_error_mgr jerr;
// Initialize the JPEG decompression object with default error handling.
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_decompress(&cinfo);
jpeg_mem_src(&cinfo, image_buffer, image_in.length());
// Read file header, set default decompression parameters
jpeg_read_header(&cinfo, TRUE);
// Force RGBA decoding, even for grayscale images
cinfo.out_color_space = JCS_EXT_RGBA;
jpeg_start_decompress(&cinfo);
// Prepare output buffer
size_t output_size = cinfo.output_width * cinfo.output_height * 4;
std::vector<uint8_t> output_buffer(output_size);
auto stride = cinfo.output_width * 4;
// Process data
auto buffer_lines_available = cinfo.output_height;
while (cinfo.output_scanline < cinfo.output_height) {
uint8_t* ptr = &output_buffer[stride * cinfo.output_scanline];
auto lines_read = jpeg_read_scanlines(&cinfo, &ptr, buffer_lines_available);
buffer_lines_available -= lines_read;
}
jpeg_finish_decompress(&cinfo);
// Step 7: release JPEG compression object
auto data = Uint8ClampedArray.new_(typed_memory_view(output_buffer.size(), output_buffer.data()));
auto js_result = ImageData.new_(data, cinfo.output_width, cinfo.output_height);
// This is an important step since it will release a good deal of memory.
jpeg_destroy_decompress(&cinfo);
// And we're done!
return js_result;
}
EMSCRIPTEN_BINDINGS(my_module) {
function("decode", &decode);
}

View File

@ -1,69 +0,0 @@
var mozjpeg_dec = (function() {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(mozjpeg_dec) {
mozjpeg_dec = mozjpeg_dec || {};
var d;d||(d=typeof mozjpeg_dec !== 'undefined' ? mozjpeg_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";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="",z,A,fa,ha;
if(da)x=w?require("path").dirname(x)+"/":__dirname+"/",z=function(a,b){fa||(fa=require("fs"));ha||(ha=require("path"));a=ha.normalize(a);return fa.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&&(ca=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",function(a){if(!(a instanceof ia))throw a;}),process.on("unhandledRejection",B),u=function(a){process.exit(a)},
d.inspect=function(){return"[Emscripten Module object]"};else if(ea)"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},"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="",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 ja=d.print||console.log.bind(console),D=d.printErr||console.warn.bind(console);
for(t in r)r.hasOwnProperty(t)&&(d[t]=r[t]);r=null;d.thisProgram&&(ca=d.thisProgram);d.quit&&(u=d.quit);var E;d.wasmBinary&&(E=d.wasmBinary);var noExitRuntime;d.noExitRuntime&&(noExitRuntime=d.noExitRuntime);"object"!==typeof WebAssembly&&B("no native wasm support detected");var F,ka=new WebAssembly.Table({initial:156,maximum:156,element:"anyfunc"}),la=!1,ma="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=G;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 qa(a,b){var c=a>>1;for(var e=c+b/2;!(c>=e)&&H[c];)++c;c<<=1;if(32<c-a&&pa)return pa.decode(G.subarray(a,c));c=0;for(e="";;){var f=I[a+2*c>>1];if(0==f||c==b/2)return e;++c;e+=String.fromCharCode(f)}}function ra(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)I[b>>1]=a.charCodeAt(f),b+=2;I[b>>1]=0;return b-e}function sa(a){return 2*a.length}
function ta(a,b){for(var c=0,e="";!(c>=b/4);){var f=J[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 ua(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}J[b>>2]=g;b+=4;if(b+4>c)break}J[b>>2]=0;return b-e}
function va(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,G,I,H,J,N,wa,xa;function ya(a){L=a;d.HEAP8=M=new Int8Array(a);d.HEAP16=I=new Int16Array(a);d.HEAP32=J=new Int32Array(a);d.HEAPU8=G=new Uint8Array(a);d.HEAPU16=H=new Uint16Array(a);d.HEAPU32=N=new Uint32Array(a);d.HEAPF32=wa=new Float32Array(a);d.HEAPF64=xa=new Float64Array(a)}var za=d.INITIAL_MEMORY||16777216;d.wasmMemory?F=d.wasmMemory:F=new WebAssembly.Memory({initial:za/65536,maximum:32768});
F&&(L=F.buffer);za=L.byteLength;ya(L);J[3104]=5255456;function O(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 Aa=[],Ba=[],Ca=[],Da=[];function Ea(){var a=d.preRun.shift();Aa.unshift(a)}var Q=0,Fa=null,R=null;d.preloadedImages={};d.preloadedAudios={};
function B(a){if(d.onAbort)d.onAbort(a);D(a);la=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");ba(a);throw a;}function Ga(a){var b=S;return String.prototype.startsWith?b.startsWith(a):0===b.indexOf(a)}function Ha(){return Ga("data:application/octet-stream;base64,")}var S="mozjpeg_dec.wasm";if(!Ha()){var Ia=S;S=d.locateFile?d.locateFile(Ia,x):x+Ia}
function Ja(){try{if(E)return new Uint8Array(E);if(A)return A(S);throw"both async and sync fetching of the wasm failed";}catch(a){B(a)}}function Ka(){return E||!v&&!w||"function"!==typeof fetch||Ga("file://")?new Promise(function(a){a(Ja())}):fetch(S,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+S+"'";return a.arrayBuffer()}).catch(function(){return Ja()})}Ba.push({Y:function(){La()}});function Ma(){return 0<Ma.W}
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 T(a){for(var b="";G[a];)b+=Oa[G[a++]];return b}var U={},V={},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 W(a){throw new Ta(a);}var Ua=void 0;function Va(a,b){function c(k){k=b(k);if(k.length!==e.length)throw new Ua("Mismatched type converter count");for(var h=0;h<e.length;++h)X(e[h],k[h])}var e=[];e.forEach(function(k){Pa[k]=a});var f=Array(a.length),g=[],l=0;a.forEach(function(k,h){V.hasOwnProperty(k)?f[h]=V[k]:(g.push(k),U.hasOwnProperty(k)||(U[k]=[]),U[k].push(function(){f[h]=V[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(V.hasOwnProperty(a)){if(c.Z)return;W("Cannot register type '"+e+"' twice")}V[a]=b;delete Pa[a];U.hasOwnProperty(a)&&(b=U[a],delete U[a],b.forEach(function(f){f()}))}var Wa=[],Y=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
function Xa(a){4<a&&0===--Y[a].V&&(Y[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():Y.length;Y[b]={V:1,value:a};return b}}function Za(a){return this.fromWireType(N[a>>2])}function $a(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].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 gb(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"),fb(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 hb(a,b){for(var c=[],e=0;e<a;e++)c.push(J[(b>>2)+e]);return c}
function ib(a,b){a=T(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 jb=void 0;function kb(a){a=lb(a);var b=T(a);Z(a);return b}
function mb(a,b){function c(g){f[g]||V[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 M[e]}:function(e){return G[e]};case 1:return c?function(e){return I[e>>1]}:function(e){return H[e>>1]};case 2:return c?function(e){return J[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=V[a];void 0===c&&W(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}
for(var ub,vb=[null,[],[]],wb=Array(256),xb=0;256>xb;++xb)wb[xb]=String.fromCharCode(xb);Oa=wb;Ta=d.BindingError=Sa("BindingError");Ua=d.InternalError=Sa("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};jb=d.UnboundTypeError=Sa("UnboundTypeError");
var zb={o:function(a){return yb(a)},i:function(){},n:function(a){"uncaught_exception"in Ma?Ma.W++:Ma.W=1;throw a;},y:function(a,b,c,e,f){var g=Na(c);b=T(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=M;else if(2===c)k=I;else if(4===c)k=J;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[l>>g])},T:null})},x:function(a,b){b=T(b);X(a,{name:b,fromWireType:function(c){var e=
Y[c].value;Xa(c);return e},toWireType:function(c,e){return Ya(e)},argPackAdvance:8,readValueFromPointer:Za,T:null})},g:function(a,b,c){c=Na(c);b=T(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 "'+$a(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:cb(b,c),T:null})},l:function(a,b,c,e,f,g){var l=hb(b,c);a=T(a);f=ib(e,f);gb(a,function(){mb("Cannot call "+a+" due to unbound types",
l)},b-1);Va(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 ab="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 "+Qa(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 bb=C?"destructors":"null";K="throwBindingError invoker fn runDestructors retType classParam".split(" ");p=[W,p,g,eb,h[0],h[1]];y&&(n+="var thisWired = classParam.toWireType("+bb+", this);\n");for(m=0;m<q-2;++m)n+="var arg"+m+"Wired = argType"+m+".toWireType("+bb+", arg"+m+"); // "+h[m+2].name+"\n",K.push("argType"+m),p.push(h[m+2]);y&&(P="thisWired"+(0<P.length?", ":"")+P);n+=(ab?"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].T&&(n+=q+"_dtor("+q+"); // "+h[m].name+"\n",K.push(q+"_dtor"),p.push(h[m].T));ab&&(n+="var ret = retType.fromWireType(rv);\nreturn ret;\n");K.push(n+"}\n");h=db(K).apply(null,p);m=b-1;if(!d.hasOwnProperty(k))throw new Ua("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=
T(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 "'+$a(p)+'" to '+this.name);if(p<e||p>f)throw new TypeError('Passing a number "'+$a(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:nb(b,
l,0!==e),T: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=T(c);X(a,{name:c,fromWireType:e,argPackAdvance:8,readValueFromPointer:e},{Z:!0})},h:function(a,b){b=T(b);var c="std::string"===b;X(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(l==f||0==G[k]){g=g?na(G,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(G[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=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),W("String has UTF-16 code units that do not fit in 8 bits"));G[k+4+g]=h}else for(g=0;g<l;++g)G[k+4+g]=f[g];null!==e&&e.push(Z,k);return k},argPackAdvance:8,readValueFromPointer:Za,T:function(e){Z(e)}})},d:function(a,b,c){c=T(c);if(2===b){var e=qa;var f=ra;var g=sa;var l=function(){return H};var k=1}else 4===b&&(e=ta,f=ua,g=va,l=function(){return N},
k=2);X(a,{name:c,fromWireType:function(h){for(var n=N[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=yb(4+p+b);N[q>>2]=p>>k;f(n,q+4,p+b);null!==h&&h.push(Z,q);return q},argPackAdvance:8,readValueFromPointer:Za,T:function(h){Z(h)}})},j:function(a,b){b=T(b);X(a,{$:!0,name:b,argPackAdvance:0,fromWireType:function(){},
toWireType:function(){}})},u:Xa,z:function(a){if(0===a)return Ya(pb());var b=ob[a];a=void 0===b?T(a):b;return Ya(pb()[a])},m:function(a){4<a&&(Y[a].V+=1)},e:function(a,b,c,e){a||W("Cannot use deleted val. handle = "+a);a=Y[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,d,Ya);rb[b]=f}return f(a,c,e)},s:function(){B()},r:function(a,b,c){G.copyWithin(a,b,b+c)},c:function(a){a>>>=0;var b=G.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{F.grow(Math.min(2147483648,e)-L.byteLength+65535>>>16);ya(F.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=J[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},v:function(a,b){var c=tb();J[a>>2]=c.length;var e=0;c.forEach(function(f){e+=f.length+1});J[b>>2]=e;return 0},k:function(a){if(!noExitRuntime&&(la=!0,d.onExit))d.onExit(a);u(a,new ia(a))},
w:function(){return 0},p:function(){},f:function(a,b,c,e){for(var f=0,g=0;g<c;g++){for(var l=J[b+8*g>>2],k=J[b+(8*g+4)>>2],h=0;h<k;h++){var n=G[l+h],p=vb[a];0===n||10===n?((1===a?ja:D)(na(p,0)),p.length=0):p.push(n)}f+=k}J[e>>2]=f;return 0},memory:F,q:function(){},table:ka};
(function(){function a(f){d.asm=f.exports;Q--;d.monitorRunDependencies&&d.monitorRunDependencies(Q);0==Q&&(null!==Fa&&(clearInterval(Fa),Fa=null),R&&(f=R,R=null,f()))}function b(f){a(f.instance)}function c(f){return Ka().then(function(g){return WebAssembly.instantiate(g,e)}).then(f,function(g){D("failed to asynchronously prepare wasm: "+g);B(g)})}var e={a:zb};Q++;d.monitorRunDependencies&&d.monitorRunDependencies(Q);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||Ha()||Ga("file://")||"function"!==typeof fetch)return c(b);fetch(S,{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 La=d.___wasm_call_ctors=function(){return(La=d.___wasm_call_ctors=d.asm.A).apply(null,arguments)},yb=d._malloc=function(){return(yb=d._malloc=d.asm.B).apply(null,arguments)},Z=d._free=function(){return(Z=d._free=d.asm.C).apply(null,arguments)},lb=d.___getTypeName=function(){return(lb=d.___getTypeName=d.asm.D).apply(null,arguments)};d.___embind_register_native_and_builtin_types=function(){return(d.___embind_register_native_and_builtin_types=d.asm.E).apply(null,arguments)};
d.dynCall_iii=function(){return(d.dynCall_iii=d.asm.F).apply(null,arguments)};d.dynCall_vii=function(){return(d.dynCall_vii=d.asm.G).apply(null,arguments)};d.dynCall_vi=function(){return(d.dynCall_vi=d.asm.H).apply(null,arguments)};d.dynCall_ii=function(){return(d.dynCall_ii=d.asm.I).apply(null,arguments)};d.dynCall_iiiiii=function(){return(d.dynCall_iiiiii=d.asm.J).apply(null,arguments)};d.dynCall_iiiiiii=function(){return(d.dynCall_iiiiiii=d.asm.K).apply(null,arguments)};
d.dynCall_iiiii=function(){return(d.dynCall_iiiii=d.asm.L).apply(null,arguments)};d.dynCall_iiii=function(){return(d.dynCall_iiii=d.asm.M).apply(null,arguments)};d.dynCall_viiiii=function(){return(d.dynCall_viiiii=d.asm.N).apply(null,arguments)};d.dynCall_viiii=function(){return(d.dynCall_viiii=d.asm.O).apply(null,arguments)};d.dynCall_viiiiiii=function(){return(d.dynCall_viiiiiii=d.asm.P).apply(null,arguments)};d.dynCall_jiji=function(){return(d.dynCall_jiji=d.asm.Q).apply(null,arguments)};
d.dynCall_viiiiii=function(){return(d.dynCall_viiiiii=d.asm.R).apply(null,arguments)};var Ab;function ia(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}R=function Bb(){Ab||Cb();Ab||(R=Bb)};
function Cb(){function a(){if(!Ab&&(Ab=!0,d.calledRun=!0,!la)){O(Ba);O(Ca);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();Da.unshift(b)}O(Da)}}if(!(0<Q)){if(d.preRun)for("function"==typeof d.preRun&&(d.preRun=[d.preRun]);d.preRun.length;)Ea();O(Aa);0<Q||(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();
return mozjpeg_dec.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = mozjpeg_dec;
else if (typeof define === 'function' && define['amd'])
define([], function() { return mozjpeg_dec; });
else if (typeof exports === 'object')
exports["mozjpeg_dec"] = mozjpeg_dec;

Binary file not shown.

View File

@ -1,72 +0,0 @@
var mozjpeg_enc = (function() {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(mozjpeg_enc) {
mozjpeg_enc = mozjpeg_enc || {};
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(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 ia))throw a;}),process.on("unhandledRejection",D),u=function(a){process.exit(a)},
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 ja=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&&(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:120,maximum:120,element:"anyfunc"}),ma=!1,na="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
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 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 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 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 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);Ba=L.byteLength;Aa(L);K[22872]=5334528;function Ca(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 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);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 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({ga:function(){Oa()}});function Pa(){return 0<Pa.ba}var Qa={};
function Ra(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Sa(a){return this.fromWireType(N[a>>2])}var R={},S={},Ta={};function Ua(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 Va(a,b){a=Ua(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}
function Wa(a){var b=Error,c=Va(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 Xa=void 0;
function Ya(a,b,c){function e(k){k=c(k);if(k.length!==a.length)throw new Xa("Mismatched type converter count");for(var h=0;h<a.length;++h)T(a[h],k[h])}a.forEach(function(k){Ta[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 Za(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 $a=void 0;function U(a){for(var b="";I[a];)b+=$a[I[a++]];return b}var ab=void 0;function V(a){throw new ab(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 Ta[a];R.hasOwnProperty(a)&&(b=R[a],delete R[a],b.forEach(function(f){f()}))}var bb=[],X=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
function cb(a){4<a&&0===--X[a].aa&&(X[a]=void 0,bb.push(a))}function db(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=bb.length?bb.pop():X.length;X[b]={aa:1,value:a};return b}}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(ya[c>>2])};case 3:return function(c){return this.fromWireType(za[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}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=Va(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){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 ib(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"),hb(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 jb(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 kb=void 0;function lb(a){a=mb(a);var b=U(a);Z(a);return b}
function nb(a,b){function c(g){f[g]||S[g]||(Ta[g]?Ta[g].forEach(c):(e.push(g),f[g]=!0))}var e=[],f={};b.forEach(c);throw new kb(a+": "+e.map(lb).join([", "]));}function ob(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 pb={};
function qb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function rb(a,b){var c=S[a];void 0===c&&V(b+" has unknown type "+lb(a));return c}var sb={},tb={};function ub(){if(!vb){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 tb)a[b]=tb[b];var c=[];for(b in a)c.push(b+"="+a[b]);vb=c}return vb}
var vb,wb=[null,[],[]];Xa=d.InternalError=Wa("InternalError");for(var xb=Array(256),yb=0;256>yb;++yb)xb[yb]=String.fromCharCode(yb);$a=xb;ab=d.BindingError=Wa("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};kb=d.UnboundTypeError=Wa("UnboundTypeError");
var Ab={i:function(a){return zb(a)},C:function(){},A:function(a){"uncaught_exception"in Pa?Pa.ba++:Pa.ba=1;throw a;},l:function(a){var b=Qa[a];delete Qa[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}));Ya([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));Ra(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=c();for(n in k)k[n].write(q,m[n]);null!==h&&h.push(e,q);return q},argPackAdvance:8,readValueFromPointer:Sa,Z:e}]})},x:function(a,b,c,e,f){var g=Za(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>>g])},Z:null})},w:function(a,b){b=U(b);T(a,{name:b,fromWireType:function(c){var e=X[c].value;cb(c);return e},toWireType:function(c,e){return db(e)},argPackAdvance:8,readValueFromPointer:Sa,Z:null})},g:function(a,b,c){c=Za(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),Z:null})},k:function(a,b,c,e,f,g){var l=jb(b,c);a=U(a);f=Y(e,f);ib(a,function(){nb("Cannot call "+a+" due to unbound types",l)},b-1);Ya([],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=
"";for(p=0;p<q-2;++p)A+=(0!==p?", ":"")+"arg"+p,F+=(0!==p?", ":"")+"arg"+p+"Wired";m="return function "+Ua(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,Ra,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"+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");
A.push(m+"}\n");h=gb(A).apply(null,n);p=b-1;if(!d.hasOwnProperty(k))throw new Xa("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=Za(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 "'+eb(n)+
'" to '+this.name);if(n<e||n>f)throw new TypeError('Passing a number "'+eb(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:ob(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,
readValueFromPointer:e},{ka:!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+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.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=zb(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:Sa,Z:function(e){Z(e)}})},d:function(a,b,c){c=U(c);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=zb(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:Sa,Z:function(h){Z(h)}})},m:function(a,b,c,e,f,g){Qa[a]={name:U(b),la:Y(c,e),ma:Y(f,g),da:[]}},e:function(a,b,c,e,f,g,l,k,h,m){Qa[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:cb,
B:function(a){if(0===a)return db(qb());var b=pb[a];a=void 0===b?U(a):b;return db(qb()[a])},j: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=sb[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")))(rb,d,db);sb[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,
e)-L.byteLength+65535>>>16);Aa(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;ub().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=ub();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&&(ma=!0,d.onExit))d.onExit(a);u(a,new ia(a))},u:function(){return 0},o:function(){},f: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=wb[a];0===m||10===m?((1===a?ja:E)(oa(n,0)),n.length=0):n.push(m)}f+=k}K[e>>2]=f;return 0},memory:H,p:function(){},table:la};
(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:Ab};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),!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 Oa=d.___wasm_call_ctors=function(){return(Oa=d.___wasm_call_ctors=d.asm.D).apply(null,arguments)},Z=d._free=function(){return(Z=d._free=d.asm.E).apply(null,arguments)},zb=d._malloc=function(){return(zb=d._malloc=d.asm.F).apply(null,arguments)},mb=d.___getTypeName=function(){return(mb=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)};
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_iiiiii=function(){return(d.dynCall_iiiiii=d.asm.M).apply(null,arguments)};d.dynCall_viiiii=function(){return(d.dynCall_viiiii=d.asm.N).apply(null,arguments)};
d.dynCall_vii=function(){return(d.dynCall_vii=d.asm.O).apply(null,arguments)};d.dynCall_ii=function(){return(d.dynCall_ii=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_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 Bb;function ia(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}P=function Cb(){Bb||Db();Bb||(P=Cb)};
function Db(){function a(){if(!Bb&&(Bb=!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=Db;if(d.preInit)for("function"==typeof d.preInit&&(d.preInit=[d.preInit]);0<d.preInit.length;)d.preInit.pop()();noExitRuntime=!0;Db();
return mozjpeg_enc.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = mozjpeg_enc;
else if (typeof define === 'function' && define['amd'])
define([], function() { return mozjpeg_enc; });
else if (typeof exports === 'object')
exports["mozjpeg_enc"] = mozjpeg_enc;

Binary file not shown.

View 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.

View File

@ -2,7 +2,7 @@ CODEC_URL := https://github.com/mozilla/mozjpeg/archive/v3.3.1.tar.gz
CODEC_DIR := node_modules/mozjpeg
CODEC_OUT_RELATIVE := .libs/libjpeg.a rdswitch.o
CODEC_OUT := $(addprefix $(CODEC_DIR)/, $(CODEC_OUT_RELATIVE))
OUT_JS := enc/mozjpeg_enc.js dec/mozjpeg_dec.js
OUT_JS := mozjpeg_enc.js
OUT_WASM := $(OUT_JS:.js=.wasm)
.PHONY: all clean

View File

@ -2,6 +2,7 @@
- Source: <https://github.com/mozilla/mozjpeg>
- Version: v3.3.1
- License: BSD
## Dependencies

View File

@ -1,5 +1,10 @@
#include <emscripten/bind.h>
#include <emscripten/val.h>
#include <inttypes.h>
#include <setjmp.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "config.h"
#include "jpeglib.h"
@ -9,6 +14,12 @@ extern "C" {
using namespace emscripten;
// MozJPEG doesnt expose a numeric version, so I have to do some fun C macro
// hackery to turn it into a string. More details here:
// https://gcc.gnu.org/onlinedocs/cpp/Stringizing.html
#define xstr(s) str(s)
#define str(s) #s
struct MozJpegOptions {
int quality;
bool baseline;
@ -28,6 +39,22 @@ struct MozJpegOptions {
int chroma_quality;
};
int version() {
char buffer[] = xstr(MOZJPEG_VERSION);
int version = 0;
int last_index = 0;
for (int i = 0; i < strlen(buffer); i++) {
if (buffer[i] == '.') {
buffer[i] = '\0';
version = version << 8 | atoi(&buffer[last_index]);
buffer[i] = '.';
last_index = i + 1;
}
}
version = version << 8 | atoi(&buffer[last_index]);
return version;
}
thread_local const val Uint8Array = val::global("Uint8Array");
val encode(std::string image_in, int image_width, int image_height, MozJpegOptions opts) {
@ -201,5 +228,6 @@ EMSCRIPTEN_BINDINGS(my_module) {
.field("separate_chroma_quality", &MozJpegOptions::separate_chroma_quality)
.field("chroma_quality", &MozJpegOptions::chroma_quality);
function("version", &version);
function("encode", &encode);
}

View File

@ -4,4 +4,4 @@ interface MozJPEGModule extends EmscriptenWasm.Module {
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>;

View File

@ -0,0 +1,72 @@
var mozjpeg_enc = (function() {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(mozjpeg_enc) {
mozjpeg_enc = mozjpeg_enc || {};
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(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(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 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&&(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 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 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 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 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 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);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);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 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 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 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.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].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(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].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].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 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",_: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 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,
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>>
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=
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)+"("+
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"+
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");
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 "'+
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=
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.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);
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},
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 = "+
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,
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++>>
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(){},
table:la};
(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),
!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 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.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.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_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,!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();
return mozjpeg_enc.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = mozjpeg_enc;
else if (typeof define === 'function' && define['amd'])
define([], function() { return mozjpeg_enc; });
else if (typeof exports === 'object')
exports["mozjpeg_enc"] = mozjpeg_enc;

Binary file not shown.

198
codecs/oxipng/Cargo.lock generated
View File

@ -1,16 +1,22 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "adler32"
version = "1.1.0"
name = "adler"
version = "0.2.3"
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]]
name = "autocfg"
version = "1.0.0"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]]
name = "bit-vec"
@ -38,9 +44,9 @@ checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
[[package]]
name = "bytemuck"
version = "1.2.0"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37fa13df2292ecb479ec23aa06f4507928bef07839be9ef15281411076629431"
checksum = "41aa2ec95ca3b5c54cf73c91acf06d24f4495d5f1b1c12506ae3483d646177ac"
[[package]]
name = "byteorder"
@ -50,9 +56,9 @@ checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
[[package]]
name = "cc"
version = "1.0.58"
version = "1.0.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518"
checksum = "ef611cc68ff783f18535d77ddd080185275713d852c4f5cbb6122c462a7a825c"
[[package]]
name = "cfg-if"
@ -96,6 +102,16 @@ dependencies = [
"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]]
name = "crossbeam-deque"
version = "0.7.3"
@ -122,17 +138,6 @@ dependencies = [
"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]]
name = "crossbeam-utils"
version = "0.7.2"
@ -156,24 +161,30 @@ dependencies = [
[[package]]
name = "either"
version = "1.5.3"
version = "1.6.1"
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]]
name = "hermit-abi"
version = "0.1.15"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9"
checksum = "4c30f6d0bc6b00693347368a67d41b58f2fb851215ff1da49e90fe2c5c667151"
dependencies = [
"libc",
]
[[package]]
name = "image"
version = "0.23.7"
version = "0.23.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2397fc43bd5648b7117aabb3c5e62d0e62c194826ec77b0b4d0c41e62744635"
checksum = "974e194911d1f7efe3cd8a8f9db3b767e43536327e899e8bc9a12ef5711b74d2"
dependencies = [
"bytemuck",
"byteorder",
@ -185,11 +196,12 @@ dependencies = [
[[package]]
name = "indexmap"
version = "1.4.0"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c398b2b113b55809ceb9ee3e753fcbac793f1956663f3c36549c1346015c2afe"
checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2"
dependencies = [
"autocfg",
"hashbrown",
"rayon",
]
@ -210,24 +222,33 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.72"
version = "0.2.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9f8082297d534141b30c8d39e9b1773713ab50fdbe4ff30f750d063b3bfd701"
checksum = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235"
[[package]]
name = "libdeflater"
version = "0.2.0"
name = "libdeflate-sys"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66dca08b13369865b2f6dca1dd05f833985cbe6c12a676b04d55f78b85e80246"
checksum = "21e39efa87b84db3e13ff4e2dfac1e57220abcbd7fe8ec44d238f7f4f787cc1f"
dependencies = [
"cc",
]
[[package]]
name = "log"
version = "0.4.8"
name = "libdeflater"
version = "0.5.0"
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 = [
"cfg-if",
]
@ -240,9 +261,9 @@ checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
[[package]]
name = "memoffset"
version = "0.5.5"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c198b026e1bbf08a937e94c6c60f9ec4a2267f5b0d2eec9c1b21b061ce2be55f"
checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa"
dependencies = [
"autocfg",
]
@ -256,6 +277,16 @@ dependencies = [
"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]]
name = "num-integer"
version = "0.1.43"
@ -308,42 +339,50 @@ dependencies = [
]
[[package]]
name = "oxipng"
version = "3.0.0"
name = "once_cell"
version = "1.4.1"
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 = [
"bit-vec",
"byteorder",
"cloudflare-zlib",
"crc",
"crossbeam-channel",
"image",
"indexmap",
"itertools",
"libdeflater",
"log",
"miniz_oxide",
"miniz_oxide 0.4.2",
"rayon",
"rgb",
"rustc_version",
"zopfli",
]
[[package]]
name = "png"
version = "0.16.6"
version = "0.16.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c150bf7479fafe3dd8740dbe48cc33b2a3efb7b0fe3483aced8bbc39f6d0238d"
checksum = "dfe7f9f1c730833200b134370e1d5098964231af8450bce9b78ee3ab5278b970"
dependencies = [
"bitflags",
"crc32fast",
"deflate",
"miniz_oxide",
"miniz_oxide 0.3.7",
]
[[package]]
name = "proc-macro2"
version = "1.0.18"
version = "1.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa"
checksum = "36e28516df94f3dd551a587da5357459d9b36d945a7c37c3557928c1c2ff2a2c"
dependencies = [
"unicode-xid",
]
@ -359,9 +398,9 @@ dependencies = [
[[package]]
name = "rayon"
version = "1.3.1"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62f02856753d04e03e26929f820d0a0a337ebe71f849801eea335d464b349080"
checksum = "dcf6960dc9a5b4ee8d3e4c5787b4a112a8818e0290a42ff664ad60692fdf2032"
dependencies = [
"autocfg",
"crossbeam-deque",
@ -371,12 +410,12 @@ dependencies = [
[[package]]
name = "rayon-core"
version = "1.7.1"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e92e15d89083484e11353891f1af602cc661426deb9564c298b270c726973280"
checksum = "e8c4fec834fb6e6d2dd5eece3c7b432a52f0ba887cf40e595190c4107edc08bf"
dependencies = [
"crossbeam-channel",
"crossbeam-deque",
"crossbeam-queue",
"crossbeam-utils",
"lazy_static",
"num_cpus",
@ -384,33 +423,60 @@ dependencies = [
[[package]]
name = "rgb"
version = "0.8.20"
version = "0.8.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90ef54b45ae131327a88597e2463fee4098ad6c88ba7b6af4b3987db8aad4098"
checksum = "287f3c3f8236abb92d8b7e36797f19159df4b58f0a658cc3fb6dd3004b1f3bd3"
dependencies = [
"bytemuck",
]
[[package]]
name = "rustc_version"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
dependencies = [
"semver",
]
[[package]]
name = "scopeguard"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
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]]
name = "squoosh-oxipng"
version = "0.1.0"
dependencies = [
"crossbeam-channel",
"log",
"once_cell",
"oxipng",
"rayon",
"wasm-bindgen",
]
[[package]]
name = "syn"
version = "1.0.34"
version = "1.0.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "936cae2873c940d92e697597c5eee105fb570cd5689c695806f672883653349b"
checksum = "6690e3e9f692504b941dc6c3b188fd28df054f7fb8469ab40680df52fdcc842b"
dependencies = [
"proc-macro2",
"quote",
@ -431,9 +497,9 @@ checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
[[package]]
name = "wasm-bindgen"
version = "0.2.64"
version = "0.2.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a634620115e4a229108b71bde263bb4220c483b3f07f5ba514ee8d15064c4c2"
checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42"
dependencies = [
"cfg-if",
"wasm-bindgen-macro",
@ -441,9 +507,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.64"
version = "0.2.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e53963b583d18a5aa3aaae4b4c1cb535218246131ba22a71f05b518098571df"
checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68"
dependencies = [
"bumpalo",
"lazy_static",
@ -456,9 +522,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.64"
version = "0.2.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fcfd5ef6eec85623b4c6e844293d4516470d8f19cd72d0d12246017eb9060b8"
checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@ -466,9 +532,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.64"
version = "0.2.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9adff9ee0e94b926ca81b57f57f86d5545cdcb1d259e21ec9bdd95b901754c75"
checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe"
dependencies = [
"proc-macro2",
"quote",
@ -479,9 +545,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.64"
version = "0.2.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f7b90ea6c632dd06fd765d44542e234d5e63d9bb917ecd64d79778a13bd79ae"
checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307"
[[package]]
name = "zopfli"

View File

@ -12,7 +12,20 @@ crate-type = ["cdylib"]
oxipng = { version = "3.0.0", default-features = false }
wasm-bindgen = "0.2.64"
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]
lto = true
opt-level = "s"
[features]
parallel = ["oxipng/parallel", "rayon", "crossbeam-channel", "once_cell"]
[package.metadata.wasm-pack.profile.release]
wasm-opt = ["-O", "--no-validation"]

View File

@ -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

View 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
View 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
View 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
View 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();

View File

@ -1,6 +1,6 @@
{
"name": "oxipng",
"scripts": {
"build": "../build-rust.sh"
"build": "../build-rust-nightly.sh ./build.sh"
}
}

View File

@ -0,0 +1,5 @@
# OxiPNG
- Source: <https://github.com/shssoichiro/oxipng>
- Version: v3.0.0
- License: MIT

View 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
}

View 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>;

View 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;

Binary file not shown.

View 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;

View File

@ -0,0 +1,5 @@
# OxiPNG
- Source: <https://github.com/shssoichiro/oxipng>
- Version: v3.0.0
- License: MIT

View File

@ -44,14 +44,20 @@ function getArrayU8FromWasm0(ptr, len) {
* @returns {Uint8Array}
*/
export function optimise(data, level) {
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
var len0 = WASM_VECTOR_LEN;
wasm.optimise(8, ptr0, len0, level);
var r0 = getInt32Memory0()[8 / 4 + 0];
var r1 = getInt32Memory0()[8 / 4 + 1];
var v1 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1);
return v1;
try {
const retptr = wasm.__wbindgen_export_0.value - 16;
wasm.__wbindgen_export_0.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_0.value += 16;
}
}
export const __wbindgen_throw = function(arg0, arg1) {

View File

@ -0,0 +1 @@
nightly

52
codecs/oxipng/spawn.ts Normal file
View 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();

View File

@ -1,9 +1,12 @@
mod malloc_shim;
use wasm_bindgen::prelude::*;
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> {
let mut options = oxipng::Options::from_preset(level);
options.alphas.insert(AlphaOptim::Black);

View 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
View 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 },
);

View 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
View File

@ -0,0 +1,5 @@
# Resize
- Source: <https://github.com/PistonDevelopers/resize>
- Version: v0.3.0
- License: MIT

View File

@ -1,9 +1,13 @@
ARG RUST_IMG=rust:1.44-stretch
FROM emscripten/emsdk:1.39.19 AS 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
FROM rust:1.44-stretch AS rust
FROM $RUST_IMG AS rust
ARG RUST_IMG
RUN rustup target add wasm32-unknown-unknown
RUN rustup component add rust-src
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/emscripten/system/include/libc/ /wasm32/include/

View 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
View File

@ -0,0 +1,5 @@
# WebP
- Source: https://github.com/webmproject/libwebp
- Version: v1.0.2
- License: BSD

View File

@ -1,22 +1,20 @@
<!doctype html>
<script src='webp_dec.js'></script>
<script>
const Module = webp_dec();
async function loadFile(src) {
const resp = await fetch(src);
return await resp.arrayBuffer();
}
Module.onRuntimeInitialized = async _ => {
console.log('Version:', Module.version().toString(16));
webp_dec().then(async module => {
console.log('Version:', module.version().toString(16));
const image = await loadFile('../../example.webp');
const imageData = Module.decode(image);
const imageData = module.decode(image);
const canvas = document.createElement('canvas');
canvas.width = result.width;
canvas.height = result.height;
canvas.width = imageData.width;
canvas.height = imageData.height;
document.body.appendChild(canvas);
const ctx = canvas.getContext('2d');
ctx.putImageData(imageData, 0, 0);
};
});
</script>

View File

@ -2,4 +2,4 @@ interface WebPModule extends EmscriptenWasm.Module {
decode(data: BufferSource): ImageData | null;
}
export default function(opts: EmscriptenWasm.ModuleOpts): WebPModule;
export default function(opts: EmscriptenWasm.ModuleOpts): Promise<WebPModule>;

View File

@ -11,47 +11,47 @@ var d;d||(d=typeof webp_dec !== 'undefined' ? webp_dec : {});var aa,ba;d.ready=n
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(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)});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 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 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);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 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 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 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}
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)}
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 Sa(a){4<a&&0===--Y[a].M&&(Y[a]=void 0,Ra.push(a))}function Ta(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 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 $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 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 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 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 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};
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");
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=
Y[c].value;Sa(c);return e},toWireType:function(c,e){return Ta(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",
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 Ua="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";y&&(p+="var destructors = [];\n");var Va=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("+Va+", this);\n");for(l=0;l<m-2;++l)p+="var arg"+l+"Wired = argType"+l+".toWireType("+Va+", arg"+l+"); // "+h[l+2].name+"\n",K.push("argType"+l),q.push(h[l+2]);r&&(O="thisWired"+(0<O.length?", ":"")+O);p+=(Ua?"var rv = ":"")+"invoker(fn"+(0<O.length?", ":"")+O+");\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));Ua&&(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=
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,
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(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&&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]);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>>
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(),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&&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===
a)return Ta(kb());var b=jb[a];a=void 0===b?S(a):b;return Ta(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"+
g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",n+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(lb,d,Ta);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>>>
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 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===--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 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 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 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 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 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 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<X.length;++a)if(void 0!==X[a])return X[a];return null};db=d.UnboundTypeError=Na("UnboundTypeError");
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,
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,
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";
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";
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);
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})},
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&&
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]);
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]=
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(),
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 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")))(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};
(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{}})();
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)};
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_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)};
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())}}
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();
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.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_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 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=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

Binary file not shown.

View File

@ -1,8 +1,6 @@
<!doctype html>
<script src='webp_enc.js'></script>
<script>
const module = webp_enc();
async function loadImage(src) {
// Load image
const img = document.createElement('img');
@ -17,7 +15,7 @@
return ctx.getImageData(0, 0, img.width, img.height);
}
module.onRuntimeInitialized = async _ => {
webp_enc().then(async module => {
console.log('Version:', module.version().toString(16));
const image = await loadImage('../../example.png');
const result = module.encode(image.data, image.width, image.height, {
@ -56,5 +54,5 @@
const img = document.createElement('img');
img.src = blobURL;
document.body.appendChild(img);
};
});
</script>

View File

@ -4,4 +4,4 @@ interface WebPModule extends EmscriptenWasm.Module {
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>;

View File

@ -11,52 +11,52 @@ var d;d||(d=typeof webp_enc !== 'undefined' ? webp_enc : {});var aa,ba;d.ready=n
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(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)});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:125,maximum:125,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 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 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[8648]=5277632;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={};
function C(a){if(d.onAbort)d.onAbort(a);D(a);ia=!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 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 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 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 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 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 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 $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 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 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 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 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 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 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 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");
var sb={u:function(a){return rb(a)},x:function(){},t:function(a){"uncaught_exception"in Ka?Ka.V++:Ka.V=1;throw a;},i: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,
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}]})},r: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===
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})},q: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})},l: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,
readValueFromPointer:bb(b,c,e),R:null});ab(b,f)},k: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,
c),R:null})},f: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"+
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+
", 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");
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 "'+
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+4,l=0;l<=f;++l){var k=e+4+l;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&&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===
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)&
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)}})},e: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},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=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)}})},j:function(a,b,c,
e,f,g){La[a]={name:U(b),ea:Z(c,e),fa:Z(f,g),W:[]}},d: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})},s:function(a,b){b=U(b);T(a,{ja:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},p:Ya,w:function(a){if(0===a)return Za(nb());var b=mb[a];a=void 0===b?U(a):b;return Za(nb()[a])},v:function(a){4<a&&(X[a].U+=1)},m: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+=
(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,
c,e)},o:function(){C()},n: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};
(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: "+
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);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({V:function(){Ja()}});var Ka={};
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 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 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 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.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 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 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 $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 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 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 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 ib=void 0;
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 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 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,
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>>
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;
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+
" 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 "+
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?
"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);
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 ['+
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;
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+=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+
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},
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),
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_"+
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)},
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: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{}})();
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)};
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_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_viiiiii=function(){return(d.dynCall_viiiiii=d.asm.P).apply(null,arguments)};var tb;P=function ub(){tb||vb();tb||(P=ub)};
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())}}
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();
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.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.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;
P=function tb(){sb||ub();sb||(P=tb)};
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=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

Binary file not shown.

View File

@ -6,6 +6,7 @@ declare namespace EmscriptenWasm {
// Options object for modularized Emscripten files. Shoe-horned by @surma.
// FIXME: This an incomplete definition!
interface ModuleOpts {
mainScriptUrlOrBlob?: string;
noInitialRun?: boolean;
locateFile?: (url: string) => string;
onRuntimeInitialized?: () => void;

254
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "squoosh",
"version": "1.11.4",
"version": "1.12.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -4639,6 +4639,12 @@
"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": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz",
@ -6392,22 +6398,14 @@
}
},
"globule": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/globule/-/globule-1.3.1.tgz",
"integrity": "sha512-OVyWOHgw29yosRHCHo7NncwR1hW5ew0W/UrvtwvjefVJeQ26q4/8r8FmPsSF1hJ93IgWkyv16pCTz6WblMzm/g==",
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/globule/-/globule-1.3.2.tgz",
"integrity": "sha512-7IDTQTIu2xzXkT+6mlluidnWo+BypnbSoEVVQCGfzqnl5Ik8d3e1d4wycb8Rj9tWW+Z39uPWsdlquqiqPCd/pA==",
"dev": true,
"requires": {
"glob": "~7.1.1",
"lodash": "~4.17.12",
"lodash": "~4.17.10",
"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": {
@ -7451,7 +7449,7 @@
},
"is-obj": {
"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=",
"dev": true
},
@ -8603,9 +8601,9 @@
}
},
"js-base64": {
"version": "2.5.2",
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.5.2.tgz",
"integrity": "sha512-Vg8czh0Q7sFBSUMWWArX/miJeBWYBPpdU/3M/DKSaekLMqrqVPaedp+5mZhie/r0lgrcaYBfwXatEew6gwgiQQ==",
"version": "2.6.4",
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.6.4.tgz",
"integrity": "sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==",
"dev": true
},
"js-levenshtein": {
@ -9785,9 +9783,9 @@
}
},
"node-sass": {
"version": "4.13.0",
"resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.13.0.tgz",
"integrity": "sha512-W1XBrvoJ1dy7VsvTAS5q1V45lREbTlZQqFbiHb3R3OTTCma0XBtuG6xZ6Z4506nR4lmHPTqVRwxT6KgtWC97CA==",
"version": "4.14.1",
"resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.14.1.tgz",
"integrity": "sha512-sjCuOlvGyCJS40R8BscF5vhVlQjNN069NtQ1gSxyK1u9iqvn6tf7O1R4GNowVZfiZUCRt5MmMs1xd+4V/7Yr0g==",
"dev": true,
"requires": {
"async-foreach": "^0.1.3",
@ -9804,15 +9802,15 @@
"node-gyp": "^3.8.0",
"npmlog": "^4.0.0",
"request": "^2.88.0",
"sass-graph": "^2.2.4",
"sass-graph": "2.2.5",
"stdout-stream": "^1.4.0",
"true-case-path": "^1.0.2"
},
"dependencies": {
"ajv": {
"version": "6.12.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.0.tgz",
"integrity": "sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw==",
"version": "6.12.5",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.5.tgz",
"integrity": "sha512-lRF8RORchjpKG50/WFf8xmg7sgCLFiYNNnqdKflk63whMQcWR5ngGjiSXkL9bjxy6B2npOK2HSMN49jEBMSkag==",
"dev": true,
"requires": {
"fast-deep-equal": "^3.1.1",
@ -9857,9 +9855,9 @@
"dev": true
},
"fast-deep-equal": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz",
"integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==",
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
"dev": true
},
"get-stdin": {
@ -9869,25 +9867,25 @@
"dev": true
},
"har-validator": {
"version": "5.1.3",
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz",
"integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==",
"version": "5.1.5",
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz",
"integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==",
"dev": true,
"requires": {
"ajv": "^6.5.5",
"ajv": "^6.12.3",
"har-schema": "^2.0.0"
}
},
"lodash": {
"version": "4.17.15",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
"version": "4.17.20",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
"integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==",
"dev": true
},
"nan": {
"version": "2.14.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz",
"integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==",
"version": "2.14.1",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz",
"integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==",
"dev": true
},
"oauth-sign": {
@ -10246,15 +10244,6 @@
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
"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": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
@ -12884,15 +12873,15 @@
}
},
"sass-graph": {
"version": "2.2.4",
"resolved": "https://registry.npmjs.org/sass-graph/-/sass-graph-2.2.4.tgz",
"integrity": "sha1-E/vWPNHK8JCLn9k0dq1DpR0eC0k=",
"version": "2.2.5",
"resolved": "https://registry.npmjs.org/sass-graph/-/sass-graph-2.2.5.tgz",
"integrity": "sha512-VFWDAHOe6mRuT4mZRd4eKE+d8Uedrk6Xnh7Sh9b4NGufQLQjOrvf/MQoOdx+0s92L89FeyUUNfU597j/3uNpag==",
"dev": true,
"requires": {
"glob": "^7.0.0",
"lodash": "^4.0.0",
"scss-tokenizer": "^0.2.3",
"yargs": "^7.0.0"
"yargs": "^13.3.2"
}
},
"sass-loader": {
@ -15354,6 +15343,12 @@
"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": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz",
@ -16159,9 +16154,9 @@
}
},
"which-module": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz",
"integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=",
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
"integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=",
"dev": true
},
"wide-align": {
@ -16289,53 +16284,148 @@
"dev": true
},
"yargs": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-7.1.0.tgz",
"integrity": "sha1-a6MY6xaWFyf10oT46gA+jWFU0Mg=",
"version": "13.3.2",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz",
"integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==",
"dev": true,
"requires": {
"camelcase": "^3.0.0",
"cliui": "^3.2.0",
"decamelize": "^1.1.1",
"get-caller-file": "^1.0.1",
"os-locale": "^1.4.0",
"read-pkg-up": "^1.0.1",
"cliui": "^5.0.0",
"find-up": "^3.0.0",
"get-caller-file": "^2.0.1",
"require-directory": "^2.1.1",
"require-main-filename": "^1.0.1",
"require-main-filename": "^2.0.0",
"set-blocking": "^2.0.0",
"string-width": "^1.0.2",
"which-module": "^1.0.0",
"y18n": "^3.2.1",
"yargs-parser": "^5.0.0"
"string-width": "^3.0.0",
"which-module": "^2.0.0",
"y18n": "^4.0.0",
"yargs-parser": "^13.1.2"
},
"dependencies": {
"camelcase": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz",
"integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=",
"ansi-regex": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
"dev": true
},
"y18n": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz",
"integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=",
"cliui": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
"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
},
"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": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-5.0.0.tgz",
"integrity": "sha1-J17PDX/+Bcd+ZOfIbkzZS/DhIoo=",
"version": "13.1.2",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz",
"integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==",
"dev": true,
"requires": {
"camelcase": "^3.0.0"
"camelcase": "^5.0.0",
"decamelize": "^1.2.0"
},
"dependencies": {
"camelcase": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz",
"integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=",
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
"dev": true
}
}

View File

@ -1,7 +1,7 @@
{
"private": true,
"name": "squoosh",
"version": "1.11.4",
"version": "1.12.0",
"license": "apache-2.0",
"scripts": {
"start": "webpack-dev-server --host 0.0.0.0 --hot",
@ -44,7 +44,7 @@
"mini-css-extract-plugin": "0.8.0",
"minimatch": "3.0.4",
"node-fetch": "2.6.0",
"node-sass": "4.13.0",
"node-sass": "4.14.1",
"normalize-path": "^3.0.0",
"optimize-css-assets-webpack-plugin": "5.0.1",
"pointer-tracker": "2.0.3",
@ -68,6 +68,7 @@
"typed-css-modules": "0.4.2",
"typescript": "3.5.3",
"url-loader": "2.1.0",
"wasm-feature-detect": "^1.2.9",
"webpack": "4.39.3",
"webpack-bundle-analyzer": "3.4.1",
"webpack-cli": "3.3.4",

View File

@ -1,6 +1,8 @@
export interface EncodeOptions {
minQuantizer: number;
maxQuantizer: number;
minQuantizerAlpha: number;
maxQuantizerAlpha: number;
tileRowsLog2: number;
tileColsLog2: number;
speed: number;
@ -12,12 +14,14 @@ export const label = 'AVIF';
export const mimeType = 'image/avif';
export const extension = 'avif';
export const defaultOptions: EncodeOptions = {
minQuantizer: 16,
maxQuantizer: 16,
minQuantizer: 33,
maxQuantizer: 63,
minQuantizerAlpha: 33,
maxQuantizerAlpha: 63,
tileColsLog2: 0,
tileRowsLog2: 0,
speed: 10,
subsample: 0,
speed: 8,
subsample: 1,
};
export interface EncoderState { type: typeof type; options: EncodeOptions; }

View File

@ -1,12 +1,34 @@
import avif_enc, { AVIFModule } from '../../../codecs/avif/enc/avif_enc';
import wasmUrl from '../../../codecs/avif/enc/avif_enc.wasm';
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 } from '../util';
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 = initEmscriptenModule(avif_enc, wasmUrl);
if (!emscriptenModule) emscriptenModule = init();
const module = await emscriptenModule;
const result = module.encode(data.data, data.width, data.height, options);

View File

@ -1,72 +1,307 @@
import { h, Component } from 'preact';
import { bind } from '../../lib/initial-util';
import {
/*inputFieldCheckedAsNumber,*/ inputFieldValueAsNumber,
preventDefault,
} from '../../lib/util';
import { EncodeOptions } from './encoder-meta';
import { preventDefault, shallowEqual } from '../../lib/util';
import { EncodeOptions, defaultOptions } from './encoder-meta';
import * as style from '../../components/Options/style.scss';
// import Checkbox from '../../components/checkbox';
// import Expander from '../../components/expander';
// import Select from '../../components/select';
import Checkbox from '../../components/checkbox';
import Expander from '../../components/expander';
import Select from '../../components/select';
import Range from '../../components/range';
// import linkState from 'linkstate';
import linkState from 'linkstate';
interface Props {
options: EncodeOptions;
onChange(newOptions: EncodeOptions): void;
}
interface State {}
interface State {
options: EncodeOptions;
lossless: boolean;
maxQuality: number;
minQuality: number;
separateAlpha: boolean;
losslessAlpha: boolean;
maxAlphaQuality: number;
minAlphaQuality: number;
showAdvanced: boolean;
grayscale: boolean;
subsample: number;
tileRows: number;
tileCols: number;
effort: number;
}
const maxQuant = 63;
const maxSpeed = 10;
export default class AVIFEncoderOptions extends Component<Props, State> {
state: State = {};
static getDerivedStateFromProps(props: Props, state: State): Partial<State> | undefined {
if (state.options && shallowEqual(state.options, props.options)) return;
const { options } = props;
@bind
onChange(event: Event) {
const form = (event.currentTarget as HTMLInputElement).closest(
'form',
) as HTMLFormElement;
const { options } = this.props;
const newOptions: EncodeOptions = {
// Copy over options the form doesn't currently care about, eg arithmetic
...this.props.options,
minQuantizer: inputFieldValueAsNumber(
form.quantizer,
options.minQuantizer,
),
maxQuantizer: inputFieldValueAsNumber(
form.quantizer,
options.maxQuantizer,
),
speed: inputFieldValueAsNumber(form.speed, options.speed),
const lossless = options.maxQuantizer === 0 && options.minQuantizer === 0;
const minQuantizerValue = lossless ? defaultOptions.minQuantizer : options.minQuantizer;
const maxQuantizerValue = lossless ? defaultOptions.maxQuantizer : options.maxQuantizer;
const losslessAlpha = options.maxQuantizerAlpha === 0 && options.minQuantizerAlpha === 0;
const minQuantizerAlphaValue = losslessAlpha ?
defaultOptions.minQuantizerAlpha : options.minQuantizerAlpha;
const maxQuantizerAlphaValue = losslessAlpha ?
defaultOptions.maxQuantizerAlpha : options.maxQuantizerAlpha;
// Create default form state from options
return {
options,
lossless,
losslessAlpha,
maxQuality: maxQuant - minQuantizerValue,
minQuality: maxQuant - maxQuantizerValue,
separateAlpha: options.maxQuantizer !== options.maxQuantizerAlpha ||
options.minQuantizer !== options.minQuantizerAlpha,
maxAlphaQuality: maxQuant - minQuantizerAlphaValue,
minAlphaQuality: maxQuant - maxQuantizerAlphaValue,
grayscale: options.subsample === 0,
subsample: options.subsample === 0 || lossless ? defaultOptions.subsample : options.subsample,
tileRows: options.tileRowsLog2,
tileCols: options.tileColsLog2,
effort: maxSpeed - options.speed,
};
this.props.onChange(newOptions);
}
render({ options }: Props) {
// The rest of the defaults are set in getDerivedStateFromProps
state: State = {
showAdvanced: false,
} as State;
private _inputChangeCallbacks = new Map<string, (event: Event) => void>();
private _inputChange = (prop: keyof State, type: 'number' | 'boolean') => {
// Cache the callback for performance
if (!this._inputChangeCallbacks.has(prop)) {
this._inputChangeCallbacks.set(prop, (event: Event) => {
const formEl = event.target as HTMLInputElement | HTMLSelectElement;
const newVal = type === 'boolean' ?
'checked' in formEl ? formEl.checked : !!formEl.value :
Number(formEl.value);
const newState: Partial<State> = {
[prop]: newVal,
};
// Ensure that min cannot be greater than max
switch (prop) {
case 'maxQuality':
if (newVal < this.state.minQuality) {
newState.minQuality = newVal as number;
}
break;
case 'minQuality':
if (newVal > this.state.maxQuality) {
newState.maxQuality = newVal as number;
}
break;
case 'maxAlphaQuality':
if (newVal < this.state.minAlphaQuality) {
newState.minAlphaQuality = newVal as number;
}
break;
case 'minAlphaQuality':
if (newVal > this.state.maxAlphaQuality) {
newState.maxAlphaQuality = newVal as number;
}
break;
}
const optionState = {
...this.state,
...newState,
};
const maxQuantizer = optionState.lossless ? 0 : (maxQuant - optionState.minQuality);
const minQuantizer = optionState.lossless ? 0 : (maxQuant - optionState.maxQuality);
const newOptions: EncodeOptions = {
maxQuantizer,
minQuantizer,
maxQuantizerAlpha: optionState.separateAlpha ?
(optionState.losslessAlpha ? 0 : (maxQuant - optionState.minAlphaQuality)) :
maxQuantizer,
minQuantizerAlpha: optionState.separateAlpha ?
(optionState.losslessAlpha ? 0 : (maxQuant - optionState.maxAlphaQuality)) :
minQuantizer,
// Always set to 4:4:4 if lossless
subsample: optionState.grayscale ? 0 : optionState.lossless ? 3 : optionState.subsample,
tileColsLog2: optionState.tileCols,
tileRowsLog2: optionState.tileRows,
speed: maxSpeed - optionState.effort,
};
// Updating options, so we don't recalculate in getDerivedStateFromProps.
newState.options = newOptions;
this.setState(
// It isn't clear to me why I have to cast this :)
newState as State,
);
this.props.onChange(newOptions);
});
}
return this._inputChangeCallbacks.get(prop)!;
}
render(
_: Props,
{
effort, grayscale, lossless, losslessAlpha, maxAlphaQuality, maxQuality, minAlphaQuality,
minQuality, separateAlpha, showAdvanced, subsample, tileCols, tileRows,
}: State,
) {
return (
<form class={style.optionsSection} onSubmit={preventDefault}>
<label class={style.optionInputFirst}>
<Checkbox
checked={lossless}
onChange={this._inputChange('lossless', 'boolean')}
/>
Lossless
</label>
<Expander>
{!lossless && (
<div>
<div class={style.optionOneCell}>
<Range
min="0"
max="62"
value={maxQuality}
onInput={this._inputChange('maxQuality', 'number')}
>
Max quality:
</Range>
</div>
<div class={style.optionOneCell}>
<Range
min="0"
max="62"
value={minQuality}
onInput={this._inputChange('minQuality', 'number')}
>
Min quality:
</Range>
</div>
</div>
)}
</Expander>
<label class={style.optionInputFirst}>
<Checkbox
checked={separateAlpha}
onChange={this._inputChange('separateAlpha', 'boolean')}
/>
Separate alpha quality
</label>
<Expander>
{separateAlpha && (
<div>
<label class={style.optionInputFirst}>
<Checkbox
checked={losslessAlpha}
onChange={this._inputChange('losslessAlpha', 'boolean')}
/>
Lossless alpha
</label>
<Expander>
{!losslessAlpha &&
<div>
<div class={style.optionOneCell}>
<Range
min="0"
max="62"
value={maxAlphaQuality}
onInput={this._inputChange('maxAlphaQuality', 'number')}
>
Max alpha quality:
</Range>
</div>
<div class={style.optionOneCell}>
<Range
min="0"
max="62"
value={minAlphaQuality}
onInput={this._inputChange('minAlphaQuality', 'number')}
>
Min alpha quality:
</Range>
</div>
</div>
}
</Expander>
</div>
)}
</Expander>
<label class={style.optionInputFirst}>
<Checkbox
checked={showAdvanced}
onChange={linkState(this, 'showAdvanced')}
/>
Show advanced settings
</label>
<Expander>
{showAdvanced &&
<div>
{/*<label class={style.optionInputFirst}>
<Checkbox
data-set-state="grayscale"
checked={grayscale}
onChange={this._inputChange('grayscale', 'boolean')}
/>
Grayscale
</label>*/}
<Expander>
{!grayscale && !lossless &&
<label class={style.optionTextFirst}>
Subsample chroma:
<Select
data-set-state="subsample"
value={subsample}
onChange={this._inputChange('subsample', 'number')}
>
<option value="1">4:2:0</option>
{/*<option value="2">4:2:2</option>*/}
<option value="3">4:4:4</option>
</Select>
</label>
}
</Expander>
<div class={style.optionOneCell}>
<Range
min="0"
max="6"
value={tileRows}
onInput={this._inputChange('tileRows', 'number')}
>
Log2 of tile rows:
</Range>
</div>
<div class={style.optionOneCell}>
<Range
min="0"
max="6"
value={tileCols}
onInput={this._inputChange('tileCols', 'number')}
>
Log2 of tile cols:
</Range>
</div>
</div>
}
</Expander>
<div class={style.optionOneCell}>
<Range
name="quantizer"
min="0"
max="63"
value={options.minQuantizer}
onInput={this.onChange}
>
Quantizer
</Range>
</div>
<div class={style.optionOneCell}>
<Range
name="speed"
min="0"
max="10"
value={options.speed}
onInput={this.onChange}
value={effort}
onInput={this._inputChange('effort', 'number')}
>
Speed
Effort:
</Range>
</div>
</form>

View File

@ -1,21 +1,16 @@
import { builtinDecode, sniffMimeType, canDecodeImage } from '../lib/util';
import { builtinDecode, sniffMimeType, canDecodeImageType } from '../lib/util';
import Processor from './processor';
import webpDataUrl from 'url-loader!./tiny.webp';
const webPSupported = canDecodeImage(webpDataUrl);
export async function decodeImage(blob: Blob, processor: Processor): Promise<ImageData> {
const mimeType = await sniffMimeType(blob);
const canDecode = await canDecodeImageType(mimeType);
try {
if (mimeType === 'image/avif') {
return await processor.avifDecode(blob);
if (!canDecode) {
if (mimeType === 'image/avif') return await processor.avifDecode(blob);
if (mimeType === 'image/webp') return await processor.webpDecode(blob);
// If it's not one of those types, fall through and try built-in decoding for a laugh.
}
if (mimeType === 'image/webp' && !(await webPSupported)) {
return await processor.webpDecode(blob);
}
// Otherwise, just throw it at the browser's decoder.
return await builtinDecode(blob);
} catch (err) {
throw Error("Couldn't decode image");

View File

@ -1,5 +1,5 @@
import mozjpeg_enc, { MozJPEGModule } from '../../../codecs/mozjpeg/enc/mozjpeg_enc';
import wasmUrl from '../../../codecs/mozjpeg/enc/mozjpeg_enc.wasm';
import mozjpeg_enc, { MozJPEGModule } from '../../../codecs/mozjpeg_enc/mozjpeg_enc';
import wasmUrl from '../../../codecs/mozjpeg_enc/mozjpeg_enc.wasm';
import { EncodeOptions } from './encoder-meta';
import { initEmscriptenModule } from '../util';

View File

@ -1,6 +1,6 @@
import { optimise } from '../../../codecs/oxipng/pkg';
import optimiser from '../../../codecs/oxipng';
import { EncodeOptions } from './encoder-meta';
export async function compress(data: ArrayBuffer, options: EncodeOptions): Promise<ArrayBuffer> {
return optimise(new Uint8Array(data), options.level).buffer;
return (await optimiser).optimise(new Uint8Array(data), options.level).buffer;
}

View File

@ -88,14 +88,14 @@ async function avifEncode(
const { encode } = await import(
/* webpackChunkName: "process-avif-enc" */
'../avif/encoder');
return encode(data, options);
return timed('avifEncode', () => encode(data, options));
}
async function avifDecode(data: ArrayBuffer): Promise<ImageData> {
const { decode } = await import(
/* webpackChunkName: "process-avif-dec" */
'../avif/decoder');
return decode(data);
return timed('avifDencode', () => decode(data));
}
const exports = {

View File

@ -62,12 +62,10 @@ export default class Processor {
if (!this._worker && needsWorker) {
// worker-loader does magic here.
// @ts-ignore - Typescript doesn't know about the 2nd param to new Worker, and the
// definition can't be overwritten.
this._worker = new Worker(
'./processor-worker',
{ name: 'processor-worker', type: 'module' },
) as Worker;
);
// Need to do some TypeScript trickery to make the type match.
this._workerApi = proxy(this._worker) as any as ProcessorWorkerApi;
}

View File

@ -1,28 +1,23 @@
type ModuleFactory<M extends EmscriptenWasm.Module> = (
export type ModuleFactory<M extends EmscriptenWasm.Module> = (
opts: EmscriptenWasm.ModuleOpts,
) => M;
) => Promise<M>;
export function initEmscriptenModule<T extends EmscriptenWasm.Module>(
moduleFactory: ModuleFactory<T>,
wasmUrl: string,
workerUrl?: string,
mainUrl?: string,
): Promise<T> {
return new Promise((resolve) => {
const module = moduleFactory({
// Just to be safe, don't automatically invoke any wasm functions
noInitialRun: true,
locateFile(url: string): string {
// Redirect the request for the wasm binary to whatever webpack gave us.
if (url.endsWith('.wasm')) return wasmUrl;
return url;
},
onRuntimeInitialized() {
// An Emscripten is a then-able that resolves with itself, causing an infite loop when you
// wrap it in a real promise. Delete the `then` prop solves this for now.
// https://github.com/kripken/emscripten/issues/5820
delete (module as any).then;
resolve(module);
},
});
return moduleFactory({
mainScriptUrlOrBlob: mainUrl,
// Just to be safe, don't automatically invoke any wasm functions
noInitialRun: true,
locateFile(url: string): string {
// Redirect the request for the wasm binary to whatever webpack gave us.
if (url.endsWith('.wasm')) return wasmUrl;
if (url.endsWith('.worker.js')) return workerUrl!;
return url;
},
});
}

View File

@ -75,7 +75,7 @@ export default class App extends Component<Props, State> {
// really breaks things on Squoosh, as you can easily end up zooming the UI when you mean to
// zoom the image. Once you've done this, it's really difficult to undo. Anyway, this seems to
// prevent it.
document.body.addEventListener('gesturestart', (event) => {
document.body.addEventListener('gesturestart', (event: any) => {
event.preventDefault();
});

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -78,11 +78,36 @@ async function decodeImage(url: string): Promise<HTMLImageElement> {
return img;
}
/** Caches results from canDecodeImageType */
const canDecodeCache = new Map<string, Promise<boolean>>();
/**
* Attempts to load the given URL as an image.
* Tests whether the browser supports a particular image mime type.
*
* @param type Mimetype
* @example await canDecodeImageType('image/avif')
*/
export function canDecodeImage(url: string): Promise<boolean> {
return decodeImage(url).then(() => true, () => false);
export function canDecodeImageType(type: string): Promise<boolean> {
if (!canDecodeCache.has(type)) {
const resultPromise = (async () => {
const picture = document.createElement('picture');
const img = document.createElement('img');
const source = document.createElement('source');
source.srcset = 'data:,x';
source.type = type;
picture.append(source, img);
// Wait a single microtick just for the `img.currentSrc` to get populated.
await 0;
// At this point `img.currentSrc` will contain "data:,x" if format is supported and ""
// otherwise.
return !!img.currentSrc;
})();
canDecodeCache.set(type, resultPromise);
}
return canDecodeCache.get(type)!;
}
export function blobToArrayBuffer(blob: Blob): Promise<ArrayBuffer> {

View File

@ -33,6 +33,16 @@ declare module 'url-loader!*' {
export default value;
}
declare module 'file-loader!*' {
const value: string;
export default value;
}
declare module '*.worker.js' {
const value: string;
export default value;
}
declare var VERSION: string;
declare var ga: {

BIN
src/sw/tiny.avif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

View File

Before

Width:  |  Height:  |  Size: 38 B

After

Width:  |  Height:  |  Size: 38 B

View File

@ -1,4 +1,5 @@
import webpDataUrl from 'url-loader!../codecs/tiny.webp';
import webpDataUrl from 'url-loader!./tiny.webp';
import avifDataUrl from 'url-loader!./tiny.avif';
// Give TypeScript the correct global.
declare var self: ServiceWorkerGlobalScope;
@ -109,17 +110,20 @@ export async function cacheAdditionalProcessors(cacheName: string, buildAssets:
toCache.push(...prefixMatches, ...wasm);
const supportsWebP = await (async () => {
if (!self.createImageBitmap) return false;
const response = await fetch(webpDataUrl);
const blob = await response.blob();
return createImageBitmap(blob).then(() => true, () => false);
})();
const [supportsWebP, supportsAvif] = await Promise.all(
[webpDataUrl, avifDataUrl].map(async (dataUrl) => {
if (!self.createImageBitmap) return false;
const response = await fetch(dataUrl);
const blob = await response.blob();
return createImageBitmap(blob).then(() => true, () => false);
}),
)
// No point caching the WebP decoder if the browser supports it:
if (supportsWebP) {
toCache = toCache.filter(asset => !/webp[\-_]dec/.test(asset));
}
// No point caching decoders the browser already supports:
toCache = toCache.filter(asset =>
(supportsWebP ? !/webp[\-_]dec/.test(asset) : true) &&
(supportsAvif ? !/avif[\-_]dec/.test(asset) : true),
);
const cache = await caches.open(cacheName);
await cache.addAll(toCache);

View File

@ -149,7 +149,7 @@ module.exports = async function(_, env) {
{
// Emscripten modules don't work with Webpack's Wasm loader.
test: /\.wasm$/,
exclude: /_bg\.wasm$/,
exclude: /(?<!\bpkg-parallel[\\/]squoosh_oxipng)_bg\.wasm$/,
// This is needed to make webpack NOT process wasm files.
// See https://github.com/webpack/webpack/issues/6725
type: 'javascript/auto',
@ -160,11 +160,11 @@ module.exports = async function(_, env) {
},
{
// Wasm modules generated by Rust + wasm-pack work great with Webpack.
test: /_bg\.wasm$/,
test: /(?<!\bpkg-parallel[\\/]squoosh_oxipng)_bg\.wasm$/,
type: 'webassembly/experimental',
},
{
test: /\.(png|svg|jpg|gif)$/,
test: /\.(png|svg|jpg|gif|worker\.js)$/,
loader: 'file-loader',
options: {
name: '[name].[hash:5].[ext]',
@ -174,8 +174,7 @@ module.exports = async function(_, env) {
},
plugins: [
new webpack.IgnorePlugin(
/(fs|crypto|path)/,
/[/\\]codecs[/\\]/
/^(fs|crypto|path|perf_hooks|worker_threads)$/
),
// Pretty progressbar showing build progress: