diff options
Diffstat (limited to '2026')
148 files changed, 6694 insertions, 74 deletions
diff --git a/2026/framing/art/intro.aseprite b/2026/framing/art/intro.aseprite Binary files differnew file mode 100644 index 0000000..0e7985e --- /dev/null +++ b/2026/framing/art/intro.aseprite diff --git a/2026/framing/art/jamsounds.aup3 b/2026/framing/art/jamsounds.aup3 Binary files differnew file mode 100644 index 0000000..1473fcd --- /dev/null +++ b/2026/framing/art/jamsounds.aup3 diff --git a/2026/framing/art/music.org b/2026/framing/art/music.org index ed108c9..a924a9d 100644 --- a/2026/framing/art/music.org +++ b/2026/framing/art/music.org @@ -1,2 +1,4 @@ * start game jingle https://ultraabox.github.io/#u5N08Untitledn310s1k02l00e00t1Ua7g0fj07r1O_U00000000i0o321T1v0wuh5f150qg500O00d030A0F0B0Q4544Pf800R0000E2c01211T0v0Aug3f0000q0C010l5000O05d390w50h5y0000000000000w000000E1c0b6T1v0pu56f0000qwB18310O01d030A5F5B9Q4445PfaedR0000E4c0b962863979T2v0pu15f180q040O0d030w0h0E0c0b40000000000w0000000001000000000040000000000p1uFAuG8QNsz82Ux27wE1erj8ZcWs0000 +* main theme +https://ultraabox.github.io/#u5N07jam2026n320s7k02l00e0ft2La7g0fj07r1O_U0000000000i0o321T5v0pug6f0000qE5130O0ld420H07000000000000h2E1c01nT1v0pufbf0000q040O0d020A0F0B0Qf444Pf000R0000E2c050819T1v0puh5f150qg500O00d030A0F0B0Q4544Pf800R0000E2c01211T3v0iugef0000q0B1610O00d080S9aiiqjriHSDSSKIh0E1c0bdT4v0puf0f1a0q050O00z8888onapap4oSBKSJJAArriiiiii07JCABrzrrrrrrr00YrkqHrsrrrrjr005zrAqzrjzrrqr1jRjrqGGrrzsrsA099ijrABJJJIAzrrtirqrqjqixzsrAjrqjiqaqqysttAJqjikikrizrHtBJJAzArzrIsRCITKSS099ijrAJS____Qg99habbCAYrDzh00E0c0bkid1kS4zgioh4h4h4h4h4h8i4x8i4x8i4h4h4h4h4h4h8h8i4x4x4wp23xFB-9Qx1kp6hwWKCGg5aHkFQdhkGmp6zjHqiFlFladeFFGdqNiHkWuEFRad6FiFBczOwzE4t0zHkp0zE4t0zEkg5czO0zAyewhROe08W44hQie2Rx78g5czFAteDjEkOeChwkOcnlC6hycYFiEM56BhEQszf9pemi0m6hyJ2p68V138Qa6gzAq538jOd2xA9p7A9GcqcYzgO4GcIzA9QpQpV78jEPEPO80 diff --git a/2026/framing/art/titlescreen.aseprite b/2026/framing/art/titlescreen.aseprite Binary files differnew file mode 100644 index 0000000..a3d83f0 --- /dev/null +++ b/2026/framing/art/titlescreen.aseprite diff --git a/2026/framing/dist/game_lib-78ce3a29d0f5620b.js b/2026/framing/dist/game_lib-632bc23475e9f6db.js index 95c2c03..ef71c3c 100644 --- a/2026/framing/dist/game_lib-78ce3a29d0f5620b.js +++ b/2026/framing/dist/game_lib-632bc23475e9f6db.js @@ -215,6 +215,10 @@ function debugString(val) { return className; } +export function titlescreen_click() { + wasm.titlescreen_click(); +} + export function start_game() { wasm.start_game(); } @@ -243,7 +247,7 @@ function __wbg_adapter_40(arg0, arg1, arg2) { } function __wbg_adapter_43(arg0, arg1, arg2) { - wasm.closure522_externref_shim(arg0, arg1, arg2); + wasm.closure529_externref_shim(arg0, arg1, arg2); } function __wbg_adapter_54(arg0, arg1) { @@ -251,7 +255,7 @@ function __wbg_adapter_54(arg0, arg1) { } function __wbg_adapter_57(arg0, arg1, arg2) { - wasm.closure597_externref_shim(arg0, arg1, arg2); + wasm.closure604_externref_shim(arg0, arg1, arg2); } const __wbindgen_enum_VisibilityState = ["hidden", "visible"]; @@ -1235,6 +1239,10 @@ function __wbg_get_imports() { imports.wbg.__wbg_setProperty_9a56f92c3dfbaa30 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) { arg0.setProperty(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4)); }, arguments) }; + imports.wbg.__wbg_setTargetAtTime_95bf62b9eef6de02 = function() { return handleError(function (arg0, arg1, arg2, arg3) { + const ret = arg0.setTargetAtTime(arg1, arg2, arg3); + return ret; + }, arguments) }; imports.wbg.__wbg_setTimeout_5356cabf3c726313 = function() { return handleError(function (arg0, arg1, arg2) { const ret = arg0.setTimeout(arg1, arg2); return ret; @@ -1316,6 +1324,9 @@ function __wbg_get_imports() { imports.wbg.__wbg_stencilMask_dada3773f3d5f226 = function(arg0, arg1) { arg0.stencilMask(arg1 >>> 0); }; + imports.wbg.__wbg_stop_6d875c19a6df48fc = function() { return handleError(function (arg0) { + arg0.stop(); + }, arguments) }; imports.wbg.__wbg_style_59ace31f3c27e375 = function(arg0) { const ret = arg0.style; return ret; @@ -1457,43 +1468,43 @@ function __wbg_get_imports() { const ret = false; return ret; }; - imports.wbg.__wbindgen_closure_wrapper3073 = function(arg0, arg1, arg2) { - const ret = makeMutClosure(arg0, arg1, 523, __wbg_adapter_43); + imports.wbg.__wbindgen_closure_wrapper3165 = function(arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 530, __wbg_adapter_43); return ret; }; - imports.wbg.__wbindgen_closure_wrapper3074 = function(arg0, arg1, arg2) { - const ret = makeMutClosure(arg0, arg1, 523, __wbg_adapter_43); + imports.wbg.__wbindgen_closure_wrapper3166 = function(arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 530, __wbg_adapter_43); return ret; }; - imports.wbg.__wbindgen_closure_wrapper3075 = function(arg0, arg1, arg2) { - const ret = makeMutClosure(arg0, arg1, 523, __wbg_adapter_43); + imports.wbg.__wbindgen_closure_wrapper3167 = function(arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 530, __wbg_adapter_43); return ret; }; - imports.wbg.__wbindgen_closure_wrapper3076 = function(arg0, arg1, arg2) { - const ret = makeMutClosure(arg0, arg1, 523, __wbg_adapter_43); + imports.wbg.__wbindgen_closure_wrapper3168 = function(arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 530, __wbg_adapter_43); return ret; }; - imports.wbg.__wbindgen_closure_wrapper3077 = function(arg0, arg1, arg2) { - const ret = makeMutClosure(arg0, arg1, 523, __wbg_adapter_43); + imports.wbg.__wbindgen_closure_wrapper3169 = function(arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 530, __wbg_adapter_43); return ret; }; - imports.wbg.__wbindgen_closure_wrapper3078 = function(arg0, arg1, arg2) { - const ret = makeMutClosure(arg0, arg1, 523, __wbg_adapter_54); + imports.wbg.__wbindgen_closure_wrapper3170 = function(arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 530, __wbg_adapter_54); return ret; }; - imports.wbg.__wbindgen_closure_wrapper3304 = function(arg0, arg1, arg2) { - const ret = makeMutClosure(arg0, arg1, 598, __wbg_adapter_57); + imports.wbg.__wbindgen_closure_wrapper3396 = function(arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 605, __wbg_adapter_57); return ret; }; - imports.wbg.__wbindgen_closure_wrapper460 = function(arg0, arg1, arg2) { + imports.wbg.__wbindgen_closure_wrapper463 = function(arg0, arg1, arg2) { const ret = makeMutClosure(arg0, arg1, 113, __wbg_adapter_34); return ret; }; - imports.wbg.__wbindgen_closure_wrapper462 = function(arg0, arg1, arg2) { + imports.wbg.__wbindgen_closure_wrapper465 = function(arg0, arg1, arg2) { const ret = makeMutClosure(arg0, arg1, 117, __wbg_adapter_37); return ret; }; - imports.wbg.__wbindgen_closure_wrapper464 = function(arg0, arg1, arg2) { + imports.wbg.__wbindgen_closure_wrapper467 = function(arg0, arg1, arg2) { const ret = makeMutClosure(arg0, arg1, 115, __wbg_adapter_40); return ret; }; diff --git a/2026/framing/dist/game_lib-632bc23475e9f6db_bg.wasm b/2026/framing/dist/game_lib-632bc23475e9f6db_bg.wasm Binary files differnew file mode 100644 index 0000000..7c32fa2 --- /dev/null +++ b/2026/framing/dist/game_lib-632bc23475e9f6db_bg.wasm diff --git a/2026/framing/dist/game_lib-78ce3a29d0f5620b_bg.wasm b/2026/framing/dist/game_lib-78ce3a29d0f5620b_bg.wasm Binary files differdeleted file mode 100644 index 76b4bee..0000000 --- a/2026/framing/dist/game_lib-78ce3a29d0f5620b_bg.wasm +++ /dev/null diff --git a/2026/framing/dist/index.html b/2026/framing/dist/index.html index be343d4..4e46e09 100644 --- a/2026/framing/dist/index.html +++ b/2026/framing/dist/index.html @@ -6,8 +6,8 @@ <meta charset="UTF-8"> <script type="module"> -import init, * as bindings from '/framing/dist/game_lib-78ce3a29d0f5620b.js'; -const wasm = await init({ module_or_path: '/framing/dist/game_lib-78ce3a29d0f5620b_bg.wasm' }); +import init, * as bindings from '/framing/dist/game_lib-632bc23475e9f6db.js'; +const wasm = await init({ module_or_path: '/framing/dist/game_lib-632bc23475e9f6db_bg.wasm' }); window.wasmBindings = bindings; @@ -23,7 +23,7 @@ dispatchEvent(new CustomEvent("TrunkApplicationStarted", {detail: {wasm}})); <link rel="icon" href="data:;base64,iVBORw0KGgo="> <link rel="stylesheet" href="/framing/dist/index-1e3cd2ca0ba4d1ec.css" integrity="sha384-1q3UDTmLdOyf9/QxW+Imap//HWhTWNfvn7j2iwuUap3HSD6IOGG7pDS9VJMk7nKv"/> <title>TODO TITLE</title> - <link rel="modulepreload" href="/framing/dist/game_lib-78ce3a29d0f5620b.js" crossorigin="anonymous" integrity="sha384-j/ezI19C1/9urd+eyiEyjiBH7hD3nF6IlprOjtj9hqdoQYfnLImA5suIKmtTRKGs"><link rel="modulepreload" href="/framing/dist/snippets/teleia-727bf4351691f1c8/src/helpers.js" crossorigin="anonymous" integrity="sha384-HhtEY2WfGmhyPUSRWKZvqsRxYsdT/DLEdFUqWyDZt6G6lrNHmE1zMlw4BJ3RycRd"><link rel="preload" href="/framing/dist/game_lib-78ce3a29d0f5620b_bg.wasm" crossorigin="anonymous" integrity="sha384-9BDBXfrtsdl5kNmiZ1gASQnzZQOtXW7orQlZxVAwJBW44JFXUdTUc0foCjLJ6fqs" as="fetch" type="application/wasm"></head> + <link rel="modulepreload" href="/framing/dist/game_lib-632bc23475e9f6db.js" crossorigin="anonymous" integrity="sha384-wB3zF5FUBj4GzDXiAKthCzMd74wJmz9oHSr/4HCFLcoCjFLmCPiBqXtQiPKpTYaD"><link rel="modulepreload" href="/framing/dist/snippets/game_lib-09da6449fcb9d06e/src/bindings.js" crossorigin="anonymous" integrity="sha384-Dpb3ctNH+2/9pBmnYvFi51S+PB475HUMu/0Sm9buFrBKpJMf6WI/rwH94aMAAaxG"><link rel="modulepreload" href="/framing/dist/snippets/teleia-727bf4351691f1c8/src/helpers.js" crossorigin="anonymous" integrity="sha384-HhtEY2WfGmhyPUSRWKZvqsRxYsdT/DLEdFUqWyDZt6G6lrNHmE1zMlw4BJ3RycRd"><link rel="preload" href="/framing/dist/game_lib-632bc23475e9f6db_bg.wasm" crossorigin="anonymous" integrity="sha384-V6RbIHd2D2OX3mjNLY1lHJQtMKAl0bPzVL+yzEhuqVP4cWc9eK/99BRlKCpxs1Ds" as="fetch" type="application/wasm"></head> <body> <script type="module"> window.addEventListener("TrunkApplicationStarted", async (event) => { @@ -32,6 +32,9 @@ dispatchEvent(new CustomEvent("TrunkApplicationStarted", {detail: {wasm}})); }); window.addEventListener("message", ev => { switch (ev.data.op) { + case "titlescreenclick": + window.wasmBindings.titlescreen_click(); + break; case "startgame": window.wasmBindings.start_game(); break; diff --git a/2026/framing/dist/snippets/game_lib-09da6449fcb9d06e/src/bindings.js b/2026/framing/dist/snippets/game_lib-09da6449fcb9d06e/src/bindings.js new file mode 100644 index 0000000..1f17e14 --- /dev/null +++ b/2026/framing/dist/snippets/game_lib-09da6449fcb9d06e/src/bindings.js @@ -0,0 +1,3 @@ +export function js_test() { + console.log("test"); +} diff --git a/2026/framing/index.html b/2026/framing/index.html index c4bb579..a554795 100644 --- a/2026/framing/index.html +++ b/2026/framing/index.html @@ -21,6 +21,9 @@ }); window.addEventListener("message", ev => { switch (ev.data.op) { + case "titlescreenclick": + window.wasmBindings.titlescreen_click(); + break; case "startgame": window.wasmBindings.start_game(); break; diff --git a/2026/framing/src/assets/audio/aww.wav b/2026/framing/src/assets/audio/aww.wav Binary files differnew file mode 100644 index 0000000..6df8dd8 --- /dev/null +++ b/2026/framing/src/assets/audio/aww.wav diff --git a/2026/framing/src/assets/audio/boo.wav b/2026/framing/src/assets/audio/boo.wav Binary files differnew file mode 100644 index 0000000..d06c162 --- /dev/null +++ b/2026/framing/src/assets/audio/boo.wav diff --git a/2026/framing/src/assets/audio/booyah.wav b/2026/framing/src/assets/audio/booyah.wav Binary files differnew file mode 100644 index 0000000..82d2bdf --- /dev/null +++ b/2026/framing/src/assets/audio/booyah.wav diff --git a/2026/framing/src/assets/audio/epicwin.wav b/2026/framing/src/assets/audio/epicwin.wav Binary files differnew file mode 100644 index 0000000..d55964e --- /dev/null +++ b/2026/framing/src/assets/audio/epicwin.wav diff --git a/2026/framing/src/assets/audio/excellent.wav b/2026/framing/src/assets/audio/excellent.wav Binary files differnew file mode 100644 index 0000000..9067c75 --- /dev/null +++ b/2026/framing/src/assets/audio/excellent.wav diff --git a/2026/framing/src/assets/audio/explosion.wav b/2026/framing/src/assets/audio/explosion.wav Binary files differnew file mode 100644 index 0000000..32c9db9 --- /dev/null +++ b/2026/framing/src/assets/audio/explosion.wav diff --git a/2026/framing/src/assets/audio/gamingtime.wav b/2026/framing/src/assets/audio/gamingtime.wav Binary files differnew file mode 100644 index 0000000..4c3dc70 --- /dev/null +++ b/2026/framing/src/assets/audio/gamingtime.wav diff --git a/2026/framing/src/assets/audio/itsover.wav b/2026/framing/src/assets/audio/itsover.wav Binary files differnew file mode 100644 index 0000000..b495ac8 --- /dev/null +++ b/2026/framing/src/assets/audio/itsover.wav diff --git a/2026/framing/src/assets/audio/jam2026.wav b/2026/framing/src/assets/audio/jam2026.wav Binary files differnew file mode 100644 index 0000000..84239cf --- /dev/null +++ b/2026/framing/src/assets/audio/jam2026.wav diff --git a/2026/framing/src/assets/audio/test.wav b/2026/framing/src/assets/audio/test.wav Binary files differdeleted file mode 100644 index 0eabe85..0000000 --- a/2026/framing/src/assets/audio/test.wav +++ /dev/null diff --git a/2026/framing/src/assets/audio/wind.wav b/2026/framing/src/assets/audio/wind.wav Binary files differnew file mode 100644 index 0000000..652fdde --- /dev/null +++ b/2026/framing/src/assets/audio/wind.wav diff --git a/2026/framing/src/assets/audio/wow.wav b/2026/framing/src/assets/audio/wow.wav Binary files differnew file mode 100644 index 0000000..11cb807 --- /dev/null +++ b/2026/framing/src/assets/audio/wow.wav diff --git a/2026/framing/src/assets/audio/youlose.wav b/2026/framing/src/assets/audio/youlose.wav Binary files differnew file mode 100644 index 0000000..6d4c935 --- /dev/null +++ b/2026/framing/src/assets/audio/youlose.wav diff --git a/2026/framing/src/assets/audio/yousuck.wav b/2026/framing/src/assets/audio/yousuck.wav Binary files differnew file mode 100644 index 0000000..8b96229 --- /dev/null +++ b/2026/framing/src/assets/audio/yousuck.wav diff --git a/2026/framing/src/assets/textures/intro.png b/2026/framing/src/assets/textures/intro.png Binary files differnew file mode 100644 index 0000000..5625316 --- /dev/null +++ b/2026/framing/src/assets/textures/intro.png diff --git a/2026/framing/src/assets/textures/titlescreen.png b/2026/framing/src/assets/textures/titlescreen.png Binary files differnew file mode 100644 index 0000000..6111223 --- /dev/null +++ b/2026/framing/src/assets/textures/titlescreen.png diff --git a/2026/framing/src/bindings.js b/2026/framing/src/bindings.js new file mode 100644 index 0000000..1f17e14 --- /dev/null +++ b/2026/framing/src/bindings.js @@ -0,0 +1,3 @@ +export function js_test() { + console.log("test"); +} diff --git a/2026/framing/src/game.rs b/2026/framing/src/game.rs index b8fb5ce..6c2df1b 100644 --- a/2026/framing/src/game.rs +++ b/2026/framing/src/game.rs @@ -3,12 +3,16 @@ use std::collections::HashMap; use teleia::*; use teleia::renderer::UberFlags; use wasm_bindgen::prelude::*; +use rand::seq::SliceRandom; use crate::assets; const NUM_LIVES: usize = 4; const LIFE_LOSS_FRAMES: u64 = 120; +const SOUND_POSITIVE: &[&str] = &["booyah", "excellent", "epicwin", "wow"]; +const SOUND_NEGATIVE: &[&str] = &["boo", "aww", "itsover", "youlose", "yousuck"]; + #[derive(PartialEq, Eq)] enum MrColor { Green, @@ -146,8 +150,11 @@ fn draw_mr_armed( } pub enum Mode { + Titlescreen, + Intro, BetweenGames, InGame, + PostGames, } pub struct Game { @@ -160,55 +167,116 @@ pub struct Game { impl Game { pub fn new(ctx: &context::Context, st: &mut state::State) -> Self { Self { - mode: Mode::BetweenGames, + mode: Mode::Titlescreen, mode_started: 0, renderer: renderer::Renderer::new(ctx, st, assets::Assets::new), lives: Lives::new(), } } + pub fn switch(&mut self, _ctx: &context::Context, st: &mut state::State, m: Mode) { + self.mode = m; + self.mode_started = st.tick; + } + fn draw_mrworld(&mut self, ctx: &context::Context, st: &mut state::State, fadeout: Option<Tick>) -> Erm<()> { + self.renderer.bind_uber_2d(ctx, st, UberFlags::TEXTURE_COLOR | UberFlags::TEXTURE_FLIP | UberFlags::SPRITE | UberFlags::OPACITY); + self.renderer.bind_texture(ctx, st, assets::Texture::Mrworld); + self.renderer.set_position_2d(ctx, st, Vec2::ZERO, st.render_dims); + self.renderer.set_vec2(ctx, st, "texture_flip", glam::Vec2::new(0.0, 1.0)); + if let Some(t) = fadeout { + if t < 35 { + self.renderer.set_texture_offset(ctx, st, 8, 1, 2 + (t / 5).clamp(0, 5) as i32, 0); + self.renderer.set_f32(ctx, st, "opacity", 1.0); + } else if t < 70 { + let since = ((t - 35) as f32).clamp(0.0, 34.0); + let opacity = (34.0 - since) / 34.0; + self.renderer.set_texture_offset(ctx, st, 8, 1, 7, 0); + self.renderer.set_f32(ctx, st, "opacity", opacity); + } + } else { + self.renderer.set_texture_offset(ctx, st, 8, 1, (st.tick as i32 / 20) % 2, 0); + self.renderer.set_f32(ctx, st, "opacity", 1.0); + } + self.renderer.render_square(ctx, st); + Ok(()) + } + fn play_random_sound(&mut self, ctx: &context::Context, st: &mut state::State, sounds: &[&str]) { + st.audio.play_sfx(sounds.choose(&mut rand::thread_rng()).unwrap()); + } } impl teleia::state::Game for Game { fn initialize_audio(&self, ctx: &context::Context, st: &state::State, actx: &audio::Context) -> HashMap<String, audio::Audio> { HashMap::from_iter(vec![ + ("jam2026".to_owned(), audio::Audio::new(actx, include_bytes!("assets/audio/jam2026.wav"))), + ("wind".to_owned(), audio::Audio::new(actx, include_bytes!("assets/audio/wind.wav"))), ("footsteps".to_owned(), audio::Audio::new(actx, include_bytes!("assets/audio/footsteps.wav"))), + ("explosion".to_owned(), audio::Audio::new(actx, include_bytes!("assets/audio/explosion.wav"))), + ("gamingtime".to_owned(), audio::Audio::new(actx, include_bytes!("assets/audio/gamingtime.wav"))), + ("booyah".to_owned(), audio::Audio::new(actx, include_bytes!("assets/audio/booyah.wav"))), + ("excellent".to_owned(), audio::Audio::new(actx, include_bytes!("assets/audio/excellent.wav"))), + ("epicwin".to_owned(), audio::Audio::new(actx, include_bytes!("assets/audio/epicwin.wav"))), + ("wow".to_owned(), audio::Audio::new(actx, include_bytes!("assets/audio/wow.wav"))), + ("boo".to_owned(), audio::Audio::new(actx, include_bytes!("assets/audio/boo.wav"))), + ("aww".to_owned(), audio::Audio::new(actx, include_bytes!("assets/audio/aww.wav"))), + ("itsover".to_owned(), audio::Audio::new(actx, include_bytes!("assets/audio/itsover.wav"))), + ("youlose".to_owned(), audio::Audio::new(actx, include_bytes!("assets/audio/youlose.wav"))), + ("yousuck".to_owned(), audio::Audio::new(actx, include_bytes!("assets/audio/yousuck.wav"))), ]) } fn update(&mut self, ctx: &context::Context, st: &mut state::State) -> Erm<()> { + let t = st.tick - self.mode_started; + match self.mode { + Mode::Intro => { + if t == 43 * 5 { + st.audio.play_sfx("explosion"); + st.audio.play_music("jam2026", None, None); + } + if t >= 57 * 5 { + self.switch(ctx, st, Mode::BetweenGames); + } + }, + _ => {}, + } Ok(()) } fn render(&mut self, ctx: &context::Context, st: &mut state::State) -> Erm<()> { let t = st.tick - self.mode_started; match self.mode { - Mode::BetweenGames => { + Mode::Titlescreen => { self.renderer.begin_frame(ctx, st, Vec4::ZERO); self.renderer.bind_uber_2d(ctx, st, UberFlags::TEXTURE_COLOR | UberFlags::TEXTURE_FLIP | UberFlags::SPRITE); - self.renderer.bind_texture(ctx, st, assets::Texture::Mrworld); - self.renderer.set_texture_offset(ctx, st, 8, 1, (t / 20 % 2) as i32, 0); + self.renderer.bind_texture(ctx, st, assets::Texture::Titlescreen); + self.renderer.set_texture_offset(ctx, st, 2, 1, (t / 60 % 2) as i32, 0); self.renderer.set_position_2d(ctx, st, Vec2::ZERO, st.render_dims); self.renderer.set_vec2(ctx, st, "texture_flip", glam::Vec2::new(0.0, 1.0)); self.renderer.render_square(ctx, st); - self.lives.render(ctx, st, &mut self.renderer)?; }, - Mode::InGame => { + Mode::Intro => { self.renderer.begin_frame(ctx, st, Vec4::ZERO); - self.renderer.bind_uber_2d(ctx, st, UberFlags::TEXTURE_COLOR | UberFlags::TEXTURE_FLIP | UberFlags::SPRITE | UberFlags::OPACITY); - self.renderer.bind_texture(ctx, st, assets::Texture::Mrworld); + self.draw_mrworld(ctx, st, None)?; + self.lives.render(ctx, st, &mut self.renderer)?; + let f = t / 5; + let sx = f % 8; + let sy = f / 8; + self.renderer.bind_uber_2d(ctx, st, UberFlags::TEXTURE_COLOR | UberFlags::TEXTURE_FLIP | UberFlags::SPRITE); + self.renderer.bind_texture(ctx, st, assets::Texture::Intro); + self.renderer.set_texture_offset(ctx, st, 8, 8, sx as i32, sy as i32); self.renderer.set_position_2d(ctx, st, Vec2::ZERO, st.render_dims); self.renderer.set_vec2(ctx, st, "texture_flip", glam::Vec2::new(0.0, 1.0)); - if t < 35 { - self.renderer.set_texture_offset(ctx, st, 8, 1, 2 + (t / 5).clamp(0, 5) as i32, 0); - self.renderer.set_f32(ctx, st, "opacity", 1.0); - self.renderer.render_square(ctx, st); - } else if t < 70 { - let since = ((t - 35) as f32).clamp(0.0, 34.0); - let opacity = (34.0 - since) / 34.0; - self.renderer.set_texture_offset(ctx, st, 8, 1, 7, 0); - self.renderer.set_f32(ctx, st, "opacity", opacity); - self.renderer.render_square(ctx, st); - } - // self.lives.render(ctx, st, &mut self.renderer)?; + self.renderer.render_square(ctx, st); } + Mode::BetweenGames => { + self.renderer.begin_frame(ctx, st, Vec4::ZERO); + self.draw_mrworld(ctx, st, None)?; + self.lives.render(ctx, st, &mut self.renderer)?; + }, + Mode::InGame => { + self.renderer.begin_frame(ctx, st, Vec4::ZERO); + self.draw_mrworld(ctx, st, Some(t))?; + // self.lives.render(ctx, st, &mut self.renderer)?; + }, + Mode::PostGames => { + }, } Ok(()) } @@ -217,22 +285,38 @@ impl teleia::state::Game for Game { } } +#[wasm_bindgen(module = "/src/bindings.js")] +extern { + fn js_test(); +} + +#[wasm_bindgen] +pub fn titlescreen_click() { + contextualize(|ctx, st, g: &mut Game| { + g.switch(ctx, st, Mode::Intro); + st.audio.play_music("wind", None, None); + }); +} + #[wasm_bindgen] pub fn start_game() { contextualize(|ctx, st, g: &mut Game| { - g.mode = Mode::InGame; - g.mode_started = st.tick; + g.switch(ctx, st, Mode::InGame); + st.audio.mute_music(0.0); }); } #[wasm_bindgen] pub fn end_game(win: bool) { contextualize(|ctx, st, g: &mut Game| { - g.mode = Mode::BetweenGames; - g.mode_started = st.tick; - if !win { + g.switch(ctx, st, Mode::BetweenGames); + st.audio.unmute_music(0.0); + if win { + g.play_random_sound(ctx, st, SOUND_POSITIVE); + } else { g.lives.lose_life(ctx, st); st.audio.play_sfx("footsteps"); + g.play_random_sound(ctx, st, SOUND_NEGATIVE); } }); } diff --git a/2026/games/distracted_penguin/index.data b/2026/games/distracted_penguin/index.data Binary files differnew file mode 100644 index 0000000..5bc28f3 --- /dev/null +++ b/2026/games/distracted_penguin/index.data diff --git a/2026/games/distracted_penguin/index.html b/2026/games/distracted_penguin/index.html new file mode 100644 index 0000000..16deae8 --- /dev/null +++ b/2026/games/distracted_penguin/index.html @@ -0,0 +1 @@ +<!doctypehtml><html lang=EN-us><head><meta charset=utf-8><meta content="text/html; charset=utf-8"http-equiv=Content-Type><title>raylib web game</title><meta content="raylib web game"name=title><meta content="New raylib web videogame, developed using raylib videogames library"name=description><meta content="raylib, programming, examples, html5, C, C++, library, learn, games, videogames"name=keywords><meta content="width=device-width"name=viewport><meta content=website property=og:type><meta content="raylib web game"property=og:title><meta content=image/png property=og:image:type><meta content=https://www.raylib.com/common/raylib_logo.png property=og:image><meta content="New raylib web videogame, developed using raylib videogames library"property=og:image:alt><meta content="raylib - example"property=og:site_name><meta content=https://www.raylib.com/games.html property=og:url><meta content="New raylib web videogame, developed using raylib videogames library"property=og:description><meta content=summary_large_image name=twitter:card><meta content=@raysan5 name=twitter:site><meta content="raylib web game"name=twitter:title><meta content=https://www.raylib.com/common/raylib_logo.png name=twitter:image><meta content="New raylib web videogame, developed using raylib videogames library"name=twitter:image:alt><meta content=https://www.raylib.com/games.html name=twitter:url><meta content="New raylib web videogame, developed using raylib videogames library"name=twitter:description><link href=https://www.raylib.com/favicon.ico rel="shortcut icon"><style>body{margin:0;overflow:hidden;background-color:#000}canvas.emscripten{border:0 none;background-color:#000}</style><script src=https://cdn.jsdelivr.net/gh/eligrey/FileSaver.js/dist/FileSaver.min.js></script><script>function saveFileFromMEMFSToDisk(e,a){var i,o=FS.readFile(e);i=new Blob([o.buffer],{type:"application/octet-binary"}),saveAs(i,a)}</script></head><body><canvas class=emscripten id=canvas oncontextmenu=event.preventDefault() tabindex=-1></canvas><p id=output><script>var Module={print:function(){var e=document.getElementById("output");return e&&(e.value=""),function(n){arguments.length>1&&(n=Array.prototype.slice.call(arguments).join(" ")),console.log(n),e&&(e.value+=n+"\n",e.scrollTop=e.scrollHeight)}}(),canvas:document.getElementById("canvas")}</script><script src=index.js async></script></body></html>
\ No newline at end of file diff --git a/2026/games/distracted_penguin/index.js b/2026/games/distracted_penguin/index.js new file mode 100644 index 0000000..9fa7c61 --- /dev/null +++ b/2026/games/distracted_penguin/index.js @@ -0,0 +1 @@ +var Module=typeof Module!="undefined"?Module:{};var ENVIRONMENT_IS_WEB=!!globalThis.window;var ENVIRONMENT_IS_WORKER=!!globalThis.WorkerGlobalScope;var ENVIRONMENT_IS_NODE=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";if(!Module["expectedDataFileDownloads"])Module["expectedDataFileDownloads"]=0;Module["expectedDataFileDownloads"]++;(()=>{var isPthread=typeof ENVIRONMENT_IS_PTHREAD!="undefined"&&ENVIRONMENT_IS_PTHREAD;var isWasmWorker=typeof ENVIRONMENT_IS_WASM_WORKER!="undefined"&&ENVIRONMENT_IS_WASM_WORKER;if(isPthread||isWasmWorker)return;var isNode=globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node&&globalThis.process.type!="renderer";async function loadPackage(metadata){var PACKAGE_PATH="";if(typeof window==="object"){PACKAGE_PATH=window["encodeURIComponent"](window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/")}else if(typeof process==="undefined"&&typeof location!=="undefined"){PACKAGE_PATH=encodeURIComponent(location.pathname.substring(0,location.pathname.lastIndexOf("/"))+"/")}var PACKAGE_NAME="build/index.data";var REMOTE_PACKAGE_BASE="index.data";var REMOTE_PACKAGE_NAME=Module["locateFile"]?Module["locateFile"](REMOTE_PACKAGE_BASE,""):REMOTE_PACKAGE_BASE;var REMOTE_PACKAGE_SIZE=metadata["remote_package_size"];async function fetchRemotePackage(packageName,packageSize){if(isNode){var contents=require("fs").readFileSync(packageName);return new Uint8Array(contents).buffer}if(!Module["dataFileDownloads"])Module["dataFileDownloads"]={};try{var response=await fetch(packageName)}catch(e){throw new Error(`Network Error: ${packageName}`,{e})}if(!response.ok){throw new Error(`${response.status}: ${response.url}`)}const chunks=[];const headers=response.headers;const total=Number(headers.get("Content-Length")||packageSize);let loaded=0;Module["setStatus"]&&Module["setStatus"]("Downloading data...");const reader=response.body.getReader();while(1){var{done,value}=await reader.read();if(done)break;chunks.push(value);loaded+=value.length;Module["dataFileDownloads"][packageName]={loaded,total};let totalLoaded=0;let totalSize=0;for(const download of Object.values(Module["dataFileDownloads"])){totalLoaded+=download.loaded;totalSize+=download.total}Module["setStatus"]&&Module["setStatus"](`Downloading data... (${totalLoaded}/${totalSize})`)}const packageData=new Uint8Array(chunks.map(c=>c.length).reduce((a,b)=>a+b,0));let offset=0;for(const chunk of chunks){packageData.set(chunk,offset);offset+=chunk.length}return packageData.buffer}var fetchPromise;var fetched=Module["getPreloadedPackage"]&&Module["getPreloadedPackage"](REMOTE_PACKAGE_NAME,REMOTE_PACKAGE_SIZE);if(!fetched){fetchPromise=fetchRemotePackage(REMOTE_PACKAGE_NAME,REMOTE_PACKAGE_SIZE)}async function runWithFS(Module){function assert(check,msg){if(!check)throw new Error(msg)}Module["FS_createPath"]("/","shaders",true,true);Module["FS_createPath"]("/","sounds",true,true);for(var file of metadata["files"]){var name=file["filename"];Module["addRunDependency"](`fp ${name}`)}async function processPackageData(arrayBuffer){assert(arrayBuffer,"Loading data file failed.");assert(arrayBuffer.constructor.name===ArrayBuffer.name,"bad input to processPackageData "+arrayBuffer.constructor.name);var byteArray=new Uint8Array(arrayBuffer);for(var file of metadata["files"]){var name=file["filename"];var data=byteArray.subarray(file["start"],file["end"]);Module["FS_createDataFile"](name,null,data,true,true,true);Module["removeRunDependency"](`fp ${name}`)}Module["removeRunDependency"]("datafile_build/index.data")}Module["addRunDependency"]("datafile_build/index.data");if(!Module["preloadResults"])Module["preloadResults"]={};Module["preloadResults"][PACKAGE_NAME]={fromCache:false};if(!fetched){fetched=await fetchPromise}processPackageData(fetched)}if(Module["calledRun"]){runWithFS(Module)}else{if(!Module["preRun"])Module["preRun"]=[];Module["preRun"].push(runWithFS)}}loadPackage({files:[{filename:"/shaders/cube.fs",start:0,end:108},{filename:"/shaders/triangle.fs",start:108,end:216},{filename:"/sounds/block.ogg",start:216,end:6598},{filename:"/sounds/hit.ogg",start:6598,end:12903},{filename:"/sounds/lose.ogg",start:12903,end:27231},{filename:"/sounds/win.ogg",start:27231,end:41738}],remote_package_size:41738})})();var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var _scriptName=globalThis.document?.currentScript?.src;if(typeof __filename!="undefined"){_scriptName=__filename}else if(ENVIRONMENT_IS_WORKER){_scriptName=self.location.href}var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("node:fs");scriptDirectory=__dirname+"/";readBinary=filename=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename);return ret};readAsync=async(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename,binary?undefined:"utf8");return ret};if(process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);if(typeof module!="undefined"){module["exports"]=Module}quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){try{scriptDirectory=new URL(".",_scriptName).href}catch{}{if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=async url=>{if(isFileURI(url)){return new Promise((resolve,reject)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){resolve(xhr.response);return}reject(xhr.status)};xhr.onerror=reject;xhr.send(null)})}var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{}var out=console.log.bind(console);var err=console.error.bind(console);var wasmBinary;var ABORT=false;var EXITSTATUS;var isFileURI=filename=>filename.startsWith("file://");class EmscriptenEH{}class EmscriptenSjLj extends EmscriptenEH{}var runtimeInitialized=false;function updateMemoryViews(){var b=wasmMemory.buffer;HEAP8=new Int8Array(b);HEAP16=new Int16Array(b);HEAPU8=new Uint8Array(b);HEAPU16=new Uint16Array(b);HEAP32=new Int32Array(b);HEAPU32=new Uint32Array(b);HEAPF32=new Float32Array(b);HEAPF64=new Float64Array(b);HEAP64=new BigInt64Array(b);HEAPU64=new BigUint64Array(b)}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(onPreRuns)}function initRuntime(){runtimeInitialized=true;if(!Module["noFSInit"]&&!FS.initialized)FS.init();TTY.init();wasmExports["pe"]();FS.ignorePermissions=false}function preMain(){}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(onPostRuns)}function abort(what){Module["onAbort"]?.(what);what=`Aborted(${what})`;err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);throw e}var wasmBinaryFile;function findWasmBinary(){return locateFile("index.wasm")}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)}}async function instantiateAsync(binary,binaryFile,imports){if(!binary&&!isFileURI(binaryFile)&&!ENVIRONMENT_IS_NODE){try{var response=fetch(binaryFile,{credentials:"same-origin"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation")}}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){var imports={a:wasmImports};return imports}async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;wasmExports=Asyncify.instrumentWasmExports(wasmExports);assignWasmExports(wasmExports);updateMemoryViews();removeRunDependency("wasm-instantiate");return wasmExports}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){return receiveInstance(result["instance"])}var info=getWasmImports();if(Module["instantiateWasm"]){return new Promise((resolve,reject)=>{Module["instantiateWasm"](info,(inst,mod)=>{resolve(receiveInstance(inst,mod))})})}wasmBinaryFile??=findWasmBinary();var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);var exports=receiveInstantiationResult(result);return exports}class ExitStatus{name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status}}var HEAP16;var HEAP32;var HEAP64;var HEAP8;var HEAPF32;var HEAPF64;var HEAPU16;var HEAPU32;var HEAPU64;var HEAPU8;var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var onPostRuns=[];var addOnPostRun=cb=>onPostRuns.push(cb);var onPreRuns=[];var addOnPreRun=cb=>onPreRuns.push(cb);var runDependencies=0;var dependenciesFulfilled=null;var removeRunDependency=id=>{runDependencies--;Module["monitorRunDependencies"]?.(runDependencies);if(runDependencies==0){if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}};var addRunDependency=id=>{runDependencies++;Module["monitorRunDependencies"]?.(runDependencies)};var dynCalls={};var noExitRuntime=true;var UTF8Decoder=globalThis.TextDecoder&&new TextDecoder;var findStringEnd=(heapOrArray,idx,maxBytesToRead,ignoreNul)=>{var maxIdx=idx+maxBytesToRead;if(ignoreNul)return maxIdx;while(heapOrArray[idx]&&!(idx>=maxIdx))++idx;return idx};var UTF8ArrayToString=(heapOrArray,idx=0,maxBytesToRead,ignoreNul)=>{var endPtr=findStringEnd(heapOrArray,idx,maxBytesToRead,ignoreNul);if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str};var UTF8ToString=(ptr,maxBytesToRead,ignoreNul)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead,ignoreNul):"";var ___assert_fail=(condition,filename,line,func)=>abort(`Assertion failed: ${UTF8ToString(condition)}, at: `+[filename?UTF8ToString(filename):"unknown filename",line,func?UTF8ToString(func):"unknown function"]);var PATH={isAbs:path=>path.charAt(0)==="/",splitPath:filename=>{var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1)},normalizeArray:(parts,allowAboveRoot)=>{var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up;up--){parts.unshift("..")}}return parts},normalize:path=>{var isAbsolute=PATH.isAbs(path),trailingSlash=path.slice(-1)==="/";path=PATH.normalizeArray(path.split("/").filter(p=>!!p),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path},dirname:path=>{var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.slice(0,-1)}return root+dir},basename:path=>path&&path.match(/([^\/]+|\/)\/*$/)[1],join:(...paths)=>PATH.normalize(paths.join("/")),join2:(l,r)=>PATH.normalize(l+"/"+r)};var initRandomFill=()=>{if(ENVIRONMENT_IS_NODE){var nodeCrypto=require("node:crypto");return view=>nodeCrypto.randomFillSync(view)}return view=>(crypto.getRandomValues(view),0)};var randomFill=view=>(randomFill=initRandomFill())(view);var PATH_FS={resolve:(...args)=>{var resolvedPath="",resolvedAbsolute=false;for(var i=args.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?args[i]:FS.cwd();if(typeof path!="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){return""}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=PATH.isAbs(path)}resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter(p=>!!p),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."},relative:(from,to)=>{from=PATH_FS.resolve(from).slice(1);to=PATH_FS.resolve(to).slice(1);function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=="")break}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break}}var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push("..")}outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join("/")}};var FS_stdin_getChar_buffer=[];var lengthBytesUTF8=str=>{var len=0;for(var i=0;i<str.length;++i){var c=str.charCodeAt(i);if(c<=127){len++}else if(c<=2047){len+=2}else if(c>=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.codePointAt(i);if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63;i++}}heap[outIdx]=0;return outIdx-startIdx};var intArrayFromString=(stringy,dontAddNull,length)=>{var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array};var FS_stdin_getChar=()=>{if(!FS_stdin_getChar_buffer.length){var result=null;if(ENVIRONMENT_IS_NODE){var BUFSIZE=256;var buf=Buffer.alloc(BUFSIZE);var bytesRead=0;var fd=process.stdin.fd;try{bytesRead=fs.readSync(fd,buf,0,BUFSIZE)}catch(e){if(e.toString().includes("EOF"))bytesRead=0;else throw e}if(bytesRead>0){result=buf.slice(0,bytesRead).toString("utf-8")}}else if(globalThis.window?.prompt){result=window.prompt("Input: ");if(result!==null){result+="\n"}}else{}if(!result){return null}FS_stdin_getChar_buffer=intArrayFromString(result,true)}return FS_stdin_getChar_buffer.shift()};var TTY={ttys:[],init(){},shutdown(){},register(dev,ops){TTY.ttys[dev]={input:[],output:[],ops};FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43)}stream.tty=tty;stream.seekable=false},close(stream){stream.tty.ops.fsync(stream.tty)},fsync(stream){stream.tty.ops.fsync(stream.tty)},read(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.get_char){throw new FS.ErrnoError(60)}var bytesRead=0;for(var i=0;i<length;i++){var result;try{result=stream.tty.ops.get_char(stream.tty)}catch(e){throw new FS.ErrnoError(29)}if(result===undefined&&bytesRead===0){throw new FS.ErrnoError(6)}if(result===null||result===undefined)break;bytesRead++;buffer[offset+i]=result}if(bytesRead){stream.node.atime=Date.now()}return bytesRead},write(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.put_char){throw new FS.ErrnoError(60)}try{for(var i=0;i<length;i++){stream.tty.ops.put_char(stream.tty,buffer[offset+i])}}catch(e){throw new FS.ErrnoError(29)}if(length){stream.node.mtime=stream.node.ctime=Date.now()}return i}},default_tty_ops:{get_char(tty){return FS_stdin_getChar()},put_char(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync(tty){if(tty.output?.length>0){out(UTF8ArrayToString(tty.output));tty.output=[]}},ioctl_tcgets(tty){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(tty,optional_actions,data){return 0},ioctl_tiocgwinsz(tty){return[24,80]}},default_tty1_ops:{put_char(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync(tty){if(tty.output?.length>0){err(UTF8ArrayToString(tty.output));tty.output=[]}}}};var mmapAlloc=size=>{abort()};var MEMFS={ops_table:null,mount(mount){return MEMFS.createNode(null,"/",16895,0)},createNode(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}MEMFS.ops_table||={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}};var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=MEMFS.emptyFileContents??=new Uint8Array(0)}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.atime=node.mtime=node.ctime=Date.now();if(parent){parent.contents[name]=node;parent.atime=parent.mtime=parent.ctime=node.atime}return node},getFileDataAsTypedArray(node){return node.contents.subarray(0,node.usedBytes)},expandFileStorage(node,newCapacity){var prevCapacity=node.contents.length;if(prevCapacity>=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity<CAPACITY_DOUBLING_MAX?2:1.125)>>>0);if(prevCapacity)newCapacity=Math.max(newCapacity,256);var oldContents=MEMFS.getFileDataAsTypedArray(node);node.contents=new Uint8Array(newCapacity);node.contents.set(oldContents)},resizeFileStorage(node,newSize){if(node.usedBytes==newSize)return;var oldContents=node.contents;node.contents=new Uint8Array(newSize);node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)));node.usedBytes=newSize},node_ops:{getattr(node){var attr={};attr.dev=FS.isChrdev(node.mode)?node.id:1;attr.ino=node.id;attr.mode=node.mode;attr.nlink=1;attr.uid=0;attr.gid=0;attr.rdev=node.rdev;if(FS.isDir(node.mode)){attr.size=4096}else if(FS.isFile(node.mode)){attr.size=node.usedBytes}else if(FS.isLink(node.mode)){attr.size=node.link.length}else{attr.size=0}attr.atime=new Date(node.atime);attr.mtime=new Date(node.mtime);attr.ctime=new Date(node.ctime);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr(node,attr){for(const key of["mode","atime","mtime","ctime"]){if(attr[key]!=null){node[key]=attr[key]}}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup(parent,name){if(!MEMFS.doesNotExistError){MEMFS.doesNotExistError=new FS.ErrnoError(44);MEMFS.doesNotExistError.stack="<generic error, no stack>"}throw MEMFS.doesNotExistError},mknod(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename(old_node,new_dir,new_name){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){if(FS.isDir(old_node.mode)){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}FS.hashRemoveNode(new_node)}delete old_node.parent.contents[old_node.name];new_dir.contents[new_name]=old_node;old_node.name=new_name;new_dir.ctime=new_dir.mtime=old_node.parent.ctime=old_node.parent.mtime=Date.now()},unlink(parent,name){delete parent.contents[name];parent.ctime=parent.mtime=Date.now()},rmdir(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.ctime=parent.mtime=Date.now()},readdir(node){return[".","..",...Object.keys(node.contents)]},symlink(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);buffer.set(contents.subarray(position,position+size),offset);return size},write(stream,buffer,offset,length,position,canOwn){if(buffer.buffer===HEAP8.buffer){canOwn=false}if(!length)return 0;var node=stream.node;node.mtime=node.ctime=Date.now();if(canOwn){node.contents=buffer.subarray(offset,offset+length);node.usedBytes=length}else if(node.usedBytes===0&&position===0){node.contents=buffer.slice(offset,offset+length);node.usedBytes=length}else{MEMFS.expandFileStorage(node,position+length);node.contents.set(buffer.subarray(offset,offset+length),position);node.usedBytes=Math.max(node.usedBytes,position+length)}return length},llseek(stream,offset,whence){var position=offset;if(whence===1){position+=stream.position}else if(whence===2){if(FS.isFile(stream.node.mode)){position+=stream.node.usedBytes}}if(position<0){throw new FS.ErrnoError(28)}return position},mmap(stream,length,position,prot,flags){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}var ptr;var allocated;var contents=stream.node.contents;if(!(flags&2)&&contents.buffer===HEAP8.buffer){allocated=false;ptr=contents.byteOffset}else{allocated=true;ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}if(contents){if(position>0||position+length<contents.length){if(contents.subarray){contents=contents.subarray(position,position+length)}else{contents=Array.prototype.slice.call(contents,position,position+length)}}HEAP8.set(contents,ptr)}}return{ptr,allocated}},msync(stream,buffer,offset,length,mmapFlags){MEMFS.stream_ops.write(stream,buffer,0,length,offset,false);return 0}}};var FS_modeStringToFlags=str=>{if(typeof str!="string")return str;var flagModes={r:0,"r+":2,w:512|64|1,"w+":512|64|2,a:1024|64|1,"a+":1024|64|2};var flags=flagModes[str];if(typeof flags=="undefined"){throw new Error(`Unknown file open mode: ${str}`)}return flags};var FS_fileDataToTypedArray=data=>{if(typeof data=="string"){data=intArrayFromString(data,true)}if(!data.subarray){data=new Uint8Array(data)}return data};var FS_getMode=(canRead,canWrite)=>{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode};var asyncLoad=async url=>{var arrayBuffer=await readAsync(url);return new Uint8Array(arrayBuffer)};var FS_createDataFile=(...args)=>FS.createDataFile(...args);var getUniqueRunDependency=id=>id;var preloadPlugins=[];var FS_handledByPreloadPlugin=async(byteArray,fullname)=>{if(typeof Browser!="undefined")Browser.init();for(var plugin of preloadPlugins){if(plugin["canHandle"](fullname)){return plugin["handle"](byteArray,fullname)}}return byteArray};var FS_preloadFile=async(parent,name,url,canRead,canWrite,dontCreateFile,canOwn,preFinish)=>{var fullname=name?PATH_FS.resolve(PATH.join2(parent,name)):parent;var dep=getUniqueRunDependency(`cp ${fullname}`);addRunDependency(dep);try{var byteArray=url;if(typeof url=="string"){byteArray=await asyncLoad(url)}byteArray=await FS_handledByPreloadPlugin(byteArray,fullname);preFinish?.();if(!dontCreateFile){FS_createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}}finally{removeRunDependency(dep)}};var FS_createPreloadedFile=(parent,name,url,canRead,canWrite,onload,onerror,dontCreateFile,canOwn,preFinish)=>{FS_preloadFile(parent,name,url,canRead,canWrite,dontCreateFile,canOwn,preFinish).then(onload).catch(onerror)};var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,filesystems:null,syncFSRequests:0,ErrnoError:class{name="ErrnoError";constructor(errno){this.errno=errno}},FSStream:class{shared={};get object(){return this.node}set object(val){this.node=val}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(val){this.shared.flags=val}get position(){return this.shared.position}set position(val){this.shared.position=val}},FSNode:class{node_ops={};stream_ops={};readMode=292|73;writeMode=146;mounted=null;constructor(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.rdev=rdev;this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(val){val?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(val){val?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return FS.isDir(this.mode)}get isDevice(){return FS.isChrdev(this.mode)}},lookupPath(path,opts={}){if(!path){throw new FS.ErrnoError(44)}opts.follow_mount??=true;if(!PATH.isAbs(path)){path=FS.cwd()+"/"+path}linkloop:for(var nlinks=0;nlinks<40;nlinks++){var parts=path.split("/").filter(p=>!!p);var current=FS.root;var current_path="/";for(var i=0;i<parts.length;i++){var islast=i===parts.length-1;if(islast&&opts.parent){break}if(parts[i]==="."){continue}if(parts[i]===".."){current_path=PATH.dirname(current_path);if(FS.isRoot(current)){path=current_path+"/"+parts.slice(i+1).join("/");nlinks--;continue linkloop}else{current=current.parent}continue}current_path=PATH.join2(current_path,parts[i]);try{current=FS.lookupNode(current,parts[i])}catch(e){if(e?.errno===44&&islast&&opts.noent_okay){return{path:current_path}}throw e}if(FS.isMountpoint(current)&&(!islast||opts.follow_mount)){current=current.mounted.root}if(FS.isLink(current.mode)&&(!islast||opts.follow)){if(!current.node_ops.readlink){throw new FS.ErrnoError(52)}var link=current.node_ops.readlink(current);if(!PATH.isAbs(link)){link=PATH.dirname(current_path)+"/"+link}path=link+"/"+parts.slice(i+1).join("/");continue linkloop}}return{path:current_path,node:current}}throw new FS.ErrnoError(32)},getPath(node){var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?`${mount}/${path}`:mount+path}path=path?`${node.name}/${path}`:node.name;node=node.parent}},hashName(parentid,name){var hash=0;for(var i=0;i<name.length;i++){hash=(hash<<5)-hash+name.charCodeAt(i)|0}return(parentid+hash>>>0)%FS.nameTable.length},hashAddNode(node){var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node},hashRemoveNode(node){var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}},lookupNode(parent,name){var errCode=FS.mayLookup(parent);if(errCode){throw new FS.ErrnoError(errCode)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node}}return FS.lookup(parent,name)},createNode(parent,name,mode,rdev){var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node},destroyNode(node){FS.hashRemoveNode(node)},isRoot(node){return node===node.parent},isMountpoint(node){return!!node.mounted},isFile(mode){return(mode&61440)===32768},isDir(mode){return(mode&61440)===16384},isLink(mode){return(mode&61440)===40960},isChrdev(mode){return(mode&61440)===8192},isBlkdev(mode){return(mode&61440)===24576},isFIFO(mode){return(mode&61440)===4096},isSocket(mode){return(mode&49152)===49152},flagsToPermissionString(flag){var perms=["r","w","rw"][flag&3];if(flag&512){perms+="w"}return perms},nodePermissions(node,perms){if(FS.ignorePermissions){return 0}if(perms.includes("r")&&!(node.mode&292)){return 2}if(perms.includes("w")&&!(node.mode&146)){return 2}if(perms.includes("x")&&!(node.mode&73)){return 2}return 0},mayLookup(dir){if(!FS.isDir(dir.mode))return 54;var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate(dir,name){if(!FS.isDir(dir.mode)){return 54}try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete(dir,name,isdir){var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else if(FS.isDir(node.mode)){return 31}return 0},mayOpen(node,flags){if(!node){return 44}if(FS.isLink(node.mode)){return 32}var mode=FS.flagsToPermissionString(flags);if(FS.isDir(node.mode)){if(mode!=="r"||flags&(512|64)){return 31}}return FS.nodePermissions(node,mode)},checkOpExists(op,err){if(!op){throw new FS.ErrnoError(err)}return op},MAX_OPEN_FDS:4096,nextfd(){for(var fd=0;fd<=FS.MAX_OPEN_FDS;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStreamChecked(fd){var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}return stream},getStream:fd=>FS.streams[fd],createStream(stream,fd=-1){stream=Object.assign(new FS.FSStream,stream);if(fd==-1){fd=FS.nextfd()}stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream(fd){FS.streams[fd]=null},dupStream(origStream,fd=-1){var stream=FS.createStream(origStream,fd);stream.stream_ops?.dup?.(stream);return stream},doSetAttr(stream,node,attr){var setattr=stream?.stream_ops.setattr;var arg=setattr?stream:node;setattr??=node.node_ops.setattr;FS.checkOpExists(setattr,63);try{setattr(arg,attr)}catch(e){if(e instanceof RangeError){throw new FS.ErrnoError(22)}throw e}},chrdev_stream_ops:{open(stream){var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;stream.stream_ops.open?.(stream)},llseek(){throw new FS.ErrnoError(70)}},major:dev=>dev>>8,minor:dev=>dev&255,makedev:(ma,mi)=>ma<<8|mi,registerDevice(dev,ops){FS.devices[dev]={stream_ops:ops}},getDevice:dev=>FS.devices[dev],getMounts(mount){var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push(...m.mounts)}return mounts},syncfs(populate,callback){if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err(`warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`)}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}for(var mount of mounts){if(mount.type.syncfs){mount.type.syncfs(mount,populate,done)}else{done(null)}}},mount(type,opts,mountpoint){var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}}var mount={type,opts,mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot},unmount(mountpoint){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(28)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);for(var[hash,current]of Object.entries(FS.nameTable)){while(current){var next=current.name_next;if(mounts.includes(current.mount)){FS.destroyNode(current)}current=next}}node.mounted=null;var idx=node.mount.mounts.indexOf(mount);node.mount.mounts.splice(idx,1)},lookup(parent,name){return parent.node_ops.lookup(parent,name)},mknod(path,mode,dev){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name){throw new FS.ErrnoError(28)}if(name==="."||name===".."){throw new FS.ErrnoError(20)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},statfs(path){return FS.statfsNode(FS.lookupPath(path,{follow:true}).node)},statfsStream(stream){return FS.statfsNode(stream.node)},statfsNode(node){var rtn={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:FS.nextInode,ffree:FS.nextInode-1,fsid:42,flags:2,namelen:255};if(node.node_ops.statfs){Object.assign(rtn,node.node_ops.statfs(node.mount.opts.root))}return rtn},create(path,mode=438){mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir(path,mode=511){mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)},mkdirTree(path,mode){var dirs=path.split("/");var d="";for(var dir of dirs){if(!dir)continue;if(d||PATH.isAbs(path))d+="/";d+=dir;try{FS.mkdir(d,mode)}catch(e){if(e.errno!=20)throw e}}},mkdev(path,mode,dev){if(typeof dev=="undefined"){dev=mode;mode=438}mode|=8192;return FS.mknod(path,mode,dev)},symlink(oldpath,newpath){if(!PATH_FS.resolve(oldpath)){throw new FS.ErrnoError(44)}var lookup=FS.lookupPath(newpath,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var newname=PATH.basename(newpath);var errCode=FS.mayCreate(parent,newname);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.symlink){throw new FS.ErrnoError(63)}return parent.node_ops.symlink(parent,newname,oldpath)},rename(old_path,new_path){var old_dirname=PATH.dirname(old_path);var new_dirname=PATH.dirname(new_path);var old_name=PATH.basename(old_path);var new_name=PATH.basename(new_path);var lookup,old_dir,new_dir;lookup=FS.lookupPath(old_path,{parent:true});old_dir=lookup.node;lookup=FS.lookupPath(new_path,{parent:true});new_dir=lookup.node;if(!old_dir||!new_dir)throw new FS.ErrnoError(44);if(old_dir.mount!==new_dir.mount){throw new FS.ErrnoError(75)}var old_node=FS.lookupNode(old_dir,old_name);var relative=PATH_FS.relative(old_path,new_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(28)}relative=PATH_FS.relative(new_path,old_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(55)}var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(old_node===new_node){return}var isdir=FS.isDir(old_node.mode);var errCode=FS.mayDelete(old_dir,old_name,isdir);if(errCode){throw new FS.ErrnoError(errCode)}errCode=new_node?FS.mayDelete(new_dir,new_name,isdir):FS.mayCreate(new_dir,new_name);if(errCode){throw new FS.ErrnoError(errCode)}if(!old_dir.node_ops.rename){throw new FS.ErrnoError(63)}if(FS.isMountpoint(old_node)||new_node&&FS.isMountpoint(new_node)){throw new FS.ErrnoError(10)}if(new_dir!==old_dir){errCode=FS.nodePermissions(old_dir,"w");if(errCode){throw new FS.ErrnoError(errCode)}}FS.hashRemoveNode(old_node);try{old_dir.node_ops.rename(old_node,new_dir,new_name);old_node.parent=new_dir}catch(e){throw e}finally{FS.hashAddNode(old_node)}},rmdir(path){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,true);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.rmdir){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.rmdir(parent,name);FS.destroyNode(node)},readdir(path){var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;var readdir=FS.checkOpExists(node.node_ops.readdir,54);return readdir(node)},unlink(path){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,false);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.unlink){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.unlink(parent,name);FS.destroyNode(node)},readlink(path){var lookup=FS.lookupPath(path);var link=lookup.node;if(!link){throw new FS.ErrnoError(44)}if(!link.node_ops.readlink){throw new FS.ErrnoError(28)}return link.node_ops.readlink(link)},stat(path,dontFollow){var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;var getattr=FS.checkOpExists(node.node_ops.getattr,63);return getattr(node)},fstat(fd){var stream=FS.getStreamChecked(fd);var node=stream.node;var getattr=stream.stream_ops.getattr;var arg=getattr?stream:node;getattr??=node.node_ops.getattr;FS.checkOpExists(getattr,63);return getattr(arg)},lstat(path){return FS.stat(path,true)},doChmod(stream,node,mode,dontFollow){FS.doSetAttr(stream,node,{mode:mode&4095|node.mode&~4095,ctime:Date.now(),dontFollow})},chmod(path,mode,dontFollow){var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}FS.doChmod(null,node,mode,dontFollow)},lchmod(path,mode){FS.chmod(path,mode,true)},fchmod(fd,mode){var stream=FS.getStreamChecked(fd);FS.doChmod(stream,stream.node,mode,false)},doChown(stream,node,dontFollow){FS.doSetAttr(stream,node,{timestamp:Date.now(),dontFollow})},chown(path,uid,gid,dontFollow){var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}FS.doChown(null,node,dontFollow)},lchown(path,uid,gid){FS.chown(path,uid,gid,true)},fchown(fd,uid,gid){var stream=FS.getStreamChecked(fd);FS.doChown(stream,stream.node,false)},doTruncate(stream,node,len){if(FS.isDir(node.mode)){throw new FS.ErrnoError(31)}if(!FS.isFile(node.mode)){throw new FS.ErrnoError(28)}var errCode=FS.nodePermissions(node,"w");if(errCode){throw new FS.ErrnoError(errCode)}FS.doSetAttr(stream,node,{size:len,timestamp:Date.now()})},truncate(path,len){if(len<0){throw new FS.ErrnoError(28)}var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:true});node=lookup.node}else{node=path}FS.doTruncate(null,node,len)},ftruncate(fd,len){var stream=FS.getStreamChecked(fd);if(len<0||(stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.doTruncate(stream,stream.node,len)},utime(path,atime,mtime){var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;var setattr=FS.checkOpExists(node.node_ops.setattr,63);setattr(node,{atime,mtime})},open(path,flags,mode=438){if(path===""){throw new FS.ErrnoError(44)}flags=FS_modeStringToFlags(flags);if(flags&64){mode=mode&4095|32768}else{mode=0}var node;var isDirPath;if(typeof path=="object"){node=path}else{isDirPath=path.endsWith("/");var lookup=FS.lookupPath(path,{follow:!(flags&131072),noent_okay:true});node=lookup.node;path=lookup.path}var created=false;if(flags&64){if(node){if(flags&128){throw new FS.ErrnoError(20)}}else if(isDirPath){throw new FS.ErrnoError(31)}else{node=FS.mknod(path,mode|511,0);created=true}}if(!node){throw new FS.ErrnoError(44)}if(FS.isChrdev(node.mode)){flags&=~512}if(flags&65536&&!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}if(!created){var errCode=FS.mayOpen(node,flags);if(errCode){throw new FS.ErrnoError(errCode)}}if(flags&512&&!created){FS.truncate(node,0)}flags&=~(128|512|131072);var stream=FS.createStream({node,path:FS.getPath(node),flags,seekable:true,position:0,stream_ops:node.stream_ops,ungotten:[],error:false});if(stream.stream_ops.open){stream.stream_ops.open(stream)}if(created){FS.chmod(node,mode&511)}return stream},close(stream){if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed(stream){return stream.fd===null},llseek(stream,offset,whence){if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70)}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position},read(stream,buffer,offset,length,position){if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.read){throw new FS.ErrnoError(28)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write(stream,buffer,offset,length,position,canOwn){if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.write){throw new FS.ErrnoError(28)}if(stream.seekable&&stream.flags&1024){FS.llseek(stream,0,2)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesWritten=stream.stream_ops.write(stream,buffer,offset,length,position,canOwn);if(!seeking)stream.position+=bytesWritten;return bytesWritten},mmap(stream,length,position,prot,flags){if((prot&2)!==0&&(flags&2)===0&&(stream.flags&2097155)!==2){throw new FS.ErrnoError(2)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(2)}if(!stream.stream_ops.mmap){throw new FS.ErrnoError(43)}if(!length){throw new FS.ErrnoError(28)}return stream.stream_ops.mmap(stream,length,position,prot,flags)},msync(stream,buffer,offset,length,mmapFlags){if(!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},ioctl(stream,cmd,arg){if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile(path,opts={}){opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){abort(`Invalid encoding type "${opts.encoding}"`)}var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){buf=UTF8ArrayToString(buf)}FS.close(stream);return buf},writeFile(path,data,opts={}){opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);data=FS_fileDataToTypedArray(data);FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn);FS.close(stream)},cwd:()=>FS.currentPath,chdir(path){var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories(){FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices(){FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length,llseek:()=>0});FS.mkdev("/dev/null",FS.makedev(1,3));TTY.register(FS.makedev(5,0),TTY.default_tty_ops);TTY.register(FS.makedev(6,0),TTY.default_tty1_ops);FS.mkdev("/dev/tty",FS.makedev(5,0));FS.mkdev("/dev/tty1",FS.makedev(6,0));var randomBuffer=new Uint8Array(1024),randomLeft=0;var randomByte=()=>{if(randomLeft===0){randomFill(randomBuffer);randomLeft=randomBuffer.byteLength}return randomBuffer[--randomLeft]};FS.createDevice("/dev","random",randomByte);FS.createDevice("/dev","urandom",randomByte);FS.mkdir("/dev/shm");FS.mkdir("/dev/shm/tmp")},createSpecialDirectories(){FS.mkdir("/proc");var proc_self=FS.mkdir("/proc/self");FS.mkdir("/proc/self/fd");FS.mount({mount(){var node=FS.createNode(proc_self,"fd",16895,73);node.stream_ops={llseek:MEMFS.stream_ops.llseek};node.node_ops={lookup(parent,name){var fd=+name;var stream=FS.getStreamChecked(fd);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path},id:fd+1};ret.parent=ret;return ret},readdir(){return Array.from(FS.streams.entries()).filter(([k,v])=>v).map(([k,v])=>k.toString())}};return node}},{},"/proc/self/fd")},createStandardStreams(input,output,error){if(input){FS.createDevice("/dev","stdin",input)}else{FS.symlink("/dev/tty","/dev/stdin")}if(output){FS.createDevice("/dev","stdout",null,output)}else{FS.symlink("/dev/tty","/dev/stdout")}if(error){FS.createDevice("/dev","stderr",null,error)}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1)},staticInit(){FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={MEMFS}},init(input,output,error){FS.initialized=true;input??=Module["stdin"];output??=Module["stdout"];error??=Module["stderr"];FS.createStandardStreams(input,output,error)},quit(){FS.initialized=false;for(var stream of FS.streams){if(stream){FS.close(stream)}}},findObject(path,dontResolveLastLink){var ret=FS.analyzePath(path,dontResolveLastLink);if(!ret.exists){return null}return ret.object},analyzePath(path,dontResolveLastLink){try{var lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});path=lookup.path}catch(e){}var ret={isRoot:false,exists:false,error:0,name:null,path:null,object:null,parentExists:false,parentPath:null,parentObject:null};try{var lookup=FS.lookupPath(path,{parent:true});ret.parentExists=true;ret.parentPath=lookup.path;ret.parentObject=lookup.node;ret.name=PATH.basename(path);lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});ret.exists=true;ret.path=lookup.path;ret.object=lookup.node;ret.name=lookup.node.name;ret.isRoot=lookup.path==="/"}catch(e){ret.error=e.errno}return ret},createPath(parent,path,canRead,canWrite){parent=typeof parent=="string"?parent:FS.getPath(parent);var parts=path.split("/").reverse();while(parts.length){var part=parts.pop();if(!part)continue;var current=PATH.join2(parent,part);try{FS.mkdir(current)}catch(e){if(e.errno!=20)throw e}parent=current}return current},createFile(parent,name,properties,canRead,canWrite){var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS_getMode(canRead,canWrite);return FS.create(path,mode)},createDataFile(parent,name,data,canRead,canWrite,canOwn){var path=name;if(parent){parent=typeof parent=="string"?parent:FS.getPath(parent);path=name?PATH.join2(parent,name):parent}var mode=FS_getMode(canRead,canWrite);var node=FS.create(path,mode);if(data){data=FS_fileDataToTypedArray(data);FS.chmod(node,mode|146);var stream=FS.open(node,577);FS.write(stream,data,0,data.length,0,canOwn);FS.close(stream);FS.chmod(node,mode)}},createDevice(parent,name,input,output){var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS_getMode(!!input,!!output);FS.createDevice.major??=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open(stream){stream.seekable=false},close(stream){if(output?.buffer?.length){output(10)}},read(stream,buffer,offset,length,pos){var bytesRead=0;for(var i=0;i<length;i++){var result;try{result=input()}catch(e){throw new FS.ErrnoError(29)}if(result===undefined&&bytesRead===0){throw new FS.ErrnoError(6)}if(result===null||result===undefined)break;bytesRead++;buffer[offset+i]=result}if(bytesRead){stream.node.atime=Date.now()}return bytesRead},write(stream,buffer,offset,length,pos){for(var i=0;i<length;i++){try{output(buffer[offset+i])}catch(e){throw new FS.ErrnoError(29)}}if(length){stream.node.mtime=stream.node.ctime=Date.now()}return i}});return FS.mkdev(path,mode,dev)},forceLoadFile(obj){if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(globalThis.XMLHttpRequest){abort("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{obj.contents=readBinary(obj.url)}catch(e){throw new FS.ErrnoError(29)}}},createLazyFile(parent,name,url,canRead,canWrite){class LazyUint8Array{lengthKnown=false;chunks=[];get(idx){if(idx>this.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]}setDataGetter(getter){this.getter=getter}cacheLength(){var xhr=new XMLHttpRequest;xhr.open("HEAD",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))abort("Couldn't load "+url+". Status: "+xhr.status);var datalength=Number(xhr.getResponseHeader("Content-length"));var header;var hasByteServing=(header=xhr.getResponseHeader("Accept-Ranges"))&&header==="bytes";var usesGzip=(header=xhr.getResponseHeader("Content-Encoding"))&&header==="gzip";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=(from,to)=>{if(from>to)abort("invalid range ("+from+", "+to+") or no bytes requested!");if(to>datalength-1)abort("only "+datalength+" bytes available! programmer error!");var xhr=new XMLHttpRequest;xhr.open("GET",url,false);if(datalength!==chunkSize)xhr.setRequestHeader("Range","bytes="+from+"-"+to);xhr.responseType="arraybuffer";if(xhr.overrideMimeType){xhr.overrideMimeType("text/plain; charset=x-user-defined")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))abort("Couldn't load "+url+". Status: "+xhr.status);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}return intArrayFromString(xhr.responseText||"",true)};var lazyArray=this;lazyArray.setDataGetter(chunkNum=>{var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]=="undefined"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]=="undefined")abort("doXHR failed!");return lazyArray.chunks[chunkNum]});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;out("LazyFiles on gzip forces download of the whole file when length is accessed")}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true}get length(){if(!this.lengthKnown){this.cacheLength()}return this._length}get chunkSize(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}if(globalThis.XMLHttpRequest){if(!ENVIRONMENT_IS_WORKER)abort("Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc");var lazyArray=new LazyUint8Array;var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}});var stream_ops={};for(const[key,fn]of Object.entries(node.stream_ops)){stream_ops[key]=(...args)=>{FS.forceLoadFile(node);return fn(...args)}}function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i<size;i++){buffer[offset+i]=contents[position+i]}}else{for(var i=0;i<size;i++){buffer[offset+i]=contents.get(position+i)}}return size}stream_ops.read=(stream,buffer,offset,length,position)=>{FS.forceLoadFile(node);return writeChunks(stream,buffer,offset,length,position)};stream_ops.mmap=(stream,length,position,prot,flags)=>{FS.forceLoadFile(node);var ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}writeChunks(stream,HEAP8,ptr,length,position);return{ptr,allocated:true}};node.stream_ops=stream_ops;return node}};var SYSCALLS={currentUmask:18,calculateAt(dirfd,path,allowEmpty){if(PATH.isAbs(path)){return path}var dir;if(dirfd===-100){dir=FS.cwd()}else{var dirstream=SYSCALLS.getStreamFromFD(dirfd);dir=dirstream.path}if(path.length==0){if(!allowEmpty){throw new FS.ErrnoError(44)}return dir}return dir+"/"+path},writeStat(buf,stat){HEAPU32[buf>>2]=stat.dev;HEAPU32[buf+4>>2]=stat.mode;HEAPU32[buf+8>>2]=stat.nlink;HEAPU32[buf+12>>2]=stat.uid;HEAPU32[buf+16>>2]=stat.gid;HEAPU32[buf+20>>2]=stat.rdev;HEAP64[buf+24>>3]=BigInt(stat.size);HEAP32[buf+32>>2]=4096;HEAP32[buf+36>>2]=stat.blocks;var atime=stat.atime.getTime();var mtime=stat.mtime.getTime();var ctime=stat.ctime.getTime();HEAP64[buf+40>>3]=BigInt(Math.floor(atime/1e3));HEAPU32[buf+48>>2]=atime%1e3*1e3*1e3;HEAP64[buf+56>>3]=BigInt(Math.floor(mtime/1e3));HEAPU32[buf+64>>2]=mtime%1e3*1e3*1e3;HEAP64[buf+72>>3]=BigInt(Math.floor(ctime/1e3));HEAPU32[buf+80>>2]=ctime%1e3*1e3*1e3;HEAP64[buf+88>>3]=BigInt(stat.ino);return 0},writeStatFs(buf,stats){HEAPU32[buf+4>>2]=stats.bsize;HEAPU32[buf+60>>2]=stats.bsize;HEAP64[buf+8>>3]=BigInt(stats.blocks);HEAP64[buf+16>>3]=BigInt(stats.bfree);HEAP64[buf+24>>3]=BigInt(stats.bavail);HEAP64[buf+32>>3]=BigInt(stats.files);HEAP64[buf+40>>3]=BigInt(stats.ffree);HEAPU32[buf+48>>2]=stats.fsid;HEAPU32[buf+64>>2]=stats.flags;HEAPU32[buf+56>>2]=stats.namelen},doMsync(addr,stream,len,flags,offset){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}if(flags&2){return 0}var buffer=HEAPU8.slice(addr,addr+len);FS.msync(stream,buffer,offset,len,flags)},getStreamFromFD(fd){var stream=FS.getStreamChecked(fd);return stream},varargs:undefined,getStr(ptr){var ret=UTF8ToString(ptr);return ret}};function ___syscall_faccessat(dirfd,path,amode,flags){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);if(amode&~7){return-28}var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;if(!node){return-44}var perms="";if(amode&4)perms+="r";if(amode&2)perms+="w";if(amode&1)perms+="x";if(perms&&FS.nodePermissions(node,perms)){return-2}return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var syscallGetVarargI=()=>{var ret=HEAP32[+SYSCALLS.varargs>>2];SYSCALLS.varargs+=4;return ret};var syscallGetVarargP=syscallGetVarargI;function ___syscall_fcntl64(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=syscallGetVarargI();if(arg<0){return-28}while(FS.streams[arg]){arg++}var newStream;newStream=FS.dupStream(stream,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=syscallGetVarargI();var mask=289792;stream.flags=stream.flags&~mask|arg&mask;return 0}case 12:{var arg=syscallGetVarargP();var offset=0;HEAP16[arg+offset>>1]=2;return 0}case 13:case 14:return 0}return-28}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);function ___syscall_getcwd(buf,size){try{if(size===0)return-28;var cwd=FS.cwd();var cwdLengthInBytes=lengthBytesUTF8(cwd)+1;if(size<cwdLengthInBytes)return-68;stringToUTF8(cwd,buf,size);return cwdLengthInBytes}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_ioctl(fd,op,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(op){case 21509:{if(!stream.tty)return-59;return 0}case 21505:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tcgets){var termios=stream.tty.ops.ioctl_tcgets(stream);var argp=syscallGetVarargP();HEAP32[argp>>2]=termios.c_iflag||0;HEAP32[argp+4>>2]=termios.c_oflag||0;HEAP32[argp+8>>2]=termios.c_cflag||0;HEAP32[argp+12>>2]=termios.c_lflag||0;for(var i=0;i<32;i++){HEAP8[argp+i+17]=termios.c_cc[i]||0}return 0}return 0}case 21510:case 21511:case 21512:{if(!stream.tty)return-59;return 0}case 21506:case 21507:case 21508:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tcsets){var argp=syscallGetVarargP();var c_iflag=HEAP32[argp>>2];var c_oflag=HEAP32[argp+4>>2];var c_cflag=HEAP32[argp+8>>2];var c_lflag=HEAP32[argp+12>>2];var c_cc=[];for(var i=0;i<32;i++){c_cc.push(HEAP8[argp+i+17])}return stream.tty.ops.ioctl_tcsets(stream.tty,op,{c_iflag,c_oflag,c_cflag,c_lflag,c_cc})}return 0}case 21519:{if(!stream.tty)return-59;var argp=syscallGetVarargP();HEAP32[argp>>2]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21537:case 21531:{var argp=syscallGetVarargP();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tiocgwinsz){var winsize=stream.tty.ops.ioctl_tiocgwinsz(stream.tty);var argp=syscallGetVarargP();HEAP16[argp>>1]=winsize[0];HEAP16[argp+2>>1]=winsize[1]}return 0}case 21524:{if(!stream.tty)return-59;return 0}case 21515:{if(!stream.tty)return-59;return 0}default:return-28}}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?syscallGetVarargI():0;if(flags&64){mode&=~SYSCALLS.currentUmask}return FS.open(path,flags,mode).fd}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var _emscripten_get_now=()=>performance.now();var _emscripten_date_now=()=>Date.now();var nowIsMonotonic=1;var checkWasiClock=clock_id=>clock_id>=0&&clock_id<=3;var INT53_MAX=9007199254740992;var INT53_MIN=-9007199254740992;var bigintToI53Checked=num=>num<INT53_MIN||num>INT53_MAX?NaN:Number(num);function _clock_time_get(clk_id,ignored_precision,ptime){ignored_precision=bigintToI53Checked(ignored_precision);if(!checkWasiClock(clk_id)){return 28}var now;if(clk_id===0){now=_emscripten_date_now()}else if(nowIsMonotonic){now=_emscripten_get_now()}else{return 52}var nsec=Math.round(now*1e3*1e3);HEAP64[ptime>>3]=BigInt(nsec);return 0}var readEmAsmArgsArray=[];var readEmAsmArgs=(sigPtr,buf)=>{readEmAsmArgsArray.length=0;var ch;while(ch=HEAPU8[sigPtr++]){var wide=ch!=105;wide&=ch!=112;buf+=wide&&buf%8?4:0;readEmAsmArgsArray.push(ch==112?HEAPU32[buf>>2]:ch==106?HEAP64[buf>>3]:ch==105?HEAP32[buf>>2]:HEAPF64[buf>>3]);buf+=wide?8:4}return readEmAsmArgsArray};var runEmAsmFunction=(code,sigPtr,argbuf)=>{var args=readEmAsmArgs(sigPtr,argbuf);return ASM_CONSTS[code](...args)};var _emscripten_asm_const_double=(code,sigPtr,argbuf)=>runEmAsmFunction(code,sigPtr,argbuf);var _emscripten_asm_const_int=(code,sigPtr,argbuf)=>runEmAsmFunction(code,sigPtr,argbuf);var maybeCStringToJsString=cString=>cString>2?UTF8ToString(cString):cString;var specialHTMLTargets=[0,globalThis.document??0,globalThis.window??0];var findEventTarget=target=>{target=maybeCStringToJsString(target);var domElement=specialHTMLTargets[target]||globalThis.document?.querySelector(target);return domElement};var getBoundingClientRect=e=>specialHTMLTargets.indexOf(e)<0?e.getBoundingClientRect():{left:0,top:0};var _emscripten_get_element_css_size=(target,width,height)=>{target=findEventTarget(target);if(!target)return-4;var rect=getBoundingClientRect(target);HEAPF64[width>>3]=rect.width;HEAPF64[height>>3]=rect.height;return 0};var JSEvents={removeAllEventListeners(){while(JSEvents.eventHandlers.length){JSEvents._removeHandler(JSEvents.eventHandlers.length-1)}JSEvents.deferredCalls=[]},inEventHandler:0,deferredCalls:[],deferCall(targetFunction,precedence,argsList){function arraysHaveEqualContent(arrA,arrB){if(arrA.length!=arrB.length)return false;for(var i in arrA){if(arrA[i]!=arrB[i])return false}return true}for(var call of JSEvents.deferredCalls){if(call.targetFunction==targetFunction&&arraysHaveEqualContent(call.argsList,argsList)){return}}JSEvents.deferredCalls.push({targetFunction,precedence,argsList});JSEvents.deferredCalls.sort((x,y)=>x.precedence-y.precedence)},removeDeferredCalls(targetFunction){JSEvents.deferredCalls=JSEvents.deferredCalls.filter(call=>call.targetFunction!=targetFunction)},canPerformEventHandlerRequests(){if(navigator.userActivation){return navigator.userActivation.isActive}return JSEvents.inEventHandler&&JSEvents.currentEventHandler.allowsDeferredCalls},runDeferredCalls(){if(!JSEvents.canPerformEventHandlerRequests()){return}var deferredCalls=JSEvents.deferredCalls;JSEvents.deferredCalls=[];for(var call of deferredCalls){call.targetFunction(...call.argsList)}},eventHandlers:[],removeAllHandlersOnTarget:(target,eventTypeString)=>{for(var i=0;i<JSEvents.eventHandlers.length;++i){if(JSEvents.eventHandlers[i].target==target&&(!eventTypeString||eventTypeString==JSEvents.eventHandlers[i].eventTypeString)){JSEvents._removeHandler(i--)}}},_removeHandler(i){var h=JSEvents.eventHandlers[i];h.target.removeEventListener(h.eventTypeString,h.eventListenerFunc,h.useCapture);JSEvents.eventHandlers.splice(i,1)},registerOrRemoveHandler(eventHandler){if(!eventHandler.target){return-4}if(eventHandler.callbackfunc){eventHandler.eventListenerFunc=function(event){++JSEvents.inEventHandler;JSEvents.currentEventHandler=eventHandler;JSEvents.runDeferredCalls();eventHandler.handlerFunc(event);JSEvents.runDeferredCalls();--JSEvents.inEventHandler};eventHandler.target.addEventListener(eventHandler.eventTypeString,eventHandler.eventListenerFunc,eventHandler.useCapture);JSEvents.eventHandlers.push(eventHandler)}else{for(var i=0;i<JSEvents.eventHandlers.length;++i){if(JSEvents.eventHandlers[i].target==eventHandler.target&&JSEvents.eventHandlers[i].eventTypeString==eventHandler.eventTypeString){JSEvents._removeHandler(i--)}}}return 0},removeSingleHandler(eventHandler){let success=false;for(let i=0;i<JSEvents.eventHandlers.length;++i){const handler=JSEvents.eventHandlers[i];if(handler.target===eventHandler.target&&handler.eventTypeId===eventHandler.eventTypeId&&handler.callbackfunc===eventHandler.callbackfunc&&handler.userData===eventHandler.userData){JSEvents._removeHandler(i--);success=true}}return success?0:-5},getNodeNameForTarget(target){if(!target)return"";if(target==window)return"#window";if(target==screen)return"#screen";return target?.nodeName||""},fullscreenEnabled(){return document.fullscreenEnabled||document.webkitFullscreenEnabled}};var fillGamepadEventData=(eventStruct,e)=>{HEAPF64[eventStruct>>3]=e.timestamp;for(var i=0;i<e.axes.length;++i){HEAPF64[eventStruct+i*8+16>>3]=e.axes[i]}for(var i=0;i<e.buttons.length;++i){if(typeof e.buttons[i]=="object"){HEAPF64[eventStruct+i*8+528>>3]=e.buttons[i].value}else{HEAPF64[eventStruct+i*8+528>>3]=e.buttons[i]}}for(var i=0;i<e.buttons.length;++i){if(typeof e.buttons[i]=="object"){HEAP8[eventStruct+i+1040]=e.buttons[i].pressed}else{HEAP8[eventStruct+i+1040]=e.buttons[i]==1}}HEAP8[eventStruct+1104]=e.connected;HEAP32[eventStruct+1108>>2]=e.index;HEAP32[eventStruct+8>>2]=e.axes.length;HEAP32[eventStruct+12>>2]=e.buttons.length;stringToUTF8(e.id,eventStruct+1112,64);stringToUTF8(e.mapping,eventStruct+1176,64)};var _emscripten_get_gamepad_status=(index,gamepadState)=>{if(index<0||index>=JSEvents.lastGamepadState.length)return-5;if(!JSEvents.lastGamepadState[index])return-7;fillGamepadEventData(gamepadState,JSEvents.lastGamepadState[index]);return 0};var _emscripten_get_num_gamepads=()=>JSEvents.lastGamepadState.length;var GLctx;var webgl_enable_ANGLE_instanced_arrays=ctx=>{var ext=ctx.getExtension("ANGLE_instanced_arrays");if(ext){ctx["vertexAttribDivisor"]=(index,divisor)=>ext["vertexAttribDivisorANGLE"](index,divisor);ctx["drawArraysInstanced"]=(mode,first,count,primcount)=>ext["drawArraysInstancedANGLE"](mode,first,count,primcount);ctx["drawElementsInstanced"]=(mode,count,type,indices,primcount)=>ext["drawElementsInstancedANGLE"](mode,count,type,indices,primcount);return 1}};var webgl_enable_OES_vertex_array_object=ctx=>{var ext=ctx.getExtension("OES_vertex_array_object");if(ext){ctx["createVertexArray"]=()=>ext["createVertexArrayOES"]();ctx["deleteVertexArray"]=vao=>ext["deleteVertexArrayOES"](vao);ctx["bindVertexArray"]=vao=>ext["bindVertexArrayOES"](vao);ctx["isVertexArray"]=vao=>ext["isVertexArrayOES"](vao);return 1}};var webgl_enable_WEBGL_draw_buffers=ctx=>{var ext=ctx.getExtension("WEBGL_draw_buffers");if(ext){ctx["drawBuffers"]=(n,bufs)=>ext["drawBuffersWEBGL"](n,bufs);return 1}};var webgl_enable_EXT_polygon_offset_clamp=ctx=>!!(ctx.extPolygonOffsetClamp=ctx.getExtension("EXT_polygon_offset_clamp"));var webgl_enable_EXT_clip_control=ctx=>!!(ctx.extClipControl=ctx.getExtension("EXT_clip_control"));var webgl_enable_WEBGL_polygon_mode=ctx=>!!(ctx.webglPolygonMode=ctx.getExtension("WEBGL_polygon_mode"));var webgl_enable_WEBGL_multi_draw=ctx=>!!(ctx.multiDrawWebgl=ctx.getExtension("WEBGL_multi_draw"));var getEmscriptenSupportedExtensions=ctx=>{var supportedExtensions=["ANGLE_instanced_arrays","EXT_blend_minmax","EXT_disjoint_timer_query","EXT_frag_depth","EXT_shader_texture_lod","EXT_sRGB","OES_element_index_uint","OES_fbo_render_mipmap","OES_standard_derivatives","OES_texture_float","OES_texture_half_float","OES_texture_half_float_linear","OES_vertex_array_object","WEBGL_color_buffer_float","WEBGL_depth_texture","WEBGL_draw_buffers","EXT_clip_control","EXT_color_buffer_half_float","EXT_depth_clamp","EXT_float_blend","EXT_polygon_offset_clamp","EXT_texture_compression_bptc","EXT_texture_compression_rgtc","EXT_texture_filter_anisotropic","KHR_parallel_shader_compile","OES_texture_float_linear","WEBGL_blend_func_extended","WEBGL_compressed_texture_astc","WEBGL_compressed_texture_etc","WEBGL_compressed_texture_etc1","WEBGL_compressed_texture_s3tc","WEBGL_compressed_texture_s3tc_srgb","WEBGL_debug_renderer_info","WEBGL_debug_shaders","WEBGL_lose_context","WEBGL_multi_draw","WEBGL_polygon_mode"];return(ctx.getSupportedExtensions()||[]).filter(ext=>supportedExtensions.includes(ext))};var GL={counter:1,buffers:[],programs:[],framebuffers:[],renderbuffers:[],textures:[],shaders:[],vaos:[],contexts:[],offscreenCanvases:{},queries:[],stringCache:{},unpackAlignment:4,unpackRowLength:0,recordError:errorCode=>{if(!GL.lastError){GL.lastError=errorCode}},getNewId:table=>{var ret=GL.counter++;for(var i=table.length;i<ret;i++){table[i]=null}return ret},genObject:(n,buffers,createFunction,objectTable)=>{for(var i=0;i<n;i++){var buffer=GLctx[createFunction]();var id=buffer&&GL.getNewId(objectTable);if(buffer){buffer.name=id;objectTable[id]=buffer}else{GL.recordError(1282)}HEAP32[buffers+i*4>>2]=id}},getSource:(shader,count,string,length)=>{var source="";for(var i=0;i<count;++i){var len=length?HEAPU32[length+i*4>>2]:undefined;source+=UTF8ToString(HEAPU32[string+i*4>>2],len)}return source},createContext:(canvas,webGLContextAttributes)=>{if(!canvas.getContextSafariWebGL2Fixed){canvas.getContextSafariWebGL2Fixed=canvas.getContext;function fixedGetContext(ver,attrs){var gl=canvas.getContextSafariWebGL2Fixed(ver,attrs);return ver=="webgl"==gl instanceof WebGLRenderingContext?gl:null}canvas.getContext=fixedGetContext}var ctx=canvas.getContext("webgl",webGLContextAttributes);if(!ctx)return 0;var handle=GL.registerContext(ctx,webGLContextAttributes);return handle},registerContext:(ctx,webGLContextAttributes)=>{var handle=GL.getNewId(GL.contexts);var context={handle,attributes:webGLContextAttributes,version:webGLContextAttributes.majorVersion,GLctx:ctx};if(ctx.canvas)ctx.canvas.GLctxObject=context;GL.contexts[handle]=context;if(typeof webGLContextAttributes.enableExtensionsByDefault=="undefined"||webGLContextAttributes.enableExtensionsByDefault){GL.initExtensions(context)}return handle},makeContextCurrent:contextHandle=>{GL.currentContext=GL.contexts[contextHandle];Module["ctx"]=GLctx=GL.currentContext?.GLctx;return!(contextHandle&&!GLctx)},getContext:contextHandle=>GL.contexts[contextHandle],deleteContext:contextHandle=>{if(GL.currentContext===GL.contexts[contextHandle]){GL.currentContext=null}if(typeof JSEvents=="object"){JSEvents.removeAllHandlersOnTarget(GL.contexts[contextHandle].GLctx.canvas)}if(GL.contexts[contextHandle]?.GLctx.canvas){GL.contexts[contextHandle].GLctx.canvas.GLctxObject=undefined}GL.contexts[contextHandle]=null},initExtensions:context=>{context||=GL.currentContext;if(context.initExtensionsDone)return;context.initExtensionsDone=true;var GLctx=context.GLctx;webgl_enable_WEBGL_multi_draw(GLctx);webgl_enable_EXT_polygon_offset_clamp(GLctx);webgl_enable_EXT_clip_control(GLctx);webgl_enable_WEBGL_polygon_mode(GLctx);webgl_enable_ANGLE_instanced_arrays(GLctx);webgl_enable_OES_vertex_array_object(GLctx);webgl_enable_WEBGL_draw_buffers(GLctx);{GLctx.disjointTimerQueryExt=GLctx.getExtension("EXT_disjoint_timer_query")}for(var ext of getEmscriptenSupportedExtensions(GLctx)){if(!ext.includes("lose_context")&&!ext.includes("debug")){GLctx.getExtension(ext)}}}};var _emscripten_glActiveTexture=x0=>GLctx.activeTexture(x0);var _emscripten_glAttachShader=(program,shader)=>{GLctx.attachShader(GL.programs[program],GL.shaders[shader])};var _emscripten_glBeginQueryEXT=(target,id)=>{GLctx.disjointTimerQueryExt["beginQueryEXT"](target,GL.queries[id])};var _emscripten_glBindAttribLocation=(program,index,name)=>{GLctx.bindAttribLocation(GL.programs[program],index,UTF8ToString(name))};var _emscripten_glBindBuffer=(target,buffer)=>{GLctx.bindBuffer(target,GL.buffers[buffer])};var _emscripten_glBindFramebuffer=(target,framebuffer)=>{GLctx.bindFramebuffer(target,GL.framebuffers[framebuffer])};var _emscripten_glBindRenderbuffer=(target,renderbuffer)=>{GLctx.bindRenderbuffer(target,GL.renderbuffers[renderbuffer])};var _emscripten_glBindTexture=(target,texture)=>{GLctx.bindTexture(target,GL.textures[texture])};var _emscripten_glBindVertexArray=vao=>{GLctx.bindVertexArray(GL.vaos[vao])};var _glBindVertexArray=_emscripten_glBindVertexArray;var _emscripten_glBindVertexArrayOES=_glBindVertexArray;var _emscripten_glBlendColor=(x0,x1,x2,x3)=>GLctx.blendColor(x0,x1,x2,x3);var _emscripten_glBlendEquation=x0=>GLctx.blendEquation(x0);var _emscripten_glBlendEquationSeparate=(x0,x1)=>GLctx.blendEquationSeparate(x0,x1);var _emscripten_glBlendFunc=(x0,x1)=>GLctx.blendFunc(x0,x1);var _emscripten_glBlendFuncSeparate=(x0,x1,x2,x3)=>GLctx.blendFuncSeparate(x0,x1,x2,x3);var _emscripten_glBufferData=(target,size,data,usage)=>{GLctx.bufferData(target,data?HEAPU8.subarray(data,data+size):size,usage)};var _emscripten_glBufferSubData=(target,offset,size,data)=>{GLctx.bufferSubData(target,offset,HEAPU8.subarray(data,data+size))};var _emscripten_glCheckFramebufferStatus=x0=>GLctx.checkFramebufferStatus(x0);var _emscripten_glClear=x0=>GLctx.clear(x0);var _emscripten_glClearColor=(x0,x1,x2,x3)=>GLctx.clearColor(x0,x1,x2,x3);var _emscripten_glClearDepthf=x0=>GLctx.clearDepth(x0);var _emscripten_glClearStencil=x0=>GLctx.clearStencil(x0);var _emscripten_glClipControlEXT=(origin,depth)=>{GLctx.extClipControl["clipControlEXT"](origin,depth)};var _emscripten_glColorMask=(red,green,blue,alpha)=>{GLctx.colorMask(!!red,!!green,!!blue,!!alpha)};var _emscripten_glCompileShader=shader=>{GLctx.compileShader(GL.shaders[shader])};var _emscripten_glCompressedTexImage2D=(target,level,internalFormat,width,height,border,imageSize,data)=>{GLctx.compressedTexImage2D(target,level,internalFormat,width,height,border,HEAPU8.subarray(data,data+imageSize))};var _emscripten_glCompressedTexSubImage2D=(target,level,xoffset,yoffset,width,height,format,imageSize,data)=>{GLctx.compressedTexSubImage2D(target,level,xoffset,yoffset,width,height,format,HEAPU8.subarray(data,data+imageSize))};var _emscripten_glCopyTexImage2D=(x0,x1,x2,x3,x4,x5,x6,x7)=>GLctx.copyTexImage2D(x0,x1,x2,x3,x4,x5,x6,x7);var _emscripten_glCopyTexSubImage2D=(x0,x1,x2,x3,x4,x5,x6,x7)=>GLctx.copyTexSubImage2D(x0,x1,x2,x3,x4,x5,x6,x7);var _emscripten_glCreateProgram=()=>{var id=GL.getNewId(GL.programs);var program=GLctx.createProgram();program.name=id;program.maxUniformLength=program.maxAttributeLength=program.maxUniformBlockNameLength=0;program.uniformIdCounter=1;GL.programs[id]=program;return id};var _emscripten_glCreateShader=shaderType=>{var id=GL.getNewId(GL.shaders);GL.shaders[id]=GLctx.createShader(shaderType);return id};var _emscripten_glCullFace=x0=>GLctx.cullFace(x0);var _emscripten_glDeleteBuffers=(n,buffers)=>{for(var i=0;i<n;i++){var id=HEAP32[buffers+i*4>>2];var buffer=GL.buffers[id];if(!buffer)continue;GLctx.deleteBuffer(buffer);buffer.name=0;GL.buffers[id]=null}};var _emscripten_glDeleteFramebuffers=(n,framebuffers)=>{for(var i=0;i<n;++i){var id=HEAP32[framebuffers+i*4>>2];var framebuffer=GL.framebuffers[id];if(!framebuffer)continue;GLctx.deleteFramebuffer(framebuffer);framebuffer.name=0;GL.framebuffers[id]=null}};var _emscripten_glDeleteProgram=id=>{if(!id)return;var program=GL.programs[id];if(!program){GL.recordError(1281);return}GLctx.deleteProgram(program);program.name=0;GL.programs[id]=null};var _emscripten_glDeleteQueriesEXT=(n,ids)=>{for(var i=0;i<n;i++){var id=HEAP32[ids+i*4>>2];var query=GL.queries[id];if(!query)continue;GLctx.disjointTimerQueryExt["deleteQueryEXT"](query);GL.queries[id]=null}};var _emscripten_glDeleteRenderbuffers=(n,renderbuffers)=>{for(var i=0;i<n;i++){var id=HEAP32[renderbuffers+i*4>>2];var renderbuffer=GL.renderbuffers[id];if(!renderbuffer)continue;GLctx.deleteRenderbuffer(renderbuffer);renderbuffer.name=0;GL.renderbuffers[id]=null}};var _emscripten_glDeleteShader=id=>{if(!id)return;var shader=GL.shaders[id];if(!shader){GL.recordError(1281);return}GLctx.deleteShader(shader);GL.shaders[id]=null};var _emscripten_glDeleteTextures=(n,textures)=>{for(var i=0;i<n;i++){var id=HEAP32[textures+i*4>>2];var texture=GL.textures[id];if(!texture)continue;GLctx.deleteTexture(texture);texture.name=0;GL.textures[id]=null}};var _emscripten_glDeleteVertexArrays=(n,vaos)=>{for(var i=0;i<n;i++){var id=HEAP32[vaos+i*4>>2];GLctx.deleteVertexArray(GL.vaos[id]);GL.vaos[id]=null}};var _glDeleteVertexArrays=_emscripten_glDeleteVertexArrays;var _emscripten_glDeleteVertexArraysOES=_glDeleteVertexArrays;var _emscripten_glDepthFunc=x0=>GLctx.depthFunc(x0);var _emscripten_glDepthMask=flag=>{GLctx.depthMask(!!flag)};var _emscripten_glDepthRangef=(x0,x1)=>GLctx.depthRange(x0,x1);var _emscripten_glDetachShader=(program,shader)=>{GLctx.detachShader(GL.programs[program],GL.shaders[shader])};var _emscripten_glDisable=x0=>GLctx.disable(x0);var _emscripten_glDisableVertexAttribArray=index=>{GLctx.disableVertexAttribArray(index)};var _emscripten_glDrawArrays=(mode,first,count)=>{GLctx.drawArrays(mode,first,count)};var _emscripten_glDrawArraysInstanced=(mode,first,count,primcount)=>{GLctx.drawArraysInstanced(mode,first,count,primcount)};var _glDrawArraysInstanced=_emscripten_glDrawArraysInstanced;var _emscripten_glDrawArraysInstancedANGLE=_glDrawArraysInstanced;var tempFixedLengthArray=[];var _emscripten_glDrawBuffers=(n,bufs)=>{var bufArray=tempFixedLengthArray[n];for(var i=0;i<n;i++){bufArray[i]=HEAP32[bufs+i*4>>2]}GLctx.drawBuffers(bufArray)};var _glDrawBuffers=_emscripten_glDrawBuffers;var _emscripten_glDrawBuffersWEBGL=_glDrawBuffers;var _emscripten_glDrawElements=(mode,count,type,indices)=>{GLctx.drawElements(mode,count,type,indices)};var _emscripten_glDrawElementsInstanced=(mode,count,type,indices,primcount)=>{GLctx.drawElementsInstanced(mode,count,type,indices,primcount)};var _glDrawElementsInstanced=_emscripten_glDrawElementsInstanced;var _emscripten_glDrawElementsInstancedANGLE=_glDrawElementsInstanced;var _emscripten_glEnable=x0=>GLctx.enable(x0);var _emscripten_glEnableVertexAttribArray=index=>{GLctx.enableVertexAttribArray(index)};var _emscripten_glEndQueryEXT=target=>{GLctx.disjointTimerQueryExt["endQueryEXT"](target)};var _emscripten_glFinish=()=>GLctx.finish();var _emscripten_glFlush=()=>GLctx.flush();var _emscripten_glFramebufferRenderbuffer=(target,attachment,renderbuffertarget,renderbuffer)=>{GLctx.framebufferRenderbuffer(target,attachment,renderbuffertarget,GL.renderbuffers[renderbuffer])};var _emscripten_glFramebufferTexture2D=(target,attachment,textarget,texture,level)=>{GLctx.framebufferTexture2D(target,attachment,textarget,GL.textures[texture],level)};var _emscripten_glFrontFace=x0=>GLctx.frontFace(x0);var _emscripten_glGenBuffers=(n,buffers)=>{GL.genObject(n,buffers,"createBuffer",GL.buffers)};var _emscripten_glGenFramebuffers=(n,ids)=>{GL.genObject(n,ids,"createFramebuffer",GL.framebuffers)};var _emscripten_glGenQueriesEXT=(n,ids)=>{for(var i=0;i<n;i++){var query=GLctx.disjointTimerQueryExt["createQueryEXT"]();if(!query){GL.recordError(1282);while(i<n)HEAP32[ids+i++*4>>2]=0;return}var id=GL.getNewId(GL.queries);query.name=id;GL.queries[id]=query;HEAP32[ids+i*4>>2]=id}};var _emscripten_glGenRenderbuffers=(n,renderbuffers)=>{GL.genObject(n,renderbuffers,"createRenderbuffer",GL.renderbuffers)};var _emscripten_glGenTextures=(n,textures)=>{GL.genObject(n,textures,"createTexture",GL.textures)};var _emscripten_glGenVertexArrays=(n,arrays)=>{GL.genObject(n,arrays,"createVertexArray",GL.vaos)};var _glGenVertexArrays=_emscripten_glGenVertexArrays;var _emscripten_glGenVertexArraysOES=_glGenVertexArrays;var _emscripten_glGenerateMipmap=x0=>GLctx.generateMipmap(x0);var __glGetActiveAttribOrUniform=(funcName,program,index,bufSize,length,size,type,name)=>{program=GL.programs[program];var info=GLctx[funcName](program,index);if(info){var numBytesWrittenExclNull=name&&stringToUTF8(info.name,name,bufSize);if(length)HEAP32[length>>2]=numBytesWrittenExclNull;if(size)HEAP32[size>>2]=info.size;if(type)HEAP32[type>>2]=info.type}};var _emscripten_glGetActiveAttrib=(program,index,bufSize,length,size,type,name)=>__glGetActiveAttribOrUniform("getActiveAttrib",program,index,bufSize,length,size,type,name);var _emscripten_glGetActiveUniform=(program,index,bufSize,length,size,type,name)=>__glGetActiveAttribOrUniform("getActiveUniform",program,index,bufSize,length,size,type,name);var _emscripten_glGetAttachedShaders=(program,maxCount,count,shaders)=>{var result=GLctx.getAttachedShaders(GL.programs[program]);var len=result.length;if(len>maxCount){len=maxCount}HEAP32[count>>2]=len;for(var i=0;i<len;++i){var id=GL.shaders.indexOf(result[i]);HEAP32[shaders+i*4>>2]=id}};var _emscripten_glGetAttribLocation=(program,name)=>GLctx.getAttribLocation(GL.programs[program],UTF8ToString(name));var writeI53ToI64=(ptr,num)=>{HEAPU32[ptr>>2]=num;var lower=HEAPU32[ptr>>2];HEAPU32[ptr+4>>2]=(num-lower)/4294967296};var emscriptenWebGLGet=(name_,p,type)=>{if(!p){GL.recordError(1281);return}var ret=undefined;switch(name_){case 36346:ret=1;break;case 36344:if(type!=0&&type!=1){GL.recordError(1280)}return;case 36345:ret=0;break;case 34466:var formats=GLctx.getParameter(34467);ret=formats?formats.length:0;break}if(ret===undefined){var result=GLctx.getParameter(name_);switch(typeof result){case"number":ret=result;break;case"boolean":ret=result?1:0;break;case"string":GL.recordError(1280);return;case"object":if(result===null){switch(name_){case 34964:case 35725:case 34965:case 36006:case 36007:case 32873:case 34229:case 34068:{ret=0;break}default:{GL.recordError(1280);return}}}else if(result instanceof Float32Array||result instanceof Uint32Array||result instanceof Int32Array||result instanceof Array){for(var i=0;i<result.length;++i){switch(type){case 0:HEAP32[p+i*4>>2]=result[i];break;case 2:HEAPF32[p+i*4>>2]=result[i];break;case 4:HEAP8[p+i]=result[i]?1:0;break}}return}else{try{ret=result.name|0}catch(e){GL.recordError(1280);err(`GL_INVALID_ENUM in glGet${type}v: Unknown object returned from WebGL getParameter(${name_})! (error: ${e})`);return}}break;default:GL.recordError(1280);err(`GL_INVALID_ENUM in glGet${type}v: Native code calling glGet${type}v(${name_}) and it returns ${result} of type ${typeof result}!`);return}}switch(type){case 1:writeI53ToI64(p,ret);break;case 0:HEAP32[p>>2]=ret;break;case 2:HEAPF32[p>>2]=ret;break;case 4:HEAP8[p]=ret?1:0;break}};var _emscripten_glGetBooleanv=(name_,p)=>emscriptenWebGLGet(name_,p,4);var _emscripten_glGetBufferParameteriv=(target,value,data)=>{if(!data){GL.recordError(1281);return}HEAP32[data>>2]=GLctx.getBufferParameter(target,value)};var _emscripten_glGetError=()=>{var error=GLctx.getError()||GL.lastError;GL.lastError=0;return error};var _emscripten_glGetFloatv=(name_,p)=>emscriptenWebGLGet(name_,p,2);var _emscripten_glGetFramebufferAttachmentParameteriv=(target,attachment,pname,params)=>{var result=GLctx.getFramebufferAttachmentParameter(target,attachment,pname);if(result instanceof WebGLRenderbuffer||result instanceof WebGLTexture){result=result.name|0}HEAP32[params>>2]=result};var _emscripten_glGetIntegerv=(name_,p)=>emscriptenWebGLGet(name_,p,0);var _emscripten_glGetProgramInfoLog=(program,maxLength,length,infoLog)=>{var log=GLctx.getProgramInfoLog(GL.programs[program]);if(log===null)log="(unknown error)";var numBytesWrittenExclNull=maxLength>0&&infoLog?stringToUTF8(log,infoLog,maxLength):0;if(length)HEAP32[length>>2]=numBytesWrittenExclNull};var _emscripten_glGetProgramiv=(program,pname,p)=>{if(!p){GL.recordError(1281);return}if(program>=GL.counter){GL.recordError(1281);return}program=GL.programs[program];if(pname==35716){var log=GLctx.getProgramInfoLog(program);if(log===null)log="(unknown error)";HEAP32[p>>2]=log.length+1}else if(pname==35719){if(!program.maxUniformLength){var numActiveUniforms=GLctx.getProgramParameter(program,35718);for(var i=0;i<numActiveUniforms;++i){program.maxUniformLength=Math.max(program.maxUniformLength,GLctx.getActiveUniform(program,i).name.length+1)}}HEAP32[p>>2]=program.maxUniformLength}else if(pname==35722){if(!program.maxAttributeLength){var numActiveAttributes=GLctx.getProgramParameter(program,35721);for(var i=0;i<numActiveAttributes;++i){program.maxAttributeLength=Math.max(program.maxAttributeLength,GLctx.getActiveAttrib(program,i).name.length+1)}}HEAP32[p>>2]=program.maxAttributeLength}else if(pname==35381){if(!program.maxUniformBlockNameLength){var numActiveUniformBlocks=GLctx.getProgramParameter(program,35382);for(var i=0;i<numActiveUniformBlocks;++i){program.maxUniformBlockNameLength=Math.max(program.maxUniformBlockNameLength,GLctx.getActiveUniformBlockName(program,i).length+1)}}HEAP32[p>>2]=program.maxUniformBlockNameLength}else{HEAP32[p>>2]=GLctx.getProgramParameter(program,pname)}};var _emscripten_glGetQueryObjecti64vEXT=(id,pname,params)=>{if(!params){GL.recordError(1281);return}var query=GL.queries[id];var param;{param=GLctx.disjointTimerQueryExt["getQueryObjectEXT"](query,pname)}var ret;if(typeof param=="boolean"){ret=param?1:0}else{ret=param}writeI53ToI64(params,ret)};var _emscripten_glGetQueryObjectivEXT=(id,pname,params)=>{if(!params){GL.recordError(1281);return}var query=GL.queries[id];var param=GLctx.disjointTimerQueryExt["getQueryObjectEXT"](query,pname);var ret;if(typeof param=="boolean"){ret=param?1:0}else{ret=param}HEAP32[params>>2]=ret};var _glGetQueryObjecti64vEXT=_emscripten_glGetQueryObjecti64vEXT;var _emscripten_glGetQueryObjectui64vEXT=_glGetQueryObjecti64vEXT;var _glGetQueryObjectivEXT=_emscripten_glGetQueryObjectivEXT;var _emscripten_glGetQueryObjectuivEXT=_glGetQueryObjectivEXT;var _emscripten_glGetQueryivEXT=(target,pname,params)=>{if(!params){GL.recordError(1281);return}HEAP32[params>>2]=GLctx.disjointTimerQueryExt["getQueryEXT"](target,pname)};var _emscripten_glGetRenderbufferParameteriv=(target,pname,params)=>{if(!params){GL.recordError(1281);return}HEAP32[params>>2]=GLctx.getRenderbufferParameter(target,pname)};var _emscripten_glGetShaderInfoLog=(shader,maxLength,length,infoLog)=>{var log=GLctx.getShaderInfoLog(GL.shaders[shader]);if(log===null)log="(unknown error)";var numBytesWrittenExclNull=maxLength>0&&infoLog?stringToUTF8(log,infoLog,maxLength):0;if(length)HEAP32[length>>2]=numBytesWrittenExclNull};var _emscripten_glGetShaderPrecisionFormat=(shaderType,precisionType,range,precision)=>{var result=GLctx.getShaderPrecisionFormat(shaderType,precisionType);HEAP32[range>>2]=result.rangeMin;HEAP32[range+4>>2]=result.rangeMax;HEAP32[precision>>2]=result.precision};var _emscripten_glGetShaderSource=(shader,bufSize,length,source)=>{var result=GLctx.getShaderSource(GL.shaders[shader]);if(!result)return;var numBytesWrittenExclNull=bufSize>0&&source?stringToUTF8(result,source,bufSize):0;if(length)HEAP32[length>>2]=numBytesWrittenExclNull};var _emscripten_glGetShaderiv=(shader,pname,p)=>{if(!p){GL.recordError(1281);return}if(pname==35716){var log=GLctx.getShaderInfoLog(GL.shaders[shader]);if(log===null)log="(unknown error)";var logLength=log?log.length+1:0;HEAP32[p>>2]=logLength}else if(pname==35720){var source=GLctx.getShaderSource(GL.shaders[shader]);var sourceLength=source?source.length+1:0;HEAP32[p>>2]=sourceLength}else{HEAP32[p>>2]=GLctx.getShaderParameter(GL.shaders[shader],pname)}};var stringToNewUTF8=str=>{var size=lengthBytesUTF8(str)+1;var ret=_malloc(size);if(ret)stringToUTF8(str,ret,size);return ret};var webglGetExtensions=()=>{var exts=getEmscriptenSupportedExtensions(GLctx);exts=exts.concat(exts.map(e=>"GL_"+e));return exts};var _emscripten_glGetString=name_=>{var ret=GL.stringCache[name_];if(!ret){switch(name_){case 7939:ret=stringToNewUTF8(webglGetExtensions().join(" "));break;case 7936:case 7937:case 37445:case 37446:var s=GLctx.getParameter(name_);if(!s){GL.recordError(1280)}ret=s?stringToNewUTF8(s):0;break;case 7938:var webGLVersion=GLctx.getParameter(7938);var glVersion=`OpenGL ES 2.0 (${webGLVersion})`;ret=stringToNewUTF8(glVersion);break;case 35724:var glslVersion=GLctx.getParameter(35724);var ver_re=/^WebGL GLSL ES ([0-9]\.[0-9][0-9]?)(?:$| .*)/;var ver_num=glslVersion.match(ver_re);if(ver_num!==null){if(ver_num[1].length==3)ver_num[1]=ver_num[1]+"0";glslVersion=`OpenGL ES GLSL ES ${ver_num[1]} (${glslVersion})`}ret=stringToNewUTF8(glslVersion);break;default:GL.recordError(1280)}GL.stringCache[name_]=ret}return ret};var _emscripten_glGetTexParameterfv=(target,pname,params)=>{if(!params){GL.recordError(1281);return}HEAPF32[params>>2]=GLctx.getTexParameter(target,pname)};var _emscripten_glGetTexParameteriv=(target,pname,params)=>{if(!params){GL.recordError(1281);return}HEAP32[params>>2]=GLctx.getTexParameter(target,pname)};var jstoi_q=str=>parseInt(str);var webglGetLeftBracePos=name=>name.slice(-1)=="]"&&name.lastIndexOf("[");var webglPrepareUniformLocationsBeforeFirstUse=program=>{var uniformLocsById=program.uniformLocsById,uniformSizeAndIdsByName=program.uniformSizeAndIdsByName,i,j;if(!uniformLocsById){program.uniformLocsById=uniformLocsById={};program.uniformArrayNamesById={};var numActiveUniforms=GLctx.getProgramParameter(program,35718);for(i=0;i<numActiveUniforms;++i){var u=GLctx.getActiveUniform(program,i);var nm=u.name;var sz=u.size;var lb=webglGetLeftBracePos(nm);var arrayName=lb>0?nm.slice(0,lb):nm;var id=program.uniformIdCounter;program.uniformIdCounter+=sz;uniformSizeAndIdsByName[arrayName]=[sz,id];for(j=0;j<sz;++j){uniformLocsById[id]=j;program.uniformArrayNamesById[id++]=arrayName}}}};var _emscripten_glGetUniformLocation=(program,name)=>{name=UTF8ToString(name);if(program=GL.programs[program]){webglPrepareUniformLocationsBeforeFirstUse(program);var uniformLocsById=program.uniformLocsById;var arrayIndex=0;var uniformBaseName=name;var leftBrace=webglGetLeftBracePos(name);if(leftBrace>0){arrayIndex=jstoi_q(name.slice(leftBrace+1))>>>0;uniformBaseName=name.slice(0,leftBrace)}var sizeAndId=program.uniformSizeAndIdsByName[uniformBaseName];if(sizeAndId&&arrayIndex<sizeAndId[0]){arrayIndex+=sizeAndId[1];if(uniformLocsById[arrayIndex]=uniformLocsById[arrayIndex]||GLctx.getUniformLocation(program,name)){return arrayIndex}}}else{GL.recordError(1281)}return-1};var webglGetUniformLocation=location=>{var p=GLctx.currentProgram;if(p){var webglLoc=p.uniformLocsById[location];if(typeof webglLoc=="number"){p.uniformLocsById[location]=webglLoc=GLctx.getUniformLocation(p,p.uniformArrayNamesById[location]+(webglLoc>0?`[${webglLoc}]`:""))}return webglLoc}else{GL.recordError(1282)}};var emscriptenWebGLGetUniform=(program,location,params,type)=>{if(!params){GL.recordError(1281);return}program=GL.programs[program];webglPrepareUniformLocationsBeforeFirstUse(program);var data=GLctx.getUniform(program,webglGetUniformLocation(location));if(typeof data=="number"||typeof data=="boolean"){switch(type){case 0:HEAP32[params>>2]=data;break;case 2:HEAPF32[params>>2]=data;break}}else{for(var i=0;i<data.length;i++){switch(type){case 0:HEAP32[params+i*4>>2]=data[i];break;case 2:HEAPF32[params+i*4>>2]=data[i];break}}}};var _emscripten_glGetUniformfv=(program,location,params)=>{emscriptenWebGLGetUniform(program,location,params,2)};var _emscripten_glGetUniformiv=(program,location,params)=>{emscriptenWebGLGetUniform(program,location,params,0)};var _emscripten_glGetVertexAttribPointerv=(index,pname,pointer)=>{if(!pointer){GL.recordError(1281);return}HEAP32[pointer>>2]=GLctx.getVertexAttribOffset(index,pname)};var emscriptenWebGLGetVertexAttrib=(index,pname,params,type)=>{if(!params){GL.recordError(1281);return}var data=GLctx.getVertexAttrib(index,pname);if(pname==34975){HEAP32[params>>2]=data&&data["name"]}else if(typeof data=="number"||typeof data=="boolean"){switch(type){case 0:HEAP32[params>>2]=data;break;case 2:HEAPF32[params>>2]=data;break;case 5:HEAP32[params>>2]=Math.fround(data);break}}else{for(var i=0;i<data.length;i++){switch(type){case 0:HEAP32[params+i*4>>2]=data[i];break;case 2:HEAPF32[params+i*4>>2]=data[i];break;case 5:HEAP32[params+i*4>>2]=Math.fround(data[i]);break}}}};var _emscripten_glGetVertexAttribfv=(index,pname,params)=>{emscriptenWebGLGetVertexAttrib(index,pname,params,2)};var _emscripten_glGetVertexAttribiv=(index,pname,params)=>{emscriptenWebGLGetVertexAttrib(index,pname,params,5)};var _emscripten_glHint=(x0,x1)=>GLctx.hint(x0,x1);var _emscripten_glIsBuffer=buffer=>{var b=GL.buffers[buffer];if(!b)return 0;return GLctx.isBuffer(b)};var _emscripten_glIsEnabled=x0=>GLctx.isEnabled(x0);var _emscripten_glIsFramebuffer=framebuffer=>{var fb=GL.framebuffers[framebuffer];if(!fb)return 0;return GLctx.isFramebuffer(fb)};var _emscripten_glIsProgram=program=>{program=GL.programs[program];if(!program)return 0;return GLctx.isProgram(program)};var _emscripten_glIsQueryEXT=id=>{var query=GL.queries[id];if(!query)return 0;return GLctx.disjointTimerQueryExt["isQueryEXT"](query)};var _emscripten_glIsRenderbuffer=renderbuffer=>{var rb=GL.renderbuffers[renderbuffer];if(!rb)return 0;return GLctx.isRenderbuffer(rb)};var _emscripten_glIsShader=shader=>{var s=GL.shaders[shader];if(!s)return 0;return GLctx.isShader(s)};var _emscripten_glIsTexture=id=>{var texture=GL.textures[id];if(!texture)return 0;return GLctx.isTexture(texture)};var _emscripten_glIsVertexArray=array=>{var vao=GL.vaos[array];if(!vao)return 0;return GLctx.isVertexArray(vao)};var _glIsVertexArray=_emscripten_glIsVertexArray;var _emscripten_glIsVertexArrayOES=_glIsVertexArray;var _emscripten_glLineWidth=x0=>GLctx.lineWidth(x0);var _emscripten_glLinkProgram=program=>{program=GL.programs[program];GLctx.linkProgram(program);program.uniformLocsById=0;program.uniformSizeAndIdsByName={}};var _emscripten_glPixelStorei=(pname,param)=>{if(pname==3317){GL.unpackAlignment=param}else if(pname==3314){GL.unpackRowLength=param}GLctx.pixelStorei(pname,param)};var _emscripten_glPolygonModeWEBGL=(face,mode)=>{GLctx.webglPolygonMode["polygonModeWEBGL"](face,mode)};var _emscripten_glPolygonOffset=(x0,x1)=>GLctx.polygonOffset(x0,x1);var _emscripten_glPolygonOffsetClampEXT=(factor,units,clamp)=>{GLctx.extPolygonOffsetClamp["polygonOffsetClampEXT"](factor,units,clamp)};var _emscripten_glQueryCounterEXT=(id,target)=>{GLctx.disjointTimerQueryExt["queryCounterEXT"](GL.queries[id],target)};var computeUnpackAlignedImageSize=(width,height,sizePerPixel)=>{function roundedToNextMultipleOf(x,y){return x+y-1&-y}var plainRowSize=(GL.unpackRowLength||width)*sizePerPixel;var alignedRowSize=roundedToNextMultipleOf(plainRowSize,GL.unpackAlignment);return height*alignedRowSize};var colorChannelsInGlTextureFormat=format=>{var colorChannels={5:3,6:4,8:2,29502:3,29504:4};return colorChannels[format-6402]||1};var heapObjectForWebGLType=type=>{type-=5120;if(type==1)return HEAPU8;if(type==4)return HEAP32;if(type==6)return HEAPF32;if(type==5||type==28922)return HEAPU32;return HEAPU16};var toTypedArrayIndex=(pointer,heap)=>pointer>>>31-Math.clz32(heap.BYTES_PER_ELEMENT);var emscriptenWebGLGetTexPixelData=(type,format,width,height,pixels,internalFormat)=>{var heap=heapObjectForWebGLType(type);var sizePerPixel=colorChannelsInGlTextureFormat(format)*heap.BYTES_PER_ELEMENT;var bytes=computeUnpackAlignedImageSize(width,height,sizePerPixel);return heap.subarray(toTypedArrayIndex(pixels,heap),toTypedArrayIndex(pixels+bytes,heap))};var _emscripten_glReadPixels=(x,y,width,height,format,type,pixels)=>{var pixelData=emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,format);if(!pixelData){GL.recordError(1280);return}GLctx.readPixels(x,y,width,height,format,type,pixelData)};var _emscripten_glReleaseShaderCompiler=()=>{};var _emscripten_glRenderbufferStorage=(x0,x1,x2,x3)=>GLctx.renderbufferStorage(x0,x1,x2,x3);var _emscripten_glSampleCoverage=(value,invert)=>{GLctx.sampleCoverage(value,!!invert)};var _emscripten_glScissor=(x0,x1,x2,x3)=>GLctx.scissor(x0,x1,x2,x3);var _emscripten_glShaderBinary=(count,shaders,binaryformat,binary,length)=>{GL.recordError(1280)};var _emscripten_glShaderSource=(shader,count,string,length)=>{var source=GL.getSource(shader,count,string,length);GLctx.shaderSource(GL.shaders[shader],source)};var _emscripten_glStencilFunc=(x0,x1,x2)=>GLctx.stencilFunc(x0,x1,x2);var _emscripten_glStencilFuncSeparate=(x0,x1,x2,x3)=>GLctx.stencilFuncSeparate(x0,x1,x2,x3);var _emscripten_glStencilMask=x0=>GLctx.stencilMask(x0);var _emscripten_glStencilMaskSeparate=(x0,x1)=>GLctx.stencilMaskSeparate(x0,x1);var _emscripten_glStencilOp=(x0,x1,x2)=>GLctx.stencilOp(x0,x1,x2);var _emscripten_glStencilOpSeparate=(x0,x1,x2,x3)=>GLctx.stencilOpSeparate(x0,x1,x2,x3);var _emscripten_glTexImage2D=(target,level,internalFormat,width,height,border,format,type,pixels)=>{var pixelData=pixels?emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,internalFormat):null;GLctx.texImage2D(target,level,internalFormat,width,height,border,format,type,pixelData)};var _emscripten_glTexParameterf=(x0,x1,x2)=>GLctx.texParameterf(x0,x1,x2);var _emscripten_glTexParameterfv=(target,pname,params)=>{var param=HEAPF32[params>>2];GLctx.texParameterf(target,pname,param)};var _emscripten_glTexParameteri=(x0,x1,x2)=>GLctx.texParameteri(x0,x1,x2);var _emscripten_glTexParameteriv=(target,pname,params)=>{var param=HEAP32[params>>2];GLctx.texParameteri(target,pname,param)};var _emscripten_glTexSubImage2D=(target,level,xoffset,yoffset,width,height,format,type,pixels)=>{var pixelData=pixels?emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,0):null;GLctx.texSubImage2D(target,level,xoffset,yoffset,width,height,format,type,pixelData)};var _emscripten_glUniform1f=(location,v0)=>{GLctx.uniform1f(webglGetUniformLocation(location),v0)};var miniTempWebGLFloatBuffers=[];var _emscripten_glUniform1fv=(location,count,value)=>{if(count<=288){var view=miniTempWebGLFloatBuffers[count];for(var i=0;i<count;++i){view[i]=HEAPF32[value+4*i>>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*4>>2)}GLctx.uniform1fv(webglGetUniformLocation(location),view)};var _emscripten_glUniform1i=(location,v0)=>{GLctx.uniform1i(webglGetUniformLocation(location),v0)};var miniTempWebGLIntBuffers=[];var _emscripten_glUniform1iv=(location,count,value)=>{if(count<=288){var view=miniTempWebGLIntBuffers[count];for(var i=0;i<count;++i){view[i]=HEAP32[value+4*i>>2]}}else{var view=HEAP32.subarray(value>>2,value+count*4>>2)}GLctx.uniform1iv(webglGetUniformLocation(location),view)};var _emscripten_glUniform2f=(location,v0,v1)=>{GLctx.uniform2f(webglGetUniformLocation(location),v0,v1)};var _emscripten_glUniform2fv=(location,count,value)=>{if(count<=144){count*=2;var view=miniTempWebGLFloatBuffers[count];for(var i=0;i<count;i+=2){view[i]=HEAPF32[value+4*i>>2];view[i+1]=HEAPF32[value+(4*i+4)>>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*8>>2)}GLctx.uniform2fv(webglGetUniformLocation(location),view)};var _emscripten_glUniform2i=(location,v0,v1)=>{GLctx.uniform2i(webglGetUniformLocation(location),v0,v1)};var _emscripten_glUniform2iv=(location,count,value)=>{if(count<=144){count*=2;var view=miniTempWebGLIntBuffers[count];for(var i=0;i<count;i+=2){view[i]=HEAP32[value+4*i>>2];view[i+1]=HEAP32[value+(4*i+4)>>2]}}else{var view=HEAP32.subarray(value>>2,value+count*8>>2)}GLctx.uniform2iv(webglGetUniformLocation(location),view)};var _emscripten_glUniform3f=(location,v0,v1,v2)=>{GLctx.uniform3f(webglGetUniformLocation(location),v0,v1,v2)};var _emscripten_glUniform3fv=(location,count,value)=>{if(count<=96){count*=3;var view=miniTempWebGLFloatBuffers[count];for(var i=0;i<count;i+=3){view[i]=HEAPF32[value+4*i>>2];view[i+1]=HEAPF32[value+(4*i+4)>>2];view[i+2]=HEAPF32[value+(4*i+8)>>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*12>>2)}GLctx.uniform3fv(webglGetUniformLocation(location),view)};var _emscripten_glUniform3i=(location,v0,v1,v2)=>{GLctx.uniform3i(webglGetUniformLocation(location),v0,v1,v2)};var _emscripten_glUniform3iv=(location,count,value)=>{if(count<=96){count*=3;var view=miniTempWebGLIntBuffers[count];for(var i=0;i<count;i+=3){view[i]=HEAP32[value+4*i>>2];view[i+1]=HEAP32[value+(4*i+4)>>2];view[i+2]=HEAP32[value+(4*i+8)>>2]}}else{var view=HEAP32.subarray(value>>2,value+count*12>>2)}GLctx.uniform3iv(webglGetUniformLocation(location),view)};var _emscripten_glUniform4f=(location,v0,v1,v2,v3)=>{GLctx.uniform4f(webglGetUniformLocation(location),v0,v1,v2,v3)};var _emscripten_glUniform4fv=(location,count,value)=>{if(count<=72){var view=miniTempWebGLFloatBuffers[4*count];var heap=HEAPF32;value=value>>2;count*=4;for(var i=0;i<count;i+=4){var dst=value+i;view[i]=heap[dst];view[i+1]=heap[dst+1];view[i+2]=heap[dst+2];view[i+3]=heap[dst+3]}}else{var view=HEAPF32.subarray(value>>2,value+count*16>>2)}GLctx.uniform4fv(webglGetUniformLocation(location),view)};var _emscripten_glUniform4i=(location,v0,v1,v2,v3)=>{GLctx.uniform4i(webglGetUniformLocation(location),v0,v1,v2,v3)};var _emscripten_glUniform4iv=(location,count,value)=>{if(count<=72){count*=4;var view=miniTempWebGLIntBuffers[count];for(var i=0;i<count;i+=4){view[i]=HEAP32[value+4*i>>2];view[i+1]=HEAP32[value+(4*i+4)>>2];view[i+2]=HEAP32[value+(4*i+8)>>2];view[i+3]=HEAP32[value+(4*i+12)>>2]}}else{var view=HEAP32.subarray(value>>2,value+count*16>>2)}GLctx.uniform4iv(webglGetUniformLocation(location),view)};var _emscripten_glUniformMatrix2fv=(location,count,transpose,value)=>{if(count<=72){count*=4;var view=miniTempWebGLFloatBuffers[count];for(var i=0;i<count;i+=4){view[i]=HEAPF32[value+4*i>>2];view[i+1]=HEAPF32[value+(4*i+4)>>2];view[i+2]=HEAPF32[value+(4*i+8)>>2];view[i+3]=HEAPF32[value+(4*i+12)>>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*16>>2)}GLctx.uniformMatrix2fv(webglGetUniformLocation(location),!!transpose,view)};var _emscripten_glUniformMatrix3fv=(location,count,transpose,value)=>{if(count<=32){count*=9;var view=miniTempWebGLFloatBuffers[count];for(var i=0;i<count;i+=9){view[i]=HEAPF32[value+4*i>>2];view[i+1]=HEAPF32[value+(4*i+4)>>2];view[i+2]=HEAPF32[value+(4*i+8)>>2];view[i+3]=HEAPF32[value+(4*i+12)>>2];view[i+4]=HEAPF32[value+(4*i+16)>>2];view[i+5]=HEAPF32[value+(4*i+20)>>2];view[i+6]=HEAPF32[value+(4*i+24)>>2];view[i+7]=HEAPF32[value+(4*i+28)>>2];view[i+8]=HEAPF32[value+(4*i+32)>>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*36>>2)}GLctx.uniformMatrix3fv(webglGetUniformLocation(location),!!transpose,view)};var _emscripten_glUniformMatrix4fv=(location,count,transpose,value)=>{if(count<=18){var view=miniTempWebGLFloatBuffers[16*count];var heap=HEAPF32;value=value>>2;count*=16;for(var i=0;i<count;i+=16){var dst=value+i;view[i]=heap[dst];view[i+1]=heap[dst+1];view[i+2]=heap[dst+2];view[i+3]=heap[dst+3];view[i+4]=heap[dst+4];view[i+5]=heap[dst+5];view[i+6]=heap[dst+6];view[i+7]=heap[dst+7];view[i+8]=heap[dst+8];view[i+9]=heap[dst+9];view[i+10]=heap[dst+10];view[i+11]=heap[dst+11];view[i+12]=heap[dst+12];view[i+13]=heap[dst+13];view[i+14]=heap[dst+14];view[i+15]=heap[dst+15]}}else{var view=HEAPF32.subarray(value>>2,value+count*64>>2)}GLctx.uniformMatrix4fv(webglGetUniformLocation(location),!!transpose,view)};var _emscripten_glUseProgram=program=>{program=GL.programs[program];GLctx.useProgram(program);GLctx.currentProgram=program};var _emscripten_glValidateProgram=program=>{GLctx.validateProgram(GL.programs[program])};var _emscripten_glVertexAttrib1f=(x0,x1)=>GLctx.vertexAttrib1f(x0,x1);var _emscripten_glVertexAttrib1fv=(index,v)=>{GLctx.vertexAttrib1f(index,HEAPF32[v>>2])};var _emscripten_glVertexAttrib2f=(x0,x1,x2)=>GLctx.vertexAttrib2f(x0,x1,x2);var _emscripten_glVertexAttrib2fv=(index,v)=>{GLctx.vertexAttrib2f(index,HEAPF32[v>>2],HEAPF32[v+4>>2])};var _emscripten_glVertexAttrib3f=(x0,x1,x2,x3)=>GLctx.vertexAttrib3f(x0,x1,x2,x3);var _emscripten_glVertexAttrib3fv=(index,v)=>{GLctx.vertexAttrib3f(index,HEAPF32[v>>2],HEAPF32[v+4>>2],HEAPF32[v+8>>2])};var _emscripten_glVertexAttrib4f=(x0,x1,x2,x3,x4)=>GLctx.vertexAttrib4f(x0,x1,x2,x3,x4);var _emscripten_glVertexAttrib4fv=(index,v)=>{GLctx.vertexAttrib4f(index,HEAPF32[v>>2],HEAPF32[v+4>>2],HEAPF32[v+8>>2],HEAPF32[v+12>>2])};var _emscripten_glVertexAttribDivisor=(index,divisor)=>{GLctx.vertexAttribDivisor(index,divisor)};var _glVertexAttribDivisor=_emscripten_glVertexAttribDivisor;var _emscripten_glVertexAttribDivisorANGLE=_glVertexAttribDivisor;var _emscripten_glVertexAttribPointer=(index,size,type,normalized,stride,ptr)=>{GLctx.vertexAttribPointer(index,size,type,!!normalized,stride,ptr)};var _emscripten_glViewport=(x0,x1,x2,x3)=>GLctx.viewport(x0,x1,x2,x3);var getHeapMax=()=>2147483648;var alignMemory=(size,alignment)=>Math.ceil(size/alignment)*alignment;var growMemory=size=>{var oldHeapSize=wasmMemory.buffer.byteLength;var pages=(size-oldHeapSize+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false};var _emscripten_sample_gamepad_data=()=>{try{if(navigator.getGamepads)return(JSEvents.lastGamepadState=navigator.getGamepads())?0:-1}catch(e){navigator.getGamepads=null}return-1};var registerFocusEventCallback=(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread)=>{var eventSize=256;JSEvents.focusEvent||=_malloc(eventSize);var focusEventHandlerFunc=e=>{var nodeName=JSEvents.getNodeNameForTarget(e.target);var id=e.target.id?e.target.id:"";var focusEvent=JSEvents.focusEvent;stringToUTF8(nodeName,focusEvent+0,128);stringToUTF8(id,focusEvent+128,128);if(((a1,a2,a3)=>dynCall_iiii(callbackfunc,a1,a2,a3))(eventTypeId,focusEvent,userData))e.preventDefault()};var eventHandler={target:findEventTarget(target),eventTypeString,eventTypeId,userData,callbackfunc,handlerFunc:focusEventHandlerFunc,useCapture};return JSEvents.registerOrRemoveHandler(eventHandler)};var _emscripten_set_blur_callback_on_thread=(target,userData,useCapture,callbackfunc,targetThread)=>registerFocusEventCallback(target,userData,useCapture,callbackfunc,12,"blur",targetThread);var findCanvasEventTarget=findEventTarget;var _emscripten_set_canvas_element_size=(target,width,height)=>{var canvas=findCanvasEventTarget(target);if(!canvas)return-4;canvas.width=width;canvas.height=height;return 0};var fillMouseEventData=(eventStruct,e,target)=>{HEAPF64[eventStruct>>3]=e.timeStamp;var idx=eventStruct>>2;HEAP32[idx+2]=e.screenX;HEAP32[idx+3]=e.screenY;HEAP32[idx+4]=e.clientX;HEAP32[idx+5]=e.clientY;HEAP8[eventStruct+24]=e.ctrlKey;HEAP8[eventStruct+25]=e.shiftKey;HEAP8[eventStruct+26]=e.altKey;HEAP8[eventStruct+27]=e.metaKey;HEAP16[idx*2+14]=e.button;HEAP16[idx*2+15]=e.buttons;HEAP32[idx+8]=e["movementX"];HEAP32[idx+9]=e["movementY"];var rect=getBoundingClientRect(target);HEAP32[idx+10]=e.clientX-(rect.left|0);HEAP32[idx+11]=e.clientY-(rect.top|0)};var registerMouseEventCallback=(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread)=>{var eventSize=64;JSEvents.mouseEvent||=_malloc(eventSize);target=findEventTarget(target);var mouseEventHandlerFunc=e=>{fillMouseEventData(JSEvents.mouseEvent,e,target);if(((a1,a2,a3)=>dynCall_iiii(callbackfunc,a1,a2,a3))(eventTypeId,JSEvents.mouseEvent,userData))e.preventDefault()};var eventHandler={target,allowsDeferredCalls:eventTypeString!="mousemove"&&eventTypeString!="mouseenter"&&eventTypeString!="mouseleave",eventTypeString,eventTypeId,userData,callbackfunc,handlerFunc:mouseEventHandlerFunc,useCapture};return JSEvents.registerOrRemoveHandler(eventHandler)};var _emscripten_set_click_callback_on_thread=(target,userData,useCapture,callbackfunc,targetThread)=>registerMouseEventCallback(target,userData,useCapture,callbackfunc,4,"click",targetThread);var _emscripten_set_focus_callback_on_thread=(target,userData,useCapture,callbackfunc,targetThread)=>registerFocusEventCallback(target,userData,useCapture,callbackfunc,13,"focus",targetThread);function getFullscreenElement(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.webkitCurrentFullScreenElement||document.msFullscreenElement}var fillFullscreenChangeEventData=eventStruct=>{var fullscreenElement=getFullscreenElement();var isFullscreen=!!fullscreenElement;HEAP8[eventStruct]=isFullscreen;HEAP8[eventStruct+1]=JSEvents.fullscreenEnabled();var reportedElement=isFullscreen?fullscreenElement:JSEvents.previousFullscreenElement;var nodeName=JSEvents.getNodeNameForTarget(reportedElement);var id=reportedElement?.id||"";stringToUTF8(nodeName,eventStruct+2,128);stringToUTF8(id,eventStruct+130,128);HEAP32[eventStruct+260>>2]=reportedElement?reportedElement.clientWidth:0;HEAP32[eventStruct+264>>2]=reportedElement?reportedElement.clientHeight:0;HEAP32[eventStruct+268>>2]=screen.width;HEAP32[eventStruct+272>>2]=screen.height;if(isFullscreen){JSEvents.previousFullscreenElement=fullscreenElement}};var registerFullscreenChangeEventCallback=(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread)=>{var eventSize=276;JSEvents.fullscreenChangeEvent||=_malloc(eventSize);var fullscreenChangeEventHandlerFunc=e=>{var fullscreenChangeEvent=JSEvents.fullscreenChangeEvent;fillFullscreenChangeEventData(fullscreenChangeEvent);if(((a1,a2,a3)=>dynCall_iiii(callbackfunc,a1,a2,a3))(eventTypeId,fullscreenChangeEvent,userData))e.preventDefault()};var eventHandler={target,eventTypeString,eventTypeId,userData,callbackfunc,handlerFunc:fullscreenChangeEventHandlerFunc,useCapture};return JSEvents.registerOrRemoveHandler(eventHandler)};var _emscripten_set_fullscreenchange_callback_on_thread=(target,userData,useCapture,callbackfunc,targetThread)=>{if(!JSEvents.fullscreenEnabled())return-1;target=findEventTarget(target);if(!target)return-4;registerFullscreenChangeEventCallback(target,userData,useCapture,callbackfunc,19,"webkitfullscreenchange",targetThread);return registerFullscreenChangeEventCallback(target,userData,useCapture,callbackfunc,19,"fullscreenchange",targetThread)};var registerGamepadEventCallback=(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread)=>{var eventSize=1240;JSEvents.gamepadEvent||=_malloc(eventSize);var gamepadEventHandlerFunc=e=>{var gamepadEvent=JSEvents.gamepadEvent;fillGamepadEventData(gamepadEvent,e["gamepad"]);if(((a1,a2,a3)=>dynCall_iiii(callbackfunc,a1,a2,a3))(eventTypeId,gamepadEvent,userData))e.preventDefault()};var eventHandler={target:findEventTarget(target),allowsDeferredCalls:true,eventTypeString,eventTypeId,userData,callbackfunc,handlerFunc:gamepadEventHandlerFunc,useCapture};return JSEvents.registerOrRemoveHandler(eventHandler)};var _emscripten_set_gamepadconnected_callback_on_thread=(userData,useCapture,callbackfunc,targetThread)=>{if(_emscripten_sample_gamepad_data())return-1;return registerGamepadEventCallback(2,userData,useCapture,callbackfunc,26,"gamepadconnected",targetThread)};var _emscripten_set_gamepaddisconnected_callback_on_thread=(userData,useCapture,callbackfunc,targetThread)=>{if(_emscripten_sample_gamepad_data())return-1;return registerGamepadEventCallback(2,userData,useCapture,callbackfunc,27,"gamepaddisconnected",targetThread)};var _emscripten_set_mousemove_callback_on_thread=(target,userData,useCapture,callbackfunc,targetThread)=>registerMouseEventCallback(target,userData,useCapture,callbackfunc,8,"mousemove",targetThread);var fillPointerlockChangeEventData=eventStruct=>{var pointerLockElement=document.pointerLockElement;var isPointerlocked=!!pointerLockElement;HEAP8[eventStruct]=isPointerlocked;var nodeName=JSEvents.getNodeNameForTarget(pointerLockElement);var id=pointerLockElement?.id||"";stringToUTF8(nodeName,eventStruct+1,128);stringToUTF8(id,eventStruct+129,128)};var registerPointerlockChangeEventCallback=(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread)=>{var eventSize=257;JSEvents.pointerlockChangeEvent||=_malloc(eventSize);var pointerlockChangeEventHandlerFunc=e=>{var pointerlockChangeEvent=JSEvents.pointerlockChangeEvent;fillPointerlockChangeEventData(pointerlockChangeEvent);if(((a1,a2,a3)=>dynCall_iiii(callbackfunc,a1,a2,a3))(eventTypeId,pointerlockChangeEvent,userData))e.preventDefault()};var eventHandler={target,eventTypeString,eventTypeId,userData,callbackfunc,handlerFunc:pointerlockChangeEventHandlerFunc,useCapture};return JSEvents.registerOrRemoveHandler(eventHandler)};var _emscripten_set_pointerlockchange_callback_on_thread=(target,userData,useCapture,callbackfunc,targetThread)=>{if(!document.body?.requestPointerLock){return-1}target=findEventTarget(target);if(!target)return-4;return registerPointerlockChangeEventCallback(target,userData,useCapture,callbackfunc,20,"pointerlockchange",targetThread)};var registerUiEventCallback=(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread)=>{var eventSize=36;JSEvents.uiEvent||=_malloc(eventSize);target=findEventTarget(target);var uiEventHandlerFunc=e=>{if(e.target!=target){return}var b=document.body;if(!b){return}var uiEvent=JSEvents.uiEvent;HEAP32[uiEvent>>2]=0;HEAP32[uiEvent+4>>2]=b.clientWidth;HEAP32[uiEvent+8>>2]=b.clientHeight;HEAP32[uiEvent+12>>2]=innerWidth;HEAP32[uiEvent+16>>2]=innerHeight;HEAP32[uiEvent+20>>2]=outerWidth;HEAP32[uiEvent+24>>2]=outerHeight;HEAP32[uiEvent+28>>2]=pageXOffset|0;HEAP32[uiEvent+32>>2]=pageYOffset|0;if(((a1,a2,a3)=>dynCall_iiii(callbackfunc,a1,a2,a3))(eventTypeId,uiEvent,userData))e.preventDefault()};var eventHandler={target,eventTypeString,eventTypeId,userData,callbackfunc,handlerFunc:uiEventHandlerFunc,useCapture};return JSEvents.registerOrRemoveHandler(eventHandler)};var _emscripten_set_resize_callback_on_thread=(target,userData,useCapture,callbackfunc,targetThread)=>registerUiEventCallback(target,userData,useCapture,callbackfunc,10,"resize",targetThread);var registerTouchEventCallback=(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread)=>{var eventSize=1552;JSEvents.touchEvent||=_malloc(eventSize);target=findEventTarget(target);var touchEventHandlerFunc=e=>{var t,touches={},et=e.touches;for(let t of et){t.isChanged=t.onTarget=0;touches[t.identifier]=t}for(let t of e.changedTouches){t.isChanged=1;touches[t.identifier]=t}for(let t of e.targetTouches){touches[t.identifier].onTarget=1}var touchEvent=JSEvents.touchEvent;HEAPF64[touchEvent>>3]=e.timeStamp;HEAP8[touchEvent+12]=e.ctrlKey;HEAP8[touchEvent+13]=e.shiftKey;HEAP8[touchEvent+14]=e.altKey;HEAP8[touchEvent+15]=e.metaKey;var idx=touchEvent+16;var targetRect=getBoundingClientRect(target);var numTouches=0;for(let t of Object.values(touches)){var idx32=idx>>2;HEAP32[idx32+0]=t.identifier;HEAP32[idx32+1]=t.screenX;HEAP32[idx32+2]=t.screenY;HEAP32[idx32+3]=t.clientX;HEAP32[idx32+4]=t.clientY;HEAP32[idx32+5]=t.pageX;HEAP32[idx32+6]=t.pageY;HEAP8[idx+28]=t.isChanged;HEAP8[idx+29]=t.onTarget;HEAP32[idx32+8]=t.clientX-(targetRect.left|0);HEAP32[idx32+9]=t.clientY-(targetRect.top|0);idx+=48;if(++numTouches>31){break}}HEAP32[touchEvent+8>>2]=numTouches;if(((a1,a2,a3)=>dynCall_iiii(callbackfunc,a1,a2,a3))(eventTypeId,touchEvent,userData))e.preventDefault()};var eventHandler={target,allowsDeferredCalls:eventTypeString=="touchstart"||eventTypeString=="touchend",eventTypeString,eventTypeId,userData,callbackfunc,handlerFunc:touchEventHandlerFunc,useCapture};return JSEvents.registerOrRemoveHandler(eventHandler)};var _emscripten_set_touchcancel_callback_on_thread=(target,userData,useCapture,callbackfunc,targetThread)=>registerTouchEventCallback(target,userData,useCapture,callbackfunc,25,"touchcancel",targetThread);var _emscripten_set_touchend_callback_on_thread=(target,userData,useCapture,callbackfunc,targetThread)=>registerTouchEventCallback(target,userData,useCapture,callbackfunc,23,"touchend",targetThread);var _emscripten_set_touchmove_callback_on_thread=(target,userData,useCapture,callbackfunc,targetThread)=>registerTouchEventCallback(target,userData,useCapture,callbackfunc,24,"touchmove",targetThread);var _emscripten_set_touchstart_callback_on_thread=(target,userData,useCapture,callbackfunc,targetThread)=>registerTouchEventCallback(target,userData,useCapture,callbackfunc,22,"touchstart",targetThread);var fillVisibilityChangeEventData=eventStruct=>{var visibilityStates=["hidden","visible","prerender","unloaded"];var visibilityState=visibilityStates.indexOf(document.visibilityState);HEAP8[eventStruct]=document.hidden;HEAP32[eventStruct+4>>2]=visibilityState};var registerVisibilityChangeEventCallback=(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread)=>{var eventSize=8;JSEvents.visibilityChangeEvent||=_malloc(eventSize);var visibilityChangeEventHandlerFunc=e=>{var visibilityChangeEvent=JSEvents.visibilityChangeEvent;fillVisibilityChangeEventData(visibilityChangeEvent);if(((a1,a2,a3)=>dynCall_iiii(callbackfunc,a1,a2,a3))(eventTypeId,visibilityChangeEvent,userData))e.preventDefault()};var eventHandler={target,eventTypeString,eventTypeId,userData,callbackfunc,handlerFunc:visibilityChangeEventHandlerFunc,useCapture};return JSEvents.registerOrRemoveHandler(eventHandler)};var _emscripten_set_visibilitychange_callback_on_thread=(userData,useCapture,callbackfunc,targetThread)=>{if(!specialHTMLTargets[1]){return-4}return registerVisibilityChangeEventCallback(specialHTMLTargets[1],userData,useCapture,callbackfunc,21,"visibilitychange",targetThread)};var handleException=e=>{if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS}quit_(1,e)};var runtimeKeepaliveCounter=0;var keepRuntimeAlive=()=>noExitRuntime||runtimeKeepaliveCounter>0;var _proc_exit=code=>{EXITSTATUS=code;if(!keepRuntimeAlive()){Module["onExit"]?.(code);ABORT=true}quit_(code,new ExitStatus(code))};var exitJS=(status,implicit)=>{EXITSTATUS=status;_proc_exit(status)};var _exit=exitJS;var maybeExit=()=>{if(!keepRuntimeAlive()){try{_exit(EXITSTATUS)}catch(e){handleException(e)}}};var callUserCallback=func=>{if(ABORT){return}try{return func()}catch(e){handleException(e)}finally{maybeExit()}};var safeSetTimeout=(func,timeout)=>setTimeout(()=>{callUserCallback(func)},timeout);var warnOnce=text=>{warnOnce.shown||={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;if(ENVIRONMENT_IS_NODE)text="warning: "+text;err(text)}};var Browser={useWebGL:false,isFullscreen:false,pointerLock:false,moduleContextCreatedCallbacks:[],workers:[],preloadedImages:{},preloadedAudios:{},getCanvas:()=>Module["canvas"],init(){if(Browser.initted)return;Browser.initted=true;var imagePlugin={};imagePlugin["canHandle"]=name=>!Module["noImageDecoding"]&&/\.(jpg|jpeg|png|bmp|webp)$/i.test(name);imagePlugin["handle"]=async(byteArray,name)=>{var b=new Blob([byteArray],{type:Browser.getMimetype(name)});if(b.size!==byteArray.length){b=new Blob([new Uint8Array(byteArray).buffer],{type:Browser.getMimetype(name)})}var url=URL.createObjectURL(b);return new Promise((resolve,reject)=>{var img=new Image;img.onload=()=>{var canvas=document.createElement("canvas");canvas.width=img.width;canvas.height=img.height;var ctx=canvas.getContext("2d");ctx.drawImage(img,0,0);Browser.preloadedImages[name]=canvas;URL.revokeObjectURL(url);resolve(byteArray)};img.onerror=event=>{err(`Image ${url} could not be decoded`);reject()};img.src=url})};preloadPlugins.push(imagePlugin);var audioPlugin={};audioPlugin["canHandle"]=name=>!Module["noAudioDecoding"]&&name.slice(-4)in{".ogg":1,".wav":1,".mp3":1};audioPlugin["handle"]=async(byteArray,name)=>new Promise((resolve,reject)=>{var done=false;function finish(audio){if(done)return;done=true;Browser.preloadedAudios[name]=audio;resolve(byteArray)}var b=new Blob([byteArray],{type:Browser.getMimetype(name)});var url=URL.createObjectURL(b);var audio=new Audio;audio.addEventListener("canplaythrough",()=>finish(audio),false);audio.onerror=event=>{if(done)return;err(`warning: browser could not fully decode audio ${name}, trying slower base64 approach`);function encode64(data){var BASE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var PAD="=";var ret="";var leftchar=0;var leftbits=0;for(var i=0;i<data.length;i++){leftchar=leftchar<<8|data[i];leftbits+=8;while(leftbits>=6){var curr=leftchar>>leftbits-6&63;leftbits-=6;ret+=BASE[curr]}}if(leftbits==2){ret+=BASE[(leftchar&3)<<4];ret+=PAD+PAD}else if(leftbits==4){ret+=BASE[(leftchar&15)<<2];ret+=PAD}return ret}audio.src="data:audio/x-"+name.slice(-3)+";base64,"+encode64(byteArray);finish(audio)};audio.src=url;safeSetTimeout(()=>{finish(audio)},1e4)});preloadPlugins.push(audioPlugin);function pointerLockChange(){var canvas=Browser.getCanvas();Browser.pointerLock=document.pointerLockElement===canvas}var canvas=Browser.getCanvas();if(canvas){document.addEventListener("pointerlockchange",pointerLockChange,false);if(Module["elementPointerLock"]){canvas.addEventListener("click",ev=>{if(!Browser.pointerLock&&Browser.getCanvas().requestPointerLock){Browser.getCanvas().requestPointerLock();ev.preventDefault()}},false)}}},createContext(canvas,useWebGL,setInModule,webGLContextAttributes){if(useWebGL&&Module["ctx"]&&canvas==Browser.getCanvas())return Module["ctx"];var ctx;var contextHandle;if(useWebGL){var contextAttributes={antialias:false,alpha:false,majorVersion:1};if(webGLContextAttributes){for(var attribute in webGLContextAttributes){contextAttributes[attribute]=webGLContextAttributes[attribute]}}if(typeof GL!="undefined"){contextHandle=GL.createContext(canvas,contextAttributes);if(contextHandle){ctx=GL.getContext(contextHandle).GLctx}}}else{ctx=canvas.getContext("2d")}if(!ctx)return null;if(setInModule){Module["ctx"]=ctx;if(useWebGL)GL.makeContextCurrent(contextHandle);Browser.useWebGL=useWebGL;Browser.moduleContextCreatedCallbacks.forEach(callback=>callback());Browser.init()}return ctx},fullscreenHandlersInstalled:false,lockPointer:undefined,resizeCanvas:undefined,requestFullscreen(lockPointer,resizeCanvas){Browser.lockPointer=lockPointer;Browser.resizeCanvas=resizeCanvas;if(typeof Browser.lockPointer=="undefined")Browser.lockPointer=true;if(typeof Browser.resizeCanvas=="undefined")Browser.resizeCanvas=false;var canvas=Browser.getCanvas();function fullscreenChange(){Browser.isFullscreen=false;var canvasContainer=canvas.parentNode;if(getFullscreenElement()===canvasContainer){canvas.exitFullscreen=Browser.exitFullscreen;if(Browser.lockPointer)canvas.requestPointerLock();Browser.isFullscreen=true;if(Browser.resizeCanvas){Browser.setFullscreenCanvasSize()}else{Browser.updateCanvasDimensions(canvas)}}else{canvasContainer.parentNode.insertBefore(canvas,canvasContainer);canvasContainer.parentNode.removeChild(canvasContainer);if(Browser.resizeCanvas){Browser.setWindowedCanvasSize()}else{Browser.updateCanvasDimensions(canvas)}}Module["onFullScreen"]?.(Browser.isFullscreen);Module["onFullscreen"]?.(Browser.isFullscreen)}if(!Browser.fullscreenHandlersInstalled){Browser.fullscreenHandlersInstalled=true;document.addEventListener("fullscreenchange",fullscreenChange,false);document.addEventListener("mozfullscreenchange",fullscreenChange,false);document.addEventListener("webkitfullscreenchange",fullscreenChange,false);document.addEventListener("MSFullscreenChange",fullscreenChange,false)}var canvasContainer=document.createElement("div");canvas.parentNode.insertBefore(canvasContainer,canvas);canvasContainer.appendChild(canvas);canvasContainer.requestFullscreen=canvasContainer["requestFullscreen"]||canvasContainer["mozRequestFullScreen"]||canvasContainer["msRequestFullscreen"]||(canvasContainer["webkitRequestFullscreen"]?()=>canvasContainer["webkitRequestFullscreen"](Element["ALLOW_KEYBOARD_INPUT"]):null)||(canvasContainer["webkitRequestFullScreen"]?()=>canvasContainer["webkitRequestFullScreen"](Element["ALLOW_KEYBOARD_INPUT"]):null);canvasContainer.requestFullscreen()},exitFullscreen(){if(!Browser.isFullscreen){return false}var CFS=document["exitFullscreen"]||document["cancelFullScreen"]||document["mozCancelFullScreen"]||document["msExitFullscreen"]||document["webkitCancelFullScreen"]||(()=>{});CFS.apply(document,[]);return true},safeSetTimeout(func,timeout){return safeSetTimeout(func,timeout)},getMimetype(name){return{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",bmp:"image/bmp",ogg:"audio/ogg",wav:"audio/wav",mp3:"audio/mpeg"}[name.slice(name.lastIndexOf(".")+1)]},getUserMedia(func){window.getUserMedia||=navigator["getUserMedia"]||navigator["mozGetUserMedia"];window.getUserMedia(func)},getMovementX(event){return event["movementX"]||event["mozMovementX"]||event["webkitMovementX"]||0},getMovementY(event){return event["movementY"]||event["mozMovementY"]||event["webkitMovementY"]||0},getMouseWheelDelta(event){var delta=0;switch(event.type){case"DOMMouseScroll":delta=event.detail/3;break;case"mousewheel":delta=event.wheelDelta/120;break;case"wheel":delta=event.deltaY;switch(event.deltaMode){case 0:delta/=100;break;case 1:delta/=3;break;case 2:delta*=80;break;default:abort("unrecognized mouse wheel delta mode: "+event.deltaMode)}break;default:abort("unrecognized mouse wheel event: "+event.type)}return delta},mouseX:0,mouseY:0,mouseMovementX:0,mouseMovementY:0,touches:{},lastTouches:{},calculateMouseCoords(pageX,pageY){var canvas=Browser.getCanvas();var rect=canvas.getBoundingClientRect();var adjustedX=pageX-(window.scrollX+rect.left);var adjustedY=pageY-(window.scrollY+rect.top);adjustedX=adjustedX*(canvas.width/rect.width);adjustedY=adjustedY*(canvas.height/rect.height);return{x:adjustedX,y:adjustedY}},setMouseCoords(pageX,pageY){const{x,y}=Browser.calculateMouseCoords(pageX,pageY);Browser.mouseMovementX=x-Browser.mouseX;Browser.mouseMovementY=y-Browser.mouseY;Browser.mouseX=x;Browser.mouseY=y},calculateMouseEvent(event){if(Browser.pointerLock){if(event.type!="mousemove"&&"mozMovementX"in event){Browser.mouseMovementX=Browser.mouseMovementY=0}else{Browser.mouseMovementX=Browser.getMovementX(event);Browser.mouseMovementY=Browser.getMovementY(event)}Browser.mouseX+=Browser.mouseMovementX;Browser.mouseY+=Browser.mouseMovementY}else{if(event.type==="touchstart"||event.type==="touchend"||event.type==="touchmove"){var touch=event.touch;if(touch===undefined){return}var coords=Browser.calculateMouseCoords(touch.pageX,touch.pageY);if(event.type==="touchstart"){Browser.lastTouches[touch.identifier]=coords;Browser.touches[touch.identifier]=coords}else if(event.type==="touchend"||event.type==="touchmove"){var last=Browser.touches[touch.identifier];last||=coords;Browser.lastTouches[touch.identifier]=last;Browser.touches[touch.identifier]=coords}return}Browser.setMouseCoords(event.pageX,event.pageY)}},resizeListeners:[],updateResizeListeners(){var canvas=Browser.getCanvas();Browser.resizeListeners.forEach(listener=>listener(canvas.width,canvas.height))},setCanvasSize(width,height,noUpdates){var canvas=Browser.getCanvas();Browser.updateCanvasDimensions(canvas,width,height);if(!noUpdates)Browser.updateResizeListeners()},windowedWidth:0,windowedHeight:0,setFullscreenCanvasSize(){if(typeof SDL!="undefined"){var flags=HEAPU32[SDL.screen>>2];flags=flags|8388608;HEAP32[SDL.screen>>2]=flags}Browser.updateCanvasDimensions(Browser.getCanvas());Browser.updateResizeListeners()},setWindowedCanvasSize(){if(typeof SDL!="undefined"){var flags=HEAPU32[SDL.screen>>2];flags=flags&~8388608;HEAP32[SDL.screen>>2]=flags}Browser.updateCanvasDimensions(Browser.getCanvas());Browser.updateResizeListeners()},updateCanvasDimensions(canvas,wNative,hNative){if(wNative&&hNative){canvas.widthNative=wNative;canvas.heightNative=hNative}else{wNative=canvas.widthNative;hNative=canvas.heightNative}var w=wNative;var h=hNative;if(Module["forcedAspectRatio"]>0){if(w/h<Module["forcedAspectRatio"]){w=Math.round(h*Module["forcedAspectRatio"])}else{h=Math.round(w/Module["forcedAspectRatio"])}}if(getFullscreenElement()===canvas.parentNode&&typeof screen!="undefined"){var factor=Math.min(screen.width/w,screen.height/h);w=Math.round(w*factor);h=Math.round(h*factor)}if(Browser.resizeCanvas){if(canvas.width!=w)canvas.width=w;if(canvas.height!=h)canvas.height=h;if(typeof canvas.style!="undefined"){canvas.style.removeProperty("width");canvas.style.removeProperty("height")}}else{if(canvas.width!=wNative)canvas.width=wNative;if(canvas.height!=hNative)canvas.height=hNative;if(typeof canvas.style!="undefined"){if(w!=wNative||h!=hNative){canvas.style.setProperty("width",w+"px","important");canvas.style.setProperty("height",h+"px","important")}else{canvas.style.removeProperty("width");canvas.style.removeProperty("height")}}}}};var _emscripten_set_window_title=title=>document.title=UTF8ToString(title);var _emscripten_sleep=function(ms){let innerFunc=()=>new Promise(resolve=>setTimeout(resolve,ms));return Asyncify.handleAsync(innerFunc)};_emscripten_sleep.isAsync=true;function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var doReadv=(stream,iov,iovcnt,offset)=>{var ret=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.read(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr<len)break;if(typeof offset!="undefined"){offset+=curr}}return ret};function _fd_read(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doReadv(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}function _fd_seek(fd,offset,whence,newOffset){offset=bigintToI53Checked(offset);try{if(isNaN(offset))return 22;var stream=SYSCALLS.getStreamFromFD(fd);FS.llseek(stream,offset,whence);HEAP64[newOffset>>3]=BigInt(stream.position);if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var doWritev=(stream,iov,iovcnt,offset)=>{var ret=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.write(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr<len){break}if(typeof offset!="undefined"){offset+=curr}}return ret};function _fd_write(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doWritev(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var _glActiveTexture=_emscripten_glActiveTexture;var _glAttachShader=_emscripten_glAttachShader;var _glBindAttribLocation=_emscripten_glBindAttribLocation;var _glBindBuffer=_emscripten_glBindBuffer;var _glBindTexture=_emscripten_glBindTexture;var _glBlendFunc=_emscripten_glBlendFunc;var _glBufferData=_emscripten_glBufferData;var _glBufferSubData=_emscripten_glBufferSubData;var _glClear=_emscripten_glClear;var _glClearColor=_emscripten_glClearColor;var _glClearDepthf=_emscripten_glClearDepthf;var _glCompileShader=_emscripten_glCompileShader;var _glCompressedTexImage2D=_emscripten_glCompressedTexImage2D;var _glCreateProgram=_emscripten_glCreateProgram;var _glCreateShader=_emscripten_glCreateShader;var _glCullFace=_emscripten_glCullFace;var _glDeleteBuffers=_emscripten_glDeleteBuffers;var _glDeleteProgram=_emscripten_glDeleteProgram;var _glDeleteShader=_emscripten_glDeleteShader;var _glDeleteTextures=_emscripten_glDeleteTextures;var _glDepthFunc=_emscripten_glDepthFunc;var _glDetachShader=_emscripten_glDetachShader;var _glDisable=_emscripten_glDisable;var _glDisableVertexAttribArray=_emscripten_glDisableVertexAttribArray;var _glDrawArrays=_emscripten_glDrawArrays;var _glDrawElements=_emscripten_glDrawElements;var _glEnable=_emscripten_glEnable;var _glEnableVertexAttribArray=_emscripten_glEnableVertexAttribArray;var _glFrontFace=_emscripten_glFrontFace;var _glGenBuffers=_emscripten_glGenBuffers;var _glGenTextures=_emscripten_glGenTextures;var _glGetAttribLocation=_emscripten_glGetAttribLocation;var _glGetFloatv=_emscripten_glGetFloatv;var _glGetProgramInfoLog=_emscripten_glGetProgramInfoLog;var _glGetProgramiv=_emscripten_glGetProgramiv;var _glGetShaderInfoLog=_emscripten_glGetShaderInfoLog;var _glGetShaderiv=_emscripten_glGetShaderiv;var _glGetString=_emscripten_glGetString;var _glGetUniformLocation=_emscripten_glGetUniformLocation;var _glLinkProgram=_emscripten_glLinkProgram;var _glPixelStorei=_emscripten_glPixelStorei;var _glReadPixels=_emscripten_glReadPixels;var _glShaderSource=_emscripten_glShaderSource;var _glTexImage2D=_emscripten_glTexImage2D;var _glTexParameteri=_emscripten_glTexParameteri;var _glUniform1i=_emscripten_glUniform1i;var _glUniform4f=_emscripten_glUniform4f;var _glUniform4fv=_emscripten_glUniform4fv;var _glUniformMatrix4fv=_emscripten_glUniformMatrix4fv;var _glUseProgram=_emscripten_glUseProgram;var _glVertexAttribPointer=_emscripten_glVertexAttribPointer;var _glViewport=_emscripten_glViewport;function GLFW_Window(id,width,height,framebufferWidth,framebufferHeight,title,monitor,share){this.id=id;this.x=0;this.y=0;this.fullscreen=false;this.storedX=0;this.storedY=0;this.width=width;this.height=height;this.framebufferWidth=framebufferWidth;this.framebufferHeight=framebufferHeight;this.storedWidth=width;this.storedHeight=height;this.title=title;this.monitor=monitor;this.share=share;this.attributes={...GLFW.hints};this.inputModes={208897:212993,208898:0,208899:0};this.buttons=0;this.keys=new Array;this.domKeys=new Array;this.shouldClose=0;this.title=null;this.windowPosFunc=0;this.windowSizeFunc=0;this.windowCloseFunc=0;this.windowRefreshFunc=0;this.windowFocusFunc=0;this.windowIconifyFunc=0;this.windowMaximizeFunc=0;this.framebufferSizeFunc=0;this.windowContentScaleFunc=0;this.mouseButtonFunc=0;this.cursorPosFunc=0;this.cursorEnterFunc=0;this.scrollFunc=0;this.dropFunc=0;this.keyFunc=0;this.charFunc=0;this.userptr=0}var _emscripten_set_main_loop_timing=(mode,value)=>{MainLoop.timingMode=mode;MainLoop.timingValue=value;if(!MainLoop.func){return 1}if(!MainLoop.running){MainLoop.running=true}if(mode==0){MainLoop.scheduler=function MainLoop_scheduler_setTimeout(){var timeUntilNextTick=Math.max(0,MainLoop.tickStartTime+value-_emscripten_get_now())|0;setTimeout(MainLoop.runner,timeUntilNextTick)}}else if(mode==1){MainLoop.scheduler=function MainLoop_scheduler_rAF(){MainLoop.requestAnimationFrame(MainLoop.runner)}}else{if(!MainLoop.setImmediate){if(globalThis.setImmediate){MainLoop.setImmediate=setImmediate}else{var setImmediates=[];var emscriptenMainLoopMessageId="setimmediate";var MainLoop_setImmediate_messageHandler=event=>{if(event.data===emscriptenMainLoopMessageId||event.data.target===emscriptenMainLoopMessageId){event.stopPropagation();setImmediates.shift()()}};addEventListener("message",MainLoop_setImmediate_messageHandler,true);MainLoop.setImmediate=func=>{setImmediates.push(func);if(ENVIRONMENT_IS_WORKER){Module["setImmediates"]??=[];Module["setImmediates"].push(func);postMessage({target:emscriptenMainLoopMessageId})}else postMessage(emscriptenMainLoopMessageId,"*")}}}MainLoop.scheduler=function MainLoop_scheduler_setImmediate(){MainLoop.setImmediate(MainLoop.runner)}}return 0};var setMainLoop=(iterFunc,fps,simulateInfiniteLoop,arg,noSetTiming)=>{MainLoop.func=iterFunc;MainLoop.arg=arg;var thisMainLoopId=MainLoop.currentlyRunningMainloop;function checkIsRunning(){if(thisMainLoopId<MainLoop.currentlyRunningMainloop){maybeExit();return false}return true}MainLoop.running=false;MainLoop.runner=function MainLoop_runner(){if(ABORT)return;if(MainLoop.queue.length>0){var start=Date.now();var blocker=MainLoop.queue.shift();blocker.func(blocker.arg);if(MainLoop.remainingBlockers){var remaining=MainLoop.remainingBlockers;var next=remaining%1==0?remaining-1:Math.floor(remaining);if(blocker.counted){MainLoop.remainingBlockers=next}else{next=next+.5;MainLoop.remainingBlockers=(8*remaining+next)/9}}MainLoop.updateStatus();if(!checkIsRunning())return;setTimeout(MainLoop.runner,0);return}if(!checkIsRunning())return;MainLoop.currentFrameNumber=MainLoop.currentFrameNumber+1|0;if(MainLoop.timingMode==1&&MainLoop.timingValue>1&&MainLoop.currentFrameNumber%MainLoop.timingValue!=0){MainLoop.scheduler();return}else if(MainLoop.timingMode==0){MainLoop.tickStartTime=_emscripten_get_now()}MainLoop.runIter(iterFunc);if(!checkIsRunning())return;MainLoop.scheduler()};if(!noSetTiming){if(fps>0){_emscripten_set_main_loop_timing(0,1e3/fps)}else{_emscripten_set_main_loop_timing(1,1)}MainLoop.scheduler()}if(simulateInfiniteLoop){throw"unwind"}};var MainLoop={running:false,scheduler:null,currentlyRunningMainloop:0,func:null,arg:0,timingMode:0,timingValue:0,currentFrameNumber:0,queue:[],preMainLoop:[],postMainLoop:[],pause(){MainLoop.scheduler=null;MainLoop.currentlyRunningMainloop++},resume(){MainLoop.currentlyRunningMainloop++;var timingMode=MainLoop.timingMode;var timingValue=MainLoop.timingValue;var func=MainLoop.func;MainLoop.func=null;setMainLoop(func,0,false,MainLoop.arg,true);_emscripten_set_main_loop_timing(timingMode,timingValue);MainLoop.scheduler()},updateStatus(){if(Module["setStatus"]){var message=Module["statusMessage"]||"Please wait...";var remaining=MainLoop.remainingBlockers??0;var expected=MainLoop.expectedBlockers??0;if(remaining){if(remaining<expected){Module["setStatus"](`{message} ({expected - remaining}/{expected})`)}else{Module["setStatus"](message)}}else{Module["setStatus"]("")}}},init(){Module["preMainLoop"]&&MainLoop.preMainLoop.push(Module["preMainLoop"]);Module["postMainLoop"]&&MainLoop.postMainLoop.push(Module["postMainLoop"])},runIter(func){if(ABORT)return;for(var pre of MainLoop.preMainLoop){if(pre()===false){return}}callUserCallback(func);for(var post of MainLoop.postMainLoop){post()}},nextRAF:0,fakeRequestAnimationFrame(func){var now=Date.now();if(MainLoop.nextRAF===0){MainLoop.nextRAF=now+1e3/60}else{while(now+2>=MainLoop.nextRAF){MainLoop.nextRAF+=1e3/60}}var delay=Math.max(MainLoop.nextRAF-now,0);setTimeout(func,delay)},requestAnimationFrame(func){if(globalThis.requestAnimationFrame){requestAnimationFrame(func)}else{MainLoop.fakeRequestAnimationFrame(func)}}};var GLFW={WindowFromId:id=>{if(id<=0||!GLFW.windows)return null;return GLFW.windows[id-1]},joystickFunc:0,errorFunc:0,monitorFunc:0,active:null,scale:null,windows:null,monitors:null,monitorString:null,versionString:null,initialTime:null,extensions:null,devicePixelRatioMQL:null,hints:null,primaryTouchId:null,defaultHints:{131073:0,131074:0,131075:1,131076:1,131077:1,131082:0,135169:8,135170:8,135171:8,135172:8,135173:24,135174:8,135175:0,135176:0,135177:0,135178:0,135179:0,135180:0,135181:0,135182:0,135183:0,139265:196609,139266:1,139267:0,139268:0,139269:0,139270:0,139271:0,139272:0,139276:0},DOMToGLFWKeyCode:keycode=>{switch(keycode){case 32:return 32;case 222:return 39;case 188:return 44;case 173:return 45;case 189:return 45;case 190:return 46;case 191:return 47;case 48:return 48;case 49:return 49;case 50:return 50;case 51:return 51;case 52:return 52;case 53:return 53;case 54:return 54;case 55:return 55;case 56:return 56;case 57:return 57;case 59:return 59;case 61:return 61;case 187:return 61;case 65:return 65;case 66:return 66;case 67:return 67;case 68:return 68;case 69:return 69;case 70:return 70;case 71:return 71;case 72:return 72;case 73:return 73;case 74:return 74;case 75:return 75;case 76:return 76;case 77:return 77;case 78:return 78;case 79:return 79;case 80:return 80;case 81:return 81;case 82:return 82;case 83:return 83;case 84:return 84;case 85:return 85;case 86:return 86;case 87:return 87;case 88:return 88;case 89:return 89;case 90:return 90;case 219:return 91;case 220:return 92;case 221:return 93;case 192:return 96;case 27:return 256;case 13:return 257;case 9:return 258;case 8:return 259;case 45:return 260;case 46:return 261;case 39:return 262;case 37:return 263;case 40:return 264;case 38:return 265;case 33:return 266;case 34:return 267;case 36:return 268;case 35:return 269;case 20:return 280;case 145:return 281;case 144:return 282;case 44:return 283;case 19:return 284;case 112:return 290;case 113:return 291;case 114:return 292;case 115:return 293;case 116:return 294;case 117:return 295;case 118:return 296;case 119:return 297;case 120:return 298;case 121:return 299;case 122:return 300;case 123:return 301;case 124:return 302;case 125:return 303;case 126:return 304;case 127:return 305;case 128:return 306;case 129:return 307;case 130:return 308;case 131:return 309;case 132:return 310;case 133:return 311;case 134:return 312;case 135:return 313;case 136:return 314;case 96:return 320;case 97:return 321;case 98:return 322;case 99:return 323;case 100:return 324;case 101:return 325;case 102:return 326;case 103:return 327;case 104:return 328;case 105:return 329;case 110:return 330;case 111:return 331;case 106:return 332;case 109:return 333;case 107:return 334;case 16:return 340;case 17:return 341;case 18:return 342;case 91:return 343;case 224:return 343;case 93:return 348;default:return-1}},getModBits:win=>{var mod=0;if(win.keys[340])mod|=1;if(win.keys[341])mod|=2;if(win.keys[342])mod|=4;if(win.keys[343]||win.keys[348])mod|=8;return mod},onKeyPress:event=>{if(!GLFW.active||!GLFW.active.charFunc)return;if(event.ctrlKey||event.metaKey)return;var charCode=event.charCode;if(charCode==0||charCode>=0&&charCode<=31)return;((a1,a2)=>dynCall_vii(GLFW.active.charFunc,a1,a2))(GLFW.active.id,charCode)},onKeyChanged:(keyCode,status)=>{if(!GLFW.active)return;var key=GLFW.DOMToGLFWKeyCode(keyCode);if(key==-1)return;var repeat=status&&GLFW.active.keys[key];GLFW.active.keys[key]=status;GLFW.active.domKeys[keyCode]=status;if(GLFW.active.keyFunc){if(repeat)status=2;((a1,a2,a3,a4,a5)=>dynCall_viiiii(GLFW.active.keyFunc,a1,a2,a3,a4,a5))(GLFW.active.id,key,keyCode,status,GLFW.getModBits(GLFW.active))}},onGamepadConnected:event=>{GLFW.refreshJoysticks()},onGamepadDisconnected:event=>{GLFW.refreshJoysticks()},onKeydown:event=>{GLFW.onKeyChanged(event.keyCode,1);if(event.key=="Backspace"||event.key=="Tab"){event.preventDefault()}},onKeyup:event=>{GLFW.onKeyChanged(event.keyCode,0)},onBlur:event=>{if(!GLFW.active)return;for(var i=0;i<GLFW.active.domKeys.length;++i){if(GLFW.active.domKeys[i]){GLFW.onKeyChanged(i,0)}}},onMousemove:event=>{if(!GLFW.active)return;if(event.type==="touchmove"){event.preventDefault();let primaryChanged=false;for(let i of event.changedTouches){if(GLFW.primaryTouchId===i.identifier){Browser.setMouseCoords(i.pageX,i.pageY);primaryChanged=true;break}}if(!primaryChanged){return}}else{Browser.calculateMouseEvent(event)}if(event.target!=Browser.getCanvas()||!GLFW.active.cursorPosFunc)return;if(GLFW.active.cursorPosFunc){((a1,a2,a3)=>dynCall_vidd(GLFW.active.cursorPosFunc,a1,a2,a3))(GLFW.active.id,Browser.mouseX,Browser.mouseY)}},DOMToGLFWMouseButton:event=>{var eventButton=event["button"];if(eventButton>0){if(eventButton==1){eventButton=2}else{eventButton=1}}return eventButton},onMouseenter:event=>{if(!GLFW.active)return;if(event.target!=Browser.getCanvas())return;if(GLFW.active.cursorEnterFunc){((a1,a2)=>dynCall_vii(GLFW.active.cursorEnterFunc,a1,a2))(GLFW.active.id,1)}},onMouseleave:event=>{if(!GLFW.active)return;if(event.target!=Browser.getCanvas())return;if(GLFW.active.cursorEnterFunc){((a1,a2)=>dynCall_vii(GLFW.active.cursorEnterFunc,a1,a2))(GLFW.active.id,0)}},onMouseButtonChanged:(event,status)=>{if(!GLFW.active)return;if(event.target!=Browser.getCanvas())return;const isTouchType=event.type==="touchstart"||event.type==="touchend"||event.type==="touchcancel";let eventButton=0;if(isTouchType){event.preventDefault();let primaryChanged=false;if(GLFW.primaryTouchId===null&&event.type==="touchstart"&&event.targetTouches.length>0){const chosenTouch=event.targetTouches[0];GLFW.primaryTouchId=chosenTouch.identifier;Browser.setMouseCoords(chosenTouch.pageX,chosenTouch.pageY);primaryChanged=true}else if(event.type==="touchend"||event.type==="touchcancel"){for(let i of event.changedTouches){if(GLFW.primaryTouchId===i.identifier){GLFW.primaryTouchId=null;primaryChanged=true;break}}}if(!primaryChanged){return}}else{Browser.calculateMouseEvent(event);eventButton=GLFW.DOMToGLFWMouseButton(event)}if(status==1){GLFW.active.buttons|=1<<eventButton;try{event.target.setCapture()}catch(e){}}else{GLFW.active.buttons&=~(1<<eventButton)}if(GLFW.active.mouseButtonFunc){((a1,a2,a3,a4)=>dynCall_viiii(GLFW.active.mouseButtonFunc,a1,a2,a3,a4))(GLFW.active.id,eventButton,status,GLFW.getModBits(GLFW.active))}},onMouseButtonDown:event=>{if(!GLFW.active)return;GLFW.onMouseButtonChanged(event,1)},onMouseButtonUp:event=>{if(!GLFW.active)return;GLFW.onMouseButtonChanged(event,0)},onMouseWheel:event=>{var delta=-Browser.getMouseWheelDelta(event);delta=delta==0?0:delta>0?Math.max(delta,1):Math.min(delta,-1);GLFW.wheelPos+=delta;if(!GLFW.active||!GLFW.active.scrollFunc||event.target!=Browser.getCanvas())return;var sx=0;var sy=delta;if(event.type=="mousewheel"){sx=event.wheelDeltaX}else{sx=event.deltaX}((a1,a2,a3)=>dynCall_vidd(GLFW.active.scrollFunc,a1,a2,a3))(GLFW.active.id,sx,sy);event.preventDefault()},onCanvasResize:(width,height,framebufferWidth,framebufferHeight)=>{if(!GLFW.active)return;var resizeNeeded=false;if(getFullscreenElement()){if(!GLFW.active.fullscreen){resizeNeeded=width!=screen.width||height!=screen.height;GLFW.active.storedX=GLFW.active.x;GLFW.active.storedY=GLFW.active.y;GLFW.active.storedWidth=GLFW.active.width;GLFW.active.storedHeight=GLFW.active.height;GLFW.active.x=GLFW.active.y=0;GLFW.active.width=screen.width;GLFW.active.height=screen.height;GLFW.active.fullscreen=true}}else if(GLFW.active.fullscreen==true){resizeNeeded=width!=GLFW.active.storedWidth||height!=GLFW.active.storedHeight;GLFW.active.x=GLFW.active.storedX;GLFW.active.y=GLFW.active.storedY;GLFW.active.width=GLFW.active.storedWidth;GLFW.active.height=GLFW.active.storedHeight;GLFW.active.fullscreen=false}if(resizeNeeded){Browser.setCanvasSize(GLFW.active.width,GLFW.active.height)}else if(GLFW.active.width!=width||GLFW.active.height!=height||GLFW.active.framebufferWidth!=framebufferWidth||GLFW.active.framebufferHeight!=framebufferHeight){GLFW.active.width=width;GLFW.active.height=height;GLFW.active.framebufferWidth=framebufferWidth;GLFW.active.framebufferHeight=framebufferHeight;GLFW.onWindowSizeChanged();GLFW.onFramebufferSizeChanged()}},onWindowSizeChanged:()=>{if(!GLFW.active)return;if(GLFW.active.windowSizeFunc){((a1,a2,a3)=>dynCall_viii(GLFW.active.windowSizeFunc,a1,a2,a3))(GLFW.active.id,GLFW.active.width,GLFW.active.height)}},onFramebufferSizeChanged:()=>{if(!GLFW.active)return;if(GLFW.active.framebufferSizeFunc){((a1,a2,a3)=>dynCall_viii(GLFW.active.framebufferSizeFunc,a1,a2,a3))(GLFW.active.id,GLFW.active.framebufferWidth,GLFW.active.framebufferHeight)}},onWindowContentScaleChanged:scale=>{GLFW.scale=scale;if(!GLFW.active)return;if(GLFW.active.windowContentScaleFunc){((a1,a2,a3)=>dynCall_viff(GLFW.active.windowContentScaleFunc,a1,a2,a3))(GLFW.active.id,GLFW.scale,GLFW.scale)}},getTime:()=>_emscripten_get_now()/1e3,setWindowTitle:(winid,title)=>{var win=GLFW.WindowFromId(winid);if(!win)return;win.title=title;if(GLFW.active.id==win.id){_emscripten_set_window_title(title)}},setJoystickCallback:cbfun=>{var prevcbfun=GLFW.joystickFunc;GLFW.joystickFunc=cbfun;GLFW.refreshJoysticks();return prevcbfun},joys:{},lastGamepadState:[],lastGamepadStateFrame:null,refreshJoysticks:()=>{if(MainLoop.currentFrameNumber!==GLFW.lastGamepadStateFrame||!MainLoop.currentFrameNumber){GLFW.lastGamepadState=navigator.getGamepads?navigator.getGamepads():navigator.webkitGetGamepads||[];GLFW.lastGamepadStateFrame=MainLoop.currentFrameNumber;for(var joy=0;joy<GLFW.lastGamepadState.length;++joy){var gamepad=GLFW.lastGamepadState[joy];if(gamepad){if(!GLFW.joys[joy]){out("glfw joystick connected:",joy);GLFW.joys[joy]={id:stringToNewUTF8(gamepad.id),buttonsCount:gamepad.buttons.length,axesCount:gamepad.axes.length,buttons:_malloc(gamepad.buttons.length),axes:_malloc(gamepad.axes.length*4)};if(GLFW.joystickFunc){((a1,a2)=>dynCall_vii(GLFW.joystickFunc,a1,a2))(joy,262145)}}var data=GLFW.joys[joy];for(var i=0;i<gamepad.buttons.length;++i){HEAP8[data.buttons+i]=gamepad.buttons[i].pressed}for(var i=0;i<gamepad.axes.length;++i){HEAPF32[data.axes+i*4>>2]=gamepad.axes[i]}}else{if(GLFW.joys[joy]){out("glfw joystick disconnected",joy);if(GLFW.joystickFunc){((a1,a2)=>dynCall_vii(GLFW.joystickFunc,a1,a2))(joy,262146)}_free(GLFW.joys[joy].id);_free(GLFW.joys[joy].buttons);_free(GLFW.joys[joy].axes);delete GLFW.joys[joy]}}}}},setKeyCallback:(winid,cbfun)=>{var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.keyFunc;win.keyFunc=cbfun;return prevcbfun},setCharCallback:(winid,cbfun)=>{var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.charFunc;win.charFunc=cbfun;return prevcbfun},setMouseButtonCallback:(winid,cbfun)=>{var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.mouseButtonFunc;win.mouseButtonFunc=cbfun;return prevcbfun},setCursorPosCallback:(winid,cbfun)=>{var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.cursorPosFunc;win.cursorPosFunc=cbfun;return prevcbfun},setScrollCallback:(winid,cbfun)=>{var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.scrollFunc;win.scrollFunc=cbfun;return prevcbfun},setDropCallback:(winid,cbfun)=>{var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.dropFunc;win.dropFunc=cbfun;return prevcbfun},onDrop:event=>{if(!GLFW.active||!GLFW.active.dropFunc)return;if(!event.dataTransfer||!event.dataTransfer.files||event.dataTransfer.files.length==0)return;event.preventDefault();var drop_dir=".glfw_dropped_files";var filenames=_malloc(event.dataTransfer.files.length*4);var filenamesArray=[];for(var i=0;i<event.dataTransfer.files.length;++i){var path=`/${drop_dir}/${event.dataTransfer.files[i].name.replace(/\//g,"_")}`;var filename=stringToNewUTF8(path);filenamesArray.push(filename);HEAPU32[filenames+i*4>>2]=filename}var written=0;FS.createPath("/",drop_dir);function save(file,in_path,numfiles){var path="/"+drop_dir+in_path+"/"+file.name.replace(/\//g,"_");var reader=new FileReader;reader.onloadend=e=>{if(reader.readyState!=2){++written;err(`failed to read dropped file: ${in_path}/${file.name}: ${reader.error}`);return}var data=e.target.result;FS.writeFile(path,new Uint8Array(data));if(++written===numfiles){((a1,a2,a3)=>dynCall_viii(GLFW.active.dropFunc,a1,a2,a3))(GLFW.active.id,filenamesArray.length,filenames);for(var i=0;i<filenamesArray.length;++i){_free(filenamesArray[i])}_free(filenames)}};reader.readAsArrayBuffer(file)}let filesQ=[];function finalize(){var count=filesQ.length;for(var i=0;i<count;++i){save(filesQ[i].file,filesQ[i].path,count)}}if(DataTransferItem.prototype.webkitGetAsEntry){let entriesTree={};function markDone(fullpath,recursive){if(entriesTree[fullpath].subpaths.length!=0)return;delete entriesTree[fullpath];let parentpath=fullpath.substring(0,fullpath.lastIndexOf("/"));if(!entriesTree.hasOwnProperty(parentpath)){if(Object.keys(entriesTree).length==0)finalize();return}const fpIndex=entriesTree[parentpath].subpaths.indexOf(fullpath);if(fpIndex>-1)entriesTree[parentpath].subpaths.splice(fpIndex,1);if(recursive)markDone(parentpath,true);if(Object.keys(entriesTree).length==0)finalize()}function processEntry(entry){let fp=entry.fullPath;let pp=fp.substring(0,fp.lastIndexOf("/"));entriesTree[fp]={subpaths:[]};if(entry.isFile){entry.file(f=>{filesQ.push({file:f,path:pp});markDone(fp,false)})}else if(entry.isDirectory){if(entriesTree.hasOwnProperty(pp))entriesTree[pp].subpaths.push(fp);FS.createPath("/"+drop_dir+pp,entry.name);var reader=entry.createReader();var rRead=function(dirEntries){if(dirEntries.length==0){markDone(fp,true);return}for(const ent of dirEntries)processEntry(ent);reader.readEntries(rRead)};reader.readEntries(rRead)}}for(const item of event.dataTransfer.items){processEntry(item.webkitGetAsEntry())}}else{for(const file of event.dataTransfer.files){filesQ.push({file,path:""})}finalize()}return false},onDragover:event=>{if(!GLFW.active||!GLFW.active.dropFunc)return;event.preventDefault();return false},setWindowSizeCallback:(winid,cbfun)=>{var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.windowSizeFunc;win.windowSizeFunc=cbfun;return prevcbfun},setWindowCloseCallback:(winid,cbfun)=>{var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.windowCloseFunc;win.windowCloseFunc=cbfun;return prevcbfun},setWindowRefreshCallback:(winid,cbfun)=>{var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.windowRefreshFunc;win.windowRefreshFunc=cbfun;return prevcbfun},onClickRequestPointerLock:e=>{var canvas=Browser.getCanvas();if(!Browser.pointerLock&&canvas.requestPointerLock){canvas.requestPointerLock();e.preventDefault()}},setInputMode:(winid,mode,value)=>{var win=GLFW.WindowFromId(winid);if(!win)return;switch(mode){case 208897:{var canvas=Browser.getCanvas();switch(value){case 212993:{win.inputModes[mode]=value;canvas.removeEventListener("click",GLFW.onClickRequestPointerLock,true);document.exitPointerLock();break}case 212994:{err("glfwSetInputMode called with GLFW_CURSOR_HIDDEN value not implemented");break}case 212995:{win.inputModes[mode]=value;canvas.addEventListener("click",GLFW.onClickRequestPointerLock,true);canvas.requestPointerLock();break}default:{err(`glfwSetInputMode called with unknown value parameter value: ${value}`);break}}break}case 208898:{err("glfwSetInputMode called with GLFW_STICKY_KEYS mode not implemented");break}case 208899:{err("glfwSetInputMode called with GLFW_STICKY_MOUSE_BUTTONS mode not implemented");break}case 208900:{err("glfwSetInputMode called with GLFW_LOCK_KEY_MODS mode not implemented");break}case 208901:{err("glfwSetInputMode called with GLFW_RAW_MOUSE_MOTION mode not implemented");break}default:{err(`glfwSetInputMode called with unknown mode parameter value: ${mode}`);break}}},getKey:(winid,key)=>{var win=GLFW.WindowFromId(winid);if(!win)return 0;return win.keys[key]},getMouseButton:(winid,button)=>{var win=GLFW.WindowFromId(winid);if(!win)return 0;return(win.buttons&1<<button)>0},getCursorPos:(winid,x,y)=>{HEAPF64[x>>3]=Browser.mouseX;HEAPF64[y>>3]=Browser.mouseY},getMousePos:(winid,x,y)=>{HEAP32[x>>2]=Browser.mouseX;HEAP32[y>>2]=Browser.mouseY},setCursorPos:(winid,x,y)=>{},getWindowPos:(winid,x,y)=>{var wx=0;var wy=0;var win=GLFW.WindowFromId(winid);if(win){wx=win.x;wy=win.y}if(x){HEAP32[x>>2]=wx}if(y){HEAP32[y>>2]=wy}},setWindowPos:(winid,x,y)=>{var win=GLFW.WindowFromId(winid);if(!win)return;win.x=x;win.y=y},getWindowSize:(winid,width,height)=>{var ww=0;var wh=0;var win=GLFW.WindowFromId(winid);if(win){ww=win.width;wh=win.height}if(width){HEAP32[width>>2]=ww}if(height){HEAP32[height>>2]=wh}},setWindowSize:(winid,width,height)=>{var win=GLFW.WindowFromId(winid);if(!win)return;if(GLFW.active.id==win.id){Browser.setCanvasSize(width,height)}},defaultWindowHints:()=>{GLFW.hints={...GLFW.defaultHints}},createWindow:(width,height,title,monitor,share)=>{var i,id;for(i=0;i<GLFW.windows.length&&GLFW.windows[i]!==null;i++){}if(i>0)abort("glfwCreateWindow only supports one window at time currently");id=i+1;if(width<=0||height<=0)return 0;if(monitor){Browser.requestFullscreen()}else{Browser.setCanvasSize(width,height)}for(i=0;i<GLFW.windows.length&&GLFW.windows[i]==null;i++){}const canvas=Browser.getCanvas();var useWebGL=GLFW.hints[139265]>0;if(i==GLFW.windows.length){if(useWebGL){var contextAttributes={antialias:GLFW.hints[135181]>1,depth:GLFW.hints[135173]>0,stencil:GLFW.hints[135174]>0,alpha:GLFW.hints[135172]>0};Browser.createContext(canvas,true,true,contextAttributes)}else{Browser.init()}}if(!Module["ctx"]&&useWebGL)return 0;var win=new GLFW_Window(id,width,height,canvas.width,canvas.height,title,monitor,share);if(id-1==GLFW.windows.length){GLFW.windows.push(win)}else{GLFW.windows[id-1]=win}GLFW.active=win;GLFW.adjustCanvasDimensions();return win.id},destroyWindow:winid=>{var win=GLFW.WindowFromId(winid);if(!win)return;if(win.windowCloseFunc){(a1=>dynCall_vi(win.windowCloseFunc,a1))(win.id)}GLFW.windows[win.id-1]=null;if(GLFW.active.id==win.id){GLFW.active=null}for(win of GLFW.windows){if(win!==null)return}delete Module["ctx"]},swapBuffers:winid=>{},requestFullscreen(lockPointer,resizeCanvas){Browser.lockPointer=lockPointer;Browser.resizeCanvas=resizeCanvas;if(typeof Browser.lockPointer=="undefined")Browser.lockPointer=true;if(typeof Browser.resizeCanvas=="undefined")Browser.resizeCanvas=false;var canvas=Browser.getCanvas();function fullscreenChange(){Browser.isFullscreen=false;var canvasContainer=canvas.parentNode;if(getFullscreenElement()===canvasContainer){canvas.exitFullscreen=Browser.exitFullscreen;if(Browser.lockPointer)canvas.requestPointerLock();Browser.isFullscreen=true;if(Browser.resizeCanvas){Browser.setFullscreenCanvasSize()}else{Browser.updateCanvasDimensions(canvas);Browser.updateResizeListeners()}}else{canvasContainer.parentNode.insertBefore(canvas,canvasContainer);canvasContainer.parentNode.removeChild(canvasContainer);if(Browser.resizeCanvas){Browser.setWindowedCanvasSize()}else{Browser.updateCanvasDimensions(canvas);Browser.updateResizeListeners()}}Module["onFullScreen"]?.(Browser.isFullscreen);Module["onFullscreen"]?.(Browser.isFullscreen)}if(!Browser.fullscreenHandlersInstalled){Browser.fullscreenHandlersInstalled=true;document.addEventListener("fullscreenchange",fullscreenChange,false);document.addEventListener("mozfullscreenchange",fullscreenChange,false);document.addEventListener("webkitfullscreenchange",fullscreenChange,false);document.addEventListener("MSFullscreenChange",fullscreenChange,false)}var canvasContainer=document.createElement("div");canvas.parentNode.insertBefore(canvasContainer,canvas);canvasContainer.appendChild(canvas);canvasContainer.requestFullscreen=canvasContainer["requestFullscreen"]||canvasContainer["mozRequestFullScreen"]||canvasContainer["msRequestFullscreen"]||(canvasContainer["webkitRequestFullscreen"]?()=>canvasContainer["webkitRequestFullscreen"](Element["ALLOW_KEYBOARD_INPUT"]):null)||(canvasContainer["webkitRequestFullScreen"]?()=>canvasContainer["webkitRequestFullScreen"](Element["ALLOW_KEYBOARD_INPUT"]):null);canvasContainer.requestFullscreen()},updateCanvasDimensions(canvas,wNative,hNative){const scale=GLFW.getHiDPIScale();if(wNative&&hNative){canvas.widthNative=wNative;canvas.heightNative=hNative}else{wNative=canvas.widthNative;hNative=canvas.heightNative}var w=wNative;var h=hNative;if(Module["forcedAspectRatio"]&&Module["forcedAspectRatio"]>0){if(w/h<Module["forcedAspectRatio"]){w=Math.round(h*Module["forcedAspectRatio"])}else{h=Math.round(w/Module["forcedAspectRatio"])}}if(getFullscreenElement()===canvas.parentNode&&typeof screen!="undefined"){var factor=Math.min(screen.width/w,screen.height/h);w=Math.round(w*factor);h=Math.round(h*factor)}if(Browser.resizeCanvas){wNative=w;hNative=h}const wNativeScaled=Math.floor(wNative*scale);const hNativeScaled=Math.floor(hNative*scale);if(canvas.width!=wNativeScaled)canvas.width=wNativeScaled;if(canvas.height!=hNativeScaled)canvas.height=hNativeScaled;if(typeof canvas.style!="undefined"){if(!GLFW.isCSSScalingEnabled()){canvas.style.setProperty("width",wNative+"px","important");canvas.style.setProperty("height",hNative+"px","important")}else{canvas.style.removeProperty("width");canvas.style.removeProperty("height")}}},calculateMouseCoords(pageX,pageY){const rect=Browser.getCanvas().getBoundingClientRect();var adjustedX=pageX-(window.scrollX+rect.left);var adjustedY=pageY-(window.scrollY+rect.top);if(GLFW.isCSSScalingEnabled()&&GLFW.active){adjustedX=adjustedX*(GLFW.active.width/rect.width);adjustedY=adjustedY*(GLFW.active.height/rect.height)}return{x:adjustedX,y:adjustedY}},setWindowAttrib:(winid,attrib,value)=>{var win=GLFW.WindowFromId(winid);if(!win)return;const isHiDPIAware=GLFW.isHiDPIAware();win.attributes[attrib]=value;if(isHiDPIAware!==GLFW.isHiDPIAware())GLFW.adjustCanvasDimensions()},getDevicePixelRatio(){return typeof devicePixelRatio=="number"&&devicePixelRatio||1},isHiDPIAware(){if(GLFW.active)return GLFW.active.attributes[139276]>0;else return false},isCSSScalingEnabled(){return!GLFW.isHiDPIAware()},adjustCanvasDimensions(){if(GLFW.active){Browser.updateCanvasDimensions(Browser.getCanvas(),GLFW.active.width,GLFW.active.height);Browser.updateResizeListeners()}},getHiDPIScale(){return GLFW.isHiDPIAware()?GLFW.scale:1},onDevicePixelRatioChange(){GLFW.onWindowContentScaleChanged(GLFW.getDevicePixelRatio());GLFW.adjustCanvasDimensions()},GLFW2ParamToGLFW3Param:param=>{var table={196609:0,196610:0,196611:0,196612:0,196613:0,196614:0,131073:0,131074:0,131075:0,131076:0,131077:135169,131078:135170,131079:135171,131080:135172,131081:135173,131082:135174,131083:135183,131084:135175,131085:135176,131086:135177,131087:135178,131088:135179,131089:135180,131090:0,131091:135181,131092:139266,131093:139267,131094:139270,131095:139271,131096:139272};return table[param]}};var _glfwCreateWindow=(width,height,title,monitor,share)=>GLFW.createWindow(width,height,title,monitor,share);var _glfwDefaultWindowHints=()=>GLFW.defaultWindowHints();var _glfwDestroyWindow=winid=>GLFW.destroyWindow(winid);var _glfwGetPrimaryMonitor=()=>1;var _glfwGetTime=()=>GLFW.getTime()-GLFW.initialTime;var _glfwGetVideoModes=(monitor,count)=>{HEAP32[count>>2]=0;return 0};var _glfwInit=()=>{if(GLFW.windows)return 1;GLFW.initialTime=GLFW.getTime();GLFW.defaultWindowHints();GLFW.windows=new Array;GLFW.active=null;GLFW.scale=GLFW.getDevicePixelRatio();window.addEventListener("gamepadconnected",GLFW.onGamepadConnected,true);window.addEventListener("gamepaddisconnected",GLFW.onGamepadDisconnected,true);window.addEventListener("keydown",GLFW.onKeydown,true);window.addEventListener("keypress",GLFW.onKeyPress,true);window.addEventListener("keyup",GLFW.onKeyup,true);window.addEventListener("blur",GLFW.onBlur,true);GLFW.devicePixelRatioMQL=window.matchMedia("(resolution: "+GLFW.getDevicePixelRatio()+"dppx)");GLFW.devicePixelRatioMQL.addEventListener("change",GLFW.onDevicePixelRatioChange);var canvas=Browser.getCanvas();canvas.addEventListener("touchmove",GLFW.onMousemove,true);canvas.addEventListener("touchstart",GLFW.onMouseButtonDown,true);canvas.addEventListener("touchcancel",GLFW.onMouseButtonUp,true);canvas.addEventListener("touchend",GLFW.onMouseButtonUp,true);canvas.addEventListener("mousemove",GLFW.onMousemove,true);canvas.addEventListener("mousedown",GLFW.onMouseButtonDown,true);canvas.addEventListener("mouseup",GLFW.onMouseButtonUp,true);canvas.addEventListener("wheel",GLFW.onMouseWheel,true);canvas.addEventListener("mousewheel",GLFW.onMouseWheel,true);canvas.addEventListener("mouseenter",GLFW.onMouseenter,true);canvas.addEventListener("mouseleave",GLFW.onMouseleave,true);canvas.addEventListener("drop",GLFW.onDrop,true);canvas.addEventListener("dragover",GLFW.onDragover,true);Browser.requestFullscreen=GLFW.requestFullscreen;Browser.calculateMouseCoords=GLFW.calculateMouseCoords;Browser.updateCanvasDimensions=GLFW.updateCanvasDimensions;Browser.resizeListeners.push((width,height)=>{if(GLFW.isHiDPIAware()){var canvas=Browser.getCanvas();GLFW.onCanvasResize(canvas.clientWidth,canvas.clientHeight,width,height)}else{GLFW.onCanvasResize(width,height,width,height)}});return 1};var _glfwMakeContextCurrent=winid=>0;var _glfwSetCharCallback=(winid,cbfun)=>GLFW.setCharCallback(winid,cbfun);var _glfwSetCursorEnterCallback=(winid,cbfun)=>{var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.cursorEnterFunc;win.cursorEnterFunc=cbfun;return prevcbfun};var _glfwSetCursorPosCallback=(winid,cbfun)=>GLFW.setCursorPosCallback(winid,cbfun);var _glfwSetDropCallback=(winid,cbfun)=>GLFW.setDropCallback(winid,cbfun);var _glfwSetErrorCallback=cbfun=>{var prevcbfun=GLFW.errorFunc;GLFW.errorFunc=cbfun;return prevcbfun};var _glfwSetKeyCallback=(winid,cbfun)=>GLFW.setKeyCallback(winid,cbfun);var _glfwSetMouseButtonCallback=(winid,cbfun)=>GLFW.setMouseButtonCallback(winid,cbfun);var _glfwSetScrollCallback=(winid,cbfun)=>GLFW.setScrollCallback(winid,cbfun);var _glfwSetWindowContentScaleCallback=(winid,cbfun)=>{var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.windowContentScaleFunc;win.windowContentScaleFunc=cbfun;return prevcbfun};var _glfwSetWindowFocusCallback=(winid,cbfun)=>{var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.windowFocusFunc;win.windowFocusFunc=cbfun;return prevcbfun};var _glfwSetWindowIconifyCallback=(winid,cbfun)=>{var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.windowIconifyFunc;win.windowIconifyFunc=cbfun;return prevcbfun};var _glfwSetWindowShouldClose=(winid,value)=>{var win=GLFW.WindowFromId(winid);if(!win)return;win.shouldClose=value};var _glfwSetWindowSize=(winid,width,height)=>GLFW.setWindowSize(winid,width,height);var _glfwSetWindowSizeCallback=(winid,cbfun)=>GLFW.setWindowSizeCallback(winid,cbfun);var _glfwSwapBuffers=winid=>GLFW.swapBuffers(winid);var _glfwTerminate=()=>{window.removeEventListener("gamepadconnected",GLFW.onGamepadConnected,true);window.removeEventListener("gamepaddisconnected",GLFW.onGamepadDisconnected,true);window.removeEventListener("keydown",GLFW.onKeydown,true);window.removeEventListener("keypress",GLFW.onKeyPress,true);window.removeEventListener("keyup",GLFW.onKeyup,true);window.removeEventListener("blur",GLFW.onBlur,true);var canvas=Browser.getCanvas();canvas.removeEventListener("touchmove",GLFW.onMousemove,true);canvas.removeEventListener("touchstart",GLFW.onMouseButtonDown,true);canvas.removeEventListener("touchcancel",GLFW.onMouseButtonUp,true);canvas.removeEventListener("touchend",GLFW.onMouseButtonUp,true);canvas.removeEventListener("mousemove",GLFW.onMousemove,true);canvas.removeEventListener("mousedown",GLFW.onMouseButtonDown,true);canvas.removeEventListener("mouseup",GLFW.onMouseButtonUp,true);canvas.removeEventListener("wheel",GLFW.onMouseWheel,true);canvas.removeEventListener("mousewheel",GLFW.onMouseWheel,true);canvas.removeEventListener("mouseenter",GLFW.onMouseenter,true);canvas.removeEventListener("mouseleave",GLFW.onMouseleave,true);canvas.removeEventListener("drop",GLFW.onDrop,true);canvas.removeEventListener("dragover",GLFW.onDragover,true);if(GLFW.devicePixelRatioMQL)GLFW.devicePixelRatioMQL.removeEventListener("change",GLFW.onDevicePixelRatioChange);canvas.width=canvas.height=1;GLFW.windows=null;GLFW.active=null};var _glfwWindowHint=(target,hint)=>{GLFW.hints[target]=hint};var stackAlloc=sz=>__emscripten_stack_alloc(sz);var stringToUTF8OnStack=str=>{var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret};var runAndAbortIfError=func=>{try{return func()}catch(e){abort(e)}};var Asyncify={instrumentWasmImports(imports){var importPattern=/^(invoke_.*|__asyncjs__.*)$/;for(let[x,original]of Object.entries(imports)){if(typeof original=="function"){let isAsyncifyImport=original.isAsync||importPattern.test(x)}}},instrumentFunction(original){var wrapper=(...args)=>{Asyncify.exportCallStack.push(original);try{return original(...args)}finally{if(!ABORT){var top=Asyncify.exportCallStack.pop();Asyncify.maybeStopUnwind()}}};Asyncify.funcWrappers.set(original,wrapper);return wrapper},instrumentWasmExports(exports){var ret={};for(let[x,original]of Object.entries(exports)){if(typeof original=="function"){var wrapper=Asyncify.instrumentFunction(original);ret[x]=wrapper}else{ret[x]=original}}return ret},State:{Normal:0,Unwinding:1,Rewinding:2,Disabled:3},state:0,StackSize:4096,currData:null,handleSleepReturnValue:0,exportCallStack:[],callstackFuncToId:new Map,callStackIdToFunc:new Map,funcWrappers:new Map,callStackId:0,asyncPromiseHandlers:null,sleepCallbacks:[],getCallStackId(func){if(!Asyncify.callstackFuncToId.has(func)){var id=Asyncify.callStackId++;Asyncify.callstackFuncToId.set(func,id);Asyncify.callStackIdToFunc.set(id,func)}return Asyncify.callstackFuncToId.get(func)},maybeStopUnwind(){if(Asyncify.currData&&Asyncify.state===Asyncify.State.Unwinding&&Asyncify.exportCallStack.length===0){Asyncify.state=Asyncify.State.Normal;runAndAbortIfError(_asyncify_stop_unwind);if(typeof Fibers!="undefined"){Fibers.trampoline()}}},whenDone(){return new Promise((resolve,reject)=>{Asyncify.asyncPromiseHandlers={resolve,reject}})},allocateData(){var ptr=_malloc(12+Asyncify.StackSize);Asyncify.setDataHeader(ptr,ptr+12,Asyncify.StackSize);Asyncify.setDataRewindFunc(ptr);return ptr},setDataHeader(ptr,stack,stackSize){HEAPU32[ptr>>2]=stack;HEAPU32[ptr+4>>2]=stack+stackSize},setDataRewindFunc(ptr){var bottomOfCallStack=Asyncify.exportCallStack[0];var rewindId=Asyncify.getCallStackId(bottomOfCallStack);HEAP32[ptr+8>>2]=rewindId},getDataRewindFunc(ptr){var id=HEAP32[ptr+8>>2];var func=Asyncify.callStackIdToFunc.get(id);return func},doRewind(ptr){var original=Asyncify.getDataRewindFunc(ptr);var func=Asyncify.funcWrappers.get(original);return callUserCallback(func)},handleSleep(startAsync){if(ABORT)return;if(Asyncify.state===Asyncify.State.Normal){var reachedCallback=false;var reachedAfterCallback=false;startAsync((handleSleepReturnValue=0)=>{if(ABORT)return;Asyncify.handleSleepReturnValue=handleSleepReturnValue;reachedCallback=true;if(!reachedAfterCallback){return}Asyncify.state=Asyncify.State.Rewinding;runAndAbortIfError(()=>_asyncify_start_rewind(Asyncify.currData));if(typeof MainLoop!="undefined"&&MainLoop.func){MainLoop.resume()}var asyncWasmReturnValue,isError=false;try{asyncWasmReturnValue=Asyncify.doRewind(Asyncify.currData)}catch(err){asyncWasmReturnValue=err;isError=true}var handled=false;if(!Asyncify.currData){var asyncPromiseHandlers=Asyncify.asyncPromiseHandlers;if(asyncPromiseHandlers){Asyncify.asyncPromiseHandlers=null;(isError?asyncPromiseHandlers.reject:asyncPromiseHandlers.resolve)(asyncWasmReturnValue);handled=true}}if(isError&&!handled){throw asyncWasmReturnValue}});reachedAfterCallback=true;if(!reachedCallback){Asyncify.state=Asyncify.State.Unwinding;Asyncify.currData=Asyncify.allocateData();if(typeof MainLoop!="undefined"&&MainLoop.func){MainLoop.pause()}runAndAbortIfError(()=>_asyncify_start_unwind(Asyncify.currData))}}else if(Asyncify.state===Asyncify.State.Rewinding){Asyncify.state=Asyncify.State.Normal;runAndAbortIfError(_asyncify_stop_rewind);_free(Asyncify.currData);Asyncify.currData=null;Asyncify.sleepCallbacks.forEach(callUserCallback)}else{abort(`invalid state: ${Asyncify.state}`)}return Asyncify.handleSleepReturnValue},handleAsync:startAsync=>Asyncify.handleSleep(async wakeUp=>{wakeUp(await startAsync())})};var FS_createPath=(...args)=>FS.createPath(...args);var FS_unlink=(...args)=>FS.unlink(...args);var FS_createLazyFile=(...args)=>FS.createLazyFile(...args);var FS_createDevice=(...args)=>FS.createDevice(...args);FS.createPreloadedFile=FS_createPreloadedFile;FS.preloadFile=FS_preloadFile;FS.staticInit();for(let i=0;i<32;++i)tempFixedLengthArray.push(new Array(i));var miniTempWebGLFloatBuffersStorage=new Float32Array(288);for(var i=0;i<=288;++i){miniTempWebGLFloatBuffers[i]=miniTempWebGLFloatBuffersStorage.subarray(0,i)}var miniTempWebGLIntBuffersStorage=new Int32Array(288);for(var i=0;i<=288;++i){miniTempWebGLIntBuffers[i]=miniTempWebGLIntBuffersStorage.subarray(0,i)}Module["requestAnimationFrame"]=MainLoop.requestAnimationFrame;Module["pauseMainLoop"]=MainLoop.pause;Module["resumeMainLoop"]=MainLoop.resume;MainLoop.init();{if(Module["noExitRuntime"])noExitRuntime=Module["noExitRuntime"];if(Module["preloadPlugins"])preloadPlugins=Module["preloadPlugins"];if(Module["print"])out=Module["print"];if(Module["printErr"])err=Module["printErr"];if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].shift()()}}}Module["addRunDependency"]=addRunDependency;Module["removeRunDependency"]=removeRunDependency;Module["FS_preloadFile"]=FS_preloadFile;Module["FS_unlink"]=FS_unlink;Module["FS_createPath"]=FS_createPath;Module["FS_createDevice"]=FS_createDevice;Module["FS_createDataFile"]=FS_createDataFile;Module["FS_createLazyFile"]=FS_createLazyFile;var ASM_CONSTS={56278:()=>{if(document.fullscreenElement)return 1},56324:()=>Module.canvas.width,56356:()=>parseInt(Module.canvas.style.width),56404:()=>{document.exitFullscreen()},56431:()=>{setTimeout(function(){Module.requestFullscreen(false,false)},100)},56503:()=>{if(document.fullscreenElement)return 1},56549:()=>Module.canvas.width,56581:()=>screen.width,56606:()=>{document.exitFullscreen()},56633:$0=>{const canvasId=UTF8ToString($0);setTimeout(function(){Module.requestFullscreen(false,true);setTimeout(function(){document.querySelector(canvasId).style.width="unset"},100)},100)},56827:()=>window.innerWidth,56853:()=>window.innerHeight,56880:()=>{if(document.fullscreenElement)return 1},56926:()=>Module.canvas.width,56958:()=>parseInt(Module.canvas.style.width),57006:()=>{if(document.fullscreenElement)return 1},57052:()=>Module.canvas.width,57084:()=>screen.width,57109:()=>window.innerWidth,57135:()=>window.innerHeight,57162:()=>{if(document.fullscreenElement)return 1},57208:()=>Module.canvas.width,57240:()=>screen.width,57265:()=>{document.exitFullscreen()},57292:()=>{if(document.fullscreenElement)return 1},57338:()=>Module.canvas.width,57370:()=>parseInt(Module.canvas.style.width),57418:()=>{document.exitFullscreen()},57445:$0=>{Module.canvas.style.opacity=$0},57483:()=>screen.width,57508:()=>screen.height,57534:()=>window.screenX,57561:()=>window.screenY,57588:()=>window.devicePixelRatio,57624:$0=>{navigator.clipboard.writeText(UTF8ToString($0))},57677:$0=>{Module.canvas.style.cursor=UTF8ToString($0)},57728:()=>{Module.canvas.style.cursor="none"},57765:($0,$1,$2,$3)=>{try{navigator.getGamepads()[$0].vibrationActuator.playEffect("dual-rumble",{startDelay:0,duration:$3,weakMagnitude:$1,strongMagnitude:$2})}catch(e){try{navigator.getGamepads()[$0].hapticActuators[0].pulse($2,$3)}catch(e){}}},58021:$0=>{Module.canvas.style.cursor=UTF8ToString($0)},58072:()=>{if(document.pointerLockElement)return 1},58119:()=>{if(document.fullscreenElement)return 1},58165:()=>window.innerWidth,58191:()=>window.innerHeight,58218:($0,$1,$2,$3,$4)=>{if(typeof window==="undefined"||(window.AudioContext||window.webkitAudioContext)===undefined){return 0}if(typeof window.miniaudio==="undefined"){window.miniaudio={referenceCount:0};window.miniaudio.device_type={};window.miniaudio.device_type.playback=$0;window.miniaudio.device_type.capture=$1;window.miniaudio.device_type.duplex=$2;window.miniaudio.device_state={};window.miniaudio.device_state.stopped=$3;window.miniaudio.device_state.started=$4;let miniaudio=window.miniaudio;miniaudio.devices=[];miniaudio.track_device=function(device){for(var iDevice=0;iDevice<miniaudio.devices.length;++iDevice){if(miniaudio.devices[iDevice]==null){miniaudio.devices[iDevice]=device;return iDevice}}miniaudio.devices.push(device);return miniaudio.devices.length-1};miniaudio.untrack_device_by_index=function(deviceIndex){miniaudio.devices[deviceIndex]=null;while(miniaudio.devices.length>0){if(miniaudio.devices[miniaudio.devices.length-1]==null){miniaudio.devices.pop()}else{break}}};miniaudio.untrack_device=function(device){for(var iDevice=0;iDevice<miniaudio.devices.length;++iDevice){if(miniaudio.devices[iDevice]==device){return miniaudio.untrack_device_by_index(iDevice)}}};miniaudio.get_device_by_index=function(deviceIndex){return miniaudio.devices[deviceIndex]};miniaudio.unlock_event_types=function(){return["touchend","click"]}();miniaudio.unlock=function(){for(var i=0;i<miniaudio.devices.length;++i){var device=miniaudio.devices[i];if(device!=null&&device.webaudio!=null&&device.state===miniaudio.device_state.started){device.webaudio.resume().then(()=>{_ma_device__on_notification_unlocked(device.pDevice)},error=>{console.error("Failed to resume audiocontext",error)})}}miniaudio.unlock_event_types.map(function(event_type){document.removeEventListener(event_type,miniaudio.unlock,true)})};miniaudio.unlock_event_types.map(function(event_type){document.addEventListener(event_type,miniaudio.unlock,true)})}window.miniaudio.referenceCount+=1;return 1},60396:()=>{if(typeof window.miniaudio!=="undefined"){window.miniaudio.unlock_event_types.map(function(event_type){document.removeEventListener(event_type,window.miniaudio.unlock,true)});window.miniaudio.referenceCount-=1;if(window.miniaudio.referenceCount===0){delete window.miniaudio}}},60700:()=>navigator.mediaDevices!==undefined&&navigator.mediaDevices.getUserMedia!==undefined,60804:()=>{try{var temp=new(window.AudioContext||window.webkitAudioContext);var sampleRate=temp.sampleRate;temp.close();return sampleRate}catch(e){return 0}},60975:($0,$1,$2,$3,$4,$5)=>{var deviceType=$0;var channels=$1;var sampleRate=$2;var bufferSize=$3;var pIntermediaryBuffer=$4;var pDevice=$5;if(typeof window.miniaudio==="undefined"){return-1}var device={};var audioContextOptions={};if(deviceType==window.miniaudio.device_type.playback&&sampleRate!=0){audioContextOptions.sampleRate=sampleRate}device.webaudio=new(window.AudioContext||window.webkitAudioContext)(audioContextOptions);device.webaudio.suspend();device.state=window.miniaudio.device_state.stopped;var channelCountIn=0;var channelCountOut=channels;if(deviceType!=window.miniaudio.device_type.playback){channelCountIn=channels}device.scriptNode=device.webaudio.createScriptProcessor(bufferSize,channelCountIn,channelCountOut);device.scriptNode.onaudioprocess=function(e){if(device.intermediaryBufferView==null||device.intermediaryBufferView.length==0){device.intermediaryBufferView=new Float32Array(HEAPF32.buffer,pIntermediaryBuffer,bufferSize*channels)}if(deviceType==window.miniaudio.device_type.capture||deviceType==window.miniaudio.device_type.duplex){for(var iChannel=0;iChannel<channels;iChannel+=1){var inputBuffer=e.inputBuffer.getChannelData(iChannel);var intermediaryBuffer=device.intermediaryBufferView;for(var iFrame=0;iFrame<bufferSize;iFrame+=1){intermediaryBuffer[iFrame*channels+iChannel]=inputBuffer[iFrame]}}_ma_device_process_pcm_frames_capture__webaudio(pDevice,bufferSize,pIntermediaryBuffer)}if(deviceType==window.miniaudio.device_type.playback||deviceType==window.miniaudio.device_type.duplex){_ma_device_process_pcm_frames_playback__webaudio(pDevice,bufferSize,pIntermediaryBuffer);for(var iChannel=0;iChannel<e.outputBuffer.numberOfChannels;++iChannel){var outputBuffer=e.outputBuffer.getChannelData(iChannel);var intermediaryBuffer=device.intermediaryBufferView;for(var iFrame=0;iFrame<bufferSize;iFrame+=1){outputBuffer[iFrame]=intermediaryBuffer[iFrame*channels+iChannel]}}}else{for(var iChannel=0;iChannel<e.outputBuffer.numberOfChannels;++iChannel){e.outputBuffer.getChannelData(iChannel).fill(0)}}};if(deviceType==window.miniaudio.device_type.capture||deviceType==window.miniaudio.device_type.duplex){navigator.mediaDevices.getUserMedia({audio:true,video:false}).then(function(stream){device.streamNode=device.webaudio.createMediaStreamSource(stream);device.streamNode.connect(device.scriptNode);device.scriptNode.connect(device.webaudio.destination)}).catch(function(error){console.log("Failed to get user media: "+error)})}if(deviceType==window.miniaudio.device_type.playback){device.scriptNode.connect(device.webaudio.destination)}device.pDevice=pDevice;return window.miniaudio.track_device(device)},63852:$0=>window.miniaudio.get_device_by_index($0).webaudio.sampleRate,63925:$0=>{var device=window.miniaudio.get_device_by_index($0);if(device.scriptNode!==undefined){device.scriptNode.onaudioprocess=function(e){};device.scriptNode.disconnect();device.scriptNode=undefined}if(device.streamNode!==undefined){device.streamNode.disconnect();device.streamNode=undefined}device.webaudio.close();device.webaudio=undefined;device.pDevice=undefined},64325:$0=>{window.miniaudio.untrack_device_by_index($0)},64375:$0=>{var device=window.miniaudio.get_device_by_index($0);device.webaudio.resume();device.state=window.miniaudio.device_state.started},64514:$0=>{var device=window.miniaudio.get_device_by_index($0);device.webaudio.suspend();device.state=window.miniaudio.device_state.stopped}};function send_ready(){window.parent.postMessage({op:"ready"})}function send_started(verb){window.parent.postMessage({op:"started",verb})}function send_done(win){window.parent.postMessage({op:"done",win})}function get_difficulty(){return window.lcolonqJamStart||-1}function SetCanvasIdJs(out,outSize){var canvasId="#"+Module.canvas.id;stringToUTF8(canvasId,out,outSize)}var _main,_malloc,_free,_ma_device__on_notification_unlocked,_ma_malloc_emscripten,_ma_free_emscripten,_ma_device_process_pcm_frames_capture__webaudio,_ma_device_process_pcm_frames_playback__webaudio,__emscripten_stack_alloc,dynCall_vii,dynCall_viii,dynCall_viff,dynCall_viiiii,dynCall_viiii,dynCall_vidd,dynCall_ii,dynCall_iiii,dynCall_iii,dynCall_iiiii,dynCall_iiiji,dynCall_iiiiiii,dynCall_jii,dynCall_vi,dynCall_vffff,dynCall_vf,dynCall_viiiiiiii,dynCall_viiiiiiiii,dynCall_i,dynCall_vff,dynCall_v,dynCall_viiiiiii,dynCall_vfi,dynCall_viif,dynCall_vif,dynCall_vifff,dynCall_viffff,dynCall_viiiiii,dynCall_vfff,dynCall_jiji,dynCall_iidiiii,_asyncify_start_unwind,_asyncify_stop_unwind,_asyncify_start_rewind,_asyncify_stop_rewind,memory,__indirect_function_table,wasmMemory;function assignWasmExports(wasmExports){_main=Module["_main"]=wasmExports["qe"];_malloc=wasmExports["re"];_free=wasmExports["se"];_ma_device__on_notification_unlocked=Module["_ma_device__on_notification_unlocked"]=wasmExports["te"];_ma_malloc_emscripten=Module["_ma_malloc_emscripten"]=wasmExports["ue"];_ma_free_emscripten=Module["_ma_free_emscripten"]=wasmExports["ve"];_ma_device_process_pcm_frames_capture__webaudio=Module["_ma_device_process_pcm_frames_capture__webaudio"]=wasmExports["we"];_ma_device_process_pcm_frames_playback__webaudio=Module["_ma_device_process_pcm_frames_playback__webaudio"]=wasmExports["xe"];__emscripten_stack_alloc=wasmExports["ye"];dynCall_vii=dynCalls["vii"]=wasmExports["ze"];dynCall_viii=dynCalls["viii"]=wasmExports["Ae"];dynCall_viff=dynCalls["viff"]=wasmExports["Be"];dynCall_viiiii=dynCalls["viiiii"]=wasmExports["Ce"];dynCall_viiii=dynCalls["viiii"]=wasmExports["De"];dynCall_vidd=dynCalls["vidd"]=wasmExports["Ee"];dynCall_ii=dynCalls["ii"]=wasmExports["Fe"];dynCall_iiii=dynCalls["iiii"]=wasmExports["Ge"];dynCall_iii=dynCalls["iii"]=wasmExports["He"];dynCall_iiiii=dynCalls["iiiii"]=wasmExports["Ie"];dynCall_iiiji=dynCalls["iiiji"]=wasmExports["Je"];dynCall_iiiiiii=dynCalls["iiiiiii"]=wasmExports["Ke"];dynCall_jii=dynCalls["jii"]=wasmExports["Le"];dynCall_vi=dynCalls["vi"]=wasmExports["Me"];dynCall_vffff=dynCalls["vffff"]=wasmExports["Ne"];dynCall_vf=dynCalls["vf"]=wasmExports["Oe"];dynCall_viiiiiiii=dynCalls["viiiiiiii"]=wasmExports["Pe"];dynCall_viiiiiiiii=dynCalls["viiiiiiiii"]=wasmExports["Qe"];dynCall_i=dynCalls["i"]=wasmExports["Re"];dynCall_vff=dynCalls["vff"]=wasmExports["Se"];dynCall_v=dynCalls["v"]=wasmExports["Te"];dynCall_viiiiiii=dynCalls["viiiiiii"]=wasmExports["Ue"];dynCall_vfi=dynCalls["vfi"]=wasmExports["Ve"];dynCall_viif=dynCalls["viif"]=wasmExports["We"];dynCall_vif=dynCalls["vif"]=wasmExports["Xe"];dynCall_vifff=dynCalls["vifff"]=wasmExports["Ye"];dynCall_viffff=dynCalls["viffff"]=wasmExports["Ze"];dynCall_viiiiii=dynCalls["viiiiii"]=wasmExports["_e"];dynCall_vfff=dynCalls["vfff"]=wasmExports["$e"];dynCall_jiji=dynCalls["jiji"]=wasmExports["af"];dynCall_iidiiii=dynCalls["iidiiii"]=wasmExports["bf"];_asyncify_start_unwind=wasmExports["cf"];_asyncify_stop_unwind=wasmExports["df"];_asyncify_start_rewind=wasmExports["ef"];_asyncify_stop_rewind=wasmExports["ff"];memory=wasmMemory=wasmExports["oe"];__indirect_function_table=wasmExports["__indirect_function_table"]}var wasmImports={na:SetCanvasIdJs,a:___assert_fail,Wa:___syscall_faccessat,J:___syscall_fcntl64,Pa:___syscall_getcwd,Sa:___syscall_ioctl,Ta:___syscall_openat,Va:_clock_time_get,B:_emscripten_asm_const_double,d:_emscripten_asm_const_int,Ua:_emscripten_date_now,ge:_emscripten_get_element_css_size,oa:_emscripten_get_gamepad_status,H:_emscripten_get_now,pa:_emscripten_get_num_gamepads,Md:_emscripten_glActiveTexture,Ld:_emscripten_glAttachShader,be:_emscripten_glBeginQueryEXT,Kd:_emscripten_glBindAttribLocation,Jd:_emscripten_glBindBuffer,Hd:_emscripten_glBindFramebuffer,Gd:_emscripten_glBindRenderbuffer,Fd:_emscripten_glBindTexture,Vd:_emscripten_glBindVertexArrayOES,Ed:_emscripten_glBlendColor,Dd:_emscripten_glBlendEquation,Cd:_emscripten_glBlendEquationSeparate,Bd:_emscripten_glBlendFunc,Ad:_emscripten_glBlendFuncSeparate,zd:_emscripten_glBufferData,yd:_emscripten_glBufferSubData,xd:_emscripten_glCheckFramebufferStatus,wd:_emscripten_glClear,vd:_emscripten_glClearColor,ud:_emscripten_glClearDepthf,td:_emscripten_glClearStencil,Ya:_emscripten_glClipControlEXT,sd:_emscripten_glColorMask,rd:_emscripten_glCompileShader,qd:_emscripten_glCompressedTexImage2D,pd:_emscripten_glCompressedTexSubImage2D,od:_emscripten_glCopyTexImage2D,nd:_emscripten_glCopyTexSubImage2D,md:_emscripten_glCreateProgram,ld:_emscripten_glCreateShader,kd:_emscripten_glCullFace,jd:_emscripten_glDeleteBuffers,id:_emscripten_glDeleteFramebuffers,hd:_emscripten_glDeleteProgram,de:_emscripten_glDeleteQueriesEXT,gd:_emscripten_glDeleteRenderbuffers,fd:_emscripten_glDeleteShader,ed:_emscripten_glDeleteTextures,Ud:_emscripten_glDeleteVertexArraysOES,cd:_emscripten_glDepthFunc,bd:_emscripten_glDepthMask,ad:_emscripten_glDepthRangef,$c:_emscripten_glDetachShader,_c:_emscripten_glDisable,Zc:_emscripten_glDisableVertexAttribArray,Yc:_emscripten_glDrawArrays,Pd:_emscripten_glDrawArraysInstancedANGLE,Qd:_emscripten_glDrawBuffersWEBGL,Xc:_emscripten_glDrawElements,Od:_emscripten_glDrawElementsInstancedANGLE,Wc:_emscripten_glEnable,Vc:_emscripten_glEnableVertexAttribArray,ae:_emscripten_glEndQueryEXT,Tc:_emscripten_glFinish,Sc:_emscripten_glFlush,Rc:_emscripten_glFramebufferRenderbuffer,Qc:_emscripten_glFramebufferTexture2D,Pc:_emscripten_glFrontFace,Oc:_emscripten_glGenBuffers,Mc:_emscripten_glGenFramebuffers,ee:_emscripten_glGenQueriesEXT,Lc:_emscripten_glGenRenderbuffers,Kc:_emscripten_glGenTextures,Sd:_emscripten_glGenVertexArraysOES,Nc:_emscripten_glGenerateMipmap,Jc:_emscripten_glGetActiveAttrib,Ic:_emscripten_glGetActiveUniform,Hc:_emscripten_glGetAttachedShaders,Gc:_emscripten_glGetAttribLocation,Fc:_emscripten_glGetBooleanv,Ec:_emscripten_glGetBufferParameteriv,Dc:_emscripten_glGetError,Cc:_emscripten_glGetFloatv,Bc:_emscripten_glGetFramebufferAttachmentParameteriv,Ac:_emscripten_glGetIntegerv,yc:_emscripten_glGetProgramInfoLog,zc:_emscripten_glGetProgramiv,Xd:_emscripten_glGetQueryObjecti64vEXT,Zd:_emscripten_glGetQueryObjectivEXT,Wd:_emscripten_glGetQueryObjectui64vEXT,Yd:_emscripten_glGetQueryObjectuivEXT,_d:_emscripten_glGetQueryivEXT,xc:_emscripten_glGetRenderbufferParameteriv,vc:_emscripten_glGetShaderInfoLog,uc:_emscripten_glGetShaderPrecisionFormat,tc:_emscripten_glGetShaderSource,wc:_emscripten_glGetShaderiv,sc:_emscripten_glGetString,rc:_emscripten_glGetTexParameterfv,qc:_emscripten_glGetTexParameteriv,mc:_emscripten_glGetUniformLocation,oc:_emscripten_glGetUniformfv,nc:_emscripten_glGetUniformiv,jc:_emscripten_glGetVertexAttribPointerv,lc:_emscripten_glGetVertexAttribfv,kc:_emscripten_glGetVertexAttribiv,ic:_emscripten_glHint,hc:_emscripten_glIsBuffer,gc:_emscripten_glIsEnabled,fc:_emscripten_glIsFramebuffer,dc:_emscripten_glIsProgram,ce:_emscripten_glIsQueryEXT,cc:_emscripten_glIsRenderbuffer,bc:_emscripten_glIsShader,ac:_emscripten_glIsTexture,Rd:_emscripten_glIsVertexArrayOES,$b:_emscripten_glLineWidth,_b:_emscripten_glLinkProgram,Zb:_emscripten_glPixelStorei,Xa:_emscripten_glPolygonModeWEBGL,Yb:_emscripten_glPolygonOffset,Za:_emscripten_glPolygonOffsetClampEXT,$d:_emscripten_glQueryCounterEXT,Xb:_emscripten_glReadPixels,Wb:_emscripten_glReleaseShaderCompiler,Ub:_emscripten_glRenderbufferStorage,Tb:_emscripten_glSampleCoverage,Sb:_emscripten_glScissor,Rb:_emscripten_glShaderBinary,Qb:_emscripten_glShaderSource,Pb:_emscripten_glStencilFunc,Ob:_emscripten_glStencilFuncSeparate,Nb:_emscripten_glStencilMask,Mb:_emscripten_glStencilMaskSeparate,Lb:_emscripten_glStencilOp,Kb:_emscripten_glStencilOpSeparate,Jb:_emscripten_glTexImage2D,Ib:_emscripten_glTexParameterf,Hb:_emscripten_glTexParameterfv,Gb:_emscripten_glTexParameteri,Fb:_emscripten_glTexParameteriv,Eb:_emscripten_glTexSubImage2D,Db:_emscripten_glUniform1f,Cb:_emscripten_glUniform1fv,Bb:_emscripten_glUniform1i,Ab:_emscripten_glUniform1iv,zb:_emscripten_glUniform2f,yb:_emscripten_glUniform2fv,xb:_emscripten_glUniform2i,wb:_emscripten_glUniform2iv,vb:_emscripten_glUniform3f,ub:_emscripten_glUniform3fv,tb:_emscripten_glUniform3i,sb:_emscripten_glUniform3iv,rb:_emscripten_glUniform4f,pb:_emscripten_glUniform4fv,ob:_emscripten_glUniform4i,nb:_emscripten_glUniform4iv,mb:_emscripten_glUniformMatrix2fv,lb:_emscripten_glUniformMatrix3fv,kb:_emscripten_glUniformMatrix4fv,jb:_emscripten_glUseProgram,ib:_emscripten_glValidateProgram,hb:_emscripten_glVertexAttrib1f,gb:_emscripten_glVertexAttrib1fv,fb:_emscripten_glVertexAttrib2f,eb:_emscripten_glVertexAttrib2fv,db:_emscripten_glVertexAttrib3f,cb:_emscripten_glVertexAttrib3fv,bb:_emscripten_glVertexAttrib4f,ab:_emscripten_glVertexAttrib4fv,Nd:_emscripten_glVertexAttribDivisorANGLE,$a:_emscripten_glVertexAttribPointer,_a:_emscripten_glViewport,Na:_emscripten_resize_heap,qa:_emscripten_sample_gamepad_data,X:_emscripten_set_blur_callback_on_thread,sa:_emscripten_set_canvas_element_size,T:_emscripten_set_click_callback_on_thread,W:_emscripten_set_focus_callback_on_thread,Y:_emscripten_set_fullscreenchange_callback_on_thread,je:_emscripten_set_gamepadconnected_callback_on_thread,ie:_emscripten_set_gamepaddisconnected_callback_on_thread,R:_emscripten_set_mousemove_callback_on_thread,S:_emscripten_set_pointerlockchange_callback_on_thread,U:_emscripten_set_resize_callback_on_thread,ke:_emscripten_set_touchcancel_callback_on_thread,P:_emscripten_set_touchend_callback_on_thread,le:_emscripten_set_touchmove_callback_on_thread,Q:_emscripten_set_touchstart_callback_on_thread,V:_emscripten_set_visibilitychange_callback_on_thread,ta:_emscripten_set_window_title,va:_emscripten_sleep,Fa:_exit,K:_fd_close,Ra:_fd_read,Oa:_fd_seek,I:_fd_write,me:get_difficulty,O:_glActiveTexture,D:_glAttachShader,h:_glBindAttribLocation,b:_glBindBuffer,k:_glBindTexture,qb:_glBlendFunc,p:_glBufferData,s:_glBufferSubData,L:_glClear,M:_glClearColor,Ka:_glClearDepthf,Ba:_glCompileShader,Ga:_glCompressedTexImage2D,za:_glCreateProgram,Da:_glCreateShader,ec:_glCullFace,n:_glDeleteBuffers,G:_glDeleteProgram,o:_glDeleteShader,F:_glDeleteTextures,Qa:_glDepthFunc,u:_glDetachShader,N:_glDisable,t:_glDisableVertexAttribArray,dd:_glDrawArrays,Uc:_glDrawElements,x:_glEnable,i:_glEnableVertexAttribArray,Ma:_glFrontFace,q:_glGenBuffers,Ia:_glGenTextures,f:_glGetAttribLocation,Vb:_glGetFloatv,xa:_glGetProgramInfoLog,C:_glGetProgramiv,Aa:_glGetShaderInfoLog,E:_glGetShaderiv,m:_glGetString,e:_glGetUniformLocation,ya:_glLinkProgram,Ja:_glPixelStorei,Ea:_glReadPixels,Ca:_glShaderSource,Ha:_glTexImage2D,v:_glTexParameteri,Id:_glUniform1i,Td:_glUniform4f,wa:_glUniform4fv,l:_glUniformMatrix4fv,r:_glUseProgram,j:_glVertexAttribPointer,w:_glViewport,z:_glfwCreateWindow,ka:_glfwDefaultWindowHints,fe:_glfwDestroyWindow,A:_glfwGetPrimaryMonitor,c:_glfwGetTime,ja:_glfwGetVideoModes,la:_glfwInit,Z:_glfwMakeContextCurrent,ca:_glfwSetCharCallback,_:_glfwSetCursorEnterCallback,aa:_glfwSetCursorPosCallback,fa:_glfwSetDropCallback,ma:_glfwSetErrorCallback,da:_glfwSetKeyCallback,ba:_glfwSetMouseButtonCallback,$:_glfwSetScrollCallback,ea:_glfwSetWindowContentScaleCallback,ga:_glfwSetWindowFocusCallback,ha:_glfwSetWindowIconifyCallback,he:_glfwSetWindowShouldClose,ua:_glfwSetWindowSize,ia:_glfwSetWindowSizeCallback,ra:_glfwSwapBuffers,y:_glfwTerminate,g:_glfwWindowHint,La:send_done,ne:send_ready,pc:send_started};function callMain(args=[]){var entryFunction=_main;args.unshift(thisProgram);var argc=args.length;var argv=stackAlloc((argc+1)*4);var argv_ptr=argv;for(var arg of args){HEAPU32[argv_ptr>>2]=stringToUTF8OnStack(arg);argv_ptr+=4}HEAPU32[argv_ptr>>2]=0;try{var ret=entryFunction(argc,argv);exitJS(ret,true);return ret}catch(e){return handleException(e)}}function run(args=arguments_){if(runDependencies>0){dependenciesFulfilled=run;return}preRun();if(runDependencies>0){dependenciesFulfilled=run;return}function doRun(){Module["calledRun"]=true;if(ABORT)return;initRuntime();preMain();Module["onRuntimeInitialized"]?.();var noInitialRun=Module["noInitialRun"]||false;if(!noInitialRun)callMain(args);postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(()=>{setTimeout(()=>Module["setStatus"](""),1);doRun()},1)}else{doRun()}}var wasmExports;createWasm();run(); diff --git a/2026/games/distracted_penguin/index.wasm b/2026/games/distracted_penguin/index.wasm Binary files differnew file mode 100755 index 0000000..1c75b29 --- /dev/null +++ b/2026/games/distracted_penguin/index.wasm diff --git a/2026/games/ellg/assets/beef1.png b/2026/games/ellg/assets/beef1.png Binary files differnew file mode 100644 index 0000000..0dbc9d9 --- /dev/null +++ b/2026/games/ellg/assets/beef1.png diff --git a/2026/games/ellg/assets/beef2.png b/2026/games/ellg/assets/beef2.png Binary files differnew file mode 100644 index 0000000..d2bd0c0 --- /dev/null +++ b/2026/games/ellg/assets/beef2.png diff --git a/2026/games/ellg/assets/chefhat.png b/2026/games/ellg/assets/chefhat.png Binary files differnew file mode 100644 index 0000000..951cac4 --- /dev/null +++ b/2026/games/ellg/assets/chefhat.png diff --git a/2026/games/ellg/assets/guy1.png b/2026/games/ellg/assets/guy1.png Binary files differnew file mode 100644 index 0000000..7b9b503 --- /dev/null +++ b/2026/games/ellg/assets/guy1.png diff --git a/2026/games/ellg/assets/guy2.png b/2026/games/ellg/assets/guy2.png Binary files differnew file mode 100644 index 0000000..fdecfe7 --- /dev/null +++ b/2026/games/ellg/assets/guy2.png diff --git a/2026/games/ellg/assets/guy3.png b/2026/games/ellg/assets/guy3.png Binary files differnew file mode 100644 index 0000000..f9a8ad2 --- /dev/null +++ b/2026/games/ellg/assets/guy3.png diff --git a/2026/games/ellg/assets/guy4.png b/2026/games/ellg/assets/guy4.png Binary files differnew file mode 100644 index 0000000..a3074a5 --- /dev/null +++ b/2026/games/ellg/assets/guy4.png diff --git a/2026/games/ellg/assets/hungry.png b/2026/games/ellg/assets/hungry.png Binary files differnew file mode 100644 index 0000000..1acc9dc --- /dev/null +++ b/2026/games/ellg/assets/hungry.png diff --git a/2026/games/ellg/assets/lose.png b/2026/games/ellg/assets/lose.png Binary files differnew file mode 100644 index 0000000..7a1b38c --- /dev/null +++ b/2026/games/ellg/assets/lose.png diff --git a/2026/games/ellg/assets/pot.png b/2026/games/ellg/assets/pot.png Binary files differnew file mode 100644 index 0000000..75e0ad9 --- /dev/null +++ b/2026/games/ellg/assets/pot.png diff --git a/2026/games/ellg/assets/song.mp3 b/2026/games/ellg/assets/song.mp3 Binary files differnew file mode 100644 index 0000000..1437c97 --- /dev/null +++ b/2026/games/ellg/assets/song.mp3 diff --git a/2026/games/ellg/assets/table.png b/2026/games/ellg/assets/table.png Binary files differnew file mode 100644 index 0000000..9ec1aab --- /dev/null +++ b/2026/games/ellg/assets/table.png diff --git a/2026/games/ellg/assets/win.png b/2026/games/ellg/assets/win.png Binary files differnew file mode 100644 index 0000000..f47a046 --- /dev/null +++ b/2026/games/ellg/assets/win.png diff --git a/2026/games/ellg/game.js b/2026/games/ellg/game.js new file mode 100644 index 0000000..a82d24b --- /dev/null +++ b/2026/games/ellg/game.js @@ -0,0 +1,378 @@ +import { Vector } from "./vector.js"; + +const WIDTH = 240; +const HEIGHT = 160; +const STANDALONE = window.self === window.top; +const DIFFICULTY = 4; + +const canvas = document.getElementById("game"); + +const ctx = canvas.getContext("2d"); +ctx.imageSmoothingEnabled = false; + +function notifyHarness(msg) { + if (!STANDALONE) window.parent.postMessage(msg); +} + +const music = new Audio("./assets/song.mp3"); +music.loop = true; +music.volume = 0.5; + +function playMusic() { + music.currentTime = 0; + music.play().catch(() => { }); +} + +function stopMusic() { + music.pause(); +} + +export async function loadImage(url) { + return new Promise((resolve, reject) => { + const img = new Image(); + img.onload = () => resolve(img); + img.onerror = reject; + img.src = url; + }); +}; + +export async function loadAssets() { + const [guy1, guy2, guy3, guy4, pot, table, beef1, beef2, hat, win, lose, hungry] = await Promise.all([ + loadImage("./assets/guy1.png"), + loadImage("./assets/guy2.png"), + loadImage("./assets/guy3.png"), + loadImage("./assets/guy4.png"), + loadImage("./assets/pot.png"), + loadImage("./assets/table.png"), + loadImage("./assets/beef1.png"), + loadImage("./assets/beef2.png"), + loadImage("./assets/chefhat.png"), + loadImage("./assets/win.png"), + loadImage("./assets/lose.png"), + loadImage("./assets/hungry.png"), + ]); + + return { + guy1, + guy2, + guy3, + guy4, + pot, + table, + beef1, + beef2, + hat, + win, + lose, + hungry + }; +}; + +let lastTime = 0; +let assets = {}; +let state = { + scene: null, +}; + +class Scene { + constructor() { } + + draw(dt) { } + update(dt) { } + handleInput(dt) { } + onClick(p) { } +} + +const END_SCREEN_TIME = 3; + +class EndScreen extends Scene { + constructor(win) { + super(); + + stopMusic(); + + this.win = win; + this.t = 0; + this.sent = false; + } + + update(dt) { + this.t += dt; + + if (!this.sent && this.t >= END_SCREEN_TIME) { + this.sent = true; + notifyHarness({ op: "done", win: this.win }); + } + } +} + +class WinScreen extends EndScreen { + constructor() { super(true) } + + draw() { + ctx.drawImage(assets.win, 0, 0); + } +} + +class GameOverScreen extends EndScreen { + constructor(endType = "death") { + super(false); + this.endType = endType; + } + + draw() { + ctx.drawImage(this.endType === "death" ? assets.lose : assets.hungry, 0, 0); + ctx.drawImage(assets.guy4, 50, 75); + } +} + +const POT = { x: 25, y: 90, size: 64 }; +const POT_CENTER = Vector.of([POT.x + POT.size / 2, POT.y + POT.size / 2]); +const COLLECT_TIME = 0.4; + +const BOUNDS = { x: 8, y: 8, w: 125, h: 96 }; + +class Icon { + constructor(img, pos, correct) { + this.img = img; + this.pos = pos; + this.size = 32; + this.correct = correct; + this.vel = new Vector(0, 0); + this.collect = null; + this.dead = false; + } + + static spawn(img, correct, speed) { + const icon = new Icon(img, Vector.of([0, 0]), correct); + icon.pos = Vector.of([ + BOUNDS.x + Math.random() * (BOUNDS.w - icon.size), + BOUNDS.y + Math.random() * (BOUNDS.h - icon.size), + ]); + const a = Math.random() * Math.PI * 2; + icon.vel = new Vector(Math.cos(a), Math.sin(a)).multiply(speed); + return icon; + } + + center() { return this.pos.add(new Vector(this.size / 2, this.size / 2)); } + + contains(p) { + return p.x >= this.pos.x && p.x <= this.pos.x + this.size && + p.y >= this.pos.y && p.y <= this.pos.y + this.size; + } + + startCollect() { + if (this.collect) return; + this.collect = { t: 0, fromCenter: this.center() }; + } + + update(dt) { + if (this.collect) { + this.collect.t += dt; + const k = Math.min(1, this.collect.t / COLLECT_TIME); + const e = k * k; + this._drawCenter = this.collect.fromCenter.add( + POT_CENTER.subtract(this.collect.fromCenter).multiply(e)); + this._scale = 1 - k; + if (k >= 1) this.dead = true; + return; + } + + this.pos = this.pos.add(this.vel.multiply(dt)); + const maxX = BOUNDS.x + BOUNDS.w - this.size; + const maxY = BOUNDS.y + BOUNDS.h - this.size; + if (this.pos.x < BOUNDS.x) { this.pos.x = BOUNDS.x; this.vel.x *= -1; } + if (this.pos.x > maxX) { this.pos.x = maxX; this.vel.x *= -1; } + if (this.pos.y < BOUNDS.y) { this.pos.y = BOUNDS.y; this.vel.y *= -1; } + if (this.pos.y > maxY) { this.pos.y = maxY; this.vel.y *= -1; } + } + + draw(ctx) { + const c = this._drawCenter ?? this.center(); + const s = this.size * (this._scale ?? 1); + ctx.drawImage( + this.img, + Math.round(c.x - s / 2), Math.round(c.y - s / 2), + Math.round(s), Math.round(s), + ); + } +} + +function difficultyConfig(raw) { + const K = 5; + const d = raw / (raw + K); + const lerp = (a, b) => a + (b - a) * d; + return { + correct: Math.round(lerp(3, 5)), + decoys: Math.round(lerp(3, 10)), + speed: lerp(20, 90), + timeLimit: lerp(8, 4), + }; +} + +function spawnIcons(cfg) { + const icons = []; + for (let i = 0; i < cfg.correct; i++) icons.push(Icon.spawn(assets.beef1, true, cfg.speed)); + for (let i = 0; i < cfg.decoys; i++) icons.push(Icon.spawn(assets.beef2, false, cfg.speed)); + return icons; +} + +class GameScreen extends Scene { + constructor(cfg) { + super(); + this.cfg = cfg; + this.timeTotal = cfg.timeLimit; + this.timeLeft = cfg.timeLimit; + this.state = { + guy: { + img: assets.guy2, + pos: Vector.of([125, 50]), + reactImg: null, + reactT: 0, + }, + icons: spawnIcons(cfg), + }; + } + + draw() { + const guy = this.state.guy; + + ctx.drawImage(guy.reactImg ?? guy.img, guy.pos.x, guy.pos.y); + ctx.drawImage(assets.hat, guy.pos.x + 45, guy.pos.y - 25, 50, 50); + ctx.drawImage(assets.table, 0, 50); + + for (const icon of this.state.icons) icon.draw(ctx); + + ctx.drawImage(assets.pot, POT.x, POT.y, POT.size, POT.size); + + const frac = this.timeLeft / this.timeTotal; + ctx.fillStyle = "#3a2a1a"; + ctx.fillRect(0, 0, WIDTH, 6); + ctx.fillStyle = frac < 0.25 ? "#e44" : "#f2c14e"; + ctx.fillRect(0, 0, Math.round(WIDTH * frac), 6); + } + + update(dt, ct) { + if (this.state.guy.reactT > 0) { + this.state.guy.reactT -= dt; + if (this.state.guy.reactT <= 0) this.state.guy.reactImg = null; + } + + this.timeLeft -= dt; + if (this.timeLeft <= 0) { + this.timeLeft = 0; + this.lose("hungry"); + return; + } + + const baseY = 50; + const amp = 4; + const speed = 0.01; + this.state.guy.pos.y = baseY + Math.round(Math.sin(ct * speed) * amp); + + for (const icon of this.state.icons) icon.update(dt); + this.state.icons = this.state.icons.filter(i => !i.dead); + } + + lose(endType = "death") { + state.scene = new GameOverScreen(endType); + } + + win() { + state.scene = new WinScreen(); + } + + onClick(p) { + for (let i = this.state.icons.length - 1; i >= 0; i--) { + const icon = this.state.icons[i]; + if (icon.collect) continue; + if (icon.contains(p)) { + if (!icon.correct) { this.lose() } + + icon.startCollect(); + + const correctLeft = this.state.icons.filter(x => x.correct && !x.collect).length; + if (correctLeft === 0) this.win() + + if (icon.correct) { + this.state.guy.reactImg = assets.guy3; + this.state.guy.reactT = 2; + }; + + return; + } + } + } +} + +async function init() { + assets = await loadAssets(); + notifyHarness({ op: "ready" }); +} + +function update(dt, ct) { + if (state.scene) { + state.scene.update(dt, Math.floor(ct)); + } +} + +function draw(dt) { + ctx.fillStyle = "#222"; + ctx.fillRect(0, 0, WIDTH, HEIGHT); + + if (state.scene) { + state.scene.draw(dt); + } +} + +function handleInput(dt) { + if (state.scene) { + state.scene.handleInput(dt); + } +} + +function main(currentTime) { + if (!lastTime) lastTime = currentTime; + const dt = Math.min((currentTime - lastTime) / 1000, 0.1); + + lastTime = currentTime; + + handleInput(dt); + update(dt, currentTime); + draw(dt); + + requestAnimationFrame(main); +} + +function startGame(difficulty = DIFFICULTY) { + state.scene = new GameScreen(difficultyConfig(difficulty)); + notifyHarness({ op: "started", verb: "make some chili!" }); + playMusic(); +} + +canvas.addEventListener("click", (ev) => { + if (music.paused && state.scene instanceof GameScreen) music.play().catch(() => { }); + + const r = canvas.getBoundingClientRect(); + const p = Vector.of([ + (ev.clientX - r.left) / r.width * WIDTH, + (ev.clientY - r.top) / r.height * HEIGHT, + ]); + state.scene?.onClick(p); +}); + +window.addEventListener("message", ev => { + switch (ev.data.op) { + case "start": + startGame(ev.data.difficulty ?? 0); + break; + default: console.log(`unknown event: ${ev}`); break; + } +}); + +await init(); + +requestAnimationFrame(main); + +if (STANDALONE) startGame(); + diff --git a/2026/games/ellg/index.html b/2026/games/ellg/index.html new file mode 100644 index 0000000..a845dea --- /dev/null +++ b/2026/games/ellg/index.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> + <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> + <title>watch the pot</title> + <style> + * { + margin: 0px; + padding: 0px; + } + + html,body { + width: 100%; + height: 100%; + } + + body { + font-size: 10px; + background: #000; + display: flex; + align-items: center; + justify-content: center; + overflow: hidden; + } + + #game { + width: min(100vw, 150vh); + aspect-ratio: 3 / 2; + image-rendering: pixelated; + } + </style> + </head> + <body> + <canvas id="game" width="240" height="160" /> + <script type="module" src="./game.js"></script> + </body> +</html> diff --git a/2026/games/ellg/vector.js b/2026/games/ellg/vector.js new file mode 100644 index 0000000..cf32d81 --- /dev/null +++ b/2026/games/ellg/vector.js @@ -0,0 +1,64 @@ +export class Vector { + static of([x, y]) { + return new Vector(x, y) + } + + constructor(x, y) { + this.x = x + this.y = y + } + + add(val) { + return new Vector(this.x + val.x, this.y + val.y) + } + + subtract(val) { + return new Vector(this.x - val.x, this.y - val.y) + } + + multiply(scalar) { + return new Vector(this.x * scalar, this.y * scalar) + } + + divide(scalar) { + return new Vector(this.x / scalar, this.y / scalar) + } + + dot(other) { + return this.x * other.x + this.y * other.y + } + + cross(other) { + return this.x * other.y - other.x * this.y + } + + hadamard(other) { + return new Vector(this.x * other.x, this.y * other.y) + } + + length() { + return Math.sqrt(this.x ** 2 + this.y ** 2) + } + + distance(other) { + return this.subtract(other).length() + } + + normalize() { + const length = this.length() + if (length === 0) { + return new Vector(0, 0) + } + return new Vector(this.x / length, this.y / length) + } + + rotateByRadians(radians) { + const cos = Math.cos(radians) + const sin = Math.sin(radians) + return new Vector(this.x * cos - this.y * sin, this.x * sin + this.y * cos) + } + + rotateByDegrees(degrees) { + return this.rotateByRadians((degrees * Math.PI) / 180) + } +} diff --git a/2026/games/gbjk/LICENSE b/2026/games/gbjk/LICENSE new file mode 100644 index 0000000..14fac91 --- /dev/null +++ b/2026/games/gbjk/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 + +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. diff --git a/2026/games/gbjk/index.html b/2026/games/gbjk/index.html new file mode 100644 index 0000000..0e43bab --- /dev/null +++ b/2026/games/gbjk/index.html @@ -0,0 +1,456 @@ +<!doctype html> +<html lang="en"> + <head> + <meta charset="UTF-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <title>tortis</title> + <script type="module" crossorigin>//#region \0vite/modulepreload-polyfill.js +(function polyfill() { + const relList = document.createElement("link").relList; + if (relList && relList.supports && relList.supports("modulepreload")) return; + for (const link of document.querySelectorAll("link[rel=\"modulepreload\"]")) processPreload(link); + new MutationObserver((mutations) => { + for (const mutation of mutations) { + if (mutation.type !== "childList") continue; + for (const node of mutation.addedNodes) if (node.tagName === "LINK" && node.rel === "modulepreload") processPreload(node); + } + }).observe(document, { + childList: true, + subtree: true + }); + function getFetchOpts(link) { + const fetchOpts = {}; + if (link.integrity) fetchOpts.integrity = link.integrity; + if (link.referrerPolicy) fetchOpts.referrerPolicy = link.referrerPolicy; + if (link.crossOrigin === "use-credentials") fetchOpts.credentials = "include"; + else if (link.crossOrigin === "anonymous") fetchOpts.credentials = "omit"; + else fetchOpts.credentials = "same-origin"; + return fetchOpts; + } + function processPreload(link) { + if (link.ep) return; + link.ep = true; + const fetchOpts = getFetchOpts(link); + fetch(link.href, fetchOpts); + } +})(); +//#endregion +//#region src/setup.ts +var WIDTH = 160; +var HEIGHT = 240; +var GRID_HEIGHT = HEIGHT - 10; +var ROWS = 15; +var COLS = 10; +var GRID_WIDTH = GRID_HEIGHT / ROWS * 10; +var GRID_X = 5; +var GRID_Y = 5; +var MARGIN = 2; +var CELL_WIDTH = GRID_HEIGHT / ROWS - MARGIN; +var FALLTIME = 600; +var MIN_FALLTIME = 300; +var rotation = 0; +var board = []; +function resetBoard() { + board.length = 0; + for (let height = 0; height < ROWS; height++) { + const row = []; + for (let width = 0; width < COLS; width++) row.push("void"); + board.push(row); + } +} +resetBoard(); +function random(elements) { + return elements[Math.floor(Math.random() * elements.length)]; +} +var addedShapeNumber = 1; +function addSquares() { + const color = random([ + "fallingRed", + "fallingGreen", + "fallingBlue" + ]); + let w = COLS / 2; + let h = 1; + for (let i = 0; i < 4; i++) { + board[h][w] = color; + if (i === 3) break; + let move = null; + let j = 0; + for (; j < 20; j++) { + move = addedShapeNumber % 6 === 0 ? "down" : random([ + "up", + "down", + "left", + "right" + ]); + if (move === "up" && (h === 0 || board[h - 1][w] !== "void")) continue; + if (move === "down" && (h === ROWS - 1 || board[h + 1][w] !== "void")) continue; + if (move === "left" && (w === 0 || board[h][w - 1] !== "void")) continue; + if (move === "right" && (w === COLS - 1 || board[h][w + 1] !== "void")) continue; + break; + } + if (j === 20) return false; + switch (move) { + case "up": + h--; + break; + case "down": + h++; + break; + case "left": + w--; + break; + case "right": + w++; + break; + } + } + addedShapeNumber++; + return true; +} +function clearFilledRows() { + let lastClearedRow = ROWS; + let clearedRows = 0; + for (let row = ROWS - 1; row >= 0; row--) if (!board[row].some((cell) => cell === "void" || cell === "fallingBlue" || cell === "fallingGreen" || cell === "fallingRed")) { + for (let col = 0; col < COLS; col++) board[row][col] = "void"; + lastClearedRow = row; + clearedRows++; + } else if (lastClearedRow !== ROWS) for (let col = 0; col < COLS; col++) switch (board[row][col]) { + case "red": + board[row][col] = "fallingRed"; + break; + case "green": + board[row][col] = "fallingGreen"; + break; + case "blue": + board[row][col] = "fallingBlue"; + break; + } + return clearedRows; +} +function setup(elements) { + const ctx = elements.main.getContext("2d"); + let gameRunning = false; + let animationFrameId = null; + let lastFrame = 0; + let fallTime = FALLTIME; + let speedUpPressed = false; + elements.left.addEventListener("click", () => moveFalling("left")); + elements.right.addEventListener("click", () => moveFalling("right")); + elements.rotateLeft.addEventListener("click", () => { + if (!gameRunning) return; + rotation -= 30 * Math.random(); + elements.main.style.transform = `rotate(${rotation}deg)`; + }); + elements.rotateRight.addEventListener("click", () => { + if (!gameRunning) return; + rotation += 30 * Math.random(); + elements.main.style.transform = `rotate(${rotation}deg)`; + }); + elements.speedUp.addEventListener("mousedown", () => speedUpPressed = gameRunning); + elements.speedUp.addEventListener("mouseup", () => speedUpPressed = false); + window.addEventListener("message", (ev) => { + const message = ev.data; + if (!isStartMessage(message)) return; + startGame(message.difficulty); + }); + window.parent.postMessage({ op: "ready" }, "*"); + draw(); + function isStartMessage(message) { + if (typeof message !== "object" || message === null) return false; + const candidate = message; + return candidate.op === "start" && typeof candidate.difficulty === "number" && Number.isFinite(candidate.difficulty); + } + function resetGame(difficulty) { + resetBoard(); + addedShapeNumber = 1; + fallTime = Math.max(MIN_FALLTIME, FALLTIME - Math.max(0, difficulty) * 5); + rotation = 0; + elements.main.style.transform = ""; + speedUpPressed = false; + lastFrame = 0; + } + function startGame(difficulty) { + if (animationFrameId !== null) { + cancelAnimationFrame(animationFrameId); + animationFrameId = null; + } + resetGame(difficulty); + gameRunning = true; + window.parent.postMessage({ + op: "started", + verb: "catch!" + }, "*"); + animationFrameId = requestAnimationFrame(gameLoop); + } + function finishGame(win) { + if (!gameRunning) return; + gameRunning = false; + if (animationFrameId !== null) { + cancelAnimationFrame(animationFrameId); + animationFrameId = null; + } + window.parent.postMessage({ + op: "done", + win + }, "*"); + resetGame(0); + draw(); + } + function moveFalling(move) { + if (!gameRunning) return; + switch (move) { + case "left": + for (let row = 0; row < ROWS; row++) for (let col = 0; col < COLS - 1; col++) if (board[row][col] === "void") switch (board[row][col + 1]) { + case "fallingRed": + case "fallingGreen": + case "fallingBlue": + board[row][col] = board[row][col + 1]; + board[row][col + 1] = "void"; + } + break; + case "right": + for (let row = 0; row < ROWS; row++) for (let col = COLS - 1; col > 0; col--) if (board[row][col] === "void") switch (board[row][col - 1]) { + case "fallingRed": + case "fallingGreen": + case "fallingBlue": + board[row][col] = board[row][col - 1]; + board[row][col - 1] = "void"; + } + break; + } + } + function physics() { + let somethingFell = false; + for (let row = ROWS - 1; row >= 1; row--) for (let col = 0; col < COLS; col++) { + let space = board[row][col]; + let above = board[row - 1][col]; + switch (above) { + case "fallingRed": + case "fallingGreen": + case "fallingBlue": if (space === "void") { + somethingFell = true; + board[row][col] = board[row - 1][col]; + board[row - 1][col] = "void"; + } else switch (above) { + case "fallingRed": + board[row - 1][col] = "red"; + break; + case "fallingGreen": + board[row - 1][col] = "green"; + break; + case "fallingBlue": + board[row - 1][col] = "blue"; + break; + } + } + } + for (let col = 0; col < COLS; col++) switch (board[ROWS - 1][col]) { + case "fallingRed": + board[ROWS - 1][col] = "red"; + break; + case "fallingGreen": + board[ROWS - 1][col] = "green"; + break; + case "fallingBlue": + board[ROWS - 1][col] = "blue"; + break; + } + return somethingFell; + } + function draw() { + ctx.clearRect(0, 0, WIDTH, HEIGHT); + ctx.fillStyle = "black"; + ctx.fillRect(GRID_X, GRID_Y, GRID_WIDTH, GRID_HEIGHT); + for (let h = 0; h < ROWS; h++) for (let w = 0; w < COLS; w++) { + switch (board[h][w]) { + case "void": + ctx.fillStyle = "#2e2e2e"; + break; + case "red": + ctx.fillStyle = "#994444"; + break; + case "green": + ctx.fillStyle = "#449944"; + break; + case "blue": + ctx.fillStyle = "#444499"; + break; + case "fallingRed": + ctx.fillStyle = "#bb3333"; + break; + case "fallingGreen": + ctx.fillStyle = "#33bb33"; + break; + case "fallingBlue": + ctx.fillStyle = "#3333bb"; + break; + } + const x = 8 + w * CELL_WIDTH + (w - 1) * MARGIN; + const y = 8 + h * CELL_WIDTH + (h - 1) * MARGIN; + ctx.fillRect(x, y, CELL_WIDTH, CELL_WIDTH); + } + } + function gameLoop(time) { + animationFrameId = null; + if (!gameRunning) return; + if (time - lastFrame > (speedUpPressed ? fallTime / 10 : fallTime)) { + lastFrame = time; + if (!physics()) { + const clearedRows = clearFilledRows(); + if (clearedRows >= 4) { + finishGame(true); + return; + } else if (clearedRows === 0) { + if (!addSquares()) { + finishGame(false); + return; + } + } + } + } + draw(); + animationFrameId = requestAnimationFrame(gameLoop); + } +} +//#endregion +//#region src/main.ts +document.querySelector("#app").innerHTML = ` + <div class="layout"> + + <div class="game"> + <div class="title-bar"> + <h1>Tortis</h1> + <p>(4row clear to win)</p> + </div> + + <canvas height="240" width="160" id="main"></canvas> + </div> + + <ul> + <button id="move-left">move left</button> + <button id="rotate-left">rotate left</button> + <button id="move-right">move right</button> + <button id="rotate-right">rotate right</button> + <button id="speed-up">speed up</button> + </ul> + </div> +`; +setup({ + main: document.querySelector("#main"), + left: document.querySelector("#move-left"), + right: document.querySelector("#move-right"), + rotateLeft: document.querySelector("#rotate-left"), + rotateRight: document.querySelector("#rotate-right"), + speedUp: document.querySelector("#speed-up") +}); +//#endregion</script> + <style rel="stylesheet" crossorigin>* { + box-sizing: border-box; +} + +html, +body, +#app { + min-height: 100%; +} + +body { + margin: 0; + color: darksalmon; + background-color: #2e2e2e; + font-family: monospace; + overflow-x: hidden; +} + +button { + min-width: 0; + font: inherit; + font-size: .4rem; + line-height: 1.1; + padding: .15rem; + color: darksalmon; + background-color: #2e2e2e; + border-color: salmon; + cursor: pointer; + white-space: normal; + overflow-wrap: anywhere; + + z-index: 9999; +} + +button:hover { + background-color: darkslategray; +} + +button:active { + background-color: slategray; +} + +.layout { + margin: auto; + display: flex; + min-height: 100dvh; + width: 100%; + padding: .15rem; + gap: .2rem; + align-items: center; + justify-content: center; + overflow: hidden; +} + +.game { + min-width: 0; +} + +.title-bar { + display: flex; + align-items: baseline; + gap: .25rem; + margin-bottom: .2rem; +} + +h1, +p { + margin: 0; +} + +h1 { + font-size: .6rem; + line-height: 1; +} + +p { + font-size: .4rem; + line-height: 1.1; +} + +canvas { + display: block; + aspect-ratio: 2 / 3; + border-radius: 6px; + border: 1px solid darksalmon; + box-shadow: 0px 0px 4px darksalmon; + height: 80vmin; + width: auto; + + transition: transform 100ms; + margin: auto; +} + +ul { + display: flex; + justify-content: center; + flex-direction: column; + gap: .15rem; + width: min(6rem, 42vw); + margin: 0; + padding: 0; + list-style: none; +} +/*$vite$:1*/</style> + </head> + <body> + <div id="app"></div> + </body> +</html> diff --git a/2026/games/gbjk/src/.gitignore b/2026/games/gbjk/src/.gitignore new file mode 100644 index 0000000..a547bf3 --- /dev/null +++ b/2026/games/gbjk/src/.gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/2026/games/gbjk/src/index.html b/2026/games/gbjk/src/index.html new file mode 100644 index 0000000..c68a552 --- /dev/null +++ b/2026/games/gbjk/src/index.html @@ -0,0 +1,12 @@ +<!doctype html> +<html lang="en"> + <head> + <meta charset="UTF-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <title>tortis</title> + </head> + <body> + <div id="app"></div> + <script type="module" src="/src/main.ts"></script> + </body> +</html> diff --git a/2026/games/gbjk/src/package.json b/2026/games/gbjk/src/package.json new file mode 100644 index 0000000..a5e9656 --- /dev/null +++ b/2026/games/gbjk/src/package.json @@ -0,0 +1,16 @@ +{ + "name": "tortis", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc && vite build", + "preview": "vite preview" + }, + "devDependencies": { + "typescript": "6.0.2", + "vite": "8.0.12", + "vite-plugin-singlefile": "2.3.3" + } +} diff --git a/2026/games/gbjk/src/pnpm-lock.yaml b/2026/games/gbjk/src/pnpm-lock.yaml new file mode 100644 index 0000000..1087420 --- /dev/null +++ b/2026/games/gbjk/src/pnpm-lock.yaml @@ -0,0 +1,568 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + devDependencies: + typescript: + specifier: ~6.0.2 + version: 6.0.3 + vite: + specifier: ^8.0.12 + version: 8.0.16 + vite-plugin-singlefile: + specifier: ^2.3.3 + version: 2.3.3(vite@8.0.16) + +packages: + + '@emnapi/core@1.10.0': + resolution: {integrity: sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==} + + '@emnapi/runtime@1.10.0': + resolution: {integrity: sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==} + + '@emnapi/wasi-threads@1.2.1': + resolution: {integrity: sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==} + + '@napi-rs/wasm-runtime@1.1.5': + resolution: {integrity: sha512-AWPoBRJ9tsnVhor4sjO7rkni+7p+2IAEFj6cx06UgP10jkQHqay/36uRV/bFkgrh18D9vb4cr8Q0Pthskgzy+Q==} + peerDependencies: + '@emnapi/core': ^1.7.1 + '@emnapi/runtime': ^1.7.1 + + '@oxc-project/types@0.133.0': + resolution: {integrity: sha512-KzkdCd6Uxqnf6l3HOw1xfatAlUURA0g14cvBYFyJ5SaNOQbOUvBr9PKArcPcrNIeRsBdgcUzOGrhKveVpvOIGA==} + + '@rolldown/binding-android-arm64@1.0.3': + resolution: {integrity: sha512-454rs7jHngixp/NMxd5srYD57OnzSlZ/eFTETjORQHLwJG1lRtmNOJcBerZlfu4GjKqeq8aCCIQrMdHyhI51Hw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [android] + + '@rolldown/binding-darwin-arm64@1.0.3': + resolution: {integrity: sha512-PcAhP+ynjURNyy8SKGl5DQP94aGuB/7JrXJb/t7P+hanXvQVMWzUvRRhBAcg/lNRadBhoUPqSoP4xw5tR/KBEA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [darwin] + + '@rolldown/binding-darwin-x64@1.0.3': + resolution: {integrity: sha512-9YpfeUvSE2RS7wysJ81uOZkXJz7f7Q55H2Gvp3VEw/EsahqDtrphrZ0EwDLK5vvKOzaCrBsjF8JmnMLcUt78Gg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [darwin] + + '@rolldown/binding-freebsd-x64@1.0.3': + resolution: {integrity: sha512-yB1IlAsSNHncV6SCTL27/MVGR5htvQsoGxIv5KMGXALp+Ll1wYsn+x98M9MW7qa+NdSbvrrY7ANI4wLJ0n1e6g==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [freebsd] + + '@rolldown/binding-linux-arm-gnueabihf@1.0.3': + resolution: {integrity: sha512-Yi30IVAAfLUCy2MseFjbB1jAMDl1VMCAas5StnYp8da9+CKvMd2H2cbEjWcw5NPaPqzvYkVIaF1nNUG+b7u/sw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@rolldown/binding-linux-arm64-gnu@1.0.3': + resolution: {integrity: sha512-jsO7R8To+AdlYgUmN5sHSCZbfhtMBkO0WUx8iORQnPcMMdgr7qM2DQmMwgabs3GhNztdmoKkMKQFHD6DTMCIQw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@rolldown/binding-linux-arm64-musl@1.0.3': + resolution: {integrity: sha512-VWkUHwWriDciit80wleYwKILoR/KMvxh/IdwS/paX+ZgpuRpCrKLUdadJbc0NpBEiyhpYawsJ73j9aCvOH+f7Q==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@rolldown/binding-linux-ppc64-gnu@1.0.3': + resolution: {integrity: sha512-5f1laC0SlIR0yDbFCd8acUhvJIag6N3zC5P7oUPN6wX0aOma+uKJ0wBDH5aq7I1PVI2ttTlhJwzwRIBnLiSGEg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ppc64] + os: [linux] + libc: [glibc] + + '@rolldown/binding-linux-s390x-gnu@1.0.3': + resolution: {integrity: sha512-Iq4ko0r4XsgbrF/LunNgHtAGLRRVE2kXonAXQ/MV0mC6jQpMOhW1SvtZja2EhC/kd05++bP78dsqBeIQyYJ6Yg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [s390x] + os: [linux] + libc: [glibc] + + '@rolldown/binding-linux-x64-gnu@1.0.3': + resolution: {integrity: sha512-B8m6tD5+/N5FeNQFbKlLA/2yVq9ycQP1SeedyEYYKWBNR3ZQbkvIUcNnDNM03lO1l5F2roiiFJGgvoLLyZXtSg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@rolldown/binding-linux-x64-musl@1.0.3': + resolution: {integrity: sha512-pSdpdUJHkuCxun9LE7jvgUB9qsRgaiyNNCX7m/AvHTcq67AiT/Yhoxvw5zPfhrM8k/BfP8ce/hMOpthKDpEUow==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + libc: [musl] + + '@rolldown/binding-openharmony-arm64@1.0.3': + resolution: {integrity: sha512-OXXS3RKJgX2uLwM+gYyuH5omcH8fL1LJs96pZGgtetVCahON57+d4SJHzTgZiOjxgGkSnpXpOsWuPDGAKAigEg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [openharmony] + + '@rolldown/binding-wasm32-wasi@1.0.3': + resolution: {integrity: sha512-JTtb8BWFynicNSoPrehsCzBtOKjZ6jhMiPFEmOiuXg1Fl8dn2KHQob+GuPSGR0dryQa1PQJbzjF3dqO/whhjLg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [wasm32] + + '@rolldown/binding-win32-arm64-msvc@1.0.3': + resolution: {integrity: sha512-gEdFFEN70A/jxb2svrWsN3aDL7OUtmvlOy+6fa2jxG8K0wQ1ZbdeLGnidov6Yu5/733dI5ySfzFlQ/cb0bSz1g==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [win32] + + '@rolldown/binding-win32-x64-msvc@1.0.3': + resolution: {integrity: sha512-eXB7CHuaQdqmJcc3koCNtNPmT/bj2gc999kUFgBxG8Ac0NdgXc4rkCHhqrgrhN3zddvvvrgzj1e90SuSfmyIXA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [win32] + + '@rolldown/pluginutils@1.0.1': + resolution: {integrity: sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==} + + '@tybys/wasm-util@0.10.2': + resolution: {integrity: sha512-RoBvJ2X0wuKlWFIjrwffGw1IqZHKQqzIchKaadZZfnNpsAYp2mM0h36JtPCjNDAHGgYez/15uMBpfGwchhiMgg==} + + braces@3.0.3: + resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} + engines: {node: '>=8'} + + detect-libc@2.1.2: + resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==} + engines: {node: '>=8'} + + fdir@6.5.0: + resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==} + engines: {node: '>=12.0.0'} + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + + fill-range@7.1.1: + resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} + engines: {node: '>=8'} + + fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + + is-number@7.0.0: + resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} + engines: {node: '>=0.12.0'} + + lightningcss-android-arm64@1.32.0: + resolution: {integrity: sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg==} + engines: {node: '>= 12.0.0'} + cpu: [arm64] + os: [android] + + lightningcss-darwin-arm64@1.32.0: + resolution: {integrity: sha512-RzeG9Ju5bag2Bv1/lwlVJvBE3q6TtXskdZLLCyfg5pt+HLz9BqlICO7LZM7VHNTTn/5PRhHFBSjk5lc4cmscPQ==} + engines: {node: '>= 12.0.0'} + cpu: [arm64] + os: [darwin] + + lightningcss-darwin-x64@1.32.0: + resolution: {integrity: sha512-U+QsBp2m/s2wqpUYT/6wnlagdZbtZdndSmut/NJqlCcMLTWp5muCrID+K5UJ6jqD2BFshejCYXniPDbNh73V8w==} + engines: {node: '>= 12.0.0'} + cpu: [x64] + os: [darwin] + + lightningcss-freebsd-x64@1.32.0: + resolution: {integrity: sha512-JCTigedEksZk3tHTTthnMdVfGf61Fky8Ji2E4YjUTEQX14xiy/lTzXnu1vwiZe3bYe0q+SpsSH/CTeDXK6WHig==} + engines: {node: '>= 12.0.0'} + cpu: [x64] + os: [freebsd] + + lightningcss-linux-arm-gnueabihf@1.32.0: + resolution: {integrity: sha512-x6rnnpRa2GL0zQOkt6rts3YDPzduLpWvwAF6EMhXFVZXD4tPrBkEFqzGowzCsIWsPjqSK+tyNEODUBXeeVHSkw==} + engines: {node: '>= 12.0.0'} + cpu: [arm] + os: [linux] + + lightningcss-linux-arm64-gnu@1.32.0: + resolution: {integrity: sha512-0nnMyoyOLRJXfbMOilaSRcLH3Jw5z9HDNGfT/gwCPgaDjnx0i8w7vBzFLFR1f6CMLKF8gVbebmkUN3fa/kQJpQ==} + engines: {node: '>= 12.0.0'} + cpu: [arm64] + os: [linux] + libc: [glibc] + + lightningcss-linux-arm64-musl@1.32.0: + resolution: {integrity: sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==} + engines: {node: '>= 12.0.0'} + cpu: [arm64] + os: [linux] + libc: [musl] + + lightningcss-linux-x64-gnu@1.32.0: + resolution: {integrity: sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==} + engines: {node: '>= 12.0.0'} + cpu: [x64] + os: [linux] + libc: [glibc] + + lightningcss-linux-x64-musl@1.32.0: + resolution: {integrity: sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==} + engines: {node: '>= 12.0.0'} + cpu: [x64] + os: [linux] + libc: [musl] + + lightningcss-win32-arm64-msvc@1.32.0: + resolution: {integrity: sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==} + engines: {node: '>= 12.0.0'} + cpu: [arm64] + os: [win32] + + lightningcss-win32-x64-msvc@1.32.0: + resolution: {integrity: sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q==} + engines: {node: '>= 12.0.0'} + cpu: [x64] + os: [win32] + + lightningcss@1.32.0: + resolution: {integrity: sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==} + engines: {node: '>= 12.0.0'} + + micromatch@4.0.8: + resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} + engines: {node: '>=8.6'} + + nanoid@3.3.13: + resolution: {integrity: sha512-sPdqC6ByMVVGvF1ynvvMo0/o+oD1VX7DaHhijt1bFgjvBkHBib4t49GoNDhf2NDta4oeUNlaGbSt5K7qjZ955Q==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + + picocolors@1.1.1: + resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + + picomatch@2.3.2: + resolution: {integrity: sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==} + engines: {node: '>=8.6'} + + picomatch@4.0.4: + resolution: {integrity: sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==} + engines: {node: '>=12'} + + postcss@8.5.15: + resolution: {integrity: sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==} + engines: {node: ^10 || ^12 || >=14} + + rolldown@1.0.3: + resolution: {integrity: sha512-i00lAJ2ks1BYr7rjNjKC7BcqAS7nVfiT3QX1SI5aY+AFHblCmaUf9OE9dbdzDvW6dJxbi2ZCZiy9v3CcwOiX3g==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + + source-map-js@1.2.1: + resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} + engines: {node: '>=0.10.0'} + + tinyglobby@0.2.17: + resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==} + engines: {node: '>=12.0.0'} + + to-regex-range@5.0.1: + resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} + engines: {node: '>=8.0'} + + tslib@2.8.1: + resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} + + typescript@6.0.3: + resolution: {integrity: sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==} + engines: {node: '>=14.17'} + hasBin: true + + vite-plugin-singlefile@2.3.3: + resolution: {integrity: sha512-XVnGH0QzbOa8fxRSsHdCarVN1BSBXNi7uLMQYlrGRN5apdHkk62XQWRJhVever0lnfuyBkwn+kvVChdm/OoOUg==} + engines: {node: '>18.0.0'} + peerDependencies: + rollup: ^4.59.0 + vite: ^5.4.21 || ^6.0.0 || ^7.0.0 || ^8.0.0 + peerDependenciesMeta: + rollup: + optional: true + + vite@8.0.16: + resolution: {integrity: sha512-h9bXPmJichP5fLmVQo3PyaGSDE2n3aPuomeAlVRm0JLmt4rY6zmPKd59HYI4LNW8oTK7tlTsuC7l/m7awx9Jcw==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + peerDependencies: + '@types/node': ^20.19.0 || >=22.12.0 + '@vitejs/devtools': ^0.1.18 + esbuild: ^0.27.0 || ^0.28.0 + jiti: '>=1.21.0' + less: ^4.0.0 + sass: ^1.70.0 + sass-embedded: ^1.70.0 + stylus: '>=0.54.8' + sugarss: ^5.0.0 + terser: ^5.16.0 + tsx: ^4.8.1 + yaml: ^2.4.2 + peerDependenciesMeta: + '@types/node': + optional: true + '@vitejs/devtools': + optional: true + esbuild: + optional: true + jiti: + optional: true + less: + optional: true + sass: + optional: true + sass-embedded: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + tsx: + optional: true + yaml: + optional: true + +snapshots: + + '@emnapi/core@1.10.0': + dependencies: + '@emnapi/wasi-threads': 1.2.1 + tslib: 2.8.1 + optional: true + + '@emnapi/runtime@1.10.0': + dependencies: + tslib: 2.8.1 + optional: true + + '@emnapi/wasi-threads@1.2.1': + dependencies: + tslib: 2.8.1 + optional: true + + '@napi-rs/wasm-runtime@1.1.5(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0)': + dependencies: + '@emnapi/core': 1.10.0 + '@emnapi/runtime': 1.10.0 + '@tybys/wasm-util': 0.10.2 + optional: true + + '@oxc-project/types@0.133.0': {} + + '@rolldown/binding-android-arm64@1.0.3': + optional: true + + '@rolldown/binding-darwin-arm64@1.0.3': + optional: true + + '@rolldown/binding-darwin-x64@1.0.3': + optional: true + + '@rolldown/binding-freebsd-x64@1.0.3': + optional: true + + '@rolldown/binding-linux-arm-gnueabihf@1.0.3': + optional: true + + '@rolldown/binding-linux-arm64-gnu@1.0.3': + optional: true + + '@rolldown/binding-linux-arm64-musl@1.0.3': + optional: true + + '@rolldown/binding-linux-ppc64-gnu@1.0.3': + optional: true + + '@rolldown/binding-linux-s390x-gnu@1.0.3': + optional: true + + '@rolldown/binding-linux-x64-gnu@1.0.3': + optional: true + + '@rolldown/binding-linux-x64-musl@1.0.3': + optional: true + + '@rolldown/binding-openharmony-arm64@1.0.3': + optional: true + + '@rolldown/binding-wasm32-wasi@1.0.3': + dependencies: + '@emnapi/core': 1.10.0 + '@emnapi/runtime': 1.10.0 + '@napi-rs/wasm-runtime': 1.1.5(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0) + optional: true + + '@rolldown/binding-win32-arm64-msvc@1.0.3': + optional: true + + '@rolldown/binding-win32-x64-msvc@1.0.3': + optional: true + + '@rolldown/pluginutils@1.0.1': {} + + '@tybys/wasm-util@0.10.2': + dependencies: + tslib: 2.8.1 + optional: true + + braces@3.0.3: + dependencies: + fill-range: 7.1.1 + + detect-libc@2.1.2: {} + + fdir@6.5.0(picomatch@4.0.4): + optionalDependencies: + picomatch: 4.0.4 + + fill-range@7.1.1: + dependencies: + to-regex-range: 5.0.1 + + fsevents@2.3.3: + optional: true + + is-number@7.0.0: {} + + lightningcss-android-arm64@1.32.0: + optional: true + + lightningcss-darwin-arm64@1.32.0: + optional: true + + lightningcss-darwin-x64@1.32.0: + optional: true + + lightningcss-freebsd-x64@1.32.0: + optional: true + + lightningcss-linux-arm-gnueabihf@1.32.0: + optional: true + + lightningcss-linux-arm64-gnu@1.32.0: + optional: true + + lightningcss-linux-arm64-musl@1.32.0: + optional: true + + lightningcss-linux-x64-gnu@1.32.0: + optional: true + + lightningcss-linux-x64-musl@1.32.0: + optional: true + + lightningcss-win32-arm64-msvc@1.32.0: + optional: true + + lightningcss-win32-x64-msvc@1.32.0: + optional: true + + lightningcss@1.32.0: + dependencies: + detect-libc: 2.1.2 + optionalDependencies: + lightningcss-android-arm64: 1.32.0 + lightningcss-darwin-arm64: 1.32.0 + lightningcss-darwin-x64: 1.32.0 + lightningcss-freebsd-x64: 1.32.0 + lightningcss-linux-arm-gnueabihf: 1.32.0 + lightningcss-linux-arm64-gnu: 1.32.0 + lightningcss-linux-arm64-musl: 1.32.0 + lightningcss-linux-x64-gnu: 1.32.0 + lightningcss-linux-x64-musl: 1.32.0 + lightningcss-win32-arm64-msvc: 1.32.0 + lightningcss-win32-x64-msvc: 1.32.0 + + micromatch@4.0.8: + dependencies: + braces: 3.0.3 + picomatch: 2.3.2 + + nanoid@3.3.13: {} + + picocolors@1.1.1: {} + + picomatch@2.3.2: {} + + picomatch@4.0.4: {} + + postcss@8.5.15: + dependencies: + nanoid: 3.3.13 + picocolors: 1.1.1 + source-map-js: 1.2.1 + + rolldown@1.0.3: + dependencies: + '@oxc-project/types': 0.133.0 + '@rolldown/pluginutils': 1.0.1 + optionalDependencies: + '@rolldown/binding-android-arm64': 1.0.3 + '@rolldown/binding-darwin-arm64': 1.0.3 + '@rolldown/binding-darwin-x64': 1.0.3 + '@rolldown/binding-freebsd-x64': 1.0.3 + '@rolldown/binding-linux-arm-gnueabihf': 1.0.3 + '@rolldown/binding-linux-arm64-gnu': 1.0.3 + '@rolldown/binding-linux-arm64-musl': 1.0.3 + '@rolldown/binding-linux-ppc64-gnu': 1.0.3 + '@rolldown/binding-linux-s390x-gnu': 1.0.3 + '@rolldown/binding-linux-x64-gnu': 1.0.3 + '@rolldown/binding-linux-x64-musl': 1.0.3 + '@rolldown/binding-openharmony-arm64': 1.0.3 + '@rolldown/binding-wasm32-wasi': 1.0.3 + '@rolldown/binding-win32-arm64-msvc': 1.0.3 + '@rolldown/binding-win32-x64-msvc': 1.0.3 + + source-map-js@1.2.1: {} + + tinyglobby@0.2.17: + dependencies: + fdir: 6.5.0(picomatch@4.0.4) + picomatch: 4.0.4 + + to-regex-range@5.0.1: + dependencies: + is-number: 7.0.0 + + tslib@2.8.1: + optional: true + + typescript@6.0.3: {} + + vite-plugin-singlefile@2.3.3(vite@8.0.16): + dependencies: + micromatch: 4.0.8 + vite: 8.0.16 + + vite@8.0.16: + dependencies: + lightningcss: 1.32.0 + picomatch: 4.0.4 + postcss: 8.5.15 + rolldown: 1.0.3 + tinyglobby: 0.2.17 + optionalDependencies: + fsevents: 2.3.3 diff --git a/2026/games/gbjk/src/src/main.ts b/2026/games/gbjk/src/src/main.ts new file mode 100644 index 0000000..8752b31 --- /dev/null +++ b/2026/games/gbjk/src/src/main.ts @@ -0,0 +1,33 @@ +import { setup } from "./setup"; +import "./style.css"; + +document.querySelector<HTMLDivElement>("#app")!.innerHTML = ` + <div class="layout"> + + <div class="game"> + <div class="title-bar"> + <h1>Tortis</h1> + <p>(4row clear to win)</p> + </div> + + <canvas height="240" width="160" id="main"></canvas> + </div> + + <ul> + <button id="move-left">move left</button> + <button id="rotate-left">rotate left</button> + <button id="move-right">move right</button> + <button id="rotate-right">rotate right</button> + <button id="speed-up">speed up</button> + </ul> + </div> +`; + +setup({ + main: document.querySelector<HTMLCanvasElement>("#main")!, + left: document.querySelector<HTMLButtonElement>("#move-left")!, + right: document.querySelector<HTMLButtonElement>("#move-right")!, + rotateLeft: document.querySelector<HTMLButtonElement>("#rotate-left")!, + rotateRight: document.querySelector<HTMLButtonElement>("#rotate-right")!, + speedUp: document.querySelector<HTMLButtonElement>("#speed-up")!, +}); diff --git a/2026/games/gbjk/src/src/setup.ts b/2026/games/gbjk/src/src/setup.ts new file mode 100644 index 0000000..9d0614b --- /dev/null +++ b/2026/games/gbjk/src/src/setup.ts @@ -0,0 +1,389 @@ +export type Elements = { + main: HTMLCanvasElement; + right: HTMLButtonElement; + left: HTMLButtonElement; + rotateRight: HTMLButtonElement; + rotateLeft: HTMLButtonElement; + speedUp: HTMLButtonElement; +}; + +const WIDTH = 160; +const HEIGHT = 240; + +const GRID_HEIGHT = HEIGHT - 10; +const ROWS = 15; +const COLS = 10; +const GRID_WIDTH = (GRID_HEIGHT / ROWS) * 10; +const GRID_X = 5; +const GRID_Y = 5; +const MARGIN = 2; +const CELL_WIDTH = GRID_HEIGHT / ROWS - MARGIN; +const FALLTIME = 600; +const MIN_FALLTIME = 300; + +let rotation = 0; + +type Block = + | "void" + | "red" + | "green" + | "blue" + | "fallingRed" + | "fallingGreen" + | "fallingBlue"; + +const board: Block[][] = []; + +function resetBoard() { + board.length = 0; + + for (let height = 0; height < ROWS; height++) { + const row: Block[] = []; + for (let width = 0; width < COLS; width++) { + row.push("void"); + } + board.push(row); + } +} + +resetBoard(); + +function random<T>(elements: T[]): T { + return elements[Math.floor(Math.random() * elements.length)]; +} + +let addedShapeNumber = 1; +function addSquares(): boolean { + const color = random(["fallingRed", "fallingGreen", "fallingBlue"] as const); + let w = COLS / 2; + let h = 1; + for (let i = 0; i < 4; i++) { + board[h][w] = color; + + if (i === 3) break; + + let move: "up" | "down" | "left" | "right" | null = null; + let j = 0; + for (; j < 20; j++) { + move = + addedShapeNumber % 6 === 0 + ? "down" + : random(["up", "down", "left", "right"] as const); + + if (move === "up" && (h === 0 || board[h - 1][w] !== "void")) continue; + if (move === "down" && (h === ROWS - 1 || board[h + 1][w] !== "void")) + continue; + + if (move === "left" && (w === 0 || board[h][w - 1] !== "void")) continue; + if (move === "right" && (w === COLS - 1 || board[h][w + 1] !== "void")) + continue; + + break; + } + if (j === 20) { + return false; + } + + switch (move) { + case "up": + h--; + break; + case "down": + h++; + break; + case "left": + w--; + break; + case "right": + w++; + break; + } + } + + addedShapeNumber++; + return true; +} + +function clearFilledRows(): number { + let lastClearedRow = ROWS; + let clearedRows = 0; + + for (let row = ROWS - 1; row >= 0; row--) { + if ( + !board[row].some( + (cell) => + cell === "void" || + cell === "fallingBlue" || + cell === "fallingGreen" || + cell === "fallingRed", + ) + ) { + for (let col = 0; col < COLS; col++) { + board[row][col] = "void"; + } + lastClearedRow = row; + clearedRows++; + } else if (lastClearedRow !== ROWS) { + for (let col = 0; col < COLS; col++) { + switch (board[row][col]) { + case "red": + board[row][col] = "fallingRed"; + break; + case "green": + board[row][col] = "fallingGreen"; + break; + case "blue": + board[row][col] = "fallingBlue"; + break; + } + } + } + } + + return clearedRows; +} + +export function setup(elements: Elements) { + const ctx = elements.main.getContext("2d")!; + + let gameRunning = false; + let animationFrameId: number | null = null; + let lastFrame = 0; + let fallTime = FALLTIME; + + let speedUpPressed = false; + + elements.left.addEventListener("click", () => moveFalling("left")); + elements.right.addEventListener("click", () => moveFalling("right")); + + elements.rotateLeft.addEventListener("click", () => { + if (!gameRunning) return; + + rotation -= 30 * Math.random(); + elements.main.style.transform = `rotate(${rotation}deg)`; + }); + elements.rotateRight.addEventListener("click", () => { + if (!gameRunning) return; + + rotation += 30 * Math.random(); + elements.main.style.transform = `rotate(${rotation}deg)`; + }); + + elements.speedUp.addEventListener( + "mousedown", + () => (speedUpPressed = gameRunning), + ); + elements.speedUp.addEventListener("mouseup", () => (speedUpPressed = false)); + + window.addEventListener("message", (ev: MessageEvent<unknown>) => { + const message = ev.data; + if (!isStartMessage(message)) return; + + startGame(message.difficulty); + }); + + window.parent.postMessage({ op: "ready" }, "*"); + + draw(); + + function isStartMessage( + message: unknown, + ): message is { op: "start"; difficulty: number } { + if (typeof message !== "object" || message === null) return false; + + const candidate = message as { op?: unknown; difficulty?: unknown }; + return ( + candidate.op === "start" && + typeof candidate.difficulty === "number" && + Number.isFinite(candidate.difficulty) + ); + } + + function resetGame(difficulty: number) { + resetBoard(); + addedShapeNumber = 1; + fallTime = Math.max(MIN_FALLTIME, FALLTIME - Math.max(0, difficulty) * 5); + rotation = 0; + elements.main.style.transform = ""; + speedUpPressed = false; + lastFrame = 0; + } + + function startGame(difficulty: number) { + if (animationFrameId !== null) { + cancelAnimationFrame(animationFrameId); + animationFrameId = null; + } + + resetGame(difficulty); + gameRunning = true; + window.parent.postMessage({ op: "started", verb: "catch!" }, "*"); + animationFrameId = requestAnimationFrame(gameLoop); + } + + function finishGame(win: boolean) { + if (!gameRunning) return; + + gameRunning = false; + if (animationFrameId !== null) { + cancelAnimationFrame(animationFrameId); + animationFrameId = null; + } + + window.parent.postMessage({ op: "done", win }, "*"); + resetGame(0); + draw(); + } + + function moveFalling(move: "left" | "right") { + if (!gameRunning) return; + + switch (move) { + case "left": + for (let row = 0; row < ROWS; row++) { + for (let col = 0; col < COLS - 1; col++) { + if (board[row][col] === "void") { + switch (board[row][col + 1]) { + case "fallingRed": + case "fallingGreen": + case "fallingBlue": + board[row][col] = board[row][col + 1]; + board[row][col + 1] = "void"; + } + } + } + } + break; + case "right": + for (let row = 0; row < ROWS; row++) { + for (let col = COLS - 1; col > 0; col--) { + if (board[row][col] === "void") { + switch (board[row][col - 1]) { + case "fallingRed": + case "fallingGreen": + case "fallingBlue": + board[row][col] = board[row][col - 1]; + board[row][col - 1] = "void"; + } + } + } + } + break; + } + } + + function physics(): boolean { + let somethingFell = false; + + for (let row = ROWS - 1; row >= 1; row--) { + for (let col = 0; col < COLS; col++) { + let space = board[row][col]; + let above = board[row - 1][col]; + switch (above) { + case "fallingRed": + case "fallingGreen": + case "fallingBlue": + if (space === "void") { + somethingFell = true; + board[row][col] = board[row - 1][col]; + board[row - 1][col] = "void"; + } else { + switch (above) { + case "fallingRed": + board[row - 1][col] = "red"; + break; + case "fallingGreen": + board[row - 1][col] = "green"; + break; + case "fallingBlue": + board[row - 1][col] = "blue"; + break; + } + } + } + } + } + + for (let col = 0; col < COLS; col++) { + switch (board[ROWS - 1][col]) { + case "fallingRed": + board[ROWS - 1][col] = "red"; + break; + case "fallingGreen": + board[ROWS - 1][col] = "green"; + break; + case "fallingBlue": + board[ROWS - 1][col] = "blue"; + break; + } + } + + return somethingFell; + } + + function draw() { + ctx.clearRect(0, 0, WIDTH, HEIGHT); + + ctx.fillStyle = "black"; + ctx.fillRect(GRID_X, GRID_Y, GRID_WIDTH, GRID_HEIGHT); + + for (let h = 0; h < ROWS; h++) { + for (let w = 0; w < COLS; w++) { + switch (board[h][w]) { + case "void": + ctx.fillStyle = "#2e2e2e"; + break; + case "red": + ctx.fillStyle = "#994444"; + break; + case "green": + ctx.fillStyle = "#449944"; + break; + case "blue": + ctx.fillStyle = "#444499"; + break; + case "fallingRed": + ctx.fillStyle = "#bb3333"; + break; + case "fallingGreen": + ctx.fillStyle = "#33bb33"; + break; + case "fallingBlue": + ctx.fillStyle = "#3333bb"; + break; + } + + const x = GRID_X + MARGIN * 1.5 + w * CELL_WIDTH + (w - 1) * MARGIN; + const y = GRID_Y + MARGIN * 1.5 + h * CELL_WIDTH + (h - 1) * MARGIN; + + ctx.fillRect(x, y, CELL_WIDTH, CELL_WIDTH); + } + } + } + + function gameLoop(time: number) { + animationFrameId = null; + + if (!gameRunning) return; + + if (time - lastFrame > (speedUpPressed ? fallTime / 10 : fallTime)) { + lastFrame = time; + const somethingFell = physics(); + if (!somethingFell) { + const clearedRows = clearFilledRows(); + if (clearedRows >= 4) { + finishGame(true); + return; + } else if (clearedRows === 0) { + if (!addSquares()) { + finishGame(false); + return; + } + } + } + } + + draw(); + animationFrameId = requestAnimationFrame(gameLoop); + } +} diff --git a/2026/games/gbjk/src/src/style.css b/2026/games/gbjk/src/src/style.css new file mode 100644 index 0000000..56e07d1 --- /dev/null +++ b/2026/games/gbjk/src/src/style.css @@ -0,0 +1,103 @@ +* { + box-sizing: border-box; +} + +html, +body, +#app { + min-height: 100%; +} + +body { + margin: 0; + color: darksalmon; + background-color: #2e2e2e; + font-family: monospace; + overflow-x: hidden; +} + +button { + min-width: 0; + font: inherit; + font-size: .4rem; + line-height: 1.1; + padding: .15rem; + color: darksalmon; + background-color: #2e2e2e; + border-color: salmon; + cursor: pointer; + white-space: normal; + overflow-wrap: anywhere; + + z-index: 9999; +} + +button:hover { + background-color: darkslategray; +} + +button:active { + background-color: slategray; +} + +.layout { + margin: auto; + display: flex; + min-height: 100dvh; + width: 100%; + padding: .15rem; + gap: .2rem; + align-items: center; + justify-content: center; + overflow: hidden; +} + +.game { + min-width: 0; +} + +.title-bar { + display: flex; + align-items: baseline; + gap: .25rem; + margin-bottom: .2rem; +} + +h1, +p { + margin: 0; +} + +h1 { + font-size: .6rem; + line-height: 1; +} + +p { + font-size: .4rem; + line-height: 1.1; +} + +canvas { + display: block; + aspect-ratio: 2 / 3; + border-radius: 6px; + border: 1px solid darksalmon; + box-shadow: 0px 0px 4px darksalmon; + height: 80vmin; + width: auto; + + transition: transform 100ms; + margin: auto; +} + +ul { + display: flex; + justify-content: center; + flex-direction: column; + gap: .15rem; + width: min(6rem, 42vw); + margin: 0; + padding: 0; + list-style: none; +} diff --git a/2026/games/gbjk/src/tsconfig.json b/2026/games/gbjk/src/tsconfig.json new file mode 100644 index 0000000..1ab38c8 --- /dev/null +++ b/2026/games/gbjk/src/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "target": "es2023", + "module": "esnext", + "lib": ["ES2023", "DOM"], + "types": ["vite/client"], + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "moduleDetection": "force", + "noEmit": true, + + /* Linting */ + "noUnusedLocals": true, + "noUnusedParameters": true, + "erasableSyntaxOnly": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["src"] +} diff --git a/2026/games/gbjk/src/vite.config.ts b/2026/games/gbjk/src/vite.config.ts new file mode 100644 index 0000000..c9036bd --- /dev/null +++ b/2026/games/gbjk/src/vite.config.ts @@ -0,0 +1,9 @@ +import { defineConfig } from "vite"; +import { viteSingleFile } from "vite-plugin-singlefile"; + +export default defineConfig({ + plugins: [viteSingleFile()], + build: { + minify: false, + }, +}); diff --git a/2026/games/peetseater/MikuWantsPizza1.png b/2026/games/peetseater/MikuWantsPizza1.png Binary files differnew file mode 100644 index 0000000..c8ea1cb --- /dev/null +++ b/2026/games/peetseater/MikuWantsPizza1.png diff --git a/2026/games/peetseater/deliverit.mp3 b/2026/games/peetseater/deliverit.mp3 Binary files differnew file mode 100644 index 0000000..bc0a46b --- /dev/null +++ b/2026/games/peetseater/deliverit.mp3 diff --git a/2026/games/peetseater/explosion.mp3 b/2026/games/peetseater/explosion.mp3 Binary files differnew file mode 100644 index 0000000..90ba5b5 --- /dev/null +++ b/2026/games/peetseater/explosion.mp3 diff --git a/2026/games/peetseater/failure.mp3 b/2026/games/peetseater/failure.mp3 Binary files differnew file mode 100644 index 0000000..b7f8661 --- /dev/null +++ b/2026/games/peetseater/failure.mp3 diff --git a/2026/games/peetseater/harness.html b/2026/games/peetseater/harness.html new file mode 100644 index 0000000..be1eac3 --- /dev/null +++ b/2026/games/peetseater/harness.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <title>LCOLONQ Game Jam 2026 Testing Harnass</title> +</head> +<body> + <iframe width="480px" height="320px" src="/games/micro2026/index.html" allow="*" sandbox="allow-scripts allow-same-origin"></iframe> + <button id="send_start">Send Start</button> + <label>Difficulty + <input id="difficulty" type="number" value="0" /> + </label> + <p id="child-messages"><p> + <script> + const iframe = document.querySelector("iframe"); + const difficulty = document.getElementById('difficulty'); + iframe.onload = function() { + const start = document.getElementById("send_start"); + start.onclick = () => { + iframe.contentWindow.postMessage({op: "start", difficulty: parseInt(difficulty.value,10)}, '*'); + } + }; + + const childMessages = document.getElementById('child-messages'); + window.addEventListener("message", (ev) => { + childMessages.textContent = childMessages.textContent + JSON.stringify(ev.data) + '\n'; + }); + </script> +</body> +</html>
\ No newline at end of file diff --git a/2026/games/peetseater/index.html b/2026/games/peetseater/index.html new file mode 100644 index 0000000..2927992 --- /dev/null +++ b/2026/games/peetseater/index.html @@ -0,0 +1,262 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <title>Microgame 2026</title> + <style> + html, body, canvas { + margin: 0; + padding: 0; + text-align: center; + } + canvas { + margin: 1px; + background-color: darkcyan; + min-width: 240px; + min-height: 160px; + width: 97%; + height: 97%; + image-rendering: pixelated; + } + </style> +</head> +<body> + <canvas id="game" width="240" height="160"></canvas> + <img + id="MikuWantsPizza" + src="MikuWantsPizza1.png" + style="display: none;" + /> + <img + id="pizza" + src="pizza.png" + style="display: none; " + /> + <script type="application/javascript"> + + // Click handling + const canvas = document.getElementById("game"); + const miku_sprite = document.getElementById("MikuWantsPizza"); + const pizza_sprite = document.getElementById("pizza"); + const ctx = canvas.getContext("2d"); + ctx.save(); + + // Audio assuming the iframe parent situation works out: + class Sound { + constructor(path) { + this.audio = new Audio(path); + this.canPlay = false; + const ref = this; + this.audio.addEventListener("canplaythrough", (event) => { + ref.canPlay = true; + }); + } + + play() { + if (this.canPlay) { + this.audio.muted = false; + this.audio.play(); + } + } + + mute() { + this.audio.muted = true; + } + } + const pizza_sound = new Sound('pizza.mp3'); + const pasta_sound = new Sound('pasta.mp3'); + const deliverit_sound = new Sound('deliverit.mp3'); + const failure_sound = new Sound('failure.mp3'); + const win_sound = new Sound('jump.mp3'); + const mad_sound = new Sound('explosion.mp3'); + const scream = new Sound('mikuscream.mp3'); + const weeee = new Sound('weeee.mp3'); + const frame_to_sound = { + 0: pizza_sound, + 1: pasta_sound, + 2: deliverit_sound, + 10: failure_sound, + 12: mad_sound, + 13: mad_sound, + 14: mad_sound, + 15: scream, + 7: win_sound, + 8: weeee, + }; + + const game_state = { + game_step: 0, + game_steps: [0, 1, 2, 3], + time_between_steps_ms: 2000, + delivery_attempt: false, + pizza_delivered: false, + play_ending: false, + ok_to_give: [2, 3], + win_frames: [4,5,6,7,8], + time_between_ending_frames_ms: 300, + fail_frames: [9, 10, 11, 12, 13, 14, 15], + state: 'idle', + difficulty: 0, + audio_played: false, + }; + + function reset_game_state() { + game_state.state = 'game'; + game_state.game_step = 0; + game_state.delivery_attempt = false; + game_state.pizza_delivered = false; + game_state.play_ending = false; + game_state.audio_played = false; + + const difficulty_selection = Math.floor(game_state.difficulty / 5); + switch (difficulty_selection) { + case 0: game_state.time_between_steps_ms = 2000; break; + case 1: game_state.time_between_steps_ms = 1800; break; + case 2: game_state.time_between_steps_ms = 1600; break; + case 3: game_state.time_between_steps_ms = 1400; break; + case 4: game_state.time_between_steps_ms = 1200; break; + case 5: game_state.time_between_steps_ms = 1000; break; + case 6: game_state.time_between_steps_ms = 800; break; + case 7: game_state.time_between_steps_ms = 600; break; + default: + game_state.time_between_steps_ms = 400; + break; + } + } + + canvas.addEventListener('click', () => { + game_state.delivery_attempt = true; + }); + + // Actual game code. + let start; + const last_frame_win = game_state.win_frames[game_state.win_frames.length - 1]; + const last_frame_fail = game_state.fail_frames[game_state.fail_frames.length - 1]; + const last_frame_game = game_state.game_steps[game_state.game_steps.length - 1]; + function game_loop(timestamp) { + if (!ctx) { + console.log('No canvas found?'); + // you win, i'm not going to take a life from you + send_game_done(true); + return; + } + + if (start === undefined) { + start = timestamp; + } + const elapsed = timestamp - start; + + let idx = game_state.game_step; + if (elapsed > game_state.time_between_steps_ms) { + game_state.game_step += 1; + game_state.audio_played = false; + start = timestamp; + } + + if (!game_state.audio_played) { + game_state.audio_played = true; + const sound = frame_to_sound[game_state.game_step]; + if (sound) { + frame_to_sound[game_state.game_step - 1]?.mute(); + sound.play(); + } + } + + switch (game_state.state) { + case 'game': + draw_pizza = true; + + if (last_frame_game < game_state.game_step) { + // they failed due to time out + game_state.state = 'failed'; + game_state.game_step = game_state.fail_frames[0]; + game_state.pizza_delivered = false; + game_state.time_between_steps_ms = game_state.time_between_ending_frames_ms; + draw_pizza = false; + } + + if (game_state.delivery_attempt) { + draw_pizza = false; + game_state.time_between_steps_ms = game_state.time_between_ending_frames_ms; + if (game_state.ok_to_give.includes(game_state.game_step)) { + game_state.pizza_delivered = true; + game_state.state = 'victory'; + game_state.game_step = game_state.win_frames[0]; + } else { + game_state.state = 'failed'; + game_state.game_step = game_state.fail_frames[0]; + } + } + + break; + case 'failed': + if (last_frame_fail - 1 < game_state.game_step) { + game_state.time_between_steps_ms = 2000; + } + if (last_frame_fail < game_state.game_step) { + game_state.game_step = last_frame_fail; + send_game_done(false); + } + break; + case 'victory': + if (last_frame_win - 1 < game_state.game_step) { + game_state.time_between_steps_ms = 2000; + } + if (last_frame_win < game_state.game_step) { + game_state.game_step = last_frame_win; + send_game_done(true); + } + break; + case 'idle': + start = undefined; + return; + } + + ctx.clearRect(0, 0, canvas.width, canvas.height); + ctx.drawImage(miku_sprite, idx * 240, 0, 240, 160, 0, 0, 240, 160); + if (draw_pizza) { + ctx.drawImage(pizza_sprite, 0, 0, 700, 300, idx * 60, 130, 70, 30); + } + requestAnimationFrame(game_loop); + } + + + // CLONQ PROTOCOL AND BOOTSTRAP + function game_ready() { + window.parent.postMessage({op: "ready"}); + } + + function ack_start_event() { + reset_game_state(); + window.parent.postMessage({op: "started", verb: "DELIVER"}); + } + + function is_game_start_event(event) { + return event?.op === 'start' && event?.difficulty > -1; + } + + function send_game_done(player_won) { + window.parent.postMessage({op: "done", win: !!player_won}); + reset_game_state(); + game_state.state = 'idle'; + } + + function message_handler(event) { + if (is_game_start_event(event.data)) { + game_state.difficulty = event?.data?.difficulty || 0; + ack_start_event(); + game_loop(); + } + } + + window.addEventListener("message", message_handler); + window.onload = function() { + game_ready(); + }; + + + + </script> +</body> +</html>
\ No newline at end of file diff --git a/2026/games/peetseater/jump.mp3 b/2026/games/peetseater/jump.mp3 Binary files differnew file mode 100644 index 0000000..6c0510e --- /dev/null +++ b/2026/games/peetseater/jump.mp3 diff --git a/2026/games/peetseater/mikuscream.mp3 b/2026/games/peetseater/mikuscream.mp3 Binary files differnew file mode 100644 index 0000000..efa9178 --- /dev/null +++ b/2026/games/peetseater/mikuscream.mp3 diff --git a/2026/games/peetseater/pasta.mp3 b/2026/games/peetseater/pasta.mp3 Binary files differnew file mode 100644 index 0000000..8967aae --- /dev/null +++ b/2026/games/peetseater/pasta.mp3 diff --git a/2026/games/peetseater/pizza.mp3 b/2026/games/peetseater/pizza.mp3 Binary files differnew file mode 100644 index 0000000..be4c32a --- /dev/null +++ b/2026/games/peetseater/pizza.mp3 diff --git a/2026/games/peetseater/pizza.png b/2026/games/peetseater/pizza.png Binary files differnew file mode 100644 index 0000000..43569e0 --- /dev/null +++ b/2026/games/peetseater/pizza.png diff --git a/2026/games/peetseater/weeee.mp3 b/2026/games/peetseater/weeee.mp3 Binary files differnew file mode 100644 index 0000000..022e30e --- /dev/null +++ b/2026/games/peetseater/weeee.mp3 diff --git a/2026/games/pralkarz/.gitignore b/2026/games/pralkarz/.gitignore new file mode 100644 index 0000000..f6237b6 --- /dev/null +++ b/2026/games/pralkarz/.gitignore @@ -0,0 +1 @@ +*.aseprite
diff --git a/2026/games/pralkarz/LICENSE b/2026/games/pralkarz/LICENSE new file mode 100644 index 0000000..fe24157 --- /dev/null +++ b/2026/games/pralkarz/LICENSE @@ -0,0 +1,7 @@ +Copyright 2026 pralkarz
+
+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.
diff --git a/2026/games/pralkarz/README.md b/2026/games/pralkarz/README.md new file mode 100644 index 0000000..14da08d --- /dev/null +++ b/2026/games/pralkarz/README.md @@ -0,0 +1,8 @@ +# dżem
+
+My entry for [LCOLONQ's microjam](https://api.colonq.computer/jam/2026) and possibly the messiest code I've ever written.
+
+## Credit
+
+- `green.webp` and `red.webp` -- emotes yoinked from LCOLONQ's Discord server
+- everything else mine
diff --git a/2026/games/pralkarz/assets/green.webp b/2026/games/pralkarz/assets/green.webp Binary files differnew file mode 100644 index 0000000..7aa3c95 --- /dev/null +++ b/2026/games/pralkarz/assets/green.webp diff --git a/2026/games/pralkarz/assets/hook.png b/2026/games/pralkarz/assets/hook.png Binary files differnew file mode 100644 index 0000000..c9f2703 --- /dev/null +++ b/2026/games/pralkarz/assets/hook.png diff --git a/2026/games/pralkarz/assets/lose.wav b/2026/games/pralkarz/assets/lose.wav Binary files differnew file mode 100644 index 0000000..015ee43 --- /dev/null +++ b/2026/games/pralkarz/assets/lose.wav diff --git a/2026/games/pralkarz/assets/numbers.png b/2026/games/pralkarz/assets/numbers.png Binary files differnew file mode 100644 index 0000000..07cf0be --- /dev/null +++ b/2026/games/pralkarz/assets/numbers.png diff --git a/2026/games/pralkarz/assets/red.webp b/2026/games/pralkarz/assets/red.webp Binary files differnew file mode 100644 index 0000000..cdb1b8b --- /dev/null +++ b/2026/games/pralkarz/assets/red.webp diff --git a/2026/games/pralkarz/assets/water.png b/2026/games/pralkarz/assets/water.png Binary files differnew file mode 100644 index 0000000..3d06f8e --- /dev/null +++ b/2026/games/pralkarz/assets/water.png diff --git a/2026/games/pralkarz/assets/win.wav b/2026/games/pralkarz/assets/win.wav Binary files differnew file mode 100644 index 0000000..feb812b --- /dev/null +++ b/2026/games/pralkarz/assets/win.wav diff --git a/2026/games/pralkarz/dzem.js b/2026/games/pralkarz/dzem.js new file mode 100644 index 0000000..5703577 --- /dev/null +++ b/2026/games/pralkarz/dzem.js @@ -0,0 +1,483 @@ +const WIDTH = 240; +const HEIGHT = 160; + +const HOOK_WIDTH = 24; +const HOOK_HEIGHT = 40; + +// TODO: Misters of size 24 are tweaking. +const MISTER_SIZES = [16, 20, 28, 32]; + +class AssetManager { + /** @type {HTMLImageElement[]} */ + images = []; + /** @type {HTMLAudioElement[]} */ + sounds = []; + + /** @type {HTMLImageElement} */ + green; + /** @type {HTMLImageElement} */ + hook; + /** @type {HTMLImageElement} */ + red; + /** @type {HTMLImageElement} */ + water; + + /** @type {HTMLAudioElement} */ + lose; + /** @type {HTMLAudioElement} */ + win; + + constructor() { + this.green = new Image(); + this.green.src = "assets/green.webp"; + this.images.push(this.green); + + this.hook = new Image(); + this.hook.src = "assets/hook.png"; + this.images.push(this.hook); + + this.numbers = new Image(); + this.numbers.src = "assets/numbers.png"; + this.images.push(this.numbers); + + this.red = new Image(); + this.red.src = "assets/red.webp"; + this.images.push(this.red); + + this.water = new Image(); + this.water.src = "assets/water.png"; + this.images.push(this.water); + + this.lose = new Audio(); + this.lose.src = "assets/lose.wav"; + this.lose.load(); + this.sounds.push(this.lose); + + this.win = new Audio(); + this.win.src = "assets/win.wav"; + this.win.load(); + this.sounds.push(this.win); + } +} + +const state = { + /** @type {?HTMLCanvasElement} */ + canvas: null, + /** @type {?CanvasRenderingContext2D} */ + ctx: null, + + /** @type {boolean} */ + ready: false, + + /** @type {boolean} */ + started: false, + /** @type {number} */ + difficulty: 0, + + /** @type {number} */ + frameCounter: 0, + /** @type {number} */ + previousFrameTime: 0, + /** @type {boolean} */ + resetPreviousFrameTime: false, + /** @type {number} */ + targetFrameTime: 1000 / 60, + + /** @type {number} */ + mousePosX: 0, + /** @type {boolean} */ + lmbPressed: false, + /** @type {boolean} */ + rmbPressed: false, + + /** @type {AssetManager} */ + assetManager: new AssetManager(), + + /** @type {number} */ + hookX: 0, + /** @type {number} */ + hookY: 0, + /** @type {number} */ + hookVelocity: -1, + + /** @type {Mister[]} */ + misters: [], + /** @type {boolean} */ + yoinkingMister: false, + /** @type {boolean} */ + ceaseYoinkage: false, + + /** @type {number} */ + elapsed: 0, + /** @type {number} */ + timer: 7, + + /** @type {boolean} */ + won: false, + /** @type {number} */ + wonFrames: 0, + /** @type {boolean} */ + lost: false, + /** @type {number} */ + lostFrames: 0, +}; + +const resetState = () => { + state.ceaseYoinkage = false; + state.difficulty = 0; + state.elapsed = 0; + state.hookVelocity = -1; + state.lmbPressed = false; + state.lost = false; + state.lostFrames = 0; + state.misters = []; + state.previousFrameTime = 0; + state.rmbPressed = false; + state.started = false; + state.timer = 7; + state.won = false; + state.wonFrames = 0; + state.yoinkingMister = false; +}; + +class Mister { + /** @type {HTMLImageElement} */ + image; + + /** @type {boolean} */ + isBad; + + /** @type {number} */ + size; + + /** @type {number} */ + x; + /** @type {number} */ + y; + + /** @type {number} */ + velocity; + + /** @type {boolean} */ + canBeYoinked; + /** @type {number} */ + yoinkCooldown; + /** @type {boolean} */ + isBeingYoinked; + + /** @type {boolean} */ + shouldBePurged; + + /** + * @param {HTMLImageElement} image + * @param {boolean} isBad + */ + constructor(image, isBad) { + this.image = image; + this.isBad = isBad; + + this.size = MISTER_SIZES[Math.floor(Math.random() * MISTER_SIZES.length)]; + + const left = Math.random() < 0.5; + this.x = left ? -this.size : WIDTH; + + const minY = this.isBad ? HOOK_HEIGHT + 15 : HEIGHT - 64; + this.y = getRandomInt(minY, HEIGHT - this.size / 2); + + const maxSpeed = 2 + Math.floor(state.difficulty / 5); + const speed = getRandomInt(1, maxSpeed); + this.velocity = left ? speed : -speed; + + this.canBeYoinked = true; + this.yoinkCooldown = 0; + this.isBeingYoinked = false; + + this.shouldBePurged = false; + } + + draw() { + state.ctx.drawImage(this.image, this.x, this.y, this.size, this.size); + } + + async update() { + this.yoinkCooldown -= 1; + if (this.yoinkCooldown < 0) { + this.canBeYoinked = true; + } + + if (!this.isBeingYoinked) { + this.x += this.velocity; + } else { + if (state.ceaseYoinkage) { + state.yoinkingMister = false; + state.ceaseYoinkage = false; + + this.canBeYoinked = false; + this.yoinkCooldown = 60; + this.isBeingYoinked = false; + + this.x += this.velocity; + } else { + this.x = state.hookX - this.size / 4; + this.y = state.hookY + HOOK_HEIGHT / 2; + } + } + + if (this.isBeingYoinked && this.y <= -5) { + if (this.isBad) { + state.assetManager.lose.play(); + state.lost = true; + state.lostFrames = 5; + } else { + state.assetManager.win.play(); + state.won = true; + state.wonFrames = 5; + } + + return; + } + + if ( + !state.yoinkingMister && + this.canBeYoinked && + state.hookVelocity < 0 && + aabb( + this.x, + this.x + this.size, + this.y, + this.y + this.size, + state.hookX, + state.hookX + 15, + state.hookY + 20, + state.hookY + 30, + ) + ) { + state.yoinkingMister = true; + this.isBeingYoinked = true; + } + + this.shouldBePurged = this.x < 0 - this.size || this.x > WIDTH; + } +} + +const getRandom = (min, max) => { + return Math.random() * (max - min) + min; +}; + +/** + * @param {number} min + * @param {number} max + */ +const getRandomInt = (min, max) => { + return Math.floor(Math.random() * (max - min + 1) + min); +}; + +/** + * @param {number} left1 + * @param {number} right1 + * @param {number} top1 + * @param {number} bottom1 + * @param {number} left2 + * @param {number} right2 + * @param {number} top2 + * @param {number} bottom2 + */ +const aabb = (left1, right1, top1, bottom1, left2, right2, top2, bottom2) => { + return left1 < right2 && right1 > left2 && top1 < bottom2 && bottom1 > top2; +}; + +/** + * @param {number} currentTime + */ +const update = (currentTime) => { + state.frameCounter += 1; + + if (state.resetPreviousFrameTime) { + state.previousFrameTime = currentTime; + state.resetPreviousFrameTime = false; + } + + state.elapsed += (currentTime - state.previousFrameTime) / 1000; + + if (state.won && state.wonFrames <= 0) { + window.parent.postMessage({ op: "done", win: true }); + resetState(); + return; + } + + if (state.lost && state.lostFrames <= 0) { + window.parent.postMessage({ op: "done", win: false }); + resetState(); + return; + } + + if (state.wonFrames > 0 || state.lostFrames > 0) { + state.misters = []; + + if (state.frameCounter % 24 === 0) { + state.wonFrames -= 1; + state.lostFrames -= 1; + } + + return; + } + + if (state.timer - Math.floor(state.elapsed) <= 0) { + state.assetManager.lose.play(); + state.lost = true; + state.lostFrames = 5; + return; + } + + state.hookY = Math.max( + Math.min(state.hookY + state.hookVelocity, 160 - HOOK_HEIGHT), + -((HOOK_HEIGHT / 4) * 3), + ); + + const spawnRate = 0.03 + Math.min(state.difficulty, 10) * 0.01; + if (Math.random() < 0.03 + spawnRate) { + const isBad = + Math.random() > + 0.3 - + (state.difficulty > 10 ? 0.1 : 0) + + Math.floor(state.elapsed / 3) * 0.05; + state.misters.push( + new Mister( + isBad ? state.assetManager.red : state.assetManager.green, + isBad, + ), + ); + } + + state.misters.forEach((mister) => mister.update()); + state.misters = state.misters.filter((mister) => !mister.shouldBePurged); + + state.previousFrameTime = currentTime; +}; + +const draw = () => { + state.ctx.drawImage(state.assetManager.water, 0, 0); + + if (state.lostFrames > 0 || state.wonFrames > 0) { + const size = + 16 * 2 ** (5 - (state.won ? state.wonFrames : state.lostFrames)); + state.ctx.drawImage( + state.won ? state.assetManager.green : state.assetManager.red, + WIDTH / 2 - size / 2, + HEIGHT / 2 - size / 2, + size, + size, + ); + return; + } + + const hook = state.assetManager.hook; + state.hookX = Math.max(state.mousePosX - hook.width / 2, 0); + state.hookX = Math.floor(Math.min(WIDTH - hook.width, state.hookX)); + state.ctx.drawImage(hook, state.hookX, state.hookY); + + if (state.hookY > 0) { + state.ctx.lineWidth = 1; + state.ctx.beginPath(); + state.ctx.moveTo(state.hookX + 18 - 0.5, 0); + state.ctx.lineTo(state.hookX + 18 - 0.5, state.hookY); + state.ctx.stroke(); + } + + state.misters.forEach((mister) => mister.draw()); + + const timerStr = (state.timer - Math.floor(state.elapsed)).toString(); + + // The magic `4` is the padding between digits so that they're not glued together. + let x = WIDTH - 4 - (timerStr.length * 16 + (timerStr.length - 1) * 4); + for (const strDigit of timerStr) { + const digit = Number(strDigit); + state.ctx.drawImage( + state.assetManager.numbers, + digit * 16, + 0, + 16, + 24, + x, + 4, + 16, + 24, + ); + x += 16 + 4; + } +}; + +/** + * @param {number} currentTime + */ +const frame = (currentTime) => { + if ( + !state.ready && + state.assetManager.images.every((img) => img.complete) && + state.assetManager.sounds.every((sound) => sound.readyState === 4) + ) { + window.parent.postMessage({ op: "ready" }); + state.ready = true; + + state.previousFrameTime = currentTime; + } + + if (state.started) { + if (currentTime - state.previousFrameTime >= state.targetFrameTime) { + update(currentTime); + } + + draw(); + } + + requestAnimationFrame(frame); +}; + +const initialize = () => { + window.addEventListener("message", (ev) => { + switch (ev.data.op) { + case "start": + state.started = true; + state.difficulty = ev.data.difficulty; + state.timer = 10 + Math.floor(state.difficulty / 5); + // This makes sure the countdown is correct. Ugly and there's probably a better solution. + state.resetPreviousFrameTime = true; + + window.parent.postMessage({ op: "started", verb: "yoink!" }); + break; + default: + console.log(`[dżem] Unexpected event: ${ev}`); + break; + } + }); + + state.canvas = document.getElementById("dzem"); + state.ctx = state.canvas.getContext("2d"); + state.ctx.imageSmoothingEnabled = false; + + state.canvas.addEventListener("mousemove", (e) => { + state.mousePosX = e.clientX; + }); + + state.canvas.addEventListener("mousedown", (e) => { + if (e.button === 0) { + state.hookVelocity = 2; + } + }); + + state.canvas.addEventListener("mouseup", (e) => { + if (e.button === 0) { + state.hookVelocity = -2; + } else if (e.button === 2) { + state.ceaseYoinkage = true; + } + }); + + state.canvas.addEventListener("contextmenu", (e) => { + e.preventDefault(); + }); + + frame(0); +}; + +initialize(); diff --git a/2026/games/pralkarz/index.html b/2026/games/pralkarz/index.html new file mode 100644 index 0000000..5e5417a --- /dev/null +++ b/2026/games/pralkarz/index.html @@ -0,0 +1,18 @@ +<!doctype html> +<html lang="en"> + <head> + <meta charset="utf-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1" /> + <title>dżem</title> + <style> + * { + margin: 0; + padding: 0; + } + </style> + </head> + <body> + <canvas id="dzem" width="240" height="160"></canvas> + <script src="dzem.js"></script> + </body> +</html> diff --git a/2026/games/prodzpod/index.html b/2026/games/prodzpod/index.html new file mode 100644 index 0000000..0dbf1f7 --- /dev/null +++ b/2026/games/prodzpod/index.html @@ -0,0 +1,220 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0"> + <title>microgames</title> + <style> +html, body, #canvas { + margin: 0; + padding: 0; + border: 0; +} + +body { + color: white; + background-color: black; + overflow: hidden; + touch-action: none; +} + +#canvas { + display: block; +} + +#canvas:focus { + outline: none; +} + +#status, #status-splash, #status-progress { + position: absolute; + left: 0; + right: 0; +} + +#status, #status-splash { + top: 0; + bottom: 0; +} + +#status { + background-color: #242424; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + visibility: hidden; +} + +#status-splash { + max-height: 100%; + max-width: 100%; + margin: auto; +} + +#status-splash.show-image--false { + display: none; +} + +#status-splash.fullsize--true { + height: 100%; + width: 100%; + object-fit: contain; +} + +#status-splash.use-filter--false { + image-rendering: pixelated; +} + +#status-progress, #status-notice { + display: none; +} + +#status-progress { + bottom: 10%; + width: 50%; + margin: 0 auto; +} + +#status-notice { + background-color: #5b3943; + border-radius: 0.5rem; + border: 1px solid #9b3943; + color: #e0e0e0; + font-family: 'Noto Sans', 'Droid Sans', Arial, sans-serif; + line-height: 1.3; + margin: 0 2rem; + overflow: hidden; + padding: 1rem; + text-align: center; + z-index: 1; +} + </style> + <link id="-gd-engine-icon" rel="icon" type="image/png" href="microgames.icon.png" /> +<link rel="apple-touch-icon" href="microgames.apple-touch-icon.png"/> + + </head> + <body> + <canvas id="canvas"> + Your browser does not support the canvas tag. + </canvas> + + <noscript> + Your browser does not support JavaScript. + </noscript> + + <div id="status"> + <img id="status-splash" class="show-image--true fullsize--true use-filter--true" src="microgames.png" alt=""> + <progress id="status-progress"></progress> + <div id="status-notice"></div> + </div> + + <script src="microgames.js"></script> + <script> +const GODOT_CONFIG = {"args":[],"canvasResizePolicy":2,"emscriptenPoolSize":8,"ensureCrossOriginIsolationHeaders":true,"executable":"microgames","experimentalVK":false,"fileSizes":{"microgames.pck":24162604,"microgames.wasm":35740641},"focusCanvas":true,"gdextensionLibs":[],"godotPoolSize":4}; +const GODOT_THREADS_ENABLED = false; +const engine = new Engine(GODOT_CONFIG); + +(function () { + const statusOverlay = document.getElementById('status'); + const statusProgress = document.getElementById('status-progress'); + const statusNotice = document.getElementById('status-notice'); + + let initializing = true; + let statusMode = ''; + + function setStatusMode(mode) { + if (statusMode === mode || !initializing) { + return; + } + if (mode === 'hidden') { + statusOverlay.remove(); + initializing = false; + return; + } + statusOverlay.style.visibility = 'visible'; + statusProgress.style.display = mode === 'progress' ? 'block' : 'none'; + statusNotice.style.display = mode === 'notice' ? 'block' : 'none'; + statusMode = mode; + } + + function setStatusNotice(text) { + while (statusNotice.lastChild) { + statusNotice.removeChild(statusNotice.lastChild); + } + const lines = text.split('\n'); + lines.forEach((line) => { + statusNotice.appendChild(document.createTextNode(line)); + statusNotice.appendChild(document.createElement('br')); + }); + } + + function displayFailureNotice(err) { + console.error(err); + if (err instanceof Error) { + setStatusNotice(err.message); + } else if (typeof err === 'string') { + setStatusNotice(err); + } else { + setStatusNotice('An unknown error occurred.'); + } + setStatusMode('notice'); + initializing = false; + } + + const missing = Engine.getMissingFeatures({ + threads: GODOT_THREADS_ENABLED, + }); + + if (missing.length !== 0) { + if (GODOT_CONFIG['serviceWorker'] && GODOT_CONFIG['ensureCrossOriginIsolationHeaders'] && 'serviceWorker' in navigator) { + let serviceWorkerRegistrationPromise; + try { + serviceWorkerRegistrationPromise = navigator.serviceWorker.getRegistration(); + } catch (err) { + serviceWorkerRegistrationPromise = Promise.reject(new Error('Service worker registration failed.')); + } + // There's a chance that installing the service worker would fix the issue + Promise.race([ + serviceWorkerRegistrationPromise.then((registration) => { + if (registration != null) { + return Promise.reject(new Error('Service worker already exists.')); + } + return registration; + }).then(() => engine.installServiceWorker()), + // For some reason, `getRegistration()` can stall + new Promise((resolve) => { + setTimeout(() => resolve(), 2000); + }), + ]).then(() => { + // Reload if there was no error. + window.location.reload(); + }).catch((err) => { + console.error('Error while registering service worker:', err); + }); + } else { + // Display the message as usual + const missingMsg = 'Error\nThe following features required to run Godot projects on the Web are missing:\n'; + displayFailureNotice(missingMsg + missing.join('\n')); + } + } else { + setStatusMode('progress'); + engine.startGame({ + 'onProgress': function (current, total) { + if (current > 0 && total > 0) { + statusProgress.value = current; + statusProgress.max = total; + } else { + statusProgress.removeAttribute('value'); + statusProgress.removeAttribute('max'); + } + }, + }).then(() => { + setStatusMode('hidden'); + }, displayFailureNotice); + } +}()); + </script> + </body> +</html> + diff --git a/2026/games/prodzpod/microgames.apple-touch-icon.png b/2026/games/prodzpod/microgames.apple-touch-icon.png Binary files differnew file mode 100644 index 0000000..4299b3e --- /dev/null +++ b/2026/games/prodzpod/microgames.apple-touch-icon.png diff --git a/2026/games/prodzpod/microgames.audio.position.worklet.js b/2026/games/prodzpod/microgames.audio.position.worklet.js new file mode 100644 index 0000000..4e512c1 --- /dev/null +++ b/2026/games/prodzpod/microgames.audio.position.worklet.js @@ -0,0 +1,66 @@ +/**************************************************************************/ +/* godot.audio.position.worklet.js */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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. */ +/**************************************************************************/ + +class GodotPositionReportingProcessor extends AudioWorkletProcessor { + static get parameterDescriptors() { + return [ + { + name: 'reset', + defaultValue: 0, + minValue: 0, + maxValue: 1, + automationRate: 'k-rate', + }, + ]; + } + + constructor(...args) { + super(...args); + this.position = 0; + } + + process(inputs, _outputs, parameters) { + if (parameters['reset'][0] > 0) { + this.position = 0; + } + + if (inputs.length > 0) { + const input = inputs[0]; + if (input.length > 0) { + this.position += input[0].length; + this.port.postMessage({ type: 'position', data: this.position }); + } + } + + return true; + } +} + +registerProcessor('godot-position-reporting-processor', GodotPositionReportingProcessor); diff --git a/2026/games/prodzpod/microgames.audio.worklet.js b/2026/games/prodzpod/microgames.audio.worklet.js new file mode 100644 index 0000000..3b94cab --- /dev/null +++ b/2026/games/prodzpod/microgames.audio.worklet.js @@ -0,0 +1,213 @@ +/**************************************************************************/ +/* audio.worklet.js */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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. */ +/**************************************************************************/ + +class RingBuffer { + constructor(p_buffer, p_state, p_threads) { + this.buffer = p_buffer; + this.avail = p_state; + this.threads = p_threads; + this.rpos = 0; + this.wpos = 0; + } + + data_left() { + return this.threads ? Atomics.load(this.avail, 0) : this.avail; + } + + space_left() { + return this.buffer.length - this.data_left(); + } + + read(output) { + const size = this.buffer.length; + let from = 0; + let to_write = output.length; + if (this.rpos + to_write > size) { + const high = size - this.rpos; + output.set(this.buffer.subarray(this.rpos, size)); + from = high; + to_write -= high; + this.rpos = 0; + } + if (to_write) { + output.set(this.buffer.subarray(this.rpos, this.rpos + to_write), from); + } + this.rpos += to_write; + if (this.threads) { + Atomics.add(this.avail, 0, -output.length); + Atomics.notify(this.avail, 0); + } else { + this.avail -= output.length; + } + } + + write(p_buffer) { + const to_write = p_buffer.length; + const mw = this.buffer.length - this.wpos; + if (mw >= to_write) { + this.buffer.set(p_buffer, this.wpos); + this.wpos += to_write; + if (mw === to_write) { + this.wpos = 0; + } + } else { + const high = p_buffer.subarray(0, mw); + const low = p_buffer.subarray(mw); + this.buffer.set(high, this.wpos); + this.buffer.set(low); + this.wpos = low.length; + } + if (this.threads) { + Atomics.add(this.avail, 0, to_write); + Atomics.notify(this.avail, 0); + } else { + this.avail += to_write; + } + } +} + +class GodotProcessor extends AudioWorkletProcessor { + constructor() { + super(); + this.threads = false; + this.running = true; + this.lock = null; + this.notifier = null; + this.output = null; + this.output_buffer = new Float32Array(); + this.input = null; + this.input_buffer = new Float32Array(); + this.port.onmessage = (event) => { + const cmd = event.data['cmd']; + const data = event.data['data']; + this.parse_message(cmd, data); + }; + } + + process_notify() { + if (this.notifier) { + Atomics.add(this.notifier, 0, 1); + Atomics.notify(this.notifier, 0); + } + } + + parse_message(p_cmd, p_data) { + if (p_cmd === 'start' && p_data) { + const state = p_data[0]; + let idx = 0; + this.threads = true; + this.lock = state.subarray(idx, ++idx); + this.notifier = state.subarray(idx, ++idx); + const avail_in = state.subarray(idx, ++idx); + const avail_out = state.subarray(idx, ++idx); + this.input = new RingBuffer(p_data[1], avail_in, true); + this.output = new RingBuffer(p_data[2], avail_out, true); + } else if (p_cmd === 'stop') { + this.running = false; + this.output = null; + this.input = null; + this.lock = null; + this.notifier = null; + } else if (p_cmd === 'start_nothreads') { + this.output = new RingBuffer(p_data[0], p_data[0].length, false); + } else if (p_cmd === 'chunk') { + this.output.write(p_data); + } + } + + static array_has_data(arr) { + return arr.length && arr[0].length && arr[0][0].length; + } + + process(inputs, outputs, parameters) { + if (!this.running) { + return false; // Stop processing. + } + if (this.output === null) { + return true; // Not ready yet, keep processing. + } + const process_input = GodotProcessor.array_has_data(inputs); + if (process_input) { + const input = inputs[0]; + const chunk = input[0].length * input.length; + if (this.input_buffer.length !== chunk) { + this.input_buffer = new Float32Array(chunk); + } + if (!this.threads) { + GodotProcessor.write_input(this.input_buffer, input); + this.port.postMessage({ 'cmd': 'input', 'data': this.input_buffer }); + } else if (this.input.space_left() >= chunk) { + GodotProcessor.write_input(this.input_buffer, input); + this.input.write(this.input_buffer); + } else { + // this.port.postMessage('Input buffer is full! Skipping input frame.'); // Uncomment this line to debug input buffer. + } + } + const process_output = GodotProcessor.array_has_data(outputs); + if (process_output) { + const output = outputs[0]; + const chunk = output[0].length * output.length; + if (this.output_buffer.length !== chunk) { + this.output_buffer = new Float32Array(chunk); + } + if (this.output.data_left() >= chunk) { + this.output.read(this.output_buffer); + GodotProcessor.write_output(output, this.output_buffer); + if (!this.threads) { + this.port.postMessage({ 'cmd': 'read', 'data': chunk }); + } + } else { + // this.port.postMessage('Output buffer has not enough frames! Skipping output frame.'); // Uncomment this line to debug output buffer. + } + } + this.process_notify(); + return true; + } + + static write_output(dest, source) { + const channels = dest.length; + for (let ch = 0; ch < channels; ch++) { + for (let sample = 0; sample < dest[ch].length; sample++) { + dest[ch][sample] = source[sample * channels + ch]; + } + } + } + + static write_input(dest, source) { + const channels = source.length; + for (let ch = 0; ch < channels; ch++) { + for (let sample = 0; sample < source[ch].length; sample++) { + dest[sample * channels + ch] = source[ch][sample]; + } + } + } +} + +registerProcessor('godot-processor', GodotProcessor); diff --git a/2026/games/prodzpod/microgames.icon.png b/2026/games/prodzpod/microgames.icon.png Binary files differnew file mode 100644 index 0000000..4299b3e --- /dev/null +++ b/2026/games/prodzpod/microgames.icon.png diff --git a/2026/games/prodzpod/microgames.js b/2026/games/prodzpod/microgames.js new file mode 100644 index 0000000..50ce2f4 --- /dev/null +++ b/2026/games/prodzpod/microgames.js @@ -0,0 +1,909 @@ +var Godot=(()=>{var _scriptName=globalThis.document?.currentScript?.src;return async function(moduleArg={}){var moduleRtn;var Module=moduleArg;var ENVIRONMENT_IS_WEB=!!globalThis.window;var ENVIRONMENT_IS_WORKER=!!globalThis.WorkerGlobalScope;var ENVIRONMENT_IS_NODE=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};if(ENVIRONMENT_IS_WORKER){_scriptName=self.location.href}var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){try{scriptDirectory=new URL(".",_scriptName).href}catch{}{if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=async url=>{var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{}var out=console.log.bind(console);var err=console.error.bind(console);var wasmBinary;var ABORT=false;var EXITSTATUS;var readyPromiseResolve,readyPromiseReject;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;var HEAP64,HEAPU64;var runtimeInitialized=false;var runtimeExited=false;function updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=HEAP8=new Int8Array(b);Module["HEAP16"]=HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAPU16"]=HEAPU16=new Uint16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);Module["HEAPF64"]=HEAPF64=new Float64Array(b);Module["HEAP64"]=HEAP64=new BigInt64Array(b);Module["HEAPU64"]=HEAPU64=new BigUint64Array(b)}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(onPreRuns)}function initRuntime(){runtimeInitialized=true;if(!Module["noFSInit"]&&!FS.initialized)FS.init();TTY.init();wasmExports["pf"]();FS.ignorePermissions=false}function preMain(){}function exitRuntime(){___funcs_on_exit();FS.quit();TTY.shutdown();IDBFS.quit();runtimeExited=true}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(onPostRuns)}function abort(what){Module["onAbort"]?.(what);what="Aborted("+what+")";err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject?.(e);throw e}var wasmBinaryFile;function findWasmBinary(){return locateFile("godot.web.template_debug.wasm32.nothreads.wasm")}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)}}async function instantiateAsync(binary,binaryFile,imports){if(!binary){try{var response=fetch(binaryFile,{credentials:"same-origin"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation")}}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){var imports={a:wasmImports};return imports}async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;assignWasmExports(wasmExports);updateMemoryViews();return wasmExports}function receiveInstantiationResult(result){return receiveInstance(result["instance"])}var info=getWasmImports();if(Module["instantiateWasm"]){return new Promise((resolve,reject)=>{Module["instantiateWasm"](info,(inst,mod)=>{resolve(receiveInstance(inst,mod))})})}wasmBinaryFile??=findWasmBinary();var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);var exports=receiveInstantiationResult(result);return exports}class ExitStatus{name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status}}var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var onPostRuns=[];var addOnPostRun=cb=>onPostRuns.push(cb);var onPreRuns=[];var addOnPreRun=cb=>onPreRuns.push(cb);function getValue(ptr,type="i8"){if(type.endsWith("*"))type="*";switch(type){case"i1":return HEAP8[ptr];case"i8":return HEAP8[ptr];case"i16":return HEAP16[ptr>>1];case"i32":return HEAP32[ptr>>2];case"i64":return HEAP64[ptr>>3];case"float":return HEAPF32[ptr>>2];case"double":return HEAPF64[ptr>>3];case"*":return HEAPU32[ptr>>2];default:abort(`invalid type for getValue: ${type}`)}}var noExitRuntime=false;function setValue(ptr,value,type="i8"){if(type.endsWith("*"))type="*";switch(type){case"i1":HEAP8[ptr]=value;break;case"i8":HEAP8[ptr]=value;break;case"i16":HEAP16[ptr>>1]=value;break;case"i32":HEAP32[ptr>>2]=value;break;case"i64":HEAP64[ptr>>3]=BigInt(value);break;case"float":HEAPF32[ptr>>2]=value;break;case"double":HEAPF64[ptr>>3]=value;break;case"*":HEAPU32[ptr>>2]=value;break;default:abort(`invalid type for setValue: ${type}`)}}var getWasmTableEntry=funcPtr=>wasmTable.get(funcPtr);var ___call_sighandler=(fp,sig)=>getWasmTableEntry(fp)(sig);var PATH={isAbs:path=>path.charAt(0)==="/",splitPath:filename=>{var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1)},normalizeArray:(parts,allowAboveRoot)=>{var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up;up--){parts.unshift("..")}}return parts},normalize:path=>{var isAbsolute=PATH.isAbs(path),trailingSlash=path.slice(-1)==="/";path=PATH.normalizeArray(path.split("/").filter(p=>!!p),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path},dirname:path=>{var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.slice(0,-1)}return root+dir},basename:path=>path&&path.match(/([^\/]+|\/)\/*$/)[1],join:(...paths)=>PATH.normalize(paths.join("/")),join2:(l,r)=>PATH.normalize(l+"/"+r)};var initRandomFill=()=>view=>crypto.getRandomValues(view);var randomFill=view=>{(randomFill=initRandomFill())(view)};var PATH_FS={resolve:(...args)=>{var resolvedPath="",resolvedAbsolute=false;for(var i=args.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?args[i]:FS.cwd();if(typeof path!="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){return""}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=PATH.isAbs(path)}resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter(p=>!!p),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."},relative:(from,to)=>{from=PATH_FS.resolve(from).slice(1);to=PATH_FS.resolve(to).slice(1);function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=="")break}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break}}var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push("..")}outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join("/")}};var UTF8Decoder=globalThis.TextDecoder&&new TextDecoder;var findStringEnd=(heapOrArray,idx,maxBytesToRead,ignoreNul)=>{var maxIdx=idx+maxBytesToRead;if(ignoreNul)return maxIdx;while(heapOrArray[idx]&&!(idx>=maxIdx))++idx;return idx};var UTF8ArrayToString=(heapOrArray,idx=0,maxBytesToRead,ignoreNul)=>{var endPtr=findStringEnd(heapOrArray,idx,maxBytesToRead,ignoreNul);if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str};var FS_stdin_getChar_buffer=[];var lengthBytesUTF8=str=>{var len=0;for(var i=0;i<str.length;++i){var c=str.charCodeAt(i);if(c<=127){len++}else if(c<=2047){len+=2}else if(c>=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.codePointAt(i);if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63;i++}}heap[outIdx]=0;return outIdx-startIdx};var intArrayFromString=(stringy,dontAddNull,length)=>{var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array};var FS_stdin_getChar=()=>{if(!FS_stdin_getChar_buffer.length){var result=null;if(globalThis.window?.prompt){result=window.prompt("Input: ");if(result!==null){result+="\n"}}else{}if(!result){return null}FS_stdin_getChar_buffer=intArrayFromString(result,true)}return FS_stdin_getChar_buffer.shift()};var TTY={ttys:[],init(){},shutdown(){},register(dev,ops){TTY.ttys[dev]={input:[],output:[],ops};FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43)}stream.tty=tty;stream.seekable=false},close(stream){stream.tty.ops.fsync(stream.tty)},fsync(stream){stream.tty.ops.fsync(stream.tty)},read(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.get_char){throw new FS.ErrnoError(60)}var bytesRead=0;for(var i=0;i<length;i++){var result;try{result=stream.tty.ops.get_char(stream.tty)}catch(e){throw new FS.ErrnoError(29)}if(result===undefined&&bytesRead===0){throw new FS.ErrnoError(6)}if(result===null||result===undefined)break;bytesRead++;buffer[offset+i]=result}if(bytesRead){stream.node.atime=Date.now()}return bytesRead},write(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.put_char){throw new FS.ErrnoError(60)}try{for(var i=0;i<length;i++){stream.tty.ops.put_char(stream.tty,buffer[offset+i])}}catch(e){throw new FS.ErrnoError(29)}if(length){stream.node.mtime=stream.node.ctime=Date.now()}return i}},default_tty_ops:{get_char(tty){return FS_stdin_getChar()},put_char(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync(tty){if(tty.output?.length>0){out(UTF8ArrayToString(tty.output));tty.output=[]}},ioctl_tcgets(tty){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(tty,optional_actions,data){return 0},ioctl_tiocgwinsz(tty){return[24,80]}},default_tty1_ops:{put_char(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync(tty){if(tty.output?.length>0){err(UTF8ArrayToString(tty.output));tty.output=[]}}}};var zeroMemory=(ptr,size)=>HEAPU8.fill(0,ptr,ptr+size);var alignMemory=(size,alignment)=>Math.ceil(size/alignment)*alignment;var mmapAlloc=size=>{size=alignMemory(size,65536);var ptr=_emscripten_builtin_memalign(65536,size);if(ptr)zeroMemory(ptr,size);return ptr};var MEMFS={ops_table:null,mount(mount){return MEMFS.createNode(null,"/",16895,0)},createNode(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}MEMFS.ops_table||={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}};var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.atime=node.mtime=node.ctime=Date.now();if(parent){parent.contents[name]=node;parent.atime=parent.mtime=parent.ctime=node.atime}return node},getFileDataAsTypedArray(node){if(!node.contents)return new Uint8Array(0);if(node.contents.subarray)return node.contents.subarray(0,node.usedBytes);return new Uint8Array(node.contents)},expandFileStorage(node,newCapacity){var prevCapacity=node.contents?node.contents.length:0;if(prevCapacity>=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity<CAPACITY_DOUBLING_MAX?2:1.125)>>>0);if(prevCapacity!=0)newCapacity=Math.max(newCapacity,256);var oldContents=node.contents;node.contents=new Uint8Array(newCapacity);if(node.usedBytes>0)node.contents.set(oldContents.subarray(0,node.usedBytes),0)},resizeFileStorage(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0}else{var oldContents=node.contents;node.contents=new Uint8Array(newSize);if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)))}node.usedBytes=newSize}},node_ops:{getattr(node){var attr={};attr.dev=FS.isChrdev(node.mode)?node.id:1;attr.ino=node.id;attr.mode=node.mode;attr.nlink=1;attr.uid=0;attr.gid=0;attr.rdev=node.rdev;if(FS.isDir(node.mode)){attr.size=4096}else if(FS.isFile(node.mode)){attr.size=node.usedBytes}else if(FS.isLink(node.mode)){attr.size=node.link.length}else{attr.size=0}attr.atime=new Date(node.atime);attr.mtime=new Date(node.mtime);attr.ctime=new Date(node.ctime);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr(node,attr){for(const key of["mode","atime","mtime","ctime"]){if(attr[key]!=null){node[key]=attr[key]}}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup(parent,name){if(!MEMFS.doesNotExistError){MEMFS.doesNotExistError=new FS.ErrnoError(44);MEMFS.doesNotExistError.stack="<generic error, no stack>"}throw MEMFS.doesNotExistError},mknod(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename(old_node,new_dir,new_name){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){if(FS.isDir(old_node.mode)){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}FS.hashRemoveNode(new_node)}delete old_node.parent.contents[old_node.name];new_dir.contents[new_name]=old_node;old_node.name=new_name;new_dir.ctime=new_dir.mtime=old_node.parent.ctime=old_node.parent.mtime=Date.now()},unlink(parent,name){delete parent.contents[name];parent.ctime=parent.mtime=Date.now()},rmdir(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.ctime=parent.mtime=Date.now()},readdir(node){return[".","..",...Object.keys(node.contents)]},symlink(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i<size;i++)buffer[offset+i]=contents[position+i]}return size},write(stream,buffer,offset,length,position,canOwn){if(buffer.buffer===HEAP8.buffer){canOwn=false}if(!length)return 0;var node=stream.node;node.mtime=node.ctime=Date.now();if(buffer.subarray&&(!node.contents||node.contents.subarray)){if(canOwn){node.contents=buffer.subarray(offset,offset+length);node.usedBytes=length;return length}else if(node.usedBytes===0&&position===0){node.contents=buffer.slice(offset,offset+length);node.usedBytes=length;return length}else if(position+length<=node.usedBytes){node.contents.set(buffer.subarray(offset,offset+length),position);return length}}MEMFS.expandFileStorage(node,position+length);if(node.contents.subarray&&buffer.subarray){node.contents.set(buffer.subarray(offset,offset+length),position)}else{for(var i=0;i<length;i++){node.contents[position+i]=buffer[offset+i]}}node.usedBytes=Math.max(node.usedBytes,position+length);return length},llseek(stream,offset,whence){var position=offset;if(whence===1){position+=stream.position}else if(whence===2){if(FS.isFile(stream.node.mode)){position+=stream.node.usedBytes}}if(position<0){throw new FS.ErrnoError(28)}return position},mmap(stream,length,position,prot,flags){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}var ptr;var allocated;var contents=stream.node.contents;if(!(flags&2)&&contents&&contents.buffer===HEAP8.buffer){allocated=false;ptr=contents.byteOffset}else{allocated=true;ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}if(contents){if(position>0||position+length<contents.length){if(contents.subarray){contents=contents.subarray(position,position+length)}else{contents=Array.prototype.slice.call(contents,position,position+length)}}HEAP8.set(contents,ptr)}}return{ptr,allocated}},msync(stream,buffer,offset,length,mmapFlags){MEMFS.stream_ops.write(stream,buffer,0,length,offset,false);return 0}}};var FS_modeStringToFlags=str=>{var flagModes={r:0,"r+":2,w:512|64|1,"w+":512|64|2,a:1024|64|1,"a+":1024|64|2};var flags=flagModes[str];if(typeof flags=="undefined"){throw new Error(`Unknown file open mode: ${str}`)}return flags};var FS_getMode=(canRead,canWrite)=>{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode};var IDBFS={dbs:{},indexedDB:()=>indexedDB,DB_VERSION:21,DB_STORE_NAME:"FILE_DATA",queuePersist:mount=>{function onPersistComplete(){if(mount.idbPersistState==="again")startPersist();else mount.idbPersistState=0}function startPersist(){mount.idbPersistState="idb";IDBFS.syncfs(mount,false,onPersistComplete)}if(!mount.idbPersistState){mount.idbPersistState=setTimeout(startPersist,0)}else if(mount.idbPersistState==="idb"){mount.idbPersistState="again"}},mount:mount=>{var mnt=MEMFS.mount(mount);if(mount?.opts?.autoPersist){mount.idbPersistState=0;var memfs_node_ops=mnt.node_ops;mnt.node_ops={...mnt.node_ops};mnt.node_ops.mknod=(parent,name,mode,dev)=>{var node=memfs_node_ops.mknod(parent,name,mode,dev);node.node_ops=mnt.node_ops;node.idbfs_mount=mnt.mount;node.memfs_stream_ops=node.stream_ops;node.stream_ops={...node.stream_ops};node.stream_ops.write=(stream,buffer,offset,length,position,canOwn)=>{stream.node.isModified=true;return node.memfs_stream_ops.write(stream,buffer,offset,length,position,canOwn)};node.stream_ops.close=stream=>{var n=stream.node;if(n.isModified){IDBFS.queuePersist(n.idbfs_mount);n.isModified=false}if(n.memfs_stream_ops.close)return n.memfs_stream_ops.close(stream)};IDBFS.queuePersist(mnt.mount);return node};mnt.node_ops.rmdir=(...args)=>(IDBFS.queuePersist(mnt.mount),memfs_node_ops.rmdir(...args));mnt.node_ops.symlink=(...args)=>(IDBFS.queuePersist(mnt.mount),memfs_node_ops.symlink(...args));mnt.node_ops.unlink=(...args)=>(IDBFS.queuePersist(mnt.mount),memfs_node_ops.unlink(...args));mnt.node_ops.rename=(...args)=>(IDBFS.queuePersist(mnt.mount),memfs_node_ops.rename(...args))}return mnt},syncfs:(mount,populate,callback)=>{IDBFS.getLocalSet(mount,(err,local)=>{if(err)return callback(err);IDBFS.getRemoteSet(mount,(err,remote)=>{if(err)return callback(err);var src=populate?remote:local;var dst=populate?local:remote;IDBFS.reconcile(src,dst,callback)})})},quit:()=>{for(var value of Object.values(IDBFS.dbs)){value.close()}IDBFS.dbs={}},getDB:(name,callback)=>{var db=IDBFS.dbs[name];if(db){return callback(null,db)}var req;try{req=IDBFS.indexedDB().open(name,IDBFS.DB_VERSION)}catch(e){return callback(e)}if(!req){return callback("Unable to connect to IndexedDB")}req.onupgradeneeded=e=>{var db=e.target.result;var transaction=e.target.transaction;var fileStore;if(db.objectStoreNames.contains(IDBFS.DB_STORE_NAME)){fileStore=transaction.objectStore(IDBFS.DB_STORE_NAME)}else{fileStore=db.createObjectStore(IDBFS.DB_STORE_NAME)}if(!fileStore.indexNames.contains("timestamp")){fileStore.createIndex("timestamp","timestamp",{unique:false})}};req.onsuccess=()=>{db=req.result;IDBFS.dbs[name]=db;callback(null,db)};req.onerror=e=>{callback(e.target.error);e.preventDefault()}},getLocalSet:(mount,callback)=>{var entries={};function isRealDir(p){return p!=="."&&p!==".."}function toAbsolute(root){return p=>PATH.join2(root,p)}var check=FS.readdir(mount.mountpoint).filter(isRealDir).map(toAbsolute(mount.mountpoint));while(check.length){var path=check.pop();var stat;try{stat=FS.stat(path)}catch(e){return callback(e)}if(FS.isDir(stat.mode)){check.push(...FS.readdir(path).filter(isRealDir).map(toAbsolute(path)))}entries[path]={timestamp:stat.mtime}}return callback(null,{type:"local",entries})},getRemoteSet:(mount,callback)=>{var entries={};IDBFS.getDB(mount.mountpoint,(err,db)=>{if(err)return callback(err);try{var transaction=db.transaction([IDBFS.DB_STORE_NAME],"readonly");transaction.onerror=e=>{callback(e.target.error);e.preventDefault()};var store=transaction.objectStore(IDBFS.DB_STORE_NAME);var index=store.index("timestamp");index.openKeyCursor().onsuccess=event=>{var cursor=event.target.result;if(!cursor){return callback(null,{type:"remote",db,entries})}entries[cursor.primaryKey]={timestamp:cursor.key};cursor.continue()}}catch(e){return callback(e)}})},loadLocalEntry:(path,callback)=>{var stat,node;try{var lookup=FS.lookupPath(path);node=lookup.node;stat=FS.stat(path)}catch(e){return callback(e)}if(FS.isDir(stat.mode)){return callback(null,{timestamp:stat.mtime,mode:stat.mode})}else if(FS.isFile(stat.mode)){node.contents=MEMFS.getFileDataAsTypedArray(node);return callback(null,{timestamp:stat.mtime,mode:stat.mode,contents:node.contents})}else{return callback(new Error("node type not supported"))}},storeLocalEntry:(path,entry,callback)=>{try{if(FS.isDir(entry["mode"])){FS.mkdirTree(path,entry["mode"])}else if(FS.isFile(entry["mode"])){FS.writeFile(path,entry["contents"],{canOwn:true})}else{return callback(new Error("node type not supported"))}FS.chmod(path,entry["mode"]);FS.utime(path,entry["timestamp"],entry["timestamp"])}catch(e){return callback(e)}callback(null)},removeLocalEntry:(path,callback)=>{try{var stat=FS.stat(path);if(FS.isDir(stat.mode)){FS.rmdir(path)}else if(FS.isFile(stat.mode)){FS.unlink(path)}}catch(e){return callback(e)}callback(null)},loadRemoteEntry:(store,path,callback)=>{var req=store.get(path);req.onsuccess=event=>callback(null,event.target.result);req.onerror=e=>{callback(e.target.error);e.preventDefault()}},storeRemoteEntry:(store,path,entry,callback)=>{try{var req=store.put(entry,path)}catch(e){callback(e);return}req.onsuccess=event=>callback();req.onerror=e=>{callback(e.target.error);e.preventDefault()}},removeRemoteEntry:(store,path,callback)=>{var req=store.delete(path);req.onsuccess=event=>callback();req.onerror=e=>{callback(e.target.error);e.preventDefault()}},reconcile:(src,dst,callback)=>{var total=0;var create=[];for(var[key,e]of Object.entries(src.entries)){var e2=dst.entries[key];if(!e2||e["timestamp"].getTime()!=e2["timestamp"].getTime()){create.push(key);total++}}var remove=[];for(var key of Object.keys(dst.entries)){if(!src.entries[key]){remove.push(key);total++}}if(!total){return callback(null)}var errored=false;var db=src.type==="remote"?src.db:dst.db;var transaction=db.transaction([IDBFS.DB_STORE_NAME],"readwrite");var store=transaction.objectStore(IDBFS.DB_STORE_NAME);function done(err){if(err&&!errored){errored=true;return callback(err)}}transaction.onerror=transaction.onabort=e=>{done(e.target.error);e.preventDefault()};transaction.oncomplete=e=>{if(!errored){callback(null)}};for(const path of create.sort()){if(dst.type==="local"){IDBFS.loadRemoteEntry(store,path,(err,entry)=>{if(err)return done(err);IDBFS.storeLocalEntry(path,entry,done)})}else{IDBFS.loadLocalEntry(path,(err,entry)=>{if(err)return done(err);IDBFS.storeRemoteEntry(store,path,entry,done)})}}for(var path of remove.sort().reverse()){if(dst.type==="local"){IDBFS.removeLocalEntry(path,done)}else{IDBFS.removeRemoteEntry(store,path,done)}}}};var asyncLoad=async url=>{var arrayBuffer=await readAsync(url);return new Uint8Array(arrayBuffer)};var FS_createDataFile=(...args)=>FS.createDataFile(...args);var getUniqueRunDependency=id=>id;var runDependencies=0;var dependenciesFulfilled=null;var removeRunDependency=id=>{runDependencies--;Module["monitorRunDependencies"]?.(runDependencies);if(runDependencies==0){if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}};var addRunDependency=id=>{runDependencies++;Module["monitorRunDependencies"]?.(runDependencies)};var preloadPlugins=[];var FS_handledByPreloadPlugin=async(byteArray,fullname)=>{if(typeof Browser!="undefined")Browser.init();for(var plugin of preloadPlugins){if(plugin["canHandle"](fullname)){return plugin["handle"](byteArray,fullname)}}return byteArray};var FS_preloadFile=async(parent,name,url,canRead,canWrite,dontCreateFile,canOwn,preFinish)=>{var fullname=name?PATH_FS.resolve(PATH.join2(parent,name)):parent;var dep=getUniqueRunDependency(`cp ${fullname}`);addRunDependency(dep);try{var byteArray=url;if(typeof url=="string"){byteArray=await asyncLoad(url)}byteArray=await FS_handledByPreloadPlugin(byteArray,fullname);preFinish?.();if(!dontCreateFile){FS_createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}}finally{removeRunDependency(dep)}};var FS_createPreloadedFile=(parent,name,url,canRead,canWrite,onload,onerror,dontCreateFile,canOwn,preFinish)=>{FS_preloadFile(parent,name,url,canRead,canWrite,dontCreateFile,canOwn,preFinish).then(onload).catch(onerror)};var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,filesystems:null,syncFSRequests:0,readFiles:{},ErrnoError:class{name="ErrnoError";constructor(errno){this.errno=errno}},FSStream:class{shared={};get object(){return this.node}set object(val){this.node=val}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(val){this.shared.flags=val}get position(){return this.shared.position}set position(val){this.shared.position=val}},FSNode:class{node_ops={};stream_ops={};readMode=292|73;writeMode=146;mounted=null;constructor(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.rdev=rdev;this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(val){val?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(val){val?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return FS.isDir(this.mode)}get isDevice(){return FS.isChrdev(this.mode)}},lookupPath(path,opts={}){if(!path){throw new FS.ErrnoError(44)}opts.follow_mount??=true;if(!PATH.isAbs(path)){path=FS.cwd()+"/"+path}linkloop:for(var nlinks=0;nlinks<40;nlinks++){var parts=path.split("/").filter(p=>!!p);var current=FS.root;var current_path="/";for(var i=0;i<parts.length;i++){var islast=i===parts.length-1;if(islast&&opts.parent){break}if(parts[i]==="."){continue}if(parts[i]===".."){current_path=PATH.dirname(current_path);if(FS.isRoot(current)){path=current_path+"/"+parts.slice(i+1).join("/");nlinks--;continue linkloop}else{current=current.parent}continue}current_path=PATH.join2(current_path,parts[i]);try{current=FS.lookupNode(current,parts[i])}catch(e){if(e?.errno===44&&islast&&opts.noent_okay){return{path:current_path}}throw e}if(FS.isMountpoint(current)&&(!islast||opts.follow_mount)){current=current.mounted.root}if(FS.isLink(current.mode)&&(!islast||opts.follow)){if(!current.node_ops.readlink){throw new FS.ErrnoError(52)}var link=current.node_ops.readlink(current);if(!PATH.isAbs(link)){link=PATH.dirname(current_path)+"/"+link}path=link+"/"+parts.slice(i+1).join("/");continue linkloop}}return{path:current_path,node:current}}throw new FS.ErrnoError(32)},getPath(node){var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?`${mount}/${path}`:mount+path}path=path?`${node.name}/${path}`:node.name;node=node.parent}},hashName(parentid,name){var hash=0;for(var i=0;i<name.length;i++){hash=(hash<<5)-hash+name.charCodeAt(i)|0}return(parentid+hash>>>0)%FS.nameTable.length},hashAddNode(node){var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node},hashRemoveNode(node){var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}},lookupNode(parent,name){var errCode=FS.mayLookup(parent);if(errCode){throw new FS.ErrnoError(errCode)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node}}return FS.lookup(parent,name)},createNode(parent,name,mode,rdev){var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node},destroyNode(node){FS.hashRemoveNode(node)},isRoot(node){return node===node.parent},isMountpoint(node){return!!node.mounted},isFile(mode){return(mode&61440)===32768},isDir(mode){return(mode&61440)===16384},isLink(mode){return(mode&61440)===40960},isChrdev(mode){return(mode&61440)===8192},isBlkdev(mode){return(mode&61440)===24576},isFIFO(mode){return(mode&61440)===4096},isSocket(mode){return(mode&49152)===49152},flagsToPermissionString(flag){var perms=["r","w","rw"][flag&3];if(flag&512){perms+="w"}return perms},nodePermissions(node,perms){if(FS.ignorePermissions){return 0}if(perms.includes("r")&&!(node.mode&292)){return 2}else if(perms.includes("w")&&!(node.mode&146)){return 2}else if(perms.includes("x")&&!(node.mode&73)){return 2}return 0},mayLookup(dir){if(!FS.isDir(dir.mode))return 54;var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate(dir,name){if(!FS.isDir(dir.mode)){return 54}try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete(dir,name,isdir){var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else{if(FS.isDir(node.mode)){return 31}}return 0},mayOpen(node,flags){if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&(512|64)){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},checkOpExists(op,err){if(!op){throw new FS.ErrnoError(err)}return op},MAX_OPEN_FDS:4096,nextfd(){for(var fd=0;fd<=FS.MAX_OPEN_FDS;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStreamChecked(fd){var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}return stream},getStream:fd=>FS.streams[fd],createStream(stream,fd=-1){stream=Object.assign(new FS.FSStream,stream);if(fd==-1){fd=FS.nextfd()}stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream(fd){FS.streams[fd]=null},dupStream(origStream,fd=-1){var stream=FS.createStream(origStream,fd);stream.stream_ops?.dup?.(stream);return stream},doSetAttr(stream,node,attr){var setattr=stream?.stream_ops.setattr;var arg=setattr?stream:node;setattr??=node.node_ops.setattr;FS.checkOpExists(setattr,63);setattr(arg,attr)},chrdev_stream_ops:{open(stream){var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;stream.stream_ops.open?.(stream)},llseek(){throw new FS.ErrnoError(70)}},major:dev=>dev>>8,minor:dev=>dev&255,makedev:(ma,mi)=>ma<<8|mi,registerDevice(dev,ops){FS.devices[dev]={stream_ops:ops}},getDevice:dev=>FS.devices[dev],getMounts(mount){var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push(...m.mounts)}return mounts},syncfs(populate,callback){if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err(`warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`)}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}for(var mount of mounts){if(mount.type.syncfs){mount.type.syncfs(mount,populate,done)}else{done(null)}}},mount(type,opts,mountpoint){var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}}var mount={type,opts,mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot},unmount(mountpoint){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(28)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);for(var[hash,current]of Object.entries(FS.nameTable)){while(current){var next=current.name_next;if(mounts.includes(current.mount)){FS.destroyNode(current)}current=next}}node.mounted=null;var idx=node.mount.mounts.indexOf(mount);node.mount.mounts.splice(idx,1)},lookup(parent,name){return parent.node_ops.lookup(parent,name)},mknod(path,mode,dev){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name){throw new FS.ErrnoError(28)}if(name==="."||name===".."){throw new FS.ErrnoError(20)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},statfs(path){return FS.statfsNode(FS.lookupPath(path,{follow:true}).node)},statfsStream(stream){return FS.statfsNode(stream.node)},statfsNode(node){var rtn={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:FS.nextInode,ffree:FS.nextInode-1,fsid:42,flags:2,namelen:255};if(node.node_ops.statfs){Object.assign(rtn,node.node_ops.statfs(node.mount.opts.root))}return rtn},create(path,mode=438){mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir(path,mode=511){mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)},mkdirTree(path,mode){var dirs=path.split("/");var d="";for(var dir of dirs){if(!dir)continue;if(d||PATH.isAbs(path))d+="/";d+=dir;try{FS.mkdir(d,mode)}catch(e){if(e.errno!=20)throw e}}},mkdev(path,mode,dev){if(typeof dev=="undefined"){dev=mode;mode=438}mode|=8192;return FS.mknod(path,mode,dev)},symlink(oldpath,newpath){if(!PATH_FS.resolve(oldpath)){throw new FS.ErrnoError(44)}var lookup=FS.lookupPath(newpath,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var newname=PATH.basename(newpath);var errCode=FS.mayCreate(parent,newname);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.symlink){throw new FS.ErrnoError(63)}return parent.node_ops.symlink(parent,newname,oldpath)},rename(old_path,new_path){var old_dirname=PATH.dirname(old_path);var new_dirname=PATH.dirname(new_path);var old_name=PATH.basename(old_path);var new_name=PATH.basename(new_path);var lookup,old_dir,new_dir;lookup=FS.lookupPath(old_path,{parent:true});old_dir=lookup.node;lookup=FS.lookupPath(new_path,{parent:true});new_dir=lookup.node;if(!old_dir||!new_dir)throw new FS.ErrnoError(44);if(old_dir.mount!==new_dir.mount){throw new FS.ErrnoError(75)}var old_node=FS.lookupNode(old_dir,old_name);var relative=PATH_FS.relative(old_path,new_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(28)}relative=PATH_FS.relative(new_path,old_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(55)}var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(old_node===new_node){return}var isdir=FS.isDir(old_node.mode);var errCode=FS.mayDelete(old_dir,old_name,isdir);if(errCode){throw new FS.ErrnoError(errCode)}errCode=new_node?FS.mayDelete(new_dir,new_name,isdir):FS.mayCreate(new_dir,new_name);if(errCode){throw new FS.ErrnoError(errCode)}if(!old_dir.node_ops.rename){throw new FS.ErrnoError(63)}if(FS.isMountpoint(old_node)||new_node&&FS.isMountpoint(new_node)){throw new FS.ErrnoError(10)}if(new_dir!==old_dir){errCode=FS.nodePermissions(old_dir,"w");if(errCode){throw new FS.ErrnoError(errCode)}}FS.hashRemoveNode(old_node);try{old_dir.node_ops.rename(old_node,new_dir,new_name);old_node.parent=new_dir}catch(e){throw e}finally{FS.hashAddNode(old_node)}},rmdir(path){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,true);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.rmdir){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.rmdir(parent,name);FS.destroyNode(node)},readdir(path){var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;var readdir=FS.checkOpExists(node.node_ops.readdir,54);return readdir(node)},unlink(path){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,false);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.unlink){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.unlink(parent,name);FS.destroyNode(node)},readlink(path){var lookup=FS.lookupPath(path);var link=lookup.node;if(!link){throw new FS.ErrnoError(44)}if(!link.node_ops.readlink){throw new FS.ErrnoError(28)}return link.node_ops.readlink(link)},stat(path,dontFollow){var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;var getattr=FS.checkOpExists(node.node_ops.getattr,63);return getattr(node)},fstat(fd){var stream=FS.getStreamChecked(fd);var node=stream.node;var getattr=stream.stream_ops.getattr;var arg=getattr?stream:node;getattr??=node.node_ops.getattr;FS.checkOpExists(getattr,63);return getattr(arg)},lstat(path){return FS.stat(path,true)},doChmod(stream,node,mode,dontFollow){FS.doSetAttr(stream,node,{mode:mode&4095|node.mode&~4095,ctime:Date.now(),dontFollow})},chmod(path,mode,dontFollow){var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}FS.doChmod(null,node,mode,dontFollow)},lchmod(path,mode){FS.chmod(path,mode,true)},fchmod(fd,mode){var stream=FS.getStreamChecked(fd);FS.doChmod(stream,stream.node,mode,false)},doChown(stream,node,dontFollow){FS.doSetAttr(stream,node,{timestamp:Date.now(),dontFollow})},chown(path,uid,gid,dontFollow){var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}FS.doChown(null,node,dontFollow)},lchown(path,uid,gid){FS.chown(path,uid,gid,true)},fchown(fd,uid,gid){var stream=FS.getStreamChecked(fd);FS.doChown(stream,stream.node,false)},doTruncate(stream,node,len){if(FS.isDir(node.mode)){throw new FS.ErrnoError(31)}if(!FS.isFile(node.mode)){throw new FS.ErrnoError(28)}var errCode=FS.nodePermissions(node,"w");if(errCode){throw new FS.ErrnoError(errCode)}FS.doSetAttr(stream,node,{size:len,timestamp:Date.now()})},truncate(path,len){if(len<0){throw new FS.ErrnoError(28)}var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:true});node=lookup.node}else{node=path}FS.doTruncate(null,node,len)},ftruncate(fd,len){var stream=FS.getStreamChecked(fd);if(len<0||(stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.doTruncate(stream,stream.node,len)},utime(path,atime,mtime){var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;var setattr=FS.checkOpExists(node.node_ops.setattr,63);setattr(node,{atime,mtime})},open(path,flags,mode=438){if(path===""){throw new FS.ErrnoError(44)}flags=typeof flags=="string"?FS_modeStringToFlags(flags):flags;if(flags&64){mode=mode&4095|32768}else{mode=0}var node;var isDirPath;if(typeof path=="object"){node=path}else{isDirPath=path.endsWith("/");var lookup=FS.lookupPath(path,{follow:!(flags&131072),noent_okay:true});node=lookup.node;path=lookup.path}var created=false;if(flags&64){if(node){if(flags&128){throw new FS.ErrnoError(20)}}else if(isDirPath){throw new FS.ErrnoError(31)}else{node=FS.mknod(path,mode|511,0);created=true}}if(!node){throw new FS.ErrnoError(44)}if(FS.isChrdev(node.mode)){flags&=~512}if(flags&65536&&!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}if(!created){var errCode=FS.mayOpen(node,flags);if(errCode){throw new FS.ErrnoError(errCode)}}if(flags&512&&!created){FS.truncate(node,0)}flags&=~(128|512|131072);var stream=FS.createStream({node,path:FS.getPath(node),flags,seekable:true,position:0,stream_ops:node.stream_ops,ungotten:[],error:false});if(stream.stream_ops.open){stream.stream_ops.open(stream)}if(created){FS.chmod(node,mode&511)}if(Module["logReadFiles"]&&!(flags&1)){if(!(path in FS.readFiles)){FS.readFiles[path]=1}}return stream},close(stream){if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed(stream){return stream.fd===null},llseek(stream,offset,whence){if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70)}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position},read(stream,buffer,offset,length,position){if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.read){throw new FS.ErrnoError(28)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write(stream,buffer,offset,length,position,canOwn){if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.write){throw new FS.ErrnoError(28)}if(stream.seekable&&stream.flags&1024){FS.llseek(stream,0,2)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesWritten=stream.stream_ops.write(stream,buffer,offset,length,position,canOwn);if(!seeking)stream.position+=bytesWritten;return bytesWritten},mmap(stream,length,position,prot,flags){if((prot&2)!==0&&(flags&2)===0&&(stream.flags&2097155)!==2){throw new FS.ErrnoError(2)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(2)}if(!stream.stream_ops.mmap){throw new FS.ErrnoError(43)}if(!length){throw new FS.ErrnoError(28)}return stream.stream_ops.mmap(stream,length,position,prot,flags)},msync(stream,buffer,offset,length,mmapFlags){if(!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},ioctl(stream,cmd,arg){if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile(path,opts={}){opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){abort(`Invalid encoding type "${opts.encoding}"`)}var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){buf=UTF8ArrayToString(buf)}FS.close(stream);return buf},writeFile(path,data,opts={}){opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){data=new Uint8Array(intArrayFromString(data,true))}if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn)}else{abort("Unsupported data type")}FS.close(stream)},cwd:()=>FS.currentPath,chdir(path){var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories(){FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices(){FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length,llseek:()=>0});FS.mkdev("/dev/null",FS.makedev(1,3));TTY.register(FS.makedev(5,0),TTY.default_tty_ops);TTY.register(FS.makedev(6,0),TTY.default_tty1_ops);FS.mkdev("/dev/tty",FS.makedev(5,0));FS.mkdev("/dev/tty1",FS.makedev(6,0));var randomBuffer=new Uint8Array(1024),randomLeft=0;var randomByte=()=>{if(randomLeft===0){randomFill(randomBuffer);randomLeft=randomBuffer.byteLength}return randomBuffer[--randomLeft]};FS.createDevice("/dev","random",randomByte);FS.createDevice("/dev","urandom",randomByte);FS.mkdir("/dev/shm");FS.mkdir("/dev/shm/tmp")},createSpecialDirectories(){FS.mkdir("/proc");var proc_self=FS.mkdir("/proc/self");FS.mkdir("/proc/self/fd");FS.mount({mount(){var node=FS.createNode(proc_self,"fd",16895,73);node.stream_ops={llseek:MEMFS.stream_ops.llseek};node.node_ops={lookup(parent,name){var fd=+name;var stream=FS.getStreamChecked(fd);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path},id:fd+1};ret.parent=ret;return ret},readdir(){return Array.from(FS.streams.entries()).filter(([k,v])=>v).map(([k,v])=>k.toString())}};return node}},{},"/proc/self/fd")},createStandardStreams(input,output,error){if(input){FS.createDevice("/dev","stdin",input)}else{FS.symlink("/dev/tty","/dev/stdin")}if(output){FS.createDevice("/dev","stdout",null,output)}else{FS.symlink("/dev/tty","/dev/stdout")}if(error){FS.createDevice("/dev","stderr",null,error)}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1)},staticInit(){FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={MEMFS,IDBFS}},init(input,output,error){FS.initialized=true;input??=Module["stdin"];output??=Module["stdout"];error??=Module["stderr"];FS.createStandardStreams(input,output,error)},quit(){FS.initialized=false;_fflush(0);for(var stream of FS.streams){if(stream){FS.close(stream)}}},findObject(path,dontResolveLastLink){var ret=FS.analyzePath(path,dontResolveLastLink);if(!ret.exists){return null}return ret.object},analyzePath(path,dontResolveLastLink){try{var lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});path=lookup.path}catch(e){}var ret={isRoot:false,exists:false,error:0,name:null,path:null,object:null,parentExists:false,parentPath:null,parentObject:null};try{var lookup=FS.lookupPath(path,{parent:true});ret.parentExists=true;ret.parentPath=lookup.path;ret.parentObject=lookup.node;ret.name=PATH.basename(path);lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});ret.exists=true;ret.path=lookup.path;ret.object=lookup.node;ret.name=lookup.node.name;ret.isRoot=lookup.path==="/"}catch(e){ret.error=e.errno}return ret},createPath(parent,path,canRead,canWrite){parent=typeof parent=="string"?parent:FS.getPath(parent);var parts=path.split("/").reverse();while(parts.length){var part=parts.pop();if(!part)continue;var current=PATH.join2(parent,part);try{FS.mkdir(current)}catch(e){if(e.errno!=20)throw e}parent=current}return current},createFile(parent,name,properties,canRead,canWrite){var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS_getMode(canRead,canWrite);return FS.create(path,mode)},createDataFile(parent,name,data,canRead,canWrite,canOwn){var path=name;if(parent){parent=typeof parent=="string"?parent:FS.getPath(parent);path=name?PATH.join2(parent,name):parent}var mode=FS_getMode(canRead,canWrite);var node=FS.create(path,mode);if(data){if(typeof data=="string"){var arr=new Array(data.length);for(var i=0,len=data.length;i<len;++i)arr[i]=data.charCodeAt(i);data=arr}FS.chmod(node,mode|146);var stream=FS.open(node,577);FS.write(stream,data,0,data.length,0,canOwn);FS.close(stream);FS.chmod(node,mode)}},createDevice(parent,name,input,output){var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS_getMode(!!input,!!output);FS.createDevice.major??=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open(stream){stream.seekable=false},close(stream){if(output?.buffer?.length){output(10)}},read(stream,buffer,offset,length,pos){var bytesRead=0;for(var i=0;i<length;i++){var result;try{result=input()}catch(e){throw new FS.ErrnoError(29)}if(result===undefined&&bytesRead===0){throw new FS.ErrnoError(6)}if(result===null||result===undefined)break;bytesRead++;buffer[offset+i]=result}if(bytesRead){stream.node.atime=Date.now()}return bytesRead},write(stream,buffer,offset,length,pos){for(var i=0;i<length;i++){try{output(buffer[offset+i])}catch(e){throw new FS.ErrnoError(29)}}if(length){stream.node.mtime=stream.node.ctime=Date.now()}return i}});return FS.mkdev(path,mode,dev)},forceLoadFile(obj){if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(globalThis.XMLHttpRequest){abort("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{obj.contents=readBinary(obj.url)}catch(e){throw new FS.ErrnoError(29)}}},createLazyFile(parent,name,url,canRead,canWrite){class LazyUint8Array{lengthKnown=false;chunks=[];get(idx){if(idx>this.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]}setDataGetter(getter){this.getter=getter}cacheLength(){var xhr=new XMLHttpRequest;xhr.open("HEAD",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))abort("Couldn't load "+url+". Status: "+xhr.status);var datalength=Number(xhr.getResponseHeader("Content-length"));var header;var hasByteServing=(header=xhr.getResponseHeader("Accept-Ranges"))&&header==="bytes";var usesGzip=(header=xhr.getResponseHeader("Content-Encoding"))&&header==="gzip";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=(from,to)=>{if(from>to)abort("invalid range ("+from+", "+to+") or no bytes requested!");if(to>datalength-1)abort("only "+datalength+" bytes available! programmer error!");var xhr=new XMLHttpRequest;xhr.open("GET",url,false);if(datalength!==chunkSize)xhr.setRequestHeader("Range","bytes="+from+"-"+to);xhr.responseType="arraybuffer";if(xhr.overrideMimeType){xhr.overrideMimeType("text/plain; charset=x-user-defined")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))abort("Couldn't load "+url+". Status: "+xhr.status);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}return intArrayFromString(xhr.responseText||"",true)};var lazyArray=this;lazyArray.setDataGetter(chunkNum=>{var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]=="undefined"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]=="undefined")abort("doXHR failed!");return lazyArray.chunks[chunkNum]});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;out("LazyFiles on gzip forces download of the whole file when length is accessed")}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true}get length(){if(!this.lengthKnown){this.cacheLength()}return this._length}get chunkSize(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}if(globalThis.XMLHttpRequest){if(!ENVIRONMENT_IS_WORKER)abort("Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc");var lazyArray=new LazyUint8Array;var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}});var stream_ops={};for(const[key,fn]of Object.entries(node.stream_ops)){stream_ops[key]=(...args)=>{FS.forceLoadFile(node);return fn(...args)}}function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i<size;i++){buffer[offset+i]=contents[position+i]}}else{for(var i=0;i<size;i++){buffer[offset+i]=contents.get(position+i)}}return size}stream_ops.read=(stream,buffer,offset,length,position)=>{FS.forceLoadFile(node);return writeChunks(stream,buffer,offset,length,position)};stream_ops.mmap=(stream,length,position,prot,flags)=>{FS.forceLoadFile(node);var ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}writeChunks(stream,HEAP8,ptr,length,position);return{ptr,allocated:true}};node.stream_ops=stream_ops;return node}};var UTF8ToString=(ptr,maxBytesToRead,ignoreNul)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead,ignoreNul):"";var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt(dirfd,path,allowEmpty){if(PATH.isAbs(path)){return path}var dir;if(dirfd===-100){dir=FS.cwd()}else{var dirstream=SYSCALLS.getStreamFromFD(dirfd);dir=dirstream.path}if(path.length==0){if(!allowEmpty){throw new FS.ErrnoError(44)}return dir}return dir+"/"+path},writeStat(buf,stat){HEAPU32[buf>>2]=stat.dev;HEAPU32[buf+4>>2]=stat.mode;HEAPU32[buf+8>>2]=stat.nlink;HEAPU32[buf+12>>2]=stat.uid;HEAPU32[buf+16>>2]=stat.gid;HEAPU32[buf+20>>2]=stat.rdev;HEAP64[buf+24>>3]=BigInt(stat.size);HEAP32[buf+32>>2]=4096;HEAP32[buf+36>>2]=stat.blocks;var atime=stat.atime.getTime();var mtime=stat.mtime.getTime();var ctime=stat.ctime.getTime();HEAP64[buf+40>>3]=BigInt(Math.floor(atime/1e3));HEAPU32[buf+48>>2]=atime%1e3*1e3*1e3;HEAP64[buf+56>>3]=BigInt(Math.floor(mtime/1e3));HEAPU32[buf+64>>2]=mtime%1e3*1e3*1e3;HEAP64[buf+72>>3]=BigInt(Math.floor(ctime/1e3));HEAPU32[buf+80>>2]=ctime%1e3*1e3*1e3;HEAP64[buf+88>>3]=BigInt(stat.ino);return 0},writeStatFs(buf,stats){HEAPU32[buf+4>>2]=stats.bsize;HEAPU32[buf+60>>2]=stats.bsize;HEAP64[buf+8>>3]=BigInt(stats.blocks);HEAP64[buf+16>>3]=BigInt(stats.bfree);HEAP64[buf+24>>3]=BigInt(stats.bavail);HEAP64[buf+32>>3]=BigInt(stats.files);HEAP64[buf+40>>3]=BigInt(stats.ffree);HEAPU32[buf+48>>2]=stats.fsid;HEAPU32[buf+64>>2]=stats.flags;HEAPU32[buf+56>>2]=stats.namelen},doMsync(addr,stream,len,flags,offset){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}if(flags&2){return 0}var buffer=HEAPU8.slice(addr,addr+len);FS.msync(stream,buffer,offset,len,flags)},getStreamFromFD(fd){var stream=FS.getStreamChecked(fd);return stream},varargs:undefined,getStr(ptr){var ret=UTF8ToString(ptr);return ret}};function ___syscall_chdir(path){try{path=SYSCALLS.getStr(path);FS.chdir(path);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_chmod(path,mode){try{path=SYSCALLS.getStr(path);FS.chmod(path,mode);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_faccessat(dirfd,path,amode,flags){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);if(amode&~7){return-28}var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;if(!node){return-44}var perms="";if(amode&4)perms+="r";if(amode&2)perms+="w";if(amode&1)perms+="x";if(perms&&FS.nodePermissions(node,perms)){return-2}return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_fchmod(fd,mode){try{FS.fchmod(fd,mode);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var syscallGetVarargI=()=>{var ret=HEAP32[+SYSCALLS.varargs>>2];SYSCALLS.varargs+=4;return ret};var syscallGetVarargP=syscallGetVarargI;function ___syscall_fcntl64(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=syscallGetVarargI();if(arg<0){return-28}while(FS.streams[arg]){arg++}var newStream;newStream=FS.dupStream(stream,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=syscallGetVarargI();stream.flags|=arg;return 0}case 12:{var arg=syscallGetVarargP();var offset=0;HEAP16[arg+offset>>1]=2;return 0}case 13:case 14:return 0}return-28}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_fstat64(fd,buf){try{return SYSCALLS.writeStat(buf,FS.fstat(fd))}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var INT53_MAX=9007199254740992;var INT53_MIN=-9007199254740992;var bigintToI53Checked=num=>num<INT53_MIN||num>INT53_MAX?NaN:Number(num);function ___syscall_ftruncate64(fd,length){length=bigintToI53Checked(length);try{if(isNaN(length))return-61;FS.ftruncate(fd,length);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);function ___syscall_getcwd(buf,size){try{if(size===0)return-28;var cwd=FS.cwd();var cwdLengthInBytes=lengthBytesUTF8(cwd)+1;if(size<cwdLengthInBytes)return-68;stringToUTF8(cwd,buf,size);return cwdLengthInBytes}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_getdents64(fd,dirp,count){try{var stream=SYSCALLS.getStreamFromFD(fd);stream.getdents||=FS.readdir(stream.path);var struct_size=280;var pos=0;var off=FS.llseek(stream,0,1);var startIdx=Math.floor(off/struct_size);var endIdx=Math.min(stream.getdents.length,startIdx+Math.floor(count/struct_size));for(var idx=startIdx;idx<endIdx;idx++){var id;var type;var name=stream.getdents[idx];if(name==="."){id=stream.node.id;type=4}else if(name===".."){var lookup=FS.lookupPath(stream.path,{parent:true});id=lookup.node.id;type=4}else{var child;try{child=FS.lookupNode(stream.node,name)}catch(e){if(e?.errno===28){continue}throw e}id=child.id;type=FS.isChrdev(child.mode)?2:FS.isDir(child.mode)?4:FS.isLink(child.mode)?10:8}HEAP64[dirp+pos>>3]=BigInt(id);HEAP64[dirp+pos+8>>3]=BigInt((idx+1)*struct_size);HEAP16[dirp+pos+16>>1]=280;HEAP8[dirp+pos+18]=type;stringToUTF8(name,dirp+pos+19,256);pos+=struct_size}FS.llseek(stream,idx*struct_size,0);return pos}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_ioctl(fd,op,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(op){case 21509:{if(!stream.tty)return-59;return 0}case 21505:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tcgets){var termios=stream.tty.ops.ioctl_tcgets(stream);var argp=syscallGetVarargP();HEAP32[argp>>2]=termios.c_iflag||0;HEAP32[argp+4>>2]=termios.c_oflag||0;HEAP32[argp+8>>2]=termios.c_cflag||0;HEAP32[argp+12>>2]=termios.c_lflag||0;for(var i=0;i<32;i++){HEAP8[argp+i+17]=termios.c_cc[i]||0}return 0}return 0}case 21510:case 21511:case 21512:{if(!stream.tty)return-59;return 0}case 21506:case 21507:case 21508:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tcsets){var argp=syscallGetVarargP();var c_iflag=HEAP32[argp>>2];var c_oflag=HEAP32[argp+4>>2];var c_cflag=HEAP32[argp+8>>2];var c_lflag=HEAP32[argp+12>>2];var c_cc=[];for(var i=0;i<32;i++){c_cc.push(HEAP8[argp+i+17])}return stream.tty.ops.ioctl_tcsets(stream.tty,op,{c_iflag,c_oflag,c_cflag,c_lflag,c_cc})}return 0}case 21519:{if(!stream.tty)return-59;var argp=syscallGetVarargP();HEAP32[argp>>2]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21537:case 21531:{var argp=syscallGetVarargP();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tiocgwinsz){var winsize=stream.tty.ops.ioctl_tiocgwinsz(stream.tty);var argp=syscallGetVarargP();HEAP16[argp>>1]=winsize[0];HEAP16[argp+2>>1]=winsize[1]}return 0}case 21524:{if(!stream.tty)return-59;return 0}case 21515:{if(!stream.tty)return-59;return 0}default:return-28}}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_lstat64(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.writeStat(buf,FS.lstat(path))}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_mkdirat(dirfd,path,mode){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);FS.mkdir(path,mode,0);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_mknodat(dirfd,path,mode,dev){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);switch(mode&61440){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-28}FS.mknod(path,mode,dev);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_newfstatat(dirfd,path,buf,flags){try{path=SYSCALLS.getStr(path);var nofollow=flags&256;var allowEmpty=flags&4096;flags=flags&~6400;path=SYSCALLS.calculateAt(dirfd,path,allowEmpty);return SYSCALLS.writeStat(buf,nofollow?FS.lstat(path):FS.stat(path))}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?syscallGetVarargI():0;return FS.open(path,flags,mode).fd}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_readlinkat(dirfd,path,buf,bufsize){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);if(bufsize<=0)return-28;var ret=FS.readlink(path);var len=Math.min(bufsize,lengthBytesUTF8(ret));var endChar=HEAP8[buf+len];stringToUTF8(ret,buf,bufsize+1);HEAP8[buf+len]=endChar;return len}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_renameat(olddirfd,oldpath,newdirfd,newpath){try{oldpath=SYSCALLS.getStr(oldpath);newpath=SYSCALLS.getStr(newpath);oldpath=SYSCALLS.calculateAt(olddirfd,oldpath);newpath=SYSCALLS.calculateAt(newdirfd,newpath);FS.rename(oldpath,newpath);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_rmdir(path){try{path=SYSCALLS.getStr(path);FS.rmdir(path);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_stat64(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.writeStat(buf,FS.stat(path))}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_statfs64(path,size,buf){try{SYSCALLS.writeStatFs(buf,FS.statfs(SYSCALLS.getStr(path)));return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_symlinkat(target,dirfd,linkpath){try{target=SYSCALLS.getStr(target);linkpath=SYSCALLS.getStr(linkpath);linkpath=SYSCALLS.calculateAt(dirfd,linkpath);FS.symlink(target,linkpath);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_unlinkat(dirfd,path,flags){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);if(!flags){FS.unlink(path)}else if(flags===512){FS.rmdir(path)}else{return-28}return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var __abort_js=()=>abort("");var runtimeKeepaliveCounter=0;var __emscripten_runtime_keepalive_clear=()=>{noExitRuntime=false;runtimeKeepaliveCounter=0};function __gmtime_js(time,tmPtr){time=bigintToI53Checked(time);var date=new Date(time*1e3);HEAP32[tmPtr>>2]=date.getUTCSeconds();HEAP32[tmPtr+4>>2]=date.getUTCMinutes();HEAP32[tmPtr+8>>2]=date.getUTCHours();HEAP32[tmPtr+12>>2]=date.getUTCDate();HEAP32[tmPtr+16>>2]=date.getUTCMonth();HEAP32[tmPtr+20>>2]=date.getUTCFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getUTCDay();var start=Date.UTC(date.getUTCFullYear(),0,1,0,0,0,0);var yday=(date.getTime()-start)/(1e3*60*60*24)|0;HEAP32[tmPtr+28>>2]=yday}var isLeapYear=year=>year%4===0&&(year%100!==0||year%400===0);var MONTH_DAYS_LEAP_CUMULATIVE=[0,31,60,91,121,152,182,213,244,274,305,335];var MONTH_DAYS_REGULAR_CUMULATIVE=[0,31,59,90,120,151,181,212,243,273,304,334];var ydayFromDate=date=>{var leap=isLeapYear(date.getFullYear());var monthDaysCumulative=leap?MONTH_DAYS_LEAP_CUMULATIVE:MONTH_DAYS_REGULAR_CUMULATIVE;var yday=monthDaysCumulative[date.getMonth()]+date.getDate()-1;return yday};function __localtime_js(time,tmPtr){time=bigintToI53Checked(time);var date=new Date(time*1e3);HEAP32[tmPtr>>2]=date.getSeconds();HEAP32[tmPtr+4>>2]=date.getMinutes();HEAP32[tmPtr+8>>2]=date.getHours();HEAP32[tmPtr+12>>2]=date.getDate();HEAP32[tmPtr+16>>2]=date.getMonth();HEAP32[tmPtr+20>>2]=date.getFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getDay();var yday=ydayFromDate(date)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr+36>>2]=-(date.getTimezoneOffset()*60);var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dst=(summerOffset!=winterOffset&&date.getTimezoneOffset()==Math.min(winterOffset,summerOffset))|0;HEAP32[tmPtr+32>>2]=dst}var timers={};var handleException=e=>{if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS}quit_(1,e)};var keepRuntimeAlive=()=>noExitRuntime||runtimeKeepaliveCounter>0;var _proc_exit=code=>{EXITSTATUS=code;if(!keepRuntimeAlive()){Module["onExit"]?.(code);ABORT=true}quit_(code,new ExitStatus(code))};var exitJS=(status,implicit)=>{EXITSTATUS=status;if(!keepRuntimeAlive()){exitRuntime()}_proc_exit(status)};var _exit=exitJS;var maybeExit=()=>{if(runtimeExited){return}if(!keepRuntimeAlive()){try{_exit(EXITSTATUS)}catch(e){handleException(e)}}};var callUserCallback=func=>{if(runtimeExited||ABORT){return}try{func();maybeExit()}catch(e){handleException(e)}};var _emscripten_get_now=()=>performance.now();var __setitimer_js=(which,timeout_ms)=>{if(timers[which]){clearTimeout(timers[which].id);delete timers[which]}if(!timeout_ms)return 0;var id=setTimeout(()=>{delete timers[which];callUserCallback(()=>__emscripten_timeout(which,_emscripten_get_now()))},timeout_ms);timers[which]={id,timeout_ms};return 0};var __tzset_js=(timezone,daylight,std_name,dst_name)=>{var currentYear=(new Date).getFullYear();var winter=new Date(currentYear,0,1);var summer=new Date(currentYear,6,1);var winterOffset=winter.getTimezoneOffset();var summerOffset=summer.getTimezoneOffset();var stdTimezoneOffset=Math.max(winterOffset,summerOffset);HEAPU32[timezone>>2]=stdTimezoneOffset*60;HEAP32[daylight>>2]=Number(winterOffset!=summerOffset);var extractZone=timezoneOffset=>{var sign=timezoneOffset>=0?"-":"+";var absOffset=Math.abs(timezoneOffset);var hours=String(Math.floor(absOffset/60)).padStart(2,"0");var minutes=String(absOffset%60).padStart(2,"0");return`UTC${sign}${hours}${minutes}`};var winterName=extractZone(winterOffset);var summerName=extractZone(summerOffset);if(summerOffset<winterOffset){stringToUTF8(winterName,std_name,17);stringToUTF8(summerName,dst_name,17)}else{stringToUTF8(winterName,dst_name,17);stringToUTF8(summerName,std_name,17)}};var _emscripten_date_now=()=>Date.now();var nowIsMonotonic=1;var checkWasiClock=clock_id=>clock_id>=0&&clock_id<=3;function _clock_time_get(clk_id,ignored_precision,ptime){ignored_precision=bigintToI53Checked(ignored_precision);if(!checkWasiClock(clk_id)){return 28}var now;if(clk_id===0){now=_emscripten_date_now()}else if(nowIsMonotonic){now=_emscripten_get_now()}else{return 52}var nsec=Math.round(now*1e3*1e3);HEAP64[ptime>>3]=BigInt(nsec);return 0}var runtimeKeepalivePush=()=>{runtimeKeepaliveCounter+=1};var _emscripten_set_main_loop_timing=(mode,value)=>{MainLoop.timingMode=mode;MainLoop.timingValue=value;if(!MainLoop.func){return 1}if(!MainLoop.running){runtimeKeepalivePush();MainLoop.running=true}if(mode==0){MainLoop.scheduler=function MainLoop_scheduler_setTimeout(){var timeUntilNextTick=Math.max(0,MainLoop.tickStartTime+value-_emscripten_get_now())|0;setTimeout(MainLoop.runner,timeUntilNextTick)};MainLoop.method="timeout"}else if(mode==1){MainLoop.scheduler=function MainLoop_scheduler_rAF(){MainLoop.requestAnimationFrame(MainLoop.runner)};MainLoop.method="rAF"}else if(mode==2){if(!MainLoop.setImmediate){if(globalThis.setImmediate){MainLoop.setImmediate=setImmediate}else{var setImmediates=[];var emscriptenMainLoopMessageId="setimmediate";var MainLoop_setImmediate_messageHandler=event=>{if(event.data===emscriptenMainLoopMessageId||event.data.target===emscriptenMainLoopMessageId){event.stopPropagation();setImmediates.shift()()}};addEventListener("message",MainLoop_setImmediate_messageHandler,true);MainLoop.setImmediate=func=>{setImmediates.push(func);if(ENVIRONMENT_IS_WORKER){Module["setImmediates"]??=[];Module["setImmediates"].push(func);postMessage({target:emscriptenMainLoopMessageId})}else postMessage(emscriptenMainLoopMessageId,"*")}}}MainLoop.scheduler=function MainLoop_scheduler_setImmediate(){MainLoop.setImmediate(MainLoop.runner)};MainLoop.method="immediate"}return 0};var runtimeKeepalivePop=()=>{runtimeKeepaliveCounter-=1};var setMainLoop=(iterFunc,fps,simulateInfiniteLoop,arg,noSetTiming)=>{MainLoop.func=iterFunc;MainLoop.arg=arg;var thisMainLoopId=MainLoop.currentlyRunningMainloop;function checkIsRunning(){if(thisMainLoopId<MainLoop.currentlyRunningMainloop){runtimeKeepalivePop();maybeExit();return false}return true}MainLoop.running=false;MainLoop.runner=function MainLoop_runner(){if(ABORT)return;if(MainLoop.queue.length>0){var start=Date.now();var blocker=MainLoop.queue.shift();blocker.func(blocker.arg);if(MainLoop.remainingBlockers){var remaining=MainLoop.remainingBlockers;var next=remaining%1==0?remaining-1:Math.floor(remaining);if(blocker.counted){MainLoop.remainingBlockers=next}else{next=next+.5;MainLoop.remainingBlockers=(8*remaining+next)/9}}MainLoop.updateStatus();if(!checkIsRunning())return;setTimeout(MainLoop.runner,0);return}if(!checkIsRunning())return;MainLoop.currentFrameNumber=MainLoop.currentFrameNumber+1|0;if(MainLoop.timingMode==1&&MainLoop.timingValue>1&&MainLoop.currentFrameNumber%MainLoop.timingValue!=0){MainLoop.scheduler();return}else if(MainLoop.timingMode==0){MainLoop.tickStartTime=_emscripten_get_now()}MainLoop.runIter(iterFunc);if(!checkIsRunning())return;MainLoop.scheduler()};if(!noSetTiming){if(fps>0){_emscripten_set_main_loop_timing(0,1e3/fps)}else{_emscripten_set_main_loop_timing(1,1)}MainLoop.scheduler()}if(simulateInfiniteLoop){throw"unwind"}};var MainLoop={running:false,scheduler:null,method:"",currentlyRunningMainloop:0,func:null,arg:0,timingMode:0,timingValue:0,currentFrameNumber:0,queue:[],preMainLoop:[],postMainLoop:[],pause(){MainLoop.scheduler=null;MainLoop.currentlyRunningMainloop++},resume(){MainLoop.currentlyRunningMainloop++;var timingMode=MainLoop.timingMode;var timingValue=MainLoop.timingValue;var func=MainLoop.func;MainLoop.func=null;setMainLoop(func,0,false,MainLoop.arg,true);_emscripten_set_main_loop_timing(timingMode,timingValue);MainLoop.scheduler()},updateStatus(){if(Module["setStatus"]){var message=Module["statusMessage"]||"Please wait...";var remaining=MainLoop.remainingBlockers??0;var expected=MainLoop.expectedBlockers??0;if(remaining){if(remaining<expected){Module["setStatus"](`{message} ({expected - remaining}/{expected})`)}else{Module["setStatus"](message)}}else{Module["setStatus"]("")}}},init(){Module["preMainLoop"]&&MainLoop.preMainLoop.push(Module["preMainLoop"]);Module["postMainLoop"]&&MainLoop.postMainLoop.push(Module["postMainLoop"])},runIter(func){if(ABORT)return;for(var pre of MainLoop.preMainLoop){if(pre()===false){return}}callUserCallback(func);for(var post of MainLoop.postMainLoop){post()}},nextRAF:0,fakeRequestAnimationFrame(func){var now=Date.now();if(MainLoop.nextRAF===0){MainLoop.nextRAF=now+1e3/60}else{while(now+2>=MainLoop.nextRAF){MainLoop.nextRAF+=1e3/60}}var delay=Math.max(MainLoop.nextRAF-now,0);setTimeout(func,delay)},requestAnimationFrame(func){if(globalThis.requestAnimationFrame){requestAnimationFrame(func)}else{MainLoop.fakeRequestAnimationFrame(func)}}};var _emscripten_cancel_main_loop=()=>{MainLoop.pause();MainLoop.func=null};var _emscripten_force_exit=status=>{__emscripten_runtime_keepalive_clear();_exit(status)};var getHeapMax=()=>2147483648;var _emscripten_get_heap_max=()=>getHeapMax();var growMemory=size=>{var oldHeapSize=wasmMemory.buffer.byteLength;var pages=(size-oldHeapSize+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false};var maybeCStringToJsString=cString=>cString>2?UTF8ToString(cString):cString;var specialHTMLTargets=[0,typeof document!="undefined"?document:0,typeof window!="undefined"?window:0];var findEventTarget=target=>{target=maybeCStringToJsString(target);var domElement=specialHTMLTargets[target]||(typeof document!="undefined"?document.querySelector(target):null);return domElement};var findCanvasEventTarget=findEventTarget;var _emscripten_set_canvas_element_size=(target,width,height)=>{var canvas=findCanvasEventTarget(target);if(!canvas)return-4;canvas.width=width;canvas.height=height;if(canvas.GLctxObject)GL.resizeOffscreenFramebuffer(canvas.GLctxObject);return 0};var _emscripten_set_main_loop=(func,fps,simulateInfiniteLoop)=>{var iterFunc=getWasmTableEntry(func);setMainLoop(iterFunc,fps,simulateInfiniteLoop)};var GLctx;var webgl_enable_ANGLE_instanced_arrays=ctx=>{var ext=ctx.getExtension("ANGLE_instanced_arrays");if(ext){ctx["vertexAttribDivisor"]=(index,divisor)=>ext["vertexAttribDivisorANGLE"](index,divisor);ctx["drawArraysInstanced"]=(mode,first,count,primcount)=>ext["drawArraysInstancedANGLE"](mode,first,count,primcount);ctx["drawElementsInstanced"]=(mode,count,type,indices,primcount)=>ext["drawElementsInstancedANGLE"](mode,count,type,indices,primcount);return 1}};var webgl_enable_OES_vertex_array_object=ctx=>{var ext=ctx.getExtension("OES_vertex_array_object");if(ext){ctx["createVertexArray"]=()=>ext["createVertexArrayOES"]();ctx["deleteVertexArray"]=vao=>ext["deleteVertexArrayOES"](vao);ctx["bindVertexArray"]=vao=>ext["bindVertexArrayOES"](vao);ctx["isVertexArray"]=vao=>ext["isVertexArrayOES"](vao);return 1}};var webgl_enable_WEBGL_draw_buffers=ctx=>{var ext=ctx.getExtension("WEBGL_draw_buffers");if(ext){ctx["drawBuffers"]=(n,bufs)=>ext["drawBuffersWEBGL"](n,bufs);return 1}};var webgl_enable_WEBGL_draw_instanced_base_vertex_base_instance=ctx=>!!(ctx.dibvbi=ctx.getExtension("WEBGL_draw_instanced_base_vertex_base_instance"));var webgl_enable_WEBGL_multi_draw_instanced_base_vertex_base_instance=ctx=>!!(ctx.mdibvbi=ctx.getExtension("WEBGL_multi_draw_instanced_base_vertex_base_instance"));var webgl_enable_EXT_polygon_offset_clamp=ctx=>!!(ctx.extPolygonOffsetClamp=ctx.getExtension("EXT_polygon_offset_clamp"));var webgl_enable_EXT_clip_control=ctx=>!!(ctx.extClipControl=ctx.getExtension("EXT_clip_control"));var webgl_enable_WEBGL_polygon_mode=ctx=>!!(ctx.webglPolygonMode=ctx.getExtension("WEBGL_polygon_mode"));var webgl_enable_WEBGL_multi_draw=ctx=>!!(ctx.multiDrawWebgl=ctx.getExtension("WEBGL_multi_draw"));var getEmscriptenSupportedExtensions=ctx=>{var supportedExtensions=["ANGLE_instanced_arrays","EXT_blend_minmax","EXT_disjoint_timer_query","EXT_frag_depth","EXT_shader_texture_lod","EXT_sRGB","OES_element_index_uint","OES_fbo_render_mipmap","OES_standard_derivatives","OES_texture_float","OES_texture_half_float","OES_texture_half_float_linear","OES_vertex_array_object","WEBGL_color_buffer_float","WEBGL_depth_texture","WEBGL_draw_buffers","EXT_color_buffer_float","EXT_conservative_depth","EXT_disjoint_timer_query_webgl2","EXT_texture_norm16","NV_shader_noperspective_interpolation","WEBGL_clip_cull_distance","EXT_clip_control","EXT_color_buffer_half_float","EXT_depth_clamp","EXT_float_blend","EXT_polygon_offset_clamp","EXT_texture_compression_bptc","EXT_texture_compression_rgtc","EXT_texture_filter_anisotropic","KHR_parallel_shader_compile","OES_texture_float_linear","WEBGL_blend_func_extended","WEBGL_compressed_texture_astc","WEBGL_compressed_texture_etc","WEBGL_compressed_texture_etc1","WEBGL_compressed_texture_s3tc","WEBGL_compressed_texture_s3tc_srgb","WEBGL_debug_renderer_info","WEBGL_debug_shaders","WEBGL_lose_context","WEBGL_multi_draw","WEBGL_polygon_mode"];return(ctx.getSupportedExtensions()||[]).filter(ext=>supportedExtensions.includes(ext))};var GL={counter:1,buffers:[],programs:[],framebuffers:[],renderbuffers:[],textures:[],shaders:[],vaos:[],contexts:[],offscreenCanvases:{},queries:[],samplers:[],transformFeedbacks:[],syncs:[],stringCache:{},stringiCache:{},unpackAlignment:4,unpackRowLength:0,recordError:errorCode=>{if(!GL.lastError){GL.lastError=errorCode}},getNewId:table=>{var ret=GL.counter++;for(var i=table.length;i<ret;i++){table[i]=null}return ret},genObject:(n,buffers,createFunction,objectTable)=>{for(var i=0;i<n;i++){var buffer=GLctx[createFunction]();var id=buffer&&GL.getNewId(objectTable);if(buffer){buffer.name=id;objectTable[id]=buffer}else{GL.recordError(1282)}HEAP32[buffers+i*4>>2]=id}},getSource:(shader,count,string,length)=>{var source="";for(var i=0;i<count;++i){var len=length?HEAPU32[length+i*4>>2]:undefined;source+=UTF8ToString(HEAPU32[string+i*4>>2],len)}return source},createContext:(canvas,webGLContextAttributes)=>{if(webGLContextAttributes.renderViaOffscreenBackBuffer)webGLContextAttributes["preserveDrawingBuffer"]=true;var ctx=webGLContextAttributes.majorVersion>1?canvas.getContext("webgl2",webGLContextAttributes):canvas.getContext("webgl",webGLContextAttributes);if(!ctx)return 0;var handle=GL.registerContext(ctx,webGLContextAttributes);return handle},enableOffscreenFramebufferAttributes:webGLContextAttributes=>{webGLContextAttributes.renderViaOffscreenBackBuffer=true;webGLContextAttributes.preserveDrawingBuffer=true},createOffscreenFramebuffer:context=>{var gl=context.GLctx;var fbo=gl.createFramebuffer();gl.bindFramebuffer(36160,fbo);context.defaultFbo=fbo;context.defaultFboForbidBlitFramebuffer=false;if(gl.getContextAttributes().antialias){context.defaultFboForbidBlitFramebuffer=true}context.defaultColorTarget=gl.createTexture();context.defaultDepthTarget=gl.createRenderbuffer();GL.resizeOffscreenFramebuffer(context);gl.bindTexture(3553,context.defaultColorTarget);gl.texParameteri(3553,10241,9728);gl.texParameteri(3553,10240,9728);gl.texParameteri(3553,10242,33071);gl.texParameteri(3553,10243,33071);gl.texImage2D(3553,0,6408,gl.canvas.width,gl.canvas.height,0,6408,5121,null);gl.framebufferTexture2D(36160,36064,3553,context.defaultColorTarget,0);gl.bindTexture(3553,null);var depthTarget=gl.createRenderbuffer();gl.bindRenderbuffer(36161,context.defaultDepthTarget);gl.renderbufferStorage(36161,33189,gl.canvas.width,gl.canvas.height);gl.framebufferRenderbuffer(36160,36096,36161,context.defaultDepthTarget);gl.bindRenderbuffer(36161,null);var vertices=[-1,-1,-1,1,1,-1,1,1];var vb=gl.createBuffer();gl.bindBuffer(34962,vb);gl.bufferData(34962,new Float32Array(vertices),35044);gl.bindBuffer(34962,null);context.blitVB=vb;var vsCode="attribute vec2 pos;"+"varying lowp vec2 tex;"+"void main() { tex = pos * 0.5 + vec2(0.5,0.5); gl_Position = vec4(pos, 0.0, 1.0); }";var vs=gl.createShader(35633);gl.shaderSource(vs,vsCode);gl.compileShader(vs);var fsCode="varying lowp vec2 tex;"+"uniform sampler2D sampler;"+"void main() { gl_FragColor = texture2D(sampler, tex); }";var fs=gl.createShader(35632);gl.shaderSource(fs,fsCode);gl.compileShader(fs);var blitProgram=gl.createProgram();gl.attachShader(blitProgram,vs);gl.attachShader(blitProgram,fs);gl.linkProgram(blitProgram);context.blitProgram=blitProgram;context.blitPosLoc=gl.getAttribLocation(blitProgram,"pos");gl.useProgram(blitProgram);gl.uniform1i(gl.getUniformLocation(blitProgram,"sampler"),0);gl.useProgram(null);if(gl.createVertexArray){context.defaultVao=gl.createVertexArray();gl.bindVertexArray(context.defaultVao);gl.enableVertexAttribArray(context.blitPosLoc);gl.bindVertexArray(null)}},resizeOffscreenFramebuffer:context=>{var gl=context.GLctx;if(context.defaultColorTarget){var prevTextureBinding=gl.getParameter(32873);gl.bindTexture(3553,context.defaultColorTarget);gl.texImage2D(3553,0,6408,gl.drawingBufferWidth,gl.drawingBufferHeight,0,6408,5121,null);gl.bindTexture(3553,prevTextureBinding)}if(context.defaultDepthTarget){var prevRenderBufferBinding=gl.getParameter(36007);gl.bindRenderbuffer(36161,context.defaultDepthTarget);gl.renderbufferStorage(36161,33189,gl.drawingBufferWidth,gl.drawingBufferHeight);gl.bindRenderbuffer(36161,prevRenderBufferBinding)}},blitOffscreenFramebuffer:context=>{var gl=context.GLctx;var prevScissorTest=gl.getParameter(3089);if(prevScissorTest)gl.disable(3089);var prevFbo=gl.getParameter(36006);if(gl.blitFramebuffer&&!context.defaultFboForbidBlitFramebuffer){gl.bindFramebuffer(36008,context.defaultFbo);gl.bindFramebuffer(36009,null);gl.blitFramebuffer(0,0,gl.canvas.width,gl.canvas.height,0,0,gl.canvas.width,gl.canvas.height,16384,9728)}else{gl.bindFramebuffer(36160,null);var prevProgram=gl.getParameter(35725);gl.useProgram(context.blitProgram);if(!gl.isProgram(prevProgram))prevProgram=null;var prevVB=gl.getParameter(34964);gl.bindBuffer(34962,context.blitVB);var prevActiveTexture=gl.getParameter(34016);gl.activeTexture(33984);var prevTextureBinding=gl.getParameter(32873);gl.bindTexture(3553,context.defaultColorTarget);var prevBlend=gl.getParameter(3042);if(prevBlend)gl.disable(3042);var prevCullFace=gl.getParameter(2884);if(prevCullFace)gl.disable(2884);var prevDepthTest=gl.getParameter(2929);if(prevDepthTest)gl.disable(2929);var prevStencilTest=gl.getParameter(2960);if(prevStencilTest)gl.disable(2960);function draw(){gl.vertexAttribPointer(context.blitPosLoc,2,5126,false,0,0);gl.drawArrays(5,0,4)}if(context.defaultVao){var prevVAO=gl.getParameter(34229);gl.bindVertexArray(context.defaultVao);draw();gl.bindVertexArray(prevVAO)}else{var prevVertexAttribPointer={buffer:gl.getVertexAttrib(context.blitPosLoc,34975),size:gl.getVertexAttrib(context.blitPosLoc,34339),stride:gl.getVertexAttrib(context.blitPosLoc,34340),type:gl.getVertexAttrib(context.blitPosLoc,34341),normalized:gl.getVertexAttrib(context.blitPosLoc,34922),pointer:gl.getVertexAttribOffset(context.blitPosLoc,34373)};var maxVertexAttribs=gl.getParameter(34921);var prevVertexAttribEnables=[];for(var i=0;i<maxVertexAttribs;++i){var prevEnabled=gl.getVertexAttrib(i,34338);var wantEnabled=i==context.blitPosLoc;if(prevEnabled&&!wantEnabled){gl.disableVertexAttribArray(i)}if(!prevEnabled&&wantEnabled){gl.enableVertexAttribArray(i)}prevVertexAttribEnables[i]=prevEnabled}draw();for(var i=0;i<maxVertexAttribs;++i){var prevEnabled=prevVertexAttribEnables[i];var nowEnabled=i==context.blitPosLoc;if(prevEnabled&&!nowEnabled){gl.enableVertexAttribArray(i)}if(!prevEnabled&&nowEnabled){gl.disableVertexAttribArray(i)}}gl.bindBuffer(34962,prevVertexAttribPointer.buffer);gl.vertexAttribPointer(context.blitPosLoc,prevVertexAttribPointer.size,prevVertexAttribPointer.type,prevVertexAttribPointer.normalized,prevVertexAttribPointer.stride,prevVertexAttribPointer.offset)}if(prevStencilTest)gl.enable(2960);if(prevDepthTest)gl.enable(2929);if(prevCullFace)gl.enable(2884);if(prevBlend)gl.enable(3042);gl.bindTexture(3553,prevTextureBinding);gl.activeTexture(prevActiveTexture);gl.bindBuffer(34962,prevVB);gl.useProgram(prevProgram)}gl.bindFramebuffer(36160,prevFbo);if(prevScissorTest)gl.enable(3089)},registerContext:(ctx,webGLContextAttributes)=>{var handle=GL.getNewId(GL.contexts);var context={handle,attributes:webGLContextAttributes,version:webGLContextAttributes.majorVersion,GLctx:ctx};if(ctx.canvas)ctx.canvas.GLctxObject=context;GL.contexts[handle]=context;if(typeof webGLContextAttributes.enableExtensionsByDefault=="undefined"||webGLContextAttributes.enableExtensionsByDefault){GL.initExtensions(context)}if(webGLContextAttributes.renderViaOffscreenBackBuffer)GL.createOffscreenFramebuffer(context);return handle},makeContextCurrent:contextHandle=>{GL.currentContext=GL.contexts[contextHandle];Module["ctx"]=GLctx=GL.currentContext?.GLctx;return!(contextHandle&&!GLctx)},getContext:contextHandle=>GL.contexts[contextHandle],deleteContext:contextHandle=>{if(GL.currentContext===GL.contexts[contextHandle]){GL.currentContext=null}if(typeof JSEvents=="object"){JSEvents.removeAllHandlersOnTarget(GL.contexts[contextHandle].GLctx.canvas)}if(GL.contexts[contextHandle]?.GLctx.canvas){GL.contexts[contextHandle].GLctx.canvas.GLctxObject=undefined}GL.contexts[contextHandle]=null},initExtensions:context=>{context||=GL.currentContext;if(context.initExtensionsDone)return;context.initExtensionsDone=true;var GLctx=context.GLctx;webgl_enable_WEBGL_multi_draw(GLctx);webgl_enable_EXT_polygon_offset_clamp(GLctx);webgl_enable_EXT_clip_control(GLctx);webgl_enable_WEBGL_polygon_mode(GLctx);webgl_enable_ANGLE_instanced_arrays(GLctx);webgl_enable_OES_vertex_array_object(GLctx);webgl_enable_WEBGL_draw_buffers(GLctx);webgl_enable_WEBGL_draw_instanced_base_vertex_base_instance(GLctx);webgl_enable_WEBGL_multi_draw_instanced_base_vertex_base_instance(GLctx);if(context.version>=2){GLctx.disjointTimerQueryExt=GLctx.getExtension("EXT_disjoint_timer_query_webgl2")}if(context.version<2||!GLctx.disjointTimerQueryExt){GLctx.disjointTimerQueryExt=GLctx.getExtension("EXT_disjoint_timer_query")}for(var ext of getEmscriptenSupportedExtensions(GLctx)){if(!ext.includes("lose_context")&&!ext.includes("debug")){GLctx.getExtension(ext)}}}};var _emscripten_webgl_do_commit_frame=()=>{if(!GL.currentContext||!GL.currentContext.GLctx){return-3}if(GL.currentContext.defaultFbo){GL.blitOffscreenFramebuffer(GL.currentContext);return 0}if(!GL.currentContext.attributes.explicitSwapControl){return-3}return 0};var _emscripten_webgl_commit_frame=_emscripten_webgl_do_commit_frame;var webglPowerPreferences=["default","low-power","high-performance"];var _emscripten_webgl_do_create_context=(target,attributes)=>{var attr32=attributes>>2;var powerPreference=HEAP32[attr32+(8>>2)];var contextAttributes={alpha:!!HEAP8[attributes+0],depth:!!HEAP8[attributes+1],stencil:!!HEAP8[attributes+2],antialias:!!HEAP8[attributes+3],premultipliedAlpha:!!HEAP8[attributes+4],preserveDrawingBuffer:!!HEAP8[attributes+5],powerPreference:webglPowerPreferences[powerPreference],failIfMajorPerformanceCaveat:!!HEAP8[attributes+12],majorVersion:HEAP32[attr32+(16>>2)],minorVersion:HEAP32[attr32+(20>>2)],enableExtensionsByDefault:HEAP8[attributes+24],explicitSwapControl:HEAP8[attributes+25],proxyContextToMainThread:HEAP32[attr32+(28>>2)],renderViaOffscreenBackBuffer:HEAP8[attributes+32]};var canvas=findCanvasEventTarget(target);if(!canvas){return 0}if(contextAttributes.explicitSwapControl&&!contextAttributes.renderViaOffscreenBackBuffer){contextAttributes.renderViaOffscreenBackBuffer=true}var contextHandle=GL.createContext(canvas,contextAttributes);return contextHandle};var _emscripten_webgl_create_context=_emscripten_webgl_do_create_context;var _emscripten_webgl_destroy_context=contextHandle=>{if(GL.currentContext==contextHandle)GL.currentContext=0;GL.deleteContext(contextHandle)};var _emscripten_webgl_enable_extension=(contextHandle,extension)=>{var context=GL.getContext(contextHandle);var extString=UTF8ToString(extension);if(extString.startsWith("GL_"))extString=extString.slice(3);if(extString=="ANGLE_instanced_arrays")webgl_enable_ANGLE_instanced_arrays(GLctx);if(extString=="OES_vertex_array_object")webgl_enable_OES_vertex_array_object(GLctx);if(extString=="WEBGL_draw_buffers")webgl_enable_WEBGL_draw_buffers(GLctx);if(extString=="WEBGL_draw_instanced_base_vertex_base_instance")webgl_enable_WEBGL_draw_instanced_base_vertex_base_instance(GLctx);if(extString=="WEBGL_multi_draw_instanced_base_vertex_base_instance")webgl_enable_WEBGL_multi_draw_instanced_base_vertex_base_instance(GLctx);if(extString=="WEBGL_multi_draw")webgl_enable_WEBGL_multi_draw(GLctx);if(extString=="EXT_polygon_offset_clamp")webgl_enable_EXT_polygon_offset_clamp(GLctx);if(extString=="EXT_clip_control")webgl_enable_EXT_clip_control(GLctx);if(extString=="WEBGL_polygon_mode")webgl_enable_WEBGL_polygon_mode(GLctx);var ext=context.GLctx.getExtension(extString);return!!ext};var stringToNewUTF8=str=>{var size=lengthBytesUTF8(str)+1;var ret=_malloc(size);if(ret)stringToUTF8(str,ret,size);return ret};var _emscripten_webgl_get_supported_extensions=()=>stringToNewUTF8(GLctx.getSupportedExtensions().join(" "));var _emscripten_webgl_make_context_current=contextHandle=>{var success=GL.makeContextCurrent(contextHandle);return success?0:-5};var ENV={};var getExecutableName=()=>thisProgram||"./this.program";var getEnvStrings=()=>{if(!getEnvStrings.strings){var lang=(typeof navigator=="object"&&navigator.language||"C").replace("-","_")+".UTF-8";var env={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:lang,_:getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(`${x}=${env[x]}`)}getEnvStrings.strings=strings}return getEnvStrings.strings};var _environ_get=(__environ,environ_buf)=>{var bufSize=0;var envp=0;for(var string of getEnvStrings()){var ptr=environ_buf+bufSize;HEAPU32[__environ+envp>>2]=ptr;bufSize+=stringToUTF8(string,ptr,Infinity)+1;envp+=4}return 0};var _environ_sizes_get=(penviron_count,penviron_buf_size)=>{var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;for(var string of strings){bufSize+=lengthBytesUTF8(string)+1}HEAPU32[penviron_buf_size>>2]=bufSize;return 0};function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}function _fd_fdstat_get(fd,pbuf){try{var rightsBase=0;var rightsInheriting=0;var flags=0;{var stream=SYSCALLS.getStreamFromFD(fd);var type=stream.tty?2:FS.isDir(stream.mode)?3:FS.isLink(stream.mode)?7:4}HEAP8[pbuf]=type;HEAP16[pbuf+2>>1]=flags;HEAP64[pbuf+8>>3]=BigInt(rightsBase);HEAP64[pbuf+16>>3]=BigInt(rightsInheriting);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var doReadv=(stream,iov,iovcnt,offset)=>{var ret=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.read(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr<len)break;if(typeof offset!="undefined"){offset+=curr}}return ret};function _fd_read(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doReadv(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}function _fd_seek(fd,offset,whence,newOffset){offset=bigintToI53Checked(offset);try{if(isNaN(offset))return 61;var stream=SYSCALLS.getStreamFromFD(fd);FS.llseek(stream,offset,whence);HEAP64[newOffset>>3]=BigInt(stream.position);if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var doWritev=(stream,iov,iovcnt,offset)=>{var ret=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.write(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr<len){break}if(typeof offset!="undefined"){offset+=curr}}return ret};function _fd_write(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doWritev(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var _emscripten_glActiveTexture=x0=>GLctx.activeTexture(x0);var _glActiveTexture=_emscripten_glActiveTexture;var _emscripten_glAttachShader=(program,shader)=>{GLctx.attachShader(GL.programs[program],GL.shaders[shader])};var _glAttachShader=_emscripten_glAttachShader;var _emscripten_glBeginTransformFeedback=x0=>GLctx.beginTransformFeedback(x0);var _glBeginTransformFeedback=_emscripten_glBeginTransformFeedback;var _emscripten_glBindBuffer=(target,buffer)=>{if(target==35051){GLctx.currentPixelPackBufferBinding=buffer}else if(target==35052){GLctx.currentPixelUnpackBufferBinding=buffer}GLctx.bindBuffer(target,GL.buffers[buffer])};var _glBindBuffer=_emscripten_glBindBuffer;var _emscripten_glBindBufferBase=(target,index,buffer)=>{GLctx.bindBufferBase(target,index,GL.buffers[buffer])};var _glBindBufferBase=_emscripten_glBindBufferBase;var _emscripten_glBindBufferRange=(target,index,buffer,offset,ptrsize)=>{GLctx.bindBufferRange(target,index,GL.buffers[buffer],offset,ptrsize)};var _glBindBufferRange=_emscripten_glBindBufferRange;var _emscripten_glBindFramebuffer=(target,framebuffer)=>{GLctx.bindFramebuffer(target,framebuffer?GL.framebuffers[framebuffer]:GL.currentContext.defaultFbo)};var _glBindFramebuffer=_emscripten_glBindFramebuffer;var _emscripten_glBindRenderbuffer=(target,renderbuffer)=>{GLctx.bindRenderbuffer(target,GL.renderbuffers[renderbuffer])};var _glBindRenderbuffer=_emscripten_glBindRenderbuffer;var _emscripten_glBindTexture=(target,texture)=>{GLctx.bindTexture(target,GL.textures[texture])};var _glBindTexture=_emscripten_glBindTexture;var _emscripten_glBindVertexArray=vao=>{GLctx.bindVertexArray(GL.vaos[vao])};var _glBindVertexArray=_emscripten_glBindVertexArray;var _emscripten_glBlendColor=(x0,x1,x2,x3)=>GLctx.blendColor(x0,x1,x2,x3);var _glBlendColor=_emscripten_glBlendColor;var _emscripten_glBlendEquation=x0=>GLctx.blendEquation(x0);var _glBlendEquation=_emscripten_glBlendEquation;var _emscripten_glBlendFunc=(x0,x1)=>GLctx.blendFunc(x0,x1);var _glBlendFunc=_emscripten_glBlendFunc;var _emscripten_glBlendFuncSeparate=(x0,x1,x2,x3)=>GLctx.blendFuncSeparate(x0,x1,x2,x3);var _glBlendFuncSeparate=_emscripten_glBlendFuncSeparate;var _emscripten_glBlitFramebuffer=(x0,x1,x2,x3,x4,x5,x6,x7,x8,x9)=>GLctx.blitFramebuffer(x0,x1,x2,x3,x4,x5,x6,x7,x8,x9);var _glBlitFramebuffer=_emscripten_glBlitFramebuffer;var _emscripten_glBufferData=(target,size,data,usage)=>{if(GL.currentContext.version>=2){if(data&&size){GLctx.bufferData(target,HEAPU8,usage,data,size)}else{GLctx.bufferData(target,size,usage)}return}GLctx.bufferData(target,data?HEAPU8.subarray(data,data+size):size,usage)};var _glBufferData=_emscripten_glBufferData;var _emscripten_glBufferSubData=(target,offset,size,data)=>{if(GL.currentContext.version>=2){size&&GLctx.bufferSubData(target,offset,HEAPU8,data,size);return}GLctx.bufferSubData(target,offset,HEAPU8.subarray(data,data+size))};var _glBufferSubData=_emscripten_glBufferSubData;var _emscripten_glCheckFramebufferStatus=x0=>GLctx.checkFramebufferStatus(x0);var _glCheckFramebufferStatus=_emscripten_glCheckFramebufferStatus;var _emscripten_glClear=x0=>GLctx.clear(x0);var _glClear=_emscripten_glClear;var _emscripten_glClearBufferfv=(buffer,drawbuffer,value)=>{GLctx.clearBufferfv(buffer,drawbuffer,HEAPF32,value>>2)};var _glClearBufferfv=_emscripten_glClearBufferfv;var _emscripten_glClearColor=(x0,x1,x2,x3)=>GLctx.clearColor(x0,x1,x2,x3);var _glClearColor=_emscripten_glClearColor;var _emscripten_glClearDepthf=x0=>GLctx.clearDepth(x0);var _glClearDepthf=_emscripten_glClearDepthf;var _emscripten_glClearStencil=x0=>GLctx.clearStencil(x0);var _glClearStencil=_emscripten_glClearStencil;var _emscripten_glColorMask=(red,green,blue,alpha)=>{GLctx.colorMask(!!red,!!green,!!blue,!!alpha)};var _glColorMask=_emscripten_glColorMask;var _emscripten_glCompileShader=shader=>{GLctx.compileShader(GL.shaders[shader])};var _glCompileShader=_emscripten_glCompileShader;var _emscripten_glCompressedTexImage2D=(target,level,internalFormat,width,height,border,imageSize,data)=>{if(GL.currentContext.version>=2){if(GLctx.currentPixelUnpackBufferBinding||!imageSize){GLctx.compressedTexImage2D(target,level,internalFormat,width,height,border,imageSize,data);return}GLctx.compressedTexImage2D(target,level,internalFormat,width,height,border,HEAPU8,data,imageSize);return}GLctx.compressedTexImage2D(target,level,internalFormat,width,height,border,HEAPU8.subarray(data,data+imageSize))};var _glCompressedTexImage2D=_emscripten_glCompressedTexImage2D;var _emscripten_glCompressedTexImage3D=(target,level,internalFormat,width,height,depth,border,imageSize,data)=>{if(GLctx.currentPixelUnpackBufferBinding){GLctx.compressedTexImage3D(target,level,internalFormat,width,height,depth,border,imageSize,data)}else{GLctx.compressedTexImage3D(target,level,internalFormat,width,height,depth,border,HEAPU8,data,imageSize)}};var _glCompressedTexImage3D=_emscripten_glCompressedTexImage3D;var _emscripten_glCompressedTexSubImage3D=(target,level,xoffset,yoffset,zoffset,width,height,depth,format,imageSize,data)=>{if(GLctx.currentPixelUnpackBufferBinding){GLctx.compressedTexSubImage3D(target,level,xoffset,yoffset,zoffset,width,height,depth,format,imageSize,data)}else{GLctx.compressedTexSubImage3D(target,level,xoffset,yoffset,zoffset,width,height,depth,format,HEAPU8,data,imageSize)}};var _glCompressedTexSubImage3D=_emscripten_glCompressedTexSubImage3D;var _emscripten_glCopyBufferSubData=(x0,x1,x2,x3,x4)=>GLctx.copyBufferSubData(x0,x1,x2,x3,x4);var _glCopyBufferSubData=_emscripten_glCopyBufferSubData;var _emscripten_glCreateProgram=()=>{var id=GL.getNewId(GL.programs);var program=GLctx.createProgram();program.name=id;program.maxUniformLength=program.maxAttributeLength=program.maxUniformBlockNameLength=0;program.uniformIdCounter=1;GL.programs[id]=program;return id};var _glCreateProgram=_emscripten_glCreateProgram;var _emscripten_glCreateShader=shaderType=>{var id=GL.getNewId(GL.shaders);GL.shaders[id]=GLctx.createShader(shaderType);return id};var _glCreateShader=_emscripten_glCreateShader;var _emscripten_glCullFace=x0=>GLctx.cullFace(x0);var _glCullFace=_emscripten_glCullFace;var _emscripten_glDeleteBuffers=(n,buffers)=>{for(var i=0;i<n;i++){var id=HEAP32[buffers+i*4>>2];var buffer=GL.buffers[id];if(!buffer)continue;GLctx.deleteBuffer(buffer);buffer.name=0;GL.buffers[id]=null;if(id==GLctx.currentPixelPackBufferBinding)GLctx.currentPixelPackBufferBinding=0;if(id==GLctx.currentPixelUnpackBufferBinding)GLctx.currentPixelUnpackBufferBinding=0}};var _glDeleteBuffers=_emscripten_glDeleteBuffers;var _emscripten_glDeleteFramebuffers=(n,framebuffers)=>{for(var i=0;i<n;++i){var id=HEAP32[framebuffers+i*4>>2];var framebuffer=GL.framebuffers[id];if(!framebuffer)continue;GLctx.deleteFramebuffer(framebuffer);framebuffer.name=0;GL.framebuffers[id]=null}};var _glDeleteFramebuffers=_emscripten_glDeleteFramebuffers;var _emscripten_glDeleteProgram=id=>{if(!id)return;var program=GL.programs[id];if(!program){GL.recordError(1281);return}GLctx.deleteProgram(program);program.name=0;GL.programs[id]=null};var _glDeleteProgram=_emscripten_glDeleteProgram;var _emscripten_glDeleteQueries=(n,ids)=>{for(var i=0;i<n;i++){var id=HEAP32[ids+i*4>>2];var query=GL.queries[id];if(!query)continue;GLctx.deleteQuery(query);GL.queries[id]=null}};var _glDeleteQueries=_emscripten_glDeleteQueries;var _emscripten_glDeleteRenderbuffers=(n,renderbuffers)=>{for(var i=0;i<n;i++){var id=HEAP32[renderbuffers+i*4>>2];var renderbuffer=GL.renderbuffers[id];if(!renderbuffer)continue;GLctx.deleteRenderbuffer(renderbuffer);renderbuffer.name=0;GL.renderbuffers[id]=null}};var _glDeleteRenderbuffers=_emscripten_glDeleteRenderbuffers;var _emscripten_glDeleteShader=id=>{if(!id)return;var shader=GL.shaders[id];if(!shader){GL.recordError(1281);return}GLctx.deleteShader(shader);GL.shaders[id]=null};var _glDeleteShader=_emscripten_glDeleteShader;var _emscripten_glDeleteSync=id=>{if(!id)return;var sync=GL.syncs[id];if(!sync){GL.recordError(1281);return}GLctx.deleteSync(sync);sync.name=0;GL.syncs[id]=null};var _glDeleteSync=_emscripten_glDeleteSync;var _emscripten_glDeleteTextures=(n,textures)=>{for(var i=0;i<n;i++){var id=HEAP32[textures+i*4>>2];var texture=GL.textures[id];if(!texture)continue;GLctx.deleteTexture(texture);texture.name=0;GL.textures[id]=null}};var _glDeleteTextures=_emscripten_glDeleteTextures;var _emscripten_glDeleteVertexArrays=(n,vaos)=>{for(var i=0;i<n;i++){var id=HEAP32[vaos+i*4>>2];GLctx.deleteVertexArray(GL.vaos[id]);GL.vaos[id]=null}};var _glDeleteVertexArrays=_emscripten_glDeleteVertexArrays;var _emscripten_glDepthFunc=x0=>GLctx.depthFunc(x0);var _glDepthFunc=_emscripten_glDepthFunc;var _emscripten_glDepthMask=flag=>{GLctx.depthMask(!!flag)};var _glDepthMask=_emscripten_glDepthMask;var _emscripten_glDisable=x0=>GLctx.disable(x0);var _glDisable=_emscripten_glDisable;var _emscripten_glDisableVertexAttribArray=index=>{GLctx.disableVertexAttribArray(index)};var _glDisableVertexAttribArray=_emscripten_glDisableVertexAttribArray;var _emscripten_glDrawArrays=(mode,first,count)=>{GLctx.drawArrays(mode,first,count)};var _glDrawArrays=_emscripten_glDrawArrays;var _emscripten_glDrawArraysInstanced=(mode,first,count,primcount)=>{GLctx.drawArraysInstanced(mode,first,count,primcount)};var _glDrawArraysInstanced=_emscripten_glDrawArraysInstanced;var tempFixedLengthArray=[];var _emscripten_glDrawBuffers=(n,bufs)=>{var bufArray=tempFixedLengthArray[n];for(var i=0;i<n;i++){bufArray[i]=HEAP32[bufs+i*4>>2]}GLctx.drawBuffers(bufArray)};var _glDrawBuffers=_emscripten_glDrawBuffers;var _emscripten_glDrawElements=(mode,count,type,indices)=>{GLctx.drawElements(mode,count,type,indices)};var _glDrawElements=_emscripten_glDrawElements;var _emscripten_glDrawElementsInstanced=(mode,count,type,indices,primcount)=>{GLctx.drawElementsInstanced(mode,count,type,indices,primcount)};var _glDrawElementsInstanced=_emscripten_glDrawElementsInstanced;var _emscripten_glEnable=x0=>GLctx.enable(x0);var _glEnable=_emscripten_glEnable;var _emscripten_glEnableVertexAttribArray=index=>{GLctx.enableVertexAttribArray(index)};var _glEnableVertexAttribArray=_emscripten_glEnableVertexAttribArray;var _emscripten_glEndTransformFeedback=()=>GLctx.endTransformFeedback();var _glEndTransformFeedback=_emscripten_glEndTransformFeedback;var _emscripten_glFenceSync=(condition,flags)=>{var sync=GLctx.fenceSync(condition,flags);if(sync){var id=GL.getNewId(GL.syncs);sync.name=id;GL.syncs[id]=sync;return id}return 0};var _glFenceSync=_emscripten_glFenceSync;var _emscripten_glFinish=()=>GLctx.finish();var _glFinish=_emscripten_glFinish;var _emscripten_glFramebufferRenderbuffer=(target,attachment,renderbuffertarget,renderbuffer)=>{GLctx.framebufferRenderbuffer(target,attachment,renderbuffertarget,GL.renderbuffers[renderbuffer])};var _glFramebufferRenderbuffer=_emscripten_glFramebufferRenderbuffer;var _emscripten_glFramebufferTexture2D=(target,attachment,textarget,texture,level)=>{GLctx.framebufferTexture2D(target,attachment,textarget,GL.textures[texture],level)};var _glFramebufferTexture2D=_emscripten_glFramebufferTexture2D;var _emscripten_glFramebufferTextureLayer=(target,attachment,texture,level,layer)=>{GLctx.framebufferTextureLayer(target,attachment,GL.textures[texture],level,layer)};var _glFramebufferTextureLayer=_emscripten_glFramebufferTextureLayer;var _emscripten_glFrontFace=x0=>GLctx.frontFace(x0);var _glFrontFace=_emscripten_glFrontFace;var _emscripten_glGenBuffers=(n,buffers)=>{GL.genObject(n,buffers,"createBuffer",GL.buffers)};var _glGenBuffers=_emscripten_glGenBuffers;var _emscripten_glGenFramebuffers=(n,ids)=>{GL.genObject(n,ids,"createFramebuffer",GL.framebuffers)};var _glGenFramebuffers=_emscripten_glGenFramebuffers;var _emscripten_glGenQueries=(n,ids)=>{GL.genObject(n,ids,"createQuery",GL.queries)};var _glGenQueries=_emscripten_glGenQueries;var _emscripten_glGenRenderbuffers=(n,renderbuffers)=>{GL.genObject(n,renderbuffers,"createRenderbuffer",GL.renderbuffers)};var _glGenRenderbuffers=_emscripten_glGenRenderbuffers;var _emscripten_glGenTextures=(n,textures)=>{GL.genObject(n,textures,"createTexture",GL.textures)};var _glGenTextures=_emscripten_glGenTextures;var _emscripten_glGenVertexArrays=(n,arrays)=>{GL.genObject(n,arrays,"createVertexArray",GL.vaos)};var _glGenVertexArrays=_emscripten_glGenVertexArrays;var _emscripten_glGenerateMipmap=x0=>GLctx.generateMipmap(x0);var _glGenerateMipmap=_emscripten_glGenerateMipmap;var writeI53ToI64=(ptr,num)=>{HEAPU32[ptr>>2]=num;var lower=HEAPU32[ptr>>2];HEAPU32[ptr+4>>2]=(num-lower)/4294967296};var webglGetExtensions=()=>{var exts=getEmscriptenSupportedExtensions(GLctx);exts=exts.concat(exts.map(e=>"GL_"+e));return exts};var emscriptenWebGLGet=(name_,p,type)=>{if(!p){GL.recordError(1281);return}var ret=undefined;switch(name_){case 36346:ret=1;break;case 36344:if(type!=0&&type!=1){GL.recordError(1280)}return;case 34814:case 36345:ret=0;break;case 34466:var formats=GLctx.getParameter(34467);ret=formats?formats.length:0;break;case 33309:if(GL.currentContext.version<2){GL.recordError(1282);return}ret=webglGetExtensions().length;break;case 33307:case 33308:if(GL.currentContext.version<2){GL.recordError(1280);return}ret=name_==33307?3:0;break}if(ret===undefined){var result=GLctx.getParameter(name_);switch(typeof result){case"number":ret=result;break;case"boolean":ret=result?1:0;break;case"string":GL.recordError(1280);return;case"object":if(result===null){switch(name_){case 34964:case 35725:case 34965:case 36006:case 36007:case 32873:case 34229:case 36662:case 36663:case 35053:case 35055:case 36010:case 35097:case 35869:case 32874:case 36389:case 35983:case 35368:case 34068:{ret=0;break}default:{GL.recordError(1280);return}}}else if(result instanceof Float32Array||result instanceof Uint32Array||result instanceof Int32Array||result instanceof Array){for(var i=0;i<result.length;++i){switch(type){case 0:HEAP32[p+i*4>>2]=result[i];break;case 2:HEAPF32[p+i*4>>2]=result[i];break;case 4:HEAP8[p+i]=result[i]?1:0;break}}return}else{try{ret=result.name|0}catch(e){GL.recordError(1280);err(`GL_INVALID_ENUM in glGet${type}v: Unknown object returned from WebGL getParameter(${name_})! (error: ${e})`);return}}break;default:GL.recordError(1280);err(`GL_INVALID_ENUM in glGet${type}v: Native code calling glGet${type}v(${name_}) and it returns ${result} of type ${typeof result}!`);return}}switch(type){case 1:writeI53ToI64(p,ret);break;case 0:HEAP32[p>>2]=ret;break;case 2:HEAPF32[p>>2]=ret;break;case 4:HEAP8[p]=ret?1:0;break}};var _emscripten_glGetFloatv=(name_,p)=>emscriptenWebGLGet(name_,p,2);var _glGetFloatv=_emscripten_glGetFloatv;var _emscripten_glGetInteger64v=(name_,p)=>{emscriptenWebGLGet(name_,p,1)};var _glGetInteger64v=_emscripten_glGetInteger64v;var _emscripten_glGetIntegerv=(name_,p)=>emscriptenWebGLGet(name_,p,0);var _glGetIntegerv=_emscripten_glGetIntegerv;var _emscripten_glGetProgramInfoLog=(program,maxLength,length,infoLog)=>{var log=GLctx.getProgramInfoLog(GL.programs[program]);if(log===null)log="(unknown error)";var numBytesWrittenExclNull=maxLength>0&&infoLog?stringToUTF8(log,infoLog,maxLength):0;if(length)HEAP32[length>>2]=numBytesWrittenExclNull};var _glGetProgramInfoLog=_emscripten_glGetProgramInfoLog;var _emscripten_glGetProgramiv=(program,pname,p)=>{if(!p){GL.recordError(1281);return}if(program>=GL.counter){GL.recordError(1281);return}program=GL.programs[program];if(pname==35716){var log=GLctx.getProgramInfoLog(program);if(log===null)log="(unknown error)";HEAP32[p>>2]=log.length+1}else if(pname==35719){if(!program.maxUniformLength){var numActiveUniforms=GLctx.getProgramParameter(program,35718);for(var i=0;i<numActiveUniforms;++i){program.maxUniformLength=Math.max(program.maxUniformLength,GLctx.getActiveUniform(program,i).name.length+1)}}HEAP32[p>>2]=program.maxUniformLength}else if(pname==35722){if(!program.maxAttributeLength){var numActiveAttributes=GLctx.getProgramParameter(program,35721);for(var i=0;i<numActiveAttributes;++i){program.maxAttributeLength=Math.max(program.maxAttributeLength,GLctx.getActiveAttrib(program,i).name.length+1)}}HEAP32[p>>2]=program.maxAttributeLength}else if(pname==35381){if(!program.maxUniformBlockNameLength){var numActiveUniformBlocks=GLctx.getProgramParameter(program,35382);for(var i=0;i<numActiveUniformBlocks;++i){program.maxUniformBlockNameLength=Math.max(program.maxUniformBlockNameLength,GLctx.getActiveUniformBlockName(program,i).length+1)}}HEAP32[p>>2]=program.maxUniformBlockNameLength}else{HEAP32[p>>2]=GLctx.getProgramParameter(program,pname)}};var _glGetProgramiv=_emscripten_glGetProgramiv;var _emscripten_glGetShaderInfoLog=(shader,maxLength,length,infoLog)=>{var log=GLctx.getShaderInfoLog(GL.shaders[shader]);if(log===null)log="(unknown error)";var numBytesWrittenExclNull=maxLength>0&&infoLog?stringToUTF8(log,infoLog,maxLength):0;if(length)HEAP32[length>>2]=numBytesWrittenExclNull};var _glGetShaderInfoLog=_emscripten_glGetShaderInfoLog;var _emscripten_glGetShaderiv=(shader,pname,p)=>{if(!p){GL.recordError(1281);return}if(pname==35716){var log=GLctx.getShaderInfoLog(GL.shaders[shader]);if(log===null)log="(unknown error)";var logLength=log?log.length+1:0;HEAP32[p>>2]=logLength}else if(pname==35720){var source=GLctx.getShaderSource(GL.shaders[shader]);var sourceLength=source?source.length+1:0;HEAP32[p>>2]=sourceLength}else{HEAP32[p>>2]=GLctx.getShaderParameter(GL.shaders[shader],pname)}};var _glGetShaderiv=_emscripten_glGetShaderiv;var _emscripten_glGetString=name_=>{var ret=GL.stringCache[name_];if(!ret){switch(name_){case 7939:ret=stringToNewUTF8(webglGetExtensions().join(" "));break;case 7936:case 7937:case 37445:case 37446:var s=GLctx.getParameter(name_);if(!s){GL.recordError(1280)}ret=s?stringToNewUTF8(s):0;break;case 7938:var webGLVersion=GLctx.getParameter(7938);var glVersion=`OpenGL ES 2.0 (${webGLVersion})`;if(GL.currentContext.version>=2)glVersion=`OpenGL ES 3.0 (${webGLVersion})`;ret=stringToNewUTF8(glVersion);break;case 35724:var glslVersion=GLctx.getParameter(35724);var ver_re=/^WebGL GLSL ES ([0-9]\.[0-9][0-9]?)(?:$| .*)/;var ver_num=glslVersion.match(ver_re);if(ver_num!==null){if(ver_num[1].length==3)ver_num[1]=ver_num[1]+"0";glslVersion=`OpenGL ES GLSL ES ${ver_num[1]} (${glslVersion})`}ret=stringToNewUTF8(glslVersion);break;default:GL.recordError(1280)}GL.stringCache[name_]=ret}return ret};var _glGetString=_emscripten_glGetString;var _emscripten_glGetSynciv=(sync,pname,bufSize,length,values)=>{if(bufSize<0){GL.recordError(1281);return}if(!values){GL.recordError(1281);return}var ret=GLctx.getSyncParameter(GL.syncs[sync],pname);if(ret!==null){HEAP32[values>>2]=ret;if(length)HEAP32[length>>2]=1}};var _glGetSynciv=_emscripten_glGetSynciv;var _emscripten_glGetUniformBlockIndex=(program,uniformBlockName)=>GLctx.getUniformBlockIndex(GL.programs[program],UTF8ToString(uniformBlockName));var _glGetUniformBlockIndex=_emscripten_glGetUniformBlockIndex;var jstoi_q=str=>parseInt(str);var webglGetLeftBracePos=name=>name.slice(-1)=="]"&&name.lastIndexOf("[");var webglPrepareUniformLocationsBeforeFirstUse=program=>{var uniformLocsById=program.uniformLocsById,uniformSizeAndIdsByName=program.uniformSizeAndIdsByName,i,j;if(!uniformLocsById){program.uniformLocsById=uniformLocsById={};program.uniformArrayNamesById={};var numActiveUniforms=GLctx.getProgramParameter(program,35718);for(i=0;i<numActiveUniforms;++i){var u=GLctx.getActiveUniform(program,i);var nm=u.name;var sz=u.size;var lb=webglGetLeftBracePos(nm);var arrayName=lb>0?nm.slice(0,lb):nm;var id=program.uniformIdCounter;program.uniformIdCounter+=sz;uniformSizeAndIdsByName[arrayName]=[sz,id];for(j=0;j<sz;++j){uniformLocsById[id]=j;program.uniformArrayNamesById[id++]=arrayName}}}};var _emscripten_glGetUniformLocation=(program,name)=>{name=UTF8ToString(name);if(program=GL.programs[program]){webglPrepareUniformLocationsBeforeFirstUse(program);var uniformLocsById=program.uniformLocsById;var arrayIndex=0;var uniformBaseName=name;var leftBrace=webglGetLeftBracePos(name);if(leftBrace>0){arrayIndex=jstoi_q(name.slice(leftBrace+1))>>>0;uniformBaseName=name.slice(0,leftBrace)}var sizeAndId=program.uniformSizeAndIdsByName[uniformBaseName];if(sizeAndId&&arrayIndex<sizeAndId[0]){arrayIndex+=sizeAndId[1];if(uniformLocsById[arrayIndex]=uniformLocsById[arrayIndex]||GLctx.getUniformLocation(program,name)){return arrayIndex}}}else{GL.recordError(1281)}return-1};var _glGetUniformLocation=_emscripten_glGetUniformLocation;var _emscripten_glLinkProgram=program=>{program=GL.programs[program];GLctx.linkProgram(program);program.uniformLocsById=0;program.uniformSizeAndIdsByName={}};var _glLinkProgram=_emscripten_glLinkProgram;var _emscripten_glPixelStorei=(pname,param)=>{if(pname==3317){GL.unpackAlignment=param}else if(pname==3314){GL.unpackRowLength=param}GLctx.pixelStorei(pname,param)};var _glPixelStorei=_emscripten_glPixelStorei;var _emscripten_glReadBuffer=x0=>GLctx.readBuffer(x0);var _glReadBuffer=_emscripten_glReadBuffer;var computeUnpackAlignedImageSize=(width,height,sizePerPixel)=>{function roundedToNextMultipleOf(x,y){return x+y-1&-y}var plainRowSize=(GL.unpackRowLength||width)*sizePerPixel;var alignedRowSize=roundedToNextMultipleOf(plainRowSize,GL.unpackAlignment);return height*alignedRowSize};var colorChannelsInGlTextureFormat=format=>{var colorChannels={5:3,6:4,8:2,29502:3,29504:4,26917:2,26918:2,29846:3,29847:4};return colorChannels[format-6402]||1};var heapObjectForWebGLType=type=>{type-=5120;if(type==0)return HEAP8;if(type==1)return HEAPU8;if(type==2)return HEAP16;if(type==4)return HEAP32;if(type==6)return HEAPF32;if(type==5||type==28922||type==28520||type==30779||type==30782)return HEAPU32;return HEAPU16};var toTypedArrayIndex=(pointer,heap)=>pointer>>>31-Math.clz32(heap.BYTES_PER_ELEMENT);var emscriptenWebGLGetTexPixelData=(type,format,width,height,pixels,internalFormat)=>{var heap=heapObjectForWebGLType(type);var sizePerPixel=colorChannelsInGlTextureFormat(format)*heap.BYTES_PER_ELEMENT;var bytes=computeUnpackAlignedImageSize(width,height,sizePerPixel);return heap.subarray(toTypedArrayIndex(pixels,heap),toTypedArrayIndex(pixels+bytes,heap))};var _emscripten_glReadPixels=(x,y,width,height,format,type,pixels)=>{if(GL.currentContext.version>=2){if(GLctx.currentPixelPackBufferBinding){GLctx.readPixels(x,y,width,height,format,type,pixels);return}var heap=heapObjectForWebGLType(type);var target=toTypedArrayIndex(pixels,heap);GLctx.readPixels(x,y,width,height,format,type,heap,target);return}var pixelData=emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,format);if(!pixelData){GL.recordError(1280);return}GLctx.readPixels(x,y,width,height,format,type,pixelData)};var _glReadPixels=_emscripten_glReadPixels;var _emscripten_glRenderbufferStorage=(x0,x1,x2,x3)=>GLctx.renderbufferStorage(x0,x1,x2,x3);var _glRenderbufferStorage=_emscripten_glRenderbufferStorage;var _emscripten_glRenderbufferStorageMultisample=(x0,x1,x2,x3,x4)=>GLctx.renderbufferStorageMultisample(x0,x1,x2,x3,x4);var _glRenderbufferStorageMultisample=_emscripten_glRenderbufferStorageMultisample;var _emscripten_glScissor=(x0,x1,x2,x3)=>GLctx.scissor(x0,x1,x2,x3);var _glScissor=_emscripten_glScissor;var _emscripten_glShaderSource=(shader,count,string,length)=>{var source=GL.getSource(shader,count,string,length);GLctx.shaderSource(GL.shaders[shader],source)};var _glShaderSource=_emscripten_glShaderSource;var _emscripten_glStencilFunc=(x0,x1,x2)=>GLctx.stencilFunc(x0,x1,x2);var _glStencilFunc=_emscripten_glStencilFunc;var _emscripten_glStencilMask=x0=>GLctx.stencilMask(x0);var _glStencilMask=_emscripten_glStencilMask;var _emscripten_glStencilOp=(x0,x1,x2)=>GLctx.stencilOp(x0,x1,x2);var _glStencilOp=_emscripten_glStencilOp;var _emscripten_glTexImage2D=(target,level,internalFormat,width,height,border,format,type,pixels)=>{if(GL.currentContext.version>=2){if(GLctx.currentPixelUnpackBufferBinding){GLctx.texImage2D(target,level,internalFormat,width,height,border,format,type,pixels);return}if(pixels){var heap=heapObjectForWebGLType(type);var index=toTypedArrayIndex(pixels,heap);GLctx.texImage2D(target,level,internalFormat,width,height,border,format,type,heap,index);return}}var pixelData=pixels?emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,internalFormat):null;GLctx.texImage2D(target,level,internalFormat,width,height,border,format,type,pixelData)};var _glTexImage2D=_emscripten_glTexImage2D;var _emscripten_glTexImage3D=(target,level,internalFormat,width,height,depth,border,format,type,pixels)=>{if(GLctx.currentPixelUnpackBufferBinding){GLctx.texImage3D(target,level,internalFormat,width,height,depth,border,format,type,pixels)}else if(pixels){var heap=heapObjectForWebGLType(type);GLctx.texImage3D(target,level,internalFormat,width,height,depth,border,format,type,heap,toTypedArrayIndex(pixels,heap))}else{GLctx.texImage3D(target,level,internalFormat,width,height,depth,border,format,type,null)}};var _glTexImage3D=_emscripten_glTexImage3D;var _emscripten_glTexParameterf=(x0,x1,x2)=>GLctx.texParameterf(x0,x1,x2);var _glTexParameterf=_emscripten_glTexParameterf;var _emscripten_glTexParameteri=(x0,x1,x2)=>GLctx.texParameteri(x0,x1,x2);var _glTexParameteri=_emscripten_glTexParameteri;var _emscripten_glTexStorage2D=(x0,x1,x2,x3,x4)=>GLctx.texStorage2D(x0,x1,x2,x3,x4);var _glTexStorage2D=_emscripten_glTexStorage2D;var _emscripten_glTexSubImage3D=(target,level,xoffset,yoffset,zoffset,width,height,depth,format,type,pixels)=>{if(GLctx.currentPixelUnpackBufferBinding){GLctx.texSubImage3D(target,level,xoffset,yoffset,zoffset,width,height,depth,format,type,pixels)}else if(pixels){var heap=heapObjectForWebGLType(type);GLctx.texSubImage3D(target,level,xoffset,yoffset,zoffset,width,height,depth,format,type,heap,toTypedArrayIndex(pixels,heap))}else{GLctx.texSubImage3D(target,level,xoffset,yoffset,zoffset,width,height,depth,format,type,null)}};var _glTexSubImage3D=_emscripten_glTexSubImage3D;var _emscripten_glTransformFeedbackVaryings=(program,count,varyings,bufferMode)=>{program=GL.programs[program];var vars=[];for(var i=0;i<count;i++)vars.push(UTF8ToString(HEAP32[varyings+i*4>>2]));GLctx.transformFeedbackVaryings(program,vars,bufferMode)};var _glTransformFeedbackVaryings=_emscripten_glTransformFeedbackVaryings;var webglGetUniformLocation=location=>{var p=GLctx.currentProgram;if(p){var webglLoc=p.uniformLocsById[location];if(typeof webglLoc=="number"){p.uniformLocsById[location]=webglLoc=GLctx.getUniformLocation(p,p.uniformArrayNamesById[location]+(webglLoc>0?`[${webglLoc}]`:""))}return webglLoc}else{GL.recordError(1282)}};var _emscripten_glUniform1f=(location,v0)=>{GLctx.uniform1f(webglGetUniformLocation(location),v0)};var _glUniform1f=_emscripten_glUniform1f;var _emscripten_glUniform1i=(location,v0)=>{GLctx.uniform1i(webglGetUniformLocation(location),v0)};var _glUniform1i=_emscripten_glUniform1i;var miniTempWebGLIntBuffers=[];var _emscripten_glUniform1iv=(location,count,value)=>{if(GL.currentContext.version>=2){count&&GLctx.uniform1iv(webglGetUniformLocation(location),HEAP32,value>>2,count);return}if(count<=288){var view=miniTempWebGLIntBuffers[count];for(var i=0;i<count;++i){view[i]=HEAP32[value+4*i>>2]}}else{var view=HEAP32.subarray(value>>2,value+count*4>>2)}GLctx.uniform1iv(webglGetUniformLocation(location),view)};var _glUniform1iv=_emscripten_glUniform1iv;var _emscripten_glUniform1ui=(location,v0)=>{GLctx.uniform1ui(webglGetUniformLocation(location),v0)};var _glUniform1ui=_emscripten_glUniform1ui;var _emscripten_glUniform1uiv=(location,count,value)=>{count&&GLctx.uniform1uiv(webglGetUniformLocation(location),HEAPU32,value>>2,count)};var _glUniform1uiv=_emscripten_glUniform1uiv;var _emscripten_glUniform2f=(location,v0,v1)=>{GLctx.uniform2f(webglGetUniformLocation(location),v0,v1)};var _glUniform2f=_emscripten_glUniform2f;var miniTempWebGLFloatBuffers=[];var _emscripten_glUniform2fv=(location,count,value)=>{if(GL.currentContext.version>=2){count&&GLctx.uniform2fv(webglGetUniformLocation(location),HEAPF32,value>>2,count*2);return}if(count<=144){count*=2;var view=miniTempWebGLFloatBuffers[count];for(var i=0;i<count;i+=2){view[i]=HEAPF32[value+4*i>>2];view[i+1]=HEAPF32[value+(4*i+4)>>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*8>>2)}GLctx.uniform2fv(webglGetUniformLocation(location),view)};var _glUniform2fv=_emscripten_glUniform2fv;var _emscripten_glUniform2iv=(location,count,value)=>{if(GL.currentContext.version>=2){count&&GLctx.uniform2iv(webglGetUniformLocation(location),HEAP32,value>>2,count*2);return}if(count<=144){count*=2;var view=miniTempWebGLIntBuffers[count];for(var i=0;i<count;i+=2){view[i]=HEAP32[value+4*i>>2];view[i+1]=HEAP32[value+(4*i+4)>>2]}}else{var view=HEAP32.subarray(value>>2,value+count*8>>2)}GLctx.uniform2iv(webglGetUniformLocation(location),view)};var _glUniform2iv=_emscripten_glUniform2iv;var _emscripten_glUniform3fv=(location,count,value)=>{if(GL.currentContext.version>=2){count&&GLctx.uniform3fv(webglGetUniformLocation(location),HEAPF32,value>>2,count*3);return}if(count<=96){count*=3;var view=miniTempWebGLFloatBuffers[count];for(var i=0;i<count;i+=3){view[i]=HEAPF32[value+4*i>>2];view[i+1]=HEAPF32[value+(4*i+4)>>2];view[i+2]=HEAPF32[value+(4*i+8)>>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*12>>2)}GLctx.uniform3fv(webglGetUniformLocation(location),view)};var _glUniform3fv=_emscripten_glUniform3fv;var _emscripten_glUniform4f=(location,v0,v1,v2,v3)=>{GLctx.uniform4f(webglGetUniformLocation(location),v0,v1,v2,v3)};var _glUniform4f=_emscripten_glUniform4f;var _emscripten_glUniform4fv=(location,count,value)=>{if(GL.currentContext.version>=2){count&&GLctx.uniform4fv(webglGetUniformLocation(location),HEAPF32,value>>2,count*4);return}if(count<=72){var view=miniTempWebGLFloatBuffers[4*count];var heap=HEAPF32;value=value>>2;count*=4;for(var i=0;i<count;i+=4){var dst=value+i;view[i]=heap[dst];view[i+1]=heap[dst+1];view[i+2]=heap[dst+2];view[i+3]=heap[dst+3]}}else{var view=HEAPF32.subarray(value>>2,value+count*16>>2)}GLctx.uniform4fv(webglGetUniformLocation(location),view)};var _glUniform4fv=_emscripten_glUniform4fv;var _emscripten_glUniformBlockBinding=(program,uniformBlockIndex,uniformBlockBinding)=>{program=GL.programs[program];GLctx.uniformBlockBinding(program,uniformBlockIndex,uniformBlockBinding)};var _glUniformBlockBinding=_emscripten_glUniformBlockBinding;var _emscripten_glUniformMatrix3fv=(location,count,transpose,value)=>{if(GL.currentContext.version>=2){count&&GLctx.uniformMatrix3fv(webglGetUniformLocation(location),!!transpose,HEAPF32,value>>2,count*9);return}if(count<=32){count*=9;var view=miniTempWebGLFloatBuffers[count];for(var i=0;i<count;i+=9){view[i]=HEAPF32[value+4*i>>2];view[i+1]=HEAPF32[value+(4*i+4)>>2];view[i+2]=HEAPF32[value+(4*i+8)>>2];view[i+3]=HEAPF32[value+(4*i+12)>>2];view[i+4]=HEAPF32[value+(4*i+16)>>2];view[i+5]=HEAPF32[value+(4*i+20)>>2];view[i+6]=HEAPF32[value+(4*i+24)>>2];view[i+7]=HEAPF32[value+(4*i+28)>>2];view[i+8]=HEAPF32[value+(4*i+32)>>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*36>>2)}GLctx.uniformMatrix3fv(webglGetUniformLocation(location),!!transpose,view)};var _glUniformMatrix3fv=_emscripten_glUniformMatrix3fv;var _emscripten_glUniformMatrix4fv=(location,count,transpose,value)=>{if(GL.currentContext.version>=2){count&&GLctx.uniformMatrix4fv(webglGetUniformLocation(location),!!transpose,HEAPF32,value>>2,count*16);return}if(count<=18){var view=miniTempWebGLFloatBuffers[16*count];var heap=HEAPF32;value=value>>2;count*=16;for(var i=0;i<count;i+=16){var dst=value+i;view[i]=heap[dst];view[i+1]=heap[dst+1];view[i+2]=heap[dst+2];view[i+3]=heap[dst+3];view[i+4]=heap[dst+4];view[i+5]=heap[dst+5];view[i+6]=heap[dst+6];view[i+7]=heap[dst+7];view[i+8]=heap[dst+8];view[i+9]=heap[dst+9];view[i+10]=heap[dst+10];view[i+11]=heap[dst+11];view[i+12]=heap[dst+12];view[i+13]=heap[dst+13];view[i+14]=heap[dst+14];view[i+15]=heap[dst+15]}}else{var view=HEAPF32.subarray(value>>2,value+count*64>>2)}GLctx.uniformMatrix4fv(webglGetUniformLocation(location),!!transpose,view)};var _glUniformMatrix4fv=_emscripten_glUniformMatrix4fv;var _emscripten_glUseProgram=program=>{program=GL.programs[program];GLctx.useProgram(program);GLctx.currentProgram=program};var _glUseProgram=_emscripten_glUseProgram;var _emscripten_glVertexAttrib4f=(x0,x1,x2,x3,x4)=>GLctx.vertexAttrib4f(x0,x1,x2,x3,x4);var _glVertexAttrib4f=_emscripten_glVertexAttrib4f;var _emscripten_glVertexAttribDivisor=(index,divisor)=>{GLctx.vertexAttribDivisor(index,divisor)};var _glVertexAttribDivisor=_emscripten_glVertexAttribDivisor;var _emscripten_glVertexAttribI4ui=(x0,x1,x2,x3,x4)=>GLctx.vertexAttribI4ui(x0,x1,x2,x3,x4);var _glVertexAttribI4ui=_emscripten_glVertexAttribI4ui;var _emscripten_glVertexAttribIPointer=(index,size,type,stride,ptr)=>{GLctx.vertexAttribIPointer(index,size,type,stride,ptr)};var _glVertexAttribIPointer=_emscripten_glVertexAttribIPointer;var _emscripten_glVertexAttribPointer=(index,size,type,normalized,stride,ptr)=>{GLctx.vertexAttribPointer(index,size,type,!!normalized,stride,ptr)};var _glVertexAttribPointer=_emscripten_glVertexAttribPointer;var _emscripten_glViewport=(x0,x1,x2,x3)=>GLctx.viewport(x0,x1,x2,x3);var _glViewport=_emscripten_glViewport;var GodotRuntime={get_func:function(ptr){return wasmTable.get(ptr)},error:function(){err.apply(null,Array.from(arguments))},print:function(){out.apply(null,Array.from(arguments))},malloc:function(p_size){return _malloc(p_size)},free:function(p_ptr){_free(p_ptr)},getHeapValue:function(p_ptr,p_type){return getValue(p_ptr,p_type)},setHeapValue:function(p_ptr,p_value,p_type){setValue(p_ptr,p_value,p_type)},heapSub:function(p_heap,p_ptr,p_len){const bytes=p_heap.BYTES_PER_ELEMENT;return p_heap.subarray(p_ptr/bytes,p_ptr/bytes+p_len)},heapSlice:function(p_heap,p_ptr,p_len){const bytes=p_heap.BYTES_PER_ELEMENT;return p_heap.slice(p_ptr/bytes,p_ptr/bytes+p_len)},heapCopy:function(p_dst,p_src,p_ptr){const bytes=p_src.BYTES_PER_ELEMENT;return p_dst.set(p_src,p_ptr/bytes)},parseString:function(p_ptr){return UTF8ToString(p_ptr)},parseStringArray:function(p_ptr,p_size){const strings=[];const ptrs=GodotRuntime.heapSub(HEAP32,p_ptr,p_size);ptrs.forEach(function(ptr){strings.push(GodotRuntime.parseString(ptr))});return strings},strlen:function(p_str){return lengthBytesUTF8(p_str)},allocString:function(p_str){const length=GodotRuntime.strlen(p_str)+1;const c_str=GodotRuntime.malloc(length);stringToUTF8(p_str,c_str,length);return c_str},allocStringArray:function(p_strings){const size=p_strings.length;const c_ptr=GodotRuntime.malloc(size*4);for(let i=0;i<size;i++){HEAP32[(c_ptr>>2)+i]=GodotRuntime.allocString(p_strings[i])}return c_ptr},freeStringArray:function(p_ptr,p_len){for(let i=0;i<p_len;i++){GodotRuntime.free(HEAP32[(p_ptr>>2)+i])}GodotRuntime.free(p_ptr)},stringToHeap:function(p_str,p_ptr,p_len){return stringToUTF8Array(p_str,HEAP8,p_ptr,p_len)}};var GodotConfig={canvas:null,locale:"en",canvas_resize_policy:2,virtual_keyboard:false,persistent_drops:false,godot_pool_size:4,on_execute:null,on_exit:null,init_config:function(p_opts){GodotConfig.canvas_resize_policy=p_opts["canvasResizePolicy"];GodotConfig.canvas=p_opts["canvas"];GodotConfig.locale=p_opts["locale"]||GodotConfig.locale;GodotConfig.virtual_keyboard=p_opts["virtualKeyboard"];GodotConfig.persistent_drops=!!p_opts["persistentDrops"];GodotConfig.godot_pool_size=p_opts["godotPoolSize"];GodotConfig.on_execute=p_opts["onExecute"];GodotConfig.on_exit=p_opts["onExit"];if(p_opts["focusCanvas"]){GodotConfig.canvas.focus()}},locate_file:function(file){return Module["locateFile"](file)},clear:function(){GodotConfig.canvas=null;GodotConfig.locale="en";GodotConfig.canvas_resize_policy=2;GodotConfig.virtual_keyboard=false;GodotConfig.persistent_drops=false;GodotConfig.on_execute=null;GodotConfig.on_exit=null}};var GodotFS={ENOENT:44,_idbfs:false,_syncing:false,_mount_points:[],is_persistent:function(){return GodotFS._idbfs?1:0},init:function(persistentPaths){GodotFS._idbfs=false;if(!Array.isArray(persistentPaths)){return Promise.reject(new Error("Persistent paths must be an array"))}if(!persistentPaths.length){return Promise.resolve()}GodotFS._mount_points=persistentPaths.slice();function createRecursive(dir){try{FS.stat(dir)}catch(e){if(e.errno!==GodotFS.ENOENT){GodotRuntime.error(e)}FS.mkdirTree(dir)}}GodotFS._mount_points.forEach(function(path){createRecursive(path);FS.mount(IDBFS,{},path)});return new Promise(function(resolve,reject){FS.syncfs(true,function(err){if(err){GodotFS._mount_points=[];GodotFS._idbfs=false;GodotRuntime.print(`IndexedDB not available: ${err.message}`)}else{GodotFS._idbfs=true}resolve(err)})})},deinit:function(){GodotFS._mount_points.forEach(function(path){try{FS.unmount(path)}catch(e){GodotRuntime.print("Already unmounted",e)}if(GodotFS._idbfs&&IDBFS.dbs[path]){IDBFS.dbs[path].close();delete IDBFS.dbs[path]}});GodotFS._mount_points=[];GodotFS._idbfs=false;GodotFS._syncing=false},sync:function(){if(GodotFS._syncing){GodotRuntime.error("Already syncing!");return Promise.resolve()}GodotFS._syncing=true;return new Promise(function(resolve,reject){FS.syncfs(false,function(error){if(error){GodotRuntime.error(`Failed to save IDB file system: ${error.message}`)}GodotFS._syncing=false;resolve(error)})})},copy_to_fs:function(path,buffer){const idx=path.lastIndexOf("/");let dir="/";if(idx>0){dir=path.slice(0,idx)}try{FS.stat(dir)}catch(e){if(e.errno!==GodotFS.ENOENT){GodotRuntime.error(e)}FS.mkdirTree(dir)}FS.writeFile(path,new Uint8Array(buffer))}};var GodotOS={request_quit:function(){},_async_cbs:[],_fs_sync_promise:null,atexit:function(p_promise_cb){GodotOS._async_cbs.push(p_promise_cb)},cleanup:function(exit_code){const cb=GodotConfig.on_exit;GodotFS.deinit();GodotConfig.clear();if(cb){cb(exit_code)}},finish_async:function(callback){GodotOS._fs_sync_promise.then(function(err){const promises=[];GodotOS._async_cbs.forEach(function(cb){promises.push(new Promise(cb))});return Promise.all(promises)}).then(function(){return GodotFS.sync()}).then(function(err){setTimeout(function(){callback()},0)})}};var GodotAudio={MAX_VOLUME_CHANNELS:8,GodotChannel:{CHANNEL_L:0,CHANNEL_R:1,CHANNEL_C:3,CHANNEL_LFE:4,CHANNEL_RL:5,CHANNEL_RR:6,CHANNEL_SL:7,CHANNEL_SR:8},WebChannel:{CHANNEL_L:0,CHANNEL_R:1,CHANNEL_SL:2,CHANNEL_SR:3,CHANNEL_C:4,CHANNEL_LFE:5},samples:null,Sample:class Sample{static getSample(id){if(!GodotAudio.samples.has(id)){throw new ReferenceError(`Could not find sample "${id}"`)}return GodotAudio.samples.get(id)}static getSampleOrNull(id){return GodotAudio.samples.get(id)??null}static create(params,options={}){const sample=new GodotAudio.Sample(params,options);GodotAudio.samples.set(params.id,sample);return sample}static delete(id){GodotAudio.samples.delete(id)}constructor(params,options={}){this.id=params.id;this._audioBuffer=null;this.numberOfChannels=options.numberOfChannels??2;this.sampleRate=options.sampleRate??44100;this.loopMode=options.loopMode??"disabled";this.loopBegin=options.loopBegin??0;this.loopEnd=options.loopEnd??0;this.setAudioBuffer(params.audioBuffer)}getAudioBuffer(){return this._duplicateAudioBuffer()}setAudioBuffer(val){this._audioBuffer=val}clear(){this.setAudioBuffer(null);GodotAudio.Sample.delete(this.id)}_duplicateAudioBuffer(){if(this._audioBuffer==null){throw new Error("couldn't duplicate a null audioBuffer")}const channels=new Array(this._audioBuffer.numberOfChannels);for(let i=0;i<this._audioBuffer.numberOfChannels;i++){const channel=new Float32Array(this._audioBuffer.getChannelData(i));channels[i]=channel}const buffer=GodotAudio.ctx.createBuffer(this.numberOfChannels,this._audioBuffer.length,this._audioBuffer.sampleRate);for(let i=0;i<channels.length;i++){buffer.copyToChannel(channels[i],i,0)}return buffer}},SampleNodeBus:class SampleNodeBus{static create(bus){return new GodotAudio.SampleNodeBus(bus)}constructor(bus){const NUMBER_OF_WEB_CHANNELS=6;this._bus=bus;this._channelSplitter=GodotAudio.ctx.createChannelSplitter(NUMBER_OF_WEB_CHANNELS);this._l=GodotAudio.ctx.createGain();this._r=GodotAudio.ctx.createGain();this._sl=GodotAudio.ctx.createGain();this._sr=GodotAudio.ctx.createGain();this._c=GodotAudio.ctx.createGain();this._lfe=GodotAudio.ctx.createGain();this._channelMerger=GodotAudio.ctx.createChannelMerger(NUMBER_OF_WEB_CHANNELS);this._channelSplitter.connect(this._l,GodotAudio.WebChannel.CHANNEL_L).connect(this._channelMerger,GodotAudio.WebChannel.CHANNEL_L,GodotAudio.WebChannel.CHANNEL_L);this._channelSplitter.connect(this._r,GodotAudio.WebChannel.CHANNEL_R).connect(this._channelMerger,GodotAudio.WebChannel.CHANNEL_L,GodotAudio.WebChannel.CHANNEL_R);this._channelSplitter.connect(this._sl,GodotAudio.WebChannel.CHANNEL_SL).connect(this._channelMerger,GodotAudio.WebChannel.CHANNEL_L,GodotAudio.WebChannel.CHANNEL_SL);this._channelSplitter.connect(this._sr,GodotAudio.WebChannel.CHANNEL_SR).connect(this._channelMerger,GodotAudio.WebChannel.CHANNEL_L,GodotAudio.WebChannel.CHANNEL_SR);this._channelSplitter.connect(this._c,GodotAudio.WebChannel.CHANNEL_C).connect(this._channelMerger,GodotAudio.WebChannel.CHANNEL_L,GodotAudio.WebChannel.CHANNEL_C);this._channelSplitter.connect(this._lfe,GodotAudio.WebChannel.CHANNEL_L).connect(this._channelMerger,GodotAudio.WebChannel.CHANNEL_L,GodotAudio.WebChannel.CHANNEL_LFE);this._channelMerger.connect(this._bus.getInputNode())}getInputNode(){return this._channelSplitter}getOutputNode(){return this._channelMerger}setVolume(volume){if(volume.length!==GodotAudio.MAX_VOLUME_CHANNELS){throw new Error(`Volume length isn't "${GodotAudio.MAX_VOLUME_CHANNELS}", is ${volume.length} instead`)}this._l.gain.value=volume[GodotAudio.GodotChannel.CHANNEL_L]??0;this._r.gain.value=volume[GodotAudio.GodotChannel.CHANNEL_R]??0;this._sl.gain.value=volume[GodotAudio.GodotChannel.CHANNEL_SL]??0;this._sr.gain.value=volume[GodotAudio.GodotChannel.CHANNEL_SR]??0;this._c.gain.value=volume[GodotAudio.GodotChannel.CHANNEL_C]??0;this._lfe.gain.value=volume[GodotAudio.GodotChannel.CHANNEL_LFE]??0}clear(){this._bus=null;this._channelSplitter.disconnect();this._channelSplitter=null;this._l.disconnect();this._l=null;this._r.disconnect();this._r=null;this._sl.disconnect();this._sl=null;this._sr.disconnect();this._sr=null;this._c.disconnect();this._c=null;this._lfe.disconnect();this._lfe=null;this._channelMerger.disconnect();this._channelMerger=null}},sampleNodes:null,SampleNode:class SampleNode{static getSampleNode(id){if(!GodotAudio.sampleNodes.has(id)){throw new ReferenceError(`Could not find sample node "${id}"`)}return GodotAudio.sampleNodes.get(id)}static getSampleNodeOrNull(id){return GodotAudio.sampleNodes.get(id)??null}static stopSampleNode(id){const sampleNode=GodotAudio.SampleNode.getSampleNodeOrNull(id);if(sampleNode==null){return}sampleNode.stop()}static pauseSampleNode(id,enable){const sampleNode=GodotAudio.SampleNode.getSampleNodeOrNull(id);if(sampleNode==null){return}sampleNode.pause(enable)}static create(params,options={}){const sampleNode=new GodotAudio.SampleNode(params,options);GodotAudio.sampleNodes.set(params.id,sampleNode);return sampleNode}static delete(id){GodotAudio.deleteSampleNode(id)}constructor(params,options={}){this.id=params.id;this.streamObjectId=params.streamObjectId;this.offset=options.offset??0;this._playbackPosition=options.offset;this.startTime=options.startTime??0;this.isPaused=false;this.isStarted=false;this.isCanceled=false;this.pauseTime=0;this._playbackRate=44100;this.loopMode=options.loopMode??this.getSample().loopMode??"disabled";this._pitchScale=options.pitchScale??1;this._sourceStartTime=0;this._sampleNodeBuses=new Map;this._source=GodotAudio.ctx.createBufferSource();this._onended=null;this._positionWorklet=null;this.setPlaybackRate(options.playbackRate??44100);this._source.buffer=this.getSample().getAudioBuffer();this._addEndedListener();const bus=GodotAudio.Bus.getBus(params.busIndex);const sampleNodeBus=this.getSampleNodeBus(bus);sampleNodeBus.setVolume(options.volume);this.connectPositionWorklet(options.start).catch(err=>{const newErr=new Error("Failed to create PositionWorklet.");newErr.cause=err;GodotRuntime.error(newErr)})}getPlaybackRate(){return this._playbackRate}getPlaybackPosition(){return this._playbackPosition}setPlaybackRate(val){this._playbackRate=val;this._syncPlaybackRate()}getPitchScale(){return this._pitchScale}setPitchScale(val){this._pitchScale=val;this._syncPlaybackRate()}getSample(){return GodotAudio.Sample.getSample(this.streamObjectId)}getOutputNode(){return this._source}start(){if(this.isStarted){return}this._resetSourceStartTime();this._source.start(this.startTime,this.offset);this.isStarted=true}stop(){this.clear()}restart(){this.isPaused=false;this.pauseTime=0;this._resetSourceStartTime();this._restart()}pause(enable=true){if(enable){this._pause();return}this._unpause()}connect(node){return this.getOutputNode().connect(node)}setVolumes(buses,volumes){for(let busIdx=0;busIdx<buses.length;busIdx++){const sampleNodeBus=this.getSampleNodeBus(buses[busIdx]);sampleNodeBus.setVolume(volumes.slice(busIdx*GodotAudio.MAX_VOLUME_CHANNELS,busIdx*GodotAudio.MAX_VOLUME_CHANNELS+GodotAudio.MAX_VOLUME_CHANNELS))}}getSampleNodeBus(bus){if(!this._sampleNodeBuses.has(bus)){const sampleNodeBus=GodotAudio.SampleNodeBus.create(bus);this._sampleNodeBuses.set(bus,sampleNodeBus);this._source.connect(sampleNodeBus.getInputNode())}return this._sampleNodeBuses.get(bus)}async connectPositionWorklet(start){await GodotAudio.audioPositionWorkletPromise;if(this.isCanceled){return}this._source.connect(this.getPositionWorklet());if(start){this.start()}}getPositionWorklet(){if(this._positionWorklet!=null){return this._positionWorklet}if(GodotAudio.audioPositionWorkletNodes.length>0){this._positionWorklet=GodotAudio.audioPositionWorkletNodes.pop()}else{this._positionWorklet=new AudioWorkletNode(GodotAudio.ctx,"godot-position-reporting-processor")}this._playbackPosition=this.offset;this._positionWorklet.port.onmessage=event=>{switch(event.data["type"]){case"position":this._playbackPosition=parseInt(event.data.data,10)/this.getSample().sampleRate+this.offset;break;default:}};const resetParameter=this._positionWorklet.parameters.get("reset");resetParameter.setValueAtTime(1,GodotAudio.ctx.currentTime);resetParameter.setValueAtTime(0,GodotAudio.ctx.currentTime+1);return this._positionWorklet}clear(){this.isCanceled=true;this.isPaused=false;this.pauseTime=0;if(this._source!=null){this._source.removeEventListener("ended",this._onended);this._onended=null;if(this.isStarted){this._source.stop()}this._source.disconnect();this._source=null}for(const sampleNodeBus of this._sampleNodeBuses.values()){sampleNodeBus.clear()}this._sampleNodeBuses.clear();if(this._positionWorklet){this._positionWorklet.disconnect();this._positionWorklet.port.onmessage=null;GodotAudio.audioPositionWorkletNodes.push(this._positionWorklet);this._positionWorklet=null}GodotAudio.SampleNode.delete(this.id)}_resetSourceStartTime(){this._sourceStartTime=GodotAudio.ctx.currentTime}_syncPlaybackRate(){this._source.playbackRate.value=this.getPlaybackRate()*this.getPitchScale()}_restart(){if(this._source!=null){this._source.disconnect()}this._source=GodotAudio.ctx.createBufferSource();this._source.buffer=this.getSample().getAudioBuffer();for(const sampleNodeBus of this._sampleNodeBuses.values()){this.connect(sampleNodeBus.getInputNode())}this._addEndedListener();const pauseTime=this.isPaused?this.pauseTime:0;if(this._positionWorklet!=null){this._positionWorklet.port.postMessage({type:"clear"});this._source.connect(this._positionWorklet)}this._source.start(this.startTime,this.offset+pauseTime);this.isStarted=true}_pause(){if(!this.isStarted){return}this.isPaused=true;this.pauseTime=(GodotAudio.ctx.currentTime-this._sourceStartTime)/this.getPlaybackRate();this._source.stop()}_unpause(){this._restart();this.isPaused=false;this.pauseTime=0}_addEndedListener(){if(this._onended!=null){this._source.removeEventListener("ended",this._onended)}const self=this;this._onended=_=>{if(self.isPaused){return}switch(self.getSample().loopMode){case"disabled":self.stop();break;case"forward":case"backward":self.restart();break;default:}};this._source.addEventListener("ended",this._onended)}},deleteSampleNode:pSampleNodeId=>{GodotAudio.sampleNodes.delete(pSampleNodeId);if(GodotAudio.sampleFinishedCallback==null){return}const sampleNodeIdPtr=GodotRuntime.allocString(pSampleNodeId);GodotAudio.sampleFinishedCallback(sampleNodeIdPtr);GodotRuntime.free(sampleNodeIdPtr)},buses:null,busSolo:null,Bus:class Bus{static getCount(){return GodotAudio.buses.length}static setCount(val){const buses=GodotAudio.buses;if(val===buses.length){return}if(val<buses.length){const deletedBuses=buses.slice(val);for(let i=0;i<deletedBuses.length;i++){const deletedBus=deletedBuses[i];deletedBus.clear()}GodotAudio.buses=buses.slice(0,val);return}for(let i=GodotAudio.buses.length;i<val;i++){GodotAudio.Bus.create()}}static getBus(index){if(index<0||index>=GodotAudio.buses.length){throw new ReferenceError(`invalid bus index "${index}"`)}return GodotAudio.buses[index]}static getBusOrNull(index){if(index<0||index>=GodotAudio.buses.length){return null}return GodotAudio.buses[index]}static move(fromIndex,toIndex){const movedBus=GodotAudio.Bus.getBusOrNull(fromIndex);if(movedBus==null){return}const buses=GodotAudio.buses.filter((_,i)=>i!==fromIndex);buses.splice(toIndex-1,0,movedBus);GodotAudio.buses=buses}static addAt(index){const newBus=GodotAudio.Bus.create();if(index!==newBus.getId()){GodotAudio.Bus.move(newBus.getId(),index)}}static create(){const newBus=new GodotAudio.Bus;const isFirstBus=GodotAudio.buses.length===0;GodotAudio.buses.push(newBus);if(isFirstBus){newBus.setSend(null)}else{newBus.setSend(GodotAudio.Bus.getBus(0))}return newBus}constructor(){this._sampleNodes=new Set;this.isSolo=false;this._send=null;this._gainNode=GodotAudio.ctx.createGain();this._soloNode=GodotAudio.ctx.createGain();this._muteNode=GodotAudio.ctx.createGain();this._gainNode.connect(this._soloNode).connect(this._muteNode)}getId(){return GodotAudio.buses.indexOf(this)}getVolumeDb(){return GodotAudio.linear_to_db(this._gainNode.gain.value)}setVolumeDb(val){const linear=GodotAudio.db_to_linear(val);if(isFinite(linear)){this._gainNode.gain.value=linear}}getSend(){return this._send}setSend(val){this._send=val;if(val==null){if(this.getId()==0){this.getOutputNode().connect(GodotAudio.ctx.destination);return}throw new Error(`Cannot send to "${val}" without the bus being at index 0 (current index: ${this.getId()})`)}this.connect(val)}getInputNode(){return this._gainNode}getOutputNode(){return this._muteNode}mute(enable){this._muteNode.gain.value=enable?0:1}solo(enable){if(this.isSolo===enable){return}if(enable){if(GodotAudio.busSolo!=null&&GodotAudio.busSolo!==this){GodotAudio.busSolo._disableSolo()}this._enableSolo();return}this._disableSolo()}addSampleNode(sampleNode){this._sampleNodes.add(sampleNode);sampleNode.getOutputNode().connect(this.getInputNode())}removeSampleNode(sampleNode){this._sampleNodes.delete(sampleNode);sampleNode.getOutputNode().disconnect()}connect(bus){if(bus==null){throw new Error("cannot connect to null bus")}this.getOutputNode().disconnect();this.getOutputNode().connect(bus.getInputNode());return bus}clear(){GodotAudio.buses=GodotAudio.buses.filter(v=>v!==this)}_syncSampleNodes(){const sampleNodes=Array.from(this._sampleNodes);for(let i=0;i<sampleNodes.length;i++){const sampleNode=sampleNodes[i];sampleNode.getOutputNode().disconnect();sampleNode.getOutputNode().connect(this.getInputNode())}}_enableSolo(){this.isSolo=true;GodotAudio.busSolo=this;this._soloNode.gain.value=1;const otherBuses=GodotAudio.buses.filter(otherBus=>otherBus!==this);for(let i=0;i<otherBuses.length;i++){const otherBus=otherBuses[i];otherBus._soloNode.gain.value=0}}_disableSolo(){this.isSolo=false;GodotAudio.busSolo=null;this._soloNode.gain.value=1;const otherBuses=GodotAudio.buses.filter(otherBus=>otherBus!==this);for(let i=0;i<otherBuses.length;i++){const otherBus=otherBuses[i];otherBus._soloNode.gain.value=1}}},sampleFinishedCallback:null,ctx:null,input:null,driver:null,interval:0,audioPositionWorkletPromise:null,audioPositionWorkletNodes:null,linear_to_db:function(linear){return Math.log(linear)*8.685889638065037},db_to_linear:function(db){return Math.exp(db*.11512925464970228)},init:function(mix_rate,latency,onstatechange,onlatencyupdate){GodotAudio.samples=new Map;GodotAudio.sampleNodes=new Map;GodotAudio.buses=[];GodotAudio.busSolo=null;GodotAudio.audioPositionWorkletNodes=[];const opts={};if(mix_rate){GodotAudio.sampleRate=mix_rate;opts["sampleRate"]=mix_rate}const ctx=new(window.AudioContext||window.webkitAudioContext)(opts);GodotAudio.ctx=ctx;ctx.onstatechange=function(){let state=0;switch(ctx.state){case"suspended":state=0;break;case"running":state=1;break;case"closed":state=2;break;default:}onstatechange(state)};ctx.onstatechange();GodotAudio.interval=setInterval(function(){let computed_latency=0;if(ctx.baseLatency){computed_latency+=GodotAudio.ctx.baseLatency}if(ctx.outputLatency){computed_latency+=GodotAudio.ctx.outputLatency}onlatencyupdate(computed_latency)},1e3);GodotOS.atexit(GodotAudio.close_async);const path=GodotConfig.locate_file("godot.audio.position.worklet.js");GodotAudio.audioPositionWorkletPromise=ctx.audioWorklet.addModule(path);return ctx.destination.channelCount},create_input:function(callback){if(GodotAudio.input){return 0}function gotMediaInput(stream){try{GodotAudio.input=GodotAudio.ctx.createMediaStreamSource(stream);callback(GodotAudio.input)}catch(e){GodotRuntime.error("Failed creating input.",e)}}if(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia){navigator.mediaDevices.getUserMedia({audio:true}).then(gotMediaInput,function(e){GodotRuntime.error("Error getting user media.",e)})}else{if(!navigator.getUserMedia){navigator.getUserMedia=navigator.webkitGetUserMedia||navigator.mozGetUserMedia}if(!navigator.getUserMedia){GodotRuntime.error("getUserMedia not available.");return 1}navigator.getUserMedia({audio:true},gotMediaInput,function(e){GodotRuntime.print(e)})}return 0},close_async:function(resolve,reject){const ctx=GodotAudio.ctx;GodotAudio.ctx=null;if(!ctx){resolve();return}if(GodotAudio.interval){clearInterval(GodotAudio.interval);GodotAudio.interval=0}if(GodotAudio.input){GodotAudio.input.disconnect();GodotAudio.input=null}let closed=Promise.resolve();if(GodotAudio.driver){closed=GodotAudio.driver.close()}closed.then(function(){return ctx.close()}).then(function(){ctx.onstatechange=null;resolve()}).catch(function(e){ctx.onstatechange=null;GodotRuntime.error("Error closing AudioContext",e);resolve()})},start_sample:function(playbackObjectId,streamObjectId,busIndex,startOptions){GodotAudio.SampleNode.stopSampleNode(playbackObjectId);GodotAudio.SampleNode.create({busIndex,id:playbackObjectId,streamObjectId},startOptions)},stop_sample:function(playbackObjectId){GodotAudio.SampleNode.stopSampleNode(playbackObjectId)},sample_set_pause:function(playbackObjectId,pause){GodotAudio.SampleNode.pauseSampleNode(playbackObjectId,pause)},update_sample_pitch_scale:function(playbackObjectId,pitchScale){const sampleNode=GodotAudio.SampleNode.getSampleNodeOrNull(playbackObjectId);if(sampleNode==null){return}sampleNode.setPitchScale(pitchScale)},sample_set_volumes_linear:function(playbackObjectId,busIndexes,volumes){const sampleNode=GodotAudio.SampleNode.getSampleNodeOrNull(playbackObjectId);if(sampleNode==null){return}const buses=busIndexes.map(busIndex=>GodotAudio.Bus.getBus(busIndex));sampleNode.setVolumes(buses,volumes)},set_sample_bus_count:function(count){GodotAudio.Bus.setCount(count)},remove_sample_bus:function(index){const bus=GodotAudio.Bus.getBusOrNull(index);if(bus==null){return}bus.clear()},add_sample_bus:function(atPos){GodotAudio.Bus.addAt(atPos)},move_sample_bus:function(busIndex,toPos){GodotAudio.Bus.move(busIndex,toPos)},set_sample_bus_send:function(busIndex,sendIndex){const bus=GodotAudio.Bus.getBusOrNull(busIndex);if(bus==null){return}let targetBus=GodotAudio.Bus.getBusOrNull(sendIndex);if(targetBus==null){targetBus=GodotAudio.Bus.getBus(0)}bus.setSend(targetBus)},set_sample_bus_volume_db:function(busIndex,volumeDb){const bus=GodotAudio.Bus.getBusOrNull(busIndex);if(bus==null){return}bus.setVolumeDb(volumeDb)},set_sample_bus_solo:function(busIndex,enable){const bus=GodotAudio.Bus.getBusOrNull(busIndex);if(bus==null){return}bus.solo(enable)},set_sample_bus_mute:function(busIndex,enable){const bus=GodotAudio.Bus.getBusOrNull(busIndex);if(bus==null){return}bus.mute(enable)}};function _godot_audio_get_sample_playback_position(playbackObjectIdStrPtr){const playbackObjectId=GodotRuntime.parseString(playbackObjectIdStrPtr);const sampleNode=GodotAudio.SampleNode.getSampleNodeOrNull(playbackObjectId);if(sampleNode==null){return 0}return sampleNode.getPlaybackPosition()}function _godot_audio_has_script_processor(){return GodotAudio.ctx&&GodotAudio.ctx.createScriptProcessor?1:0}function _godot_audio_has_worklet(){return GodotAudio.ctx&&GodotAudio.ctx.audioWorklet?1:0}function _godot_audio_init(p_mix_rate,p_latency,p_state_change,p_latency_update){const statechange=GodotRuntime.get_func(p_state_change);const latencyupdate=GodotRuntime.get_func(p_latency_update);const mix_rate=GodotRuntime.getHeapValue(p_mix_rate,"i32");const channels=GodotAudio.init(mix_rate,p_latency,statechange,latencyupdate);GodotRuntime.setHeapValue(p_mix_rate,GodotAudio.ctx.sampleRate,"i32");return channels}function _godot_audio_input_start(){return GodotAudio.create_input(function(input){input.connect(GodotAudio.driver.get_node())})}function _godot_audio_input_stop(){if(GodotAudio.input){const tracks=GodotAudio.input["mediaStream"]["getTracks"]();for(let i=0;i<tracks.length;i++){tracks[i]["stop"]()}GodotAudio.input.disconnect();GodotAudio.input=null}}function _godot_audio_is_available(){if(!(window.AudioContext||window.webkitAudioContext)){return 0}return 1}function _godot_audio_resume(){if(GodotAudio.ctx&&GodotAudio.ctx.state!=="running"){GodotAudio.ctx.resume()}}function _godot_audio_sample_bus_add(atPos){GodotAudio.add_sample_bus(atPos)}function _godot_audio_sample_bus_move(fromPos,toPos){GodotAudio.move_sample_bus(fromPos,toPos)}function _godot_audio_sample_bus_remove(index){GodotAudio.remove_sample_bus(index)}function _godot_audio_sample_bus_set_count(count){GodotAudio.set_sample_bus_count(count)}function _godot_audio_sample_bus_set_mute(bus,enable){GodotAudio.set_sample_bus_mute(bus,Boolean(enable))}function _godot_audio_sample_bus_set_send(bus,sendIndex){GodotAudio.set_sample_bus_send(bus,sendIndex)}function _godot_audio_sample_bus_set_solo(bus,enable){GodotAudio.set_sample_bus_solo(bus,Boolean(enable))}function _godot_audio_sample_bus_set_volume_db(bus,volumeDb){GodotAudio.set_sample_bus_volume_db(bus,volumeDb)}function _godot_audio_sample_is_active(playbackObjectIdStrPtr){const playbackObjectId=GodotRuntime.parseString(playbackObjectIdStrPtr);return Number(GodotAudio.sampleNodes.has(playbackObjectId))}function _godot_audio_sample_register_stream(streamObjectIdStrPtr,framesPtr,framesTotal,loopModeStrPtr,loopBegin,loopEnd){const BYTES_PER_FLOAT32=4;const streamObjectId=GodotRuntime.parseString(streamObjectIdStrPtr);const loopMode=GodotRuntime.parseString(loopModeStrPtr);const numberOfChannels=2;const sampleRate=GodotAudio.ctx.sampleRate;const subLeft=GodotRuntime.heapSub(HEAPF32,framesPtr,framesTotal);const subRight=GodotRuntime.heapSub(HEAPF32,framesPtr+framesTotal*BYTES_PER_FLOAT32,framesTotal);const audioBuffer=GodotAudio.ctx.createBuffer(numberOfChannels,framesTotal,sampleRate);audioBuffer.copyToChannel(new Float32Array(subLeft),0,0);audioBuffer.copyToChannel(new Float32Array(subRight),1,0);GodotAudio.Sample.create({id:streamObjectId,audioBuffer},{loopBegin,loopEnd,loopMode,numberOfChannels,sampleRate})}function _godot_audio_sample_set_finished_callback(callbackPtr){GodotAudio.sampleFinishedCallback=GodotRuntime.get_func(callbackPtr)}function _godot_audio_sample_set_pause(playbackObjectIdStrPtr,pause){const playbackObjectId=GodotRuntime.parseString(playbackObjectIdStrPtr);GodotAudio.sample_set_pause(playbackObjectId,Boolean(pause))}function _godot_audio_sample_set_volumes_linear(playbackObjectIdStrPtr,busesPtr,busesSize,volumesPtr,volumesSize){const playbackObjectId=GodotRuntime.parseString(playbackObjectIdStrPtr);const buses=GodotRuntime.heapSub(HEAP32,busesPtr,busesSize);const volumes=GodotRuntime.heapSub(HEAPF32,volumesPtr,volumesSize);GodotAudio.sample_set_volumes_linear(playbackObjectId,Array.from(buses),volumes)}function _godot_audio_sample_start(playbackObjectIdStrPtr,streamObjectIdStrPtr,busIndex,offset,pitchScale,volumePtr){const playbackObjectId=GodotRuntime.parseString(playbackObjectIdStrPtr);const streamObjectId=GodotRuntime.parseString(streamObjectIdStrPtr);const volume=GodotRuntime.heapSub(HEAPF32,volumePtr,8);const startOptions={offset,volume,playbackRate:1,pitchScale,start:true};GodotAudio.start_sample(playbackObjectId,streamObjectId,busIndex,startOptions)}function _godot_audio_sample_stop(playbackObjectIdStrPtr){const playbackObjectId=GodotRuntime.parseString(playbackObjectIdStrPtr);GodotAudio.stop_sample(playbackObjectId)}function _godot_audio_sample_stream_is_registered(streamObjectIdStrPtr){const streamObjectId=GodotRuntime.parseString(streamObjectIdStrPtr);return Number(GodotAudio.Sample.getSampleOrNull(streamObjectId)!=null)}function _godot_audio_sample_unregister_stream(streamObjectIdStrPtr){const streamObjectId=GodotRuntime.parseString(streamObjectIdStrPtr);const sample=GodotAudio.Sample.getSampleOrNull(streamObjectId);if(sample!=null){sample.clear()}}function _godot_audio_sample_update_pitch_scale(playbackObjectIdStrPtr,pitchScale){const playbackObjectId=GodotRuntime.parseString(playbackObjectIdStrPtr);GodotAudio.update_sample_pitch_scale(playbackObjectId,pitchScale)}var GodotAudioScript={script:null,create:function(buffer_length,channel_count){GodotAudioScript.script=GodotAudio.ctx.createScriptProcessor(buffer_length,2,channel_count);GodotAudio.driver=GodotAudioScript;return GodotAudioScript.script.bufferSize},start:function(p_in_buf,p_in_size,p_out_buf,p_out_size,onprocess){GodotAudioScript.script.onaudioprocess=function(event){const inb=GodotRuntime.heapSub(HEAPF32,p_in_buf,p_in_size);const input=event.inputBuffer;if(GodotAudio.input){const inlen=input.getChannelData(0).length;for(let ch=0;ch<2;ch++){const data=input.getChannelData(ch);for(let s=0;s<inlen;s++){inb[s*2+ch]=data[s]}}}onprocess();const outb=GodotRuntime.heapSub(HEAPF32,p_out_buf,p_out_size);const output=event.outputBuffer;const channels=output.numberOfChannels;for(let ch=0;ch<channels;ch++){const data=output.getChannelData(ch);for(let sample=0;sample<data.length;sample++){data[sample]=outb[sample*channels+ch]}}};GodotAudioScript.script.connect(GodotAudio.ctx.destination)},get_node:function(){return GodotAudioScript.script},close:function(){return new Promise(function(resolve,reject){GodotAudioScript.script.disconnect();GodotAudioScript.script.onaudioprocess=null;GodotAudioScript.script=null;resolve()})}};function _godot_audio_script_create(buffer_length,channel_count){const buf_len=GodotRuntime.getHeapValue(buffer_length,"i32");try{const out_len=GodotAudioScript.create(buf_len,channel_count);GodotRuntime.setHeapValue(buffer_length,out_len,"i32")}catch(e){GodotRuntime.error("Error starting AudioDriverScriptProcessor",e);return 1}return 0}function _godot_audio_script_start(p_in_buf,p_in_size,p_out_buf,p_out_size,p_cb){const onprocess=GodotRuntime.get_func(p_cb);GodotAudioScript.start(p_in_buf,p_in_size,p_out_buf,p_out_size,onprocess)}var GodotAudioWorklet={promise:null,worklet:null,ring_buffer:null,create:function(channels){const path=GodotConfig.locate_file("godot.audio.worklet.js");GodotAudioWorklet.promise=GodotAudio.ctx.audioWorklet.addModule(path).then(function(){GodotAudioWorklet.worklet=new AudioWorkletNode(GodotAudio.ctx,"godot-processor",{outputChannelCount:[channels]});return Promise.resolve()});GodotAudio.driver=GodotAudioWorklet},start:function(in_buf,out_buf,state){GodotAudioWorklet.promise.then(function(){const node=GodotAudioWorklet.worklet;node.connect(GodotAudio.ctx.destination);node.port.postMessage({cmd:"start",data:[state,in_buf,out_buf]});node.port.onmessage=function(event){GodotRuntime.error(event.data)}})},start_no_threads:function(p_out_buf,p_out_size,out_callback,p_in_buf,p_in_size,in_callback){function RingBuffer(){let wpos=0;let rpos=0;let pending_samples=0;const wbuf=new Float32Array(p_out_size);function send(port){if(pending_samples===0){return}const buffer=GodotRuntime.heapSub(HEAPF32,p_out_buf,p_out_size);const size=buffer.length;const tot_sent=pending_samples;out_callback(wpos,pending_samples);if(wpos+pending_samples>=size){const high=size-wpos;wbuf.set(buffer.subarray(wpos,size));pending_samples-=high;wpos=0}if(pending_samples>0){wbuf.set(buffer.subarray(wpos,wpos+pending_samples),tot_sent-pending_samples)}port.postMessage({cmd:"chunk",data:wbuf.subarray(0,tot_sent)});wpos+=pending_samples;pending_samples=0}this.receive=function(recv_buf){const buffer=GodotRuntime.heapSub(HEAPF32,p_in_buf,p_in_size);const from=rpos;let to_write=recv_buf.length;let high=0;if(rpos+to_write>=p_in_size){high=p_in_size-rpos;buffer.set(recv_buf.subarray(0,high),rpos);to_write-=high;rpos=0}if(to_write){buffer.set(recv_buf.subarray(high,to_write),rpos)}in_callback(from,recv_buf.length);rpos+=to_write};this.consumed=function(size,port){pending_samples+=size;send(port)}}GodotAudioWorklet.ring_buffer=new RingBuffer;GodotAudioWorklet.promise.then(function(){const node=GodotAudioWorklet.worklet;const buffer=GodotRuntime.heapSlice(HEAPF32,p_out_buf,p_out_size);node.connect(GodotAudio.ctx.destination);node.port.postMessage({cmd:"start_nothreads",data:[buffer,p_in_size]});node.port.onmessage=function(event){if(!GodotAudioWorklet.worklet){return}if(event.data["cmd"]==="read"){const read=event.data["data"];GodotAudioWorklet.ring_buffer.consumed(read,GodotAudioWorklet.worklet.port)}else if(event.data["cmd"]==="input"){const buf=event.data["data"];if(buf.length>p_in_size){GodotRuntime.error("Input chunk is too big");return}GodotAudioWorklet.ring_buffer.receive(buf)}else{GodotRuntime.error(event.data)}}})},get_node:function(){return GodotAudioWorklet.worklet},close:function(){return new Promise(function(resolve,reject){if(GodotAudioWorklet.promise===null){return}const p=GodotAudioWorklet.promise;p.then(function(){GodotAudioWorklet.worklet.port.postMessage({cmd:"stop",data:null});GodotAudioWorklet.worklet.disconnect();GodotAudioWorklet.worklet.port.onmessage=null;GodotAudioWorklet.worklet=null;GodotAudioWorklet.promise=null;resolve()}).catch(function(err){GodotRuntime.error(err)})})}};function _godot_audio_worklet_create(channels){try{GodotAudioWorklet.create(channels)}catch(e){GodotRuntime.error("Error starting AudioDriverWorklet",e);return 1}return 0}function _godot_audio_worklet_start_no_threads(p_out_buf,p_out_size,p_out_callback,p_in_buf,p_in_size,p_in_callback){const out_callback=GodotRuntime.get_func(p_out_callback);const in_callback=GodotRuntime.get_func(p_in_callback);GodotAudioWorklet.start_no_threads(p_out_buf,p_out_size,out_callback,p_in_buf,p_in_size,in_callback)}function _godot_js_config_canvas_id_get(p_ptr,p_ptr_max){GodotRuntime.stringToHeap(`#${GodotConfig.canvas.id}`,p_ptr,p_ptr_max)}function _godot_js_config_locale_get(p_ptr,p_ptr_max){GodotRuntime.stringToHeap(GodotConfig.locale,p_ptr,p_ptr_max)}var GodotDisplayCursor={shape:"default",visible:true,cursors:{},set_style:function(style){GodotConfig.canvas.style.cursor=style},set_shape:function(shape){GodotDisplayCursor.shape=shape;let css=shape;if(shape in GodotDisplayCursor.cursors){const c=GodotDisplayCursor.cursors[shape];css=`url("${c.url}") ${c.x} ${c.y}, default`}if(GodotDisplayCursor.visible){GodotDisplayCursor.set_style(css)}},clear:function(){GodotDisplayCursor.set_style("");GodotDisplayCursor.shape="default";GodotDisplayCursor.visible=true;Object.keys(GodotDisplayCursor.cursors).forEach(function(key){URL.revokeObjectURL(GodotDisplayCursor.cursors[key]);delete GodotDisplayCursor.cursors[key]})},lockPointer:function(){const canvas=GodotConfig.canvas;if(canvas.requestPointerLock){canvas.requestPointerLock()}},releasePointer:function(){if(document.exitPointerLock){document.exitPointerLock()}},isPointerLocked:function(){return document.pointerLockElement===GodotConfig.canvas}};var GodotEventListeners={handlers:[],has:function(target,event,method,capture){return GodotEventListeners.handlers.findIndex(function(e){return e.target===target&&e.event===event&&e.method===method&&e.capture===capture})!==-1},add:function(target,event,method,capture){if(GodotEventListeners.has(target,event,method,capture)){return}function Handler(p_target,p_event,p_method,p_capture){this.target=p_target;this.event=p_event;this.method=p_method;this.capture=p_capture}GodotEventListeners.handlers.push(new Handler(target,event,method,capture));target.addEventListener(event,method,capture)},clear:function(){GodotEventListeners.handlers.forEach(function(h){h.target.removeEventListener(h.event,h.method,h.capture)});GodotEventListeners.handlers.length=0}};var _emscripten_webgl_do_get_current_context=()=>GL.currentContext?GL.currentContext.handle:0;var _emscripten_webgl_get_current_context=_emscripten_webgl_do_get_current_context;var GodotDisplayScreen={desired_size:[0,0],hidpi:true,getPixelRatio:function(){return GodotDisplayScreen.hidpi?window.devicePixelRatio||1:1},isFullscreen:function(){const elem=document.fullscreenElement||document.mozFullscreenElement||document.webkitFullscreenElement||document.msFullscreenElement;if(elem){return elem===GodotConfig.canvas}return document.fullscreen||document.mozFullScreen||document.webkitIsFullscreen},hasFullscreen:function(){return document.fullscreenEnabled||document.mozFullScreenEnabled||document.webkitFullscreenEnabled},requestFullscreen:function(){if(!GodotDisplayScreen.hasFullscreen()){return 1}const canvas=GodotConfig.canvas;try{const promise=(canvas.requestFullscreen||canvas.msRequestFullscreen||canvas.mozRequestFullScreen||canvas.mozRequestFullscreen||canvas.webkitRequestFullscreen).call(canvas);if(promise){promise.catch(function(){})}}catch(e){return 1}return 0},exitFullscreen:function(){if(!GodotDisplayScreen.isFullscreen()){return 0}try{const promise=document.exitFullscreen();if(promise){promise.catch(function(){})}}catch(e){return 1}return 0},_updateGL:function(){const gl_context_handle=_emscripten_webgl_get_current_context();const gl=GL.getContext(gl_context_handle);if(gl){GL.resizeOffscreenFramebuffer(gl)}},updateSize:function(){const isFullscreen=GodotDisplayScreen.isFullscreen();const wantsFullWindow=GodotConfig.canvas_resize_policy===2;const noResize=GodotConfig.canvas_resize_policy===0;const dWidth=GodotDisplayScreen.desired_size[0];const dHeight=GodotDisplayScreen.desired_size[1];const canvas=GodotConfig.canvas;let width=dWidth;let height=dHeight;if(noResize){if(canvas.width!==width||canvas.height!==height){GodotDisplayScreen.desired_size=[canvas.width,canvas.height];GodotDisplayScreen._updateGL();return 1}return 0}const scale=GodotDisplayScreen.getPixelRatio();if(isFullscreen||wantsFullWindow){width=Math.floor(window.innerWidth*scale);height=Math.floor(window.innerHeight*scale)}const csw=`${Math.floor(width/scale)}px`;const csh=`${Math.floor(height/scale)}px`;if(canvas.style.width!==csw||canvas.style.height!==csh||canvas.width!==width||canvas.height!==height){canvas.width=width;canvas.height=height;canvas.style.width=csw;canvas.style.height=csh;GodotDisplayScreen._updateGL();return 1}return 0}};var GodotInputGamepads={samples:[],get_pads:function(){try{const pads=navigator.getGamepads();if(pads){return pads}return[]}catch(e){return[]}},get_samples:function(){return GodotInputGamepads.samples},get_sample:function(index){const samples=GodotInputGamepads.samples;return index<samples.length?samples[index]:null},sample:function(){const pads=GodotInputGamepads.get_pads();const samples=[];for(let i=0;i<pads.length;i++){const pad=pads[i];if(!pad){samples.push(null);continue}const s={standard:pad.mapping==="standard",buttons:[],axes:[],connected:pad.connected};for(let b=0;b<pad.buttons.length;b++){s.buttons.push(pad.buttons[b].value)}for(let a=0;a<pad.axes.length;a++){s.axes.push(pad.axes[a])}samples.push(s)}GodotInputGamepads.samples=samples},init:function(onchange){GodotInputGamepads.samples=[];function add(pad){const guid=GodotInputGamepads.get_guid(pad);const c_id=GodotRuntime.allocString(pad.id);const c_guid=GodotRuntime.allocString(guid);onchange(pad.index,1,c_id,c_guid);GodotRuntime.free(c_id);GodotRuntime.free(c_guid)}const pads=GodotInputGamepads.get_pads();for(let i=0;i<pads.length;i++){if(pads[i]){add(pads[i])}}GodotEventListeners.add(window,"gamepadconnected",function(evt){if(evt.gamepad){add(evt.gamepad)}},false);GodotEventListeners.add(window,"gamepaddisconnected",function(evt){if(evt.gamepad){onchange(evt.gamepad.index,0)}},false)},get_guid:function(pad){if(pad.mapping){return pad.mapping}const ua=navigator.userAgent;let os="Unknown";if(ua.indexOf("Android")>=0){os="Android"}else if(ua.indexOf("Linux")>=0){os="Linux"}else if(ua.indexOf("iPhone")>=0){os="iOS"}else if(ua.indexOf("Macintosh")>=0){os="MacOSX"}else if(ua.indexOf("Windows")>=0){os="Windows"}const id=pad.id;const exp1=/vendor: ([0-9a-f]{4}) product: ([0-9a-f]{4})/i;const exp2=/^([0-9a-f]+)-([0-9a-f]+)-/i;let vendor="";let product="";if(exp1.test(id)){const match=exp1.exec(id);vendor=match[1].padStart(4,"0");product=match[2].padStart(4,"0")}else if(exp2.test(id)){const match=exp2.exec(id);vendor=match[1].padStart(4,"0");product=match[2].padStart(4,"0")}if(!vendor||!product){return`${os}Unknown`}return os+vendor+product}};var GodotInputDragDrop={promises:[],pending_files:[],add_entry:function(entry){if(entry.isDirectory){GodotInputDragDrop.add_dir(entry)}else if(entry.isFile){GodotInputDragDrop.add_file(entry)}else{GodotRuntime.error("Unrecognized entry...",entry)}},add_dir:function(entry){GodotInputDragDrop.promises.push(new Promise(function(resolve,reject){const reader=entry.createReader();reader.readEntries(function(entries){for(let i=0;i<entries.length;i++){GodotInputDragDrop.add_entry(entries[i])}resolve()})}))},add_file:function(entry){GodotInputDragDrop.promises.push(new Promise(function(resolve,reject){entry.file(function(file){const reader=new FileReader;reader.onload=function(){const f={path:file.relativePath||file.webkitRelativePath,name:file.name,type:file.type,size:file.size,data:reader.result};if(!f["path"]){f["path"]=f["name"]}GodotInputDragDrop.pending_files.push(f);resolve()};reader.onerror=function(){GodotRuntime.print("Error reading file");reject()};reader.readAsArrayBuffer(file)},function(err){GodotRuntime.print("Error!");reject()})}))},process:function(resolve,reject){if(GodotInputDragDrop.promises.length===0){resolve();return}GodotInputDragDrop.promises.pop().then(function(){setTimeout(function(){GodotInputDragDrop.process(resolve,reject)},0)})},_process_event:function(ev,callback){ev.preventDefault();if(ev.dataTransfer.items){for(let i=0;i<ev.dataTransfer.items.length;i++){const item=ev.dataTransfer.items[i];let entry=null;if("getAsEntry"in item){entry=item.getAsEntry()}else if("webkitGetAsEntry"in item){entry=item.webkitGetAsEntry()}if(entry){GodotInputDragDrop.add_entry(entry)}}}else{GodotRuntime.error("File upload not supported")}new Promise(GodotInputDragDrop.process).then(function(){const DROP=`/tmp/drop-${parseInt(Math.random()*(1<<30),10)}/`;const drops=[];const files=[];FS.mkdir(DROP.slice(0,-1));GodotInputDragDrop.pending_files.forEach(elem=>{const path=elem["path"];GodotFS.copy_to_fs(DROP+path,elem["data"]);let idx=path.indexOf("/");if(idx===-1){drops.push(DROP+path)}else{const sub=path.substr(0,idx);idx=sub.indexOf("/");if(idx<0&&drops.indexOf(DROP+sub)===-1){drops.push(DROP+sub)}}files.push(DROP+path)});GodotInputDragDrop.promises=[];GodotInputDragDrop.pending_files=[];callback(drops);if(GodotConfig.persistent_drops){GodotOS.atexit(function(resolve,reject){GodotInputDragDrop.remove_drop(files,DROP);resolve()})}else{GodotInputDragDrop.remove_drop(files,DROP)}})},remove_drop:function(files,drop_path){const dirs=[drop_path.substr(0,drop_path.length-1)];files.forEach(function(file){FS.unlink(file);let dir=file.replace(drop_path,"");let idx=dir.lastIndexOf("/");while(idx>0){dir=dir.substr(0,idx);if(dirs.indexOf(drop_path+dir)===-1){dirs.push(drop_path+dir)}idx=dir.lastIndexOf("/")}});dirs.sort(function(a,b){const al=(a.match(/\//g)||[]).length;const bl=(b.match(/\//g)||[]).length;if(al>bl){return-1}else if(al<bl){return 1}return 0}).forEach(function(dir){FS.rmdir(dir)})},handler:function(callback){return function(ev){GodotInputDragDrop._process_event(ev,callback)}}};var GodotIME={ime:null,active:false,focusTimerIntervalId:-1,getModifiers:function(evt){return evt.shiftKey+0+(evt.altKey+0<<1)+(evt.ctrlKey+0<<2)+(evt.metaKey+0<<3)},ime_active:function(active){function clearFocusTimerInterval(){clearInterval(GodotIME.focusTimerIntervalId);GodotIME.focusTimerIntervalId=-1}function focusTimer(){if(GodotIME.ime==null){clearFocusTimerInterval();return}GodotIME.ime.focus()}if(GodotIME.focusTimerIntervalId>-1){clearFocusTimerInterval()}if(GodotIME.ime==null){return}GodotIME.active=active;if(active){GodotIME.ime.style.display="block";GodotIME.focusTimerIntervalId=setInterval(focusTimer,100)}else{GodotIME.ime.style.display="none";GodotConfig.canvas.focus()}},ime_position:function(x,y){if(GodotIME.ime==null){return}const canvas=GodotConfig.canvas;const rect=canvas.getBoundingClientRect();const rw=canvas.width/rect.width;const rh=canvas.height/rect.height;const clx=x/rw+rect.x;const cly=y/rh+rect.y;GodotIME.ime.style.left=`${clx}px`;GodotIME.ime.style.top=`${cly}px`},init:function(ime_cb,key_cb,code,key){function key_event_cb(pressed,evt){const modifiers=GodotIME.getModifiers(evt);GodotRuntime.stringToHeap(evt.code,code,32);GodotRuntime.stringToHeap(evt.key,key,32);key_cb(pressed,evt.repeat,modifiers);evt.preventDefault()}function ime_event_cb(event){if(GodotIME.ime==null){return}switch(event.type){case"compositionstart":ime_cb(0,null);GodotIME.ime.innerHTML="";break;case"compositionupdate":{const ptr=GodotRuntime.allocString(event.data);ime_cb(1,ptr);GodotRuntime.free(ptr)}break;case"compositionend":{const ptr=GodotRuntime.allocString(event.data);ime_cb(2,ptr);GodotRuntime.free(ptr);GodotIME.ime.innerHTML=""}break;default:}}const ime=document.createElement("div");ime.className="ime";ime.style.background="none";ime.style.opacity=0;ime.style.position="fixed";ime.style.textAlign="left";ime.style.fontSize="1px";ime.style.left="0px";ime.style.top="0px";ime.style.width="100%";ime.style.height="40px";ime.style.pointerEvents="none";ime.style.display="none";ime.contentEditable="true";GodotEventListeners.add(ime,"compositionstart",ime_event_cb,false);GodotEventListeners.add(ime,"compositionupdate",ime_event_cb,false);GodotEventListeners.add(ime,"compositionend",ime_event_cb,false);GodotEventListeners.add(ime,"keydown",key_event_cb.bind(null,1),false);GodotEventListeners.add(ime,"keyup",key_event_cb.bind(null,0),false);ime.onblur=function(){this.style.display="none";GodotConfig.canvas.focus();GodotIME.active=false};GodotConfig.canvas.parentElement.appendChild(ime);GodotIME.ime=ime},clear:function(){if(GodotIME.ime==null){return}if(GodotIME.focusTimerIntervalId>-1){clearInterval(GodotIME.focusTimerIntervalId);GodotIME.focusTimerIntervalId=-1}GodotIME.ime.remove();GodotIME.ime=null}};var GodotInput={inputKeyCallback:null,setInputKeyData:null,getModifiers:function(evt){return evt.shiftKey+0+(evt.altKey+0<<1)+(evt.ctrlKey+0<<2)+(evt.metaKey+0<<3)},computePosition:function(evt,rect){const canvas=GodotConfig.canvas;const rw=canvas.width/rect.width;const rh=canvas.height/rect.height;const x=(evt.clientX-rect.x)*rw;const y=(evt.clientY-rect.y)*rh;return[x,y]},onKeyEvent:function(pIsPressed,pEvent){if(GodotInput.inputKeyCallback==null){throw new TypeError("GodotInput.onKeyEvent(): GodotInput.inputKeyCallback is null, cannot process key event.")}if(GodotInput.setInputKeyData==null){throw new TypeError("GodotInput.onKeyEvent(): GodotInput.setInputKeyData is null, cannot process key event.")}const modifiers=GodotInput.getModifiers(pEvent);GodotInput.setInputKeyData(pEvent.code,pEvent.key);GodotInput.inputKeyCallback(pIsPressed?1:0,pEvent.repeat,modifiers);pEvent.preventDefault()}};var GodotDisplayVK={textinput:null,textarea:null,available:function(){return GodotConfig.virtual_keyboard&&"ontouchstart"in window},init:function(input_cb){function create(what){const elem=document.createElement(what);elem.style.display="none";elem.style.position="absolute";elem.style.zIndex="-1";elem.style.background="transparent";elem.style.padding="0px";elem.style.margin="0px";elem.style.overflow="hidden";elem.style.width="0px";elem.style.height="0px";elem.style.border="0px";elem.style.outline="none";elem.readonly=true;elem.disabled=true;GodotEventListeners.add(elem,"input",function(evt){const c_str=GodotRuntime.allocString(elem.value);input_cb(c_str,elem.selectionEnd);GodotRuntime.free(c_str)},false);if(what==="input"){const onKey=(pEvent,pEventName)=>{if(pEvent.key!=="Enter"){return}GodotInput.onKeyEvent(pEventName==="keydown",pEvent)};GodotEventListeners.add(elem,"keydown",pEvent=>onKey(pEvent,"keydown"),false);GodotEventListeners.add(elem,"keyup",pEvent=>onKey(pEvent,"keyup"),false)}GodotEventListeners.add(elem,"blur",function(evt){elem.style.display="none";elem.readonly=true;elem.disabled=true},false);GodotConfig.canvas.insertAdjacentElement("beforebegin",elem);return elem}GodotDisplayVK.textinput=create("input");GodotDisplayVK.textarea=create("textarea");GodotDisplayVK.updateSize()},show:function(text,type,start,end){if(!GodotDisplayVK.textinput||!GodotDisplayVK.textarea){return}if(GodotDisplayVK.textinput.style.display!==""||GodotDisplayVK.textarea.style.display!==""){GodotDisplayVK.hide()}GodotDisplayVK.updateSize();let elem=GodotDisplayVK.textinput;switch(type){case 0:elem.type="text";elem.inputmode="";break;case 1:elem=GodotDisplayVK.textarea;break;case 2:elem.type="text";elem.inputmode="numeric";break;case 3:elem.type="text";elem.inputmode="decimal";break;case 4:elem.type="tel";elem.inputmode="";break;case 5:elem.type="email";elem.inputmode="";break;case 6:elem.type="password";elem.inputmode="";break;case 7:elem.type="url";elem.inputmode="";break;default:elem.type="text";elem.inputmode="";break}elem.readonly=false;elem.disabled=false;elem.value=text;elem.style.display="block";elem.focus();elem.setSelectionRange(start,end)},hide:function(){if(!GodotDisplayVK.textinput||!GodotDisplayVK.textarea){return}[GodotDisplayVK.textinput,GodotDisplayVK.textarea].forEach(function(elem){elem.blur();elem.style.display="none";elem.value=""})},updateSize:function(){if(!GodotDisplayVK.textinput||!GodotDisplayVK.textarea){return}const rect=GodotConfig.canvas.getBoundingClientRect();function update(elem){elem.style.left=`${rect.left}px`;elem.style.top=`${rect.top}px`;elem.style.width=`${rect.width}px`;elem.style.height=`${rect.height}px`}update(GodotDisplayVK.textinput);update(GodotDisplayVK.textarea)},clear:function(){if(GodotDisplayVK.textinput){GodotDisplayVK.textinput.remove();GodotDisplayVK.textinput=null}if(GodotDisplayVK.textarea){GodotDisplayVK.textarea.remove();GodotDisplayVK.textarea=null}}};var GodotDisplay={window_icon:"",getDPI:function(){const dpi=Math.round(window.devicePixelRatio*96);return dpi>=96?dpi:96}};function _godot_js_display_alert(p_text){window.alert(GodotRuntime.parseString(p_text))}function _godot_js_display_canvas_focus(){GodotConfig.canvas.focus()}function _godot_js_display_canvas_is_focused(){return document.activeElement===GodotConfig.canvas}function _godot_js_display_clipboard_get(callback){const func=GodotRuntime.get_func(callback);try{navigator.clipboard.readText().then(function(result){const ptr=GodotRuntime.allocString(result);func(ptr);GodotRuntime.free(ptr)}).catch(function(e){})}catch(e){}}function _godot_js_display_clipboard_set(p_text){const text=GodotRuntime.parseString(p_text);if(!navigator.clipboard||!navigator.clipboard.writeText){return 1}navigator.clipboard.writeText(text).catch(function(e){GodotRuntime.error("Setting OS clipboard is only possible from an input callback for the Web platform. Exception:",e)});return 0}function _godot_js_display_cursor_is_hidden(){return!GodotDisplayCursor.visible}function _godot_js_display_cursor_is_locked(){return GodotDisplayCursor.isPointerLocked()?1:0}function _godot_js_display_cursor_lock_set(p_lock){if(p_lock){GodotDisplayCursor.lockPointer()}else{GodotDisplayCursor.releasePointer()}}function _godot_js_display_cursor_set_custom_shape(p_shape,p_ptr,p_len,p_hotspot_x,p_hotspot_y){const shape=GodotRuntime.parseString(p_shape);const old_shape=GodotDisplayCursor.cursors[shape];if(p_len>0){const png=new Blob([GodotRuntime.heapSlice(HEAPU8,p_ptr,p_len)],{type:"image/png"});const url=URL.createObjectURL(png);GodotDisplayCursor.cursors[shape]={url,x:p_hotspot_x,y:p_hotspot_y}}else{delete GodotDisplayCursor.cursors[shape]}if(shape===GodotDisplayCursor.shape){GodotDisplayCursor.set_shape(GodotDisplayCursor.shape)}if(old_shape){URL.revokeObjectURL(old_shape.url)}}function _godot_js_display_cursor_set_shape(p_string){GodotDisplayCursor.set_shape(GodotRuntime.parseString(p_string))}function _godot_js_display_cursor_set_visible(p_visible){const visible=p_visible!==0;if(visible===GodotDisplayCursor.visible){return}GodotDisplayCursor.visible=visible;if(visible){GodotDisplayCursor.set_shape(GodotDisplayCursor.shape)}else{GodotDisplayCursor.set_style("none")}}function _godot_js_display_desired_size_set(width,height){GodotDisplayScreen.desired_size=[width,height];GodotDisplayScreen.updateSize()}function _godot_js_display_fullscreen_cb(callback){const canvas=GodotConfig.canvas;const func=GodotRuntime.get_func(callback);function change_cb(evt){if(evt.target===canvas){func(GodotDisplayScreen.isFullscreen())}}GodotEventListeners.add(document,"fullscreenchange",change_cb,false);GodotEventListeners.add(document,"mozfullscreenchange",change_cb,false);GodotEventListeners.add(document,"webkitfullscreenchange",change_cb,false)}function _godot_js_display_fullscreen_exit(){return GodotDisplayScreen.exitFullscreen()}function _godot_js_display_fullscreen_request(){return GodotDisplayScreen.requestFullscreen()}function _godot_js_display_has_webgl(p_version){if(p_version!==1&&p_version!==2){return false}try{return!!document.createElement("canvas").getContext(p_version===2?"webgl2":"webgl")}catch(e){}return false}function _godot_js_display_is_swap_ok_cancel(){const win=["Windows","Win64","Win32","WinCE"];const plat=navigator.platform||"";if(win.indexOf(plat)!==-1){return 1}return 0}function _godot_js_display_notification_cb(callback,p_enter,p_exit,p_in,p_out){const canvas=GodotConfig.canvas;const func=GodotRuntime.get_func(callback);const notif=[p_enter,p_exit,p_in,p_out];["mouseover","mouseleave","focus","blur"].forEach(function(evt_name,idx){GodotEventListeners.add(canvas,evt_name,function(){func(notif[idx])},true)})}function _godot_js_display_pixel_ratio_get(){return GodotDisplayScreen.getPixelRatio()}function _godot_js_display_screen_dpi_get(){return GodotDisplay.getDPI()}function _godot_js_display_screen_size_get(width,height){const scale=GodotDisplayScreen.getPixelRatio();GodotRuntime.setHeapValue(width,window.screen.width*scale,"i32");GodotRuntime.setHeapValue(height,window.screen.height*scale,"i32")}function _godot_js_display_setup_canvas(p_width,p_height,p_fullscreen,p_hidpi){const canvas=GodotConfig.canvas;GodotEventListeners.add(canvas,"contextmenu",function(ev){ev.preventDefault()},false);GodotEventListeners.add(canvas,"webglcontextlost",function(ev){alert("WebGL context lost, please reload the page");ev.preventDefault()},false);GodotDisplayScreen.hidpi=!!p_hidpi;switch(GodotConfig.canvas_resize_policy){case 0:GodotDisplayScreen.desired_size=[canvas.width,canvas.height];break;case 1:GodotDisplayScreen.desired_size=[p_width,p_height];break;default:canvas.style.position="absolute";canvas.style.top=0;canvas.style.left=0;break}GodotDisplayScreen.updateSize();if(p_fullscreen){GodotDisplayScreen.requestFullscreen()}}function _godot_js_display_size_update(){const updated=GodotDisplayScreen.updateSize();if(updated){GodotDisplayVK.updateSize()}return updated}function _godot_js_display_touchscreen_is_available(){return"ontouchstart"in window}function _godot_js_display_tts_available(){return"speechSynthesis"in window}function _godot_js_display_vk_available(){return GodotDisplayVK.available()}function _godot_js_display_vk_cb(p_input_cb){const input_cb=GodotRuntime.get_func(p_input_cb);if(GodotDisplayVK.available()){GodotDisplayVK.init(input_cb)}}function _godot_js_display_vk_hide(){GodotDisplayVK.hide()}function _godot_js_display_vk_show(p_text,p_type,p_start,p_end){const text=GodotRuntime.parseString(p_text);const start=p_start>0?p_start:0;const end=p_end>0?p_end:start;GodotDisplayVK.show(text,p_type,start,end)}function _godot_js_display_window_blur_cb(callback){const func=GodotRuntime.get_func(callback);GodotEventListeners.add(window,"blur",function(){func()},false)}function _godot_js_display_window_icon_set(p_ptr,p_len){let link=document.getElementById("-gd-engine-icon");const old_icon=GodotDisplay.window_icon;if(p_ptr){if(link===null){link=document.createElement("link");link.rel="icon";link.id="-gd-engine-icon";document.head.appendChild(link)}const png=new Blob([GodotRuntime.heapSlice(HEAPU8,p_ptr,p_len)],{type:"image/png"});GodotDisplay.window_icon=URL.createObjectURL(png);link.href=GodotDisplay.window_icon}else{if(link){link.remove()}GodotDisplay.window_icon=null}if(old_icon){URL.revokeObjectURL(old_icon)}}function _godot_js_display_window_size_get(p_width,p_height){GodotRuntime.setHeapValue(p_width,GodotConfig.canvas.width,"i32");GodotRuntime.setHeapValue(p_height,GodotConfig.canvas.height,"i32")}function _godot_js_display_window_title_set(p_data){document.title=GodotRuntime.parseString(p_data)}function _godot_js_emscripten_get_version(){const emscriptenVersionPtr=GodotRuntime.allocString("4.0.20");return emscriptenVersionPtr}function _godot_js_eval(p_js,p_use_global_ctx,p_union_ptr,p_byte_arr,p_byte_arr_write,p_callback){const js_code=GodotRuntime.parseString(p_js);let eval_ret=null;try{if(p_use_global_ctx){const global_eval=eval;eval_ret=global_eval(js_code)}else{eval_ret=eval(js_code)}}catch(e){GodotRuntime.error(e)}switch(typeof eval_ret){case"boolean":GodotRuntime.setHeapValue(p_union_ptr,eval_ret,"i32");return 1;case"number":GodotRuntime.setHeapValue(p_union_ptr,eval_ret,"double");return 3;case"string":GodotRuntime.setHeapValue(p_union_ptr,GodotRuntime.allocString(eval_ret),"*");return 4;case"object":if(eval_ret===null){break}if(ArrayBuffer.isView(eval_ret)&&!(eval_ret instanceof Uint8Array)){eval_ret=new Uint8Array(eval_ret.buffer)}else if(eval_ret instanceof ArrayBuffer){eval_ret=new Uint8Array(eval_ret)}if(eval_ret instanceof Uint8Array){const func=GodotRuntime.get_func(p_callback);const bytes_ptr=func(p_byte_arr,p_byte_arr_write,eval_ret.length);HEAPU8.set(eval_ret,bytes_ptr);return 29}break}return 0}var IDHandler={_last_id:0,_references:{},get:function(p_id){return IDHandler._references[p_id]},add:function(p_data){const id=++IDHandler._last_id;IDHandler._references[id]=p_data;return id},remove:function(p_id){delete IDHandler._references[p_id]}};var GodotFetch={onread:function(id,result){const obj=IDHandler.get(id);if(!obj){return}if(result.value){obj.chunks.push(result.value)}obj.reading=false;obj.done=result.done},onresponse:function(id,response){const obj=IDHandler.get(id);if(!obj){return}let chunked=false;response.headers.forEach(function(value,header){const v=value.toLowerCase().trim();const h=header.toLowerCase().trim();if(h==="transfer-encoding"&&v==="chunked"){chunked=true}});obj.status=response.status;obj.response=response;obj.reader=response.body?.getReader();obj.chunked=chunked},onerror:function(id,err){GodotRuntime.error(err);const obj=IDHandler.get(id);if(!obj){return}obj.error=err},create:function(method,url,headers,body){const obj={request:null,response:null,reader:null,error:null,done:false,reading:false,status:0,chunks:[]};const id=IDHandler.add(obj);const init={method,headers,body};obj.request=fetch(url,init);obj.request.then(GodotFetch.onresponse.bind(null,id)).catch(GodotFetch.onerror.bind(null,id));return id},free:function(id){const obj=IDHandler.get(id);if(!obj){return}IDHandler.remove(id);if(!obj.request){return}obj.request.then(function(response){response.abort()}).catch(function(e){})},read:function(id){const obj=IDHandler.get(id);if(!obj){return}if(obj.reader&&!obj.reading){if(obj.done){obj.reader=null;return}obj.reading=true;obj.reader.read().then(GodotFetch.onread.bind(null,id)).catch(GodotFetch.onerror.bind(null,id))}else if(obj.reader==null&&obj.response.body==null){obj.reading=true;GodotFetch.onread(id,{value:undefined,done:true})}}};function _godot_js_fetch_create(p_method,p_url,p_headers,p_headers_size,p_body,p_body_size){const method=GodotRuntime.parseString(p_method);const url=GodotRuntime.parseString(p_url);const headers=GodotRuntime.parseStringArray(p_headers,p_headers_size);const body=p_body_size?GodotRuntime.heapSlice(HEAP8,p_body,p_body_size):null;return GodotFetch.create(method,url,headers.map(function(hv){const idx=hv.indexOf(":");if(idx<=0){return[]}return[hv.slice(0,idx).trim(),hv.slice(idx+1).trim()]}).filter(function(v){return v.length===2}),body)}function _godot_js_fetch_free(id){GodotFetch.free(id)}function _godot_js_fetch_http_status_get(p_id){const obj=IDHandler.get(p_id);if(!obj||!obj.response){return 0}return obj.status}function _godot_js_fetch_is_chunked(p_id){const obj=IDHandler.get(p_id);if(!obj||!obj.response){return-1}return obj.chunked?1:0}function _godot_js_fetch_read_chunk(p_id,p_buf,p_buf_size){const obj=IDHandler.get(p_id);if(!obj||!obj.response){return 0}let to_read=p_buf_size;const chunks=obj.chunks;while(to_read&&chunks.length){const chunk=obj.chunks[0];if(chunk.length>to_read){GodotRuntime.heapCopy(HEAP8,chunk.slice(0,to_read),p_buf);chunks[0]=chunk.slice(to_read);to_read=0}else{GodotRuntime.heapCopy(HEAP8,chunk,p_buf);to_read-=chunk.length;chunks.pop()}}if(!chunks.length){GodotFetch.read(p_id)}return p_buf_size-to_read}function _godot_js_fetch_read_headers(p_id,p_parse_cb,p_ref){const obj=IDHandler.get(p_id);if(!obj||!obj.response){return 1}const cb=GodotRuntime.get_func(p_parse_cb);const arr=[];obj.response.headers.forEach(function(v,h){arr.push(`${h}:${v}`)});const c_ptr=GodotRuntime.allocStringArray(arr);cb(arr.length,c_ptr,p_ref);GodotRuntime.freeStringArray(c_ptr,arr.length);return 0}function _godot_js_fetch_state_get(p_id){const obj=IDHandler.get(p_id);if(!obj){return-1}if(obj.error){return-1}if(!obj.response){return 0}if(obj.reader||obj.response.body==null&&!obj.done){return 1}if(obj.done){return 2}return-1}function _godot_js_input_drop_files_cb(callback){const func=GodotRuntime.get_func(callback);const dropFiles=function(files){const args=files||[];if(!args.length){return}const argc=args.length;const argv=GodotRuntime.allocStringArray(args);func(argv,argc);GodotRuntime.freeStringArray(argv,argc)};const canvas=GodotConfig.canvas;GodotEventListeners.add(canvas,"dragover",function(ev){ev.preventDefault()},false);GodotEventListeners.add(canvas,"drop",GodotInputDragDrop.handler(dropFiles))}function _godot_js_input_gamepad_cb(change_cb){const onchange=GodotRuntime.get_func(change_cb);GodotInputGamepads.init(onchange)}function _godot_js_input_gamepad_sample(){GodotInputGamepads.sample();return 0}function _godot_js_input_gamepad_sample_count(){return GodotInputGamepads.get_samples().length}function _godot_js_input_gamepad_sample_get(p_index,r_btns,r_btns_num,r_axes,r_axes_num,r_standard){const sample=GodotInputGamepads.get_sample(p_index);if(!sample||!sample.connected){return 1}const btns=sample.buttons;const btns_len=btns.length<16?btns.length:16;for(let i=0;i<btns_len;i++){GodotRuntime.setHeapValue(r_btns+(i<<2),btns[i],"float")}GodotRuntime.setHeapValue(r_btns_num,btns_len,"i32");const axes=sample.axes;const axes_len=axes.length<10?axes.length:10;for(let i=0;i<axes_len;i++){GodotRuntime.setHeapValue(r_axes+(i<<2),axes[i],"float")}GodotRuntime.setHeapValue(r_axes_num,axes_len,"i32");const is_standard=sample.standard?1:0;GodotRuntime.setHeapValue(r_standard,is_standard,"i32");return 0}var _godot_js_input_key_cb=function(pCallback,pCodePtr,pKeyPtr){GodotInput.inputKeyCallback=GodotRuntime.get_func(pCallback);GodotInput.setInputKeyData=(pCode,pKey)=>{GodotRuntime.stringToHeap(pCode,pCodePtr,32);GodotRuntime.stringToHeap(pKey,pKeyPtr,32)};GodotEventListeners.add(GodotConfig.canvas,"keydown",GodotInput.onKeyEvent.bind(null,true),false);GodotEventListeners.add(GodotConfig.canvas,"keyup",GodotInput.onKeyEvent.bind(null,false),false)};function _godot_js_input_mouse_button_cb(callback){const func=GodotRuntime.get_func(callback);const canvas=GodotConfig.canvas;function button_cb(p_pressed,evt){const rect=canvas.getBoundingClientRect();const pos=GodotInput.computePosition(evt,rect);const modifiers=GodotInput.getModifiers(evt);if(p_pressed){GodotConfig.canvas.focus()}if(func(p_pressed,evt.button,pos[0],pos[1],modifiers)){evt.preventDefault()}}GodotEventListeners.add(canvas,"mousedown",button_cb.bind(null,1),false);GodotEventListeners.add(window,"mouseup",button_cb.bind(null,0),false)}function _godot_js_input_mouse_move_cb(callback){const func=GodotRuntime.get_func(callback);const canvas=GodotConfig.canvas;function move_cb(evt){const rect=canvas.getBoundingClientRect();const pos=GodotInput.computePosition(evt,rect);const rw=canvas.width/rect.width;const rh=canvas.height/rect.height;const rel_pos_x=evt.movementX*rw;const rel_pos_y=evt.movementY*rh;const modifiers=GodotInput.getModifiers(evt);func(pos[0],pos[1],rel_pos_x,rel_pos_y,modifiers,evt.pressure)}GodotEventListeners.add(window,"pointermove",move_cb,false)}function _godot_js_input_mouse_wheel_cb(callback){const func=GodotRuntime.get_func(callback);function wheel_cb(evt){if(func(evt.deltaMode,evt.deltaX??0,evt.deltaY??0)){evt.preventDefault()}}GodotEventListeners.add(GodotConfig.canvas,"wheel",wheel_cb,false)}function _godot_js_input_paste_cb(callback){const func=GodotRuntime.get_func(callback);GodotEventListeners.add(window,"paste",function(evt){const text=evt.clipboardData.getData("text");const ptr=GodotRuntime.allocString(text);func(ptr);GodotRuntime.free(ptr)},false)}function _godot_js_input_touch_cb(callback,ids,coords){const func=GodotRuntime.get_func(callback);const canvas=GodotConfig.canvas;function touch_cb(type,evt){if(type===0){GodotConfig.canvas.focus()}const rect=canvas.getBoundingClientRect();const touches=evt.changedTouches;for(let i=0;i<touches.length;i++){const touch=touches[i];const pos=GodotInput.computePosition(touch,rect);GodotRuntime.setHeapValue(coords+i*2*8,pos[0],"double");GodotRuntime.setHeapValue(coords+(i*2+1)*8,pos[1],"double");GodotRuntime.setHeapValue(ids+i*4,touch.identifier,"i32")}func(type,touches.length);if(evt.cancelable){evt.preventDefault()}}GodotEventListeners.add(canvas,"touchstart",touch_cb.bind(null,0),false);GodotEventListeners.add(canvas,"touchend",touch_cb.bind(null,1),false);GodotEventListeners.add(canvas,"touchcancel",touch_cb.bind(null,1),false);GodotEventListeners.add(canvas,"touchmove",touch_cb.bind(null,2),false)}function _godot_js_input_vibrate_handheld(p_duration_ms){if(typeof navigator.vibrate!=="function"){GodotRuntime.print("This browser does not support vibration.")}else{navigator.vibrate(p_duration_ms)}}function _godot_js_is_ime_focused(){return GodotIME.active}function _godot_js_os_download_buffer(p_ptr,p_size,p_name,p_mime){const buf=GodotRuntime.heapSlice(HEAP8,p_ptr,p_size);const name=GodotRuntime.parseString(p_name);const mime=GodotRuntime.parseString(p_mime);const blob=new Blob([buf],{type:mime});const url=window.URL.createObjectURL(blob);const a=document.createElement("a");a.href=url;a.download=name;a.style.display="none";document.body.appendChild(a);a.click();a.remove();window.URL.revokeObjectURL(url)}function _godot_js_os_execute(p_json){const json_args=GodotRuntime.parseString(p_json);const args=JSON.parse(json_args);if(GodotConfig.on_execute){GodotConfig.on_execute(args);return 0}return 1}function _godot_js_os_finish_async(p_callback){const func=GodotRuntime.get_func(p_callback);GodotOS.finish_async(func)}function _godot_js_os_fs_is_persistent(){return GodotFS.is_persistent()}function _godot_js_os_fs_sync(callback){const func=GodotRuntime.get_func(callback);GodotOS._fs_sync_promise=GodotFS.sync();GodotOS._fs_sync_promise.then(function(err){func()})}function _godot_js_os_has_feature(p_ftr){const ftr=GodotRuntime.parseString(p_ftr);const ua=navigator.userAgent;if(ftr==="web_macos"){return ua.indexOf("Mac")!==-1?1:0}if(ftr==="web_windows"){return ua.indexOf("Windows")!==-1?1:0}if(ftr==="web_android"){return ua.indexOf("Android")!==-1?1:0}if(ftr==="web_ios"){return ua.indexOf("iPhone")!==-1||ua.indexOf("iPad")!==-1||ua.indexOf("iPod")!==-1?1:0}if(ftr==="web_linuxbsd"){return ua.indexOf("CrOS")!==-1||ua.indexOf("BSD")!==-1||ua.indexOf("Linux")!==-1||ua.indexOf("X11")!==-1?1:0}return 0}function _godot_js_os_hw_concurrency_get(){const concurrency=navigator.hardwareConcurrency||1;return concurrency<2?concurrency:2}function _godot_js_os_request_quit_cb(p_callback){GodotOS.request_quit=GodotRuntime.get_func(p_callback)}function _godot_js_os_shell_open(p_uri){window.open(GodotRuntime.parseString(p_uri),"_blank")}var GodotPWA={hasUpdate:false,updateState:function(cb,reg){if(!reg){return}if(!reg.active){return}if(reg.waiting){GodotPWA.hasUpdate=true;cb()}GodotEventListeners.add(reg,"updatefound",function(){const installing=reg.installing;GodotEventListeners.add(installing,"statechange",function(){if(installing.state==="installed"){GodotPWA.hasUpdate=true;cb()}})})}};function _godot_js_pwa_cb(p_update_cb){if("serviceWorker"in navigator){try{const cb=GodotRuntime.get_func(p_update_cb);navigator.serviceWorker.getRegistration().then(GodotPWA.updateState.bind(null,cb))}catch(e){GodotRuntime.error("Failed to assign PWA callback",e)}}}function _godot_js_pwa_update(){if("serviceWorker"in navigator&&GodotPWA.hasUpdate){try{navigator.serviceWorker.getRegistration().then(function(reg){if(!reg||!reg.waiting){return}reg.waiting.postMessage("update")})}catch(e){GodotRuntime.error(e);return 1}return 0}return 1}var GodotRTCDataChannel={connect:function(p_id,p_on_open,p_on_message,p_on_error,p_on_close){const ref=IDHandler.get(p_id);if(!ref){return}ref.binaryType="arraybuffer";ref.onopen=function(event){p_on_open()};ref.onclose=function(event){p_on_close()};ref.onerror=function(event){p_on_error()};ref.onmessage=function(event){let buffer;let is_string=0;if(event.data instanceof ArrayBuffer){buffer=new Uint8Array(event.data)}else if(event.data instanceof Blob){GodotRuntime.error("Blob type not supported");return}else if(typeof event.data==="string"){is_string=1;const enc=new TextEncoder("utf-8");buffer=new Uint8Array(enc.encode(event.data))}else{GodotRuntime.error("Unknown message type");return}const len=buffer.length*buffer.BYTES_PER_ELEMENT;const out=GodotRuntime.malloc(len);HEAPU8.set(buffer,out);p_on_message(out,len,is_string);GodotRuntime.free(out)}},close:function(p_id){const ref=IDHandler.get(p_id);if(!ref){return}ref.onopen=null;ref.onmessage=null;ref.onerror=null;ref.onclose=null;ref.close()},get_prop:function(p_id,p_prop,p_def){const ref=IDHandler.get(p_id);return ref&&ref[p_prop]!==undefined?ref[p_prop]:p_def}};function _godot_js_rtc_datachannel_close(p_id){const ref=IDHandler.get(p_id);if(!ref){return}GodotRTCDataChannel.close(p_id)}function _godot_js_rtc_datachannel_connect(p_id,p_ref,p_on_open,p_on_message,p_on_error,p_on_close){const onopen=GodotRuntime.get_func(p_on_open).bind(null,p_ref);const onmessage=GodotRuntime.get_func(p_on_message).bind(null,p_ref);const onerror=GodotRuntime.get_func(p_on_error).bind(null,p_ref);const onclose=GodotRuntime.get_func(p_on_close).bind(null,p_ref);GodotRTCDataChannel.connect(p_id,onopen,onmessage,onerror,onclose)}function _godot_js_rtc_datachannel_destroy(p_id){GodotRTCDataChannel.close(p_id);IDHandler.remove(p_id)}function _godot_js_rtc_datachannel_get_buffered_amount(p_id){return GodotRTCDataChannel.get_prop(p_id,"bufferedAmount",0)}function _godot_js_rtc_datachannel_id_get(p_id){return GodotRTCDataChannel.get_prop(p_id,"id",65535)}function _godot_js_rtc_datachannel_is_negotiated(p_id){return GodotRTCDataChannel.get_prop(p_id,"negotiated",65535)}function _godot_js_rtc_datachannel_is_ordered(p_id){return GodotRTCDataChannel.get_prop(p_id,"ordered",true)}function _godot_js_rtc_datachannel_label_get(p_id){const ref=IDHandler.get(p_id);if(!ref||!ref.label){return 0}return GodotRuntime.allocString(ref.label)}function _godot_js_rtc_datachannel_max_packet_lifetime_get(p_id){const ref=IDHandler.get(p_id);if(!ref){return 65535}if(ref["maxPacketLifeTime"]!==undefined){return ref["maxPacketLifeTime"]}else if(ref["maxRetransmitTime"]!==undefined){return ref["maxRetransmitTime"]}return 65535}function _godot_js_rtc_datachannel_max_retransmits_get(p_id){return GodotRTCDataChannel.get_prop(p_id,"maxRetransmits",65535)}function _godot_js_rtc_datachannel_protocol_get(p_id){const ref=IDHandler.get(p_id);if(!ref||!ref.protocol){return 0}return GodotRuntime.allocString(ref.protocol)}function _godot_js_rtc_datachannel_ready_state_get(p_id){const ref=IDHandler.get(p_id);if(!ref){return 3}switch(ref.readyState){case"connecting":return 0;case"open":return 1;case"closing":return 2;case"closed":default:return 3}}function _godot_js_rtc_datachannel_send(p_id,p_buffer,p_length,p_raw){const ref=IDHandler.get(p_id);if(!ref){return 1}const bytes_array=new Uint8Array(p_length);for(let i=0;i<p_length;i++){bytes_array[i]=GodotRuntime.getHeapValue(p_buffer+i,"i8")}if(p_raw){ref.send(bytes_array.buffer)}else{const string=new TextDecoder("utf-8").decode(bytes_array);ref.send(string)}return 0}var GodotRTCPeerConnection={ConnectionState:{new:0,connecting:1,connected:2,disconnected:3,failed:4,closed:5},ConnectionStateCompat:{new:0,checking:1,connected:2,completed:2,disconnected:3,failed:4,closed:5},IceGatheringState:{new:0,gathering:1,complete:2},SignalingState:{stable:0,"have-local-offer":1,"have-remote-offer":2,"have-local-pranswer":3,"have-remote-pranswer":4,closed:5},create:function(config,onConnectionChange,onSignalingChange,onIceGatheringChange,onIceCandidate,onDataChannel){let conn=null;try{conn=new RTCPeerConnection(config)}catch(e){GodotRuntime.error(e);return 0}const id=IDHandler.add(conn);if("connectionState"in conn&&conn["connectionState"]!==undefined){conn.onconnectionstatechange=function(event){if(!IDHandler.get(id)){return}onConnectionChange(GodotRTCPeerConnection.ConnectionState[conn.connectionState]||0)}}else{conn.oniceconnectionstatechange=function(event){if(!IDHandler.get(id)){return}onConnectionChange(GodotRTCPeerConnection.ConnectionStateCompat[conn.iceConnectionState]||0)}}conn.onicegatheringstatechange=function(event){if(!IDHandler.get(id)){return}onIceGatheringChange(GodotRTCPeerConnection.IceGatheringState[conn.iceGatheringState]||0)};conn.onsignalingstatechange=function(event){if(!IDHandler.get(id)){return}onSignalingChange(GodotRTCPeerConnection.SignalingState[conn.signalingState]||0)};conn.onicecandidate=function(event){if(!IDHandler.get(id)){return}const c=event.candidate;if(!c||!c.candidate){return}const candidate_str=GodotRuntime.allocString(c.candidate);const mid_str=GodotRuntime.allocString(c.sdpMid);onIceCandidate(mid_str,c.sdpMLineIndex,candidate_str);GodotRuntime.free(candidate_str);GodotRuntime.free(mid_str)};conn.ondatachannel=function(event){if(!IDHandler.get(id)){return}const cid=IDHandler.add(event.channel);onDataChannel(cid)};return id},destroy:function(p_id){const conn=IDHandler.get(p_id);if(!conn){return}conn.onconnectionstatechange=null;conn.oniceconnectionstatechange=null;conn.onicegatheringstatechange=null;conn.onsignalingstatechange=null;conn.onicecandidate=null;conn.ondatachannel=null;IDHandler.remove(p_id)},onsession:function(p_id,callback,session){if(!IDHandler.get(p_id)){return}const type_str=GodotRuntime.allocString(session.type);const sdp_str=GodotRuntime.allocString(session.sdp);callback(type_str,sdp_str);GodotRuntime.free(type_str);GodotRuntime.free(sdp_str)},onerror:function(p_id,callback,error){const ref=IDHandler.get(p_id);if(!ref){return}GodotRuntime.error(error);callback()}};function _godot_js_rtc_pc_close(p_id){const ref=IDHandler.get(p_id);if(!ref){return}ref.close()}function _godot_js_rtc_pc_create(p_config,p_ref,p_on_connection_state_change,p_on_ice_gathering_state_change,p_on_signaling_state_change,p_on_ice_candidate,p_on_datachannel){const wrap=function(p_func){return GodotRuntime.get_func(p_func).bind(null,p_ref)};return GodotRTCPeerConnection.create(JSON.parse(GodotRuntime.parseString(p_config)),wrap(p_on_connection_state_change),wrap(p_on_signaling_state_change),wrap(p_on_ice_gathering_state_change),wrap(p_on_ice_candidate),wrap(p_on_datachannel))}function _godot_js_rtc_pc_datachannel_create(p_id,p_label,p_config){try{const ref=IDHandler.get(p_id);if(!ref){return 0}const label=GodotRuntime.parseString(p_label);const config=JSON.parse(GodotRuntime.parseString(p_config));const channel=ref.createDataChannel(label,config);return IDHandler.add(channel)}catch(e){GodotRuntime.error(e);return 0}}function _godot_js_rtc_pc_destroy(p_id){GodotRTCPeerConnection.destroy(p_id)}function _godot_js_rtc_pc_ice_candidate_add(p_id,p_mid_name,p_mline_idx,p_sdp){const ref=IDHandler.get(p_id);if(!ref){return}const sdpMidName=GodotRuntime.parseString(p_mid_name);const sdpName=GodotRuntime.parseString(p_sdp);ref.addIceCandidate(new RTCIceCandidate({candidate:sdpName,sdpMid:sdpMidName,sdpMlineIndex:p_mline_idx}))}function _godot_js_rtc_pc_local_description_set(p_id,p_type,p_sdp,p_obj,p_on_error){const ref=IDHandler.get(p_id);if(!ref){return}const type=GodotRuntime.parseString(p_type);const sdp=GodotRuntime.parseString(p_sdp);const onerror=GodotRuntime.get_func(p_on_error).bind(null,p_obj);ref.setLocalDescription({sdp,type}).catch(function(error){GodotRTCPeerConnection.onerror(p_id,onerror,error)})}function _godot_js_rtc_pc_offer_create(p_id,p_obj,p_on_session,p_on_error){const ref=IDHandler.get(p_id);if(!ref){return}const onsession=GodotRuntime.get_func(p_on_session).bind(null,p_obj);const onerror=GodotRuntime.get_func(p_on_error).bind(null,p_obj);ref.createOffer().then(function(session){GodotRTCPeerConnection.onsession(p_id,onsession,session)}).catch(function(error){GodotRTCPeerConnection.onerror(p_id,onerror,error)})}function _godot_js_rtc_pc_remote_description_set(p_id,p_type,p_sdp,p_obj,p_session_created,p_on_error){const ref=IDHandler.get(p_id);if(!ref){return}const type=GodotRuntime.parseString(p_type);const sdp=GodotRuntime.parseString(p_sdp);const onerror=GodotRuntime.get_func(p_on_error).bind(null,p_obj);const onsession=GodotRuntime.get_func(p_session_created).bind(null,p_obj);ref.setRemoteDescription({sdp,type}).then(function(){if(type!=="offer"){return Promise.resolve()}return ref.createAnswer().then(function(session){GodotRTCPeerConnection.onsession(p_id,onsession,session)})}).catch(function(error){GodotRTCPeerConnection.onerror(p_id,onerror,error)})}function _godot_js_set_ime_active(p_active){GodotIME.ime_active(p_active)}function _godot_js_set_ime_cb(p_ime_cb,p_key_cb,code,key){const ime_cb=GodotRuntime.get_func(p_ime_cb);const key_cb=GodotRuntime.get_func(p_key_cb);GodotIME.init(ime_cb,key_cb,code,key)}function _godot_js_set_ime_position(p_x,p_y){GodotIME.ime_position(p_x,p_y)}function _godot_js_tts_get_voices(p_callback){const func=GodotRuntime.get_func(p_callback);try{const arr=[];const voices=window.speechSynthesis.getVoices();for(let i=0;i<voices.length;i++){arr.push(`${voices[i].lang};${voices[i].name}`)}const c_ptr=GodotRuntime.allocStringArray(arr);func(arr.length,c_ptr);GodotRuntime.freeStringArray(c_ptr,arr.length)}catch(e){}}function _godot_js_tts_is_paused(){return window.speechSynthesis.paused}function _godot_js_tts_is_speaking(){return window.speechSynthesis.speaking}function _godot_js_tts_pause(){window.speechSynthesis.pause()}function _godot_js_tts_resume(){window.speechSynthesis.resume()}function _godot_js_tts_speak(p_text,p_voice,p_volume,p_pitch,p_rate,p_utterance_id,p_callback){const func=GodotRuntime.get_func(p_callback);function listener_end(evt){evt.currentTarget.cb(1,evt.currentTarget.id,0)}function listener_start(evt){evt.currentTarget.cb(0,evt.currentTarget.id,0)}function listener_error(evt){evt.currentTarget.cb(2,evt.currentTarget.id,0)}function listener_bound(evt){evt.currentTarget.cb(3,evt.currentTarget.id,evt.charIndex)}const utterance=new SpeechSynthesisUtterance(GodotRuntime.parseString(p_text));utterance.rate=p_rate;utterance.pitch=p_pitch;utterance.volume=p_volume/100;utterance.addEventListener("end",listener_end);utterance.addEventListener("start",listener_start);utterance.addEventListener("error",listener_error);utterance.addEventListener("boundary",listener_bound);utterance.id=p_utterance_id;utterance.cb=func;const voice=GodotRuntime.parseString(p_voice);const voices=window.speechSynthesis.getVoices();for(let i=0;i<voices.length;i++){if(voices[i].name===voice){utterance.voice=voices[i];break}}window.speechSynthesis.resume();window.speechSynthesis.speak(utterance)}function _godot_js_tts_stop(){window.speechSynthesis.cancel();window.speechSynthesis.resume()}var GodotWebMidi={abortControllers:[],isListening:false};function _godot_js_webmidi_close_midi_inputs(){for(const abortController of GodotWebMidi.abortControllers){abortController.abort()}GodotWebMidi.abortControllers=[];GodotWebMidi.isListening=false}function _godot_js_webmidi_open_midi_inputs(pSetInputNamesCb,pOnMidiMessageCb,pDataBuffer,dataBufferLen){if(GodotWebMidi.is_listening){return 0}if(!navigator.requestMIDIAccess){return 2}const setInputNamesCb=GodotRuntime.get_func(pSetInputNamesCb);const onMidiMessageCb=GodotRuntime.get_func(pOnMidiMessageCb);GodotWebMidi.isListening=true;navigator.requestMIDIAccess().then(midi=>{const inputs=[...midi.inputs.values()];const inputNames=inputs.map(input=>input.name);const c_ptr=GodotRuntime.allocStringArray(inputNames);setInputNamesCb(inputNames.length,c_ptr);GodotRuntime.freeStringArray(c_ptr,inputNames.length);inputs.forEach((input,i)=>{const abortController=new AbortController;GodotWebMidi.abortControllers.push(abortController);input.addEventListener("midimessage",event=>{const status=event.data[0];const data=event.data.slice(1);const size=data.length;if(size>dataBufferLen){throw new Error(`data too big ${size} > ${dataBufferLen}`)}HEAPU8.set(data,pDataBuffer);onMidiMessageCb(i,status,pDataBuffer,data.length)},{signal:abortController.signal})})});return 0}var GodotWebSocket={_onopen:function(p_id,callback,event){const ref=IDHandler.get(p_id);if(!ref){return}const c_str=GodotRuntime.allocString(ref.protocol);callback(c_str);GodotRuntime.free(c_str)},_onmessage:function(p_id,callback,event){const ref=IDHandler.get(p_id);if(!ref){return}let buffer;let is_string=0;if(event.data instanceof ArrayBuffer){buffer=new Uint8Array(event.data)}else if(event.data instanceof Blob){GodotRuntime.error("Blob type not supported");return}else if(typeof event.data==="string"){is_string=1;buffer=new TextEncoder("utf-8").encode(event.data)}else{GodotRuntime.error("Unknown message type");return}const len=buffer.length*buffer.BYTES_PER_ELEMENT;const out=GodotRuntime.malloc(len);HEAPU8.set(buffer,out);callback(out,len,is_string);GodotRuntime.free(out)},_onerror:function(p_id,callback,event){const ref=IDHandler.get(p_id);if(!ref){return}callback()},_onclose:function(p_id,callback,event){const ref=IDHandler.get(p_id);if(!ref){return}const c_str=GodotRuntime.allocString(event.reason);callback(event.code,c_str,event.wasClean?1:0);GodotRuntime.free(c_str)},send:function(p_id,p_data){const ref=IDHandler.get(p_id);if(!ref||ref.readyState!==ref.OPEN){return 1}ref.send(p_data);return 0},bufferedAmount:function(p_id){const ref=IDHandler.get(p_id);if(!ref){return 0}return ref.bufferedAmount},create:function(socket,p_on_open,p_on_message,p_on_error,p_on_close){const id=IDHandler.add(socket);socket.onopen=GodotWebSocket._onopen.bind(null,id,p_on_open);socket.onmessage=GodotWebSocket._onmessage.bind(null,id,p_on_message);socket.onerror=GodotWebSocket._onerror.bind(null,id,p_on_error);socket.onclose=GodotWebSocket._onclose.bind(null,id,p_on_close);return id},close:function(p_id,p_code,p_reason){const ref=IDHandler.get(p_id);if(ref&&ref.readyState<ref.CLOSING){const code=p_code;const reason=p_reason;ref.close(code,reason)}},destroy:function(p_id){const ref=IDHandler.get(p_id);if(!ref){return}GodotWebSocket.close(p_id,3001,"destroyed");IDHandler.remove(p_id);ref.onopen=null;ref.onmessage=null;ref.onerror=null;ref.onclose=null}};function _godot_js_websocket_buffered_amount(p_id){return GodotWebSocket.bufferedAmount(p_id)}function _godot_js_websocket_close(p_id,p_code,p_reason){const code=p_code;const reason=GodotRuntime.parseString(p_reason);GodotWebSocket.close(p_id,code,reason)}function _godot_js_websocket_create(p_ref,p_url,p_proto,p_on_open,p_on_message,p_on_error,p_on_close){const on_open=GodotRuntime.get_func(p_on_open).bind(null,p_ref);const on_message=GodotRuntime.get_func(p_on_message).bind(null,p_ref);const on_error=GodotRuntime.get_func(p_on_error).bind(null,p_ref);const on_close=GodotRuntime.get_func(p_on_close).bind(null,p_ref);const url=GodotRuntime.parseString(p_url);const protos=GodotRuntime.parseString(p_proto);let socket=null;try{if(protos){socket=new WebSocket(url,protos.split(","))}else{socket=new WebSocket(url)}}catch(e){return 0}socket.binaryType="arraybuffer";return GodotWebSocket.create(socket,on_open,on_message,on_error,on_close)}function _godot_js_websocket_destroy(p_id){GodotWebSocket.destroy(p_id)}function _godot_js_websocket_send(p_id,p_buf,p_buf_len,p_raw){const bytes_array=new Uint8Array(p_buf_len);let i=0;for(i=0;i<p_buf_len;i++){bytes_array[i]=GodotRuntime.getHeapValue(p_buf+i,"i8")}let out=bytes_array.buffer;if(!p_raw){out=new TextDecoder("utf-8").decode(bytes_array)}return GodotWebSocket.send(p_id,out)}var GodotJSWrapper={proxies:null,cb_ret:null,MyProxy:function(val){const id=IDHandler.add(this);GodotJSWrapper.proxies.set(val,id);let refs=1;this.ref=function(){refs++};this.unref=function(){refs--;if(refs===0){IDHandler.remove(id);GodotJSWrapper.proxies.delete(val)}};this.get_val=function(){return val};this.get_id=function(){return id}},get_proxied:function(val){const id=GodotJSWrapper.proxies.get(val);if(id===undefined){const proxy=new GodotJSWrapper.MyProxy(val);return proxy.get_id()}IDHandler.get(id).ref();return id},get_proxied_value:function(id){const proxy=IDHandler.get(id);if(proxy===undefined){return undefined}return proxy.get_val()},variant2js:function(type,val){switch(type){case 0:return null;case 1:return Boolean(GodotRuntime.getHeapValue(val,"i64"));case 2:{const heap_value=GodotRuntime.getHeapValue(val,"i64");return heap_value>=Number.MIN_SAFE_INTEGER&&heap_value<=Number.MAX_SAFE_INTEGER?Number(heap_value):heap_value}case 3:return Number(GodotRuntime.getHeapValue(val,"double"));case 4:return GodotRuntime.parseString(GodotRuntime.getHeapValue(val,"*"));case 24:return GodotJSWrapper.get_proxied_value(GodotRuntime.getHeapValue(val,"i64"));default:return undefined}},js2variant:function(p_val,p_exchange){if(p_val===undefined||p_val===null){return 0}const type=typeof p_val;if(type==="boolean"){GodotRuntime.setHeapValue(p_exchange,p_val,"i64");return 1}else if(type==="number"){if(Number.isInteger(p_val)){GodotRuntime.setHeapValue(p_exchange,p_val,"i64");return 2}GodotRuntime.setHeapValue(p_exchange,p_val,"double");return 3}else if(type==="bigint"){GodotRuntime.setHeapValue(p_exchange,p_val,"i64");return 2}else if(type==="string"){const c_str=GodotRuntime.allocString(p_val);GodotRuntime.setHeapValue(p_exchange,c_str,"*");return 4}const id=GodotJSWrapper.get_proxied(p_val);GodotRuntime.setHeapValue(p_exchange,id,"i64");return 24},isBuffer:function(obj){return obj instanceof ArrayBuffer||ArrayBuffer.isView(obj)}};function _godot_js_wrapper_create_cb(p_ref,p_func){const func=GodotRuntime.get_func(p_func);let id=0;const cb=function(){if(!GodotJSWrapper.get_proxied_value(id)){return undefined}GodotJSWrapper.cb_ret=null;const args=Array.from(arguments);const argsProxy=new GodotJSWrapper.MyProxy(args);func(p_ref,argsProxy.get_id(),args.length);argsProxy.unref();const ret=GodotJSWrapper.cb_ret;GodotJSWrapper.cb_ret=null;return ret};id=GodotJSWrapper.get_proxied(cb);return id}function _godot_js_wrapper_create_object(p_object,p_args,p_argc,p_convert_callback,p_exchange,p_lock,p_free_lock_callback){const name=GodotRuntime.parseString(p_object);if(typeof window[name]==="undefined"){return-1}const convert=GodotRuntime.get_func(p_convert_callback);const freeLock=GodotRuntime.get_func(p_free_lock_callback);const args=new Array(p_argc);for(let i=0;i<p_argc;i++){const type=convert(p_args,i,p_exchange,p_lock);const lock=GodotRuntime.getHeapValue(p_lock,"*");args[i]=GodotJSWrapper.variant2js(type,p_exchange);if(lock){freeLock(p_lock,type)}}try{const res=new window[name](...args);return GodotJSWrapper.js2variant(res,p_exchange)}catch(e){GodotRuntime.error(`Error calling constructor ${name} with args:`,args,"error:",e);return-1}}function _godot_js_wrapper_interface_get(p_name){const name=GodotRuntime.parseString(p_name);if(typeof window[name]!=="undefined"){return GodotJSWrapper.get_proxied(window[name])}return 0}function _godot_js_wrapper_object_call(p_id,p_method,p_args,p_argc,p_convert_callback,p_exchange,p_lock,p_free_lock_callback){const obj=GodotJSWrapper.get_proxied_value(p_id);if(obj===undefined){return-1}const method=GodotRuntime.parseString(p_method);const convert=GodotRuntime.get_func(p_convert_callback);const freeLock=GodotRuntime.get_func(p_free_lock_callback);const args=new Array(p_argc);for(let i=0;i<p_argc;i++){const type=convert(p_args,i,p_exchange,p_lock);const lock=GodotRuntime.getHeapValue(p_lock,"*");args[i]=GodotJSWrapper.variant2js(type,p_exchange);if(lock){freeLock(p_lock,type)}}try{const res=obj[method](...args);return GodotJSWrapper.js2variant(res,p_exchange)}catch(e){GodotRuntime.error(`Error calling method ${method} on:`,obj,"error:",e);return-1}}function _godot_js_wrapper_object_get(p_id,p_exchange,p_prop){const obj=GodotJSWrapper.get_proxied_value(p_id);if(obj===undefined){return 0}if(p_prop){const prop=GodotRuntime.parseString(p_prop);try{return GodotJSWrapper.js2variant(obj[prop],p_exchange)}catch(e){GodotRuntime.error(`Error getting variable ${prop} on object`,obj);return 0}}return GodotJSWrapper.js2variant(obj,p_exchange)}function _godot_js_wrapper_object_getvar(p_id,p_type,p_exchange){const obj=GodotJSWrapper.get_proxied_value(p_id);if(obj===undefined){return-1}const prop=GodotJSWrapper.variant2js(p_type,p_exchange);if(prop===undefined||prop===null){return-1}try{return GodotJSWrapper.js2variant(obj[prop],p_exchange)}catch(e){GodotRuntime.error(`Error getting variable ${prop} on object`,obj,e);return-1}}function _godot_js_wrapper_object_is_buffer(p_id){const obj=GodotJSWrapper.get_proxied_value(p_id);return GodotJSWrapper.isBuffer(obj)?1:0}function _godot_js_wrapper_object_set(p_id,p_name,p_type,p_exchange){const obj=GodotJSWrapper.get_proxied_value(p_id);if(obj===undefined){return}const name=GodotRuntime.parseString(p_name);try{obj[name]=GodotJSWrapper.variant2js(p_type,p_exchange)}catch(e){GodotRuntime.error(`Error setting variable ${name} on object`,obj)}}function _godot_js_wrapper_object_set_cb_ret(p_val_type,p_val_ex){GodotJSWrapper.cb_ret=GodotJSWrapper.variant2js(p_val_type,p_val_ex)}function _godot_js_wrapper_object_setvar(p_id,p_key_type,p_key_ex,p_val_type,p_val_ex){const obj=GodotJSWrapper.get_proxied_value(p_id);if(obj===undefined){return-1}const key=GodotJSWrapper.variant2js(p_key_type,p_key_ex);try{obj[key]=GodotJSWrapper.variant2js(p_val_type,p_val_ex);return 0}catch(e){GodotRuntime.error(`Error setting variable ${key} on object`,obj);return-1}}function _godot_js_wrapper_object_transfer_buffer(p_id,p_byte_arr,p_byte_arr_write,p_callback){let obj=GodotJSWrapper.get_proxied_value(p_id);if(!GodotJSWrapper.isBuffer(obj)){return}if(ArrayBuffer.isView(obj)&&!(obj instanceof Uint8Array)){obj=new Uint8Array(obj.buffer)}else if(obj instanceof ArrayBuffer){obj=new Uint8Array(obj)}const resizePackedByteArrayAndOpenWrite=GodotRuntime.get_func(p_callback);const bytesPtr=resizePackedByteArrayAndOpenWrite(p_byte_arr,p_byte_arr_write,obj.length);HEAPU8.set(obj,bytesPtr)}function _godot_js_wrapper_object_unref(p_id){const proxy=IDHandler.get(p_id);if(proxy!==undefined){proxy.unref()}}function _godot_webgl2_glFramebufferTextureMultisampleMultiviewOVR(target,attachment,texture,level,samples,base_view_index,num_views){const context=GL.currentContext;if(typeof context.oculusMultiviewExt==="undefined"){const ext=context.GLctx.getExtension("OCULUS_multiview");if(!ext){GodotRuntime.error("Trying to call glFramebufferTextureMultisampleMultiviewOVR() without the OCULUS_multiview extension");return}context.oculusMultiviewExt=ext}const ext=context.oculusMultiviewExt;ext.framebufferTextureMultisampleMultiviewOVR(target,attachment,GL.textures[texture],level,samples,base_view_index,num_views)}function _godot_webgl2_glFramebufferTextureMultiviewOVR(target,attachment,texture,level,base_view_index,num_views){const context=GL.currentContext;if(typeof context.multiviewExt==="undefined"){const ext=context.GLctx.getExtension("OVR_multiview2");if(!ext){GodotRuntime.error("Trying to call glFramebufferTextureMultiviewOVR() without the OVR_multiview2 extension");return}context.multiviewExt=ext}const ext=context.multiviewExt;ext.framebufferTextureMultiviewOVR(target,attachment,GL.textures[texture],level,base_view_index,num_views)}function _godot_webgl2_glGetBufferSubData(target,offset,size,data){const gl_context_handle=_emscripten_webgl_get_current_context();const gl=GL.getContext(gl_context_handle);if(gl){gl.GLctx["getBufferSubData"](target,offset,HEAPU8,data,size)}}var GodotWebXR={gl:null,session:null,gl_binding:null,layer:null,space:null,frame:null,pose:null,view_count:1,input_sources:[,,,,,,,,,,,,,,,],touches:[,,,,],onsimpleevent:null,orig_requestAnimationFrame:null,requestAnimationFrame:callback=>{if(GodotWebXR.session&&GodotWebXR.space){const onFrame=function(time,frame){GodotWebXR.frame=frame;GodotWebXR.pose=frame.getViewerPose(GodotWebXR.space);callback(time);GodotWebXR.frame=null;GodotWebXR.pose=null};GodotWebXR.session.requestAnimationFrame(onFrame)}else{GodotWebXR.orig_requestAnimationFrame(callback)}},monkeyPatchRequestAnimationFrame:enable=>{if(GodotWebXR.orig_requestAnimationFrame===null){GodotWebXR.orig_requestAnimationFrame=MainLoop.requestAnimationFrame}MainLoop.requestAnimationFrame=enable?GodotWebXR.requestAnimationFrame:GodotWebXR.orig_requestAnimationFrame},pauseResumeMainLoop:()=>{MainLoop.pause();runtimeKeepalivePush();window.setTimeout(function(){runtimeKeepalivePop();MainLoop.resume()},0)},getLayer:()=>{const new_view_count=GodotWebXR.pose?GodotWebXR.pose.views.length:1;let layer=GodotWebXR.layer;if(layer&&GodotWebXR.view_count===new_view_count){return layer}if(!GodotWebXR.session||!GodotWebXR.gl_binding||!GodotWebXR.gl_binding.createProjectionLayer){return null}const gl=GodotWebXR.gl;layer=GodotWebXR.gl_binding.createProjectionLayer({textureType:new_view_count>1?"texture-array":"texture",colorFormat:gl.RGBA8,depthFormat:gl.DEPTH_COMPONENT24});GodotWebXR.session.updateRenderState({layers:[layer]});GodotWebXR.layer=layer;GodotWebXR.view_count=new_view_count;return layer},getSubImage:()=>{if(!GodotWebXR.pose){return null}const layer=GodotWebXR.getLayer();if(layer===null){return null}return GodotWebXR.gl_binding.getViewSubImage(layer,GodotWebXR.pose.views[0])},getTextureId:texture=>{if(texture.name!==undefined){return texture.name}const id=GL.getNewId(GL.textures);texture.name=id;GL.textures[id]=texture;return id},addInputSource:input_source=>{let name=-1;if(input_source.targetRayMode==="tracked-pointer"&&input_source.handedness==="left"){name=0}else if(input_source.targetRayMode==="tracked-pointer"&&input_source.handedness==="right"){name=1}else{for(let i=2;i<16;i++){if(!GodotWebXR.input_sources[i]){name=i;break}}}if(name>=0){GodotWebXR.input_sources[name]=input_source;input_source.name=name;if(input_source.targetRayMode==="screen"){let touch_index=-1;for(let i=0;i<5;i++){if(!GodotWebXR.touches[i]){touch_index=i;break}}if(touch_index>=0){GodotWebXR.touches[touch_index]=input_source;input_source.touch_index=touch_index}}}return name},removeInputSource:input_source=>{if(input_source.name!==undefined){const name=input_source.name;if(name>=0&&name<16){GodotWebXR.input_sources[name]=null}if(input_source.touch_index!==undefined){const touch_index=input_source.touch_index;if(touch_index>=0&&touch_index<5){GodotWebXR.touches[touch_index]=null}}return name}return-1},getInputSourceId:input_source=>{if(input_source!==undefined){return input_source.name}return-1},getTouchIndex:input_source=>{if(input_source.touch_index!==undefined){return input_source.touch_index}return-1}};function _godot_webxr_get_bounds_geometry(r_points){if(!GodotWebXR.space||!GodotWebXR.space.boundsGeometry){return 0}const point_count=GodotWebXR.space.boundsGeometry.length;if(point_count===0){return 0}const buf=GodotRuntime.malloc(point_count*3*4);for(let i=0;i<point_count;i++){const point=GodotWebXR.space.boundsGeometry[i];GodotRuntime.setHeapValue(buf+(i*3+0)*4,point.x,"float");GodotRuntime.setHeapValue(buf+(i*3+1)*4,point.y,"float");GodotRuntime.setHeapValue(buf+(i*3+2)*4,point.z,"float")}GodotRuntime.setHeapValue(r_points,buf,"i32");return point_count}function _godot_webxr_get_color_texture(){const subimage=GodotWebXR.getSubImage();if(subimage===null){return 0}return GodotWebXR.getTextureId(subimage.colorTexture)}function _godot_webxr_get_depth_texture(){const subimage=GodotWebXR.getSubImage();if(subimage===null){return 0}if(!subimage.depthStencilTexture){return 0}return GodotWebXR.getTextureId(subimage.depthStencilTexture)}function _godot_webxr_get_frame_rate(){if(!GodotWebXR.session||GodotWebXR.session.frameRate===undefined){return 0}return GodotWebXR.session.frameRate}function _godot_webxr_get_projection_for_view(p_view,r_transform){if(!GodotWebXR.session||!GodotWebXR.pose){return false}const matrix=GodotWebXR.pose.views[p_view].projectionMatrix;for(let i=0;i<16;i++){GodotRuntime.setHeapValue(r_transform+i*4,matrix[i],"float")}return true}function _godot_webxr_get_render_target_size(r_size){const subimage=GodotWebXR.getSubImage();if(subimage===null){return false}GodotRuntime.setHeapValue(r_size+0,subimage.viewport.width,"i32");GodotRuntime.setHeapValue(r_size+4,subimage.viewport.height,"i32");return true}function _godot_webxr_get_supported_frame_rates(r_frame_rates){if(!GodotWebXR.session||GodotWebXR.session.supportedFrameRates===undefined){return 0}const frame_rate_count=GodotWebXR.session.supportedFrameRates.length;if(frame_rate_count===0){return 0}const buf=GodotRuntime.malloc(frame_rate_count*4);for(let i=0;i<frame_rate_count;i++){GodotRuntime.setHeapValue(buf+i*4,GodotWebXR.session.supportedFrameRates[i],"float")}GodotRuntime.setHeapValue(r_frame_rates,buf,"i32");return frame_rate_count}function _godot_webxr_get_transform_for_view(p_view,r_transform){if(!GodotWebXR.session||!GodotWebXR.pose){return false}const views=GodotWebXR.pose.views;let matrix;if(p_view>=0){matrix=views[p_view].transform.matrix}else{matrix=GodotWebXR.pose.transform.matrix}for(let i=0;i<16;i++){GodotRuntime.setHeapValue(r_transform+i*4,matrix[i],"float")}return true}function _godot_webxr_get_velocity_texture(){const subimage=GodotWebXR.getSubImage();if(subimage===null){return 0}if(!subimage.motionVectorTexture){return 0}return GodotWebXR.getTextureId(subimage.motionVectorTexture)}function _godot_webxr_get_view_count(){if(!GodotWebXR.session||!GodotWebXR.pose){return 1}const view_count=GodotWebXR.pose.views.length;return view_count>0?view_count:1}function _godot_webxr_get_visibility_state(){if(!GodotWebXR.session||!GodotWebXR.session.visibilityState){return 0}return GodotRuntime.allocString(GodotWebXR.session.visibilityState)}var _godot_webxr_initialize=function(p_session_mode,p_required_features,p_optional_features,p_requested_reference_spaces,p_on_session_started,p_on_session_ended,p_on_session_failed,p_on_input_event,p_on_simple_event){GodotWebXR.monkeyPatchRequestAnimationFrame(true);const session_mode=GodotRuntime.parseString(p_session_mode);const required_features=GodotRuntime.parseString(p_required_features).split(",").map(s=>s.trim()).filter(s=>s!=="");const optional_features=GodotRuntime.parseString(p_optional_features).split(",").map(s=>s.trim()).filter(s=>s!=="");const requested_reference_space_types=GodotRuntime.parseString(p_requested_reference_spaces).split(",").map(s=>s.trim());const onstarted=GodotRuntime.get_func(p_on_session_started);const onended=GodotRuntime.get_func(p_on_session_ended);const onfailed=GodotRuntime.get_func(p_on_session_failed);const oninputevent=GodotRuntime.get_func(p_on_input_event);const onsimpleevent=GodotRuntime.get_func(p_on_simple_event);const session_init={};if(required_features.length>0){session_init["requiredFeatures"]=required_features}if(optional_features.length>0){session_init["optionalFeatures"]=optional_features}navigator.xr.requestSession(session_mode,session_init).then(function(session){GodotWebXR.session=session;session.addEventListener("end",function(evt){onended()});session.addEventListener("inputsourceschange",function(evt){evt.added.forEach(GodotWebXR.addInputSource);evt.removed.forEach(GodotWebXR.removeInputSource)});["selectstart","selectend","squeezestart","squeezeend"].forEach((input_event,index)=>{session.addEventListener(input_event,function(evt){GodotWebXR.frame=evt.frame;oninputevent(index,GodotWebXR.getInputSourceId(evt.inputSource));GodotWebXR.frame=null})});session.addEventListener("visibilitychange",function(evt){const c_str=GodotRuntime.allocString("visibility_state_changed");onsimpleevent(c_str);GodotRuntime.free(c_str)});GodotWebXR.onsimpleevent=onsimpleevent;const gl_context_handle=_emscripten_webgl_get_current_context();const gl=GL.getContext(gl_context_handle).GLctx;GodotWebXR.gl=gl;gl.makeXRCompatible().then(function(){const throwNoWebXRLayersError=()=>{throw new Error("This browser doesn't support WebXR Layers (which Godot requires) nor is the polyfill in use. If you are the developer of this application, please consider including the polyfill.")};try{GodotWebXR.gl_binding=new XRWebGLBinding(session,gl)}catch(error){throwNoWebXRLayersError()}if(!GodotWebXR.gl_binding.createProjectionLayer){throwNoWebXRLayersError()}const layer=GodotWebXR.getLayer();if(!layer){throw new Error("Unable to create WebXR Layer.")}function onReferenceSpaceSuccess(reference_space,reference_space_type){GodotWebXR.space=reference_space;reference_space.onreset=function(evt){const c_str=GodotRuntime.allocString("reference_space_reset");onsimpleevent(c_str);GodotRuntime.free(c_str)};GodotWebXR.pauseResumeMainLoop();window.setTimeout(function(){const reference_space_c_str=GodotRuntime.allocString(reference_space_type);const enabled_features="enabledFeatures"in session?Array.from(session.enabledFeatures):[];const enabled_features_c_str=GodotRuntime.allocString(enabled_features.join(","));const environment_blend_mode="environmentBlendMode"in session?session.environmentBlendMode:"";const environment_blend_mode_c_str=GodotRuntime.allocString(environment_blend_mode);onstarted(reference_space_c_str,enabled_features_c_str,environment_blend_mode_c_str);GodotRuntime.free(reference_space_c_str);GodotRuntime.free(enabled_features_c_str);GodotRuntime.free(environment_blend_mode_c_str)},0)}function requestReferenceSpace(){const reference_space_type=requested_reference_space_types.shift();session.requestReferenceSpace(reference_space_type).then(refSpace=>{onReferenceSpaceSuccess(refSpace,reference_space_type)}).catch(()=>{if(requested_reference_space_types.length===0){const c_str=GodotRuntime.allocString("Unable to get any of the requested reference space types");onfailed(c_str);GodotRuntime.free(c_str)}else{requestReferenceSpace()}})}requestReferenceSpace()}).catch(function(error){const c_str=GodotRuntime.allocString(`Unable to make WebGL context compatible with WebXR: ${error}`);onfailed(c_str);GodotRuntime.free(c_str)})}).catch(function(error){const c_str=GodotRuntime.allocString(`Unable to start session: ${error}`);onfailed(c_str);GodotRuntime.free(c_str)})};function _godot_webxr_is_session_supported(p_session_mode,p_callback){const session_mode=GodotRuntime.parseString(p_session_mode);const cb=GodotRuntime.get_func(p_callback);if(navigator.xr){navigator.xr.isSessionSupported(session_mode).then(function(supported){const c_str=GodotRuntime.allocString(session_mode);cb(c_str,supported?1:0);GodotRuntime.free(c_str)})}else{const c_str=GodotRuntime.allocString(session_mode);cb(c_str,0);GodotRuntime.free(c_str)}}function _godot_webxr_is_supported(){return!!navigator.xr}var _godot_webxr_uninitialize=function(){if(GodotWebXR.session){GodotWebXR.session.end().catch(e=>{})}GodotWebXR.session=null;GodotWebXR.gl_binding=null;GodotWebXR.layer=null;GodotWebXR.space=null;GodotWebXR.frame=null;GodotWebXR.pose=null;GodotWebXR.view_count=1;GodotWebXR.input_sources=new Array(16);GodotWebXR.touches=new Array(5);GodotWebXR.onsimpleevent=null;GodotWebXR.monkeyPatchRequestAnimationFrame(false);GodotWebXR.pauseResumeMainLoop()};function _godot_webxr_update_input_source(p_input_source_id,r_target_pose,r_target_ray_mode,r_touch_index,r_has_grip_pose,r_grip_pose,r_has_standard_mapping,r_button_count,r_buttons,r_axes_count,r_axes,r_has_hand_data,r_hand_joints,r_hand_radii){if(!GodotWebXR.session||!GodotWebXR.frame){return 0}if(p_input_source_id<0||p_input_source_id>=GodotWebXR.input_sources.length||!GodotWebXR.input_sources[p_input_source_id]){return false}const input_source=GodotWebXR.input_sources[p_input_source_id];const frame=GodotWebXR.frame;const space=GodotWebXR.space;const target_pose=frame.getPose(input_source.targetRaySpace,space);if(!target_pose){return false}const target_pose_matrix=target_pose.transform.matrix;for(let i=0;i<16;i++){GodotRuntime.setHeapValue(r_target_pose+i*4,target_pose_matrix[i],"float")}let target_ray_mode=0;switch(input_source.targetRayMode){case"gaze":target_ray_mode=1;break;case"tracked-pointer":target_ray_mode=2;break;case"screen":target_ray_mode=3;break;default:}GodotRuntime.setHeapValue(r_target_ray_mode,target_ray_mode,"i32");GodotRuntime.setHeapValue(r_touch_index,GodotWebXR.getTouchIndex(input_source),"i32");let has_grip_pose=false;if(input_source.gripSpace){const grip_pose=frame.getPose(input_source.gripSpace,space);if(grip_pose){const grip_pose_matrix=grip_pose.transform.matrix;for(let i=0;i<16;i++){GodotRuntime.setHeapValue(r_grip_pose+i*4,grip_pose_matrix[i],"float")}has_grip_pose=true}}GodotRuntime.setHeapValue(r_has_grip_pose,has_grip_pose?1:0,"i32");let has_standard_mapping=false;let button_count=0;let axes_count=0;if(input_source.gamepad){if(input_source.gamepad.mapping==="xr-standard"){has_standard_mapping=true}button_count=Math.min(input_source.gamepad.buttons.length,10);for(let i=0;i<button_count;i++){GodotRuntime.setHeapValue(r_buttons+i*4,input_source.gamepad.buttons[i].value,"float")}axes_count=Math.min(input_source.gamepad.axes.length,10);for(let i=0;i<axes_count;i++){GodotRuntime.setHeapValue(r_axes+i*4,input_source.gamepad.axes[i],"float")}}GodotRuntime.setHeapValue(r_has_standard_mapping,has_standard_mapping?1:0,"i32");GodotRuntime.setHeapValue(r_button_count,button_count,"i32");GodotRuntime.setHeapValue(r_axes_count,axes_count,"i32");let has_hand_data=false;if(input_source.hand&&r_hand_joints!==0&&r_hand_radii!==0){const hand_joint_array=new Float32Array(25*16);const hand_radii_array=new Float32Array(25);if(frame.fillPoses(input_source.hand.values(),space,hand_joint_array)&&frame.fillJointRadii(input_source.hand.values(),hand_radii_array)){GodotRuntime.heapCopy(HEAPF32,hand_joint_array,r_hand_joints);GodotRuntime.heapCopy(HEAPF32,hand_radii_array,r_hand_radii);has_hand_data=true}}GodotRuntime.setHeapValue(r_has_hand_data,has_hand_data?1:0,"i32");return true}function _godot_webxr_update_target_frame_rate(p_frame_rate){if(!GodotWebXR.session||GodotWebXR.session.updateTargetFrameRate===undefined){return}GodotWebXR.session.updateTargetFrameRate(p_frame_rate).then(()=>{const c_str=GodotRuntime.allocString("display_refresh_rate_changed");GodotWebXR.onsimpleevent(c_str);GodotRuntime.free(c_str)})}var stackAlloc=sz=>__emscripten_stack_alloc(sz);var stringToUTF8OnStack=str=>{var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret};var getCFunc=ident=>{var func=Module["_"+ident];return func};var writeArrayToMemory=(array,buffer)=>{HEAP8.set(array,buffer)};var stackSave=()=>_emscripten_stack_get_current();var stackRestore=val=>__emscripten_stack_restore(val);var ccall=(ident,returnType,argTypes,args,opts)=>{var toC={string:str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){ret=stringToUTF8OnStack(str)}return ret},array:arr=>{var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType==="string"){return UTF8ToString(ret)}if(returnType==="boolean")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i<args.length;i++){var converter=toC[argTypes[i]];if(converter){if(stack===0)stack=stackSave();cArgs[i]=converter(args[i])}else{cArgs[i]=args[i]}}}var ret=func(...cArgs);function onDone(ret){if(stack!==0)stackRestore(stack);return convertReturnValue(ret)}ret=onDone(ret);return ret};var cwrap=(ident,returnType,argTypes,opts)=>{var numericArgs=!argTypes||argTypes.every(type=>type==="number"||type==="boolean");var numericRet=returnType!=="string";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return(...args)=>ccall(ident,returnType,argTypes,args,opts)};FS.createPreloadedFile=FS_createPreloadedFile;FS.preloadFile=FS_preloadFile;FS.staticInit();Module["requestAnimationFrame"]=MainLoop.requestAnimationFrame;Module["pauseMainLoop"]=MainLoop.pause;Module["resumeMainLoop"]=MainLoop.resume;MainLoop.init();for(let i=0;i<32;++i)tempFixedLengthArray.push(new Array(i));var miniTempWebGLIntBuffersStorage=new Int32Array(288);for(var i=0;i<=288;++i){miniTempWebGLIntBuffers[i]=miniTempWebGLIntBuffersStorage.subarray(0,i)}var miniTempWebGLFloatBuffersStorage=new Float32Array(288);for(var i=0;i<=288;++i){miniTempWebGLFloatBuffers[i]=miniTempWebGLFloatBuffersStorage.subarray(0,i)}Module["request_quit"]=function(){GodotOS.request_quit()};Module["onExit"]=GodotOS.cleanup;GodotOS._fs_sync_promise=Promise.resolve();Module["initConfig"]=GodotConfig.init_config;Module["initFS"]=GodotFS.init;Module["copyToFS"]=GodotFS.copy_to_fs;GodotOS.atexit(function(resolve,reject){GodotDisplayCursor.clear();resolve()});GodotOS.atexit(function(resolve,reject){GodotEventListeners.clear();resolve()});GodotOS.atexit(function(resolve,reject){GodotDisplayVK.clear();resolve()});GodotOS.atexit(function(resolve,reject){GodotIME.clear();resolve()});GodotJSWrapper.proxies=new Map;{if(Module["noExitRuntime"])noExitRuntime=Module["noExitRuntime"];if(Module["preloadPlugins"])preloadPlugins=Module["preloadPlugins"];if(Module["print"])out=Module["print"];if(Module["printErr"])err=Module["printErr"];if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].shift()()}}}Module["callMain"]=callMain;Module["cwrap"]=cwrap;var _free,__Z14godot_web_mainiPPc,_main,_malloc,_fflush,__emwebxr_on_input_event,__emwebxr_on_simple_event,___funcs_on_exit,_emscripten_builtin_memalign,__emscripten_timeout,__emscripten_stack_restore,__emscripten_stack_alloc,_emscripten_stack_get_current,memory,__indirect_function_table,wasmMemory,wasmTable;function assignWasmExports(wasmExports){_free=Module["_free"]=wasmExports["qf"];__Z14godot_web_mainiPPc=Module["__Z14godot_web_mainiPPc"]=wasmExports["rf"];_main=Module["_main"]=wasmExports["sf"];_malloc=Module["_malloc"]=wasmExports["tf"];_fflush=wasmExports["uf"];__emwebxr_on_input_event=Module["__emwebxr_on_input_event"]=wasmExports["vf"];__emwebxr_on_simple_event=Module["__emwebxr_on_simple_event"]=wasmExports["wf"];___funcs_on_exit=wasmExports["yf"];_emscripten_builtin_memalign=wasmExports["zf"];__emscripten_timeout=wasmExports["Af"];__emscripten_stack_restore=wasmExports["Bf"];__emscripten_stack_alloc=wasmExports["Cf"];_emscripten_stack_get_current=wasmExports["Df"];memory=wasmMemory=wasmExports["of"];__indirect_function_table=wasmTable=wasmExports["xf"]}var wasmImports={Oc:___call_sighandler,fd:___syscall_chdir,Za:___syscall_chmod,gd:___syscall_faccessat,dd:___syscall_fchmod,U:___syscall_fcntl64,cd:___syscall_fstat64,_c:___syscall_ftruncate64,Zc:___syscall_getcwd,Nc:___syscall_getdents64,Aa:___syscall_ioctl,ad:___syscall_lstat64,Uc:___syscall_mkdirat,Tc:___syscall_mknodat,$c:___syscall_newfstatat,Xa:___syscall_openat,Mc:___syscall_readlinkat,Kc:___syscall_renameat,Ta:___syscall_rmdir,bd:___syscall_stat64,Jc:___syscall_statfs64,Ic:___syscall_symlinkat,Ua:___syscall_unlinkat,hd:__abort_js,Qc:__emscripten_runtime_keepalive_clear,Rc:__gmtime_js,Sc:__localtime_js,Fc:__setitimer_js,id:__tzset_js,ed:_clock_time_get,Ve:_emscripten_cancel_main_loop,Ya:_emscripten_date_now,We:_emscripten_force_exit,Hc:_emscripten_get_heap_max,ja:_emscripten_get_now,Gc:_emscripten_resize_heap,Lc:_emscripten_set_canvas_element_size,La:_emscripten_set_main_loop,Pa:_emscripten_webgl_commit_frame,bc:_emscripten_webgl_create_context,Lb:_emscripten_webgl_destroy_context,$b:_emscripten_webgl_enable_extension,vd:_emscripten_webgl_get_supported_extensions,ac:_emscripten_webgl_make_context_current,Xc:_environ_get,Yc:_environ_sizes_get,Ka:_exit,na:_fd_close,Va:_fd_fdstat_get,_a:_fd_read,Wc:_fd_seek,za:_fd_write,g:_glActiveTexture,db:_glAttachShader,fa:_glBeginTransformFeedback,b:_glBindBuffer,z:_glBindBufferBase,Da:_glBindBufferRange,d:_glBindFramebuffer,ta:_glBindRenderbuffer,c:_glBindTexture,f:_glBindVertexArray,Qd:_glBlendColor,L:_glBlendEquation,ia:_glBlendFunc,C:_glBlendFuncSeparate,la:_glBlitFramebuffer,h:_glBufferData,R:_glBufferSubData,P:_glCheckFramebufferStatus,G:_glClear,Fa:_glClearBufferfv,Q:_glClearColor,_:_glClearDepthf,lb:_glClearStencil,S:_glColorMask,fb:_glCompileShader,od:_glCompressedTexImage2D,qd:_glCompressedTexImage3D,pd:_glCompressedTexSubImage3D,rd:_glCopyBufferSubData,Bd:_glCreateProgram,hb:_glCreateShader,ma:_glCullFace,m:_glDeleteBuffers,w:_glDeleteFramebuffers,ga:_glDeleteProgram,ld:_glDeleteQueries,oa:_glDeleteRenderbuffers,W:_glDeleteShader,ob:_glDeleteSync,j:_glDeleteTextures,O:_glDeleteVertexArrays,F:_glDepthFunc,x:_glDepthMask,e:_glDisable,n:_glDisableVertexAttribArray,E:_glDrawArrays,T:_glDrawArraysInstanced,ha:_glDrawBuffers,I:_glDrawElements,J:_glDrawElementsInstanced,q:_glEnable,o:_glEnableVertexAttribArray,ea:_glEndTransformFeedback,nb:_glFenceSync,Jd:_glFinish,Ia:_glFramebufferRenderbuffer,t:_glFramebufferTexture2D,ca:_glFramebufferTextureLayer,kb:_glFrontFace,k:_glGenBuffers,B:_glGenFramebuffers,md:_glGenQueries,Ja:_glGenRenderbuffers,v:_glGenTextures,N:_glGenVertexArrays,kd:_glGenerateMipmap,td:_glGetFloatv,ud:_glGetInteger64v,aa:_glGetIntegerv,wd:_glGetProgramInfoLog,cb:_glGetProgramiv,eb:_glGetShaderInfoLog,ra:_glGetShaderiv,Z:_glGetString,Td:_glGetSynciv,Ed:_glGetUniformBlockIndex,Ea:_glGetUniformLocation,yd:_glLinkProgram,Ba:_glPixelStorei,Hd:_glReadBuffer,Ca:_glReadPixels,Md:_glRenderbufferStorage,ab:_glRenderbufferStorageMultisample,va:_glScissor,gb:_glShaderSource,jb:_glStencilFunc,ba:_glStencilMask,Fd:_glStencilOp,u:_glTexImage2D,Y:_glTexImage3D,Ha:_glTexParameterf,a:_glTexParameteri,Ga:_glTexStorage2D,$a:_glTexSubImage3D,zd:_glTransformFeedbackVaryings,i:_glUniform1f,D:_glUniform1i,Cd:_glUniform1iv,s:_glUniform1ui,sa:_glUniform1uiv,X:_glUniform2f,K:_glUniform2fv,ka:_glUniform2iv,p:_glUniform3fv,M:_glUniform4f,A:_glUniform4fv,Dd:_glUniformBlockBinding,ib:_glUniformMatrix3fv,H:_glUniformMatrix4fv,l:_glUseProgram,ua:_glVertexAttrib4f,$:_glVertexAttribDivisor,mb:_glVertexAttribI4ui,da:_glVertexAttribIPointer,r:_glVertexAttribPointer,y:_glViewport,Ie:_godot_audio_get_sample_playback_position,xd:_godot_audio_has_script_processor,Id:_godot_audio_has_worklet,mf:_godot_audio_init,yc:_godot_audio_input_start,rc:_godot_audio_input_stop,nf:_godot_audio_is_available,pa:_godot_audio_resume,Sd:_godot_audio_sample_bus_add,Rd:_godot_audio_sample_bus_move,Zd:_godot_audio_sample_bus_remove,ge:_godot_audio_sample_bus_set_count,Kd:_godot_audio_sample_bus_set_mute,Od:_godot_audio_sample_bus_set_send,Ld:_godot_audio_sample_bus_set_solo,Nd:_godot_audio_sample_bus_set_volume_db,Te:_godot_audio_sample_is_active,Yb:_godot_audio_sample_register_stream,Pd:_godot_audio_sample_set_finished_callback,af:_godot_audio_sample_set_pause,pe:_godot_audio_sample_set_volumes_linear,Fb:_godot_audio_sample_start,lf:_godot_audio_sample_stop,hc:_godot_audio_sample_stream_is_registered,Nb:_godot_audio_sample_unregister_stream,ze:_godot_audio_sample_update_pitch_scale,sd:_godot_audio_script_create,nd:_godot_audio_script_start,Gd:_godot_audio_worklet_create,Ad:_godot_audio_worklet_start_no_threads,gc:_godot_js_config_canvas_id_get,Ke:_godot_js_config_locale_get,Se:_godot_js_display_alert,sc:_godot_js_display_canvas_focus,tc:_godot_js_display_canvas_is_focused,ic:_godot_js_display_clipboard_get,jc:_godot_js_display_clipboard_set,vc:_godot_js_display_cursor_is_hidden,uc:_godot_js_display_cursor_is_locked,xa:_godot_js_display_cursor_lock_set,Sa:_godot_js_display_cursor_set_custom_shape,wc:_godot_js_display_cursor_set_shape,ya:_godot_js_display_cursor_set_visible,Eb:_godot_js_display_desired_size_set,Qb:_godot_js_display_fullscreen_cb,Db:_godot_js_display_fullscreen_exit,Cb:_godot_js_display_fullscreen_request,cc:_godot_js_display_has_webgl,ec:_godot_js_display_is_swap_ok_cancel,Ob:_godot_js_display_notification_cb,Hb:_godot_js_display_pixel_ratio_get,Ib:_godot_js_display_screen_dpi_get,Jb:_godot_js_display_screen_size_get,fc:_godot_js_display_setup_canvas,Vc:_godot_js_display_size_update,qc:_godot_js_display_touchscreen_is_available,Kb:_godot_js_display_tts_available,Oa:_godot_js_display_vk_available,Mb:_godot_js_display_vk_cb,oc:_godot_js_display_vk_hide,pc:_godot_js_display_vk_show,Pb:_godot_js_display_window_blur_cb,Qa:_godot_js_display_window_icon_set,Na:_godot_js_display_window_size_get,Gb:_godot_js_display_window_title_set,Ue:_godot_js_emscripten_get_version,$e:_godot_js_eval,Ab:_godot_js_fetch_create,Ma:_godot_js_fetch_free,xb:_godot_js_fetch_http_status_get,zb:_godot_js_fetch_is_chunked,yb:_godot_js_fetch_read_chunk,kf:_godot_js_fetch_read_headers,wa:_godot_js_fetch_state_get,Tb:_godot_js_input_drop_files_cb,Sb:_godot_js_input_gamepad_cb,Bb:_godot_js_input_gamepad_sample,lc:_godot_js_input_gamepad_sample_count,kc:_godot_js_input_gamepad_sample_get,Vb:_godot_js_input_key_cb,_b:_godot_js_input_mouse_button_cb,Zb:_godot_js_input_mouse_move_cb,Xb:_godot_js_input_mouse_wheel_cb,Ub:_godot_js_input_paste_cb,Wb:_godot_js_input_touch_cb,Me:_godot_js_input_vibrate_handheld,Ra:_godot_js_is_ime_focused,Ye:_godot_js_os_download_buffer,Qe:_godot_js_os_execute,vb:_godot_js_os_finish_async,He:_godot_js_os_fs_is_persistent,Re:_godot_js_os_fs_sync,Oe:_godot_js_os_has_feature,Pe:_godot_js_os_hw_concurrency_get,dc:_godot_js_os_request_quit_cb,Ne:_godot_js_os_shell_open,Je:_godot_js_pwa_cb,Le:_godot_js_pwa_update,ub:_godot_js_rtc_datachannel_close,xe:_godot_js_rtc_datachannel_connect,ue:_godot_js_rtc_datachannel_destroy,ye:_godot_js_rtc_datachannel_get_buffered_amount,De:_godot_js_rtc_datachannel_id_get,Ae:_godot_js_rtc_datachannel_is_negotiated,Ee:_godot_js_rtc_datachannel_is_ordered,we:_godot_js_rtc_datachannel_label_get,Ce:_godot_js_rtc_datachannel_max_packet_lifetime_get,Be:_godot_js_rtc_datachannel_max_retransmits_get,ve:_godot_js_rtc_datachannel_protocol_get,Ge:_godot_js_rtc_datachannel_ready_state_get,Fe:_godot_js_rtc_datachannel_send,tb:_godot_js_rtc_pc_close,oe:_godot_js_rtc_pc_create,ne:_godot_js_rtc_pc_datachannel_create,sb:_godot_js_rtc_pc_destroy,qe:_godot_js_rtc_pc_ice_candidate_add,se:_godot_js_rtc_pc_local_description_set,te:_godot_js_rtc_pc_offer_create,re:_godot_js_rtc_pc_remote_description_set,nc:_godot_js_set_ime_active,Rb:_godot_js_set_ime_cb,mc:_godot_js_set_ime_position,Cc:_godot_js_tts_get_voices,Dc:_godot_js_tts_is_paused,Ec:_godot_js_tts_is_speaking,Ac:_godot_js_tts_pause,zc:_godot_js_tts_resume,Bc:_godot_js_tts_speak,xc:_godot_js_tts_stop,Wa:_godot_js_webmidi_close_midi_inputs,jd:_godot_js_webmidi_open_midi_inputs,ke:_godot_js_websocket_buffered_amount,je:_godot_js_websocket_close,me:_godot_js_websocket_create,rb:_godot_js_websocket_destroy,le:_godot_js_websocket_send,df:_godot_js_wrapper_create_cb,bf:_godot_js_wrapper_create_object,cf:_godot_js_wrapper_interface_get,ff:_godot_js_wrapper_object_call,hf:_godot_js_wrapper_object_get,wb:_godot_js_wrapper_object_getvar,_e:_godot_js_wrapper_object_is_buffer,jf:_godot_js_wrapper_object_set,ef:_godot_js_wrapper_object_set_cb_ret,gf:_godot_js_wrapper_object_setvar,Ze:_godot_js_wrapper_object_transfer_buffer,Xe:_godot_js_wrapper_object_unref,bb:_godot_webgl2_glFramebufferTextureMultisampleMultiviewOVR,V:_godot_webgl2_glFramebufferTextureMultiviewOVR,qa:_godot_webgl2_glGetBufferSubData,fe:_godot_webxr_get_bounds_geometry,Xd:_godot_webxr_get_color_texture,Wd:_godot_webxr_get_depth_texture,ee:_godot_webxr_get_frame_rate,Yd:_godot_webxr_get_projection_for_view,_d:_godot_webxr_get_render_target_size,ce:_godot_webxr_get_supported_frame_rates,pb:_godot_webxr_get_transform_for_view,Vd:_godot_webxr_get_velocity_texture,qb:_godot_webxr_get_view_count,he:_godot_webxr_get_visibility_state,ae:_godot_webxr_initialize,ie:_godot_webxr_is_session_supported,be:_godot_webxr_is_supported,$d:_godot_webxr_uninitialize,Ud:_godot_webxr_update_input_source,de:_godot_webxr_update_target_frame_rate,Pc:_proc_exit};function callMain(args=[]){var entryFunction=_main;args.unshift(thisProgram);var argc=args.length;var argv=stackAlloc((argc+1)*4);var argv_ptr=argv;for(var arg of args){HEAPU32[argv_ptr>>2]=stringToUTF8OnStack(arg);argv_ptr+=4}HEAPU32[argv_ptr>>2]=0;try{var ret=entryFunction(argc,argv);exitJS(ret,true);return ret}catch(e){return handleException(e)}}function run(args=arguments_){if(runDependencies>0){dependenciesFulfilled=run;return}preRun();if(runDependencies>0){dependenciesFulfilled=run;return}function doRun(){Module["calledRun"]=true;if(ABORT)return;initRuntime();preMain();readyPromiseResolve?.(Module);Module["onRuntimeInitialized"]?.();var noInitialRun=Module["noInitialRun"]||true;if(!noInitialRun)callMain(args);postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(()=>{setTimeout(()=>Module["setStatus"](""),1);doRun()},1)}else{doRun()}}var wasmExports;wasmExports=await (createWasm());run();addOnPostRun(function(){GL.getSource=(shader,count,string,length)=>{let source="";for(let i=0;i<count;++i){const ptr=HEAPU32[string+i*4>>2];const len=length?HEAPU32[length+i*4>>2]:undefined;if(len){const endPtr=ptr+len;const slice=HEAPU8.buffer instanceof ArrayBuffer?HEAPU8.subarray(ptr,endPtr):HEAPU8.slice(ptr,endPtr);source+=UTF8Decoder.decode(slice)}else{source+=UTF8ToString(ptr,len)}}return source}});if(runtimeInitialized){moduleRtn=Module}else{moduleRtn=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject})} +;return moduleRtn}})();if(typeof exports==="object"&&typeof module==="object"){module.exports=Godot;module.exports.default=Godot}else if(typeof define==="function"&&define["amd"])define([],()=>Godot); + +const Features = { + /** + * Check whether WebGL is available. Optionally, specify a particular version of WebGL to check for. + * + * @param {number=} [majorVersion=1] The major WebGL version to check for. + * @returns {boolean} If the given major version of WebGL is available. + * @function Engine.isWebGLAvailable + */ + isWebGLAvailable: function (majorVersion = 1) { + try { + return !!document.createElement('canvas').getContext(['webgl', 'webgl2'][majorVersion - 1]); + } catch (e) { /* Not available */ } + return false; + }, + + /** + * Check whether the Fetch API available and supports streaming responses. + * + * @returns {boolean} If the Fetch API is available and supports streaming responses. + * @function Engine.isFetchAvailable + */ + isFetchAvailable: function () { + return 'fetch' in window && 'Response' in window && 'body' in window.Response.prototype; + }, + + /** + * Check whether the engine is running in a Secure Context. + * + * @returns {boolean} If the engine is running in a Secure Context. + * @function Engine.isSecureContext + */ + isSecureContext: function () { + return window['isSecureContext'] === true; + }, + + /** + * Check whether the engine is cross origin isolated. + * This value is dependent on Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy headers sent by the server. + * + * @returns {boolean} If the engine is running in a Secure Context. + * @function Engine.isSecureContext + */ + isCrossOriginIsolated: function () { + return window['crossOriginIsolated'] === true; + }, + + /** + * Check whether SharedBufferArray is available. + * + * Most browsers require the page to be running in a secure context, and the + * the server to provide specific CORS headers for SharedArrayBuffer to be available. + * + * @returns {boolean} If SharedArrayBuffer is available. + * @function Engine.isSharedArrayBufferAvailable + */ + isSharedArrayBufferAvailable: function () { + return 'SharedArrayBuffer' in window; + }, + + /** + * Check whether the AudioContext supports AudioWorkletNodes. + * + * @returns {boolean} If AudioWorkletNode is available. + * @function Engine.isAudioWorkletAvailable + */ + isAudioWorkletAvailable: function () { + return 'AudioContext' in window && 'audioWorklet' in AudioContext.prototype; + }, + + /** + * Return an array of missing required features (as string). + * + * @returns {Array<string>} A list of human-readable missing features. + * @function Engine.getMissingFeatures + * @param {{threads: (boolean|undefined)}} supportedFeatures + */ + getMissingFeatures: function (supportedFeatures = {}) { + const { + // Quotes are needed for the Closure compiler. + 'threads': supportsThreads = true, + } = supportedFeatures; + + const missing = []; + if (!Features.isWebGLAvailable(2)) { + missing.push('WebGL2 - Check web browser configuration and hardware support'); + } + if (!Features.isFetchAvailable()) { + missing.push('Fetch - Check web browser version'); + } + if (!Features.isSecureContext()) { + missing.push('Secure Context - Check web server configuration (use HTTPS)'); + } + + if (supportsThreads) { + if (!Features.isCrossOriginIsolated()) { + missing.push('Cross-Origin Isolation - Check that the web server configuration sends the correct headers.'); + } + if (!Features.isSharedArrayBufferAvailable()) { + missing.push('SharedArrayBuffer - Check that the web server configuration sends the correct headers.'); + } + } + + // Audio is normally optional since we have a dummy fallback. + return missing; + }, +}; + +const Preloader = /** @constructor */ function () { // eslint-disable-line no-unused-vars + function getTrackedResponse(response, load_status) { + function onloadprogress(reader, controller) { + return reader.read().then(function (result) { + if (load_status.done) { + return Promise.resolve(); + } + if (result.value) { + controller.enqueue(result.value); + load_status.loaded += result.value.length; + } + if (!result.done) { + return onloadprogress(reader, controller); + } + load_status.done = true; + return Promise.resolve(); + }); + } + const reader = response.body.getReader(); + return new Response(new ReadableStream({ + start: function (controller) { + onloadprogress(reader, controller).then(function () { + controller.close(); + }); + }, + }), { headers: response.headers }); + } + + function loadFetch(file, tracker, fileSize, raw) { + tracker[file] = { + total: fileSize || 0, + loaded: 0, + done: false, + }; + return fetch(file).then(function (response) { + if (!response.ok) { + return Promise.reject(new Error(`Failed loading file '${file}'`)); + } + const tr = getTrackedResponse(response, tracker[file]); + if (raw) { + return Promise.resolve(tr); + } + return tr.arrayBuffer(); + }); + } + + function retry(func, attempts = 1) { + function onerror(err) { + if (attempts <= 1) { + return Promise.reject(err); + } + return new Promise(function (resolve, reject) { + setTimeout(function () { + retry(func, attempts - 1).then(resolve).catch(reject); + }, 1000); + }); + } + return func().catch(onerror); + } + + const DOWNLOAD_ATTEMPTS_MAX = 4; + const loadingFiles = {}; + const lastProgress = { loaded: 0, total: 0 }; + let progressFunc = null; + + const animateProgress = function () { + let loaded = 0; + let total = 0; + let totalIsValid = true; + let progressIsFinal = true; + + Object.keys(loadingFiles).forEach(function (file) { + const stat = loadingFiles[file]; + if (!stat.done) { + progressIsFinal = false; + } + if (!totalIsValid || stat.total === 0) { + totalIsValid = false; + total = 0; + } else { + total += stat.total; + } + loaded += stat.loaded; + }); + if (loaded !== lastProgress.loaded || total !== lastProgress.total) { + lastProgress.loaded = loaded; + lastProgress.total = total; + if (typeof progressFunc === 'function') { + progressFunc(loaded, total); + } + } + if (!progressIsFinal) { + requestAnimationFrame(animateProgress); + } + }; + + this.animateProgress = animateProgress; + + this.setProgressFunc = function (callback) { + progressFunc = callback; + }; + + this.loadPromise = function (file, fileSize, raw = false) { + return retry(loadFetch.bind(null, file, loadingFiles, fileSize, raw), DOWNLOAD_ATTEMPTS_MAX); + }; + + this.preloadedFiles = []; + this.preload = function (pathOrBuffer, destPath, fileSize) { + let buffer = null; + if (typeof pathOrBuffer === 'string') { + const me = this; + return this.loadPromise(pathOrBuffer, fileSize).then(function (buf) { + me.preloadedFiles.push({ + path: destPath || pathOrBuffer, + buffer: buf, + }); + return Promise.resolve(); + }); + } else if (pathOrBuffer instanceof ArrayBuffer) { + buffer = new Uint8Array(pathOrBuffer); + } else if (ArrayBuffer.isView(pathOrBuffer)) { + buffer = new Uint8Array(pathOrBuffer.buffer); + } + if (buffer) { + this.preloadedFiles.push({ + path: destPath, + buffer: pathOrBuffer, + }); + return Promise.resolve(); + } + return Promise.reject(new Error('Invalid object for preloading')); + }; +}; + +/** + * An object used to configure the Engine instance based on godot export options, and to override those in custom HTML + * templates if needed. + * + * @header Engine configuration + * @summary The Engine configuration object. This is just a typedef, create it like a regular object, e.g.: + * + * ``const MyConfig = { executable: 'godot', unloadAfterInit: false }`` + * + * @typedef {Object} EngineConfig + */ +const EngineConfig = {}; // eslint-disable-line no-unused-vars + +/** + * @struct + * @constructor + * @ignore + */ +const InternalConfig = function (initConfig) { // eslint-disable-line no-unused-vars + const cfg = /** @lends {InternalConfig.prototype} */ { + /** + * Whether to unload the engine automatically after the instance is initialized. + * + * @memberof EngineConfig + * @default + * @type {boolean} + */ + unloadAfterInit: true, + /** + * The HTML DOM Canvas object to use. + * + * By default, the first canvas element in the document will be used is none is specified. + * + * @memberof EngineConfig + * @default + * @type {?HTMLCanvasElement} + */ + canvas: null, + /** + * The name of the WASM file without the extension. (Set by Godot Editor export process). + * + * @memberof EngineConfig + * @default + * @type {string} + */ + executable: '', + /** + * An alternative name for the game pck to load. The executable name is used otherwise. + * + * @memberof EngineConfig + * @default + * @type {?string} + */ + mainPack: null, + /** + * Specify a language code to select the proper localization for the game. + * + * The browser locale will be used if none is specified. See complete list of + * :ref:`supported locales <doc_locales>`. + * + * @memberof EngineConfig + * @type {?string} + * @default + */ + locale: null, + /** + * The canvas resize policy determines how the canvas should be resized by Godot. + * + * ``0`` means Godot won't do any resizing. This is useful if you want to control the canvas size from + * javascript code in your template. + * + * ``1`` means Godot will resize the canvas on start, and when changing window size via engine functions. + * + * ``2`` means Godot will adapt the canvas size to match the whole browser window. + * + * @memberof EngineConfig + * @type {number} + * @default + */ + canvasResizePolicy: 2, + /** + * The arguments to be passed as command line arguments on startup. + * + * See :ref:`command line tutorial <doc_command_line_tutorial>`. + * + * **Note**: :js:meth:`startGame <Engine.prototype.startGame>` will always add the ``--main-pack`` argument. + * + * @memberof EngineConfig + * @type {Array<string>} + * @default + */ + args: [], + /** + * When enabled, the game canvas will automatically grab the focus when the engine starts. + * + * @memberof EngineConfig + * @type {boolean} + * @default + */ + focusCanvas: true, + /** + * When enabled, this will turn on experimental virtual keyboard support on mobile. + * + * @memberof EngineConfig + * @type {boolean} + * @default + */ + experimentalVK: false, + /** + * The progressive web app service worker to install. + * @memberof EngineConfig + * @default + * @type {string} + */ + serviceWorker: '', + /** + * @ignore + * @type {Array.<string>} + */ + persistentPaths: ['/userfs'], + /** + * @ignore + * @type {boolean} + */ + persistentDrops: false, + /** + * @ignore + * @type {Array.<string>} + */ + gdextensionLibs: [], + /** + * @ignore + * @type {Array.<string>} + */ + fileSizes: [], + /** + * @ignore + * @type {number} + */ + emscriptenPoolSize: 8, + /** + * @ignore + * @type {number} + */ + godotPoolSize: 4, + /** + * A callback function for handling Godot's ``OS.execute`` calls. + * + * This is for example used in the Web Editor template to switch between project manager and editor, and for running the game. + * + * @callback EngineConfig.onExecute + * @param {string} path The path that Godot's wants executed. + * @param {Array.<string>} args The arguments of the "command" to execute. + */ + /** + * @ignore + * @type {?function(string, Array.<string>)} + */ + onExecute: null, + /** + * A callback function for being notified when the Godot instance quits. + * + * **Note**: This function will not be called if the engine crashes or become unresponsive. + * + * @callback EngineConfig.onExit + * @param {number} status_code The status code returned by Godot on exit. + */ + /** + * @ignore + * @type {?function(number)} + */ + onExit: null, + /** + * A callback function for displaying download progress. + * + * The function is called once per frame while downloading files, so the usage of ``requestAnimationFrame()`` + * is not necessary. + * + * If the callback function receives a total amount of bytes as 0, this means that it is impossible to calculate. + * Possible reasons include: + * + * - Files are delivered with server-side chunked compression + * - Files are delivered with server-side compression on Chromium + * - Not all file downloads have started yet (usually on servers without multi-threading) + * + * @callback EngineConfig.onProgress + * @param {number} current The current amount of downloaded bytes so far. + * @param {number} total The total amount of bytes to be downloaded. + */ + /** + * @ignore + * @type {?function(number, number)} + */ + onProgress: null, + /** + * A callback function for handling the standard output stream. This method should usually only be used in debug pages. + * + * By default, ``console.log()`` is used. + * + * @callback EngineConfig.onPrint + * @param {...*} [var_args] A variadic number of arguments to be printed. + */ + /** + * @ignore + * @type {?function(...*)} + */ + onPrint: function () { + console.log.apply(console, Array.from(arguments)); // eslint-disable-line no-console + }, + /** + * A callback function for handling the standard error stream. This method should usually only be used in debug pages. + * + * By default, ``console.error()`` is used. + * + * @callback EngineConfig.onPrintError + * @param {...*} [var_args] A variadic number of arguments to be printed as errors. + */ + /** + * @ignore + * @type {?function(...*)} + */ + onPrintError: function (var_args) { + console.error.apply(console, Array.from(arguments)); // eslint-disable-line no-console + }, + }; + + /** + * @ignore + * @struct + * @constructor + * @param {EngineConfig} opts + */ + function Config(opts) { + this.update(opts); + } + + Config.prototype = cfg; + + /** + * @ignore + * @param {EngineConfig} opts + */ + Config.prototype.update = function (opts) { + const config = opts || {}; + // NOTE: We must explicitly pass the default, accessing it via + // the key will fail due to closure compiler renames. + function parse(key, def) { + if (typeof (config[key]) === 'undefined') { + return def; + } + return config[key]; + } + // Module config + this.unloadAfterInit = parse('unloadAfterInit', this.unloadAfterInit); + this.onPrintError = parse('onPrintError', this.onPrintError); + this.onPrint = parse('onPrint', this.onPrint); + this.onProgress = parse('onProgress', this.onProgress); + + // Godot config + this.canvas = parse('canvas', this.canvas); + this.executable = parse('executable', this.executable); + this.mainPack = parse('mainPack', this.mainPack); + this.locale = parse('locale', this.locale); + this.canvasResizePolicy = parse('canvasResizePolicy', this.canvasResizePolicy); + this.persistentPaths = parse('persistentPaths', this.persistentPaths); + this.persistentDrops = parse('persistentDrops', this.persistentDrops); + this.experimentalVK = parse('experimentalVK', this.experimentalVK); + this.focusCanvas = parse('focusCanvas', this.focusCanvas); + this.serviceWorker = parse('serviceWorker', this.serviceWorker); + this.gdextensionLibs = parse('gdextensionLibs', this.gdextensionLibs); + this.fileSizes = parse('fileSizes', this.fileSizes); + this.emscriptenPoolSize = parse('emscriptenPoolSize', this.emscriptenPoolSize); + this.godotPoolSize = parse('godotPoolSize', this.godotPoolSize); + this.args = parse('args', this.args); + this.onExecute = parse('onExecute', this.onExecute); + this.onExit = parse('onExit', this.onExit); + }; + + /** + * @ignore + * @param {string} loadPath + * @param {Response} response + */ + Config.prototype.getModuleConfig = function (loadPath, response) { + let r = response; + const gdext = this.gdextensionLibs; + return { + 'print': this.onPrint, + 'printErr': this.onPrintError, + 'thisProgram': this.executable, + 'noExitRuntime': false, + 'dynamicLibraries': [`${loadPath}.side.wasm`].concat(this.gdextensionLibs), + 'emscriptenPoolSize': this.emscriptenPoolSize, + 'instantiateWasm': function (imports, onSuccess) { + function done(result) { + onSuccess(result['instance'], result['module']); + } + if (typeof (WebAssembly.instantiateStreaming) !== 'undefined') { + WebAssembly.instantiateStreaming(Promise.resolve(r), imports).then(done); + } else { + r.arrayBuffer().then(function (buffer) { + WebAssembly.instantiate(buffer, imports).then(done); + }); + } + r = null; + return {}; + }, + 'locateFile': function (path) { + if (!path.startsWith('godot.')) { + return path; + } else if (path.endsWith('.audio.worklet.js')) { + return `${loadPath}.audio.worklet.js`; + } else if (path.endsWith('.audio.position.worklet.js')) { + return `${loadPath}.audio.position.worklet.js`; + } else if (path.endsWith('.js')) { + return `${loadPath}.js`; + } else if (path in gdext) { + return path; + } else if (path.endsWith('.side.wasm')) { + return `${loadPath}.side.wasm`; + } else if (path.endsWith('.wasm')) { + return `${loadPath}.wasm`; + } + return path; + }, + }; + }; + + /** + * @ignore + * @param {function()} cleanup + */ + Config.prototype.getGodotConfig = function (cleanup) { + // Try to find a canvas + if (!(this.canvas instanceof HTMLCanvasElement)) { + const nodes = document.getElementsByTagName('canvas'); + if (nodes.length && nodes[0] instanceof HTMLCanvasElement) { + const first = nodes[0]; + this.canvas = /** @type {!HTMLCanvasElement} */ (first); + } + if (!this.canvas) { + throw new Error('No canvas found in page'); + } + } + // Canvas can grab focus on click, or key events won't work. + if (this.canvas.tabIndex < 0) { + this.canvas.tabIndex = 0; + } + + // Browser locale, or custom one if defined. + let locale = this.locale; + if (!locale) { + locale = navigator.languages ? navigator.languages[0] : navigator.language; + locale = locale.split('.')[0]; + } + locale = locale.replace('-', '_'); + const onExit = this.onExit; + + // Godot configuration. + return { + 'canvas': this.canvas, + 'canvasResizePolicy': this.canvasResizePolicy, + 'locale': locale, + 'persistentDrops': this.persistentDrops, + 'virtualKeyboard': this.experimentalVK, + 'godotPoolSize': this.godotPoolSize, + 'focusCanvas': this.focusCanvas, + 'onExecute': this.onExecute, + 'onExit': function (p_code) { + cleanup(); // We always need to call the cleanup callback to free memory. + if (typeof (onExit) === 'function') { + onExit(p_code); + } + }, + }; + }; + return new Config(initConfig); +}; + +/** + * Projects exported for the Web expose the :js:class:`Engine` class to the JavaScript environment, that allows + * fine control over the engine's start-up process. + * + * This API is built in an asynchronous manner and requires basic understanding + * of `Promises <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises>`__. + * + * @module Engine + * @header Web export JavaScript reference + */ +const Engine = (function () { + const preloader = new Preloader(); + + let loadPromise = null; + let loadPath = ''; + let initPromise = null; + + /** + * @classdesc The ``Engine`` class provides methods for loading and starting exported projects on the Web. For default export + * settings, this is already part of the exported HTML page. To understand practical use of the ``Engine`` class, + * see :ref:`Custom HTML page for Web export <doc_customizing_html5_shell>`. + * + * @description Create a new Engine instance with the given configuration. + * + * @global + * @constructor + * @param {EngineConfig} initConfig The initial config for this instance. + */ + function Engine(initConfig) { // eslint-disable-line no-shadow + this.config = new InternalConfig(initConfig); + this.rtenv = null; + } + + /** + * Load the engine from the specified base path. + * + * @param {string} basePath Base path of the engine to load. + * @param {number=} [size=0] The file size if known. + * @returns {Promise} A Promise that resolves once the engine is loaded. + * + * @function Engine.load + */ + Engine.load = function (basePath, size) { + if (loadPromise == null) { + loadPath = basePath; + loadPromise = preloader.loadPromise(`${loadPath}.wasm`, size, true); + requestAnimationFrame(preloader.animateProgress); + } + return loadPromise; + }; + + /** + * Unload the engine to free memory. + * + * This method will be called automatically depending on the configuration. See :js:attr:`unloadAfterInit`. + * + * @function Engine.unload + */ + Engine.unload = function () { + loadPromise = null; + }; + + /** + * Safe Engine constructor, creates a new prototype for every new instance to avoid prototype pollution. + * @ignore + * @constructor + */ + function SafeEngine(initConfig) { + const proto = /** @lends Engine.prototype */ { + /** + * Initialize the engine instance. Optionally, pass the base path to the engine to load it, + * if it hasn't been loaded yet. See :js:meth:`Engine.load`. + * + * @param {string=} basePath Base path of the engine to load. + * @return {Promise} A ``Promise`` that resolves once the engine is loaded and initialized. + */ + init: function (basePath) { + if (initPromise) { + return initPromise; + } + if (loadPromise == null) { + if (!basePath) { + initPromise = Promise.reject(new Error('A base path must be provided when calling `init` and the engine is not loaded.')); + return initPromise; + } + Engine.load(basePath, this.config.fileSizes[`${basePath}.wasm`]); + } + const me = this; + function doInit(promise) { + // Care! Promise chaining is bogus with old emscripten versions. + // This caused a regression with the Mono build (which uses an older emscripten version). + // Make sure to test that when refactoring. + return new Promise(function (resolve, reject) { + promise.then(function (response) { + const cloned = new Response(response.clone().body, { 'headers': [['content-type', 'application/wasm']] }); + Godot(me.config.getModuleConfig(loadPath, cloned)).then(function (module) { + const paths = me.config.persistentPaths; + module['initFS'](paths).then(function (err) { + me.rtenv = module; + if (me.config.unloadAfterInit) { + Engine.unload(); + } + resolve(); + }); + }); + }); + }); + } + preloader.setProgressFunc(this.config.onProgress); + initPromise = doInit(loadPromise); + return initPromise; + }, + + /** + * Load a file so it is available in the instance's file system once it runs. Must be called **before** starting the + * instance. + * + * If not provided, the ``path`` is derived from the URL of the loaded file. + * + * @param {string|ArrayBuffer} file The file to preload. + * + * If a ``string`` the file will be loaded from that path. + * + * If an ``ArrayBuffer`` or a view on one, the buffer will used as the content of the file. + * + * @param {string=} path Path by which the file will be accessible. Required, if ``file`` is not a string. + * + * @returns {Promise} A Promise that resolves once the file is loaded. + */ + preloadFile: function (file, path) { + return preloader.preload(file, path, this.config.fileSizes[file]); + }, + + /** + * Start the engine instance using the given override configuration (if any). + * :js:meth:`startGame <Engine.prototype.startGame>` can be used in typical cases instead. + * + * This will initialize the instance if it is not initialized. For manual initialization, see :js:meth:`init <Engine.prototype.init>`. + * The engine must be loaded beforehand. + * + * Fails if a canvas cannot be found on the page, or not specified in the configuration. + * + * @param {EngineConfig} override An optional configuration override. + * @return {Promise} Promise that resolves once the engine started. + */ + start: function (override) { + this.config.update(override); + const me = this; + return me.init().then(function () { + if (!me.rtenv) { + return Promise.reject(new Error('The engine must be initialized before it can be started')); + } + + let config = {}; + try { + config = me.config.getGodotConfig(function () { + me.rtenv = null; + }); + } catch (e) { + return Promise.reject(e); + } + // Godot configuration. + me.rtenv['initConfig'](config); + + // Preload GDExtension libraries. + if (me.config.gdextensionLibs.length > 0 && !me.rtenv['loadDynamicLibrary']) { + return Promise.reject(new Error('GDExtension libraries are not supported by this engine version. ' + + 'Enable "Extensions Support" for your export preset and/or build your custom template with "dlink_enabled=yes".')); + } + return new Promise(function (resolve, reject) { + for (const file of preloader.preloadedFiles) { + me.rtenv['copyToFS'](file.path, file.buffer); + } + preloader.preloadedFiles.length = 0; // Clear memory + me.rtenv['callMain'](me.config.args); + initPromise = null; + me.installServiceWorker(); + resolve(); + }); + }); + }, + + /** + * Start the game instance using the given configuration override (if any). + * + * This will initialize the instance if it is not initialized. For manual initialization, see :js:meth:`init <Engine.prototype.init>`. + * + * This will load the engine if it is not loaded, and preload the main pck. + * + * This method expects the initial config (or the override) to have both the :js:attr:`executable` and :js:attr:`mainPack` + * properties set (normally done by the editor during export). + * + * @param {EngineConfig} override An optional configuration override. + * @return {Promise} Promise that resolves once the game started. + */ + startGame: function (override) { + this.config.update(override); + // Add main-pack argument. + const exe = this.config.executable; + const pack = this.config.mainPack || `${exe}.pck`; + this.config.args = ['--main-pack', pack].concat(this.config.args); + // Start and init with execName as loadPath if not inited. + const me = this; + return Promise.all([ + this.init(exe), + this.preloadFile(pack, pack), + ]).then(function () { + return me.start.apply(me); + }); + }, + + /** + * Create a file at the specified ``path`` with the passed as ``buffer`` in the instance's file system. + * + * @param {string} path The location where the file will be created. + * @param {ArrayBuffer} buffer The content of the file. + */ + copyToFS: function (path, buffer) { + if (this.rtenv == null) { + throw new Error('Engine must be inited before copying files'); + } + this.rtenv['copyToFS'](path, buffer); + }, + + /** + * Request that the current instance quit. + * + * This is akin the user pressing the close button in the window manager, and will + * have no effect if the engine has crashed, or is stuck in a loop. + * + */ + requestQuit: function () { + if (this.rtenv) { + this.rtenv['request_quit'](); + } + }, + + /** + * Install the progressive-web app service worker. + * @returns {Promise} The service worker registration promise. + */ + installServiceWorker: function () { + if (this.config.serviceWorker && 'serviceWorker' in navigator) { + try { + return navigator.serviceWorker.register(this.config.serviceWorker); + } catch (e) { + return Promise.reject(e); + } + } + return Promise.resolve(); + }, + }; + + Engine.prototype = proto; + // Closure compiler exported instance methods. + Engine.prototype['init'] = Engine.prototype.init; + Engine.prototype['preloadFile'] = Engine.prototype.preloadFile; + Engine.prototype['start'] = Engine.prototype.start; + Engine.prototype['startGame'] = Engine.prototype.startGame; + Engine.prototype['copyToFS'] = Engine.prototype.copyToFS; + Engine.prototype['requestQuit'] = Engine.prototype.requestQuit; + Engine.prototype['installServiceWorker'] = Engine.prototype.installServiceWorker; + // Also expose static methods as instance methods + Engine.prototype['load'] = Engine.load; + Engine.prototype['unload'] = Engine.unload; + return new Engine(initConfig); + } + + // Closure compiler exported static methods. + SafeEngine['load'] = Engine.load; + SafeEngine['unload'] = Engine.unload; + + // Feature-detection utilities. + SafeEngine['isWebGLAvailable'] = Features.isWebGLAvailable; + SafeEngine['isFetchAvailable'] = Features.isFetchAvailable; + SafeEngine['isSecureContext'] = Features.isSecureContext; + SafeEngine['isCrossOriginIsolated'] = Features.isCrossOriginIsolated; + SafeEngine['isSharedArrayBufferAvailable'] = Features.isSharedArrayBufferAvailable; + SafeEngine['isAudioWorkletAvailable'] = Features.isAudioWorkletAvailable; + SafeEngine['getMissingFeatures'] = Features.getMissingFeatures; + + return SafeEngine; +}()); +if (typeof window !== 'undefined') { + window['Engine'] = Engine; +} diff --git a/2026/games/prodzpod/microgames.pck b/2026/games/prodzpod/microgames.pck Binary files differnew file mode 100644 index 0000000..f9765de --- /dev/null +++ b/2026/games/prodzpod/microgames.pck diff --git a/2026/games/prodzpod/microgames.png b/2026/games/prodzpod/microgames.png Binary files differnew file mode 100644 index 0000000..766b0b6 --- /dev/null +++ b/2026/games/prodzpod/microgames.png diff --git a/2026/games/prodzpod/microgames.wasm b/2026/games/prodzpod/microgames.wasm Binary files differnew file mode 100644 index 0000000..4f2aa56 --- /dev/null +++ b/2026/games/prodzpod/microgames.wasm diff --git a/2026/games/samzyre/index.html b/2026/games/samzyre/index.html new file mode 100644 index 0000000..48a0218 --- /dev/null +++ b/2026/games/samzyre/index.html @@ -0,0 +1,52 @@ +<html>
+
+<head>
+ <title>rctrctrl</title>
+ <meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
+
+ <style>
+ html,
+ body {
+ margin: 0;
+ padding: 0;
+ width: 100%;
+ height: 100%;
+ overflow: hidden;
+ }
+
+ canvas {
+ display: block;
+ width: 100vw;
+ height: 100vh;
+ }
+ </style>
+<link rel="modulepreload" href="./microjam_rctrctrl-f61f8eb97d2bebe5.js" crossorigin="anonymous" integrity="sha384-sB3RNS0ypZaFAp7nRGjLfKFy1SBikFtXgCDvrr+jPvGs70ozD8DWlqbskwz8eWt1"><link rel="preload" href="./microjam_rctrctrl-f61f8eb97d2bebe5_bg.wasm" crossorigin="anonymous" integrity="sha384-/0GpaK9lZrKjuDyfa7jnUNS0I+/v5OOWgQHN4zHeMQC8aTqcybg7aKtXr3KAqYrd" as="fetch" type="application/wasm"></head>
+
+<body>
+ <script>
+ function send_ready() { window.parent.postMessage({ op: "ready" }); }
+ function send_started(verb) { window.parent.postMessage({ op: "started", verb }); }
+ function send_done(win) { window.parent.postMessage({ op: "done", win }); }
+ addEventListener("message", (ev) => {
+ if (ev.data.op == "start") {
+ window.wasmBindings.game_start(ev.data.difficulty);
+ } else {
+ console.log(`unknown message: ${ev.data}`);
+ }
+ });
+ </script>
+ <canvas id="notan_app"></canvas>
+ +<script type="module"> +import init, * as bindings from './microjam_rctrctrl-f61f8eb97d2bebe5.js'; +const wasm = await init({ module_or_path: './microjam_rctrctrl-f61f8eb97d2bebe5_bg.wasm' }); + + +window.wasmBindings = bindings; + + +dispatchEvent(new CustomEvent("TrunkApplicationStarted", {detail: {wasm}})); + +</script></body>
+
+</html>
\ No newline at end of file diff --git a/2026/games/samzyre/microjam_rctrctrl-f61f8eb97d2bebe5.js b/2026/games/samzyre/microjam_rctrctrl-f61f8eb97d2bebe5.js new file mode 100644 index 0000000..88efa02 --- /dev/null +++ b/2026/games/samzyre/microjam_rctrctrl-f61f8eb97d2bebe5.js @@ -0,0 +1,1412 @@ +/** + * @param {number} difficulty + */ +export function game_start(difficulty) { + wasm.game_start(difficulty); +} +function __wbg_get_imports() { + const import0 = { + __proto__: null, + __wbg___wbindgen_boolean_get_fa956cfa2d1bd751: function(arg0) { + const v = arg0; + const ret = typeof(v) === 'boolean' ? v : undefined; + return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0; + }, + __wbg___wbindgen_debug_string_c25d447a39f5578f: function(arg0, arg1) { + const ret = debugString(arg1); + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }, + __wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) { + const ret = arg0 === undefined; + return ret; + }, + __wbg___wbindgen_number_get_394265ed1e1b84ee: function(arg0, arg1) { + const obj = arg1; + const ret = typeof(obj) === 'number' ? obj : undefined; + getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true); + }, + __wbg___wbindgen_string_get_b0ca35b86a603356: function(arg0, arg1) { + const obj = arg1; + const ret = typeof(obj) === 'string' ? obj : undefined; + var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + var len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }, + __wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); + }, + __wbg__wbg_cb_unref_fffb441def202758: function(arg0) { + arg0._wbg_cb_unref(); + }, + __wbg_activeElement_4bc99dc1a7094c27: function(arg0) { + const ret = arg0.activeElement; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_activeTexture_92b04d918019d603: function(arg0, arg1) { + arg0.activeTexture(arg1 >>> 0); + }, + __wbg_activeTexture_d12958674e97a118: function(arg0, arg1) { + arg0.activeTexture(arg1 >>> 0); + }, + __wbg_addEventListener_d85450ee1320c989: function() { return handleError(function (arg0, arg1, arg2, arg3) { + arg0.addEventListener(getStringFromWasm0(arg1, arg2), arg3); + }, arguments); }, + __wbg_appendChild_f553e8704c4f14a6: function() { return handleError(function (arg0, arg1) { + const ret = arg0.appendChild(arg1); + return ret; + }, arguments); }, + __wbg_attachShader_5f7f4077e124e23b: function(arg0, arg1, arg2) { + arg0.attachShader(arg1, arg2); + }, + __wbg_attachShader_8971266b4c9bc514: function(arg0, arg1, arg2) { + arg0.attachShader(arg1, arg2); + }, + __wbg_bindBufferBase_4d761d76138d5494: function(arg0, arg1, arg2, arg3) { + arg0.bindBufferBase(arg1 >>> 0, arg2 >>> 0, arg3); + }, + __wbg_bindBuffer_1e00cfb4321ef9a4: function(arg0, arg1, arg2) { + arg0.bindBuffer(arg1 >>> 0, arg2); + }, + __wbg_bindBuffer_a01497b1abdcdd9a: function(arg0, arg1, arg2) { + arg0.bindBuffer(arg1 >>> 0, arg2); + }, + __wbg_bindFramebuffer_390311eff3896937: function(arg0, arg1, arg2) { + arg0.bindFramebuffer(arg1 >>> 0, arg2); + }, + __wbg_bindFramebuffer_658e4b06f7ee8bb4: function(arg0, arg1, arg2) { + arg0.bindFramebuffer(arg1 >>> 0, arg2); + }, + __wbg_bindTexture_28eff4bbd8aaab54: function(arg0, arg1, arg2) { + arg0.bindTexture(arg1 >>> 0, arg2); + }, + __wbg_bindTexture_9b04b1b7c00d4dd6: function(arg0, arg1, arg2) { + arg0.bindTexture(arg1 >>> 0, arg2); + }, + __wbg_bindVertexArrayOES_5cad2205a17e8990: function(arg0, arg1) { + arg0.bindVertexArrayOES(arg1); + }, + __wbg_bindVertexArray_427eeac0c1764d8a: function(arg0, arg1) { + arg0.bindVertexArray(arg1); + }, + __wbg_blendEquationSeparate_043e2f50f6ecb2d3: function(arg0, arg1, arg2) { + arg0.blendEquationSeparate(arg1 >>> 0, arg2 >>> 0); + }, + __wbg_blendEquationSeparate_c7e2b2261c94e1c5: function(arg0, arg1, arg2) { + arg0.blendEquationSeparate(arg1 >>> 0, arg2 >>> 0); + }, + __wbg_blendEquation_455b8986ededabc0: function(arg0, arg1) { + arg0.blendEquation(arg1 >>> 0); + }, + __wbg_blendEquation_f5c5272993f6cb01: function(arg0, arg1) { + arg0.blendEquation(arg1 >>> 0); + }, + __wbg_blendFuncSeparate_37156309688f8f88: function(arg0, arg1, arg2, arg3, arg4) { + arg0.blendFuncSeparate(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0, arg4 >>> 0); + }, + __wbg_blendFuncSeparate_3ee6d939a9f3938b: function(arg0, arg1, arg2, arg3, arg4) { + arg0.blendFuncSeparate(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0, arg4 >>> 0); + }, + __wbg_blendFunc_114dc7056ccfeb8d: function(arg0, arg1, arg2) { + arg0.blendFunc(arg1 >>> 0, arg2 >>> 0); + }, + __wbg_blendFunc_a854d7e4459150ba: function(arg0, arg1, arg2) { + arg0.blendFunc(arg1 >>> 0, arg2 >>> 0); + }, + __wbg_body_40ec34e0a2931fe8: function(arg0) { + const ret = arg0.body; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_bufferData_073a7c6abef7a55f: function(arg0, arg1, arg2, arg3) { + arg0.bufferData(arg1 >>> 0, arg2, arg3 >>> 0); + }, + __wbg_bufferData_90ef588bac2be2f5: function(arg0, arg1, arg2, arg3) { + arg0.bufferData(arg1 >>> 0, arg2, arg3 >>> 0); + }, + __wbg_bufferSubData_bae930b21e9c1c48: function(arg0, arg1, arg2, arg3) { + arg0.bufferSubData(arg1 >>> 0, arg2, arg3); + }, + __wbg_bufferSubData_ce9854d3d337e2cf: function(arg0, arg1, arg2, arg3) { + arg0.bufferSubData(arg1 >>> 0, arg2, arg3); + }, + __wbg_button_f6a9a7b725f1838e: function(arg0) { + const ret = arg0.button; + return ret; + }, + __wbg_checkFramebufferStatus_12fa8186abd75390: function(arg0, arg1) { + const ret = arg0.checkFramebufferStatus(arg1 >>> 0); + return ret; + }, + __wbg_checkFramebufferStatus_5efda28e4c119e10: function(arg0, arg1) { + const ret = arg0.checkFramebufferStatus(arg1 >>> 0); + return ret; + }, + __wbg_clearColor_157e2ce41a7945b4: function(arg0, arg1, arg2, arg3, arg4) { + arg0.clearColor(arg1, arg2, arg3, arg4); + }, + __wbg_clearColor_9152d82998e32a1e: function(arg0, arg1, arg2, arg3, arg4) { + arg0.clearColor(arg1, arg2, arg3, arg4); + }, + __wbg_clearDepth_8b5d226aae155082: function(arg0, arg1) { + arg0.clearDepth(arg1); + }, + __wbg_clearDepth_ca9b22d41551b513: function(arg0, arg1) { + arg0.clearDepth(arg1); + }, + __wbg_clearStencil_58f2af46612bccae: function(arg0, arg1) { + arg0.clearStencil(arg1); + }, + __wbg_clearStencil_a66fe23df6313fc7: function(arg0, arg1) { + arg0.clearStencil(arg1); + }, + __wbg_clear_53d71d234e14e4c1: function(arg0, arg1) { + arg0.clear(arg1 >>> 0); + }, + __wbg_clear_dd06a0da4ce8e13f: function(arg0, arg1) { + arg0.clear(arg1 >>> 0); + }, + __wbg_clientHeight_994541cde34d3ca0: function(arg0) { + const ret = arg0.clientHeight; + return ret; + }, + __wbg_clientWidth_6852617da948be39: function(arg0) { + const ret = arg0.clientWidth; + return ret; + }, + __wbg_clientX_a7dcb4081126cd4b: function(arg0) { + const ret = arg0.clientX; + return ret; + }, + __wbg_clientY_c0560910b20ee192: function(arg0) { + const ret = arg0.clientY; + return ret; + }, + __wbg_code_89c999e407c79eef: function(arg0, arg1) { + const ret = arg1.code; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }, + __wbg_colorMask_44ebb91cad2502f2: function(arg0, arg1, arg2, arg3, arg4) { + arg0.colorMask(arg1 !== 0, arg2 !== 0, arg3 !== 0, arg4 !== 0); + }, + __wbg_colorMask_a4d164c2039b5731: function(arg0, arg1, arg2, arg3, arg4) { + arg0.colorMask(arg1 !== 0, arg2 !== 0, arg3 !== 0, arg4 !== 0); + }, + __wbg_compileShader_9bdfd792722cf704: function(arg0, arg1) { + arg0.compileShader(arg1); + }, + __wbg_compileShader_fc2e4b73240d4fd7: function(arg0, arg1) { + arg0.compileShader(arg1); + }, + __wbg_createBuffer_01568a9d930d90dd: function(arg0) { + const ret = arg0.createBuffer(); + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_createBuffer_2075765bde5035d5: function(arg0) { + const ret = arg0.createBuffer(); + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_createElement_fcbc0805de826d62: function() { return handleError(function (arg0, arg1, arg2) { + const ret = arg0.createElement(getStringFromWasm0(arg1, arg2)); + return ret; + }, arguments); }, + __wbg_createFramebuffer_b24d2c80a8b9e7cc: function(arg0) { + const ret = arg0.createFramebuffer(); + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_createFramebuffer_de0d521f546e7534: function(arg0) { + const ret = arg0.createFramebuffer(); + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_createProgram_118becaac3a20318: function(arg0) { + const ret = arg0.createProgram(); + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_createProgram_538c9777a4ac084f: function(arg0) { + const ret = arg0.createProgram(); + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_createShader_78bc8b7e9a88e1a8: function(arg0, arg1) { + const ret = arg0.createShader(arg1 >>> 0); + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_createShader_7d139f2d50f77365: function(arg0, arg1) { + const ret = arg0.createShader(arg1 >>> 0); + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_createTexture_0ee0fa5f924f3d14: function(arg0) { + const ret = arg0.createTexture(); + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_createTexture_d13f98e0d3d912f4: function(arg0) { + const ret = arg0.createTexture(); + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_createVertexArrayOES_2fa3e59eebd5f674: function(arg0) { + const ret = arg0.createVertexArrayOES(); + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_createVertexArray_baf9eef7ea5a2c7a: function(arg0) { + const ret = arg0.createVertexArray(); + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_cullFace_62bbea3bef0e6b99: function(arg0, arg1) { + arg0.cullFace(arg1 >>> 0); + }, + __wbg_cullFace_f1c75ae19b07eaf3: function(arg0, arg1) { + arg0.cullFace(arg1 >>> 0); + }, + __wbg_debug_87fd9b1a625b7efb: function(arg0) { + console.debug(arg0); + }, + __wbg_deleteBuffer_08eb938e35c27967: function(arg0, arg1) { + arg0.deleteBuffer(arg1); + }, + __wbg_deleteBuffer_1ca3ffe668a488e7: function(arg0, arg1) { + arg0.deleteBuffer(arg1); + }, + __wbg_deleteFramebuffer_963cd69957209d37: function(arg0, arg1) { + arg0.deleteFramebuffer(arg1); + }, + __wbg_deleteFramebuffer_d1a36e889b009344: function(arg0, arg1) { + arg0.deleteFramebuffer(arg1); + }, + __wbg_deleteProgram_09bd45a51105b2f6: function(arg0, arg1) { + arg0.deleteProgram(arg1); + }, + __wbg_deleteProgram_132e191baa9fa84f: function(arg0, arg1) { + arg0.deleteProgram(arg1); + }, + __wbg_deleteShader_3120790d36063afe: function(arg0, arg1) { + arg0.deleteShader(arg1); + }, + __wbg_deleteShader_993edb4beb3c4d53: function(arg0, arg1) { + arg0.deleteShader(arg1); + }, + __wbg_deleteTexture_2b163b157ea1be24: function(arg0, arg1) { + arg0.deleteTexture(arg1); + }, + __wbg_deleteTexture_bdc2202d7a50dcea: function(arg0, arg1) { + arg0.deleteTexture(arg1); + }, + __wbg_deleteVertexArrayOES_7fa59c32cfdfa6fa: function(arg0, arg1) { + arg0.deleteVertexArrayOES(arg1); + }, + __wbg_deleteVertexArray_475d4e969aac1dd0: function(arg0, arg1) { + arg0.deleteVertexArray(arg1); + }, + __wbg_deltaX_5d829ffba565ed10: function(arg0) { + const ret = arg0.deltaX; + return ret; + }, + __wbg_deltaY_6cfce8f8da250c23: function(arg0) { + const ret = arg0.deltaY; + return ret; + }, + __wbg_depthFunc_455cfeb8a9d2fb4c: function(arg0, arg1) { + arg0.depthFunc(arg1 >>> 0); + }, + __wbg_depthFunc_74a8f8acf8973c86: function(arg0, arg1) { + arg0.depthFunc(arg1 >>> 0); + }, + __wbg_depthMask_4bd6c73b1339d257: function(arg0, arg1) { + arg0.depthMask(arg1 !== 0); + }, + __wbg_depthMask_a644a67deced3257: function(arg0, arg1) { + arg0.depthMask(arg1 !== 0); + }, + __wbg_devicePixelRatio_1c0e0ed7deb19cd8: function(arg0) { + const ret = arg0.devicePixelRatio; + return ret; + }, + __wbg_disable_1659d1b7d50c31e7: function(arg0, arg1) { + arg0.disable(arg1 >>> 0); + }, + __wbg_disable_40c3975167c1ee07: function(arg0, arg1) { + arg0.disable(arg1 >>> 0); + }, + __wbg_document_179650d6cb13c263: function(arg0) { + const ret = arg0.document; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_drawArraysInstancedANGLE_d58dbd2d38fdebaa: function(arg0, arg1, arg2, arg3, arg4) { + arg0.drawArraysInstancedANGLE(arg1 >>> 0, arg2, arg3, arg4); + }, + __wbg_drawArraysInstanced_51b161548a3f10c4: function(arg0, arg1, arg2, arg3, arg4) { + arg0.drawArraysInstanced(arg1 >>> 0, arg2, arg3, arg4); + }, + __wbg_drawArrays_676becae0149ed65: function(arg0, arg1, arg2, arg3) { + arg0.drawArrays(arg1 >>> 0, arg2, arg3); + }, + __wbg_drawArrays_b0c59a6e158122f2: function(arg0, arg1, arg2, arg3) { + arg0.drawArrays(arg1 >>> 0, arg2, arg3); + }, + __wbg_drawElementsInstancedANGLE_9b58c4013373b180: function(arg0, arg1, arg2, arg3, arg4, arg5) { + arg0.drawElementsInstancedANGLE(arg1 >>> 0, arg2, arg3 >>> 0, arg4, arg5); + }, + __wbg_drawElementsInstanced_c7f96ea02e6d5326: function(arg0, arg1, arg2, arg3, arg4, arg5) { + arg0.drawElementsInstanced(arg1 >>> 0, arg2, arg3 >>> 0, arg4, arg5); + }, + __wbg_drawElements_24d819ce3fa4e848: function(arg0, arg1, arg2, arg3, arg4) { + arg0.drawElements(arg1 >>> 0, arg2, arg3 >>> 0, arg4); + }, + __wbg_drawElements_44c54d328f546528: function(arg0, arg1, arg2, arg3, arg4) { + arg0.drawElements(arg1 >>> 0, arg2, arg3 >>> 0, arg4); + }, + __wbg_enableVertexAttribArray_4c08219124740f14: function(arg0, arg1) { + arg0.enableVertexAttribArray(arg1 >>> 0); + }, + __wbg_enableVertexAttribArray_7470ba2dcf2606e3: function(arg0, arg1) { + arg0.enableVertexAttribArray(arg1 >>> 0); + }, + __wbg_enable_28bbeed576131d1f: function(arg0, arg1) { + arg0.enable(arg1 >>> 0); + }, + __wbg_enable_611804c0ac1504ce: function(arg0, arg1) { + arg0.enable(arg1 >>> 0); + }, + __wbg_error_744744ff0c9861e6: function(arg0) { + console.error(arg0); + }, + __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) { + let deferred0_0; + let deferred0_1; + try { + deferred0_0 = arg0; + deferred0_1 = arg1; + console.error(getStringFromWasm0(arg0, arg1)); + } finally { + wasm.__wbindgen_free(deferred0_0, deferred0_1, 1); + } + }, + __wbg_error_deab6ad15f02a66a: function(arg0, arg1) { + console.error(getStringFromWasm0(arg0, arg1)); + }, + __wbg_exitFullscreen_7bda0f69cc078f03: function(arg0) { + arg0.exitFullscreen(); + }, + __wbg_exitPointerLock_a188e9d7ca5c5405: function(arg0) { + arg0.exitPointerLock(); + }, + __wbg_focus_2f77051f98540625: function() { return handleError(function (arg0) { + arg0.focus(); + }, arguments); }, + __wbg_framebufferTexture2D_3c2abd606fc53f31: function(arg0, arg1, arg2, arg3, arg4, arg5) { + arg0.framebufferTexture2D(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0, arg4, arg5); + }, + __wbg_framebufferTexture2D_e1fb64212fcda219: function(arg0, arg1, arg2, arg3, arg4, arg5) { + arg0.framebufferTexture2D(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0, arg4, arg5); + }, + __wbg_fullscreen_b047bcb3d273275c: function(arg0) { + const ret = arg0.fullscreen; + return ret; + }, + __wbg_generateMipmap_18f44736a6a40621: function(arg0, arg1) { + arg0.generateMipmap(arg1 >>> 0); + }, + __wbg_generateMipmap_f3b84861ff9cc175: function(arg0, arg1) { + arg0.generateMipmap(arg1 >>> 0); + }, + __wbg_getActiveUniform_1172c049ce2c5c6f: function(arg0, arg1, arg2) { + const ret = arg0.getActiveUniform(arg1, arg2 >>> 0); + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_getActiveUniform_e58ab19b1c87ec40: function(arg0, arg1, arg2) { + const ret = arg0.getActiveUniform(arg1, arg2 >>> 0); + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_getAttribute_5a601ba4718b922a: function(arg0, arg1, arg2, arg3) { + const ret = arg1.getAttribute(getStringFromWasm0(arg2, arg3)); + var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + var len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }, + __wbg_getBoundingClientRect_e828e6c31c66dea6: function(arg0) { + const ret = arg0.getBoundingClientRect(); + return ret; + }, + __wbg_getContext_ca12bb65aab778a4: function() { return handleError(function (arg0, arg1, arg2, arg3) { + const ret = arg0.getContext(getStringFromWasm0(arg1, arg2), arg3); + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, arguments); }, + __wbg_getElementById_1cbd8f06dbe8eb8e: function(arg0, arg1, arg2) { + const ret = arg0.getElementById(getStringFromWasm0(arg1, arg2)); + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_getExtension_101c7e41de3e4d90: function() { return handleError(function (arg0, arg1, arg2) { + const ret = arg0.getExtension(getStringFromWasm0(arg1, arg2)); + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, arguments); }, + __wbg_getExtension_72db47e91b2d77c7: function() { return handleError(function (arg0, arg1, arg2) { + const ret = arg0.getExtension(getStringFromWasm0(arg1, arg2)); + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, arguments); }, + __wbg_getParameter_039a5899307fab55: function() { return handleError(function (arg0, arg1) { + const ret = arg0.getParameter(arg1 >>> 0); + return ret; + }, arguments); }, + __wbg_getParameter_d39f59581389af1b: function() { return handleError(function (arg0, arg1) { + const ret = arg0.getParameter(arg1 >>> 0); + return ret; + }, arguments); }, + __wbg_getProgramInfoLog_c4762e0513468a26: function(arg0, arg1, arg2) { + const ret = arg1.getProgramInfoLog(arg2); + var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + var len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }, + __wbg_getProgramInfoLog_d1ce570463a68779: function(arg0, arg1, arg2) { + const ret = arg1.getProgramInfoLog(arg2); + var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + var len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }, + __wbg_getProgramParameter_b9995b56c258ac86: function(arg0, arg1, arg2) { + const ret = arg0.getProgramParameter(arg1, arg2 >>> 0); + return ret; + }, + __wbg_getProgramParameter_c8d1154fbb3c0890: function(arg0, arg1, arg2) { + const ret = arg0.getProgramParameter(arg1, arg2 >>> 0); + return ret; + }, + __wbg_getRandomValues_3f44b700395062e5: function() { return handleError(function (arg0, arg1) { + globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1)); + }, arguments); }, + __wbg_getShaderInfoLog_5cee2add982c7165: function(arg0, arg1, arg2) { + const ret = arg1.getShaderInfoLog(arg2); + var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + var len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }, + __wbg_getShaderInfoLog_bc236afe696c1283: function(arg0, arg1, arg2) { + const ret = arg1.getShaderInfoLog(arg2); + var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + var len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }, + __wbg_getShaderParameter_3394e75dcb97f380: function(arg0, arg1, arg2) { + const ret = arg0.getShaderParameter(arg1, arg2 >>> 0); + return ret; + }, + __wbg_getShaderParameter_cbcc0995e8e16214: function(arg0, arg1, arg2) { + const ret = arg0.getShaderParameter(arg1, arg2 >>> 0); + return ret; + }, + __wbg_getSupportedExtensions_2a7458ec45e82560: function(arg0) { + const ret = arg0.getSupportedExtensions(); + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_getSupportedExtensions_7857ec28819e5f1e: function(arg0) { + const ret = arg0.getSupportedExtensions(); + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_getUTCDay_a70766185f119e98: function(arg0) { + const ret = arg0.getUTCDay(); + return ret; + }, + __wbg_getUTCFullYear_5af8ca4e2020c06e: function(arg0) { + const ret = arg0.getUTCFullYear(); + return ret; + }, + __wbg_getUTCHours_3f030631d89309ea: function(arg0) { + const ret = arg0.getUTCHours(); + return ret; + }, + __wbg_getUTCMinutes_03f5d6c64c8b2fb1: function(arg0) { + const ret = arg0.getUTCMinutes(); + return ret; + }, + __wbg_getUTCMonth_773ed3c34515d086: function(arg0) { + const ret = arg0.getUTCMonth(); + return ret; + }, + __wbg_getUTCSeconds_92d08d3589a8958a: function(arg0) { + const ret = arg0.getUTCSeconds(); + return ret; + }, + __wbg_getUniformBlockIndex_cfee6ff6d323c784: function(arg0, arg1, arg2, arg3) { + const ret = arg0.getUniformBlockIndex(arg1, getStringFromWasm0(arg2, arg3)); + return ret; + }, + __wbg_getUniformLocation_24ef46cdda2148ab: function(arg0, arg1, arg2, arg3) { + const ret = arg0.getUniformLocation(arg1, getStringFromWasm0(arg2, arg3)); + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_getUniformLocation_788a34295dd6fabe: function(arg0, arg1, arg2, arg3) { + const ret = arg0.getUniformLocation(arg1, getStringFromWasm0(arg2, arg3)); + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_get_unchecked_6e0ad6d2a41b06f6: function(arg0, arg1) { + const ret = arg0[arg1 >>> 0]; + return ret; + }, + __wbg_hasFocus_cc8af87239498204: function() { return handleError(function (arg0) { + const ret = arg0.hasFocus(); + return ret; + }, arguments); }, + __wbg_height_88fcc72a51006db4: function() { return handleError(function (arg0) { + const ret = arg0.height; + return ret; + }, arguments); }, + __wbg_id_2bb4f5057d3bfc99: function(arg0, arg1) { + const ret = arg1.id; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }, + __wbg_info_eadbe775a8e2e9eb: function(arg0) { + console.info(arg0); + }, + __wbg_instanceof_HtmlCanvasElement_ed02ed9136056019: function(arg0) { + let result; + try { + result = arg0 instanceof HTMLCanvasElement; + } catch (_) { + result = false; + } + const ret = result; + return ret; + }, + __wbg_instanceof_WebGl2RenderingContext_90225152e4e3c799: function(arg0) { + let result; + try { + result = arg0 instanceof WebGL2RenderingContext; + } catch (_) { + result = false; + } + const ret = result; + return ret; + }, + __wbg_instanceof_WebGlRenderingContext_3a2147e38261ce18: function(arg0) { + let result; + try { + result = arg0 instanceof WebGLRenderingContext; + } catch (_) { + result = false; + } + const ret = result; + return ret; + }, + __wbg_instanceof_Window_05ba1ee4f6781663: function(arg0) { + let result; + try { + result = arg0 instanceof Window; + } catch (_) { + result = false; + } + const ret = result; + return ret; + }, + __wbg_key_803dca86cdcfa8dd: function(arg0, arg1) { + const ret = arg1.key; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }, + __wbg_left_7e76a74d0db1754f: function(arg0) { + const ret = arg0.left; + return ret; + }, + __wbg_length_370319915dc99107: function(arg0) { + const ret = arg0.length; + return ret; + }, + __wbg_linkProgram_4e047fb3197a0348: function(arg0, arg1) { + arg0.linkProgram(arg1); + }, + __wbg_linkProgram_d7c71c539c8c6a43: function(arg0, arg1) { + arg0.linkProgram(arg1); + }, + __wbg_log_d267660666346fb3: function(arg0) { + console.log(arg0); + }, + __wbg_movementX_87e39021f3fce8b8: function(arg0) { + const ret = arg0.movementX; + return ret; + }, + __wbg_movementY_f6f63087e2248fa9: function(arg0) { + const ret = arg0.movementY; + return ret; + }, + __wbg_name_0fc5ff57b2835432: function(arg0, arg1) { + const ret = arg1.name; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }, + __wbg_new_0_3da9e97f24fc69be: function() { + const ret = new Date(); + return ret; + }, + __wbg_new_227d7c05414eb861: function() { + const ret = new Error(); + return ret; + }, + __wbg_new_da52cf8fe3429cb2: function() { + const ret = new Object(); + return ret; + }, + __wbg_now_86c0d4ba3fa605b8: function() { + const ret = Date.now(); + return ret; + }, + __wbg_now_e7c6795a7f81e10f: function(arg0) { + const ret = arg0.now(); + return ret; + }, + __wbg_open_221b279749ba2e4e: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) { + const ret = arg0.open(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4)); + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, arguments); }, + __wbg_parentElement_5030754e30795652: function(arg0) { + const ret = arg0.parentElement; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_performance_3fcf6e32a7e1ed0a: function(arg0) { + const ret = arg0.performance; + return ret; + }, + __wbg_pixelStorei_2a93b18efde9acf8: function(arg0, arg1, arg2) { + arg0.pixelStorei(arg1 >>> 0, arg2); + }, + __wbg_pixelStorei_c844cd0db4f1fde6: function(arg0, arg1, arg2) { + arg0.pixelStorei(arg1 >>> 0, arg2); + }, + __wbg_pointerId_ea33d2695be12e7f: function(arg0) { + const ret = arg0.pointerId; + return ret; + }, + __wbg_pointerLockElement_1e6b7da5caad7e29: function(arg0) { + const ret = arg0.pointerLockElement; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_pointerType_d5e932608aa61bb6: function(arg0, arg1) { + const ret = arg1.pointerType; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }, + __wbg_preventDefault_b64888c857500682: function(arg0) { + arg0.preventDefault(); + }, + __wbg_readPixels_5f013a7d85b23800: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) { + arg0.readPixels(arg1, arg2, arg3, arg4, arg5 >>> 0, arg6 >>> 0, arg7); + }, arguments); }, + __wbg_readPixels_82c9dee754d58176: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) { + arg0.readPixels(arg1, arg2, arg3, arg4, arg5 >>> 0, arg6 >>> 0, arg7); + }, arguments); }, + __wbg_readPixels_c7861e25836bf57b: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) { + arg0.readPixels(arg1, arg2, arg3, arg4, arg5 >>> 0, arg6 >>> 0, arg7); + }, arguments); }, + __wbg_requestAnimationFrame_1a85deeab66448c2: function() { return handleError(function (arg0, arg1) { + const ret = arg0.requestAnimationFrame(arg1); + return ret; + }, arguments); }, + __wbg_requestFullscreen_ba637845d23582f1: function() { return handleError(function (arg0) { + arg0.requestFullscreen(); + }, arguments); }, + __wbg_requestPointerLock_989cabcffbb4aec5: function(arg0) { + arg0.requestPointerLock(); + }, + __wbg_scissor_105e756596bc35df: function(arg0, arg1, arg2, arg3, arg4) { + arg0.scissor(arg1, arg2, arg3, arg4); + }, + __wbg_scissor_573b844152316b8d: function(arg0, arg1, arg2, arg3, arg4) { + arg0.scissor(arg1, arg2, arg3, arg4); + }, + __wbg_screen_99621feb231136f1: function() { return handleError(function (arg0) { + const ret = arg0.screen; + return ret; + }, arguments); }, + __wbg_send_done_326e83aeec683f47: function(arg0) { + send_done(arg0 !== 0); + }, + __wbg_send_ready_faa77f3634f876a3: function() { + send_ready(); + }, + __wbg_send_started_3a6ec872e822b33e: function(arg0, arg1) { + let deferred0_0; + let deferred0_1; + try { + deferred0_0 = arg0; + deferred0_1 = arg1; + send_started(getStringFromWasm0(arg0, arg1)); + } finally { + wasm.__wbindgen_free(deferred0_0, deferred0_1, 1); + } + }, + __wbg_setAttribute_71039043be82d098: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) { + arg0.setAttribute(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4)); + }, arguments); }, + __wbg_setProperty_e4e51b1b1d681d15: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) { + arg0.setProperty(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4)); + }, arguments); }, + __wbg_set_alpha_695e0ae07be8e6fe: function(arg0, arg1) { + arg0.alpha = arg1 !== 0; + }, + __wbg_set_antialias_377e879f0c5bad5a: function(arg0, arg1) { + arg0.antialias = arg1 !== 0; + }, + __wbg_set_fail_if_major_performance_caveat_e0f248f7cd5bb272: function(arg0, arg1) { + arg0.failIfMajorPerformanceCaveat = arg1 !== 0; + }, + __wbg_set_height_7d9d8f892e6964c6: function(arg0, arg1) { + arg0.height = arg1 >>> 0; + }, + __wbg_set_id_4beae8b813c092d8: function(arg0, arg1, arg2) { + arg0.id = getStringFromWasm0(arg1, arg2); + }, + __wbg_set_power_preference_d4bb249e54c05ea0: function(arg0, arg1) { + arg0.powerPreference = __wbindgen_enum_WebGlPowerPreference[arg1]; + }, + __wbg_set_premultiplied_alpha_106df0077befb930: function(arg0, arg1) { + arg0.premultipliedAlpha = arg1 !== 0; + }, + __wbg_set_stencil_8b0cad3fa2a5fe61: function(arg0, arg1) { + arg0.stencil = arg1 !== 0; + }, + __wbg_set_width_8e30d010cd66830d: function(arg0, arg1) { + arg0.width = arg1 >>> 0; + }, + __wbg_shaderSource_4cf90af97621ff49: function(arg0, arg1, arg2, arg3) { + arg0.shaderSource(arg1, getStringFromWasm0(arg2, arg3)); + }, + __wbg_shaderSource_c3469dc2221dd528: function(arg0, arg1, arg2, arg3) { + arg0.shaderSource(arg1, getStringFromWasm0(arg2, arg3)); + }, + __wbg_size_b36d0d28d1c4981a: function(arg0) { + const ret = arg0.size; + return ret; + }, + __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) { + const ret = arg1.stack; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }, + __wbg_static_accessor_GLOBAL_4ef717fb391d88b7: function() { + const ret = typeof global === 'undefined' ? null : global; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_static_accessor_GLOBAL_THIS_8d1badc68b5a74f4: function() { + const ret = typeof globalThis === 'undefined' ? null : globalThis; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_static_accessor_SELF_146583524fe1469b: function() { + const ret = typeof self === 'undefined' ? null : self; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_static_accessor_WINDOW_f2829a2234d7819e: function() { + const ret = typeof window === 'undefined' ? null : window; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_stencilFunc_48e49f1713dce095: function(arg0, arg1, arg2, arg3) { + arg0.stencilFunc(arg1 >>> 0, arg2, arg3 >>> 0); + }, + __wbg_stencilFunc_58cf8319300c80f4: function(arg0, arg1, arg2, arg3) { + arg0.stencilFunc(arg1 >>> 0, arg2, arg3 >>> 0); + }, + __wbg_stencilMask_1c99b79b516d12dd: function(arg0, arg1) { + arg0.stencilMask(arg1 >>> 0); + }, + __wbg_stencilMask_9a844dc58a89992f: function(arg0, arg1) { + arg0.stencilMask(arg1 >>> 0); + }, + __wbg_stencilOp_06cfeee22c1b8637: function(arg0, arg1, arg2, arg3) { + arg0.stencilOp(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0); + }, + __wbg_stencilOp_bc387bdecd5af963: function(arg0, arg1, arg2, arg3) { + arg0.stencilOp(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0); + }, + __wbg_stopPropagation_4c4ff88c29f9bc38: function(arg0) { + arg0.stopPropagation(); + }, + __wbg_style_6657aed849e5d757: function(arg0) { + const ret = arg0.style; + return ret; + }, + __wbg_texImage2D_3813406af5bf54c8: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) { + arg0.texImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8 >>> 0, arg9); + }, arguments); }, + __wbg_texImage2D_5abd8779d1d033c7: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) { + arg0.texImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8 >>> 0, arg9); + }, arguments); }, + __wbg_texImage2D_8d168171984f2a40: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) { + arg0.texImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8 >>> 0, arg9); + }, arguments); }, + __wbg_texParameteri_1fc451e0964fc91c: function(arg0, arg1, arg2, arg3) { + arg0.texParameteri(arg1 >>> 0, arg2 >>> 0, arg3); + }, + __wbg_texParameteri_9d0daa263d3a863f: function(arg0, arg1, arg2, arg3) { + arg0.texParameteri(arg1 >>> 0, arg2 >>> 0, arg3); + }, + __wbg_texSubImage2D_047380bb2660e4f9: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) { + arg0.texSubImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8 >>> 0, arg9); + }, arguments); }, + __wbg_texSubImage2D_d1af697e69f8a9e4: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) { + arg0.texSubImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8 >>> 0, arg9); + }, arguments); }, + __wbg_texSubImage2D_d3cd09d0ffcb27be: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) { + arg0.texSubImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8 >>> 0, arg9); + }, arguments); }, + __wbg_top_fe120acfa924a430: function(arg0) { + const ret = arg0.top; + return ret; + }, + __wbg_type_d8812aaede3b3a4a: function(arg0) { + const ret = arg0.type; + return ret; + }, + __wbg_uniform1i_5830de6702add20a: function(arg0, arg1, arg2) { + arg0.uniform1i(arg1, arg2); + }, + __wbg_uniform1i_7621f908f78177df: function(arg0, arg1, arg2) { + arg0.uniform1i(arg1, arg2); + }, + __wbg_uniformBlockBinding_a9ed6b750199e03c: function(arg0, arg1, arg2, arg3) { + arg0.uniformBlockBinding(arg1, arg2 >>> 0, arg3 >>> 0); + }, + __wbg_useProgram_182d120fe476921b: function(arg0, arg1) { + arg0.useProgram(arg1); + }, + __wbg_useProgram_49495850b446fa56: function(arg0, arg1) { + arg0.useProgram(arg1); + }, + __wbg_vertexAttribDivisorANGLE_978337b09d11ed84: function(arg0, arg1, arg2) { + arg0.vertexAttribDivisorANGLE(arg1 >>> 0, arg2 >>> 0); + }, + __wbg_vertexAttribDivisor_fb31b5ed9bc856da: function(arg0, arg1, arg2) { + arg0.vertexAttribDivisor(arg1 >>> 0, arg2 >>> 0); + }, + __wbg_vertexAttribPointer_a8f0af57269c2067: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { + arg0.vertexAttribPointer(arg1 >>> 0, arg2, arg3 >>> 0, arg4 !== 0, arg5, arg6); + }, + __wbg_vertexAttribPointer_b300c8e000cdac93: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { + arg0.vertexAttribPointer(arg1 >>> 0, arg2, arg3 >>> 0, arg4 !== 0, arg5, arg6); + }, + __wbg_viewport_affdf15c559df1e2: function(arg0, arg1, arg2, arg3, arg4) { + arg0.viewport(arg1, arg2, arg3, arg4); + }, + __wbg_viewport_e8a16ca4a5085e5f: function(arg0, arg1, arg2, arg3, arg4) { + arg0.viewport(arg1, arg2, arg3, arg4); + }, + __wbg_warn_b1370d804fa3e259: function(arg0) { + console.warn(arg0); + }, + __wbg_width_803b57798d6492f2: function() { return handleError(function (arg0) { + const ret = arg0.width; + return ret; + }, arguments); }, + __wbindgen_cast_0000000000000001: function(arg0, arg1) { + // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 445, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`. + const ret = makeMutClosure(arg0, arg1, wasm_bindgen_a54a27798c28f5e2___convert__closures_____invoke___web_sys_4c11355c90da68f3___features__gen_Event__Event______true_); + return ret; + }, + __wbindgen_cast_0000000000000002: function(arg0, arg1) { + // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("KeyboardEvent")], shim_idx: 444, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`. + const ret = makeMutClosure(arg0, arg1, wasm_bindgen_a54a27798c28f5e2___convert__closures_____invoke___web_sys_4c11355c90da68f3___features__gen_KeyboardEvent__KeyboardEvent______true_); + return ret; + }, + __wbindgen_cast_0000000000000003: function(arg0, arg1) { + // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MouseEvent")], shim_idx: 441, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`. + const ret = makeMutClosure(arg0, arg1, wasm_bindgen_a54a27798c28f5e2___convert__closures_____invoke___web_sys_4c11355c90da68f3___features__gen_MouseEvent__MouseEvent______true_); + return ret; + }, + __wbindgen_cast_0000000000000004: function(arg0, arg1) { + // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("PointerEvent")], shim_idx: 443, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`. + const ret = makeMutClosure(arg0, arg1, wasm_bindgen_a54a27798c28f5e2___convert__closures_____invoke___web_sys_4c11355c90da68f3___features__gen_PointerEvent__PointerEvent______true_); + return ret; + }, + __wbindgen_cast_0000000000000005: function(arg0, arg1) { + // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("WheelEvent")], shim_idx: 442, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`. + const ret = makeMutClosure(arg0, arg1, wasm_bindgen_a54a27798c28f5e2___convert__closures_____invoke___web_sys_4c11355c90da68f3___features__gen_WheelEvent__WheelEvent______true_); + return ret; + }, + __wbindgen_cast_0000000000000006: function(arg0, arg1) { + // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 831, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`. + const ret = makeMutClosure(arg0, arg1, wasm_bindgen_a54a27798c28f5e2___convert__closures_____invoke_______true_); + return ret; + }, + __wbindgen_cast_0000000000000007: function(arg0, arg1) { + // Cast intrinsic for `Ref(Slice(F32)) -> NamedExternref("Float32Array")`. + const ret = getArrayF32FromWasm0(arg0, arg1); + return ret; + }, + __wbindgen_cast_0000000000000008: function(arg0, arg1) { + // Cast intrinsic for `Ref(Slice(I16)) -> NamedExternref("Int16Array")`. + const ret = getArrayI16FromWasm0(arg0, arg1); + return ret; + }, + __wbindgen_cast_0000000000000009: function(arg0, arg1) { + // Cast intrinsic for `Ref(Slice(I32)) -> NamedExternref("Int32Array")`. + const ret = getArrayI32FromWasm0(arg0, arg1); + return ret; + }, + __wbindgen_cast_000000000000000a: function(arg0, arg1) { + // Cast intrinsic for `Ref(Slice(I8)) -> NamedExternref("Int8Array")`. + const ret = getArrayI8FromWasm0(arg0, arg1); + return ret; + }, + __wbindgen_cast_000000000000000b: function(arg0, arg1) { + // Cast intrinsic for `Ref(Slice(U16)) -> NamedExternref("Uint16Array")`. + const ret = getArrayU16FromWasm0(arg0, arg1); + return ret; + }, + __wbindgen_cast_000000000000000c: function(arg0, arg1) { + // Cast intrinsic for `Ref(Slice(U32)) -> NamedExternref("Uint32Array")`. + const ret = getArrayU32FromWasm0(arg0, arg1); + return ret; + }, + __wbindgen_cast_000000000000000d: function(arg0, arg1) { + // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`. + const ret = getArrayU8FromWasm0(arg0, arg1); + return ret; + }, + __wbindgen_cast_000000000000000e: function(arg0, arg1) { + // Cast intrinsic for `Ref(String) -> Externref`. + const ret = getStringFromWasm0(arg0, arg1); + return ret; + }, + __wbindgen_init_externref_table: function() { + const table = wasm.__wbindgen_externrefs; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + }, + }; + return { + __proto__: null, + "./microjam_rctrctrl_bg.js": import0, + }; +} + +function wasm_bindgen_a54a27798c28f5e2___convert__closures_____invoke_______true_(arg0, arg1) { + wasm.wasm_bindgen_a54a27798c28f5e2___convert__closures_____invoke_______true_(arg0, arg1); +} + +function wasm_bindgen_a54a27798c28f5e2___convert__closures_____invoke___web_sys_4c11355c90da68f3___features__gen_Event__Event______true_(arg0, arg1, arg2) { + wasm.wasm_bindgen_a54a27798c28f5e2___convert__closures_____invoke___web_sys_4c11355c90da68f3___features__gen_Event__Event______true_(arg0, arg1, arg2); +} + +function wasm_bindgen_a54a27798c28f5e2___convert__closures_____invoke___web_sys_4c11355c90da68f3___features__gen_KeyboardEvent__KeyboardEvent______true_(arg0, arg1, arg2) { + wasm.wasm_bindgen_a54a27798c28f5e2___convert__closures_____invoke___web_sys_4c11355c90da68f3___features__gen_KeyboardEvent__KeyboardEvent______true_(arg0, arg1, arg2); +} + +function wasm_bindgen_a54a27798c28f5e2___convert__closures_____invoke___web_sys_4c11355c90da68f3___features__gen_MouseEvent__MouseEvent______true_(arg0, arg1, arg2) { + wasm.wasm_bindgen_a54a27798c28f5e2___convert__closures_____invoke___web_sys_4c11355c90da68f3___features__gen_MouseEvent__MouseEvent______true_(arg0, arg1, arg2); +} + +function wasm_bindgen_a54a27798c28f5e2___convert__closures_____invoke___web_sys_4c11355c90da68f3___features__gen_PointerEvent__PointerEvent______true_(arg0, arg1, arg2) { + wasm.wasm_bindgen_a54a27798c28f5e2___convert__closures_____invoke___web_sys_4c11355c90da68f3___features__gen_PointerEvent__PointerEvent______true_(arg0, arg1, arg2); +} + +function wasm_bindgen_a54a27798c28f5e2___convert__closures_____invoke___web_sys_4c11355c90da68f3___features__gen_WheelEvent__WheelEvent______true_(arg0, arg1, arg2) { + wasm.wasm_bindgen_a54a27798c28f5e2___convert__closures_____invoke___web_sys_4c11355c90da68f3___features__gen_WheelEvent__WheelEvent______true_(arg0, arg1, arg2); +} + + +const __wbindgen_enum_WebGlPowerPreference = ["default", "low-power", "high-performance"]; + +function addToExternrefTable0(obj) { + const idx = wasm.__externref_table_alloc(); + wasm.__wbindgen_externrefs.set(idx, obj); + return idx; +} + +const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined') + ? { register: () => {}, unregister: () => {} } + : new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b)); + +function debugString(val) { + // primitive types + const type = typeof val; + if (type == 'number' || type == 'boolean' || val == null) { + return `${val}`; + } + if (type == 'string') { + return `"${val}"`; + } + if (type == 'symbol') { + const description = val.description; + if (description == null) { + return 'Symbol'; + } else { + return `Symbol(${description})`; + } + } + if (type == 'function') { + const name = val.name; + if (typeof name == 'string' && name.length > 0) { + return `Function(${name})`; + } else { + return 'Function'; + } + } + // objects + if (Array.isArray(val)) { + const length = val.length; + let debug = '['; + if (length > 0) { + debug += debugString(val[0]); + } + for(let i = 1; i < length; i++) { + debug += ', ' + debugString(val[i]); + } + debug += ']'; + return debug; + } + // Test for built-in + const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val)); + let className; + if (builtInMatches && builtInMatches.length > 1) { + className = builtInMatches[1]; + } else { + // Failed to match the standard '[object ClassName]' + return toString.call(val); + } + if (className == 'Object') { + // we're a user defined class or Object + // JSON.stringify avoids problems with cycles, and is generally much + // easier than looping through ownProperties of `val`. + try { + return 'Object(' + JSON.stringify(val) + ')'; + } catch (_) { + return 'Object'; + } + } + // errors + if (val instanceof Error) { + return `${val.name}: ${val.message}\n${val.stack}`; + } + // TODO we could test for more things here, like `Set`s and `Map`s. + return className; +} + +function getArrayF32FromWasm0(ptr, len) { + ptr = ptr >>> 0; + return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len); +} + +function getArrayI16FromWasm0(ptr, len) { + ptr = ptr >>> 0; + return getInt16ArrayMemory0().subarray(ptr / 2, ptr / 2 + len); +} + +function getArrayI32FromWasm0(ptr, len) { + ptr = ptr >>> 0; + return getInt32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len); +} + +function getArrayI8FromWasm0(ptr, len) { + ptr = ptr >>> 0; + return getInt8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len); +} + +function getArrayU16FromWasm0(ptr, len) { + ptr = ptr >>> 0; + return getUint16ArrayMemory0().subarray(ptr / 2, ptr / 2 + len); +} + +function getArrayU32FromWasm0(ptr, len) { + ptr = ptr >>> 0; + return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len); +} + +function getArrayU8FromWasm0(ptr, len) { + ptr = ptr >>> 0; + return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len); +} + +let cachedDataViewMemory0 = null; +function getDataViewMemory0() { + if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { + cachedDataViewMemory0 = new DataView(wasm.memory.buffer); + } + return cachedDataViewMemory0; +} + +let cachedFloat32ArrayMemory0 = null; +function getFloat32ArrayMemory0() { + if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) { + cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer); + } + return cachedFloat32ArrayMemory0; +} + +let cachedInt16ArrayMemory0 = null; +function getInt16ArrayMemory0() { + if (cachedInt16ArrayMemory0 === null || cachedInt16ArrayMemory0.byteLength === 0) { + cachedInt16ArrayMemory0 = new Int16Array(wasm.memory.buffer); + } + return cachedInt16ArrayMemory0; +} + +let cachedInt32ArrayMemory0 = null; +function getInt32ArrayMemory0() { + if (cachedInt32ArrayMemory0 === null || cachedInt32ArrayMemory0.byteLength === 0) { + cachedInt32ArrayMemory0 = new Int32Array(wasm.memory.buffer); + } + return cachedInt32ArrayMemory0; +} + +let cachedInt8ArrayMemory0 = null; +function getInt8ArrayMemory0() { + if (cachedInt8ArrayMemory0 === null || cachedInt8ArrayMemory0.byteLength === 0) { + cachedInt8ArrayMemory0 = new Int8Array(wasm.memory.buffer); + } + return cachedInt8ArrayMemory0; +} + +function getStringFromWasm0(ptr, len) { + return decodeText(ptr >>> 0, len); +} + +let cachedUint16ArrayMemory0 = null; +function getUint16ArrayMemory0() { + if (cachedUint16ArrayMemory0 === null || cachedUint16ArrayMemory0.byteLength === 0) { + cachedUint16ArrayMemory0 = new Uint16Array(wasm.memory.buffer); + } + return cachedUint16ArrayMemory0; +} + +let cachedUint32ArrayMemory0 = null; +function getUint32ArrayMemory0() { + if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) { + cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer); + } + return cachedUint32ArrayMemory0; +} + +let cachedUint8ArrayMemory0 = null; +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +function handleError(f, args) { + try { + return f.apply(this, args); + } catch (e) { + const idx = addToExternrefTable0(e); + wasm.__wbindgen_exn_store(idx); + } +} + +function isLikeNone(x) { + return x === undefined || x === null; +} + +function makeMutClosure(arg0, arg1, f) { + const state = { a: arg0, b: arg1, cnt: 1 }; + const real = (...args) => { + + // First up with a closure we increment the internal reference + // count. This ensures that the Rust closure environment won't + // be deallocated while we're invoking it. + state.cnt++; + const a = state.a; + state.a = 0; + try { + return f(a, state.b, ...args); + } finally { + state.a = a; + real._wbg_cb_unref(); + } + }; + real._wbg_cb_unref = () => { + if (--state.cnt === 0) { + wasm.__wbindgen_destroy_closure(state.a, state.b); + state.a = 0; + CLOSURE_DTORS.unregister(state); + } + }; + CLOSURE_DTORS.register(real, state, state); + return real; +} + +function passStringToWasm0(arg, malloc, realloc) { + if (realloc === undefined) { + const buf = cachedTextEncoder.encode(arg); + const ptr = malloc(buf.length, 1) >>> 0; + getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf); + WASM_VECTOR_LEN = buf.length; + return ptr; + } + + let len = arg.length; + let ptr = malloc(len, 1) >>> 0; + + const mem = getUint8ArrayMemory0(); + + let offset = 0; + + for (; offset < len; offset++) { + const code = arg.charCodeAt(offset); + if (code > 0x7F) break; + mem[ptr + offset] = code; + } + if (offset !== len) { + if (offset !== 0) { + arg = arg.slice(offset); + } + ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; + const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); + const ret = cachedTextEncoder.encodeInto(arg, view); + + offset += ret.written; + ptr = realloc(ptr, len, offset, 1) >>> 0; + } + + WASM_VECTOR_LEN = offset; + return ptr; +} + +let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); +cachedTextDecoder.decode(); +const MAX_SAFARI_DECODE_BYTES = 2146435072; +let numBytesDecoded = 0; +function decodeText(ptr, len) { + numBytesDecoded += len; + if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) { + cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + cachedTextDecoder.decode(); + numBytesDecoded = len; + } + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} + +const cachedTextEncoder = new TextEncoder(); + +if (!('encodeInto' in cachedTextEncoder)) { + cachedTextEncoder.encodeInto = function (arg, view) { + const buf = cachedTextEncoder.encode(arg); + view.set(buf); + return { + read: arg.length, + written: buf.length + }; + }; +} + +let WASM_VECTOR_LEN = 0; + +let wasmModule, wasmInstance, wasm; +function __wbg_finalize_init(instance, module) { + wasmInstance = instance; + wasm = instance.exports; + wasmModule = module; + cachedDataViewMemory0 = null; + cachedFloat32ArrayMemory0 = null; + cachedInt16ArrayMemory0 = null; + cachedInt32ArrayMemory0 = null; + cachedInt8ArrayMemory0 = null; + cachedUint16ArrayMemory0 = null; + cachedUint32ArrayMemory0 = null; + cachedUint8ArrayMemory0 = null; + wasm.__wbindgen_start(); + return wasm; +} + +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + } catch (e) { + const validResponse = module.ok && expectedResponseType(module.type); + + if (validResponse && 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 { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + } else { + return instance; + } + } + + function expectedResponseType(type) { + switch (type) { + case 'basic': case 'cors': case 'default': return true; + } + return false; + } +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + + if (module !== undefined) { + if (Object.getPrototypeOf(module) === Object.prototype) { + ({module} = module) + } else { + console.warn('using deprecated parameters for `initSync()`; pass a single object instead') + } + } + + const imports = __wbg_get_imports(); + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); + } + const instance = new WebAssembly.Instance(module, imports); + return __wbg_finalize_init(instance, module); +} + +async function __wbg_init(module_or_path) { + if (wasm !== undefined) return wasm; + + + if (module_or_path !== undefined) { + if (Object.getPrototypeOf(module_or_path) === Object.prototype) { + ({module_or_path} = module_or_path) + } else { + console.warn('using deprecated parameters for the initialization function; pass a single object instead') + } + } + + if (module_or_path === undefined) { + module_or_path = new URL('microjam_rctrctrl_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) { + module_or_path = fetch(module_or_path); + } + + const { instance, module } = await __wbg_load(await module_or_path, imports); + + return __wbg_finalize_init(instance, module); +} + +export { initSync, __wbg_init as default }; diff --git a/2026/games/samzyre/microjam_rctrctrl-f61f8eb97d2bebe5_bg.wasm b/2026/games/samzyre/microjam_rctrctrl-f61f8eb97d2bebe5_bg.wasm Binary files differnew file mode 100644 index 0000000..80307cd --- /dev/null +++ b/2026/games/samzyre/microjam_rctrctrl-f61f8eb97d2bebe5_bg.wasm diff --git a/2026/games/yukievt/BG.png b/2026/games/yukievt/BG.png Binary files differnew file mode 100644 index 0000000..a0b1346 --- /dev/null +++ b/2026/games/yukievt/BG.png diff --git a/2026/games/yukievt/FG.png b/2026/games/yukievt/FG.png Binary files differnew file mode 100644 index 0000000..9dd75a3 --- /dev/null +++ b/2026/games/yukievt/FG.png diff --git a/2026/games/yukievt/Failure.ogg b/2026/games/yukievt/Failure.ogg Binary files differnew file mode 100644 index 0000000..a36600f --- /dev/null +++ b/2026/games/yukievt/Failure.ogg diff --git a/2026/games/yukievt/Failure.png b/2026/games/yukievt/Failure.png Binary files differnew file mode 100644 index 0000000..a47fe01 --- /dev/null +++ b/2026/games/yukievt/Failure.png diff --git a/2026/games/yukievt/HandL.png b/2026/games/yukievt/HandL.png Binary files differnew file mode 100644 index 0000000..cf01d0d --- /dev/null +++ b/2026/games/yukievt/HandL.png diff --git a/2026/games/yukievt/HandR.png b/2026/games/yukievt/HandR.png Binary files differnew file mode 100644 index 0000000..b90333a --- /dev/null +++ b/2026/games/yukievt/HandR.png diff --git a/2026/games/yukievt/Happy.ogg b/2026/games/yukievt/Happy.ogg Binary files differnew file mode 100644 index 0000000..9aab026 --- /dev/null +++ b/2026/games/yukievt/Happy.ogg diff --git a/2026/games/yukievt/HeartPop.wav b/2026/games/yukievt/HeartPop.wav Binary files differnew file mode 100644 index 0000000..ecdbdc1 --- /dev/null +++ b/2026/games/yukievt/HeartPop.wav diff --git a/2026/games/yukievt/HeartSmall.png b/2026/games/yukievt/HeartSmall.png Binary files differnew file mode 100644 index 0000000..102a146 --- /dev/null +++ b/2026/games/yukievt/HeartSmall.png diff --git a/2026/games/yukievt/MouseGuide.png b/2026/games/yukievt/MouseGuide.png Binary files differnew file mode 100644 index 0000000..3f66c74 --- /dev/null +++ b/2026/games/yukievt/MouseGuide.png diff --git a/2026/games/yukievt/Pat.ogg b/2026/games/yukievt/Pat.ogg Binary files differnew file mode 100644 index 0000000..daedb3f --- /dev/null +++ b/2026/games/yukievt/Pat.ogg diff --git a/2026/games/yukievt/PatAll.png b/2026/games/yukievt/PatAll.png Binary files differnew file mode 100644 index 0000000..0ad96a5 --- /dev/null +++ b/2026/games/yukievt/PatAll.png diff --git a/2026/games/yukievt/PatNoL.png b/2026/games/yukievt/PatNoL.png Binary files differnew file mode 100644 index 0000000..0790bdf --- /dev/null +++ b/2026/games/yukievt/PatNoL.png diff --git a/2026/games/yukievt/PatNoR.png b/2026/games/yukievt/PatNoR.png Binary files differnew file mode 100644 index 0000000..7834cd9 --- /dev/null +++ b/2026/games/yukievt/PatNoR.png diff --git a/2026/games/yukievt/RustleInL.ogg b/2026/games/yukievt/RustleInL.ogg Binary files differnew file mode 100644 index 0000000..fd40036 --- /dev/null +++ b/2026/games/yukievt/RustleInL.ogg diff --git a/2026/games/yukievt/RustleInR.ogg b/2026/games/yukievt/RustleInR.ogg Binary files differnew file mode 100644 index 0000000..882637f --- /dev/null +++ b/2026/games/yukievt/RustleInR.ogg diff --git a/2026/games/yukievt/RustleOut.ogg b/2026/games/yukievt/RustleOut.ogg Binary files differnew file mode 100644 index 0000000..20f6909 --- /dev/null +++ b/2026/games/yukievt/RustleOut.ogg diff --git a/2026/games/yukievt/RustleOutL.ogg b/2026/games/yukievt/RustleOutL.ogg Binary files differnew file mode 100644 index 0000000..90c4718 --- /dev/null +++ b/2026/games/yukievt/RustleOutL.ogg diff --git a/2026/games/yukievt/RustleOutR.ogg b/2026/games/yukievt/RustleOutR.ogg Binary files differnew file mode 100644 index 0000000..0b92a27 --- /dev/null +++ b/2026/games/yukievt/RustleOutR.ogg diff --git a/2026/games/yukievt/Sad.ogg b/2026/games/yukievt/Sad.ogg Binary files differnew file mode 100644 index 0000000..be091be --- /dev/null +++ b/2026/games/yukievt/Sad.ogg diff --git a/2026/games/yukievt/Success.ogg b/2026/games/yukievt/Success.ogg Binary files differnew file mode 100644 index 0000000..5be491b --- /dev/null +++ b/2026/games/yukievt/Success.ogg diff --git a/2026/games/yukievt/Success.png b/2026/games/yukievt/Success.png Binary files differnew file mode 100644 index 0000000..92895d2 --- /dev/null +++ b/2026/games/yukievt/Success.png diff --git a/2026/games/yukievt/TickH.wav b/2026/games/yukievt/TickH.wav Binary files differnew file mode 100644 index 0000000..02ce681 --- /dev/null +++ b/2026/games/yukievt/TickH.wav diff --git a/2026/games/yukievt/TickL.wav b/2026/games/yukievt/TickL.wav Binary files differnew file mode 100644 index 0000000..b11a0d4 --- /dev/null +++ b/2026/games/yukievt/TickL.wav diff --git a/2026/games/yukievt/Timer.png b/2026/games/yukievt/Timer.png Binary files differnew file mode 100644 index 0000000..876f06d --- /dev/null +++ b/2026/games/yukievt/Timer.png diff --git a/2026/games/yukievt/TimerUp.ogg b/2026/games/yukievt/TimerUp.ogg Binary files differnew file mode 100644 index 0000000..2b47092 --- /dev/null +++ b/2026/games/yukievt/TimerUp.ogg diff --git a/2026/games/yukievt/TimerUp.png b/2026/games/yukievt/TimerUp.png Binary files differnew file mode 100644 index 0000000..aba701d --- /dev/null +++ b/2026/games/yukievt/TimerUp.png diff --git a/2026/games/yukievt/TinyDark.png b/2026/games/yukievt/TinyDark.png Binary files differnew file mode 100644 index 0000000..92c8265 --- /dev/null +++ b/2026/games/yukievt/TinyDark.png diff --git a/2026/games/yukievt/TinyLight1.png b/2026/games/yukievt/TinyLight1.png Binary files differnew file mode 100644 index 0000000..a28fe01 --- /dev/null +++ b/2026/games/yukievt/TinyLight1.png diff --git a/2026/games/yukievt/TinyLight2.png b/2026/games/yukievt/TinyLight2.png Binary files differnew file mode 100644 index 0000000..602fb36 --- /dev/null +++ b/2026/games/yukievt/TinyLight2.png diff --git a/2026/games/yukievt/YookL.png b/2026/games/yukievt/YookL.png Binary files differnew file mode 100644 index 0000000..71c3621 --- /dev/null +++ b/2026/games/yukievt/YookL.png diff --git a/2026/games/yukievt/YookLHappy.png b/2026/games/yukievt/YookLHappy.png Binary files differnew file mode 100644 index 0000000..78bc279 --- /dev/null +++ b/2026/games/yukievt/YookLHappy.png diff --git a/2026/games/yukievt/YookR.png b/2026/games/yukievt/YookR.png Binary files differnew file mode 100644 index 0000000..f6dd89f --- /dev/null +++ b/2026/games/yukievt/YookR.png diff --git a/2026/games/yukievt/YookRHappy.png b/2026/games/yukievt/YookRHappy.png Binary files differnew file mode 100644 index 0000000..61cd540 --- /dev/null +++ b/2026/games/yukievt/YookRHappy.png diff --git a/2026/games/yukievt/index.html b/2026/games/yukievt/index.html new file mode 100644 index 0000000..fd23d5a --- /dev/null +++ b/2026/games/yukievt/index.html @@ -0,0 +1,652 @@ +<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
+ <title>Pat The Long Yooks (YukieVT's entry for the LCOLONQ MICROJAM 2K26-A-PALOOZA)</title>
+ <style>
+ * {
+ margin: 0px;
+ padding: 0px;
+ }
+ body {
+ font-size: 10px;
+ font-family: monospace;
+ }
+ /* Stretching to fill screen while preserving aspect ratio from:
+ https://stackoverflow.com/questions/67758479/how-to-fit-html-canvas-to-screen-while-maintaining-aspect-ratio-and-not-cutting
+ */
+ .screen {
+ position: fixed;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ left: 0;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ }
+ #canvas {
+ object-fit: contain;
+ width: 100%;
+ height: 100%;
+ image-rendering: pixelated; */ From https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Drawing_shapes */
+ }
+ </style>
+
+ <script type="module">
+ window.addEventListener("message", ev => {
+ switch (ev.data.op) {
+ case "start":
+ Difficulty = ev.data.difficulty
+ DoStart();
+ break;
+ }
+ });
+ /* window.addEventListener("click", ev => {
+ window.parent.postMessage({op: "done", win: true});
+ });*/
+ window.onload = DoInit;
+ </script>
+
+ </head>
+ <body>
+ <div class="screen">
+ <canvas id="canvas" width=240 height=160></canvas>
+ </div>
+
+ <script>
+ function ShowTextOnly(Text, Colour) {
+ ctx.fillStyle = "#000000";
+ ctx.fillRect(0, 0, 240, 160);
+ ctx.fillStyle = Colour;
+ ctx.fillText(Text, 10, 10);
+ }
+
+ function DoInit() {
+ canvas = document.getElementById("canvas");
+ ctx = canvas.getContext("2d", {alpha: false});
+ FPS = 60.0;
+ FrameInterval = 1000 / FPS;
+
+ //Audio:
+ ShowTextOnly("Loading sounds...", "#0000FF");
+ audTicks = [LoadAud("TickL.wav"), LoadAud("TickH.wav")];
+ audTimerUp = LoadAud("TimerUp.ogg");
+ audHeartPop = LoadAud("HeartPop.wav");
+ audPat = LoadAud("Pat.ogg");
+ audHappy = LoadAud("Happy.ogg");
+ audSad = LoadAud("Sad.ogg");
+ audSuccess = LoadAud("Success.ogg");
+ audFailure = LoadAud("Failure.ogg");
+ audRustleInL = LoadAud("RustleInL.ogg");
+ audRustleInR = LoadAud("RustleInR.ogg");
+ audRustleOutL = LoadAud("RustleOutL.ogg");
+ audRustleOutR = LoadAud("RustleOutR.ogg");
+
+ //Images (ii = Image Index (index in Imgs[])):
+ iiYookL = 0
+ iiYookR = 1
+ iiYookLHappy = 2
+ iiYookRHappy = 3
+ iiHandL = 4
+ iiHandR = 5
+ iiHeartSmall = 6
+ iiMouseGuide = 7
+ iiTinyDark = 8
+ iiTinyLight1 = 9
+ iiTinyLight2 = 10
+ iiSuccess = 11
+ iiFailure = 12
+ iiPatAll = 13
+ iiPatNoL = 14
+ iiPatNoR = 15
+ iiTimer = 16
+ iiTimerUp = 17
+ iiFG = 18
+ iiBG = 19
+ iiNumTotal = 20
+ ImgFNs = [];
+ ImgFNs.length = iiNumTotal;
+ ImgFNs[iiYookL] = "YookL.png";
+ ImgFNs[iiYookR] = "YookR.png";
+ ImgFNs[iiYookLHappy] = "YookLHappy.png";
+ ImgFNs[iiYookRHappy] = "YookRHappy.png";
+ ImgFNs[iiHandL] = "HandL.png";
+ ImgFNs[iiHandR] = "HandR.png";
+ ImgFNs[iiHeartSmall] = "HeartSmall.png";
+ ImgFNs[iiMouseGuide] = "MouseGuide.png";
+ ImgFNs[iiTinyDark] = "TinyDark.png";
+ ImgFNs[iiTinyLight1] = "TinyLight1.png";
+ ImgFNs[iiTinyLight2] = "TinyLight2.png";
+ ImgFNs[iiSuccess] = "Success.png";
+ ImgFNs[iiFailure] = "Failure.png";
+ ImgFNs[iiPatAll] = "PatAll.png";
+ ImgFNs[iiPatNoL] = "PatNoL.png";
+ ImgFNs[iiPatNoR] = "PatNoR.png";
+ ImgFNs[iiTimer] = "Timer.png";
+ ImgFNs[iiTimerUp] = "TimerUp.png";
+ ImgFNs[iiFG] = "FG.png";
+ ImgFNs[iiBG] = "BG.png";
+ NumImgsLoaded = 0;
+ console.log("iiNumTotal: " + iiNumTotal.toString() + ". ImgFNs: " + ImgFNs)
+
+ Imgs = [];
+ Imgs.length = iiNumTotal;
+ ShowTextOnly("Loading " + iiNumTotal + " images...", "#0000FF");
+ LoadNextImg();
+ }
+
+ function LoadAud(FNCur) {
+ audCur = new Audio(FNCur)
+ audCur.loop = false
+ audCur.muted = false
+ audCur.volume = 1.0
+ return audCur
+ }
+
+ function LoadNextImg() {
+ if (NumImgsLoaded > 0) {
+ //ctx.drawImage(Imgs[NumImgsLoaded - 1], (NumImgsLoaded - 1) * 10, 0);
+ }
+ if (NumImgsLoaded == iiNumTotal) {
+ InitFinished();
+ Difficulty = 0; //Used when debugging. Overwritten by the jam's e.g. {op: "start", difficulty: 42.0}.
+ //DoStart(); //FOR ACTUAL JAM WITH HARNESS, COMMENT THIS OUT! TO RUN ALONE, UNCOMMENT THIS.
+ return;
+ }
+ Imgs[NumImgsLoaded] = new Image();
+ Imgs[NumImgsLoaded].addEventListener("load", () => {
+ NumImgsLoaded += 1;
+ LoadNextImg();
+ });
+ Imgs[NumImgsLoaded].addEventListener("error", () => {
+ ctx.fillStyle = "#FF0000";
+ ctx.fillText("Failed to load image: " + ImgFNs[NumImgsLoaded], 10, 30);
+ });
+ Imgs[NumImgsLoaded].src = ImgFNs[NumImgsLoaded];
+ }
+
+ function InitFinished() {
+ ShowTextOnly("(Ready)", "#00FF00");
+ window.parent.postMessage({op: "ready"});
+ }
+
+
+
+ function onMouseDown(e) { //Based on https://stackoverflow.com/questions/2405771/is-right-click-a-javascript-event
+ console.log("onMouseDown, e: " + e)
+ switch (e.button) {
+ case 0:
+ LastClick = 0;
+ break;
+ case 2:
+ LastClick = 1;
+ break;
+ }
+ }
+ function ContextMenuBlocker(e) {
+ e.preventDefault();
+ }
+ function DisableContextMenu(DisableNow) {
+ if (DisableNow) {
+ document.addEventListener("contextmenu", ContextMenuBlocker);
+ } else {
+ document.removeEventListener("contextmenu", ContextMenuBlocker);
+ }
+ }
+
+ function AnimCreate(Img, Loop = false) {
+ return {Img: Img, KFs: [], IndKF: -1, IndFrame: 0, Loop: Loop, XFrom: 0, YFrom: 0, XCur: 0, YCur: 0};
+ }
+ function AnimAddKF(Anim, XNew, YNew, NumFrames = 0) {
+ Anim.KFs[Anim.KFs.length] = {X: XNew, Y: YNew, NumFrames: NumFrames};
+ }
+ function AnimDraw(Anim) { //Returns true if animation has finished playing (if it's not set to loop).
+ if (Anim.IndKF == -1) { //If starting animation for first time...
+ Anim.XFrom = Anim.KFs[0].X //Start moving from first frame's pos.
+ Anim.YFrom = Anim.KFs[0].Y
+ Anim.IndKF = 1; //Start moving towards second frame's pos.
+ }
+ if (Anim.IndKF >= Anim.KFs.length) { //If we've just reached the end of the animation...
+ if (Anim.Loop) { //If we should loop...
+ Anim.IndKF = 0; //Start moving towards first frame's pos
+ Anim.IndFrame = 0; //We're at the beginning of this new movement.
+ } else { //Else, if we should not loop...
+ return true; //Return that the animation has finished.
+ }
+ }
+
+ //Work out current position based on current keyframe and frame index, and draw the image at that position.
+ KFCur = Anim.KFs[Anim.IndKF]
+ Anim.XCur = Anim.XFrom + ((KFCur.X - Anim.XFrom) * (Anim.IndFrame / KFCur.NumFrames));
+ Anim.YCur = Anim.YFrom + ((KFCur.Y - Anim.YFrom) * (Anim.IndFrame / KFCur.NumFrames));
+ ctx.drawImage(Anim.Img, Math.round(Anim.XCur), Math.round(Anim.YCur));
+
+ //Next time, draw next frame. This may be the first frame in the next keyframe.
+ //If there is no next keyframe, that will be dealt with on the next call of this function, rather than
+ //reporting "end of animation" now, to give the just-drawn frame a chance to be displayed.
+ Anim.IndFrame ++;
+ if (Anim.IndFrame >= KFCur.NumFrames) {
+ Anim.XFrom = Anim.XCur //Next time, start a movement from the current pos (end of cur movement).
+ Anim.YFrom = Anim.YCur
+ Anim.IndKF ++; //Move on to (potentially-non-existent) next keyframe.
+ Anim.IndFrame = 0; //Next time will be the first frame of a new movement.
+ }
+ return false; //Return that the animation has not yet finished playing.
+ }
+
+ function ParticlesDraw() {
+ ctx.globalCompositeOperation = "lighter";
+ for (IndParticle = 0; IndParticle < NumParticlesMax; IndParticle ++) {
+ if (Particles[IndParticle].FramesLeft > 0) {
+ ctx.globalAlpha = Math.min(1.0, Particles[IndParticle].FramesLeft / 30.0);
+ ctx.drawImage(Imgs[iiHeartSmall], Particles[IndParticle].X, Particles[IndParticle].Y);
+ Particles[IndParticle].X += Particles[IndParticle].HSpeed;
+ Particles[IndParticle].Y += Particles[IndParticle].VSpeed;
+ Particles[IndParticle].HSpeed *= Particles[IndParticle].Momentum;
+ Particles[IndParticle].VSpeed *= Particles[IndParticle].Momentum;
+ Particles[IndParticle].FramesLeft --;
+ }
+ }
+ ctx.globalCompositeOperation = "source-over";
+ ctx.globalAlpha = 1.0;
+ }
+ function ParticleCreate(XNew, YNew, FramesLeftMin) {
+ Particles[IndParticleNext].FramesLeft = FramesLeftMin + (Math.random() * (FramesLeftMin * 0.5));
+ Particles[IndParticleNext].X = XNew;
+ Particles[IndParticleNext].Y = YNew;
+ Particles[IndParticleNext].HSpeed = -1.2 + (Math.random() * 2.4);
+ Particles[IndParticleNext].VSpeed = -0.8 + (Math.random() * -0.4);
+ IndParticleNext ++;
+ if (IndParticleNext == NumParticlesMax) {IndParticleNext = 0;}
+ }
+ function ParticlesCreateOnYook(ValYook, XYook, YYook, FramesLeftMin, NumParticlesNew) {
+ ParticleX = 0
+ if (ValYook == 0) {
+ ParticleX = XYook + 64;
+ } else {
+ ParticleX = XYook + 3;
+ }
+ for (IndRepeat = 0; IndRepeat < NumParticlesNew; IndRepeat ++) {
+ ParticleCreate(
+ ParticleX - 10 + (Math.random() * 20),
+ (YYook - 10) - 10 + (Math.random() * 20),
+ FramesLeftMin
+ );
+ }
+ }
+
+ function TiniesInit() {
+ TinyGap = 2;
+ TinyFrameInterval = 15;
+
+ TinyFramesLeft = TinyFrameInterval
+ TinyFramePolarity = 0;
+ TinyXInc = Imgs[iiTinyDark].width + TinyGap;
+ TinyTotalWidth = TinyXInc * NumYooks;
+ TinyFirstX = Math.floor((240 - TinyTotalWidth) / 2);
+ TinyY = 4
+ TinyXs = [];
+ for (IndTiny = 0; IndTiny < NumYooks; IndTiny ++) {
+ TinyXs[IndTiny] = TinyFirstX + (TinyXInc * IndTiny);
+ }
+ }
+
+ function TiniesDraw() {
+ for (IndTiny = 0; IndTiny < NumYooks; IndTiny ++) {
+ if (IndTiny < IndYook) {
+ ctx.drawImage(Imgs[iiTinyLight1 + TinyFramePolarity], TinyXs[IndTiny], TinyY);
+ } else {
+ ctx.drawImage(Imgs[iiTinyDark], TinyXs[IndTiny], TinyY);
+ }
+ }
+ if (TinyFramesLeft == 0) {
+ TinyFramePolarity = 1 - TinyFramePolarity;
+ TinyFramesLeft = TinyFrameInterval;
+ } else {
+ TinyFramesLeft --;
+ }
+ }
+
+ function TimerSetNumSecsMax(NewVal) {
+ TimerNumSecsMax = NewVal;
+ NumFramesPerTimerTile = (FPS * TimerNumSecsMax) / TimerNumTiles;
+ }
+ function TimerInit() {
+ TimerNumTiles = 8; //(Excluding an extra final "time has run out" frame in the image).
+ TimerTileWidth = Imgs[iiTimer].width / (TimerNumTiles + 1);
+ TimerTileHeight = Imgs[iiTimer].height;
+ TimerIndFrame = 0; //Increments while waiting for input. Used for input time limit.
+ TimerIndTilePrev = 0;
+
+ AnimTimerUp = AnimCreate(Imgs[iiTimerUp], true)
+ AnimAddKF(AnimTimerUp, 207, 0, 3); //Centre (usual position)
+ AnimAddKF(AnimTimerUp, 205, 0, 3); //Left
+ //AnimAddKF(AnimTimerUp, 207, 4, 2); //Centre
+ //AnimAddKF(AnimTimerUp, 209, 4, 2); //Right
+ }
+ function TimerDraw() {
+ TimerIndTile = Math.min(TimerNumTiles, Math.floor(TimerIndFrame / NumFramesPerTimerTile))
+ if (TimerIndTile < TimerNumTiles) {
+ ctx.drawImage(
+ Imgs[iiTimer],
+ TimerIndTile * TimerTileWidth, 0, TimerTileWidth, TimerTileHeight,
+ 216, 2, TimerTileWidth, TimerTileHeight
+ );
+ if (TimerIndTile != TimerIndTilePrev) {
+ if (TimerIndTile != 0) { //Don't play tick on frame index 0, because timer's not yet running (it's just rewound).
+ audTicks[TimerIndTile % 2].play(); //Play tick 0 on even numbers, tick 1 on odd numbers.
+ }
+ }
+ } else {
+ AnimDraw(AnimTimerUp);
+ if (TimerIndTile != TimerIndTilePrev) {audTimerUp.play();}
+ }
+ TimerIndTilePrev = TimerIndTile;
+ }
+
+ async function DoStart() {
+ window.parent.postMessage({op: "started", verb: "pat!"});
+ DisableContextMenu(true);
+
+ //Make an array of available particles.
+ NumParticlesMax = 20
+ Particles = [];
+ Particles.length = NumParticlesMax;
+ for (IndParticle = 0; IndParticle < NumParticlesMax; IndParticle ++) {
+ Particles[IndParticle] = {FramesLeft: 0, X: 0, Y: 0, HSpeed: 0, VSpeed: 0, Momentum: 0.97}
+ }
+ IndParticleNext = 0;
+
+ //Make an array of long yooks which can appear. 0 = on the left, 1 = on the right.
+ NumYooks = 3;
+ Yooks = [];
+ Yooks.length = NumYooks;
+ for (IndYook = 0; IndYook < NumYooks; IndYook ++) {
+ Yooks[IndYook] = Math.floor(Math.random() * 2);
+ }
+ IndYook = 0;
+ TiniesInit();
+ TimerInit();
+
+ //Different number of seconds on the timer for each yook that appears. The last one will be used if IndYook is past end of this array.
+ if (Difficulty >= 40) {
+ SecsPerYook = [2.00, 0.80, 0.50]
+ } else if (Difficulty >= 20) {
+ SecsPerYook = [2.50, 1.50, 0.80]
+ } else {
+ SecsPerYook = [3.00, 2.00, 1.50]
+ }
+
+ //Gameplay state:
+ staInitYook = 0
+ staAnimYookOn = 1
+ staInitInput = 2
+ staAwaitInput = 3
+ staInitHand = 4
+ staAnimHandOn = 5
+ staAnimHandPat = 6
+ staAnimHandOff = 7
+ staFailMain = 8
+ staFailDetail = 9
+ staAnimYookOff = 10
+ staSuccMain = 11
+ staSuccDetail = 12
+ staCur = staInitYook
+
+ AnimMouseBounce = AnimCreate(Imgs[iiMouseGuide], true);
+ AnimAddKF(AnimMouseBounce, 89, 92, 8);
+ AnimAddKF(AnimMouseBounce, 89, 96, 8);
+ SuccessHeartFrameInterval = 9;
+
+ GameLoop: while (true) {
+ //ctx.fillStyle = "#505050";
+ //ctx.fillRect(0, 0, 240, 160);
+ ctx.drawImage(Imgs[iiBG], 0, 0)
+
+ //If a long yook should be fully on the screen, draw it at its sitting position (happy, if current answer was correct and at least pat has begun).
+ if ((staCur > staAnimYookOn) && (staCur < staAnimYookOff)) {
+ IsHappy = (LastClick == ValYook) && (staCur >= staAnimHandPat)
+ ctx.drawImage((IsHappy ? Imgs[iiYookLHappy + ValYook] : Imgs[ValYook]), PosYookSitX, PosYookSitY);
+ ctx.drawImage(Imgs[iiFG], 0, 0)
+ }
+
+ switch (staCur) {
+ case staInitYook: //Prepare new long yook. Prepare "yook on/off" animations. Fall through to animating.
+ console.log("State: InitYook");
+ ValYook = Yooks[IndYook]; //IndYook has already been set to a new value either above or when patting a previous one.
+ TimerSetNumSecsMax(SecsPerYook[Math.min(SecsPerYook.length, IndYook)]) //Set how many secs are on the timer for patting this yook.
+ TimerIndFrame = 0; //Set timer back to 0 ASAP. A few breaks below might increment this, so it's reset later too.
+
+ AnimYookOn = AnimCreate(Imgs[ValYook]);
+ AnimYookOff = AnimCreate(Imgs[iiYookLHappy + ValYook]);
+ PosYookSitX = 0
+ PosYookSitY = 48
+ NumFramesYookOn = 10
+ NumFramesYookOff = 90
+
+ IndFrameMisc = 0 //For miscellaneous animations (like zooms) done in the state machine below.
+ NumFramesEndZoomDuring = 10
+ NumFramesEndZoomAfter = 40
+ NumFramesEndDetailWait = 100
+
+ if (ValYook == 0) {
+ PosYookSitX = 110 - Imgs[iiYookL].width;
+ AnimAddKF(AnimYookOn, 0 - Imgs[iiYookL].width, PosYookSitY);
+ AnimAddKF(AnimYookOff, PosYookSitX, PosYookSitY);
+ AnimAddKF(AnimYookOff, 240, PosYookSitY, NumFramesYookOff);
+ } else {
+ PosYookSitX = (240 - 110);
+ AnimAddKF(AnimYookOn, 240, PosYookSitY);
+ AnimAddKF(AnimYookOff, PosYookSitX, PosYookSitY);
+ AnimAddKF(AnimYookOff, -117, PosYookSitY, NumFramesYookOff);
+ }
+ AnimAddKF(AnimYookOn, PosYookSitX, PosYookSitY, NumFramesYookOn);
+
+ staCur = staAnimYookOn;
+ (ValYook ? audRustleInR : audRustleInL).play();
+
+ case staAnimYookOn: //Animate long yook sliding onto screen. Fall through to init input when done.
+ ctx.drawImage(Imgs[iiFG], 0, 0);
+ if (AnimDraw(AnimYookOn)) {
+ staCur = staInitInput;
+ } else {
+ break;
+ }
+
+
+ case staInitInput: //Forget any previous mouse click. Fall through to awaiting input.
+ console.log("State: InitInput");
+ LastClick = -1;
+ //Start monitoring for mouse clicks.
+ //Clicked mouse button will be 0 for LMB or 1 for RMB. Any other button is ignored. Reset to -1 when we've used the value.
+ window.addEventListener("mousedown", onMouseDown);
+
+ TimerIndFrame = 0;
+ staCur = staAwaitInput;
+
+ case staAwaitInput: //Wait for L or R click while bouncing the mouse guide image. Fall through when answered.
+ AnimDraw(AnimMouseBounce);
+ if (LastClick != -1) { //If a mouse button was clicked...
+ window.removeEventListener("mousedown", onMouseDown); //Stop monitoring for mouse clicks, so that LastClick can't keep changing.
+ staCur = staInitHand;
+ }
+ if (TimerIndTile >= TimerNumTiles) { //If timer has run out...
+ window.removeEventListener("mousedown", onMouseDown); //Stop monitoring for mouse clicks here, too.
+ staCur = staFailMain;
+ } else {
+ TimerIndFrame ++;
+ }
+ break;
+
+ case staInitHand: //Set up "hand on/off" animations. Fall through to animating.
+ console.log("State: InitHand")
+ PosHandOffX = 0; //To be set below.
+ PosHandHoverX = 0; //To be set below.
+ PosHandOffY = -10;
+ PosHandHoverY = 25;
+ if (LastClick == 0) {
+ PosHandOffX = -117;
+ PosHandHoverX = -19;
+ } else {
+ PosHandOffX = 240;
+ PosHandHoverX = 259 - 117;
+ }
+ AnimHandOn = AnimCreate(Imgs[iiHandL + LastClick]);
+ AnimAddKF(AnimHandOn, PosHandOffX, PosHandOffY);
+ AnimAddKF(AnimHandOn, PosHandHoverX, PosHandHoverY, 15);
+ AnimHandOff = AnimCreate(AnimHandOn.Img);
+ AnimAddKF(AnimHandOff, PosHandHoverX, PosHandHoverY);
+ AnimAddKF(AnimHandOff, PosHandOffX, PosHandOffY, 10);
+ staCur = staAnimHandOn;
+
+ case staAnimHandOn: //Animate hand moving onto screen.
+ AnimHandPat = null;
+ if (AnimDraw(AnimHandOn)) { //If "hand on" animation has finished...
+ if (LastClick == ValYook) { //If mouse input matched yook...
+ //Prepare a "hand pat" animation.
+ AnimHandPat = AnimCreate(Imgs[iiHandL + LastClick]);
+ AnimAddKF(AnimHandPat, PosHandHoverX, PosHandHoverY); //Current (hover)
+ AnimAddKF(AnimHandPat, PosHandHoverX, PosHandHoverY, 8); //Initial delay (hover)
+ AnimAddKF(AnimHandPat, PosHandHoverX, PosHandHoverY + 8, 4); //Down quickly (touching)
+ AnimAddKF(AnimHandPat, PosHandHoverX, PosHandHoverY , 12); //Up slowly (hover)
+ AnimAddKF(AnimHandPat, PosHandHoverX, PosHandHoverY , 3); //Wait (hover)
+ AnimAddKF(AnimHandPat, PosHandHoverX, PosHandHoverY + 8, 4); //Down quickly (touching)
+ AnimAddKF(AnimHandPat, PosHandHoverX, PosHandHoverY , 12); //Up slowly (hover)
+ //AnimAddKF(AnimHandPat, PosHandHoverX, PosHandHoverY , 3); //Wait (hover)
+
+ //Make some heart particles (hearticles) now that the "hand pat" animation is about to begin.
+ ParticlesCreateOnYook(ValYook, PosYookSitX, PosYookSitY, 60, 5)
+
+ //Queue pat sounds to play in sync with the pat animation.
+ setTimeout(() => {audPat.play();}, 12 * FrameInterval);
+ setTimeout(() => {audPat.play();}, 31 * FrameInterval);
+ audHappy.playbackRate = 0.97 + (Math.random() * 0.06);
+ audHappy.preservesPitch = false;
+ audHappy.play();
+ IndYook ++; //Prepare to move on to next long yook now (causes another "tiny" to light up).
+ }
+ staCur = staAnimHandPat; //Even if "hand pat" anim wasn't made, fall through and attempt to animate it (will skip it).
+ } else { //Else, if animation hasn't finished yet...
+ break; //Wait another frame (ONLY if animation hasn't finished yet).
+ } //Ended if "hand on" animation has finished yet or not.
+
+ case staAnimHandPat: //Animate "hand pat", if one was prepared. If not, fall through to "hand off" animation.
+ if (AnimHandPat != null) {
+ if (AnimDraw(AnimHandPat)) {
+ staCur = staAnimHandOff;
+ } else {
+ break;
+ }
+ }
+
+ case staAnimHandOff: //Animate hand moving off the screen. Fall through to success (if patted) when done.
+ if (AnimDraw(AnimHandOff)) {
+ if (LastClick == ValYook) {
+ staCur = staAnimYookOff;
+ (ValYook ? audRustleOutR : audRustleOutL).play();
+ NumFramesUntilHeart = SuccessHeartFrameInterval;
+ } else {
+ staCur = staFailMain;
+ audFailure.play();
+ IndFrameMisc = 0;
+ break;
+ }
+ } else { //Else, if animation hasn't finished yet...
+ break; //Wait another frame.
+ }
+
+ case staAnimYookOff:
+ if (AnimDraw(AnimYookOff)) {
+ if (IndYook == NumYooks) {
+ staCur = staSuccMain;
+ audSuccess.play();
+ IndFrameMisc = 0;
+ } else {
+ staCur = staInitYook;
+ }
+ }
+ ctx.drawImage(Imgs[iiFG], 0, 0);
+ if (NumFramesUntilHeart == 0) {
+ ParticlesCreateOnYook(ValYook, AnimYookOff.XCur, AnimYookOff.YCur, 30, 1);
+ audHeartPop.volume = 0.1 + (Math.random() * 0.9);
+ audHeartPop.play();
+ NumFramesUntilHeart = SuccessHeartFrameInterval;
+ } else {
+ NumFramesUntilHeart --;
+ }
+ break;
+
+ case staSuccMain: //Animate zooming in of success image. After enough time, fall through to success detail.
+ ctx.drawImage(Imgs[iiFG], 0, 0);
+ if (IndFrameMisc < NumFramesEndZoomAfter) {
+ CurScale = Math.min(1.0, IndFrameMisc / NumFramesEndZoomDuring);
+ ctx.drawImage(Imgs[iiSuccess], (1 - CurScale) * 120, (1 - CurScale) * 80, 240 * CurScale, 160 * CurScale);
+ IndFrameMisc ++;
+ break;
+ } else {
+ IndFrameMisc = 0;
+ staCur = staSuccDetail;
+ }
+
+ case staSuccDetail: //Show the success detail for a while (and spawn hearts). Afterwards, end entire game.
+ ctx.drawImage(Imgs[iiFG], 0, 0);
+ ctx.drawImage(Imgs[iiSuccess], 0, 0);
+ ctx.drawImage(Imgs[iiPatAll], 0, 0);
+ if (IndFrameMisc < NumFramesEndDetailWait) {
+ IndFrameMisc ++;
+ } else {
+ break GameLoop;
+ }
+ if (NumFramesUntilHeart == 0) {
+ ParticleCreate(16 + (Math.random() * (240 - 32)), 16 + (Math.random() * (160 - 32)) , 20);
+ NumFramesUntilHeart = SuccessHeartFrameInterval;
+ } else {
+ NumFramesUntilHeart --;
+ }
+ break;
+
+ case staFailMain: //Animate zooming in of failure image. After enough time, fall through to failure detail.
+ if (IndFrameMisc < NumFramesEndZoomAfter) {
+ CurScale = Math.min(1.0, IndFrameMisc / NumFramesEndZoomDuring);
+ ctx.drawImage(Imgs[iiFailure], (1 - CurScale) * 120, (1 - CurScale) * 80, 240 * CurScale, 160 * CurScale);
+ IndFrameMisc ++;
+ break;
+ } else {
+ IndFrameMisc = 0;
+ staCur = staFailDetail;
+ audSad.play(); //Play a sad long yook voice sound.
+ }
+
+ case staFailDetail: //Show the failure detail for a while. Afterwards, end entire game.
+ ctx.drawImage(Imgs[iiFailure], 0, 0);
+ ctx.drawImage(Imgs[iiPatNoL + ValYook], 0, 0);
+ if (IndFrameMisc < NumFramesEndDetailWait) {
+ IndFrameMisc ++;
+ } else {
+ break GameLoop;
+ }
+ break;
+
+ default:
+ ctx.fillStyle = "#FF0000"
+ ctx.fillText("Unhandled state (" + staCur + ")!", 5, 10);
+ break;
+ } //Ended switch on current state machine state.
+
+ ParticlesDraw();
+ TiniesDraw();
+ if (staCur < staAnimYookOff) {TimerDraw();} //Draw timer if current long yook isn't moving off the screen yet, or on failure.
+ await new Promise(r => setTimeout(r, FrameInterval));
+
+ } //Ended outermost infinite game loop.
+
+ ctx.fillStyle = "#00FF00"
+ ctx.fillText("(Done)", 5, 10);
+ window.parent.postMessage({op: "done", win: (LastClick == ValYook)});
+ }
+ </script>
+
+ </body>
+</html>
\ No newline at end of file diff --git a/2026/games/yukievt/license.txt b/2026/games/yukievt/license.txt new file mode 100644 index 0000000..8759553 --- /dev/null +++ b/2026/games/yukievt/license.txt @@ -0,0 +1,9 @@ +This is generally bad javascript code written by someone who barely knows javascript.
+You probably shouldn't use it to learn from, let alone use it in your own projects.
+However, you may use it in non-commercial projects.
+
+- If you choose to use any of the code in a non-commercial project,
+ please give credit to YukieVT.
+- Don't use the code for anything commercial.
+- Don't use the code for any political campaign.
+- Don't use the assets (sounds, images) for any project, even non-commercial ones.
\ No newline at end of file diff --git a/2026/games/yukievt/readme.txt b/2026/games/yukievt/readme.txt new file mode 100644 index 0000000..ef27d35 --- /dev/null +++ b/2026/games/yukievt/readme.txt @@ -0,0 +1,32 @@ + Pat The Long Yooks
+ (A microgame by YukieVT)
+
+This is an entry for the LCOLONQ MICROJAM 2K26-A-PALOOZA:
+ https://api.colonq.computer/jam/2026
+As such, it's designed to be loaded in an iframe served by LCOLONQ's "harness"
+web server available at:
+ https://github.com/lcolonq/jam/tree/master/2026
+(Binaries available in the readme on that page, along with instructions)
+The harness then sends a "start" signal to the microgame to begin the gameplay.
+
+ Alternatively, **TO RUN THIS MICROGAME BY ITSELF**:
+Simply uncomment the following line in the LoadNextImg() function:
+ //DoStart();
+This will cause the game to automatically start as soon as the images and sounds
+have finished loading, instead of waiting for a signal from the harness that
+it's time to start.
+NOTE: In this case, sadly, sounds won't play until your first mouse click.
+
+ HOW TO PLAY:
+A long yook will slide onto the screen from the left or the right. You have a
+few seconds to react and pat it!
+ - If it slides from the left, left-click anywhere to pat it.
+ - If it slides from the right, right-click anywhere to pat it.
+After you've patted 3 long yooks, the game is complete! The timer gets faster
+for each consecutive long yook that appears.
+
+ COMPATIBILITY:
+I've confirmed that the game works on the following browsers:
+ - Mozilla Firefox 128
+ - Google Chrome 107
+ - Microsoft Edge 150
\ No newline at end of file diff --git a/2026/games/example_godot b/2026/games_examples/example_godot index 4b72ee3..4b72ee3 120000 --- a/2026/games/example_godot +++ b/2026/games_examples/example_godot diff --git a/2026/games/example_js b/2026/games_examples/example_js index 0399ed3..0399ed3 120000 --- a/2026/games/example_js +++ b/2026/games_examples/example_js diff --git a/2026/games/example_raylib b/2026/games_examples/example_raylib index 71e0956..71e0956 120000 --- a/2026/games/example_raylib +++ b/2026/games_examples/example_raylib diff --git a/2026/games/example_teleia b/2026/games_examples/example_teleia index a9aac2c..a9aac2c 120000 --- a/2026/games/example_teleia +++ b/2026/games_examples/example_teleia diff --git a/2026/index.html b/2026/index.html index 8aba7d2..061ef97 100644 --- a/2026/index.html +++ b/2026/index.html @@ -16,16 +16,6 @@ .jam-hidden { visibility: hidden; } - #jam-titlescreen { - position: fixed; - top: 0px; - bottom: 0px; - right: 0px; - left: 0px; - color: white; - background-color: black; - z-index: 2; - } #jam-iframe-parent { display: grid; grid-template-columns: 100%; @@ -50,9 +40,6 @@ </style> </head> <body> - <div id="jam-titlescreen"> - click to continue - </div> <div id="jam-iframe-parent"> <iframe id="jam-framing-iframe" width="480" height="320" src="./framing/dist/index.html"></iframe> </div> @@ -151,7 +138,7 @@ microgames[idx].loaded.classList.add("jam-hidden"); framing.contentWindow.postMessage({op: "endgame", win: win}); loadUpcomingGames(); - setTimeout(startNextGameIfReady, 3000); + setTimeout(startNextGameIfReady, 4000); state = {mode: "finished"}; console.log(state); } @@ -212,11 +199,14 @@ } }); - let titlescreen = document.getElementById("jam-titlescreen"); - titlescreen.addEventListener("click", () => { - titlescreen.classList.add("jam-hidden"); - loadUpcomingGames(); - startNextGameIfReady(); + let started = false; + document.body.addEventListener("click", () => { + if (!started) { + started = true; + framing.contentWindow.postMessage({op: "titlescreenclick"}); + loadUpcomingGames(); + setTimeout(startNextGameIfReady, 8000); + } }); </script> </body> diff --git a/2026/submissions.org b/2026/submissions.org index 5462fb3..37a489e 100644 --- a/2026/submissions.org +++ b/2026/submissions.org @@ -1,15 +1,25 @@ * Submissions -- PeetsEater +- [X] PeetsEater - MrROBUST - Bytomancer - rpc2dot0 -- gbjk +- [X] gbjk - lunaticlurker -- pralkarz - https://codeberg.org/pralkarz/dzem -- yukievt -- janetacarr -- bigbookofbug -- yukievt +- [X] pralkarz - https://codeberg.org/pralkarz/dzem +- [X] yukievt - tyumici +- doceys +- colinahscopy_ +- [X] ellg +- [X] distracted_penguin https://github.com/distractedpen/lcolonq-microgame-jam-2026 +- [X] samzyre https://github.com/Samzyre/microjam_rctrctrl/releases +- [X] prod +- asrael? +- captinbaptin? +- yurcheeg? +- a_tension_span? +- bvnanana? - ctrl_o? -- prod? +- janetacarr? +- bigbookofbug? +- the0x539? diff --git a/2026/submissions/distracted_penguin/lcolonq-microgame-jam-2026-release-1.zip b/2026/submissions/distracted_penguin/lcolonq-microgame-jam-2026-release-1.zip Binary files differnew file mode 100644 index 0000000..b245d84 --- /dev/null +++ b/2026/submissions/distracted_penguin/lcolonq-microgame-jam-2026-release-1.zip diff --git a/2026/submissions/distracted_penguin/spintodefend.zip b/2026/submissions/distracted_penguin/spintodefend.zip Binary files differnew file mode 100644 index 0000000..db51fca --- /dev/null +++ b/2026/submissions/distracted_penguin/spintodefend.zip diff --git a/2026/submissions/ellg/FEsh.zip b/2026/submissions/ellg/FEsh.zip Binary files differnew file mode 100644 index 0000000..757e2d7 --- /dev/null +++ b/2026/submissions/ellg/FEsh.zip diff --git a/2026/submissions/gbjk/tortis.tar.gz b/2026/submissions/gbjk/tortis.tar.gz Binary files differnew file mode 100644 index 0000000..8060eb7 --- /dev/null +++ b/2026/submissions/gbjk/tortis.tar.gz diff --git a/2026/submissions/peetseater/for-clonq.zip b/2026/submissions/peetseater/for-clonq.zip Binary files differnew file mode 100644 index 0000000..5b2db0d --- /dev/null +++ b/2026/submissions/peetseater/for-clonq.zip diff --git a/2026/submissions/pralkarz/dzem-main.zip b/2026/submissions/pralkarz/dzem-main.zip Binary files differnew file mode 100644 index 0000000..548d426 --- /dev/null +++ b/2026/submissions/pralkarz/dzem-main.zip diff --git a/2026/submissions/prodzpod/microgames-main.zip b/2026/submissions/prodzpod/microgames-main.zip Binary files differnew file mode 100644 index 0000000..518aa01 --- /dev/null +++ b/2026/submissions/prodzpod/microgames-main.zip diff --git a/2026/submissions/samzyre/dist.zip b/2026/submissions/samzyre/dist.zip Binary files differnew file mode 100644 index 0000000..e2870a4 --- /dev/null +++ b/2026/submissions/samzyre/dist.zip diff --git a/2026/submissions/samzyre/microjam_rctrctrl-1.1.zip b/2026/submissions/samzyre/microjam_rctrctrl-1.1.zip Binary files differnew file mode 100644 index 0000000..120f425 --- /dev/null +++ b/2026/submissions/samzyre/microjam_rctrctrl-1.1.zip diff --git a/2026/submissions/yukievt/aww4db.7z b/2026/submissions/yukievt/aww4db.7z Binary files differnew file mode 100644 index 0000000..1241c71 --- /dev/null +++ b/2026/submissions/yukievt/aww4db.7z |
