discourse_voice_assets 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +5 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE +21 -0
- data/README.md +77 -0
- data/Rakefile +14 -0
- data/lib/discourse_voice_assets/version.rb +5 -0
- data/lib/discourse_voice_assets.rb +24 -0
- data/vendor/dfn3/dfn3-model.bin +0 -0
- data/vendor/dfn3/dfn3-worklet.js +1 -0
- data/vendor/dfn3/dfn3.wasm +0 -0
- data/vendor/dtln/dtln-worklet.js +1 -0
- data/vendor/dtln/dtln.wasm +0 -0
- data/vendor/livekit/livekit-client.js +40 -0
- data/vendor/mediapipe/selfie_segmenter.tflite +0 -0
- data/vendor/mediapipe/vision_bundle.js +2 -0
- data/vendor/mediapipe/wasm/vision_wasm_internal.js +8827 -0
- data/vendor/mediapipe/wasm/vision_wasm_internal.wasm +0 -0
- data/vendor/mediapipe/wasm/vision_wasm_nosimd_internal.js +8818 -0
- data/vendor/mediapipe/wasm/vision_wasm_nosimd_internal.wasm +0 -0
- data/vendor/rnnoise/rnnoise-worklet.js +1 -0
- data/vendor/rnnoise/rnnoise.wasm +0 -0
- data/vendor/stt/ort/ort-wasm-simd-threaded.jsep.js +106 -0
- data/vendor/stt/ort/ort-wasm-simd-threaded.jsep.wasm +0 -0
- data/vendor/stt/subtitles-worker.js +2846 -0
- data/vendor/stt/vad/silero_vad_legacy.onnx +0 -0
- data/vendor/stt/vad/silero_vad_v5.onnx +0 -0
- data/vendor/stt/vad/vad.worklet.bundle.min.js +1 -0
- data/vendor/stt/vad.js +2866 -0
- metadata +107 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 3ac0000a3fb049d76bce55dab193168ec5bedeb68e2c48a69e4dc37eaa81b30f
|
|
4
|
+
data.tar.gz: e15086c3342ea453bc5c9217ea56ea82bac9e238a750346883159a951df6c6fe
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 8a96398b000f3b5f60c2bfbc899937d63dd80325c79d842c764266151ac80e572259d377f6a94ce1ee813f1563755981dc126a1da6614a9ba47a2b0598dd7f2b
|
|
7
|
+
data.tar.gz: cb53bd4d36816ef2616795076391811004a477bb46f008d65e54ec1273d9d36bdc75bec05a023097e244d57850c964ba5181f8f918a641f70e524cf5d9c440d6
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/CHANGELOG.md
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) Civilized Discourse Construction Kit, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# DiscourseVoiceAssets
|
|
2
|
+
|
|
3
|
+
Prebuilt browser media assets for Discourse voice/video chat (the `resenha`
|
|
4
|
+
plugin). The plugin's client features depend on ~75 MB of WebAssembly
|
|
5
|
+
binaries, ML models, and vendored SDK bundles; this gem carries those blobs so
|
|
6
|
+
they stay out of the main Discourse repository, along with the pinned,
|
|
7
|
+
reproducible build scripts that produce every artifact.
|
|
8
|
+
|
|
9
|
+
## What's vendored
|
|
10
|
+
|
|
11
|
+
| Directory | Contents | Source | License |
|
|
12
|
+
|---|---|---|---|
|
|
13
|
+
| `vendor/rnnoise` | RNNoise noise-suppression worklet + wasm (~130 KB) | [xiph/rnnoise](https://github.com/xiph/rnnoise) @ v0.1.1 | BSD-3-Clause |
|
|
14
|
+
| `vendor/dtln` | DTLN noise-suppression worklet + wasm (~6 MB) | [DataDog/dtln-rs](https://github.com/DataDog/dtln-rs) | Apache-2.0 |
|
|
15
|
+
| `vendor/dfn3` | DeepFilterNet3 worklet + wasm (~9.5 MB) + model (~8 MB) | [Rikorose/DeepFilterNet](https://github.com/Rikorose/DeepFilterNet) | MIT/Apache-2.0 |
|
|
16
|
+
| `vendor/stt` | Live-subtitles runtime: parakeet.js worker, Silero VAD, onnxruntime-web (~41 MB) | [parakeet.js](https://github.com/ysdede/parakeet.js), [@ricky0123/vad-web](https://github.com/ricky0123/vad), [onnxruntime-web](https://onnxruntime.ai) | Apache-2.0 / MIT |
|
|
17
|
+
| `vendor/mediapipe` | Background-blur segmentation: tasks-vision runtime + `selfie_segmenter.tflite` (~22 MB) | [MediaPipe](https://github.com/google-ai-edge/mediapipe), © Google | Apache-2.0 |
|
|
18
|
+
| `vendor/livekit` | Self-contained `livekit-client` ESM bundle (~530 KB) | [livekit-client](https://github.com/livekit/client-sdk-js) | Apache-2.0 |
|
|
19
|
+
|
|
20
|
+
The ~2.5 GB speech-to-text model weights are **not** vendored — they download
|
|
21
|
+
at runtime from HuggingFace (or a self-hosted mirror).
|
|
22
|
+
|
|
23
|
+
## How the plugin consumes it
|
|
24
|
+
|
|
25
|
+
```ruby
|
|
26
|
+
require "discourse_voice_assets"
|
|
27
|
+
|
|
28
|
+
DiscourseVoiceAssets::DIRECTORIES # => %w[dfn3 dtln livekit mediapipe rnnoise stt]
|
|
29
|
+
DiscourseVoiceAssets.vendor_path("stt") # absolute path to the vendored dir
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
At plugin activation the vendor tree is symlinked into the plugin's
|
|
33
|
+
`public/javascripts/<gem version>/`, and the server exposes that base path to
|
|
34
|
+
the client, so assets are served at
|
|
35
|
+
`/plugins/resenha/javascripts/<version>/<dir>/...`. Filenames are stable
|
|
36
|
+
across releases — the version-stamped URL provides the cache busting that
|
|
37
|
+
content hashes otherwise would (the `/plugins/` prefix is served with
|
|
38
|
+
long-lived immutable caching) — so bumping the gem requires no other plugin
|
|
39
|
+
change.
|
|
40
|
+
|
|
41
|
+
## Rebuilding assets
|
|
42
|
+
|
|
43
|
+
Everything under `vendor/` is generated. Upstreams are pinned
|
|
44
|
+
(git SHA or npm version); build scripts clone into the gitignored `upstream/`
|
|
45
|
+
directory and apply patches from `src/<engine>-worklet/patches/` where needed.
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pnpm install
|
|
49
|
+
|
|
50
|
+
bash scripts/build-rnnoise-worklet.sh # emcc (standalone wasm)
|
|
51
|
+
bash scripts/build-dtln-worklet.sh # Rust + Emscripten
|
|
52
|
+
bash scripts/build-dfn3-worklet.sh # Rust + wasm-pack
|
|
53
|
+
bash scripts/build-stt-assets.sh # esbuild (parakeet.js, vad-web, ort)
|
|
54
|
+
bash scripts/build-livekit-bundle.sh # esbuild (livekit-client)
|
|
55
|
+
bash scripts/fetch-mediapipe-assets.sh # npm tarball + Google model repo (SHA-256 pinned)
|
|
56
|
+
|
|
57
|
+
# Verify built engines end-to-end in headless Chromium:
|
|
58
|
+
node scripts/smoke-ns-worklet.mjs <rnnoise|dtln|dfn3>
|
|
59
|
+
node scripts/smoke-stt-worker.mjs
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Releasing a new version
|
|
63
|
+
|
|
64
|
+
1. Rebuild the affected assets (above) and commit `vendor/`.
|
|
65
|
+
2. Bump `lib/discourse_voice_assets/version.rb`, tag, and release the gem.
|
|
66
|
+
3. In Discourse: bump the gem version. Nothing else — the plugin references
|
|
67
|
+
the stable filenames and derives the versioned URL at runtime. Renaming or
|
|
68
|
+
removing a vendored file (see the spec's stable-path list) is a breaking
|
|
69
|
+
change needing a coordinated plugin update.
|
|
70
|
+
|
|
71
|
+
## Development
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
bundle install
|
|
75
|
+
bundle exec rspec # vendor tree / manifest integrity
|
|
76
|
+
pnpm test:js # worklet source unit tests (node --test)
|
|
77
|
+
```
|
data/Rakefile
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "bundler/gem_tasks"
|
|
4
|
+
require "rspec/core/rake_task"
|
|
5
|
+
|
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
7
|
+
|
|
8
|
+
require "rubocop/rake_task"
|
|
9
|
+
|
|
10
|
+
RuboCop::RakeTask.new
|
|
11
|
+
|
|
12
|
+
task test: :spec
|
|
13
|
+
task lint: :rubocop
|
|
14
|
+
task default: %i[spec lint]
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "discourse_voice_assets/version"
|
|
4
|
+
|
|
5
|
+
module DiscourseVoiceAssets
|
|
6
|
+
class Error < StandardError
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# Asset directories served by the consuming plugin under its public
|
|
10
|
+
# javascripts dir. Each maps 1:1 to a directory under vendor/.
|
|
11
|
+
DIRECTORIES = %w[dfn3 dtln livekit mediapipe rnnoise stt].freeze
|
|
12
|
+
|
|
13
|
+
def self.gem_root
|
|
14
|
+
@gem_root ||= File.expand_path("../..", __FILE__)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Absolute path to a vendored asset (or asset directory when called with
|
|
18
|
+
# no arguments beyond the directory name). Filenames are stable across
|
|
19
|
+
# releases: the consuming plugin serves the tree from a URL stamped with
|
|
20
|
+
# this gem's version, so cache busting comes from version bumps.
|
|
21
|
+
def self.vendor_path(*segments)
|
|
22
|
+
File.join(gem_root, "vendor", *segments)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{typeof globalThis.TextDecoder>"u"&&(globalThis.TextDecoder=class{constructor(){}decode(e){if(!e)return"";let n=e instanceof Uint8Array?e:new Uint8Array(e),r="",s=0;for(;s<n.length;){let i=n[s],u,a;for(i<128?(u=i,a=0):i<224?(u=i&31,a=1):i<240?(u=i&15,a=2):(u=i&7,a=3),s++;a-- >0&&s<n.length;)u=u<<6|n[s++]&63;r+=String.fromCodePoint(u)}return r}});typeof globalThis.TextEncoder>"u"&&(globalThis.TextEncoder=class{encode(e=""){let n=[];for(let r of e){let s=r.codePointAt(0);s<128?n.push(s):s<2048?n.push(192|s>>6,128|s&63):s<65536?n.push(224|s>>12,128|s>>6&63,128|s&63):n.push(240|s>>18,128|s>>12&63,128|s>>6&63,128|s&63)}return new Uint8Array(n)}encodeInto(e,n){let r=this.encode(e),s=Math.min(r.length,n.length);return n.set(r.subarray(0,s)),{read:e.length,written:s}}});var h=class{constructor(e,n){this.ratio=e/n,this.pos=0,this.last=0}process(e){if(this.ratio===1)return e.slice();let n=e.length-1,r=Math.max(0,Math.floor((n-this.pos)/this.ratio)+1),s=new Float32Array(r),i=this.pos;for(let u=0;u<r;u++){let a=Math.min(Math.floor(i),n),_=i-a,g=a<0?this.last:e[a],d=a<n?e[a+1]:g;s[u]=g+_*(d-g),i+=this.ratio}return this.pos=i-e.length,this.last=e[n],s}};var D=50;function E({engineRate:t,frameSize:e,createEngine:n}){class r extends AudioWorkletProcessor{constructor(){super(),this.engine=null,this.bypass=!1,this.consecutiveErrors=0,this.initErrorReported=!1,this.inputBuffer=new Float32Array(e),this.outputBuffer=new Float32Array(e),this.inputIndex=0,this.outputQueue=[],this.outputQueueOffset=0,this.downsampler=new h(sampleRate,t),this.upsampler=new h(t,sampleRate),this.port.onmessage=i=>{i.data?.type==="init"&&this.#e(i.data.assets)}}async#e(i){try{let u=await n(i);u.denoise(new Float32Array(e),this.outputBuffer),this.engine=u,this.port.postMessage({type:"ready"})}catch(u){this.#t(u)}}#t(i){this.initErrorReported||(this.initErrorReported=!0,this.port.postMessage({type:"error",message:String(i?.message||i)}))}process(i,u){let a=i?.[0]?.[0],_=u?.[0]?.[0];if(!_)return!0;if(!a)return _.fill(0),!0;if(!this.engine||this.bypass)return _.set(a),!0;try{let g=this.downsampler.process(a);for(let w=0;w<g.length;w++)this.inputBuffer[this.inputIndex++]=g[w],this.inputIndex>=e&&(this.engine.denoise(this.inputBuffer,this.outputBuffer),this.inputIndex=0,this.outputQueue.push(this.upsampler.process(this.outputBuffer)));let d=0;for(;d<_.length&&this.outputQueue.length>0;){let w=this.outputQueue[0],I=w.length-this.outputQueueOffset,B=_.length-d,A=Math.min(I,B);_.set(w.subarray(this.outputQueueOffset,this.outputQueueOffset+A),d),d+=A,this.outputQueueOffset+=A,this.outputQueueOffset>=w.length&&(this.outputQueue.shift(),this.outputQueueOffset=0)}d<_.length&&_.fill(0,d),this.consecutiveErrors=0}catch(g){_.set(a),this.consecutiveErrors++,this.consecutiveErrors===1&&console.error("[resenha] noise suppression engine error:",g),this.consecutiveErrors>=D&&(this.bypass=!0,this.port.postMessage({type:"bypass"}),console.error("[resenha] engine keeps failing, noise suppression bypassed"))}return!0}}registerProcessor("noise-suppression-processor",r)}var q={},f,b=new Array(128).fill(void 0);b.push(void 0,null,!0,!1);function o(t){return b[t]}var m=b.length;function P(t){t<132||(b[t]=m,m=t)}function M(t){let e=o(t);return P(t),e}var R=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&R.decode();var p=null;function F(){return(p===null||p.byteLength===0)&&(p=new Uint8Array(f.memory.buffer)),p}function T(t,e){return t=t>>>0,R.decode(F().subarray(t,t+e))}function c(t){m===b.length&&b.push(b.length+1);let e=m;return m=b[e],b[e]=t,e}var x=0;function j(t,e){let n=e(t.length*1,1)>>>0;return F().set(t,n/1),x=t.length,n}function O(t,e){let n=j(t,f.__wbindgen_malloc),r=x;return f.df_create(n,r,e)>>>0}function W(t){return f.df_get_frame_length(t)>>>0}var y=null;function C(){return(y===null||y.byteLength===0)&&(y=new Float32Array(f.memory.buffer)),y}function L(t,e){let n=e(t.length*4,4)>>>0;return C().set(t,n/4),x=t.length,n}function S(t,e){let n=L(e,f.__wbindgen_malloc),r=x,s=f.df_process_frame(t,n,r);return M(s)}function l(t,e){try{return t.apply(this,e)}catch(n){f.__wbindgen_exn_store(c(n))}}var G=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>f.__wbg_dfstate_free(t>>>0));async function N(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(r){if(t.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",r);else throw r}let n=await t.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{let n=await WebAssembly.instantiate(t,e);return n instanceof WebAssembly.Instance?{instance:n,module:t}:n}}function U(){let t={};return t.wbg={},t.wbg.__wbindgen_object_drop_ref=function(e){M(e)},t.wbg.__wbg_crypto_566d7465cdbb6b7a=function(e){let n=o(e).crypto;return c(n)},t.wbg.__wbindgen_is_object=function(e){let n=o(e);return typeof n=="object"&&n!==null},t.wbg.__wbg_process_dc09a8c7d59982f6=function(e){let n=o(e).process;return c(n)},t.wbg.__wbg_versions_d98c6400c6ca2bd8=function(e){let n=o(e).versions;return c(n)},t.wbg.__wbg_node_caaf83d002149bd5=function(e){let n=o(e).node;return c(n)},t.wbg.__wbindgen_is_string=function(e){return typeof o(e)=="string"},t.wbg.__wbg_require_94a9da52636aacbf=function(){return l(function(){let e=module.require;return c(e)},arguments)},t.wbg.__wbindgen_is_function=function(e){return typeof o(e)=="function"},t.wbg.__wbindgen_string_new=function(e,n){let r=T(e,n);return c(r)},t.wbg.__wbg_msCrypto_0b84745e9245cdf6=function(e){let n=o(e).msCrypto;return c(n)},t.wbg.__wbg_randomFillSync_290977693942bf03=function(){return l(function(e,n){o(e).randomFillSync(M(n))},arguments)},t.wbg.__wbg_getRandomValues_260cc23a41afad9a=function(){return l(function(e,n){o(e).getRandomValues(o(n))},arguments)},t.wbg.__wbg_newnoargs_e258087cd0daa0ea=function(e,n){let r=new Function(T(e,n));return c(r)},t.wbg.__wbg_call_27c0f87801dedf93=function(){return l(function(e,n){let r=o(e).call(o(n));return c(r)},arguments)},t.wbg.__wbindgen_object_clone_ref=function(e){let n=o(e);return c(n)},t.wbg.__wbg_self_ce0dbfc45cf2f5be=function(){return l(function(){let e=self.self;return c(e)},arguments)},t.wbg.__wbg_window_c6fb939a7f436783=function(){return l(function(){let e=window.window;return c(e)},arguments)},t.wbg.__wbg_globalThis_d1e6af4856ba331b=function(){return l(function(){let e=globalThis.globalThis;return c(e)},arguments)},t.wbg.__wbg_global_207b558942527489=function(){return l(function(){let e=global.global;return c(e)},arguments)},t.wbg.__wbindgen_is_undefined=function(e){return o(e)===void 0},t.wbg.__wbg_call_b3ca7c6051f9bec1=function(){return l(function(e,n,r){let s=o(e).call(o(n),o(r));return c(s)},arguments)},t.wbg.__wbg_buffer_12d079cc21e14bdb=function(e){let n=o(e).buffer;return c(n)},t.wbg.__wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb=function(e,n,r){let s=new Uint8Array(o(e),n>>>0,r>>>0);return c(s)},t.wbg.__wbg_new_63b92bc8671ed464=function(e){let n=new Uint8Array(o(e));return c(n)},t.wbg.__wbg_set_a47bac70306a19a7=function(e,n,r){o(e).set(o(n),r>>>0)},t.wbg.__wbg_newwithbyteoffsetandlength_4a659d079a1650e0=function(e,n,r){let s=new Float32Array(o(e),n>>>0,r>>>0);return c(s)},t.wbg.__wbg_new_9efabd6b6d2ce46d=function(e){let n=new Float32Array(o(e));return c(n)},t.wbg.__wbg_newwithlength_e9b4878cebadb3d3=function(e){let n=new Uint8Array(e>>>0);return c(n)},t.wbg.__wbg_subarray_a1f73cd4b5b42fe1=function(e,n,r){let s=o(e).subarray(n>>>0,r>>>0);return c(s)},t.wbg.__wbindgen_throw=function(e,n){throw new Error(T(e,n))},t.wbg.__wbindgen_memory=function(){let e=f.memory;return c(e)},t}function Q(t,e){return f=t.exports,k.__wbindgen_wasm_module=e,y=null,p=null,f}function v(t){if(f!==void 0)return f;let e=U();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));let n=new WebAssembly.Instance(t,e);return Q(n,t)}async function k(t){if(f!==void 0)return f;typeof t>"u"&&(t=new URL("df_bg.wasm",q.url));let e=U();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:n,module:r}=await N(await t,e);return Q(n,r)}E({engineRate:48e3,frameSize:480,async createEngine({wasm:t,model:e}){v(await WebAssembly.compile(t));let n=O(new Uint8Array(e),100),r=W(n);if(r!==480)throw new Error(`unexpected DeepFilterNet hop size: ${r}`);return{denoise(s,i){i.set(S(n,s))}}}});})();
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{var Zt=Object.create;var ir=Object.defineProperty;var Jt=Object.getOwnPropertyDescriptor;var en=Object.getOwnPropertyNames;var rn=Object.getPrototypeOf,tn=Object.prototype.hasOwnProperty;var nn=(D,l)=>()=>{try{return l||D((l={exports:{}}).exports,l),l.exports}catch(P){throw l=0,P}};var on=(D,l,P,M)=>{if(l&&typeof l=="object"||typeof l=="function")for(let N of en(l))!tn.call(D,N)&&N!==P&&ir(D,N,{get:()=>l[N],enumerable:!(M=Jt(l,N))||M.enumerable});return D};var an=(D,l,P)=>(P=D!=null?Zt(rn(D)):{},on(l||!D||!D.__esModule?ir(P,"default",{value:D,enumerable:!0}):P,D));var sr=nn((ar,ue)=>{async function De(D={}){var l=D,P=!1,M=!0;l.noInitialRun=!0;function N(e){let r=e.length;for(;r--;)e[r]=Math.random()*Number.MAX_SAFE_INTEGER;return e}let S=typeof AudioWorkletGlobalScope<"u"?{getRandomValues:N}:window.crypto,F=typeof AudioWorkletGlobalScope<"u"?{now:()=>Date.now()}:window.performance;var T=[],C="./this.program",B=(e,r)=>{throw r},z;M&&(z=self.location.href);var j="";function ce(e){return l.locateFile?l.locateFile(e,j):j+e}var re,q;if(P||M){try{j=new URL(".",z).href}catch{}M&&(q=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),re=async e=>{var r=await fetch(e,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)}}var ie=console.log.bind(console),X=console.error.bind(console),Pe,de=!1,ve;class _{}class fn extends _{}class Ae extends _{constructor(r){super(),this.excPtr=r}}var lr=!1;function ur(){var e=nr.buffer;$=new Int8Array(e),Q=new Uint8Array(e),ke=new Int32Array(e),m=new Uint32Array(e),be=new Float32Array(e),x=new BigInt64Array(e)}function cr(){var e=l.preRun;e&&(typeof e=="function"&&(e=[e]),Ce.push(...e)),Te(Ce)}function dr(){lr=!0,!l.noFSInit&&!n.initialized&&n.init(),G.init(),ne.T(),n.ignorePermissions=!1}function vr(){var e=l.postRun;e&&(typeof e=="function"&&(e=[e]),Me.push(...e)),Te(Me)}function L(e){l.onAbort?.(e),e=`Aborted(${e})`,X(e),de=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw r}var Fe;function hr(){return ce("dtln_rs.wasm")}function mr(e){if(q)return q(e);throw"both async and sync fetching of the wasm failed"}async function pr(e){if(!Pe)try{var r=await re(e);return new Uint8Array(r)}catch{}return mr(e)}async function wr(e,r){try{var t=await pr(e),o=await WebAssembly.instantiate(t,r);return o}catch(i){X(`failed to asynchronously prepare wasm: ${i}`),L(i)}}async function _r(e,r,t){if(!e)try{var o=fetch(r,{credentials:"same-origin"}),i=await WebAssembly.instantiateStreaming(o,t);return i}catch(a){X(`wasm streaming compile failed: ${a}`),X("falling back to ArrayBuffer instantiation")}return wr(r,t)}function gr(){var e={a:St};return e}async function yr(){function e(s){return ne=s.exports,bt(ne),ur(),ne}function r(s){return e(s.instance)}var t=gr(),o=l.instantiateWasm;if(o)return new Promise(s=>{o(t,f=>s(e(f)))});Fe??=hr();var i=await _r(Pe,Fe,t),a=r(i);return a}class Re{name="ExitStatus";constructor(r){this.message=`Program terminated with exit(${r})`,this.status=r}}var Te=e=>{for(;e.length>0;)e.shift()(l)},Me=[],Ce=[],Ne=!0,y=e=>Ve(e),E=()=>Ze(),xe=[],Be=0,Er=e=>{var r=new he(e);return r.get_caught()||(r.set_caught(!0),Be--),r.set_rethrown(!1),xe.push(r),tr(e)},ae=null,kr=()=>{g(0,0);var e=xe.pop();Je(e.excPtr),ae=null},$,m;class he{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){m[this.ptr+4>>2]=r}get_type(){return m[this.ptr+4>>2]}set_destructor(r){m[this.ptr+8>>2]=r}get_destructor(){return m[this.ptr+8>>2]}set_caught(r){r=r?1:0,$[this.ptr+12]=r}get_caught(){return $[this.ptr+12]!=0}set_rethrown(r){r=r?1:0,$[this.ptr+13]=r}get_rethrown(){return $[this.ptr+13]!=0}init(r,t){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(t)}set_adjusted_ptr(r){m[this.ptr+16>>2]=r}get_adjusted_ptr(){return m[this.ptr+16>>2]}}var se=e=>Ke(e),me=e=>{var r=ae?.excPtr;if(!r)return se(0),0;var t=new he(r);t.set_adjusted_ptr(r);var o=t.get_type();if(!o)return se(0),r;for(var i of e){if(!i||i===o)break;var a=t.ptr+16;if(rr(i,o,a))return se(i),r}return se(o),r},br=()=>me([]),Sr=e=>me([e]),Dr=(e,r)=>me([e,r]),Pr=e=>{throw e},Ar=(e,r,t)=>{var o=new he(e);o.init(r,t),er(e),e=ae=new Ae(e),Be++,Pr(e)},Fr=e=>{throw e},Rr=e=>{e=ae??=new Ae(e),Fr(e)},fe=e=>{for(var r=0,t=0;t<e.length;++t){var o=e.charCodeAt(t);o<=127?r++:o<=2047?r+=2:o>=55296&&o<=57343?(r+=4,++t):r+=3}return r},ze=(e,r,t,o)=>{if(!(o>0))return 0;for(var i=t,a=t+o-1,s=0;s<e.length;++s){var f=e.codePointAt(s);if(f<=127){if(t>=a)break;r[t++]=f}else if(f<=2047){if(t+1>=a)break;r[t++]=192|f>>6,r[t++]=128|f&63}else if(f<=65535){if(t+2>=a)break;r[t++]=224|f>>12,r[t++]=128|f>>6&63,r[t++]=128|f&63}else{if(t+3>=a)break;r[t++]=240|f>>18,r[t++]=128|f>>12&63,r[t++]=128|f>>6&63,r[t++]=128|f&63,s++}}return r[t]=0,t-i},Q,pe=(e,r,t)=>ze(e,Q,r,t);function Tr(e,r){try{if(!r)return-28;var t=n.cwd(),o=fe(t)+1;return r<o?-68:(pe(t,e,r),o)}catch(i){if(typeof n>"u"||i.name!=="ErrnoError")throw i;return-i.errno}}var Mr=()=>L(""),je=()=>F.now(),Cr=()=>Date.now(),Nr=1,xr=e=>e>=0&&e<=3,Br=9007199254740992,zr=-9007199254740992,Le=e=>e<zr||e>Br?NaN:Number(e),x;function jr(e,r,t){if(r=Le(r),!xr(e))return 28;var o;if(e===0)o=Cr();else if(Nr)o=je();else return 52;var i=Math.round(o*1e3*1e3);return x[t>>3]=BigInt(i),0}var Lr=()=>Q.length,Ir=()=>Lr(),Or=e=>{var r=Q.length;return e>>>=0,!1},we={},Ur=()=>C,te=()=>{if(!te.strings){var e=(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8",r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:Ur()};for(var t in we)we[t]===void 0?delete r[t]:r[t]=we[t];var o=[];for(var t in r)o.push(`${t}=${r[t]}`);te.strings=o}return te.strings},Hr=(e,r)=>{var t=0,o=0;for(var i of te()){var a=r+t;m[e+o>>2]=a,t+=pe(i,a,1/0)+1,o+=4}return 0},Wr=(e,r)=>{var t=te();m[e>>2]=t.length;var o=0;for(var i of t)o+=fe(i)+1;return m[r>>2]=o,0},$r=0,qr=()=>Ne||$r>0,Xr=e=>{ve=e,qr()||(l.onExit?.(e),de=!0),B(e,new Re(e))},Ie=(e,r)=>{ve=e,Xr(e)},Qr=Ie,p={isAbs:e=>e.charAt(0)==="/",splitPath:e=>{var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return r.exec(e).slice(1)},normalizeArray:(e,r)=>{for(var t=0,o=e.length-1;o>=0;o--){var i=e[o];i==="."?e.splice(o,1):i===".."?(e.splice(o,1),t++):t&&(e.splice(o,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:e=>{var r=p.isAbs(e),t=e.slice(-1)==="/";return e=p.normalizeArray(e.split("/").filter(o=>!!o),!r).join("/"),!e&&!r&&(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=p.splitPath(e),t=r[0],o=r[1];return!t&&!o?".":(o&&(o=o.slice(0,-1)),t+o)},basename:e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],join:(...e)=>p.normalize(e.join("/")),join2:(e,r)=>p.normalize(e+"/"+r)},Gr=()=>e=>(S.getRandomValues(e),0),_e=e=>(_e=Gr())(e),V={resolve:(...e)=>{for(var r="",t=!1,o=e.length-1;o>=-1&&!t;o--){var i=o>=0?e[o]:n.cwd();if(typeof i!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";r=i+"/"+r,t=p.isAbs(i)}return r=p.normalizeArray(r.split("/").filter(a=>!!a),!t).join("/"),(t?"/":"")+r||"."},relative:(e,r)=>{e=V.resolve(e).slice(1),r=V.resolve(r).slice(1);function t(c){for(var w=0;w<c.length&&c[w]==="";w++);for(var b=c.length-1;b>=0&&c[b]==="";b--);return w>b?[]:c.slice(w,b-w+1)}for(var o=t(e.split("/")),i=t(r.split("/")),a=Math.min(o.length,i.length),s=a,f=0;f<a;f++)if(o[f]!==i[f]){s=f;break}for(var u=[],f=s;f<o.length;f++)u.push("..");return u=u.concat(i.slice(s)),u.join("/")}},Oe=globalThis.TextDecoder&&new TextDecoder,Kr=(e,r,t,o)=>{var i=r+t;if(o)return i;for(;e[r]&&!(r>=i);)++r;return r},Y=(e,r=0,t,o)=>{var i=Kr(e,r,t,o);if(i-r>16&&e.buffer&&Oe)return Oe.decode(e.subarray(r,i));for(var a="";r<i;){var s=e[r++];if(!(s&128)){a+=String.fromCharCode(s);continue}var f=e[r++]&63;if((s&224)==192){a+=String.fromCharCode((s&31)<<6|f);continue}var u=e[r++]&63;if((s&240)==224?s=(s&15)<<12|f<<6|u:s=(s&7)<<18|f<<12|u<<6|e[r++]&63,s<65536)a+=String.fromCharCode(s);else{var c=s-65536;a+=String.fromCharCode(55296|c>>10,56320|c&1023)}}return a},ge=[],ye=(e,r,t)=>{var o=t>0?t:fe(e)+1,i=new Array(o),a=ze(e,i,0,i.length);return r&&(i.length=a),i},Vr=()=>{if(!ge.length){var e=null;if(!e)return null;ge=ye(e,!0)}return ge.shift()},G={ttys:[],init(){},shutdown(){},register(e,r){G.ttys[e]={input:[],output:[],ops:r},n.registerDevice(e,G.stream_ops)},stream_ops:{open(e){var r=G.ttys[e.node.rdev];if(!r)throw new n.ErrnoError(43);e.tty=r,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,r,t,o,i){if(!e.tty||!e.tty.ops.get_char)throw new n.ErrnoError(60);for(var a=0,s=0;s<o;s++){var f;try{f=e.tty.ops.get_char(e.tty)}catch{throw new n.ErrnoError(29)}if(f===void 0&&!a)throw new n.ErrnoError(6);if(f==null)break;a++,r[t+s]=f}return a&&(e.node.atime=Date.now()),a},write(e,r,t,o,i){if(!e.tty||!e.tty.ops.put_char)throw new n.ErrnoError(60);try{for(var a=0;a<o;a++)e.tty.ops.put_char(e.tty,r[t+a])}catch{throw new n.ErrnoError(29)}return o&&(e.node.mtime=e.node.ctime=Date.now()),a}},default_tty_ops:{get_char(e){return Vr()},put_char(e,r){r===null||r===10?(ie(Y(e.output)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){e.output?.length>0&&(ie(Y(e.output)),e.output=[])},ioctl_tcgets(e){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(e,r,t){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,r){r===null||r===10?(X(Y(e.output)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){e.output?.length>0&&(X(Y(e.output)),e.output=[])}}},Ue=e=>{L()},d={ops_table:null,mount(e){return d.createNode(null,"/",16895,0)},createNode(e,r,t,o){if(n.isBlkdev(t)||n.isFIFO(t))throw new n.ErrnoError(63);d.ops_table||={dir:{node:{getattr:d.node_ops.getattr,setattr:d.node_ops.setattr,lookup:d.node_ops.lookup,mknod:d.node_ops.mknod,rename:d.node_ops.rename,unlink:d.node_ops.unlink,rmdir:d.node_ops.rmdir,readdir:d.node_ops.readdir,symlink:d.node_ops.symlink},stream:{llseek:d.stream_ops.llseek}},file:{node:{getattr:d.node_ops.getattr,setattr:d.node_ops.setattr},stream:{llseek:d.stream_ops.llseek,read:d.stream_ops.read,write:d.stream_ops.write,mmap:d.stream_ops.mmap,msync:d.stream_ops.msync}},link:{node:{getattr:d.node_ops.getattr,setattr:d.node_ops.setattr,readlink:d.node_ops.readlink},stream:{}},chrdev:{node:{getattr:d.node_ops.getattr,setattr:d.node_ops.setattr},stream:n.chrdev_stream_ops}};var i=n.createNode(e,r,t,o);return n.isDir(i.mode)?(i.node_ops=d.ops_table.dir.node,i.stream_ops=d.ops_table.dir.stream,i.contents={}):n.isFile(i.mode)?(i.node_ops=d.ops_table.file.node,i.stream_ops=d.ops_table.file.stream,i.usedBytes=0,i.contents=d.emptyFileContents??=new Uint8Array(0)):n.isLink(i.mode)?(i.node_ops=d.ops_table.link.node,i.stream_ops=d.ops_table.link.stream):n.isChrdev(i.mode)&&(i.node_ops=d.ops_table.chrdev.node,i.stream_ops=d.ops_table.chrdev.stream),i.atime=i.mtime=i.ctime=Date.now(),e&&(e.contents[r]=i,e.atime=e.mtime=e.ctime=i.atime),i},getFileDataAsTypedArray(e){return e.contents.subarray(0,e.usedBytes)},expandFileStorage(e,r){var t=e.contents.length;if(!(t>=r)){var o=1024*1024;r=Math.max(r,t*(t<o?2:1.125)>>>0),t&&(r=Math.max(r,256));var i=d.getFileDataAsTypedArray(e);e.contents=new Uint8Array(r),e.contents.set(i)}},resizeFileStorage(e,r){if(e.usedBytes!=r){var t=e.contents;e.contents=new Uint8Array(r),e.contents.set(t.subarray(0,Math.min(r,e.usedBytes))),e.usedBytes=r}},node_ops:{getattr(e){var r={};return r.dev=n.isChrdev(e.mode)?e.id:1,r.ino=e.id,r.mode=e.mode,r.nlink=1,r.uid=0,r.gid=0,r.rdev=e.rdev,n.isDir(e.mode)?r.size=4096:n.isFile(e.mode)?r.size=e.usedBytes:n.isLink(e.mode)?r.size=e.link.length:r.size=0,r.atime=new Date(e.atime),r.mtime=new Date(e.mtime),r.ctime=new Date(e.ctime),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},setattr(e,r){for(let t of["mode","atime","mtime","ctime"])r[t]!=null&&(e[t]=r[t]);r.size!==void 0&&d.resizeFileStorage(e,r.size)},lookup(e,r){throw d.doesNotExistError||(d.doesNotExistError=new n.ErrnoError(44),d.doesNotExistError.stack="<generic error, no stack>"),d.doesNotExistError},mknod(e,r,t,o){return d.createNode(e,r,t,o)},rename(e,r,t){var o;try{o=n.lookupNode(r,t)}catch{}if(o){if(n.isDir(e.mode))for(var i in o.contents)throw new n.ErrnoError(55);n.hashRemoveNode(o)}delete e.parent.contents[e.name],r.contents[t]=e,e.name=t,r.ctime=r.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,r){delete e.contents[r],e.ctime=e.mtime=Date.now()},rmdir(e,r){var t=n.lookupNode(e,r);for(var o in t.contents)throw new n.ErrnoError(55);delete e.contents[r],e.ctime=e.mtime=Date.now()},readdir(e){return[".","..",...Object.keys(e.contents)]},symlink(e,r,t){var o=d.createNode(e,r,41471,0);return o.link=t,o},readlink(e){if(!n.isLink(e.mode))throw new n.ErrnoError(28);return e.link}},stream_ops:{read(e,r,t,o,i){var a=e.node.contents;if(i>=e.node.usedBytes)return 0;var s=Math.min(e.node.usedBytes-i,o);return r.set(a.subarray(i,i+s),t),s},write(e,r,t,o,i,a){if(!o)return 0;var s=e.node;return s.mtime=s.ctime=Date.now(),a?(s.contents=r.subarray(t,t+o),s.usedBytes=o):!s.usedBytes&&!i?(s.contents=r.slice(t,t+o),s.usedBytes=o):(d.expandFileStorage(s,i+o),s.contents.set(r.subarray(t,t+o),i),s.usedBytes=Math.max(s.usedBytes,i+o)),o},llseek(e,r,t){var o=r;if(t===1?o+=e.position:t===2&&n.isFile(e.node.mode)&&(o+=e.node.usedBytes),o<0)throw new n.ErrnoError(28);return o},mmap(e,r,t,o,i){if(!n.isFile(e.node.mode))throw new n.ErrnoError(43);var a,s,f=e.node.contents;if(!(i&2)&&f.buffer===$.buffer)s=!1,a=f.byteOffset;else{if(s=!0,a=Ue(r),!a)throw new n.ErrnoError(48);f&&((t>0||t+r<f.length)&&(f.subarray?f=f.subarray(t,t+r):f=Array.prototype.slice.call(f,t,t+r)),$.set(f,a))}return{ptr:a,allocated:s}},msync(e,r,t,o,i){return d.stream_ops.write(e,r,0,o,t,!1),0}}},Yr=e=>{if(typeof e!="string")return e;var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},t=r[e];if(typeof t>"u")throw new Error(`Unknown file open mode: ${e}`);return t},He=e=>(typeof e=="string"&&(e=ye(e,!0)),e.subarray||(e=new Uint8Array(e)),e),Ee=(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},Zr=async e=>{var r=await re(e);return new Uint8Array(r)},Jr=(...e)=>n.createDataFile(...e),et=e=>e,We=null,rt=async()=>We,K=0,$e=null,tt=e=>{K--,l.monitorRunDependencies?.(K),K||$e()},nt=e=>{K||(We=new Promise(r=>$e=r)),K++,l.monitorRunDependencies?.(K)},ot=[],it=async(e,r)=>{typeof Browser<"u"&&Browser.init();for(var t of ot)if(t.canHandle(r))return t.handle(e,r);return e},qe=async(e,r,t,o,i,a,s,f)=>{var u=r?V.resolve(p.join2(e,r)):e,c=et(`cp ${u}`);nt(c);try{var w=t;typeof t=="string"&&(w=await Zr(t)),w=await it(w,u),f?.(),a||Jr(e,r,w,o,i,s)}finally{tt(c)}},at=(e,r,t,o,i,a,s,f,u,c)=>{qe(e,r,t,o,i,f,u,c).then(a).catch(s)},n={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,filesystems:null,syncFSRequests:0,ErrnoError:class{name="ErrnoError";constructor(e){this.errno=e}},FSStream:class{shared={};get object(){return this.node}set object(e){this.node=e}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{node_ops={};stream_ops={};readMode=365;writeMode=146;mounted=null;constructor(e,r,t,o){e||(e=this),this.parent=e,this.mount=e.mount,this.id=n.nextInode++,this.name=r,this.mode=t,this.rdev=o,this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return n.isDir(this.mode)}get isDevice(){return n.isChrdev(this.mode)}addListener(e,r=!1){var t={cb:e,exclusive:r},o=this.listeners??=new Set;return o.add(t),{listeners:o,entry:t}}notifyListeners(e){if(this.listeners){var r;for(var t of this.listeners)t.exclusive?(r||=[]).push(t):t.cb(e);if(r){var o=(this.exclTurn||0)%r.length;this.exclTurn=o+1,r[o].cb(e)}}}},lookupPath(e,r={}){if(!e)throw new n.ErrnoError(44);r.follow_mount??=!0,p.isAbs(e)||(e=n.cwd()+"/"+e);e:for(var t=0;t<40;t++){for(var o=e.split("/").filter(c=>!!c),i=n.root,a="/",s=0;s<o.length;s++){var f=s===o.length-1;if(f&&r.parent)break;if(o[s]!=="."){if(o[s]===".."){if(a=p.dirname(a),n.isRoot(i)){e=a+"/"+o.slice(s+1).join("/"),t--;continue e}else i=i.parent;continue}a=p.join2(a,o[s]);try{i=n.lookupNode(i,o[s])}catch(c){if(c?.errno===44&&f&&r.noent_okay)return{path:a};throw c}if(n.isMountpoint(i)&&(!f||r.follow_mount)&&(i=i.mounted.root),n.isLink(i.mode)&&(!f||r.follow)){if(!i.node_ops.readlink)throw new n.ErrnoError(52);var u=i.node_ops.readlink(i);p.isAbs(u)||(u=p.dirname(a)+"/"+u),e=u+"/"+o.slice(s+1).join("/");continue e}}}return{path:a,node:i}}throw new n.ErrnoError(32)},getPath(e){for(var r;;){if(n.isRoot(e)){var t=e.mount.mountpoint;return r?t[t.length-1]!=="/"?`${t}/${r}`:t+r:t}r=r?`${e.name}/${r}`:e.name,e=e.parent}},hashName(e,r){for(var t=0,o=0;o<r.length;o++)t=(t<<5)-t+r.charCodeAt(o)|0;return(e+t>>>0)%n.nameTable.length},hashAddNode(e){var r=n.hashName(e.parent.id,e.name);e.name_next=n.nameTable[r],n.nameTable[r]=e},hashRemoveNode(e){var r=n.hashName(e.parent.id,e.name);if(n.nameTable[r]===e)n.nameTable[r]=e.name_next;else for(var t=n.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode(e,r){var t=n.mayLookup(e);if(t)throw new n.ErrnoError(t);for(var o=n.hashName(e.id,r),i=n.nameTable[o];i;i=i.name_next){var a=i.name;if(i.parent.id===e.id&&a===r)return i}return n.lookup(e,r)},createNode(e,r,t,o){var i=new n.FSNode(e,r,t,o);return n.hashAddNode(i),i},destroyNode(e){n.hashRemoveNode(e)},isRoot(e){return e===e.parent},isMountpoint(e){return!!e.mounted},isFile(e){return(e&61440)===32768},isDir(e){return(e&61440)===16384},isLink(e){return(e&61440)===40960},isChrdev(e){return(e&61440)===8192},isBlkdev(e){return(e&61440)===24576},isFIFO(e){return(e&61440)===4096},isSocket(e){return(e&49152)===49152},flagsToPermissionString(e){var r=["r","w","rw"][e&3];return e&512&&(r+="w"),r},nodePermissions(e,r){return n.ignorePermissions?0:r.includes("r")&&!(e.mode&292)||r.includes("w")&&!(e.mode&146)||r.includes("x")&&!(e.mode&73)?2:0},mayLookup(e){if(!n.isDir(e.mode))return 54;var r=n.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate(e,r){if(!n.isDir(e.mode))return 54;try{var t=n.lookupNode(e,r);return 20}catch{}return n.nodePermissions(e,"wx")},mayDelete(e,r,t){var o;try{o=n.lookupNode(e,r)}catch(a){return a.errno}var i=n.nodePermissions(e,"wx");if(i)return i;if(t){if(!n.isDir(o.mode))return 54;if(n.isRoot(o)||n.getPath(o)===n.cwd())return 10}else if(n.isDir(o.mode))return 31;return 0},mayOpen(e,r){if(!e)return 44;if(n.isLink(e.mode))return 32;var t=n.flagsToPermissionString(r);return n.isDir(e.mode)&&(t!=="r"||r&576)?31:n.nodePermissions(e,t)},checkOpExists(e,r){if(!e)throw new n.ErrnoError(r);return e},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=n.MAX_OPEN_FDS;e++)if(!n.streams[e])return e;throw new n.ErrnoError(33)},getStreamChecked(e){var r=n.getStream(e);if(!r)throw new n.ErrnoError(8);return r},getStream:e=>n.streams[e],createStream(e,r=-1){return e=Object.assign(new n.FSStream,e),r==-1&&(r=n.nextfd()),e.fd=r,n.streams[r]=e,e},closeStream(e){n.streams[e]=null},dupStream(e,r=-1){var t=n.createStream(e,r);return t.stream_ops?.dup?.(t),t},doSetAttr(e,r,t){var o=e?.stream_ops.setattr,i=o?e:r;o??=r.node_ops.setattr,n.checkOpExists(o,63);try{o(i,t)}catch(a){throw a instanceof RangeError?new n.ErrnoError(22):a}},chrdev_stream_ops:{open(e){var r=n.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new n.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,r)=>e<<8|r,registerDevice(e,r){n.devices[e]={stream_ops:r}},getDevice:e=>n.devices[e],getMounts(e){for(var r=[],t=[e];t.length;){var o=t.pop();r.push(o),t.push(...o.mounts)}return r},syncfs(e,r){typeof e=="function"&&(r=e,e=!1),n.syncFSRequests++,n.syncFSRequests>1&&X(`warning: ${n.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=n.getMounts(n.root.mount),o=0;function i(f){return n.syncFSRequests--,r(f)}function a(f){if(f)return a.errored?void 0:(a.errored=!0,i(f));++o>=t.length&&i(null)}for(var s of t)s.type.syncfs?s.type.syncfs(s,e,a):a(null)},mount(e,r,t){var o=t==="/",i=!t,a;if(o&&n.root)throw new n.ErrnoError(10);if(!o&&!i){var s=n.lookupPath(t,{follow_mount:!1});if(t=s.path,a=s.node,n.isMountpoint(a))throw new n.ErrnoError(10);if(!n.isDir(a.mode))throw new n.ErrnoError(54)}var f={type:e,opts:r,mountpoint:t,mounts:[]},u=e.mount(f);return u.mount=f,f.root=u,o?n.root=u:a&&(a.mounted=f,a.mount&&a.mount.mounts.push(f)),u},unmount(e){var r=n.lookupPath(e,{follow_mount:!1});if(!n.isMountpoint(r.node))throw new n.ErrnoError(28);var t=r.node,o=t.mounted,i=n.getMounts(o);for(var[a,s]of Object.entries(n.nameTable))for(;s;){var f=s.name_next;i.includes(s.mount)&&n.destroyNode(s),s=f}t.mounted=null;var u=t.mount.mounts.indexOf(o);t.mount.mounts.splice(u,1)},lookup(e,r){return e.node_ops.lookup(e,r)},mknod(e,r,t){var o=n.lookupPath(e,{parent:!0}),i=o.node,a=p.basename(e);if(!a)throw new n.ErrnoError(28);if(a==="."||a==="..")throw new n.ErrnoError(20);var s=n.mayCreate(i,a);if(s)throw new n.ErrnoError(s);if(!i.node_ops.mknod)throw new n.ErrnoError(63);return i.node_ops.mknod(i,a,r,t)},statfs(e){return n.statfsNode(n.lookupPath(e,{follow:!0}).node)},statfsStream(e){return n.statfsNode(e.node)},statfsNode(e){var r={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:n.nextInode,ffree:n.nextInode-1,fsid:42,flags:2,namelen:255};return e.node_ops.statfs&&Object.assign(r,e.node_ops.statfs(e.mount.opts.root)),r},create(e,r=438){return r&=4095,r|=32768,n.mknod(e,r,0)},mkdir(e,r=511){return r&=1023,r|=16384,n.mknod(e,r,0)},mkdirTree(e,r){var t=e.split("/"),o="";for(var i of t)if(i){(o||p.isAbs(e))&&(o+="/"),o+=i;try{n.mkdir(o,r)}catch(a){if(a.errno!=20)throw a}}},mkdev(e,r,t){return typeof t>"u"&&(t=r,r=438),r|=8192,n.mknod(e,r,t)},symlink(e,r){if(!V.resolve(e))throw new n.ErrnoError(44);var t=n.lookupPath(r,{parent:!0}),o=t.node;if(!o)throw new n.ErrnoError(44);var i=p.basename(r),a=n.mayCreate(o,i);if(a)throw new n.ErrnoError(a);if(!o.node_ops.symlink)throw new n.ErrnoError(63);return o.node_ops.symlink(o,i,e)},link(e,r,t){var o=n.lookupPath(r,{parent:!0}),i=o.node;if(!i)throw new n.ErrnoError(44);var a=p.basename(r),s=n.mayCreate(i,a);if(s)throw new n.ErrnoError(s);if(!i.node_ops.link)throw new n.ErrnoError(34);return i.node_ops.link(i,a,e,t)},rename(e,r){var t=p.dirname(e),o=p.dirname(r),i=p.basename(e),a=p.basename(r),s,f,u;if(s=n.lookupPath(e,{parent:!0}),f=s.node,s=n.lookupPath(r,{parent:!0}),u=s.node,!f||!u)throw new n.ErrnoError(44);if(f.mount!==u.mount)throw new n.ErrnoError(75);var c=n.lookupNode(f,i),w=V.relative(e,o);if(w.charAt(0)!==".")throw new n.ErrnoError(28);if(w=V.relative(r,t),w.charAt(0)!==".")throw new n.ErrnoError(55);var b;try{b=n.lookupNode(u,a)}catch{}if(c!==b){var v=n.isDir(c.mode),h=n.mayDelete(f,i,v);if(h)throw new n.ErrnoError(h);if(h=b?n.mayDelete(u,a,v):n.mayCreate(u,a),h)throw new n.ErrnoError(h);if(!f.node_ops.rename)throw new n.ErrnoError(63);if(n.isMountpoint(c)||b&&n.isMountpoint(b))throw new n.ErrnoError(10);if(u!==f&&(h=n.nodePermissions(f,"w"),h))throw new n.ErrnoError(h);n.hashRemoveNode(c);try{f.node_ops.rename(c,u,a),c.parent=u}catch(A){throw A}finally{n.hashAddNode(c)}}},rmdir(e){var r=n.lookupPath(e,{parent:!0}),t=r.node,o=p.basename(e),i=n.lookupNode(t,o),a=n.mayDelete(t,o,!0);if(a)throw new n.ErrnoError(a);if(!t.node_ops.rmdir)throw new n.ErrnoError(63);if(n.isMountpoint(i))throw new n.ErrnoError(10);t.node_ops.rmdir(t,o),n.destroyNode(i)},readdir(e){var r=n.lookupPath(e,{follow:!0}),t=r.node,o=n.checkOpExists(t.node_ops.readdir,54);return o(t)},unlink(e){var r=n.lookupPath(e,{parent:!0}),t=r.node;if(!t)throw new n.ErrnoError(44);var o=p.basename(e),i=n.lookupNode(t,o),a=n.mayDelete(t,o,!1);if(a)throw new n.ErrnoError(a);if(!t.node_ops.unlink)throw new n.ErrnoError(63);if(n.isMountpoint(i))throw new n.ErrnoError(10);t.node_ops.unlink(t,o),n.destroyNode(i)},readlink(e){var r=n.lookupPath(e),t=r.node;if(!t)throw new n.ErrnoError(44);if(!t.node_ops.readlink)throw new n.ErrnoError(28);return t.node_ops.readlink(t)},stat(e,r){var t=n.lookupPath(e,{follow:!r}),o=t.node,i=n.checkOpExists(o.node_ops.getattr,63);return i(o)},fstat(e){var r=n.getStreamChecked(e),t=r.node,o=r.stream_ops.getattr,i=o?r:t;return o??=t.node_ops.getattr,n.checkOpExists(o,63),o(i)},lstat(e){return n.stat(e,!0)},doChmod(e,r,t,o){n.doSetAttr(e,r,{mode:t&4095|r.mode&-4096,ctime:Date.now(),dontFollow:o})},chmod(e,r,t){var o;if(typeof e=="string"){var i=n.lookupPath(e,{follow:!t});o=i.node}else o=e;n.doChmod(null,o,r,t)},lchmod(e,r){n.chmod(e,r,!0)},fchmod(e,r){var t=n.getStreamChecked(e);n.doChmod(t,t.node,r,!1)},doChown(e,r,t){n.doSetAttr(e,r,{timestamp:Date.now(),dontFollow:t})},chown(e,r,t,o){var i;if(typeof e=="string"){var a=n.lookupPath(e,{follow:!o});i=a.node}else i=e;n.doChown(null,i,o)},lchown(e,r,t){n.chown(e,r,t,!0)},fchown(e,r,t){var o=n.getStreamChecked(e);n.doChown(o,o.node,!1)},doTruncate(e,r,t){if(n.isDir(r.mode))throw new n.ErrnoError(31);if(!n.isFile(r.mode))throw new n.ErrnoError(28);var o=n.nodePermissions(r,"w");if(o)throw new n.ErrnoError(o);n.doSetAttr(e,r,{size:t,timestamp:Date.now()})},truncate(e,r){if(r<0)throw new n.ErrnoError(28);var t;if(typeof e=="string"){var o=n.lookupPath(e,{follow:!0});t=o.node}else t=e;n.doTruncate(null,t,r)},ftruncate(e,r){var t=n.getStreamChecked(e);if(r<0||(t.flags&2097155)===0)throw new n.ErrnoError(28);n.doTruncate(t,t.node,r)},utime(e,r,t,o){var i=n.lookupPath(e,{follow:!o});n.doSetAttr(null,i.node,{atime:r,mtime:t,dontFollow:o})},open(e,r,t=438){if(e==="")throw new n.ErrnoError(44);r=Yr(r),r&64?t=t&4095|32768:t=0;var o,i;if(typeof e=="object")o=e;else{i=e.endsWith("/");var a=n.lookupPath(e,{follow:!(r&131072),noent_okay:!0});o=a.node,e=a.path}var s=!1;if(r&64)if(o){if(r&128)throw new n.ErrnoError(20)}else{if(i)throw new n.ErrnoError(31);o=n.mknod(e,t|511,0),s=!0}if(!o)throw new n.ErrnoError(44);if(n.isChrdev(o.mode)&&(r&=-513),r&65536&&!n.isDir(o.mode))throw new n.ErrnoError(54);if(!s){var f=n.mayOpen(o,r);if(f)throw new n.ErrnoError(f)}r&512&&!s&&n.truncate(o,0),r&=-131713;var u=n.createStream({node:o,path:n.getPath(o),flags:r,seekable:!0,position:0,stream_ops:o.stream_ops,ungotten:[],error:!1});return u.stream_ops.open&&u.stream_ops.open(u),s&&n.chmod(o,t&511),u},close(e){if(n.isClosed(e))throw new n.ErrnoError(8);e.getdents&&(e.getdents=null),e.node?.notifyListeners(32);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(r){throw r}finally{n.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,r,t){if(n.isClosed(e))throw new n.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new n.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new n.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,t),e.ungotten=[],e.position},read(e,r,t,o,i){if(o<0||i<0)throw new n.ErrnoError(28);if(n.isClosed(e))throw new n.ErrnoError(8);if((e.flags&2097155)===1)throw new n.ErrnoError(8);if(n.isDir(e.node.mode))throw new n.ErrnoError(31);if(!e.stream_ops.read)throw new n.ErrnoError(28);var a=typeof i<"u";if(!a)i=e.position;else if(!e.seekable)throw new n.ErrnoError(70);var s=e.stream_ops.read(e,r,t,o,i);return a||(e.position+=s),s},write(e,r,t,o,i,a){if(o<0||i<0)throw new n.ErrnoError(28);if(n.isClosed(e))throw new n.ErrnoError(8);if((e.flags&2097155)===0)throw new n.ErrnoError(8);if(n.isDir(e.node.mode))throw new n.ErrnoError(31);if(!e.stream_ops.write)throw new n.ErrnoError(28);e.seekable&&e.flags&1024&&n.llseek(e,0,2);var s=typeof i<"u";if(!s)i=e.position;else if(!e.seekable)throw new n.ErrnoError(70);var f=e.stream_ops.write(e,r,t,o,i,a);return s||(e.position+=f),f},mmap(e,r,t,o,i){if(o&2&&!(i&2)&&(e.flags&2097155)!==2)throw new n.ErrnoError(2);if((e.flags&2097155)===1)throw new n.ErrnoError(2);if(!e.stream_ops.mmap)throw new n.ErrnoError(43);if(!r)throw new n.ErrnoError(28);return e.stream_ops.mmap(e,r,t,o,i)},msync(e,r,t,o,i){return e.stream_ops.msync?e.stream_ops.msync(e,r,t,o,i):0},ioctl(e,r,t){if(!e.stream_ops.ioctl)throw new n.ErrnoError(59);return e.stream_ops.ioctl(e,r,t)},readFile(e,r={}){r.flags=r.flags??0,r.encoding=r.encoding??"binary",r.encoding!=="utf8"&&r.encoding!=="binary"&&L(`Invalid encoding type "${r.encoding}"`);var t=n.open(e,r.flags),o=n.stat(e),i=o.size,a=new Uint8Array(i);return n.read(t,a,0,i,0),r.encoding==="utf8"&&(a=Y(a)),n.close(t),a},writeFile(e,r,t={}){t.flags=t.flags??577;var o=n.open(e,t.flags,t.mode);r=He(r),n.write(o,r,0,r.byteLength,void 0,t.canOwn),n.close(o)},cwd:()=>n.currentPath,chdir(e){var r=n.lookupPath(e,{follow:!0});if(r.node===null)throw new n.ErrnoError(44);if(!n.isDir(r.node.mode))throw new n.ErrnoError(54);var t=n.nodePermissions(r.node,"x");if(t)throw new n.ErrnoError(t);n.currentPath=r.path},createDefaultDirectories(){n.mkdir("/tmp"),n.mkdir("/home"),n.mkdir("/home/web_user")},createDefaultDevices(){n.mkdir("/dev"),n.registerDevice(n.makedev(1,3),{read:()=>0,write:(o,i,a,s,f)=>s,llseek:()=>0}),n.mkdev("/dev/null",n.makedev(1,3)),G.register(n.makedev(5,0),G.default_tty_ops),G.register(n.makedev(6,0),G.default_tty1_ops),n.mkdev("/dev/tty",n.makedev(5,0)),n.mkdev("/dev/tty1",n.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(r||(_e(e),r=e.byteLength),e[--r]);n.createDevice("/dev","random",t),n.createDevice("/dev","urandom",t),n.mkdir("/dev/shm"),n.mkdir("/dev/shm/tmp")},createSpecialDirectories(){n.mkdir("/proc");var e=n.mkdir("/proc/self");n.mkdir("/proc/self/fd"),n.mount({mount(){var r=n.createNode(e,"fd",16895,73);return r.stream_ops={llseek:d.stream_ops.llseek},r.node_ops={lookup(t,o){var i=+o,a=n.getStreamChecked(i),s={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>a.path},id:i+1};return s.parent=s,s},readdir(){return Array.from(n.streams.entries()).filter(([t,o])=>o).map(([t,o])=>t.toString())}},r}},{},"/proc/self/fd")},createStandardStreams(e,r,t){e?n.createDevice("/dev","stdin",e):n.symlink("/dev/tty","/dev/stdin"),r?n.createDevice("/dev","stdout",null,r):n.symlink("/dev/tty","/dev/stdout"),t?n.createDevice("/dev","stderr",null,t):n.symlink("/dev/tty1","/dev/stderr");var o=n.open("/dev/stdin",0),i=n.open("/dev/stdout",1),a=n.open("/dev/stderr",1)},staticInit(){n.nameTable=new Array(4096),n.mount(d,{},"/"),n.createDefaultDirectories(),n.createDefaultDevices(),n.createSpecialDirectories(),n.filesystems={MEMFS:d}},init(e,r,t){n.initialized=!0,e??=l.stdin,r??=l.stdout,t??=l.stderr,n.createStandardStreams(e,r,t)},quit(){n.initialized=!1;for(var e of n.streams)e&&n.close(e)},findObject(e,r){var t=n.analyzePath(e,r);return t.exists?t.object:null},analyzePath(e,r){try{var t=n.lookupPath(e,{follow:!r});e=t.path}catch{}var o={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=n.lookupPath(e,{parent:!0});o.parentExists=!0,o.parentPath=t.path,o.parentObject=t.node,o.name=p.basename(e),t=n.lookupPath(e,{follow:!r}),o.exists=!0,o.path=t.path,o.object=t.node,o.name=t.node.name,o.isRoot=t.path==="/"}catch(i){o.error=i.errno}return o},createPath(e,r,t,o){e=typeof e=="string"?e:n.getPath(e);for(var i=r.split("/").reverse();i.length;){var a=i.pop();if(a){var s=p.join2(e,a);try{n.mkdir(s)}catch(f){if(f.errno!=20)throw f}e=s}}return s},createFile(e,r,t,o,i){var a=p.join2(typeof e=="string"?e:n.getPath(e),r),s=Ee(o,i);return n.create(a,s)},createDataFile(e,r,t,o,i,a){var s=r;e&&(e=typeof e=="string"?e:n.getPath(e),s=r?p.join2(e,r):e);var f=Ee(o,i),u=n.create(s,f);if(t){t=He(t),n.chmod(u,f|146);var c=n.open(u,577);n.write(c,t,0,t.length,0,a),n.close(c),n.chmod(u,f)}},createDevice(e,r,t,o){var i=p.join2(typeof e=="string"?e:n.getPath(e),r),a=Ee(!!t,!!o);n.createDevice.major??=64;var s=n.makedev(n.createDevice.major++,0);return n.registerDevice(s,{open(f){f.seekable=!1},close(f){o?.buffer?.length&&o(10)},read(f,u,c,w,b){for(var v=0,h=0;h<w;h++){var A;try{A=t()}catch{throw new n.ErrnoError(29)}if(A===void 0&&!v)throw new n.ErrnoError(6);if(A==null)break;v++,u[c+h]=A}return v&&(f.node.atime=Date.now()),v},write(f,u,c,w,b){for(var v=0;v<w;v++)try{o(u[c+v])}catch{throw new n.ErrnoError(29)}return w&&(f.node.mtime=f.node.ctime=Date.now()),v}}),n.mkdev(i,a,s)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(globalThis.XMLHttpRequest)L("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");else try{e.contents=q(e.url)}catch{throw new n.ErrnoError(29)}},createLazyFile(e,r,t,o,i){class a{lengthKnown=!1;chunks=[];get(v){if(!(v>this.length-1||v<0)){var h=v%this.chunkSize,A=v/this.chunkSize|0;return this.getter(A)[h]}}setDataGetter(v){this.getter=v}cacheLength(){var v=new XMLHttpRequest;v.open("HEAD",t,!1),v.send(null),v.status>=200&&v.status<300||v.status===304||L(`Couldn't load ${t}. Status: ${v.status}`);var h=Number(v.getResponseHeader("Content-length")),A,H=(A=v.getResponseHeader("Accept-Ranges"))&&A==="bytes",I=(A=v.getResponseHeader("Content-Encoding"))&&A==="gzip",O=1024*1024;H||(O=h);var U=(W,J)=>{W>J&&L(`invalid range (${W}, ${J}) or no bytes requested!`),J>h-1&&L(`only ${h} bytes available! programmer error!`);var R=new XMLHttpRequest;return R.open("GET",t,!1),h!==O&&R.setRequestHeader("Range",`bytes=${W}-${J}`),R.responseType="arraybuffer",R.overrideMimeType&&R.overrideMimeType("text/plain; charset=x-user-defined"),R.send(null),R.status>=200&&R.status<300||R.status===304||L(`Couldn't load ${t}. Status: ${R.status}`),R.response!==void 0?new Uint8Array(R.response||[]):ye(R.responseText??"",!0)},oe=this;oe.setDataGetter(W=>{var J=W*O,R=(W+1)*O-1;return R=Math.min(R,h-1),typeof oe.chunks[W]>"u"&&(oe.chunks[W]=U(J,R)),typeof oe.chunks[W]>"u"&&L("doXHR failed!"),oe.chunks[W]}),(I||!h)&&(O=h=1,h=this.getter(0).length,O=h,ie("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=h,this._chunkSize=O,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(globalThis.XMLHttpRequest){M||L("Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc");var s=new a,f={isDevice:!1,contents:s}}else var f={isDevice:!1,url:t};var u=n.createFile(e,r,f,o,i);f.contents?u.contents=f.contents:f.url&&(u.contents=null,u.url=f.url),Object.defineProperties(u,{usedBytes:{get:function(){return this.contents.length}}});var c={};for(let[b,v]of Object.entries(u.stream_ops))c[b]=(...h)=>(n.forceLoadFile(u),v(...h));function w(b,v,h,A,H){var I=b.node.contents;if(H>=I.length)return 0;var O=Math.min(I.length-H,A);if(I.slice)for(var U=0;U<O;U++)v[h+U]=I[H+U];else for(var U=0;U<O;U++)v[h+U]=I.get(H+U);return O}return c.read=(b,v,h,A,H)=>(n.forceLoadFile(u),w(b,v,h,A,H)),c.mmap=(b,v,h,A,H)=>{n.forceLoadFile(u);var I=Ue(v);if(!I)throw new n.ErrnoError(48);return w(b,$,I,v,h),{ptr:I,allocated:!0}},u.stream_ops=c,u}},st=(e,r,t)=>e?Y(Q,e,r,t):"",ke,le={currentUmask:18,calculateAt(e,r,t){if(p.isAbs(r))return r;var o;if(e===-100)o=n.cwd();else{var i=le.getStreamFromFD(e);o=i.path}if(r.length==0){if(!t)throw new n.ErrnoError(44);return o}return o+"/"+r},writeStat(e,r){m[e>>2]=r.dev,m[e+4>>2]=r.mode,m[e+8>>2]=r.nlink,m[e+12>>2]=r.uid,m[e+16>>2]=r.gid,m[e+20>>2]=r.rdev,x[e+24>>3]=BigInt(r.size),ke[e+32>>2]=4096,ke[e+36>>2]=r.blocks;var t=r.atime.getTime(),o=r.mtime.getTime(),i=r.ctime.getTime();return x[e+40>>3]=BigInt(Math.floor(t/1e3)),m[e+48>>2]=t%1e3*1e3*1e3,x[e+56>>3]=BigInt(Math.floor(o/1e3)),m[e+64>>2]=o%1e3*1e3*1e3,x[e+72>>3]=BigInt(Math.floor(i/1e3)),m[e+80>>2]=i%1e3*1e3*1e3,x[e+88>>3]=BigInt(r.ino),0},writeStatFs(e,r){m[e+4>>2]=r.bsize,m[e+60>>2]=r.bsize,x[e+8>>3]=BigInt(r.blocks),x[e+16>>3]=BigInt(r.bfree),x[e+24>>3]=BigInt(r.bavail),x[e+32>>3]=BigInt(r.files),x[e+40>>3]=BigInt(r.ffree),m[e+48>>2]=r.fsid,m[e+64>>2]=r.flags,m[e+56>>2]=r.namelen},doMsync(e,r,t,o,i){if(!n.isFile(r.node.mode))throw new n.ErrnoError(43);if(o&2)return 0;var a=Q.subarray(e,e+t);n.msync(r,a,i,t,o)},getStreamFromFD(e){var r=n.getStreamChecked(e);return r},varargs:void 0,getStr(e){var r=st(e);return r}};function ft(e){try{var r=le.getStreamFromFD(e);return n.close(r),0}catch(t){if(typeof n>"u"||t.name!=="ErrnoError")throw t;return t.errno}}function lt(e,r,t,o){r=Le(r);try{if(isNaN(r))return 22;var i=le.getStreamFromFD(e);return n.llseek(i,r,t),x[o>>3]=BigInt(i.position),i.getdents&&!r&&t===0&&(i.getdents=null),0}catch(a){if(typeof n>"u"||a.name!=="ErrnoError")throw a;return a.errno}}var ut=(e,r,t,o)=>{if(t==1)return n.write(e,$,m[r>>2],m[r+4>>2],o);for(var i=0,a=0,s=r;a<t;a++,s+=8)i+=m[s+4>>2];for(var f=new Uint8Array(i),u=0,a=0;a<t;a++,r+=8){var c=m[r>>2],w=m[r+4>>2];f.set(Q.subarray(c,c+w),u),u+=w}return n.write(e,f,0,i,o)};function ct(e,r,t,o){try{var i=le.getStreamFromFD(e),a=ut(i,r,t);return m[o>>2]=a,0}catch(s){if(typeof n>"u"||s.name!=="ErrnoError")throw s;return s.errno}}var dt=e=>e,vt=(e,r)=>_e(Q.subarray(e,e+r)),ht=e=>{if(e instanceof Re||e=="unwind")return ve;B(1,e)},Xe=e=>Ye(e),mt=e=>{var r=fe(e)+1,t=Xe(r);return pe(e,t,r),t},Qe=[],k=e=>{var r=Qe[e];return r||(Qe[e]=r=or.get(e)),r},be;n.createPreloadedFile=at,n.preloadFile=qe,n.staticInit();{l.noExitRuntime&&(Ne=l.noExitRuntime),l.print&&(ie=l.print),l.printErr&&(X=l.printErr),l.arguments&&(T=l.arguments),l.thisProgram&&(C=l.thisProgram);var Z=l.preInit;if(Z)for(typeof Z=="function"&&(l.preInit=Z=[Z]);Z.length>0;)Z.shift()()}var pt,wt,_t,gt,Ge,yt,g,Ke,Ve,Ye,Ze,Je,er,rr,tr,Et,kt,nr,or;function bt(e){pt=l._dtln_create_wasm=e.V,wt=l._dtln_get_audio_buffer=e.W,_t=l._dtln_denoise_wasm=e.X,gt=l._dtln_destroy_wasm=e.Y,Ge=l._main=e.Z,yt=l._napi_register_module_v1=e._,g=e.$,Ke=e.aa,Ve=e.ba,Ye=e.ca,Ze=e.da,Je=e.ea,er=e.fa,rr=e.ga,tr=e.ha,Et=nr=e.S,kt=or=e.U}var St={w:Er,M:kr,a:br,o:Sr,p:Dr,n:Ar,c:Rr,G:Tr,J:Mr,I:jr,D:Ir,m:je,C:Or,K:Hr,L:Wr,N:Qr,H:ft,E:lt,t:ct,i:Dt,g:Pt,h:Mt,l:Rt,x:qt,B:zt,y:Xt,u:Wt,R:jt,O:Ht,P:Ut,k:Tt,b:Ft,d:At,e:Nt,j:Bt,f:Ct,z:$t,A:It,v:Ot,r:xt,Q:Lt,s:Qt,q:dt,F:vt};function Dt(e){var r=E();try{return k(e)()}catch(t){if(y(r),!(t instanceof _))throw t;g(1,0)}}function Pt(e,r){var t=E();try{return k(e)(r)}catch(o){if(y(t),!(o instanceof _))throw o;g(1,0)}}function At(e,r,t){var o=E();try{k(e)(r,t)}catch(i){if(y(o),!(i instanceof _))throw i;g(1,0)}}function Ft(e,r){var t=E();try{k(e)(r)}catch(o){if(y(t),!(o instanceof _))throw o;g(1,0)}}function Rt(e,r,t,o){var i=E();try{return k(e)(r,t,o)}catch(a){if(y(i),!(a instanceof _))throw a;g(1,0)}}function Tt(e){var r=E();try{k(e)()}catch(t){if(y(r),!(t instanceof _))throw t;g(1,0)}}function Mt(e,r,t){var o=E();try{return k(e)(r,t)}catch(i){if(y(o),!(i instanceof _))throw i;g(1,0)}}function Ct(e,r,t,o,i,a){var s=E();try{k(e)(r,t,o,i,a)}catch(f){if(y(s),!(f instanceof _))throw f;g(1,0)}}function Nt(e,r,t,o){var i=E();try{k(e)(r,t,o)}catch(a){if(y(i),!(a instanceof _))throw a;g(1,0)}}function xt(e,r,t,o,i){var a=E();try{k(e)(r,t,o,i)}catch(s){if(y(a),!(s instanceof _))throw s;g(1,0)}}function Bt(e,r,t,o,i){var a=E();try{k(e)(r,t,o,i)}catch(s){if(y(a),!(s instanceof _))throw s;g(1,0)}}function zt(e,r,t,o,i,a){var s=E();try{return k(e)(r,t,o,i,a)}catch(f){if(y(s),!(f instanceof _))throw f;g(1,0)}}function jt(e,r){var t=E();try{return k(e)(r)}catch(o){if(y(t),!(o instanceof _))throw o;g(1,0)}}function Lt(e,r,t){var o=E();try{k(e)(r,t)}catch(i){if(y(o),!(i instanceof _))throw i;g(1,0)}}function It(e,r,t,o,i,a,s,f){var u=E();try{k(e)(r,t,o,i,a,s,f)}catch(c){if(y(u),!(c instanceof _))throw c;g(1,0)}}function Ot(e,r,t,o,i,a,s,f,u){var c=E();try{k(e)(r,t,o,i,a,s,f,u)}catch(w){if(y(c),!(w instanceof _))throw w;g(1,0)}}function Ut(e){var r=E();try{return k(e)()}catch(t){if(y(r),!(t instanceof _))throw t;return g(1,0),0n}}function Ht(e,r,t){var o=E();try{return k(e)(r,t)}catch(i){if(y(o),!(i instanceof _))throw i;g(1,0)}}function Wt(e,r,t,o){var i=E();try{return k(e)(r,t,o)}catch(a){if(y(i),!(a instanceof _))throw a;g(1,0)}}function $t(e,r,t,o,i,a,s){var f=E();try{k(e)(r,t,o,i,a,s)}catch(u){if(y(f),!(u instanceof _))throw u;g(1,0)}}function qt(e,r,t,o,i){var a=E();try{return k(e)(r,t,o,i)}catch(s){if(y(a),!(s instanceof _))throw s;g(1,0)}}function Xt(e,r,t,o,i,a,s,f){var u=E();try{return k(e)(r,t,o,i,a,s,f)}catch(c){if(y(u),!(c instanceof _))throw c;g(1,0)}}function Qt(e,r,t,o,i,a){var s=E();try{k(e)(r,t,o,i,a)}catch(f){if(y(s),!(f instanceof _))throw f;g(1,0)}}function Gt(e=[]){var r=Ge;e.unshift(C);var t=e.length,o=Xe((t+1)*4),i=o;for(var a of e)m[i>>2]=mt(a),i+=4;m[i>>2]=0;try{var s=r(t,o);return Ie(s,!0),s}catch(f){return ht(f)}}async function Kt(e=T){cr(),K&&await rt();var r=l.setStatus;if(r&&(r("Running..."),await new Promise(o=>setTimeout(o,1)),setTimeout(r,1,"")),!de){dr(),l.onRuntimeInitialized?.();var t=l.noInitialRun||!1;t||Gt(e),vr()}}var ne;ne=await yr(),await Kt();let Vt=512,Yt=4;return l.dtln={dtln_create:()=>l._dtln_create_wasm(),dtln_destroy:e=>l._dtln_destroy_wasm(e),dtln_denoise:(e,r,t)=>{let o=l._dtln_get_audio_buffer(e)/Yt;return be.set(r,o),l._dtln_denoise_wasm(e),t.set(be.subarray(o,o+Vt)),!1}},l}typeof ar=="object"&&typeof ue=="object"?(ue.exports=De,ue.exports.default=De):typeof define=="function"&&define.amd&&define([],()=>De)});var ee=class{constructor(l,P){this.ratio=l/P,this.pos=0,this.last=0}process(l){if(this.ratio===1)return l.slice();let P=l.length-1,M=Math.max(0,Math.floor((P-this.pos)/this.ratio)+1),N=new Float32Array(M),S=this.pos;for(let F=0;F<M;F++){let T=Math.min(Math.floor(S),P),C=S-T,B=T<0?this.last:l[T],z=T<P?l[T+1]:B;N[F]=B+C*(z-B),S+=this.ratio}return this.pos=S-l.length,this.last=l[P],N}};var sn=50;function Se({engineRate:D,frameSize:l,createEngine:P}){class M extends AudioWorkletProcessor{constructor(){super(),this.engine=null,this.bypass=!1,this.consecutiveErrors=0,this.initErrorReported=!1,this.inputBuffer=new Float32Array(l),this.outputBuffer=new Float32Array(l),this.inputIndex=0,this.outputQueue=[],this.outputQueueOffset=0,this.downsampler=new ee(sampleRate,D),this.upsampler=new ee(D,sampleRate),this.port.onmessage=S=>{S.data?.type==="init"&&this.#e(S.data.assets)}}async#e(S){try{let F=await P(S);F.denoise(new Float32Array(l),this.outputBuffer),this.engine=F,this.port.postMessage({type:"ready"})}catch(F){this.#r(F)}}#r(S){this.initErrorReported||(this.initErrorReported=!0,this.port.postMessage({type:"error",message:String(S?.message||S)}))}process(S,F){let T=S?.[0]?.[0],C=F?.[0]?.[0];if(!C)return!0;if(!T)return C.fill(0),!0;if(!this.engine||this.bypass)return C.set(T),!0;try{let B=this.downsampler.process(T);for(let j=0;j<B.length;j++)this.inputBuffer[this.inputIndex++]=B[j],this.inputIndex>=l&&(this.engine.denoise(this.inputBuffer,this.outputBuffer),this.inputIndex=0,this.outputQueue.push(this.upsampler.process(this.outputBuffer)));let z=0;for(;z<C.length&&this.outputQueue.length>0;){let j=this.outputQueue[0],ce=j.length-this.outputQueueOffset,re=C.length-z,q=Math.min(ce,re);C.set(j.subarray(this.outputQueueOffset,this.outputQueueOffset+q),z),z+=q,this.outputQueueOffset+=q,this.outputQueueOffset>=j.length&&(this.outputQueue.shift(),this.outputQueueOffset=0)}z<C.length&&C.fill(0,z),this.consecutiveErrors=0}catch(B){C.set(T),this.consecutiveErrors++,this.consecutiveErrors===1&&console.error("[resenha] noise suppression engine error:",B),this.consecutiveErrors>=sn&&(this.bypass=!0,this.port.postMessage({type:"bypass"}),console.error("[resenha] engine keeps failing, noise suppression bypassed"))}return!0}}registerProcessor("noise-suppression-processor",M)}var fr=an(sr());globalThis.self??=globalThis;globalThis.self.location??={href:""};Se({engineRate:16e3,frameSize:512,async createEngine({wasm:D}){let l,P=new Promise((S,F)=>{l=F}),M=await Promise.race([(0,fr.default)({instantiateWasm:(S,F)=>(WebAssembly.instantiate(D,S).then(T=>F(T.instance,T.module)).catch(l),{})}),P]),N=M.dtln.dtln_create();return{denoise(S,F){M.dtln.dtln_denoise(N,S,F)}}}});})();
|
|
Binary file
|