diff --git a/data/changelog.json b/data/changelog.json index 27460e8d..7c0cfe4f 100644 --- a/data/changelog.json +++ b/data/changelog.json @@ -1,5 +1,5 @@ { - "version": "1.0.2", - "desc": "20 new games, a brand new night time theme, and more fun quotes! (courtesy of astra!!)", - "timestamp": "1709824136" + "version": "1.0.3", + "desc": "added a few games (courtesy of legalize), fixed retro games", + "timestamp": "1710095962" } diff --git a/data/games.json b/data/games.json index 8b8e101f..20c195f5 100644 --- a/data/games.json +++ b/data/games.json @@ -29,21 +29,11 @@ "image": "cover.svg", "directory": "drift" }, - { - "name": "Dashy Reaper", - "image": "cover.svg", - "directory": "dashy" - }, { "name": "Driving Force 4", "image": "cover.svg", "directory": "driving" }, - { - "name": "Bullet Fury", - "image": "cover.svg", - "directory": "bulletfury" - }, { "name": "Minecraft Games", "image": "cover.svg", diff --git a/semag/animalcrossingwildworld/index.html b/semag/animalcrossingwildworld/index.html index ad205367..50e2a18b 100644 --- a/semag/animalcrossingwildworld/index.html +++ b/semag/animalcrossingwildworld/index.html @@ -18,8 +18,8 @@ EJS_core = "nds"; EJS_color = "#0064ff"; EJS_startOnLoaded = true; - EJS_pathtodata = "https://cdn.emulatorjs.org/stable/data/"; + EJS_pathtodata = "/semag/emulatorjs/data/"; EJS_gameUrl = "Animal Crossing - Wild World (USA) (Rev 1).nds"; - + diff --git a/semag/banjokazooie/index.html b/semag/banjokazooie/index.html index 2195b8f5..bc9daed7 100644 --- a/semag/banjokazooie/index.html +++ b/semag/banjokazooie/index.html @@ -18,8 +18,8 @@ EJS_core = "n64"; EJS_color = "#0064ff"; EJS_startOnLoaded = true; - EJS_pathtodata = "https://cdn.emulatorjs.org/stable/data/"; + EJS_pathtodata = "/semag/emulatorjs/data/"; EJS_gameUrl = "Banjo-Kazooie (USA) (Rev A).n64"; - + diff --git a/semag/cds/index.html b/semag/cds/index.html index 470aa424..c15a2ade 100644 --- a/semag/cds/index.html +++ b/semag/cds/index.html @@ -1,20 +1,25 @@ - + + Counter Strike: DS +
- - + \ No newline at end of file diff --git a/semag/dashy/cover.svg b/semag/dashy/cover.svg deleted file mode 100644 index 8199c172..00000000 --- a/semag/dashy/cover.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/semag/dashy/game.swf b/semag/dashy/game.swf deleted file mode 100644 index 32860284..00000000 Binary files a/semag/dashy/game.swf and /dev/null differ diff --git a/semag/dashy/index.html b/semag/dashy/index.html deleted file mode 100644 index c22417f3..00000000 --- a/semag/dashy/index.html +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/semag/donkeykong64/index.html b/semag/donkeykong64/index.html index 7185414e..b67f4926 100644 --- a/semag/donkeykong64/index.html +++ b/semag/donkeykong64/index.html @@ -18,8 +18,8 @@ EJS_core = "n64"; EJS_color = "#0064ff"; EJS_startOnLoaded = true; - EJS_pathtodata = "https://cdn.emulatorjs.org/stable/data/"; + EJS_pathtodata = "/semag/emulatorjs/data/"; EJS_gameUrl = "Donkey Kong 64 (USA).n64"; - + diff --git a/semag/doom64/index.html b/semag/doom64/index.html index 52078e01..25c85ca9 100644 --- a/semag/doom64/index.html +++ b/semag/doom64/index.html @@ -18,8 +18,8 @@ EJS_core = "n64"; EJS_color = "#0064ff"; EJS_startOnLoaded = true; - EJS_pathtodata = "https://cdn.emulatorjs.org/stable/data/"; + EJS_pathtodata = "/semag/emulatorjs/data/"; EJS_gameUrl = "Doom 64 (USA) (Rev A).n64"; - + diff --git a/semag/emulatorjs/data/GameManager.js b/semag/emulatorjs/data/GameManager.js index 2aa3cd61..bf2688eb 100644 --- a/semag/emulatorjs/data/GameManager.js +++ b/semag/emulatorjs/data/GameManager.js @@ -1,345 +1,374 @@ -class EJS_GameManager { - constructor(Module, EJS) { - this.EJS = EJS; - this.Module = Module; - this.FS = this.Module.FS; - this.functions = { - restart: this.Module.cwrap('system_restart', '', []), - getStateInfo: this.Module.cwrap('get_state_info', 'string', []), //these names are dumb - saveStateInfo: this.Module.cwrap('save_state_info', 'null', []), - loadState: this.Module.cwrap('load_state', 'number', ['string', 'number']), - screenshot: this.Module.cwrap('cmd_take_screenshot', '', []), - simulateInput: this.Module.cwrap('simulate_input', 'null', ['number', 'number', 'number']), - toggleMainLoop: this.Module.cwrap('toggleMainLoop', 'null', ['number']), - getCoreOptions: this.Module.cwrap('get_core_options', 'string', []), - setVariable: this.Module.cwrap('ejs_set_variable', 'null', ['string', 'string']), - setCheat: this.Module.cwrap('set_cheat', 'null', ['number', 'number', 'string']), - resetCheat: this.Module.cwrap('reset_cheat', 'null', []), - toggleShader: this.Module.cwrap('shader_enable', 'null', ['number']), - getDiskCount: this.Module.cwrap('get_disk_count', 'number', []), - getCurrentDisk: this.Module.cwrap('get_current_disk', 'number', []), - setCurrentDisk: this.Module.cwrap('set_current_disk', 'null', ['number']), - getSaveFilePath: this.Module.cwrap('save_file_path', 'string', []), - saveSaveFiles: this.Module.cwrap('cmd_savefiles', '', []), - supportsStates: this.Module.cwrap('supports_states', 'number', []), - loadSaveFiles: this.Module.cwrap('refresh_save_files', 'null', []), - toggleFastForward: this.Module.cwrap('toggle_fastforward', 'null', ['number']), - setFastForwardRatio: this.Module.cwrap('set_ff_ratio', 'null', ['number']), - toggleRewind: this.Module.cwrap('toggle_rewind', 'null', ['number']), - setRewindGranularity: this.Module.cwrap('set_rewind_granularity', 'null', ['number']), - toggleSlowMotion: this.Module.cwrap('toggle_slow_motion', 'null', ['number']), - setSlowMotionRatio: this.Module.cwrap('set_sm_ratio', 'null', ['number']), - getFrameNum: this.Module.cwrap('get_current_frame_count', 'number', ['']) - } - this.mkdir("/home"); - this.mkdir("/home/web_user"); - this.mkdir("/home/web_user/retroarch"); - this.mkdir("/home/web_user/retroarch/userdata"); - this.mkdir("/home/web_user/retroarch/userdata/config"); - this.mkdir("/home/web_user/retroarch/userdata/config/Beetle PSX HW"); - this.FS.writeFile("/home/web_user/retroarch/userdata/config/Beetle PSX HW/Beetle PSX HW.opt", 'beetle_psx_hw_renderer = "software"\n'); - - this.mkdir("/data"); - this.mkdir("/data/saves"); - - this.FS.writeFile("/home/web_user/retroarch/userdata/retroarch.cfg", this.getRetroArchCfg()); - - this.FS.mount(IDBFS, {}, '/data/saves'); - this.FS.syncfs(true, () => {}); - - this.initShaders(); - - this.EJS.addEventListener(window, "beforeunload", () => { - this.saveSaveFiles(); - this.FS.syncfs(() => {}); - }) - } - mkdir(path) { - try { - this.FS.mkdir(path); - } catch(e) {} - } - getRetroArchCfg() { - return "autosave_interval = 60\n" + - "screenshot_directory = \"/\"\n" + - "block_sram_overwrite = false\n" + - "video_gpu_screenshot = false\n" + - "audio_latency = 64\n" + - "video_top_portrait_viewport = true\n" + - "video_vsync = true\n" + - "video_smooth = false\n" + - "fastforward_ratio = 3.0\n" + - "slowmotion_ratio = 3.0\n" + - (this.EJS.rewindEnabled ? "rewind_enable = true\n" : "") + - (this.EJS.rewindEnabled ? "rewind_granularity = 6\n" : "") + - "savefile_directory = \"/data/saves\"\n"; - } - initShaders() { - if (!window.EJS_SHADERS) return; - this.mkdir("/shader"); - for (const shader in window.EJS_SHADERS) { - this.FS.writeFile('/shader/'+shader, window.EJS_SHADERS[shader]); - } - } - clearEJSResetTimer() { - if (this.EJS.resetTimeout) { - clearTimeout(this.EJS.resetTimeout); - delete this.EJS.resetTimeout; - } - } - restart() { - this.clearEJSResetTimer(); - this.functions.restart(); - } - getState() { - return new Promise(async (resolve, reject) => { - const stateInfo = (await this.getStateInfo()).split('|') - let state; - let size = stateInfo[0] >> 0; - if (size > 0) { - state = new Uint8Array(size); - let start = stateInfo[1] >> 0; - for (let i=0; i { - let a; - let b = setInterval(() => { - a = this.functions.getStateInfo(); - if (a) { - clearInterval(b); - resolve(a); - } - }, 50) - }); - } - loadState(state) { - try { - this.FS.unlink('game.state'); - } catch(e){} - this.FS.writeFile('/game.state', state); - this.clearEJSResetTimer(); - this.functions.loadState("game.state", 0); - setTimeout(() => { - try { - this.FS.unlink('game.state'); - } catch(e){} - }, 5000) - } - screenshot() { - this.functions.screenshot(); - return this.FS.readFile('screenshot.png'); - } - quickSave(slot) { - if (!slot) slot = 1; - (async () => { - let name = slot + '-quick.state'; - try { - this.FS.unlink(name); - } catch (e) {} - let data = await this.getState(); - this.FS.writeFile('/'+name, data); - })(); - } - quickLoad(slot) { - if (!slot) slot = 1; - (async () => { - let name = slot + '-quick.state'; - this.clearEJSResetTimer(); - this.functions.loadState(name, 0); - })(); - } - simulateInput(player, index, value) { - if (this.EJS.isNetplay) { - this.EJS.netplay.simulateInput(player, index, value); - return; - } - if ([24, 25, 26, 27, 28, 29].includes(index)) { - if (index === 24 && value === 1) { - const slot = this.EJS.settings['save-state-slot'] ? this.EJS.settings['save-state-slot'] : "1"; - this.quickSave(slot); - this.EJS.displayMessage(this.EJS.localization("SAVED STATE TO SLOT")+" "+slot); - } - if (index === 25 && value === 1) { - const slot = this.EJS.settings['save-state-slot'] ? this.EJS.settings['save-state-slot'] : "1"; - this.quickLoad(slot); - this.EJS.displayMessage(this.EJS.localization("LOADED STATE FROM SLOT")+" "+slot); - } - if (index === 26 && value === 1) { - let newSlot; - try { - newSlot = parseFloat(this.EJS.settings['save-state-slot'] ? this.EJS.settings['save-state-slot'] : "1") + 1; - } catch(e) { - newSlot = 1; - } - if (newSlot > 9) newSlot = 1; - this.EJS.displayMessage(this.EJS.localization("SET SAVE STATE SLOT TO")+" "+newSlot); - this.EJS.changeSettingOption('save-state-slot', newSlot.toString()); - } - if (index === 27) { - this.functions.toggleFastForward(this.EJS.isFastForward ? !value : value); - } - if (index === 29) { - this.functions.toggleSlowMotion(this.EJS.isSlowMotion ? !value : value); - } - if (index === 28) { - if (this.EJS.rewindEnabled) { - this.functions.toggleRewind(value); - } - } - return; - } - this.functions.simulateInput(player, index, value); - } - getFileNames() { - if (this.EJS.getCore() === "picodrive") { - return ["bin", "gen", "smd", "md", "32x", "cue", "iso", "sms", "68k", "chd"]; - } else { - return ["toc", "ccd", "exe", "pbp", "chd", "img", "bin", "iso"]; - } - } - createCueFile(fileNames) { - try { - if (fileNames.length > 1) { - fileNames = fileNames.filter((item) => { - return this.getFileNames().includes(item.split(".").pop().toLowerCase()); - }) - fileNames = fileNames.sort((a, b) => { - if (isNaN(a.charAt()) || isNaN(b.charAt())) throw new Error("Incorrect file name format"); - return (parseInt(a.charAt()) > parseInt(b.charAt())) ? 1 : -1; - }) - } - } catch(e) { - if (fileNames.length > 1) { - console.warn("Could not auto-create cue file(s)."); - return null; - } - } - for (let i=0; i 1) { - let contents = ""; - for (let i=0; i { - this.EJS.downloadFile('cores/ppsspp-assets.zip', (res) => { - this.EJS.checkCompression(new Uint8Array(res.data), this.EJS.localization("Decompress Game Data")).then((pspassets) => { - if (pspassets === -1) { - this.EJS.textElem.innerText = this.localization('Network Error'); - this.EJS.textElem.style.color = "red"; - return; - } - this.mkdir("/PPSSPP"); - - for (const file in pspassets) { - const data = pspassets[file]; - const path = "/PPSSPP/"+file; - const paths = path.split("/"); - let cp = ""; - for (let i=0; i {}); - } - supportsStates() { - return !!this.functions.supportsStates(); - } - getSaveFile() { - this.saveSaveFiles(); - const exists = FS.analyzePath(this.getSaveFilePath()).exists; - return (exists ? FS.readFile(this.getSaveFilePath()) : null); - } - loadSaveFiles() { - this.clearEJSResetTimer(); - this.functions.loadSaveFiles(); - } - setFastForwardRatio(ratio) { - this.functions.setFastForwardRatio(ratio); - } - toggleFastForward(active) { - this.functions.toggleFastForward(active); - } - setSlowMotionRatio(ratio) { - this.functions.setSlowMotionRatio(ratio); - } - toggleSlowMotion(active) { - this.functions.toggleSlowMotion(active); - } - setRewindGranularity(value) { - this.functions.setRewindGranularity(value); - } - getFrameNum() { - return this.functions.getFrameNum(); - } -} - -window.EJS_GameManager = EJS_GameManager; +class EJS_GameManager { + constructor(Module, EJS) { + this.EJS = EJS; + this.Module = Module; + this.FS = this.Module.FS; + this.functions = { + restart: this.Module.cwrap('system_restart', '', []), + saveStateInfo: this.Module.cwrap('save_state_info', 'null', []), + loadState: this.Module.cwrap('load_state', 'number', ['string', 'number']), + screenshot: this.Module.cwrap('cmd_take_screenshot', '', []), + simulateInput: this.Module.cwrap('simulate_input', 'null', ['number', 'number', 'number']), + toggleMainLoop: this.Module.cwrap('toggleMainLoop', 'null', ['number']), + getCoreOptions: this.Module.cwrap('get_core_options', 'string', []), + setVariable: this.Module.cwrap('ejs_set_variable', 'null', ['string', 'string']), + setCheat: this.Module.cwrap('set_cheat', 'null', ['number', 'number', 'string']), + resetCheat: this.Module.cwrap('reset_cheat', 'null', []), + toggleShader: this.Module.cwrap('shader_enable', 'null', ['number']), + getDiskCount: this.Module.cwrap('get_disk_count', 'number', []), + getCurrentDisk: this.Module.cwrap('get_current_disk', 'number', []), + setCurrentDisk: this.Module.cwrap('set_current_disk', 'null', ['number']), + getSaveFilePath: this.Module.cwrap('save_file_path', 'string', []), + saveSaveFiles: this.Module.cwrap('cmd_savefiles', '', []), + supportsStates: this.Module.cwrap('supports_states', 'number', []), + loadSaveFiles: this.Module.cwrap('refresh_save_files', 'null', []), + toggleFastForward: this.Module.cwrap('toggle_fastforward', 'null', ['number']), + setFastForwardRatio: this.Module.cwrap('set_ff_ratio', 'null', ['number']), + toggleRewind: this.Module.cwrap('toggle_rewind', 'null', ['number']), + setRewindGranularity: this.Module.cwrap('set_rewind_granularity', 'null', ['number']), + toggleSlowMotion: this.Module.cwrap('toggle_slow_motion', 'null', ['number']), + setSlowMotionRatio: this.Module.cwrap('set_sm_ratio', 'null', ['number']), + getFrameNum: this.Module.cwrap('get_current_frame_count', 'number', ['']) + } + this.writeFile("/home/web_user/retroarch/userdata/config/Beetle PSX HW/Beetle PSX HW.opt", 'beetle_psx_hw_renderer = "software"\n'); + this.writeFile("/home/web_user/retroarch/userdata/config/MAME 2003 (0.78)/MAME 2003 (0.78).opt", 'mame2003_skip_disclaimer = "enabled"\nmame2003_skip_warnings = "enabled"\n'); + + this.mkdir("/data"); + this.mkdir("/data/saves"); + + this.writeFile("/home/web_user/retroarch/userdata/retroarch.cfg", this.getRetroArchCfg()); + + this.FS.mount(IDBFS, {}, '/data/saves'); + this.FS.syncfs(true, () => {}); + + this.initShaders(); + + this.EJS.addEventListener(window, "beforeunload", () => { + this.saveSaveFiles(); + this.FS.syncfs(() => {}); + }) + } + loadExternalFiles() { + return new Promise(async (resolve, reject) => { + if (this.EJS.config.externalFiles && this.EJS.config.externalFiles.constructor.name === 'Object') { + for (const key in this.EJS.config.externalFiles) { + await new Promise(done => { + this.EJS.downloadFile(this.EJS.config.externalFiles[key], async (res) => { + if (res === -1) { + if (this.EJS.debug) console.warn("Failed to fetch file from '" + this.EJS.config.externalFiles[key] + "'. Make sure the file exists."); + return done(); + } + let path = key; + if (key.trim().endsWith("/")) { + const invalidCharacters = /[#<$+%>!`&*'|{}/\\?"=@:^\r\n]/ig; + let name = this.EJS.config.externalFiles[key].split("/").pop().split("#")[0].split("?")[0].replace(invalidCharacters, "").trim(); + if (!name) return done(); + const files = await this.EJS.checkCompression(new Uint8Array(res.data), this.EJS.localization("Decompress Game Assets")); + if (files["!!notCompressedData"]) { + path += name; + } else { + for (const k in files) { + this.writeFile(path+k, files[k]); + } + return done(); + } + } + try { + this.writeFile(path, res.data); + } catch(e) { + if (this.EJS.debug) console.warn("Failed to write file to '" + path + "'. Make sure there are no conflicting files."); + } + done(); + }, null, true, {responseType: "arraybuffer", method: "GET"}); + }) + } + } + resolve(); + }); + } + writeFile(path, data) { + const parts = path.split("/"); + let current = "/"; + for (let i=0; i { + try { + this.FS.unlink('game.state'); + } catch(e){} + }, 5000) + } + screenshot() { + this.functions.screenshot(); + return new Promise(async resolve => { + while (1) { + try { + FS.stat("/screenshot.png"); + return resolve(this.FS.readFile("/screenshot.png")); + } catch(e) {} + + await new Promise(res => setTimeout(res, 50)); + } + }) + } + quickSave(slot) { + if (!slot) slot = 1; + (async () => { + let name = slot + '-quick.state'; + try { + this.FS.unlink(name); + } catch (e) {} + let data = await this.getState(); + this.FS.writeFile('/'+name, data); + })(); + } + quickLoad(slot) { + if (!slot) slot = 1; + (async () => { + let name = slot + '-quick.state'; + this.clearEJSResetTimer(); + this.functions.loadState(name, 0); + })(); + } + simulateInput(player, index, value) { + if (this.EJS.isNetplay) { + this.EJS.netplay.simulateInput(player, index, value); + return; + } + if ([24, 25, 26, 27, 28, 29].includes(index)) { + if (index === 24 && value === 1) { + const slot = this.EJS.settings['save-state-slot'] ? this.EJS.settings['save-state-slot'] : "1"; + this.quickSave(slot); + this.EJS.displayMessage(this.EJS.localization("SAVED STATE TO SLOT")+" "+slot); + } + if (index === 25 && value === 1) { + const slot = this.EJS.settings['save-state-slot'] ? this.EJS.settings['save-state-slot'] : "1"; + this.quickLoad(slot); + this.EJS.displayMessage(this.EJS.localization("LOADED STATE FROM SLOT")+" "+slot); + } + if (index === 26 && value === 1) { + let newSlot; + try { + newSlot = parseFloat(this.EJS.settings['save-state-slot'] ? this.EJS.settings['save-state-slot'] : "1") + 1; + } catch(e) { + newSlot = 1; + } + if (newSlot > 9) newSlot = 1; + this.EJS.displayMessage(this.EJS.localization("SET SAVE STATE SLOT TO")+" "+newSlot); + this.EJS.changeSettingOption('save-state-slot', newSlot.toString()); + } + if (index === 27) { + this.functions.toggleFastForward(this.EJS.isFastForward ? !value : value); + } + if (index === 29) { + this.functions.toggleSlowMotion(this.EJS.isSlowMotion ? !value : value); + } + if (index === 28) { + if (this.EJS.rewindEnabled) { + this.functions.toggleRewind(value); + } + } + return; + } + this.functions.simulateInput(player, index, value); + } + getFileNames() { + if (this.EJS.getCore() === "picodrive") { + return ["bin", "gen", "smd", "md", "32x", "cue", "iso", "sms", "68k", "chd"]; + } else { + return ["toc", "ccd", "exe", "pbp", "chd", "img", "bin", "iso"]; + } + } + createCueFile(fileNames) { + try { + if (fileNames.length > 1) { + fileNames = fileNames.filter((item) => { + return this.getFileNames().includes(item.split(".").pop().toLowerCase()); + }) + fileNames = fileNames.sort((a, b) => { + if (isNaN(a.charAt()) || isNaN(b.charAt())) throw new Error("Incorrect file name format"); + return (parseInt(a.charAt()) > parseInt(b.charAt())) ? 1 : -1; + }) + } + } catch(e) { + if (fileNames.length > 1) { + console.warn("Could not auto-create cue file(s)."); + return null; + } + } + for (let i=0; i 1) { + let contents = ""; + for (let i=0; i { + this.EJS.downloadFile('cores/ppsspp-assets.zip', (res) => { + this.EJS.checkCompression(new Uint8Array(res.data), this.EJS.localization("Decompress Game Data")).then((pspassets) => { + if (pspassets === -1) { + this.EJS.textElem.innerText = this.localization('Network Error'); + this.EJS.textElem.style.color = "red"; + return; + } + this.mkdir("/PPSSPP"); + + for (const file in pspassets) { + const data = pspassets[file]; + const path = "/PPSSPP/"+file; + const paths = path.split("/"); + let cp = ""; + for (let i=0; i {}); + } + supportsStates() { + return !!this.functions.supportsStates(); + } + getSaveFile() { + this.saveSaveFiles(); + const exists = FS.analyzePath(this.getSaveFilePath()).exists; + return (exists ? FS.readFile(this.getSaveFilePath()) : null); + } + loadSaveFiles() { + this.clearEJSResetTimer(); + this.functions.loadSaveFiles(); + } + setFastForwardRatio(ratio) { + this.functions.setFastForwardRatio(ratio); + } + toggleFastForward(active) { + this.functions.toggleFastForward(active); + } + setSlowMotionRatio(ratio) { + this.functions.setSlowMotionRatio(ratio); + } + toggleSlowMotion(active) { + this.functions.toggleSlowMotion(active); + } + setRewindGranularity(value) { + this.functions.setRewindGranularity(value); + } + getFrameNum() { + return this.functions.getFrameNum(); + } +} + +window.EJS_GameManager = EJS_GameManager; diff --git a/semag/emulatorjs/data/compression/extract7z.js b/semag/emulatorjs/data/compression/extract7z.js index c48b7453..e270b151 100644 --- a/semag/emulatorjs/data/compression/extract7z.js +++ b/semag/emulatorjs/data/compression/extract7z.js @@ -1 +1 @@ -var Module,Module=Module||((void 0!==Module?Module:null)||{}),moduleOverrides={},key;for(key in Module)Module.hasOwnProperty(key)&&(moduleOverrides[key]=Module[key]);var ENVIRONMENT_IS_WEB=!1,ENVIRONMENT_IS_WORKER=!1,ENVIRONMENT_IS_NODE=!1,ENVIRONMENT_IS_SHELL=!1,nodeFS,nodePath,TRY_USE_DUMP,key;if(Module.ENVIRONMENT)if("WEB"===Module.ENVIRONMENT)ENVIRONMENT_IS_WEB=!0;else if("WORKER"===Module.ENVIRONMENT)ENVIRONMENT_IS_WORKER=!0;else if("NODE"===Module.ENVIRONMENT)ENVIRONMENT_IS_NODE=!0;else{if("SHELL"!==Module.ENVIRONMENT)throw new Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.");ENVIRONMENT_IS_SHELL=!0}else ENVIRONMENT_IS_WEB="object"==typeof window,ENVIRONMENT_IS_WORKER="function"==typeof importScripts,ENVIRONMENT_IS_NODE="object"==typeof process&&"function"==typeof require&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER,ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE)Module.print||(Module.print=console.log),Module.printErr||(Module.printErr=console.warn),Module.read=function(e,r){nodeFS=nodeFS||require("fs"),e=(nodePath=nodePath||require("path")).normalize(e);e=nodeFS.readFileSync(e);return r?e:e.toString()},Module.readBinary=function(e){e=Module.read(e,!0);return e.buffer||(e=new Uint8Array(e)),assert(e.buffer),e},Module.load=function(e){globalEval(read(e))},Module.thisProgram||(1>2],e=-16&(r+e+15|0);if((HEAP32[DYNAMICTOP_PTR>>2]=e,TOTAL_MEMORY<=e)&&!enlargeMemory())return HEAP32[DYNAMICTOP_PTR>>2]=r,0;return r},alignMemory:function(e,r){return e=Math.ceil(e/(r||16))*(r||16)},makeBigInt:function(e,r,t){return t?+(e>>>0)+4294967296*(r>>>0):+(e>>>0)+4294967296*(0|r)},GLOBAL_BASE:8,QUANTUM_SIZE:4,__dummy__:0};Module.Runtime=Runtime;var ABORT=0,EXITSTATUS=0,cwrap,ccall;function assert(e,r){e||abort("Assertion failed: "+r)}function getCFunc(_0x222174){var _0x54cf7b=Module["_"+_0x222174];if(!_0x54cf7b)try{_0x54cf7b=eval("_"+_0x222174)}catch(_0x4b65d1){}return assert(_0x54cf7b,"Cannot call unknown function "+_0x222174+" (perhaps LLVM optimizations or closure removed it?)"),_0x54cf7b}function setValue(e,r,t,n){switch("*"===(t=t||"i8").charAt(t.length-1)&&(t="i32"),t){case"i1":case"i8":HEAP8[e>>0]=r;break;case"i16":HEAP16[e>>1]=r;break;case"i32":HEAP32[e>>2]=r;break;case"i64":tempI64=[r>>>0,(tempDouble=r,1<=+Math_abs(tempDouble)?0>>0:~~+Math_ceil((tempDouble-(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[e>>2]=tempI64[0],HEAP32[e+4>>2]=tempI64[1];break;case"float":HEAPF32[e>>2]=r;break;case"double":HEAPF64[e>>3]=r;break;default:abort("invalid type for setValue: "+t)}}function getValue(e,r,t){switch("*"===(r=r||"i8").charAt(r.length-1)&&(r="i32"),r){case"i1":case"i8":return HEAP8[e>>0];case"i16":return HEAP16[e>>1];case"i32":case"i64":return HEAP32[e>>2];case"float":return HEAPF32[e>>2];case"double":return HEAPF64[e>>3];default:abort("invalid type for setValue: "+r)}return null}!function(){var _0x17b09f={stackSave:function(){Runtime.stackSave()},stackRestore:function(){Runtime.stackRestore()},arrayToC:function(e){var r=Runtime.stackAlloc(e.length);return writeArrayToMemory(e,r),r},stringToC:function(e){var r,t=0;return null!=e&&0!==e&&(r=1+(e.length<<2),stringToUTF8(e,t=Runtime.stackAlloc(r),r)),t}},_0x237e8c={string:_0x17b09f.stringToC,array:_0x17b09f.arrayToC};ccall=function(e,r,t,n,i){var e=getCFunc(e),o=[],a=0;if(assert("array"!==r,'Return type should not be "array".'),n)for(var u=0;u>2]=0;for(s=u+o;n>0]=0;return u}if("i8"===a)return e.subarray||e.slice?HEAPU8.set(e,u):HEAPU8.set(new Uint8Array(e),u),u;for(var f,l,c,d=0;d>0],(0!=t||r)&&(i++,!r||i!=r););r=r||i;var o="";if(n<128){for(var a;0>0];if(!t)return r;r+=String.fromCharCode(t)}}function stringToAscii(e,r){return writeAsciiToMemory(e,r,!1)}Module.ALLOC_NORMAL=ALLOC_NORMAL,Module.ALLOC_STACK=ALLOC_STACK,Module.ALLOC_STATIC=ALLOC_STATIC,Module.ALLOC_DYNAMIC=ALLOC_DYNAMIC,Module.ALLOC_NONE=ALLOC_NONE,Module.allocate=allocate,Module.getMemory=getMemory,Module.Pointer_stringify=Pointer_stringify,Module.AsciiToString=AsciiToString,Module.stringToAscii=stringToAscii;var UTF8Decoder="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function UTF8ArrayToString(e,r){for(var t=r;e[t];)++t;if(16>10,56320|1023&i))):s+=String.fromCharCode((31&a)<<6|u)):s+=String.fromCharCode(a)}}function UTF8ToString(e){return UTF8ArrayToString(HEAPU8,e)}function stringToUTF8Array(e,r,t,n){if(!(0>6,r[t++]=128|63&u}else if(u<=65535){if(o<=t+2)break;r[t++]=224|u>>12,r[t++]=128|u>>6&63,r[t++]=128|63&u}else if(u<=2097151){if(o<=t+3)break;r[t++]=240|u>>18,r[t++]=128|u>>12&63,r[t++]=128|u>>6&63,r[t++]=128|63&u}else if(u<=67108863){if(o<=t+4)break;r[t++]=248|u>>24,r[t++]=128|u>>18&63,r[t++]=128|u>>12&63,r[t++]=128|u>>6&63,r[t++]=128|63&u}else{if(o<=t+5)break;r[t++]=252|u>>30,r[t++]=128|u>>24&63,r[t++]=128|u>>18&63,r[t++]=128|u>>12&63,r[t++]=128|u>>6&63,r[t++]=128|63&u}}return r[t]=0,t-i}function stringToUTF8(e,r,t){return assert("number"==typeof t,"stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),stringToUTF8Array(e,HEAPU8,r,t)}function lengthBytesUTF8(e){for(var r=0,t=0;t>2)-1]=34821223,HEAPU32[(STACK_MAX>>2)-2]=2310721022}function checkStackCookie(){if(34821223==HEAPU32[(STACK_MAX>>2)-1]&&2310721022==HEAPU32[(STACK_MAX>>2)-2]||abort("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x02135467, but received 0x"+HEAPU32[(STACK_MAX>>2)-2].toString(16)+" "+HEAPU32[(STACK_MAX>>2)-1].toString(16)),1668509029!==HEAP32[0])throw"Runtime error: The application has corrupted its heap memory area (address zero)!"}function abortStackOverflow(e){abort("Stack overflow! Attempted to allocate "+e+" bytes on the stack, but stack has only "+(STACK_MAX-asm.stackSave()+e)+" bytes available!")}function abortOnCannotGrowMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+TOTAL_MEMORY+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which adjusts the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}function enlargeMemory(){assert(HEAP32[DYNAMICTOP_PTR>>2]>TOTAL_MEMORY),assert(4>2]>=r)return!1;for(;TOTAL_MEMORY>2];)if(TOTAL_MEMORY>0]=e.charCodeAt(n);t||(HEAP8[r>>0]=0)}Module.addOnPreRun=addOnPreRun,Module.addOnInit=addOnInit,Module.addOnPreMain=addOnPreMain,Module.addOnExit=addOnExit,Module.addOnPostRun=addOnPostRun,Module.intArrayFromString=intArrayFromString,Module.intArrayToString=intArrayToString,Module.writeStringToMemory=writeStringToMemory,Module.writeArrayToMemory=writeArrayToMemory,Module.writeAsciiToMemory=writeAsciiToMemory,Math.imul&&-5===Math.imul(4294967295,5)||(Math.imul=function(e,r){var t=65535&e,n=65535&r;return t*n+((e>>>16)*n+t*(r>>>16)<<16)|0}),Math.imul=Math.imul,Math.clz32||(Math.clz32=function(e){e>>>=0;for(var r=0;r<32;r++)if(e&1<<31-r)return r;return 32}),Math.clz32=Math.clz32,Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Math.trunc=Math.trunc;var Math_abs=Math.abs,Math_cos=Math.cos,Math_sin=Math.sin,Math_tan=Math.tan,Math_acos=Math.acos,Math_asin=Math.asin,Math_atan=Math.atan,Math_atan2=Math.atan2,Math_exp=Math.exp,Math_log=Math.log,Math_sqrt=Math.sqrt,Math_ceil=Math.ceil,Math_floor=Math.floor,Math_pow=Math.pow,Math_imul=Math.imul,Math_fround=Math.fround,Math_min=Math.min,Math_clz32=Math.clz32,Math_trunc=Math.trunc,runDependencies=0,runDependencyWatcher=null,dependenciesFulfilled=null,runDependencyTracking={};function getUniqueRunDependency(e){for(var r=e;;){if(!runDependencyTracking[e])return e;e=r+Math.random()}return e}function addRunDependency(e){runDependencies++,Module.monitorRunDependencies&&Module.monitorRunDependencies(runDependencies),e?(assert(!runDependencyTracking[e]),runDependencyTracking[e]=1,null===runDependencyWatcher&&"undefined"!=typeof setInterval&&(runDependencyWatcher=setInterval(function(){if(ABORT)return clearInterval(runDependencyWatcher),void(runDependencyWatcher=null);var e,r=!1;for(e in runDependencyTracking)r||(r=!0,Module.printErr("still waiting on run dependencies:")),Module.printErr("dependency: "+e);r&&Module.printErr("(end of list)")},1e4))):Module.printErr("warning: run dependency added without ID")}function removeRunDependency(e){runDependencies--,Module.monitorRunDependencies&&Module.monitorRunDependencies(runDependencies),e?(assert(runDependencyTracking[e]),delete runDependencyTracking[e]):Module.printErr("warning: run dependency removed without ID"),0==runDependencies&&(null!==runDependencyWatcher&&(clearInterval(runDependencyWatcher),runDependencyWatcher=null),dependenciesFulfilled&&(e=dependenciesFulfilled,dependenciesFulfilled=null,e()))}Module.addRunDependency=addRunDependency,Module.removeRunDependency=removeRunDependency,Module.preloadedImages={},Module.preloadedAudios={};var ASM_CONSTS=[function(e,r,t){for(var n=new Uint8Array(r),i=0;i>2]=e:Module.printErr("failed to set errno from JS"),e}var PATH={splitPath:function(e){return/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1)},normalizeArray:function(e,r){for(var t=0,n=e.length-1;0<=n;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t--;)e.unshift("..");return e},normalize:function(e){var r="/"===e.charAt(0),t="/"===e.substr(-1);return(e=PATH.normalizeArray(e.split("/").filter(function(e){return!!e}),!r).join("/"))||r||(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:function(e){var r=PATH.splitPath(e),e=r[0],r=r[1];return e||r?e+(r=r&&r.substr(0,r.length-1)):"."},basename:function(e){if("/"===e)return"/";var r=e.lastIndexOf("/");return-1===r?e:e.substr(r+1)},extname:function(e){return PATH.splitPath(e)[3]},join:function(){var e=Array.prototype.slice.call(arguments,0);return PATH.normalize(e.join("/"))},join2:function(e,r){return PATH.normalize(e+"/"+r)},resolve:function(){for(var e="",r=!1,t=arguments.length-1;-1<=t&&!r;t--){var n=0<=t?arguments[t]:FS.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,r="/"===n.charAt(0)}return(r?"/":"")+(e=PATH.normalizeArray(e.split("/").filter(function(e){return!!e}),!r).join("/"))||"."},relative:function(e,r){function t(e){for(var r=0;re.contents.length&&(e.contents=MEMFS.getFileDataAsRegularArray(e),e.usedBytes=e.contents.length),!e.contents||e.contents.subarray){var t=e.contents?e.contents.buffer.byteLength:0;if(r<=t)return;r=Math.max(r,t*(t<1048576?2:1.125)|0),0!=t&&(r=Math.max(r,256));t=e.contents;return e.contents=new Uint8Array(r),void(0r)e.contents.length=r;else for(;e.contents.length=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-i,n);if(assert(0<=a),8t.timestamp)&&(a.push(e),o++)});var t=[];if(Object.keys(i.entries).forEach(function(e){i.entries[e];n.entries[e]||(t.push(e),o++)}),!o)return r(null);var u=0,e=("remote"===n.type?n:i).db.transaction([IDBFS.DB_STORE_NAME],"readwrite"),s=e.objectStore(IDBFS.DB_STORE_NAME);function f(e){return e?f.errored?void 0:(f.errored=!0,r(e)):++u>=o?r(null):void 0}e.onerror=function(e){f(this.error),e.preventDefault()},a.sort().forEach(function(t){"local"===i.type?IDBFS.loadRemoteEntry(s,t,function(e,r){return e?f(e):void IDBFS.storeLocalEntry(t,r,f)}):IDBFS.loadLocalEntry(t,function(e,r){return e?f(e):void IDBFS.storeRemoteEntry(s,t,r,f)})}),t.sort().reverse().forEach(function(e){"local"===i.type?IDBFS.removeLocalEntry(e,f):IDBFS.removeRemoteEntry(s,e,f)})}},NODEFS={isWindows:!1,staticInit:function(){NODEFS.isWindows=!!process.platform.match(/^win/)},mount:function(e){return assert(ENVIRONMENT_IS_NODE),NODEFS.createNode(null,"/",NODEFS.getMode(e.opts.root),0)},createNode:function(e,r,t,n){if(!FS.isDir(t)&&!FS.isFile(t)&&!FS.isLink(t))throw new FS.ErrnoError(ERRNO_CODES.EINVAL);t=FS.createNode(e,r,t);return t.node_ops=NODEFS.node_ops,t.stream_ops=NODEFS.stream_ops,t},getMode:function(e){var r;try{r=fs.lstatSync(e),NODEFS.isWindows&&(r.mode=r.mode|(146&r.mode)>>1)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return r.mode},realPath:function(e){for(var r=[];e.parent!==e;)r.push(e.name),e=e.parent;return r.push(e.mount.opts.root),r.reverse(),PATH.join.apply(null,r)},flagsToPermissionStringMap:{0:"r",1:"r+",2:"r+",64:"r",65:"r+",66:"r+",129:"rx+",193:"rx+",514:"w+",577:"w",578:"w+",705:"wx",706:"wx+",1024:"a",1025:"a",1026:"a+",1089:"a",1090:"a+",1153:"ax",1154:"ax+",1217:"ax",1218:"ax+",4096:"rs",4098:"rs+"},flagsToPermissionString:function(e){if(e&=-2097153,e&=-2049,e&=-32769,(e&=-524289)in NODEFS.flagsToPermissionStringMap)return NODEFS.flagsToPermissionStringMap[e];throw new FS.ErrnoError(ERRNO_CODES.EINVAL)},node_ops:{getattr:function(e){var r,t=NODEFS.realPath(e);try{r=fs.lstatSync(t)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return NODEFS.isWindows&&!r.blksize&&(r.blksize=4096),NODEFS.isWindows&&!r.blocks&&(r.blocks=(r.size+r.blksize-1)/r.blksize|0),{dev:r.dev,ino:r.ino,mode:r.mode,nlink:r.nlink,uid:r.uid,gid:r.gid,rdev:r.rdev,size:r.size,atime:r.atime,mtime:r.mtime,ctime:r.ctime,blksize:r.blksize,blocks:r.blocks}},setattr:function(e,r){var t,n=NODEFS.realPath(e);try{void 0!==r.mode&&(fs.chmodSync(n,r.mode),e.mode=r.mode),void 0!==r.timestamp&&(t=new Date(r.timestamp),fs.utimesSync(n,t,t)),void 0!==r.size&&fs.truncateSync(n,r.size)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},lookup:function(e,r){var t=PATH.join2(NODEFS.realPath(e),r),t=NODEFS.getMode(t);return NODEFS.createNode(e,r,t)},mknod:function(e,r,t,n){var i=NODEFS.createNode(e,r,t,n),o=NODEFS.realPath(i);try{FS.isDir(i.mode)?fs.mkdirSync(o,i.mode):fs.writeFileSync(o,"",{mode:i.mode})}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return i},rename:function(e,r,t){var n=NODEFS.realPath(e),i=PATH.join2(NODEFS.realPath(r),t);try{fs.renameSync(n,i)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},unlink:function(e,r){var t=PATH.join2(NODEFS.realPath(e),r);try{fs.unlinkSync(t)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},rmdir:function(e,r){var t=PATH.join2(NODEFS.realPath(e),r);try{fs.rmdirSync(t)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},readdir:function(e){var r=NODEFS.realPath(e);try{return fs.readdirSync(r)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},symlink:function(e,r,t){var n=PATH.join2(NODEFS.realPath(e),r);try{fs.symlinkSync(t,n)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},readlink:function(e){var r=NODEFS.realPath(e);try{return r=fs.readlinkSync(r),NODEJS_PATH.relative(NODEJS_PATH.resolve(e.mount.opts.root),r)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}},stream_ops:{open:function(e){var r=NODEFS.realPath(e.node);try{FS.isFile(e.node.mode)&&(e.nfd=fs.openSync(r,NODEFS.flagsToPermissionString(e.flags)))}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},close:function(e){try{FS.isFile(e.node.mode)&&e.nfd&&fs.closeSync(e.nfd)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},read:function(e,r,t,n,i){if(0===n)return 0;var o,a=new Buffer(n);try{o=fs.readSync(e.nfd,a,0,n,i)}catch(e){throw new FS.ErrnoError(ERRNO_CODES[e.code])}if(0=e.node.size)return 0;i=e.node.contents.slice(i,i+n),n=WORKERFS.reader.readAsArrayBuffer(i);return r.set(new Uint8Array(n),t),i.size},write:function(e,r,t,n,i){throw new FS.ErrnoError(ERRNO_CODES.EIO)},llseek:function(e,r,t){if(1===t?r+=e.position:2===t&&FS.isFile(e.node.mode)&&(r+=e.node.size),r<0)throw new FS.ErrnoError(ERRNO_CODES.EINVAL);return r}}};STATICTOP+=16,STATICTOP+=16,STATICTOP+=16;var FS={root:null,mounts:[],devices:[null],streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,trackingDelegate:{},tracking:{openFlags:{READ:1,WRITE:2}},ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,handleFSError:function(e){if(!(e instanceof FS.ErrnoError))throw e+" : "+stackTrace();return ___setErrNo(e.errno)},lookupPath:function(e,r){if(r=r||{},!(e=PATH.resolve(FS.cwd(),e)))return{path:"",node:null};var t,n={follow_mount:!0,recurse_count:0};for(t in n)void 0===r[t]&&(r[t]=n[t]);if(8>>0)%FS.nameTable.length},hashAddNode:function(e){var r=FS.hashName(e.parent.id,e.name);e.name_next=FS.nameTable[r],FS.nameTable[r]=e},hashRemoveNode:function(e){var r=FS.hashName(e.parent.id,e.name);if(FS.nameTable[r]===e)FS.nameTable[r]=e.name_next;else for(var t=FS.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode:function(e,r){var t=FS.mayLookup(e);if(t)throw new FS.ErrnoError(t,e);for(var t=FS.hashName(e.id,r),n=FS.nameTable[t];n;n=n.name_next){var i=n.name;if(n.parent.id===e.id&&i===r)return n}return FS.lookup(e,r)},createNode:function(e,r,t,n){FS.FSNode||(FS.FSNode=function(e,r,t,n){e=e||this,this.parent=e,this.mount=e.mount,this.mounted=null,this.id=FS.nextInode++,this.name=r,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=n},FS.FSNode.prototype={},Object.defineProperties(FS.FSNode.prototype,{read:{get:function(){return 365==(365&this.mode)},set:function(e){e?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146==(146&this.mode)},set:function(e){e?this.mode|=146:this.mode&=-147}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}}));n=new FS.FSNode(e,r,t,n);return FS.hashAddNode(n),n},destroyNode:function(e){FS.hashRemoveNode(e)},isRoot:function(e){return e===e.parent},isMountpoint:function(e){return!!e.mounted},isFile:function(e){return 32768==(61440&e)},isDir:function(e){return 16384==(61440&e)},isLink:function(e){return 40960==(61440&e)},isChrdev:function(e){return 8192==(61440&e)},isBlkdev:function(e){return 24576==(61440&e)},isFIFO:function(e){return 4096==(61440&e)},isSocket:function(e){return 49152==(49152&e)},flagModes:{r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218},modeStringToFlags:function(e){var r=FS.flagModes[e];if(void 0===r)throw new Error("Unknown file open mode: "+e);return r},flagsToPermissionString:function(e){var r=["r","w","rw"][3&e];return 512&e&&(r+="w"),r},nodePermissions:function(e,r){return FS.ignorePermissions||(-1===r.indexOf("r")||292&e.mode)&&(-1===r.indexOf("w")||146&e.mode)&&(-1===r.indexOf("x")||73&e.mode)?0:ERRNO_CODES.EACCES},mayLookup:function(e){var r=FS.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:ERRNO_CODES.EACCES)},mayCreate:function(e,r){try{FS.lookupNode(e,r);return ERRNO_CODES.EEXIST}catch(e){}return FS.nodePermissions(e,"wx")},mayDelete:function(e,r,t){var n;try{n=FS.lookupNode(e,r)}catch(e){return e.errno}var i=FS.nodePermissions(e,"wx");if(i)return i;if(t){if(!FS.isDir(n.mode))return ERRNO_CODES.ENOTDIR;if(FS.isRoot(n)||FS.getPath(n)===FS.cwd())return ERRNO_CODES.EBUSY}else if(FS.isDir(n.mode))return ERRNO_CODES.EISDIR;return 0},mayOpen:function(e,r){return e?FS.isLink(e.mode)?ERRNO_CODES.ELOOP:FS.isDir(e.mode)&&("r"!==FS.flagsToPermissionString(r)||512&r)?ERRNO_CODES.EISDIR:FS.nodePermissions(e,FS.flagsToPermissionString(r)):ERRNO_CODES.ENOENT},MAX_OPEN_FDS:4096,nextfd:function(e,r){e=e||0,r=r||FS.MAX_OPEN_FDS;for(var t=e;t<=r;t++)if(!FS.streams[t])return t;throw new FS.ErrnoError(ERRNO_CODES.EMFILE)},getStream:function(e){return FS.streams[e]},createStream:function(e,r,t){FS.FSStream||(FS.FSStream=function(){},FS.FSStream.prototype={},Object.defineProperties(FS.FSStream.prototype,{object:{get:function(){return this.node},set:function(e){this.node=e}},isRead:{get:function(){return 1!=(2097155&this.flags)}},isWrite:{get:function(){return 0!=(2097155&this.flags)}},isAppend:{get:function(){return 1024&this.flags}}}));var n,i=new FS.FSStream;for(n in e)i[n]=e[n];e=i;t=FS.nextfd(r,t);return e.fd=t,FS.streams[t]=e},closeStream:function(e){FS.streams[e]=null},chrdev_stream_ops:{open:function(e){var r=FS.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek:function(){throw new FS.ErrnoError(ERRNO_CODES.ESPIPE)}},major:function(e){return e>>8},minor:function(e){return 255&e},makedev:function(e,r){return e<<8|r},registerDevice:function(e,r){FS.devices[e]={stream_ops:r}},getDevice:function(e){return FS.devices[e]},getMounts:function(e){for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push.apply(t,n.mounts)}return r},syncfs:function(r,t){"function"==typeof r&&(t=r,r=!1),FS.syncFSRequests++,1=n.length&&o(null)}n.forEach(function(e){return e.type.syncfs?void e.type.syncfs(e,r,a):a(null)})},mount:function(e,r,t){var n="/"===t,i=!t;if(n&&FS.root)throw new FS.ErrnoError(ERRNO_CODES.EBUSY);if(!n&&!i){var o=FS.lookupPath(t,{follow_mount:!1});if(t=o.path,o=o.node,FS.isMountpoint(o))throw new FS.ErrnoError(ERRNO_CODES.EBUSY);if(!FS.isDir(o.mode))throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR)}t={type:e,opts:r,mountpoint:t,mounts:[]},e=e.mount(t);return(e.mount=t).root=e,n?FS.root=e:o&&(o.mounted=t,o.mount&&o.mount.mounts.push(t)),e},unmount:function(e){var r=FS.lookupPath(e,{follow_mount:!1});if(!FS.isMountpoint(r.node))throw new FS.ErrnoError(ERRNO_CODES.EINVAL);var e=r.node,r=e.mounted,n=FS.getMounts(r);Object.keys(FS.nameTable).forEach(function(e){for(var r=FS.nameTable[e];r;){var t=r.name_next;-1!==n.indexOf(r.mount)&&FS.destroyNode(r),r=t}}),e.mounted=null;r=e.mount.mounts.indexOf(r);assert(-1!==r),e.mount.mounts.splice(r,1)},lookup:function(e,r){return e.node_ops.lookup(e,r)},mknod:function(e,r,t){var n=FS.lookupPath(e,{parent:!0}).node,i=PATH.basename(e);if(!i||"."===i||".."===i)throw new FS.ErrnoError(ERRNO_CODES.EINVAL);e=FS.mayCreate(n,i);if(e)throw new FS.ErrnoError(e);if(!n.node_ops.mknod)throw new FS.ErrnoError(ERRNO_CODES.EPERM);return n.node_ops.mknod(n,i,r,t)},create:function(e,r){return r=void 0!==r?r:438,r&=4095,r|=32768,FS.mknod(e,r,0)},mkdir:function(e,r){return r=void 0!==r?r:511,r&=1023,r|=16384,FS.mknod(e,r,0)},mkdirTree:function(e,r){for(var t=e.split("/"),n="",i=0;ithis.length-1||e<0)){var r=e%this.chunkSize,e=e/this.chunkSize|0;return this.getter(e)[r]}},i.prototype.setDataGetter=function(e){this.getter=e},i.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",a,!1),e.send(null),!(200<=e.status&&e.status<300||304===e.status))throw new Error("Couldn't load "+a+". Status: "+e.status);var n=Number(e.getResponseHeader("Content-length")),r=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,t=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,i=1048576;r||(i=n);var o=this;o.setDataGetter(function(e){var r=e*i,t=(e+1)*i-1,t=Math.min(t,n-1);if(void 0===o.chunks[e]&&(o.chunks[e]=function(e,r){if(r=o.length)return 0;var a=Math.min(o.length-i,n);if(assert(0<=a),o.slice)for(var u=0;u>2]=n.dev,HEAP32[t+4>>2]=0,HEAP32[t+8>>2]=n.ino,HEAP32[t+12>>2]=n.mode,HEAP32[t+16>>2]=n.nlink,HEAP32[t+20>>2]=n.uid,HEAP32[t+24>>2]=n.gid,HEAP32[t+28>>2]=n.rdev,HEAP32[t+32>>2]=0,HEAP32[t+36>>2]=n.size,HEAP32[t+40>>2]=4096,HEAP32[t+44>>2]=n.blocks,HEAP32[t+48>>2]=n.atime.getTime()/1e3|0,HEAP32[t+52>>2]=0,HEAP32[t+56>>2]=n.mtime.getTime()/1e3|0,HEAP32[t+60>>2]=0,HEAP32[t+64>>2]=n.ctime.getTime()/1e3|0,HEAP32[t+68>>2]=0,HEAP32[t+72>>2]=n.ino,0},doMsync:function(e,r,t,n){e=new Uint8Array(HEAPU8.subarray(e,e+t));FS.msync(r,e,0,t,n)},doMkdir:function(e,r){return"/"===(e=PATH.normalize(e))[e.length-1]&&(e=e.substr(0,e.length-1)),FS.mkdir(e,r,0),0},doMknod:function(e,r,t){switch(61440&r){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-ERRNO_CODES.EINVAL}return FS.mknod(e,r,t),0},doReadlink:function(e,r,t){if(t<=0)return-ERRNO_CODES.EINVAL;var n=FS.readlink(e),i=Math.min(t,lengthBytesUTF8(n)),e=HEAP8[r+i];return stringToUTF8(n,r,t+1),HEAP8[r+i]=e,i},doAccess:function(e,r){if(-8&r)return-ERRNO_CODES.EINVAL;var t=FS.lookupPath(e,{follow:!0}).node,e="";return 4&r&&(e+="r"),2&r&&(e+="w"),1&r&&(e+="x"),e&&FS.nodePermissions(t,e)?-ERRNO_CODES.EACCES:0},doDup:function(e,r,t){var n=FS.getStream(t);return n&&FS.close(n),FS.open(e,r,0,t,t).fd},doReadv:function(e,r,t,n){for(var i=0,o=0;o>2],u=HEAP32[r+(8*o+4)>>2],a=FS.read(e,HEAP8,a,u,n);if(a<0)return-1;if(i+=a,a>2],u=HEAP32[r+(8*o+4)>>2],u=FS.write(e,HEAP8,a,u,n);if(u<0)return-1;i+=u}return i},varargs:0,get:function(e){return SYSCALLS.varargs+=4,HEAP32[SYSCALLS.varargs-4>>2]},getStr:function(){return Pointer_stringify(SYSCALLS.get())},getStreamFromFD:function(){var e=FS.getStream(SYSCALLS.get());if(!e)throw new FS.ErrnoError(ERRNO_CODES.EBADF);return e},getSocketFromFD:function(){var e=SOCKFS.getSocket(SYSCALLS.get());if(!e)throw new FS.ErrnoError(ERRNO_CODES.EBADF);return e},getSocketAddress:function(e){var r=SYSCALLS.get(),t=SYSCALLS.get();if(e&&0===r)return null;t=__read_sockaddr(r,t);if(t.errno)throw new FS.ErrnoError(t.errno);return t.addr=DNS.lookup_addr(t.addr)||t.addr,t},get64:function(){var e=SYSCALLS.get(),r=SYSCALLS.get();return assert(0<=e?0===r:-1===r),e},getZero:function(){assert(0===SYSCALLS.get())}};function ___syscall5(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStr(),n=SYSCALLS.get(),i=SYSCALLS.get();return FS.open(t,n,i).fd}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function ___lock(){}function ___unlock(){}function ___syscall6(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStreamFromFD();return FS.close(t),0}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}var cttz_i8=allocate([8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0],"i8",ALLOC_STATIC),fs,NODEJS_PATH;function _emscripten_memcpy_big(e,r,t){return HEAPU8.set(HEAPU8.subarray(r,r+t),e),e}function ___syscall140(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStreamFromFD(),n=SYSCALLS.get(),i=SYSCALLS.get(),o=SYSCALLS.get(),a=SYSCALLS.get(),i=i;return assert(0===n),FS.llseek(t,i,a),HEAP32[o>>2]=t.position,t.getdents&&0===i&&0===a&&(t.getdents=null),0}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function ___syscall146(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStreamFromFD(),n=SYSCALLS.get(),i=SYSCALLS.get();return SYSCALLS.doWritev(t,n,i)}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function ___syscall54(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStreamFromFD(),n=SYSCALLS.get();switch(n){case 21505:case 21506:return t.tty?0:-ERRNO_CODES.ENOTTY;case 21519:if(!t.tty)return-ERRNO_CODES.ENOTTY;var i=SYSCALLS.get();return HEAP32[i>>2]=0;case 21520:return t.tty?-ERRNO_CODES.EINVAL:-ERRNO_CODES.ENOTTY;case 21531:i=SYSCALLS.get();return FS.ioctl(t,n,i);default:abort("bad ioctl syscall "+n)}}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function ___syscall221(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStreamFromFD();switch(SYSCALLS.get()){case 0:return(n=SYSCALLS.get())<0?-ERRNO_CODES.EINVAL:FS.open(t.path,t.flags,0,n).fd;case 1:case 2:return 0;case 3:return t.flags;case 4:var n=SYSCALLS.get();return t.flags|=n,0;case 12:case 12:n=SYSCALLS.get();return HEAP16[n+0>>1]=2,0;case 13:case 14:case 13:case 14:return 0;case 16:case 8:return-ERRNO_CODES.EINVAL;case 9:return ___setErrNo(ERRNO_CODES.EINVAL),-1;default:return-ERRNO_CODES.EINVAL}}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function ___syscall145(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStreamFromFD(),n=SYSCALLS.get(),i=SYSCALLS.get();return SYSCALLS.doReadv(t,n,i)}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function nullFunc_iiii(e){Module.printErr("Invalid function pointer called with signature 'iiii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"),Module.printErr("Build with ASSERTIONS=2 for more info."),abort(e)}function nullFunc_vi(e){Module.printErr("Invalid function pointer called with signature 'vi'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"),Module.printErr("Build with ASSERTIONS=2 for more info."),abort(e)}function nullFunc_vii(e){Module.printErr("Invalid function pointer called with signature 'vii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"),Module.printErr("Build with ASSERTIONS=2 for more info."),abort(e)}function nullFunc_ii(e){Module.printErr("Invalid function pointer called with signature 'ii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"),Module.printErr("Build with ASSERTIONS=2 for more info."),abort(e)}function nullFunc_iiiii(e){Module.printErr("Invalid function pointer called with signature 'iiiii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"),Module.printErr("Build with ASSERTIONS=2 for more info."),abort(e)}function nullFunc_iii(e){Module.printErr("Invalid function pointer called with signature 'iii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"),Module.printErr("Build with ASSERTIONS=2 for more info."),abort(e)}function invoke_iiii(e,r,t,n){try{return Module.dynCall_iiii(e,r,t,n)}catch(e){if("number"!=typeof e&&"longjmp"!==e)throw e;asm.setThrew(1,0)}}function invoke_vi(e,r){try{Module.dynCall_vi(e,r)}catch(e){if("number"!=typeof e&&"longjmp"!==e)throw e;asm.setThrew(1,0)}}function invoke_vii(e,r,t){try{Module.dynCall_vii(e,r,t)}catch(e){if("number"!=typeof e&&"longjmp"!==e)throw e;asm.setThrew(1,0)}}function invoke_ii(e,r){try{return Module.dynCall_ii(e,r)}catch(e){if("number"!=typeof e&&"longjmp"!==e)throw e;asm.setThrew(1,0)}}function invoke_iiiii(e,r,t,n,i){try{return Module.dynCall_iiiii(e,r,t,n,i)}catch(e){if("number"!=typeof e&&"longjmp"!==e)throw e;asm.setThrew(1,0)}}function invoke_iii(e,r,t){try{return Module.dynCall_iii(e,r,t)}catch(e){if("number"!=typeof e&&"longjmp"!==e)throw e;asm.setThrew(1,0)}}Module._llvm_cttz_i32=_llvm_cttz_i32,Module.___udivmoddi4=___udivmoddi4,Module.___udivdi3=___udivdi3,Module._sbrk=_sbrk,Module.___uremdi3=___uremdi3,Module._memcpy=_memcpy,Module._pthread_self=_pthread_self,FS.staticInit(),__ATINIT__.unshift(function(){Module.noFSInit||FS.init.initialized||FS.init()}),__ATMAIN__.push(function(){FS.ignorePermissions=!1}),__ATEXIT__.push(function(){FS.quit()}),Module.FS_createFolder=FS.createFolder,Module.FS_createPath=FS.createPath,Module.FS_createDataFile=FS.createDataFile,Module.FS_createPreloadedFile=FS.createPreloadedFile,Module.FS_createLazyFile=FS.createLazyFile,Module.FS_createLink=FS.createLink,Module.FS_createDevice=FS.createDevice,Module.FS_unlink=FS.unlink,__ATINIT__.unshift(function(){TTY.init()}),__ATEXIT__.push(function(){TTY.shutdown()}),ENVIRONMENT_IS_NODE&&(fs=require("fs"),NODEJS_PATH=require("path"),NODEFS.staticInit()),DYNAMICTOP_PTR=allocate(1,"i32",ALLOC_STATIC),STACK_BASE=STACKTOP=Runtime.alignMemory(STATICTOP),STACK_MAX=STACK_BASE+TOTAL_STACK,DYNAMIC_BASE=Runtime.alignMemory(STACK_MAX),HEAP32[DYNAMICTOP_PTR>>2]=DYNAMIC_BASE,staticSealed=!0,assert(DYNAMIC_BASE>2])+(t<<2)>>2];if(St[a>>2]=0,-1==((St[u>>2]=0)|h))return or[3&St[s+4>>2]](s,0|St[i>>2]),St[n>>2]=-1,St[i>>2]=0,(p=St[o>>2]=0)|p;if(0==(0|St[i>>2])||(0|St[n>>2])!=(0|h)){if(E=0|G(d=(b=0|St[e+12>>2])+(40*h|0)|0),_=Ft,S=0|function(e,r,t){e|=0,r|=0,t|=0;var n=0,i=0,o=0,a=0;(0|(pt=(n=pt)+16|0))>=(0|bt)&&yt(16);return o=n+4|0,St[(i=(a=n)+8|0)>>2]=e,St[o>>2]=r,St[a>>2]=t,t=40+(0|St[i>>2])|0,r=(0|St[52+(0|St[i>>2])>>2])+((0|St[(0|St[48+(0|St[i>>2])>>2])+(St[o>>2]<<2)>>2])+(0|St[a>>2])<<3)|0,a=0|Dt(0|St[t>>2],0|St[t+4>>2],0|St[r>>2],0|St[r+4>>2]),pt=n,0|a}(e,h,0),m=Ft,!((0|E)==(0|E)&0==(0|_)))return 0|(p=2);if(St[n>>2]=h,or[3&St[s+4>>2]](s,0|St[i>>2]),(St[i>>2]=0)|(n=0|he(r,S,m)))return 0|(p=n);if(St[o>>2]=E){if(n=0|sr[3&St[s>>2]](s,E),!(St[i>>2]=n))return 0|(p=2);k=n}else k=0|St[i>>2];if(0|(n=0|Re(d,(0|St[e>>2])+(St[(0|St[e+48>>2])+(h<<2)>>2]<<3)|0,r,S,m,k,E,f,l,c)))return 0|(p=n);if(0|St[b+(40*h|0)+28>>2]&&(0|(n=0|Pe(0|St[i>>2],E)))!=(0|St[b+(40*h|0)+32>>2]))return 0|(p=3)}if(b=0|St[e+16>>2],(n=(St[a>>2]=0)|St[(0|St[e+56>>2])+(h<<2)>>2])>>>0>>0){for(h=n,n=0;n=n+(0|St[b+(h<<5)+8>>2])|0,h=h+1|0,(0|h)!=(0|t););St[a>>2]=n}return n=0|St[b+(t<<5)+8>>2],St[u>>2]=n,((u=0|St[a>>2])+n|0)>>>0>(0|St[o>>2])>>>0?0|(p=11):0|Et[b+(t<<5)+27>>0]?0|(p=(0|(o=0|Pe((0|St[i>>2])+u|0,n)))==(0|St[b+(t<<5)+16>>2])?0:3):(p=0)|p}function j(e,r,t,n){e|=0,r|=0,t|=0,n|=0;var i,o,a,u,s,f,l,c,d,E,_=0,S=0,m=pt;(0|bt)<=(0|(pt=pt+48|0))&&yt(48),i=m+36|0,a=m+28|0,u=m+24|0,s=m+20|0,f=m+16|0,l=m+12|0,c=m+8|0,d=m+4|0,St[(o=(E=m)+32|0)>>2]=e,St[a>>2]=r,St[u>>2]=t,St[s>>2]=n,St[f>>2]=0,St[l>>2]=0;e:for(;;){if((0|St[l>>2])==(0|St[s>>2])){_=3;break}if(n=0|St[l>>2],St[l>>2]=n+1,St[d>>2]=re[(0|St[u>>2])+(n<<1)>>1],(0|St[d>>2])>>>0<128)0|St[o>>2]&&(Et[(0|St[o>>2])+(0|St[f>>2])>>0]=St[d>>2]),St[f>>2]=1+(0|St[f>>2]);else{if(55296<=(0|St[d>>2])>>>0&(0|St[d>>2])>>>0<57344){if(56320<=(0|St[d>>2])>>>0){_=23;break}if((0|St[l>>2])==(0|St[s>>2])){_=23;break}if(n=0|St[l>>2],St[l>>2]=n+1,St[E>>2]=re[(0|St[u>>2])+(n<<1)>>1],(0|St[E>>2])>>>0<56320|57344<=(0|St[E>>2])>>>0){_=23;break}St[d>>2]=65536+((0|St[d>>2])-55296<<10|(0|St[E>>2])-56320)}for(St[c>>2]=1;!(5<=(0|St[c>>2])>>>0||(0|St[d>>2])>>>0<1<<6+(5*(0|St[c>>2])|0)>>>0);)St[c>>2]=1+(0|St[c>>2]);for(0|St[o>>2]&&(Et[(0|St[o>>2])+(0|St[f>>2])>>0]=(0|mt[(0|St[c>>2])-1+341>>0])+((0|St[d>>2])>>>(6*(0|St[c>>2])|0))),St[f>>2]=1+(0|St[f>>2]);;)if(St[c>>2]=(0|St[c>>2])-1,0|St[o>>2]&&(Et[(0|St[o>>2])+(0|St[f>>2])>>0]=128+((0|St[d>>2])>>>(6*(0|St[c>>2])|0)&63)),St[f>>2]=1+(0|St[f>>2]),!(0|St[c>>2]))continue e}}return 3==(0|_)?(St[St[a>>2]>>2]=St[f>>2],Et[i>>0]=1,S=0|Et[i>>0],pt=m,0|1&S):23==(0|_)?(St[St[a>>2]>>2]=St[f>>2],S=(Et[i>>0]=0)|Et[i>>0],pt=m,0|1&S):0}function X(e){e|=0;var r,t=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(r=t)>>2]=e,Ce(16+(0|St[r>>2])|0),pt=t}function P(e){e|=0;var r,t=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(r=t)>>2]=e,St[St[r>>2]>>2]=0,St[4+(0|St[r>>2])>>2]=0,St[8+(0|St[r>>2])>>2]=0,St[12+(0|St[r>>2])>>2]=0,St[16+(0|St[r>>2])>>2]=0,St[20+(0|St[r>>2])>>2]=0,St[24+(0|St[r>>2])>>2]=0,St[28+(0|St[r>>2])>>2]=0,St[32+(0|St[r>>2])>>2]=0,St[36+(0|St[r>>2])>>2]=0,pt=t}function N(e,r){e|=0,r|=0;var t,n,i,o=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),n=o+4|0,St[(t=(i=o)+8|0)>>2]=e,St[n>>2]=r;e:do{if(0|St[St[t>>2]>>2])for(St[i>>2]=0;;){if((0|St[i>>2])>>>0>=(0|St[16+(0|St[t>>2])>>2])>>>0)break e;!function(e,r){e|=0,r|=0;var t,n,i=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(t=(n=i)+4|0)>>2]=e,St[n>>2]=r,Le(16+(0|St[t>>2])|0,0|St[n>>2]),X(0|St[t>>2]),pt=i}((0|St[St[t>>2]>>2])+(24*(0|St[i>>2])|0)|0,0|St[n>>2]),St[i>>2]=1+(0|St[i>>2])}}while(0);or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[St[t>>2]>>2]),or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[4+(0|St[t>>2])>>2]),or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[8+(0|St[t>>2])>>2]),or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[12+(0|St[t>>2])>>2]),P(0|St[t>>2]),pt=o}function C(e){e|=0;var r,t,n,i=pt;for((0|bt)<=(0|(pt=pt+16|0))&&yt(16),t=i+4|0,St[(r=(n=i)+8|0)>>2]=e,St[t>>2]=0,St[n>>2]=0;!((0|St[n>>2])>>>0>=(0|St[16+(0|St[r>>2])>>2])>>>0);)St[t>>2]=(0|St[t>>2])+(0|St[(0|St[St[r>>2]>>2])+(24*(0|St[n>>2])|0)+4>>2]),St[n>>2]=1+(0|St[n>>2]);return pt=i,0|St[t>>2]}function G(e){e|=0;var r,t,n,i,o=0,a=0,u=0,s=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),n=(r=s)+8|0,St[(t=s+12|0)>>2]=e,e=0|C(0|St[t>>2]),St[n>>2]=e;do{if(0|St[n>>2]){for(St[n>>2]=(0|St[n>>2])-1;;){if((0|St[n>>2])<0){o=8;break}if(e=(0|function(e,r){e|=0,r|=0;var t,n,i,o,a=0,u=0,s=0,f=pt;for((0|bt)<=(0|(pt=pt+16|0))&&yt(16),t=f+12|0,i=f+4|0,St[(n=(o=f)+8|0)>>2]=e,St[i>>2]=r,St[o>>2]=0;;){if((0|St[o>>2])>>>0>=(0|St[20+(0|St[n>>2])>>2])>>>0){a=6;break}if(u=0|St[o>>2],(0|St[(0|St[4+(0|St[n>>2])>>2])+(St[o>>2]<<3)+4>>2])==(0|St[i>>2])){a=4;break}St[o>>2]=u+1}return 4==(0|a)?(St[t>>2]=u,s=0|St[t>>2],pt=f,0|s):6==(0|a)?(St[t>>2]=-1,s=0|St[t>>2],pt=f,0|s):0}(0|St[t>>2],0|St[n>>2]))<0,a=0|St[n>>2],e){o=6;break}St[n>>2]=a+-1}if(6==(0|o)){e=(0|St[12+(0|St[t>>2])>>2])+(a<<3)|0,u=0|St[e+4>>2],St[(i=r)>>2]=St[e>>2],St[i+4>>2]=u;break}if(8==(0|o)){St[(u=r)>>2]=0,St[u+4>>2]=0;break}}else St[(u=r)>>2]=0,St[u+4>>2]=0}while(0);return Ft=0|St[(o=r)+4>>2],pt=s,0|St[o>>2]}function q(e){e|=0;var r,t=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(r=t)>>2]=e,St[St[r>>2]>>2]=0,St[4+(0|St[r>>2])>>2]=0,St[8+(0|St[r>>2])>>2]=0,St[12+(0|St[r>>2])>>2]=0,St[16+(0|St[r>>2])>>2]=0,St[20+(0|St[r>>2])>>2]=0,St[24+(0|St[r>>2])>>2]=0,St[28+(0|St[r>>2])>>2]=0,pt=t}function Z(e,r){e|=0,r|=0;var t,n,i,o=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),n=o+4|0,St[(t=(i=o)+8|0)>>2]=e,St[n>>2]=r;e:do{if(0|St[12+(0|St[t>>2])>>2])for(St[i>>2]=0;;){if((0|St[i>>2])>>>0>=(0|St[24+(0|St[t>>2])>>2])>>>0)break e;N((0|St[12+(0|St[t>>2])>>2])+(40*(0|St[i>>2])|0)|0,0|St[n>>2]),St[i>>2]=1+(0|St[i>>2])}}while(0);or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[St[t>>2]>>2]),or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[4+(0|St[t>>2])>>2]),or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[8+(0|St[t>>2])>>2]),or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[12+(0|St[t>>2])>>2]),or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[16+(0|St[t>>2])>>2]),q(0|St[t>>2]),pt=o}function J(e){e|=0;var r,t=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(r=t)>>2]=e,q(0|St[r>>2]),St[48+(0|St[r>>2])>>2]=0,St[52+(0|St[r>>2])>>2]=0,St[56+(0|St[r>>2])>>2]=0,St[60+(0|St[r>>2])>>2]=0,Ce(68+((St[64+(0|St[r>>2])>>2]=0)|St[r>>2])|0),pt=t}function $(e,r){e|=0,r|=0;var t,n,i=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(t=(n=i)+4|0)>>2]=e,St[n>>2]=r,or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[48+(0|St[t>>2])>>2]),or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[52+(0|St[t>>2])>>2]),or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[56+(0|St[t>>2])>>2]),or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[60+(0|St[t>>2])>>2]),or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[64+(0|St[t>>2])>>2]),Le(68+(0|St[t>>2])|0,0|St[n>>2]),Z(0|St[t>>2],0|St[n>>2]),J(0|St[t>>2]),pt=i}function ee(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u,s,f=0,l=pt;if((0|bt)<=(0|(pt=pt+32|0))&&yt(32),i=l+16|0,o=l+12|0,a=l+8|0,u=l+4|0,St[(n=(s=l)+20|0)>>2]=e,St[i>>2]=r,St[o>>2]=t,St[a>>2]=(0|St[(0|St[64+(0|St[n>>2])>>2])+(1+(0|St[i>>2])<<2)>>2])-(0|St[(0|St[64+(0|St[n>>2])>>2])+(St[i>>2]<<2)>>2]),!(0|St[o>>2]))return f=0|St[a>>2],pt=l,0|f;for(St[s>>2]=(0|St[68+(0|St[n>>2])>>2])+(St[(0|St[64+(0|St[n>>2])>>2])+(St[i>>2]<<2)>>2]<<1),St[u>>2]=0;!((0|St[u>>2])>>>0>=(0|St[a>>2])>>>0);)_t[(0|St[o>>2])+(St[u>>2]<<1)>>1]=0|mt[(0|St[s>>2])+(St[u>>2]<<1)>>0]|(65535&(0|mt[(0|St[s>>2])+(St[u>>2]<<1)+1>>0]))<<8,St[u>>2]=1+(0|St[u>>2]);return f=0|St[a>>2],pt=l,0|f}function ue(e,r){e|=0,r|=0;var t,n,i=pt;return(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(t=(n=i)+4|0)>>2]=e,St[n>>2]=r,r=0|le(0|St[t>>2],0|St[n>>2]),pt=i,0|r}function se(e,r,t,n,i,o,a,u,s){e|=0,r|=0,t|=0,n|=0,i|=0,o|=0,a|=0,u|=0,s|=0;var f,l,c,d,E,_,S,m,h,p,b,k,F,w,y,v=0,M=0,O=pt;(0|bt)<=(0|(pt=pt+64|0))&&yt(64),f=O+60|0,c=O+52|0,d=O+48|0,E=O+44|0,_=O+40|0,S=O+36|0,m=O+32|0,h=O+28|0,p=O+24|0,k=(b=O)+20|0,F=O+16|0,w=O+12|0,y=O+8|0,St[(l=O+56|0)>>2]=e,St[c>>2]=r,St[d>>2]=t,St[E>>2]=n,St[_>>2]=i,St[S>>2]=o,St[m>>2]=a,St[h>>2]=u,St[p>>2]=s;e:for(;;){if(s=0|ue(0|St[l>>2],b),St[k>>2]=s,0|St[k>>2]){v=3;break}if((0|(s=0|St[b>>2]))!=(0|St[(u=b)>>2])||(((0|s)<0)<<31>>31|0)!=(0|St[u+4>>2])){v=5;break}switch(0|St[b>>2]){case 0:v=7;break e;case 6:if(u=0|function(e,r,t,n,i,o,a){e|=0,r|=0,t|=0,n|=0,i|=0,o|=0,a|=0;var u=0,s=0,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0;(0|(pt=(u=pt)+80|0))>=(0|bt)&&yt(80);if(s=u+68|0,l=u+60|0,c=u+56|0,d=u+52|0,E=u+48|0,_=u+44|0,S=u+40|0,m=u+36|0,h=u+32|0,p=u+28|0,b=u+24|0,k=u+20|0,w=(F=u)+16|0,y=u+12|0,v=u+8|0,St[(f=u+64|0)>>2]=e,St[l>>2]=r,St[c>>2]=t,St[d>>2]=n,St[E>>2]=i,St[_>>2]=o,St[S>>2]=a,a=0|le(0|St[f>>2],0|St[l>>2]),St[h>>2]=a,0|St[h>>2])return St[s>>2]=St[h>>2],M=0|St[s>>2],pt=u,0|M;if(h=0|fe(0|St[f>>2],0|St[c>>2]),St[p>>2]=h,0|St[p>>2])return St[s>>2]=St[p>>2],M=0|St[s>>2],pt=u,0|M;if(p=0|I(0|St[f>>2],9,0),St[b>>2]=p,0|St[b>>2])return St[s>>2]=St[b>>2],M=0|St[s>>2],pt=u,0|M;if(0|St[St[c>>2]>>2]){if(b=0|sr[3&St[St[S>>2]>>2]](0|St[S>>2],St[St[c>>2]>>2]<<3),!(St[St[d>>2]>>2]=b))return St[s>>2]=2,M=0|St[s>>2],pt=u,0|M}else St[St[d>>2]>>2]=0;St[m>>2]=0;for(;!((0|St[m>>2])>>>0>=(0|St[St[c>>2]>>2])>>>0);){if(b=0|le(0|St[f>>2],(0|St[St[d>>2]>>2])+(St[m>>2]<<3)|0),St[k>>2]=b,0|St[k>>2]){O=14;break}St[m>>2]=1+(0|St[m>>2])}if(14==(0|O))return St[s>>2]=St[k>>2],M=0|St[s>>2],pt=u,0|M;for(;;){if(k=0|ue(0|St[f>>2],F),St[w>>2]=k,0|St[w>>2]){O=17;break}if(0==(0|St[(k=F)>>2])&0==(0|St[k+4>>2])){O=24;break}if(k=F,d=0|St[f>>2],10==(0|St[k>>2])&0==(0|St[k+4>>2])){if(k=0|ne(d,0|St[St[c>>2]>>2],0|St[E>>2],0|St[_>>2],0|St[S>>2]),St[y>>2]=k,0|St[y>>2]){O=21;break}}else if(k=0|me(d),St[v>>2]=k,0|St[v>>2]){O=23;break}}{if(17==(0|O))return St[s>>2]=St[w>>2],M=0|St[s>>2],pt=u,0|M;if(21==(0|O))return St[s>>2]=St[y>>2],M=0|St[s>>2],pt=u,0|M;if(23==(0|O))return St[s>>2]=St[v>>2],M=0|St[s>>2],pt=u,0|M;if(24==(0|O)){r:do{if(!(0|St[St[E>>2]>>2])){if(0|St[St[c>>2]>>2]){if(O=0|sr[3&St[St[S>>2]>>2]](0|St[S>>2],0|St[St[c>>2]>>2]),!(St[St[E>>2]>>2]=O))return St[s>>2]=2,M=0|St[s>>2],pt=u,0|M}else St[St[E>>2]>>2]=0;if(0|St[St[c>>2]>>2]){if(O=0|sr[3&St[St[S>>2]>>2]](0|St[S>>2],St[St[c>>2]>>2]<<2),!(St[St[_>>2]>>2]=O))return St[s>>2]=2,M=0|St[s>>2],pt=u,0|M}else St[St[_>>2]>>2]=0;for(St[m>>2]=0;;){if((0|St[m>>2])>>>0>=(0|St[St[c>>2]>>2])>>>0)break r;Et[(0|St[St[E>>2]>>2])+(0|St[m>>2])>>0]=0,St[(0|St[St[_>>2]>>2])+(St[m>>2]<<2)>>2]=0,St[m>>2]=1+(0|St[m>>2])}}}while(0);return St[s>>2]=0,M=0|St[s>>2],pt=u,0|M}}return 0}(0|St[l>>2],0|St[c>>2],20+(0|St[d>>2])|0,0|St[d>>2],4+(0|St[d>>2])|0,8+(0|St[d>>2])|0,0|St[h>>2]),St[F>>2]=u,0|St[F>>2]){v=9;break e}continue e;case 7:if(u=0|function(e,r,t,n,i){e|=0,r|=0,t|=0,n|=0,i|=0;var o=0,a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0,R=0,g=0,T=0,N=0,D=0;(0|(pt=(o=pt)+112|0))>=(0|bt)&&yt(112);if(a=o+96|0,s=o+88|0,f=o+84|0,l=o+80|0,c=o+76|0,d=o+72|0,E=o+68|0,_=o+64|0,S=o+60|0,m=o+56|0,h=o+52|0,p=o+48|0,b=o+44|0,k=o+40|0,F=o+36|0,y=(w=o)+32|0,v=o+28|0,M=o+24|0,O=o+20|0,A=o+16|0,R=o+12|0,g=o+8|0,St[(u=o+92|0)>>2]=e,St[s>>2]=r,St[f>>2]=t,St[l>>2]=n,St[c>>2]=i,i=0|I(0|St[u>>2],11,0),St[E>>2]=i,0|St[E>>2])return St[a>>2]=St[E>>2],T=0|St[a>>2],pt=o,0|T;if(E=0|fe(0|St[u>>2],0|St[s>>2]),St[_>>2]=E,0|St[_>>2])return St[a>>2]=St[_>>2],T=0|St[a>>2],pt=o,0|T;if(_=0|de(0|St[u>>2]),St[S>>2]=_,0|St[S>>2])return St[a>>2]=St[S>>2],T=0|St[a>>2],pt=o,0|T;if(0|St[St[s>>2]>>2]){if(S=0|sr[3&St[St[l>>2]>>2]](0|St[l>>2],40*(0|St[St[s>>2]>>2])|0),!(St[St[f>>2]>>2]=S))return St[a>>2]=2,T=0|St[a>>2],pt=o,0|T}else St[St[f>>2]>>2]=0;St[d>>2]=0;for(;!((0|St[d>>2])>>>0>=(0|St[St[s>>2]>>2])>>>0);)P((0|St[St[f>>2]>>2])+(40*(0|St[d>>2])|0)|0),St[d>>2]=1+(0|St[d>>2]);St[d>>2]=0;for(;N=0|St[u>>2],!((0|St[d>>2])>>>0>=(0|St[St[s>>2]>>2])>>>0);){if(S=0|function(e,r,t){e|=0,r|=0,t|=0;var n=0,i=0,o=0,a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0,R=0,g=0,T=0,N=0,D=0,P=0,C=0,I=0,L=0,x=0,B=0,H=0,U=0,z=0;(0|(pt=(n=pt)+160|0))>=(0|bt)&&yt(160);if(i=n+136|0,a=n+128|0,u=n+124|0,s=n+120|0,f=n+116|0,l=n+112|0,c=n+108|0,d=n+104|0,E=n+100|0,_=n+96|0,S=n+155|0,m=n+92|0,h=n+88|0,p=n+84|0,b=n+140|0,k=n+80|0,F=n+76|0,w=n+72|0,y=n+68|0,v=n+8|0,M=n+64|0,O=n+60|0,A=n+56|0,R=n+52|0,g=n+48|0,T=n+44|0,N=n+40|0,P=(D=n)+36|0,C=n+32|0,I=n+28|0,L=n+24|0,x=n+20|0,B=n+16|0,St[(o=n+132|0)>>2]=e,St[a>>2]=r,St[u>>2]=t,St[d>>2]=0,St[E>>2]=0,t=0|fe(0|St[o>>2],s),St[_>>2]=t,0|St[_>>2])return St[i>>2]=St[_>>2],H=0|St[i>>2],pt=n,0|H;if(32<(0|St[s>>2])>>>0)return St[i>>2]=4,H=0|St[i>>2],pt=n,0|H;if(St[16+(0|St[a>>2])>>2]=St[s>>2],0|St[s>>2]){if(_=0|sr[3&St[St[u>>2]>>2]](0|St[u>>2],24*(0|St[s>>2])|0),!(St[St[a>>2]>>2]=_))return St[i>>2]=2,H=0|St[i>>2],pt=n,0|H}else St[St[a>>2]>>2]=0;St[c>>2]=0;for(;!((0|St[c>>2])>>>0>=(0|St[s>>2])>>>0);)X((0|St[St[a>>2]>>2])+(24*(0|St[c>>2])|0)|0),St[c>>2]=1+(0|St[c>>2]);St[c>>2]=0;r:for(;;){if((0|St[c>>2])>>>0>=(0|St[s>>2])>>>0){U=55;break}if(St[m>>2]=(0|St[St[a>>2]>>2])+(24*(0|St[c>>2])|0),_=0|te(0|St[o>>2],S),St[k>>2]=_,0|St[k>>2]){U=15;break}if(St[h>>2]=15&(0|mt[S>>0]),_=0|ie(0|St[o>>2],b,0|St[h>>2]),St[F>>2]=_,0|St[F>>2]){U=17;break}if(8<(0|St[h>>2])>>>0){U=19;break}for(_=8+(0|St[m>>2])|0,St[_>>2]=0,St[_+4>>2]=0,St[p>>2]=0;!((0|St[p>>2])>>>0>=(0|St[h>>2])>>>0);)_=0|It(0|mt[b+((0|St[h>>2])-1-(0|St[p>>2]))>>0],0,St[p>>2]<<3|0),t=8+(0|St[m>>2])|0,e=St[(r=t)+4>>2]|Ft,St[(z=t)>>2]=St[r>>2]|_,St[z+4>>2]=e,St[p>>2]=1+(0|St[p>>2]);if(16&(0|mt[S>>0])|0){if(e=0|fe(0|St[o>>2],0|St[m>>2]),St[w>>2]=e,0|St[w>>2]){U=25;break}if(e=0|fe(0|St[o>>2],4+(0|St[m>>2])|0),St[y>>2]=e,0|St[y>>2]){U=27;break}if(32<(0|St[St[m>>2]>>2])>>>0){U=30;break}if(32<(0|St[4+(0|St[m>>2])>>2])>>>0){U=30;break}}else St[St[m>>2]>>2]=1,St[4+(0|St[m>>2])>>2]=1;if(32&(0|mt[S>>0])|0){if(St[(e=v)>>2]=0,St[e+4>>2]=0,e=0|le(0|St[o>>2],v),St[M>>2]=e,0|St[M>>2]){U=34;break}if(!(0|Ie(16+(0|St[m>>2])|0,0|St[v>>2],0|St[u>>2]))){U=36;break}if(e=0|ie(0|St[o>>2],0|St[16+(0|St[m>>2])>>2],0|St[v>>2]),St[O>>2]=e,0|St[O>>2]){U=38;break}}for(;128&(0|mt[S>>0]);){if(e=0|te(0|St[o>>2],S),St[A>>2]=e,0|St[A>>2]){U=41;break r}if(e=15&(0|mt[S>>0]),z=0|ce(0|St[o>>2],e,((0|e)<0)<<31>>31),St[R>>2]=z,0|St[R>>2]){U=43;break r}if(16&(0|mt[S>>0])|0){if(z=0|fe(0|St[o>>2],g),St[T>>2]=z,0|St[T>>2]){U=46;break r}if(z=0|fe(0|St[o>>2],g),St[N>>2]=z,0|St[N>>2]){U=48;break r}}if(32&(0|mt[S>>0])){if(St[(z=D)>>2]=0,St[z+4>>2]=0,z=0|le(0|St[o>>2],D),St[P>>2]=z,0|St[P>>2]){U=51;break r}if(z=D,e=0|ce(0|St[o>>2],0|St[z>>2],0|St[z+4>>2]),St[C>>2]=e,0|St[C>>2]){U=53;break r}}}St[d>>2]=(0|St[d>>2])+(0|St[St[m>>2]>>2]),St[E>>2]=(0|St[E>>2])+(0|St[4+(0|St[m>>2])>>2]),St[c>>2]=1+(0|St[c>>2])}switch(0|U){case 15:return St[i>>2]=St[k>>2],H=0|St[i>>2],pt=n,0|H;case 17:return St[i>>2]=St[F>>2],H=0|St[i>>2],pt=n,0|H;case 19:return St[i>>2]=4,H=0|St[i>>2],pt=n,0|H;case 25:return St[i>>2]=St[w>>2],H=0|St[i>>2],pt=n,0|H;case 27:return St[i>>2]=St[y>>2],H=0|St[i>>2],pt=n,0|H;case 30:return St[i>>2]=4,H=0|St[i>>2],pt=n,0|H;case 34:return St[i>>2]=St[M>>2],H=0|St[i>>2],pt=n,0|H;case 36:return St[i>>2]=2,H=0|St[i>>2],pt=n,0|H;case 38:return St[i>>2]=St[O>>2],H=0|St[i>>2],pt=n,0|H;case 41:return St[i>>2]=St[A>>2],H=0|St[i>>2],pt=n,0|H;case 43:return St[i>>2]=St[R>>2],H=0|St[i>>2],pt=n,0|H;case 46:return St[i>>2]=St[T>>2],H=0|St[i>>2],pt=n,0|H;case 48:return St[i>>2]=St[N>>2],H=0|St[i>>2],pt=n,0|H;case 51:return St[i>>2]=St[P>>2],H=0|St[i>>2],pt=n,0|H;case 53:return St[i>>2]=St[C>>2],H=0|St[i>>2],pt=n,0|H;case 55:if(!(0|St[E>>2]))return St[i>>2]=4,H=0|St[i>>2],pt=n,0|H;if(C=(0|St[E>>2])-1|0,St[f>>2]=C,St[20+(0|St[a>>2])>>2]=C,0|St[f>>2]){if(C=0|sr[3&St[St[u>>2]>>2]](0|St[u>>2],St[f>>2]<<3),!(St[4+(0|St[a>>2])>>2]=C))return St[i>>2]=2,H=0|St[i>>2],pt=n,0|H}else St[4+(0|St[a>>2])>>2]=0;for(St[c>>2]=0;;){if((0|St[c>>2])>>>0>=(0|St[f>>2])>>>0){U=68;break}if(St[I>>2]=(0|St[4+(0|St[a>>2])>>2])+(St[c>>2]<<3),C=0|fe(0|St[o>>2],0|St[I>>2]),St[L>>2]=C,0|St[L>>2]){U=64;break}if(C=0|fe(0|St[o>>2],4+(0|St[I>>2])|0),St[x>>2]=C,0|St[x>>2]){U=66;break}St[c>>2]=1+(0|St[c>>2])}if(64==(0|U))return St[i>>2]=St[L>>2],H=0|St[i>>2],pt=n,0|H;if(66==(0|U))return St[i>>2]=St[x>>2],H=0|St[i>>2],pt=n,0|H;if(68!=(0|U))break;if((0|St[d>>2])>>>0<(0|St[f>>2])>>>0)return St[i>>2]=4,H=0|St[i>>2],pt=n,0|H;if(U=(0|St[d>>2])-(0|St[f>>2])|0,St[l>>2]=U,St[24+(0|St[a>>2])>>2]=U,0|St[l>>2]){if(U=0|sr[3&St[St[u>>2]>>2]](0|St[u>>2],St[l>>2]<<2),!(St[8+(0|St[a>>2])>>2]=U))return St[i>>2]=2,H=0|St[i>>2],pt=n,0|H}else St[8+(0|St[a>>2])>>2]=0;U=1==(0|St[l>>2]),St[c>>2]=0;r:do{if(U){for(;!((0|St[c>>2])>>>0>=(0|St[d>>2])>>>0||(0|function(e,r){e|=0,r|=0;var t,n,i,o,a=0,u=0,s=0,f=pt;for((0|bt)<=(0|(pt=pt+16|0))&&yt(16),t=f+12|0,i=f+4|0,St[(n=(o=f)+8|0)>>2]=e,St[i>>2]=r,St[o>>2]=0;;){if((0|St[o>>2])>>>0>=(0|St[20+(0|St[n>>2])>>2])>>>0){a=6;break}if(u=0|St[o>>2],(0|St[(0|St[4+(0|St[n>>2])>>2])+(St[o>>2]<<3)>>2])==(0|St[i>>2])){a=4;break}St[o>>2]=u+1}return 4==(0|a)?(St[t>>2]=u,s=0|St[t>>2],pt=f,0|s):6==(0|a)?(St[t>>2]=-1,s=0|St[t>>2],pt=f,0|s):0}(0|St[a>>2],0|St[c>>2]))<0);)St[c>>2]=1+(0|St[c>>2]);if((0|St[c>>2])==(0|St[d>>2]))return St[i>>2]=4,H=0|St[i>>2],pt=n,0|H;St[St[8+(0|St[a>>2])>>2]>>2]=St[c>>2];break}for(;;){if((0|St[c>>2])>>>0>=(0|St[l>>2])>>>0)break r;if(u=0|fe(0|St[o>>2],(0|St[8+(0|St[a>>2])>>2])+(St[c>>2]<<2)|0),St[B>>2]=u,0|St[B>>2])break;St[c>>2]=1+(0|St[c>>2])}return St[i>>2]=St[B>>2],H=0|St[i>>2],pt=n,0|H}while(0);return St[i>>2]=0,H=0|St[i>>2],pt=n,0|H}return 0}(N,(0|St[St[f>>2]>>2])+(40*(0|St[d>>2])|0)|0,0|St[l>>2]),St[m>>2]=S,0|St[m>>2]){D=17;break}St[d>>2]=1+(0|St[d>>2])}if(17==(0|D))return St[a>>2]=St[m>>2],T=0|St[a>>2],pt=o,0|T;if(m=0|I(N,12,0),St[h>>2]=m,0|St[h>>2])return St[a>>2]=St[h>>2],T=0|St[a>>2],pt=o,0|T;St[d>>2]=0;r:for(;;){if((0|St[d>>2])>>>0>=(0|St[St[s>>2]>>2])>>>0){D=33;break}if(St[b>>2]=(0|St[St[f>>2]>>2])+(40*(0|St[d>>2])|0),h=0|C(0|St[b>>2]),St[k>>2]=h,0|St[k>>2]){if(h=0|sr[3&St[St[l>>2]>>2]](0|St[l>>2],St[k>>2]<<3),!(St[12+(0|St[b>>2])>>2]=h)){D=26;break}}else St[12+(0|St[b>>2])>>2]=0;for(St[p>>2]=0;!((0|St[p>>2])>>>0>=(0|St[k>>2])>>>0);){if(h=0|le(0|St[u>>2],(0|St[12+(0|St[b>>2])>>2])+(St[p>>2]<<3)|0),St[F>>2]=h,0|St[F>>2]){D=30;break r}St[p>>2]=1+(0|St[p>>2])}St[d>>2]=1+(0|St[d>>2])}{if(26==(0|D))return St[a>>2]=2,T=0|St[a>>2],pt=o,0|T;if(30==(0|D))return St[a>>2]=St[F>>2],T=0|St[a>>2],pt=o,0|T;if(33==(0|D)){for(;;){if(F=(D=0)|ue(0|St[u>>2],w),St[y>>2]=F,0|St[y>>2]){D=34;break}if(0==(0|St[(F=w)>>2])&0==(0|St[F+4>>2])){D=36;break}if(10==(0|St[(F=w)>>2])&0==(0|St[F+4>>2])){St[M>>2]=0,St[O>>2]=0,F=0|ne(0|St[u>>2],0|St[St[s>>2]>>2],M,O,0|St[c>>2]),St[v>>2]=F;r:do{if(!(0|St[v>>2]))for(St[d>>2]=0;;){if((0|St[d>>2])>>>0>=(0|St[St[s>>2]>>2])>>>0)break r;St[A>>2]=(0|St[St[f>>2]>>2])+(40*(0|St[d>>2])|0),St[28+(0|St[A>>2])>>2]=mt[(0|St[M>>2])+(0|St[d>>2])>>0],St[32+(0|St[A>>2])>>2]=St[(0|St[O>>2])+(St[d>>2]<<2)>>2],St[d>>2]=1+(0|St[d>>2])}}while(0);if(or[3&St[4+(0|St[c>>2])>>2]](0|St[c>>2],0|St[O>>2]),or[3&St[4+(0|St[c>>2])>>2]](0|St[c>>2],0|St[M>>2]),St[R>>2]=St[v>>2],0|St[R>>2]){D=43;break}D=33}else{if(F=0|me(0|St[u>>2]),St[g>>2]=F,0|St[g>>2]){D=45;break}D=33}}if(34==(0|D))return St[a>>2]=St[y>>2],T=0|St[a>>2],pt=o,0|T;if(36==(0|D))return St[a>>2]=0,T=0|St[a>>2],pt=o,0|T;if(43==(0|D))return St[a>>2]=St[R>>2],T=0|St[a>>2],pt=o,0|T;if(45==(0|D))return St[a>>2]=St[g>>2],T=0|St[a>>2],pt=o,0|T}}return 0}(0|St[l>>2],24+(0|St[d>>2])|0,12+(0|St[d>>2])|0,0|St[h>>2],0|St[p>>2]),St[w>>2]=u,0|St[w>>2]){v=11;break e}continue e;case 8:if(u=0|function(e,r,t,n,i,o,a,u){e|=0,r|=0,t|=0,n|=0,i|=0,o|=0,a|=0,u|=0;var s=0,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0,R=0,g=0,T=0,N=0,D=0,P=0,C=0,I=0,L=0,x=0,B=0,H=0,U=0,z=0,Y=0,V=0,K=0;(0|(pt=(s=pt)+160|0))>=(0|bt)&&yt(160);f=s+144|0,c=s+136|0,d=s+132|0,E=s+128|0,_=s+124|0,S=s+120|0,m=s+116|0,h=s+112|0,p=s+16|0,b=s+108|0,k=s+104|0,F=s+100|0,w=s+96|0,y=s+92|0,v=s+88|0,M=s+84|0,O=s+8|0,A=s+80|0,R=s+76|0,T=(g=s)+72|0,N=s+68|0,D=s+64|0,P=s+60|0,C=s+56|0,I=s+52|0,L=s+48|0,x=s+44|0,B=s+40|0,H=s+36|0,U=s+32|0,z=s+28|0,Y=s+24|0,St[(l=s+140|0)>>2]=e,St[c>>2]=r,St[d>>2]=t,St[E>>2]=n,St[_>>2]=i,St[S>>2]=o,St[m>>2]=a,St[h>>2]=u,St[(u=p)>>2]=0,St[u+4>>2]=0,St[k>>2]=0,St[F>>2]=0,St[b>>2]=0;for(;!((0|St[b>>2])>>>0>=(0|St[c>>2])>>>0);)St[(0|St[d>>2])+(40*(0|St[b>>2])|0)+36>>2]=1,St[b>>2]=1+(0|St[b>>2]);St[St[E>>2]>>2]=St[c>>2];r:for(;;){if(u=0|ue(0|St[l>>2],p),St[w>>2]=u,0|St[w>>2]){V=6;break}if(13==(0|St[(u=p)>>2])&0==(0|St[u+4>>2]))for(St[St[E>>2]>>2]=0,St[b>>2]=0;;){if((0|St[b>>2])>>>0>=(0|St[c>>2])>>>0)continue r;if(o=0|fe(0|St[l>>2],y),St[v>>2]=o,0|St[v>>2]){V=11;break r}St[(0|St[d>>2])+(40*(0|St[b>>2])|0)+36>>2]=St[y>>2],o=0|St[E>>2],St[o>>2]=(0|St[o>>2])+(0|St[y>>2]),St[b>>2]=1+(0|St[b>>2])}else{if(o=a=u=p,10==(0|St[u>>2])&0==(0|St[u+4>>2])|9==(0|St[a>>2])&0==(0|St[a+4>>2])|0==(0|St[o>>2])&0==(0|St[o+4>>2])){V=16;break}if(o=0|me(0|St[l>>2]),St[M>>2]=o,0|St[M>>2]){V=15;break}}}{if(6==(0|V))return St[f>>2]=St[w>>2],K=0|St[f>>2],pt=s,0|K;if(11==(0|V))return St[f>>2]=St[v>>2],K=0|St[f>>2],pt=s,0|K;if(15==(0|V))return St[f>>2]=St[M>>2],K=0|St[f>>2],pt=s,0|K;if(16==(0|V)){if(0|St[St[E>>2]>>2]){if(M=0|sr[3&St[St[h>>2]>>2]](0|St[h>>2],St[St[E>>2]>>2]<<3),St[St[_>>2]>>2]=M,!(0|St[St[_>>2]>>2]))return St[f>>2]=2,K=0|St[f>>2],pt=s,0|K;if(M=0|sr[3&St[St[h>>2]>>2]](0|St[h>>2],0|St[St[E>>2]>>2]),St[St[S>>2]>>2]=M,!(0|St[St[S>>2]>>2]))return St[f>>2]=2,K=0|St[f>>2],pt=s,0|K;if(M=0|sr[3&St[St[h>>2]>>2]](0|St[h>>2],St[St[E>>2]>>2]<<2),St[St[m>>2]>>2]=M,!(0|St[St[m>>2]>>2]))return St[f>>2]=2,K=0|St[f>>2],pt=s,0|K}else St[St[_>>2]>>2]=0,St[St[S>>2]>>2]=0,St[St[m>>2]>>2]=0;St[b>>2]=0;r:for(;!((0|St[b>>2])>>>0>=(0|St[c>>2])>>>0);){if(St[(M=O)>>2]=0,St[M+4>>2]=0,St[R>>2]=St[(0|St[d>>2])+(40*(0|St[b>>2])|0)+36>>2],0|St[R>>2]){M=p;t:do{if(9==(0|St[M>>2])&0==(0|St[M+4>>2]))for(St[A>>2]=1;;){if((0|St[A>>2])>>>0>=(0|St[R>>2])>>>0)break t;if(v=0|le(0|St[l>>2],g),St[T>>2]=v,0|St[T>>2]){V=31;break r}w=0|St[(v=g)>>2],y=0|St[v+4>>2],v=0|St[k>>2],St[k>>2]=v+1,o=(0|St[St[_>>2]>>2])+(v<<3)|0,St[o>>2]=w,St[o+4>>2]=y,y=g,w=0|Dt(0|St[(o=O)>>2],0|St[o+4>>2],0|St[y>>2],0|St[y+4>>2]),St[(y=O)>>2]=w,St[y+4>>2]=Ft,St[A>>2]=1+(0|St[A>>2])}}while(0);M=0|G((0|St[d>>2])+(40*(0|St[b>>2])|0)|0),w=0|Nt(0|M,0|Ft,0|St[(y=O)>>2],0|St[y+4>>2]),y=0|St[k>>2],St[k>>2]=y+1,M=(0|St[St[_>>2]>>2])+(y<<3)|0,St[M>>2]=w,St[M+4>>2]=Ft}St[b>>2]=1+(0|St[b>>2])}if(31==(0|V))return St[f>>2]=St[T>>2],K=0|St[f>>2],pt=s,0|K;if(9==(0|St[(T=p)>>2])&0==(0|St[T+4>>2])&&(T=0|ue(0|St[l>>2],p),St[N>>2]=T,0|St[N>>2]))return St[f>>2]=St[N>>2],K=0|St[f>>2],pt=s,0|K;for(St[b>>2]=0;!((0|St[b>>2])>>>0>=(0|St[St[E>>2]>>2])>>>0);)Et[(0|St[St[S>>2]>>2])+(0|St[b>>2])>>0]=0,St[(0|St[St[m>>2]>>2])+(St[b>>2]<<2)>>2]=0,St[b>>2]=1+(0|St[b>>2]);for(St[b>>2]=0;!((0|St[b>>2])>>>0>=(0|St[c>>2])>>>0);)St[D>>2]=St[(0|St[d>>2])+(40*(0|St[b>>2])|0)+36>>2],1==(0|St[D>>2])&&0!=(0|St[(0|St[d>>2])+(40*(0|St[b>>2])|0)+28>>2])||(St[F>>2]=(0|St[F>>2])+(0|St[D>>2])),St[b>>2]=1+(0|St[b>>2]);for(St[k>>2]=0;;){if(10==(0|St[(D=p)>>2])&0==(0|St[D+4>>2])){St[P>>2]=0,St[C>>2]=0,St[I>>2]=0,D=0|ne(0|St[l>>2],0|St[F>>2],C,I,0|St[h>>2]),St[L>>2]=D;r:do{if(!(0|St[L>>2]))for(St[b>>2]=0;;){if((0|St[b>>2])>>>0>=(0|St[c>>2])>>>0)break r;St[x>>2]=(0|St[d>>2])+(40*(0|St[b>>2])|0),St[B>>2]=St[36+(0|St[x>>2])>>2],1==(0|St[B>>2])&&0|St[28+(0|St[x>>2])>>2]?(Et[(0|St[St[S>>2]>>2])+(0|St[k>>2])>>0]=1,St[(0|St[St[m>>2]>>2])+(St[k>>2]<<2)>>2]=St[32+(0|St[x>>2])>>2],St[k>>2]=1+(0|St[k>>2])):V=55;t:do{if(55==(0|V))for(V=0,St[H>>2]=0;;){if((0|St[H>>2])>>>0>=(0|St[B>>2])>>>0)break t;Et[(0|St[St[S>>2]>>2])+(0|St[k>>2])>>0]=0|Et[(0|St[C>>2])+(0|St[P>>2])>>0],St[(0|St[St[m>>2]>>2])+(St[k>>2]<<2)>>2]=St[(0|St[I>>2])+(St[P>>2]<<2)>>2],St[k>>2]=1+(0|St[k>>2]),St[H>>2]=1+(0|St[H>>2]),St[P>>2]=1+(0|St[P>>2])}}while(0);St[b>>2]=1+(0|St[b>>2])}}while(0);if(or[3&St[4+(0|St[h>>2])>>2]](0|St[h>>2],0|St[C>>2]),or[3&St[4+(0|St[h>>2])>>2]](0|St[h>>2],0|St[I>>2]),St[U>>2]=St[L>>2],0|St[U>>2]){V=60;break}}else{if(0==(0|St[(D=p)>>2])&0==(0|St[D+4>>2])){V=62;break}if(D=0|me(0|St[l>>2]),St[z>>2]=D,0|St[z>>2]){V=64;break}}if(D=0|ue(0|St[l>>2],p),St[Y>>2]=D,0|St[Y>>2]){V=66;break}}if(60==(0|V))return St[f>>2]=St[U>>2],K=0|St[f>>2],pt=s,0|K;if(62==(0|V))return St[f>>2]=0,K=0|St[f>>2],pt=s,0|K;if(64==(0|V))return St[f>>2]=St[z>>2],K=0|St[f>>2],pt=s,0|K;if(66==(0|V))return St[f>>2]=St[Y>>2],K=0|St[f>>2],pt=s,0|K}}return 0}(0|St[l>>2],0|St[24+(0|St[d>>2])>>2],0|St[12+(0|St[d>>2])>>2],0|St[E>>2],0|St[_>>2],0|St[S>>2],0|St[m>>2],0|St[p>>2]),St[y>>2]=u,0|St[y>>2]){v=13;break e}continue e;default:v=14;break e}}return 3==(0|v)?(St[f>>2]=St[k>>2],M=0|St[f>>2],pt=O,0|M):5==(0|v)?(St[f>>2]=4,M=0|St[f>>2],pt=O,0|M):7==(0|v)?(M=(St[f>>2]=0)|St[f>>2],pt=O,0|M):9==(0|v)?(St[f>>2]=St[F>>2],M=0|St[f>>2],pt=O,0|M):11==(0|v)?(St[f>>2]=St[w>>2],M=0|St[f>>2],pt=O,0|M):13==(0|v)?(St[f>>2]=St[y>>2],M=0|St[f>>2],pt=O,0|M):14==(0|v)?(St[f>>2]=4,M=0|St[f>>2],pt=O,0|M):0}function fe(e,r){e|=0,r|=0;var t,n,i,o,a=0,u=0,s=pt;return(0|bt)<=(0|(pt=pt+32|0))&&yt(32),t=s+20|0,i=s+12|0,a=(o=s)+8|0,St[(n=s+16|0)>>2]=e,St[i>>2]=r,r=0|le(0|St[n>>2],o),St[a>>2]=r,pt=(u=0|St[a>>2]?(St[t>>2]=St[a>>2],0|St[t>>2]):0<(r=0|St[(a=o)+4>>2])>>>0|0==(0|r)&2147483648<=(0|St[a>>2])>>>0?(St[t>>2]=4,0|St[t>>2]):0<(r=0|St[(a=o)+4>>2])>>>0|0==(0|r)&67108864<=(0|St[a>>2])>>>0?(St[t>>2]=4,0|St[t>>2]):(St[St[i>>2]>>2]=St[o>>2],(St[t>>2]=0)|St[t>>2]),s),0|u}function le(e,r){e|=0,r|=0;var t,n,i,o,a,u,s,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=pt;if((0|bt)<=(0|(pt=pt+48|0))&&yt(48),t=m+28|0,f=m+20|0,i=m+34|0,l=m+33|0,c=m+16|0,d=m+12|0,E=m+32|0,a=(o=m)+8|0,St[(n=m+24|0)>>2]=e,St[f>>2]=r,Et[l>>0]=-128,r=0|te(0|St[n>>2],i),St[d>>2]=r,0|St[d>>2])return St[t>>2]=St[d>>2],_=0|St[t>>2],pt=m,0|_;for(d=0|St[f>>2],St[d>>2]=0,St[d+4>>2]=0,St[c>>2]=0;;){if(8<=(0|St[c>>2])){S=10;break}if(!((0|mt[i>>0])&(0|mt[l>>0]))){S=6;break}if(d=0|te(0|St[n>>2],E),St[a>>2]=d,0|St[a>>2]){S=8;break}d=0|It(0|mt[E>>0],0,St[c>>2]<<3|0),r=0|St[f>>2],u=St[(e=r)+4>>2]|Ft,St[(s=r)>>2]=St[e>>2]|d,St[s+4>>2]=u,Et[l>>0]=(0|mt[l>>0])>>1,St[c>>2]=1+(0|St[c>>2])}return 6==(0|S)?(E=(0|mt[i>>0])&(0|mt[l>>0])-1,St[(l=o)>>2]=E,St[l+4>>2]=((0|E)<0)<<31>>31,o=0|It(0|St[(E=o)>>2],0|St[E+4>>2],St[c>>2]<<3|0),c=0|St[f>>2],E=0|Dt(0|St[(f=c)>>2],0|St[f+4>>2],0|o,0|Ft),St[(o=c)>>2]=E,St[o+4>>2]=Ft,_=(St[t>>2]=0)|St[t>>2],pt=m,0|_):8==(0|S)?(St[t>>2]=St[a>>2],_=0|St[t>>2],pt=m,0|_):10==(0|S)?(_=(St[t>>2]=0)|St[t>>2],pt=m,0|_):0}function ce(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a=0,u=pt;return(0|bt)<=(0|(pt=pt+16|0))&&yt(16),n=u+12|0,St[(i=(o=u)+8|0)>>2]=e,St[(e=o)>>2]=r,St[e+4>>2]=t,e=0|St[(t=o)+4>>2],pt=(a=0>>0|(0==(0|e)?(0|St[t>>2])>>>0>(0|St[4+(0|St[i>>2])>>2])>>>0:0)?(St[n>>2]=16,0|St[n>>2]):(t=4+(0|St[i>>2])|0,St[t>>2]=(0|St[t>>2])-(0|St[o>>2]),t=0|St[i>>2],St[t>>2]=(0|St[t>>2])+(0|St[o>>2]),(St[n>>2]=0)|St[n>>2]),u),0|a}function de(e){e|=0;var r,t,n,i,o=0,a=pt;return(0|bt)<=(0|(pt=pt+16|0))&&yt(16),r=a+8|0,n=a+12|0,St[(t=(i=a)+4|0)>>2]=e,e=0|te(0|St[t>>2],n),St[i>>2]=e,pt=(o=(0|St[i>>2]?St[r>>2]=St[i>>2]:St[r>>2]=0==(0|mt[n>>0])?0:4,0|St[r>>2]),a),0|o}function Ee(e,r,t,n){e|=0,r|=0,t|=0,n|=0;var i,o,a,u,s,f,l,c,d,E=0,_=0,S=pt;if((0|bt)<=(0|(pt=pt+32|0))&&yt(32),i=S+24|0,a=S+16|0,u=S+12|0,s=S+8|0,f=S+29|0,l=S+28|0,c=S+4|0,St[(o=(d=S)+20|0)>>2]=e,St[a>>2]=r,St[u>>2]=t,St[s>>2]=n,Et[f>>0]=0,(Et[l>>0]=0)|St[a>>2]){if(n=0|sr[3&St[St[s>>2]>>2]](0|St[s>>2],0|St[a>>2]),!(St[St[u>>2]>>2]=n))return St[i>>2]=2,E=0|St[i>>2],pt=S,0|E}else St[St[u>>2]>>2]=0;for(St[c>>2]=0;;){if((0|St[c>>2])>>>0>=(0|St[a>>2])>>>0){_=12;break}if(!(0|mt[l>>0])){if(n=0|te(0|St[o>>2],f),St[d>>2]=n,0|St[d>>2]){_=9;break}Et[l>>0]=-128}Et[(0|St[St[u>>2]>>2])+(0|St[c>>2])>>0]=(0|mt[f>>0])&(0|mt[l>>0])|0?1:0,Et[l>>0]=(0|mt[l>>0])>>1,St[c>>2]=1+(0|St[c>>2])}return 9==(0|_)?(St[i>>2]=St[d>>2],E=0|St[i>>2],pt=S,0|E):12==(0|_)?(E=(St[i>>2]=0)|St[i>>2],pt=S,0|E):0}function _e(e,r,t,n){e|=0,r|=0,t|=0,n|=0;var i,o,a,u,s,f,l,c=0,d=0,E=pt;if((0|bt)<=(0|(pt=pt+32|0))&&yt(32),i=E+24|0,a=E+16|0,u=E+12|0,s=E+8|0,c=E+28|0,f=E+4|0,St[(o=(l=E)+20|0)>>2]=e,St[a>>2]=r,St[u>>2]=t,St[s>>2]=n,n=0|te(0|St[o>>2],c),St[l>>2]=n,0|St[l>>2])return St[i>>2]=St[l>>2],d=0|St[i>>2],pt=E,0|d;if(!(0|mt[c>>0]))return c=0|Ee(0|St[o>>2],0|St[a>>2],0|St[u>>2],0|St[s>>2]),St[i>>2]=c,d=0|St[i>>2],pt=E,0|d;if(0|St[a>>2]){if(c=0|sr[3&St[St[s>>2]>>2]](0|St[s>>2],0|St[a>>2]),!(St[St[u>>2]>>2]=c))return St[i>>2]=2,d=0|St[i>>2],pt=E,0|d}else St[St[u>>2]>>2]=0;for(St[f>>2]=0;!((0|St[f>>2])>>>0>=(0|St[a>>2])>>>0);)Et[(0|St[St[u>>2]>>2])+(0|St[f>>2])>>0]=1,St[f>>2]=1+(0|St[f>>2]);return d=(St[i>>2]=0)|St[i>>2],pt=E,0|d}function Se(e,r){e|=0,r|=0;var t,n,i,o,a,u,s=0,f=0,l=pt;for((0|bt)<=(0|(pt=pt+32|0))&&yt(32),t=l+16|0,i=l+8|0,o=l+4|0,a=l+20|0,St[(n=(u=l)+12|0)>>2]=e,St[i>>2]=r,St[St[i>>2]>>2]=0,St[o>>2]=0;;){if(4<=(0|St[o>>2])){s=6;break}if(r=0|te(0|St[n>>2],a),St[u>>2]=r,0|St[u>>2]){s=4;break}r=0|St[i>>2],St[r>>2]=St[r>>2]|(0|mt[a>>0])<<(St[o>>2]<<3),St[o>>2]=1+(0|St[o>>2])}return 4==(0|s)?(St[t>>2]=St[u>>2],f=0|St[t>>2],pt=l,0|f):6==(0|s)?(f=(St[t>>2]=0)|St[t>>2],pt=l,0|f):0}function te(e,r){e|=0,r|=0;var t,n,i,o=0,a=pt;return(0|bt)<=(0|(pt=pt+16|0))&&yt(16),t=a+8|0,St[(n=(i=a)+4|0)>>2]=e,St[i>>2]=r,pt=(o=0|St[4+(0|St[n>>2])>>2]?(r=4+(0|St[n>>2])|0,St[r>>2]=(0|St[r>>2])-1,r=0|St[n>>2],n=0|St[r>>2],St[r>>2]=1+n,Et[St[i>>2]>>0]=0|Et[n>>0],(St[t>>2]=0)|St[t>>2]):(St[t>>2]=16,0|St[t>>2]),a),0|o}function me(e){e|=0;var r,t,n,i=0,o=0,a=pt;return(0|bt)<=(0|(pt=pt+32|0))&&yt(32),r=a+16|0,i=(n=a)+8|0,St[(t=a+12|0)>>2]=e,e=0|le(0|St[t>>2],n),St[i>>2]=e,pt=(o=(0|St[i>>2]?St[r>>2]=St[i>>2]:(i=n,n=0|ce(0|St[t>>2],0|St[i>>2],0|St[i+4>>2]),St[r>>2]=n),0|St[r>>2]),a),0|o}function ne(e,r,t,n,i){e|=0,r|=0,t|=0,n|=0,i|=0;var o,a,u,s,f,l,c,d,E=0,_=0,S=0,m=pt;if((0|bt)<=(0|(pt=pt+48|0))&&yt(48),o=m+32|0,u=m+24|0,s=m+20|0,f=m+16|0,l=m+12|0,c=m+8|0,E=m+4|0,St[(a=(d=m)+28|0)>>2]=e,St[u>>2]=r,St[s>>2]=t,St[f>>2]=n,St[l>>2]=i,i=0|_e(0|St[a>>2],0|St[u>>2],0|St[s>>2],0|St[l>>2]),St[E>>2]=i,0|St[E>>2])return St[o>>2]=St[E>>2],_=0|St[o>>2],pt=m,0|_;if(0|St[u>>2]){if(E=0|sr[3&St[St[l>>2]>>2]](0|St[l>>2],St[u>>2]<<2),!(St[St[f>>2]>>2]=E))return St[o>>2]=2,_=0|St[o>>2],pt=m,0|_}else St[St[f>>2]>>2]=0;for(St[c>>2]=0;;){if((0|St[c>>2])>>>0>=(0|St[u>>2])>>>0){S=13;break}if(0|Et[(0|St[St[s>>2]>>2])+(0|St[c>>2])>>0]&&(E=0|Se(0|St[a>>2],(0|St[St[f>>2]>>2])+(St[c>>2]<<2)|0),St[d>>2]=E,0|St[d>>2])){S=11;break}St[c>>2]=1+(0|St[c>>2])}return 11==(0|S)?(St[o>>2]=St[d>>2],_=0|St[o>>2],pt=m,0|_):13==(0|S)?(_=(St[o>>2]=0)|St[o>>2],pt=m,0|_):0}function I(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u,s,f=0,l=0,c=pt;for((0|bt)<=(0|(pt=pt+32|0))&&yt(32),n=c+28|0,o=c+8|0,u=(a=c)+20|0,s=c+16|0,St[(i=c+24|0)>>2]=e,St[(e=o)>>2]=r,St[e+4>>2]=t;;){if(t=0|ue(0|St[i>>2],a),St[u>>2]=t,0|St[u>>2]){f=3;break}if(e=o,(0|St[(t=a)>>2])==(0|St[e>>2])&&(0|St[t+4>>2])==(0|St[e+4>>2])){f=5;break}if(0==(0|St[(e=a)>>2])&0==(0|St[e+4>>2])){f=7;break}if(e=0|me(0|St[i>>2]),St[s>>2]=e,0|St[s>>2]){f=9;break}}return 3==(0|f)?(St[n>>2]=St[u>>2],l=0|St[n>>2],pt=c,0|l):5==(0|f)?(l=(St[n>>2]=0)|St[n>>2],pt=c,0|l):7==(0|f)?(St[n>>2]=16,l=0|St[n>>2],pt=c,0|l):9==(0|f)?(St[n>>2]=St[s>>2],l=0|St[n>>2],pt=c,0|l):0}function ie(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u,s,f=0,l=0,c=pt;for((0|bt)<=(0|(pt=pt+32|0))&&yt(32),n=c+20|0,o=c+12|0,a=c+8|0,u=c+4|0,St[(i=(s=c)+16|0)>>2]=e,St[o>>2]=r,St[a>>2]=t,St[u>>2]=0;;){if((0|St[u>>2])>>>0>=(0|St[a>>2])>>>0){f=6;break}if(t=0|te(0|St[i>>2],(0|St[o>>2])+(0|St[u>>2])|0),St[s>>2]=t,0|St[s>>2]){f=4;break}St[u>>2]=1+(0|St[u>>2])}return 4==(0|f)?(St[n>>2]=St[s>>2],l=0|St[n>>2],pt=c,0|l):6==(0|f)?(l=(St[n>>2]=0)|St[n>>2],pt=c,0|l):0}function oe(e){e|=0;var r,t,n,i=0,o=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),r=o+8|0,St[(t=(n=o)+4|0)>>2]=e;do{if(0|St[St[t>>2]>>2]){if(e=0|function(e){var r=0,t=0,n=0,i=0;-1<(0|St[76+(e|=0)>>2])&&ze();(r=0!=(1&St[e>>2]|0))||(H(11076),t=0|St[e+52>>2],n=e+56|0,0|t&&(St[t+56>>2]=St[n>>2]),0|(i=0|St[n>>2])&&(St[i+52>>2]=t),(0|St[2768])==(0|e)&&(St[2768]=i),V(11076));i=0|Ve(e),t=0|ar[1&St[e+12>>2]](e)|i,0|(i=0|St[e+92>>2])&&Ge(i);r||Ge(e);return 0|t}(0|St[St[t>>2]>>2]),St[n>>2]=e,0|St[n>>2])return St[r>>2]=St[n>>2],i=0|St[r>>2],pt=o,0|i;St[St[t>>2]>>2]=0;break}}while(0);return i=(St[r>>2]=0)|St[r>>2],pt=o,0|i}function L(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u,s=0,f=pt;return(0|bt)<=(0|(pt=pt+32|0))&&yt(32),n=f+16|0,o=f+8|0,a=f+4|0,St[(i=(u=f)+12|0)>>2]=e,St[o>>2]=r,St[a>>2]=t,St[u>>2]=St[St[a>>2]>>2],pt=(s=0|St[u>>2]?(t=0|function(e,r,t,n){e|=0,n|=0;var i=0,o=0,a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0;i=0|wt(t|=0,r|=0),o=-1<(0|St[n+76>>2])?0|ze():0;u=0|Et[(a=n+74|0)>>0],Et[a>>0]=u+255|u,a=0|St[(u=n+4|0)>>2],s=(0|St[n+8>>2])-a|0,f=a,c=0<(0|s)?(Je(0|e,0|f,0|(a=s>>>0>>0?s:i)),St[u>>2]=f+a,l=i-a|0,e+a|0):(l=i,e);e:do{if(l){for(e=n+32|0,a=l,f=c;!(0|function(e){var r=0,t=0,n=0;t=0|Et[(r=74+(e|=0)|0)>>0],Et[r>>0]=t+255|t,r=e+44|0,(0|St[(t=e+20|0)>>2])>>>0>(0|St[r>>2])>>>0&&nr[15&St[e+36>>2]](e,0,0);St[e+16>>2]=0,St[e+28>>2]=0,St[t>>2]=0,n=20&(t=0|St[e>>2])?(4&t&&(St[e>>2]=32|t),-1):(t=0|St[r>>2],St[e+8>>2]=t,St[e+4>>2]=t,0);return 0|n}(n)||((u=0|nr[15&St[e>>2]](n,f,a))+1|0)>>>0<2);){if(!(s=a-u|0)){d=13;break e}a=s,f=f+u|0}0|o&&He(),E=((i-a|0)>>>0)/(r>>>0)|0}else d=13}while(0);13==(0|d)&&(E=(o&&He(),t));return 0|E}(0|St[o>>2],1,0|St[u>>2],0|St[St[i>>2]>>2]),St[St[a>>2]>>2]=t,(0|St[St[a>>2]>>2])==(0|St[u>>2])?(St[n>>2]=0)|St[n>>2]:(u=0|function(e){var r=0,t=0,n=0;n=-1<(0|St[76+(e|=0)>>2])?(r=0==(0|ze()),t=(0|St[e>>2])>>>5&1,r||He(),t):(0|St[e>>2])>>>5&1;return 0|n}(0|St[St[i>>2]>>2]),St[n>>2]=u,0|St[n>>2])):(St[n>>2]=0)|St[n>>2],f),0|s}function ae(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u,s,f=0,l=pt;switch((0|bt)<=(0|(pt=pt+32|0))&&yt(32),n=l+20|0,o=l+12|0,a=l+8|0,u=l+4|0,St[(i=(s=l)+16|0)>>2]=e,St[o>>2]=r,St[a>>2]=t,0|St[a>>2]){case 0:St[u>>2]=0;break;case 1:St[u>>2]=1;break;case 2:St[u>>2]=2;break;default:return St[n>>2]=1,f=0|St[n>>2],pt=l,0|f}return a=0|(e=0|St[St[i>>2]>>2],r=0|St[St[o>>2]>>2],t=0|St[u>>2],0|function(e,r,t){r|=0,t|=0;var n=0,i=0,o=0;o=-1<(0|St[76+(e|=0)>>2])?(n=0==(0|ze()),i=0|We(e,r,t),n||He(),i):0|We(e,r,t);return 0|o}(e|=0,r|=0,t|=0)),St[s>>2]=a,a=0|(t=0|St[St[i>>2]>>2],0|function(e){var r=0,t=0,n=0;n=-1<(0|St[76+(e|=0)>>2])?(r=0==(0|ze()),t=0|je(e),r||He(),t):0|je(e);return 0|n}(t|=0)),i=0|St[o>>2],St[i>>2]=a,St[4+i>>2]=((0|a)<0)<<31>>31,St[n>>2]=St[s>>2],f=0|St[n>>2],pt=l,0|f}function he(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a=pt;return(0|bt)<=(0|(pt=pt+32|0))&&yt(32),i=a+8|0,St[(n=(o=a)+16|0)>>2]=e,St[(e=i)>>2]=r,St[e+4>>2]=t,i=0|St[(t=i)+4>>2],St[(e=o)>>2]=St[t>>2],St[e+4>>2]=i,i=0|nr[15&St[12+(0|St[n>>2])>>2]](0|St[n>>2],o,0),pt=a,0|i}function pe(e,r,t,n){e|=0,r|=0,t|=0,n|=0;var i,o,a,u,s,f,l,c=0,d=0,E=pt;for((0|bt)<=(0|(pt=pt+32|0))&&yt(32),i=E+24|0,a=E+16|0,u=E+12|0,s=E+8|0,f=E+4|0,St[(o=(l=E)+20|0)>>2]=e,St[a>>2]=r,St[u>>2]=t,St[s>>2]=n;;){if(!(0|St[u>>2])){c=8;break}if(St[f>>2]=St[u>>2],n=0|nr[15&St[8+(0|St[o>>2])>>2]](0|St[o>>2],0|St[a>>2],f),St[l>>2]=n,0|St[l>>2]){c=4;break}if(!(0|St[f>>2])){c=6;break}St[a>>2]=(0|St[a>>2])+(0|St[f>>2]),St[u>>2]=(0|St[u>>2])-(0|St[f>>2])}return 4==(0|c)?(St[i>>2]=St[l>>2],d=0|St[i>>2],pt=E,0|d):6==(0|c)?(St[i>>2]=St[s>>2],d=0|St[i>>2],pt=E,0|d):8==(0|c)?(d=(St[i>>2]=0)|St[i>>2],pt=E,0|d):0}function be(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),i=a+4|0,St[(n=(o=a)+8|0)>>2]=e,St[i>>2]=r,St[o>>2]=t,St[76+(0|St[n>>2])>>2]=1,St[72+(0|St[n>>2])>>2]=0,(St[88+(0|St[n>>2])>>2]=0)|St[i>>2]&&(St[44+(0|St[n>>2])>>2]=0,St[48+(0|St[n>>2])>>2]=0,St[80+(0|St[n>>2])>>2]=1),pt=(0|St[o>>2]&&(St[80+(0|St[n>>2])>>2]=1),a)}function ke(e){e|=0;var r,t=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(r=t)>>2]=e,be((St[36+(0|St[r>>2])>>2]=0)|St[r>>2],1,1),pt=t}function Fe(e,r,t,n,i,o){e|=0,r|=0,t|=0,n|=0,i|=0,o|=0;var a,u,s,f,l,c,d,E,_,S,m,h,p,b=0,k=0,F=0,w=0,y=0,v=pt;for((0|bt)<=(0|(pt=pt+64|0))&&yt(64),a=v+56|0,s=v+48|0,b=v+44|0,f=v+40|0,l=v+36|0,c=v+32|0,k=v+28|0,d=v+24|0,E=v+20|0,_=v+16|0,S=v+12|0,m=v+8|0,h=v+4|0,St[(u=(p=v)+52|0)>>2]=e,St[s>>2]=r,St[b>>2]=t,St[f>>2]=n,St[l>>2]=i,St[c>>2]=o,St[k>>2]=St[St[f>>2]>>2],we((St[St[f>>2]>>2]=0)|St[u>>2],0|St[s>>2]),St[St[c>>2]>>2]=0;;){if(F=0|St[u>>2],274==(0|St[72+(0|St[u>>2])>>2])){w=46;break}if(0|St[F+76>>2]){for(;!((0|St[k>>2])>>>0<=0||5<=(0|St[88+(0|St[u>>2])>>2])>>>0);)o=0|St[b>>2],St[b>>2]=o+1,i=0|Et[o>>0],o=88+(0|St[u>>2])|0,n=0|St[o>>2],St[o>>2]=n+1,Et[92+(0|St[u>>2])+n>>0]=i,i=0|St[f>>2],St[i>>2]=1+(0|St[i>>2]),St[k>>2]=(0|St[k>>2])-1;if((0|St[88+(0|St[u>>2])>>2])>>>0<5){w=8;break}if(0|mt[92+(0|St[u>>2])>>0]){w=10;break}!function(e,r){e|=0,r|=0;var t=0,n=0,i=0;(0|(pt=(t=pt)+16|0))>=(0|bt)&&yt(16),St[(n=(i=t)+4|0)>>2]=e,St[i>>2]=r,St[32+(0|St[n>>2])>>2]=(0|mt[1+(0|St[i>>2])>>0])<<24|(0|mt[2+(0|St[i>>2])>>0])<<16|(0|mt[3+(0|St[i>>2])>>0])<<8|0|mt[4+(0|St[i>>2])>>0],St[28+(0|St[n>>2])>>2]=-1,St[76+(0|St[n>>2])>>2]=0,pt=t}(0|St[u>>2],92+(0|St[u>>2])|0),St[88+(0|St[u>>2])>>2]=0}if(((St[d>>2]=0)|St[36+(0|St[u>>2])>>2])>>>0>=(0|St[s>>2])>>>0){if(0==(0|St[72+(0|St[u>>2])>>2])&&0==(0|St[32+(0|St[u>>2])>>2])){w=15;break}if(!(0|St[l>>2])){w=17;break}if(0|St[72+(0|St[u>>2])>>2]){w=19;break}St[d>>2]=1}if(0|St[80+(0|St[u>>2])>>2]&&function(e){e|=0;var r=0,t=0,n=0,i=0,o=0;for((0|(pt=(r=pt)+16|0))>=(0|bt)&&yt(16),n=r+8|0,i=r+4|0,St[(t=(o=r)+12|0)>>2]=e,St[n>>2]=1846+(768<<(0|St[St[t>>2]>>2])+(0|St[4+(0|St[t>>2])>>2])),St[o>>2]=St[16+(0|St[t>>2])>>2],St[i>>2]=0;!((0|St[i>>2])>>>0>=(0|St[n>>2])>>>0);)_t[(0|St[o>>2])+(St[i>>2]<<1)>>1]=1024,St[i>>2]=1+(0|St[i>>2]);St[56+(0|St[t>>2])+12>>2]=1,St[56+(0|St[t>>2])+8>>2]=1,St[56+(0|St[t>>2])+4>>2]=1,St[56+(0|St[t>>2])>>2]=1,St[52+(0|St[t>>2])>>2]=0,St[80+(0|St[t>>2])>>2]=0,pt=r}(0|St[u>>2]),0|St[88+(0|St[u>>2])>>2]){for(St[m>>2]=St[88+(0|St[u>>2])>>2],St[h>>2]=0;!(20<=(0|St[m>>2])>>>0||(0|St[h>>2])>>>0>=(0|St[k>>2])>>>0);)i=0|St[h>>2],St[h>>2]=i+1,n=0|Et[(0|St[b>>2])+i>>0],i=0|St[m>>2],St[m>>2]=i+1,Et[92+(0|St[u>>2])+i>>0]=n;if(St[88+(0|St[u>>2])>>2]=St[m>>2],(0|St[m>>2])>>>0<20|0!=(0|St[d>>2])){if(n=0|ye(0|St[u>>2],92+(0|St[u>>2])|0,0|St[m>>2]),St[p>>2]=n,!(0|St[p>>2])){w=40;break}if(0!=(0|St[d>>2])&2!=(0|St[p>>2])){w=42;break}}if(St[24+(0|St[u>>2])>>2]=92+(0|St[u>>2]),0|ve(0|St[u>>2],0|St[s>>2],0|St[24+(0|St[u>>2])>>2])){w=44;break}St[h>>2]=(0|St[h>>2])-((0|St[m>>2])-((0|St[24+(0|St[u>>2])>>2])-(92+(0|St[u>>2])))),n=0|St[f>>2],St[n>>2]=(0|St[n>>2])+(0|St[h>>2]),St[b>>2]=(0|St[b>>2])+(0|St[h>>2]),St[k>>2]=(0|St[k>>2])-(0|St[h>>2]),St[88+(0|St[u>>2])>>2]=0}else{if((0|St[k>>2])>>>0<20|0!=(0|St[d>>2])){if(i=0|ye(0|St[u>>2],0|St[b>>2],0|St[k>>2]),St[S>>2]=i,!(0|St[S>>2])){w=26;break}if(0!=(0|St[d>>2])&2!=(0|St[S>>2])){w=28;break}St[_>>2]=St[b>>2]}else St[_>>2]=(0|St[b>>2])+(0|St[k>>2])-20;if(St[24+(0|St[u>>2])>>2]=St[b>>2],0|ve(0|St[u>>2],0|St[s>>2],0|St[_>>2])){w=32;break}St[E>>2]=(0|St[24+(0|St[u>>2])>>2])-(0|St[b>>2]),i=0|St[f>>2],St[i>>2]=(0|St[i>>2])+(0|St[E>>2]),St[b>>2]=(0|St[b>>2])+(0|St[E>>2]),St[k>>2]=(0|St[k>>2])-(0|St[E>>2])}}switch(0|w){case 8:return St[St[c>>2]>>2]=3,y=(St[a>>2]=0)|St[a>>2],pt=v,0|y;case 10:return St[a>>2]=1,y=0|St[a>>2],pt=v,0|y;case 15:return St[St[c>>2]>>2]=4,y=(St[a>>2]=0)|St[a>>2],pt=v,0|y;case 17:return St[St[c>>2]>>2]=2,y=(St[a>>2]=0)|St[a>>2],pt=v,0|y;case 19:return St[St[c>>2]>>2]=2,St[a>>2]=1,y=0|St[a>>2],pt=v,0|y;case 26:return Je(92+(0|St[u>>2])|0,0|St[b>>2],0|St[k>>2]),St[88+(0|St[u>>2])>>2]=St[k>>2],b=0|St[f>>2],St[b>>2]=(0|St[b>>2])+(0|St[k>>2]),St[St[c>>2]>>2]=3,y=(St[a>>2]=0)|St[a>>2],pt=v,0|y;case 28:return St[St[c>>2]>>2]=2,St[a>>2]=1,y=0|St[a>>2],pt=v,0|y;case 32:return St[a>>2]=1,y=0|St[a>>2],pt=v,0|y;case 40:return k=0|St[f>>2],St[k>>2]=(0|St[k>>2])+(0|St[h>>2]),St[St[c>>2]>>2]=3,y=(St[a>>2]=0)|St[a>>2],pt=v,0|y;case 42:return St[St[c>>2]>>2]=2,St[a>>2]=1,y=0|St[a>>2],pt=v,0|y;case 44:return St[a>>2]=1,y=0|St[a>>2],pt=v,0|y;case 46:return 0|St[F+32>>2]||(St[St[c>>2]>>2]=1),St[a>>2]=0==(0|St[32+(0|St[u>>2])>>2])?0:1,y=0|St[a>>2],pt=v,0|y}return 0}function we(e,r){e|=0,r|=0;var t,n,i,o,a,u,s=0,f=0,l=pt;if((0|bt)<=(0|(pt=pt+32|0))&&yt(32),s=l+20|0,n=l+16|0,i=l+12|0,o=l+8|0,a=l+4|0,St[(t=(u=l)+24|0)>>2]=e,St[s>>2]=r,0|St[72+(0|St[t>>2])>>2])if(274<=(0|St[72+(0|St[t>>2])>>2])>>>0)pt=l;else{for(St[n>>2]=St[20+(0|St[t>>2])>>2],St[i>>2]=St[36+(0|St[t>>2])>>2],St[o>>2]=St[40+(0|St[t>>2])>>2],St[a>>2]=St[72+(0|St[t>>2])>>2],St[u>>2]=St[56+(0|St[t>>2])>>2],((0|St[s>>2])-(0|St[i>>2])|0)>>>0<(0|St[a>>2])>>>0&&(St[a>>2]=(0|St[s>>2])-(0|St[i>>2])),0==(0|St[48+(0|St[t>>2])>>2])&&((0|St[12+(0|St[t>>2])>>2])-(0|St[44+(0|St[t>>2])>>2])|0)>>>0<=(0|St[a>>2])>>>0&&(St[48+(0|St[t>>2])>>2]=St[12+(0|St[t>>2])>>2]),s=44+(0|St[t>>2])|0,St[s>>2]=(0|St[s>>2])+(0|St[a>>2]),s=72+(0|St[t>>2])|0,St[s>>2]=(0|St[s>>2])-(0|St[a>>2]);s=0|St[a>>2],St[a>>2]=s+-1,f=0|St[i>>2],s;)Et[(0|St[n>>2])+(0|St[i>>2])>>0]=0|Et[(0|St[n>>2])+(f-(0|St[u>>2])+((0|St[i>>2])>>>0<(0|St[u>>2])>>>0?0|St[o>>2]:0))>>0],St[i>>2]=1+(0|St[i>>2]);St[36+(0|St[t>>2])>>2]=f,pt=l}else pt=l}function ye(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u,s,f,l,c,d,E,_,S,m,h,p,b,k,F,w,y,v,M,O,A=0,R=0,g=0,T=0,N=0,D=0,P=0,C=pt;(0|bt)<=(0|(pt=pt+112|0))&&yt(112),n=C+104|0,o=C+96|0,A=C+92|0,a=C+88|0,u=C+84|0,s=C+80|0,f=C+76|0,l=C+72|0,c=C+68|0,d=C+64|0,E=C+60|0,_=C+56|0,S=C+52|0,m=C+48|0,h=C+44|0,p=C+40|0,R=C+36|0,g=C+32|0,b=C+28|0,k=C+24|0,F=C+20|0,w=C+16|0,y=C+12|0,v=C+8|0,M=C+4|0,St[(i=(O=C)+100|0)>>2]=e,St[o>>2]=r,St[A>>2]=t,St[a>>2]=St[28+(0|St[i>>2])>>2],St[u>>2]=St[32+(0|St[i>>2])>>2],St[s>>2]=(0|St[o>>2])+(0|St[A>>2]),St[f>>2]=St[16+(0|St[i>>2])>>2],St[l>>2]=St[52+(0|St[i>>2])>>2],St[S>>2]=St[44+(0|St[i>>2])>>2]&(1<>2])>>2])-1,St[d>>2]=(0|St[f>>2])+(St[l>>2]<<4<<1)+(St[S>>2]<<1),St[_>>2]=re[St[d>>2]>>1];do{if((0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0<(0|St[s>>2])>>>0){St[a>>2]=St[a>>2]<<8,A=St[u>>2]<<8,t=0|St[o>>2],St[o>>2]=t+1,St[u>>2]=0|A|mt[t>>0];break}return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T}}while(0);t=0|wt((0|St[a>>2])>>>11,0|St[_>>2]),St[E>>2]=t,t=0|St[E>>2];e:do{if((0|St[u>>2])>>>0>=(0|St[E>>2])>>>0){St[a>>2]=(0|St[a>>2])-t,St[u>>2]=(0|St[u>>2])-(0|St[E>>2]),St[d>>2]=384+(0|St[f>>2])+(St[l>>2]<<1),St[_>>2]=re[St[d>>2]>>1];do{if((0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0<(0|St[s>>2])>>>0){St[a>>2]=St[a>>2]<<8,A=St[u>>2]<<8,r=0|St[o>>2],St[o>>2]=r+1,St[u>>2]=0|A|mt[r>>0];break}return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T}}while(0);if(r=0|wt((0|St[a>>2])>>>11,0|St[_>>2]),St[E>>2]=r,r=0|St[E>>2],(0|St[u>>2])>>>0<(0|St[E>>2])>>>0)St[a>>2]=r,St[l>>2]=0,St[d>>2]=1636+(0|St[f>>2]),St[c>>2]=2;else{St[a>>2]=(0|St[a>>2])-r,St[u>>2]=(0|St[u>>2])-(0|St[E>>2]),St[c>>2]=3,St[d>>2]=408+(0|St[f>>2])+(St[l>>2]<<1),St[_>>2]=re[St[d>>2]>>1];do{if((0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0<(0|St[s>>2])>>>0){St[a>>2]=St[a>>2]<<8,r=St[u>>2]<<8,A=0|St[o>>2],St[o>>2]=A+1,St[u>>2]=0|r|mt[A>>0];break}return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T}}while(0);A=0|wt((0|St[a>>2])>>>11,0|St[_>>2]),St[E>>2]=A,A=0|St[E>>2];do{if((0|St[u>>2])>>>0>=(0|St[E>>2])>>>0){St[a>>2]=(0|St[a>>2])-A,St[u>>2]=(0|St[u>>2])-(0|St[E>>2]),St[d>>2]=432+(0|St[f>>2])+(St[l>>2]<<1),St[_>>2]=re[St[d>>2]>>1];do{if((0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0<(0|St[s>>2])>>>0){St[a>>2]=St[a>>2]<<8,r=St[u>>2]<<8,e=0|St[o>>2],St[o>>2]=e+1,St[u>>2]=0|r|mt[e>>0];break}return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T}}while(0);if(e=0|wt((0|St[a>>2])>>>11,0|St[_>>2]),St[E>>2]=e,e=0|St[E>>2],(0|St[u>>2])>>>0<(0|St[E>>2])>>>0){St[a>>2]=e;break}St[a>>2]=(0|St[a>>2])-e,St[u>>2]=(0|St[u>>2])-(0|St[E>>2]),St[d>>2]=456+(0|St[f>>2])+(St[l>>2]<<1),St[_>>2]=re[St[d>>2]>>1];do{if((0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0<(0|St[s>>2])>>>0){St[a>>2]=St[a>>2]<<8,e=St[u>>2]<<8,r=0|St[o>>2],St[o>>2]=r+1,St[u>>2]=0|e|mt[r>>0];break}return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T}}while(0);if(r=0|wt((0|St[a>>2])>>>11,0|St[_>>2]),St[E>>2]=r,r=0|St[E>>2],(0|St[u>>2])>>>0<(0|St[E>>2])>>>0){St[a>>2]=r;break}St[a>>2]=(0|St[a>>2])-r,St[u>>2]=(0|St[u>>2])-(0|St[E>>2]);break}St[a>>2]=A,St[d>>2]=480+(0|St[f>>2])+(St[l>>2]<<4<<1)+(St[S>>2]<<1),St[_>>2]=re[St[d>>2]>>1];do{if((0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0<(0|St[s>>2])>>>0){St[a>>2]=St[a>>2]<<8,r=St[u>>2]<<8,e=0|St[o>>2],St[o>>2]=e+1,St[u>>2]=0|r|mt[e>>0];break}return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T}}while(0);if(e=0|wt((0|St[a>>2])>>>11,0|St[_>>2]),St[E>>2]=e,e=0|St[E>>2],(0|St[u>>2])>>>0>=(0|St[E>>2])>>>0){St[a>>2]=(0|St[a>>2])-e,St[u>>2]=(0|St[u>>2])-(0|St[E>>2]);break}St[a>>2]=e;do{if((0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0<(0|St[s>>2])>>>0){St[a>>2]=St[a>>2]<<8,e=St[u>>2]<<8,r=0|St[o>>2],St[o>>2]=r+1,St[u>>2]=0|e|mt[r>>0];break}return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T}}while(0);return St[n>>2]=3,T=0|St[n>>2],pt=C,0|T}while(0);St[l>>2]=12,St[d>>2]=2664+(0|St[f>>2])}St[y>>2]=St[d>>2],St[_>>2]=re[St[y>>2]>>1];do{if((0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0<(0|St[s>>2])>>>0){St[a>>2]=St[a>>2]<<8,A=St[u>>2]<<8,r=0|St[o>>2],St[o>>2]=r+1,St[u>>2]=0|A|mt[r>>0];break}return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T}}while(0);r=0|wt((0|St[a>>2])>>>11,0|St[_>>2]),St[E>>2]=r,r=0|St[E>>2];do{if((0|St[u>>2])>>>0>=(0|St[E>>2])>>>0){St[a>>2]=(0|St[a>>2])-r,St[u>>2]=(0|St[u>>2])-(0|St[E>>2]),St[y>>2]=2+(0|St[d>>2]),St[_>>2]=re[St[y>>2]>>1];do{if((0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0<(0|St[s>>2])>>>0){St[a>>2]=St[a>>2]<<8,A=St[u>>2]<<8,e=0|St[o>>2],St[o>>2]=e+1,St[u>>2]=0|A|mt[e>>0];break}return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T}}while(0);if(e=0|wt((0|St[a>>2])>>>11,0|St[_>>2]),St[E>>2]=e,e=0|St[E>>2],(0|St[u>>2])>>>0<(0|St[E>>2])>>>0){St[a>>2]=e,St[y>>2]=260+(0|St[d>>2])+(St[S>>2]<<3<<1),St[w>>2]=8,St[F>>2]=8;break}St[a>>2]=(0|St[a>>2])-e,St[u>>2]=(0|St[u>>2])-(0|St[E>>2]),St[y>>2]=516+(0|St[d>>2]),St[w>>2]=16,St[F>>2]=256;break}}while(St[a>>2]=r,St[y>>2]=4+(0|St[d>>2])+(St[S>>2]<<3<<1),St[w>>2]=0,St[F>>2]=8,0);St[k>>2]=1;do{if(St[_>>2]=re[(0|St[y>>2])+(St[k>>2]<<1)>>1],(0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0>=(0|St[s>>2])>>>0){N=86;break}St[a>>2]=St[a>>2]<<8,r=St[u>>2]<<8,e=0|St[o>>2],St[o>>2]=e+1,St[u>>2]=0|r|mt[e>>0]}}while(e=0|wt((0|St[a>>2])>>>11,0|St[_>>2]),St[E>>2]=e,e=0|St[E>>2],(0|St[u>>2])>>>0<(0|St[E>>2])>>>0?(St[a>>2]=e,St[k>>2]=(0|St[k>>2])+(0|St[k>>2])):(St[a>>2]=(0|St[a>>2])-e,St[u>>2]=(0|St[u>>2])-(0|St[E>>2]),St[k>>2]=(0|St[k>>2])+(0|St[k>>2])+1),(0|St[k>>2])>>>0<(0|St[F>>2])>>>0);if(86==(0|N))return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T;if(St[k>>2]=(0|St[k>>2])-(0|St[F>>2]),St[k>>2]=(0|St[k>>2])+(0|St[w>>2]),(0|St[l>>2])>>>0<4){St[d>>2]=864+(0|St[f>>2])+(((0|St[k>>2])>>>0<4?0|St[k>>2]:3)<<6<<1),St[v>>2]=1;do{if(St[_>>2]=re[(0|St[d>>2])+(St[v>>2]<<1)>>1],(0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0>=(0|St[s>>2])>>>0){N=96;break}St[a>>2]=St[a>>2]<<8,e=St[u>>2]<<8,r=0|St[o>>2],St[o>>2]=r+1,St[u>>2]=0|e|mt[r>>0]}}while(r=0|wt((0|St[a>>2])>>>11,0|St[_>>2]),St[E>>2]=r,r=0|St[E>>2],(0|St[u>>2])>>>0<(0|St[E>>2])>>>0?(St[a>>2]=r,St[v>>2]=(0|St[v>>2])+(0|St[v>>2])):(St[a>>2]=(0|St[a>>2])-r,St[u>>2]=(0|St[u>>2])-(0|St[E>>2]),St[v>>2]=(0|St[v>>2])+(0|St[v>>2])+1),(0|St[v>>2])>>>0<64);if(96==(0|N))return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T;if(St[v>>2]=(0|St[v>>2])-64,4<=(0|St[v>>2])>>>0){St[M>>2]=((0|St[v>>2])>>>1)-1;do{if(!((0|St[v>>2])>>>0<14)){for(St[M>>2]=(0|St[M>>2])-4;;){if((0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0>=(0|St[s>>2])>>>0)break;St[a>>2]=St[a>>2]<<8,r=St[u>>2]<<8,e=0|St[o>>2],St[o>>2]=e+1,St[u>>2]=0|r|mt[e>>0]}if(St[a>>2]=(0|St[a>>2])>>>1,St[u>>2]=(0|St[u>>2])-(St[a>>2]&(((0|St[u>>2])-(0|St[a>>2])|0)>>>31)-1),e=(0|St[M>>2])-1|0,!(St[M>>2]=e)){N=111;break}}if(111!=(0|N))return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T;St[d>>2]=1604+(0|St[f>>2]),St[M>>2]=4;break}}while(St[d>>2]=1376+(0|St[f>>2])+((2|1&St[v>>2])<>2]<<1)+(0-(0|St[v>>2])<<1)-2,0);for(St[O>>2]=1;;){if(St[_>>2]=re[(0|St[d>>2])+(St[O>>2]<<1)>>1],(0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0>=(0|St[s>>2])>>>0)break;St[a>>2]=St[a>>2]<<8,e=St[u>>2]<<8,r=0|St[o>>2],St[o>>2]=r+1,St[u>>2]=0|e|mt[r>>0]}if(r=0|wt((0|St[a>>2])>>>11,0|St[_>>2]),St[E>>2]=r,r=0|St[E>>2],(0|St[u>>2])>>>0<(0|St[E>>2])>>>0?(St[a>>2]=r,St[O>>2]=(0|St[O>>2])+(0|St[O>>2])):(St[a>>2]=(0|St[a>>2])-r,St[u>>2]=(0|St[u>>2])-(0|St[E>>2]),St[O>>2]=(0|St[O>>2])+(0|St[O>>2])+1),r=(0|St[M>>2])-1|0,!(St[M>>2]=r))break e}return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T}}}else{St[a>>2]=t,St[d>>2]=3692+(0|St[f>>2]),(0|St[48+(0|St[i>>2])>>2]||0|St[44+(0|St[i>>2])>>2])&&(r=0|St[i>>2],D=0|St[36+(0|St[i>>2])>>2]?0|St[r+36>>2]:0|St[r+40>>2],St[d>>2]=(0|St[d>>2])+(768*(((St[44+(0|St[i>>2])>>2]&(1<>2])>>2])-1)<>2]>>2])+((0|mt[(0|St[20+(0|St[i>>2])>>2])+(D-1)>>0])>>8-(0|St[St[i>>2]>>2]))|0)<<1));r:do{if((0|St[l>>2])>>>0<7){for(St[m>>2]=1;;){if(St[_>>2]=re[(0|St[d>>2])+(St[m>>2]<<1)>>1],(0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0>=(0|St[s>>2])>>>0)break;St[a>>2]=St[a>>2]<<8,r=St[u>>2]<<8,e=0|St[o>>2],St[o>>2]=e+1,St[u>>2]=0|r|mt[e>>0]}if(e=0|wt((0|St[a>>2])>>>11,0|St[_>>2]),St[E>>2]=e,e=0|St[E>>2],(0|St[u>>2])>>>0<(0|St[E>>2])>>>0?(St[a>>2]=e,St[m>>2]=(0|St[m>>2])+(0|St[m>>2])):(St[a>>2]=(0|St[a>>2])-e,St[u>>2]=(0|St[u>>2])-(0|St[E>>2]),St[m>>2]=(0|St[m>>2])+(0|St[m>>2])+1),256<=(0|St[m>>2])>>>0)break r}return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T}for(P=(0|St[36+(0|St[i>>2])>>2])>>>0<(0|St[56+(0|St[i>>2])>>2])>>>0?0|St[40+(0|St[i>>2])>>2]:0,St[h>>2]=mt[(0|St[20+(0|St[i>>2])>>2])+((0|St[36+(0|St[i>>2])>>2])-(0|St[56+(0|St[i>>2])>>2])+P)>>0],St[p>>2]=256,St[R>>2]=1;;){if(St[h>>2]=St[h>>2]<<1,St[g>>2]=St[h>>2]&St[p>>2],St[b>>2]=(0|St[d>>2])+(St[p>>2]<<1)+(St[g>>2]<<1)+(St[R>>2]<<1),St[_>>2]=re[St[b>>2]>>1],(0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0>=(0|St[s>>2])>>>0)break;St[a>>2]=St[a>>2]<<8,e=St[u>>2]<<8,r=0|St[o>>2],St[o>>2]=r+1,St[u>>2]=0|e|mt[r>>0]}if(r=0|wt((0|St[a>>2])>>>11,0|St[_>>2]),St[E>>2]=r,r=0|St[E>>2],(0|St[u>>2])>>>0<(0|St[E>>2])>>>0?(St[a>>2]=r,St[R>>2]=(0|St[R>>2])+(0|St[R>>2]),St[p>>2]=St[p>>2]&~St[g>>2]):(St[a>>2]=(0|St[a>>2])-r,St[u>>2]=(0|St[u>>2])-(0|St[E>>2]),St[R>>2]=(0|St[R>>2])+(0|St[R>>2])+1,St[p>>2]=St[p>>2]&St[g>>2]),256<=(0|St[R>>2])>>>0)break r}return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T}while(0);St[c>>2]=1}}while(0);do{if((0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0<(0|St[s>>2])>>>0){St[a>>2]=St[a>>2]<<8,R=St[u>>2]<<8,g=0|St[o>>2],St[o>>2]=g+1,St[u>>2]=0|R|mt[g>>0];break}return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T}}while(0);return St[n>>2]=St[c>>2],T=0|St[n>>2],pt=C,0|T}function ve(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u,s,f,l=0,c=0,d=pt;(0|bt)<=(0|(pt=pt+32|0))&&yt(32),n=d+24|0,o=d+16|0,a=d+12|0,u=d+8|0,s=d+4|0,St[(i=(f=d)+20|0)>>2]=e,St[o>>2]=r,St[a>>2]=t;do{if(St[u>>2]=St[o>>2],0==(0|St[48+(0|St[i>>2])>>2])&&(St[s>>2]=(0|St[12+(0|St[i>>2])>>2])-(0|St[44+(0|St[i>>2])>>2]),((0|St[o>>2])-(0|St[36+(0|St[i>>2])>>2])|0)>>>0>(0|St[s>>2])>>>0)&&(St[u>>2]=(0|St[36+(0|St[i>>2])>>2])+(0|St[s>>2])),t=0|function(e,r,t){e|=0,r|=0,t|=0;var n=0,i=0,o=0,a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0,R=0,g=0,T=0,N=0,D=0,P=0,C=0,I=0,L=0,x=0,B=0,H=0,U=0,z=0,Y=0,V=0,K=0,W=0,j=0,X=0,G=0,q=0,Q=0,Z=0,J=0,$=0,ee=0;(0|(pt=(n=pt)+192|0))>=(0|bt)&&yt(192);i=n+188|0,a=n+180|0,u=n+176|0,s=n+172|0,f=n+168|0,l=n+164|0,c=n+160|0,d=n+156|0,E=n+152|0,_=n+148|0,S=n+144|0,m=n+140|0,h=n+136|0,p=n+132|0,b=n+128|0,k=n+124|0,F=n+120|0,w=n+116|0,y=n+112|0,v=n+108|0,M=n+104|0,O=n+100|0,A=n+96|0,R=n+92|0,g=n+88|0,T=n+84|0,N=n+80|0,D=n+76|0,P=n+72|0,C=n+68|0,I=n+64|0,L=n+60|0,x=n+56|0,B=n+52|0,H=n+48|0,U=n+44|0,z=n+40|0,Y=n+36|0,V=n+32|0,K=n+28|0,W=n+24|0,j=n+20|0,X=n+16|0,G=n+12|0,q=n+8|0,Q=n+4|0,St[(o=(Z=n)+184|0)>>2]=e,St[a>>2]=r,St[u>>2]=t,St[s>>2]=St[16+(0|St[o>>2])>>2],St[f>>2]=St[52+(0|St[o>>2])>>2],St[l>>2]=St[56+(0|St[o>>2])>>2],St[c>>2]=St[56+(0|St[o>>2])+4>>2],St[d>>2]=St[56+(0|St[o>>2])+8>>2],St[E>>2]=St[56+(0|St[o>>2])+12>>2],St[_>>2]=(1<>2])>>2])-1,St[S>>2]=(1<>2])>>2])-1,St[m>>2]=St[St[o>>2]>>2],St[h>>2]=St[20+(0|St[o>>2])>>2],St[p>>2]=St[40+(0|St[o>>2])>>2],St[b>>2]=St[36+(0|St[o>>2])>>2],St[k>>2]=St[44+(0|St[o>>2])>>2],St[F>>2]=St[48+(0|St[o>>2])>>2],St[w>>2]=0,St[y>>2]=St[24+(0|St[o>>2])>>2],St[v>>2]=St[28+(0|St[o>>2])>>2],St[M>>2]=St[32+(0|St[o>>2])>>2];e:do{St[g>>2]=St[k>>2]&St[_>>2],St[O>>2]=(0|St[s>>2])+(St[f>>2]<<4<<1)+(St[g>>2]<<1),St[R>>2]=re[St[O>>2]>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,t=St[M>>2]<<8,r=0|St[y>>2],St[y>>2]=r+1,St[M>>2]=0|t|mt[r>>0]),r=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=r,r=0|St[A>>2];r:do{if((0|St[M>>2])>>>0<(0|St[A>>2])>>>0){if(St[v>>2]=r,_t[St[O>>2]>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[O>>2]=3692+(0|St[s>>2]),0!=(0|St[F>>2])|0!=(0|St[k>>2])&&(St[O>>2]=(0|St[O>>2])+(768*(((St[k>>2]&St[S>>2])<>2])+((0|mt[(0|St[h>>2])+((0==(0|St[b>>2])?0|St[p>>2]:0|St[b>>2])-1)>>0])>>8-(0|St[m>>2]))|0)<<1)),(0|St[f>>2])>>>0<7)for(St[f>>2]=(0|St[f>>2])-((0|St[f>>2])>>>0<4?0|St[f>>2]:3),St[T>>2]=1;St[R>>2]=re[(0|St[O>>2])+(St[T>>2]<<1)>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,t=St[M>>2]<<8,e=0|St[y>>2],St[y>>2]=e+1,St[M>>2]=0|t|mt[e>>0]),e=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=e,e=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=e,_t[(0|St[O>>2])+(St[T>>2]<<1)>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[T>>2]=(0|St[T>>2])+(0|St[T>>2])):(St[v>>2]=(0|St[v>>2])-e,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[(0|St[O>>2])+(St[T>>2]<<1)>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[T>>2]=(0|St[T>>2])+(0|St[T>>2])+1),(0|St[T>>2])>>>0<256;);else for(St[N>>2]=mt[(0|St[20+(0|St[o>>2])>>2])+((0|St[b>>2])-(0|St[l>>2])+((0|St[b>>2])>>>0<(0|St[l>>2])>>>0?0|St[p>>2]:0))>>0],St[D>>2]=256,St[f>>2]=(0|St[f>>2])-((0|St[f>>2])>>>0<10?3:6),St[T>>2]=1;St[N>>2]=St[N>>2]<<1,St[P>>2]=St[N>>2]&St[D>>2],St[C>>2]=(0|St[O>>2])+(St[D>>2]<<1)+(St[P>>2]<<1)+(St[T>>2]<<1),St[R>>2]=re[St[C>>2]>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,e=St[M>>2]<<8,t=0|St[y>>2],St[y>>2]=t+1,St[M>>2]=0|e|mt[t>>0]),t=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=t,t=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=t,_t[St[C>>2]>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[T>>2]=(0|St[T>>2])+(0|St[T>>2]),St[D>>2]=St[D>>2]&~St[P>>2]):(St[v>>2]=(0|St[v>>2])-t,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[St[C>>2]>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[T>>2]=(0|St[T>>2])+(0|St[T>>2])+1,St[D>>2]=St[D>>2]&St[P>>2]),(0|St[T>>2])>>>0<256;);t=255&St[T>>2],e=0|St[b>>2],St[b>>2]=e+1,Et[(0|St[h>>2])+e>>0]=t,St[k>>2]=1+(0|St[k>>2])}else{if(St[v>>2]=(0|St[v>>2])-r,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[St[O>>2]>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[O>>2]=384+(0|St[s>>2])+(St[f>>2]<<1),St[R>>2]=re[St[O>>2]>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,t=St[M>>2]<<8,e=0|St[y>>2],St[y>>2]=e+1,St[M>>2]=0|t|mt[e>>0]),e=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=e,e=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0)St[v>>2]=e,_t[St[O>>2]>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[f>>2]=12+(0|St[f>>2]),St[O>>2]=1636+(0|St[s>>2]);else{if(St[v>>2]=(0|St[v>>2])-e,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[St[O>>2]>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),0==(0|St[F>>2])&0==(0|St[k>>2])){J=28;break e}St[O>>2]=408+(0|St[s>>2])+(St[f>>2]<<1),St[R>>2]=re[St[O>>2]>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,e=St[M>>2]<<8,t=0|St[y>>2],St[y>>2]=t+1,St[M>>2]=0|e|mt[t>>0]),t=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=t,t=0|St[A>>2];do{if((0|St[M>>2])>>>0<(0|St[A>>2])>>>0){if(St[v>>2]=t,_t[St[O>>2]>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[O>>2]=480+(0|St[s>>2])+(St[f>>2]<<4<<1)+(St[g>>2]<<1),St[R>>2]=re[St[O>>2]>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,e=St[M>>2]<<8,$=0|St[y>>2],St[y>>2]=$+1,St[M>>2]=0|e|mt[$>>0]),$=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=$,$=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0){St[v>>2]=$,_t[St[O>>2]>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),Et[(0|St[h>>2])+(0|St[b>>2])>>0]=0|Et[(0|St[h>>2])+((0|St[b>>2])-(0|St[l>>2])+((0|St[b>>2])>>>0<(0|St[l>>2])>>>0?0|St[p>>2]:0))>>0],St[b>>2]=1+(0|St[b>>2]),St[k>>2]=1+(0|St[k>>2]),St[f>>2]=(0|St[f>>2])>>>0<7?9:11;break r}St[v>>2]=(0|St[v>>2])-$,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[St[O>>2]>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5);break}}while(St[v>>2]=(0|St[v>>2])-t,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[St[O>>2]>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[O>>2]=432+(0|St[s>>2])+(St[f>>2]<<1),St[R>>2]=re[St[O>>2]>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,$=St[M>>2]<<8,e=0|St[y>>2],St[y>>2]=e+1,St[M>>2]=0|$|mt[e>>0]),e=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=e,e=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=e,_t[St[O>>2]>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[I>>2]=St[c>>2]):(St[v>>2]=(0|St[v>>2])-e,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[St[O>>2]>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[O>>2]=456+(0|St[s>>2])+(St[f>>2]<<1),St[R>>2]=re[St[O>>2]>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,e=St[M>>2]<<8,$=0|St[y>>2],St[y>>2]=$+1,St[M>>2]=0|e|mt[$>>0]),$=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=$,$=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=$,_t[St[O>>2]>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[I>>2]=St[d>>2]):(St[v>>2]=(0|St[v>>2])-$,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[St[O>>2]>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[I>>2]=St[E>>2],St[E>>2]=St[d>>2]),St[d>>2]=St[c>>2]),St[c>>2]=St[l>>2],St[l>>2]=St[I>>2],0);St[f>>2]=(0|St[f>>2])>>>0<7?8:11,St[O>>2]=2664+(0|St[s>>2])}St[B>>2]=St[O>>2],St[R>>2]=re[St[B>>2]>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,t=St[M>>2]<<8,$=0|St[y>>2],St[y>>2]=$+1,St[M>>2]=0|t|mt[$>>0]),$=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=$,$=0|St[A>>2];do{if((0|St[M>>2])>>>0>=(0|St[A>>2])>>>0){if(St[v>>2]=(0|St[v>>2])-$,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[St[B>>2]>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[B>>2]=2+(0|St[O>>2]),St[R>>2]=re[St[B>>2]>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,t=St[M>>2]<<8,e=0|St[y>>2],St[y>>2]=e+1,St[M>>2]=0|t|mt[e>>0]),e=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=e,e=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0){St[v>>2]=e,_t[St[B>>2]>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[B>>2]=260+(0|St[O>>2])+(St[g>>2]<<3<<1),St[x>>2]=8,St[L>>2]=8;break}St[v>>2]=(0|St[v>>2])-e,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[St[B>>2]>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[B>>2]=516+(0|St[O>>2]),St[x>>2]=16,St[L>>2]=256;break}}while(St[v>>2]=$,_t[St[B>>2]>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[B>>2]=4+(0|St[O>>2])+(St[g>>2]<<3<<1),St[x>>2]=0,St[L>>2]=8,0);for(St[w>>2]=1;St[R>>2]=re[(0|St[B>>2])+(St[w>>2]<<1)>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,$=St[M>>2]<<8,e=0|St[y>>2],St[y>>2]=e+1,St[M>>2]=0|$|mt[e>>0]),e=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=e,e=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=e,_t[(0|St[B>>2])+(St[w>>2]<<1)>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[w>>2]=(0|St[w>>2])+(0|St[w>>2])):(St[v>>2]=(0|St[v>>2])-e,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[(0|St[B>>2])+(St[w>>2]<<1)>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[w>>2]=(0|St[w>>2])+(0|St[w>>2])+1),(0|St[w>>2])>>>0<(0|St[L>>2])>>>0;);if(St[w>>2]=(0|St[w>>2])-(0|St[L>>2]),St[w>>2]=(0|St[w>>2])+(0|St[x>>2]),12<=(0|St[f>>2])>>>0){St[O>>2]=864+(0|St[s>>2])+(((0|St[w>>2])>>>0<4?0|St[w>>2]:3)<<6<<1),St[H>>2]=1,St[R>>2]=re[(0|St[O>>2])+(St[H>>2]<<1)>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,e=St[M>>2]<<8,$=0|St[y>>2],St[y>>2]=$+1,St[M>>2]=0|e|mt[$>>0]),$=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=$,$=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=$,_t[(0|St[O>>2])+(St[H>>2]<<1)>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[H>>2]=(0|St[H>>2])+(0|St[H>>2])):(St[v>>2]=(0|St[v>>2])-$,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[(0|St[O>>2])+(St[H>>2]<<1)>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[H>>2]=(0|St[H>>2])+(0|St[H>>2])+1),St[R>>2]=re[(0|St[O>>2])+(St[H>>2]<<1)>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,$=St[M>>2]<<8,e=0|St[y>>2],St[y>>2]=e+1,St[M>>2]=0|$|mt[e>>0]),e=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=e,e=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=e,_t[(0|St[O>>2])+(St[H>>2]<<1)>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[H>>2]=(0|St[H>>2])+(0|St[H>>2])):(St[v>>2]=(0|St[v>>2])-e,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[(0|St[O>>2])+(St[H>>2]<<1)>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[H>>2]=(0|St[H>>2])+(0|St[H>>2])+1),St[R>>2]=re[(0|St[O>>2])+(St[H>>2]<<1)>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,e=St[M>>2]<<8,$=0|St[y>>2],St[y>>2]=$+1,St[M>>2]=0|e|mt[$>>0]),$=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=$,$=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=$,_t[(0|St[O>>2])+(St[H>>2]<<1)>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[H>>2]=(0|St[H>>2])+(0|St[H>>2])):(St[v>>2]=(0|St[v>>2])-$,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[(0|St[O>>2])+(St[H>>2]<<1)>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[H>>2]=(0|St[H>>2])+(0|St[H>>2])+1),St[R>>2]=re[(0|St[O>>2])+(St[H>>2]<<1)>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,$=St[M>>2]<<8,e=0|St[y>>2],St[y>>2]=e+1,St[M>>2]=0|$|mt[e>>0]),e=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=e,e=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=e,_t[(0|St[O>>2])+(St[H>>2]<<1)>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[H>>2]=(0|St[H>>2])+(0|St[H>>2])):(St[v>>2]=(0|St[v>>2])-e,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[(0|St[O>>2])+(St[H>>2]<<1)>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[H>>2]=(0|St[H>>2])+(0|St[H>>2])+1),St[R>>2]=re[(0|St[O>>2])+(St[H>>2]<<1)>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,e=St[M>>2]<<8,$=0|St[y>>2],St[y>>2]=$+1,St[M>>2]=0|e|mt[$>>0]),$=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=$,$=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=$,_t[(0|St[O>>2])+(St[H>>2]<<1)>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[H>>2]=(0|St[H>>2])+(0|St[H>>2])):(St[v>>2]=(0|St[v>>2])-$,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[(0|St[O>>2])+(St[H>>2]<<1)>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[H>>2]=(0|St[H>>2])+(0|St[H>>2])+1),St[R>>2]=re[(0|St[O>>2])+(St[H>>2]<<1)>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,$=St[M>>2]<<8,e=0|St[y>>2],St[y>>2]=e+1,St[M>>2]=0|$|mt[e>>0]),e=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=e,e=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=e,_t[(0|St[O>>2])+(St[H>>2]<<1)>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[H>>2]=(0|St[H>>2])+(0|St[H>>2])):(St[v>>2]=(0|St[v>>2])-e,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[(0|St[O>>2])+(St[H>>2]<<1)>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[H>>2]=(0|St[H>>2])+(0|St[H>>2])+1),St[H>>2]=(0|St[H>>2])-64;t:do{if(4<=(0|St[H>>2])>>>0){if(St[U>>2]=St[H>>2],St[z>>2]=((0|St[H>>2])>>>1)-1,St[H>>2]=2|1&St[H>>2],e=0|St[z>>2],(0|St[U>>2])>>>0<14)for(St[H>>2]=St[H>>2]<>2]=1376+(0|St[s>>2])+(St[H>>2]<<1)+(0-(0|St[U>>2])<<1)-2,St[Y>>2]=1,St[V>>2]=1;;)if(St[R>>2]=re[(0|St[O>>2])+(St[V>>2]<<1)>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,$=St[M>>2]<<8,t=0|St[y>>2],St[y>>2]=t+1,St[M>>2]=0|$|mt[t>>0]),t=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=t,t=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=t,_t[(0|St[O>>2])+(St[V>>2]<<1)>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[V>>2]=(0|St[V>>2])+(0|St[V>>2])):(St[v>>2]=(0|St[v>>2])-t,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[(0|St[O>>2])+(St[V>>2]<<1)>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[V>>2]=(0|St[V>>2])+(0|St[V>>2])+1,St[H>>2]=St[H>>2]|St[Y>>2]),St[Y>>2]=St[Y>>2]<<1,t=(0|St[z>>2])-1|0,!(St[z>>2]=t))break t;for(St[z>>2]=e-4;(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,t=St[M>>2]<<8,$=0|St[y>>2],St[y>>2]=$+1,St[M>>2]=0|t|mt[$>>0]),St[v>>2]=(0|St[v>>2])>>>1,St[M>>2]=(0|St[M>>2])-(0|St[v>>2]),St[K>>2]=0-((0|St[M>>2])>>>31),St[H>>2]=(St[H>>2]<<1)+(1+(0|St[K>>2])),St[M>>2]=(0|St[M>>2])+(St[v>>2]&St[K>>2]),$=(0|St[z>>2])-1|0,St[z>>2]=$,0!=(0|$););if(St[O>>2]=1604+(0|St[s>>2]),St[H>>2]=St[H>>2]<<4,St[W>>2]=1,St[R>>2]=re[(0|St[O>>2])+(St[W>>2]<<1)>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,e=St[M>>2]<<8,$=0|St[y>>2],St[y>>2]=$+1,St[M>>2]=0|e|mt[$>>0]),$=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=$,$=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=$,_t[(0|St[O>>2])+(St[W>>2]<<1)>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[W>>2]=(0|St[W>>2])+(0|St[W>>2])):(St[v>>2]=(0|St[v>>2])-$,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[(0|St[O>>2])+(St[W>>2]<<1)>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[W>>2]=(0|St[W>>2])+(0|St[W>>2])+1,St[H>>2]=1|St[H>>2]),St[R>>2]=re[(0|St[O>>2])+(St[W>>2]<<1)>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,$=St[M>>2]<<8,e=0|St[y>>2],St[y>>2]=e+1,St[M>>2]=0|$|mt[e>>0]),e=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=e,e=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=e,_t[(0|St[O>>2])+(St[W>>2]<<1)>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[W>>2]=(0|St[W>>2])+(0|St[W>>2])):(St[v>>2]=(0|St[v>>2])-e,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[(0|St[O>>2])+(St[W>>2]<<1)>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[W>>2]=(0|St[W>>2])+(0|St[W>>2])+1,St[H>>2]=2|St[H>>2]),St[R>>2]=re[(0|St[O>>2])+(St[W>>2]<<1)>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,e=St[M>>2]<<8,$=0|St[y>>2],St[y>>2]=$+1,St[M>>2]=0|e|mt[$>>0]),$=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=$,$=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=$,_t[(0|St[O>>2])+(St[W>>2]<<1)>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[W>>2]=(0|St[W>>2])+(0|St[W>>2])):(St[v>>2]=(0|St[v>>2])-$,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[(0|St[O>>2])+(St[W>>2]<<1)>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[W>>2]=(0|St[W>>2])+(0|St[W>>2])+1,St[H>>2]=4|St[H>>2]),St[R>>2]=re[(0|St[O>>2])+(St[W>>2]<<1)>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,$=St[M>>2]<<8,e=0|St[y>>2],St[y>>2]=e+1,St[M>>2]=0|$|mt[e>>0]),e=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=e,e=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=e,_t[(0|St[O>>2])+(St[W>>2]<<1)>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[W>>2]=(0|St[W>>2])+(0|St[W>>2])):(St[v>>2]=(0|St[v>>2])-e,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[(0|St[O>>2])+(St[W>>2]<<1)>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[W>>2]=(0|St[W>>2])+(0|St[W>>2])+1,St[H>>2]=8|St[H>>2]),-1==(0|St[H>>2])){J=130;break e}}}while(0);if(St[E>>2]=St[d>>2],St[d>>2]=St[c>>2],St[c>>2]=St[l>>2],St[l>>2]=1+(0|St[H>>2]),e=0|St[H>>2],0|St[F>>2]){if(e>>>0>=(0|St[F>>2])>>>0){J=135;break e}}else if(e>>>0>=(0|St[k>>2])>>>0){J=133;break e}St[f>>2]=(0|St[f>>2])>>>0<19?7:10}if(St[w>>2]=2+(0|St[w>>2]),(0|St[a>>2])==(0|St[b>>2])){J=138;break e}if(St[j>>2]=(0|St[a>>2])-(0|St[b>>2]),St[X>>2]=(0|St[j>>2])>>>0<(0|St[w>>2])>>>0?0|St[j>>2]:0|St[w>>2],St[G>>2]=(0|St[b>>2])-(0|St[l>>2])+((0|St[b>>2])>>>0<(0|St[l>>2])>>>0?0|St[p>>2]:0),St[k>>2]=(0|St[k>>2])+(0|St[X>>2]),St[w>>2]=(0|St[w>>2])-(0|St[X>>2]),((0|St[G>>2])+(0|St[X>>2])|0)>>>0>(0|St[p>>2])>>>0)for(;;)if(e=0|Et[(0|St[h>>2])+(0|St[G>>2])>>0],$=0|St[b>>2],St[b>>2]=$+1,Et[(0|St[h>>2])+$>>0]=e,e=1+(0|St[G>>2])|0,St[G>>2]=e,St[G>>2]=(0|e)==(0|St[p>>2])?0:e,e=(0|St[X>>2])-1|0,!(St[X>>2]=e))break r;for(St[q>>2]=(0|St[h>>2])+(0|St[b>>2]),St[Q>>2]=(0|St[G>>2])-(0|St[b>>2]),St[Z>>2]=(0|St[q>>2])+(0|St[X>>2]),St[b>>2]=(0|St[b>>2])+(0|St[X>>2]);Et[St[q>>2]>>0]=0|Et[(0|St[q>>2])+(0|St[Q>>2])>>0],e=1+(0|St[q>>2])|0,St[q>>2]=e,(0|e)!=(0|St[Z>>2]););}}while(0)}while(!((0|St[b>>2])>>>0>=(0|St[a>>2])>>>0)&&(0|St[y>>2])>>>0<(0|St[u>>2])>>>0);{if(28==(0|J))return St[i>>2]=1,ee=0|St[i>>2],pt=n,0|ee;if(130==(0|J))St[w>>2]=274+(0|St[w>>2]),St[f>>2]=(0|St[f>>2])-12;else{if(133==(0|J))return St[i>>2]=1,ee=0|St[i>>2],pt=n,0|ee;if(135==(0|J))return St[i>>2]=1,ee=0|St[i>>2],pt=n,0|ee;if(138==(0|J))return St[i>>2]=1,ee=0|St[i>>2],pt=n,0|ee}}(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,J=St[M>>2]<<8,u=0|St[y>>2],St[y>>2]=u+1,St[M>>2]=0|J|mt[u>>0]);return St[24+(0|St[o>>2])>>2]=St[y>>2],St[28+(0|St[o>>2])>>2]=St[v>>2],St[32+(0|St[o>>2])>>2]=St[M>>2],St[72+(0|St[o>>2])>>2]=St[w>>2],St[36+(0|St[o>>2])>>2]=St[b>>2],St[44+(0|St[o>>2])>>2]=St[k>>2],St[56+(0|St[o>>2])>>2]=St[l>>2],St[56+(0|St[o>>2])+4>>2]=St[c>>2],St[56+(0|St[o>>2])+8>>2]=St[d>>2],St[56+(0|St[o>>2])+12>>2]=St[E>>2],St[52+(0|St[o>>2])>>2]=St[f>>2],St[i>>2]=0,ee=0|St[i>>2],pt=n,0|ee}(0|St[i>>2],0|St[u>>2],0|St[a>>2]),St[f>>2]=t,0|St[f>>2]){l=6;break}}while(((0|St[44+(0|St[i>>2])>>2])>>>0>=(0|St[12+(0|St[i>>2])>>2])>>>0&&(St[48+(0|St[i>>2])>>2]=St[12+(0|St[i>>2])>>2]),we(0|St[i>>2],0|St[o>>2]),!((0|St[36+(0|St[i>>2])>>2])>>>0>=(0|St[o>>2])>>>0))&&(!((0|St[24+(0|St[i>>2])>>2])>>>0>=(0|St[a>>2])>>>0)&&(0|St[72+(0|St[i>>2])>>2])>>>0<274));return pt=(c=6==(0|l)?(St[n>>2]=St[f>>2],0|St[n>>2]):(274<(0|St[72+(0|St[i>>2])>>2])>>>0&&(St[72+(0|St[i>>2])>>2]=274),(St[n>>2]=0)|St[n>>2]),d),0|c}function Oe(e,r){e|=0,r|=0;var t,n,i=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(t=(n=i)+4|0)>>2]=e,St[n>>2]=r,or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[16+(0|St[t>>2])>>2]),St[16+(0|St[t>>2])>>2]=0,pt=i}function Ae(e,r,t,n){e|=0,r|=0,t|=0,n|=0;var i,o,a,u,s,f,l=0,c=0,d=0,E=pt;return(0|bt)<=(0|(pt=pt+48|0))&&yt(48),i=E+40|0,a=E+32|0,u=E+28|0,s=E+24|0,f=E+8|0,l=E+4|0,St[(o=(c=E)+36|0)>>2]=e,St[a>>2]=r,St[u>>2]=t,St[s>>2]=n,n=0|function(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u,s,f=0,l=pt;return(0|bt)<=(0|(pt=pt+32|0))&&yt(32),n=l+16|0,o=l+8|0,a=l+4|0,s=(u=l)+20|0,St[(i=l+12|0)>>2]=e,St[o>>2]=r,St[a>>2]=t,pt=(f=(0|St[a>>2])>>>0<5?(St[n>>2]=4,0|St[n>>2]):(a=0|mt[1+(0|St[o>>2])>>0]|(0|mt[2+(0|St[o>>2])>>0])<<8|(0|mt[3+(0|St[o>>2])>>0])<<16|(0|mt[4+(0|St[o>>2])>>0])<<24,St[u>>2]=a,St[u>>2]=(0|St[u>>2])>>>0<4096?4096:a,St[12+(0|St[i>>2])>>2]=St[u>>2],Et[s>>0]=0|Et[St[o>>2]>>0],225<=(0|mt[s>>0])?(St[n>>2]=4,0|St[n>>2]):(St[St[i>>2]>>2]=(0|mt[s>>0])%9|0,Et[s>>0]=(0|mt[s>>0])/9|0,St[8+(0|St[i>>2])>>2]=(0|mt[s>>0])/5|0,St[4+(0|St[i>>2])>>2]=(0|mt[s>>0])%5|0,(St[n>>2]=0)|St[n>>2])),l),0|f}(f,0|St[a>>2],0|St[u>>2]),St[l>>2]=n,pt=(d=0|St[l>>2]?(St[i>>2]=St[l>>2],0|St[i>>2]):(l=0|function(e,r,t){e|=0,r|=0,t|=0;var n=0,i=0,o=0,a=0,u=0,s=0,f=0,l=0;(0|(pt=(n=pt)+32|0))>=(0|bt)&&yt(32);i=n+16|0,a=n+8|0,u=n+4|0,St[(o=(s=n)+12|0)>>2]=e,St[a>>2]=r,St[u>>2]=t,St[s>>2]=1846+(768<<(0|St[St[a>>2]>>2])+(0|St[4+(0|St[a>>2])>>2])),0!=(0|St[16+(0|St[o>>2])>>2])&&(0|St[s>>2])==(0|St[84+(0|St[o>>2])>>2])||(f=3);if(3==(0|f)&&(Oe(0|St[o>>2],0|St[u>>2]),f=0|sr[3&St[St[u>>2]>>2]](0|St[u>>2],St[s>>2]<<1),St[16+(0|St[o>>2])>>2]=f,St[84+(0|St[o>>2])>>2]=St[s>>2],0==(0|St[16+(0|St[o>>2])>>2])))return St[i>>2]=2,l=0|St[i>>2],pt=n,0|l;return St[i>>2]=0,l=0|St[i>>2],pt=n,0|l}(0|St[o>>2],f,0|St[s>>2]),St[c>>2]=l,0|St[c>>2]?(St[i>>2]=St[c>>2],0|St[i>>2]):(c=0|St[o>>2],St[c>>2]=St[f>>2],St[c+4>>2]=St[4+f>>2],St[c+8>>2]=St[8+f>>2],St[c+12>>2]=St[12+f>>2],(St[i>>2]=0)|St[i>>2])),E),0|d}function Re(e,r,t,n,i,o,a,u,s,f){e|=0,r|=0,t|=0,n|=0,i|=0,o|=0,a|=0,u|=0,s|=0,f|=0;var l,c,d,E,_,S,m,h,p,b,k,F,w=pt;for((0|bt)<=(0|(pt=pt+64|0))&&yt(64),c=w+52|0,d=w+48|0,_=(E=w)+44|0,S=w+40|0,m=w+36|0,h=w+32|0,p=w+28|0,b=w+16|0,k=w+12|0,F=w+8|0,St[(l=w+56|0)>>2]=e,St[c>>2]=r,St[d>>2]=t,St[(t=E)>>2]=n,St[t+4>>2]=i,St[_>>2]=o,St[S>>2]=a,St[m>>2]=u,St[h>>2]=s,St[p>>2]=f,St[b>>2]=0,St[4+b>>2]=0,f=E,E=(St[8+b>>2]=0)|function(e,r,t,n,i,o,a,u,s,f,l){e|=0,r|=0,t|=0,n|=0,i|=0,o|=0,a|=0,u|=0,s|=0,f|=0,l|=0;var c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0,R=0,g=0,T=0,N=0,D=0,P=0,C=0,I=0,L=0,x=0,B=0,H=0,U=0,z=0,Y=0,V=0,K=0,W=0,j=0,X=0,G=0,q=0;(0|(pt=(c=pt)+192|0))>=(0|bt)&&yt(192);if(d=c+180|0,_=c+172|0,S=c+168|0,m=c+40|0,h=c+164|0,p=c+160|0,b=c+156|0,k=c+152|0,F=c+148|0,w=c+144|0,y=c+140|0,v=c+128|0,M=c+124|0,O=c+120|0,A=c+116|0,R=c+112|0,g=c+108|0,T=c+32|0,N=c+24|0,D=c+104|0,P=c+100|0,C=c+88|0,I=c+16|0,L=c+84|0,x=c+80|0,B=c+76|0,H=c+72|0,U=c+68|0,z=c+8|0,V=(Y=c)+64|0,K=c+60|0,W=c+56|0,j=c+52|0,X=c+48|0,St[(E=c+176|0)>>2]=e,St[_>>2]=r,St[S>>2]=t,St[(t=m)>>2]=n,St[t+4>>2]=i,St[h>>2]=o,St[p>>2]=a,St[b>>2]=u,St[k>>2]=s,St[F>>2]=f,St[w>>2]=l,St[v>>2]=0,St[4+v>>2]=0,St[8+v>>2]=0,St[M>>2]=0,St[O>>2]=0,l=0|function(e){e|=0;var r=0,t=0,n=0,i=0,o=0,a=0,u=0;(0|(pt=(r=pt)+16|0))>=(0|bt)&&yt(16);if(t=r+8|0,St[(n=(i=r)+4|0)>>2]=e,1<=(0|St[16+(0|St[n>>2])>>2])>>>0&&(0|St[16+(0|St[n>>2])>>2])>>>0<=4){if(!(0|De(0|St[St[n>>2]>>2])))return St[t>>2]=4,o=0|St[t>>2],pt=r,0|o;if(e=0|St[n>>2],1==(0|St[16+(0|St[n>>2])>>2]))return pt=(o=(1==(0|St[e+24>>2])&&0==(0|St[St[8+(0|St[n>>2])>>2]>>2])&&0==(0|St[20+(0|St[n>>2])>>2])?St[t>>2]=0:St[t>>2]=4,0|St[t>>2]),r),0|o;if(a=0|St[n>>2],2==(0|St[e+16>>2])){if(St[i>>2]=24+(0|St[a>>2]),e=8+(0|St[i>>2])|0,!(0<(u=0|St[e+4>>2])>>>0|0==(0|u)&4294967295<(0|St[e>>2])>>>0||1!=(0|St[St[i>>2]>>2])||1!=(0|St[4+(0|St[i>>2])>>2])||1!=(0|St[24+(0|St[n>>2])>>2])||0!=(0|St[St[8+(0|St[n>>2])>>2]>>2])||1!=(0|St[20+(0|St[n>>2])>>2])||1!=(0|St[St[4+(0|St[n>>2])>>2]>>2]))&&0==(0|St[4+(0|St[4+(0|St[n>>2])>>2])>>2]))switch(0|St[8+(0|St[i>>2])>>2]){case 50529537:case 50528515:return St[t>>2]=0,o=0|St[t>>2],pt=r,0|o;default:return St[t>>2]=4,o=0|St[t>>2],pt=r,0|o}return St[t>>2]=4,o=0|St[t>>2],pt=r,0|o}if(4!=(0|St[a+16>>2]))return St[t>>2]=4,o=0|St[t>>2],pt=r,0|o;if(0|De(24+(0|St[St[n>>2]>>2])|0)&&0|De(48+(0|St[St[n>>2]>>2])|0)&&(a=72+(0|St[St[n>>2]>>2])+8|0,50528539==(0|St[a>>2])&0==(0|St[a+4>>2]))&&4==(0|St[72+(0|St[St[n>>2]>>2])>>2])&&1==(0|St[72+(0|St[St[n>>2]>>2])+4>>2])){do{if(4==(0|St[24+(0|St[n>>2])>>2])&&2==(0|St[St[8+(0|St[n>>2])>>2]>>2])&&6==(0|St[4+(0|St[8+(0|St[n>>2])>>2])>>2])&&1==(0|St[8+(0|St[8+(0|St[n>>2])>>2])>>2])&&0==(0|St[12+(0|St[8+(0|St[n>>2])>>2])>>2])&&3==(0|St[20+(0|St[n>>2])>>2])){if(5!=(0|St[St[4+(0|St[n>>2])>>2]>>2]))break;if(0|St[4+(0|St[4+(0|St[n>>2])>>2])>>2])break;if(4!=(0|St[8+(0|St[4+(0|St[n>>2])>>2])>>2]))break;if(1!=(0|St[8+(0|St[4+(0|St[n>>2])>>2])+4>>2]))break;if(3!=(0|St[16+(0|St[4+(0|St[n>>2])>>2])>>2]))break;if(2!=(0|St[16+(0|St[4+(0|St[n>>2])>>2])+4>>2]))break;return St[t>>2]=0,o=0|St[t>>2],pt=r,0|o}}while(0);return St[t>>2]=4,o=0|St[t>>2],pt=r,0|o}return St[t>>2]=4,o=0|St[t>>2],pt=r,0|o}return St[t>>2]=4,o=0|St[t>>2],pt=r,0|o}(0|St[E>>2]),St[A>>2]=l,0|St[A>>2])return St[d>>2]=St[A>>2],G=0|St[d>>2],pt=c,0|G;St[y>>2]=0;e:for(;;){if((0|St[y>>2])>>>0>=(0|St[16+(0|St[E>>2])>>2])>>>0){q=55;break}St[R>>2]=(0|St[St[E>>2]>>2])+(24*(0|St[y>>2])|0);r:do{if(0|ge(0|St[8+(0|St[R>>2])>>2])){St[g>>2]=0,St[D>>2]=St[h>>2],St[P>>2]=St[p>>2];do{if(4==(0|St[16+(0|St[E>>2])>>2])){if(St[C>>2]=St[2],St[4+C>>2]=St[3],St[8+C>>2]=St[4],A=(0|St[12+(0|St[E>>2])>>2])+(St[y>>2]<<3)|0,l=0|St[A+4>>2],St[(f=I)>>2]=St[A>>2],St[f+4>>2]=l,St[g>>2]=St[C+(St[y>>2]<<2)>>2],(0|St[y>>2])>>>0<2){if(St[P>>2]=St[I>>2],0!=(0|St[(l=I)+4>>2])||(0|St[P>>2])!=(0|St[l>>2])){q=9;break e}if(l=0|sr[3&St[St[b>>2]>>2]](0|St[b>>2],0|St[P>>2]),St[L>>2]=l,0==(0|St[L>>2])&0!=(0|St[P>>2])){q=11;break e}l=0|St[L>>2],St[(0|St[k>>2])+(1-(0|St[y>>2])<<2)>>2]=l,St[D>>2]=l,St[v+(1-(0|St[y>>2])<<2)>>2]=St[P>>2];break}if(2!=(0|St[y>>2])){q=17;break e}if(0<(f=0|St[(l=I)+4>>2])>>>0|(0==(0|f)?(0|St[l>>2])>>>0>(0|St[p>>2])>>>0:0)){q=15;break e}l=(0|St[h>>2])+((0|St[p>>2])-(0|St[I>>2]))|0,St[D>>2]=l,St[O>>2]=l,l=0|St[I>>2],St[P>>2]=l,St[M>>2]=l;break}}while(0);if(l=0|Te(0|St[_>>2],0|St[g>>2]),St[(f=T)>>2]=l,St[f+4>>2]=Ft,f=(0|St[_>>2])+(St[g>>2]<<3)|0,l=0|St[f+4>>2],St[(A=N)>>2]=St[f>>2],St[A+4>>2]=l,l=0|St[S>>2],f=T,s=0|Dt(0|St[(A=m)>>2],0|St[A+4>>2],0|St[f>>2],0|St[f+4>>2]),f=0|he(l,s,Ft),St[x>>2]=f,0|St[x>>2]){q=19;break e}if(f=8+(0|St[R>>2])|0,0==(0|St[f>>2])&0==(0|St[f+4>>2])){if(0|St[(f=N)+4>>2]||(0|St[f>>2])!=(0|St[P>>2])){q=22;break e}if(s=0|Ne(0|St[(f=N)>>2],0|St[f+4>>2],0|St[S>>2],0|St[D>>2],0|St[F>>2],0|St[w>>2]),St[B>>2]=s,0|St[B>>2]){q=24;break e}break}if(s=8+(0|St[R>>2])|0,f=0|St[R>>2],196865==(0|St[s>>2])&0==(0|St[s+4>>2])){if(l=0|function(e,r,t,n,i,o,a,u,s){e|=0,r|=0,t|=0,n|=0,i|=0,o|=0,a|=0,u|=0,s|=0;var f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0,R=0;(0|(pt=(f=pt)+192|0))>=(0|bt)&&yt(192);if(l=f+180|0,E=(d=f)+172|0,_=f+168|0,S=f+164|0,m=f+160|0,h=f+156|0,p=f+152|0,b=f+40|0,k=f+32|0,F=f+28|0,w=f+24|0,y=f+20|0,v=f+16|0,M=f+12|0,O=f+8|0,St[(c=f+176|0)>>2]=e,St[(e=d)>>2]=r,St[e+4>>2]=t,St[E>>2]=n,St[_>>2]=i,St[S>>2]=o,St[m>>2]=a,St[h>>2]=u,St[p>>2]=s,St[k>>2]=0,St[20+b>>2]=0,St[16+b>>2]=0,s=0|Ae(b,0|St[16+(0|St[c>>2])>>2],0|St[16+(0|St[c>>2])+4>>2],0|St[m>>2]),St[F>>2]=s,0|St[F>>2])return St[l>>2]=St[F>>2],A=0|St[l>>2],pt=f,0|A;St[20+b>>2]=St[_>>2],St[40+b>>2]=St[S>>2],ke(b),St[p>>2]=(0|St[p>>2])+(0|St[S>>2]);do{if(St[w>>2]=0,St[y>>2]=262144,(F=0|St[(_=d)+4>>2])>>>0<0|(0==(0|F)?(0|St[y>>2])>>>0>(0|St[_>>2])>>>0:0)&&(St[y>>2]=St[d>>2]),_=0|nr[15&St[St[E>>2]>>2]](0|St[E>>2],w,y),St[k>>2]=_,0|St[k>>2])break;if(St[v>>2]=St[y>>2],St[M>>2]=St[36+b>>2],_=0|Fe(b,0|St[S>>2],0|St[w>>2],v,1,O),St[k>>2]=_,St[y>>2]=(0|St[y>>2])-(0|St[v>>2]),F=0|Nt(0|St[(_=d)>>2],0|St[_+4>>2],0|St[v>>2],0),St[(_=d)>>2]=F,St[_+4>>2]=Ft,Q(2,(0|St[p>>2])-(0|St[S>>2])+(0|St[M>>2])|0,0|St[h>>2]),0|St[k>>2])break;if((0|St[36+b>>2])==(0|St[40+b>>2])){R=11;break}if(0==(0|St[v>>2])&&(0|St[M>>2])==(0|St[36+b>>2])){R=11;break}}while(_=0|sr[3&St[4+(0|St[E>>2])>>2]](0|St[E>>2],0|St[v>>2]),St[k>>2]=_,!(0|St[k>>2]));do{if(11==(0|R)){if(!(0|St[y>>2]||(0|St[40+b>>2])!=(0|St[S>>2]))&&!(1!=(0|St[O>>2])&4!=(0|St[O>>2])))break;St[k>>2]=1}}while(0);return Oe(b,0|St[m>>2]),St[l>>2]=St[k>>2],A=0|St[l>>2],pt=f,0|A}(f,0|St[(s=N)>>2],0|St[s+4>>2],0|St[S>>2],0|St[D>>2],0|St[P>>2],0|St[b>>2],0|St[F>>2],0|St[w>>2]),St[H>>2]=l,0|St[H>>2]){q=27;break e}break}if(!(33==(0|St[(l=f+8|0)>>2])&0==(0|St[l+4>>2]))){q=31;break e}if(l=N,f=0|function(e,r,t,n,i,o,a,u,s){e|=0,r|=0,t|=0,n|=0,i|=0,o|=0,a|=0,u|=0,s|=0;var f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0,R=0;(0|(pt=(f=pt)+208|0))>=(0|bt)&&yt(208);if(l=f+204|0,E=(d=f)+196|0,_=f+192|0,S=f+188|0,m=f+184|0,h=f+180|0,p=f+176|0,b=f+36|0,k=f+32|0,F=f+28|0,w=f+24|0,y=f+20|0,v=f+16|0,M=f+12|0,O=f+8|0,St[(c=f+200|0)>>2]=e,St[(e=d)>>2]=r,St[e+4>>2]=t,St[E>>2]=n,St[_>>2]=i,St[S>>2]=o,St[m>>2]=a,St[h>>2]=u,St[p>>2]=s,St[k>>2]=0,St[20+b>>2]=0,St[16+b>>2]=0,1!=(0|St[16+(0|St[c>>2])+4>>2]))return St[l>>2]=1,A=0|St[l>>2],pt=f,0|A;if(s=0|function(e,r,t){e|=0,r|=0,t|=0;var n=0,i=0,o=0,a=0,u=0,s=0,f=0,l=0;(0|(pt=(n=pt)+32|0))>=(0|bt)&&yt(32);return i=n+12|0,a=n+21|0,u=n+4|0,s=n+16|0,St[(o=(f=n)+8|0)>>2]=e,Et[a>>0]=r,St[u>>2]=t,t=0|function(e,r){e|=0,r|=0;var t=0,n=0,i=0,o=0,a=0,u=0,s=0;(0|(pt=(t=pt)+16|0))>=(0|bt)&&yt(16);if(n=t+8|0,o=t+4|0,Et[(i=(a=t)+12|0)>>0]=e,St[o>>2]=r,40<(0|mt[i>>0]))return St[n>>2]=4,u=0|St[n>>2],pt=t,0|u;s=40==(0|mt[i>>0])?-1:(2|1&(0|mt[i>>0]))<<11+((0|mt[i>>0])/2|0);return St[a>>2]=s,Et[St[o>>2]>>0]=4,Et[1+(0|St[o>>2])>>0]=St[a>>2],Et[2+(0|St[o>>2])>>0]=(0|St[a>>2])>>>8,Et[3+(0|St[o>>2])>>0]=(0|St[a>>2])>>>16,Et[4+(0|St[o>>2])>>0]=(0|St[a>>2])>>>24,St[n>>2]=0,u=0|St[n>>2],pt=t,0|u}(0|Et[a>>0],s),St[f>>2]=t,pt=(l=(0|St[f>>2]?St[i>>2]=St[f>>2]:(f=0|Ae(0|St[o>>2],s,5,0|St[u>>2]),St[i>>2]=f),0|St[i>>2]),n),0|l}(b,0|Et[St[16+(0|St[c>>2])>>2]>>0],0|St[m>>2]),St[F>>2]=s,0|St[F>>2])return St[l>>2]=St[F>>2],A=0|St[l>>2],pt=f,0|A;St[20+b>>2]=St[_>>2],St[40+b>>2]=St[S>>2],function(e){e|=0;var r=0,t=0;(0|(pt=(r=pt)+16|0))>=(0|bt)&&yt(16),St[(t=r)>>2]=e,St[120+(0|St[t>>2])>>2]=0,St[128+(0|St[t>>2])>>2]=1,St[132+(0|St[t>>2])>>2]=1,St[136+(0|St[t>>2])>>2]=1,ke(0|St[t>>2]),pt=r}(b),St[p>>2]=(0|St[p>>2])+(0|St[S>>2]);do{if(St[w>>2]=0,St[y>>2]=262144,(F=0|St[(_=d)+4>>2])>>>0<0|(0==(0|F)?(0|St[y>>2])>>>0>(0|St[_>>2])>>>0:0)&&(St[y>>2]=St[d>>2]),_=0|nr[15&St[St[E>>2]>>2]](0|St[E>>2],w,y),St[k>>2]=_,0|St[k>>2])break;if(St[v>>2]=St[y>>2],St[M>>2]=St[36+b>>2],_=0|function(e,r,t,n,i,o){e|=0,r|=0,t|=0,n|=0,i|=0,o|=0;var a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0;(0|(pt=(a=pt)+80|0))>=(0|bt)&&yt(80);u=a+72|0,f=a+64|0,l=a+60|0,c=a+56|0,d=a+52|0,E=a+48|0,_=a+44|0,S=a+40|0,m=a+36|0,h=a+32|0,p=a+28|0,b=a+24|0,k=a+20|0,F=a+16|0,w=a+12|0,y=a+8|0,v=a+4|0,St[(s=(M=a)+68|0)>>2]=e,St[f>>2]=r,St[l>>2]=t,St[c>>2]=n,St[d>>2]=i,St[E>>2]=o,St[_>>2]=St[St[c>>2]>>2],St[St[c>>2]>>2]=0,St[St[E>>2]>>2]=0;for(;;){if(8==(0|St[120+(0|St[s>>2])>>2])){O=49;break}if(St[S>>2]=St[36+(0|St[s>>2])>>2],9==(0|St[120+(0|St[s>>2])>>2])){O=4;break}if(0==(0|St[d>>2])&&(0|St[S>>2])==(0|St[f>>2])){O=6;break}if(6==(0|St[120+(0|St[s>>2])>>2])||7==(0|St[120+(0|St[s>>2])>>2]))if(St[m>>2]=(0|St[f>>2])-(0|St[S>>2]),St[h>>2]=(0|St[_>>2])-(0|St[St[c>>2]>>2]),((St[p>>2]=0)|St[116+(0|St[s>>2])>>2])>>>0<=(0|St[m>>2])>>>0&&(St[m>>2]=St[116+(0|St[s>>2])>>2],St[p>>2]=1),128&(0|mt[124+(0|St[s>>2])>>0])){if(6==(0|St[120+(0|St[s>>2])>>2])){if(St[w>>2]=(0|mt[124+(0|St[s>>2])>>0])>>5&3,St[y>>2]=3==(0|St[w>>2])&1,St[v>>2]=0<(0|St[w>>2])&1,0==(0|St[y>>2])&&0|St[128+(0|St[s>>2])>>2]){O=33;break}if(0==(0|St[v>>2])&&0|St[132+(0|St[s>>2])>>2]){O=33;break}be(0|St[s>>2],0|St[y>>2],0|St[v>>2]),St[128+(0|St[s>>2])>>2]=0,St[132+(0|St[s>>2])>>2]=0,St[120+(0|St[s>>2])>>2]=7}if((0|St[h>>2])>>>0>(0|St[112+(0|St[s>>2])>>2])>>>0&&(St[h>>2]=St[112+(0|St[s>>2])>>2]),n=0|Fe(0|St[s>>2],(0|St[S>>2])+(0|St[m>>2])|0,0|St[l>>2],h,0|St[p>>2],0|St[E>>2]),St[F>>2]=n,St[l>>2]=(0|St[l>>2])+(0|St[h>>2]),n=0|St[c>>2],St[n>>2]=(0|St[n>>2])+(0|St[h>>2]),n=112+(0|St[s>>2])|0,St[n>>2]=(0|St[n>>2])-(0|St[h>>2]),St[k>>2]=(0|St[36+(0|St[s>>2])>>2])-(0|St[S>>2]),n=116+(0|St[s>>2])|0,St[n>>2]=(0|St[n>>2])-(0|St[k>>2]),St[M>>2]=St[F>>2],0|St[M>>2]){O=38;break}if(3==(0|St[St[E>>2]>>2])){O=40;break}if(0==(0|St[h>>2])&0==(0|St[k>>2])){if(4!=(0|St[St[E>>2]>>2])){O=45;break}if(0|St[116+(0|St[s>>2])>>2]){O=45;break}if(0|St[112+(0|St[s>>2])>>2]){O=45;break}St[120+(0|St[s>>2])>>2]=0}4==(0|St[St[E>>2]>>2])&&(St[St[E>>2]>>2]=2)}else{if((0|St[St[c>>2]>>2])==(0|St[_>>2])){O=16;break}if(6==(0|St[120+(0|St[s>>2])>>2])){if(St[b>>2]=1==(0|mt[124+(0|St[s>>2])>>0])&1,n=0|St[s>>2],0|St[b>>2])St[n+132>>2]=1,St[136+(0|St[s>>2])>>2]=1;else if(0|St[n+128>>2]){O=21;break}be((St[128+(0|St[s>>2])>>2]=0)|St[s>>2],0|St[b>>2],0)}if((0|St[h>>2])>>>0>(0|St[m>>2])>>>0&&(St[h>>2]=St[m>>2]),!(0|St[h>>2])){O=26;break}!function(e,r,t){e|=0,r|=0,t|=0;var n=0,i=0,o=0,a=0;(0|(pt=(n=pt)+16|0))>=(0|bt)&&yt(16),o=n+4|0,St[(i=(a=n)+8|0)>>2]=e,St[o>>2]=r,St[a>>2]=t,Je((0|St[20+(0|St[i>>2])>>2])+(0|St[36+(0|St[i>>2])>>2])|0,0|St[o>>2],0|St[a>>2]),o=36+(0|St[i>>2])|0,St[o>>2]=(0|St[o>>2])+(0|St[a>>2]),0==(0|St[48+(0|St[i>>2])>>2])&&((0|St[12+(0|St[i>>2])>>2])-(0|St[44+(0|St[i>>2])>>2])|0)>>>0<=(0|St[a>>2])>>>0&&(St[48+(0|St[i>>2])>>2]=St[12+(0|St[i>>2])>>2]),o=44+(0|St[i>>2])|0,St[o>>2]=(0|St[o>>2])+(0|St[a>>2]),pt=n}(0|St[s>>2],0|St[l>>2],0|St[h>>2]),St[l>>2]=(0|St[l>>2])+(0|St[h>>2]),n=0|St[c>>2],St[n>>2]=(0|St[n>>2])+(0|St[h>>2]),n=116+(0|St[s>>2])|0,St[n>>2]=(0|St[n>>2])-(0|St[h>>2]),St[120+(0|St[s>>2])>>2]=0==(0|St[116+(0|St[s>>2])>>2])?0:7}else{if((0|St[St[c>>2]>>2])==(0|St[_>>2])){O=10;break}o=0|St[c>>2],St[o>>2]=1+(0|St[o>>2]),o=0|St[s>>2],i=0|St[l>>2],St[l>>2]=i+1,n=0|function(e,r){e|=0,r|=0;var t=0,n=0,i=0,o=0,a=0,u=0,s=0,f=0;(0|(pt=(t=pt)+32|0))>=(0|bt)&&yt(32);switch(n=t+12|0,o=t+16|0,a=t+4|0,St[(i=(u=t)+8|0)>>2]=e,Et[o>>0]=r,0|St[120+(0|St[i>>2])>>2]){case 0:if(Et[124+(0|St[i>>2])>>0]=0|Et[o>>0],!(0|mt[124+(0|St[i>>2])>>0]))return St[n>>2]=8,s=0|St[n>>2],pt=t,0|s;r=0|mt[124+(0|St[i>>2])>>0];do{if(!(128&(0|mt[124+(0|St[i>>2])>>0]))){if((127&r|0)<=2){St[116+(0|St[i>>2])>>2]=0;break}return St[n>>2]=9,s=0|St[n>>2],pt=t,0|s}}while(St[116+(0|St[i>>2])>>2]=(31&r)<<16,0);return St[n>>2]=1,s=0|St[n>>2],pt=t,0|s;case 1:return r=116+(0|St[i>>2])|0,St[r>>2]=St[r>>2]|(0|mt[o>>0])<<8,St[n>>2]=2,s=0|St[n>>2],pt=t,0|s;case 2:return r=116+(0|St[i>>2])|0,St[r>>2]=0|St[r>>2]|mt[o>>0],r=116+(0|St[i>>2])|0,St[r>>2]=1+(0|St[r>>2]),St[n>>2]=0==(128&(0|mt[124+(0|St[i>>2])>>0])|0)?6:3,s=0|St[n>>2],pt=t,0|s;case 3:return St[112+(0|St[i>>2])>>2]=(0|mt[o>>0])<<8,St[n>>2]=4,s=0|St[n>>2],pt=t,0|s;case 4:return r=112+(0|St[i>>2])|0,St[r>>2]=0|St[r>>2]|mt[o>>0],r=112+(0|St[i>>2])|0,St[r>>2]=1+(0|St[r>>2]),f=2<=((0|mt[124+(0|St[i>>2])>>0])>>5&3|0)?5:0|St[136+(0|St[i>>2])>>2]?9:6,St[n>>2]=f,s=0|St[n>>2],pt=t,0|s;case 5:return pt=(s=(225<=(0|mt[o>>0])?St[n>>2]=9:(St[a>>2]=(0|mt[o>>0])%9|0,Et[o>>0]=(0|mt[o>>0])/9|0,St[8+(0|St[i>>2])>>2]=(0|mt[o>>0])/5|0,St[u>>2]=(0|mt[o>>0])%5|0,4<((0|St[a>>2])+(0|St[u>>2])|0)?St[n>>2]=9:(St[St[i>>2]>>2]=St[a>>2],St[4+(0|St[i>>2])>>2]=St[u>>2],St[136+(0|St[i>>2])>>2]=0,St[n>>2]=6)),0|St[n>>2]),t),0|s;default:return St[n>>2]=9,s=0|St[n>>2],pt=t,0|s}return 0}(o,0|Et[i>>0]),St[120+(0|St[s>>2])>>2]=n}}switch(0|O){case 4:return St[u>>2]=1,A=0|St[u>>2],pt=a,0|A;case 6:return St[St[E>>2]>>2]=2,St[u>>2]=0,A=0|St[u>>2],pt=a,0|A;case 10:case 16:return St[St[E>>2]>>2]=3,St[u>>2]=0,A=0|St[u>>2],pt=a,0|A;case 21:case 26:case 33:return St[u>>2]=1,A=0|St[u>>2],pt=a,0|A;case 38:return St[u>>2]=St[M>>2],A=0|St[u>>2],pt=a,0|A;case 40:return St[u>>2]=St[F>>2],A=0|St[u>>2],pt=a,0|A;case 45:return St[u>>2]=1,A=0|St[u>>2],pt=a,0|A;case 49:return St[St[E>>2]>>2]=1,St[u>>2]=0,A=0|St[u>>2],pt=a,0|A}return 0}(b,0|St[S>>2],0|St[w>>2],v,1,O),St[k>>2]=_,St[y>>2]=(0|St[y>>2])-(0|St[v>>2]),F=0|Nt(0|St[(_=d)>>2],0|St[_+4>>2],0|St[v>>2],0),St[(_=d)>>2]=F,St[_+4>>2]=Ft,Q(2,(0|St[p>>2])-(0|St[S>>2])+(0|St[M>>2])|0,0|St[h>>2]),0|St[k>>2])break;if((0|St[36+b>>2])==(0|St[40+b>>2])){R=13;break}if(0==(0|St[v>>2])&&(0|St[M>>2])==(0|St[36+b>>2])){R=13;break}}while(_=0|sr[3&St[4+(0|St[E>>2])>>2]](0|St[E>>2],0|St[v>>2]),St[k>>2]=_,!(0|St[k>>2]));13==(0|R)&&(0|St[y>>2]?1:(0|St[40+b>>2])!=(0|St[S>>2]))|1!=(0|St[O>>2])&&(St[k>>2]=1);return Oe(b,0|St[m>>2]),St[l>>2]=St[k>>2],A=0|St[l>>2],pt=f,0|A}(0|St[R>>2],0|St[l>>2],0|St[l+4>>2],0|St[S>>2],0|St[D>>2],0|St[P>>2],0|St[b>>2],0|St[F>>2],0|St[w>>2]),St[U>>2]=f,0|St[U>>2]){q=30;break e}}else{if(f=8+(0|St[R>>2])|0,!(50528539==(0|St[f>>2])&0==(0|St[f+4>>2]))){if(1!=(0|St[y>>2])){q=47;break e}switch(f=8+(0|St[R>>2])|0,l=0|St[f+4>>2],0|St[f>>2]){case 50528515:if(0|l){q=53;break e}(function(e,r,t,n,i){e|=0,r|=0,t|=0,n|=0,i|=0;var o,a,u,s,f,l,c,d,E,_,S,m,h,p,b,k,F=0,w=0,y=pt;if((0|bt)<=(0|(pt=pt+64|0))&&yt(64),o=y+52|0,u=y+44|0,s=y+40|0,f=y+36|0,l=y+32|0,c=y+28|0,d=y+24|0,E=y+20|0,_=y+16|0,S=y+12|0,m=y+57|0,h=y+8|0,p=y+4|0,b=y+56|0,St[(a=(k=y)+48|0)>>2]=e,St[u>>2]=r,St[s>>2]=t,St[f>>2]=n,St[l>>2]=i,St[c>>2]=0,St[E>>2]=7&St[St[f>>2]>>2],(0|St[u>>2])>>>0<5)return St[o>>2]=0,St[o>>2],pt=y;St[s>>2]=5+(0|St[s>>2]),St[d>>2]=-1;t:for(;;){for(St[_>>2]=(0|St[a>>2])+(0|St[c>>2]),St[S>>2]=(0|St[a>>2])+(0|St[u>>2])-4;!((0|St[_>>2])>>>0>=(0|St[S>>2])>>>0)&&232!=(254&mt[St[_>>2]>>0]|0);)St[_>>2]=1+(0|St[_>>2]);if(St[c>>2]=(0|St[_>>2])-(0|St[a>>2]),i=(0|St[_>>2])>>>0>=(0|St[S>>2])>>>0,St[d>>2]=(0|St[c>>2])-(0|St[d>>2]),F=3<(0|St[d>>2])>>>0,i)break;do{if(F)St[E>>2]=0;else if(St[E>>2]=St[E>>2]<<(0|St[d>>2])-1&7,0|St[E>>2]){if(Et[m>>0]=0|Et[(0|St[_>>2])+(4-(0|mt[360+(0|St[E>>2])>>0]))>>0],0|Et[352+(0|St[E>>2])>>0]&&0|mt[m>>0]&&255!=(0|mt[m>>0]))break;St[d>>2]=St[c>>2],St[E>>2]=St[E>>2]<<1&7|1,St[c>>2]=1+(0|St[c>>2]);continue t}}while(0);if(St[d>>2]=St[c>>2],0|mt[4+(0|St[_>>2])>>0]&&255!=(0|mt[4+(0|St[_>>2])>>0]))St[E>>2]=St[E>>2]<<1&7|1,St[c>>2]=1+(0|St[c>>2]);else{for(St[h>>2]=mt[4+(0|St[_>>2])>>0]<<24|mt[3+(0|St[_>>2])>>0]<<16|mt[2+(0|St[_>>2])>>0]<<8|mt[1+(0|St[_>>2])>>0];0|St[l>>2]?St[p>>2]=(0|St[s>>2])+(0|St[c>>2])+(0|St[h>>2]):St[p>>2]=(0|St[h>>2])-((0|St[s>>2])+(0|St[c>>2])),0|St[E>>2]&&(St[k>>2]=mt[360+(0|St[E>>2])>>0]<<3,Et[b>>0]=(0|St[p>>2])>>>(24-(0|St[k>>2])|0),!(0|mt[b>>0]&&255!=(0|mt[b>>0])));)St[h>>2]=St[p>>2]^(1<<32-(0|St[k>>2]))-1;Et[4+(0|St[_>>2])>>0]=~(((0|St[p>>2])>>>24&1)-1),Et[3+(0|St[_>>2])>>0]=(0|St[p>>2])>>>16,Et[2+(0|St[_>>2])>>0]=(0|St[p>>2])>>>8,Et[1+(0|St[_>>2])>>0]=St[p>>2],St[c>>2]=5+(0|St[c>>2])}}w=F?0:St[E>>2]<<(0|St[d>>2])-1&7,St[St[f>>2]>>2]=w,St[o>>2]=St[c>>2],St[o>>2],pt=y})((St[X>>2]=0)|St[h>>2],0|St[p>>2],0,X,0);break r;case 50529537:if(0|l){q=53;break e}!function(e,r,t,n){e|=0,r|=0,t|=0,n|=0;var i,o,a,u,s,f,l,c,d=0,E=pt;if((0|bt)<=(0|(pt=pt+32|0))&&yt(32),i=E+28|0,a=E+20|0,u=E+16|0,s=E+12|0,f=E+8|0,l=E+4|0,St[(o=(c=E)+24|0)>>2]=e,St[a>>2]=r,St[u>>2]=t,St[s>>2]=n,(0|St[a>>2])>>>0<4)return St[i>>2]=0,St[i>>2],pt=E;for(St[a>>2]=(0|St[a>>2])-4,St[u>>2]=8+(0|St[u>>2]),St[f>>2]=0;d=0|St[f>>2],!((0|St[f>>2])>>>0>(0|St[a>>2])>>>0);)235==(0|mt[(0|St[o>>2])+(d+3)>>0])&&(St[c>>2]=(0|mt[(0|St[o>>2])+(2+(0|St[f>>2]))>>0])<<16|(0|mt[(0|St[o>>2])+(1+(0|St[f>>2]))>>0])<<8|0|mt[(0|St[o>>2])+(0|St[f>>2])>>0],St[c>>2]=St[c>>2]<<2,0|St[s>>2]?St[l>>2]=(0|St[u>>2])+(0|St[f>>2])+(0|St[c>>2]):St[l>>2]=(0|St[c>>2])-((0|St[u>>2])+(0|St[f>>2])),St[l>>2]=(0|St[l>>2])>>>2,Et[(0|St[o>>2])+(2+(0|St[f>>2]))>>0]=(0|St[l>>2])>>>16,Et[(0|St[o>>2])+(1+(0|St[f>>2]))>>0]=(0|St[l>>2])>>>8,Et[(0|St[o>>2])+(0|St[f>>2])>>0]=St[l>>2]),St[f>>2]=4+(0|St[f>>2]);St[i>>2]=d,St[i>>2],pt=E}(0|St[h>>2],0|St[p>>2],0,0);break r;default:q=53;break e}}if(l=0|Te(0|St[_>>2],1),St[(f=z)>>2]=l,St[f+4>>2]=Ft,f=8+(0|St[_>>2])|0,l=0|St[f+4>>2],St[(s=Y)>>2]=St[f>>2],St[s+4>>2]=l,3!=(0|St[y>>2])){q=34;break e}if(l=0|St[S>>2],f=z,A=0|Dt(0|St[(s=m)>>2],0|St[s+4>>2],0|St[f>>2],0|St[f+4>>2]),f=0|he(l,A,Ft),St[K>>2]=f,0|St[K>>2]){q=36;break e}if(St[8+v>>2]=St[Y>>2],0!=(0|St[(f=Y)+4>>2])||(0|St[8+v>>2])!=(0|St[f>>2])){q=38;break e}if(f=0|sr[3&St[St[b>>2]>>2]](0|St[b>>2],0|St[8+v>>2]),St[8+(0|St[k>>2])>>2]=f,0==(0|St[8+(0|St[k>>2])>>2])&&0|St[8+v>>2]){q=41;break e}if(A=0|Ne(0|St[(f=Y)>>2],0|St[f+4>>2],0|St[S>>2],0|St[8+(0|St[k>>2])>>2],0|St[F>>2],0|St[w>>2]),St[V>>2]=A,St[W>>2]=St[V>>2],0|St[W>>2]){q=43;break e}if(A=0|function(e,r,t,n,i,o,a,u,s,f){e|=0,r|=0,t|=0,n|=0,i|=0,o|=0,a|=0,u|=0,s|=0,f|=0;var l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0,R=0,g=0,T=0,N=0,D=0,P=0,C=0,I=0,L=0,x=0,B=0,H=0;(0|(pt=(l=pt)+624|0))>=(0|bt)&&yt(624);c=l+92|0,E=l+84|0,_=l+80|0,S=l+76|0,m=l+72|0,h=l+68|0,p=l+64|0,b=l+60|0,k=l+56|0,F=l+52|0,w=l+96|0,y=l+48|0,v=l+44|0,M=l+40|0,O=l+36|0,A=l+32|0,R=l+28|0,g=l+613|0,T=l+24|0,N=l+612|0,D=l+20|0,P=l+16|0,C=l+12|0,I=l+8|0,L=l+4|0,St[(d=(x=l)+88|0)>>2]=e,St[E>>2]=r,St[_>>2]=t,St[S>>2]=n,St[m>>2]=i,St[h>>2]=o,St[p>>2]=a,St[b>>2]=u,St[k>>2]=s,St[F>>2]=f,St[y>>2]=0,St[v>>2]=0,St[R>>2]=0,Et[g>>0]=0,St[T>>2]=0;for(;!(258<=(0|St[T>>2])>>>0);)_t[w+(St[T>>2]<<1)>>1]=1024,St[T>>2]=1+(0|St[T>>2]);St[M>>2]=St[p>>2],St[O>>2]=(0|St[M>>2])+(0|St[b>>2]),St[A>>2]=-1,St[T>>2]=0;for(;!(5<=(0|St[T>>2])>>>0);){if((0|St[M>>2])==(0|St[O>>2])){B=7;break}b=St[R>>2]<<8,p=0|St[M>>2],St[M>>2]=p+1,St[R>>2]=0|b|mt[p>>0],St[T>>2]=1+(0|St[T>>2])}if(7==(0|B))return St[c>>2]=1,H=0|St[c>>2],pt=l,0|H;if(!(0|St[F>>2]))return St[c>>2]=0,H=0|St[c>>2],pt=l,0|H;for(;;){for(St[I>>2]=(0|St[E>>2])-(0|St[y>>2]),((0|St[F>>2])-(0|St[v>>2])|0)>>>0<(0|St[I>>2])>>>0&&(St[I>>2]=(0|St[F>>2])-(0|St[v>>2]));0|St[I>>2]&&(Et[N>>0]=0|Et[(0|St[d>>2])+(0|St[y>>2])>>0],T=0|Et[N>>0],p=0|St[v>>2],St[v>>2]=p+1,Et[(0|St[k>>2])+p>>0]=T,232!=(254&(0|mt[N>>0])|0))&&(15!=(0|mt[g>>0])||128!=(240&(0|mt[N>>0])|0));)St[y>>2]=1+(0|St[y>>2]),Et[g>>0]=0|Et[N>>0],St[I>>2]=(0|St[I>>2])-1;if(!(0|St[I>>2])){B=46;break}if((0|St[v>>2])==(0|St[F>>2])){B=46;break}T=0|St[y>>2],St[y>>2]=T+1,Et[N>>0]=0|Et[(0|St[d>>2])+T>>0];do{if(232!=(0|mt[N>>0])){if(233==(0|mt[N>>0])){St[D>>2]=512+w;break}St[D>>2]=514+w;break}}while(St[D>>2]=w+((0|mt[g>>0])<<1),0);if(St[C>>2]=re[St[D>>2]>>1],T=0|wt((0|St[A>>2])>>>11,0|St[C>>2]),St[P>>2]=T,T=0|St[P>>2],(0|St[R>>2])>>>0<(0|St[P>>2])>>>0){if(St[A>>2]=T,_t[St[D>>2]>>1]=(0|St[C>>2])+((2048-(0|St[C>>2])|0)>>>5),(0|St[A>>2])>>>0<16777216){if((0|St[M>>2])==(0|St[O>>2])){B=28;break}St[A>>2]=St[A>>2]<<8,p=St[R>>2]<<8,b=0|St[M>>2],St[M>>2]=b+1,St[R>>2]=0|p|mt[b>>0]}Et[g>>0]=0|Et[N>>0]}else{if(St[A>>2]=(0|St[A>>2])-T,St[R>>2]=(0|St[R>>2])-(0|St[P>>2]),_t[St[D>>2]>>1]=(0|St[C>>2])-((0|St[C>>2])>>>5),(0|St[A>>2])>>>0<16777216){if((0|St[M>>2])==(0|St[O>>2])){B=33;break}St[A>>2]=St[A>>2]<<8,T=St[R>>2]<<8,b=0|St[M>>2],St[M>>2]=b+1,St[R>>2]=0|T|mt[b>>0]}if(232==(0|mt[N>>0])){if(St[x>>2]=St[_>>2],(0|St[S>>2])>>>0<4){B=37;break}St[_>>2]=4+(0|St[_>>2]),St[S>>2]=(0|St[S>>2])-4}else{if(St[x>>2]=St[m>>2],(0|St[h>>2])>>>0<4){B=40;break}St[m>>2]=4+(0|St[m>>2]),St[h>>2]=(0|St[h>>2])-4}if(St[L>>2]=((0|mt[St[x>>2]>>0])<<24|(0|mt[1+(0|St[x>>2])>>0])<<16|(0|mt[2+(0|St[x>>2])>>0])<<8|0|mt[3+(0|St[x>>2])>>0])-(4+(0|St[v>>2])),b=255&St[L>>2],T=0|St[v>>2],St[v>>2]=T+1,Et[(0|St[k>>2])+T>>0]=b,(0|St[v>>2])==(0|St[F>>2])){B=46;break}if(b=(0|St[L>>2])>>>8&255,T=0|St[v>>2],St[v>>2]=T+1,Et[(0|St[k>>2])+T>>0]=b,(0|St[v>>2])==(0|St[F>>2])){B=46;break}if(b=(0|St[L>>2])>>>16&255,T=0|St[v>>2],St[v>>2]=T+1,Et[(0|St[k>>2])+T>>0]=b,(0|St[v>>2])==(0|St[F>>2])){B=46;break}b=(0|St[L>>2])>>>24&255,Et[g>>0]=b,T=0|St[v>>2],St[v>>2]=T+1,Et[(0|St[k>>2])+T>>0]=b}}{if(28==(0|B))return St[c>>2]=1,H=0|St[c>>2],pt=l,0|H;if(33==(0|B))return St[c>>2]=1,H=0|St[c>>2],pt=l,0|H;if(37==(0|B))return St[c>>2]=1,H=0|St[c>>2],pt=l,0|H;if(40==(0|B))return St[c>>2]=1,H=0|St[c>>2],pt=l,0|H;if(46==(0|B))return St[c>>2]=(0|St[v>>2])==(0|St[F>>2])?0:1,H=0|St[c>>2],pt=l,0|H}return 0}(0|St[O>>2],0|St[M>>2],0|St[St[k>>2]>>2],0|St[v>>2],0|St[4+(0|St[k>>2])>>2],0|St[4+v>>2],0|St[8+(0|St[k>>2])>>2],0|St[8+v>>2],0|St[h>>2],0|St[p>>2]),St[V>>2]=A,St[j>>2]=St[V>>2],0|St[j>>2]){q=45;break e}}}while(0);St[y>>2]=1+(0|St[y>>2])}switch(0|q){case 9:case 11:return St[d>>2]=2,G=0|St[d>>2],pt=c,0|G;case 15:return St[d>>2]=5,G=0|St[d>>2],pt=c,0|G;case 17:return St[d>>2]=4,G=0|St[d>>2],pt=c,0|G;case 19:return St[d>>2]=St[x>>2],G=0|St[d>>2],pt=c,0|G;case 22:return St[d>>2]=1,G=0|St[d>>2],pt=c,0|G;case 24:return St[d>>2]=St[B>>2],G=0|St[d>>2],pt=c,0|G;case 27:return St[d>>2]=St[H>>2],G=0|St[d>>2],pt=c,0|G;case 30:return St[d>>2]=St[U>>2],G=0|St[d>>2],pt=c,0|G;case 31:case 34:return St[d>>2]=4,G=0|St[d>>2],pt=c,0|G;case 36:return St[d>>2]=St[K>>2],G=0|St[d>>2],pt=c,0|G;case 38:case 41:return St[d>>2]=2,G=0|St[d>>2],pt=c,0|G;case 43:return St[d>>2]=St[W>>2],G=0|St[d>>2],pt=c,0|G;case 45:return St[d>>2]=St[j>>2],G=0|St[d>>2],pt=c,0|G;case 47:case 53:return St[d>>2]=4,G=0|St[d>>2],pt=c,0|G;case 55:return St[d>>2]=0,G=0|St[d>>2],pt=c,0|G}return 0}(0|St[l>>2],0|St[c>>2],0|St[d>>2],0|St[f>>2],0|St[f+4>>2],0|St[_>>2],0|St[S>>2],0|St[m>>2],b,0|St[h>>2],0|St[p>>2]),St[F>>2]=E,St[k>>2]=0;!(3<=(0|St[k>>2]));)or[3&St[4+(0|St[m>>2])>>2]](0|St[m>>2],0|St[b+(St[k>>2]<<2)>>2]),St[k>>2]=1+(0|St[k>>2]);return pt=w,0|St[F>>2]}function ge(e){e|=0;var r,t,n=0,i=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),r=i+4|0,St[(t=i)>>2]=e,e=0|St[t>>2];e:do{if(33<=(0|e)){if((0|e)<196865){if(33==(0|e)){n=2;break e}n=3;break e}if(196865==(0|e)){n=2;break e}n=3;break e}}while(n=0==(0|e)?2:3,0);return 2==(0|n)?St[r>>2]=1:3==(0|n)&&(St[r>>2]=0),pt=i,0|St[r>>2]}function Te(e,r){e|=0,r|=0;var t,n,i,o,a=0,u=pt;for((0|bt)<=(0|(pt=pt+32|0))&&yt(32),n=u+12|0,a=(i=u)+8|0,St[(t=u+16|0)>>2]=e,St[n>>2]=r,St[(r=i)>>2]=0,St[r+4>>2]=0,St[a>>2]=0;!((0|St[a>>2])>>>0>=(0|St[n>>2])>>>0);)r=(0|St[t>>2])+(St[a>>2]<<3)|0,o=0|Dt(0|St[(e=i)>>2],0|St[e+4>>2],0|St[r>>2],0|St[r+4>>2]),St[(r=i)>>2]=o,St[r+4>>2]=Ft,St[a>>2]=1+(0|St[a>>2]);return Ft=0|St[(a=i)+4>>2],pt=u,0|St[a>>2]}function Ne(e,r,t,n,i,o){e|=0,r|=0,t|=0,n|=0,i|=0,o|=0;var a,u,s,f,l,c,d,E,_,S,m=0,h=0,p=pt;for((0|bt)<=(0|(pt=pt+48|0))&&yt(48),a=p+40|0,s=(u=p)+36|0,f=p+32|0,l=p+28|0,c=p+20|0,d=p+16|0,E=p+12|0,_=p+8|0,St[(S=u)>>2]=e,St[S+4>>2]=r,St[s>>2]=t,St[f>>2]=n,St[l>>2]=i,St[p+24>>2]=o;;){if(!(0<(i=0|St[(o=u)+4>>2])>>>0|0==(0|i)&0<(0|St[o>>2])>>>0)){m=11;break}if(St[d>>2]=262144,(i=0|St[(o=u)+4>>2])>>>0<0|(0==(0|i)?(0|St[d>>2])>>>0>(0|St[o>>2])>>>0:0)&&(St[d>>2]=St[u>>2]),o=0|nr[15&St[St[s>>2]>>2]](0|St[s>>2],c,d),St[E>>2]=o,0|St[E>>2]){m=6;break}if(!(0|St[d>>2])){m=8;break}if(Je(0|St[f>>2],0|St[c>>2],0|St[d>>2]),St[f>>2]=(0|St[f>>2])+(0|St[d>>2]),i=0|Nt(0|St[(o=u)>>2],0|St[o+4>>2],0|St[d>>2],0),St[(o=u)>>2]=i,St[o+4>>2]=Ft,Q(2,0|St[d>>2],0|St[l>>2]),o=0|sr[3&St[4+(0|St[s>>2])>>2]](0|St[s>>2],0|St[d>>2]),St[_>>2]=o,0|St[_>>2]){m=10;break}}return 6==(0|m)?(St[a>>2]=St[E>>2],h=0|St[a>>2],pt=p,0|h):8==(0|m)?(St[a>>2]=6,h=0|St[a>>2],pt=p,0|h):10==(0|m)?(St[a>>2]=St[_>>2],h=0|St[a>>2],pt=p,0|h):11==(0|m)?(h=(St[a>>2]=0)|St[a>>2],pt=p,0|h):0}function De(e){e|=0;var r,t,n=0,i=pt;return(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(r=i)>>2]=e,1!=(0|St[St[r>>2]>>2])||1!=(0|St[4+(0|St[r>>2])>>2])?(pt=i,(n=0)|1&n):(e=8+(0|St[r>>2])|0,(t=0|St[e+4>>2])>>>0<0|0==(0|t)&(0|St[e>>2])>>>0<=4294967295?(n=0!=(0|ge(0|St[8+(0|St[r>>2])>>2])),pt=i,0|1&n):(pt=i,(n=0)|1&n))}function Pe(e,r){e|=0,r|=0;var t,n,i=pt;return(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(t=(n=i)+4|0)>>2]=e,St[n>>2]=r,r=~(0|ur[1&St[2761]](-1,0|St[t>>2],0|St[n>>2],2852)),pt=i,0|r}function Ce(e){e|=0;var r,t=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(r=t)>>2]=e,St[St[r>>2]>>2]=0,St[4+(0|St[r>>2])>>2]=0,pt=t}function Ie(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u=0,s=pt;return(0|bt)<=(0|(pt=pt+16|0))&&yt(16),n=s+12|0,o=s+4|0,St[(i=(a=s)+8|0)>>2]=e,St[o>>2]=r,St[a>>2]=t,pt=(u=(St[4+(0|St[i>>2])>>2]=0)|St[o>>2]?(t=0|sr[3&St[St[a>>2]>>2]](0|St[a>>2],0|St[o>>2]),St[St[i>>2]>>2]=t,0|St[St[i>>2]>>2]?(St[4+(0|St[i>>2])>>2]=St[o>>2],St[n>>2]=1,0|St[n>>2]):(St[n>>2]=0)|St[n>>2]):(St[St[i>>2]>>2]=0,St[n>>2]=1,0|St[n>>2]),s),0|u}function Le(e,r){e|=0,r|=0;var t,n,i=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(t=(n=i)+4|0)>>2]=e,St[n>>2]=r,or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[St[t>>2]>>2]),St[St[t>>2]>>2]=0,St[4+(0|St[t>>2])>>2]=0,pt=i}function xe(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u,s,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=pt;for((0|bt)<=(0|(pt=pt+48|0))&&yt(48),n=F+16|0,f=(i=F)+32|0,l=0|St[(o=e+28|0)>>2],St[f>>2]=l,c=(0|St[(a=e+20|0)>>2])-l|0,St[f+4>>2]=c,St[f+8>>2]=r,r=e+60|0,l=e+44|0,E=c+(St[f+12>>(d=2)]=t)|0,c=f;;){if((0|E)==(0|(_=0|St[2762]?(g(1,0|e),St[i>>2]=St[r>>2],St[i+4>>2]=c,St[i+8>>2]=d,f=0|Be(0|A(146,0|i)),v(0),f):(St[n>>2]=St[r>>2],St[4+n>>2]=c,St[8+n>>2]=d,0|Be(0|A(146,0|n)))))){S=6;break}if((0|_)<0){S=8;break}f=E-_|0,b=_>>>0<=(u=0|St[c+4>>2])>>>0?(p=(h=2==(0|d)?(St[o>>2]=(0|St[o>>2])+_,m=_,2):(m=_,d),c),u):(s=0|St[l>>2],St[o>>2]=s,St[a>>2]=s,m=_-u|0,h=d+-1|0,p=c+8|0,0|St[c+12>>2]),St[p>>2]=(0|St[p>>2])+m,St[p+4>>2]=b-m,d=h,E=f,c=p}return 6==(0|S)?(p=0|St[l>>2],St[e+16>>2]=p+(0|St[e+48>>2]),l=p,St[o>>2]=l,St[a>>2]=l,k=t):8==(0|S)&&(St[e+16>>2]=0,St[o>>2]=0,St[a>>2]=0,St[e>>2]=32|St[e>>2],k=2==(0|d)?0:t-(0|St[c+4>>2])|0),pt=F,0|k}function Be(e){var r;return 0|(4294963200<(e|=0)>>>0?(r=0|vt(),St[r>>2]=0-e,-1):e)}function vt(){return 0|(0|St[2762]?0|St[16]:11092)}function He(){0}function Ue(e,r,t,n,i){e|=0,r|=0,t|=0,n|=0,i|=0;var o,a,u,s,f,l,c,d,E,_,S,m,h,p,b,k,F,w,y,v,M,O,A,R,g,T,N=0,D=0,P=0,C=0,I=0,L=0,x=0,B=0,H=0,U=0,z=0,Y=0,V=0,K=0,W=0,j=0,X=0,G=0,q=0,Q=0,Z=0,J=0,$=0,ee=0,re=0,te=0,ne=0,ie=0,oe=0,ae=0,ue=0,se=0,fe=0,le=0,ce=0,de=0,Ee=0,_e=0,Se=0,me=0,he=0,pe=0,be=0,ke=0,Fe=0,we=0,ye=0,ve=0,Me=0,Oe=0,Ae=0,Re=0,ge=0,Te=0,Ne=0,De=0,Pe=0,Ce=0,Ie=0,Le=0,xe=0,Be=0,He=0,Ue=0,ze=0,Ye=0,Ve=0,Ke=0,We=0,je=0,Xe=0,Ge=0,qe=0,Qe=0,Ze=0,Je=0,$e=0,er=0,rr=0,tr=0,nr=0,ir=0,or=0,ar=0,ur=0,sr=0,fr=0,lr=0,cr=0,dr=0,Er=0,_r=0,Sr=0,mr=0,hr=0,pr=0,br=0,kr=0,Fr=0,wr=0,yr=0,vr=0,Mr=0,Or=0,Ar=0,Rr=0,gr=0,Tr=0,Nr=0,Dr=0,Pr=0,Cr=0,Ir=0,Lr=0,xr=0,Br=0,Hr=0,Ur=0,zr=0,Yr=0,Vr=0,Kr=0,Wr=0,jr=0,Xr=0,Gr=0,qr=0,Qr=0,Zr=0,Jr=0,$r=0,et=0,rt=0,tt=0,nt=0,it=0,ot=0,at=0,ut=0,st=0,ft=0,lt=0,ct=0,dt=pt;(0|bt)<=(0|(pt=pt+624|0))&&yt(624),a=dt+16|0,d=(f=dt)+528|0,E=0!=(0|e),S=_=40+(l=dt+536|0)|0,m=39+l|0,l=4+(c=dt+8|0)|0,p=0-(h=u=dt+588|0)|0,k=11+(s=dt+576|0)|0,F=(s=b=12+s|0)-h|0,w=-2-h|0,y=2+s|0,v=288+(o=dt+24|0)|0,O=M=9+u|0,A=8+u|0,P=D=N=0,C=r;e:for(;;){do{if(-1<(0|D)){if((2147483647-D|0)<(0|N)){r=0|vt(),St[r>>2]=75,I=-1;break}I=N+D|0;break}}while(I=D,0);if(!((r=0|Et[C>>0])<<24>>24)){L=243;break}x=C,B=r;r:for(;;){switch(B<<24>>24){case 37:U=H=x,L=9;break r;case 0:Y=z=x;break r}B=0|Et[(x=r=x+1|0)>>0]}r:do{if(9==(0|L))for(;;){if(37!=((L=0)|Et[U+1>>0])){z=H,Y=U;break r}if(r=H+1|0,37!=(0|Et[(V=U+2|0)>>0])){z=r,Y=V;break}H=r,U=V,L=9}}while(0);if(V=z-C|0,E&&0==(32&St[e>>2]|0)&&Mt(C,V,e),0|V)N=V,D=I,C=Y;else{Q=(K=((r=0|Et[(V=Y+1|0)>>0])<<24>>24)-48|0)>>>0<10?(X=(W=36==(0|Et[Y+2>>0]))?K:-1,G=W?1:P,q=0|Et[(j=W?Y+3|0:V)>>0],j):(X=-1,G=P,q=r,V),V=(q<<24>>24)-32|0;r:do{if(V>>>0<32)for(r=0,j=V,W=q,K=Q;;){if(!(1<>24)-32|r,32<=(j=((te=0|Et[(re=K+1|0)>>0])<<24>>24)-32|0)>>>0){Z=ee,J=te,$=re;break}r=ee,W=te,K=re}else Z=0,J=q,$=Q}while(0);do{if(J<<24>>24!=42)if((V=(J<<24>>24)-48|0)>>>0<10){for(K=0,W=$,r=V;K=(10*K|0)+r|0,r=((ne=0|Et[(W=W+1|0)>>0])<<24>>24)-48|0,r>>>0<10;);if((0|K)<0){ie=-1;break e}oe=K,ae=Z,ue=G,se=W,fe=ne}else oe=0,ae=Z,ue=G,se=$,fe=J;else{if((j=((V=0|Et[(r=$+1|0)>>0])<<24>>24)-48|0)>>>0<10&&36==(0|Et[$+2>>0]))St[i+(j<<2)>>2]=10,le=0|St[n+((0|Et[r>>0])-48<<3)>>2],ce=1,de=$+3|0;else{if(0|G){ie=-1;break e}if(!E){ae=Z,ue=oe=0,se=r,fe=V;break}V=3+(0|St[t>>2])&-4,j=0|St[V>>2],St[t>>2]=V+4,le=j,ce=0,de=r}oe=(r=(0|le)<0)?0-le|0:le,ae=r?8192|Z:Z,ue=ce,fe=0|Et[(se=de)>>0]}}while(0);r:do{if(fe<<24>>24==46){if((j=0|Et[(r=se+1|0)>>0])<<24>>24!=42){if(!((V=(j<<24>>24)-48|0)>>>0<10)){me=0,he=r;break}for(Ee=0,_e=r,Se=V;;){if(r=(10*Ee|0)+Se|0,10<=(Se=(0|Et[(V=_e+1|0)>>0])-48|0)>>>0){me=r,he=V;break r}Ee=r,_e=V}}if((K=(0|Et[(W=se+2|0)>>0])-48|0)>>>0<10&&36==(0|Et[se+3>>0])){St[i+(K<<2)>>2]=10,me=0|St[n+((0|Et[W>>0])-48<<3)>>2],he=se+4|0;break}if(0|ue){ie=-1;break e}he=(me=E?(K=3+(0|St[t>>2])&-4,V=0|St[K>>2],St[t>>2]=K+4,V):0,W)}else me=-1,he=se}while(0);for(W=0,V=he;;){if(57<(K=(0|Et[V>>0])-65|0)>>>0){ie=-1;break e}if(pe=V+1|0,!(((ke=255&(be=0|Et[419+(58*W|0)+K>>0]))+-1|0)>>>0<8))break;W=ke,V=pe}if(!(be<<24>>24)){ie=-1;break}K=-1<(0|X);do{if(be<<24>>24==19){if(K){ie=-1;break e}L=51}else{if(K){St[i+(X<<2)>>2]=ke,j=0|St[(r=n+(X<<3)|0)+4>>2],St[(re=f)>>2]=St[r>>2],St[re+4>>2]=j,L=51;break}if(!E){ie=0;break e}Ot(f,ke,t)}}while(0);if(51!=(0|L)||(L=0,E)){j=0!=(0|W)&3==(15&(K=0|Et[V>>0])|0)?-33&K:K,K=-65537&ae,re=0==(8192&ae|0)?ae:K;r:do{switch(0|j){case 110:switch((255&W)<<24>>24){case 0:case 1:N=0,D=St[St[f>>2]>>2]=I,P=ue,C=pe;continue e;case 2:r=0|St[f>>2],St[r>>2]=I,St[r+4>>2]=((0|I)<0)<<31>>31,N=0,D=I,P=ue,C=pe;continue e;case 3:N=0,D=_t[St[f>>2]>>1]=I,P=ue,C=pe;continue e;case 4:N=0,D=Et[St[f>>2]>>0]=I,P=ue,C=pe;continue e;case 6:N=0,D=St[St[f>>2]>>2]=I,P=ue,C=pe;continue e;case 7:r=0|St[f>>2],St[r>>2]=I,St[r+4>>2]=((0|I)<0)<<31>>31,N=0,D=I,P=ue,C=pe;continue e;default:N=0,D=I,P=ue,C=pe;continue e}break;case 112:Fe=120,we=8>>0?me:8,ye=8|re,L=63;break;case 88:case 120:Fe=j,we=me,ye=re,L=63;break;case 111:if(0==(0|(te=0|St[(r=f)>>2]))&0==(0|(ee=0|St[r+4>>2])))ve=_;else for(r=_,Me=te,te=ee;;){if(Et[(ee=r+-1|0)>>0]=7&Me|48,0==(0|(Me=0|Ct(0|Me,0|te,3)))&0==(0|(te=Ft))){ve=ee;break}r=ee}L=(Te=(ge=8&re?(Re=899,((Ae=0)|(r=S-(Oe=ve)|0))<(0|me)?me:r+1|0):(Oe=ve,Ae=0,Re=899,me),re),76);break;case 105:case 100:if(te=0|St[(r=f)>>2],(0|(Me=0|St[r+4>>2]))<0){r=0|Nt(0,0,0|te,0|Me),ee=Ft,De=1,Pe=899,Ce=St[(Ne=f)>>2]=r,Ie=St[Ne+4>>2]=ee,L=75;break r}L=(Ie=(Ce=(Pe=2048&re?(De=1,900):0==(0|(De=ee=1&re))?899:901,te),Me),75);break;case 117:Pe=899,Ce=(De=0)|St[(Me=f)>>2],Ie=0|St[Me+4>>2],L=75;break;case 99:Et[m>>0]=St[f>>2],Le=m,xe=0,Be=899,He=_,Ue=1,ze=K;break;case 109:Me=0|vt(),Ye=0|function(e){e|=0;var r=0,t=0,n=0,i=0,o=0,a=0;r=0;for(;;){if((0|mt[953+r>>0])==(0|e)){t=2;break}if(87==(0|(n=r+1|0))){i=1041,o=87,t=5;break}r=n}2==(0|t)&&(r?(i=1041,o=r,t=5):a=1041);if(5==(0|t))for(;;){for(t=0,r=i;r=(e=r)+1|0,0!=(0|Et[e>>0]););if(!(o=o+-1|0)){a=r;break}i=r,t=5}return 0|a}(0|St[Me>>2]),L=81;break;case 115:Ye=0|(Me=0|St[f>>2])?Me:909,L=81;break;case 67:St[c>>2]=St[f>>2],St[l>>2]=0,Ve=-1,Ke=St[f>>2]=c,L=85;break;case 83:Me=0|St[f>>2],L=me?(Ve=me,Ke=Me,85):(gt(e,32,oe,0,re),We=0,96);break;case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:je=+ht[f>>3],St[a>>2]=0,ht[kt>>3]=je,qe=0<=(0|St[kt+4>>2])?(Me=1&re,2048&re?(Xe=je,Ge=1,919):(Xe=je,0==(0|(Ge=Me))?917:922)):(Xe=-je,Ge=1,916),ht[kt>>3]=Xe,Me=2146435072&St[kt+4>>2];do{if(Me>>>0<2146435072|2146435072==(0|Me)&!1){if((te=0!=(je=2*(T=a,+ + +function e(r,t){r=+r;t|=0;var n=0,i=0,o=0,a=0,u=0,s=0,f=0;ht[kt>>3]=r;n=0|St[kt>>2];i=0|St[kt+4>>2];o=0|Ct(0|n,0|i,52);switch(2047&o){case 0:s=0!=r?(a=+e(0x10000000000000000*r,t),u=a,(0|St[t>>2])-64|0):(u=r,0),St[t>>2]=s,f=u;break;case 2047:f=r;break;default:St[t>>2]=(2047&o)-1022,St[kt>>2]=n,St[kt+4>>2]=-2146435073&i|1071644672,f=+ht[kt>>3]}return+f}(+Xe,T|=0))))&&(St[a>>2]=(0|St[a>>2])-1),97==(0|(ee=32|j))){Ne=0==(0|(r=32&j))?qe:qe+9|0,Qe=2|Ge,Ze=12-me|0;do{if(!(11>>0|0==(0|Ze))){for(Je=8,$e=Ze;$e=$e+-1|0,Je*=16,0!=(0|$e););if(45==(0|Et[Ne>>0])){er=-(Je+(-je-Je));break}er=je+Je-Je;break}}while(er=je,0);for(tr=(0|(rr=0|At($e=(0|(Ze=0|St[a>>2]))<0?0-Ze|0:Ze,((0|$e)<0)<<31>>31,b)))==(0|b)?(Et[k>>0]=48,k):rr,Et[tr+-1>>0]=43+(Ze>>31&2),Et[(Ze=tr+-2|0)>>0]=j+15,rr=(0|me)<1,$e=0==(8&re|0),nr=u,ir=er;;){or=~~ir,ar=nr+1|0,Et[nr>>0]=mt[883+or>>0]|r,ir=16*(ir-(0|or));do{if(1==(ar-h|0)){if($e&rr&0==ir){ur=ar;break}Et[ar>>0]=46,ur=nr+2|0}else ur=ar}while(0);if(0==ir)break;nr=ur}rr=Ze,gt(e,32,oe,r=($e=0!=(0|me)&(w+(nr=ur)|0)<(0|me)?y+me-rr|0:F-rr+nr|0)+Qe|0,re),32&St[e>>2]||Mt(Ne,Qe,e),gt(e,48,oe,r,65536^re),ar=nr-h|0,32&St[e>>2]||Mt(u,ar,e),gt(e,48,$e-(ar+(nr=s-rr|0))|0,0,0),32&St[e>>2]||Mt(Ze,nr,e),gt(e,32,oe,r,8192^re),sr=(0|r)<(0|oe)?oe:r;break}for(r=(0|me)<0?6:me,lr=te?(nr=(0|St[a>>2])-28|0,fr=268435456*je,St[a>>2]=nr):(fr=je,0|St[a>>2]),nr=(0|lr)<0?o:v,ar=nr,ir=fr;$e=~~ir>>>0,St[ar>>2]=$e,ar=ar+4|0,ir=1e9*(ir-($e>>>0)),0!=ir;);if(0<(0|lr))for(te=nr,Ze=ar,Qe=lr;;){Ne=29<(0|Qe)?29:Qe,$e=Ze+-4|0;do{if($e>>>0>>0)cr=te;else{for(rr=$e,or=0;_r=0|xt(0|(Er=0|Dt(0|(dr=0|It(0|St[rr>>2],0,0|Ne)),0|Ft,0|or,0)),0|(dr=Ft),1e9,0),St[rr>>2]=_r,or=0|Lt(0|Er,0|dr,1e9,0),rr=rr+-4|0,te>>>0<=rr>>>0;);if(!or){cr=te;break}St[(rr=te+-4|0)>>2]=or,cr=rr}}while(0);for($e=Ze;!($e>>>0<=cr>>>0||0|St[(rr=$e+-4|0)>>2]);)$e=rr;if(rr=(0|St[a>>2])-Ne|0,!(0<(0|(St[a>>2]=rr)))){Sr=cr,mr=$e,hr=rr;break}te=cr,Ze=$e,Qe=rr}else Sr=nr,mr=ar,hr=lr;if((0|hr)<0)for(Qe=1+((r+25|0)/9|0)|0,Ze=102==(0|ee),te=Sr,rr=mr,dr=hr;;){_r=9<(0|(Er=0-dr|0))?9:Er;do{if(te>>>0>>0){for(Er=(1<<_r)-1|0,R=1e9>>>_r,pr=0,br=te;g=0|St[br>>2],St[br>>2]=(g>>>_r)+pr,pr=0|wt(g&Er,R),br=br+4|0,br>>>0>>0;);if(br=0==(0|St[te>>2])?te+4|0:te,!pr){kr=br,Fr=rr;break}St[rr>>2]=pr,kr=br,Fr=rr+4|0}else kr=0==(0|St[te>>2])?te+4|0:te,Fr=rr}while(0);if(Ne=(0|Qe)<(Fr-($e=Ze?nr:kr)>>2|0)?$e+(Qe<<2)|0:Fr,dr=(0|St[a>>2])+_r|0,0<=(0|(St[a>>2]=dr))){wr=kr,yr=Ne;break}te=kr,rr=Ne}else wr=Sr,yr=mr;rr=nr;do{if(wr>>>0>>0){if(te=9*(rr-wr>>2)|0,(dr=0|St[wr>>2])>>>0<10){vr=te;break}for(Mr=te,Or=10;;){if(te=Mr+1|0,dr>>>0<(Or=10*Or|0)>>>0){vr=te;break}Mr=te}}else vr=0}while(0);if((0|(te=r-(102!=(0|ee)?vr:0)+(((_r=0!=(0|r))&(dr=103==(0|ee)))<<31>>31)|0))<((9*(yr-rr>>2)|0)-9|0)){if(te=nr+4+(((0|(Qe=te+9216|0))/9|0)-1024<<2)|0,(0|(Ze=1+((0|Qe)%9|0)|0))<9)for(Qe=Ze,Ze=10;;){if(ar=10*Ze|0,9==(0|(Qe=Qe+1|0))){Ar=ar;break}Ze=ar}else Ar=10;Qe=((Ze=0|St[te>>2])>>>0)%(Ar>>>0)|0,ee=(te+4|0)==(0|yr);do{if(ee&0==(0|Qe))Rr=te,gr=vr,Tr=wr;else{ir=0==(1&((Ze>>>0)/(Ar>>>0)|0)|0)?9007199254740992:9007199254740994,Nr=Qe>>>0<(ar=(0|Ar)/2|0)>>>0?.5:ee&(0|Qe)==(0|ar)?1:1.5;do{if(Ge){if(45!=(0|Et[qe>>0])){Dr=Nr,Pr=ir;break}Dr=-Nr,Pr=-ir}else Dr=Nr,Pr=ir}while(0);if(ar=Ze-Qe|0,St[te>>2]=ar,Pr+Dr==Pr){Rr=te,gr=vr,Tr=wr;break}if(Ne=ar+Ar|0,999999999<(St[te>>2]=Ne)>>>0)for(Ne=te,ar=wr;;){if(Cr=($e=Ne+-4|0)>>>(St[Ne>>2]=0)>>0?(St[(br=ar+-4|0)>>2]=0,br):ar,br=1+(0|St[$e>>2])|0,!(999999999<(St[$e>>2]=br)>>>0)){Ir=$e,Lr=Cr;break}Ne=$e,ar=Cr}else Ir=te,Lr=wr;if(ar=9*(rr-Lr>>2)|0,(Ne=0|St[Lr>>2])>>>0<10){Rr=Ir,gr=ar,Tr=Lr;break}for(xr=ar,Br=10;;){if(ar=xr+1|0,Ne>>>0<(Br=10*Br|0)>>>0){Rr=Ir,gr=ar,Tr=Lr;break}xr=ar}}}while(0);Hr=gr,Ur=(te=Rr+4|0)>>>0>>0?te:yr,zr=Tr}else Hr=vr,Ur=yr,zr=wr;for(te=0-Hr|0,Qe=Ur;;){if(Qe>>>0<=zr>>>0){Yr=0;break}if(0|St[(Ze=Qe+-4|0)>>2]){Yr=1;break}Qe=Ze}do{if(dr){if(Kr=(0|Hr)<(0|(Ze=(1&_r^1)+r|0))&-5<(0|Hr)?(Vr=j+-1|0,Ze+-1-Hr|0):(Vr=j+-2|0,Ze+-1|0),0|(Ze=8&re)){Wr=Vr,jr=Kr,Xr=Ze;break}do{if(Yr){if(!(Ze=0|St[Qe+-4>>2])){Gr=9;break}if((Ze>>>0)%10|0){Gr=0;break}for(qr=0,Qr=10;;){if(ee=qr+1|0,(Ze>>>0)%((Qr=10*Qr|0)>>>0)|0){Gr=ee;break}qr=ee}}else Gr=9}while(0);if(Ze=(9*(Qe-rr>>2)|0)-9|0,102==(32|Vr)){Wr=Vr,jr=(0|Kr)<(0|(ee=(0|(pr=Ze-Gr|0))<0?0:pr))?Kr:ee,Xr=0;break}Wr=Vr,jr=(0|Kr)<(0|(Ze=(0|(ee=Ze+Hr-Gr|0))<0?0:ee))?Kr:Ze,Xr=0;break}}while(Wr=j,jr=r,Xr=8&re,0);if(rr=0!=(0|(r=jr|Xr))&1,_r=102==(32|Wr))Jr=(Zr=0)<(0|Hr)?Hr:0;else{if((s-(Ze=0|At(dr=(0|Hr)<0?te:Hr,((0|dr)<0)<<31>>31,b))|0)<2)for(dr=Ze;;){if(Et[(ee=dr+-1|0)>>0]=48,!((s-ee|0)<2)){$r=ee;break}dr=ee}else $r=Ze;Et[$r+-1>>0]=43+(Hr>>31&2),Et[(dr=$r+-2|0)>>0]=Wr,Jr=s-(Zr=dr)|0}gt(e,32,oe,dr=Ge+1+jr+rr+Jr|0,re),32&St[e>>2]||Mt(qe,Ge,e),gt(e,48,oe,dr,65536^re);do{if(_r){ee=te=nr>>>0>>0?nr:zr;do{pr=0|At(0|St[ee>>2],0,M);do{if((0|ee)==(0|te)){if((0|pr)!=(0|M)){et=pr;break}Et[A>>0]=48,et=A}else{if(pr>>>0<=u>>>0){et=pr;break}for(Pt(0|u,48,pr-h|0),Ne=pr;;){if(!(u>>>0<(ar=Ne+-1|0)>>>0)){et=ar;break}Ne=ar}}}while(0)}while(32&St[e>>2]||Mt(et,O-et|0,e),(ee=ee+4|0)>>>0<=nr>>>0);do{if(0|r){if(32&St[e>>2]|0)break;Mt(951,1,e)}}while(0);if(0<(0|jr)&ee>>>0>>0)for(te=jr,pr=ee;;){if(u>>>0<(Ne=0|At(0|St[pr>>2],0,M))>>>0)for(Pt(0|u,48,Ne-h|0),ar=Ne;;){if(!(u>>>0<($e=ar+-1|0)>>>0)){rt=$e;break}ar=$e}else rt=Ne;if(32&St[e>>2]||Mt(rt,9<(0|te)?9:te,e),ar=te+-9|0,!(9<(0|te)&(pr=pr+4|0)>>>0>>0)){tt=ar;break}te=ar}else tt=jr;gt(e,48,tt+9|0,9,0)}else{if(te=Yr?Qe:zr+4|0,-1<(0|jr))for(pr=0==(0|Xr),ee=jr,ar=zr;;){nt=(0|($e=0|At(0|St[ar>>2],0,M)))==(0|M)?(Et[A>>0]=48,A):$e;do{if((0|ar)==(0|zr)){if($e=nt+1|0,32&St[e>>2]||Mt(nt,1,e),pr&(0|ee)<1){it=$e;break}if(32&St[e>>2]|0){it=$e;break}Mt(951,1,e),it=$e}else{if(nt>>>0<=u>>>0){it=nt;break}for(Pt(0|u,48,nt+p|0),$e=nt;;){if(!(u>>>0<(br=$e+-1|0)>>>0)){it=br;break}$e=br}}}while(0);if(Ne=O-it|0,32&St[e>>2]||Mt(it,(0|Ne)<(0|ee)?Ne:ee,e),!((ar=ar+4|0)>>>0>>0&-1<(0|($e=ee-Ne|0)))){ot=$e;break}ee=$e}else ot=jr;if(gt(e,48,ot+18|0,18,0),32&St[e>>2]|0)break;Mt(Zr,s-Zr|0,e)}}while(0);gt(e,32,oe,dr,8192^re),sr=(0|dr)<(0|oe)?oe:dr}else Qe=0!=(32&j|0),gt(e,32,oe,_r=(nr=(r=Xe!=Xe|!1)?0:Ge)+3|0,K),32&(32&(rr=0|St[e>>2])?rr:(Mt(qe,nr,e),0|St[e>>2]))||Mt(r?Qe?943:947:Qe?935:939,3,e),gt(e,32,oe,_r,8192^re),sr=(0|_r)<(0|oe)?oe:_r}while(0);N=sr,D=I,P=ue,C=pe;continue e;default:Le=C,xe=0,Be=899,He=_,Ue=me,ze=re}}while(0);r:do{if(63==(0|L)){if(W=(L=0)|St[(j=f)>>2],V=0|St[j+4>>2],j=32&Fe,0==(0|W)&0==(0|V))at=_,st=ut=0;else{for(Me=_,_r=W,W=V;Et[(Me=Me+-1|0)>>0]=mt[883+(15&_r)>>0]|j,_r=0|Ct(0|_r,0|W,4),W=Ft,!(0==(0|_r)&0==(0|W)););at=Me,ut=0|St[(W=f)>>2],st=0|St[W+4>>2]}Oe=at,Ae=(W=0==(8&ye|0)|0==(0|ut)&0==(0|st))?0:2,Re=W?899:899+(Fe>>4)|0,ge=we,Te=ye,L=76}else if(75==(0|L))Oe=(L=0)|At(Ce,Ie,_),Ae=De,Re=Pe,ge=me,Te=re,L=76;else if(81==(0|L))Be=899,He=(_r=(xe=L=0)==(0|(W=0|Rt(Le=Ye,0,me))))?Ye+me|0:W,Ue=_r?me:W-Ye|0,ze=K;else if(85==(0|L)){for(W=Ke,j=_r=L=0;;){if(!(V=0|St[W>>2])){ft=_r,lt=j;break}if((0|(Qe=0|Tt(d,V)))<0|(Ve-_r|0)>>>0>>0){ft=_r,lt=Qe;break}if(!((V=Qe+_r|0)>>>0>>0)){ft=V,lt=Qe;break}W=W+4|0,_r=V,j=Qe}if((0|lt)<0){ie=-1;break e}if(gt(e,32,oe,ft,re),ft)for(j=Ke,_r=0;;){if(!(W=0|St[j>>2])){We=ft,L=96;break r}if((0|ft)<(0|(_r=(Me=0|Tt(d,W))+_r|0))){We=ft,L=96;break r}if(32&St[e>>2]||Mt(d,Me,e),ft>>>0<=_r>>>0){We=ft,L=96;break}j=j+4|0}else We=0,L=96}}while(0);C=(P=(D=(N=96!=(0|L)?(76==(0|L)&&(K=-1<((L=0)|ge)?-65537&Te:Te,ze=(Ue=0!=(0|ge)|(_r=0!=(0|St[(j=f)>>2])|0!=(0|St[j+4>>2]))?(xe=Ae,Be=Re,He=_,(0|(j=S-(Le=Oe)+(1&_r^1)|0))<(0|ge)?ge:j):(xe=Ae,Be=Re,He=Le=_,0),K)),gt(e,32,Me=(0|oe)<(0|(_r=(j=(0|Ue)<(0|(K=He-Le|0))?K:Ue)+xe|0))?_r:oe,_r,ze),32&St[e>>2]||Mt(Be,xe,e),gt(e,48,Me,_r,65536^ze),gt(e,48,j,K,0),32&St[e>>2]||Mt(Le,K,e),gt(e,32,Me,_r,8192^ze),Me):(L=0,gt(e,32,oe,We,8192^re),(0|We)<(0|oe)?oe:We),I),ue),pe)}else N=0,D=I,P=ue,C=pe}}e:do{if(243==(0|L))if(e)ie=I;else if(P){for(pe=1;;){if(!(C=0|St[i+(pe<<2)>>2])){ct=pe;break}if(Ot(n+(pe<<3)|0,C,t),10<=(0|(pe=pe+1|0))){ie=1;break e}}for(;;){if(0|St[i+(ct<<2)>>2]){ie=-1;break e}if(10<=(0|(ct=ct+1|0))){ie=1;break}}}else ie=0}while(0);return pt=dt,0|ie}function ze(){return 0}function Mt(e,r,t){e|=0,r|=0;var n,i,o=0,a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0;(a=0|St[(o=(t|=0)+16|0)>>2])?(u=a,s=5):0|function(e){var r=0,t=0,n=0;t=0|Et[(r=74+(e|=0)|0)>>0],Et[r>>0]=255+t|t,n=8&(t=0|St[e>>2])?(St[e>>2]=32|t,-1):(St[e+8>>2]=0,St[e+4>>2]=0,r=0|St[e+44>>2],St[e+28>>2]=r,St[e+20>>2]=r,St[e+16>>2]=r+(0|St[e+48>>2]),0);return 0|n}(t)?f=0:(u=0|St[o>>2],s=5);e:do{if(5==(0|s)){if((u-(n=o=0|St[(a=t+20|0)>>2])|0)>>>0>>0){f=0|nr[15&St[t+36>>2]](t,e,r);break}r:do{if(-1<(0|Et[t+75>>0])){for(o=r;;){if(!o){l=r,c=e,d=0,E=n;break r}if(10==(0|Et[e+(i=o+-1|0)>>0]))break;o=i}if((0|nr[15&St[t+36>>2]](t,e,o))>>>0>>0){f=o;break e}l=r-o|0,c=e+o|0,d=o,E=0|St[a>>2]}else l=r,c=e,d=0,E=n}while(0);Je(0|E,0|c,0|l),St[a>>2]=(0|St[a>>2])+l,f=d+l|0}}while(0);return 0|f}function Ot(e,r,t){e|=0,r|=0,t|=0;var n,i=0,o=0,a=0,u=0;e:do{if(r>>>0<=20){switch(0|r){case 9:i=3+(0|St[t>>2])&-4,o=0|St[i>>2],St[t>>2]=i+4,St[e>>2]=o;break e;case 10:o=3+(0|St[t>>2])&-4,i=0|St[o>>2],St[t>>2]=o+4,St[(o=e)>>2]=i,St[o+4>>2]=((0|i)<0)<<31>>31;break e;case 11:i=3+(0|St[t>>2])&-4,o=0|St[i>>2],St[t>>2]=i+4,St[(i=e)>>2]=o,St[i+4>>2]=0;break e;case 12:i=7+(0|St[t>>2])&-8,n=0|St[(o=i)>>2],a=0|St[o+4>>2],St[t>>2]=i+8,St[(i=e)>>2]=n,St[i+4>>2]=a;break e;case 13:a=3+(0|St[t>>2])&-4,i=0|St[a>>2],St[t>>2]=a+4,a=(65535&i)<<16>>16,St[(i=e)>>2]=a,St[i+4>>2]=((0|a)<0)<<31>>31;break e;case 14:a=3+(0|St[t>>2])&-4,i=0|St[a>>2],St[t>>2]=a+4,St[(a=e)>>2]=65535&i,St[a+4>>2]=0;break e;case 15:a=3+(0|St[t>>2])&-4,i=0|St[a>>2],St[t>>2]=a+4,a=(255&i)<<24>>24,St[(i=e)>>2]=a,St[i+4>>2]=((0|a)<0)<<31>>31;break e;case 16:a=3+(0|St[t>>2])&-4,i=0|St[a>>2],St[t>>2]=a+4,St[(a=e)>>2]=255&i,St[a+4>>2]=0;break e;case 17:case 18:a=7+(0|St[t>>2])&-8,u=+ht[a>>3],St[t>>2]=a+8,ht[e>>3]=u;break e;default:break e}}}while(0)}function At(e,r,t){t|=0;var n=0,i=0,o=0,a=0,u=0,s=0;if(0<(r|=0)>>>0|0==(0|r)&4294967295<(e|=0)>>>0){for(n=t,i=e,o=r;r=0|xt(0|i,0|o,10,0),Et[(n=n+-1|0)>>0]=48|r,i=0|Lt(0|(r=i),0|o,10,0),9>>0|9==(0|o)&4294967295>>0;)o=Ft;a=i,u=n}else a=e,u=t;if(a)for(t=a,a=u;;){if(Et[(u=a+-1|0)>>0]=(t>>>0)%10|48,t>>>0<10){s=u;break}t=(t>>>0)/10|0,a=u}else s=u;return 0|s}function Rt(e,r,t){e|=0;var n,i,o,a,u=0,s=0,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=255&(r|=0),u=0!=(0|(t|=0));e:do{if(u&0!=(3&e|0))for(n=255&r,s=e,f=t;;){if((0|Et[s>>0])==n<<24>>24){l=s,c=f,d=6;break e}if(!((a=0!=(0|(o=f+-1|0)))&0!=(3&(i=s+1|0)|0))){E=i,_=o,S=a,d=5;break}s=i,f=o}else E=e,_=t,S=u,d=5}while(0);5==(0|d)&&(S?(l=E,c=_,d=6):(m=E,h=0));e:do{if(6==(0|d))if(E=255&r,(0|Et[l>>0])==E<<24>>24)m=l,h=c;else{_=0|wt(w,16843009);r:do{if(3>>0){for(S=l,u=c;!((-2139062144&(t=St[S>>2]^_)^-2139062144)&t+-16843009|0);){if(t=S+4|0,!(3<(e=u+-4|0)>>>0)){p=t,b=e,d=11;break r}S=t,u=e}k=S,F=u}else p=l,b=c,d=11}while(0);if(11==(0|d)){if(!b){m=p,h=0;break}k=p,F=b}for(;;){if((0|Et[k>>0])==E<<24>>24){m=k,h=F;break e}if(_=k+1|0,!(F=F+-1|0)){m=_,h=0;break}k=_}}}while(0);return 0|(0|h?m:0)}function gt(e,r,t,n,i){e|=0,r|=0,t|=0,n|=0,i|=0;var o,a,u,s,f=0,l=0,c=0,d=0,E=0,_=pt;(0|bt)<=(0|(pt=pt+256|0))&&yt(256),o=_;do{if((0|n)<(0|t)&0==(73728&i|0)){if(Pt(0|o,0|r,0|(256<(a=t-n|0)>>>0?256:a)),u=0==(32&(f=0|St[e>>2])|0),255>>0){for(s=t-n|0,l=a,c=f,f=u;f=0==(32&(d=f?(Mt(o,256,e),0|St[e>>2]):c)|0),!((l=l+-256|0)>>>0<=255);)c=d;if(!f)break;E=255&s}else{if(!u)break;E=a}Mt(o,E,e)}}while(0);pt=_}function Tt(e,r){r|=0;return 0|((e|=0)?0|function(e,r,t){e|=0,r|=0,t|=0;var n=0;do{if(e){if(r>>>0<128){Et[e>>0]=r,n=1;break}if(r>>>0<2048){Et[e>>0]=r>>>6|192,Et[e+1>>0]=63&r|128,n=2;break}if(r>>>0<55296|57344==(-8192&r|0)){Et[e>>0]=r>>>12|224,Et[e+1>>0]=r>>>6&63|128,Et[e+2>>0]=63&r|128,n=3;break}if((r+-65536|0)>>>0<1048576){Et[e>>0]=r>>>18|240,Et[e+1>>0]=r>>>12&63|128,Et[e+2>>0]=r>>>6&63|128,Et[e+3>>0]=63&r|128,n=4;break}t=0|vt(),St[t>>2]=84,n=-1;break}}while(n=1,0);return 0|n}(e,r,0):0)}function Ye(e,r){var t=0|function(e,r){e|=0;var t=0,n=0,i=0,o=0,a=0,u=0,s=0,f=0,l=0;t=255&(r|=0);e:do{if(t){if(3&e)for(o=255&r,a=e;;){if((u=0|Et[a>>0])<<24>>24==0||u<<24>>24==o<<24>>24){n=a;break e}if(!(3&(u=a+1|0))){i=u;break}a=u}else i=e;a=0|wt(t,16843009),o=0|St[i>>2];r:do{if((-2139062144&o^-2139062144)&o+-16843009)l=i;else for(u=i,s=o;;){if((-2139062144&(f=s^a)^-2139062144)&f-16843009|0){l=u;break r}if((-2139062144&(s=0|St[(f=u+4|0)>>2])^-2139062144)&s+-16843009|0){l=f;break}u=f}}while(0);for(a=255&r,o=l;;){if((u=0|Et[o>>0])<<24>>24==0||u<<24>>24==a<<24>>24){n=o;break}o=o+1|0}}else n=e+(0|function(e){var r,t=0,n=0,i=0,o=0,a=0,u=0,s=0,f=0,t=e|=0;r:do{if(3&t)for(o=e,a=t;;){if(!(0|Et[o>>0])){u=a;break r}if(!(3&(a=r=o+1|0))){n=r,i=4;break}o=r}else n=e,i=4}while(0);if(4==(0|i)){for(i=n;!((-2139062144&(s=0|St[i>>2])^-2139062144)&s+-16843009);)i=i+4|0;if((255&s)<<24>>24)for(s=i;;){if(!(0|Et[(i=s+1|0)>>0])){f=i;break}s=i}else f=i;u=f}return u-t|0}(e))|0}while(0);return 0|n}(e|=0,r|=0);return 0|((0|Et[t>>0])==(255&r)<<24>>24?t:0)}function Ve(e){e|=0;var r=0,t=0,n=0,i=0,o=0,a=0,u=0;do{if(e){if((0|St[e+76>>2])<=-1){r=0|Ke(e);break}r=((t=!0)||He(),n=0|Ke(e))}else{if(i=0|St[34]?0|Ve(0|St[34]):0,H(11076),n=0|St[2768])for(t=n,n=i;;){if(a=(St[t+76>>2],0),u=(0|St[t+20>>2])>>>0>(0|St[t+28>>2])>>>0?0|Ke(t)|n:n,0|a&&He(),!(t=0|St[t+56>>2])){o=u;break}n=u}else o=i;V(11076),r=o}}while(0);return 0|r}function Ke(e){var r,t,n,i,o=0,a=(e|=0)+28|0;return 0|((0|St[(o=e+20|0)>>2])>>>0>(0|St[a>>2])>>>0&&(nr[15&St[e+36>>2]](e,0,0),0==(0|St[o>>2]))?-1:((t=0|St[(r=e+4|0)>>2])>>>0<(i=0|St[(n=e+8|0)>>2])>>>0&&nr[15&St[e+40>>2]](e,t-i|0,1),St[e+16>>2]=0,St[a>>2]=0,St[o>>2]=0,St[n>>2]=0,St[r>>2]=0))}function We(e,r,t){e|=0,r|=0;var n=0,n=1==(0|(t|=0))?r-(0|St[e+8>>2])+(0|St[e+4>>2])|0:r,i=e+28|0;return 0|((0|St[(r=e+20|0)>>2])>>>0>(0|St[i>>2])>>>0&&(nr[15&St[e+36>>2]](e,0,0),0==(0|St[r>>2]))?-1:(St[e+16>>2]=0,St[i>>2]=0,((St[r>>2]=0)|nr[15&St[e+40>>2]](e,n,t))<0?-1:(St[e+8>>2]=0,St[e+4>>2]=0,St[e>>2]=-17&St[e>>2],0)))}function je(e){var r=0,t=0,r=128&St[(e|=0)>>2]&&(0|St[e+20>>2])>>>0>(0|St[e+28>>2])>>>0?2:1;return 0|((0|(t=0|nr[15&St[e+40>>2]](e,0,r)))<0?t:t-(0|St[e+8>>2])+(0|St[e+4>>2])+(0|St[e+20>>2])-(0|St[e+28>>2])|0)}function Xe(e){e|=0;var r,t=0,n=0,i=0,o=0,a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0,R=0,g=0,T=0,N=0,D=0,P=0,C=0,I=0,L=0,x=0,B=0,H=0,U=0,z=0,Y=0,V=0,K=0,W=0,j=0,X=0,G=0,q=0,Q=0,Z=0,J=0,$=0,ee=0,re=0,te=0,ne=0,ie=0,oe=0,ae=0,ue=0,se=0,fe=0,le=0,ce=0,de=0,Ee=0,_e=0,Se=0,me=0,he=0,pe=0,be=0,ke=0,Fe=0,we=0,ye=0,ve=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),t=ve;do{if(e>>>0<245){if(i=(n=e>>>0<11?16:e+11&-8)>>>3,3&(a=(o=0|St[2774])>>>i)|0){l=0|St[(f=(s=11136+((u=(1&a^1)+i|0)<<1<<2)|0)+8|0)>>2],d=0|St[(c=l+8|0)>>2];do{if((0|s)!=(0|d)){if(d>>>0<(0|St[2778])>>>0&&Me(),(0|St[(E=d+12|0)>>2])==(0|l)){St[E>>2]=s,St[f>>2]=d;break}Me()}else St[2774]=o&~(1<>2]=3|d,St[(f=l+d+4|0)>>2]=1|St[f>>2],pt=ve,0|(_=c)}if((f=0|St[2776])>>>0>>0){if(0|a){S=0|St[(h=(m=11136+((p=((d=(E=(d=((s=a<>>(s=d>>>12&16))>>>5&8)|s|(E=(S=E>>>d)>>>2&4)|(S=(m=S>>>E)>>>1&2)|(m=(h=m>>>S)>>>1&1))+(h>>>m)|0)<<1<<2)|0)+8|0)>>2],s=0|St[(E=S+8|0)>>2];do{if((0|m)!=(0|s)){if(s>>>0<(0|St[2778])>>>0&&Me(),(0|St[(d=s+12|0)>>2])==(0|S)){St[d>>2]=m,St[h>>2]=s,b=o;break}Me()}else d=o&~(1<>2]=3|n,St[(h=S+n|0)+4>>2]=1|s,St[h+s>>2]=s,0|f&&(m=0|St[2779],a=11136+((i=f>>>3)<<1<<2)|0,b&(c=1<>2])>>>0<(0|St[2778])>>>0?Me():(k=l,F=i):(St[2774]=b|c,F=(k=a)+8|0),St[F>>2]=m,St[k+12>>2]=m,St[m+8>>2]=k,St[m+12>>2]=a),St[2776]=s,St[2779]=h,pt=ve,0|(_=E)}if(h=0|St[2775]){for(u=0|St[11400+(((s=(m=(s=(h&0-h)-1|0)>>>(a=s>>>12&16))>>>5&8)|a|(m=(c=m>>>s)>>>2&4)|(c=(i=c>>>m)>>>1&2)|(i=(l=i>>>c)>>>1&1))+(l>>>i)<<2)>>2],c=(-8&St[(l=i=u)+4>>2])-n|0;;){if(u=0|St[i+16>>2])w=u;else{if(!(m=0|St[i+20>>2]))break;w=m}l=(m=(u=(-8&St[(i=w)+4>>2])-n|0)>>>0>>0)?w:l,c=m?u:c}l>>>0<(i=0|St[2778])>>>0&&Me(),(E=l+n|0)>>>0<=l>>>0&&Me(),S=0|St[l+24>>2],p=0|St[l+12>>2];do{if((0|p)==(0|l)){if(m=0|St[(u=l+20|0)>>2])v=m,M=u;else{if(!(s=0|St[(a=l+16|0)>>2])){y=0;break}v=s,M=a}for(;;)if(0|(m=0|St[(u=v+20|0)>>2]))v=m,M=u;else{if(!(m=0|St[(u=v+16|0)>>2]))break;v=m,M=u}if(!(M>>>0>>0)){St[M>>2]=0,y=v;break}Me()}else{if((u=0|St[l+8>>2])>>>0>>0&&Me(),(0|St[(m=u+12|0)>>2])!=(0|l)&&Me(),(0|St[(a=p+8|0)>>2])==(0|l)){St[m>>2]=p,St[a>>2]=u,y=p;break}Me()}}while(0);do{if(0|S){if(p=0|St[l+28>>2],(0|l)==(0|St[(i=11400+(p<<2)|0)>>2])){if(!(St[i>>2]=y)){St[2775]=h&~(1<>>0<(0|St[2778])>>>0&&Me(),(0|St[(p=S+16|0)>>2])==(0|l)?St[p>>2]=y:St[S+20>>2]=y,!y)break;y>>>0<(p=0|St[2778])>>>0&&Me(),St[y+24>>2]=S,i=0|St[l+16>>2];do{if(0|i){if(!(i>>>0

>>0)){St[y+16>>2]=i,St[i+24>>2]=y;break}Me()}}while(0);if(0|(i=0|St[l+20>>2])){if(!(i>>>0<(0|St[2778])>>>0)){St[y+20>>2]=i,St[i+24>>2]=y;break}Me()}}}while(0);return c>>>0<16?(S=c+n|0,St[l+4>>2]=3|S,St[(h=l+S+4|0)>>2]=1|St[h>>2]):(St[l+4>>2]=3|n,St[E+4>>2]=1|c,St[E+c>>2]=c,0|f&&(h=0|St[2779],i=11136+((S=f>>>3)<<1<<2)|0,o&(p=1<>2])>>>0<(0|St[2778])>>>0?Me():(O=u,A=S):(St[2774]=o|p,A=(O=i)+8|0),St[A>>2]=h,St[O+12>>2]=h,St[h+8>>2]=O,St[h+12>>2]=i),St[2776]=c,St[2779]=E),pt=ve,0|(_=l+8|0)}R=n}else R=n}else if(e>>>0<=4294967231)if(h=-8&(i=e+11|0),p=0|St[2775]){S=0-h|0,g=(u=i>>>8)?16777215>>0?31:h>>>((s=14-((u=((a=u<<(i=(u+1048320|0)>>>16&8))+520192|0)>>>16&4)|i|(a=((m=a<>>16&2))+(m<>>15)|0)+7|0)&1|s<<1:0,s=0|St[11400+(g<<2)>>2];e:do{if(s)for(m=S,i=s,u=h<<(31==((a=0)|g)?0:25-(g>>>1)|0),d=0;;){if((C=(-8&St[i+4>>2])-h|0)>>>0>>0){if(!C){L=0,x=I=i,P=90;break e}B=i,H=C}else B=a,H=m;if(r=0==(0|(C=0|St[i+20>>2]))|(0|C)==(0|(i=0|St[i+16+(u>>>31<<2)>>2]))?d:C,C=0==(0|i)){T=r,N=B,D=H,P=86;break}a=B,m=H,u<<=1&C^1,d=r}else N=T=0,D=S,P=86}while(0);if(86==(0|P)){if(0==(0|T)&0==(0|N)){if(!(S=p&((s=2<>>(S=s>>>12&16))>>>5&8)|S|(n=(l=n>>>s)>>>2&4)|(l=(E=l>>>n)>>>1&2)|(E=(c=E>>>l)>>>1&1))+(c>>>E)<<2)>>2]}else U=T;U?(I=N,L=D,x=U,P=90):(z=N,Y=D)}if(90==(0|P))for(;;)if(P=0,l=(c=(E=(-8&St[x+4>>2])-h|0)>>>0>>0)?E:L,E=c?x:I,0|(c=0|St[x+16>>2]))I=E,L=l,x=c,P=90;else{if(!(x=0|St[x+20>>2])){z=E,Y=l;break}I=E,L=l,P=90}if(0!=(0|z)&&Y>>>0<((0|St[2776])-h|0)>>>0){z>>>0<(l=0|St[2778])>>>0&&Me(),(E=z+h|0)>>>0<=z>>>0&&Me(),c=0|St[z+24>>2],n=0|St[z+12>>2];do{if((0|n)==(0|z)){if(s=0|St[(S=z+20|0)>>2])K=s,W=S;else{if(!(f=0|St[(o=z+16|0)>>2])){V=0;break}K=f,W=o}for(;;)if(0|(s=0|St[(S=K+20|0)>>2]))K=s,W=S;else{if(!(s=0|St[(S=K+16|0)>>2]))break;K=s,W=S}if(!(W>>>0>>0)){St[W>>2]=0,V=K;break}Me()}else{if((S=0|St[z+8>>2])>>>0>>0&&Me(),(0|St[(s=S+12|0)>>2])!=(0|z)&&Me(),(0|St[(o=n+8|0)>>2])==(0|z)){St[s>>2]=n,St[o>>2]=S,V=n;break}Me()}}while(0);do{if(c){if(n=0|St[z+28>>2],(0|z)==(0|St[(l=11400+(n<<2)|0)>>2])){if(!(St[l>>2]=V)){l=p&~(1<>>0<(0|St[2778])>>>0&&Me(),(0|St[(l=c+16|0)>>2])==(0|z)?St[l>>2]=V:St[c+20>>2]=V,!V){j=p;break}V>>>0<(l=0|St[2778])>>>0&&Me(),St[V+24>>2]=c,n=0|St[z+16>>2];do{if(0|n){if(!(n>>>0>>0)){St[V+16>>2]=n,St[n+24>>2]=V;break}Me()}}while(0);if(n=0|St[z+20>>2]){if(!(n>>>0<(0|St[2778])>>>0)){St[V+20>>2]=n,St[n+24>>2]=V,j=p;break}Me()}else j=p}else j=p}while(0);do{if(16<=Y>>>0){if(St[z+4>>2]=3|h,St[E+4>>2]=1|Y,p=(St[E+Y>>2]=Y)>>>3,Y>>>0<256){c=11136+(p<<1<<2)|0,(n=0|St[2774])&(l=1<>2])>>>0<(0|St[2778])>>>0?Me():(X=S,G=p):(St[2774]=n|l,G=(X=c)+8|0),St[G>>2]=E,St[X+12>>2]=E,St[E+8>>2]=X,St[E+12>>2]=c;break}if(S=11400+((q=(c=Y>>>8)?16777215>>0?31:Y>>>((S=14-((c=((n=c<<(l=(c+1048320|0)>>>16&8))+520192|0)>>>16&4)|l|(n=((p=n<>>16&2))+(p<>>15)|0)+7|0)&1|S<<1:0)<<2)|0,St[E+28>>2]=q,St[(n=E+16|0)+4>>2]=0,St[n>>2]=0,!(j&(n=1<>2]=E,St[E+24>>2]=S,St[E+12>>2]=E,St[E+8>>2]=E;break}for(n=Y<<(31==(0|q)?0:25-(q>>>1)|0),p=0|St[S>>2];;){if((-8&St[p+4>>2]|0)==(0|Y)){P=148;break}if(!(S=0|St[(Q=p+16+(n>>>31<<2)|0)>>2])){P=145;break}n<<=1,p=S}if(145==(0|P)){if(!(Q>>>0<(0|St[2778])>>>0)){St[Q>>2]=E,St[E+24>>2]=p,St[E+12>>2]=E,St[E+8>>2]=E;break}Me()}else if(148==(0|P)){if(S=0|St[(n=p+8|0)>>2],(l=0|St[2778])>>>0<=S>>>0&l>>>0<=p>>>0){St[S+12>>2]=E,St[n>>2]=E,St[E+8>>2]=S,St[E+12>>2]=p,St[E+24>>2]=0;break}Me()}}else S=Y+h|0,St[z+4>>2]=3|S,St[(n=z+S+4|0)>>2]=1|St[n>>2]}while(0);return pt=ve,0|(_=z+8|0)}R=h}else R=h;else R=-1}while(0);if(R>>>0<=(z=0|St[2776])>>>0)return Y=z-R|0,Q=0|St[2779],15>>0?(q=Q+R|0,St[2779]=q,St[2776]=Y,St[q+4>>2]=1|Y,St[q+Y>>2]=Y,St[Q+4>>2]=3|R):(St[2776]=0,St[2779]=0,St[Q+4>>2]=3|z,St[(Y=Q+z+4|0)>>2]=1|St[Y>>2]),pt=ve,0|(_=Q+8|0);if(R>>>0<(Q=0|St[2777])>>>0)return Y=Q-R|0,St[2777]=Y,q=(z=0|St[2780])+R|0,St[2780]=q,St[q+4>>2]=1|Y,St[z+4>>2]=3|R,pt=ve,0|(_=z+8|0);if(Z=0|St[2892]?0|St[2894]:(St[2894]=4096,St[2893]=4096,St[2895]=-1,St[2896]=-1,St[2897]=0,St[2885]=0,z=-16&t^1431655768,St[t>>2]=z,St[2892]=z,4096),z=R+48|0,(Z=(Y=Z+(t=R+47|0)|0)&(q=0-Z|0))>>>0<=R>>>0)return pt=ve,(_=0)|_;if(0|(j=0|St[2884])&&(G=(X=0|St[2882])+Z|0)>>>0<=X>>>0|j>>>0>>0)return pt=ve,(_=0)|_;e:do{if(4&St[2885])P=187;else{j=0|St[2780];r:do{if(j){for(G=11544;!((X=0|St[G>>2])>>>0<=j>>>0&&(X+(0|St[(J=G+4|0)>>2])|0)>>>0>j>>>0);){if(!(X=0|St[G+8>>2])){P=172;break r}G=X}if((p=Y-Q&q)>>>0<2147483647)if((0|(X=0|Ze(0|p)))==((0|St[G>>2])+(0|St[J>>2])|0)){if(-1!=(0|X)){$=p,ee=X,P=190;break e}}else re=X,te=p,P=180}else P=172}while(0);do{if(172==(0|P)&&-1!=(0|(j=0|Ze(0)))&&(h=j,p=(V=(0==((X=(p=0|St[2893])+-1|0)&h|0)?0:(X+h&0-p)-h|0)+Z|0)+(h=0|St[2882])|0,R>>>0>>0&V>>>0<2147483647)){if(0|(X=0|St[2884])&&p>>>0<=h>>>0|X>>>0

>>0)break;if((0|(X=0|Ze(0|V)))==(0|j)){$=V,ee=j,P=190;break e}re=X,te=V,P=180}}while(0);r:do{if(180==(0|P)){V=0-te|0;do{if(te>>>0>>0&te>>>0<2147483647&-1!=(0|re)&&(j=t-te+(X=0|St[2894])&0-X)>>>0<2147483647){if(-1==(0|Ze(0|j))){Ze(0|V);break r}ne=j+te|0;break}}while(ne=te,0);if(-1!=(0|re)){$=ne,ee=re,P=190;break e}}}while(0);St[2885]=4|St[2885],P=187}}while(0);if(187==(0|P)&&Z>>>0<2147483647&&(re=0|Ze(0|Z))>>>0<(Z=0|Ze(0))>>>0&-1!=(0|re)&-1!=(0|Z)&&(R+40|0)>>>0<(ne=Z-re|0)>>>0&&($=ne,ee=re,P=190),190==(0|P)){re=(0|St[2882])+$|0,(St[2882]=re)>>>0>(0|St[2883])>>>0&&(St[2883]=re),re=0|St[2780];do{if(re){for(ne=11544;;){if((0|ee)==((ie=0|St[ne>>2])+(ae=0|St[(oe=ne+4|0)>>2])|0)){P=200;break}if(!(Z=0|St[ne+8>>2]))break;ne=Z}if(200==(0|P)&&0==(8&St[ne+12>>2]|0)&&re>>>0>>0&ie>>>0<=re>>>0){St[oe>>2]=ae+$,Z=re+(te=0==(7&(Z=re+8|0)|0)?0:0-Z&7)|0,t=$-te+(0|St[2777])|0,St[2780]=Z,St[2777]=t,St[Z+4>>2]=1|t,St[Z+t+4>>2]=40,St[2781]=St[2896];break}for(ue=ee>>>0<(t=0|St[2778])>>>0?St[2778]=ee:t,t=ee+$|0,Z=11544;;){if((0|St[Z>>2])==(0|t)){P=208;break}if(!(te=0|St[Z+8>>2])){se=11544;break}Z=te}if(208==(0|P)){if(!(8&St[Z+12>>2])){St[Z>>2]=ee,St[(ne=Z+4|0)>>2]=(0|St[ne>>2])+$,te=ee+(0==(7&(ne=ee+8|0)|0)?0:0-ne&7)|0,z=t+(0==(7&(ne=t+8|0)|0)?0:0-ne&7)|0,ne=te+R|0,J=z-te-R|0,St[te+4>>2]=3|R;do{if((0|z)!=(0|re)){if((0|z)==(0|St[2779])){q=(0|St[2776])+J|0,St[2776]=q,St[2779]=ne,St[ne+4>>2]=1|q,St[ne+q>>2]=q;break}if(1==(3&(q=0|St[z+4>>2])|0)){Q=-8&q,Y=q>>>3;e:do{if(256<=q>>>0){V=0|St[z+24>>2],G=0|St[z+12>>2];do{if((0|G)==(0|z)){if(p=0|St[(X=(j=z+16|0)+4|0)>>2])le=p,ce=X;else{if(!(h=0|St[j>>2])){fe=0;break}le=h,ce=j}for(;;)if(0|(p=0|St[(X=le+20|0)>>2]))le=p,ce=X;else{if(!(p=0|St[(X=le+16|0)>>2]))break;le=p,ce=X}if(!(ce>>>0>>0)){St[ce>>2]=0,fe=le;break}Me()}else{if((X=0|St[z+8>>2])>>>0>>0&&Me(),(0|St[(p=X+12|0)>>2])!=(0|z)&&Me(),(0|St[(j=G+8|0)>>2])==(0|z)){St[p>>2]=G,St[j>>2]=X,fe=G;break}Me()}}while(0);if(!V)break;X=11400+((G=0|St[z+28>>2])<<2)|0;do{if((0|z)==(0|St[X>>2])){if(0|(St[X>>2]=fe))break;St[2775]=St[2775]&~(1<>>0<(0|St[2778])>>>0&&Me(),(0|St[(j=V+16|0)>>2])==(0|z)?St[j>>2]=fe:St[V+20>>2]=fe,!fe)break e}while(0);fe>>>0<(G=0|St[2778])>>>0&&Me(),St[fe+24>>2]=V,j=0|St[(X=z+16|0)>>2];do{if(0|j){if(!(j>>>0>>0)){St[fe+16>>2]=j,St[j+24>>2]=fe;break}Me()}}while(0);if(!(j=0|St[X+4>>2]))break;if(!(j>>>0<(0|St[2778])>>>0)){St[fe+20>>2]=j,St[j+24>>2]=fe;break}Me()}else{j=0|St[z+8>>2],G=0|St[z+12>>2],V=11136+(Y<<1<<2)|0;do{if((0|j)!=(0|V)){if(j>>>0>>0&&Me(),(0|St[j+12>>2])==(0|z))break;Me()}}while(0);if((0|G)==(0|j)){St[2774]=St[2774]&~(1<>>0>>0&&Me(),(0|St[(X=G+8|0)>>2])==(0|z)){de=X;break}Me()}}while(0);St[j+12>>2]=G,St[de>>2]=j}}while(0);Ee=z+Q|0,_e=Q+J|0}else Ee=z,_e=J;if(St[(Y=Ee+4|0)>>2]=-2&St[Y>>2],St[ne+4>>2]=1|_e,Y=(St[ne+_e>>2]=_e)>>>3,_e>>>0<256){q=11136+(Y<<1<<2)|0,V=0|St[2774],X=1<>2])>>>0>=(0|St[2778])>>>0){Se=p,me=Y;break}Me()}else St[2774]=V|X,me=(Se=q)+8|0}while(0);St[me>>2]=ne,St[Se+12>>2]=ne,St[ne+8>>2]=Se,St[ne+12>>2]=q;break}X=_e>>>8;do{if(X){if(16777215<_e>>>0){he=31;break}he=_e>>>((h=14-((Y=((Q=X<<(V=(X+1048320|0)>>>16&8))+520192|0)>>>16&4)|V|(Q=((p=Q<>>16&2))+(p<>>15)|0)+7|0)&1|h<<1}else he=0}while(0);if(X=11400+(he<<2)|0,St[ne+28>>2]=he,St[(q=ne+16|0)+4>>2]=0,!((q=(St[q>>2]=0)|St[2775])&(h=1<>2]=ne,St[ne+24>>2]=X,St[ne+12>>2]=ne,St[ne+8>>2]=ne;break}for(h=_e<<(31==(0|he)?0:25-(he>>>1)|0),q=0|St[X>>2];;){if((-8&St[q+4>>2]|0)==(0|_e)){P=278;break}if(!(X=0|St[(pe=q+16+(h>>>31<<2)|0)>>2])){P=275;break}h<<=1,q=X}if(275==(0|P)){if(!(pe>>>0<(0|St[2778])>>>0)){St[pe>>2]=ne,St[ne+24>>2]=q,St[ne+12>>2]=ne,St[ne+8>>2]=ne;break}Me()}else if(278==(0|P)){if(X=0|St[(h=q+8|0)>>2],(Q=0|St[2778])>>>0<=X>>>0&Q>>>0<=q>>>0){St[X+12>>2]=ne,St[h>>2]=ne,St[ne+8>>2]=X,St[ne+12>>2]=q,St[ne+24>>2]=0;break}Me()}}else X=(0|St[2777])+J|0,St[2777]=X,St[2780]=ne,St[ne+4>>2]=1|X}while(0);return pt=ve,0|(_=te+8|0)}se=11544}for(;!((ne=0|St[se>>2])>>>0<=re>>>0&&re>>>0<(be=ne+(0|St[se+4>>2])|0)>>>0);)se=0|St[se+8>>2];for(te=be+-47|0,ne=te+8|0,J=te+(0==(7&ne|0)?0:0-ne&7)|0,ne=re+16|0,te=J>>>0>>0?re:J,J=te+8|0,z=ee+8|0,t=0==(7&z|0)?0:0-z&7,z=ee+t|0,Z=$+-40-t|0,St[2780]=z,St[2777]=Z,St[z+4>>2]=1|Z,St[z+Z+4>>2]=40,St[2781]=St[2896],Z=te+4|0,St[Z>>2]=27,St[J>>2]=St[2886],St[J+4>>2]=St[2887],St[J+8>>2]=St[2888],St[J+12>>2]=St[2889],St[2886]=ee,St[2887]=$,St[2889]=0,St[2888]=J,J=te+24|0;St[(J=J+4|0)>>2]=7,(J+4|0)>>>0>>0;);if((0|te)!=(0|re)){if(J=te-re|0,St[Z>>2]=-2&St[Z>>2],St[re+4>>2]=1|J,z=(St[te>>2]=J)>>>3,J>>>0<256){t=11136+(z<<1<<2)|0,(X=0|St[2774])&(h=1<>2])>>>0<(0|St[2778])>>>0?Me():(ke=Q,Fe=z):(St[2774]=X|h,Fe=(ke=t)+8|0),St[Fe>>2]=re,St[ke+12>>2]=re,St[re+8>>2]=ke,St[re+12>>2]=t;break}if(Q=11400+((we=(t=J>>>8)?16777215>>0?31:J>>>((Q=14-((t=((X=t<<(h=(t+1048320|0)>>>16&8))+520192|0)>>>16&4)|h|(X=((z=X<>>16&2))+(z<>>15)|0)+7|0)&1|Q<<1:0)<<2)|0,St[re+28>>2]=we,St[re+20>>2]=0,!((X=(St[ne>>2]=0)|St[2775])&(z=1<>2]=re,St[re+24>>2]=Q,St[re+12>>2]=re,St[re+8>>2]=re;break}for(z=J<<(31==(0|we)?0:25-(we>>>1)|0),X=0|St[Q>>2];;){if((-8&St[X+4>>2]|0)==(0|J)){P=304;break}if(!(Q=0|St[(ye=X+16+(z>>>31<<2)|0)>>2])){P=301;break}z<<=1,X=Q}if(301==(0|P)){if(!(ye>>>0<(0|St[2778])>>>0)){St[ye>>2]=re,St[re+24>>2]=X,St[re+12>>2]=re,St[re+8>>2]=re;break}Me()}else if(304==(0|P)){if(J=0|St[(z=X+8|0)>>2],(ne=0|St[2778])>>>0<=J>>>0&ne>>>0<=X>>>0){St[J+12>>2]=re,St[z>>2]=re,St[re+8>>2]=J,St[re+12>>2]=X,St[re+24>>2]=0;break}Me()}}}else{for(J=0|St[2778],0==(0|J)|ee>>>0>>0&&(St[2778]=ee),St[2886]=ee,St[2887]=$,St[2889]=0,St[2783]=St[2892],St[2782]=-1,J=0;St[(z=11136+(J<<1<<2)|0)+12>>2]=z,St[z+8>>2]=z,J=J+1|0,32!=(0|J););J=ee+(X=0==(7&(J=ee+8|0)|0)?0:0-J&7)|0,z=$+-40-X|0,St[2780]=J,St[2777]=z,St[J+4>>2]=1|z,St[J+z+4>>2]=40,St[2781]=St[2896]}}while(0);if(R>>>0<($=0|St[2777])>>>0)return ee=$-R|0,St[2777]=ee,re=($=0|St[2780])+R|0,St[2780]=re,St[re+4>>2]=1|ee,St[$+4>>2]=3|R,pt=ve,0|(_=$+8|0)}return $=0|vt(),St[$>>2]=12,pt=ve,(_=0)|_}function Ge(e){var r,t,n=0,i=0,o=0,a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0,R=0,g=0,T=0;if(e|=0){(n=e+-8|0)>>>0<(i=0|St[2778])>>>0&&Me(),1==(0|(e=3&(o=0|St[e+-4>>2])))&&Me(),r=n+(a=-8&o)|0;do{if(1&o)d=n,E=a;else{if(u=0|St[n>>2],!e)return;if(f=u+a|0,(s=n+(0-u)|0)>>>0>>0&&Me(),(0|s)==(0|St[2779])){if(3==(3&(c=0|St[(l=4+r|0)>>2])|0))return St[2776]=f,St[l>>2]=-2&c,St[s+4>>2]=1|f,void(St[s+f>>2]=f);d=s,E=f;break}if(c=u>>>3,u>>>0<256){if(u=0|St[s+8>>2],l=0|St[s+12>>2],(0|u)!=(0|(_=11136+(c<<1<<2)|0))&&(u>>>0>>0&&Me(),(0|St[u+12>>2])!=(0|s)&&Me()),(0|l)==(0|u)){St[2774]=St[2774]&~(1<>>0>>0&&Me(),(0|St[(_=l+8|0)>>2])==(0|s)?S=_:Me()):S=l+8|0,St[u+12>>2]=l,St[S>>2]=u,d=s,E=f;break}u=0|St[s+24>>2],l=0|St[s+12>>2];do{if((0|l)==(0|s)){if(m=0|St[(c=(_=s+16|0)+4|0)>>2])p=m,b=c;else{if(!(t=0|St[_>>2])){h=0;break}p=t,b=_}for(;;)if(0|(m=0|St[(c=p+20|0)>>2]))p=m,b=c;else{if(!(m=0|St[(c=p+16|0)>>2]))break;p=m,b=c}if(!(b>>>0>>0)){St[b>>2]=0,h=p;break}Me()}else{if((c=0|St[s+8>>2])>>>0>>0&&Me(),(0|St[(m=c+12|0)>>2])!=(0|s)&&Me(),(0|St[(_=l+8|0)>>2])==(0|s)){St[m>>2]=l,St[_>>2]=c,h=l;break}Me()}}while(0);if(u){if(l=0|St[s+28>>2],(0|s)==(0|St[(c=11400+(l<<2)|0)>>2])){if(!(St[c>>2]=h)){St[2775]=St[2775]&~(1<>>0<(0|St[2778])>>>0&&Me(),(0|St[(l=u+16|0)>>2])==(0|s)?St[l>>2]=h:St[u+20>>2]=h,!h){d=s,E=f;break}h>>>0<(l=0|St[2778])>>>0&&Me(),St[h+24>>2]=u,_=0|St[(c=s+16|0)>>2];do{if(0|_){if(!(_>>>0>>0)){St[h+16>>2]=_,St[_+24>>2]=h;break}Me()}}while(0);if(_=0|St[c+4>>2]){if(!(_>>>0<(0|St[2778])>>>0)){St[h+20>>2]=_,St[_+24>>2]=h,d=s,E=f;break}Me()}else d=s,E=f}else d=s,E=f}}while(0);if(r>>>0<=d>>>0&&Me(),1&(n=0|St[(a=4+r|0)>>2])||Me(),2&n)St[a>>2]=-2&n,St[d+4>>2]=1|E,v=St[d+E>>2]=E;else{if((0|r)==(0|St[2780]))return h=(0|St[2777])+E|0,St[2777]=h,St[2780]=d,St[d+4>>2]=1|h,(0|d)!=(0|St[2779])?void 0:(St[2779]=0,void(St[2776]=0));if((0|r)==(0|St[2779]))return h=(0|St[2776])+E|0,St[2776]=h,St[2779]=d,St[d+4>>2]=1|h,void(St[d+h>>2]=h);h=(-8&n)+E|0,i=n>>>3;do{if(256<=n>>>0){p=0|St[24+r>>2],b=0|St[12+r>>2];do{if((0|b)==(0|r)){if(o=0|St[(e=(S=16+r|0)+4|0)>>2])F=o,w=e;else{if(!(_=0|St[S>>2])){k=0;break}F=_,w=S}for(;;)if(0|(o=0|St[(e=F+20|0)>>2]))F=o,w=e;else{if(!(o=0|St[(e=F+16|0)>>2]))break;F=o,w=e}if(!(w>>>0<(0|St[2778])>>>0)){St[w>>2]=0,k=F;break}Me()}else{if((e=0|St[8+r>>2])>>>0<(0|St[2778])>>>0&&Me(),(0|St[(o=e+12|0)>>2])!=(0|r)&&Me(),(0|St[(S=b+8|0)>>2])==(0|r)){St[o>>2]=b,St[S>>2]=e,k=b;break}Me()}}while(0);if(0|p){if(b=0|St[28+r>>2],(0|r)==(0|St[(f=11400+(b<<2)|0)>>2])){if(!(St[f>>2]=k)){St[2775]=St[2775]&~(1<>>0<(0|St[2778])>>>0&&Me(),(0|St[(b=p+16|0)>>2])==(0|r)?St[b>>2]=k:St[p+20>>2]=k,!k)break;k>>>0<(b=0|St[2778])>>>0&&Me(),St[k+24>>2]=p,s=0|St[(f=16+r|0)>>2];do{if(0|s){if(!(s>>>0>>0)){St[k+16>>2]=s,St[s+24>>2]=k;break}Me()}}while(0);if(0|(s=0|St[f+4>>2])){if(!(s>>>0<(0|St[2778])>>>0)){St[k+20>>2]=s,St[s+24>>2]=k;break}Me()}}}else{if(s=0|St[8+r>>2],b=0|St[12+r>>2],(0|s)!=(0|(p=11136+(i<<1<<2)|0))&&(s>>>0<(0|St[2778])>>>0&&Me(),(0|St[s+12>>2])!=(0|r)&&Me()),(0|b)==(0|s)){St[2774]=St[2774]&~(1<>>0<(0|St[2778])>>>0&&Me(),(0|St[(p=b+8|0)>>2])==(0|r)?y=p:Me()):y=b+8|0,St[s+12>>2]=b,St[y>>2]=s}}while(0);if(St[d+4>>2]=1|h,St[d+h>>2]=h,(0|d)==(0|St[2779]))return void(St[2776]=h);v=h}if(E=v>>>3,v>>>0<256)return n=11136+(E<<1<<2)|0,(a=0|St[2774])&(h=1<>2])>>>0<(0|St[2778])>>>0?Me():(M=y,O=E):(St[2774]=a|h,O=(M=n)+8|0),St[O>>2]=d,St[M+12>>2]=d,St[d+8>>2]=M,void(St[d+12>>2]=n);a=11400+((A=(n=v>>>8)?16777215>>0?31:v>>>((a=14-((n=((O=n<<(M=(n+1048320|0)>>>16&8))+520192|0)>>>16&4)|M|(O=((h=O<>>16&2))+(h<>>15)|0)+7|0)&1|a<<1:0)<<2)|0,St[d+28>>2]=A,St[d+20>>2]=0,O=(St[d+16>>2]=0)|St[2775],h=1<>>1)|0),n=0|St[a>>2];;){if((-8&St[n+4>>2]|0)==(0|v)){R=130;break}if(!(E=0|St[(g=n+16+(M>>>31<<2)|0)>>2])){R=127;break}M<<=1,n=E}if(127==(0|R)){if(!(g>>>0<(0|St[2778])>>>0)){St[g>>2]=d,St[d+24>>2]=n,St[d+12>>2]=d,St[d+8>>2]=d;break}Me()}else if(130==(0|R)){if(f=0|St[(M=n+8|0)>>2],(E=0|St[2778])>>>0<=f>>>0&E>>>0<=n>>>0){St[f+12>>2]=d,St[M>>2]=d,St[d+8>>2]=f,St[d+12>>2]=n,St[d+24>>2]=0;break}Me()}}else St[2775]=O|h,St[a>>2]=d,St[d+24>>2]=a,St[d+12>>2]=d,St[d+8>>2]=d}while(0);if(d=(0|St[2782])-1|0,!(St[2782]=d)){for(T=11552;d=0|St[T>>2];)T=d+8|0;St[2782]=-1}}}function Nt(e,r,t,n){r|=0,n|=0;return 0|(Ft=r-n-((e|=0)>>>0<(t|=0)>>>0|0)>>>0,e-t>>>0|0)}function Dt(e,r,t,n){var i=0;return 0|(Ft=(r|=0)+(n|=0)+((i=(e|=0)+(t|=0)>>>0)>>>0>>0|0)>>>0,0|i)}function Pt(e,r,t){r|=0;var n,i,o,a=(e|=0)+(t|=0)|0;if(20<=(0|t)){if(i=(r&=255)|r<<8|r<<16|r<<24,o=-4&a,n=3&e)for(n=e+4-n|0;(0|e)<(0|n);)Et[e>>0]=r,e=e+1|0;for(;(0|e)<(0|o);)St[e>>2]=i,e=e+4|0}for(;(0|e)<(0|a);)Et[e>>0]=r,e=e+1|0;return e-t|0}function Ct(e,r,t){return e|=0,r|=0,(0|(t|=0))<32?(Ft=r>>>t,e>>>t|(r&(1<>>t-32|(Ft=0)}function It(e,r,t){return e|=0,r|=0,(0|(t|=0))<32?(Ft=r<>>32-t,e<>0]))<8?0|r:(0|(r=0|Et[E+(e>>8&255)>>0]))<8?r+8|0:(0|(r=0|Et[E+(e>>16&255)>>0]))<8?r+16|0:24+(0|Et[E+(e>>>24)>>0])|0}function Qe(e,r,t,n,i){i|=0;var o,a,u,s=0,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0,R=0,g=0,T=0,N=0,s=e|=0,c=t|=0,E=d=n|=0;if(!(l=f=r|=0))return _=0!=(0|i),E?(_&&(St[i>>2]=0|e,St[i+4>>2]=0&r),(m=S=0)|(Ft=S,m)):(_&&(St[i>>2]=(s>>>0)%(c>>>0),St[i+4>>2]=0),(S=0)|(Ft=S,m=(s>>>0)/(c>>>0)>>>0));_=0==(0|E);do{if(c){if(!_){if((h=(0|D(0|E))-(0|D(0|l))|0)>>>0<=31){w=s>>>((F=p=h+1|0)>>>0)&(k=h-31>>31)|l<<(b=31-h|0),y=l>>>(p>>>0)&k,v=0,M=s<>2]=0|e,St[i+4>>2]=f|0&r,(m=S=0)|(Ft=S,m)):(m=S=0)|(Ft=S,m)}if((b=c-1|0)&c|0){w=(h=32-(k=33+(0|D(0|c))-(0|D(0|l))|0)|0)-1>>31&l>>>((a=k-32|0)>>>0)|(l<>>((F=k)>>>0))&(u=a>>31),y=u&l>>>(k>>>0),v=s<<(p=64-k|0)&(o=h>>31),M=(l<>>(a>>>0))&o|s<>31;break}return 0|i&&(St[i>>2]=b&s,St[i+4>>2]=0),1==(0|c)?0|(Ft=S=f|0&r,m=0|e):(b=0|qe(0|c),0|(Ft=S=l>>>(b>>>0)|0,m=l<<32-b|s>>>(b>>>0)|0))}if(_)return 0|i&&(St[i>>2]=(l>>>0)%(c>>>0),St[i+4>>2]=0),(S=0)|(Ft=S,m=(l>>>0)/(c>>>0)>>>0);if(!s)return 0|i&&(St[i>>2]=0,St[i+4>>2]=(l>>>0)%(E>>>0)),(S=0)|(Ft=S,m=(l>>>0)/(E>>>0)>>>0);if(!((b=E-1|0)&E))return 0|i&&(St[i>>2]=0|e,St[i+4>>2]=b&l|0&r),m=l>>>(((S=0)|qe(0|E))>>>0),0|(Ft=S,m);if((b=(0|D(0|E))-(0|D(0|l))|0)>>>0<=30){w=l<<(h=31-b|0)|s>>>((F=k=b+1|0)>>>0),y=l>>>(k>>>0),v=0,M=s<>2]=0|e,St[i+4>>2]=f|0&r),(m=S=0)|(Ft=S,m)}while(0);if(F){for(r=0|t,t=d|0&n,n=0|Dt(0|r,0|t,-1,-1),d=Ft,f=M,M=v,v=y,y=w,w=F,F=0;f=M>>>31|(e=f)<<1,M=F|M<<1,Nt(0|n,0|d,0|(s=y<<1|e>>>31|0),0|(e=y>>>31|v<<1|0)),F=1&(E=(l=Ft)>>31|((0|l)<0?-1:0)<<1),y=0|Nt(0|s,0|e,E&r|0,(((0|l)<0?-1:0)>>31|((0|l)<0?-1:0)<<1)&t|0),v=Ft,w=w-1|0,0!=(0|w););O=f,A=M,R=v,g=y,T=0,N=F}else O=M,A=v,R=y,g=w,N=T=0;return F=A,(A=0)|i&&(St[i>>2]=g,St[i+4>>2]=R),0|(Ft=S=(0|F)>>>31|(O|A)<<1|0&(A<<1|F>>>31)|T,m=-2&(F<<1|0)|N)}function Lt(e,r,t,n){return 0|Qe(e|=0,r|=0,t|=0,n|=0,0)}function Ze(e){var r,t;return 0<(0|(e=(e|=0)+15&-16|0))&(0|(t=(r=0|St[d>>2])+e|0))<(0|r)|(0|t)<0?(h(),M(12),-1):(0|(St[d>>2]=t))>(0|m())&&0==(0|S())?(M(12),St[d>>2]=r,-1):0|r}function xt(e,r,t,n){var i,o=pt;return pt=pt+16|0,Qe(e|=0,r|=0,t|=0,n|=0,i=0|o),pt=o,0|(Ft=0|St[4+i>>2],0|St[i>>2])}function Je(e,r,t){e|=0,r|=0;var n;if(4096<=(0|(t|=0)))return 0|R(0|e,0|r,0|t);if(n=0|e,(3&e)==(3&r)){for(;3&e;){if(!t)return 0|n;Et[e>>0]=0|Et[r>>0],e=e+1|0,r=r+1|0,t=t-1|0}for(;4<=(0|t);)St[e>>2]=St[r>>2],e=e+4|0,r=r+4|0,t=t-4|0}for(;0<(0|t);)Et[e>>0]=0|Et[r>>0],e=e+1|0,r=r+1|0,t=t-1|0;return 0|n}function $e(){return 0}function er(e,r,t){return p(0),0}function rr(e){b(1)}function tr(e,r){k(2)}var nr=[er,function(e,r,t){e|=0,r|=0,t|=0;var n=0,i=pt;return(0|bt)<=(0|(pt=pt+80|0))&&yt(80),n=i,St[e+36>>2]=9,0==(64&St[e>>2]|0)&&(St[n>>2]=St[e+60>>2],St[n+4>>2]=21505,St[n+8>>2]=i+12,0|Y(54,0|n))&&(Et[e+75>>0]=-1),n=0|xe(e,r,t),pt=i,0|n},function(e,r,t){e|=0,r|=0,t|=0;var n,i,o=0,a=pt;return(0|bt)<=(0|(pt=pt+32|0))&&yt(32),i=(n=a)+20|0,St[n>>2]=St[e+60>>2],St[n+4>>2]=0,St[n+8>>2]=r,St[n+12>>2]=i,St[n+16>>2]=t,o=(0|Be(0|O(140,0|n)))<0?St[i>>2]=-1:0|St[i>>2],pt=a,0|o},function(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u=pt;return(0|bt)<=(0|(pt=pt+16|0))&&yt(16),i=u+8|0,o=u+4|0,St[(n=(a=u)+12|0)>>2]=e,St[i>>2]=r,St[o>>2]=t,St[a>>2]=St[n>>2],n=0==(0|L(8+(0|St[a>>2])|0,0|St[i>>2],0|St[o>>2])),pt=u,0|(n?0:8)},function(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u=pt;return(0|bt)<=(0|(pt=pt+16|0))&&yt(16),i=u+8|0,o=u+4|0,St[(n=(a=u)+12|0)>>2]=e,St[i>>2]=r,St[o>>2]=t,St[a>>2]=St[n>>2],n=0|ae(8+(0|St[a>>2])|0,0|St[i>>2],0|St[o>>2]),pt=u,0|n},function(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u,s,f=0,l=0,c=0,d=0,E=0,_=pt;return(0|bt)<=(0|(pt=pt+32|0))&&yt(32),i=_+16|0,o=_+12|0,a=_+8|0,u=_+4|0,St[(n=(s=_)+20|0)>>2]=e,St[i>>2]=r,St[o>>2]=t,St[a>>2]=0,St[u>>2]=St[n>>2],St[s>>2]=(0|St[24+(0|St[u>>2])>>2])-(0|St[20+(0|St[u>>2])>>2]),0==(0|St[s>>2])&&0<(0|St[St[o>>2]>>2])>>>0&&(16384<((St[20+(0|St[u>>2])>>2]=0)|St[St[o>>2]>>2])>>>0&&(St[St[o>>2]>>2]=16384),n=0|nr[15&St[St[16+(0|St[u>>2])>>2]>>2]](0|St[16+(0|St[u>>2])>>2],28+(0|St[u>>2])|0,0|St[o>>2]),St[a>>2]=n,n=0|St[St[o>>2]>>2],St[24+(0|St[u>>2])>>2]=n,St[s>>2]=n),pt=(E=(d=(c=(l=(f=((0|St[s>>2])>>>0>=(0|St[St[o>>2]>>2])>>>0||(St[St[o>>2]>>2]=St[s>>2]),(0|St[u>>2])+28|0),0|St[u>>2]),f+(0|St[(l+20|0)>>2])|0),0|St[i>>2]),St[d>>2]=c,0|St[a>>2]),_),0|E},function(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u,s,f=0,l=0,c=0,d=0,E=0,_=pt;return(0|bt)<=(0|(pt=pt+32|0))&&yt(32),i=_+16|0,o=_+12|0,a=_+8|0,u=_+4|0,St[(n=(s=_)+20|0)>>2]=e,St[i>>2]=r,St[o>>2]=t,St[a>>2]=0,St[u>>2]=St[n>>2],St[s>>2]=(0|St[24+(0|St[u>>2])>>2])-(0|St[20+(0|St[u>>2])>>2]),0==(0|St[s>>2])&&0<(0|St[St[o>>2]>>2])>>>0&&(St[20+(0|St[u>>2])>>2]=0,St[s>>2]=16384,n=0|nr[15&St[St[16+(0|St[u>>2])>>2]>>2]](0|St[16+(0|St[u>>2])>>2],28+(0|St[u>>2])|0,s),St[a>>2]=n,St[24+(0|St[u>>2])>>2]=St[s>>2]),pt=(E=(d=(c=(l=(f=((0|St[s>>2])>>>0>=(0|St[St[o>>2]>>2])>>>0||(St[St[o>>2]>>2]=St[s>>2]),(0|St[u>>2])+28|0),0|St[u>>2]),f+(0|St[(l+20|0)>>2])|0),0|St[i>>2]),St[d>>2]=c,0|St[a>>2]),_),0|E},function(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u,s=0,f=0,l=pt;return(0|bt)<=(0|(pt=pt+32|0))&&yt(32),n=l+20|0,s=l+12|0,o=l+8|0,a=l+4|0,St[(i=(u=l)+16|0)>>2]=e,St[s>>2]=r,St[o>>2]=t,St[a>>2]=St[i>>2],St[u>>2]=(0|St[24+(0|St[a>>2])>>2])-(0|St[20+(0|St[a>>2])>>2]),pt=(f=0|St[u>>2]?((0|St[u>>2])>>>0>(0|St[St[o>>2]>>2])>>>0&&(St[u>>2]=St[St[o>>2]>>2]),Je(0|St[s>>2],28+(0|St[a>>2])+(0|St[20+(0|St[a>>2])>>2])|0,0|St[u>>2]),s=20+(0|St[a>>2])|0,St[s>>2]=(0|St[s>>2])+(0|St[u>>2]),St[St[o>>2]>>2]=St[u>>2],(St[n>>2]=0)|St[n>>2]):(i=0|nr[15&St[St[16+(0|St[a>>2])>>2]>>2]](0|St[16+(0|St[a>>2])>>2],0|St[s>>2],0|St[o>>2]),St[n>>2]=i,0|St[n>>2]),l),0|f},function(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u=pt;return(0|bt)<=(0|(pt=pt+16|0))&&yt(16),i=u+8|0,o=u+4|0,St[(n=(a=u)+12|0)>>2]=e,St[i>>2]=r,St[o>>2]=t,St[a>>2]=St[n>>2],St[24+(0|St[a>>2])>>2]=0,n=(St[20+(0|St[a>>2])>>2]=0)|nr[15&St[4+(0|St[16+(0|St[a>>2])>>2])>>2]](0|St[16+(0|St[a>>2])>>2],0|St[i>>2],0|St[o>>2]),pt=u,0|n},xe,function(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u=0,s=0,f=0,l=0,c=0,d=pt;return(0|bt)<=(0|(pt=pt+48|0))&&yt(48),n=d+16|0,St[(s=(u=d)+32|0)>>2]=r,f=s+4|0,o=0|St[(i=e+48|0)>>2],St[f>>2]=t-(0!=(0|o)&1),a=e+44|0,St[s+8>>2]=St[a>>2],St[s+12>>2]=o,c=1<=(0|(l=0|St[2762]?(g(2,0|e),St[u>>2]=St[e+60>>2],St[u+4>>2]=s,St[u+8>>2]=2,s=0|Be(0|T(145,0|u)),v(0),s):(St[n>>2]=St[e+60>>2],St[4+n>>2]=s,St[8+n>>2]=2,0|Be(0|T(145,0|n)))))?(s=0|St[f>>2])>>>0>>0?(f=0|St[a>>2],u=St[(a=e+4|0)>>2]=f,St[e+8>>2]=u+(l-s),0|St[i>>2]&&(St[a>>2]=u+1,Et[r+(t+-1)>>0]=0|Et[u>>0]),t):l:(St[e>>2]=St[e>>2]|48&l^16,St[e+8>>2]=0,St[e+4>>2]=0,l),pt=d,0|c},er,er,er,er,er],ir=[rr,function(e){0|St[(e|=0)+68>>2]||He()},function(e){0|St[(e|=0)+68>>2]||He()},rr],or=[tr,function(e,r){e|=0,r|=0;var t,n=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(t=n)+4>>2]=e,St[t>>2]=r,Ge(0|St[t>>2]),pt=n},function(e,r){e|=0,r|=0;var t,n=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(t=n)+4>>2]=e,St[t>>2]=r,Ge(0|St[t>>2]),pt=n},tr],ar=[function(e){return F(3),0},function(e){e|=0;var r,t=pt;return(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(r=t)>>2]=St[e+60>>2],e=0|Be(0|U(6,0|r)),pt=t,0|e}],ur=[function(e,r,t,n){return w(4),0},function(e,r,t,n){e|=0,r|=0,t|=0,n|=0;var i,o,a,u,s,f=0,l=pt;for((0|bt)<=(0|(pt=pt+32|0))&&yt(32),o=l+12|0,a=l+8|0,u=l+4|0,St[(i=(s=l)+16|0)>>2]=e,St[o>>2]=r,St[a>>2]=t,St[u>>2]=n,St[s>>2]=St[o>>2];!((0|St[a>>2])>>>0<=0)&&3&St[s>>2];)St[i>>2]=St[(0|St[u>>2])+((255&(St[i>>2]^(0|mt[St[s>>2]>>0])))<<2)>>2]^(0|St[i>>2])>>>8,St[a>>2]=(0|St[a>>2])-1,St[s>>2]=1+(0|St[s>>2]);for(;!((0|St[a>>2])>>>0<4);)St[i>>2]=St[i>>2]^St[St[s>>2]>>2],St[i>>2]=St[(0|St[u>>2])+(768+(255&St[i>>2])<<2)>>2]^St[(0|St[u>>2])+(512+((0|St[i>>2])>>>8&255)<<2)>>2]^St[(0|St[u>>2])+(256+((0|St[i>>2])>>>16&255)<<2)>>2]^St[(0|St[u>>2])+((0|St[i>>2])>>>24<<2)>>2],St[a>>2]=(0|St[a>>2])-4,St[s>>2]=4+(0|St[s>>2]);for(;f=0|St[i>>2],!((0|St[a>>2])>>>0<=0);)St[i>>2]=St[(0|St[u>>2])+((255&(f^(0|mt[St[s>>2]>>0])))<<2)>>2]^(0|St[i>>2])>>>8,St[a>>2]=(0|St[a>>2])-1,St[s>>2]=1+(0|St[s>>2]);return pt=l,0|f}],sr=[function(e,r){return y(5),0},function(e,r){e|=0,r|=0;var t,n,i=pt;return(0|bt)<=(0|(pt=pt+16|0))&&yt(16),t=i+8|0,St[(n=i)+4>>2]=e,St[n>>2]=r,0|St[n>>2]?(r=0|Xe(0|St[n>>2]),St[t>>2]=r):St[t>>2]=0,pt=i,0|St[t>>2]},function(e,r){e|=0,r|=0;var t,n,i=pt;return(0|bt)<=(0|(pt=pt+16|0))&&yt(16),t=i+8|0,St[(n=i)+4>>2]=e,St[n>>2]=r,0|St[n>>2]?(r=0|Xe(0|St[n>>2]),St[t>>2]=r):St[t>>2]=0,pt=i,0|St[t>>2]},function(e,r){e|=0,r|=0;var t,n,i,o=pt;return(0|bt)<=(0|(pt=pt+16|0))&&yt(16),n=o+4|0,St[(t=(i=o)+8|0)>>2]=e,St[n>>2]=r,St[i>>2]=St[t>>2],t=20+(0|St[i>>2])|0,St[t>>2]=(0|St[t>>2])+(0|St[n>>2]),pt=o,0}];return{_sbrk:Ze,_i64Subtract:Nt,_free:Ge,___udivmoddi4:Qe,_i64Add:Dt,_extract:function(e,r){e|=0,r|=0;var t,n,i,o,a,u,s,f,l,c,d,E,_,S,m,h,p,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0,R=0,g=0,T=0,N=0,D=0,P=0,C=0,I=0,L=0;if((0|bt)<=(0|(pt=(r=pt)+16816|0))&&yt(16816),t=r+80|0,n=r+16544|0,i=r+16532|0,o=r+120|0,a=r+112|0,u=r+104|0,f=(s=r)+100|0,l=r+96|0,c=r+92|0,d=r+16548|0,E=r+88|0,_=r+84|0,S=0|function(e,r){e|=0,r|=0;var t=0,n=0,i=0,o=0,a=0;(0|(pt=(t=pt)+32|0))>=(0|bt)&&yt(32);n=t+16|0,i=t,a=0|Rt(2845,0|Et[r>>0],4)?(o=32768|function(e){var r=0,t=0,n=0,i=0;return r=0==(0|Ye(e=e|0,43)),t=0|Et[e>>0],n=r?t<<24>>24!=114&1:2,r=0==(0|Ye(e,120)),i=r?n:128|n,n=0==(0|Ye(e,101)),e=n?i:524288|i,i=t<<24>>24==114?e:64|e,e=t<<24>>24==119?512|i:i,0|(t<<24>>24==97?1024|e:e)}(r),St[i>>2]=e,St[i+4>>2]=o,St[i+8>>2]=438,o=0|Be(0|z(5,0|i)),0<=(0|o)?(i=0|function(e,r){e|=0,r|=0;var t=0,n=0,i=0,o=0,a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0,_=0;(0|(pt=(t=pt)+112|0))>=(0|bt)&&yt(112);if(n=t+40|0,i=t+24|0,o=t+16|0,u=(a=t)+52|0,0|Rt(2845,(s=0|Et[r>>0])<<24>>24,4))if(f=0|Xe(1144)){for(c=f,d=c+112|0;St[c>>2]=0,c=c+4|0,(0|c)<(0|d););0|Ye(r,43)||(St[f>>2]=s<<24>>24==114?8:4),E=0|Ye(r,101)?(St[a>>2]=e,St[a+4>>2]=2,St[a+8>>2]=1,x(221,0|a),0|Et[r>>0]):s,_=E<<24>>24==97?(St[o>>2]=e,St[4+o>>2]=3,1024&(E=0|x(221,0|o))||(St[i>>2]=e,St[i+4>>2]=4,St[i+8>>2]=1024|E,x(221,0|i)),i=128|St[f>>2],St[f>>2]=i):0|St[f>>2],St[f+60>>2]=e,St[f+44>>2]=f+120,St[f+48>>2]=1024,Et[(i=f+75|0)>>0]=-1,0==(8&_|0)&&(St[n>>2]=e,St[4+n>>2]=21505,St[8+n>>2]=u,0==(0|Y(54,0|n)))&&(Et[i>>0]=10),St[f+32>>2]=10,St[f+36>>2]=9,St[f+40>>2]=2,St[f+12>>2]=1,0|St[2763]||(St[f+76>>2]=-1),H(11076),i=0|St[2768],0|(St[f+56>>2]=i)&&(St[i+52>>2]=f),St[2768]=f,V(11076),l=f}else l=0;else f=0|vt(),St[f>>2]=22,l=0;return pt=t,0|l}(o,r))||(St[n>>2]=o,U(6,0|n),0):0):(i=0|vt(),St[i>>2]=22,0);return pt=t,0|a}(e,140),St[f>>2]=0,St[a>>2]=1,St[(e=4+a|0)>>2]=1,St[u>>2]=2,St[4+u>>2]=2,St[(m=8+i|0)>>2]=S,function(e){e|=0;var r=0,t=0;(0|(pt=(r=pt)+16|0))>=(0|bt)&&yt(16),St[(t=r)>>2]=e,St[St[t>>2]>>2]=3,St[4+(0|St[t>>2])>>2]=4,pt=r}(i),function(e,r){e|=0,r|=0;var t=0,n=0,i=0;(0|(pt=(t=pt)+16|0))>=(0|bt)&&yt(16),St[(n=(i=t)+4|0)>>2]=e,St[i>>2]=r,St[St[n>>2]>>2]=0|St[i>>2]?6:5,St[4+(0|St[n>>2])>>2]=3,St[8+(0|St[n>>2])>>2]=7,St[12+(0|St[n>>2])>>2]=8,pt=t}(o,0),St[16+o>>2]=i,function(e){e|=0;var r=0,t=0;(0|(pt=(r=pt)+16|0))>=(0|bt)&&yt(16),St[(t=r)>>2]=e,St[24+(0|St[t>>2])>>2]=0,St[20+(0|St[t>>2])>>2]=0,pt=r}(o),function(){var e=0,r=0,t=0,n=0,i=0,o=0;for((0|(pt=(e=pt)+16|0))>=(0|bt)&&yt(16),t=e+8|0,n=e+4|0,St[(r=(i=e)+12|0)>>2]=0;!(256<=(0|St[r>>2])>>>0);){for(St[t>>2]=St[r>>2],St[n>>2]=0;o=0|St[t>>2],!(8<=(0|St[n>>2])>>>0);)St[t>>2]=o>>>1^-306674912&~((1&St[t>>2])-1),St[n>>2]=1+(0|St[n>>2]);St[2852+(St[r>>2]<<2)>>2]=o,St[r>>2]=1+(0|St[r>>2])}for(;!(2048<=(0|St[r>>2])>>>0);)St[i>>2]=St[2852+((0|St[r>>2])-256<<2)>>2],St[2852+(St[r>>2]<<2)>>2]=St[2852+((255&St[i>>2])<<2)>>2]^(0|St[i>>2])>>>8,St[r>>2]=1+(0|St[r>>2]);St[2761]=1,pt=e}(),J(s),0|function(e,r,t,n){e|=0,r|=0,t|=0,n|=0;var i=0,o=0,a=0,u=0,s=0,f=0,l=0;(0|(pt=(i=pt)+32|0))>=(0|bt)&&yt(32);return a=i+12|0,u=i+8|0,s=i+4|0,St[(o=(f=i)+16|0)>>2]=e,St[a>>2]=r,St[u>>2]=t,St[s>>2]=n,n=0|function(e,r,t,n){e|=0,r|=0,t|=0,n|=0;var i=0,o=0,a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0;(0|(pt=(i=pt)+160|0))>=(0|bt)&&yt(160);if(o=i+112|0,u=i+104|0,s=i+100|0,f=i+96|0,l=i+120|0,c=i+32|0,d=i+24|0,E=i+16|0,_=i+92|0,S=i+88|0,m=i+80|0,h=i+72|0,p=i+68|0,b=i+64|0,k=i+8|0,F=i+60|0,w=i+56|0,y=i+48|0,M=(v=i)+40|0,St[(a=i+108|0)>>2]=e,St[u>>2]=r,St[s>>2]=t,St[f>>2]=n,St[(n=c)>>2]=0,St[n+4>>2]=0,n=0|nr[15&St[12+(0|St[u>>2])>>2]](0|St[u>>2],c,1),St[p>>2]=n,0|St[p>>2])return St[o>>2]=St[p>>2],O=0|St[o>>2],pt=i,0|O;if(p=0|pe(0|St[u>>2],l,32,17),St[b>>2]=p,0|St[b>>2])return St[o>>2]=St[b>>2],O=0|St[o>>2],pt=i,0|O;if(!(0|function(e){e|=0;var r=0,t=0,n=0,i=0,o=0,a=0;(0|(pt=(r=pt)+16|0))>=(0|bt)&&yt(16);t=r+8|0,St[(n=(i=r)+4|0)>>2]=e,St[i>>2]=0;for(;;){if(6<=(0|St[i>>2])>>>0){o=6;break}if((0|mt[(0|St[n>>2])+(0|St[i>>2])>>0])!=(0|mt[346+(0|St[i>>2])>>0])){o=4;break}St[i>>2]=1+(0|St[i>>2])}{if(4==(0|o))return St[t>>2]=0,a=0|St[t>>2],pt=r,0|a;if(6==(0|o))return St[t>>2]=1,a=0|St[t>>2],pt=r,0|a}return 0}(l)))return St[o>>2]=17,O=0|St[o>>2],pt=i,0|O;if(0|mt[l+6>>0])return St[o>>2]=4,O=0|St[o>>2],pt=i,0|O;if(b=0|mt[l+12+4>>0]|(0|mt[l+12+4+1>>0])<<8|(0|mt[l+12+4+2>>0])<<16|(0|mt[l+12+4+3>>0])<<24,St[(p=d)>>2]=0|mt[l+12>>0]|(0|mt[l+12+1>>0])<<8|(0|mt[l+12+2>>0])<<16|(0|mt[l+12+3>>0])<<24,St[p+4>>2]=b,b=0|mt[l+20+4>>0]|(0|mt[l+20+4+1>>0])<<8|(0|mt[l+20+4+2>>0])<<16|(0|mt[l+20+4+3>>0])<<24,St[(p=E)>>2]=0|mt[l+20>>0]|(0|mt[l+20+1>>0])<<8|(0|mt[l+20+2>>0])<<16|(0|mt[l+20+3>>0])<<24,St[p+4>>2]=b,St[S>>2]=0|mt[l+28>>0]|(0|mt[l+28+1>>0])<<8|(0|mt[l+28+2>>0])<<16|(0|mt[l+28+3>>0])<<24,p=0|Dt(0|St[(b=c)>>2],0|St[b+4>>2],32,0),b=32+(0|St[a>>2])|0,St[b>>2]=p,St[b+4>>2]=Ft,(0|(b=0|Pe(l+12|0,20)))!=(0|mt[l+8>>0]|(0|mt[l+8+1>>0])<<8|(0|mt[l+8+2>>0])<<16|(0|mt[l+8+3>>0])<<24|0))return St[o>>2]=3,O=0|St[o>>2],pt=i,0|O;if(St[_>>2]=St[E>>2],0!=(0|St[(l=E)+4>>2])||(0|St[_>>2])!=(0|St[l>>2]))return St[o>>2]=2,O=0|St[o>>2],pt=i,0|O;if(!(0|St[_>>2]))return St[o>>2]=0,O=0|St[o>>2],pt=i,0|O;if(b=0|St[(l=d)>>2],p=0|St[l+4>>2],n=E,t=0|Dt(0|St[(l=d)>>2],0|St[l+4>>2],0|St[n>>2],0|St[n+4>>2]),p>>>0>(n=Ft)>>>0|(0|p)==(0|n)&t>>>0>>0||(b=0|St[(t=d)>>2],n=0|St[t+4>>2],p=E,l=0|Dt(0|St[(t=d)>>2],0|St[t+4>>2],0|St[p>>2],0|St[p+4>>2]),p=0|Dt(0|l,0|Ft,32,0),n>>>0>(l=Ft)>>>0|(0|n)==(0|l)&p>>>0>>0))return St[o>>2]=17,O=0|St[o>>2],pt=i,0|O;if(St[(p=k)>>2]=0,St[p+4>>2]=0,p=0|nr[15&St[12+(0|St[u>>2])>>2]](0|St[u>>2],k,2),St[F>>2]=p,0|St[F>>2])return St[o>>2]=St[F>>2],O=0|St[o>>2],pt=i,0|O;if(p=0|St[(F=k)>>2],b=0|St[F+4>>2],l=d,n=0|Dt(0|St[(F=c)>>2],0|St[F+4>>2],0|St[l>>2],0|St[l+4>>2]),b>>>0<(l=Ft)>>>0|(0|b)==(0|l)&p>>>0>>0||(p=0|St[(n=k)>>2],l=0|St[n+4>>2],b=0|Dt(0|St[(n=c)>>2],0|St[n+4>>2],32,0),F=0|Dt(0|b,0|Ft,0|St[(n=d)>>2],0|St[n+4>>2]),l>>>0<(n=Ft)>>>0|(0|l)==(0|n)&p>>>0>>0)||(k=0|St[(F=k)>>2],p=0|St[F+4>>2],n=0|Dt(0|St[(F=c)>>2],0|St[F+4>>2],32,0),l=0|Dt(0|n,0|Ft,0|St[(F=d)>>2],0|St[F+4>>2]),E=0|Dt(0|l,0|Ft,0|St[(F=E)>>2],0|St[F+4>>2]),p>>>0<(F=Ft)>>>0|(0|p)==(0|F)&k>>>0>>0))return St[o>>2]=6,O=0|St[o>>2],pt=i,0|O;if(E=0|St[u>>2],c=0|Dt(0|St[(k=c)>>2],0|St[k+4>>2],32,0),d=0|Dt(0|c,0|Ft,0|St[(k=d)>>2],0|St[k+4>>2]),k=0|he(E,d,Ft),St[w>>2]=k,0|St[w>>2])return St[o>>2]=St[w>>2],O=0|St[o>>2],pt=i,0|O;if(!(0|Ie(m,0|St[_>>2],0|St[f>>2])))return St[o>>2]=2,O=0|St[o>>2],pt=i,0|O;w=0|function(e,r,t){e|=0,r|=0,t|=0;var n=0,i=0,o=0,a=0;(0|(pt=(n=pt)+16|0))>=(0|bt)&&yt(16);return o=n+4|0,St[(i=(a=n)+8|0)>>2]=e,St[o>>2]=r,St[a>>2]=t,t=0|pe(0|St[i>>2],0|St[o>>2],0|St[a>>2],6),pt=n,0|t}(0|St[u>>2],0|St[m>>2],0|St[_>>2]),St[h>>2]=w;do{if(0==(0|St[h>>2])&&(St[h>>2]=16,(0|(w=0|Pe(0|St[m>>2],0|St[_>>2])))==(0|St[S>>2]))){St[y>>2]=St[m>>2],St[4+y>>2]=St[4+m>>2],w=0|ue(y,v),St[h>>2]=w,w=v;do{if(0==(0|St[h>>2])&(23==(0|St[w>>2])&0==(0|St[w+4>>2]))){if(Ce(M),k=32+(0|St[a>>2])|0,d=0|function(e,r,t,n,i,o){e|=0,r|=0,t|=0,n|=0,i|=0,o|=0;var a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0;(0|(pt=(a=pt)+80|0))>=(0|bt)&&yt(80);return s=a+64|0,f=a+60|0,c=(l=a)+56|0,d=a+24|0,E=a+20|0,_=a+16|0,S=a+12|0,m=a+8|0,St[(u=a+68|0)>>2]=e,St[s>>2]=r,St[f>>2]=t,St[(t=l)>>2]=n,St[t+4>>2]=i,St[c>>2]=o,St[E>>2]=0,St[_>>2]=0,St[S>>2]=0,q(d),o=l,l=0|function(e,r,t,n,i,o,a,u,s,f){e|=0,r|=0,t|=0,n|=0,i|=0,o|=0,a|=0,u|=0,s|=0,f|=0;var l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0,R=0,g=0;(0|(pt=(l=pt)+96|0))>=(0|bt)&&yt(96);if(c=l+80|0,E=l+72|0,_=l+68|0,S=l+16|0,m=l+64|0,h=l+60|0,p=l+56|0,b=l+52|0,k=l+48|0,F=l+44|0,w=l+8|0,y=l+40|0,M=(v=l)+36|0,O=l+32|0,A=l+28|0,R=l+24|0,St[(d=l+76|0)>>2]=e,St[E>>2]=r,St[_>>2]=t,St[(t=S)>>2]=n,St[t+4>>2]=i,St[m>>2]=o,St[h>>2]=a,St[p>>2]=u,St[b>>2]=s,St[k>>2]=f,St[F>>2]=0,f=0|se(0|St[E>>2],w,0|St[m>>2],F,0|St[h>>2],0|St[p>>2],0|St[b>>2],0|St[k>>2],0|St[k>>2]),St[O>>2]=f,0|St[O>>2])return St[c>>2]=St[O>>2],g=0|St[c>>2],pt=l,0|g;if(O=S,f=0|Dt(0|St[(S=w)>>2],0|St[4+S>>2],0|St[O>>2],0|St[O+4>>2]),St[(O=w)>>2]=f,St[O+4>>2]=Ft,1!=(0|St[24+(0|St[m>>2])>>2]))return St[c>>2]=16,g=0|St[c>>2],pt=l,0|g;if(St[y>>2]=St[12+(0|St[m>>2])>>2],O=0|G(0|St[y>>2]),St[(f=v)>>2]=O,St[f+4>>2]=Ft,f=w,O=0|he(0|St[d>>2],0|St[f>>2],0|St[f+4>>2]),St[A>>2]=O,0|St[A>>2])return St[c>>2]=St[A>>2],g=0|St[c>>2],pt=l,0|g;if(!(0|Ie(0|St[_>>2],0|St[v>>2],0|St[k>>2])))return St[c>>2]=2,g=0|St[c>>2],pt=l,0|g;if(A=w,w=0|Re(0|St[y>>2],0|St[St[m>>2]>>2],0|St[d>>2],0|St[A>>2],0|St[A+4>>2],0|St[St[_>>2]>>2],0|St[v>>2],0|St[k>>2],0,0),St[M>>2]=w,St[R>>2]=St[M>>2],0|St[R>>2])return St[c>>2]=St[R>>2],g=0|St[c>>2],pt=l,0|g;if(0|St[28+(0|St[y>>2])>>2]&&(0|(R=0|Pe(0|St[St[_>>2]>>2],0|St[v>>2])))!=(0|St[32+(0|St[y>>2])>>2]))return St[c>>2]=3,g=0|St[c>>2],pt=l,0|g;return St[c>>2]=0,g=0|St[c>>2],pt=l,0|g}(0|St[u>>2],0|St[s>>2],0|St[f>>2],0|St[o>>2],0|St[o+4>>2],d,E,_,S,0|St[c>>2]),St[m>>2]=l,Z(d,0|St[c>>2]),or[3&St[4+(0|St[c>>2])>>2]](0|St[c>>2],0|St[E>>2]),or[3&St[4+(0|St[c>>2])>>2]](0|St[c>>2],0|St[_>>2]),or[3&St[4+(0|St[c>>2])>>2]](0|St[c>>2],0|St[S>>2]),pt=a,0|St[m>>2]}(0|St[u>>2],y,M,0|St[k>>2],0|St[k+4>>2],0|St[f>>2]),St[h>>2]=d,d=0|St[f>>2],0|St[h>>2]){Le(M,d);break}Le(m,d),St[m>>2]=St[M>>2],St[4+m>>2]=St[4+M>>2],St[y>>2]=St[m>>2],St[4+y>>2]=St[4+m>>2],d=0|ue(y,v),St[h>>2]=d;break}}while(0);if(0|St[h>>2])break;if(1==(0|St[(w=v)>>2])&0==(0|St[w+4>>2])){w=0|function(e,r,t,n){e|=0,r|=0,t|=0,n|=0;var i=0,o=0,a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0,_=0,S=0;(0|(pt=(i=pt)+48|0))>=(0|bt)&&yt(48);return a=i+36|0,u=i+32|0,s=i+28|0,f=i+24|0,l=i+20|0,c=i+16|0,d=i+12|0,E=i+8|0,_=i+4|0,St[(o=(S=i)+40|0)>>2]=e,St[a>>2]=r,St[u>>2]=t,St[s>>2]=n,St[f>>2]=0,St[l>>2]=0,St[c>>2]=0,St[d>>2]=0,St[E>>2]=0,St[_>>2]=0,n=0|function(e,r,t,n,i,o,a,u,s,f){e|=0,r|=0,t|=0,n|=0,i|=0,o|=0,a|=0,u|=0,s|=0,f|=0;var l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0,R=0,g=0,T=0,N=0,D=0,P=0,C=0,I=0,L=0,x=0,B=0,H=0,U=0,z=0,Y=0,V=0,K=0,W=0,j=0,X=0,G=0,q=0,Q=0,Z=0,J=0,$=0,ee=0,re=0,te=0,ne=0,ie=0,oe=0,ae=0;(0|(pt=(l=pt)+208|0))>=(0|bt)&&yt(208);if(c=l+188|0,E=l+180|0,_=l+176|0,S=l+172|0,m=l+168|0,h=l+164|0,p=l+160|0,b=l+156|0,k=l+152|0,F=l+148|0,w=l+8|0,y=l+144|0,v=l+140|0,M=l+136|0,O=l+132|0,A=l+128|0,R=l+124|0,g=l+120|0,T=l+116|0,N=l+112|0,D=l+108|0,P=l+104|0,I=(C=l)+100|0,L=l+96|0,x=l+92|0,B=l+88|0,H=l+84|0,U=l+80|0,z=l+76|0,Y=l+72|0,V=l+68|0,K=l+64|0,W=l+60|0,j=l+56|0,X=l+193|0,G=l+52|0,q=l+48|0,Q=l+44|0,Z=l+40|0,J=l+192|0,$=l+36|0,ee=l+32|0,re=l+28|0,te=l+24|0,ne=l+20|0,ie=l+16|0,St[(d=l+184|0)>>2]=e,St[E>>2]=r,St[_>>2]=t,St[S>>2]=n,St[m>>2]=i,St[h>>2]=o,St[p>>2]=a,St[b>>2]=u,St[k>>2]=s,St[F>>2]=f,St[y>>2]=0,St[v>>2]=0,St[M>>2]=0,St[O>>2]=0,f=0|ue(0|St[E>>2],w),St[R>>2]=f,0|St[R>>2])return St[c>>2]=St[R>>2],oe=0|St[c>>2],pt=l,0|oe;if(2==(0|St[(R=w)>>2])&0==(0|St[R+4>>2])){if(R=0|function(e){e|=0;var r=0,t=0,n=0,i=0,o=0,a=0,u=0;(0|(pt=(r=pt)+32|0))>=(0|bt)&&yt(32);t=r+16|0,o=(i=r)+8|0,St[(n=r+12|0)>>2]=e;for(;;){if(e=0|ue(0|St[n>>2],i),St[o>>2]=e,0|St[o>>2]){a=3;break}if(0==(0|St[(e=i)>>2])&0==(0|St[e+4>>2])){a=6;break}me(0|St[n>>2])}{if(3==(0|a))return St[t>>2]=St[o>>2],u=0|St[t>>2],pt=r,0|u;if(6==(0|a))return St[t>>2]=0,u=0|St[t>>2],pt=r,0|u}return 0}(0|St[E>>2]),St[g>>2]=R,0|St[g>>2])return St[c>>2]=St[g>>2],oe=0|St[c>>2],pt=l,0|oe;if(g=0|ue(0|St[E>>2],w),St[T>>2]=g,0|St[T>>2])return St[c>>2]=St[T>>2],oe=0|St[c>>2],pt=l,0|oe}if(4==(0|St[(T=w)>>2])&0==(0|St[T+4>>2])){if(T=0|se(0|St[E>>2],40+(0|St[d>>2])|0,0|St[d>>2],y,0|St[_>>2],0|St[S>>2],0|St[m>>2],0|St[k>>2],0|St[F>>2]),St[N>>2]=T,0|St[N>>2])return St[c>>2]=St[N>>2],oe=0|St[c>>2],pt=l,0|oe;if(N=32+(0|St[d>>2])|0,T=40+(0|St[d>>2])|0,g=0|Dt(0|St[(y=T)>>2],0|St[y+4>>2],0|St[N>>2],0|St[N+4>>2]),St[(N=T)>>2]=g,St[N+4>>2]=Ft,N=0|ue(0|St[E>>2],w),St[D>>2]=N,0|St[D>>2])return St[c>>2]=St[D>>2],oe=0|St[c>>2],pt=l,0|oe}if(0==(0|St[(D=w)>>2])&0==(0|St[D+4>>2]))return St[c>>2]=0,oe=0|St[c>>2],pt=l,0|oe;if(5!=(0|St[(D=w)>>2])|0!=(0|St[D+4>>2]))return St[c>>2]=16,oe=0|St[c>>2],pt=l,0|oe;if(D=0|fe(0|St[E>>2],v),St[P>>2]=D,0|St[P>>2])return St[c>>2]=St[P>>2],oe=0|St[c>>2],pt=l,0|oe;if(St[28+(0|St[d>>2])>>2]=St[v>>2],0|St[v>>2]){if(P=0|sr[3&St[St[k>>2]>>2]](0|St[k>>2],St[v>>2]<<5),!(St[M>>2]=P))return St[c>>2]=2,oe=0|St[c>>2],pt=l,0|oe}else St[M>>2]=0;St[16+(0|St[d>>2])>>2]=St[M>>2],St[A>>2]=0;for(;!((0|St[A>>2])>>>0>=(0|St[v>>2])>>>0);)!function(e){e|=0;var r=0,t=0;(0|(pt=(r=pt)+16|0))>=(0|bt)&&yt(16),St[(t=r)>>2]=e,Et[24+(0|St[t>>2])>>0]=1,Et[25+(0|St[t>>2])>>0]=0,Et[26+(0|St[t>>2])>>0]=0,Et[27+(0|St[t>>2])>>0]=0,Et[28+(0|St[t>>2])>>0]=0,pt=r}((0|St[M>>2])+(St[A>>2]<<5)|0),St[A>>2]=1+(0|St[A>>2]);e:for(;;){if(P=0|ue(0|St[E>>2],w),St[I>>2]=P,0|St[I>>2]){ae=27;break}if(0==(0|St[(P=w)>>2])&0==(0|St[P+4>>2])){ae=86;break}if(P=0|le(0|St[E>>2],C),St[L>>2]=P,0|St[L>>2]){ae=30;break}if(0<(D=0|St[(P=C)+4>>2])>>>0|(0==(0|D)?(0|St[P>>2])>>>0>(0|St[4+(0|St[E>>2])>>2])>>>0:0)){ae=32;break}if((0|(P=0|St[w>>2]))==(0|St[(D=w)>>2])&&(((0|P)<0)<<31>>31|0)==(0|St[D+4>>2]))switch(0|St[w>>2]){case 17:if(P=0|de(0|St[E>>2]),St[H>>2]=P,0|St[H>>2]){ae=38;break e}if(St[B>>2]=(0|St[C>>2])-1,1&St[B>>2]|0){ae=40;break e}if(!(0|Ie(68+(0|St[d>>2])|0,0|St[B>>2],0|St[k>>2]))){ae=42;break e}if(1+(0|St[v>>2])|0){if(P=0|sr[3&St[St[k>>2]>>2]](0|St[k>>2],1+(0|St[v>>2])<<2),!(St[64+(0|St[d>>2])>>2]=P)){ae=46;break e}}else St[64+(0|St[d>>2])>>2]=0;if(Je(0|St[68+(0|St[d>>2])>>2],0|St[St[E>>2]>>2],0|St[B>>2]),P=0|function(e,r,t,n){e|=0,r|=0,t|=0,n|=0;var i=0,o=0,a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0;(0|(pt=(i=pt)+32|0))>=(0|bt)&&yt(32);o=i+24|0,u=i+16|0,s=i+12|0,f=i+8|0,l=i+4|0,St[(a=(c=i)+20|0)>>2]=e,St[u>>2]=r,St[s>>2]=t,St[f>>2]=n,St[c>>2]=0,St[l>>2]=0;r:for(;;){if(n=(0|St[l>>2])>>>0<(0|St[s>>2])>>>0,St[(0|St[f>>2])+(St[l>>2]<<2)>>2]=St[c>>2],!n){d=9;break}for(;;){if((0|St[c>>2])>>>0>=(0|St[u>>2])>>>0){d=4;break r}if(0==(0|mt[(0|St[a>>2])+(St[c>>2]<<1)>>0])&&0==(0|mt[(0|St[a>>2])+(1+(St[c>>2]<<1))>>0]))break;St[c>>2]=1+(0|St[c>>2])}St[c>>2]=1+(0|St[c>>2]),St[l>>2]=1+(0|St[l>>2])}{if(4==(0|d))return St[o>>2]=16,E=0|St[o>>2],pt=i,0|E;if(9==(0|d))return St[o>>2]=(0|St[c>>2])==(0|St[u>>2])?0:16,E=0|St[o>>2],pt=i,0|E}return 0}(0|St[St[E>>2]>>2],(0|St[B>>2])>>>1,0|St[v>>2],0|St[64+(0|St[d>>2])>>2]),St[U>>2]=P,0|St[U>>2]){ae=48;break e}if(P=0|ce(0|St[E>>2],0|St[B>>2],0),St[z>>2]=P,0|St[z>>2]){ae=50;break e}continue e;case 14:if(P=0|Ee(0|St[E>>2],0|St[v>>2],0|St[h>>2],0|St[F>>2]),St[Y>>2]=P,0|St[Y>>2]){ae=52;break e}for(St[O>>2]=0,St[A>>2]=0;;){if((0|St[A>>2])>>>0>=(0|St[v>>2])>>>0)continue e;0|Et[(0|St[St[h>>2]>>2])+(0|St[A>>2])>>0]&&(St[O>>2]=1+(0|St[O>>2])),St[A>>2]=1+(0|St[A>>2])}break;case 15:if(P=0|Ee(0|St[E>>2],0|St[O>>2],0|St[p>>2],0|St[F>>2]),St[V>>2]=P,0|St[V>>2]){ae=59;break e}continue e;case 21:if(P=0|_e(0|St[E>>2],0|St[v>>2],0|St[b>>2],0|St[F>>2]),St[K>>2]=P,0|St[K>>2]){ae=61;break e}if(P=0|de(0|St[E>>2]),St[W>>2]=P,0|St[W>>2]){ae=63;break e}for(St[A>>2]=0;!((0|St[A>>2])>>>0>=(0|St[v>>2])>>>0);){if(St[j>>2]=(0|St[M>>2])+(St[A>>2]<<5),Et[X>>0]=0|Et[(0|St[St[b>>2]>>2])+(0|St[A>>2])>>0],Et[29+(0|St[j>>2])>>0]=0|Et[X>>0],(St[20+(0|St[j>>2])>>2]=0)|Et[X>>0]&&(P=0|Se(0|St[E>>2],20+(0|St[j>>2])|0),St[G>>2]=P,0|St[G>>2])){ae=68;break e}St[A>>2]=1+(0|St[A>>2])}or[3&St[4+(0|St[F>>2])>>2]](0|St[F>>2],0|St[St[b>>2]>>2]),St[St[b>>2]>>2]=0;continue e;case 20:if(P=0|_e(0|St[E>>2],0|St[v>>2],0|St[b>>2],0|St[F>>2]),St[q>>2]=P,0|St[q>>2]){ae=72;break e}if(P=0|de(0|St[E>>2]),St[Q>>2]=P,0|St[Q>>2]){ae=74;break e}for(St[A>>2]=0;!((0|St[A>>2])>>>0>=(0|St[v>>2])>>>0);){if(St[Z>>2]=(0|St[M>>2])+(St[A>>2]<<5),Et[J>>0]=0|Et[(0|St[St[b>>2]>>2])+(0|St[A>>2])>>0],Et[28+(0|St[Z>>2])>>0]=0|Et[J>>0],St[4+(0|St[Z>>2])>>2]=0,(St[St[Z>>2]>>2]=0)|Et[J>>0]){if(P=0|Se(0|St[E>>2],0|St[Z>>2]),St[$>>2]=P,0|St[$>>2]){ae=79;break e}if(P=0|Se(0|St[E>>2],4+(0|St[Z>>2])|0),St[ee>>2]=P,0|St[ee>>2]){ae=81;break e}}St[A>>2]=1+(0|St[A>>2])}or[3&St[4+(0|St[F>>2])>>2]](0|St[F>>2],0|St[St[b>>2]>>2]),St[St[b>>2]>>2]=0;continue e;default:if(P=C,D=0|ce(0|St[E>>2],0|St[P>>2],0|St[P+4>>2]),St[re>>2]=D,0|St[re>>2]){ae=85;break e}continue e}else if(D=C,P=0|ce(0|St[E>>2],0|St[D>>2],0|St[D+4>>2]),St[x>>2]=P,0|St[x>>2]){ae=35;break}}switch(0|ae){case 27:return St[c>>2]=St[I>>2],oe=0|St[c>>2],pt=l,0|oe;case 30:return St[c>>2]=St[L>>2],oe=0|St[c>>2],pt=l,0|oe;case 32:return St[c>>2]=16,oe=0|St[c>>2],pt=l,0|oe;case 35:return St[c>>2]=St[x>>2],oe=0|St[c>>2],pt=l,0|oe;case 38:return St[c>>2]=St[H>>2],oe=0|St[c>>2],pt=l,0|oe;case 40:return St[c>>2]=16,oe=0|St[c>>2],pt=l,0|oe;case 42:case 46:return St[c>>2]=2,oe=0|St[c>>2],pt=l,0|oe;case 48:return St[c>>2]=St[U>>2],oe=0|St[c>>2],pt=l,0|oe;case 50:return St[c>>2]=St[z>>2],oe=0|St[c>>2],pt=l,0|oe;case 52:return St[c>>2]=St[Y>>2],oe=0|St[c>>2],pt=l,0|oe;case 59:return St[c>>2]=St[V>>2],oe=0|St[c>>2],pt=l,0|oe;case 61:return St[c>>2]=St[K>>2],oe=0|St[c>>2],pt=l,0|oe;case 63:return St[c>>2]=St[W>>2],oe=0|St[c>>2],pt=l,0|oe;case 68:return St[c>>2]=St[G>>2],oe=0|St[c>>2],pt=l,0|oe;case 72:return St[c>>2]=St[q>>2],oe=0|St[c>>2],pt=l,0|oe;case 74:return St[c>>2]=St[Q>>2],oe=0|St[c>>2],pt=l,0|oe;case 79:return St[c>>2]=St[$>>2],oe=0|St[c>>2],pt=l,0|oe;case 81:return St[c>>2]=St[ee>>2],oe=0|St[c>>2],pt=l,0|oe;case 85:return St[c>>2]=St[re>>2],oe=0|St[c>>2],pt=l,0|oe;case 86:for(St[te>>2]=0,St[ne>>2]=0,St[A>>2]=0;!((0|St[A>>2])>>>0>=(0|St[v>>2])>>>0);)St[ie>>2]=(0|St[M>>2])+(St[A>>2]<<5),(Et[26+(0|St[ie>>2])>>0]=0)|St[St[h>>2]>>2]?Et[24+(0|St[ie>>2])>>0]=0|mt[(0|St[St[h>>2]>>2])+(0|St[A>>2])>>0]?0:1:Et[24+(0|St[ie>>2])>>0]=1,0|Et[24+(0|St[ie>>2])>>0]?(Et[25+(0|St[ie>>2])>>0]=0,re=(0|St[St[_>>2]>>2])+(St[ne>>2]<<3)|0,ee=0|St[re+4>>2],$=8+(0|St[ie>>2])|0,St[$>>2]=St[re>>2],St[$+4>>2]=ee,St[16+(0|St[ie>>2])>>2]=St[(0|St[St[m>>2]>>2])+(St[ne>>2]<<2)>>2],Et[27+(0|St[ie>>2])>>0]=0|Et[(0|St[St[S>>2]>>2])+(0|St[ne>>2])>>0],St[ne>>2]=1+(0|St[ne>>2])):(0|St[St[p>>2]>>2]?Et[25+(0|St[ie>>2])>>0]=0|mt[(0|St[St[p>>2]>>2])+(0|St[te>>2])>>0]?0:1:Et[25+(0|St[ie>>2])>>0]=1,St[te>>2]=1+(0|St[te>>2]),ee=8+(0|St[ie>>2])|0,St[ee>>2]=0,St[ee+4>>2]=0,St[16+(0|St[ie>>2])>>2]=0,Et[27+(0|St[ie>>2])>>0]=0),St[A>>2]=1+(0|St[A>>2]);return A=0|function(e,r){e|=0,r|=0;var t=0,n=0,i=0,o=0,a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0,_=0;(0|(pt=(t=pt)+48|0))>=(0|bt)&&yt(48);if(n=t+40|0,o=t+32|0,a=t+28|0,s=(u=t)+24|0,f=t+20|0,l=t+16|0,c=t+12|0,d=t+8|0,St[(i=t+36|0)>>2]=e,St[o>>2]=r,St[a>>2]=0,St[(r=u)>>2]=0,St[r+4>>2]=0,St[f>>2]=0,St[l>>2]=0,0|St[24+(0|St[i>>2])>>2]){if(r=0|sr[3&St[St[o>>2]>>2]](0|St[o>>2],St[24+(0|St[i>>2])>>2]<<2),!(St[48+(0|St[i>>2])>>2]=r))return St[n>>2]=2,E=0|St[n>>2],pt=t,0|E}else St[48+(0|St[i>>2])>>2]=0;St[s>>2]=0;for(;!((0|St[s>>2])>>>0>=(0|St[24+(0|St[i>>2])>>2])>>>0);)St[(0|St[48+(0|St[i>>2])>>2])+(St[s>>2]<<2)>>2]=St[a>>2],St[a>>2]=(0|St[a>>2])+(0|St[(0|St[12+(0|St[i>>2])>>2])+(40*(0|St[s>>2])|0)+24>>2]),St[s>>2]=1+(0|St[s>>2]);if(0|St[20+(0|St[i>>2])>>2]){if(a=0|sr[3&St[St[o>>2]>>2]](0|St[o>>2],St[20+(0|St[i>>2])>>2]<<3),!(St[52+(0|St[i>>2])>>2]=a))return St[n>>2]=2,E=0|St[n>>2],pt=t,0|E}else St[52+(0|St[i>>2])>>2]=0;St[s>>2]=0;for(;!((0|St[s>>2])>>>0>=(0|St[20+(0|St[i>>2])>>2])>>>0);)r=0|St[(a=u)+4>>2],e=(0|St[52+(0|St[i>>2])>>2])+(St[s>>2]<<3)|0,St[e>>2]=St[a>>2],St[e+4>>2]=r,r=(0|St[St[i>>2]>>2])+(St[s>>2]<<3)|0,a=0|Dt(0|St[(e=u)>>2],0|St[e+4>>2],0|St[r>>2],0|St[r+4>>2]),St[(r=u)>>2]=a,St[r+4>>2]=Ft,St[s>>2]=1+(0|St[s>>2]);if(0|St[24+(0|St[i>>2])>>2]){if(u=0|sr[3&St[St[o>>2]>>2]](0|St[o>>2],St[24+(0|St[i>>2])>>2]<<2),!(St[56+(0|St[i>>2])>>2]=u))return St[n>>2]=2,E=0|St[n>>2],pt=t,0|E}else St[56+(0|St[i>>2])>>2]=0;if(0|St[28+(0|St[i>>2])>>2]){if(u=0|sr[3&St[St[o>>2]>>2]](0|St[o>>2],St[28+(0|St[i>>2])>>2]<<2),!(St[60+(0|St[i>>2])>>2]=u))return St[n>>2]=2,E=0|St[n>>2],pt=t,0|E}else St[60+(0|St[i>>2])>>2]=0;St[s>>2]=0;e:for(;;){if((0|St[s>>2])>>>0>=(0|St[28+(0|St[i>>2])>>2])>>>0){_=36;break}if(St[c>>2]=(0|St[16+(0|St[i>>2])>>2])+(St[s>>2]<<5),St[d>>2]=1&(0!=(0|Et[24+(0|St[c>>2])>>0])^1),0!=(0|St[d>>2])&0==(0|St[l>>2]))St[(0|St[60+(0|St[i>>2])>>2])+(St[s>>2]<<2)>>2]=-1;else{r:do{if(!(0|St[l>>2]))for(;;){if((0|St[f>>2])>>>0>=(0|St[24+(0|St[i>>2])>>2])>>>0){_=29;break e}if(St[(0|St[56+(0|St[i>>2])>>2])+(St[f>>2]<<2)>>2]=St[s>>2],0|St[(0|St[12+(0|St[i>>2])>>2])+(40*(0|St[f>>2])|0)+36>>2])break r;St[f>>2]=1+(0|St[f>>2])}}while(0);St[(0|St[60+(0|St[i>>2])>>2])+(St[s>>2]<<2)>>2]=St[f>>2],0==(0|St[d>>2])&&(St[l>>2]=1+(0|St[l>>2]),(0|St[l>>2])>>>0>=(0|St[(0|St[12+(0|St[i>>2])>>2])+(40*(0|St[f>>2])|0)+36>>2])>>>0)&&(St[f>>2]=1+(0|St[f>>2]),St[l>>2]=0)}St[s>>2]=1+(0|St[s>>2])}{if(29==(0|_))return St[n>>2]=16,E=0|St[n>>2],pt=t,0|E;if(36==(0|_))return St[n>>2]=0,E=0|St[n>>2],pt=t,0|E}return 0}(0|St[d>>2],0|St[k>>2]),St[c>>2]=A,oe=0|St[c>>2],pt=l,0|oe}return 0}(0|St[o>>2],0|St[a>>2],f,l,c,d,E,_,0|St[u>>2],0|St[s>>2]),St[S>>2]=n,or[3&St[4+(0|St[s>>2])>>2]](0|St[s>>2],0|St[f>>2]),or[3&St[4+(0|St[s>>2])>>2]](0|St[s>>2],0|St[l>>2]),or[3&St[4+(0|St[s>>2])>>2]](0|St[s>>2],0|St[c>>2]),or[3&St[4+(0|St[s>>2])>>2]](0|St[s>>2],0|St[d>>2]),or[3&St[4+(0|St[s>>2])>>2]](0|St[s>>2],0|St[E>>2]),or[3&St[4+(0|St[s>>2])>>2]](0|St[s>>2],0|St[_>>2]),pt=i,0|St[S>>2]}(0|St[a>>2],y,0|St[s>>2],0|St[f>>2]),St[h>>2]=w;break}St[h>>2]=4;break}}while(0);return Le(m,0|St[f>>2]),St[o>>2]=St[h>>2],O=0|St[o>>2],pt=i,0|O}(0|St[o>>2],0|St[a>>2],0|St[u>>2],0|St[s>>2]),St[f>>2]=n,pt=(l=(0|St[f>>2]&&$(0|St[o>>2],0|St[u>>2]),0|St[f>>2]),i),0|l}(s,o,a,u))return $(s,a),oe(m),K(1),void(pt=r);St[l>>2]=-1,S=(St[c>>2]=0)|St[(i=s+28|0)>>2];e:do{if(S){for(h=s+16|0,p=0|St[h>>2],k=0,F=0;F=0|Dt(0|St[(w=p+(k<<5)+8|0)>>2],0|St[w+4>>2],0|F,0),k=k+1|0,(0|k)!=(0|S););for(v=y=w=k=0,M=p,O=S;;){if(Pt(0|d,0,255),St[E>>2]=0,(St[_>>2]=0)|Et[M+(v<<5)+25>>0])P=y,C=k,I=w,L=O;else{if(w>>>0<(A=0|ee(s,v,0))>>>0){if(Ge(k),!(R=0|Xe(A<<1)))break;g=R,T=A}else g=k,T=w;if(ee(s,v,g),0|g){for(A=St[n>>2]=0;0|_t[g+(A<<1)>>1];)A=A+1|0;j(0,n,g,A),N=1+(0|St[n>>2])|0,0|(D=0|Xe(St[n>>2]=N))&&0|j(D,n,g,A)&&(Et[D+(0|St[n>>2])>>0]=0,function(e,r,t){e|=0,r|=0,t|=0;var n=0,i=0,o=0,a=0,u=0,s=0;(0|(pt=(n=pt)+32|0))>=(0|bt)&&yt(32),o=n+12|0,a=n+8|0,u=n+4|0,St[(i=(s=n)+16|0)>>2]=e,St[o>>2]=r,St[a>>2]=t,St[u>>2]=0,St[s>>2]=St[a>>2];r:do{if(0|St[s>>2])for(;;){if(t=(0|St[s>>2])-1|0,!(St[s>>2]=t))break r;if(t=0|St[o>>2],St[o>>2]=t+1,r=0|Et[t>>0],t=0|St[i>>2],St[i>>2]=t+1,!((Et[t>>0]=r)<<24>>24))break r;St[u>>2]=1+(0|St[u>>2])}}while(0);if(0|St[s>>2])return St[u>>2],pt=n;for(0|St[a>>2]&&(Et[St[i>>2]>>0]=0);i=0|St[o>>2],St[o>>2]=i+1,0|Et[i>>0];)St[u>>2]=1+(0|St[u>>2]);St[u>>2],pt=n}(d,D,255)),Ge(D)}D=0|St[M+(v<<5)+8>>2],0|(N=0|W(s,o,v,l,f,c,E,_,a,u,F,y))&&(St[t>>2]=N,function(e,r){e|=0,r|=0;var t=0,n=0;(0|(pt=(t=pt)+16|0))>=(0|bt)&&yt(16),St[(n=t)>>2]=r,r=0|function(e,r,t){e|=0,r|=0,t|=0;var n=0,i=0,o=0,a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0;(0|(pt=(n=pt)+224|0))>=(0|bt)&&yt(224);i=n+120|0,u=(a=n)+136|0,f=40+(s=o=n+80|0)|0;for(;St[s>>2]=0,s=s+4|0,(0|s)<(0|f););St[i>>2]=St[t>>2],l=(0|Ue(0,r,i,a,o))<0?-1:(c=-1<(0|St[e+76>>2])?0|ze():0,t=0|St[e>>2],s=32&t,(0|Et[e+74>>0])<1&&(St[e>>2]=-33&t),m=0|St[(t=e+48|0)>>2]?0|Ue(e,r,i,a,o):(d=0|St[(f=e+44|0)>>2],St[f>>2]=u,St[(E=e+28|0)>>2]=u,St[(_=e+20|0)>>2]=u,St[t>>2]=80,St[(S=e+16|0)>>2]=80+u,u=0|Ue(e,r,i,a,o),d?(nr[15&St[e+36>>2]](e,0,0),h=0==(0|St[_>>2])?-1:u,St[f>>2]=d,St[t>>2]=0,St[S>>2]=0,St[E>>2]=0,St[_>>2]=0,h):u),o=0|St[e>>2],St[e>>2]=o|s,0|c&&He(),0==(32&o|0)?m:-1);return pt=n,0|l}(0|St[5],e,n),pt=t}(169,t)),B(0,0|d,0|D,(0|St[f>>2])+(0|St[E>>2])|0),P=D+y|0,C=g,I=T,L=0|St[i>>2]}if(L>>>0<=(D=v+1|0)>>>0){b=C;break e}k=C,w=I,y=P,v=D,M=0|St[h>>2],O=L}b=R}else b=0}while(0);Ge(b),or[3&St[e>>2]](a,0|St[f>>2]),$(s,a),oe(m),K(1),pt=r},_pthread_self:$e,_memset:Pt,_llvm_cttz_i32:qe,_malloc:Xe,_memcpy:Je,_bitshift64Lshr:Ct,_fflush:Ve,___udivdi3:Lt,___uremdi3:xt,___errno_location:vt,_bitshift64Shl:It,runPostSets:function(){},_emscripten_replace_memory:function(e){return!(16777215&c(e)||c(e)<=16777215||2147483648>2],e=-16&(r+e+15|0);if((HEAP32[DYNAMICTOP_PTR>>2]=e,TOTAL_MEMORY<=e)&&!enlargeMemory())return HEAP32[DYNAMICTOP_PTR>>2]=r,0;return r},alignMemory:function(e,r){return e=Math.ceil(e/(r||16))*(r||16)},makeBigInt:function(e,r,t){return t?+(e>>>0)+4294967296*(r>>>0):+(e>>>0)+4294967296*(0|r)},GLOBAL_BASE:8,QUANTUM_SIZE:4,__dummy__:0};Module.Runtime=Runtime;var ABORT=0,EXITSTATUS=0,cwrap,ccall;function assert(e,r){e||abort("Assertion failed: "+r)}function getCFunc(_0x222174){var _0x54cf7b=Module["_"+_0x222174];if(!_0x54cf7b)try{_0x54cf7b=eval("_"+_0x222174)}catch(_0x4b65d1){}return assert(_0x54cf7b,"Cannot call unknown function "+_0x222174+" (perhaps LLVM optimizations or closure removed it?)"),_0x54cf7b}function setValue(e,r,t,n){switch("*"===(t=t||"i8").charAt(t.length-1)&&(t="i32"),t){case"i1":case"i8":HEAP8[e>>0]=r;break;case"i16":HEAP16[e>>1]=r;break;case"i32":HEAP32[e>>2]=r;break;case"i64":tempI64=[r>>>0,(tempDouble=r,1<=+Math_abs(tempDouble)?0>>0:~~+Math_ceil((tempDouble-(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[e>>2]=tempI64[0],HEAP32[e+4>>2]=tempI64[1];break;case"float":HEAPF32[e>>2]=r;break;case"double":HEAPF64[e>>3]=r;break;default:abort("invalid type for setValue: "+t)}}function getValue(e,r,t){switch("*"===(r=r||"i8").charAt(r.length-1)&&(r="i32"),r){case"i1":case"i8":return HEAP8[e>>0];case"i16":return HEAP16[e>>1];case"i32":case"i64":return HEAP32[e>>2];case"float":return HEAPF32[e>>2];case"double":return HEAPF64[e>>3];default:abort("invalid type for setValue: "+r)}return null}!function(){var _0x17b09f={stackSave:function(){Runtime.stackSave()},stackRestore:function(){Runtime.stackRestore()},arrayToC:function(e){var r=Runtime.stackAlloc(e.length);return writeArrayToMemory(e,r),r},stringToC:function(e){var r,t=0;return null!=e&&0!==e&&(r=1+(e.length<<2),stringToUTF8(e,t=Runtime.stackAlloc(r),r)),t}},_0x237e8c={string:_0x17b09f.stringToC,array:_0x17b09f.arrayToC};ccall=function(e,r,t,n,i){var e=getCFunc(e),o=[],a=0;if(assert("array"!==r,'Return type should not be "array".'),n)for(var u=0;u>2]=0;for(s=u+o;n>0]=0;return u}if("i8"===a)return e.subarray||e.slice?HEAPU8.set(e,u):HEAPU8.set(new Uint8Array(e),u),u;for(var f,l,c,d=0;d>0],(0!=t||r)&&(i++,!r||i!=r););r=r||i;var o="";if(n<128){for(var a;0>0];if(!t)return r;r+=String.fromCharCode(t)}}function stringToAscii(e,r){return writeAsciiToMemory(e,r,!1)}Module.ALLOC_NORMAL=ALLOC_NORMAL,Module.ALLOC_STACK=ALLOC_STACK,Module.ALLOC_STATIC=ALLOC_STATIC,Module.ALLOC_DYNAMIC=ALLOC_DYNAMIC,Module.ALLOC_NONE=ALLOC_NONE,Module.allocate=allocate,Module.getMemory=getMemory,Module.Pointer_stringify=Pointer_stringify,Module.AsciiToString=AsciiToString,Module.stringToAscii=stringToAscii;var UTF8Decoder="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function UTF8ArrayToString(e,r){for(var t=r;e[t];)++t;if(16>10,56320|1023&i))):s+=String.fromCharCode((31&a)<<6|u)):s+=String.fromCharCode(a)}}function UTF8ToString(e){return UTF8ArrayToString(HEAPU8,e)}function stringToUTF8Array(e,r,t,n){if(!(0>6,r[t++]=128|63&u}else if(u<=65535){if(o<=t+2)break;r[t++]=224|u>>12,r[t++]=128|u>>6&63,r[t++]=128|63&u}else if(u<=2097151){if(o<=t+3)break;r[t++]=240|u>>18,r[t++]=128|u>>12&63,r[t++]=128|u>>6&63,r[t++]=128|63&u}else if(u<=67108863){if(o<=t+4)break;r[t++]=248|u>>24,r[t++]=128|u>>18&63,r[t++]=128|u>>12&63,r[t++]=128|u>>6&63,r[t++]=128|63&u}else{if(o<=t+5)break;r[t++]=252|u>>30,r[t++]=128|u>>24&63,r[t++]=128|u>>18&63,r[t++]=128|u>>12&63,r[t++]=128|u>>6&63,r[t++]=128|63&u}}return r[t]=0,t-i}function stringToUTF8(e,r,t){return assert("number"==typeof t,"stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),stringToUTF8Array(e,HEAPU8,r,t)}function lengthBytesUTF8(e){for(var r=0,t=0;t>2)-1]=34821223,HEAPU32[(STACK_MAX>>2)-2]=2310721022}function checkStackCookie(){if(34821223==HEAPU32[(STACK_MAX>>2)-1]&&2310721022==HEAPU32[(STACK_MAX>>2)-2]||abort("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x02135467, but received 0x"+HEAPU32[(STACK_MAX>>2)-2].toString(16)+" "+HEAPU32[(STACK_MAX>>2)-1].toString(16)),1668509029!==HEAP32[0])throw"Runtime error: The application has corrupted its heap memory area (address zero)!"}function abortStackOverflow(e){abort("Stack overflow! Attempted to allocate "+e+" bytes on the stack, but stack has only "+(STACK_MAX-asm.stackSave()+e)+" bytes available!")}function abortOnCannotGrowMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+TOTAL_MEMORY+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which adjusts the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}function enlargeMemory(){assert(HEAP32[DYNAMICTOP_PTR>>2]>TOTAL_MEMORY),assert(4>2]>=r)return!1;for(;TOTAL_MEMORY>2];)if(TOTAL_MEMORY>0]=e.charCodeAt(n);t||(HEAP8[r>>0]=0)}Module.addOnPreRun=addOnPreRun,Module.addOnInit=addOnInit,Module.addOnPreMain=addOnPreMain,Module.addOnExit=addOnExit,Module.addOnPostRun=addOnPostRun,Module.intArrayFromString=intArrayFromString,Module.intArrayToString=intArrayToString,Module.writeStringToMemory=writeStringToMemory,Module.writeArrayToMemory=writeArrayToMemory,Module.writeAsciiToMemory=writeAsciiToMemory,Math.imul&&-5===Math.imul(4294967295,5)||(Math.imul=function(e,r){var t=65535&e,n=65535&r;return t*n+((e>>>16)*n+t*(r>>>16)<<16)|0}),Math.imul=Math.imul,Math.clz32||(Math.clz32=function(e){e>>>=0;for(var r=0;r<32;r++)if(e&1<<31-r)return r;return 32}),Math.clz32=Math.clz32,Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Math.trunc=Math.trunc;var Math_abs=Math.abs,Math_cos=Math.cos,Math_sin=Math.sin,Math_tan=Math.tan,Math_acos=Math.acos,Math_asin=Math.asin,Math_atan=Math.atan,Math_atan2=Math.atan2,Math_exp=Math.exp,Math_log=Math.log,Math_sqrt=Math.sqrt,Math_ceil=Math.ceil,Math_floor=Math.floor,Math_pow=Math.pow,Math_imul=Math.imul,Math_fround=Math.fround,Math_min=Math.min,Math_clz32=Math.clz32,Math_trunc=Math.trunc,runDependencies=0,runDependencyWatcher=null,dependenciesFulfilled=null,runDependencyTracking={};function getUniqueRunDependency(e){for(var r=e;;){if(!runDependencyTracking[e])return e;e=r+Math.random()}return e}function addRunDependency(e){runDependencies++,Module.monitorRunDependencies&&Module.monitorRunDependencies(runDependencies),e?(assert(!runDependencyTracking[e]),runDependencyTracking[e]=1,null===runDependencyWatcher&&"undefined"!=typeof setInterval&&(runDependencyWatcher=setInterval(function(){if(ABORT)return clearInterval(runDependencyWatcher),void(runDependencyWatcher=null);var e,r=!1;for(e in runDependencyTracking)r||(r=!0,Module.printErr("still waiting on run dependencies:")),Module.printErr("dependency: "+e);r&&Module.printErr("(end of list)")},1e4))):Module.printErr("warning: run dependency added without ID")}function removeRunDependency(e){runDependencies--,Module.monitorRunDependencies&&Module.monitorRunDependencies(runDependencies),e?(assert(runDependencyTracking[e]),delete runDependencyTracking[e]):Module.printErr("warning: run dependency removed without ID"),0==runDependencies&&(null!==runDependencyWatcher&&(clearInterval(runDependencyWatcher),runDependencyWatcher=null),dependenciesFulfilled&&(e=dependenciesFulfilled,dependenciesFulfilled=null,e()))}Module.addRunDependency=addRunDependency,Module.removeRunDependency=removeRunDependency,Module.preloadedImages={},Module.preloadedAudios={};var ASM_CONSTS=[function(e,r,t){for(var n=new Uint8Array(r),i=0;i>2]=e:Module.printErr("failed to set errno from JS"),e}var PATH={splitPath:function(e){return/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1)},normalizeArray:function(e,r){for(var t=0,n=e.length-1;0<=n;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t--;)e.unshift("..");return e},normalize:function(e){var r="/"===e.charAt(0),t="/"===e.substr(-1);return(e=PATH.normalizeArray(e.split("/").filter(function(e){return!!e}),!r).join("/"))||r||(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:function(e){var r=PATH.splitPath(e),e=r[0],r=r[1];return e||r?e+(r=r&&r.substr(0,r.length-1)):"."},basename:function(e){if("/"===e)return"/";var r=e.lastIndexOf("/");return-1===r?e:e.substr(r+1)},extname:function(e){return PATH.splitPath(e)[3]},join:function(){var e=Array.prototype.slice.call(arguments,0);return PATH.normalize(e.join("/"))},join2:function(e,r){return PATH.normalize(e+"/"+r)},resolve:function(){for(var e="",r=!1,t=arguments.length-1;-1<=t&&!r;t--){var n=0<=t?arguments[t]:FS.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,r="/"===n.charAt(0)}return(r?"/":"")+(e=PATH.normalizeArray(e.split("/").filter(function(e){return!!e}),!r).join("/"))||"."},relative:function(e,r){function t(e){for(var r=0;re.contents.length&&(e.contents=MEMFS.getFileDataAsRegularArray(e),e.usedBytes=e.contents.length),!e.contents||e.contents.subarray){var t=e.contents?e.contents.buffer.byteLength:0;if(r<=t)return;r=Math.max(r,t*(t<1048576?2:1.125)|0),0!=t&&(r=Math.max(r,256));t=e.contents;return e.contents=new Uint8Array(r),void(0r)e.contents.length=r;else for(;e.contents.length=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-i,n);if(assert(0<=a),8t.timestamp)&&(a.push(e),o++)});var t=[];if(Object.keys(i.entries).forEach(function(e){i.entries[e];n.entries[e]||(t.push(e),o++)}),!o)return r(null);var u=0,e=("remote"===n.type?n:i).db.transaction([IDBFS.DB_STORE_NAME],"readwrite"),s=e.objectStore(IDBFS.DB_STORE_NAME);function f(e){return e?f.errored?void 0:(f.errored=!0,r(e)):++u>=o?r(null):void 0}e.onerror=function(e){f(this.error),e.preventDefault()},a.sort().forEach(function(t){"local"===i.type?IDBFS.loadRemoteEntry(s,t,function(e,r){return e?f(e):void IDBFS.storeLocalEntry(t,r,f)}):IDBFS.loadLocalEntry(t,function(e,r){return e?f(e):void IDBFS.storeRemoteEntry(s,t,r,f)})}),t.sort().reverse().forEach(function(e){"local"===i.type?IDBFS.removeLocalEntry(e,f):IDBFS.removeRemoteEntry(s,e,f)})}},NODEFS={isWindows:!1,staticInit:function(){NODEFS.isWindows=!!process.platform.match(/^win/)},mount:function(e){return assert(ENVIRONMENT_IS_NODE),NODEFS.createNode(null,"/",NODEFS.getMode(e.opts.root),0)},createNode:function(e,r,t,n){if(!FS.isDir(t)&&!FS.isFile(t)&&!FS.isLink(t))throw new FS.ErrnoError(ERRNO_CODES.EINVAL);t=FS.createNode(e,r,t);return t.node_ops=NODEFS.node_ops,t.stream_ops=NODEFS.stream_ops,t},getMode:function(e){var r;try{r=fs.lstatSync(e),NODEFS.isWindows&&(r.mode=r.mode|(146&r.mode)>>1)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return r.mode},realPath:function(e){for(var r=[];e.parent!==e;)r.push(e.name),e=e.parent;return r.push(e.mount.opts.root),r.reverse(),PATH.join.apply(null,r)},flagsToPermissionStringMap:{0:"r",1:"r+",2:"r+",64:"r",65:"r+",66:"r+",129:"rx+",193:"rx+",514:"w+",577:"w",578:"w+",705:"wx",706:"wx+",1024:"a",1025:"a",1026:"a+",1089:"a",1090:"a+",1153:"ax",1154:"ax+",1217:"ax",1218:"ax+",4096:"rs",4098:"rs+"},flagsToPermissionString:function(e){if(e&=-2097153,e&=-2049,e&=-32769,(e&=-524289)in NODEFS.flagsToPermissionStringMap)return NODEFS.flagsToPermissionStringMap[e];throw new FS.ErrnoError(ERRNO_CODES.EINVAL)},node_ops:{getattr:function(e){var r,t=NODEFS.realPath(e);try{r=fs.lstatSync(t)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return NODEFS.isWindows&&!r.blksize&&(r.blksize=4096),NODEFS.isWindows&&!r.blocks&&(r.blocks=(r.size+r.blksize-1)/r.blksize|0),{dev:r.dev,ino:r.ino,mode:r.mode,nlink:r.nlink,uid:r.uid,gid:r.gid,rdev:r.rdev,size:r.size,atime:r.atime,mtime:r.mtime,ctime:r.ctime,blksize:r.blksize,blocks:r.blocks}},setattr:function(e,r){var t,n=NODEFS.realPath(e);try{void 0!==r.mode&&(fs.chmodSync(n,r.mode),e.mode=r.mode),void 0!==r.timestamp&&(t=new Date(r.timestamp),fs.utimesSync(n,t,t)),void 0!==r.size&&fs.truncateSync(n,r.size)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},lookup:function(e,r){var t=PATH.join2(NODEFS.realPath(e),r),t=NODEFS.getMode(t);return NODEFS.createNode(e,r,t)},mknod:function(e,r,t,n){var i=NODEFS.createNode(e,r,t,n),o=NODEFS.realPath(i);try{FS.isDir(i.mode)?fs.mkdirSync(o,i.mode):fs.writeFileSync(o,"",{mode:i.mode})}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return i},rename:function(e,r,t){var n=NODEFS.realPath(e),i=PATH.join2(NODEFS.realPath(r),t);try{fs.renameSync(n,i)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},unlink:function(e,r){var t=PATH.join2(NODEFS.realPath(e),r);try{fs.unlinkSync(t)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},rmdir:function(e,r){var t=PATH.join2(NODEFS.realPath(e),r);try{fs.rmdirSync(t)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},readdir:function(e){var r=NODEFS.realPath(e);try{return fs.readdirSync(r)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},symlink:function(e,r,t){var n=PATH.join2(NODEFS.realPath(e),r);try{fs.symlinkSync(t,n)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},readlink:function(e){var r=NODEFS.realPath(e);try{return r=fs.readlinkSync(r),NODEJS_PATH.relative(NODEJS_PATH.resolve(e.mount.opts.root),r)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}},stream_ops:{open:function(e){var r=NODEFS.realPath(e.node);try{FS.isFile(e.node.mode)&&(e.nfd=fs.openSync(r,NODEFS.flagsToPermissionString(e.flags)))}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},close:function(e){try{FS.isFile(e.node.mode)&&e.nfd&&fs.closeSync(e.nfd)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},read:function(e,r,t,n,i){if(0===n)return 0;var o,a=new Buffer(n);try{o=fs.readSync(e.nfd,a,0,n,i)}catch(e){throw new FS.ErrnoError(ERRNO_CODES[e.code])}if(0=e.node.size)return 0;i=e.node.contents.slice(i,i+n),n=WORKERFS.reader.readAsArrayBuffer(i);return r.set(new Uint8Array(n),t),i.size},write:function(e,r,t,n,i){throw new FS.ErrnoError(ERRNO_CODES.EIO)},llseek:function(e,r,t){if(1===t?r+=e.position:2===t&&FS.isFile(e.node.mode)&&(r+=e.node.size),r<0)throw new FS.ErrnoError(ERRNO_CODES.EINVAL);return r}}};STATICTOP+=16,STATICTOP+=16,STATICTOP+=16;var FS={root:null,mounts:[],devices:[null],streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,trackingDelegate:{},tracking:{openFlags:{READ:1,WRITE:2}},ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,handleFSError:function(e){if(!(e instanceof FS.ErrnoError))throw e+" : "+stackTrace();return ___setErrNo(e.errno)},lookupPath:function(e,r){if(r=r||{},!(e=PATH.resolve(FS.cwd(),e)))return{path:"",node:null};var t,n={follow_mount:!0,recurse_count:0};for(t in n)void 0===r[t]&&(r[t]=n[t]);if(8>>0)%FS.nameTable.length},hashAddNode:function(e){var r=FS.hashName(e.parent.id,e.name);e.name_next=FS.nameTable[r],FS.nameTable[r]=e},hashRemoveNode:function(e){var r=FS.hashName(e.parent.id,e.name);if(FS.nameTable[r]===e)FS.nameTable[r]=e.name_next;else for(var t=FS.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode:function(e,r){var t=FS.mayLookup(e);if(t)throw new FS.ErrnoError(t,e);for(var t=FS.hashName(e.id,r),n=FS.nameTable[t];n;n=n.name_next){var i=n.name;if(n.parent.id===e.id&&i===r)return n}return FS.lookup(e,r)},createNode:function(e,r,t,n){FS.FSNode||(FS.FSNode=function(e,r,t,n){e=e||this,this.parent=e,this.mount=e.mount,this.mounted=null,this.id=FS.nextInode++,this.name=r,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=n},FS.FSNode.prototype={},Object.defineProperties(FS.FSNode.prototype,{read:{get:function(){return 365==(365&this.mode)},set:function(e){e?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146==(146&this.mode)},set:function(e){e?this.mode|=146:this.mode&=-147}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}}));n=new FS.FSNode(e,r,t,n);return FS.hashAddNode(n),n},destroyNode:function(e){FS.hashRemoveNode(e)},isRoot:function(e){return e===e.parent},isMountpoint:function(e){return!!e.mounted},isFile:function(e){return 32768==(61440&e)},isDir:function(e){return 16384==(61440&e)},isLink:function(e){return 40960==(61440&e)},isChrdev:function(e){return 8192==(61440&e)},isBlkdev:function(e){return 24576==(61440&e)},isFIFO:function(e){return 4096==(61440&e)},isSocket:function(e){return 49152==(49152&e)},flagModes:{r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218},modeStringToFlags:function(e){var r=FS.flagModes[e];if(void 0===r)throw new Error("Unknown file open mode: "+e);return r},flagsToPermissionString:function(e){var r=["r","w","rw"][3&e];return 512&e&&(r+="w"),r},nodePermissions:function(e,r){return FS.ignorePermissions||(-1===r.indexOf("r")||292&e.mode)&&(-1===r.indexOf("w")||146&e.mode)&&(-1===r.indexOf("x")||73&e.mode)?0:ERRNO_CODES.EACCES},mayLookup:function(e){var r=FS.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:ERRNO_CODES.EACCES)},mayCreate:function(e,r){try{FS.lookupNode(e,r);return ERRNO_CODES.EEXIST}catch(e){}return FS.nodePermissions(e,"wx")},mayDelete:function(e,r,t){var n;try{n=FS.lookupNode(e,r)}catch(e){return e.errno}var i=FS.nodePermissions(e,"wx");if(i)return i;if(t){if(!FS.isDir(n.mode))return ERRNO_CODES.ENOTDIR;if(FS.isRoot(n)||FS.getPath(n)===FS.cwd())return ERRNO_CODES.EBUSY}else if(FS.isDir(n.mode))return ERRNO_CODES.EISDIR;return 0},mayOpen:function(e,r){return e?FS.isLink(e.mode)?ERRNO_CODES.ELOOP:FS.isDir(e.mode)&&("r"!==FS.flagsToPermissionString(r)||512&r)?ERRNO_CODES.EISDIR:FS.nodePermissions(e,FS.flagsToPermissionString(r)):ERRNO_CODES.ENOENT},MAX_OPEN_FDS:4096,nextfd:function(e,r){e=e||0,r=r||FS.MAX_OPEN_FDS;for(var t=e;t<=r;t++)if(!FS.streams[t])return t;throw new FS.ErrnoError(ERRNO_CODES.EMFILE)},getStream:function(e){return FS.streams[e]},createStream:function(e,r,t){FS.FSStream||(FS.FSStream=function(){},FS.FSStream.prototype={},Object.defineProperties(FS.FSStream.prototype,{object:{get:function(){return this.node},set:function(e){this.node=e}},isRead:{get:function(){return 1!=(2097155&this.flags)}},isWrite:{get:function(){return 0!=(2097155&this.flags)}},isAppend:{get:function(){return 1024&this.flags}}}));var n,i=new FS.FSStream;for(n in e)i[n]=e[n];e=i;t=FS.nextfd(r,t);return e.fd=t,FS.streams[t]=e},closeStream:function(e){FS.streams[e]=null},chrdev_stream_ops:{open:function(e){var r=FS.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek:function(){throw new FS.ErrnoError(ERRNO_CODES.ESPIPE)}},major:function(e){return e>>8},minor:function(e){return 255&e},makedev:function(e,r){return e<<8|r},registerDevice:function(e,r){FS.devices[e]={stream_ops:r}},getDevice:function(e){return FS.devices[e]},getMounts:function(e){for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push.apply(t,n.mounts)}return r},syncfs:function(r,t){"function"==typeof r&&(t=r,r=!1),FS.syncFSRequests++,1=n.length&&o(null)}n.forEach(function(e){return e.type.syncfs?void e.type.syncfs(e,r,a):a(null)})},mount:function(e,r,t){var n="/"===t,i=!t;if(n&&FS.root)throw new FS.ErrnoError(ERRNO_CODES.EBUSY);if(!n&&!i){var o=FS.lookupPath(t,{follow_mount:!1});if(t=o.path,o=o.node,FS.isMountpoint(o))throw new FS.ErrnoError(ERRNO_CODES.EBUSY);if(!FS.isDir(o.mode))throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR)}t={type:e,opts:r,mountpoint:t,mounts:[]},e=e.mount(t);return(e.mount=t).root=e,n?FS.root=e:o&&(o.mounted=t,o.mount&&o.mount.mounts.push(t)),e},unmount:function(e){var r=FS.lookupPath(e,{follow_mount:!1});if(!FS.isMountpoint(r.node))throw new FS.ErrnoError(ERRNO_CODES.EINVAL);var e=r.node,r=e.mounted,n=FS.getMounts(r);Object.keys(FS.nameTable).forEach(function(e){for(var r=FS.nameTable[e];r;){var t=r.name_next;-1!==n.indexOf(r.mount)&&FS.destroyNode(r),r=t}}),e.mounted=null;r=e.mount.mounts.indexOf(r);assert(-1!==r),e.mount.mounts.splice(r,1)},lookup:function(e,r){return e.node_ops.lookup(e,r)},mknod:function(e,r,t){var n=FS.lookupPath(e,{parent:!0}).node,i=PATH.basename(e);if(!i||"."===i||".."===i)throw new FS.ErrnoError(ERRNO_CODES.EINVAL);e=FS.mayCreate(n,i);if(e)throw new FS.ErrnoError(e);if(!n.node_ops.mknod)throw new FS.ErrnoError(ERRNO_CODES.EPERM);return n.node_ops.mknod(n,i,r,t)},create:function(e,r){return r=void 0!==r?r:438,r&=4095,r|=32768,FS.mknod(e,r,0)},mkdir:function(e,r){return r=void 0!==r?r:511,r&=1023,r|=16384,FS.mknod(e,r,0)},mkdirTree:function(e,r){for(var t=e.split("/"),n="",i=0;ithis.length-1||e<0)){var r=e%this.chunkSize,e=e/this.chunkSize|0;return this.getter(e)[r]}},i.prototype.setDataGetter=function(e){this.getter=e},i.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",a,!1),e.send(null),!(200<=e.status&&e.status<300||304===e.status))throw new Error("Couldn't load "+a+". Status: "+e.status);var n=Number(e.getResponseHeader("Content-length")),r=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,t=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,i=1048576;r||(i=n);var o=this;o.setDataGetter(function(e){var r=e*i,t=(e+1)*i-1,t=Math.min(t,n-1);if(void 0===o.chunks[e]&&(o.chunks[e]=function(e,r){if(r=o.length)return 0;var a=Math.min(o.length-i,n);if(assert(0<=a),o.slice)for(var u=0;u>2]=n.dev,HEAP32[t+4>>2]=0,HEAP32[t+8>>2]=n.ino,HEAP32[t+12>>2]=n.mode,HEAP32[t+16>>2]=n.nlink,HEAP32[t+20>>2]=n.uid,HEAP32[t+24>>2]=n.gid,HEAP32[t+28>>2]=n.rdev,HEAP32[t+32>>2]=0,HEAP32[t+36>>2]=n.size,HEAP32[t+40>>2]=4096,HEAP32[t+44>>2]=n.blocks,HEAP32[t+48>>2]=n.atime.getTime()/1e3|0,HEAP32[t+52>>2]=0,HEAP32[t+56>>2]=n.mtime.getTime()/1e3|0,HEAP32[t+60>>2]=0,HEAP32[t+64>>2]=n.ctime.getTime()/1e3|0,HEAP32[t+68>>2]=0,HEAP32[t+72>>2]=n.ino,0},doMsync:function(e,r,t,n){e=new Uint8Array(HEAPU8.subarray(e,e+t));FS.msync(r,e,0,t,n)},doMkdir:function(e,r){return"/"===(e=PATH.normalize(e))[e.length-1]&&(e=e.substr(0,e.length-1)),FS.mkdir(e,r,0),0},doMknod:function(e,r,t){switch(61440&r){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-ERRNO_CODES.EINVAL}return FS.mknod(e,r,t),0},doReadlink:function(e,r,t){if(t<=0)return-ERRNO_CODES.EINVAL;var n=FS.readlink(e),i=Math.min(t,lengthBytesUTF8(n)),e=HEAP8[r+i];return stringToUTF8(n,r,t+1),HEAP8[r+i]=e,i},doAccess:function(e,r){if(-8&r)return-ERRNO_CODES.EINVAL;var t=FS.lookupPath(e,{follow:!0}).node,e="";return 4&r&&(e+="r"),2&r&&(e+="w"),1&r&&(e+="x"),e&&FS.nodePermissions(t,e)?-ERRNO_CODES.EACCES:0},doDup:function(e,r,t){var n=FS.getStream(t);return n&&FS.close(n),FS.open(e,r,0,t,t).fd},doReadv:function(e,r,t,n){for(var i=0,o=0;o>2],u=HEAP32[r+(8*o+4)>>2],a=FS.read(e,HEAP8,a,u,n);if(a<0)return-1;if(i+=a,a>2],u=HEAP32[r+(8*o+4)>>2],u=FS.write(e,HEAP8,a,u,n);if(u<0)return-1;i+=u}return i},varargs:0,get:function(e){return SYSCALLS.varargs+=4,HEAP32[SYSCALLS.varargs-4>>2]},getStr:function(){return Pointer_stringify(SYSCALLS.get())},getStreamFromFD:function(){var e=FS.getStream(SYSCALLS.get());if(!e)throw new FS.ErrnoError(ERRNO_CODES.EBADF);return e},getSocketFromFD:function(){var e=SOCKFS.getSocket(SYSCALLS.get());if(!e)throw new FS.ErrnoError(ERRNO_CODES.EBADF);return e},getSocketAddress:function(e){var r=SYSCALLS.get(),t=SYSCALLS.get();if(e&&0===r)return null;t=__read_sockaddr(r,t);if(t.errno)throw new FS.ErrnoError(t.errno);return t.addr=DNS.lookup_addr(t.addr)||t.addr,t},get64:function(){var e=SYSCALLS.get(),r=SYSCALLS.get();return assert(0<=e?0===r:-1===r),e},getZero:function(){assert(0===SYSCALLS.get())}};function ___syscall5(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStr(),n=SYSCALLS.get(),i=SYSCALLS.get();return FS.open(t,n,i).fd}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function ___lock(){}function ___unlock(){}function ___syscall6(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStreamFromFD();return FS.close(t),0}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}var cttz_i8=allocate([8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0],"i8",ALLOC_STATIC),fs,NODEJS_PATH;function _emscripten_memcpy_big(e,r,t){return HEAPU8.set(HEAPU8.subarray(r,r+t),e),e}function ___syscall140(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStreamFromFD(),n=SYSCALLS.get(),i=SYSCALLS.get(),o=SYSCALLS.get(),a=SYSCALLS.get(),i=i;return assert(0===n),FS.llseek(t,i,a),HEAP32[o>>2]=t.position,t.getdents&&0===i&&0===a&&(t.getdents=null),0}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function ___syscall146(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStreamFromFD(),n=SYSCALLS.get(),i=SYSCALLS.get();return SYSCALLS.doWritev(t,n,i)}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function ___syscall54(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStreamFromFD(),n=SYSCALLS.get();switch(n){case 21505:case 21506:return t.tty?0:-ERRNO_CODES.ENOTTY;case 21519:if(!t.tty)return-ERRNO_CODES.ENOTTY;var i=SYSCALLS.get();return HEAP32[i>>2]=0;case 21520:return t.tty?-ERRNO_CODES.EINVAL:-ERRNO_CODES.ENOTTY;case 21531:i=SYSCALLS.get();return FS.ioctl(t,n,i);default:abort("bad ioctl syscall "+n)}}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function ___syscall221(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStreamFromFD();switch(SYSCALLS.get()){case 0:return(n=SYSCALLS.get())<0?-ERRNO_CODES.EINVAL:FS.open(t.path,t.flags,0,n).fd;case 1:case 2:return 0;case 3:return t.flags;case 4:var n=SYSCALLS.get();return t.flags|=n,0;case 12:case 12:n=SYSCALLS.get();return HEAP16[n+0>>1]=2,0;case 13:case 14:case 13:case 14:return 0;case 16:case 8:return-ERRNO_CODES.EINVAL;case 9:return ___setErrNo(ERRNO_CODES.EINVAL),-1;default:return-ERRNO_CODES.EINVAL}}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function ___syscall145(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStreamFromFD(),n=SYSCALLS.get(),i=SYSCALLS.get();return SYSCALLS.doReadv(t,n,i)}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function nullFunc_iiii(e){Module.printErr("Invalid function pointer called with signature 'iiii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"),Module.printErr("Build with ASSERTIONS=2 for more info."),abort(e)}function nullFunc_vi(e){Module.printErr("Invalid function pointer called with signature 'vi'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"),Module.printErr("Build with ASSERTIONS=2 for more info."),abort(e)}function nullFunc_vii(e){Module.printErr("Invalid function pointer called with signature 'vii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"),Module.printErr("Build with ASSERTIONS=2 for more info."),abort(e)}function nullFunc_ii(e){Module.printErr("Invalid function pointer called with signature 'ii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"),Module.printErr("Build with ASSERTIONS=2 for more info."),abort(e)}function nullFunc_iiiii(e){Module.printErr("Invalid function pointer called with signature 'iiiii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"),Module.printErr("Build with ASSERTIONS=2 for more info."),abort(e)}function nullFunc_iii(e){Module.printErr("Invalid function pointer called with signature 'iii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"),Module.printErr("Build with ASSERTIONS=2 for more info."),abort(e)}function invoke_iiii(e,r,t,n){try{return Module.dynCall_iiii(e,r,t,n)}catch(e){if("number"!=typeof e&&"longjmp"!==e)throw e;asm.setThrew(1,0)}}function invoke_vi(e,r){try{Module.dynCall_vi(e,r)}catch(e){if("number"!=typeof e&&"longjmp"!==e)throw e;asm.setThrew(1,0)}}function invoke_vii(e,r,t){try{Module.dynCall_vii(e,r,t)}catch(e){if("number"!=typeof e&&"longjmp"!==e)throw e;asm.setThrew(1,0)}}function invoke_ii(e,r){try{return Module.dynCall_ii(e,r)}catch(e){if("number"!=typeof e&&"longjmp"!==e)throw e;asm.setThrew(1,0)}}function invoke_iiiii(e,r,t,n,i){try{return Module.dynCall_iiiii(e,r,t,n,i)}catch(e){if("number"!=typeof e&&"longjmp"!==e)throw e;asm.setThrew(1,0)}}function invoke_iii(e,r,t){try{return Module.dynCall_iii(e,r,t)}catch(e){if("number"!=typeof e&&"longjmp"!==e)throw e;asm.setThrew(1,0)}}Module._llvm_cttz_i32=_llvm_cttz_i32,Module.___udivmoddi4=___udivmoddi4,Module.___udivdi3=___udivdi3,Module._sbrk=_sbrk,Module.___uremdi3=___uremdi3,Module._memcpy=_memcpy,Module._pthread_self=_pthread_self,FS.staticInit(),__ATINIT__.unshift(function(){Module.noFSInit||FS.init.initialized||FS.init()}),__ATMAIN__.push(function(){FS.ignorePermissions=!1}),__ATEXIT__.push(function(){FS.quit()}),Module.FS_createFolder=FS.createFolder,Module.FS_createPath=FS.createPath,Module.FS_createDataFile=FS.createDataFile,Module.FS_createPreloadedFile=FS.createPreloadedFile,Module.FS_createLazyFile=FS.createLazyFile,Module.FS_createLink=FS.createLink,Module.FS_createDevice=FS.createDevice,Module.FS_unlink=FS.unlink,__ATINIT__.unshift(function(){TTY.init()}),__ATEXIT__.push(function(){TTY.shutdown()}),ENVIRONMENT_IS_NODE&&(fs=require("fs"),NODEJS_PATH=require("path"),NODEFS.staticInit()),DYNAMICTOP_PTR=allocate(1,"i32",ALLOC_STATIC),STACK_BASE=STACKTOP=Runtime.alignMemory(STATICTOP),STACK_MAX=STACK_BASE+TOTAL_STACK,DYNAMIC_BASE=Runtime.alignMemory(STACK_MAX),HEAP32[DYNAMICTOP_PTR>>2]=DYNAMIC_BASE,staticSealed=!0,assert(DYNAMIC_BASE>2])+(t<<2)>>2];if(St[a>>2]=0,-1==((St[u>>2]=0)|h))return or[3&St[s+4>>2]](s,0|St[i>>2]),St[n>>2]=-1,St[i>>2]=0,(p=St[o>>2]=0)|p;if(0==(0|St[i>>2])||(0|St[n>>2])!=(0|h)){if(E=0|G(d=(b=0|St[e+12>>2])+(40*h|0)|0),_=Ft,S=0|function(e,r,t){e|=0,r|=0,t|=0;var n=0,i=0,o=0,a=0;(0|(pt=(n=pt)+16|0))>=(0|bt)&&yt(16);return o=n+4|0,St[(i=(a=n)+8|0)>>2]=e,St[o>>2]=r,St[a>>2]=t,t=40+(0|St[i>>2])|0,r=(0|St[52+(0|St[i>>2])>>2])+((0|St[(0|St[48+(0|St[i>>2])>>2])+(St[o>>2]<<2)>>2])+(0|St[a>>2])<<3)|0,a=0|Dt(0|St[t>>2],0|St[t+4>>2],0|St[r>>2],0|St[r+4>>2]),pt=n,0|a}(e,h,0),m=Ft,!((0|E)==(0|E)&0==(0|_)))return 0|(p=2);if(St[n>>2]=h,or[3&St[s+4>>2]](s,0|St[i>>2]),(St[i>>2]=0)|(n=0|he(r,S,m)))return 0|(p=n);if(St[o>>2]=E){if(n=0|sr[3&St[s>>2]](s,E),!(St[i>>2]=n))return 0|(p=2);k=n}else k=0|St[i>>2];if(0|(n=0|Re(d,(0|St[e>>2])+(St[(0|St[e+48>>2])+(h<<2)>>2]<<3)|0,r,S,m,k,E,f,l,c)))return 0|(p=n);if(0|St[b+(40*h|0)+28>>2]&&(0|(n=0|Pe(0|St[i>>2],E)))!=(0|St[b+(40*h|0)+32>>2]))return 0|(p=3)}if(b=0|St[e+16>>2],(n=(St[a>>2]=0)|St[(0|St[e+56>>2])+(h<<2)>>2])>>>0>>0){for(h=n,n=0;n=n+(0|St[b+(h<<5)+8>>2])|0,h=h+1|0,(0|h)!=(0|t););St[a>>2]=n}return n=0|St[b+(t<<5)+8>>2],St[u>>2]=n,((u=0|St[a>>2])+n|0)>>>0>(0|St[o>>2])>>>0?0|(p=11):0|Et[b+(t<<5)+27>>0]?0|(p=(0|(o=0|Pe((0|St[i>>2])+u|0,n)))==(0|St[b+(t<<5)+16>>2])?0:3):(p=0)|p}function j(e,r,t,n){e|=0,r|=0,t|=0,n|=0;var i,o,a,u,s,f,l,c,d,E,_=0,S=0,m=pt;(0|bt)<=(0|(pt=pt+48|0))&&yt(48),i=m+36|0,a=m+28|0,u=m+24|0,s=m+20|0,f=m+16|0,l=m+12|0,c=m+8|0,d=m+4|0,St[(o=(E=m)+32|0)>>2]=e,St[a>>2]=r,St[u>>2]=t,St[s>>2]=n,St[f>>2]=0,St[l>>2]=0;e:for(;;){if((0|St[l>>2])==(0|St[s>>2])){_=3;break}if(n=0|St[l>>2],St[l>>2]=n+1,St[d>>2]=re[(0|St[u>>2])+(n<<1)>>1],(0|St[d>>2])>>>0<128)0|St[o>>2]&&(Et[(0|St[o>>2])+(0|St[f>>2])>>0]=St[d>>2]),St[f>>2]=1+(0|St[f>>2]);else{if(55296<=(0|St[d>>2])>>>0&(0|St[d>>2])>>>0<57344){if(56320<=(0|St[d>>2])>>>0){_=23;break}if((0|St[l>>2])==(0|St[s>>2])){_=23;break}if(n=0|St[l>>2],St[l>>2]=n+1,St[E>>2]=re[(0|St[u>>2])+(n<<1)>>1],(0|St[E>>2])>>>0<56320|57344<=(0|St[E>>2])>>>0){_=23;break}St[d>>2]=65536+((0|St[d>>2])-55296<<10|(0|St[E>>2])-56320)}for(St[c>>2]=1;!(5<=(0|St[c>>2])>>>0||(0|St[d>>2])>>>0<1<<6+(5*(0|St[c>>2])|0)>>>0);)St[c>>2]=1+(0|St[c>>2]);for(0|St[o>>2]&&(Et[(0|St[o>>2])+(0|St[f>>2])>>0]=(0|mt[(0|St[c>>2])-1+341>>0])+((0|St[d>>2])>>>(6*(0|St[c>>2])|0))),St[f>>2]=1+(0|St[f>>2]);;)if(St[c>>2]=(0|St[c>>2])-1,0|St[o>>2]&&(Et[(0|St[o>>2])+(0|St[f>>2])>>0]=128+((0|St[d>>2])>>>(6*(0|St[c>>2])|0)&63)),St[f>>2]=1+(0|St[f>>2]),!(0|St[c>>2]))continue e}}return 3==(0|_)?(St[St[a>>2]>>2]=St[f>>2],Et[i>>0]=1,S=0|Et[i>>0],pt=m,0|1&S):23==(0|_)?(St[St[a>>2]>>2]=St[f>>2],S=(Et[i>>0]=0)|Et[i>>0],pt=m,0|1&S):0}function X(e){e|=0;var r,t=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(r=t)>>2]=e,Ce(16+(0|St[r>>2])|0),pt=t}function P(e){e|=0;var r,t=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(r=t)>>2]=e,St[St[r>>2]>>2]=0,St[4+(0|St[r>>2])>>2]=0,St[8+(0|St[r>>2])>>2]=0,St[12+(0|St[r>>2])>>2]=0,St[16+(0|St[r>>2])>>2]=0,St[20+(0|St[r>>2])>>2]=0,St[24+(0|St[r>>2])>>2]=0,St[28+(0|St[r>>2])>>2]=0,St[32+(0|St[r>>2])>>2]=0,St[36+(0|St[r>>2])>>2]=0,pt=t}function N(e,r){e|=0,r|=0;var t,n,i,o=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),n=o+4|0,St[(t=(i=o)+8|0)>>2]=e,St[n>>2]=r;e:do{if(0|St[St[t>>2]>>2])for(St[i>>2]=0;;){if((0|St[i>>2])>>>0>=(0|St[16+(0|St[t>>2])>>2])>>>0)break e;!function(e,r){e|=0,r|=0;var t,n,i=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(t=(n=i)+4|0)>>2]=e,St[n>>2]=r,Le(16+(0|St[t>>2])|0,0|St[n>>2]),X(0|St[t>>2]),pt=i}((0|St[St[t>>2]>>2])+(24*(0|St[i>>2])|0)|0,0|St[n>>2]),St[i>>2]=1+(0|St[i>>2])}}while(0);or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[St[t>>2]>>2]),or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[4+(0|St[t>>2])>>2]),or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[8+(0|St[t>>2])>>2]),or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[12+(0|St[t>>2])>>2]),P(0|St[t>>2]),pt=o}function C(e){e|=0;var r,t,n,i=pt;for((0|bt)<=(0|(pt=pt+16|0))&&yt(16),t=i+4|0,St[(r=(n=i)+8|0)>>2]=e,St[t>>2]=0,St[n>>2]=0;!((0|St[n>>2])>>>0>=(0|St[16+(0|St[r>>2])>>2])>>>0);)St[t>>2]=(0|St[t>>2])+(0|St[(0|St[St[r>>2]>>2])+(24*(0|St[n>>2])|0)+4>>2]),St[n>>2]=1+(0|St[n>>2]);return pt=i,0|St[t>>2]}function G(e){e|=0;var r,t,n,i,o=0,a=0,u=0,s=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),n=(r=s)+8|0,St[(t=s+12|0)>>2]=e,e=0|C(0|St[t>>2]),St[n>>2]=e;do{if(0|St[n>>2]){for(St[n>>2]=(0|St[n>>2])-1;;){if((0|St[n>>2])<0){o=8;break}if(e=(0|function(e,r){e|=0,r|=0;var t,n,i,o,a=0,u=0,s=0,f=pt;for((0|bt)<=(0|(pt=pt+16|0))&&yt(16),t=f+12|0,i=f+4|0,St[(n=(o=f)+8|0)>>2]=e,St[i>>2]=r,St[o>>2]=0;;){if((0|St[o>>2])>>>0>=(0|St[20+(0|St[n>>2])>>2])>>>0){a=6;break}if(u=0|St[o>>2],(0|St[(0|St[4+(0|St[n>>2])>>2])+(St[o>>2]<<3)+4>>2])==(0|St[i>>2])){a=4;break}St[o>>2]=u+1}return 4==(0|a)?(St[t>>2]=u,s=0|St[t>>2],pt=f,0|s):6==(0|a)?(St[t>>2]=-1,s=0|St[t>>2],pt=f,0|s):0}(0|St[t>>2],0|St[n>>2]))<0,a=0|St[n>>2],e){o=6;break}St[n>>2]=a+-1}if(6==(0|o)){e=(0|St[12+(0|St[t>>2])>>2])+(a<<3)|0,u=0|St[e+4>>2],St[(i=r)>>2]=St[e>>2],St[i+4>>2]=u;break}if(8==(0|o)){St[(u=r)>>2]=0,St[u+4>>2]=0;break}}else St[(u=r)>>2]=0,St[u+4>>2]=0}while(0);return Ft=0|St[(o=r)+4>>2],pt=s,0|St[o>>2]}function q(e){e|=0;var r,t=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(r=t)>>2]=e,St[St[r>>2]>>2]=0,St[4+(0|St[r>>2])>>2]=0,St[8+(0|St[r>>2])>>2]=0,St[12+(0|St[r>>2])>>2]=0,St[16+(0|St[r>>2])>>2]=0,St[20+(0|St[r>>2])>>2]=0,St[24+(0|St[r>>2])>>2]=0,St[28+(0|St[r>>2])>>2]=0,pt=t}function Z(e,r){e|=0,r|=0;var t,n,i,o=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),n=o+4|0,St[(t=(i=o)+8|0)>>2]=e,St[n>>2]=r;e:do{if(0|St[12+(0|St[t>>2])>>2])for(St[i>>2]=0;;){if((0|St[i>>2])>>>0>=(0|St[24+(0|St[t>>2])>>2])>>>0)break e;N((0|St[12+(0|St[t>>2])>>2])+(40*(0|St[i>>2])|0)|0,0|St[n>>2]),St[i>>2]=1+(0|St[i>>2])}}while(0);or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[St[t>>2]>>2]),or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[4+(0|St[t>>2])>>2]),or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[8+(0|St[t>>2])>>2]),or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[12+(0|St[t>>2])>>2]),or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[16+(0|St[t>>2])>>2]),q(0|St[t>>2]),pt=o}function J(e){e|=0;var r,t=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(r=t)>>2]=e,q(0|St[r>>2]),St[48+(0|St[r>>2])>>2]=0,St[52+(0|St[r>>2])>>2]=0,St[56+(0|St[r>>2])>>2]=0,St[60+(0|St[r>>2])>>2]=0,Ce(68+((St[64+(0|St[r>>2])>>2]=0)|St[r>>2])|0),pt=t}function $(e,r){e|=0,r|=0;var t,n,i=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(t=(n=i)+4|0)>>2]=e,St[n>>2]=r,or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[48+(0|St[t>>2])>>2]),or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[52+(0|St[t>>2])>>2]),or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[56+(0|St[t>>2])>>2]),or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[60+(0|St[t>>2])>>2]),or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[64+(0|St[t>>2])>>2]),Le(68+(0|St[t>>2])|0,0|St[n>>2]),Z(0|St[t>>2],0|St[n>>2]),J(0|St[t>>2]),pt=i}function ee(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u,s,f=0,l=pt;if((0|bt)<=(0|(pt=pt+32|0))&&yt(32),i=l+16|0,o=l+12|0,a=l+8|0,u=l+4|0,St[(n=(s=l)+20|0)>>2]=e,St[i>>2]=r,St[o>>2]=t,St[a>>2]=(0|St[(0|St[64+(0|St[n>>2])>>2])+(1+(0|St[i>>2])<<2)>>2])-(0|St[(0|St[64+(0|St[n>>2])>>2])+(St[i>>2]<<2)>>2]),!(0|St[o>>2]))return f=0|St[a>>2],pt=l,0|f;for(St[s>>2]=(0|St[68+(0|St[n>>2])>>2])+(St[(0|St[64+(0|St[n>>2])>>2])+(St[i>>2]<<2)>>2]<<1),St[u>>2]=0;!((0|St[u>>2])>>>0>=(0|St[a>>2])>>>0);)_t[(0|St[o>>2])+(St[u>>2]<<1)>>1]=0|mt[(0|St[s>>2])+(St[u>>2]<<1)>>0]|(65535&(0|mt[(0|St[s>>2])+(St[u>>2]<<1)+1>>0]))<<8,St[u>>2]=1+(0|St[u>>2]);return f=0|St[a>>2],pt=l,0|f}function ue(e,r){e|=0,r|=0;var t,n,i=pt;return(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(t=(n=i)+4|0)>>2]=e,St[n>>2]=r,r=0|le(0|St[t>>2],0|St[n>>2]),pt=i,0|r}function se(e,r,t,n,i,o,a,u,s){e|=0,r|=0,t|=0,n|=0,i|=0,o|=0,a|=0,u|=0,s|=0;var f,l,c,d,E,_,S,m,h,p,b,k,F,w,y,v=0,M=0,O=pt;(0|bt)<=(0|(pt=pt+64|0))&&yt(64),f=O+60|0,c=O+52|0,d=O+48|0,E=O+44|0,_=O+40|0,S=O+36|0,m=O+32|0,h=O+28|0,p=O+24|0,k=(b=O)+20|0,F=O+16|0,w=O+12|0,y=O+8|0,St[(l=O+56|0)>>2]=e,St[c>>2]=r,St[d>>2]=t,St[E>>2]=n,St[_>>2]=i,St[S>>2]=o,St[m>>2]=a,St[h>>2]=u,St[p>>2]=s;e:for(;;){if(s=0|ue(0|St[l>>2],b),St[k>>2]=s,0|St[k>>2]){v=3;break}if((0|(s=0|St[b>>2]))!=(0|St[(u=b)>>2])||(((0|s)<0)<<31>>31|0)!=(0|St[u+4>>2])){v=5;break}switch(0|St[b>>2]){case 0:v=7;break e;case 6:if(u=0|function(e,r,t,n,i,o,a){e|=0,r|=0,t|=0,n|=0,i|=0,o|=0,a|=0;var u=0,s=0,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0;(0|(pt=(u=pt)+80|0))>=(0|bt)&&yt(80);if(s=u+68|0,l=u+60|0,c=u+56|0,d=u+52|0,E=u+48|0,_=u+44|0,S=u+40|0,m=u+36|0,h=u+32|0,p=u+28|0,b=u+24|0,k=u+20|0,w=(F=u)+16|0,y=u+12|0,v=u+8|0,St[(f=u+64|0)>>2]=e,St[l>>2]=r,St[c>>2]=t,St[d>>2]=n,St[E>>2]=i,St[_>>2]=o,St[S>>2]=a,a=0|le(0|St[f>>2],0|St[l>>2]),St[h>>2]=a,0|St[h>>2])return St[s>>2]=St[h>>2],M=0|St[s>>2],pt=u,0|M;if(h=0|fe(0|St[f>>2],0|St[c>>2]),St[p>>2]=h,0|St[p>>2])return St[s>>2]=St[p>>2],M=0|St[s>>2],pt=u,0|M;if(p=0|I(0|St[f>>2],9,0),St[b>>2]=p,0|St[b>>2])return St[s>>2]=St[b>>2],M=0|St[s>>2],pt=u,0|M;if(0|St[St[c>>2]>>2]){if(b=0|sr[3&St[St[S>>2]>>2]](0|St[S>>2],St[St[c>>2]>>2]<<3),!(St[St[d>>2]>>2]=b))return St[s>>2]=2,M=0|St[s>>2],pt=u,0|M}else St[St[d>>2]>>2]=0;St[m>>2]=0;for(;!((0|St[m>>2])>>>0>=(0|St[St[c>>2]>>2])>>>0);){if(b=0|le(0|St[f>>2],(0|St[St[d>>2]>>2])+(St[m>>2]<<3)|0),St[k>>2]=b,0|St[k>>2]){O=14;break}St[m>>2]=1+(0|St[m>>2])}if(14==(0|O))return St[s>>2]=St[k>>2],M=0|St[s>>2],pt=u,0|M;for(;;){if(k=0|ue(0|St[f>>2],F),St[w>>2]=k,0|St[w>>2]){O=17;break}if(0==(0|St[(k=F)>>2])&0==(0|St[k+4>>2])){O=24;break}if(k=F,d=0|St[f>>2],10==(0|St[k>>2])&0==(0|St[k+4>>2])){if(k=0|ne(d,0|St[St[c>>2]>>2],0|St[E>>2],0|St[_>>2],0|St[S>>2]),St[y>>2]=k,0|St[y>>2]){O=21;break}}else if(k=0|me(d),St[v>>2]=k,0|St[v>>2]){O=23;break}}{if(17==(0|O))return St[s>>2]=St[w>>2],M=0|St[s>>2],pt=u,0|M;if(21==(0|O))return St[s>>2]=St[y>>2],M=0|St[s>>2],pt=u,0|M;if(23==(0|O))return St[s>>2]=St[v>>2],M=0|St[s>>2],pt=u,0|M;if(24==(0|O)){r:do{if(!(0|St[St[E>>2]>>2])){if(0|St[St[c>>2]>>2]){if(O=0|sr[3&St[St[S>>2]>>2]](0|St[S>>2],0|St[St[c>>2]>>2]),!(St[St[E>>2]>>2]=O))return St[s>>2]=2,M=0|St[s>>2],pt=u,0|M}else St[St[E>>2]>>2]=0;if(0|St[St[c>>2]>>2]){if(O=0|sr[3&St[St[S>>2]>>2]](0|St[S>>2],St[St[c>>2]>>2]<<2),!(St[St[_>>2]>>2]=O))return St[s>>2]=2,M=0|St[s>>2],pt=u,0|M}else St[St[_>>2]>>2]=0;for(St[m>>2]=0;;){if((0|St[m>>2])>>>0>=(0|St[St[c>>2]>>2])>>>0)break r;Et[(0|St[St[E>>2]>>2])+(0|St[m>>2])>>0]=0,St[(0|St[St[_>>2]>>2])+(St[m>>2]<<2)>>2]=0,St[m>>2]=1+(0|St[m>>2])}}}while(0);return St[s>>2]=0,M=0|St[s>>2],pt=u,0|M}}return 0}(0|St[l>>2],0|St[c>>2],20+(0|St[d>>2])|0,0|St[d>>2],4+(0|St[d>>2])|0,8+(0|St[d>>2])|0,0|St[h>>2]),St[F>>2]=u,0|St[F>>2]){v=9;break e}continue e;case 7:if(u=0|function(e,r,t,n,i){e|=0,r|=0,t|=0,n|=0,i|=0;var o=0,a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0,R=0,g=0,T=0,N=0,D=0;(0|(pt=(o=pt)+112|0))>=(0|bt)&&yt(112);if(a=o+96|0,s=o+88|0,f=o+84|0,l=o+80|0,c=o+76|0,d=o+72|0,E=o+68|0,_=o+64|0,S=o+60|0,m=o+56|0,h=o+52|0,p=o+48|0,b=o+44|0,k=o+40|0,F=o+36|0,y=(w=o)+32|0,v=o+28|0,M=o+24|0,O=o+20|0,A=o+16|0,R=o+12|0,g=o+8|0,St[(u=o+92|0)>>2]=e,St[s>>2]=r,St[f>>2]=t,St[l>>2]=n,St[c>>2]=i,i=0|I(0|St[u>>2],11,0),St[E>>2]=i,0|St[E>>2])return St[a>>2]=St[E>>2],T=0|St[a>>2],pt=o,0|T;if(E=0|fe(0|St[u>>2],0|St[s>>2]),St[_>>2]=E,0|St[_>>2])return St[a>>2]=St[_>>2],T=0|St[a>>2],pt=o,0|T;if(_=0|de(0|St[u>>2]),St[S>>2]=_,0|St[S>>2])return St[a>>2]=St[S>>2],T=0|St[a>>2],pt=o,0|T;if(0|St[St[s>>2]>>2]){if(S=0|sr[3&St[St[l>>2]>>2]](0|St[l>>2],40*(0|St[St[s>>2]>>2])|0),!(St[St[f>>2]>>2]=S))return St[a>>2]=2,T=0|St[a>>2],pt=o,0|T}else St[St[f>>2]>>2]=0;St[d>>2]=0;for(;!((0|St[d>>2])>>>0>=(0|St[St[s>>2]>>2])>>>0);)P((0|St[St[f>>2]>>2])+(40*(0|St[d>>2])|0)|0),St[d>>2]=1+(0|St[d>>2]);St[d>>2]=0;for(;N=0|St[u>>2],!((0|St[d>>2])>>>0>=(0|St[St[s>>2]>>2])>>>0);){if(S=0|function(e,r,t){e|=0,r|=0,t|=0;var n=0,i=0,o=0,a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0,R=0,g=0,T=0,N=0,D=0,P=0,C=0,I=0,L=0,x=0,B=0,H=0,U=0,z=0;(0|(pt=(n=pt)+160|0))>=(0|bt)&&yt(160);if(i=n+136|0,a=n+128|0,u=n+124|0,s=n+120|0,f=n+116|0,l=n+112|0,c=n+108|0,d=n+104|0,E=n+100|0,_=n+96|0,S=n+155|0,m=n+92|0,h=n+88|0,p=n+84|0,b=n+140|0,k=n+80|0,F=n+76|0,w=n+72|0,y=n+68|0,v=n+8|0,M=n+64|0,O=n+60|0,A=n+56|0,R=n+52|0,g=n+48|0,T=n+44|0,N=n+40|0,P=(D=n)+36|0,C=n+32|0,I=n+28|0,L=n+24|0,x=n+20|0,B=n+16|0,St[(o=n+132|0)>>2]=e,St[a>>2]=r,St[u>>2]=t,St[d>>2]=0,St[E>>2]=0,t=0|fe(0|St[o>>2],s),St[_>>2]=t,0|St[_>>2])return St[i>>2]=St[_>>2],H=0|St[i>>2],pt=n,0|H;if(32<(0|St[s>>2])>>>0)return St[i>>2]=4,H=0|St[i>>2],pt=n,0|H;if(St[16+(0|St[a>>2])>>2]=St[s>>2],0|St[s>>2]){if(_=0|sr[3&St[St[u>>2]>>2]](0|St[u>>2],24*(0|St[s>>2])|0),!(St[St[a>>2]>>2]=_))return St[i>>2]=2,H=0|St[i>>2],pt=n,0|H}else St[St[a>>2]>>2]=0;St[c>>2]=0;for(;!((0|St[c>>2])>>>0>=(0|St[s>>2])>>>0);)X((0|St[St[a>>2]>>2])+(24*(0|St[c>>2])|0)|0),St[c>>2]=1+(0|St[c>>2]);St[c>>2]=0;r:for(;;){if((0|St[c>>2])>>>0>=(0|St[s>>2])>>>0){U=55;break}if(St[m>>2]=(0|St[St[a>>2]>>2])+(24*(0|St[c>>2])|0),_=0|te(0|St[o>>2],S),St[k>>2]=_,0|St[k>>2]){U=15;break}if(St[h>>2]=15&(0|mt[S>>0]),_=0|ie(0|St[o>>2],b,0|St[h>>2]),St[F>>2]=_,0|St[F>>2]){U=17;break}if(8<(0|St[h>>2])>>>0){U=19;break}for(_=8+(0|St[m>>2])|0,St[_>>2]=0,St[_+4>>2]=0,St[p>>2]=0;!((0|St[p>>2])>>>0>=(0|St[h>>2])>>>0);)_=0|It(0|mt[b+((0|St[h>>2])-1-(0|St[p>>2]))>>0],0,St[p>>2]<<3|0),t=8+(0|St[m>>2])|0,e=St[(r=t)+4>>2]|Ft,St[(z=t)>>2]=St[r>>2]|_,St[z+4>>2]=e,St[p>>2]=1+(0|St[p>>2]);if(16&(0|mt[S>>0])|0){if(e=0|fe(0|St[o>>2],0|St[m>>2]),St[w>>2]=e,0|St[w>>2]){U=25;break}if(e=0|fe(0|St[o>>2],4+(0|St[m>>2])|0),St[y>>2]=e,0|St[y>>2]){U=27;break}if(32<(0|St[St[m>>2]>>2])>>>0){U=30;break}if(32<(0|St[4+(0|St[m>>2])>>2])>>>0){U=30;break}}else St[St[m>>2]>>2]=1,St[4+(0|St[m>>2])>>2]=1;if(32&(0|mt[S>>0])|0){if(St[(e=v)>>2]=0,St[e+4>>2]=0,e=0|le(0|St[o>>2],v),St[M>>2]=e,0|St[M>>2]){U=34;break}if(!(0|Ie(16+(0|St[m>>2])|0,0|St[v>>2],0|St[u>>2]))){U=36;break}if(e=0|ie(0|St[o>>2],0|St[16+(0|St[m>>2])>>2],0|St[v>>2]),St[O>>2]=e,0|St[O>>2]){U=38;break}}for(;128&(0|mt[S>>0]);){if(e=0|te(0|St[o>>2],S),St[A>>2]=e,0|St[A>>2]){U=41;break r}if(e=15&(0|mt[S>>0]),z=0|ce(0|St[o>>2],e,((0|e)<0)<<31>>31),St[R>>2]=z,0|St[R>>2]){U=43;break r}if(16&(0|mt[S>>0])|0){if(z=0|fe(0|St[o>>2],g),St[T>>2]=z,0|St[T>>2]){U=46;break r}if(z=0|fe(0|St[o>>2],g),St[N>>2]=z,0|St[N>>2]){U=48;break r}}if(32&(0|mt[S>>0])){if(St[(z=D)>>2]=0,St[z+4>>2]=0,z=0|le(0|St[o>>2],D),St[P>>2]=z,0|St[P>>2]){U=51;break r}if(z=D,e=0|ce(0|St[o>>2],0|St[z>>2],0|St[z+4>>2]),St[C>>2]=e,0|St[C>>2]){U=53;break r}}}St[d>>2]=(0|St[d>>2])+(0|St[St[m>>2]>>2]),St[E>>2]=(0|St[E>>2])+(0|St[4+(0|St[m>>2])>>2]),St[c>>2]=1+(0|St[c>>2])}switch(0|U){case 15:return St[i>>2]=St[k>>2],H=0|St[i>>2],pt=n,0|H;case 17:return St[i>>2]=St[F>>2],H=0|St[i>>2],pt=n,0|H;case 19:return St[i>>2]=4,H=0|St[i>>2],pt=n,0|H;case 25:return St[i>>2]=St[w>>2],H=0|St[i>>2],pt=n,0|H;case 27:return St[i>>2]=St[y>>2],H=0|St[i>>2],pt=n,0|H;case 30:return St[i>>2]=4,H=0|St[i>>2],pt=n,0|H;case 34:return St[i>>2]=St[M>>2],H=0|St[i>>2],pt=n,0|H;case 36:return St[i>>2]=2,H=0|St[i>>2],pt=n,0|H;case 38:return St[i>>2]=St[O>>2],H=0|St[i>>2],pt=n,0|H;case 41:return St[i>>2]=St[A>>2],H=0|St[i>>2],pt=n,0|H;case 43:return St[i>>2]=St[R>>2],H=0|St[i>>2],pt=n,0|H;case 46:return St[i>>2]=St[T>>2],H=0|St[i>>2],pt=n,0|H;case 48:return St[i>>2]=St[N>>2],H=0|St[i>>2],pt=n,0|H;case 51:return St[i>>2]=St[P>>2],H=0|St[i>>2],pt=n,0|H;case 53:return St[i>>2]=St[C>>2],H=0|St[i>>2],pt=n,0|H;case 55:if(!(0|St[E>>2]))return St[i>>2]=4,H=0|St[i>>2],pt=n,0|H;if(C=(0|St[E>>2])-1|0,St[f>>2]=C,St[20+(0|St[a>>2])>>2]=C,0|St[f>>2]){if(C=0|sr[3&St[St[u>>2]>>2]](0|St[u>>2],St[f>>2]<<3),!(St[4+(0|St[a>>2])>>2]=C))return St[i>>2]=2,H=0|St[i>>2],pt=n,0|H}else St[4+(0|St[a>>2])>>2]=0;for(St[c>>2]=0;;){if((0|St[c>>2])>>>0>=(0|St[f>>2])>>>0){U=68;break}if(St[I>>2]=(0|St[4+(0|St[a>>2])>>2])+(St[c>>2]<<3),C=0|fe(0|St[o>>2],0|St[I>>2]),St[L>>2]=C,0|St[L>>2]){U=64;break}if(C=0|fe(0|St[o>>2],4+(0|St[I>>2])|0),St[x>>2]=C,0|St[x>>2]){U=66;break}St[c>>2]=1+(0|St[c>>2])}if(64==(0|U))return St[i>>2]=St[L>>2],H=0|St[i>>2],pt=n,0|H;if(66==(0|U))return St[i>>2]=St[x>>2],H=0|St[i>>2],pt=n,0|H;if(68!=(0|U))break;if((0|St[d>>2])>>>0<(0|St[f>>2])>>>0)return St[i>>2]=4,H=0|St[i>>2],pt=n,0|H;if(U=(0|St[d>>2])-(0|St[f>>2])|0,St[l>>2]=U,St[24+(0|St[a>>2])>>2]=U,0|St[l>>2]){if(U=0|sr[3&St[St[u>>2]>>2]](0|St[u>>2],St[l>>2]<<2),!(St[8+(0|St[a>>2])>>2]=U))return St[i>>2]=2,H=0|St[i>>2],pt=n,0|H}else St[8+(0|St[a>>2])>>2]=0;U=1==(0|St[l>>2]),St[c>>2]=0;r:do{if(U){for(;!((0|St[c>>2])>>>0>=(0|St[d>>2])>>>0||(0|function(e,r){e|=0,r|=0;var t,n,i,o,a=0,u=0,s=0,f=pt;for((0|bt)<=(0|(pt=pt+16|0))&&yt(16),t=f+12|0,i=f+4|0,St[(n=(o=f)+8|0)>>2]=e,St[i>>2]=r,St[o>>2]=0;;){if((0|St[o>>2])>>>0>=(0|St[20+(0|St[n>>2])>>2])>>>0){a=6;break}if(u=0|St[o>>2],(0|St[(0|St[4+(0|St[n>>2])>>2])+(St[o>>2]<<3)>>2])==(0|St[i>>2])){a=4;break}St[o>>2]=u+1}return 4==(0|a)?(St[t>>2]=u,s=0|St[t>>2],pt=f,0|s):6==(0|a)?(St[t>>2]=-1,s=0|St[t>>2],pt=f,0|s):0}(0|St[a>>2],0|St[c>>2]))<0);)St[c>>2]=1+(0|St[c>>2]);if((0|St[c>>2])==(0|St[d>>2]))return St[i>>2]=4,H=0|St[i>>2],pt=n,0|H;St[St[8+(0|St[a>>2])>>2]>>2]=St[c>>2];break}for(;;){if((0|St[c>>2])>>>0>=(0|St[l>>2])>>>0)break r;if(u=0|fe(0|St[o>>2],(0|St[8+(0|St[a>>2])>>2])+(St[c>>2]<<2)|0),St[B>>2]=u,0|St[B>>2])break;St[c>>2]=1+(0|St[c>>2])}return St[i>>2]=St[B>>2],H=0|St[i>>2],pt=n,0|H}while(0);return St[i>>2]=0,H=0|St[i>>2],pt=n,0|H}return 0}(N,(0|St[St[f>>2]>>2])+(40*(0|St[d>>2])|0)|0,0|St[l>>2]),St[m>>2]=S,0|St[m>>2]){D=17;break}St[d>>2]=1+(0|St[d>>2])}if(17==(0|D))return St[a>>2]=St[m>>2],T=0|St[a>>2],pt=o,0|T;if(m=0|I(N,12,0),St[h>>2]=m,0|St[h>>2])return St[a>>2]=St[h>>2],T=0|St[a>>2],pt=o,0|T;St[d>>2]=0;r:for(;;){if((0|St[d>>2])>>>0>=(0|St[St[s>>2]>>2])>>>0){D=33;break}if(St[b>>2]=(0|St[St[f>>2]>>2])+(40*(0|St[d>>2])|0),h=0|C(0|St[b>>2]),St[k>>2]=h,0|St[k>>2]){if(h=0|sr[3&St[St[l>>2]>>2]](0|St[l>>2],St[k>>2]<<3),!(St[12+(0|St[b>>2])>>2]=h)){D=26;break}}else St[12+(0|St[b>>2])>>2]=0;for(St[p>>2]=0;!((0|St[p>>2])>>>0>=(0|St[k>>2])>>>0);){if(h=0|le(0|St[u>>2],(0|St[12+(0|St[b>>2])>>2])+(St[p>>2]<<3)|0),St[F>>2]=h,0|St[F>>2]){D=30;break r}St[p>>2]=1+(0|St[p>>2])}St[d>>2]=1+(0|St[d>>2])}{if(26==(0|D))return St[a>>2]=2,T=0|St[a>>2],pt=o,0|T;if(30==(0|D))return St[a>>2]=St[F>>2],T=0|St[a>>2],pt=o,0|T;if(33==(0|D)){for(;;){if(F=(D=0)|ue(0|St[u>>2],w),St[y>>2]=F,0|St[y>>2]){D=34;break}if(0==(0|St[(F=w)>>2])&0==(0|St[F+4>>2])){D=36;break}if(10==(0|St[(F=w)>>2])&0==(0|St[F+4>>2])){St[M>>2]=0,St[O>>2]=0,F=0|ne(0|St[u>>2],0|St[St[s>>2]>>2],M,O,0|St[c>>2]),St[v>>2]=F;r:do{if(!(0|St[v>>2]))for(St[d>>2]=0;;){if((0|St[d>>2])>>>0>=(0|St[St[s>>2]>>2])>>>0)break r;St[A>>2]=(0|St[St[f>>2]>>2])+(40*(0|St[d>>2])|0),St[28+(0|St[A>>2])>>2]=mt[(0|St[M>>2])+(0|St[d>>2])>>0],St[32+(0|St[A>>2])>>2]=St[(0|St[O>>2])+(St[d>>2]<<2)>>2],St[d>>2]=1+(0|St[d>>2])}}while(0);if(or[3&St[4+(0|St[c>>2])>>2]](0|St[c>>2],0|St[O>>2]),or[3&St[4+(0|St[c>>2])>>2]](0|St[c>>2],0|St[M>>2]),St[R>>2]=St[v>>2],0|St[R>>2]){D=43;break}D=33}else{if(F=0|me(0|St[u>>2]),St[g>>2]=F,0|St[g>>2]){D=45;break}D=33}}if(34==(0|D))return St[a>>2]=St[y>>2],T=0|St[a>>2],pt=o,0|T;if(36==(0|D))return St[a>>2]=0,T=0|St[a>>2],pt=o,0|T;if(43==(0|D))return St[a>>2]=St[R>>2],T=0|St[a>>2],pt=o,0|T;if(45==(0|D))return St[a>>2]=St[g>>2],T=0|St[a>>2],pt=o,0|T}}return 0}(0|St[l>>2],24+(0|St[d>>2])|0,12+(0|St[d>>2])|0,0|St[h>>2],0|St[p>>2]),St[w>>2]=u,0|St[w>>2]){v=11;break e}continue e;case 8:if(u=0|function(e,r,t,n,i,o,a,u){e|=0,r|=0,t|=0,n|=0,i|=0,o|=0,a|=0,u|=0;var s=0,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0,R=0,g=0,T=0,N=0,D=0,P=0,C=0,I=0,L=0,x=0,B=0,H=0,U=0,z=0,Y=0,V=0,K=0;(0|(pt=(s=pt)+160|0))>=(0|bt)&&yt(160);f=s+144|0,c=s+136|0,d=s+132|0,E=s+128|0,_=s+124|0,S=s+120|0,m=s+116|0,h=s+112|0,p=s+16|0,b=s+108|0,k=s+104|0,F=s+100|0,w=s+96|0,y=s+92|0,v=s+88|0,M=s+84|0,O=s+8|0,A=s+80|0,R=s+76|0,T=(g=s)+72|0,N=s+68|0,D=s+64|0,P=s+60|0,C=s+56|0,I=s+52|0,L=s+48|0,x=s+44|0,B=s+40|0,H=s+36|0,U=s+32|0,z=s+28|0,Y=s+24|0,St[(l=s+140|0)>>2]=e,St[c>>2]=r,St[d>>2]=t,St[E>>2]=n,St[_>>2]=i,St[S>>2]=o,St[m>>2]=a,St[h>>2]=u,St[(u=p)>>2]=0,St[u+4>>2]=0,St[k>>2]=0,St[F>>2]=0,St[b>>2]=0;for(;!((0|St[b>>2])>>>0>=(0|St[c>>2])>>>0);)St[(0|St[d>>2])+(40*(0|St[b>>2])|0)+36>>2]=1,St[b>>2]=1+(0|St[b>>2]);St[St[E>>2]>>2]=St[c>>2];r:for(;;){if(u=0|ue(0|St[l>>2],p),St[w>>2]=u,0|St[w>>2]){V=6;break}if(13==(0|St[(u=p)>>2])&0==(0|St[u+4>>2]))for(St[St[E>>2]>>2]=0,St[b>>2]=0;;){if((0|St[b>>2])>>>0>=(0|St[c>>2])>>>0)continue r;if(o=0|fe(0|St[l>>2],y),St[v>>2]=o,0|St[v>>2]){V=11;break r}St[(0|St[d>>2])+(40*(0|St[b>>2])|0)+36>>2]=St[y>>2],o=0|St[E>>2],St[o>>2]=(0|St[o>>2])+(0|St[y>>2]),St[b>>2]=1+(0|St[b>>2])}else{if(o=a=u=p,10==(0|St[u>>2])&0==(0|St[u+4>>2])|9==(0|St[a>>2])&0==(0|St[a+4>>2])|0==(0|St[o>>2])&0==(0|St[o+4>>2])){V=16;break}if(o=0|me(0|St[l>>2]),St[M>>2]=o,0|St[M>>2]){V=15;break}}}{if(6==(0|V))return St[f>>2]=St[w>>2],K=0|St[f>>2],pt=s,0|K;if(11==(0|V))return St[f>>2]=St[v>>2],K=0|St[f>>2],pt=s,0|K;if(15==(0|V))return St[f>>2]=St[M>>2],K=0|St[f>>2],pt=s,0|K;if(16==(0|V)){if(0|St[St[E>>2]>>2]){if(M=0|sr[3&St[St[h>>2]>>2]](0|St[h>>2],St[St[E>>2]>>2]<<3),St[St[_>>2]>>2]=M,!(0|St[St[_>>2]>>2]))return St[f>>2]=2,K=0|St[f>>2],pt=s,0|K;if(M=0|sr[3&St[St[h>>2]>>2]](0|St[h>>2],0|St[St[E>>2]>>2]),St[St[S>>2]>>2]=M,!(0|St[St[S>>2]>>2]))return St[f>>2]=2,K=0|St[f>>2],pt=s,0|K;if(M=0|sr[3&St[St[h>>2]>>2]](0|St[h>>2],St[St[E>>2]>>2]<<2),St[St[m>>2]>>2]=M,!(0|St[St[m>>2]>>2]))return St[f>>2]=2,K=0|St[f>>2],pt=s,0|K}else St[St[_>>2]>>2]=0,St[St[S>>2]>>2]=0,St[St[m>>2]>>2]=0;St[b>>2]=0;r:for(;!((0|St[b>>2])>>>0>=(0|St[c>>2])>>>0);){if(St[(M=O)>>2]=0,St[M+4>>2]=0,St[R>>2]=St[(0|St[d>>2])+(40*(0|St[b>>2])|0)+36>>2],0|St[R>>2]){M=p;t:do{if(9==(0|St[M>>2])&0==(0|St[M+4>>2]))for(St[A>>2]=1;;){if((0|St[A>>2])>>>0>=(0|St[R>>2])>>>0)break t;if(v=0|le(0|St[l>>2],g),St[T>>2]=v,0|St[T>>2]){V=31;break r}w=0|St[(v=g)>>2],y=0|St[v+4>>2],v=0|St[k>>2],St[k>>2]=v+1,o=(0|St[St[_>>2]>>2])+(v<<3)|0,St[o>>2]=w,St[o+4>>2]=y,y=g,w=0|Dt(0|St[(o=O)>>2],0|St[o+4>>2],0|St[y>>2],0|St[y+4>>2]),St[(y=O)>>2]=w,St[y+4>>2]=Ft,St[A>>2]=1+(0|St[A>>2])}}while(0);M=0|G((0|St[d>>2])+(40*(0|St[b>>2])|0)|0),w=0|Nt(0|M,0|Ft,0|St[(y=O)>>2],0|St[y+4>>2]),y=0|St[k>>2],St[k>>2]=y+1,M=(0|St[St[_>>2]>>2])+(y<<3)|0,St[M>>2]=w,St[M+4>>2]=Ft}St[b>>2]=1+(0|St[b>>2])}if(31==(0|V))return St[f>>2]=St[T>>2],K=0|St[f>>2],pt=s,0|K;if(9==(0|St[(T=p)>>2])&0==(0|St[T+4>>2])&&(T=0|ue(0|St[l>>2],p),St[N>>2]=T,0|St[N>>2]))return St[f>>2]=St[N>>2],K=0|St[f>>2],pt=s,0|K;for(St[b>>2]=0;!((0|St[b>>2])>>>0>=(0|St[St[E>>2]>>2])>>>0);)Et[(0|St[St[S>>2]>>2])+(0|St[b>>2])>>0]=0,St[(0|St[St[m>>2]>>2])+(St[b>>2]<<2)>>2]=0,St[b>>2]=1+(0|St[b>>2]);for(St[b>>2]=0;!((0|St[b>>2])>>>0>=(0|St[c>>2])>>>0);)St[D>>2]=St[(0|St[d>>2])+(40*(0|St[b>>2])|0)+36>>2],1==(0|St[D>>2])&&0!=(0|St[(0|St[d>>2])+(40*(0|St[b>>2])|0)+28>>2])||(St[F>>2]=(0|St[F>>2])+(0|St[D>>2])),St[b>>2]=1+(0|St[b>>2]);for(St[k>>2]=0;;){if(10==(0|St[(D=p)>>2])&0==(0|St[D+4>>2])){St[P>>2]=0,St[C>>2]=0,St[I>>2]=0,D=0|ne(0|St[l>>2],0|St[F>>2],C,I,0|St[h>>2]),St[L>>2]=D;r:do{if(!(0|St[L>>2]))for(St[b>>2]=0;;){if((0|St[b>>2])>>>0>=(0|St[c>>2])>>>0)break r;St[x>>2]=(0|St[d>>2])+(40*(0|St[b>>2])|0),St[B>>2]=St[36+(0|St[x>>2])>>2],1==(0|St[B>>2])&&0|St[28+(0|St[x>>2])>>2]?(Et[(0|St[St[S>>2]>>2])+(0|St[k>>2])>>0]=1,St[(0|St[St[m>>2]>>2])+(St[k>>2]<<2)>>2]=St[32+(0|St[x>>2])>>2],St[k>>2]=1+(0|St[k>>2])):V=55;t:do{if(55==(0|V))for(V=0,St[H>>2]=0;;){if((0|St[H>>2])>>>0>=(0|St[B>>2])>>>0)break t;Et[(0|St[St[S>>2]>>2])+(0|St[k>>2])>>0]=0|Et[(0|St[C>>2])+(0|St[P>>2])>>0],St[(0|St[St[m>>2]>>2])+(St[k>>2]<<2)>>2]=St[(0|St[I>>2])+(St[P>>2]<<2)>>2],St[k>>2]=1+(0|St[k>>2]),St[H>>2]=1+(0|St[H>>2]),St[P>>2]=1+(0|St[P>>2])}}while(0);St[b>>2]=1+(0|St[b>>2])}}while(0);if(or[3&St[4+(0|St[h>>2])>>2]](0|St[h>>2],0|St[C>>2]),or[3&St[4+(0|St[h>>2])>>2]](0|St[h>>2],0|St[I>>2]),St[U>>2]=St[L>>2],0|St[U>>2]){V=60;break}}else{if(0==(0|St[(D=p)>>2])&0==(0|St[D+4>>2])){V=62;break}if(D=0|me(0|St[l>>2]),St[z>>2]=D,0|St[z>>2]){V=64;break}}if(D=0|ue(0|St[l>>2],p),St[Y>>2]=D,0|St[Y>>2]){V=66;break}}if(60==(0|V))return St[f>>2]=St[U>>2],K=0|St[f>>2],pt=s,0|K;if(62==(0|V))return St[f>>2]=0,K=0|St[f>>2],pt=s,0|K;if(64==(0|V))return St[f>>2]=St[z>>2],K=0|St[f>>2],pt=s,0|K;if(66==(0|V))return St[f>>2]=St[Y>>2],K=0|St[f>>2],pt=s,0|K}}return 0}(0|St[l>>2],0|St[24+(0|St[d>>2])>>2],0|St[12+(0|St[d>>2])>>2],0|St[E>>2],0|St[_>>2],0|St[S>>2],0|St[m>>2],0|St[p>>2]),St[y>>2]=u,0|St[y>>2]){v=13;break e}continue e;default:v=14;break e}}return 3==(0|v)?(St[f>>2]=St[k>>2],M=0|St[f>>2],pt=O,0|M):5==(0|v)?(St[f>>2]=4,M=0|St[f>>2],pt=O,0|M):7==(0|v)?(M=(St[f>>2]=0)|St[f>>2],pt=O,0|M):9==(0|v)?(St[f>>2]=St[F>>2],M=0|St[f>>2],pt=O,0|M):11==(0|v)?(St[f>>2]=St[w>>2],M=0|St[f>>2],pt=O,0|M):13==(0|v)?(St[f>>2]=St[y>>2],M=0|St[f>>2],pt=O,0|M):14==(0|v)?(St[f>>2]=4,M=0|St[f>>2],pt=O,0|M):0}function fe(e,r){e|=0,r|=0;var t,n,i,o,a=0,u=0,s=pt;return(0|bt)<=(0|(pt=pt+32|0))&&yt(32),t=s+20|0,i=s+12|0,a=(o=s)+8|0,St[(n=s+16|0)>>2]=e,St[i>>2]=r,r=0|le(0|St[n>>2],o),St[a>>2]=r,pt=(u=0|St[a>>2]?(St[t>>2]=St[a>>2],0|St[t>>2]):0<(r=0|St[(a=o)+4>>2])>>>0|0==(0|r)&2147483648<=(0|St[a>>2])>>>0?(St[t>>2]=4,0|St[t>>2]):0<(r=0|St[(a=o)+4>>2])>>>0|0==(0|r)&67108864<=(0|St[a>>2])>>>0?(St[t>>2]=4,0|St[t>>2]):(St[St[i>>2]>>2]=St[o>>2],(St[t>>2]=0)|St[t>>2]),s),0|u}function le(e,r){e|=0,r|=0;var t,n,i,o,a,u,s,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=pt;if((0|bt)<=(0|(pt=pt+48|0))&&yt(48),t=m+28|0,f=m+20|0,i=m+34|0,l=m+33|0,c=m+16|0,d=m+12|0,E=m+32|0,a=(o=m)+8|0,St[(n=m+24|0)>>2]=e,St[f>>2]=r,Et[l>>0]=-128,r=0|te(0|St[n>>2],i),St[d>>2]=r,0|St[d>>2])return St[t>>2]=St[d>>2],_=0|St[t>>2],pt=m,0|_;for(d=0|St[f>>2],St[d>>2]=0,St[d+4>>2]=0,St[c>>2]=0;;){if(8<=(0|St[c>>2])){S=10;break}if(!((0|mt[i>>0])&(0|mt[l>>0]))){S=6;break}if(d=0|te(0|St[n>>2],E),St[a>>2]=d,0|St[a>>2]){S=8;break}d=0|It(0|mt[E>>0],0,St[c>>2]<<3|0),r=0|St[f>>2],u=St[(e=r)+4>>2]|Ft,St[(s=r)>>2]=St[e>>2]|d,St[s+4>>2]=u,Et[l>>0]=(0|mt[l>>0])>>1,St[c>>2]=1+(0|St[c>>2])}return 6==(0|S)?(E=(0|mt[i>>0])&(0|mt[l>>0])-1,St[(l=o)>>2]=E,St[l+4>>2]=((0|E)<0)<<31>>31,o=0|It(0|St[(E=o)>>2],0|St[E+4>>2],St[c>>2]<<3|0),c=0|St[f>>2],E=0|Dt(0|St[(f=c)>>2],0|St[f+4>>2],0|o,0|Ft),St[(o=c)>>2]=E,St[o+4>>2]=Ft,_=(St[t>>2]=0)|St[t>>2],pt=m,0|_):8==(0|S)?(St[t>>2]=St[a>>2],_=0|St[t>>2],pt=m,0|_):10==(0|S)?(_=(St[t>>2]=0)|St[t>>2],pt=m,0|_):0}function ce(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a=0,u=pt;return(0|bt)<=(0|(pt=pt+16|0))&&yt(16),n=u+12|0,St[(i=(o=u)+8|0)>>2]=e,St[(e=o)>>2]=r,St[e+4>>2]=t,e=0|St[(t=o)+4>>2],pt=(a=0>>0|(0==(0|e)?(0|St[t>>2])>>>0>(0|St[4+(0|St[i>>2])>>2])>>>0:0)?(St[n>>2]=16,0|St[n>>2]):(t=4+(0|St[i>>2])|0,St[t>>2]=(0|St[t>>2])-(0|St[o>>2]),t=0|St[i>>2],St[t>>2]=(0|St[t>>2])+(0|St[o>>2]),(St[n>>2]=0)|St[n>>2]),u),0|a}function de(e){e|=0;var r,t,n,i,o=0,a=pt;return(0|bt)<=(0|(pt=pt+16|0))&&yt(16),r=a+8|0,n=a+12|0,St[(t=(i=a)+4|0)>>2]=e,e=0|te(0|St[t>>2],n),St[i>>2]=e,pt=(o=(0|St[i>>2]?St[r>>2]=St[i>>2]:St[r>>2]=0==(0|mt[n>>0])?0:4,0|St[r>>2]),a),0|o}function Ee(e,r,t,n){e|=0,r|=0,t|=0,n|=0;var i,o,a,u,s,f,l,c,d,E=0,_=0,S=pt;if((0|bt)<=(0|(pt=pt+32|0))&&yt(32),i=S+24|0,a=S+16|0,u=S+12|0,s=S+8|0,f=S+29|0,l=S+28|0,c=S+4|0,St[(o=(d=S)+20|0)>>2]=e,St[a>>2]=r,St[u>>2]=t,St[s>>2]=n,Et[f>>0]=0,(Et[l>>0]=0)|St[a>>2]){if(n=0|sr[3&St[St[s>>2]>>2]](0|St[s>>2],0|St[a>>2]),!(St[St[u>>2]>>2]=n))return St[i>>2]=2,E=0|St[i>>2],pt=S,0|E}else St[St[u>>2]>>2]=0;for(St[c>>2]=0;;){if((0|St[c>>2])>>>0>=(0|St[a>>2])>>>0){_=12;break}if(!(0|mt[l>>0])){if(n=0|te(0|St[o>>2],f),St[d>>2]=n,0|St[d>>2]){_=9;break}Et[l>>0]=-128}Et[(0|St[St[u>>2]>>2])+(0|St[c>>2])>>0]=(0|mt[f>>0])&(0|mt[l>>0])|0?1:0,Et[l>>0]=(0|mt[l>>0])>>1,St[c>>2]=1+(0|St[c>>2])}return 9==(0|_)?(St[i>>2]=St[d>>2],E=0|St[i>>2],pt=S,0|E):12==(0|_)?(E=(St[i>>2]=0)|St[i>>2],pt=S,0|E):0}function _e(e,r,t,n){e|=0,r|=0,t|=0,n|=0;var i,o,a,u,s,f,l,c=0,d=0,E=pt;if((0|bt)<=(0|(pt=pt+32|0))&&yt(32),i=E+24|0,a=E+16|0,u=E+12|0,s=E+8|0,c=E+28|0,f=E+4|0,St[(o=(l=E)+20|0)>>2]=e,St[a>>2]=r,St[u>>2]=t,St[s>>2]=n,n=0|te(0|St[o>>2],c),St[l>>2]=n,0|St[l>>2])return St[i>>2]=St[l>>2],d=0|St[i>>2],pt=E,0|d;if(!(0|mt[c>>0]))return c=0|Ee(0|St[o>>2],0|St[a>>2],0|St[u>>2],0|St[s>>2]),St[i>>2]=c,d=0|St[i>>2],pt=E,0|d;if(0|St[a>>2]){if(c=0|sr[3&St[St[s>>2]>>2]](0|St[s>>2],0|St[a>>2]),!(St[St[u>>2]>>2]=c))return St[i>>2]=2,d=0|St[i>>2],pt=E,0|d}else St[St[u>>2]>>2]=0;for(St[f>>2]=0;!((0|St[f>>2])>>>0>=(0|St[a>>2])>>>0);)Et[(0|St[St[u>>2]>>2])+(0|St[f>>2])>>0]=1,St[f>>2]=1+(0|St[f>>2]);return d=(St[i>>2]=0)|St[i>>2],pt=E,0|d}function Se(e,r){e|=0,r|=0;var t,n,i,o,a,u,s=0,f=0,l=pt;for((0|bt)<=(0|(pt=pt+32|0))&&yt(32),t=l+16|0,i=l+8|0,o=l+4|0,a=l+20|0,St[(n=(u=l)+12|0)>>2]=e,St[i>>2]=r,St[St[i>>2]>>2]=0,St[o>>2]=0;;){if(4<=(0|St[o>>2])){s=6;break}if(r=0|te(0|St[n>>2],a),St[u>>2]=r,0|St[u>>2]){s=4;break}r=0|St[i>>2],St[r>>2]=St[r>>2]|(0|mt[a>>0])<<(St[o>>2]<<3),St[o>>2]=1+(0|St[o>>2])}return 4==(0|s)?(St[t>>2]=St[u>>2],f=0|St[t>>2],pt=l,0|f):6==(0|s)?(f=(St[t>>2]=0)|St[t>>2],pt=l,0|f):0}function te(e,r){e|=0,r|=0;var t,n,i,o=0,a=pt;return(0|bt)<=(0|(pt=pt+16|0))&&yt(16),t=a+8|0,St[(n=(i=a)+4|0)>>2]=e,St[i>>2]=r,pt=(o=0|St[4+(0|St[n>>2])>>2]?(r=4+(0|St[n>>2])|0,St[r>>2]=(0|St[r>>2])-1,r=0|St[n>>2],n=0|St[r>>2],St[r>>2]=1+n,Et[St[i>>2]>>0]=0|Et[n>>0],(St[t>>2]=0)|St[t>>2]):(St[t>>2]=16,0|St[t>>2]),a),0|o}function me(e){e|=0;var r,t,n,i=0,o=0,a=pt;return(0|bt)<=(0|(pt=pt+32|0))&&yt(32),r=a+16|0,i=(n=a)+8|0,St[(t=a+12|0)>>2]=e,e=0|le(0|St[t>>2],n),St[i>>2]=e,pt=(o=(0|St[i>>2]?St[r>>2]=St[i>>2]:(i=n,n=0|ce(0|St[t>>2],0|St[i>>2],0|St[i+4>>2]),St[r>>2]=n),0|St[r>>2]),a),0|o}function ne(e,r,t,n,i){e|=0,r|=0,t|=0,n|=0,i|=0;var o,a,u,s,f,l,c,d,E=0,_=0,S=0,m=pt;if((0|bt)<=(0|(pt=pt+48|0))&&yt(48),o=m+32|0,u=m+24|0,s=m+20|0,f=m+16|0,l=m+12|0,c=m+8|0,E=m+4|0,St[(a=(d=m)+28|0)>>2]=e,St[u>>2]=r,St[s>>2]=t,St[f>>2]=n,St[l>>2]=i,i=0|_e(0|St[a>>2],0|St[u>>2],0|St[s>>2],0|St[l>>2]),St[E>>2]=i,0|St[E>>2])return St[o>>2]=St[E>>2],_=0|St[o>>2],pt=m,0|_;if(0|St[u>>2]){if(E=0|sr[3&St[St[l>>2]>>2]](0|St[l>>2],St[u>>2]<<2),!(St[St[f>>2]>>2]=E))return St[o>>2]=2,_=0|St[o>>2],pt=m,0|_}else St[St[f>>2]>>2]=0;for(St[c>>2]=0;;){if((0|St[c>>2])>>>0>=(0|St[u>>2])>>>0){S=13;break}if(0|Et[(0|St[St[s>>2]>>2])+(0|St[c>>2])>>0]&&(E=0|Se(0|St[a>>2],(0|St[St[f>>2]>>2])+(St[c>>2]<<2)|0),St[d>>2]=E,0|St[d>>2])){S=11;break}St[c>>2]=1+(0|St[c>>2])}return 11==(0|S)?(St[o>>2]=St[d>>2],_=0|St[o>>2],pt=m,0|_):13==(0|S)?(_=(St[o>>2]=0)|St[o>>2],pt=m,0|_):0}function I(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u,s,f=0,l=0,c=pt;for((0|bt)<=(0|(pt=pt+32|0))&&yt(32),n=c+28|0,o=c+8|0,u=(a=c)+20|0,s=c+16|0,St[(i=c+24|0)>>2]=e,St[(e=o)>>2]=r,St[e+4>>2]=t;;){if(t=0|ue(0|St[i>>2],a),St[u>>2]=t,0|St[u>>2]){f=3;break}if(e=o,(0|St[(t=a)>>2])==(0|St[e>>2])&&(0|St[t+4>>2])==(0|St[e+4>>2])){f=5;break}if(0==(0|St[(e=a)>>2])&0==(0|St[e+4>>2])){f=7;break}if(e=0|me(0|St[i>>2]),St[s>>2]=e,0|St[s>>2]){f=9;break}}return 3==(0|f)?(St[n>>2]=St[u>>2],l=0|St[n>>2],pt=c,0|l):5==(0|f)?(l=(St[n>>2]=0)|St[n>>2],pt=c,0|l):7==(0|f)?(St[n>>2]=16,l=0|St[n>>2],pt=c,0|l):9==(0|f)?(St[n>>2]=St[s>>2],l=0|St[n>>2],pt=c,0|l):0}function ie(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u,s,f=0,l=0,c=pt;for((0|bt)<=(0|(pt=pt+32|0))&&yt(32),n=c+20|0,o=c+12|0,a=c+8|0,u=c+4|0,St[(i=(s=c)+16|0)>>2]=e,St[o>>2]=r,St[a>>2]=t,St[u>>2]=0;;){if((0|St[u>>2])>>>0>=(0|St[a>>2])>>>0){f=6;break}if(t=0|te(0|St[i>>2],(0|St[o>>2])+(0|St[u>>2])|0),St[s>>2]=t,0|St[s>>2]){f=4;break}St[u>>2]=1+(0|St[u>>2])}return 4==(0|f)?(St[n>>2]=St[s>>2],l=0|St[n>>2],pt=c,0|l):6==(0|f)?(l=(St[n>>2]=0)|St[n>>2],pt=c,0|l):0}function oe(e){e|=0;var r,t,n,i=0,o=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),r=o+8|0,St[(t=(n=o)+4|0)>>2]=e;do{if(0|St[St[t>>2]>>2]){if(e=0|function(e){var r=0,t=0,n=0,i=0;-1<(0|St[76+(e|=0)>>2])&&ze();(r=0!=(1&St[e>>2]|0))||(H(11076),t=0|St[e+52>>2],n=e+56|0,0|t&&(St[t+56>>2]=St[n>>2]),0|(i=0|St[n>>2])&&(St[i+52>>2]=t),(0|St[2768])==(0|e)&&(St[2768]=i),V(11076));i=0|Ve(e),t=0|ar[1&St[e+12>>2]](e)|i,0|(i=0|St[e+92>>2])&&Ge(i);r||Ge(e);return 0|t}(0|St[St[t>>2]>>2]),St[n>>2]=e,0|St[n>>2])return St[r>>2]=St[n>>2],i=0|St[r>>2],pt=o,0|i;St[St[t>>2]>>2]=0;break}}while(0);return i=(St[r>>2]=0)|St[r>>2],pt=o,0|i}function L(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u,s=0,f=pt;return(0|bt)<=(0|(pt=pt+32|0))&&yt(32),n=f+16|0,o=f+8|0,a=f+4|0,St[(i=(u=f)+12|0)>>2]=e,St[o>>2]=r,St[a>>2]=t,St[u>>2]=St[St[a>>2]>>2],pt=(s=0|St[u>>2]?(t=0|function(e,r,t,n){e|=0,n|=0;var i=0,o=0,a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0;i=0|wt(t|=0,r|=0),o=-1<(0|St[n+76>>2])?0|ze():0;u=0|Et[(a=n+74|0)>>0],Et[a>>0]=u+255|u,a=0|St[(u=n+4|0)>>2],s=(0|St[n+8>>2])-a|0,f=a,c=0<(0|s)?(Je(0|e,0|f,0|(a=s>>>0>>0?s:i)),St[u>>2]=f+a,l=i-a|0,e+a|0):(l=i,e);e:do{if(l){for(e=n+32|0,a=l,f=c;!(0|function(e){var r=0,t=0,n=0;t=0|Et[(r=74+(e|=0)|0)>>0],Et[r>>0]=t+255|t,r=e+44|0,(0|St[(t=e+20|0)>>2])>>>0>(0|St[r>>2])>>>0&&nr[15&St[e+36>>2]](e,0,0);St[e+16>>2]=0,St[e+28>>2]=0,St[t>>2]=0,n=20&(t=0|St[e>>2])?(4&t&&(St[e>>2]=32|t),-1):(t=0|St[r>>2],St[e+8>>2]=t,St[e+4>>2]=t,0);return 0|n}(n)||((u=0|nr[15&St[e>>2]](n,f,a))+1|0)>>>0<2);){if(!(s=a-u|0)){d=13;break e}a=s,f=f+u|0}0|o&&He(),E=((i-a|0)>>>0)/(r>>>0)|0}else d=13}while(0);13==(0|d)&&(E=(o&&He(),t));return 0|E}(0|St[o>>2],1,0|St[u>>2],0|St[St[i>>2]>>2]),St[St[a>>2]>>2]=t,(0|St[St[a>>2]>>2])==(0|St[u>>2])?(St[n>>2]=0)|St[n>>2]:(u=0|function(e){var r=0,t=0,n=0;n=-1<(0|St[76+(e|=0)>>2])?(r=0==(0|ze()),t=(0|St[e>>2])>>>5&1,r||He(),t):(0|St[e>>2])>>>5&1;return 0|n}(0|St[St[i>>2]>>2]),St[n>>2]=u,0|St[n>>2])):(St[n>>2]=0)|St[n>>2],f),0|s}function ae(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u,s,f=0,l=pt;switch((0|bt)<=(0|(pt=pt+32|0))&&yt(32),n=l+20|0,o=l+12|0,a=l+8|0,u=l+4|0,St[(i=(s=l)+16|0)>>2]=e,St[o>>2]=r,St[a>>2]=t,0|St[a>>2]){case 0:St[u>>2]=0;break;case 1:St[u>>2]=1;break;case 2:St[u>>2]=2;break;default:return St[n>>2]=1,f=0|St[n>>2],pt=l,0|f}return a=0|(e=0|St[St[i>>2]>>2],r=0|St[St[o>>2]>>2],t=0|St[u>>2],0|function(e,r,t){r|=0,t|=0;var n=0,i=0,o=0;o=-1<(0|St[76+(e|=0)>>2])?(n=0==(0|ze()),i=0|We(e,r,t),n||He(),i):0|We(e,r,t);return 0|o}(e|=0,r|=0,t|=0)),St[s>>2]=a,a=0|(t=0|St[St[i>>2]>>2],0|function(e){var r=0,t=0,n=0;n=-1<(0|St[76+(e|=0)>>2])?(r=0==(0|ze()),t=0|je(e),r||He(),t):0|je(e);return 0|n}(t|=0)),i=0|St[o>>2],St[i>>2]=a,St[4+i>>2]=((0|a)<0)<<31>>31,St[n>>2]=St[s>>2],f=0|St[n>>2],pt=l,0|f}function he(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a=pt;return(0|bt)<=(0|(pt=pt+32|0))&&yt(32),i=a+8|0,St[(n=(o=a)+16|0)>>2]=e,St[(e=i)>>2]=r,St[e+4>>2]=t,i=0|St[(t=i)+4>>2],St[(e=o)>>2]=St[t>>2],St[e+4>>2]=i,i=0|nr[15&St[12+(0|St[n>>2])>>2]](0|St[n>>2],o,0),pt=a,0|i}function pe(e,r,t,n){e|=0,r|=0,t|=0,n|=0;var i,o,a,u,s,f,l,c=0,d=0,E=pt;for((0|bt)<=(0|(pt=pt+32|0))&&yt(32),i=E+24|0,a=E+16|0,u=E+12|0,s=E+8|0,f=E+4|0,St[(o=(l=E)+20|0)>>2]=e,St[a>>2]=r,St[u>>2]=t,St[s>>2]=n;;){if(!(0|St[u>>2])){c=8;break}if(St[f>>2]=St[u>>2],n=0|nr[15&St[8+(0|St[o>>2])>>2]](0|St[o>>2],0|St[a>>2],f),St[l>>2]=n,0|St[l>>2]){c=4;break}if(!(0|St[f>>2])){c=6;break}St[a>>2]=(0|St[a>>2])+(0|St[f>>2]),St[u>>2]=(0|St[u>>2])-(0|St[f>>2])}return 4==(0|c)?(St[i>>2]=St[l>>2],d=0|St[i>>2],pt=E,0|d):6==(0|c)?(St[i>>2]=St[s>>2],d=0|St[i>>2],pt=E,0|d):8==(0|c)?(d=(St[i>>2]=0)|St[i>>2],pt=E,0|d):0}function be(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),i=a+4|0,St[(n=(o=a)+8|0)>>2]=e,St[i>>2]=r,St[o>>2]=t,St[76+(0|St[n>>2])>>2]=1,St[72+(0|St[n>>2])>>2]=0,(St[88+(0|St[n>>2])>>2]=0)|St[i>>2]&&(St[44+(0|St[n>>2])>>2]=0,St[48+(0|St[n>>2])>>2]=0,St[80+(0|St[n>>2])>>2]=1),pt=(0|St[o>>2]&&(St[80+(0|St[n>>2])>>2]=1),a)}function ke(e){e|=0;var r,t=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(r=t)>>2]=e,be((St[36+(0|St[r>>2])>>2]=0)|St[r>>2],1,1),pt=t}function Fe(e,r,t,n,i,o){e|=0,r|=0,t|=0,n|=0,i|=0,o|=0;var a,u,s,f,l,c,d,E,_,S,m,h,p,b=0,k=0,F=0,w=0,y=0,v=pt;for((0|bt)<=(0|(pt=pt+64|0))&&yt(64),a=v+56|0,s=v+48|0,b=v+44|0,f=v+40|0,l=v+36|0,c=v+32|0,k=v+28|0,d=v+24|0,E=v+20|0,_=v+16|0,S=v+12|0,m=v+8|0,h=v+4|0,St[(u=(p=v)+52|0)>>2]=e,St[s>>2]=r,St[b>>2]=t,St[f>>2]=n,St[l>>2]=i,St[c>>2]=o,St[k>>2]=St[St[f>>2]>>2],we((St[St[f>>2]>>2]=0)|St[u>>2],0|St[s>>2]),St[St[c>>2]>>2]=0;;){if(F=0|St[u>>2],274==(0|St[72+(0|St[u>>2])>>2])){w=46;break}if(0|St[F+76>>2]){for(;!((0|St[k>>2])>>>0<=0||5<=(0|St[88+(0|St[u>>2])>>2])>>>0);)o=0|St[b>>2],St[b>>2]=o+1,i=0|Et[o>>0],o=88+(0|St[u>>2])|0,n=0|St[o>>2],St[o>>2]=n+1,Et[92+(0|St[u>>2])+n>>0]=i,i=0|St[f>>2],St[i>>2]=1+(0|St[i>>2]),St[k>>2]=(0|St[k>>2])-1;if((0|St[88+(0|St[u>>2])>>2])>>>0<5){w=8;break}if(0|mt[92+(0|St[u>>2])>>0]){w=10;break}!function(e,r){e|=0,r|=0;var t=0,n=0,i=0;(0|(pt=(t=pt)+16|0))>=(0|bt)&&yt(16),St[(n=(i=t)+4|0)>>2]=e,St[i>>2]=r,St[32+(0|St[n>>2])>>2]=(0|mt[1+(0|St[i>>2])>>0])<<24|(0|mt[2+(0|St[i>>2])>>0])<<16|(0|mt[3+(0|St[i>>2])>>0])<<8|0|mt[4+(0|St[i>>2])>>0],St[28+(0|St[n>>2])>>2]=-1,St[76+(0|St[n>>2])>>2]=0,pt=t}(0|St[u>>2],92+(0|St[u>>2])|0),St[88+(0|St[u>>2])>>2]=0}if(((St[d>>2]=0)|St[36+(0|St[u>>2])>>2])>>>0>=(0|St[s>>2])>>>0){if(0==(0|St[72+(0|St[u>>2])>>2])&&0==(0|St[32+(0|St[u>>2])>>2])){w=15;break}if(!(0|St[l>>2])){w=17;break}if(0|St[72+(0|St[u>>2])>>2]){w=19;break}St[d>>2]=1}if(0|St[80+(0|St[u>>2])>>2]&&function(e){e|=0;var r=0,t=0,n=0,i=0,o=0;for((0|(pt=(r=pt)+16|0))>=(0|bt)&&yt(16),n=r+8|0,i=r+4|0,St[(t=(o=r)+12|0)>>2]=e,St[n>>2]=1846+(768<<(0|St[St[t>>2]>>2])+(0|St[4+(0|St[t>>2])>>2])),St[o>>2]=St[16+(0|St[t>>2])>>2],St[i>>2]=0;!((0|St[i>>2])>>>0>=(0|St[n>>2])>>>0);)_t[(0|St[o>>2])+(St[i>>2]<<1)>>1]=1024,St[i>>2]=1+(0|St[i>>2]);St[56+(0|St[t>>2])+12>>2]=1,St[56+(0|St[t>>2])+8>>2]=1,St[56+(0|St[t>>2])+4>>2]=1,St[56+(0|St[t>>2])>>2]=1,St[52+(0|St[t>>2])>>2]=0,St[80+(0|St[t>>2])>>2]=0,pt=r}(0|St[u>>2]),0|St[88+(0|St[u>>2])>>2]){for(St[m>>2]=St[88+(0|St[u>>2])>>2],St[h>>2]=0;!(20<=(0|St[m>>2])>>>0||(0|St[h>>2])>>>0>=(0|St[k>>2])>>>0);)i=0|St[h>>2],St[h>>2]=i+1,n=0|Et[(0|St[b>>2])+i>>0],i=0|St[m>>2],St[m>>2]=i+1,Et[92+(0|St[u>>2])+i>>0]=n;if(St[88+(0|St[u>>2])>>2]=St[m>>2],(0|St[m>>2])>>>0<20|0!=(0|St[d>>2])){if(n=0|ye(0|St[u>>2],92+(0|St[u>>2])|0,0|St[m>>2]),St[p>>2]=n,!(0|St[p>>2])){w=40;break}if(0!=(0|St[d>>2])&2!=(0|St[p>>2])){w=42;break}}if(St[24+(0|St[u>>2])>>2]=92+(0|St[u>>2]),0|ve(0|St[u>>2],0|St[s>>2],0|St[24+(0|St[u>>2])>>2])){w=44;break}St[h>>2]=(0|St[h>>2])-((0|St[m>>2])-((0|St[24+(0|St[u>>2])>>2])-(92+(0|St[u>>2])))),n=0|St[f>>2],St[n>>2]=(0|St[n>>2])+(0|St[h>>2]),St[b>>2]=(0|St[b>>2])+(0|St[h>>2]),St[k>>2]=(0|St[k>>2])-(0|St[h>>2]),St[88+(0|St[u>>2])>>2]=0}else{if((0|St[k>>2])>>>0<20|0!=(0|St[d>>2])){if(i=0|ye(0|St[u>>2],0|St[b>>2],0|St[k>>2]),St[S>>2]=i,!(0|St[S>>2])){w=26;break}if(0!=(0|St[d>>2])&2!=(0|St[S>>2])){w=28;break}St[_>>2]=St[b>>2]}else St[_>>2]=(0|St[b>>2])+(0|St[k>>2])-20;if(St[24+(0|St[u>>2])>>2]=St[b>>2],0|ve(0|St[u>>2],0|St[s>>2],0|St[_>>2])){w=32;break}St[E>>2]=(0|St[24+(0|St[u>>2])>>2])-(0|St[b>>2]),i=0|St[f>>2],St[i>>2]=(0|St[i>>2])+(0|St[E>>2]),St[b>>2]=(0|St[b>>2])+(0|St[E>>2]),St[k>>2]=(0|St[k>>2])-(0|St[E>>2])}}switch(0|w){case 8:return St[St[c>>2]>>2]=3,y=(St[a>>2]=0)|St[a>>2],pt=v,0|y;case 10:return St[a>>2]=1,y=0|St[a>>2],pt=v,0|y;case 15:return St[St[c>>2]>>2]=4,y=(St[a>>2]=0)|St[a>>2],pt=v,0|y;case 17:return St[St[c>>2]>>2]=2,y=(St[a>>2]=0)|St[a>>2],pt=v,0|y;case 19:return St[St[c>>2]>>2]=2,St[a>>2]=1,y=0|St[a>>2],pt=v,0|y;case 26:return Je(92+(0|St[u>>2])|0,0|St[b>>2],0|St[k>>2]),St[88+(0|St[u>>2])>>2]=St[k>>2],b=0|St[f>>2],St[b>>2]=(0|St[b>>2])+(0|St[k>>2]),St[St[c>>2]>>2]=3,y=(St[a>>2]=0)|St[a>>2],pt=v,0|y;case 28:return St[St[c>>2]>>2]=2,St[a>>2]=1,y=0|St[a>>2],pt=v,0|y;case 32:return St[a>>2]=1,y=0|St[a>>2],pt=v,0|y;case 40:return k=0|St[f>>2],St[k>>2]=(0|St[k>>2])+(0|St[h>>2]),St[St[c>>2]>>2]=3,y=(St[a>>2]=0)|St[a>>2],pt=v,0|y;case 42:return St[St[c>>2]>>2]=2,St[a>>2]=1,y=0|St[a>>2],pt=v,0|y;case 44:return St[a>>2]=1,y=0|St[a>>2],pt=v,0|y;case 46:return 0|St[F+32>>2]||(St[St[c>>2]>>2]=1),St[a>>2]=0==(0|St[32+(0|St[u>>2])>>2])?0:1,y=0|St[a>>2],pt=v,0|y}return 0}function we(e,r){e|=0,r|=0;var t,n,i,o,a,u,s=0,f=0,l=pt;if((0|bt)<=(0|(pt=pt+32|0))&&yt(32),s=l+20|0,n=l+16|0,i=l+12|0,o=l+8|0,a=l+4|0,St[(t=(u=l)+24|0)>>2]=e,St[s>>2]=r,0|St[72+(0|St[t>>2])>>2])if(274<=(0|St[72+(0|St[t>>2])>>2])>>>0)pt=l;else{for(St[n>>2]=St[20+(0|St[t>>2])>>2],St[i>>2]=St[36+(0|St[t>>2])>>2],St[o>>2]=St[40+(0|St[t>>2])>>2],St[a>>2]=St[72+(0|St[t>>2])>>2],St[u>>2]=St[56+(0|St[t>>2])>>2],((0|St[s>>2])-(0|St[i>>2])|0)>>>0<(0|St[a>>2])>>>0&&(St[a>>2]=(0|St[s>>2])-(0|St[i>>2])),0==(0|St[48+(0|St[t>>2])>>2])&&((0|St[12+(0|St[t>>2])>>2])-(0|St[44+(0|St[t>>2])>>2])|0)>>>0<=(0|St[a>>2])>>>0&&(St[48+(0|St[t>>2])>>2]=St[12+(0|St[t>>2])>>2]),s=44+(0|St[t>>2])|0,St[s>>2]=(0|St[s>>2])+(0|St[a>>2]),s=72+(0|St[t>>2])|0,St[s>>2]=(0|St[s>>2])-(0|St[a>>2]);s=0|St[a>>2],St[a>>2]=s+-1,f=0|St[i>>2],s;)Et[(0|St[n>>2])+(0|St[i>>2])>>0]=0|Et[(0|St[n>>2])+(f-(0|St[u>>2])+((0|St[i>>2])>>>0<(0|St[u>>2])>>>0?0|St[o>>2]:0))>>0],St[i>>2]=1+(0|St[i>>2]);St[36+(0|St[t>>2])>>2]=f,pt=l}else pt=l}function ye(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u,s,f,l,c,d,E,_,S,m,h,p,b,k,F,w,y,v,M,O,A=0,R=0,g=0,T=0,N=0,D=0,P=0,C=pt;(0|bt)<=(0|(pt=pt+112|0))&&yt(112),n=C+104|0,o=C+96|0,A=C+92|0,a=C+88|0,u=C+84|0,s=C+80|0,f=C+76|0,l=C+72|0,c=C+68|0,d=C+64|0,E=C+60|0,_=C+56|0,S=C+52|0,m=C+48|0,h=C+44|0,p=C+40|0,R=C+36|0,g=C+32|0,b=C+28|0,k=C+24|0,F=C+20|0,w=C+16|0,y=C+12|0,v=C+8|0,M=C+4|0,St[(i=(O=C)+100|0)>>2]=e,St[o>>2]=r,St[A>>2]=t,St[a>>2]=St[28+(0|St[i>>2])>>2],St[u>>2]=St[32+(0|St[i>>2])>>2],St[s>>2]=(0|St[o>>2])+(0|St[A>>2]),St[f>>2]=St[16+(0|St[i>>2])>>2],St[l>>2]=St[52+(0|St[i>>2])>>2],St[S>>2]=St[44+(0|St[i>>2])>>2]&(1<>2])>>2])-1,St[d>>2]=(0|St[f>>2])+(St[l>>2]<<4<<1)+(St[S>>2]<<1),St[_>>2]=re[St[d>>2]>>1];do{if((0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0<(0|St[s>>2])>>>0){St[a>>2]=St[a>>2]<<8,A=St[u>>2]<<8,t=0|St[o>>2],St[o>>2]=t+1,St[u>>2]=0|A|mt[t>>0];break}return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T}}while(0);t=0|wt((0|St[a>>2])>>>11,0|St[_>>2]),St[E>>2]=t,t=0|St[E>>2];e:do{if((0|St[u>>2])>>>0>=(0|St[E>>2])>>>0){St[a>>2]=(0|St[a>>2])-t,St[u>>2]=(0|St[u>>2])-(0|St[E>>2]),St[d>>2]=384+(0|St[f>>2])+(St[l>>2]<<1),St[_>>2]=re[St[d>>2]>>1];do{if((0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0<(0|St[s>>2])>>>0){St[a>>2]=St[a>>2]<<8,A=St[u>>2]<<8,r=0|St[o>>2],St[o>>2]=r+1,St[u>>2]=0|A|mt[r>>0];break}return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T}}while(0);if(r=0|wt((0|St[a>>2])>>>11,0|St[_>>2]),St[E>>2]=r,r=0|St[E>>2],(0|St[u>>2])>>>0<(0|St[E>>2])>>>0)St[a>>2]=r,St[l>>2]=0,St[d>>2]=1636+(0|St[f>>2]),St[c>>2]=2;else{St[a>>2]=(0|St[a>>2])-r,St[u>>2]=(0|St[u>>2])-(0|St[E>>2]),St[c>>2]=3,St[d>>2]=408+(0|St[f>>2])+(St[l>>2]<<1),St[_>>2]=re[St[d>>2]>>1];do{if((0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0<(0|St[s>>2])>>>0){St[a>>2]=St[a>>2]<<8,r=St[u>>2]<<8,A=0|St[o>>2],St[o>>2]=A+1,St[u>>2]=0|r|mt[A>>0];break}return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T}}while(0);A=0|wt((0|St[a>>2])>>>11,0|St[_>>2]),St[E>>2]=A,A=0|St[E>>2];do{if((0|St[u>>2])>>>0>=(0|St[E>>2])>>>0){St[a>>2]=(0|St[a>>2])-A,St[u>>2]=(0|St[u>>2])-(0|St[E>>2]),St[d>>2]=432+(0|St[f>>2])+(St[l>>2]<<1),St[_>>2]=re[St[d>>2]>>1];do{if((0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0<(0|St[s>>2])>>>0){St[a>>2]=St[a>>2]<<8,r=St[u>>2]<<8,e=0|St[o>>2],St[o>>2]=e+1,St[u>>2]=0|r|mt[e>>0];break}return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T}}while(0);if(e=0|wt((0|St[a>>2])>>>11,0|St[_>>2]),St[E>>2]=e,e=0|St[E>>2],(0|St[u>>2])>>>0<(0|St[E>>2])>>>0){St[a>>2]=e;break}St[a>>2]=(0|St[a>>2])-e,St[u>>2]=(0|St[u>>2])-(0|St[E>>2]),St[d>>2]=456+(0|St[f>>2])+(St[l>>2]<<1),St[_>>2]=re[St[d>>2]>>1];do{if((0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0<(0|St[s>>2])>>>0){St[a>>2]=St[a>>2]<<8,e=St[u>>2]<<8,r=0|St[o>>2],St[o>>2]=r+1,St[u>>2]=0|e|mt[r>>0];break}return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T}}while(0);if(r=0|wt((0|St[a>>2])>>>11,0|St[_>>2]),St[E>>2]=r,r=0|St[E>>2],(0|St[u>>2])>>>0<(0|St[E>>2])>>>0){St[a>>2]=r;break}St[a>>2]=(0|St[a>>2])-r,St[u>>2]=(0|St[u>>2])-(0|St[E>>2]);break}St[a>>2]=A,St[d>>2]=480+(0|St[f>>2])+(St[l>>2]<<4<<1)+(St[S>>2]<<1),St[_>>2]=re[St[d>>2]>>1];do{if((0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0<(0|St[s>>2])>>>0){St[a>>2]=St[a>>2]<<8,r=St[u>>2]<<8,e=0|St[o>>2],St[o>>2]=e+1,St[u>>2]=0|r|mt[e>>0];break}return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T}}while(0);if(e=0|wt((0|St[a>>2])>>>11,0|St[_>>2]),St[E>>2]=e,e=0|St[E>>2],(0|St[u>>2])>>>0>=(0|St[E>>2])>>>0){St[a>>2]=(0|St[a>>2])-e,St[u>>2]=(0|St[u>>2])-(0|St[E>>2]);break}St[a>>2]=e;do{if((0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0<(0|St[s>>2])>>>0){St[a>>2]=St[a>>2]<<8,e=St[u>>2]<<8,r=0|St[o>>2],St[o>>2]=r+1,St[u>>2]=0|e|mt[r>>0];break}return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T}}while(0);return St[n>>2]=3,T=0|St[n>>2],pt=C,0|T}while(0);St[l>>2]=12,St[d>>2]=2664+(0|St[f>>2])}St[y>>2]=St[d>>2],St[_>>2]=re[St[y>>2]>>1];do{if((0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0<(0|St[s>>2])>>>0){St[a>>2]=St[a>>2]<<8,A=St[u>>2]<<8,r=0|St[o>>2],St[o>>2]=r+1,St[u>>2]=0|A|mt[r>>0];break}return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T}}while(0);r=0|wt((0|St[a>>2])>>>11,0|St[_>>2]),St[E>>2]=r,r=0|St[E>>2];do{if((0|St[u>>2])>>>0>=(0|St[E>>2])>>>0){St[a>>2]=(0|St[a>>2])-r,St[u>>2]=(0|St[u>>2])-(0|St[E>>2]),St[y>>2]=2+(0|St[d>>2]),St[_>>2]=re[St[y>>2]>>1];do{if((0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0<(0|St[s>>2])>>>0){St[a>>2]=St[a>>2]<<8,A=St[u>>2]<<8,e=0|St[o>>2],St[o>>2]=e+1,St[u>>2]=0|A|mt[e>>0];break}return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T}}while(0);if(e=0|wt((0|St[a>>2])>>>11,0|St[_>>2]),St[E>>2]=e,e=0|St[E>>2],(0|St[u>>2])>>>0<(0|St[E>>2])>>>0){St[a>>2]=e,St[y>>2]=260+(0|St[d>>2])+(St[S>>2]<<3<<1),St[w>>2]=8,St[F>>2]=8;break}St[a>>2]=(0|St[a>>2])-e,St[u>>2]=(0|St[u>>2])-(0|St[E>>2]),St[y>>2]=516+(0|St[d>>2]),St[w>>2]=16,St[F>>2]=256;break}}while(St[a>>2]=r,St[y>>2]=4+(0|St[d>>2])+(St[S>>2]<<3<<1),St[w>>2]=0,St[F>>2]=8,0);St[k>>2]=1;do{if(St[_>>2]=re[(0|St[y>>2])+(St[k>>2]<<1)>>1],(0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0>=(0|St[s>>2])>>>0){N=86;break}St[a>>2]=St[a>>2]<<8,r=St[u>>2]<<8,e=0|St[o>>2],St[o>>2]=e+1,St[u>>2]=0|r|mt[e>>0]}}while(e=0|wt((0|St[a>>2])>>>11,0|St[_>>2]),St[E>>2]=e,e=0|St[E>>2],(0|St[u>>2])>>>0<(0|St[E>>2])>>>0?(St[a>>2]=e,St[k>>2]=(0|St[k>>2])+(0|St[k>>2])):(St[a>>2]=(0|St[a>>2])-e,St[u>>2]=(0|St[u>>2])-(0|St[E>>2]),St[k>>2]=(0|St[k>>2])+(0|St[k>>2])+1),(0|St[k>>2])>>>0<(0|St[F>>2])>>>0);if(86==(0|N))return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T;if(St[k>>2]=(0|St[k>>2])-(0|St[F>>2]),St[k>>2]=(0|St[k>>2])+(0|St[w>>2]),(0|St[l>>2])>>>0<4){St[d>>2]=864+(0|St[f>>2])+(((0|St[k>>2])>>>0<4?0|St[k>>2]:3)<<6<<1),St[v>>2]=1;do{if(St[_>>2]=re[(0|St[d>>2])+(St[v>>2]<<1)>>1],(0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0>=(0|St[s>>2])>>>0){N=96;break}St[a>>2]=St[a>>2]<<8,e=St[u>>2]<<8,r=0|St[o>>2],St[o>>2]=r+1,St[u>>2]=0|e|mt[r>>0]}}while(r=0|wt((0|St[a>>2])>>>11,0|St[_>>2]),St[E>>2]=r,r=0|St[E>>2],(0|St[u>>2])>>>0<(0|St[E>>2])>>>0?(St[a>>2]=r,St[v>>2]=(0|St[v>>2])+(0|St[v>>2])):(St[a>>2]=(0|St[a>>2])-r,St[u>>2]=(0|St[u>>2])-(0|St[E>>2]),St[v>>2]=(0|St[v>>2])+(0|St[v>>2])+1),(0|St[v>>2])>>>0<64);if(96==(0|N))return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T;if(St[v>>2]=(0|St[v>>2])-64,4<=(0|St[v>>2])>>>0){St[M>>2]=((0|St[v>>2])>>>1)-1;do{if(!((0|St[v>>2])>>>0<14)){for(St[M>>2]=(0|St[M>>2])-4;;){if((0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0>=(0|St[s>>2])>>>0)break;St[a>>2]=St[a>>2]<<8,r=St[u>>2]<<8,e=0|St[o>>2],St[o>>2]=e+1,St[u>>2]=0|r|mt[e>>0]}if(St[a>>2]=(0|St[a>>2])>>>1,St[u>>2]=(0|St[u>>2])-(St[a>>2]&(((0|St[u>>2])-(0|St[a>>2])|0)>>>31)-1),e=(0|St[M>>2])-1|0,!(St[M>>2]=e)){N=111;break}}if(111!=(0|N))return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T;St[d>>2]=1604+(0|St[f>>2]),St[M>>2]=4;break}}while(St[d>>2]=1376+(0|St[f>>2])+((2|1&St[v>>2])<>2]<<1)+(0-(0|St[v>>2])<<1)-2,0);for(St[O>>2]=1;;){if(St[_>>2]=re[(0|St[d>>2])+(St[O>>2]<<1)>>1],(0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0>=(0|St[s>>2])>>>0)break;St[a>>2]=St[a>>2]<<8,e=St[u>>2]<<8,r=0|St[o>>2],St[o>>2]=r+1,St[u>>2]=0|e|mt[r>>0]}if(r=0|wt((0|St[a>>2])>>>11,0|St[_>>2]),St[E>>2]=r,r=0|St[E>>2],(0|St[u>>2])>>>0<(0|St[E>>2])>>>0?(St[a>>2]=r,St[O>>2]=(0|St[O>>2])+(0|St[O>>2])):(St[a>>2]=(0|St[a>>2])-r,St[u>>2]=(0|St[u>>2])-(0|St[E>>2]),St[O>>2]=(0|St[O>>2])+(0|St[O>>2])+1),r=(0|St[M>>2])-1|0,!(St[M>>2]=r))break e}return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T}}}else{St[a>>2]=t,St[d>>2]=3692+(0|St[f>>2]),(0|St[48+(0|St[i>>2])>>2]||0|St[44+(0|St[i>>2])>>2])&&(r=0|St[i>>2],D=0|St[36+(0|St[i>>2])>>2]?0|St[r+36>>2]:0|St[r+40>>2],St[d>>2]=(0|St[d>>2])+(768*(((St[44+(0|St[i>>2])>>2]&(1<>2])>>2])-1)<>2]>>2])+((0|mt[(0|St[20+(0|St[i>>2])>>2])+(D-1)>>0])>>8-(0|St[St[i>>2]>>2]))|0)<<1));r:do{if((0|St[l>>2])>>>0<7){for(St[m>>2]=1;;){if(St[_>>2]=re[(0|St[d>>2])+(St[m>>2]<<1)>>1],(0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0>=(0|St[s>>2])>>>0)break;St[a>>2]=St[a>>2]<<8,r=St[u>>2]<<8,e=0|St[o>>2],St[o>>2]=e+1,St[u>>2]=0|r|mt[e>>0]}if(e=0|wt((0|St[a>>2])>>>11,0|St[_>>2]),St[E>>2]=e,e=0|St[E>>2],(0|St[u>>2])>>>0<(0|St[E>>2])>>>0?(St[a>>2]=e,St[m>>2]=(0|St[m>>2])+(0|St[m>>2])):(St[a>>2]=(0|St[a>>2])-e,St[u>>2]=(0|St[u>>2])-(0|St[E>>2]),St[m>>2]=(0|St[m>>2])+(0|St[m>>2])+1),256<=(0|St[m>>2])>>>0)break r}return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T}for(P=(0|St[36+(0|St[i>>2])>>2])>>>0<(0|St[56+(0|St[i>>2])>>2])>>>0?0|St[40+(0|St[i>>2])>>2]:0,St[h>>2]=mt[(0|St[20+(0|St[i>>2])>>2])+((0|St[36+(0|St[i>>2])>>2])-(0|St[56+(0|St[i>>2])>>2])+P)>>0],St[p>>2]=256,St[R>>2]=1;;){if(St[h>>2]=St[h>>2]<<1,St[g>>2]=St[h>>2]&St[p>>2],St[b>>2]=(0|St[d>>2])+(St[p>>2]<<1)+(St[g>>2]<<1)+(St[R>>2]<<1),St[_>>2]=re[St[b>>2]>>1],(0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0>=(0|St[s>>2])>>>0)break;St[a>>2]=St[a>>2]<<8,e=St[u>>2]<<8,r=0|St[o>>2],St[o>>2]=r+1,St[u>>2]=0|e|mt[r>>0]}if(r=0|wt((0|St[a>>2])>>>11,0|St[_>>2]),St[E>>2]=r,r=0|St[E>>2],(0|St[u>>2])>>>0<(0|St[E>>2])>>>0?(St[a>>2]=r,St[R>>2]=(0|St[R>>2])+(0|St[R>>2]),St[p>>2]=St[p>>2]&~St[g>>2]):(St[a>>2]=(0|St[a>>2])-r,St[u>>2]=(0|St[u>>2])-(0|St[E>>2]),St[R>>2]=(0|St[R>>2])+(0|St[R>>2])+1,St[p>>2]=St[p>>2]&St[g>>2]),256<=(0|St[R>>2])>>>0)break r}return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T}while(0);St[c>>2]=1}}while(0);do{if((0|St[a>>2])>>>0<16777216){if((0|St[o>>2])>>>0<(0|St[s>>2])>>>0){St[a>>2]=St[a>>2]<<8,R=St[u>>2]<<8,g=0|St[o>>2],St[o>>2]=g+1,St[u>>2]=0|R|mt[g>>0];break}return T=(St[n>>2]=0)|St[n>>2],pt=C,0|T}}while(0);return St[n>>2]=St[c>>2],T=0|St[n>>2],pt=C,0|T}function ve(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u,s,f,l=0,c=0,d=pt;(0|bt)<=(0|(pt=pt+32|0))&&yt(32),n=d+24|0,o=d+16|0,a=d+12|0,u=d+8|0,s=d+4|0,St[(i=(f=d)+20|0)>>2]=e,St[o>>2]=r,St[a>>2]=t;do{if(St[u>>2]=St[o>>2],0==(0|St[48+(0|St[i>>2])>>2])&&(St[s>>2]=(0|St[12+(0|St[i>>2])>>2])-(0|St[44+(0|St[i>>2])>>2]),((0|St[o>>2])-(0|St[36+(0|St[i>>2])>>2])|0)>>>0>(0|St[s>>2])>>>0)&&(St[u>>2]=(0|St[36+(0|St[i>>2])>>2])+(0|St[s>>2])),t=0|function(e,r,t){e|=0,r|=0,t|=0;var n=0,i=0,o=0,a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0,R=0,g=0,T=0,N=0,D=0,P=0,C=0,I=0,L=0,x=0,B=0,H=0,U=0,z=0,Y=0,V=0,K=0,W=0,j=0,X=0,G=0,q=0,Q=0,Z=0,J=0,$=0,ee=0;(0|(pt=(n=pt)+192|0))>=(0|bt)&&yt(192);i=n+188|0,a=n+180|0,u=n+176|0,s=n+172|0,f=n+168|0,l=n+164|0,c=n+160|0,d=n+156|0,E=n+152|0,_=n+148|0,S=n+144|0,m=n+140|0,h=n+136|0,p=n+132|0,b=n+128|0,k=n+124|0,F=n+120|0,w=n+116|0,y=n+112|0,v=n+108|0,M=n+104|0,O=n+100|0,A=n+96|0,R=n+92|0,g=n+88|0,T=n+84|0,N=n+80|0,D=n+76|0,P=n+72|0,C=n+68|0,I=n+64|0,L=n+60|0,x=n+56|0,B=n+52|0,H=n+48|0,U=n+44|0,z=n+40|0,Y=n+36|0,V=n+32|0,K=n+28|0,W=n+24|0,j=n+20|0,X=n+16|0,G=n+12|0,q=n+8|0,Q=n+4|0,St[(o=(Z=n)+184|0)>>2]=e,St[a>>2]=r,St[u>>2]=t,St[s>>2]=St[16+(0|St[o>>2])>>2],St[f>>2]=St[52+(0|St[o>>2])>>2],St[l>>2]=St[56+(0|St[o>>2])>>2],St[c>>2]=St[56+(0|St[o>>2])+4>>2],St[d>>2]=St[56+(0|St[o>>2])+8>>2],St[E>>2]=St[56+(0|St[o>>2])+12>>2],St[_>>2]=(1<>2])>>2])-1,St[S>>2]=(1<>2])>>2])-1,St[m>>2]=St[St[o>>2]>>2],St[h>>2]=St[20+(0|St[o>>2])>>2],St[p>>2]=St[40+(0|St[o>>2])>>2],St[b>>2]=St[36+(0|St[o>>2])>>2],St[k>>2]=St[44+(0|St[o>>2])>>2],St[F>>2]=St[48+(0|St[o>>2])>>2],St[w>>2]=0,St[y>>2]=St[24+(0|St[o>>2])>>2],St[v>>2]=St[28+(0|St[o>>2])>>2],St[M>>2]=St[32+(0|St[o>>2])>>2];e:do{St[g>>2]=St[k>>2]&St[_>>2],St[O>>2]=(0|St[s>>2])+(St[f>>2]<<4<<1)+(St[g>>2]<<1),St[R>>2]=re[St[O>>2]>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,t=St[M>>2]<<8,r=0|St[y>>2],St[y>>2]=r+1,St[M>>2]=0|t|mt[r>>0]),r=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=r,r=0|St[A>>2];r:do{if((0|St[M>>2])>>>0<(0|St[A>>2])>>>0){if(St[v>>2]=r,_t[St[O>>2]>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[O>>2]=3692+(0|St[s>>2]),0!=(0|St[F>>2])|0!=(0|St[k>>2])&&(St[O>>2]=(0|St[O>>2])+(768*(((St[k>>2]&St[S>>2])<>2])+((0|mt[(0|St[h>>2])+((0==(0|St[b>>2])?0|St[p>>2]:0|St[b>>2])-1)>>0])>>8-(0|St[m>>2]))|0)<<1)),(0|St[f>>2])>>>0<7)for(St[f>>2]=(0|St[f>>2])-((0|St[f>>2])>>>0<4?0|St[f>>2]:3),St[T>>2]=1;St[R>>2]=re[(0|St[O>>2])+(St[T>>2]<<1)>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,t=St[M>>2]<<8,e=0|St[y>>2],St[y>>2]=e+1,St[M>>2]=0|t|mt[e>>0]),e=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=e,e=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=e,_t[(0|St[O>>2])+(St[T>>2]<<1)>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[T>>2]=(0|St[T>>2])+(0|St[T>>2])):(St[v>>2]=(0|St[v>>2])-e,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[(0|St[O>>2])+(St[T>>2]<<1)>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[T>>2]=(0|St[T>>2])+(0|St[T>>2])+1),(0|St[T>>2])>>>0<256;);else for(St[N>>2]=mt[(0|St[20+(0|St[o>>2])>>2])+((0|St[b>>2])-(0|St[l>>2])+((0|St[b>>2])>>>0<(0|St[l>>2])>>>0?0|St[p>>2]:0))>>0],St[D>>2]=256,St[f>>2]=(0|St[f>>2])-((0|St[f>>2])>>>0<10?3:6),St[T>>2]=1;St[N>>2]=St[N>>2]<<1,St[P>>2]=St[N>>2]&St[D>>2],St[C>>2]=(0|St[O>>2])+(St[D>>2]<<1)+(St[P>>2]<<1)+(St[T>>2]<<1),St[R>>2]=re[St[C>>2]>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,e=St[M>>2]<<8,t=0|St[y>>2],St[y>>2]=t+1,St[M>>2]=0|e|mt[t>>0]),t=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=t,t=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=t,_t[St[C>>2]>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[T>>2]=(0|St[T>>2])+(0|St[T>>2]),St[D>>2]=St[D>>2]&~St[P>>2]):(St[v>>2]=(0|St[v>>2])-t,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[St[C>>2]>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[T>>2]=(0|St[T>>2])+(0|St[T>>2])+1,St[D>>2]=St[D>>2]&St[P>>2]),(0|St[T>>2])>>>0<256;);t=255&St[T>>2],e=0|St[b>>2],St[b>>2]=e+1,Et[(0|St[h>>2])+e>>0]=t,St[k>>2]=1+(0|St[k>>2])}else{if(St[v>>2]=(0|St[v>>2])-r,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[St[O>>2]>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[O>>2]=384+(0|St[s>>2])+(St[f>>2]<<1),St[R>>2]=re[St[O>>2]>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,t=St[M>>2]<<8,e=0|St[y>>2],St[y>>2]=e+1,St[M>>2]=0|t|mt[e>>0]),e=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=e,e=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0)St[v>>2]=e,_t[St[O>>2]>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[f>>2]=12+(0|St[f>>2]),St[O>>2]=1636+(0|St[s>>2]);else{if(St[v>>2]=(0|St[v>>2])-e,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[St[O>>2]>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),0==(0|St[F>>2])&0==(0|St[k>>2])){J=28;break e}St[O>>2]=408+(0|St[s>>2])+(St[f>>2]<<1),St[R>>2]=re[St[O>>2]>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,e=St[M>>2]<<8,t=0|St[y>>2],St[y>>2]=t+1,St[M>>2]=0|e|mt[t>>0]),t=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=t,t=0|St[A>>2];do{if((0|St[M>>2])>>>0<(0|St[A>>2])>>>0){if(St[v>>2]=t,_t[St[O>>2]>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[O>>2]=480+(0|St[s>>2])+(St[f>>2]<<4<<1)+(St[g>>2]<<1),St[R>>2]=re[St[O>>2]>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,e=St[M>>2]<<8,$=0|St[y>>2],St[y>>2]=$+1,St[M>>2]=0|e|mt[$>>0]),$=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=$,$=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0){St[v>>2]=$,_t[St[O>>2]>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),Et[(0|St[h>>2])+(0|St[b>>2])>>0]=0|Et[(0|St[h>>2])+((0|St[b>>2])-(0|St[l>>2])+((0|St[b>>2])>>>0<(0|St[l>>2])>>>0?0|St[p>>2]:0))>>0],St[b>>2]=1+(0|St[b>>2]),St[k>>2]=1+(0|St[k>>2]),St[f>>2]=(0|St[f>>2])>>>0<7?9:11;break r}St[v>>2]=(0|St[v>>2])-$,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[St[O>>2]>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5);break}}while(St[v>>2]=(0|St[v>>2])-t,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[St[O>>2]>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[O>>2]=432+(0|St[s>>2])+(St[f>>2]<<1),St[R>>2]=re[St[O>>2]>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,$=St[M>>2]<<8,e=0|St[y>>2],St[y>>2]=e+1,St[M>>2]=0|$|mt[e>>0]),e=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=e,e=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=e,_t[St[O>>2]>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[I>>2]=St[c>>2]):(St[v>>2]=(0|St[v>>2])-e,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[St[O>>2]>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[O>>2]=456+(0|St[s>>2])+(St[f>>2]<<1),St[R>>2]=re[St[O>>2]>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,e=St[M>>2]<<8,$=0|St[y>>2],St[y>>2]=$+1,St[M>>2]=0|e|mt[$>>0]),$=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=$,$=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=$,_t[St[O>>2]>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[I>>2]=St[d>>2]):(St[v>>2]=(0|St[v>>2])-$,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[St[O>>2]>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[I>>2]=St[E>>2],St[E>>2]=St[d>>2]),St[d>>2]=St[c>>2]),St[c>>2]=St[l>>2],St[l>>2]=St[I>>2],0);St[f>>2]=(0|St[f>>2])>>>0<7?8:11,St[O>>2]=2664+(0|St[s>>2])}St[B>>2]=St[O>>2],St[R>>2]=re[St[B>>2]>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,t=St[M>>2]<<8,$=0|St[y>>2],St[y>>2]=$+1,St[M>>2]=0|t|mt[$>>0]),$=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=$,$=0|St[A>>2];do{if((0|St[M>>2])>>>0>=(0|St[A>>2])>>>0){if(St[v>>2]=(0|St[v>>2])-$,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[St[B>>2]>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[B>>2]=2+(0|St[O>>2]),St[R>>2]=re[St[B>>2]>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,t=St[M>>2]<<8,e=0|St[y>>2],St[y>>2]=e+1,St[M>>2]=0|t|mt[e>>0]),e=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=e,e=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0){St[v>>2]=e,_t[St[B>>2]>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[B>>2]=260+(0|St[O>>2])+(St[g>>2]<<3<<1),St[x>>2]=8,St[L>>2]=8;break}St[v>>2]=(0|St[v>>2])-e,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[St[B>>2]>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[B>>2]=516+(0|St[O>>2]),St[x>>2]=16,St[L>>2]=256;break}}while(St[v>>2]=$,_t[St[B>>2]>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[B>>2]=4+(0|St[O>>2])+(St[g>>2]<<3<<1),St[x>>2]=0,St[L>>2]=8,0);for(St[w>>2]=1;St[R>>2]=re[(0|St[B>>2])+(St[w>>2]<<1)>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,$=St[M>>2]<<8,e=0|St[y>>2],St[y>>2]=e+1,St[M>>2]=0|$|mt[e>>0]),e=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=e,e=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=e,_t[(0|St[B>>2])+(St[w>>2]<<1)>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[w>>2]=(0|St[w>>2])+(0|St[w>>2])):(St[v>>2]=(0|St[v>>2])-e,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[(0|St[B>>2])+(St[w>>2]<<1)>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[w>>2]=(0|St[w>>2])+(0|St[w>>2])+1),(0|St[w>>2])>>>0<(0|St[L>>2])>>>0;);if(St[w>>2]=(0|St[w>>2])-(0|St[L>>2]),St[w>>2]=(0|St[w>>2])+(0|St[x>>2]),12<=(0|St[f>>2])>>>0){St[O>>2]=864+(0|St[s>>2])+(((0|St[w>>2])>>>0<4?0|St[w>>2]:3)<<6<<1),St[H>>2]=1,St[R>>2]=re[(0|St[O>>2])+(St[H>>2]<<1)>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,e=St[M>>2]<<8,$=0|St[y>>2],St[y>>2]=$+1,St[M>>2]=0|e|mt[$>>0]),$=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=$,$=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=$,_t[(0|St[O>>2])+(St[H>>2]<<1)>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[H>>2]=(0|St[H>>2])+(0|St[H>>2])):(St[v>>2]=(0|St[v>>2])-$,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[(0|St[O>>2])+(St[H>>2]<<1)>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[H>>2]=(0|St[H>>2])+(0|St[H>>2])+1),St[R>>2]=re[(0|St[O>>2])+(St[H>>2]<<1)>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,$=St[M>>2]<<8,e=0|St[y>>2],St[y>>2]=e+1,St[M>>2]=0|$|mt[e>>0]),e=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=e,e=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=e,_t[(0|St[O>>2])+(St[H>>2]<<1)>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[H>>2]=(0|St[H>>2])+(0|St[H>>2])):(St[v>>2]=(0|St[v>>2])-e,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[(0|St[O>>2])+(St[H>>2]<<1)>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[H>>2]=(0|St[H>>2])+(0|St[H>>2])+1),St[R>>2]=re[(0|St[O>>2])+(St[H>>2]<<1)>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,e=St[M>>2]<<8,$=0|St[y>>2],St[y>>2]=$+1,St[M>>2]=0|e|mt[$>>0]),$=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=$,$=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=$,_t[(0|St[O>>2])+(St[H>>2]<<1)>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[H>>2]=(0|St[H>>2])+(0|St[H>>2])):(St[v>>2]=(0|St[v>>2])-$,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[(0|St[O>>2])+(St[H>>2]<<1)>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[H>>2]=(0|St[H>>2])+(0|St[H>>2])+1),St[R>>2]=re[(0|St[O>>2])+(St[H>>2]<<1)>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,$=St[M>>2]<<8,e=0|St[y>>2],St[y>>2]=e+1,St[M>>2]=0|$|mt[e>>0]),e=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=e,e=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=e,_t[(0|St[O>>2])+(St[H>>2]<<1)>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[H>>2]=(0|St[H>>2])+(0|St[H>>2])):(St[v>>2]=(0|St[v>>2])-e,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[(0|St[O>>2])+(St[H>>2]<<1)>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[H>>2]=(0|St[H>>2])+(0|St[H>>2])+1),St[R>>2]=re[(0|St[O>>2])+(St[H>>2]<<1)>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,e=St[M>>2]<<8,$=0|St[y>>2],St[y>>2]=$+1,St[M>>2]=0|e|mt[$>>0]),$=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=$,$=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=$,_t[(0|St[O>>2])+(St[H>>2]<<1)>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[H>>2]=(0|St[H>>2])+(0|St[H>>2])):(St[v>>2]=(0|St[v>>2])-$,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[(0|St[O>>2])+(St[H>>2]<<1)>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[H>>2]=(0|St[H>>2])+(0|St[H>>2])+1),St[R>>2]=re[(0|St[O>>2])+(St[H>>2]<<1)>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,$=St[M>>2]<<8,e=0|St[y>>2],St[y>>2]=e+1,St[M>>2]=0|$|mt[e>>0]),e=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=e,e=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=e,_t[(0|St[O>>2])+(St[H>>2]<<1)>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[H>>2]=(0|St[H>>2])+(0|St[H>>2])):(St[v>>2]=(0|St[v>>2])-e,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[(0|St[O>>2])+(St[H>>2]<<1)>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[H>>2]=(0|St[H>>2])+(0|St[H>>2])+1),St[H>>2]=(0|St[H>>2])-64;t:do{if(4<=(0|St[H>>2])>>>0){if(St[U>>2]=St[H>>2],St[z>>2]=((0|St[H>>2])>>>1)-1,St[H>>2]=2|1&St[H>>2],e=0|St[z>>2],(0|St[U>>2])>>>0<14)for(St[H>>2]=St[H>>2]<>2]=1376+(0|St[s>>2])+(St[H>>2]<<1)+(0-(0|St[U>>2])<<1)-2,St[Y>>2]=1,St[V>>2]=1;;)if(St[R>>2]=re[(0|St[O>>2])+(St[V>>2]<<1)>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,$=St[M>>2]<<8,t=0|St[y>>2],St[y>>2]=t+1,St[M>>2]=0|$|mt[t>>0]),t=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=t,t=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=t,_t[(0|St[O>>2])+(St[V>>2]<<1)>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[V>>2]=(0|St[V>>2])+(0|St[V>>2])):(St[v>>2]=(0|St[v>>2])-t,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[(0|St[O>>2])+(St[V>>2]<<1)>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[V>>2]=(0|St[V>>2])+(0|St[V>>2])+1,St[H>>2]=St[H>>2]|St[Y>>2]),St[Y>>2]=St[Y>>2]<<1,t=(0|St[z>>2])-1|0,!(St[z>>2]=t))break t;for(St[z>>2]=e-4;(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,t=St[M>>2]<<8,$=0|St[y>>2],St[y>>2]=$+1,St[M>>2]=0|t|mt[$>>0]),St[v>>2]=(0|St[v>>2])>>>1,St[M>>2]=(0|St[M>>2])-(0|St[v>>2]),St[K>>2]=0-((0|St[M>>2])>>>31),St[H>>2]=(St[H>>2]<<1)+(1+(0|St[K>>2])),St[M>>2]=(0|St[M>>2])+(St[v>>2]&St[K>>2]),$=(0|St[z>>2])-1|0,St[z>>2]=$,0!=(0|$););if(St[O>>2]=1604+(0|St[s>>2]),St[H>>2]=St[H>>2]<<4,St[W>>2]=1,St[R>>2]=re[(0|St[O>>2])+(St[W>>2]<<1)>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,e=St[M>>2]<<8,$=0|St[y>>2],St[y>>2]=$+1,St[M>>2]=0|e|mt[$>>0]),$=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=$,$=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=$,_t[(0|St[O>>2])+(St[W>>2]<<1)>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[W>>2]=(0|St[W>>2])+(0|St[W>>2])):(St[v>>2]=(0|St[v>>2])-$,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[(0|St[O>>2])+(St[W>>2]<<1)>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[W>>2]=(0|St[W>>2])+(0|St[W>>2])+1,St[H>>2]=1|St[H>>2]),St[R>>2]=re[(0|St[O>>2])+(St[W>>2]<<1)>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,$=St[M>>2]<<8,e=0|St[y>>2],St[y>>2]=e+1,St[M>>2]=0|$|mt[e>>0]),e=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=e,e=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=e,_t[(0|St[O>>2])+(St[W>>2]<<1)>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[W>>2]=(0|St[W>>2])+(0|St[W>>2])):(St[v>>2]=(0|St[v>>2])-e,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[(0|St[O>>2])+(St[W>>2]<<1)>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[W>>2]=(0|St[W>>2])+(0|St[W>>2])+1,St[H>>2]=2|St[H>>2]),St[R>>2]=re[(0|St[O>>2])+(St[W>>2]<<1)>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,e=St[M>>2]<<8,$=0|St[y>>2],St[y>>2]=$+1,St[M>>2]=0|e|mt[$>>0]),$=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=$,$=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=$,_t[(0|St[O>>2])+(St[W>>2]<<1)>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[W>>2]=(0|St[W>>2])+(0|St[W>>2])):(St[v>>2]=(0|St[v>>2])-$,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[(0|St[O>>2])+(St[W>>2]<<1)>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[W>>2]=(0|St[W>>2])+(0|St[W>>2])+1,St[H>>2]=4|St[H>>2]),St[R>>2]=re[(0|St[O>>2])+(St[W>>2]<<1)>>1],(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,$=St[M>>2]<<8,e=0|St[y>>2],St[y>>2]=e+1,St[M>>2]=0|$|mt[e>>0]),e=0|wt((0|St[v>>2])>>>11,0|St[R>>2]),St[A>>2]=e,e=0|St[A>>2],(0|St[M>>2])>>>0<(0|St[A>>2])>>>0?(St[v>>2]=e,_t[(0|St[O>>2])+(St[W>>2]<<1)>>1]=(0|St[R>>2])+((2048-(0|St[R>>2])|0)>>>5),St[W>>2]=(0|St[W>>2])+(0|St[W>>2])):(St[v>>2]=(0|St[v>>2])-e,St[M>>2]=(0|St[M>>2])-(0|St[A>>2]),_t[(0|St[O>>2])+(St[W>>2]<<1)>>1]=(0|St[R>>2])-((0|St[R>>2])>>>5),St[W>>2]=(0|St[W>>2])+(0|St[W>>2])+1,St[H>>2]=8|St[H>>2]),-1==(0|St[H>>2])){J=130;break e}}}while(0);if(St[E>>2]=St[d>>2],St[d>>2]=St[c>>2],St[c>>2]=St[l>>2],St[l>>2]=1+(0|St[H>>2]),e=0|St[H>>2],0|St[F>>2]){if(e>>>0>=(0|St[F>>2])>>>0){J=135;break e}}else if(e>>>0>=(0|St[k>>2])>>>0){J=133;break e}St[f>>2]=(0|St[f>>2])>>>0<19?7:10}if(St[w>>2]=2+(0|St[w>>2]),(0|St[a>>2])==(0|St[b>>2])){J=138;break e}if(St[j>>2]=(0|St[a>>2])-(0|St[b>>2]),St[X>>2]=(0|St[j>>2])>>>0<(0|St[w>>2])>>>0?0|St[j>>2]:0|St[w>>2],St[G>>2]=(0|St[b>>2])-(0|St[l>>2])+((0|St[b>>2])>>>0<(0|St[l>>2])>>>0?0|St[p>>2]:0),St[k>>2]=(0|St[k>>2])+(0|St[X>>2]),St[w>>2]=(0|St[w>>2])-(0|St[X>>2]),((0|St[G>>2])+(0|St[X>>2])|0)>>>0>(0|St[p>>2])>>>0)for(;;)if(e=0|Et[(0|St[h>>2])+(0|St[G>>2])>>0],$=0|St[b>>2],St[b>>2]=$+1,Et[(0|St[h>>2])+$>>0]=e,e=1+(0|St[G>>2])|0,St[G>>2]=e,St[G>>2]=(0|e)==(0|St[p>>2])?0:e,e=(0|St[X>>2])-1|0,!(St[X>>2]=e))break r;for(St[q>>2]=(0|St[h>>2])+(0|St[b>>2]),St[Q>>2]=(0|St[G>>2])-(0|St[b>>2]),St[Z>>2]=(0|St[q>>2])+(0|St[X>>2]),St[b>>2]=(0|St[b>>2])+(0|St[X>>2]);Et[St[q>>2]>>0]=0|Et[(0|St[q>>2])+(0|St[Q>>2])>>0],e=1+(0|St[q>>2])|0,St[q>>2]=e,(0|e)!=(0|St[Z>>2]););}}while(0)}while(!((0|St[b>>2])>>>0>=(0|St[a>>2])>>>0)&&(0|St[y>>2])>>>0<(0|St[u>>2])>>>0);{if(28==(0|J))return St[i>>2]=1,ee=0|St[i>>2],pt=n,0|ee;if(130==(0|J))St[w>>2]=274+(0|St[w>>2]),St[f>>2]=(0|St[f>>2])-12;else{if(133==(0|J))return St[i>>2]=1,ee=0|St[i>>2],pt=n,0|ee;if(135==(0|J))return St[i>>2]=1,ee=0|St[i>>2],pt=n,0|ee;if(138==(0|J))return St[i>>2]=1,ee=0|St[i>>2],pt=n,0|ee}}(0|St[v>>2])>>>0<16777216&&(St[v>>2]=St[v>>2]<<8,J=St[M>>2]<<8,u=0|St[y>>2],St[y>>2]=u+1,St[M>>2]=0|J|mt[u>>0]);return St[24+(0|St[o>>2])>>2]=St[y>>2],St[28+(0|St[o>>2])>>2]=St[v>>2],St[32+(0|St[o>>2])>>2]=St[M>>2],St[72+(0|St[o>>2])>>2]=St[w>>2],St[36+(0|St[o>>2])>>2]=St[b>>2],St[44+(0|St[o>>2])>>2]=St[k>>2],St[56+(0|St[o>>2])>>2]=St[l>>2],St[56+(0|St[o>>2])+4>>2]=St[c>>2],St[56+(0|St[o>>2])+8>>2]=St[d>>2],St[56+(0|St[o>>2])+12>>2]=St[E>>2],St[52+(0|St[o>>2])>>2]=St[f>>2],St[i>>2]=0,ee=0|St[i>>2],pt=n,0|ee}(0|St[i>>2],0|St[u>>2],0|St[a>>2]),St[f>>2]=t,0|St[f>>2]){l=6;break}}while(((0|St[44+(0|St[i>>2])>>2])>>>0>=(0|St[12+(0|St[i>>2])>>2])>>>0&&(St[48+(0|St[i>>2])>>2]=St[12+(0|St[i>>2])>>2]),we(0|St[i>>2],0|St[o>>2]),!((0|St[36+(0|St[i>>2])>>2])>>>0>=(0|St[o>>2])>>>0))&&(!((0|St[24+(0|St[i>>2])>>2])>>>0>=(0|St[a>>2])>>>0)&&(0|St[72+(0|St[i>>2])>>2])>>>0<274));return pt=(c=6==(0|l)?(St[n>>2]=St[f>>2],0|St[n>>2]):(274<(0|St[72+(0|St[i>>2])>>2])>>>0&&(St[72+(0|St[i>>2])>>2]=274),(St[n>>2]=0)|St[n>>2]),d),0|c}function Oe(e,r){e|=0,r|=0;var t,n,i=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(t=(n=i)+4|0)>>2]=e,St[n>>2]=r,or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[16+(0|St[t>>2])>>2]),St[16+(0|St[t>>2])>>2]=0,pt=i}function Ae(e,r,t,n){e|=0,r|=0,t|=0,n|=0;var i,o,a,u,s,f,l=0,c=0,d=0,E=pt;return(0|bt)<=(0|(pt=pt+48|0))&&yt(48),i=E+40|0,a=E+32|0,u=E+28|0,s=E+24|0,f=E+8|0,l=E+4|0,St[(o=(c=E)+36|0)>>2]=e,St[a>>2]=r,St[u>>2]=t,St[s>>2]=n,n=0|function(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u,s,f=0,l=pt;return(0|bt)<=(0|(pt=pt+32|0))&&yt(32),n=l+16|0,o=l+8|0,a=l+4|0,s=(u=l)+20|0,St[(i=l+12|0)>>2]=e,St[o>>2]=r,St[a>>2]=t,pt=(f=(0|St[a>>2])>>>0<5?(St[n>>2]=4,0|St[n>>2]):(a=0|mt[1+(0|St[o>>2])>>0]|(0|mt[2+(0|St[o>>2])>>0])<<8|(0|mt[3+(0|St[o>>2])>>0])<<16|(0|mt[4+(0|St[o>>2])>>0])<<24,St[u>>2]=a,St[u>>2]=(0|St[u>>2])>>>0<4096?4096:a,St[12+(0|St[i>>2])>>2]=St[u>>2],Et[s>>0]=0|Et[St[o>>2]>>0],225<=(0|mt[s>>0])?(St[n>>2]=4,0|St[n>>2]):(St[St[i>>2]>>2]=(0|mt[s>>0])%9|0,Et[s>>0]=(0|mt[s>>0])/9|0,St[8+(0|St[i>>2])>>2]=(0|mt[s>>0])/5|0,St[4+(0|St[i>>2])>>2]=(0|mt[s>>0])%5|0,(St[n>>2]=0)|St[n>>2])),l),0|f}(f,0|St[a>>2],0|St[u>>2]),St[l>>2]=n,pt=(d=0|St[l>>2]?(St[i>>2]=St[l>>2],0|St[i>>2]):(l=0|function(e,r,t){e|=0,r|=0,t|=0;var n=0,i=0,o=0,a=0,u=0,s=0,f=0,l=0;(0|(pt=(n=pt)+32|0))>=(0|bt)&&yt(32);i=n+16|0,a=n+8|0,u=n+4|0,St[(o=(s=n)+12|0)>>2]=e,St[a>>2]=r,St[u>>2]=t,St[s>>2]=1846+(768<<(0|St[St[a>>2]>>2])+(0|St[4+(0|St[a>>2])>>2])),0!=(0|St[16+(0|St[o>>2])>>2])&&(0|St[s>>2])==(0|St[84+(0|St[o>>2])>>2])||(f=3);if(3==(0|f)&&(Oe(0|St[o>>2],0|St[u>>2]),f=0|sr[3&St[St[u>>2]>>2]](0|St[u>>2],St[s>>2]<<1),St[16+(0|St[o>>2])>>2]=f,St[84+(0|St[o>>2])>>2]=St[s>>2],0==(0|St[16+(0|St[o>>2])>>2])))return St[i>>2]=2,l=0|St[i>>2],pt=n,0|l;return St[i>>2]=0,l=0|St[i>>2],pt=n,0|l}(0|St[o>>2],f,0|St[s>>2]),St[c>>2]=l,0|St[c>>2]?(St[i>>2]=St[c>>2],0|St[i>>2]):(c=0|St[o>>2],St[c>>2]=St[f>>2],St[c+4>>2]=St[4+f>>2],St[c+8>>2]=St[8+f>>2],St[c+12>>2]=St[12+f>>2],(St[i>>2]=0)|St[i>>2])),E),0|d}function Re(e,r,t,n,i,o,a,u,s,f){e|=0,r|=0,t|=0,n|=0,i|=0,o|=0,a|=0,u|=0,s|=0,f|=0;var l,c,d,E,_,S,m,h,p,b,k,F,w=pt;for((0|bt)<=(0|(pt=pt+64|0))&&yt(64),c=w+52|0,d=w+48|0,_=(E=w)+44|0,S=w+40|0,m=w+36|0,h=w+32|0,p=w+28|0,b=w+16|0,k=w+12|0,F=w+8|0,St[(l=w+56|0)>>2]=e,St[c>>2]=r,St[d>>2]=t,St[(t=E)>>2]=n,St[t+4>>2]=i,St[_>>2]=o,St[S>>2]=a,St[m>>2]=u,St[h>>2]=s,St[p>>2]=f,St[b>>2]=0,St[4+b>>2]=0,f=E,E=(St[8+b>>2]=0)|function(e,r,t,n,i,o,a,u,s,f,l){e|=0,r|=0,t|=0,n|=0,i|=0,o|=0,a|=0,u|=0,s|=0,f|=0,l|=0;var c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0,R=0,g=0,T=0,N=0,D=0,P=0,C=0,I=0,L=0,x=0,B=0,H=0,U=0,z=0,Y=0,V=0,K=0,W=0,j=0,X=0,G=0,q=0;(0|(pt=(c=pt)+192|0))>=(0|bt)&&yt(192);if(d=c+180|0,_=c+172|0,S=c+168|0,m=c+40|0,h=c+164|0,p=c+160|0,b=c+156|0,k=c+152|0,F=c+148|0,w=c+144|0,y=c+140|0,v=c+128|0,M=c+124|0,O=c+120|0,A=c+116|0,R=c+112|0,g=c+108|0,T=c+32|0,N=c+24|0,D=c+104|0,P=c+100|0,C=c+88|0,I=c+16|0,L=c+84|0,x=c+80|0,B=c+76|0,H=c+72|0,U=c+68|0,z=c+8|0,V=(Y=c)+64|0,K=c+60|0,W=c+56|0,j=c+52|0,X=c+48|0,St[(E=c+176|0)>>2]=e,St[_>>2]=r,St[S>>2]=t,St[(t=m)>>2]=n,St[t+4>>2]=i,St[h>>2]=o,St[p>>2]=a,St[b>>2]=u,St[k>>2]=s,St[F>>2]=f,St[w>>2]=l,St[v>>2]=0,St[4+v>>2]=0,St[8+v>>2]=0,St[M>>2]=0,St[O>>2]=0,l=0|function(e){e|=0;var r=0,t=0,n=0,i=0,o=0,a=0,u=0;(0|(pt=(r=pt)+16|0))>=(0|bt)&&yt(16);if(t=r+8|0,St[(n=(i=r)+4|0)>>2]=e,1<=(0|St[16+(0|St[n>>2])>>2])>>>0&&(0|St[16+(0|St[n>>2])>>2])>>>0<=4){if(!(0|De(0|St[St[n>>2]>>2])))return St[t>>2]=4,o=0|St[t>>2],pt=r,0|o;if(e=0|St[n>>2],1==(0|St[16+(0|St[n>>2])>>2]))return pt=(o=(1==(0|St[e+24>>2])&&0==(0|St[St[8+(0|St[n>>2])>>2]>>2])&&0==(0|St[20+(0|St[n>>2])>>2])?St[t>>2]=0:St[t>>2]=4,0|St[t>>2]),r),0|o;if(a=0|St[n>>2],2==(0|St[e+16>>2])){if(St[i>>2]=24+(0|St[a>>2]),e=8+(0|St[i>>2])|0,!(0<(u=0|St[e+4>>2])>>>0|0==(0|u)&4294967295<(0|St[e>>2])>>>0||1!=(0|St[St[i>>2]>>2])||1!=(0|St[4+(0|St[i>>2])>>2])||1!=(0|St[24+(0|St[n>>2])>>2])||0!=(0|St[St[8+(0|St[n>>2])>>2]>>2])||1!=(0|St[20+(0|St[n>>2])>>2])||1!=(0|St[St[4+(0|St[n>>2])>>2]>>2]))&&0==(0|St[4+(0|St[4+(0|St[n>>2])>>2])>>2]))switch(0|St[8+(0|St[i>>2])>>2]){case 50529537:case 50528515:return St[t>>2]=0,o=0|St[t>>2],pt=r,0|o;default:return St[t>>2]=4,o=0|St[t>>2],pt=r,0|o}return St[t>>2]=4,o=0|St[t>>2],pt=r,0|o}if(4!=(0|St[a+16>>2]))return St[t>>2]=4,o=0|St[t>>2],pt=r,0|o;if(0|De(24+(0|St[St[n>>2]>>2])|0)&&0|De(48+(0|St[St[n>>2]>>2])|0)&&(a=72+(0|St[St[n>>2]>>2])+8|0,50528539==(0|St[a>>2])&0==(0|St[a+4>>2]))&&4==(0|St[72+(0|St[St[n>>2]>>2])>>2])&&1==(0|St[72+(0|St[St[n>>2]>>2])+4>>2])){do{if(4==(0|St[24+(0|St[n>>2])>>2])&&2==(0|St[St[8+(0|St[n>>2])>>2]>>2])&&6==(0|St[4+(0|St[8+(0|St[n>>2])>>2])>>2])&&1==(0|St[8+(0|St[8+(0|St[n>>2])>>2])>>2])&&0==(0|St[12+(0|St[8+(0|St[n>>2])>>2])>>2])&&3==(0|St[20+(0|St[n>>2])>>2])){if(5!=(0|St[St[4+(0|St[n>>2])>>2]>>2]))break;if(0|St[4+(0|St[4+(0|St[n>>2])>>2])>>2])break;if(4!=(0|St[8+(0|St[4+(0|St[n>>2])>>2])>>2]))break;if(1!=(0|St[8+(0|St[4+(0|St[n>>2])>>2])+4>>2]))break;if(3!=(0|St[16+(0|St[4+(0|St[n>>2])>>2])>>2]))break;if(2!=(0|St[16+(0|St[4+(0|St[n>>2])>>2])+4>>2]))break;return St[t>>2]=0,o=0|St[t>>2],pt=r,0|o}}while(0);return St[t>>2]=4,o=0|St[t>>2],pt=r,0|o}return St[t>>2]=4,o=0|St[t>>2],pt=r,0|o}return St[t>>2]=4,o=0|St[t>>2],pt=r,0|o}(0|St[E>>2]),St[A>>2]=l,0|St[A>>2])return St[d>>2]=St[A>>2],G=0|St[d>>2],pt=c,0|G;St[y>>2]=0;e:for(;;){if((0|St[y>>2])>>>0>=(0|St[16+(0|St[E>>2])>>2])>>>0){q=55;break}St[R>>2]=(0|St[St[E>>2]>>2])+(24*(0|St[y>>2])|0);r:do{if(0|ge(0|St[8+(0|St[R>>2])>>2])){St[g>>2]=0,St[D>>2]=St[h>>2],St[P>>2]=St[p>>2];do{if(4==(0|St[16+(0|St[E>>2])>>2])){if(St[C>>2]=St[2],St[4+C>>2]=St[3],St[8+C>>2]=St[4],A=(0|St[12+(0|St[E>>2])>>2])+(St[y>>2]<<3)|0,l=0|St[A+4>>2],St[(f=I)>>2]=St[A>>2],St[f+4>>2]=l,St[g>>2]=St[C+(St[y>>2]<<2)>>2],(0|St[y>>2])>>>0<2){if(St[P>>2]=St[I>>2],0!=(0|St[(l=I)+4>>2])||(0|St[P>>2])!=(0|St[l>>2])){q=9;break e}if(l=0|sr[3&St[St[b>>2]>>2]](0|St[b>>2],0|St[P>>2]),St[L>>2]=l,0==(0|St[L>>2])&0!=(0|St[P>>2])){q=11;break e}l=0|St[L>>2],St[(0|St[k>>2])+(1-(0|St[y>>2])<<2)>>2]=l,St[D>>2]=l,St[v+(1-(0|St[y>>2])<<2)>>2]=St[P>>2];break}if(2!=(0|St[y>>2])){q=17;break e}if(0<(f=0|St[(l=I)+4>>2])>>>0|(0==(0|f)?(0|St[l>>2])>>>0>(0|St[p>>2])>>>0:0)){q=15;break e}l=(0|St[h>>2])+((0|St[p>>2])-(0|St[I>>2]))|0,St[D>>2]=l,St[O>>2]=l,l=0|St[I>>2],St[P>>2]=l,St[M>>2]=l;break}}while(0);if(l=0|Te(0|St[_>>2],0|St[g>>2]),St[(f=T)>>2]=l,St[f+4>>2]=Ft,f=(0|St[_>>2])+(St[g>>2]<<3)|0,l=0|St[f+4>>2],St[(A=N)>>2]=St[f>>2],St[A+4>>2]=l,l=0|St[S>>2],f=T,s=0|Dt(0|St[(A=m)>>2],0|St[A+4>>2],0|St[f>>2],0|St[f+4>>2]),f=0|he(l,s,Ft),St[x>>2]=f,0|St[x>>2]){q=19;break e}if(f=8+(0|St[R>>2])|0,0==(0|St[f>>2])&0==(0|St[f+4>>2])){if(0|St[(f=N)+4>>2]||(0|St[f>>2])!=(0|St[P>>2])){q=22;break e}if(s=0|Ne(0|St[(f=N)>>2],0|St[f+4>>2],0|St[S>>2],0|St[D>>2],0|St[F>>2],0|St[w>>2]),St[B>>2]=s,0|St[B>>2]){q=24;break e}break}if(s=8+(0|St[R>>2])|0,f=0|St[R>>2],196865==(0|St[s>>2])&0==(0|St[s+4>>2])){if(l=0|function(e,r,t,n,i,o,a,u,s){e|=0,r|=0,t|=0,n|=0,i|=0,o|=0,a|=0,u|=0,s|=0;var f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0,R=0;(0|(pt=(f=pt)+192|0))>=(0|bt)&&yt(192);if(l=f+180|0,E=(d=f)+172|0,_=f+168|0,S=f+164|0,m=f+160|0,h=f+156|0,p=f+152|0,b=f+40|0,k=f+32|0,F=f+28|0,w=f+24|0,y=f+20|0,v=f+16|0,M=f+12|0,O=f+8|0,St[(c=f+176|0)>>2]=e,St[(e=d)>>2]=r,St[e+4>>2]=t,St[E>>2]=n,St[_>>2]=i,St[S>>2]=o,St[m>>2]=a,St[h>>2]=u,St[p>>2]=s,St[k>>2]=0,St[20+b>>2]=0,St[16+b>>2]=0,s=0|Ae(b,0|St[16+(0|St[c>>2])>>2],0|St[16+(0|St[c>>2])+4>>2],0|St[m>>2]),St[F>>2]=s,0|St[F>>2])return St[l>>2]=St[F>>2],A=0|St[l>>2],pt=f,0|A;St[20+b>>2]=St[_>>2],St[40+b>>2]=St[S>>2],ke(b),St[p>>2]=(0|St[p>>2])+(0|St[S>>2]);do{if(St[w>>2]=0,St[y>>2]=262144,(F=0|St[(_=d)+4>>2])>>>0<0|(0==(0|F)?(0|St[y>>2])>>>0>(0|St[_>>2])>>>0:0)&&(St[y>>2]=St[d>>2]),_=0|nr[15&St[St[E>>2]>>2]](0|St[E>>2],w,y),St[k>>2]=_,0|St[k>>2])break;if(St[v>>2]=St[y>>2],St[M>>2]=St[36+b>>2],_=0|Fe(b,0|St[S>>2],0|St[w>>2],v,1,O),St[k>>2]=_,St[y>>2]=(0|St[y>>2])-(0|St[v>>2]),F=0|Nt(0|St[(_=d)>>2],0|St[_+4>>2],0|St[v>>2],0),St[(_=d)>>2]=F,St[_+4>>2]=Ft,Q(2,(0|St[p>>2])-(0|St[S>>2])+(0|St[M>>2])|0,0|St[h>>2]),0|St[k>>2])break;if((0|St[36+b>>2])==(0|St[40+b>>2])){R=11;break}if(0==(0|St[v>>2])&&(0|St[M>>2])==(0|St[36+b>>2])){R=11;break}}while(_=0|sr[3&St[4+(0|St[E>>2])>>2]](0|St[E>>2],0|St[v>>2]),St[k>>2]=_,!(0|St[k>>2]));do{if(11==(0|R)){if(!(0|St[y>>2]||(0|St[40+b>>2])!=(0|St[S>>2]))&&!(1!=(0|St[O>>2])&4!=(0|St[O>>2])))break;St[k>>2]=1}}while(0);return Oe(b,0|St[m>>2]),St[l>>2]=St[k>>2],A=0|St[l>>2],pt=f,0|A}(f,0|St[(s=N)>>2],0|St[s+4>>2],0|St[S>>2],0|St[D>>2],0|St[P>>2],0|St[b>>2],0|St[F>>2],0|St[w>>2]),St[H>>2]=l,0|St[H>>2]){q=27;break e}break}if(!(33==(0|St[(l=f+8|0)>>2])&0==(0|St[l+4>>2]))){q=31;break e}if(l=N,f=0|function(e,r,t,n,i,o,a,u,s){e|=0,r|=0,t|=0,n|=0,i|=0,o|=0,a|=0,u|=0,s|=0;var f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0,R=0;(0|(pt=(f=pt)+208|0))>=(0|bt)&&yt(208);if(l=f+204|0,E=(d=f)+196|0,_=f+192|0,S=f+188|0,m=f+184|0,h=f+180|0,p=f+176|0,b=f+36|0,k=f+32|0,F=f+28|0,w=f+24|0,y=f+20|0,v=f+16|0,M=f+12|0,O=f+8|0,St[(c=f+200|0)>>2]=e,St[(e=d)>>2]=r,St[e+4>>2]=t,St[E>>2]=n,St[_>>2]=i,St[S>>2]=o,St[m>>2]=a,St[h>>2]=u,St[p>>2]=s,St[k>>2]=0,St[20+b>>2]=0,St[16+b>>2]=0,1!=(0|St[16+(0|St[c>>2])+4>>2]))return St[l>>2]=1,A=0|St[l>>2],pt=f,0|A;if(s=0|function(e,r,t){e|=0,r|=0,t|=0;var n=0,i=0,o=0,a=0,u=0,s=0,f=0,l=0;(0|(pt=(n=pt)+32|0))>=(0|bt)&&yt(32);return i=n+12|0,a=n+21|0,u=n+4|0,s=n+16|0,St[(o=(f=n)+8|0)>>2]=e,Et[a>>0]=r,St[u>>2]=t,t=0|function(e,r){e|=0,r|=0;var t=0,n=0,i=0,o=0,a=0,u=0,s=0;(0|(pt=(t=pt)+16|0))>=(0|bt)&&yt(16);if(n=t+8|0,o=t+4|0,Et[(i=(a=t)+12|0)>>0]=e,St[o>>2]=r,40<(0|mt[i>>0]))return St[n>>2]=4,u=0|St[n>>2],pt=t,0|u;s=40==(0|mt[i>>0])?-1:(2|1&(0|mt[i>>0]))<<11+((0|mt[i>>0])/2|0);return St[a>>2]=s,Et[St[o>>2]>>0]=4,Et[1+(0|St[o>>2])>>0]=St[a>>2],Et[2+(0|St[o>>2])>>0]=(0|St[a>>2])>>>8,Et[3+(0|St[o>>2])>>0]=(0|St[a>>2])>>>16,Et[4+(0|St[o>>2])>>0]=(0|St[a>>2])>>>24,St[n>>2]=0,u=0|St[n>>2],pt=t,0|u}(0|Et[a>>0],s),St[f>>2]=t,pt=(l=(0|St[f>>2]?St[i>>2]=St[f>>2]:(f=0|Ae(0|St[o>>2],s,5,0|St[u>>2]),St[i>>2]=f),0|St[i>>2]),n),0|l}(b,0|Et[St[16+(0|St[c>>2])>>2]>>0],0|St[m>>2]),St[F>>2]=s,0|St[F>>2])return St[l>>2]=St[F>>2],A=0|St[l>>2],pt=f,0|A;St[20+b>>2]=St[_>>2],St[40+b>>2]=St[S>>2],function(e){e|=0;var r=0,t=0;(0|(pt=(r=pt)+16|0))>=(0|bt)&&yt(16),St[(t=r)>>2]=e,St[120+(0|St[t>>2])>>2]=0,St[128+(0|St[t>>2])>>2]=1,St[132+(0|St[t>>2])>>2]=1,St[136+(0|St[t>>2])>>2]=1,ke(0|St[t>>2]),pt=r}(b),St[p>>2]=(0|St[p>>2])+(0|St[S>>2]);do{if(St[w>>2]=0,St[y>>2]=262144,(F=0|St[(_=d)+4>>2])>>>0<0|(0==(0|F)?(0|St[y>>2])>>>0>(0|St[_>>2])>>>0:0)&&(St[y>>2]=St[d>>2]),_=0|nr[15&St[St[E>>2]>>2]](0|St[E>>2],w,y),St[k>>2]=_,0|St[k>>2])break;if(St[v>>2]=St[y>>2],St[M>>2]=St[36+b>>2],_=0|function(e,r,t,n,i,o){e|=0,r|=0,t|=0,n|=0,i|=0,o|=0;var a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0;(0|(pt=(a=pt)+80|0))>=(0|bt)&&yt(80);u=a+72|0,f=a+64|0,l=a+60|0,c=a+56|0,d=a+52|0,E=a+48|0,_=a+44|0,S=a+40|0,m=a+36|0,h=a+32|0,p=a+28|0,b=a+24|0,k=a+20|0,F=a+16|0,w=a+12|0,y=a+8|0,v=a+4|0,St[(s=(M=a)+68|0)>>2]=e,St[f>>2]=r,St[l>>2]=t,St[c>>2]=n,St[d>>2]=i,St[E>>2]=o,St[_>>2]=St[St[c>>2]>>2],St[St[c>>2]>>2]=0,St[St[E>>2]>>2]=0;for(;;){if(8==(0|St[120+(0|St[s>>2])>>2])){O=49;break}if(St[S>>2]=St[36+(0|St[s>>2])>>2],9==(0|St[120+(0|St[s>>2])>>2])){O=4;break}if(0==(0|St[d>>2])&&(0|St[S>>2])==(0|St[f>>2])){O=6;break}if(6==(0|St[120+(0|St[s>>2])>>2])||7==(0|St[120+(0|St[s>>2])>>2]))if(St[m>>2]=(0|St[f>>2])-(0|St[S>>2]),St[h>>2]=(0|St[_>>2])-(0|St[St[c>>2]>>2]),((St[p>>2]=0)|St[116+(0|St[s>>2])>>2])>>>0<=(0|St[m>>2])>>>0&&(St[m>>2]=St[116+(0|St[s>>2])>>2],St[p>>2]=1),128&(0|mt[124+(0|St[s>>2])>>0])){if(6==(0|St[120+(0|St[s>>2])>>2])){if(St[w>>2]=(0|mt[124+(0|St[s>>2])>>0])>>5&3,St[y>>2]=3==(0|St[w>>2])&1,St[v>>2]=0<(0|St[w>>2])&1,0==(0|St[y>>2])&&0|St[128+(0|St[s>>2])>>2]){O=33;break}if(0==(0|St[v>>2])&&0|St[132+(0|St[s>>2])>>2]){O=33;break}be(0|St[s>>2],0|St[y>>2],0|St[v>>2]),St[128+(0|St[s>>2])>>2]=0,St[132+(0|St[s>>2])>>2]=0,St[120+(0|St[s>>2])>>2]=7}if((0|St[h>>2])>>>0>(0|St[112+(0|St[s>>2])>>2])>>>0&&(St[h>>2]=St[112+(0|St[s>>2])>>2]),n=0|Fe(0|St[s>>2],(0|St[S>>2])+(0|St[m>>2])|0,0|St[l>>2],h,0|St[p>>2],0|St[E>>2]),St[F>>2]=n,St[l>>2]=(0|St[l>>2])+(0|St[h>>2]),n=0|St[c>>2],St[n>>2]=(0|St[n>>2])+(0|St[h>>2]),n=112+(0|St[s>>2])|0,St[n>>2]=(0|St[n>>2])-(0|St[h>>2]),St[k>>2]=(0|St[36+(0|St[s>>2])>>2])-(0|St[S>>2]),n=116+(0|St[s>>2])|0,St[n>>2]=(0|St[n>>2])-(0|St[k>>2]),St[M>>2]=St[F>>2],0|St[M>>2]){O=38;break}if(3==(0|St[St[E>>2]>>2])){O=40;break}if(0==(0|St[h>>2])&0==(0|St[k>>2])){if(4!=(0|St[St[E>>2]>>2])){O=45;break}if(0|St[116+(0|St[s>>2])>>2]){O=45;break}if(0|St[112+(0|St[s>>2])>>2]){O=45;break}St[120+(0|St[s>>2])>>2]=0}4==(0|St[St[E>>2]>>2])&&(St[St[E>>2]>>2]=2)}else{if((0|St[St[c>>2]>>2])==(0|St[_>>2])){O=16;break}if(6==(0|St[120+(0|St[s>>2])>>2])){if(St[b>>2]=1==(0|mt[124+(0|St[s>>2])>>0])&1,n=0|St[s>>2],0|St[b>>2])St[n+132>>2]=1,St[136+(0|St[s>>2])>>2]=1;else if(0|St[n+128>>2]){O=21;break}be((St[128+(0|St[s>>2])>>2]=0)|St[s>>2],0|St[b>>2],0)}if((0|St[h>>2])>>>0>(0|St[m>>2])>>>0&&(St[h>>2]=St[m>>2]),!(0|St[h>>2])){O=26;break}!function(e,r,t){e|=0,r|=0,t|=0;var n=0,i=0,o=0,a=0;(0|(pt=(n=pt)+16|0))>=(0|bt)&&yt(16),o=n+4|0,St[(i=(a=n)+8|0)>>2]=e,St[o>>2]=r,St[a>>2]=t,Je((0|St[20+(0|St[i>>2])>>2])+(0|St[36+(0|St[i>>2])>>2])|0,0|St[o>>2],0|St[a>>2]),o=36+(0|St[i>>2])|0,St[o>>2]=(0|St[o>>2])+(0|St[a>>2]),0==(0|St[48+(0|St[i>>2])>>2])&&((0|St[12+(0|St[i>>2])>>2])-(0|St[44+(0|St[i>>2])>>2])|0)>>>0<=(0|St[a>>2])>>>0&&(St[48+(0|St[i>>2])>>2]=St[12+(0|St[i>>2])>>2]),o=44+(0|St[i>>2])|0,St[o>>2]=(0|St[o>>2])+(0|St[a>>2]),pt=n}(0|St[s>>2],0|St[l>>2],0|St[h>>2]),St[l>>2]=(0|St[l>>2])+(0|St[h>>2]),n=0|St[c>>2],St[n>>2]=(0|St[n>>2])+(0|St[h>>2]),n=116+(0|St[s>>2])|0,St[n>>2]=(0|St[n>>2])-(0|St[h>>2]),St[120+(0|St[s>>2])>>2]=0==(0|St[116+(0|St[s>>2])>>2])?0:7}else{if((0|St[St[c>>2]>>2])==(0|St[_>>2])){O=10;break}o=0|St[c>>2],St[o>>2]=1+(0|St[o>>2]),o=0|St[s>>2],i=0|St[l>>2],St[l>>2]=i+1,n=0|function(e,r){e|=0,r|=0;var t=0,n=0,i=0,o=0,a=0,u=0,s=0,f=0;(0|(pt=(t=pt)+32|0))>=(0|bt)&&yt(32);switch(n=t+12|0,o=t+16|0,a=t+4|0,St[(i=(u=t)+8|0)>>2]=e,Et[o>>0]=r,0|St[120+(0|St[i>>2])>>2]){case 0:if(Et[124+(0|St[i>>2])>>0]=0|Et[o>>0],!(0|mt[124+(0|St[i>>2])>>0]))return St[n>>2]=8,s=0|St[n>>2],pt=t,0|s;r=0|mt[124+(0|St[i>>2])>>0];do{if(!(128&(0|mt[124+(0|St[i>>2])>>0]))){if((127&r|0)<=2){St[116+(0|St[i>>2])>>2]=0;break}return St[n>>2]=9,s=0|St[n>>2],pt=t,0|s}}while(St[116+(0|St[i>>2])>>2]=(31&r)<<16,0);return St[n>>2]=1,s=0|St[n>>2],pt=t,0|s;case 1:return r=116+(0|St[i>>2])|0,St[r>>2]=St[r>>2]|(0|mt[o>>0])<<8,St[n>>2]=2,s=0|St[n>>2],pt=t,0|s;case 2:return r=116+(0|St[i>>2])|0,St[r>>2]=0|St[r>>2]|mt[o>>0],r=116+(0|St[i>>2])|0,St[r>>2]=1+(0|St[r>>2]),St[n>>2]=0==(128&(0|mt[124+(0|St[i>>2])>>0])|0)?6:3,s=0|St[n>>2],pt=t,0|s;case 3:return St[112+(0|St[i>>2])>>2]=(0|mt[o>>0])<<8,St[n>>2]=4,s=0|St[n>>2],pt=t,0|s;case 4:return r=112+(0|St[i>>2])|0,St[r>>2]=0|St[r>>2]|mt[o>>0],r=112+(0|St[i>>2])|0,St[r>>2]=1+(0|St[r>>2]),f=2<=((0|mt[124+(0|St[i>>2])>>0])>>5&3|0)?5:0|St[136+(0|St[i>>2])>>2]?9:6,St[n>>2]=f,s=0|St[n>>2],pt=t,0|s;case 5:return pt=(s=(225<=(0|mt[o>>0])?St[n>>2]=9:(St[a>>2]=(0|mt[o>>0])%9|0,Et[o>>0]=(0|mt[o>>0])/9|0,St[8+(0|St[i>>2])>>2]=(0|mt[o>>0])/5|0,St[u>>2]=(0|mt[o>>0])%5|0,4<((0|St[a>>2])+(0|St[u>>2])|0)?St[n>>2]=9:(St[St[i>>2]>>2]=St[a>>2],St[4+(0|St[i>>2])>>2]=St[u>>2],St[136+(0|St[i>>2])>>2]=0,St[n>>2]=6)),0|St[n>>2]),t),0|s;default:return St[n>>2]=9,s=0|St[n>>2],pt=t,0|s}return 0}(o,0|Et[i>>0]),St[120+(0|St[s>>2])>>2]=n}}switch(0|O){case 4:return St[u>>2]=1,A=0|St[u>>2],pt=a,0|A;case 6:return St[St[E>>2]>>2]=2,St[u>>2]=0,A=0|St[u>>2],pt=a,0|A;case 10:case 16:return St[St[E>>2]>>2]=3,St[u>>2]=0,A=0|St[u>>2],pt=a,0|A;case 21:case 26:case 33:return St[u>>2]=1,A=0|St[u>>2],pt=a,0|A;case 38:return St[u>>2]=St[M>>2],A=0|St[u>>2],pt=a,0|A;case 40:return St[u>>2]=St[F>>2],A=0|St[u>>2],pt=a,0|A;case 45:return St[u>>2]=1,A=0|St[u>>2],pt=a,0|A;case 49:return St[St[E>>2]>>2]=1,St[u>>2]=0,A=0|St[u>>2],pt=a,0|A}return 0}(b,0|St[S>>2],0|St[w>>2],v,1,O),St[k>>2]=_,St[y>>2]=(0|St[y>>2])-(0|St[v>>2]),F=0|Nt(0|St[(_=d)>>2],0|St[_+4>>2],0|St[v>>2],0),St[(_=d)>>2]=F,St[_+4>>2]=Ft,Q(2,(0|St[p>>2])-(0|St[S>>2])+(0|St[M>>2])|0,0|St[h>>2]),0|St[k>>2])break;if((0|St[36+b>>2])==(0|St[40+b>>2])){R=13;break}if(0==(0|St[v>>2])&&(0|St[M>>2])==(0|St[36+b>>2])){R=13;break}}while(_=0|sr[3&St[4+(0|St[E>>2])>>2]](0|St[E>>2],0|St[v>>2]),St[k>>2]=_,!(0|St[k>>2]));13==(0|R)&&(0|St[y>>2]?1:(0|St[40+b>>2])!=(0|St[S>>2]))|1!=(0|St[O>>2])&&(St[k>>2]=1);return Oe(b,0|St[m>>2]),St[l>>2]=St[k>>2],A=0|St[l>>2],pt=f,0|A}(0|St[R>>2],0|St[l>>2],0|St[l+4>>2],0|St[S>>2],0|St[D>>2],0|St[P>>2],0|St[b>>2],0|St[F>>2],0|St[w>>2]),St[U>>2]=f,0|St[U>>2]){q=30;break e}}else{if(f=8+(0|St[R>>2])|0,!(50528539==(0|St[f>>2])&0==(0|St[f+4>>2]))){if(1!=(0|St[y>>2])){q=47;break e}switch(f=8+(0|St[R>>2])|0,l=0|St[f+4>>2],0|St[f>>2]){case 50528515:if(0|l){q=53;break e}(function(e,r,t,n,i){e|=0,r|=0,t|=0,n|=0,i|=0;var o,a,u,s,f,l,c,d,E,_,S,m,h,p,b,k,F=0,w=0,y=pt;if((0|bt)<=(0|(pt=pt+64|0))&&yt(64),o=y+52|0,u=y+44|0,s=y+40|0,f=y+36|0,l=y+32|0,c=y+28|0,d=y+24|0,E=y+20|0,_=y+16|0,S=y+12|0,m=y+57|0,h=y+8|0,p=y+4|0,b=y+56|0,St[(a=(k=y)+48|0)>>2]=e,St[u>>2]=r,St[s>>2]=t,St[f>>2]=n,St[l>>2]=i,St[c>>2]=0,St[E>>2]=7&St[St[f>>2]>>2],(0|St[u>>2])>>>0<5)return St[o>>2]=0,St[o>>2],pt=y;St[s>>2]=5+(0|St[s>>2]),St[d>>2]=-1;t:for(;;){for(St[_>>2]=(0|St[a>>2])+(0|St[c>>2]),St[S>>2]=(0|St[a>>2])+(0|St[u>>2])-4;!((0|St[_>>2])>>>0>=(0|St[S>>2])>>>0)&&232!=(254&mt[St[_>>2]>>0]|0);)St[_>>2]=1+(0|St[_>>2]);if(St[c>>2]=(0|St[_>>2])-(0|St[a>>2]),i=(0|St[_>>2])>>>0>=(0|St[S>>2])>>>0,St[d>>2]=(0|St[c>>2])-(0|St[d>>2]),F=3<(0|St[d>>2])>>>0,i)break;do{if(F)St[E>>2]=0;else if(St[E>>2]=St[E>>2]<<(0|St[d>>2])-1&7,0|St[E>>2]){if(Et[m>>0]=0|Et[(0|St[_>>2])+(4-(0|mt[360+(0|St[E>>2])>>0]))>>0],0|Et[352+(0|St[E>>2])>>0]&&0|mt[m>>0]&&255!=(0|mt[m>>0]))break;St[d>>2]=St[c>>2],St[E>>2]=St[E>>2]<<1&7|1,St[c>>2]=1+(0|St[c>>2]);continue t}}while(0);if(St[d>>2]=St[c>>2],0|mt[4+(0|St[_>>2])>>0]&&255!=(0|mt[4+(0|St[_>>2])>>0]))St[E>>2]=St[E>>2]<<1&7|1,St[c>>2]=1+(0|St[c>>2]);else{for(St[h>>2]=mt[4+(0|St[_>>2])>>0]<<24|mt[3+(0|St[_>>2])>>0]<<16|mt[2+(0|St[_>>2])>>0]<<8|mt[1+(0|St[_>>2])>>0];0|St[l>>2]?St[p>>2]=(0|St[s>>2])+(0|St[c>>2])+(0|St[h>>2]):St[p>>2]=(0|St[h>>2])-((0|St[s>>2])+(0|St[c>>2])),0|St[E>>2]&&(St[k>>2]=mt[360+(0|St[E>>2])>>0]<<3,Et[b>>0]=(0|St[p>>2])>>>(24-(0|St[k>>2])|0),!(0|mt[b>>0]&&255!=(0|mt[b>>0])));)St[h>>2]=St[p>>2]^(1<<32-(0|St[k>>2]))-1;Et[4+(0|St[_>>2])>>0]=~(((0|St[p>>2])>>>24&1)-1),Et[3+(0|St[_>>2])>>0]=(0|St[p>>2])>>>16,Et[2+(0|St[_>>2])>>0]=(0|St[p>>2])>>>8,Et[1+(0|St[_>>2])>>0]=St[p>>2],St[c>>2]=5+(0|St[c>>2])}}w=F?0:St[E>>2]<<(0|St[d>>2])-1&7,St[St[f>>2]>>2]=w,St[o>>2]=St[c>>2],St[o>>2],pt=y})((St[X>>2]=0)|St[h>>2],0|St[p>>2],0,X,0);break r;case 50529537:if(0|l){q=53;break e}!function(e,r,t,n){e|=0,r|=0,t|=0,n|=0;var i,o,a,u,s,f,l,c,d=0,E=pt;if((0|bt)<=(0|(pt=pt+32|0))&&yt(32),i=E+28|0,a=E+20|0,u=E+16|0,s=E+12|0,f=E+8|0,l=E+4|0,St[(o=(c=E)+24|0)>>2]=e,St[a>>2]=r,St[u>>2]=t,St[s>>2]=n,(0|St[a>>2])>>>0<4)return St[i>>2]=0,St[i>>2],pt=E;for(St[a>>2]=(0|St[a>>2])-4,St[u>>2]=8+(0|St[u>>2]),St[f>>2]=0;d=0|St[f>>2],!((0|St[f>>2])>>>0>(0|St[a>>2])>>>0);)235==(0|mt[(0|St[o>>2])+(d+3)>>0])&&(St[c>>2]=(0|mt[(0|St[o>>2])+(2+(0|St[f>>2]))>>0])<<16|(0|mt[(0|St[o>>2])+(1+(0|St[f>>2]))>>0])<<8|0|mt[(0|St[o>>2])+(0|St[f>>2])>>0],St[c>>2]=St[c>>2]<<2,0|St[s>>2]?St[l>>2]=(0|St[u>>2])+(0|St[f>>2])+(0|St[c>>2]):St[l>>2]=(0|St[c>>2])-((0|St[u>>2])+(0|St[f>>2])),St[l>>2]=(0|St[l>>2])>>>2,Et[(0|St[o>>2])+(2+(0|St[f>>2]))>>0]=(0|St[l>>2])>>>16,Et[(0|St[o>>2])+(1+(0|St[f>>2]))>>0]=(0|St[l>>2])>>>8,Et[(0|St[o>>2])+(0|St[f>>2])>>0]=St[l>>2]),St[f>>2]=4+(0|St[f>>2]);St[i>>2]=d,St[i>>2],pt=E}(0|St[h>>2],0|St[p>>2],0,0);break r;default:q=53;break e}}if(l=0|Te(0|St[_>>2],1),St[(f=z)>>2]=l,St[f+4>>2]=Ft,f=8+(0|St[_>>2])|0,l=0|St[f+4>>2],St[(s=Y)>>2]=St[f>>2],St[s+4>>2]=l,3!=(0|St[y>>2])){q=34;break e}if(l=0|St[S>>2],f=z,A=0|Dt(0|St[(s=m)>>2],0|St[s+4>>2],0|St[f>>2],0|St[f+4>>2]),f=0|he(l,A,Ft),St[K>>2]=f,0|St[K>>2]){q=36;break e}if(St[8+v>>2]=St[Y>>2],0!=(0|St[(f=Y)+4>>2])||(0|St[8+v>>2])!=(0|St[f>>2])){q=38;break e}if(f=0|sr[3&St[St[b>>2]>>2]](0|St[b>>2],0|St[8+v>>2]),St[8+(0|St[k>>2])>>2]=f,0==(0|St[8+(0|St[k>>2])>>2])&&0|St[8+v>>2]){q=41;break e}if(A=0|Ne(0|St[(f=Y)>>2],0|St[f+4>>2],0|St[S>>2],0|St[8+(0|St[k>>2])>>2],0|St[F>>2],0|St[w>>2]),St[V>>2]=A,St[W>>2]=St[V>>2],0|St[W>>2]){q=43;break e}if(A=0|function(e,r,t,n,i,o,a,u,s,f){e|=0,r|=0,t|=0,n|=0,i|=0,o|=0,a|=0,u|=0,s|=0,f|=0;var l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0,R=0,g=0,T=0,N=0,D=0,P=0,C=0,I=0,L=0,x=0,B=0,H=0;(0|(pt=(l=pt)+624|0))>=(0|bt)&&yt(624);c=l+92|0,E=l+84|0,_=l+80|0,S=l+76|0,m=l+72|0,h=l+68|0,p=l+64|0,b=l+60|0,k=l+56|0,F=l+52|0,w=l+96|0,y=l+48|0,v=l+44|0,M=l+40|0,O=l+36|0,A=l+32|0,R=l+28|0,g=l+613|0,T=l+24|0,N=l+612|0,D=l+20|0,P=l+16|0,C=l+12|0,I=l+8|0,L=l+4|0,St[(d=(x=l)+88|0)>>2]=e,St[E>>2]=r,St[_>>2]=t,St[S>>2]=n,St[m>>2]=i,St[h>>2]=o,St[p>>2]=a,St[b>>2]=u,St[k>>2]=s,St[F>>2]=f,St[y>>2]=0,St[v>>2]=0,St[R>>2]=0,Et[g>>0]=0,St[T>>2]=0;for(;!(258<=(0|St[T>>2])>>>0);)_t[w+(St[T>>2]<<1)>>1]=1024,St[T>>2]=1+(0|St[T>>2]);St[M>>2]=St[p>>2],St[O>>2]=(0|St[M>>2])+(0|St[b>>2]),St[A>>2]=-1,St[T>>2]=0;for(;!(5<=(0|St[T>>2])>>>0);){if((0|St[M>>2])==(0|St[O>>2])){B=7;break}b=St[R>>2]<<8,p=0|St[M>>2],St[M>>2]=p+1,St[R>>2]=0|b|mt[p>>0],St[T>>2]=1+(0|St[T>>2])}if(7==(0|B))return St[c>>2]=1,H=0|St[c>>2],pt=l,0|H;if(!(0|St[F>>2]))return St[c>>2]=0,H=0|St[c>>2],pt=l,0|H;for(;;){for(St[I>>2]=(0|St[E>>2])-(0|St[y>>2]),((0|St[F>>2])-(0|St[v>>2])|0)>>>0<(0|St[I>>2])>>>0&&(St[I>>2]=(0|St[F>>2])-(0|St[v>>2]));0|St[I>>2]&&(Et[N>>0]=0|Et[(0|St[d>>2])+(0|St[y>>2])>>0],T=0|Et[N>>0],p=0|St[v>>2],St[v>>2]=p+1,Et[(0|St[k>>2])+p>>0]=T,232!=(254&(0|mt[N>>0])|0))&&(15!=(0|mt[g>>0])||128!=(240&(0|mt[N>>0])|0));)St[y>>2]=1+(0|St[y>>2]),Et[g>>0]=0|Et[N>>0],St[I>>2]=(0|St[I>>2])-1;if(!(0|St[I>>2])){B=46;break}if((0|St[v>>2])==(0|St[F>>2])){B=46;break}T=0|St[y>>2],St[y>>2]=T+1,Et[N>>0]=0|Et[(0|St[d>>2])+T>>0];do{if(232!=(0|mt[N>>0])){if(233==(0|mt[N>>0])){St[D>>2]=512+w;break}St[D>>2]=514+w;break}}while(St[D>>2]=w+((0|mt[g>>0])<<1),0);if(St[C>>2]=re[St[D>>2]>>1],T=0|wt((0|St[A>>2])>>>11,0|St[C>>2]),St[P>>2]=T,T=0|St[P>>2],(0|St[R>>2])>>>0<(0|St[P>>2])>>>0){if(St[A>>2]=T,_t[St[D>>2]>>1]=(0|St[C>>2])+((2048-(0|St[C>>2])|0)>>>5),(0|St[A>>2])>>>0<16777216){if((0|St[M>>2])==(0|St[O>>2])){B=28;break}St[A>>2]=St[A>>2]<<8,p=St[R>>2]<<8,b=0|St[M>>2],St[M>>2]=b+1,St[R>>2]=0|p|mt[b>>0]}Et[g>>0]=0|Et[N>>0]}else{if(St[A>>2]=(0|St[A>>2])-T,St[R>>2]=(0|St[R>>2])-(0|St[P>>2]),_t[St[D>>2]>>1]=(0|St[C>>2])-((0|St[C>>2])>>>5),(0|St[A>>2])>>>0<16777216){if((0|St[M>>2])==(0|St[O>>2])){B=33;break}St[A>>2]=St[A>>2]<<8,T=St[R>>2]<<8,b=0|St[M>>2],St[M>>2]=b+1,St[R>>2]=0|T|mt[b>>0]}if(232==(0|mt[N>>0])){if(St[x>>2]=St[_>>2],(0|St[S>>2])>>>0<4){B=37;break}St[_>>2]=4+(0|St[_>>2]),St[S>>2]=(0|St[S>>2])-4}else{if(St[x>>2]=St[m>>2],(0|St[h>>2])>>>0<4){B=40;break}St[m>>2]=4+(0|St[m>>2]),St[h>>2]=(0|St[h>>2])-4}if(St[L>>2]=((0|mt[St[x>>2]>>0])<<24|(0|mt[1+(0|St[x>>2])>>0])<<16|(0|mt[2+(0|St[x>>2])>>0])<<8|0|mt[3+(0|St[x>>2])>>0])-(4+(0|St[v>>2])),b=255&St[L>>2],T=0|St[v>>2],St[v>>2]=T+1,Et[(0|St[k>>2])+T>>0]=b,(0|St[v>>2])==(0|St[F>>2])){B=46;break}if(b=(0|St[L>>2])>>>8&255,T=0|St[v>>2],St[v>>2]=T+1,Et[(0|St[k>>2])+T>>0]=b,(0|St[v>>2])==(0|St[F>>2])){B=46;break}if(b=(0|St[L>>2])>>>16&255,T=0|St[v>>2],St[v>>2]=T+1,Et[(0|St[k>>2])+T>>0]=b,(0|St[v>>2])==(0|St[F>>2])){B=46;break}b=(0|St[L>>2])>>>24&255,Et[g>>0]=b,T=0|St[v>>2],St[v>>2]=T+1,Et[(0|St[k>>2])+T>>0]=b}}{if(28==(0|B))return St[c>>2]=1,H=0|St[c>>2],pt=l,0|H;if(33==(0|B))return St[c>>2]=1,H=0|St[c>>2],pt=l,0|H;if(37==(0|B))return St[c>>2]=1,H=0|St[c>>2],pt=l,0|H;if(40==(0|B))return St[c>>2]=1,H=0|St[c>>2],pt=l,0|H;if(46==(0|B))return St[c>>2]=(0|St[v>>2])==(0|St[F>>2])?0:1,H=0|St[c>>2],pt=l,0|H}return 0}(0|St[O>>2],0|St[M>>2],0|St[St[k>>2]>>2],0|St[v>>2],0|St[4+(0|St[k>>2])>>2],0|St[4+v>>2],0|St[8+(0|St[k>>2])>>2],0|St[8+v>>2],0|St[h>>2],0|St[p>>2]),St[V>>2]=A,St[j>>2]=St[V>>2],0|St[j>>2]){q=45;break e}}}while(0);St[y>>2]=1+(0|St[y>>2])}switch(0|q){case 9:case 11:return St[d>>2]=2,G=0|St[d>>2],pt=c,0|G;case 15:return St[d>>2]=5,G=0|St[d>>2],pt=c,0|G;case 17:return St[d>>2]=4,G=0|St[d>>2],pt=c,0|G;case 19:return St[d>>2]=St[x>>2],G=0|St[d>>2],pt=c,0|G;case 22:return St[d>>2]=1,G=0|St[d>>2],pt=c,0|G;case 24:return St[d>>2]=St[B>>2],G=0|St[d>>2],pt=c,0|G;case 27:return St[d>>2]=St[H>>2],G=0|St[d>>2],pt=c,0|G;case 30:return St[d>>2]=St[U>>2],G=0|St[d>>2],pt=c,0|G;case 31:case 34:return St[d>>2]=4,G=0|St[d>>2],pt=c,0|G;case 36:return St[d>>2]=St[K>>2],G=0|St[d>>2],pt=c,0|G;case 38:case 41:return St[d>>2]=2,G=0|St[d>>2],pt=c,0|G;case 43:return St[d>>2]=St[W>>2],G=0|St[d>>2],pt=c,0|G;case 45:return St[d>>2]=St[j>>2],G=0|St[d>>2],pt=c,0|G;case 47:case 53:return St[d>>2]=4,G=0|St[d>>2],pt=c,0|G;case 55:return St[d>>2]=0,G=0|St[d>>2],pt=c,0|G}return 0}(0|St[l>>2],0|St[c>>2],0|St[d>>2],0|St[f>>2],0|St[f+4>>2],0|St[_>>2],0|St[S>>2],0|St[m>>2],b,0|St[h>>2],0|St[p>>2]),St[F>>2]=E,St[k>>2]=0;!(3<=(0|St[k>>2]));)or[3&St[4+(0|St[m>>2])>>2]](0|St[m>>2],0|St[b+(St[k>>2]<<2)>>2]),St[k>>2]=1+(0|St[k>>2]);return pt=w,0|St[F>>2]}function ge(e){e|=0;var r,t,n=0,i=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),r=i+4|0,St[(t=i)>>2]=e,e=0|St[t>>2];e:do{if(33<=(0|e)){if((0|e)<196865){if(33==(0|e)){n=2;break e}n=3;break e}if(196865==(0|e)){n=2;break e}n=3;break e}}while(n=0==(0|e)?2:3,0);return 2==(0|n)?St[r>>2]=1:3==(0|n)&&(St[r>>2]=0),pt=i,0|St[r>>2]}function Te(e,r){e|=0,r|=0;var t,n,i,o,a=0,u=pt;for((0|bt)<=(0|(pt=pt+32|0))&&yt(32),n=u+12|0,a=(i=u)+8|0,St[(t=u+16|0)>>2]=e,St[n>>2]=r,St[(r=i)>>2]=0,St[r+4>>2]=0,St[a>>2]=0;!((0|St[a>>2])>>>0>=(0|St[n>>2])>>>0);)r=(0|St[t>>2])+(St[a>>2]<<3)|0,o=0|Dt(0|St[(e=i)>>2],0|St[e+4>>2],0|St[r>>2],0|St[r+4>>2]),St[(r=i)>>2]=o,St[r+4>>2]=Ft,St[a>>2]=1+(0|St[a>>2]);return Ft=0|St[(a=i)+4>>2],pt=u,0|St[a>>2]}function Ne(e,r,t,n,i,o){e|=0,r|=0,t|=0,n|=0,i|=0,o|=0;var a,u,s,f,l,c,d,E,_,S,m=0,h=0,p=pt;for((0|bt)<=(0|(pt=pt+48|0))&&yt(48),a=p+40|0,s=(u=p)+36|0,f=p+32|0,l=p+28|0,c=p+20|0,d=p+16|0,E=p+12|0,_=p+8|0,St[(S=u)>>2]=e,St[S+4>>2]=r,St[s>>2]=t,St[f>>2]=n,St[l>>2]=i,St[p+24>>2]=o;;){if(!(0<(i=0|St[(o=u)+4>>2])>>>0|0==(0|i)&0<(0|St[o>>2])>>>0)){m=11;break}if(St[d>>2]=262144,(i=0|St[(o=u)+4>>2])>>>0<0|(0==(0|i)?(0|St[d>>2])>>>0>(0|St[o>>2])>>>0:0)&&(St[d>>2]=St[u>>2]),o=0|nr[15&St[St[s>>2]>>2]](0|St[s>>2],c,d),St[E>>2]=o,0|St[E>>2]){m=6;break}if(!(0|St[d>>2])){m=8;break}if(Je(0|St[f>>2],0|St[c>>2],0|St[d>>2]),St[f>>2]=(0|St[f>>2])+(0|St[d>>2]),i=0|Nt(0|St[(o=u)>>2],0|St[o+4>>2],0|St[d>>2],0),St[(o=u)>>2]=i,St[o+4>>2]=Ft,Q(2,0|St[d>>2],0|St[l>>2]),o=0|sr[3&St[4+(0|St[s>>2])>>2]](0|St[s>>2],0|St[d>>2]),St[_>>2]=o,0|St[_>>2]){m=10;break}}return 6==(0|m)?(St[a>>2]=St[E>>2],h=0|St[a>>2],pt=p,0|h):8==(0|m)?(St[a>>2]=6,h=0|St[a>>2],pt=p,0|h):10==(0|m)?(St[a>>2]=St[_>>2],h=0|St[a>>2],pt=p,0|h):11==(0|m)?(h=(St[a>>2]=0)|St[a>>2],pt=p,0|h):0}function De(e){e|=0;var r,t,n=0,i=pt;return(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(r=i)>>2]=e,1!=(0|St[St[r>>2]>>2])||1!=(0|St[4+(0|St[r>>2])>>2])?(pt=i,(n=0)|1&n):(e=8+(0|St[r>>2])|0,(t=0|St[e+4>>2])>>>0<0|0==(0|t)&(0|St[e>>2])>>>0<=4294967295?(n=0!=(0|ge(0|St[8+(0|St[r>>2])>>2])),pt=i,0|1&n):(pt=i,(n=0)|1&n))}function Pe(e,r){e|=0,r|=0;var t,n,i=pt;return(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(t=(n=i)+4|0)>>2]=e,St[n>>2]=r,r=~(0|ur[1&St[2761]](-1,0|St[t>>2],0|St[n>>2],2852)),pt=i,0|r}function Ce(e){e|=0;var r,t=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(r=t)>>2]=e,St[St[r>>2]>>2]=0,St[4+(0|St[r>>2])>>2]=0,pt=t}function Ie(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u=0,s=pt;return(0|bt)<=(0|(pt=pt+16|0))&&yt(16),n=s+12|0,o=s+4|0,St[(i=(a=s)+8|0)>>2]=e,St[o>>2]=r,St[a>>2]=t,pt=(u=(St[4+(0|St[i>>2])>>2]=0)|St[o>>2]?(t=0|sr[3&St[St[a>>2]>>2]](0|St[a>>2],0|St[o>>2]),St[St[i>>2]>>2]=t,0|St[St[i>>2]>>2]?(St[4+(0|St[i>>2])>>2]=St[o>>2],St[n>>2]=1,0|St[n>>2]):(St[n>>2]=0)|St[n>>2]):(St[St[i>>2]>>2]=0,St[n>>2]=1,0|St[n>>2]),s),0|u}function Le(e,r){e|=0,r|=0;var t,n,i=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(t=(n=i)+4|0)>>2]=e,St[n>>2]=r,or[3&St[4+(0|St[n>>2])>>2]](0|St[n>>2],0|St[St[t>>2]>>2]),St[St[t>>2]>>2]=0,St[4+(0|St[t>>2])>>2]=0,pt=i}function xe(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u,s,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=pt;for((0|bt)<=(0|(pt=pt+48|0))&&yt(48),n=F+16|0,f=(i=F)+32|0,l=0|St[(o=e+28|0)>>2],St[f>>2]=l,c=(0|St[(a=e+20|0)>>2])-l|0,St[f+4>>2]=c,St[f+8>>2]=r,r=e+60|0,l=e+44|0,E=c+(St[f+12>>(d=2)]=t)|0,c=f;;){if((0|E)==(0|(_=0|St[2762]?(g(1,0|e),St[i>>2]=St[r>>2],St[i+4>>2]=c,St[i+8>>2]=d,f=0|Be(0|A(146,0|i)),v(0),f):(St[n>>2]=St[r>>2],St[4+n>>2]=c,St[8+n>>2]=d,0|Be(0|A(146,0|n)))))){S=6;break}if((0|_)<0){S=8;break}f=E-_|0,b=_>>>0<=(u=0|St[c+4>>2])>>>0?(p=(h=2==(0|d)?(St[o>>2]=(0|St[o>>2])+_,m=_,2):(m=_,d),c),u):(s=0|St[l>>2],St[o>>2]=s,St[a>>2]=s,m=_-u|0,h=d+-1|0,p=c+8|0,0|St[c+12>>2]),St[p>>2]=(0|St[p>>2])+m,St[p+4>>2]=b-m,d=h,E=f,c=p}return 6==(0|S)?(p=0|St[l>>2],St[e+16>>2]=p+(0|St[e+48>>2]),l=p,St[o>>2]=l,St[a>>2]=l,k=t):8==(0|S)&&(St[e+16>>2]=0,St[o>>2]=0,St[a>>2]=0,St[e>>2]=32|St[e>>2],k=2==(0|d)?0:t-(0|St[c+4>>2])|0),pt=F,0|k}function Be(e){var r;return 0|(4294963200<(e|=0)>>>0?(r=0|vt(),St[r>>2]=0-e,-1):e)}function vt(){return 0|(0|St[2762]?0|St[16]:11092)}function He(){0}function Ue(e,r,t,n,i){e|=0,r|=0,t|=0,n|=0,i|=0;var o,a,u,s,f,l,c,d,E,_,S,m,h,p,b,k,F,w,y,v,M,O,A,R,g,T,N=0,D=0,P=0,C=0,I=0,L=0,x=0,B=0,H=0,U=0,z=0,Y=0,V=0,K=0,W=0,j=0,X=0,G=0,q=0,Q=0,Z=0,J=0,$=0,ee=0,re=0,te=0,ne=0,ie=0,oe=0,ae=0,ue=0,se=0,fe=0,le=0,ce=0,de=0,Ee=0,_e=0,Se=0,me=0,he=0,pe=0,be=0,ke=0,Fe=0,we=0,ye=0,ve=0,Me=0,Oe=0,Ae=0,Re=0,ge=0,Te=0,Ne=0,De=0,Pe=0,Ce=0,Ie=0,Le=0,xe=0,Be=0,He=0,Ue=0,ze=0,Ye=0,Ve=0,Ke=0,We=0,je=0,Xe=0,Ge=0,qe=0,Qe=0,Ze=0,Je=0,$e=0,er=0,rr=0,tr=0,nr=0,ir=0,or=0,ar=0,ur=0,sr=0,fr=0,lr=0,cr=0,dr=0,Er=0,_r=0,Sr=0,mr=0,hr=0,pr=0,br=0,kr=0,Fr=0,wr=0,yr=0,vr=0,Mr=0,Or=0,Ar=0,Rr=0,gr=0,Tr=0,Nr=0,Dr=0,Pr=0,Cr=0,Ir=0,Lr=0,xr=0,Br=0,Hr=0,Ur=0,zr=0,Yr=0,Vr=0,Kr=0,Wr=0,jr=0,Xr=0,Gr=0,qr=0,Qr=0,Zr=0,Jr=0,$r=0,et=0,rt=0,tt=0,nt=0,it=0,ot=0,at=0,ut=0,st=0,ft=0,lt=0,ct=0,dt=pt;(0|bt)<=(0|(pt=pt+624|0))&&yt(624),a=dt+16|0,d=(f=dt)+528|0,E=0!=(0|e),S=_=40+(l=dt+536|0)|0,m=39+l|0,l=4+(c=dt+8|0)|0,p=0-(h=u=dt+588|0)|0,k=11+(s=dt+576|0)|0,F=(s=b=12+s|0)-h|0,w=-2-h|0,y=2+s|0,v=288+(o=dt+24|0)|0,O=M=9+u|0,A=8+u|0,P=D=N=0,C=r;e:for(;;){do{if(-1<(0|D)){if((2147483647-D|0)<(0|N)){r=0|vt(),St[r>>2]=75,I=-1;break}I=N+D|0;break}}while(I=D,0);if(!((r=0|Et[C>>0])<<24>>24)){L=243;break}x=C,B=r;r:for(;;){switch(B<<24>>24){case 37:U=H=x,L=9;break r;case 0:Y=z=x;break r}B=0|Et[(x=r=x+1|0)>>0]}r:do{if(9==(0|L))for(;;){if(37!=((L=0)|Et[U+1>>0])){z=H,Y=U;break r}if(r=H+1|0,37!=(0|Et[(V=U+2|0)>>0])){z=r,Y=V;break}H=r,U=V,L=9}}while(0);if(V=z-C|0,E&&0==(32&St[e>>2]|0)&&Mt(C,V,e),0|V)N=V,D=I,C=Y;else{Q=(K=((r=0|Et[(V=Y+1|0)>>0])<<24>>24)-48|0)>>>0<10?(X=(W=36==(0|Et[Y+2>>0]))?K:-1,G=W?1:P,q=0|Et[(j=W?Y+3|0:V)>>0],j):(X=-1,G=P,q=r,V),V=(q<<24>>24)-32|0;r:do{if(V>>>0<32)for(r=0,j=V,W=q,K=Q;;){if(!(1<>24)-32|r,32<=(j=((te=0|Et[(re=K+1|0)>>0])<<24>>24)-32|0)>>>0){Z=ee,J=te,$=re;break}r=ee,W=te,K=re}else Z=0,J=q,$=Q}while(0);do{if(J<<24>>24!=42)if((V=(J<<24>>24)-48|0)>>>0<10){for(K=0,W=$,r=V;K=(10*K|0)+r|0,r=((ne=0|Et[(W=W+1|0)>>0])<<24>>24)-48|0,r>>>0<10;);if((0|K)<0){ie=-1;break e}oe=K,ae=Z,ue=G,se=W,fe=ne}else oe=0,ae=Z,ue=G,se=$,fe=J;else{if((j=((V=0|Et[(r=$+1|0)>>0])<<24>>24)-48|0)>>>0<10&&36==(0|Et[$+2>>0]))St[i+(j<<2)>>2]=10,le=0|St[n+((0|Et[r>>0])-48<<3)>>2],ce=1,de=$+3|0;else{if(0|G){ie=-1;break e}if(!E){ae=Z,ue=oe=0,se=r,fe=V;break}V=3+(0|St[t>>2])&-4,j=0|St[V>>2],St[t>>2]=V+4,le=j,ce=0,de=r}oe=(r=(0|le)<0)?0-le|0:le,ae=r?8192|Z:Z,ue=ce,fe=0|Et[(se=de)>>0]}}while(0);r:do{if(fe<<24>>24==46){if((j=0|Et[(r=se+1|0)>>0])<<24>>24!=42){if(!((V=(j<<24>>24)-48|0)>>>0<10)){me=0,he=r;break}for(Ee=0,_e=r,Se=V;;){if(r=(10*Ee|0)+Se|0,10<=(Se=(0|Et[(V=_e+1|0)>>0])-48|0)>>>0){me=r,he=V;break r}Ee=r,_e=V}}if((K=(0|Et[(W=se+2|0)>>0])-48|0)>>>0<10&&36==(0|Et[se+3>>0])){St[i+(K<<2)>>2]=10,me=0|St[n+((0|Et[W>>0])-48<<3)>>2],he=se+4|0;break}if(0|ue){ie=-1;break e}he=(me=E?(K=3+(0|St[t>>2])&-4,V=0|St[K>>2],St[t>>2]=K+4,V):0,W)}else me=-1,he=se}while(0);for(W=0,V=he;;){if(57<(K=(0|Et[V>>0])-65|0)>>>0){ie=-1;break e}if(pe=V+1|0,!(((ke=255&(be=0|Et[419+(58*W|0)+K>>0]))+-1|0)>>>0<8))break;W=ke,V=pe}if(!(be<<24>>24)){ie=-1;break}K=-1<(0|X);do{if(be<<24>>24==19){if(K){ie=-1;break e}L=51}else{if(K){St[i+(X<<2)>>2]=ke,j=0|St[(r=n+(X<<3)|0)+4>>2],St[(re=f)>>2]=St[r>>2],St[re+4>>2]=j,L=51;break}if(!E){ie=0;break e}Ot(f,ke,t)}}while(0);if(51!=(0|L)||(L=0,E)){j=0!=(0|W)&3==(15&(K=0|Et[V>>0])|0)?-33&K:K,K=-65537&ae,re=0==(8192&ae|0)?ae:K;r:do{switch(0|j){case 110:switch((255&W)<<24>>24){case 0:case 1:N=0,D=St[St[f>>2]>>2]=I,P=ue,C=pe;continue e;case 2:r=0|St[f>>2],St[r>>2]=I,St[r+4>>2]=((0|I)<0)<<31>>31,N=0,D=I,P=ue,C=pe;continue e;case 3:N=0,D=_t[St[f>>2]>>1]=I,P=ue,C=pe;continue e;case 4:N=0,D=Et[St[f>>2]>>0]=I,P=ue,C=pe;continue e;case 6:N=0,D=St[St[f>>2]>>2]=I,P=ue,C=pe;continue e;case 7:r=0|St[f>>2],St[r>>2]=I,St[r+4>>2]=((0|I)<0)<<31>>31,N=0,D=I,P=ue,C=pe;continue e;default:N=0,D=I,P=ue,C=pe;continue e}break;case 112:Fe=120,we=8>>0?me:8,ye=8|re,L=63;break;case 88:case 120:Fe=j,we=me,ye=re,L=63;break;case 111:if(0==(0|(te=0|St[(r=f)>>2]))&0==(0|(ee=0|St[r+4>>2])))ve=_;else for(r=_,Me=te,te=ee;;){if(Et[(ee=r+-1|0)>>0]=7&Me|48,0==(0|(Me=0|Ct(0|Me,0|te,3)))&0==(0|(te=Ft))){ve=ee;break}r=ee}L=(Te=(ge=8&re?(Re=899,((Ae=0)|(r=S-(Oe=ve)|0))<(0|me)?me:r+1|0):(Oe=ve,Ae=0,Re=899,me),re),76);break;case 105:case 100:if(te=0|St[(r=f)>>2],(0|(Me=0|St[r+4>>2]))<0){r=0|Nt(0,0,0|te,0|Me),ee=Ft,De=1,Pe=899,Ce=St[(Ne=f)>>2]=r,Ie=St[Ne+4>>2]=ee,L=75;break r}L=(Ie=(Ce=(Pe=2048&re?(De=1,900):0==(0|(De=ee=1&re))?899:901,te),Me),75);break;case 117:Pe=899,Ce=(De=0)|St[(Me=f)>>2],Ie=0|St[Me+4>>2],L=75;break;case 99:Et[m>>0]=St[f>>2],Le=m,xe=0,Be=899,He=_,Ue=1,ze=K;break;case 109:Me=0|vt(),Ye=0|function(e){e|=0;var r=0,t=0,n=0,i=0,o=0,a=0;r=0;for(;;){if((0|mt[953+r>>0])==(0|e)){t=2;break}if(87==(0|(n=r+1|0))){i=1041,o=87,t=5;break}r=n}2==(0|t)&&(r?(i=1041,o=r,t=5):a=1041);if(5==(0|t))for(;;){for(t=0,r=i;r=(e=r)+1|0,0!=(0|Et[e>>0]););if(!(o=o+-1|0)){a=r;break}i=r,t=5}return 0|a}(0|St[Me>>2]),L=81;break;case 115:Ye=0|(Me=0|St[f>>2])?Me:909,L=81;break;case 67:St[c>>2]=St[f>>2],St[l>>2]=0,Ve=-1,Ke=St[f>>2]=c,L=85;break;case 83:Me=0|St[f>>2],L=me?(Ve=me,Ke=Me,85):(gt(e,32,oe,0,re),We=0,96);break;case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:je=+ht[f>>3],St[a>>2]=0,ht[kt>>3]=je,qe=0<=(0|St[kt+4>>2])?(Me=1&re,2048&re?(Xe=je,Ge=1,919):(Xe=je,0==(0|(Ge=Me))?917:922)):(Xe=-je,Ge=1,916),ht[kt>>3]=Xe,Me=2146435072&St[kt+4>>2];do{if(Me>>>0<2146435072|2146435072==(0|Me)&!1){if((te=0!=(je=2*(T=a,+ + +function e(r,t){r=+r;t|=0;var n=0,i=0,o=0,a=0,u=0,s=0,f=0;ht[kt>>3]=r;n=0|St[kt>>2];i=0|St[kt+4>>2];o=0|Ct(0|n,0|i,52);switch(2047&o){case 0:s=0!=r?(a=+e(0x10000000000000000*r,t),u=a,(0|St[t>>2])-64|0):(u=r,0),St[t>>2]=s,f=u;break;case 2047:f=r;break;default:St[t>>2]=(2047&o)-1022,St[kt>>2]=n,St[kt+4>>2]=-2146435073&i|1071644672,f=+ht[kt>>3]}return+f}(+Xe,T|=0))))&&(St[a>>2]=(0|St[a>>2])-1),97==(0|(ee=32|j))){Ne=0==(0|(r=32&j))?qe:qe+9|0,Qe=2|Ge,Ze=12-me|0;do{if(!(11>>0|0==(0|Ze))){for(Je=8,$e=Ze;$e=$e+-1|0,Je*=16,0!=(0|$e););if(45==(0|Et[Ne>>0])){er=-(Je+(-je-Je));break}er=je+Je-Je;break}}while(er=je,0);for(tr=(0|(rr=0|At($e=(0|(Ze=0|St[a>>2]))<0?0-Ze|0:Ze,((0|$e)<0)<<31>>31,b)))==(0|b)?(Et[k>>0]=48,k):rr,Et[tr+-1>>0]=43+(Ze>>31&2),Et[(Ze=tr+-2|0)>>0]=j+15,rr=(0|me)<1,$e=0==(8&re|0),nr=u,ir=er;;){or=~~ir,ar=nr+1|0,Et[nr>>0]=mt[883+or>>0]|r,ir=16*(ir-(0|or));do{if(1==(ar-h|0)){if($e&rr&0==ir){ur=ar;break}Et[ar>>0]=46,ur=nr+2|0}else ur=ar}while(0);if(0==ir)break;nr=ur}rr=Ze,gt(e,32,oe,r=($e=0!=(0|me)&(w+(nr=ur)|0)<(0|me)?y+me-rr|0:F-rr+nr|0)+Qe|0,re),32&St[e>>2]||Mt(Ne,Qe,e),gt(e,48,oe,r,65536^re),ar=nr-h|0,32&St[e>>2]||Mt(u,ar,e),gt(e,48,$e-(ar+(nr=s-rr|0))|0,0,0),32&St[e>>2]||Mt(Ze,nr,e),gt(e,32,oe,r,8192^re),sr=(0|r)<(0|oe)?oe:r;break}for(r=(0|me)<0?6:me,lr=te?(nr=(0|St[a>>2])-28|0,fr=268435456*je,St[a>>2]=nr):(fr=je,0|St[a>>2]),nr=(0|lr)<0?o:v,ar=nr,ir=fr;$e=~~ir>>>0,St[ar>>2]=$e,ar=ar+4|0,ir=1e9*(ir-($e>>>0)),0!=ir;);if(0<(0|lr))for(te=nr,Ze=ar,Qe=lr;;){Ne=29<(0|Qe)?29:Qe,$e=Ze+-4|0;do{if($e>>>0>>0)cr=te;else{for(rr=$e,or=0;_r=0|xt(0|(Er=0|Dt(0|(dr=0|It(0|St[rr>>2],0,0|Ne)),0|Ft,0|or,0)),0|(dr=Ft),1e9,0),St[rr>>2]=_r,or=0|Lt(0|Er,0|dr,1e9,0),rr=rr+-4|0,te>>>0<=rr>>>0;);if(!or){cr=te;break}St[(rr=te+-4|0)>>2]=or,cr=rr}}while(0);for($e=Ze;!($e>>>0<=cr>>>0||0|St[(rr=$e+-4|0)>>2]);)$e=rr;if(rr=(0|St[a>>2])-Ne|0,!(0<(0|(St[a>>2]=rr)))){Sr=cr,mr=$e,hr=rr;break}te=cr,Ze=$e,Qe=rr}else Sr=nr,mr=ar,hr=lr;if((0|hr)<0)for(Qe=1+((r+25|0)/9|0)|0,Ze=102==(0|ee),te=Sr,rr=mr,dr=hr;;){_r=9<(0|(Er=0-dr|0))?9:Er;do{if(te>>>0>>0){for(Er=(1<<_r)-1|0,R=1e9>>>_r,pr=0,br=te;g=0|St[br>>2],St[br>>2]=(g>>>_r)+pr,pr=0|wt(g&Er,R),br=br+4|0,br>>>0>>0;);if(br=0==(0|St[te>>2])?te+4|0:te,!pr){kr=br,Fr=rr;break}St[rr>>2]=pr,kr=br,Fr=rr+4|0}else kr=0==(0|St[te>>2])?te+4|0:te,Fr=rr}while(0);if(Ne=(0|Qe)<(Fr-($e=Ze?nr:kr)>>2|0)?$e+(Qe<<2)|0:Fr,dr=(0|St[a>>2])+_r|0,0<=(0|(St[a>>2]=dr))){wr=kr,yr=Ne;break}te=kr,rr=Ne}else wr=Sr,yr=mr;rr=nr;do{if(wr>>>0>>0){if(te=9*(rr-wr>>2)|0,(dr=0|St[wr>>2])>>>0<10){vr=te;break}for(Mr=te,Or=10;;){if(te=Mr+1|0,dr>>>0<(Or=10*Or|0)>>>0){vr=te;break}Mr=te}}else vr=0}while(0);if((0|(te=r-(102!=(0|ee)?vr:0)+(((_r=0!=(0|r))&(dr=103==(0|ee)))<<31>>31)|0))<((9*(yr-rr>>2)|0)-9|0)){if(te=nr+4+(((0|(Qe=te+9216|0))/9|0)-1024<<2)|0,(0|(Ze=1+((0|Qe)%9|0)|0))<9)for(Qe=Ze,Ze=10;;){if(ar=10*Ze|0,9==(0|(Qe=Qe+1|0))){Ar=ar;break}Ze=ar}else Ar=10;Qe=((Ze=0|St[te>>2])>>>0)%(Ar>>>0)|0,ee=(te+4|0)==(0|yr);do{if(ee&0==(0|Qe))Rr=te,gr=vr,Tr=wr;else{ir=0==(1&((Ze>>>0)/(Ar>>>0)|0)|0)?9007199254740992:9007199254740994,Nr=Qe>>>0<(ar=(0|Ar)/2|0)>>>0?.5:ee&(0|Qe)==(0|ar)?1:1.5;do{if(Ge){if(45!=(0|Et[qe>>0])){Dr=Nr,Pr=ir;break}Dr=-Nr,Pr=-ir}else Dr=Nr,Pr=ir}while(0);if(ar=Ze-Qe|0,St[te>>2]=ar,Pr+Dr==Pr){Rr=te,gr=vr,Tr=wr;break}if(Ne=ar+Ar|0,999999999<(St[te>>2]=Ne)>>>0)for(Ne=te,ar=wr;;){if(Cr=($e=Ne+-4|0)>>>(St[Ne>>2]=0)>>0?(St[(br=ar+-4|0)>>2]=0,br):ar,br=1+(0|St[$e>>2])|0,!(999999999<(St[$e>>2]=br)>>>0)){Ir=$e,Lr=Cr;break}Ne=$e,ar=Cr}else Ir=te,Lr=wr;if(ar=9*(rr-Lr>>2)|0,(Ne=0|St[Lr>>2])>>>0<10){Rr=Ir,gr=ar,Tr=Lr;break}for(xr=ar,Br=10;;){if(ar=xr+1|0,Ne>>>0<(Br=10*Br|0)>>>0){Rr=Ir,gr=ar,Tr=Lr;break}xr=ar}}}while(0);Hr=gr,Ur=(te=Rr+4|0)>>>0>>0?te:yr,zr=Tr}else Hr=vr,Ur=yr,zr=wr;for(te=0-Hr|0,Qe=Ur;;){if(Qe>>>0<=zr>>>0){Yr=0;break}if(0|St[(Ze=Qe+-4|0)>>2]){Yr=1;break}Qe=Ze}do{if(dr){if(Kr=(0|Hr)<(0|(Ze=(1&_r^1)+r|0))&-5<(0|Hr)?(Vr=j+-1|0,Ze+-1-Hr|0):(Vr=j+-2|0,Ze+-1|0),0|(Ze=8&re)){Wr=Vr,jr=Kr,Xr=Ze;break}do{if(Yr){if(!(Ze=0|St[Qe+-4>>2])){Gr=9;break}if((Ze>>>0)%10|0){Gr=0;break}for(qr=0,Qr=10;;){if(ee=qr+1|0,(Ze>>>0)%((Qr=10*Qr|0)>>>0)|0){Gr=ee;break}qr=ee}}else Gr=9}while(0);if(Ze=(9*(Qe-rr>>2)|0)-9|0,102==(32|Vr)){Wr=Vr,jr=(0|Kr)<(0|(ee=(0|(pr=Ze-Gr|0))<0?0:pr))?Kr:ee,Xr=0;break}Wr=Vr,jr=(0|Kr)<(0|(Ze=(0|(ee=Ze+Hr-Gr|0))<0?0:ee))?Kr:Ze,Xr=0;break}}while(Wr=j,jr=r,Xr=8&re,0);if(rr=0!=(0|(r=jr|Xr))&1,_r=102==(32|Wr))Jr=(Zr=0)<(0|Hr)?Hr:0;else{if((s-(Ze=0|At(dr=(0|Hr)<0?te:Hr,((0|dr)<0)<<31>>31,b))|0)<2)for(dr=Ze;;){if(Et[(ee=dr+-1|0)>>0]=48,!((s-ee|0)<2)){$r=ee;break}dr=ee}else $r=Ze;Et[$r+-1>>0]=43+(Hr>>31&2),Et[(dr=$r+-2|0)>>0]=Wr,Jr=s-(Zr=dr)|0}gt(e,32,oe,dr=Ge+1+jr+rr+Jr|0,re),32&St[e>>2]||Mt(qe,Ge,e),gt(e,48,oe,dr,65536^re);do{if(_r){ee=te=nr>>>0>>0?nr:zr;do{pr=0|At(0|St[ee>>2],0,M);do{if((0|ee)==(0|te)){if((0|pr)!=(0|M)){et=pr;break}Et[A>>0]=48,et=A}else{if(pr>>>0<=u>>>0){et=pr;break}for(Pt(0|u,48,pr-h|0),Ne=pr;;){if(!(u>>>0<(ar=Ne+-1|0)>>>0)){et=ar;break}Ne=ar}}}while(0)}while(32&St[e>>2]||Mt(et,O-et|0,e),(ee=ee+4|0)>>>0<=nr>>>0);do{if(0|r){if(32&St[e>>2]|0)break;Mt(951,1,e)}}while(0);if(0<(0|jr)&ee>>>0>>0)for(te=jr,pr=ee;;){if(u>>>0<(Ne=0|At(0|St[pr>>2],0,M))>>>0)for(Pt(0|u,48,Ne-h|0),ar=Ne;;){if(!(u>>>0<($e=ar+-1|0)>>>0)){rt=$e;break}ar=$e}else rt=Ne;if(32&St[e>>2]||Mt(rt,9<(0|te)?9:te,e),ar=te+-9|0,!(9<(0|te)&(pr=pr+4|0)>>>0>>0)){tt=ar;break}te=ar}else tt=jr;gt(e,48,tt+9|0,9,0)}else{if(te=Yr?Qe:zr+4|0,-1<(0|jr))for(pr=0==(0|Xr),ee=jr,ar=zr;;){nt=(0|($e=0|At(0|St[ar>>2],0,M)))==(0|M)?(Et[A>>0]=48,A):$e;do{if((0|ar)==(0|zr)){if($e=nt+1|0,32&St[e>>2]||Mt(nt,1,e),pr&(0|ee)<1){it=$e;break}if(32&St[e>>2]|0){it=$e;break}Mt(951,1,e),it=$e}else{if(nt>>>0<=u>>>0){it=nt;break}for(Pt(0|u,48,nt+p|0),$e=nt;;){if(!(u>>>0<(br=$e+-1|0)>>>0)){it=br;break}$e=br}}}while(0);if(Ne=O-it|0,32&St[e>>2]||Mt(it,(0|Ne)<(0|ee)?Ne:ee,e),!((ar=ar+4|0)>>>0>>0&-1<(0|($e=ee-Ne|0)))){ot=$e;break}ee=$e}else ot=jr;if(gt(e,48,ot+18|0,18,0),32&St[e>>2]|0)break;Mt(Zr,s-Zr|0,e)}}while(0);gt(e,32,oe,dr,8192^re),sr=(0|dr)<(0|oe)?oe:dr}else Qe=0!=(32&j|0),gt(e,32,oe,_r=(nr=(r=Xe!=Xe|!1)?0:Ge)+3|0,K),32&(32&(rr=0|St[e>>2])?rr:(Mt(qe,nr,e),0|St[e>>2]))||Mt(r?Qe?943:947:Qe?935:939,3,e),gt(e,32,oe,_r,8192^re),sr=(0|_r)<(0|oe)?oe:_r}while(0);N=sr,D=I,P=ue,C=pe;continue e;default:Le=C,xe=0,Be=899,He=_,Ue=me,ze=re}}while(0);r:do{if(63==(0|L)){if(W=(L=0)|St[(j=f)>>2],V=0|St[j+4>>2],j=32&Fe,0==(0|W)&0==(0|V))at=_,st=ut=0;else{for(Me=_,_r=W,W=V;Et[(Me=Me+-1|0)>>0]=mt[883+(15&_r)>>0]|j,_r=0|Ct(0|_r,0|W,4),W=Ft,!(0==(0|_r)&0==(0|W)););at=Me,ut=0|St[(W=f)>>2],st=0|St[W+4>>2]}Oe=at,Ae=(W=0==(8&ye|0)|0==(0|ut)&0==(0|st))?0:2,Re=W?899:899+(Fe>>4)|0,ge=we,Te=ye,L=76}else if(75==(0|L))Oe=(L=0)|At(Ce,Ie,_),Ae=De,Re=Pe,ge=me,Te=re,L=76;else if(81==(0|L))Be=899,He=(_r=(xe=L=0)==(0|(W=0|Rt(Le=Ye,0,me))))?Ye+me|0:W,Ue=_r?me:W-Ye|0,ze=K;else if(85==(0|L)){for(W=Ke,j=_r=L=0;;){if(!(V=0|St[W>>2])){ft=_r,lt=j;break}if((0|(Qe=0|Tt(d,V)))<0|(Ve-_r|0)>>>0>>0){ft=_r,lt=Qe;break}if(!((V=Qe+_r|0)>>>0>>0)){ft=V,lt=Qe;break}W=W+4|0,_r=V,j=Qe}if((0|lt)<0){ie=-1;break e}if(gt(e,32,oe,ft,re),ft)for(j=Ke,_r=0;;){if(!(W=0|St[j>>2])){We=ft,L=96;break r}if((0|ft)<(0|(_r=(Me=0|Tt(d,W))+_r|0))){We=ft,L=96;break r}if(32&St[e>>2]||Mt(d,Me,e),ft>>>0<=_r>>>0){We=ft,L=96;break}j=j+4|0}else We=0,L=96}}while(0);C=(P=(D=(N=96!=(0|L)?(76==(0|L)&&(K=-1<((L=0)|ge)?-65537&Te:Te,ze=(Ue=0!=(0|ge)|(_r=0!=(0|St[(j=f)>>2])|0!=(0|St[j+4>>2]))?(xe=Ae,Be=Re,He=_,(0|(j=S-(Le=Oe)+(1&_r^1)|0))<(0|ge)?ge:j):(xe=Ae,Be=Re,He=Le=_,0),K)),gt(e,32,Me=(0|oe)<(0|(_r=(j=(0|Ue)<(0|(K=He-Le|0))?K:Ue)+xe|0))?_r:oe,_r,ze),32&St[e>>2]||Mt(Be,xe,e),gt(e,48,Me,_r,65536^ze),gt(e,48,j,K,0),32&St[e>>2]||Mt(Le,K,e),gt(e,32,Me,_r,8192^ze),Me):(L=0,gt(e,32,oe,We,8192^re),(0|We)<(0|oe)?oe:We),I),ue),pe)}else N=0,D=I,P=ue,C=pe}}e:do{if(243==(0|L))if(e)ie=I;else if(P){for(pe=1;;){if(!(C=0|St[i+(pe<<2)>>2])){ct=pe;break}if(Ot(n+(pe<<3)|0,C,t),10<=(0|(pe=pe+1|0))){ie=1;break e}}for(;;){if(0|St[i+(ct<<2)>>2]){ie=-1;break e}if(10<=(0|(ct=ct+1|0))){ie=1;break}}}else ie=0}while(0);return pt=dt,0|ie}function ze(){return 0}function Mt(e,r,t){e|=0,r|=0;var n,i,o=0,a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0;(a=0|St[(o=(t|=0)+16|0)>>2])?(u=a,s=5):0|function(e){var r=0,t=0,n=0;t=0|Et[(r=74+(e|=0)|0)>>0],Et[r>>0]=255+t|t,n=8&(t=0|St[e>>2])?(St[e>>2]=32|t,-1):(St[e+8>>2]=0,St[e+4>>2]=0,r=0|St[e+44>>2],St[e+28>>2]=r,St[e+20>>2]=r,St[e+16>>2]=r+(0|St[e+48>>2]),0);return 0|n}(t)?f=0:(u=0|St[o>>2],s=5);e:do{if(5==(0|s)){if((u-(n=o=0|St[(a=t+20|0)>>2])|0)>>>0>>0){f=0|nr[15&St[t+36>>2]](t,e,r);break}r:do{if(-1<(0|Et[t+75>>0])){for(o=r;;){if(!o){l=r,c=e,d=0,E=n;break r}if(10==(0|Et[e+(i=o+-1|0)>>0]))break;o=i}if((0|nr[15&St[t+36>>2]](t,e,o))>>>0>>0){f=o;break e}l=r-o|0,c=e+o|0,d=o,E=0|St[a>>2]}else l=r,c=e,d=0,E=n}while(0);Je(0|E,0|c,0|l),St[a>>2]=(0|St[a>>2])+l,f=d+l|0}}while(0);return 0|f}function Ot(e,r,t){e|=0,r|=0,t|=0;var n,i=0,o=0,a=0,u=0;e:do{if(r>>>0<=20){switch(0|r){case 9:i=3+(0|St[t>>2])&-4,o=0|St[i>>2],St[t>>2]=i+4,St[e>>2]=o;break e;case 10:o=3+(0|St[t>>2])&-4,i=0|St[o>>2],St[t>>2]=o+4,St[(o=e)>>2]=i,St[o+4>>2]=((0|i)<0)<<31>>31;break e;case 11:i=3+(0|St[t>>2])&-4,o=0|St[i>>2],St[t>>2]=i+4,St[(i=e)>>2]=o,St[i+4>>2]=0;break e;case 12:i=7+(0|St[t>>2])&-8,n=0|St[(o=i)>>2],a=0|St[o+4>>2],St[t>>2]=i+8,St[(i=e)>>2]=n,St[i+4>>2]=a;break e;case 13:a=3+(0|St[t>>2])&-4,i=0|St[a>>2],St[t>>2]=a+4,a=(65535&i)<<16>>16,St[(i=e)>>2]=a,St[i+4>>2]=((0|a)<0)<<31>>31;break e;case 14:a=3+(0|St[t>>2])&-4,i=0|St[a>>2],St[t>>2]=a+4,St[(a=e)>>2]=65535&i,St[a+4>>2]=0;break e;case 15:a=3+(0|St[t>>2])&-4,i=0|St[a>>2],St[t>>2]=a+4,a=(255&i)<<24>>24,St[(i=e)>>2]=a,St[i+4>>2]=((0|a)<0)<<31>>31;break e;case 16:a=3+(0|St[t>>2])&-4,i=0|St[a>>2],St[t>>2]=a+4,St[(a=e)>>2]=255&i,St[a+4>>2]=0;break e;case 17:case 18:a=7+(0|St[t>>2])&-8,u=+ht[a>>3],St[t>>2]=a+8,ht[e>>3]=u;break e;default:break e}}}while(0)}function At(e,r,t){t|=0;var n=0,i=0,o=0,a=0,u=0,s=0;if(0<(r|=0)>>>0|0==(0|r)&4294967295<(e|=0)>>>0){for(n=t,i=e,o=r;r=0|xt(0|i,0|o,10,0),Et[(n=n+-1|0)>>0]=48|r,i=0|Lt(0|(r=i),0|o,10,0),9>>0|9==(0|o)&4294967295>>0;)o=Ft;a=i,u=n}else a=e,u=t;if(a)for(t=a,a=u;;){if(Et[(u=a+-1|0)>>0]=(t>>>0)%10|48,t>>>0<10){s=u;break}t=(t>>>0)/10|0,a=u}else s=u;return 0|s}function Rt(e,r,t){e|=0;var n,i,o,a,u=0,s=0,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=255&(r|=0),u=0!=(0|(t|=0));e:do{if(u&0!=(3&e|0))for(n=255&r,s=e,f=t;;){if((0|Et[s>>0])==n<<24>>24){l=s,c=f,d=6;break e}if(!((a=0!=(0|(o=f+-1|0)))&0!=(3&(i=s+1|0)|0))){E=i,_=o,S=a,d=5;break}s=i,f=o}else E=e,_=t,S=u,d=5}while(0);5==(0|d)&&(S?(l=E,c=_,d=6):(m=E,h=0));e:do{if(6==(0|d))if(E=255&r,(0|Et[l>>0])==E<<24>>24)m=l,h=c;else{_=0|wt(w,16843009);r:do{if(3>>0){for(S=l,u=c;!((-2139062144&(t=St[S>>2]^_)^-2139062144)&t+-16843009|0);){if(t=S+4|0,!(3<(e=u+-4|0)>>>0)){p=t,b=e,d=11;break r}S=t,u=e}k=S,F=u}else p=l,b=c,d=11}while(0);if(11==(0|d)){if(!b){m=p,h=0;break}k=p,F=b}for(;;){if((0|Et[k>>0])==E<<24>>24){m=k,h=F;break e}if(_=k+1|0,!(F=F+-1|0)){m=_,h=0;break}k=_}}}while(0);return 0|(0|h?m:0)}function gt(e,r,t,n,i){e|=0,r|=0,t|=0,n|=0,i|=0;var o,a,u,s,f=0,l=0,c=0,d=0,E=0,_=pt;(0|bt)<=(0|(pt=pt+256|0))&&yt(256),o=_;do{if((0|n)<(0|t)&0==(73728&i|0)){if(Pt(0|o,0|r,0|(256<(a=t-n|0)>>>0?256:a)),u=0==(32&(f=0|St[e>>2])|0),255>>0){for(s=t-n|0,l=a,c=f,f=u;f=0==(32&(d=f?(Mt(o,256,e),0|St[e>>2]):c)|0),!((l=l+-256|0)>>>0<=255);)c=d;if(!f)break;E=255&s}else{if(!u)break;E=a}Mt(o,E,e)}}while(0);pt=_}function Tt(e,r){r|=0;return 0|((e|=0)?0|function(e,r,t){e|=0,r|=0,t|=0;var n=0;do{if(e){if(r>>>0<128){Et[e>>0]=r,n=1;break}if(r>>>0<2048){Et[e>>0]=r>>>6|192,Et[e+1>>0]=63&r|128,n=2;break}if(r>>>0<55296|57344==(-8192&r|0)){Et[e>>0]=r>>>12|224,Et[e+1>>0]=r>>>6&63|128,Et[e+2>>0]=63&r|128,n=3;break}if((r+-65536|0)>>>0<1048576){Et[e>>0]=r>>>18|240,Et[e+1>>0]=r>>>12&63|128,Et[e+2>>0]=r>>>6&63|128,Et[e+3>>0]=63&r|128,n=4;break}t=0|vt(),St[t>>2]=84,n=-1;break}}while(n=1,0);return 0|n}(e,r,0):0)}function Ye(e,r){var t=0|function(e,r){e|=0;var t=0,n=0,i=0,o=0,a=0,u=0,s=0,f=0,l=0;t=255&(r|=0);e:do{if(t){if(3&e)for(o=255&r,a=e;;){if((u=0|Et[a>>0])<<24>>24==0||u<<24>>24==o<<24>>24){n=a;break e}if(!(3&(u=a+1|0))){i=u;break}a=u}else i=e;a=0|wt(t,16843009),o=0|St[i>>2];r:do{if((-2139062144&o^-2139062144)&o+-16843009)l=i;else for(u=i,s=o;;){if((-2139062144&(f=s^a)^-2139062144)&f-16843009|0){l=u;break r}if((-2139062144&(s=0|St[(f=u+4|0)>>2])^-2139062144)&s+-16843009|0){l=f;break}u=f}}while(0);for(a=255&r,o=l;;){if((u=0|Et[o>>0])<<24>>24==0||u<<24>>24==a<<24>>24){n=o;break}o=o+1|0}}else n=e+(0|function(e){var r,t=0,n=0,i=0,o=0,a=0,u=0,s=0,f=0,t=e|=0;r:do{if(3&t)for(o=e,a=t;;){if(!(0|Et[o>>0])){u=a;break r}if(!(3&(a=r=o+1|0))){n=r,i=4;break}o=r}else n=e,i=4}while(0);if(4==(0|i)){for(i=n;!((-2139062144&(s=0|St[i>>2])^-2139062144)&s+-16843009);)i=i+4|0;if((255&s)<<24>>24)for(s=i;;){if(!(0|Et[(i=s+1|0)>>0])){f=i;break}s=i}else f=i;u=f}return u-t|0}(e))|0}while(0);return 0|n}(e|=0,r|=0);return 0|((0|Et[t>>0])==(255&r)<<24>>24?t:0)}function Ve(e){e|=0;var r=0,t=0,n=0,i=0,o=0,a=0,u=0;do{if(e){if((0|St[e+76>>2])<=-1){r=0|Ke(e);break}r=((t=!0)||He(),n=0|Ke(e))}else{if(i=0|St[34]?0|Ve(0|St[34]):0,H(11076),n=0|St[2768])for(t=n,n=i;;){if(a=(St[t+76>>2],0),u=(0|St[t+20>>2])>>>0>(0|St[t+28>>2])>>>0?0|Ke(t)|n:n,0|a&&He(),!(t=0|St[t+56>>2])){o=u;break}n=u}else o=i;V(11076),r=o}}while(0);return 0|r}function Ke(e){var r,t,n,i,o=0,a=(e|=0)+28|0;return 0|((0|St[(o=e+20|0)>>2])>>>0>(0|St[a>>2])>>>0&&(nr[15&St[e+36>>2]](e,0,0),0==(0|St[o>>2]))?-1:((t=0|St[(r=e+4|0)>>2])>>>0<(i=0|St[(n=e+8|0)>>2])>>>0&&nr[15&St[e+40>>2]](e,t-i|0,1),St[e+16>>2]=0,St[a>>2]=0,St[o>>2]=0,St[n>>2]=0,St[r>>2]=0))}function We(e,r,t){e|=0,r|=0;var n=0,n=1==(0|(t|=0))?r-(0|St[e+8>>2])+(0|St[e+4>>2])|0:r,i=e+28|0;return 0|((0|St[(r=e+20|0)>>2])>>>0>(0|St[i>>2])>>>0&&(nr[15&St[e+36>>2]](e,0,0),0==(0|St[r>>2]))?-1:(St[e+16>>2]=0,St[i>>2]=0,((St[r>>2]=0)|nr[15&St[e+40>>2]](e,n,t))<0?-1:(St[e+8>>2]=0,St[e+4>>2]=0,St[e>>2]=-17&St[e>>2],0)))}function je(e){var r=0,t=0,r=128&St[(e|=0)>>2]&&(0|St[e+20>>2])>>>0>(0|St[e+28>>2])>>>0?2:1;return 0|((0|(t=0|nr[15&St[e+40>>2]](e,0,r)))<0?t:t-(0|St[e+8>>2])+(0|St[e+4>>2])+(0|St[e+20>>2])-(0|St[e+28>>2])|0)}function Xe(e){e|=0;var r,t=0,n=0,i=0,o=0,a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0,R=0,g=0,T=0,N=0,D=0,P=0,C=0,I=0,L=0,x=0,B=0,H=0,U=0,z=0,Y=0,V=0,K=0,W=0,j=0,X=0,G=0,q=0,Q=0,Z=0,J=0,$=0,ee=0,re=0,te=0,ne=0,ie=0,oe=0,ae=0,ue=0,se=0,fe=0,le=0,ce=0,de=0,Ee=0,_e=0,Se=0,me=0,he=0,pe=0,be=0,ke=0,Fe=0,we=0,ye=0,ve=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),t=ve;do{if(e>>>0<245){if(i=(n=e>>>0<11?16:e+11&-8)>>>3,3&(a=(o=0|St[2774])>>>i)|0){l=0|St[(f=(s=11136+((u=(1&a^1)+i|0)<<1<<2)|0)+8|0)>>2],d=0|St[(c=l+8|0)>>2];do{if((0|s)!=(0|d)){if(d>>>0<(0|St[2778])>>>0&&Me(),(0|St[(E=d+12|0)>>2])==(0|l)){St[E>>2]=s,St[f>>2]=d;break}Me()}else St[2774]=o&~(1<>2]=3|d,St[(f=l+d+4|0)>>2]=1|St[f>>2],pt=ve,0|(_=c)}if((f=0|St[2776])>>>0>>0){if(0|a){S=0|St[(h=(m=11136+((p=((d=(E=(d=((s=a<>>(s=d>>>12&16))>>>5&8)|s|(E=(S=E>>>d)>>>2&4)|(S=(m=S>>>E)>>>1&2)|(m=(h=m>>>S)>>>1&1))+(h>>>m)|0)<<1<<2)|0)+8|0)>>2],s=0|St[(E=S+8|0)>>2];do{if((0|m)!=(0|s)){if(s>>>0<(0|St[2778])>>>0&&Me(),(0|St[(d=s+12|0)>>2])==(0|S)){St[d>>2]=m,St[h>>2]=s,b=o;break}Me()}else d=o&~(1<>2]=3|n,St[(h=S+n|0)+4>>2]=1|s,St[h+s>>2]=s,0|f&&(m=0|St[2779],a=11136+((i=f>>>3)<<1<<2)|0,b&(c=1<>2])>>>0<(0|St[2778])>>>0?Me():(k=l,F=i):(St[2774]=b|c,F=(k=a)+8|0),St[F>>2]=m,St[k+12>>2]=m,St[m+8>>2]=k,St[m+12>>2]=a),St[2776]=s,St[2779]=h,pt=ve,0|(_=E)}if(h=0|St[2775]){for(u=0|St[11400+(((s=(m=(s=(h&0-h)-1|0)>>>(a=s>>>12&16))>>>5&8)|a|(m=(c=m>>>s)>>>2&4)|(c=(i=c>>>m)>>>1&2)|(i=(l=i>>>c)>>>1&1))+(l>>>i)<<2)>>2],c=(-8&St[(l=i=u)+4>>2])-n|0;;){if(u=0|St[i+16>>2])w=u;else{if(!(m=0|St[i+20>>2]))break;w=m}l=(m=(u=(-8&St[(i=w)+4>>2])-n|0)>>>0>>0)?w:l,c=m?u:c}l>>>0<(i=0|St[2778])>>>0&&Me(),(E=l+n|0)>>>0<=l>>>0&&Me(),S=0|St[l+24>>2],p=0|St[l+12>>2];do{if((0|p)==(0|l)){if(m=0|St[(u=l+20|0)>>2])v=m,M=u;else{if(!(s=0|St[(a=l+16|0)>>2])){y=0;break}v=s,M=a}for(;;)if(0|(m=0|St[(u=v+20|0)>>2]))v=m,M=u;else{if(!(m=0|St[(u=v+16|0)>>2]))break;v=m,M=u}if(!(M>>>0>>0)){St[M>>2]=0,y=v;break}Me()}else{if((u=0|St[l+8>>2])>>>0>>0&&Me(),(0|St[(m=u+12|0)>>2])!=(0|l)&&Me(),(0|St[(a=p+8|0)>>2])==(0|l)){St[m>>2]=p,St[a>>2]=u,y=p;break}Me()}}while(0);do{if(0|S){if(p=0|St[l+28>>2],(0|l)==(0|St[(i=11400+(p<<2)|0)>>2])){if(!(St[i>>2]=y)){St[2775]=h&~(1<>>0<(0|St[2778])>>>0&&Me(),(0|St[(p=S+16|0)>>2])==(0|l)?St[p>>2]=y:St[S+20>>2]=y,!y)break;y>>>0<(p=0|St[2778])>>>0&&Me(),St[y+24>>2]=S,i=0|St[l+16>>2];do{if(0|i){if(!(i>>>0

>>0)){St[y+16>>2]=i,St[i+24>>2]=y;break}Me()}}while(0);if(0|(i=0|St[l+20>>2])){if(!(i>>>0<(0|St[2778])>>>0)){St[y+20>>2]=i,St[i+24>>2]=y;break}Me()}}}while(0);return c>>>0<16?(S=c+n|0,St[l+4>>2]=3|S,St[(h=l+S+4|0)>>2]=1|St[h>>2]):(St[l+4>>2]=3|n,St[E+4>>2]=1|c,St[E+c>>2]=c,0|f&&(h=0|St[2779],i=11136+((S=f>>>3)<<1<<2)|0,o&(p=1<>2])>>>0<(0|St[2778])>>>0?Me():(O=u,A=S):(St[2774]=o|p,A=(O=i)+8|0),St[A>>2]=h,St[O+12>>2]=h,St[h+8>>2]=O,St[h+12>>2]=i),St[2776]=c,St[2779]=E),pt=ve,0|(_=l+8|0)}R=n}else R=n}else if(e>>>0<=4294967231)if(h=-8&(i=e+11|0),p=0|St[2775]){S=0-h|0,g=(u=i>>>8)?16777215>>0?31:h>>>((s=14-((u=((a=u<<(i=(u+1048320|0)>>>16&8))+520192|0)>>>16&4)|i|(a=((m=a<>>16&2))+(m<>>15)|0)+7|0)&1|s<<1:0,s=0|St[11400+(g<<2)>>2];e:do{if(s)for(m=S,i=s,u=h<<(31==((a=0)|g)?0:25-(g>>>1)|0),d=0;;){if((C=(-8&St[i+4>>2])-h|0)>>>0>>0){if(!C){L=0,x=I=i,P=90;break e}B=i,H=C}else B=a,H=m;if(r=0==(0|(C=0|St[i+20>>2]))|(0|C)==(0|(i=0|St[i+16+(u>>>31<<2)>>2]))?d:C,C=0==(0|i)){T=r,N=B,D=H,P=86;break}a=B,m=H,u<<=1&C^1,d=r}else N=T=0,D=S,P=86}while(0);if(86==(0|P)){if(0==(0|T)&0==(0|N)){if(!(S=p&((s=2<>>(S=s>>>12&16))>>>5&8)|S|(n=(l=n>>>s)>>>2&4)|(l=(E=l>>>n)>>>1&2)|(E=(c=E>>>l)>>>1&1))+(c>>>E)<<2)>>2]}else U=T;U?(I=N,L=D,x=U,P=90):(z=N,Y=D)}if(90==(0|P))for(;;)if(P=0,l=(c=(E=(-8&St[x+4>>2])-h|0)>>>0>>0)?E:L,E=c?x:I,0|(c=0|St[x+16>>2]))I=E,L=l,x=c,P=90;else{if(!(x=0|St[x+20>>2])){z=E,Y=l;break}I=E,L=l,P=90}if(0!=(0|z)&&Y>>>0<((0|St[2776])-h|0)>>>0){z>>>0<(l=0|St[2778])>>>0&&Me(),(E=z+h|0)>>>0<=z>>>0&&Me(),c=0|St[z+24>>2],n=0|St[z+12>>2];do{if((0|n)==(0|z)){if(s=0|St[(S=z+20|0)>>2])K=s,W=S;else{if(!(f=0|St[(o=z+16|0)>>2])){V=0;break}K=f,W=o}for(;;)if(0|(s=0|St[(S=K+20|0)>>2]))K=s,W=S;else{if(!(s=0|St[(S=K+16|0)>>2]))break;K=s,W=S}if(!(W>>>0>>0)){St[W>>2]=0,V=K;break}Me()}else{if((S=0|St[z+8>>2])>>>0>>0&&Me(),(0|St[(s=S+12|0)>>2])!=(0|z)&&Me(),(0|St[(o=n+8|0)>>2])==(0|z)){St[s>>2]=n,St[o>>2]=S,V=n;break}Me()}}while(0);do{if(c){if(n=0|St[z+28>>2],(0|z)==(0|St[(l=11400+(n<<2)|0)>>2])){if(!(St[l>>2]=V)){l=p&~(1<>>0<(0|St[2778])>>>0&&Me(),(0|St[(l=c+16|0)>>2])==(0|z)?St[l>>2]=V:St[c+20>>2]=V,!V){j=p;break}V>>>0<(l=0|St[2778])>>>0&&Me(),St[V+24>>2]=c,n=0|St[z+16>>2];do{if(0|n){if(!(n>>>0>>0)){St[V+16>>2]=n,St[n+24>>2]=V;break}Me()}}while(0);if(n=0|St[z+20>>2]){if(!(n>>>0<(0|St[2778])>>>0)){St[V+20>>2]=n,St[n+24>>2]=V,j=p;break}Me()}else j=p}else j=p}while(0);do{if(16<=Y>>>0){if(St[z+4>>2]=3|h,St[E+4>>2]=1|Y,p=(St[E+Y>>2]=Y)>>>3,Y>>>0<256){c=11136+(p<<1<<2)|0,(n=0|St[2774])&(l=1<>2])>>>0<(0|St[2778])>>>0?Me():(X=S,G=p):(St[2774]=n|l,G=(X=c)+8|0),St[G>>2]=E,St[X+12>>2]=E,St[E+8>>2]=X,St[E+12>>2]=c;break}if(S=11400+((q=(c=Y>>>8)?16777215>>0?31:Y>>>((S=14-((c=((n=c<<(l=(c+1048320|0)>>>16&8))+520192|0)>>>16&4)|l|(n=((p=n<>>16&2))+(p<>>15)|0)+7|0)&1|S<<1:0)<<2)|0,St[E+28>>2]=q,St[(n=E+16|0)+4>>2]=0,St[n>>2]=0,!(j&(n=1<>2]=E,St[E+24>>2]=S,St[E+12>>2]=E,St[E+8>>2]=E;break}for(n=Y<<(31==(0|q)?0:25-(q>>>1)|0),p=0|St[S>>2];;){if((-8&St[p+4>>2]|0)==(0|Y)){P=148;break}if(!(S=0|St[(Q=p+16+(n>>>31<<2)|0)>>2])){P=145;break}n<<=1,p=S}if(145==(0|P)){if(!(Q>>>0<(0|St[2778])>>>0)){St[Q>>2]=E,St[E+24>>2]=p,St[E+12>>2]=E,St[E+8>>2]=E;break}Me()}else if(148==(0|P)){if(S=0|St[(n=p+8|0)>>2],(l=0|St[2778])>>>0<=S>>>0&l>>>0<=p>>>0){St[S+12>>2]=E,St[n>>2]=E,St[E+8>>2]=S,St[E+12>>2]=p,St[E+24>>2]=0;break}Me()}}else S=Y+h|0,St[z+4>>2]=3|S,St[(n=z+S+4|0)>>2]=1|St[n>>2]}while(0);return pt=ve,0|(_=z+8|0)}R=h}else R=h;else R=-1}while(0);if(R>>>0<=(z=0|St[2776])>>>0)return Y=z-R|0,Q=0|St[2779],15>>0?(q=Q+R|0,St[2779]=q,St[2776]=Y,St[q+4>>2]=1|Y,St[q+Y>>2]=Y,St[Q+4>>2]=3|R):(St[2776]=0,St[2779]=0,St[Q+4>>2]=3|z,St[(Y=Q+z+4|0)>>2]=1|St[Y>>2]),pt=ve,0|(_=Q+8|0);if(R>>>0<(Q=0|St[2777])>>>0)return Y=Q-R|0,St[2777]=Y,q=(z=0|St[2780])+R|0,St[2780]=q,St[q+4>>2]=1|Y,St[z+4>>2]=3|R,pt=ve,0|(_=z+8|0);if(Z=0|St[2892]?0|St[2894]:(St[2894]=4096,St[2893]=4096,St[2895]=-1,St[2896]=-1,St[2897]=0,St[2885]=0,z=-16&t^1431655768,St[t>>2]=z,St[2892]=z,4096),z=R+48|0,(Z=(Y=Z+(t=R+47|0)|0)&(q=0-Z|0))>>>0<=R>>>0)return pt=ve,(_=0)|_;if(0|(j=0|St[2884])&&(G=(X=0|St[2882])+Z|0)>>>0<=X>>>0|j>>>0>>0)return pt=ve,(_=0)|_;e:do{if(4&St[2885])P=187;else{j=0|St[2780];r:do{if(j){for(G=11544;!((X=0|St[G>>2])>>>0<=j>>>0&&(X+(0|St[(J=G+4|0)>>2])|0)>>>0>j>>>0);){if(!(X=0|St[G+8>>2])){P=172;break r}G=X}if((p=Y-Q&q)>>>0<2147483647)if((0|(X=0|Ze(0|p)))==((0|St[G>>2])+(0|St[J>>2])|0)){if(-1!=(0|X)){$=p,ee=X,P=190;break e}}else re=X,te=p,P=180}else P=172}while(0);do{if(172==(0|P)&&-1!=(0|(j=0|Ze(0)))&&(h=j,p=(V=(0==((X=(p=0|St[2893])+-1|0)&h|0)?0:(X+h&0-p)-h|0)+Z|0)+(h=0|St[2882])|0,R>>>0>>0&V>>>0<2147483647)){if(0|(X=0|St[2884])&&p>>>0<=h>>>0|X>>>0

>>0)break;if((0|(X=0|Ze(0|V)))==(0|j)){$=V,ee=j,P=190;break e}re=X,te=V,P=180}}while(0);r:do{if(180==(0|P)){V=0-te|0;do{if(te>>>0>>0&te>>>0<2147483647&-1!=(0|re)&&(j=t-te+(X=0|St[2894])&0-X)>>>0<2147483647){if(-1==(0|Ze(0|j))){Ze(0|V);break r}ne=j+te|0;break}}while(ne=te,0);if(-1!=(0|re)){$=ne,ee=re,P=190;break e}}}while(0);St[2885]=4|St[2885],P=187}}while(0);if(187==(0|P)&&Z>>>0<2147483647&&(re=0|Ze(0|Z))>>>0<(Z=0|Ze(0))>>>0&-1!=(0|re)&-1!=(0|Z)&&(R+40|0)>>>0<(ne=Z-re|0)>>>0&&($=ne,ee=re,P=190),190==(0|P)){re=(0|St[2882])+$|0,(St[2882]=re)>>>0>(0|St[2883])>>>0&&(St[2883]=re),re=0|St[2780];do{if(re){for(ne=11544;;){if((0|ee)==((ie=0|St[ne>>2])+(ae=0|St[(oe=ne+4|0)>>2])|0)){P=200;break}if(!(Z=0|St[ne+8>>2]))break;ne=Z}if(200==(0|P)&&0==(8&St[ne+12>>2]|0)&&re>>>0>>0&ie>>>0<=re>>>0){St[oe>>2]=ae+$,Z=re+(te=0==(7&(Z=re+8|0)|0)?0:0-Z&7)|0,t=$-te+(0|St[2777])|0,St[2780]=Z,St[2777]=t,St[Z+4>>2]=1|t,St[Z+t+4>>2]=40,St[2781]=St[2896];break}for(ue=ee>>>0<(t=0|St[2778])>>>0?St[2778]=ee:t,t=ee+$|0,Z=11544;;){if((0|St[Z>>2])==(0|t)){P=208;break}if(!(te=0|St[Z+8>>2])){se=11544;break}Z=te}if(208==(0|P)){if(!(8&St[Z+12>>2])){St[Z>>2]=ee,St[(ne=Z+4|0)>>2]=(0|St[ne>>2])+$,te=ee+(0==(7&(ne=ee+8|0)|0)?0:0-ne&7)|0,z=t+(0==(7&(ne=t+8|0)|0)?0:0-ne&7)|0,ne=te+R|0,J=z-te-R|0,St[te+4>>2]=3|R;do{if((0|z)!=(0|re)){if((0|z)==(0|St[2779])){q=(0|St[2776])+J|0,St[2776]=q,St[2779]=ne,St[ne+4>>2]=1|q,St[ne+q>>2]=q;break}if(1==(3&(q=0|St[z+4>>2])|0)){Q=-8&q,Y=q>>>3;e:do{if(256<=q>>>0){V=0|St[z+24>>2],G=0|St[z+12>>2];do{if((0|G)==(0|z)){if(p=0|St[(X=(j=z+16|0)+4|0)>>2])le=p,ce=X;else{if(!(h=0|St[j>>2])){fe=0;break}le=h,ce=j}for(;;)if(0|(p=0|St[(X=le+20|0)>>2]))le=p,ce=X;else{if(!(p=0|St[(X=le+16|0)>>2]))break;le=p,ce=X}if(!(ce>>>0>>0)){St[ce>>2]=0,fe=le;break}Me()}else{if((X=0|St[z+8>>2])>>>0>>0&&Me(),(0|St[(p=X+12|0)>>2])!=(0|z)&&Me(),(0|St[(j=G+8|0)>>2])==(0|z)){St[p>>2]=G,St[j>>2]=X,fe=G;break}Me()}}while(0);if(!V)break;X=11400+((G=0|St[z+28>>2])<<2)|0;do{if((0|z)==(0|St[X>>2])){if(0|(St[X>>2]=fe))break;St[2775]=St[2775]&~(1<>>0<(0|St[2778])>>>0&&Me(),(0|St[(j=V+16|0)>>2])==(0|z)?St[j>>2]=fe:St[V+20>>2]=fe,!fe)break e}while(0);fe>>>0<(G=0|St[2778])>>>0&&Me(),St[fe+24>>2]=V,j=0|St[(X=z+16|0)>>2];do{if(0|j){if(!(j>>>0>>0)){St[fe+16>>2]=j,St[j+24>>2]=fe;break}Me()}}while(0);if(!(j=0|St[X+4>>2]))break;if(!(j>>>0<(0|St[2778])>>>0)){St[fe+20>>2]=j,St[j+24>>2]=fe;break}Me()}else{j=0|St[z+8>>2],G=0|St[z+12>>2],V=11136+(Y<<1<<2)|0;do{if((0|j)!=(0|V)){if(j>>>0>>0&&Me(),(0|St[j+12>>2])==(0|z))break;Me()}}while(0);if((0|G)==(0|j)){St[2774]=St[2774]&~(1<>>0>>0&&Me(),(0|St[(X=G+8|0)>>2])==(0|z)){de=X;break}Me()}}while(0);St[j+12>>2]=G,St[de>>2]=j}}while(0);Ee=z+Q|0,_e=Q+J|0}else Ee=z,_e=J;if(St[(Y=Ee+4|0)>>2]=-2&St[Y>>2],St[ne+4>>2]=1|_e,Y=(St[ne+_e>>2]=_e)>>>3,_e>>>0<256){q=11136+(Y<<1<<2)|0,V=0|St[2774],X=1<>2])>>>0>=(0|St[2778])>>>0){Se=p,me=Y;break}Me()}else St[2774]=V|X,me=(Se=q)+8|0}while(0);St[me>>2]=ne,St[Se+12>>2]=ne,St[ne+8>>2]=Se,St[ne+12>>2]=q;break}X=_e>>>8;do{if(X){if(16777215<_e>>>0){he=31;break}he=_e>>>((h=14-((Y=((Q=X<<(V=(X+1048320|0)>>>16&8))+520192|0)>>>16&4)|V|(Q=((p=Q<>>16&2))+(p<>>15)|0)+7|0)&1|h<<1}else he=0}while(0);if(X=11400+(he<<2)|0,St[ne+28>>2]=he,St[(q=ne+16|0)+4>>2]=0,!((q=(St[q>>2]=0)|St[2775])&(h=1<>2]=ne,St[ne+24>>2]=X,St[ne+12>>2]=ne,St[ne+8>>2]=ne;break}for(h=_e<<(31==(0|he)?0:25-(he>>>1)|0),q=0|St[X>>2];;){if((-8&St[q+4>>2]|0)==(0|_e)){P=278;break}if(!(X=0|St[(pe=q+16+(h>>>31<<2)|0)>>2])){P=275;break}h<<=1,q=X}if(275==(0|P)){if(!(pe>>>0<(0|St[2778])>>>0)){St[pe>>2]=ne,St[ne+24>>2]=q,St[ne+12>>2]=ne,St[ne+8>>2]=ne;break}Me()}else if(278==(0|P)){if(X=0|St[(h=q+8|0)>>2],(Q=0|St[2778])>>>0<=X>>>0&Q>>>0<=q>>>0){St[X+12>>2]=ne,St[h>>2]=ne,St[ne+8>>2]=X,St[ne+12>>2]=q,St[ne+24>>2]=0;break}Me()}}else X=(0|St[2777])+J|0,St[2777]=X,St[2780]=ne,St[ne+4>>2]=1|X}while(0);return pt=ve,0|(_=te+8|0)}se=11544}for(;!((ne=0|St[se>>2])>>>0<=re>>>0&&re>>>0<(be=ne+(0|St[se+4>>2])|0)>>>0);)se=0|St[se+8>>2];for(te=be+-47|0,ne=te+8|0,J=te+(0==(7&ne|0)?0:0-ne&7)|0,ne=re+16|0,te=J>>>0>>0?re:J,J=te+8|0,z=ee+8|0,t=0==(7&z|0)?0:0-z&7,z=ee+t|0,Z=$+-40-t|0,St[2780]=z,St[2777]=Z,St[z+4>>2]=1|Z,St[z+Z+4>>2]=40,St[2781]=St[2896],Z=te+4|0,St[Z>>2]=27,St[J>>2]=St[2886],St[J+4>>2]=St[2887],St[J+8>>2]=St[2888],St[J+12>>2]=St[2889],St[2886]=ee,St[2887]=$,St[2889]=0,St[2888]=J,J=te+24|0;St[(J=J+4|0)>>2]=7,(J+4|0)>>>0>>0;);if((0|te)!=(0|re)){if(J=te-re|0,St[Z>>2]=-2&St[Z>>2],St[re+4>>2]=1|J,z=(St[te>>2]=J)>>>3,J>>>0<256){t=11136+(z<<1<<2)|0,(X=0|St[2774])&(h=1<>2])>>>0<(0|St[2778])>>>0?Me():(ke=Q,Fe=z):(St[2774]=X|h,Fe=(ke=t)+8|0),St[Fe>>2]=re,St[ke+12>>2]=re,St[re+8>>2]=ke,St[re+12>>2]=t;break}if(Q=11400+((we=(t=J>>>8)?16777215>>0?31:J>>>((Q=14-((t=((X=t<<(h=(t+1048320|0)>>>16&8))+520192|0)>>>16&4)|h|(X=((z=X<>>16&2))+(z<>>15)|0)+7|0)&1|Q<<1:0)<<2)|0,St[re+28>>2]=we,St[re+20>>2]=0,!((X=(St[ne>>2]=0)|St[2775])&(z=1<>2]=re,St[re+24>>2]=Q,St[re+12>>2]=re,St[re+8>>2]=re;break}for(z=J<<(31==(0|we)?0:25-(we>>>1)|0),X=0|St[Q>>2];;){if((-8&St[X+4>>2]|0)==(0|J)){P=304;break}if(!(Q=0|St[(ye=X+16+(z>>>31<<2)|0)>>2])){P=301;break}z<<=1,X=Q}if(301==(0|P)){if(!(ye>>>0<(0|St[2778])>>>0)){St[ye>>2]=re,St[re+24>>2]=X,St[re+12>>2]=re,St[re+8>>2]=re;break}Me()}else if(304==(0|P)){if(J=0|St[(z=X+8|0)>>2],(ne=0|St[2778])>>>0<=J>>>0&ne>>>0<=X>>>0){St[J+12>>2]=re,St[z>>2]=re,St[re+8>>2]=J,St[re+12>>2]=X,St[re+24>>2]=0;break}Me()}}}else{for(J=0|St[2778],0==(0|J)|ee>>>0>>0&&(St[2778]=ee),St[2886]=ee,St[2887]=$,St[2889]=0,St[2783]=St[2892],St[2782]=-1,J=0;St[(z=11136+(J<<1<<2)|0)+12>>2]=z,St[z+8>>2]=z,J=J+1|0,32!=(0|J););J=ee+(X=0==(7&(J=ee+8|0)|0)?0:0-J&7)|0,z=$+-40-X|0,St[2780]=J,St[2777]=z,St[J+4>>2]=1|z,St[J+z+4>>2]=40,St[2781]=St[2896]}}while(0);if(R>>>0<($=0|St[2777])>>>0)return ee=$-R|0,St[2777]=ee,re=($=0|St[2780])+R|0,St[2780]=re,St[re+4>>2]=1|ee,St[$+4>>2]=3|R,pt=ve,0|(_=$+8|0)}return $=0|vt(),St[$>>2]=12,pt=ve,(_=0)|_}function Ge(e){var r,t,n=0,i=0,o=0,a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0,R=0,g=0,T=0;if(e|=0){(n=e+-8|0)>>>0<(i=0|St[2778])>>>0&&Me(),1==(0|(e=3&(o=0|St[e+-4>>2])))&&Me(),r=n+(a=-8&o)|0;do{if(1&o)d=n,E=a;else{if(u=0|St[n>>2],!e)return;if(f=u+a|0,(s=n+(0-u)|0)>>>0>>0&&Me(),(0|s)==(0|St[2779])){if(3==(3&(c=0|St[(l=4+r|0)>>2])|0))return St[2776]=f,St[l>>2]=-2&c,St[s+4>>2]=1|f,void(St[s+f>>2]=f);d=s,E=f;break}if(c=u>>>3,u>>>0<256){if(u=0|St[s+8>>2],l=0|St[s+12>>2],(0|u)!=(0|(_=11136+(c<<1<<2)|0))&&(u>>>0>>0&&Me(),(0|St[u+12>>2])!=(0|s)&&Me()),(0|l)==(0|u)){St[2774]=St[2774]&~(1<>>0>>0&&Me(),(0|St[(_=l+8|0)>>2])==(0|s)?S=_:Me()):S=l+8|0,St[u+12>>2]=l,St[S>>2]=u,d=s,E=f;break}u=0|St[s+24>>2],l=0|St[s+12>>2];do{if((0|l)==(0|s)){if(m=0|St[(c=(_=s+16|0)+4|0)>>2])p=m,b=c;else{if(!(t=0|St[_>>2])){h=0;break}p=t,b=_}for(;;)if(0|(m=0|St[(c=p+20|0)>>2]))p=m,b=c;else{if(!(m=0|St[(c=p+16|0)>>2]))break;p=m,b=c}if(!(b>>>0>>0)){St[b>>2]=0,h=p;break}Me()}else{if((c=0|St[s+8>>2])>>>0>>0&&Me(),(0|St[(m=c+12|0)>>2])!=(0|s)&&Me(),(0|St[(_=l+8|0)>>2])==(0|s)){St[m>>2]=l,St[_>>2]=c,h=l;break}Me()}}while(0);if(u){if(l=0|St[s+28>>2],(0|s)==(0|St[(c=11400+(l<<2)|0)>>2])){if(!(St[c>>2]=h)){St[2775]=St[2775]&~(1<>>0<(0|St[2778])>>>0&&Me(),(0|St[(l=u+16|0)>>2])==(0|s)?St[l>>2]=h:St[u+20>>2]=h,!h){d=s,E=f;break}h>>>0<(l=0|St[2778])>>>0&&Me(),St[h+24>>2]=u,_=0|St[(c=s+16|0)>>2];do{if(0|_){if(!(_>>>0>>0)){St[h+16>>2]=_,St[_+24>>2]=h;break}Me()}}while(0);if(_=0|St[c+4>>2]){if(!(_>>>0<(0|St[2778])>>>0)){St[h+20>>2]=_,St[_+24>>2]=h,d=s,E=f;break}Me()}else d=s,E=f}else d=s,E=f}}while(0);if(r>>>0<=d>>>0&&Me(),1&(n=0|St[(a=4+r|0)>>2])||Me(),2&n)St[a>>2]=-2&n,St[d+4>>2]=1|E,v=St[d+E>>2]=E;else{if((0|r)==(0|St[2780]))return h=(0|St[2777])+E|0,St[2777]=h,St[2780]=d,St[d+4>>2]=1|h,(0|d)!=(0|St[2779])?void 0:(St[2779]=0,void(St[2776]=0));if((0|r)==(0|St[2779]))return h=(0|St[2776])+E|0,St[2776]=h,St[2779]=d,St[d+4>>2]=1|h,void(St[d+h>>2]=h);h=(-8&n)+E|0,i=n>>>3;do{if(256<=n>>>0){p=0|St[24+r>>2],b=0|St[12+r>>2];do{if((0|b)==(0|r)){if(o=0|St[(e=(S=16+r|0)+4|0)>>2])F=o,w=e;else{if(!(_=0|St[S>>2])){k=0;break}F=_,w=S}for(;;)if(0|(o=0|St[(e=F+20|0)>>2]))F=o,w=e;else{if(!(o=0|St[(e=F+16|0)>>2]))break;F=o,w=e}if(!(w>>>0<(0|St[2778])>>>0)){St[w>>2]=0,k=F;break}Me()}else{if((e=0|St[8+r>>2])>>>0<(0|St[2778])>>>0&&Me(),(0|St[(o=e+12|0)>>2])!=(0|r)&&Me(),(0|St[(S=b+8|0)>>2])==(0|r)){St[o>>2]=b,St[S>>2]=e,k=b;break}Me()}}while(0);if(0|p){if(b=0|St[28+r>>2],(0|r)==(0|St[(f=11400+(b<<2)|0)>>2])){if(!(St[f>>2]=k)){St[2775]=St[2775]&~(1<>>0<(0|St[2778])>>>0&&Me(),(0|St[(b=p+16|0)>>2])==(0|r)?St[b>>2]=k:St[p+20>>2]=k,!k)break;k>>>0<(b=0|St[2778])>>>0&&Me(),St[k+24>>2]=p,s=0|St[(f=16+r|0)>>2];do{if(0|s){if(!(s>>>0>>0)){St[k+16>>2]=s,St[s+24>>2]=k;break}Me()}}while(0);if(0|(s=0|St[f+4>>2])){if(!(s>>>0<(0|St[2778])>>>0)){St[k+20>>2]=s,St[s+24>>2]=k;break}Me()}}}else{if(s=0|St[8+r>>2],b=0|St[12+r>>2],(0|s)!=(0|(p=11136+(i<<1<<2)|0))&&(s>>>0<(0|St[2778])>>>0&&Me(),(0|St[s+12>>2])!=(0|r)&&Me()),(0|b)==(0|s)){St[2774]=St[2774]&~(1<>>0<(0|St[2778])>>>0&&Me(),(0|St[(p=b+8|0)>>2])==(0|r)?y=p:Me()):y=b+8|0,St[s+12>>2]=b,St[y>>2]=s}}while(0);if(St[d+4>>2]=1|h,St[d+h>>2]=h,(0|d)==(0|St[2779]))return void(St[2776]=h);v=h}if(E=v>>>3,v>>>0<256)return n=11136+(E<<1<<2)|0,(a=0|St[2774])&(h=1<>2])>>>0<(0|St[2778])>>>0?Me():(M=y,O=E):(St[2774]=a|h,O=(M=n)+8|0),St[O>>2]=d,St[M+12>>2]=d,St[d+8>>2]=M,void(St[d+12>>2]=n);a=11400+((A=(n=v>>>8)?16777215>>0?31:v>>>((a=14-((n=((O=n<<(M=(n+1048320|0)>>>16&8))+520192|0)>>>16&4)|M|(O=((h=O<>>16&2))+(h<>>15)|0)+7|0)&1|a<<1:0)<<2)|0,St[d+28>>2]=A,St[d+20>>2]=0,O=(St[d+16>>2]=0)|St[2775],h=1<>>1)|0),n=0|St[a>>2];;){if((-8&St[n+4>>2]|0)==(0|v)){R=130;break}if(!(E=0|St[(g=n+16+(M>>>31<<2)|0)>>2])){R=127;break}M<<=1,n=E}if(127==(0|R)){if(!(g>>>0<(0|St[2778])>>>0)){St[g>>2]=d,St[d+24>>2]=n,St[d+12>>2]=d,St[d+8>>2]=d;break}Me()}else if(130==(0|R)){if(f=0|St[(M=n+8|0)>>2],(E=0|St[2778])>>>0<=f>>>0&E>>>0<=n>>>0){St[f+12>>2]=d,St[M>>2]=d,St[d+8>>2]=f,St[d+12>>2]=n,St[d+24>>2]=0;break}Me()}}else St[2775]=O|h,St[a>>2]=d,St[d+24>>2]=a,St[d+12>>2]=d,St[d+8>>2]=d}while(0);if(d=(0|St[2782])-1|0,!(St[2782]=d)){for(T=11552;d=0|St[T>>2];)T=d+8|0;St[2782]=-1}}}function Nt(e,r,t,n){r|=0,n|=0;return 0|(Ft=r-n-((e|=0)>>>0<(t|=0)>>>0|0)>>>0,e-t>>>0|0)}function Dt(e,r,t,n){var i=0;return 0|(Ft=(r|=0)+(n|=0)+((i=(e|=0)+(t|=0)>>>0)>>>0>>0|0)>>>0,0|i)}function Pt(e,r,t){r|=0;var n,i,o,a=(e|=0)+(t|=0)|0;if(20<=(0|t)){if(i=(r&=255)|r<<8|r<<16|r<<24,o=-4&a,n=3&e)for(n=e+4-n|0;(0|e)<(0|n);)Et[e>>0]=r,e=e+1|0;for(;(0|e)<(0|o);)St[e>>2]=i,e=e+4|0}for(;(0|e)<(0|a);)Et[e>>0]=r,e=e+1|0;return e-t|0}function Ct(e,r,t){return e|=0,r|=0,(0|(t|=0))<32?(Ft=r>>>t,e>>>t|(r&(1<>>t-32|(Ft=0)}function It(e,r,t){return e|=0,r|=0,(0|(t|=0))<32?(Ft=r<>>32-t,e<>0]))<8?0|r:(0|(r=0|Et[E+(e>>8&255)>>0]))<8?r+8|0:(0|(r=0|Et[E+(e>>16&255)>>0]))<8?r+16|0:24+(0|Et[E+(e>>>24)>>0])|0}function Qe(e,r,t,n,i){i|=0;var o,a,u,s=0,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0,R=0,g=0,T=0,N=0,s=e|=0,c=t|=0,E=d=n|=0;if(!(l=f=r|=0))return _=0!=(0|i),E?(_&&(St[i>>2]=0|e,St[i+4>>2]=0&r),(m=S=0)|(Ft=S,m)):(_&&(St[i>>2]=(s>>>0)%(c>>>0),St[i+4>>2]=0),(S=0)|(Ft=S,m=(s>>>0)/(c>>>0)>>>0));_=0==(0|E);do{if(c){if(!_){if((h=(0|D(0|E))-(0|D(0|l))|0)>>>0<=31){w=s>>>((F=p=h+1|0)>>>0)&(k=h-31>>31)|l<<(b=31-h|0),y=l>>>(p>>>0)&k,v=0,M=s<>2]=0|e,St[i+4>>2]=f|0&r,(m=S=0)|(Ft=S,m)):(m=S=0)|(Ft=S,m)}if((b=c-1|0)&c|0){w=(h=32-(k=33+(0|D(0|c))-(0|D(0|l))|0)|0)-1>>31&l>>>((a=k-32|0)>>>0)|(l<>>((F=k)>>>0))&(u=a>>31),y=u&l>>>(k>>>0),v=s<<(p=64-k|0)&(o=h>>31),M=(l<>>(a>>>0))&o|s<>31;break}return 0|i&&(St[i>>2]=b&s,St[i+4>>2]=0),1==(0|c)?0|(Ft=S=f|0&r,m=0|e):(b=0|qe(0|c),0|(Ft=S=l>>>(b>>>0)|0,m=l<<32-b|s>>>(b>>>0)|0))}if(_)return 0|i&&(St[i>>2]=(l>>>0)%(c>>>0),St[i+4>>2]=0),(S=0)|(Ft=S,m=(l>>>0)/(c>>>0)>>>0);if(!s)return 0|i&&(St[i>>2]=0,St[i+4>>2]=(l>>>0)%(E>>>0)),(S=0)|(Ft=S,m=(l>>>0)/(E>>>0)>>>0);if(!((b=E-1|0)&E))return 0|i&&(St[i>>2]=0|e,St[i+4>>2]=b&l|0&r),m=l>>>(((S=0)|qe(0|E))>>>0),0|(Ft=S,m);if((b=(0|D(0|E))-(0|D(0|l))|0)>>>0<=30){w=l<<(h=31-b|0)|s>>>((F=k=b+1|0)>>>0),y=l>>>(k>>>0),v=0,M=s<>2]=0|e,St[i+4>>2]=f|0&r),(m=S=0)|(Ft=S,m)}while(0);if(F){for(r=0|t,t=d|0&n,n=0|Dt(0|r,0|t,-1,-1),d=Ft,f=M,M=v,v=y,y=w,w=F,F=0;f=M>>>31|(e=f)<<1,M=F|M<<1,Nt(0|n,0|d,0|(s=y<<1|e>>>31|0),0|(e=y>>>31|v<<1|0)),F=1&(E=(l=Ft)>>31|((0|l)<0?-1:0)<<1),y=0|Nt(0|s,0|e,E&r|0,(((0|l)<0?-1:0)>>31|((0|l)<0?-1:0)<<1)&t|0),v=Ft,w=w-1|0,0!=(0|w););O=f,A=M,R=v,g=y,T=0,N=F}else O=M,A=v,R=y,g=w,N=T=0;return F=A,(A=0)|i&&(St[i>>2]=g,St[i+4>>2]=R),0|(Ft=S=(0|F)>>>31|(O|A)<<1|0&(A<<1|F>>>31)|T,m=-2&(F<<1|0)|N)}function Lt(e,r,t,n){return 0|Qe(e|=0,r|=0,t|=0,n|=0,0)}function Ze(e){var r,t;return 0<(0|(e=(e|=0)+15&-16|0))&(0|(t=(r=0|St[d>>2])+e|0))<(0|r)|(0|t)<0?(h(),M(12),-1):(0|(St[d>>2]=t))>(0|m())&&0==(0|S())?(M(12),St[d>>2]=r,-1):0|r}function xt(e,r,t,n){var i,o=pt;return pt=pt+16|0,Qe(e|=0,r|=0,t|=0,n|=0,i=0|o),pt=o,0|(Ft=0|St[4+i>>2],0|St[i>>2])}function Je(e,r,t){e|=0,r|=0;var n;if(4096<=(0|(t|=0)))return 0|R(0|e,0|r,0|t);if(n=0|e,(3&e)==(3&r)){for(;3&e;){if(!t)return 0|n;Et[e>>0]=0|Et[r>>0],e=e+1|0,r=r+1|0,t=t-1|0}for(;4<=(0|t);)St[e>>2]=St[r>>2],e=e+4|0,r=r+4|0,t=t-4|0}for(;0<(0|t);)Et[e>>0]=0|Et[r>>0],e=e+1|0,r=r+1|0,t=t-1|0;return 0|n}function $e(){return 0}function er(e,r,t){return p(0),0}function rr(e){b(1)}function tr(e,r){k(2)}var nr=[er,function(e,r,t){e|=0,r|=0,t|=0;var n=0,i=pt;return(0|bt)<=(0|(pt=pt+80|0))&&yt(80),n=i,St[e+36>>2]=9,0==(64&St[e>>2]|0)&&(St[n>>2]=St[e+60>>2],St[n+4>>2]=21505,St[n+8>>2]=i+12,0|Y(54,0|n))&&(Et[e+75>>0]=-1),n=0|xe(e,r,t),pt=i,0|n},function(e,r,t){e|=0,r|=0,t|=0;var n,i,o=0,a=pt;return(0|bt)<=(0|(pt=pt+32|0))&&yt(32),i=(n=a)+20|0,St[n>>2]=St[e+60>>2],St[n+4>>2]=0,St[n+8>>2]=r,St[n+12>>2]=i,St[n+16>>2]=t,o=(0|Be(0|O(140,0|n)))<0?St[i>>2]=-1:0|St[i>>2],pt=a,0|o},function(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u=pt;return(0|bt)<=(0|(pt=pt+16|0))&&yt(16),i=u+8|0,o=u+4|0,St[(n=(a=u)+12|0)>>2]=e,St[i>>2]=r,St[o>>2]=t,St[a>>2]=St[n>>2],n=0==(0|L(8+(0|St[a>>2])|0,0|St[i>>2],0|St[o>>2])),pt=u,0|(n?0:8)},function(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u=pt;return(0|bt)<=(0|(pt=pt+16|0))&&yt(16),i=u+8|0,o=u+4|0,St[(n=(a=u)+12|0)>>2]=e,St[i>>2]=r,St[o>>2]=t,St[a>>2]=St[n>>2],n=0|ae(8+(0|St[a>>2])|0,0|St[i>>2],0|St[o>>2]),pt=u,0|n},function(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u,s,f=0,l=0,c=0,d=0,E=0,_=pt;return(0|bt)<=(0|(pt=pt+32|0))&&yt(32),i=_+16|0,o=_+12|0,a=_+8|0,u=_+4|0,St[(n=(s=_)+20|0)>>2]=e,St[i>>2]=r,St[o>>2]=t,St[a>>2]=0,St[u>>2]=St[n>>2],St[s>>2]=(0|St[24+(0|St[u>>2])>>2])-(0|St[20+(0|St[u>>2])>>2]),0==(0|St[s>>2])&&0<(0|St[St[o>>2]>>2])>>>0&&(16384<((St[20+(0|St[u>>2])>>2]=0)|St[St[o>>2]>>2])>>>0&&(St[St[o>>2]>>2]=16384),n=0|nr[15&St[St[16+(0|St[u>>2])>>2]>>2]](0|St[16+(0|St[u>>2])>>2],28+(0|St[u>>2])|0,0|St[o>>2]),St[a>>2]=n,n=0|St[St[o>>2]>>2],St[24+(0|St[u>>2])>>2]=n,St[s>>2]=n),pt=(E=(d=(c=(l=(f=((0|St[s>>2])>>>0>=(0|St[St[o>>2]>>2])>>>0||(St[St[o>>2]>>2]=St[s>>2]),(0|St[u>>2])+28|0),0|St[u>>2]),f+(0|St[(l+20|0)>>2])|0),0|St[i>>2]),St[d>>2]=c,0|St[a>>2]),_),0|E},function(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u,s,f=0,l=0,c=0,d=0,E=0,_=pt;return(0|bt)<=(0|(pt=pt+32|0))&&yt(32),i=_+16|0,o=_+12|0,a=_+8|0,u=_+4|0,St[(n=(s=_)+20|0)>>2]=e,St[i>>2]=r,St[o>>2]=t,St[a>>2]=0,St[u>>2]=St[n>>2],St[s>>2]=(0|St[24+(0|St[u>>2])>>2])-(0|St[20+(0|St[u>>2])>>2]),0==(0|St[s>>2])&&0<(0|St[St[o>>2]>>2])>>>0&&(St[20+(0|St[u>>2])>>2]=0,St[s>>2]=16384,n=0|nr[15&St[St[16+(0|St[u>>2])>>2]>>2]](0|St[16+(0|St[u>>2])>>2],28+(0|St[u>>2])|0,s),St[a>>2]=n,St[24+(0|St[u>>2])>>2]=St[s>>2]),pt=(E=(d=(c=(l=(f=((0|St[s>>2])>>>0>=(0|St[St[o>>2]>>2])>>>0||(St[St[o>>2]>>2]=St[s>>2]),(0|St[u>>2])+28|0),0|St[u>>2]),f+(0|St[(l+20|0)>>2])|0),0|St[i>>2]),St[d>>2]=c,0|St[a>>2]),_),0|E},function(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u,s=0,f=0,l=pt;return(0|bt)<=(0|(pt=pt+32|0))&&yt(32),n=l+20|0,s=l+12|0,o=l+8|0,a=l+4|0,St[(i=(u=l)+16|0)>>2]=e,St[s>>2]=r,St[o>>2]=t,St[a>>2]=St[i>>2],St[u>>2]=(0|St[24+(0|St[a>>2])>>2])-(0|St[20+(0|St[a>>2])>>2]),pt=(f=0|St[u>>2]?((0|St[u>>2])>>>0>(0|St[St[o>>2]>>2])>>>0&&(St[u>>2]=St[St[o>>2]>>2]),Je(0|St[s>>2],28+(0|St[a>>2])+(0|St[20+(0|St[a>>2])>>2])|0,0|St[u>>2]),s=20+(0|St[a>>2])|0,St[s>>2]=(0|St[s>>2])+(0|St[u>>2]),St[St[o>>2]>>2]=St[u>>2],(St[n>>2]=0)|St[n>>2]):(i=0|nr[15&St[St[16+(0|St[a>>2])>>2]>>2]](0|St[16+(0|St[a>>2])>>2],0|St[s>>2],0|St[o>>2]),St[n>>2]=i,0|St[n>>2]),l),0|f},function(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u=pt;return(0|bt)<=(0|(pt=pt+16|0))&&yt(16),i=u+8|0,o=u+4|0,St[(n=(a=u)+12|0)>>2]=e,St[i>>2]=r,St[o>>2]=t,St[a>>2]=St[n>>2],St[24+(0|St[a>>2])>>2]=0,n=(St[20+(0|St[a>>2])>>2]=0)|nr[15&St[4+(0|St[16+(0|St[a>>2])>>2])>>2]](0|St[16+(0|St[a>>2])>>2],0|St[i>>2],0|St[o>>2]),pt=u,0|n},xe,function(e,r,t){e|=0,r|=0,t|=0;var n,i,o,a,u=0,s=0,f=0,l=0,c=0,d=pt;return(0|bt)<=(0|(pt=pt+48|0))&&yt(48),n=d+16|0,St[(s=(u=d)+32|0)>>2]=r,f=s+4|0,o=0|St[(i=e+48|0)>>2],St[f>>2]=t-(0!=(0|o)&1),a=e+44|0,St[s+8>>2]=St[a>>2],St[s+12>>2]=o,c=1<=(0|(l=0|St[2762]?(g(2,0|e),St[u>>2]=St[e+60>>2],St[u+4>>2]=s,St[u+8>>2]=2,s=0|Be(0|T(145,0|u)),v(0),s):(St[n>>2]=St[e+60>>2],St[4+n>>2]=s,St[8+n>>2]=2,0|Be(0|T(145,0|n)))))?(s=0|St[f>>2])>>>0>>0?(f=0|St[a>>2],u=St[(a=e+4|0)>>2]=f,St[e+8>>2]=u+(l-s),0|St[i>>2]&&(St[a>>2]=u+1,Et[r+(t+-1)>>0]=0|Et[u>>0]),t):l:(St[e>>2]=St[e>>2]|48&l^16,St[e+8>>2]=0,St[e+4>>2]=0,l),pt=d,0|c},er,er,er,er,er],ir=[rr,function(e){0|St[(e|=0)+68>>2]||He()},function(e){0|St[(e|=0)+68>>2]||He()},rr],or=[tr,function(e,r){e|=0,r|=0;var t,n=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(t=n)+4>>2]=e,St[t>>2]=r,Ge(0|St[t>>2]),pt=n},function(e,r){e|=0,r|=0;var t,n=pt;(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(t=n)+4>>2]=e,St[t>>2]=r,Ge(0|St[t>>2]),pt=n},tr],ar=[function(e){return F(3),0},function(e){e|=0;var r,t=pt;return(0|bt)<=(0|(pt=pt+16|0))&&yt(16),St[(r=t)>>2]=St[e+60>>2],e=0|Be(0|U(6,0|r)),pt=t,0|e}],ur=[function(e,r,t,n){return w(4),0},function(e,r,t,n){e|=0,r|=0,t|=0,n|=0;var i,o,a,u,s,f=0,l=pt;for((0|bt)<=(0|(pt=pt+32|0))&&yt(32),o=l+12|0,a=l+8|0,u=l+4|0,St[(i=(s=l)+16|0)>>2]=e,St[o>>2]=r,St[a>>2]=t,St[u>>2]=n,St[s>>2]=St[o>>2];!((0|St[a>>2])>>>0<=0)&&3&St[s>>2];)St[i>>2]=St[(0|St[u>>2])+((255&(St[i>>2]^(0|mt[St[s>>2]>>0])))<<2)>>2]^(0|St[i>>2])>>>8,St[a>>2]=(0|St[a>>2])-1,St[s>>2]=1+(0|St[s>>2]);for(;!((0|St[a>>2])>>>0<4);)St[i>>2]=St[i>>2]^St[St[s>>2]>>2],St[i>>2]=St[(0|St[u>>2])+(768+(255&St[i>>2])<<2)>>2]^St[(0|St[u>>2])+(512+((0|St[i>>2])>>>8&255)<<2)>>2]^St[(0|St[u>>2])+(256+((0|St[i>>2])>>>16&255)<<2)>>2]^St[(0|St[u>>2])+((0|St[i>>2])>>>24<<2)>>2],St[a>>2]=(0|St[a>>2])-4,St[s>>2]=4+(0|St[s>>2]);for(;f=0|St[i>>2],!((0|St[a>>2])>>>0<=0);)St[i>>2]=St[(0|St[u>>2])+((255&(f^(0|mt[St[s>>2]>>0])))<<2)>>2]^(0|St[i>>2])>>>8,St[a>>2]=(0|St[a>>2])-1,St[s>>2]=1+(0|St[s>>2]);return pt=l,0|f}],sr=[function(e,r){return y(5),0},function(e,r){e|=0,r|=0;var t,n,i=pt;return(0|bt)<=(0|(pt=pt+16|0))&&yt(16),t=i+8|0,St[(n=i)+4>>2]=e,St[n>>2]=r,0|St[n>>2]?(r=0|Xe(0|St[n>>2]),St[t>>2]=r):St[t>>2]=0,pt=i,0|St[t>>2]},function(e,r){e|=0,r|=0;var t,n,i=pt;return(0|bt)<=(0|(pt=pt+16|0))&&yt(16),t=i+8|0,St[(n=i)+4>>2]=e,St[n>>2]=r,0|St[n>>2]?(r=0|Xe(0|St[n>>2]),St[t>>2]=r):St[t>>2]=0,pt=i,0|St[t>>2]},function(e,r){e|=0,r|=0;var t,n,i,o=pt;return(0|bt)<=(0|(pt=pt+16|0))&&yt(16),n=o+4|0,St[(t=(i=o)+8|0)>>2]=e,St[n>>2]=r,St[i>>2]=St[t>>2],t=20+(0|St[i>>2])|0,St[t>>2]=(0|St[t>>2])+(0|St[n>>2]),pt=o,0}];return{_sbrk:Ze,_i64Subtract:Nt,_free:Ge,___udivmoddi4:Qe,_i64Add:Dt,_extract:function(e,r){e|=0,r|=0;var t,n,i,o,a,u,s,f,l,c,d,E,_,S,m,h,p,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0,R=0,g=0,T=0,N=0,D=0,P=0,C=0,I=0,L=0;if((0|bt)<=(0|(pt=(r=pt)+16816|0))&&yt(16816),t=r+80|0,n=r+16544|0,i=r+16532|0,o=r+120|0,a=r+112|0,u=r+104|0,f=(s=r)+100|0,l=r+96|0,c=r+92|0,d=r+16548|0,E=r+88|0,_=r+84|0,S=0|function(e,r){e|=0,r|=0;var t=0,n=0,i=0,o=0,a=0;(0|(pt=(t=pt)+32|0))>=(0|bt)&&yt(32);n=t+16|0,i=t,a=0|Rt(2845,0|Et[r>>0],4)?(o=32768|function(e){var r=0,t=0,n=0,i=0;return r=0==(0|Ye(e=e|0,43)),t=0|Et[e>>0],n=r?t<<24>>24!=114&1:2,r=0==(0|Ye(e,120)),i=r?n:128|n,n=0==(0|Ye(e,101)),e=n?i:524288|i,i=t<<24>>24==114?e:64|e,e=t<<24>>24==119?512|i:i,0|(t<<24>>24==97?1024|e:e)}(r),St[i>>2]=e,St[i+4>>2]=o,St[i+8>>2]=438,o=0|Be(0|z(5,0|i)),0<=(0|o)?(i=0|function(e,r){e|=0,r|=0;var t=0,n=0,i=0,o=0,a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0,_=0;(0|(pt=(t=pt)+112|0))>=(0|bt)&&yt(112);if(n=t+40|0,i=t+24|0,o=t+16|0,u=(a=t)+52|0,0|Rt(2845,(s=0|Et[r>>0])<<24>>24,4))if(f=0|Xe(1144)){for(c=f,d=c+112|0;St[c>>2]=0,c=c+4|0,(0|c)<(0|d););0|Ye(r,43)||(St[f>>2]=s<<24>>24==114?8:4),E=0|Ye(r,101)?(St[a>>2]=e,St[a+4>>2]=2,St[a+8>>2]=1,x(221,0|a),0|Et[r>>0]):s,_=E<<24>>24==97?(St[o>>2]=e,St[4+o>>2]=3,1024&(E=0|x(221,0|o))||(St[i>>2]=e,St[i+4>>2]=4,St[i+8>>2]=1024|E,x(221,0|i)),i=128|St[f>>2],St[f>>2]=i):0|St[f>>2],St[f+60>>2]=e,St[f+44>>2]=f+120,St[f+48>>2]=1024,Et[(i=f+75|0)>>0]=-1,0==(8&_|0)&&(St[n>>2]=e,St[4+n>>2]=21505,St[8+n>>2]=u,0==(0|Y(54,0|n)))&&(Et[i>>0]=10),St[f+32>>2]=10,St[f+36>>2]=9,St[f+40>>2]=2,St[f+12>>2]=1,0|St[2763]||(St[f+76>>2]=-1),H(11076),i=0|St[2768],0|(St[f+56>>2]=i)&&(St[i+52>>2]=f),St[2768]=f,V(11076),l=f}else l=0;else f=0|vt(),St[f>>2]=22,l=0;return pt=t,0|l}(o,r))||(St[n>>2]=o,U(6,0|n),0):0):(i=0|vt(),St[i>>2]=22,0);return pt=t,0|a}(e,140),St[f>>2]=0,St[a>>2]=1,St[(e=4+a|0)>>2]=1,St[u>>2]=2,St[4+u>>2]=2,St[(m=8+i|0)>>2]=S,function(e){e|=0;var r=0,t=0;(0|(pt=(r=pt)+16|0))>=(0|bt)&&yt(16),St[(t=r)>>2]=e,St[St[t>>2]>>2]=3,St[4+(0|St[t>>2])>>2]=4,pt=r}(i),function(e,r){e|=0,r|=0;var t=0,n=0,i=0;(0|(pt=(t=pt)+16|0))>=(0|bt)&&yt(16),St[(n=(i=t)+4|0)>>2]=e,St[i>>2]=r,St[St[n>>2]>>2]=0|St[i>>2]?6:5,St[4+(0|St[n>>2])>>2]=3,St[8+(0|St[n>>2])>>2]=7,St[12+(0|St[n>>2])>>2]=8,pt=t}(o,0),St[16+o>>2]=i,function(e){e|=0;var r=0,t=0;(0|(pt=(r=pt)+16|0))>=(0|bt)&&yt(16),St[(t=r)>>2]=e,St[24+(0|St[t>>2])>>2]=0,St[20+(0|St[t>>2])>>2]=0,pt=r}(o),function(){var e=0,r=0,t=0,n=0,i=0,o=0;for((0|(pt=(e=pt)+16|0))>=(0|bt)&&yt(16),t=e+8|0,n=e+4|0,St[(r=(i=e)+12|0)>>2]=0;!(256<=(0|St[r>>2])>>>0);){for(St[t>>2]=St[r>>2],St[n>>2]=0;o=0|St[t>>2],!(8<=(0|St[n>>2])>>>0);)St[t>>2]=o>>>1^-306674912&~((1&St[t>>2])-1),St[n>>2]=1+(0|St[n>>2]);St[2852+(St[r>>2]<<2)>>2]=o,St[r>>2]=1+(0|St[r>>2])}for(;!(2048<=(0|St[r>>2])>>>0);)St[i>>2]=St[2852+((0|St[r>>2])-256<<2)>>2],St[2852+(St[r>>2]<<2)>>2]=St[2852+((255&St[i>>2])<<2)>>2]^(0|St[i>>2])>>>8,St[r>>2]=1+(0|St[r>>2]);St[2761]=1,pt=e}(),J(s),0|function(e,r,t,n){e|=0,r|=0,t|=0,n|=0;var i=0,o=0,a=0,u=0,s=0,f=0,l=0;(0|(pt=(i=pt)+32|0))>=(0|bt)&&yt(32);return a=i+12|0,u=i+8|0,s=i+4|0,St[(o=(f=i)+16|0)>>2]=e,St[a>>2]=r,St[u>>2]=t,St[s>>2]=n,n=0|function(e,r,t,n){e|=0,r|=0,t|=0,n|=0;var i=0,o=0,a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0;(0|(pt=(i=pt)+160|0))>=(0|bt)&&yt(160);if(o=i+112|0,u=i+104|0,s=i+100|0,f=i+96|0,l=i+120|0,c=i+32|0,d=i+24|0,E=i+16|0,_=i+92|0,S=i+88|0,m=i+80|0,h=i+72|0,p=i+68|0,b=i+64|0,k=i+8|0,F=i+60|0,w=i+56|0,y=i+48|0,M=(v=i)+40|0,St[(a=i+108|0)>>2]=e,St[u>>2]=r,St[s>>2]=t,St[f>>2]=n,St[(n=c)>>2]=0,St[n+4>>2]=0,n=0|nr[15&St[12+(0|St[u>>2])>>2]](0|St[u>>2],c,1),St[p>>2]=n,0|St[p>>2])return St[o>>2]=St[p>>2],O=0|St[o>>2],pt=i,0|O;if(p=0|pe(0|St[u>>2],l,32,17),St[b>>2]=p,0|St[b>>2])return St[o>>2]=St[b>>2],O=0|St[o>>2],pt=i,0|O;if(!(0|function(e){e|=0;var r=0,t=0,n=0,i=0,o=0,a=0;(0|(pt=(r=pt)+16|0))>=(0|bt)&&yt(16);t=r+8|0,St[(n=(i=r)+4|0)>>2]=e,St[i>>2]=0;for(;;){if(6<=(0|St[i>>2])>>>0){o=6;break}if((0|mt[(0|St[n>>2])+(0|St[i>>2])>>0])!=(0|mt[346+(0|St[i>>2])>>0])){o=4;break}St[i>>2]=1+(0|St[i>>2])}{if(4==(0|o))return St[t>>2]=0,a=0|St[t>>2],pt=r,0|a;if(6==(0|o))return St[t>>2]=1,a=0|St[t>>2],pt=r,0|a}return 0}(l)))return St[o>>2]=17,O=0|St[o>>2],pt=i,0|O;if(0|mt[l+6>>0])return St[o>>2]=4,O=0|St[o>>2],pt=i,0|O;if(b=0|mt[l+12+4>>0]|(0|mt[l+12+4+1>>0])<<8|(0|mt[l+12+4+2>>0])<<16|(0|mt[l+12+4+3>>0])<<24,St[(p=d)>>2]=0|mt[l+12>>0]|(0|mt[l+12+1>>0])<<8|(0|mt[l+12+2>>0])<<16|(0|mt[l+12+3>>0])<<24,St[p+4>>2]=b,b=0|mt[l+20+4>>0]|(0|mt[l+20+4+1>>0])<<8|(0|mt[l+20+4+2>>0])<<16|(0|mt[l+20+4+3>>0])<<24,St[(p=E)>>2]=0|mt[l+20>>0]|(0|mt[l+20+1>>0])<<8|(0|mt[l+20+2>>0])<<16|(0|mt[l+20+3>>0])<<24,St[p+4>>2]=b,St[S>>2]=0|mt[l+28>>0]|(0|mt[l+28+1>>0])<<8|(0|mt[l+28+2>>0])<<16|(0|mt[l+28+3>>0])<<24,p=0|Dt(0|St[(b=c)>>2],0|St[b+4>>2],32,0),b=32+(0|St[a>>2])|0,St[b>>2]=p,St[b+4>>2]=Ft,(0|(b=0|Pe(l+12|0,20)))!=(0|mt[l+8>>0]|(0|mt[l+8+1>>0])<<8|(0|mt[l+8+2>>0])<<16|(0|mt[l+8+3>>0])<<24|0))return St[o>>2]=3,O=0|St[o>>2],pt=i,0|O;if(St[_>>2]=St[E>>2],0!=(0|St[(l=E)+4>>2])||(0|St[_>>2])!=(0|St[l>>2]))return St[o>>2]=2,O=0|St[o>>2],pt=i,0|O;if(!(0|St[_>>2]))return St[o>>2]=0,O=0|St[o>>2],pt=i,0|O;if(b=0|St[(l=d)>>2],p=0|St[l+4>>2],n=E,t=0|Dt(0|St[(l=d)>>2],0|St[l+4>>2],0|St[n>>2],0|St[n+4>>2]),p>>>0>(n=Ft)>>>0|(0|p)==(0|n)&t>>>0>>0||(b=0|St[(t=d)>>2],n=0|St[t+4>>2],p=E,l=0|Dt(0|St[(t=d)>>2],0|St[t+4>>2],0|St[p>>2],0|St[p+4>>2]),p=0|Dt(0|l,0|Ft,32,0),n>>>0>(l=Ft)>>>0|(0|n)==(0|l)&p>>>0>>0))return St[o>>2]=17,O=0|St[o>>2],pt=i,0|O;if(St[(p=k)>>2]=0,St[p+4>>2]=0,p=0|nr[15&St[12+(0|St[u>>2])>>2]](0|St[u>>2],k,2),St[F>>2]=p,0|St[F>>2])return St[o>>2]=St[F>>2],O=0|St[o>>2],pt=i,0|O;if(p=0|St[(F=k)>>2],b=0|St[F+4>>2],l=d,n=0|Dt(0|St[(F=c)>>2],0|St[F+4>>2],0|St[l>>2],0|St[l+4>>2]),b>>>0<(l=Ft)>>>0|(0|b)==(0|l)&p>>>0>>0||(p=0|St[(n=k)>>2],l=0|St[n+4>>2],b=0|Dt(0|St[(n=c)>>2],0|St[n+4>>2],32,0),F=0|Dt(0|b,0|Ft,0|St[(n=d)>>2],0|St[n+4>>2]),l>>>0<(n=Ft)>>>0|(0|l)==(0|n)&p>>>0>>0)||(k=0|St[(F=k)>>2],p=0|St[F+4>>2],n=0|Dt(0|St[(F=c)>>2],0|St[F+4>>2],32,0),l=0|Dt(0|n,0|Ft,0|St[(F=d)>>2],0|St[F+4>>2]),E=0|Dt(0|l,0|Ft,0|St[(F=E)>>2],0|St[F+4>>2]),p>>>0<(F=Ft)>>>0|(0|p)==(0|F)&k>>>0>>0))return St[o>>2]=6,O=0|St[o>>2],pt=i,0|O;if(E=0|St[u>>2],c=0|Dt(0|St[(k=c)>>2],0|St[k+4>>2],32,0),d=0|Dt(0|c,0|Ft,0|St[(k=d)>>2],0|St[k+4>>2]),k=0|he(E,d,Ft),St[w>>2]=k,0|St[w>>2])return St[o>>2]=St[w>>2],O=0|St[o>>2],pt=i,0|O;if(!(0|Ie(m,0|St[_>>2],0|St[f>>2])))return St[o>>2]=2,O=0|St[o>>2],pt=i,0|O;w=0|function(e,r,t){e|=0,r|=0,t|=0;var n=0,i=0,o=0,a=0;(0|(pt=(n=pt)+16|0))>=(0|bt)&&yt(16);return o=n+4|0,St[(i=(a=n)+8|0)>>2]=e,St[o>>2]=r,St[a>>2]=t,t=0|pe(0|St[i>>2],0|St[o>>2],0|St[a>>2],6),pt=n,0|t}(0|St[u>>2],0|St[m>>2],0|St[_>>2]),St[h>>2]=w;do{if(0==(0|St[h>>2])&&(St[h>>2]=16,(0|(w=0|Pe(0|St[m>>2],0|St[_>>2])))==(0|St[S>>2]))){St[y>>2]=St[m>>2],St[4+y>>2]=St[4+m>>2],w=0|ue(y,v),St[h>>2]=w,w=v;do{if(0==(0|St[h>>2])&(23==(0|St[w>>2])&0==(0|St[w+4>>2]))){if(Ce(M),k=32+(0|St[a>>2])|0,d=0|function(e,r,t,n,i,o){e|=0,r|=0,t|=0,n|=0,i|=0,o|=0;var a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0;(0|(pt=(a=pt)+80|0))>=(0|bt)&&yt(80);return s=a+64|0,f=a+60|0,c=(l=a)+56|0,d=a+24|0,E=a+20|0,_=a+16|0,S=a+12|0,m=a+8|0,St[(u=a+68|0)>>2]=e,St[s>>2]=r,St[f>>2]=t,St[(t=l)>>2]=n,St[t+4>>2]=i,St[c>>2]=o,St[E>>2]=0,St[_>>2]=0,St[S>>2]=0,q(d),o=l,l=0|function(e,r,t,n,i,o,a,u,s,f){e|=0,r|=0,t|=0,n|=0,i|=0,o|=0,a|=0,u|=0,s|=0,f|=0;var l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0,R=0,g=0;(0|(pt=(l=pt)+96|0))>=(0|bt)&&yt(96);if(c=l+80|0,E=l+72|0,_=l+68|0,S=l+16|0,m=l+64|0,h=l+60|0,p=l+56|0,b=l+52|0,k=l+48|0,F=l+44|0,w=l+8|0,y=l+40|0,M=(v=l)+36|0,O=l+32|0,A=l+28|0,R=l+24|0,St[(d=l+76|0)>>2]=e,St[E>>2]=r,St[_>>2]=t,St[(t=S)>>2]=n,St[t+4>>2]=i,St[m>>2]=o,St[h>>2]=a,St[p>>2]=u,St[b>>2]=s,St[k>>2]=f,St[F>>2]=0,f=0|se(0|St[E>>2],w,0|St[m>>2],F,0|St[h>>2],0|St[p>>2],0|St[b>>2],0|St[k>>2],0|St[k>>2]),St[O>>2]=f,0|St[O>>2])return St[c>>2]=St[O>>2],g=0|St[c>>2],pt=l,0|g;if(O=S,f=0|Dt(0|St[(S=w)>>2],0|St[4+S>>2],0|St[O>>2],0|St[O+4>>2]),St[(O=w)>>2]=f,St[O+4>>2]=Ft,1!=(0|St[24+(0|St[m>>2])>>2]))return St[c>>2]=16,g=0|St[c>>2],pt=l,0|g;if(St[y>>2]=St[12+(0|St[m>>2])>>2],O=0|G(0|St[y>>2]),St[(f=v)>>2]=O,St[f+4>>2]=Ft,f=w,O=0|he(0|St[d>>2],0|St[f>>2],0|St[f+4>>2]),St[A>>2]=O,0|St[A>>2])return St[c>>2]=St[A>>2],g=0|St[c>>2],pt=l,0|g;if(!(0|Ie(0|St[_>>2],0|St[v>>2],0|St[k>>2])))return St[c>>2]=2,g=0|St[c>>2],pt=l,0|g;if(A=w,w=0|Re(0|St[y>>2],0|St[St[m>>2]>>2],0|St[d>>2],0|St[A>>2],0|St[A+4>>2],0|St[St[_>>2]>>2],0|St[v>>2],0|St[k>>2],0,0),St[M>>2]=w,St[R>>2]=St[M>>2],0|St[R>>2])return St[c>>2]=St[R>>2],g=0|St[c>>2],pt=l,0|g;if(0|St[28+(0|St[y>>2])>>2]&&(0|(R=0|Pe(0|St[St[_>>2]>>2],0|St[v>>2])))!=(0|St[32+(0|St[y>>2])>>2]))return St[c>>2]=3,g=0|St[c>>2],pt=l,0|g;return St[c>>2]=0,g=0|St[c>>2],pt=l,0|g}(0|St[u>>2],0|St[s>>2],0|St[f>>2],0|St[o>>2],0|St[o+4>>2],d,E,_,S,0|St[c>>2]),St[m>>2]=l,Z(d,0|St[c>>2]),or[3&St[4+(0|St[c>>2])>>2]](0|St[c>>2],0|St[E>>2]),or[3&St[4+(0|St[c>>2])>>2]](0|St[c>>2],0|St[_>>2]),or[3&St[4+(0|St[c>>2])>>2]](0|St[c>>2],0|St[S>>2]),pt=a,0|St[m>>2]}(0|St[u>>2],y,M,0|St[k>>2],0|St[k+4>>2],0|St[f>>2]),St[h>>2]=d,d=0|St[f>>2],0|St[h>>2]){Le(M,d);break}Le(m,d),St[m>>2]=St[M>>2],St[4+m>>2]=St[4+M>>2],St[y>>2]=St[m>>2],St[4+y>>2]=St[4+m>>2],d=0|ue(y,v),St[h>>2]=d;break}}while(0);if(0|St[h>>2])break;if(1==(0|St[(w=v)>>2])&0==(0|St[w+4>>2])){w=0|function(e,r,t,n){e|=0,r|=0,t|=0,n|=0;var i=0,o=0,a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0,_=0,S=0;(0|(pt=(i=pt)+48|0))>=(0|bt)&&yt(48);return a=i+36|0,u=i+32|0,s=i+28|0,f=i+24|0,l=i+20|0,c=i+16|0,d=i+12|0,E=i+8|0,_=i+4|0,St[(o=(S=i)+40|0)>>2]=e,St[a>>2]=r,St[u>>2]=t,St[s>>2]=n,St[f>>2]=0,St[l>>2]=0,St[c>>2]=0,St[d>>2]=0,St[E>>2]=0,St[_>>2]=0,n=0|function(e,r,t,n,i,o,a,u,s,f){e|=0,r|=0,t|=0,n|=0,i|=0,o|=0,a|=0,u|=0,s|=0,f|=0;var l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0,p=0,b=0,k=0,F=0,w=0,y=0,v=0,M=0,O=0,A=0,R=0,g=0,T=0,N=0,D=0,P=0,C=0,I=0,L=0,x=0,B=0,H=0,U=0,z=0,Y=0,V=0,K=0,W=0,j=0,X=0,G=0,q=0,Q=0,Z=0,J=0,$=0,ee=0,re=0,te=0,ne=0,ie=0,oe=0,ae=0;(0|(pt=(l=pt)+208|0))>=(0|bt)&&yt(208);if(c=l+188|0,E=l+180|0,_=l+176|0,S=l+172|0,m=l+168|0,h=l+164|0,p=l+160|0,b=l+156|0,k=l+152|0,F=l+148|0,w=l+8|0,y=l+144|0,v=l+140|0,M=l+136|0,O=l+132|0,A=l+128|0,R=l+124|0,g=l+120|0,T=l+116|0,N=l+112|0,D=l+108|0,P=l+104|0,I=(C=l)+100|0,L=l+96|0,x=l+92|0,B=l+88|0,H=l+84|0,U=l+80|0,z=l+76|0,Y=l+72|0,V=l+68|0,K=l+64|0,W=l+60|0,j=l+56|0,X=l+193|0,G=l+52|0,q=l+48|0,Q=l+44|0,Z=l+40|0,J=l+192|0,$=l+36|0,ee=l+32|0,re=l+28|0,te=l+24|0,ne=l+20|0,ie=l+16|0,St[(d=l+184|0)>>2]=e,St[E>>2]=r,St[_>>2]=t,St[S>>2]=n,St[m>>2]=i,St[h>>2]=o,St[p>>2]=a,St[b>>2]=u,St[k>>2]=s,St[F>>2]=f,St[y>>2]=0,St[v>>2]=0,St[M>>2]=0,St[O>>2]=0,f=0|ue(0|St[E>>2],w),St[R>>2]=f,0|St[R>>2])return St[c>>2]=St[R>>2],oe=0|St[c>>2],pt=l,0|oe;if(2==(0|St[(R=w)>>2])&0==(0|St[R+4>>2])){if(R=0|function(e){e|=0;var r=0,t=0,n=0,i=0,o=0,a=0,u=0;(0|(pt=(r=pt)+32|0))>=(0|bt)&&yt(32);t=r+16|0,o=(i=r)+8|0,St[(n=r+12|0)>>2]=e;for(;;){if(e=0|ue(0|St[n>>2],i),St[o>>2]=e,0|St[o>>2]){a=3;break}if(0==(0|St[(e=i)>>2])&0==(0|St[e+4>>2])){a=6;break}me(0|St[n>>2])}{if(3==(0|a))return St[t>>2]=St[o>>2],u=0|St[t>>2],pt=r,0|u;if(6==(0|a))return St[t>>2]=0,u=0|St[t>>2],pt=r,0|u}return 0}(0|St[E>>2]),St[g>>2]=R,0|St[g>>2])return St[c>>2]=St[g>>2],oe=0|St[c>>2],pt=l,0|oe;if(g=0|ue(0|St[E>>2],w),St[T>>2]=g,0|St[T>>2])return St[c>>2]=St[T>>2],oe=0|St[c>>2],pt=l,0|oe}if(4==(0|St[(T=w)>>2])&0==(0|St[T+4>>2])){if(T=0|se(0|St[E>>2],40+(0|St[d>>2])|0,0|St[d>>2],y,0|St[_>>2],0|St[S>>2],0|St[m>>2],0|St[k>>2],0|St[F>>2]),St[N>>2]=T,0|St[N>>2])return St[c>>2]=St[N>>2],oe=0|St[c>>2],pt=l,0|oe;if(N=32+(0|St[d>>2])|0,T=40+(0|St[d>>2])|0,g=0|Dt(0|St[(y=T)>>2],0|St[y+4>>2],0|St[N>>2],0|St[N+4>>2]),St[(N=T)>>2]=g,St[N+4>>2]=Ft,N=0|ue(0|St[E>>2],w),St[D>>2]=N,0|St[D>>2])return St[c>>2]=St[D>>2],oe=0|St[c>>2],pt=l,0|oe}if(0==(0|St[(D=w)>>2])&0==(0|St[D+4>>2]))return St[c>>2]=0,oe=0|St[c>>2],pt=l,0|oe;if(5!=(0|St[(D=w)>>2])|0!=(0|St[D+4>>2]))return St[c>>2]=16,oe=0|St[c>>2],pt=l,0|oe;if(D=0|fe(0|St[E>>2],v),St[P>>2]=D,0|St[P>>2])return St[c>>2]=St[P>>2],oe=0|St[c>>2],pt=l,0|oe;if(St[28+(0|St[d>>2])>>2]=St[v>>2],0|St[v>>2]){if(P=0|sr[3&St[St[k>>2]>>2]](0|St[k>>2],St[v>>2]<<5),!(St[M>>2]=P))return St[c>>2]=2,oe=0|St[c>>2],pt=l,0|oe}else St[M>>2]=0;St[16+(0|St[d>>2])>>2]=St[M>>2],St[A>>2]=0;for(;!((0|St[A>>2])>>>0>=(0|St[v>>2])>>>0);)!function(e){e|=0;var r=0,t=0;(0|(pt=(r=pt)+16|0))>=(0|bt)&&yt(16),St[(t=r)>>2]=e,Et[24+(0|St[t>>2])>>0]=1,Et[25+(0|St[t>>2])>>0]=0,Et[26+(0|St[t>>2])>>0]=0,Et[27+(0|St[t>>2])>>0]=0,Et[28+(0|St[t>>2])>>0]=0,pt=r}((0|St[M>>2])+(St[A>>2]<<5)|0),St[A>>2]=1+(0|St[A>>2]);e:for(;;){if(P=0|ue(0|St[E>>2],w),St[I>>2]=P,0|St[I>>2]){ae=27;break}if(0==(0|St[(P=w)>>2])&0==(0|St[P+4>>2])){ae=86;break}if(P=0|le(0|St[E>>2],C),St[L>>2]=P,0|St[L>>2]){ae=30;break}if(0<(D=0|St[(P=C)+4>>2])>>>0|(0==(0|D)?(0|St[P>>2])>>>0>(0|St[4+(0|St[E>>2])>>2])>>>0:0)){ae=32;break}if((0|(P=0|St[w>>2]))==(0|St[(D=w)>>2])&&(((0|P)<0)<<31>>31|0)==(0|St[D+4>>2]))switch(0|St[w>>2]){case 17:if(P=0|de(0|St[E>>2]),St[H>>2]=P,0|St[H>>2]){ae=38;break e}if(St[B>>2]=(0|St[C>>2])-1,1&St[B>>2]|0){ae=40;break e}if(!(0|Ie(68+(0|St[d>>2])|0,0|St[B>>2],0|St[k>>2]))){ae=42;break e}if(1+(0|St[v>>2])|0){if(P=0|sr[3&St[St[k>>2]>>2]](0|St[k>>2],1+(0|St[v>>2])<<2),!(St[64+(0|St[d>>2])>>2]=P)){ae=46;break e}}else St[64+(0|St[d>>2])>>2]=0;if(Je(0|St[68+(0|St[d>>2])>>2],0|St[St[E>>2]>>2],0|St[B>>2]),P=0|function(e,r,t,n){e|=0,r|=0,t|=0,n|=0;var i=0,o=0,a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0;(0|(pt=(i=pt)+32|0))>=(0|bt)&&yt(32);o=i+24|0,u=i+16|0,s=i+12|0,f=i+8|0,l=i+4|0,St[(a=(c=i)+20|0)>>2]=e,St[u>>2]=r,St[s>>2]=t,St[f>>2]=n,St[c>>2]=0,St[l>>2]=0;r:for(;;){if(n=(0|St[l>>2])>>>0<(0|St[s>>2])>>>0,St[(0|St[f>>2])+(St[l>>2]<<2)>>2]=St[c>>2],!n){d=9;break}for(;;){if((0|St[c>>2])>>>0>=(0|St[u>>2])>>>0){d=4;break r}if(0==(0|mt[(0|St[a>>2])+(St[c>>2]<<1)>>0])&&0==(0|mt[(0|St[a>>2])+(1+(St[c>>2]<<1))>>0]))break;St[c>>2]=1+(0|St[c>>2])}St[c>>2]=1+(0|St[c>>2]),St[l>>2]=1+(0|St[l>>2])}{if(4==(0|d))return St[o>>2]=16,E=0|St[o>>2],pt=i,0|E;if(9==(0|d))return St[o>>2]=(0|St[c>>2])==(0|St[u>>2])?0:16,E=0|St[o>>2],pt=i,0|E}return 0}(0|St[St[E>>2]>>2],(0|St[B>>2])>>>1,0|St[v>>2],0|St[64+(0|St[d>>2])>>2]),St[U>>2]=P,0|St[U>>2]){ae=48;break e}if(P=0|ce(0|St[E>>2],0|St[B>>2],0),St[z>>2]=P,0|St[z>>2]){ae=50;break e}continue e;case 14:if(P=0|Ee(0|St[E>>2],0|St[v>>2],0|St[h>>2],0|St[F>>2]),St[Y>>2]=P,0|St[Y>>2]){ae=52;break e}for(St[O>>2]=0,St[A>>2]=0;;){if((0|St[A>>2])>>>0>=(0|St[v>>2])>>>0)continue e;0|Et[(0|St[St[h>>2]>>2])+(0|St[A>>2])>>0]&&(St[O>>2]=1+(0|St[O>>2])),St[A>>2]=1+(0|St[A>>2])}break;case 15:if(P=0|Ee(0|St[E>>2],0|St[O>>2],0|St[p>>2],0|St[F>>2]),St[V>>2]=P,0|St[V>>2]){ae=59;break e}continue e;case 21:if(P=0|_e(0|St[E>>2],0|St[v>>2],0|St[b>>2],0|St[F>>2]),St[K>>2]=P,0|St[K>>2]){ae=61;break e}if(P=0|de(0|St[E>>2]),St[W>>2]=P,0|St[W>>2]){ae=63;break e}for(St[A>>2]=0;!((0|St[A>>2])>>>0>=(0|St[v>>2])>>>0);){if(St[j>>2]=(0|St[M>>2])+(St[A>>2]<<5),Et[X>>0]=0|Et[(0|St[St[b>>2]>>2])+(0|St[A>>2])>>0],Et[29+(0|St[j>>2])>>0]=0|Et[X>>0],(St[20+(0|St[j>>2])>>2]=0)|Et[X>>0]&&(P=0|Se(0|St[E>>2],20+(0|St[j>>2])|0),St[G>>2]=P,0|St[G>>2])){ae=68;break e}St[A>>2]=1+(0|St[A>>2])}or[3&St[4+(0|St[F>>2])>>2]](0|St[F>>2],0|St[St[b>>2]>>2]),St[St[b>>2]>>2]=0;continue e;case 20:if(P=0|_e(0|St[E>>2],0|St[v>>2],0|St[b>>2],0|St[F>>2]),St[q>>2]=P,0|St[q>>2]){ae=72;break e}if(P=0|de(0|St[E>>2]),St[Q>>2]=P,0|St[Q>>2]){ae=74;break e}for(St[A>>2]=0;!((0|St[A>>2])>>>0>=(0|St[v>>2])>>>0);){if(St[Z>>2]=(0|St[M>>2])+(St[A>>2]<<5),Et[J>>0]=0|Et[(0|St[St[b>>2]>>2])+(0|St[A>>2])>>0],Et[28+(0|St[Z>>2])>>0]=0|Et[J>>0],St[4+(0|St[Z>>2])>>2]=0,(St[St[Z>>2]>>2]=0)|Et[J>>0]){if(P=0|Se(0|St[E>>2],0|St[Z>>2]),St[$>>2]=P,0|St[$>>2]){ae=79;break e}if(P=0|Se(0|St[E>>2],4+(0|St[Z>>2])|0),St[ee>>2]=P,0|St[ee>>2]){ae=81;break e}}St[A>>2]=1+(0|St[A>>2])}or[3&St[4+(0|St[F>>2])>>2]](0|St[F>>2],0|St[St[b>>2]>>2]),St[St[b>>2]>>2]=0;continue e;default:if(P=C,D=0|ce(0|St[E>>2],0|St[P>>2],0|St[P+4>>2]),St[re>>2]=D,0|St[re>>2]){ae=85;break e}continue e}else if(D=C,P=0|ce(0|St[E>>2],0|St[D>>2],0|St[D+4>>2]),St[x>>2]=P,0|St[x>>2]){ae=35;break}}switch(0|ae){case 27:return St[c>>2]=St[I>>2],oe=0|St[c>>2],pt=l,0|oe;case 30:return St[c>>2]=St[L>>2],oe=0|St[c>>2],pt=l,0|oe;case 32:return St[c>>2]=16,oe=0|St[c>>2],pt=l,0|oe;case 35:return St[c>>2]=St[x>>2],oe=0|St[c>>2],pt=l,0|oe;case 38:return St[c>>2]=St[H>>2],oe=0|St[c>>2],pt=l,0|oe;case 40:return St[c>>2]=16,oe=0|St[c>>2],pt=l,0|oe;case 42:case 46:return St[c>>2]=2,oe=0|St[c>>2],pt=l,0|oe;case 48:return St[c>>2]=St[U>>2],oe=0|St[c>>2],pt=l,0|oe;case 50:return St[c>>2]=St[z>>2],oe=0|St[c>>2],pt=l,0|oe;case 52:return St[c>>2]=St[Y>>2],oe=0|St[c>>2],pt=l,0|oe;case 59:return St[c>>2]=St[V>>2],oe=0|St[c>>2],pt=l,0|oe;case 61:return St[c>>2]=St[K>>2],oe=0|St[c>>2],pt=l,0|oe;case 63:return St[c>>2]=St[W>>2],oe=0|St[c>>2],pt=l,0|oe;case 68:return St[c>>2]=St[G>>2],oe=0|St[c>>2],pt=l,0|oe;case 72:return St[c>>2]=St[q>>2],oe=0|St[c>>2],pt=l,0|oe;case 74:return St[c>>2]=St[Q>>2],oe=0|St[c>>2],pt=l,0|oe;case 79:return St[c>>2]=St[$>>2],oe=0|St[c>>2],pt=l,0|oe;case 81:return St[c>>2]=St[ee>>2],oe=0|St[c>>2],pt=l,0|oe;case 85:return St[c>>2]=St[re>>2],oe=0|St[c>>2],pt=l,0|oe;case 86:for(St[te>>2]=0,St[ne>>2]=0,St[A>>2]=0;!((0|St[A>>2])>>>0>=(0|St[v>>2])>>>0);)St[ie>>2]=(0|St[M>>2])+(St[A>>2]<<5),(Et[26+(0|St[ie>>2])>>0]=0)|St[St[h>>2]>>2]?Et[24+(0|St[ie>>2])>>0]=0|mt[(0|St[St[h>>2]>>2])+(0|St[A>>2])>>0]?0:1:Et[24+(0|St[ie>>2])>>0]=1,0|Et[24+(0|St[ie>>2])>>0]?(Et[25+(0|St[ie>>2])>>0]=0,re=(0|St[St[_>>2]>>2])+(St[ne>>2]<<3)|0,ee=0|St[re+4>>2],$=8+(0|St[ie>>2])|0,St[$>>2]=St[re>>2],St[$+4>>2]=ee,St[16+(0|St[ie>>2])>>2]=St[(0|St[St[m>>2]>>2])+(St[ne>>2]<<2)>>2],Et[27+(0|St[ie>>2])>>0]=0|Et[(0|St[St[S>>2]>>2])+(0|St[ne>>2])>>0],St[ne>>2]=1+(0|St[ne>>2])):(0|St[St[p>>2]>>2]?Et[25+(0|St[ie>>2])>>0]=0|mt[(0|St[St[p>>2]>>2])+(0|St[te>>2])>>0]?0:1:Et[25+(0|St[ie>>2])>>0]=1,St[te>>2]=1+(0|St[te>>2]),ee=8+(0|St[ie>>2])|0,St[ee>>2]=0,St[ee+4>>2]=0,St[16+(0|St[ie>>2])>>2]=0,Et[27+(0|St[ie>>2])>>0]=0),St[A>>2]=1+(0|St[A>>2]);return A=0|function(e,r){e|=0,r|=0;var t=0,n=0,i=0,o=0,a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0,_=0;(0|(pt=(t=pt)+48|0))>=(0|bt)&&yt(48);if(n=t+40|0,o=t+32|0,a=t+28|0,s=(u=t)+24|0,f=t+20|0,l=t+16|0,c=t+12|0,d=t+8|0,St[(i=t+36|0)>>2]=e,St[o>>2]=r,St[a>>2]=0,St[(r=u)>>2]=0,St[r+4>>2]=0,St[f>>2]=0,St[l>>2]=0,0|St[24+(0|St[i>>2])>>2]){if(r=0|sr[3&St[St[o>>2]>>2]](0|St[o>>2],St[24+(0|St[i>>2])>>2]<<2),!(St[48+(0|St[i>>2])>>2]=r))return St[n>>2]=2,E=0|St[n>>2],pt=t,0|E}else St[48+(0|St[i>>2])>>2]=0;St[s>>2]=0;for(;!((0|St[s>>2])>>>0>=(0|St[24+(0|St[i>>2])>>2])>>>0);)St[(0|St[48+(0|St[i>>2])>>2])+(St[s>>2]<<2)>>2]=St[a>>2],St[a>>2]=(0|St[a>>2])+(0|St[(0|St[12+(0|St[i>>2])>>2])+(40*(0|St[s>>2])|0)+24>>2]),St[s>>2]=1+(0|St[s>>2]);if(0|St[20+(0|St[i>>2])>>2]){if(a=0|sr[3&St[St[o>>2]>>2]](0|St[o>>2],St[20+(0|St[i>>2])>>2]<<3),!(St[52+(0|St[i>>2])>>2]=a))return St[n>>2]=2,E=0|St[n>>2],pt=t,0|E}else St[52+(0|St[i>>2])>>2]=0;St[s>>2]=0;for(;!((0|St[s>>2])>>>0>=(0|St[20+(0|St[i>>2])>>2])>>>0);)r=0|St[(a=u)+4>>2],e=(0|St[52+(0|St[i>>2])>>2])+(St[s>>2]<<3)|0,St[e>>2]=St[a>>2],St[e+4>>2]=r,r=(0|St[St[i>>2]>>2])+(St[s>>2]<<3)|0,a=0|Dt(0|St[(e=u)>>2],0|St[e+4>>2],0|St[r>>2],0|St[r+4>>2]),St[(r=u)>>2]=a,St[r+4>>2]=Ft,St[s>>2]=1+(0|St[s>>2]);if(0|St[24+(0|St[i>>2])>>2]){if(u=0|sr[3&St[St[o>>2]>>2]](0|St[o>>2],St[24+(0|St[i>>2])>>2]<<2),!(St[56+(0|St[i>>2])>>2]=u))return St[n>>2]=2,E=0|St[n>>2],pt=t,0|E}else St[56+(0|St[i>>2])>>2]=0;if(0|St[28+(0|St[i>>2])>>2]){if(u=0|sr[3&St[St[o>>2]>>2]](0|St[o>>2],St[28+(0|St[i>>2])>>2]<<2),!(St[60+(0|St[i>>2])>>2]=u))return St[n>>2]=2,E=0|St[n>>2],pt=t,0|E}else St[60+(0|St[i>>2])>>2]=0;St[s>>2]=0;e:for(;;){if((0|St[s>>2])>>>0>=(0|St[28+(0|St[i>>2])>>2])>>>0){_=36;break}if(St[c>>2]=(0|St[16+(0|St[i>>2])>>2])+(St[s>>2]<<5),St[d>>2]=1&(0!=(0|Et[24+(0|St[c>>2])>>0])^1),0!=(0|St[d>>2])&0==(0|St[l>>2]))St[(0|St[60+(0|St[i>>2])>>2])+(St[s>>2]<<2)>>2]=-1;else{r:do{if(!(0|St[l>>2]))for(;;){if((0|St[f>>2])>>>0>=(0|St[24+(0|St[i>>2])>>2])>>>0){_=29;break e}if(St[(0|St[56+(0|St[i>>2])>>2])+(St[f>>2]<<2)>>2]=St[s>>2],0|St[(0|St[12+(0|St[i>>2])>>2])+(40*(0|St[f>>2])|0)+36>>2])break r;St[f>>2]=1+(0|St[f>>2])}}while(0);St[(0|St[60+(0|St[i>>2])>>2])+(St[s>>2]<<2)>>2]=St[f>>2],0==(0|St[d>>2])&&(St[l>>2]=1+(0|St[l>>2]),(0|St[l>>2])>>>0>=(0|St[(0|St[12+(0|St[i>>2])>>2])+(40*(0|St[f>>2])|0)+36>>2])>>>0)&&(St[f>>2]=1+(0|St[f>>2]),St[l>>2]=0)}St[s>>2]=1+(0|St[s>>2])}{if(29==(0|_))return St[n>>2]=16,E=0|St[n>>2],pt=t,0|E;if(36==(0|_))return St[n>>2]=0,E=0|St[n>>2],pt=t,0|E}return 0}(0|St[d>>2],0|St[k>>2]),St[c>>2]=A,oe=0|St[c>>2],pt=l,0|oe}return 0}(0|St[o>>2],0|St[a>>2],f,l,c,d,E,_,0|St[u>>2],0|St[s>>2]),St[S>>2]=n,or[3&St[4+(0|St[s>>2])>>2]](0|St[s>>2],0|St[f>>2]),or[3&St[4+(0|St[s>>2])>>2]](0|St[s>>2],0|St[l>>2]),or[3&St[4+(0|St[s>>2])>>2]](0|St[s>>2],0|St[c>>2]),or[3&St[4+(0|St[s>>2])>>2]](0|St[s>>2],0|St[d>>2]),or[3&St[4+(0|St[s>>2])>>2]](0|St[s>>2],0|St[E>>2]),or[3&St[4+(0|St[s>>2])>>2]](0|St[s>>2],0|St[_>>2]),pt=i,0|St[S>>2]}(0|St[a>>2],y,0|St[s>>2],0|St[f>>2]),St[h>>2]=w;break}St[h>>2]=4;break}}while(0);return Le(m,0|St[f>>2]),St[o>>2]=St[h>>2],O=0|St[o>>2],pt=i,0|O}(0|St[o>>2],0|St[a>>2],0|St[u>>2],0|St[s>>2]),St[f>>2]=n,pt=(l=(0|St[f>>2]&&$(0|St[o>>2],0|St[u>>2]),0|St[f>>2]),i),0|l}(s,o,a,u))return $(s,a),oe(m),K(1),void(pt=r);St[l>>2]=-1,S=(St[c>>2]=0)|St[(i=s+28|0)>>2];e:do{if(S){for(h=s+16|0,p=0|St[h>>2],k=0,F=0;F=0|Dt(0|St[(w=p+(k<<5)+8|0)>>2],0|St[w+4>>2],0|F,0),k=k+1|0,(0|k)!=(0|S););for(v=y=w=k=0,M=p,O=S;;){if(Pt(0|d,0,255),St[E>>2]=0,(St[_>>2]=0)|Et[M+(v<<5)+25>>0])P=y,C=k,I=w,L=O;else{if(w>>>0<(A=0|ee(s,v,0))>>>0){if(Ge(k),!(R=0|Xe(A<<1)))break;g=R,T=A}else g=k,T=w;if(ee(s,v,g),0|g){for(A=St[n>>2]=0;0|_t[g+(A<<1)>>1];)A=A+1|0;j(0,n,g,A),N=1+(0|St[n>>2])|0,0|(D=0|Xe(St[n>>2]=N))&&0|j(D,n,g,A)&&(Et[D+(0|St[n>>2])>>0]=0,function(e,r,t){e|=0,r|=0,t|=0;var n=0,i=0,o=0,a=0,u=0,s=0;(0|(pt=(n=pt)+32|0))>=(0|bt)&&yt(32),o=n+12|0,a=n+8|0,u=n+4|0,St[(i=(s=n)+16|0)>>2]=e,St[o>>2]=r,St[a>>2]=t,St[u>>2]=0,St[s>>2]=St[a>>2];r:do{if(0|St[s>>2])for(;;){if(t=(0|St[s>>2])-1|0,!(St[s>>2]=t))break r;if(t=0|St[o>>2],St[o>>2]=t+1,r=0|Et[t>>0],t=0|St[i>>2],St[i>>2]=t+1,!((Et[t>>0]=r)<<24>>24))break r;St[u>>2]=1+(0|St[u>>2])}}while(0);if(0|St[s>>2])return St[u>>2],pt=n;for(0|St[a>>2]&&(Et[St[i>>2]>>0]=0);i=0|St[o>>2],St[o>>2]=i+1,0|Et[i>>0];)St[u>>2]=1+(0|St[u>>2]);St[u>>2],pt=n}(d,D,255)),Ge(D)}D=0|St[M+(v<<5)+8>>2],0|(N=0|W(s,o,v,l,f,c,E,_,a,u,F,y))&&(St[t>>2]=N,function(e,r){e|=0,r|=0;var t=0,n=0;(0|(pt=(t=pt)+16|0))>=(0|bt)&&yt(16),St[(n=t)>>2]=r,r=0|function(e,r,t){e|=0,r|=0,t|=0;var n=0,i=0,o=0,a=0,u=0,s=0,f=0,l=0,c=0,d=0,E=0,_=0,S=0,m=0,h=0;(0|(pt=(n=pt)+224|0))>=(0|bt)&&yt(224);i=n+120|0,u=(a=n)+136|0,f=40+(s=o=n+80|0)|0;for(;St[s>>2]=0,s=s+4|0,(0|s)<(0|f););St[i>>2]=St[t>>2],l=(0|Ue(0,r,i,a,o))<0?-1:(c=-1<(0|St[e+76>>2])?0|ze():0,t=0|St[e>>2],s=32&t,(0|Et[e+74>>0])<1&&(St[e>>2]=-33&t),m=0|St[(t=e+48|0)>>2]?0|Ue(e,r,i,a,o):(d=0|St[(f=e+44|0)>>2],St[f>>2]=u,St[(E=e+28|0)>>2]=u,St[(_=e+20|0)>>2]=u,St[t>>2]=80,St[(S=e+16|0)>>2]=80+u,u=0|Ue(e,r,i,a,o),d?(nr[15&St[e+36>>2]](e,0,0),h=0==(0|St[_>>2])?-1:u,St[f>>2]=d,St[t>>2]=0,St[S>>2]=0,St[E>>2]=0,St[_>>2]=0,h):u),o=0|St[e>>2],St[e>>2]=o|s,0|c&&He(),0==(32&o|0)?m:-1);return pt=n,0|l}(0|St[5],e,n),pt=t}(169,t)),B(0,0|d,0|D,(0|St[f>>2])+(0|St[E>>2])|0),P=D+y|0,C=g,I=T,L=0|St[i>>2]}if(L>>>0<=(D=v+1|0)>>>0){b=C;break e}k=C,w=I,y=P,v=D,M=0|St[h>>2],O=L}b=R}else b=0}while(0);Ge(b),or[3&St[e>>2]](a,0|St[f>>2]),$(s,a),oe(m),K(1),pt=r},_pthread_self:$e,_memset:Pt,_llvm_cttz_i32:qe,_malloc:Xe,_memcpy:Je,_bitshift64Lshr:Ct,_fflush:Ve,___udivdi3:Lt,___uremdi3:xt,___errno_location:vt,_bitshift64Shl:It,runPostSets:function(){},_emscripten_replace_memory:function(e){return!(16777215&c(e)||c(e)<=16777215||2147483648>2],e=-16&(r+e+15|0);if((HEAP32[DYNAMICTOP_PTR>>2]=e,TOTAL_MEMORY<=e)&&!enlargeMemory())return HEAP32[DYNAMICTOP_PTR>>2]=r,0;return r},alignMemory:function(e,r){return e=Math.ceil(e/(r||16))*(r||16)},makeBigInt:function(e,r,t){return t?+(e>>>0)+4294967296*(r>>>0):+(e>>>0)+4294967296*(0|r)},GLOBAL_BASE:8,QUANTUM_SIZE:4,__dummy__:0};Module.Runtime=Runtime;var ABORT=0,EXITSTATUS=0,cwrap,ccall;function assert(e,r){e||abort("Assertion failed: "+r)}function getCFunc(_0x5d9040){var _0x23b817=Module["_"+_0x5d9040];if(!_0x23b817)try{_0x23b817=eval("_"+_0x5d9040)}catch(_0x2989f0){}return assert(_0x23b817,"Cannot call unknown function "+_0x5d9040+" (perhaps LLVM optimizations or closure removed it?)"),_0x23b817}function setValue(e,r,t,n){switch("*"===(t=t||"i8").charAt(t.length-1)&&(t="i32"),t){case"i1":case"i8":HEAP8[e>>0]=r;break;case"i16":HEAP16[e>>1]=r;break;case"i32":HEAP32[e>>2]=r;break;case"i64":tempI64=[r>>>0,(tempDouble=r,1<=+Math_abs(tempDouble)?0>>0:~~+Math_ceil((tempDouble-(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[e>>2]=tempI64[0],HEAP32[e+4>>2]=tempI64[1];break;case"float":HEAPF32[e>>2]=r;break;case"double":HEAPF64[e>>3]=r;break;default:abort("invalid type for setValue: "+t)}}function getValue(e,r,t){switch("*"===(r=r||"i8").charAt(r.length-1)&&(r="i32"),r){case"i1":case"i8":return HEAP8[e>>0];case"i16":return HEAP16[e>>1];case"i32":case"i64":return HEAP32[e>>2];case"float":return HEAPF32[e>>2];case"double":return HEAPF64[e>>3];default:abort("invalid type for setValue: "+r)}return null}!function(){var _0x2ad24a={stackSave:function(){Runtime.stackSave()},stackRestore:function(){Runtime.stackRestore()},arrayToC:function(e){var r=Runtime.stackAlloc(e.length);return writeArrayToMemory(e,r),r},stringToC:function(e){var r,t=0;return null!=e&&0!==e&&(r=1+(e.length<<2),stringToUTF8(e,t=Runtime.stackAlloc(r),r)),t}},_0x3c7171={string:_0x2ad24a.stringToC,array:_0x2ad24a.arrayToC};ccall=function(e,r,t,n,o){var e=getCFunc(e),i=[],a=0;if(assert("array"!==r,'Return type should not be "array".'),n)for(var s=0;s>2]=0;for(u=s+i;n>0]=0;return s}if("i8"===a)return e.subarray||e.slice?HEAPU8.set(e,s):HEAPU8.set(new Uint8Array(e),s),s;for(var c,l,f,d=0;d>0],(0!=t||r)&&(o++,!r||o!=r););r=r||o;var i="";if(n<128){for(var a;0>0];if(!t)return r;r+=String.fromCharCode(t)}}function stringToAscii(e,r){return writeAsciiToMemory(e,r,!1)}Module.ALLOC_NORMAL=ALLOC_NORMAL,Module.ALLOC_STACK=ALLOC_STACK,Module.ALLOC_STATIC=ALLOC_STATIC,Module.ALLOC_DYNAMIC=ALLOC_DYNAMIC,Module.ALLOC_NONE=ALLOC_NONE,Module.allocate=allocate,Module.getMemory=getMemory,Module.Pointer_stringify=Pointer_stringify,Module.AsciiToString=AsciiToString,Module.stringToAscii=stringToAscii;var UTF8Decoder="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function UTF8ArrayToString(e,r){for(var t=r;e[t];)++t;if(16>10,56320|1023&o))):u+=String.fromCharCode((31&a)<<6|s)):u+=String.fromCharCode(a)}}function UTF8ToString(e){return UTF8ArrayToString(HEAPU8,e)}function stringToUTF8Array(e,r,t,n){if(!(0>6,r[t++]=128|63&s}else if(s<=65535){if(i<=t+2)break;r[t++]=224|s>>12,r[t++]=128|s>>6&63,r[t++]=128|63&s}else if(s<=2097151){if(i<=t+3)break;r[t++]=240|s>>18,r[t++]=128|s>>12&63,r[t++]=128|s>>6&63,r[t++]=128|63&s}else if(s<=67108863){if(i<=t+4)break;r[t++]=248|s>>24,r[t++]=128|s>>18&63,r[t++]=128|s>>12&63,r[t++]=128|s>>6&63,r[t++]=128|63&s}else{if(i<=t+5)break;r[t++]=252|s>>30,r[t++]=128|s>>24&63,r[t++]=128|s>>18&63,r[t++]=128|s>>12&63,r[t++]=128|s>>6&63,r[t++]=128|63&s}}return r[t]=0,t-o}function stringToUTF8(e,r,t){return assert("number"==typeof t,"stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),stringToUTF8Array(e,HEAPU8,r,t)}function lengthBytesUTF8(e){for(var r=0,t=0;t>2)-1]=34821223,HEAPU32[(STACK_MAX>>2)-2]=2310721022}function checkStackCookie(){if(34821223==HEAPU32[(STACK_MAX>>2)-1]&&2310721022==HEAPU32[(STACK_MAX>>2)-2]||abort("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x02135467, but received 0x"+HEAPU32[(STACK_MAX>>2)-2].toString(16)+" "+HEAPU32[(STACK_MAX>>2)-1].toString(16)),1668509029!==HEAP32[0])throw"Runtime error: The application has corrupted its heap memory area (address zero)!"}function abortStackOverflow(e){abort("Stack overflow! Attempted to allocate "+e+" bytes on the stack, but stack has only "+(STACK_MAX-Module.asm.stackSave()+e)+" bytes available!")}function abortOnCannotGrowMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+TOTAL_MEMORY+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or (4) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}function enlargeMemory(){assert(HEAP32[DYNAMICTOP_PTR>>2]>TOTAL_MEMORY);var e=Module.usingWasm?WASM_PAGE_SIZE:ASMJS_PAGE_SIZE,r=2147483648-e;if(HEAP32[DYNAMICTOP_PTR>>2]>r)return Module.printErr("Cannot enlarge memory, asked to go up to "+HEAP32[DYNAMICTOP_PTR>>2]+" bytes, but the limit is "+r+" bytes!"),!1;var t=TOTAL_MEMORY;for(TOTAL_MEMORY=Math.max(TOTAL_MEMORY,MIN_TOTAL_MEMORY);TOTAL_MEMORY>2];)TOTAL_MEMORY=TOTAL_MEMORY<=536870912?alignUp(2*TOTAL_MEMORY,e):Math.min(alignUp((3*TOTAL_MEMORY+2147483648)/4,e),r);var n=Date.now(),o=Module.reallocBuffer(TOTAL_MEMORY);return o&&o.byteLength==TOTAL_MEMORY?(updateGlobalBuffer(o),updateGlobalBufferViews(),Module.printErr("enlarged memory arrays from "+t+" to "+TOTAL_MEMORY+", took "+(Date.now()-n)+" ms (has ArrayBuffer.transfer? "+!!ArrayBuffer.transfer+")"),Module.usingWasm||Module.printErr("Warning: Enlarging memory arrays, this is not fast! "+[t,TOTAL_MEMORY]),!0):(Module.printErr("Failed to grow the heap from "+t+" bytes to "+TOTAL_MEMORY+" bytes, not enough memory!"),o&&Module.printErr("Expected to get back a buffer of size "+TOTAL_MEMORY+" bytes, but instead got back a buffer of size "+o.byteLength),TOTAL_MEMORY=t,!1)}STATIC_BASE=STATICTOP=STACK_BASE=STACKTOP=STACK_MAX=DYNAMIC_BASE=DYNAMICTOP_PTR=0,staticSealed=!1,Module.reallocBuffer||(Module.reallocBuffer=function(e){var r,t;try{ArrayBuffer.transfer?t=ArrayBuffer.transfer(buffer,e):(r=HEAP8,t=new ArrayBuffer(e),new Int8Array(t).set(r))}catch(e){return!1}return!!_emscripten_replace_memory(t)&&t});try{byteLength=Function.prototype.call.bind(Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength").get),byteLength(new ArrayBuffer(4))}catch(_0x5226f8){byteLength=function(e){return e.byteLength}}var TOTAL_STACK=Module.TOTAL_STACK||5242880,TOTAL_MEMORY=Module.TOTAL_MEMORY||16777216;function getTotalMemory(){return TOTAL_MEMORY}if(TOTAL_MEMORY>0]=e.charCodeAt(n);t||(HEAP8[r>>0]=0)}Module.addOnPreRun=addOnPreRun,Module.addOnInit=addOnInit,Module.addOnPreMain=addOnPreMain,Module.addOnExit=addOnExit,Module.addOnPostRun=addOnPostRun,Module.intArrayFromString=intArrayFromString,Module.intArrayToString=intArrayToString,Module.writeStringToMemory=writeStringToMemory,Module.writeArrayToMemory=writeArrayToMemory,Module.writeAsciiToMemory=writeAsciiToMemory,Math.imul&&-5===Math.imul(4294967295,5)||(Math.imul=function(e,r){var t=65535&e,n=65535&r;return t*n+((e>>>16)*n+t*(r>>>16)<<16)|0}),Math.imul=Math.imul,Math.clz32||(Math.clz32=function(e){e>>>=0;for(var r=0;r<32;r++)if(e&1<<31-r)return r;return 32}),Math.clz32=Math.clz32,Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Math.trunc=Math.trunc;var Math_abs=Math.abs,Math_cos=Math.cos,Math_sin=Math.sin,Math_tan=Math.tan,Math_acos=Math.acos,Math_asin=Math.asin,Math_atan=Math.atan,Math_atan2=Math.atan2,Math_exp=Math.exp,Math_log=Math.log,Math_sqrt=Math.sqrt,Math_ceil=Math.ceil,Math_floor=Math.floor,Math_pow=Math.pow,Math_imul=Math.imul,Math_fround=Math.fround,Math_round=Math.round,Math_min=Math.min,Math_clz32=Math.clz32,Math_trunc=Math.trunc,runDependencies=0,runDependencyWatcher=null,dependenciesFulfilled=null,runDependencyTracking={};function getUniqueRunDependency(e){for(var r=e;;){if(!runDependencyTracking[e])return e;e=r+Math.random()}return e}function addRunDependency(e){runDependencies++,Module.monitorRunDependencies&&Module.monitorRunDependencies(runDependencies),e?(assert(!runDependencyTracking[e]),runDependencyTracking[e]=1,null===runDependencyWatcher&&"undefined"!=typeof setInterval&&(runDependencyWatcher=setInterval(function(){if(ABORT)return clearInterval(runDependencyWatcher),void(runDependencyWatcher=null);var e,r=!1;for(e in runDependencyTracking)r||(r=!0,Module.printErr("still waiting on run dependencies:")),Module.printErr("dependency: "+e);r&&Module.printErr("(end of list)")},1e4))):Module.printErr("warning: run dependency added without ID")}function removeRunDependency(e){runDependencies--,Module.monitorRunDependencies&&Module.monitorRunDependencies(runDependencies),e?(assert(runDependencyTracking[e]),delete runDependencyTracking[e]):Module.printErr("warning: run dependency removed without ID"),0==runDependencies&&(null!==runDependencyWatcher&&(clearInterval(runDependencyWatcher),runDependencyWatcher=null),dependenciesFulfilled&&(e=dependenciesFulfilled,dependenciesFulfilled=null,e()))}Module.addRunDependency=addRunDependency,Module.removeRunDependency=removeRunDependency,Module.preloadedImages={},Module.preloadedAudios={};var ASM_CONSTS=[function(e,r,t){for(var n=new Uint8Array(r),o=0;o>2]=e:Module.printErr("failed to set errno from JS"),e}var PATH={splitPath:function(e){return/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1)},normalizeArray:function(e,r){for(var t=0,n=e.length-1;0<=n;n--){var o=e[n];"."===o?e.splice(n,1):".."===o?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:function(e){var r="/"===e.charAt(0),t="/"===e.substr(-1);return(e=PATH.normalizeArray(e.split("/").filter(function(e){return!!e}),!r).join("/"))||r||(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:function(e){var r=PATH.splitPath(e),e=r[0],r=r[1];return e||r?e+(r=r&&r.substr(0,r.length-1)):"."},basename:function(e){if("/"===e)return"/";var r=e.lastIndexOf("/");return-1===r?e:e.substr(r+1)},extname:function(e){return PATH.splitPath(e)[3]},join:function(){var e=Array.prototype.slice.call(arguments,0);return PATH.normalize(e.join("/"))},join2:function(e,r){return PATH.normalize(e+"/"+r)},resolve:function(){for(var e="",r=!1,t=arguments.length-1;-1<=t&&!r;t--){var n=0<=t?arguments[t]:FS.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,r="/"===n.charAt(0)}return(r?"/":"")+(e=PATH.normalizeArray(e.split("/").filter(function(e){return!!e}),!r).join("/"))||"."},relative:function(e,r){function t(e){for(var r=0;re.contents.length&&(e.contents=MEMFS.getFileDataAsRegularArray(e),e.usedBytes=e.contents.length),!e.contents||e.contents.subarray){var t=e.contents?e.contents.length:0;if(r<=t)return;r=Math.max(r,t*(t<1048576?2:1.125)|0),0!=t&&(r=Math.max(r,256));t=e.contents;return e.contents=new Uint8Array(r),void(0r)e.contents.length=r;else for(;e.contents.length=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-o,n);if(assert(0<=a),8t.timestamp)&&(a.push(e),i++)});var t=[];if(Object.keys(o.entries).forEach(function(e){o.entries[e];n.entries[e]||(t.push(e),i++)}),!i)return r(null);var s=0,e=("remote"===n.type?n:o).db.transaction([IDBFS.DB_STORE_NAME],"readwrite"),u=e.objectStore(IDBFS.DB_STORE_NAME);function c(e){return e?c.errored?void 0:(c.errored=!0,r(e)):++s>=i?r(null):void 0}e.onerror=function(e){c(this.error),e.preventDefault()},a.sort().forEach(function(t){"local"===o.type?IDBFS.loadRemoteEntry(u,t,function(e,r){return e?c(e):void IDBFS.storeLocalEntry(t,r,c)}):IDBFS.loadLocalEntry(t,function(e,r){return e?c(e):void IDBFS.storeRemoteEntry(u,t,r,c)})}),t.sort().reverse().forEach(function(e){"local"===o.type?IDBFS.removeLocalEntry(e,c):IDBFS.removeRemoteEntry(u,e,c)})}},NODEFS={isWindows:!1,staticInit:function(){NODEFS.isWindows=!!process.platform.match(/^win/)},mount:function(e){return assert(ENVIRONMENT_IS_NODE),NODEFS.createNode(null,"/",NODEFS.getMode(e.opts.root),0)},createNode:function(e,r,t,n){if(!FS.isDir(t)&&!FS.isFile(t)&&!FS.isLink(t))throw new FS.ErrnoError(ERRNO_CODES.EINVAL);t=FS.createNode(e,r,t);return t.node_ops=NODEFS.node_ops,t.stream_ops=NODEFS.stream_ops,t},getMode:function(e){var r;try{r=fs.lstatSync(e),NODEFS.isWindows&&(r.mode=r.mode|(146&r.mode)>>1)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return r.mode},realPath:function(e){for(var r=[];e.parent!==e;)r.push(e.name),e=e.parent;return r.push(e.mount.opts.root),r.reverse(),PATH.join.apply(null,r)},flagsToPermissionStringMap:{0:"r",1:"r+",2:"r+",64:"r",65:"r+",66:"r+",129:"rx+",193:"rx+",514:"w+",577:"w",578:"w+",705:"wx",706:"wx+",1024:"a",1025:"a",1026:"a+",1089:"a",1090:"a+",1153:"ax",1154:"ax+",1217:"ax",1218:"ax+",4096:"rs",4098:"rs+"},flagsToPermissionString:function(e){if(e&=-2097153,e&=-2049,e&=-32769,(e&=-524289)in NODEFS.flagsToPermissionStringMap)return NODEFS.flagsToPermissionStringMap[e];throw new FS.ErrnoError(ERRNO_CODES.EINVAL)},node_ops:{getattr:function(e){var r,t=NODEFS.realPath(e);try{r=fs.lstatSync(t)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return NODEFS.isWindows&&!r.blksize&&(r.blksize=4096),NODEFS.isWindows&&!r.blocks&&(r.blocks=(r.size+r.blksize-1)/r.blksize|0),{dev:r.dev,ino:r.ino,mode:r.mode,nlink:r.nlink,uid:r.uid,gid:r.gid,rdev:r.rdev,size:r.size,atime:r.atime,mtime:r.mtime,ctime:r.ctime,blksize:r.blksize,blocks:r.blocks}},setattr:function(e,r){var t,n=NODEFS.realPath(e);try{void 0!==r.mode&&(fs.chmodSync(n,r.mode),e.mode=r.mode),void 0!==r.timestamp&&(t=new Date(r.timestamp),fs.utimesSync(n,t,t)),void 0!==r.size&&fs.truncateSync(n,r.size)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},lookup:function(e,r){var t=PATH.join2(NODEFS.realPath(e),r),t=NODEFS.getMode(t);return NODEFS.createNode(e,r,t)},mknod:function(e,r,t,n){var o=NODEFS.createNode(e,r,t,n),i=NODEFS.realPath(o);try{FS.isDir(o.mode)?fs.mkdirSync(i,o.mode):fs.writeFileSync(i,"",{mode:o.mode})}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return o},rename:function(e,r,t){var n=NODEFS.realPath(e),o=PATH.join2(NODEFS.realPath(r),t);try{fs.renameSync(n,o)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},unlink:function(e,r){var t=PATH.join2(NODEFS.realPath(e),r);try{fs.unlinkSync(t)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},rmdir:function(e,r){var t=PATH.join2(NODEFS.realPath(e),r);try{fs.rmdirSync(t)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},readdir:function(e){var r=NODEFS.realPath(e);try{return fs.readdirSync(r)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},symlink:function(e,r,t){var n=PATH.join2(NODEFS.realPath(e),r);try{fs.symlinkSync(t,n)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},readlink:function(e){var r=NODEFS.realPath(e);try{return r=fs.readlinkSync(r),NODEJS_PATH.relative(NODEJS_PATH.resolve(e.mount.opts.root),r)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}},stream_ops:{open:function(e){var r=NODEFS.realPath(e.node);try{FS.isFile(e.node.mode)&&(e.nfd=fs.openSync(r,NODEFS.flagsToPermissionString(e.flags)))}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},close:function(e){try{FS.isFile(e.node.mode)&&e.nfd&&fs.closeSync(e.nfd)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},read:function(e,r,t,n,o){if(0===n)return 0;var i,a=new Buffer(n);try{i=fs.readSync(e.nfd,a,0,n,o)}catch(e){throw new FS.ErrnoError(ERRNO_CODES[e.code])}if(0=e.node.size)return 0;o=e.node.contents.slice(o,o+n),n=WORKERFS.reader.readAsArrayBuffer(o);return r.set(new Uint8Array(n),t),o.size},write:function(e,r,t,n,o){throw new FS.ErrnoError(ERRNO_CODES.EIO)},llseek:function(e,r,t){if(1===t?r+=e.position:2===t&&FS.isFile(e.node.mode)&&(r+=e.node.size),r<0)throw new FS.ErrnoError(ERRNO_CODES.EINVAL);return r}}};STATICTOP+=16,STATICTOP+=16,STATICTOP+=16;var FS={root:null,mounts:[],devices:[null],streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,trackingDelegate:{},tracking:{openFlags:{READ:1,WRITE:2}},ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,handleFSError:function(e){if(!(e instanceof FS.ErrnoError))throw e+" : "+stackTrace();return ___setErrNo(e.errno)},lookupPath:function(e,r){if(r=r||{},!(e=PATH.resolve(FS.cwd(),e)))return{path:"",node:null};var t,n={follow_mount:!0,recurse_count:0};for(t in n)void 0===r[t]&&(r[t]=n[t]);if(8>>0)%FS.nameTable.length},hashAddNode:function(e){var r=FS.hashName(e.parent.id,e.name);e.name_next=FS.nameTable[r],FS.nameTable[r]=e},hashRemoveNode:function(e){var r=FS.hashName(e.parent.id,e.name);if(FS.nameTable[r]===e)FS.nameTable[r]=e.name_next;else for(var t=FS.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode:function(e,r){var t=FS.mayLookup(e);if(t)throw new FS.ErrnoError(t,e);for(var t=FS.hashName(e.id,r),n=FS.nameTable[t];n;n=n.name_next){var o=n.name;if(n.parent.id===e.id&&o===r)return n}return FS.lookup(e,r)},createNode:function(e,r,t,n){FS.FSNode||(FS.FSNode=function(e,r,t,n){e=e||this,this.parent=e,this.mount=e.mount,this.mounted=null,this.id=FS.nextInode++,this.name=r,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=n},FS.FSNode.prototype={},Object.defineProperties(FS.FSNode.prototype,{read:{get:function(){return 365==(365&this.mode)},set:function(e){e?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146==(146&this.mode)},set:function(e){e?this.mode|=146:this.mode&=-147}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}}));n=new FS.FSNode(e,r,t,n);return FS.hashAddNode(n),n},destroyNode:function(e){FS.hashRemoveNode(e)},isRoot:function(e){return e===e.parent},isMountpoint:function(e){return!!e.mounted},isFile:function(e){return 32768==(61440&e)},isDir:function(e){return 16384==(61440&e)},isLink:function(e){return 40960==(61440&e)},isChrdev:function(e){return 8192==(61440&e)},isBlkdev:function(e){return 24576==(61440&e)},isFIFO:function(e){return 4096==(61440&e)},isSocket:function(e){return 49152==(49152&e)},flagModes:{r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218},modeStringToFlags:function(e){var r=FS.flagModes[e];if(void 0===r)throw new Error("Unknown file open mode: "+e);return r},flagsToPermissionString:function(e){var r=["r","w","rw"][3&e];return 512&e&&(r+="w"),r},nodePermissions:function(e,r){return FS.ignorePermissions||(-1===r.indexOf("r")||292&e.mode)&&(-1===r.indexOf("w")||146&e.mode)&&(-1===r.indexOf("x")||73&e.mode)?0:ERRNO_CODES.EACCES},mayLookup:function(e){var r=FS.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:ERRNO_CODES.EACCES)},mayCreate:function(e,r){try{FS.lookupNode(e,r);return ERRNO_CODES.EEXIST}catch(e){}return FS.nodePermissions(e,"wx")},mayDelete:function(e,r,t){var n;try{n=FS.lookupNode(e,r)}catch(e){return e.errno}var o=FS.nodePermissions(e,"wx");if(o)return o;if(t){if(!FS.isDir(n.mode))return ERRNO_CODES.ENOTDIR;if(FS.isRoot(n)||FS.getPath(n)===FS.cwd())return ERRNO_CODES.EBUSY}else if(FS.isDir(n.mode))return ERRNO_CODES.EISDIR;return 0},mayOpen:function(e,r){return e?FS.isLink(e.mode)?ERRNO_CODES.ELOOP:FS.isDir(e.mode)&&("r"!==FS.flagsToPermissionString(r)||512&r)?ERRNO_CODES.EISDIR:FS.nodePermissions(e,FS.flagsToPermissionString(r)):ERRNO_CODES.ENOENT},MAX_OPEN_FDS:4096,nextfd:function(e,r){e=e||0,r=r||FS.MAX_OPEN_FDS;for(var t=e;t<=r;t++)if(!FS.streams[t])return t;throw new FS.ErrnoError(ERRNO_CODES.EMFILE)},getStream:function(e){return FS.streams[e]},createStream:function(e,r,t){FS.FSStream||(FS.FSStream=function(){},FS.FSStream.prototype={},Object.defineProperties(FS.FSStream.prototype,{object:{get:function(){return this.node},set:function(e){this.node=e}},isRead:{get:function(){return 1!=(2097155&this.flags)}},isWrite:{get:function(){return 0!=(2097155&this.flags)}},isAppend:{get:function(){return 1024&this.flags}}}));var n,o=new FS.FSStream;for(n in e)o[n]=e[n];e=o;t=FS.nextfd(r,t);return e.fd=t,FS.streams[t]=e},closeStream:function(e){FS.streams[e]=null},chrdev_stream_ops:{open:function(e){var r=FS.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek:function(){throw new FS.ErrnoError(ERRNO_CODES.ESPIPE)}},major:function(e){return e>>8},minor:function(e){return 255&e},makedev:function(e,r){return e<<8|r},registerDevice:function(e,r){FS.devices[e]={stream_ops:r}},getDevice:function(e){return FS.devices[e]},getMounts:function(e){for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push.apply(t,n.mounts)}return r},syncfs:function(r,t){"function"==typeof r&&(t=r,r=!1),FS.syncFSRequests++,1=n.length&&i(null)}n.forEach(function(e){return e.type.syncfs?void e.type.syncfs(e,r,a):a(null)})},mount:function(e,r,t){var n="/"===t,o=!t;if(n&&FS.root)throw new FS.ErrnoError(ERRNO_CODES.EBUSY);if(!n&&!o){var i=FS.lookupPath(t,{follow_mount:!1});if(t=i.path,i=i.node,FS.isMountpoint(i))throw new FS.ErrnoError(ERRNO_CODES.EBUSY);if(!FS.isDir(i.mode))throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR)}t={type:e,opts:r,mountpoint:t,mounts:[]},e=e.mount(t);return(e.mount=t).root=e,n?FS.root=e:i&&(i.mounted=t,i.mount&&i.mount.mounts.push(t)),e},unmount:function(e){var r=FS.lookupPath(e,{follow_mount:!1});if(!FS.isMountpoint(r.node))throw new FS.ErrnoError(ERRNO_CODES.EINVAL);var e=r.node,r=e.mounted,n=FS.getMounts(r);Object.keys(FS.nameTable).forEach(function(e){for(var r=FS.nameTable[e];r;){var t=r.name_next;-1!==n.indexOf(r.mount)&&FS.destroyNode(r),r=t}}),e.mounted=null;r=e.mount.mounts.indexOf(r);assert(-1!==r),e.mount.mounts.splice(r,1)},lookup:function(e,r){return e.node_ops.lookup(e,r)},mknod:function(e,r,t){var n=FS.lookupPath(e,{parent:!0}).node,o=PATH.basename(e);if(!o||"."===o||".."===o)throw new FS.ErrnoError(ERRNO_CODES.EINVAL);e=FS.mayCreate(n,o);if(e)throw new FS.ErrnoError(e);if(!n.node_ops.mknod)throw new FS.ErrnoError(ERRNO_CODES.EPERM);return n.node_ops.mknod(n,o,r,t)},create:function(e,r){return r=void 0!==r?r:438,r&=4095,r|=32768,FS.mknod(e,r,0)},mkdir:function(e,r){return r=void 0!==r?r:511,r&=1023,r|=16384,FS.mknod(e,r,0)},mkdirTree:function(e,r){for(var t=e.split("/"),n="",o=0;othis.length-1||e<0)){var r=e%this.chunkSize,e=e/this.chunkSize|0;return this.getter(e)[r]}},o.prototype.setDataGetter=function(e){this.getter=e},o.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",a,!1),e.send(null),!(200<=e.status&&e.status<300||304===e.status))throw new Error("Couldn't load "+a+". Status: "+e.status);var n=Number(e.getResponseHeader("Content-length")),r=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,t=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,o=1048576;r||(o=n);var i=this;i.setDataGetter(function(e){var r=e*o,t=(e+1)*o-1,t=Math.min(t,n-1);if(void 0===i.chunks[e]&&(i.chunks[e]=function(e,r){if(r=i.length)return 0;var a=Math.min(i.length-o,n);if(assert(0<=a),i.slice)for(var s=0;s>2]=n.dev,HEAP32[t+4>>2]=0,HEAP32[t+8>>2]=n.ino,HEAP32[t+12>>2]=n.mode,HEAP32[t+16>>2]=n.nlink,HEAP32[t+20>>2]=n.uid,HEAP32[t+24>>2]=n.gid,HEAP32[t+28>>2]=n.rdev,HEAP32[t+32>>2]=0,HEAP32[t+36>>2]=n.size,HEAP32[t+40>>2]=4096,HEAP32[t+44>>2]=n.blocks,HEAP32[t+48>>2]=n.atime.getTime()/1e3|0,HEAP32[t+52>>2]=0,HEAP32[t+56>>2]=n.mtime.getTime()/1e3|0,HEAP32[t+60>>2]=0,HEAP32[t+64>>2]=n.ctime.getTime()/1e3|0,HEAP32[t+68>>2]=0,HEAP32[t+72>>2]=n.ino,0},doMsync:function(e,r,t,n){e=new Uint8Array(HEAPU8.subarray(e,e+t));FS.msync(r,e,0,t,n)},doMkdir:function(e,r){return"/"===(e=PATH.normalize(e))[e.length-1]&&(e=e.substr(0,e.length-1)),FS.mkdir(e,r,0),0},doMknod:function(e,r,t){switch(61440&r){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-ERRNO_CODES.EINVAL}return FS.mknod(e,r,t),0},doReadlink:function(e,r,t){if(t<=0)return-ERRNO_CODES.EINVAL;var n=FS.readlink(e),o=Math.min(t,lengthBytesUTF8(n)),e=HEAP8[r+o];return stringToUTF8(n,r,t+1),HEAP8[r+o]=e,o},doAccess:function(e,r){if(-8&r)return-ERRNO_CODES.EINVAL;var t=FS.lookupPath(e,{follow:!0}).node,e="";return 4&r&&(e+="r"),2&r&&(e+="w"),1&r&&(e+="x"),e&&FS.nodePermissions(t,e)?-ERRNO_CODES.EACCES:0},doDup:function(e,r,t){var n=FS.getStream(t);return n&&FS.close(n),FS.open(e,r,0,t,t).fd},doReadv:function(e,r,t,n){for(var o=0,i=0;i>2],s=HEAP32[r+(8*i+4)>>2],a=FS.read(e,HEAP8,a,s,n);if(a<0)return-1;if(o+=a,a>2],s=HEAP32[r+(8*i+4)>>2],s=FS.write(e,HEAP8,a,s,n);if(s<0)return-1;o+=s}return o},varargs:0,get:function(e){return SYSCALLS.varargs+=4,HEAP32[SYSCALLS.varargs-4>>2]},getStr:function(){return Pointer_stringify(SYSCALLS.get())},getStreamFromFD:function(){var e=FS.getStream(SYSCALLS.get());if(!e)throw new FS.ErrnoError(ERRNO_CODES.EBADF);return e},getSocketFromFD:function(){var e=SOCKFS.getSocket(SYSCALLS.get());if(!e)throw new FS.ErrnoError(ERRNO_CODES.EBADF);return e},getSocketAddress:function(e){var r=SYSCALLS.get(),t=SYSCALLS.get();if(e&&0===r)return null;t=__read_sockaddr(r,t);if(t.errno)throw new FS.ErrnoError(t.errno);return t.addr=DNS.lookup_addr(t.addr)||t.addr,t},get64:function(){var e=SYSCALLS.get(),r=SYSCALLS.get();return assert(0<=e?0===r:-1===r),e},getZero:function(){assert(0===SYSCALLS.get())}};function ___syscall5(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStr(),n=SYSCALLS.get(),o=SYSCALLS.get();return FS.open(t,n,o).fd}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function ___lock(){}function ___unlock(){}function ___syscall6(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStreamFromFD();return FS.close(t),0}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}var cttz_i8=allocate([8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0],"i8",ALLOC_STATIC),fs,NODEJS_PATH;function _emscripten_memcpy_big(e,r,t){return HEAPU8.set(HEAPU8.subarray(r,r+t),e),e}function ___syscall140(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStreamFromFD(),n=(SYSCALLS.get(),SYSCALLS.get()),o=SYSCALLS.get(),i=SYSCALLS.get(),n=n;return FS.llseek(t,n,i),HEAP32[o>>2]=t.position,t.getdents&&0===n&&0===i&&(t.getdents=null),0}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function ___syscall146(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStreamFromFD(),n=SYSCALLS.get(),o=SYSCALLS.get();return SYSCALLS.doWritev(t,n,o)}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function ___syscall54(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStreamFromFD(),n=SYSCALLS.get();switch(n){case 21505:case 21506:return t.tty?0:-ERRNO_CODES.ENOTTY;case 21519:if(!t.tty)return-ERRNO_CODES.ENOTTY;var o=SYSCALLS.get();return HEAP32[o>>2]=0;case 21520:return t.tty?-ERRNO_CODES.EINVAL:-ERRNO_CODES.ENOTTY;case 21531:o=SYSCALLS.get();return FS.ioctl(t,n,o);case 21523:return t.tty?0:-ERRNO_CODES.ENOTTY;default:abort("bad ioctl syscall "+n)}}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function ___syscall221(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStreamFromFD();switch(SYSCALLS.get()){case 0:return(n=SYSCALLS.get())<0?-ERRNO_CODES.EINVAL:FS.open(t.path,t.flags,0,n).fd;case 1:case 2:return 0;case 3:return t.flags;case 4:var n=SYSCALLS.get();return t.flags|=n,0;case 12:case 12:n=SYSCALLS.get();return HEAP16[n+0>>1]=2,0;case 13:case 14:case 13:case 14:return 0;case 16:case 8:return-ERRNO_CODES.EINVAL;case 9:return ___setErrNo(ERRNO_CODES.EINVAL),-1;default:return-ERRNO_CODES.EINVAL}}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function ___syscall145(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStreamFromFD(),n=SYSCALLS.get(),o=SYSCALLS.get();return SYSCALLS.doReadv(t,n,o)}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function nullFunc_ii(e){Module.printErr("Invalid function pointer called with signature 'ii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"),Module.printErr("Build with ASSERTIONS=2 for more info."),abort(e)}function nullFunc_iiii(e){Module.printErr("Invalid function pointer called with signature 'iiii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"),Module.printErr("Build with ASSERTIONS=2 for more info."),abort(e)}function invoke_ii(e,r){try{return Module.dynCall_ii(e,r)}catch(e){if("number"!=typeof e&&"longjmp"!==e)throw e;Module.setThrew(1,0)}}function invoke_iiii(e,r,t,n){try{return Module.dynCall_iiii(e,r,t,n)}catch(e){if("number"!=typeof e&&"longjmp"!==e)throw e;Module.setThrew(1,0)}}FS.staticInit(),__ATINIT__.unshift(function(){Module.noFSInit||FS.init.initialized||FS.init()}),__ATMAIN__.push(function(){FS.ignorePermissions=!1}),__ATEXIT__.push(function(){FS.quit()}),Module.FS_createFolder=FS.createFolder,Module.FS_createPath=FS.createPath,Module.FS_createDataFile=FS.createDataFile,Module.FS_createPreloadedFile=FS.createPreloadedFile,Module.FS_createLazyFile=FS.createLazyFile,Module.FS_createLink=FS.createLink,Module.FS_createDevice=FS.createDevice,Module.FS_unlink=FS.unlink,__ATINIT__.unshift(function(){TTY.init()}),__ATEXIT__.push(function(){TTY.shutdown()}),ENVIRONMENT_IS_NODE&&(fs=require("fs"),NODEJS_PATH=require("path"),NODEFS.staticInit()),DYNAMICTOP_PTR=allocate(1,"i32",ALLOC_STATIC),STACK_BASE=STACKTOP=Runtime.alignMemory(STATICTOP),STACK_MAX=STACK_BASE+TOTAL_STACK,DYNAMIC_BASE=Runtime.alignMemory(STACK_MAX),HEAP32[DYNAMICTOP_PTR>>2]=DYNAMIC_BASE,staticSealed=!0,assert(DYNAMIC_BASE=(0|Je)&&Qe(48);n=t+32|0,o=t+16|0,i=t,s=0|Le(3788,0|Xe[r>>0],4)?(a=0|function(e){var r=0,t=0,n=0,o=0;return r=0==(0|G(e=e|0,43)),t=0|Xe[e>>0],n=r?t<<24>>24!=114&1:2,r=0==(0|G(e,120)),o=r?n:128|n,n=0==(0|G(e,101)),e=n?o:524288|o,o=t<<24>>24==114?e:64|e,e=t<<24>>24==119?512|o:o,0|(t<<24>>24==97?1024|e:e)}(r),Ge[i>>2]=e,Ge[i+4>>2]=32768|a,Ge[i+8>>2]=438,e=0|U(0|A(5,0|i)),0<=(0|e)?(524288&a|0&&(Ge[o>>2]=e,Ge[o+4>>2]=2,Ge[o+8>>2]=1,M(221,0|o)),(o=0|function(e,r){e|=0,r|=0;var t=0,n=0,o=0,i=0,a=0,s=0,u=0,c=0,l=0,f=0,d=0,E=0,S=0;(0|(Ze=(t=Ze)+64|0))>=(0|Je)&&Qe(64);if(n=t+40|0,o=t+24|0,i=t+16|0,s=(a=t)+56|0,0|Le(3788,(u=0|Xe[r>>0])<<24>>24,4))if(c=0|x(1156)){for(f=c,d=f+124|0;Ge[f>>2]=0,f=f+4|0,(0|f)<(0|d););0|G(r,43)||(Ge[c>>2]=u<<24>>24==114?8:4),E=0|G(r,101)?(Ge[a>>2]=e,Ge[a+4>>2]=2,Ge[a+8>>2]=1,M(221,0|a),0|Xe[r>>0]):u,S=E<<24>>24==97?(Ge[i>>2]=e,Ge[4+i>>2]=3,1024&(E=0|M(221,0|i))||(Ge[o>>2]=e,Ge[o+4>>2]=4,Ge[o+8>>2]=1024|E,M(221,0|o)),o=128|Ge[c>>2],Ge[c>>2]=o):0|Ge[c>>2],Ge[c+60>>2]=e,Ge[c+44>>2]=c+132,Ge[c+48>>2]=1024,Xe[(o=c+75|0)>>0]=-1,0==(8&S|0)&&(Ge[n>>2]=e,Ge[4+n>>2]=21523,Ge[8+n>>2]=s,0==(0|T(54,0|n)))&&(Xe[o>>0]=10),Ge[c+32>>2]=4,Ge[c+36>>2]=3,Ge[c+40>>2]=2,Ge[c+12>>2]=1,0|Ge[1073]||(Ge[c+76>>2]=-1),function(e){e|=0;var r=0,t=0;r=0|Q(),Ge[e+56>>2]=Ge[r>>2],0|(t=0|Ge[r>>2])&&(Ge[52+t>>2]=e),Ge[r>>2]=e,$()}(c),l=c}else l=0;else Ge[(c=652)>>2]=22,l=0;return Ze=t,0|l}(e,r))||(Ge[n>>2]=e,y(6,0|n),0)):0):(Ge[(o=652)>>2]=22,0);return Ze=t,0|s}(e|=0,964);do{if(0|s){if(o=s,a=2,function(e,r,t){r|=0,t|=0;var n=0,o=0;-1<(0|Ge[76+(e|=0)>>2])?(n=0==(0|V()),o=0|ne(e,r,t),n||K()):ne(e,r,t)}(o|=i=0,i|=0,a|=0),e=0|(i=s,0|function(e){var r=0,t=0,n=0;n=-1<(0|Ge[76+(e|=0)>>2])?(r=0==(0|V()),t=0|oe(e),r||K(),t):0|oe(e);return 0|n}(i|=0)),a=s,i=void 0,-1<((i=0)|Ge[76+(a|=0)>>2])?(i=0==(0|V()),ne(a,0,0),Ge[a>>2]=-33&Ge[a>>2],i||K()):(ne(a,0,0),Ge[a>>2]=-33&Ge[a>>2]),t=0|x(e+1|0))return(0|(n=0|function(e,r,t,n){e|=0,n|=0;var o=0,i=0,a=0,s=0,u=0,c=0,l=0,f=0,d=0,E=0;o=0|Ne(t|=0,r|=0),i=0==(0|r)?0:t,a=-1<(0|Ge[n+76>>2])?0|V():0;s=0|Xe[(t=n+74|0)>>0],Xe[t>>0]=s+255|s,t=0|Ge[(s=n+4|0)>>2],u=(0|Ge[n+8>>2])-t|0,c=u>>>0>>0?u:o,f=0<(0|u)?(tr(0|e,0|t,0|c),Ge[s>>2]=t+c,l=o-c|0,e+c|0):(l=o,e);e:do{if(l){for(e=n+32|0,c=l,t=f;!(0|function(e){var r=0,t=0,n=0;t=0|Xe[(r=74+(e|=0)|0)>>0],Xe[r>>0]=255+t|t,r=e+28|0,(0|Ge[(t=e+20|0)>>2])>>>0>(0|Ge[r>>2])>>>0&&de[7&Ge[e+36>>2]](e,0,0);Ge[e+16>>2]=0,Ge[r>>2]=0,Ge[t>>2]=0,n=4&(t=0|Ge[e>>2])?(Ge[e>>2]=32|t,-1):(r=(0|Ge[e+44>>2])+(0|Ge[e+48>>2])|0,Ge[e+8>>2]=r,Ge[e+4>>2]=r,t<<27>>31);return 0|n}(n)||((s=0|de[7&Ge[e>>2]](n,t,c))+1|0)>>>0<2);){if(!(u=c-s|0)){d=13;break e}c=u,t=t+s|0}0|a&&K(),E=((o-c|0)>>>0)/(r>>>0)|0}else d=13}while(0);13==(0|d)&&(E=(a&&K(),i));return 0|E}(t,1,e,s)))<(0|e)&&ae(1256),Ge[r>>2]=t,Xe[t+e>>0]=0,ee(s),0|n;ae(1230),ee(s);break}}while(0);return(Ge[r>>2]=0)|-1}function N(e,r){e|=0,r|=0;var t,n,o,i,a,s,u,c,l,f,d,E,S,_,m,h,p,F,M,b=0,y=0,O=0,w=0,R=0,A=0,k=0,T=0,g=0,v=0,N=0,D=0;if((0|Je)<=(0|(Ze=(r=Ze)+4192|0))&&Qe(4192),t=r+32|0,n=r+24|0,o=r+16|0,i=r+8|0,a=(b=r)+40|0,u=r+88|0,((Ge[(s=r+36|0)>>2]=0)|(c=0|I(e,s)))<22)return Ge[b>>2]=182,ie(967,b),B(0|Ge[s>>2]),Ze=r,0;b=c-22|0;e:do{if(22<(0|b)){for(y=(e=0|Ge[s>>2])+c|0,O=b;101010256!=((0|qe[(A=(R=(w=e+O|0)+1|0)+1|0)+1>>0])<<24|((0|qe[A>>0])<<16|((0|qe[R>>0])<<8|0|qe[w>>0]))|0)||(w+22+((0|qe[(R=w+20|0)+1>>0])<<8|0|qe[R>>0])|0)!=(0|y);)if((0|(O=O+-1|0))<=22)break e;if(A=e+((0|qe[(R=(y=(O=w+16|0)+1|0)+1|0)+1>>0])<<24|((0|qe[R>>0])<<16|((0|qe[y>>0])<<8|0|qe[O>>0])))|0,33639248==((0|qe[A+3>>0])<<24|((0|qe[A+2>>0])<<16|((0|qe[A+1>>0])<<8|0|qe[A>>0]))|0))for(O=A,y=0;;){if(R=((0|qe[O+27>>0])<<24|((0|qe[O+26>>0])<<16|((0|qe[O+25>>0])<<8|0|qe[O+24>>0])))+y|0,O=O+(46+((0|qe[O+29>>0])<<8|0|qe[O+28>>0])+((0|qe[O+31>>0])<<8|0|qe[O+30>>0])+((0|qe[O+33>>0])<<8|0|qe[O+32>>0]))|0,33639248!=((0|qe[O+3>>0])<<24|((0|qe[O+2>>0])<<16|((0|qe[O+1>>0])<<8|0|qe[O>>0]))|0)){k=R;break}y=R}else k=0;y=4+a|0,O=12+a|0,R=16+a|0;r:do{if(33639248==((0|qe[A+3>>0])<<24|((0|qe[A+2>>0])<<16|((0|qe[A+1>>0])<<8|0|qe[A>>0]))|0)){for(T=0,g=A;v=0|Xe[g+10>>0],N=0|Xe[g+11>>0],l=(0|qe[g+19>>0])<<24|((0|qe[g+18>>0])<<16|((0|qe[g+17>>0])<<8|0|qe[g+16>>0])),f=(0|qe[g+23>>0])<<24|((0|qe[g+22>>0])<<16|((0|qe[g+21>>0])<<8|0|qe[g+20>>0])),d=(0|qe[g+27>>0])<<24|((0|qe[g+26>>0])<<16|((0|qe[g+25>>0])<<8|0|qe[g+24>>0])),E=(0|qe[g+29>>0])<<8|0|qe[g+28>>0],S=(0|qe[g+33>>0])<<8|0|qe[g+32>>0],_=(0|qe[g+31>>0])<<8|0|qe[g+30>>0],er(0|u,0,4096),!(4095>>0);){switch(tr(0|u,g+46|0,0|E),p=28+(m=e+((0|qe[g+45>>0])<<24|((0|qe[g+44>>0])<<16|((0|qe[g+43>>0])<<8|0|qe[g+42>>0])))|0)|0,F=30+m+((0|qe[1+(h=26+m|0)>>0])<<8|0|qe[h>>0])+((0|qe[1+p>>0])<<8|0|qe[p>>0])|0,(65535&((255&N)<<8|255&v))<<16>>16){case 0:P(0,0|u,0|d,0|F),D=15;break;case 8:D=15}if(15==(0|D)&&(D=0)|(v=0|x(d))){for(N=a,p=N+48|0;N=N+4|(Ge[N>>2]=0),(0|N)<(0|p););do{if(!(0|function(e,r){e|=0,r|=0;var t=0,n=0,o=0,i=0,a=0,s=0;(0|(Ze=(t=Ze)+16|0))>=(0|Je)&&Qe(16);if(n=t+12|0,i=t+4|0,Ge[(o=(a=t)+8|0)>>2]=e,Ge[i>>2]=r,!(0|Ge[o>>2]))return Ge[n>>2]=-2,s=0|Ge[n>>2],Ze=t,0|s;if(15!=(0|Ge[i>>2])&&15!=(0-(0|Ge[i>>2])|0))return Ge[n>>2]=-1e4,s=0|Ge[n>>2],Ze=t,0|s;return Ge[36+(0|Ge[o>>2])>>2]=0,Ge[40+(0|Ge[o>>2])>>2]=0,Ge[24+(0|Ge[o>>2])>>2]=0,Ge[8+(0|Ge[o>>2])>>2]=0,Ge[20+(0|Ge[o>>2])>>2]=0,Ge[44+(0|Ge[o>>2])>>2]=0,r=0|x(43784),Ge[a>>2]=r,Ze=(s=(0|Ge[a>>2]?(Ge[28+(0|Ge[o>>2])>>2]=Ge[a>>2],Ge[Ge[a>>2]>>2]=0,Ge[10992+(0|Ge[a>>2])>>2]=0,Ge[10996+(0|Ge[a>>2])>>2]=0,Ge[43780+(0|Ge[a>>2])>>2]=1,Ge[11e3+(0|Ge[a>>2])>>2]=1,Ge[11004+(0|Ge[a>>2])>>2]=0,Ge[11008+(0|Ge[a>>2])>>2]=Ge[i>>2],Ge[n>>2]=0):Ge[n>>2]=-4,0|Ge[n>>2]),t),0|s}(a,-15))){if(Ge[a>>2]=F,Ge[y>>2]=f,Ge[O>>2]=v,Ge[R>>2]=d,N=1==(0|function(e,r,t,n){e|=0,r|=0,t|=0,n|=0;var o=0,i=0,a=0,s=0,u=0,c=0,l=0,f=0,d=0,E=0,S=0,_=0,m=0,h=0,p=0,F=0,M=0,b=0;(0|(Ze=(o=Ze)+64|0))>=(0|Je)&&Qe(64);if(i=o+48|0,s=o+40|0,u=o+36|0,c=o+32|0,l=o+28|0,f=o+24|0,d=o+20|0,E=o+16|0,S=o+12|0,_=o+8|0,m=o+4|0,Ge[(a=(h=o)+44|0)>>2]=e,Ge[s>>2]=r,Ge[u>>2]=t,Ge[c>>2]=n,Ge[E>>2]=8,0|Ge[a>>2]&&0|Ge[28+(0|Ge[a>>2])>>2]){if(1==(0|Ge[s>>2])&&(Ge[s>>2]=2),0!=(0|Ge[s>>2])&2!=(0|Ge[s>>2])&4!=(0|Ge[s>>2]))return Ge[i>>2]=-2,p=0|Ge[i>>2],Ze=o,0|p;if(Ge[l>>2]=Ge[28+(0|Ge[a>>2])>>2],0<(0|Ge[11008+(0|Ge[l>>2])>>2])&&(Ge[E>>2]=1|Ge[E>>2]),Ge[m>>2]=Ge[4+(0|Ge[a>>2])>>2],Ge[d>>2]=Ge[11e3+(0|Ge[l>>2])>>2],((Ge[11e3+(0|Ge[l>>2])>>2]=0)|Ge[43780+(0|Ge[l>>2])>>2])<0)return Ge[i>>2]=-3,p=0|Ge[i>>2],Ze=o,0|p;if(4!=(0|Ge[s>>2])&&0!=(0|Ge[11004+(0|Ge[l>>2])>>2]))return Ge[i>>2]=-2,p=0|Ge[i>>2],Ze=o,0|p;if(n=11004+(0|Ge[l>>2])|0,Ge[n>>2]=Ge[n>>2]|4==(0|Ge[s>>2]),4==(0|Ge[s>>2])&0!=(0|Ge[d>>2]))return Ge[E>>2]=4|Ge[E>>2],Ge[S>>2]=Ge[4+(0|Ge[a>>2])>>2],Ge[_>>2]=Ge[16+(0|Ge[a>>2])>>2],d=0|L(0|Ge[l>>2],0|Ge[Ge[a>>2]>>2],S,0|Ge[12+(0|Ge[a>>2])>>2],0|Ge[12+(0|Ge[a>>2])>>2],_,0|Ge[E>>2],0|Ge[u>>2],0|Ge[c>>2]),Ge[h>>2]=d,Ge[43780+(0|Ge[l>>2])>>2]=Ge[h>>2],d=0|Ge[a>>2],Ge[d>>2]=(0|Ge[d>>2])+(0|Ge[S>>2]),d=4+(0|Ge[a>>2])|0,Ge[d>>2]=(0|Ge[d>>2])-(0|Ge[S>>2]),d=8+(0|Ge[a>>2])|0,Ge[d>>2]=(0|Ge[d>>2])+(0|Ge[S>>2]),Ge[40+(0|Ge[a>>2])>>2]=Ge[28+(0|Ge[l>>2])>>2],d=12+(0|Ge[a>>2])|0,Ge[d>>2]=(0|Ge[d>>2])+(0|Ge[_>>2]),d=16+(0|Ge[a>>2])|0,Ge[d>>2]=(0|Ge[d>>2])-(0|Ge[_>>2]),d=20+(0|Ge[a>>2])|0,Ge[d>>2]=(0|Ge[d>>2])+(0|Ge[_>>2]),Ze=(p=((0|Ge[h>>2])<0?Ge[i>>2]=-3:0|Ge[h>>2]?(Ge[43780+(0|Ge[l>>2])>>2]=-1,Ge[i>>2]=-5):Ge[i>>2]=1,0|Ge[i>>2]),o),0|p;if(4!=(0|Ge[s>>2])&&(Ge[E>>2]=2|Ge[E>>2]),0|Ge[10996+(0|Ge[l>>2])>>2])return Ge[f>>2]=Ge[((0|Ge[10996+(0|Ge[l>>2])>>2])>>>0<(0|Ge[16+(0|Ge[a>>2])>>2])>>>0?10996+(0|Ge[l>>2])|0:16+(0|Ge[a>>2])|0)>>2],tr(0|Ge[12+(0|Ge[a>>2])>>2],11012+(0|Ge[l>>2])+(0|Ge[10992+(0|Ge[l>>2])>>2])|0,0|Ge[f>>2]),d=12+(0|Ge[a>>2])|0,Ge[d>>2]=(0|Ge[d>>2])+(0|Ge[f>>2]),d=16+(0|Ge[a>>2])|0,Ge[d>>2]=(0|Ge[d>>2])-(0|Ge[f>>2]),d=20+(0|Ge[a>>2])|0,Ge[d>>2]=(0|Ge[d>>2])+(0|Ge[f>>2]),d=10996+(0|Ge[l>>2])|0,Ge[d>>2]=(0|Ge[d>>2])-(0|Ge[f>>2]),Ge[10992+(0|Ge[l>>2])>>2]=(0|Ge[10992+(0|Ge[l>>2])>>2])+(0|Ge[f>>2])&32767,F=0|Ge[43780+(0|Ge[l>>2])>>2]?0:0!=(0|Ge[10996+(0|Ge[l>>2])>>2])^1,Ge[i>>2]=F?1:0,p=0|Ge[i>>2],Ze=o,0|p;for(;;){if(Ge[S>>2]=Ge[4+(0|Ge[a>>2])>>2],Ge[_>>2]=32768-(0|Ge[10992+(0|Ge[l>>2])>>2]),F=0|L(0|Ge[l>>2],0|Ge[Ge[a>>2]>>2],S,11012+(0|Ge[l>>2])|0,11012+(0|Ge[l>>2])+(0|Ge[10992+(0|Ge[l>>2])>>2])|0,_,0|Ge[E>>2],0|Ge[u>>2],0|Ge[c>>2]),Ge[h>>2]=F,Ge[43780+(0|Ge[l>>2])>>2]=Ge[h>>2],F=0|Ge[a>>2],Ge[F>>2]=(0|Ge[F>>2])+(0|Ge[S>>2]),F=4+(0|Ge[a>>2])|0,Ge[F>>2]=(0|Ge[F>>2])-(0|Ge[S>>2]),F=8+(0|Ge[a>>2])|0,Ge[F>>2]=(0|Ge[F>>2])+(0|Ge[S>>2]),Ge[40+(0|Ge[a>>2])>>2]=Ge[28+(0|Ge[l>>2])>>2],Ge[10996+(0|Ge[l>>2])>>2]=Ge[_>>2],Ge[f>>2]=Ge[((0|Ge[10996+(0|Ge[l>>2])>>2])>>>0<(0|Ge[16+(0|Ge[a>>2])>>2])>>>0?10996+(0|Ge[l>>2])|0:16+(0|Ge[a>>2])|0)>>2],tr(0|Ge[12+(0|Ge[a>>2])>>2],11012+(0|Ge[l>>2])+(0|Ge[10992+(0|Ge[l>>2])>>2])|0,0|Ge[f>>2]),F=12+(0|Ge[a>>2])|0,Ge[F>>2]=(0|Ge[F>>2])+(0|Ge[f>>2]),F=16+(0|Ge[a>>2])|0,Ge[F>>2]=(0|Ge[F>>2])-(0|Ge[f>>2]),F=20+(0|Ge[a>>2])|0,Ge[F>>2]=(0|Ge[F>>2])+(0|Ge[f>>2]),F=10996+(0|Ge[l>>2])|0,Ge[F>>2]=(0|Ge[F>>2])-(0|Ge[f>>2]),Ge[10992+(0|Ge[l>>2])>>2]=(0|Ge[10992+(0|Ge[l>>2])>>2])+(0|Ge[f>>2])&32767,(0|Ge[h>>2])<0){M=27;break}if(!(1!=(0|Ge[h>>2])|0!=(0|Ge[m>>2]))){M=29;break}if(F=0==(0|Ge[h>>2]),4==(0|Ge[s>>2])){if(F){M=32;break}if(0|Ge[16+(0|Ge[a>>2])>>2])continue;M=34;break}if(F){M=39;break}if(!(0|Ge[4+(0|Ge[a>>2])>>2])){M=39;break}if(!(0|Ge[16+(0|Ge[a>>2])>>2])){M=39;break}if(0|Ge[10996+(0|Ge[l>>2])>>2]){M=39;break}}if(27==(0|M))return Ge[i>>2]=-3,p=0|Ge[i>>2],Ze=o,0|p;if(29==(0|M))return Ge[i>>2]=-5,p=0|Ge[i>>2],Ze=o,0|p;if(32==(0|M))return Ge[i>>2]=0|Ge[10996+(0|Ge[l>>2])>>2]?-5:1,p=0|Ge[i>>2],Ze=o,0|p;if(34==(0|M))return Ge[i>>2]=-5,p=0|Ge[i>>2],Ze=o,0|p;if(39==(0|M))return b=0|Ge[h>>2]?0:0!=(0|Ge[10996+(0|Ge[l>>2])>>2])^1,Ge[i>>2]=b?1:0,p=0|Ge[i>>2],Ze=o,0|p}return Ge[i>>2]=-2,p=0|Ge[i>>2],Ze=o,0|p}(a,4,k,T)),function(e){e|=0;var r=0,t=0,n=0;if((0|(Ze=(r=Ze)+16|0))>=(0|Je)&&Qe(16),t=r+4|0,Ge[(n=r)>>2]=e,!(0|Ge[n>>2]))return Ge[t>>2]=-2,Ge[t>>2],Ze=r;0|Ge[28+(0|Ge[n>>2])>>2]&&(B(0|Ge[28+(0|Ge[n>>2])>>2]),Ge[28+(0|Ge[n>>2])>>2]=0),Ge[t>>2]=0,Ge[t>>2],Ze=r}(a),!N){B(v);break}if((0|(N=0|function(e,r,t){e|=0,r|=0,t|=0;var n=0,o=0,i=0,a=0,s=0,u=0,c=0,l=0,f=0;(0|(Ze=(n=Ze)+32|0))>=(0|Je)&&Qe(32);if(o=n+20|0,a=n+12|0,s=n+8|0,u=n+4|0,l=(c=n)+24|0,Ge[(i=n+16|0)>>2]=e,Ge[a>>2]=r,Ge[s>>2]=t,Ge[u>>2]=Ge[a>>2],Ge[c>>2]=Ge[i>>2],!(0|Ge[u>>2]))return Ge[o>>2]=0,f=0|Ge[o>>2],Ze=n,0|f;Ge[c>>2]=~Ge[c>>2];for(;i=0|Ge[s>>2],Ge[s>>2]=i-1,i;)i=0|Ge[u>>2],Ge[u>>2]=1+i,Xe[l>>0]=0|Xe[i>>0],Ge[c>>2]=(0|Ge[c>>2])>>>4^Ge[8+((15&Ge[c>>2]^15&(0|qe[l>>0]))<<2)>>2],Ge[c>>2]=(0|Ge[c>>2])>>>4^Ge[8+((15&Ge[c>>2]^(0|qe[l>>0])>>4)<<2)>>2];return Ge[o>>2]=~Ge[c>>2],f=0|Ge[o>>2],Ze=n,0|f}(0,v,d)))==(0|l)){P(0,0|u,0|d,0|v),B(v);break}Ge[o>>2]=N,Ge[4+o>>2]=l,ie(1175,o),B(v);break}}while(B(v),0)}if(M=10,function(e,r){var t=0,n=0,o=0,i=0,a=0,s=0;n=t=255&(e|=0),0<=(0|Ge[76+(r|=0)>>2])&&0!=(0|V())?(a=(0|n)!=(0|Xe[r+75>>0])&&(i=0|Ge[(o=r+20|0)>>2])>>>0<(0|Ge[r+16>>2])>>>0?(Ge[o>>2]=i+1,Xe[i>>0]=t,n):0|J(r,e),K()):s=3;do{if(3==(0|s)){if((0|n)!=(0|Xe[r+75>>0])&&(i=0|Ge[(a=r+20|0)>>2])>>>0<(0|Ge[r+16>>2])>>>0){Ge[a>>2]=i+1,Xe[i>>0]=t,0;break}J(r,e)}}while(0)}(M|=0,0|Ge[208]),33639248!=((0|qe[(g=g+(46+E+_+S)|0)+3>>0])<<24|((0|qe[g+2>>0])<<16|((0|qe[g+1>>0])<<8|0|qe[g>>0]))|0))break r;T=d+T|0}return Ge[n>>2]=240,ie(967,n),B(0|Ge[s>>2]),Ze=r,0}}while(0);return C(1),Ge[t>>2]=307,ie(967,t),B(0|Ge[s>>2]),Ze=r,0}}while(0);return Ge[i>>2]=188,ie(967,i),B(0|Ge[s>>2]),Ze=r,0}function L(e,r,t,n,o,i,a,s,u){e|=0,r|=0,t|=0,n|=0,o|=0,i|=0,a|=0,s|=0,u|=0;var c,l,f,d,E,S,_,m,h,p,F,M,b,y,O,w,R,A,k,T,g,v,N,D,P,C,I,L,x,B,H,U,Y,z,V,K,W,X,j,G,q,Z,J,Q,$,ee,re,te,ne,oe,ie,ae,se,ue,ce,le,fe,de,Ee,Se,_e,me,he,pe,Fe,Me,be,ye,Oe,we,Re,Ae,ke,Te=0,ge=0,ve=0,Ne=0,De=0,Pe=0,Ce=0,Ie=0,Le=0,xe=0,Be=0,He=0,Ue=0,Ye=0,ze=0,Ve=0,Ke=0,We=Ze;if((0|Je)<=(0|(Ze=Ze+432|0))&&Qe(432),c=We+416|0,f=We+408|0,d=We+404|0,E=We+400|0,Te=We+396|0,S=We+392|0,_=We+388|0,m=We+384|0,h=We+380|0,p=We+376|0,F=We+372|0,M=We+368|0,b=We+364|0,y=We+360|0,O=We+356|0,w=We+352|0,R=We+348|0,A=We+344|0,k=We+340|0,T=We+336|0,g=We+332|0,v=We+328|0,N=We+324|0,D=We+320|0,P=We+316|0,C=We+312|0,I=We+308|0,L=We+304|0,x=We+300|0,B=We+296|0,H=We+292|0,U=We+288|0,Y=We+284|0,z=We+280|0,V=We+276|0,K=We+272|0,W=We+268|0,X=We+264|0,j=We+260|0,G=We+192|0,q=We+128|0,Z=We+120|0,J=We+116|0,Q=We+112|0,$=We+108|0,ee=We+420|0,re=We+104|0,te=We+100|0,ne=We+96|0,oe=We+92|0,ie=We+88|0,ae=We+84|0,se=We+80|0,ue=We+76|0,ce=We+72|0,le=We+68|0,fe=We+64|0,de=We+60|0,Ee=We+56|0,Se=We+52|0,_e=We+48|0,me=We+44|0,he=We+40|0,pe=We+36|0,Fe=We+32|0,Me=We+28|0,be=We+24|0,ye=We+20|0,Oe=We+16|0,we=We+12|0,Re=We+8|0,Ae=We+4|0,Ge[(l=(ke=We)+412|0)>>2]=e,Ge[f>>2]=r,Ge[d>>2]=t,Ge[E>>2]=n,Ge[Te>>2]=o,Ge[S>>2]=i,Ge[_>>2]=a,Ge[m>>2]=s,Ge[h>>2]=u,Ge[p>>2]=-1,Ge[w>>2]=Ge[f>>2],Ge[R>>2]=(0|Ge[f>>2])+(0|Ge[Ge[d>>2]>>2]),Ge[A>>2]=Ge[Te>>2],Ge[k>>2]=(0|Ge[Te>>2])+(0|Ge[Ge[S>>2]>>2]),ge=4&Ge[_>>2]|0?-1:(0|Ge[Te>>2])-(0|Ge[E>>2])+(0|Ge[Ge[S>>2]>>2])-1|0,Ge[T>>2]=ge,0==(1+(0|Ge[T>>2])&Ge[T>>2]|0)&&(0|Ge[Te>>2])>>>0>=(0|Ge[E>>2])>>>0){switch(Ge[F>>2]=Ge[4+(0|Ge[l>>2])>>2],Ge[O>>2]=Ge[56+(0|Ge[l>>2])>>2],Ge[M>>2]=Ge[32+(0|Ge[l>>2])>>2],Ge[b>>2]=Ge[36+(0|Ge[l>>2])>>2],Ge[y>>2]=Ge[40+(0|Ge[l>>2])>>2],Ge[g>>2]=Ge[60+(0|Ge[l>>2])>>2],0|Ge[Ge[l>>2]>>2]){case 0:Ge[12+(0|Ge[l>>2])>>2]=0,Ge[8+(0|Ge[l>>2])>>2]=0,Ge[y>>2]=0,Ge[b>>2]=0,Ge[M>>2]=0,Ge[F>>2]=0,Ge[O>>2]=0,Ge[28+(0|Ge[l>>2])>>2]=1,ve=(Ge[16+(0|Ge[l>>2])>>2]=1)&Ge[_>>2]|0?(0|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0?9:(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ne=0|qe[ge>>0],De=0|Ge[l>>2],15):31;break;case 1:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ne=0|qe[ge>>0],De=0|Ge[l>>2],15):9;break;case 2:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Pe=0|Ge[l>>2],Ce=0|qe[ge>>0],22):16;break;case 36:ve=30;break;case 3:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[v>>2]=qe[ge>>0],39):33;break;case 5:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[N>>2]=qe[ge>>0],49):43;break;case 6:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[D>>2]=qe[ge>>0],61):55;break;case 7:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ie=0|Xe[ge>>0],Le=0|Ge[b>>2],xe=0|Ge[l>>2],70):64;break;case 39:ve=73;break;case 51:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[P>>2]=qe[ge>>0],83):77;break;case 52:ve=85;break;case 9:ve=89;break;case 38:ve=91;break;case 40:ve=94;break;case 10:ve=100;break;case 11:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[x>>2]=qe[ge>>0],121):115;break;case 14:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[H>>2]=qe[ge>>0],133):127;break;case 35:ve=144;break;case 16:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[oe>>2]=qe[ge>>0],185):179;break;case 17:ve=194;break;case 18:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[ie>>2]=qe[ge>>0],203):197;break;case 21:ve=208;break;case 23:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[ce>>2]=qe[ge>>0],231):225;break;case 24:ve=238;break;case 25:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[Ee>>2]=qe[ge>>0],267):261;break;case 26:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[me>>2]=qe[ge>>0],286):280;break;case 27:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[pe>>2]=qe[ge>>0],301):295;break;case 37:ve=305;break;case 53:ve=308;break;case 32:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[Fe>>2]=qe[ge>>0],326):320;break;case 41:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[be>>2]=qe[ge>>0],338):332;break;case 42:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[Me>>2]=qe[ge>>0],347):341;break;case 34:ve=348;break;default:ve=350}do{if(9==(0|ve)){if(2&Ge[_>>2]|0){Be=Ge[p>>2]=1,He=0|Ge[l>>2],ve=349;break}De=(Ne=0)|Ge[l>>2],ve=15;break}}while(0);15==(0|ve)&&(Ge[De+8>>2]=Ne,ve=(0|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0?16:(Ne=0|Ge[w>>2],Ge[w>>2]=Ne+1,Pe=0|Ge[l>>2],Ce=0|qe[Ne>>0],22));do{if(16==(0|ve)){if(2&Ge[_>>2]|0){Ge[p>>2]=1,He=0|Ge[l>>(Be=2)],ve=349;break}Pe=0|Ge[l>>2],Ce=0,ve=22;break}}while(0);22==(0|ve)&&(Ge[Pe+12>>2]=Ce,Ue=(((Ge[8+(0|Ge[l>>2])>>2]<<8)+(0|Ge[12+(0|Ge[l>>2])>>2])|0)>>>0)%31|0||32&Ge[12+(0|Ge[l>>2])>>2]|0?1:8!=(15&Ge[8+(0|Ge[l>>2])>>2]|0),Ge[b>>2]=1&Ue,4&Ge[_>>2]||(Ye=32768<1<<8+((0|Ge[8+(0|Ge[l>>2])>>2])>>>4)>>>0?1:(1+(0|Ge[T>>2])|0)>>>0<1<<8+((0|Ge[8+(0|Ge[l>>2])>>2])>>>4)>>>0,Ge[b>>2]=Ge[b>>2]|1&Ye),ve=0|Ge[b>>2]?30:31),30==(0|ve)&&(Ge[p>>2]=-1,Be=36,He=0|Ge[l>>2],ve=349);e:for(;;){switch(0|ve){case 31:$e(2,((ve=0)|Ge[h>>2])+(0|Ge[g>>2])|0,0|Ge[m>>2]),ve=(0|Ge[F>>2])>>>0<3?32:40;break;case 33:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=3,He=0|Ge[l>>2],ve=349;continue e}Ge[v>>2]=0,ve=39;continue e;case 39:ve=0,Ge[O>>2]=Ge[O>>2]|Ge[v>>2]<>2],Ge[F>>2]=8+(0|Ge[F>>2]),ve=(0|Ge[F>>2])>>>0<3?32:40;break;case 43:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=5,He=0|Ge[l>>2],ve=349;continue e}Ge[N>>2]=0,ve=49;continue e;case 49:ve=0,Ge[O>>2]=Ge[O>>2]|Ge[N>>2]<>2],Ge[F>>2]=8+(0|Ge[F>>2]),ve=(0|Ge[F>>2])>>>0<(7&Ge[F>>2])>>>0?42:50;break;case 55:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=6,He=0|Ge[l>>2],ve=349;continue e}Ge[D>>2]=0,ve=61;continue e;case 61:ve=0,Ge[O>>2]=Ge[O>>2]|Ge[D>>2]<>2],Ge[F>>2]=8+(0|Ge[F>>2]),ve=(0|Ge[F>>2])>>>0<8?54:62;break;case 64:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=7,He=0|Ge[l>>2],ve=349;continue e}Le=(Ie=0)|Ge[b>>2],xe=0|Ge[l>>2],ve=70;continue e;case 70:Xe[xe+10528+Le>>(ve=0)]=Ie,ve=71;break;case 73:ve=0,Ge[p>>2]=-1,Be=39,He=0|Ge[l>>2],ve=349;continue e;case 77:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=51,He=0|Ge[l>>2],ve=349;continue e}Ge[P>>2]=0,ve=83;continue e;case 83:ve=0,Ge[O>>2]=Ge[O>>2]|Ge[P>>2]<>2],Ge[F>>2]=8+(0|Ge[F>>2]),ve=(0|Ge[F>>2])>>>0<8?76:84;break;case 85:if(((ve=0)|Ge[A>>2])>>>0>=(0|Ge[k>>2])>>>0){Ge[p>>2]=2,Be=52,He=0|Ge[l>>2],ve=349;continue e}Ye=255&Ge[M>>2],Ue=0|Ge[A>>2],Ge[A>>2]=Ue+1,Xe[Ue>>0]=Ye,Ge[b>>2]=(0|Ge[b>>2])-1,ve=74;break;case 89:if(((ve=0)|Ge[A>>2])>>>0<(0|Ge[k>>2])>>>0){ve=91;continue e}Ge[p>>2]=2,Be=9,He=0|Ge[l>>2],ve=349;continue e;case 91:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){if(!(2&Ge[_>>2])){ve=94;continue e}Ge[p>>2]=1,Be=38,He=0|Ge[l>>2],ve=349;continue e}ze=(((Ye=((0|Ge[k>>2])-(0|Ge[A>>2])|0)>>>0<((0|Ge[R>>2])-(0|Ge[w>>2])|0)>>>0)?0|Ge[k>>2]:0|Ge[R>>2])-(Ye?0|Ge[A>>2]:0|Ge[w>>2])|0)>>>0<(0|Ge[b>>2])>>>0?((Ye=((0|Ge[k>>2])-(0|Ge[A>>2])|0)>>>0<((0|Ge[R>>2])-(0|Ge[w>>2])|0)>>>0)?0|Ge[k>>2]:0|Ge[R>>2])-(Ye?0|Ge[A>>2]:0|Ge[w>>2])|0:0|Ge[b>>2],Ge[C>>2]=ze,tr(0|Ge[A>>2],0|Ge[w>>2],0|Ge[C>>2]),Ge[w>>2]=(0|Ge[w>>2])+(0|Ge[C>>2]),Ge[A>>2]=(0|Ge[A>>2])+(0|Ge[C>>2]),Ge[b>>2]=(0|Ge[b>>2])-(0|Ge[C>>2]),ve=88;break;case 94:ve=0,Ge[p>>2]=-1,Be=40,He=0|Ge[l>>2],ve=349;continue e;case 100:ve=0,Ge[p>>2]=-1,Be=10,He=0|Ge[l>>2],ve=349;continue e;case 115:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=11,He=0|Ge[l>>2],ve=349;continue e}Ge[x>>2]=0,ve=121;continue e;case 121:ve=0,Ge[O>>2]=Ge[O>>2]|Ge[x>>2]<>2],Ge[F>>2]=8+(0|Ge[F>>2]),ve=(0|Ge[F>>2])>>>0<(0|Xe[1331+(0|Ge[b>>2])>>0])>>>0?114:122;break;case 127:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=14,He=0|Ge[l>>2],ve=349;continue e}Ge[H>>2]=0,ve=133;continue e;case 133:ve=0,Ge[O>>2]=Ge[O>>2]|Ge[H>>2]<>2],Ge[F>>2]=8+(0|Ge[F>>2]),ve=(0|Ge[F>>2])>>>0<3?126:134;break;case 144:ve=0,Ge[p>>2]=-1,Be=35,He=0|Ge[l>>2],ve=349;continue e;case 179:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=16,He=0|Ge[l>>2],ve=349;continue e}Ge[oe>>2]=0,ve=185;continue e;case 185:ve=0,Ge[O>>2]=Ge[O>>2]|Ge[oe>>2]<>2],Ge[F>>2]=8+(0|Ge[F>>2]),ve=(0|Ge[F>>2])>>>0<15?170:187;break;case 194:ve=0,Ge[p>>2]=-1,Be=17,He=0|Ge[l>>2],ve=349;continue e;case 197:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=18,He=0|Ge[l>>2],ve=349;continue e}Ge[ie>>2]=0,ve=203;continue e;case 203:ve=0,Ge[O>>2]=Ge[O>>2]|Ge[ie>>2]<>2],Ge[F>>2]=8+(0|Ge[F>>2]),ve=(0|Ge[F>>2])>>>0<(0|Ge[y>>2])>>>0?196:204;break;case 208:ve=0,Ge[p>>2]=-1,Be=21,He=0|Ge[l>>2],ve=349;continue e;case 225:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=23,He=0|Ge[l>>2],ve=349;continue e}Ge[ce>>2]=0,ve=231;continue e;case 231:ve=0,Ge[O>>2]=Ge[O>>2]|Ge[ce>>2]<>2],Ge[F>>2]=8+(0|Ge[F>>2]),ve=(0|Ge[F>>2])>>>0<15?216:233;break;case 238:if(((ve=0)|Ge[A>>2])>>>0>=(0|Ge[k>>2])>>>0){Ge[p>>2]=2,Be=24,He=0|Ge[l>>2],ve=349;continue e}Ye=255&Ge[b>>2],Ue=0|Ge[A>>2],Ge[A>>2]=Ue+1,Xe[Ue>>0]=Ye,ve=212;break;case 261:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=25,He=0|Ge[l>>2],ve=349;continue e}Ge[Ee>>2]=0,ve=267;continue e;case 267:ve=0,Ge[O>>2]=Ge[O>>2]|Ge[Ee>>2]<>2],Ge[F>>2]=8+(0|Ge[F>>2]),ve=(0|Ge[F>>2])>>>0<(0|Ge[y>>2])>>>0?260:268;break;case 280:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=26,He=0|Ge[l>>2],ve=349;continue e}Ge[me>>2]=0,ve=286;continue e;case 286:ve=0,Ge[O>>2]=Ge[O>>2]|Ge[me>>2]<>2],Ge[F>>2]=8+(0|Ge[F>>2]),ve=(0|Ge[F>>2])>>>0<15?271:288;break;case 295:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=27,He=0|Ge[l>>2],ve=349;continue e}Ge[pe>>2]=0,ve=301;continue e;case 301:ve=0,Ge[O>>2]=Ge[O>>2]|Ge[pe>>2]<>2],Ge[F>>2]=8+(0|Ge[F>>2]),ve=(0|Ge[F>>2])>>>0<(0|Ge[y>>2])>>>0?294:302;break;case 305:ve=0,Ge[p>>2]=-1,Be=37,He=0|Ge[l>>2],ve=349;continue e;case 308:if(((ve=0)|Ge[A>>2])>>>0>=(0|Ge[k>>2])>>>0){Ge[p>>2]=2,Be=53,He=0|Ge[l>>2],ve=349;continue e}Ye=0|Ge[g>>2],Ge[g>>2]=Ye+1,Ue=0|Xe[(0|Ge[E>>2])+(Ye-(0|Ge[M>>2])&Ge[T>>2])>>0],Ye=0|Ge[A>>2],Ge[A>>2]=Ye+1,Xe[Ye>>0]=Ue,ve=307;break;case 320:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=32,He=0|Ge[l>>2],ve=349;continue e}Ge[Fe>>2]=0,ve=326;continue e;case 326:ve=0,Ge[O>>2]=Ge[O>>2]|Ge[Fe>>2]<>2],Ge[F>>2]=8+(0|Ge[F>>2]),ve=(0|Ge[F>>2])>>>0<(7&Ge[F>>2])>>>0?319:327;break;case 332:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=41,He=0|Ge[l>>2],ve=349;continue e}Ge[be>>2]=0,ve=338;continue e;case 338:ve=0,Ge[O>>2]=Ge[O>>2]|Ge[be>>2]<>2],Ge[F>>2]=8+(0|Ge[F>>2]),ve=(0|Ge[F>>2])>>>0<8?331:339;break;case 341:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=42,He=0|Ge[l>>2],ve=349;continue e}Ge[Me>>2]=0,ve=347;continue e;case 347:Ge[16+((ve=0)|Ge[l>>2])>>2]=Ge[16+(0|Ge[l>>2])>>2]<<8|Ge[Me>>2],Ge[b>>2]=1+(0|Ge[b>>2]),ve=328;break;case 348:ve=0,Be=34,He=(Ge[p>>2]=0)|Ge[l>>2],ve=349;continue e;case 349:ve=0,Ge[He>>2]=Be,ve=350;continue e;case 350:if(Ge[4+((ve=0)|Ge[l>>2])>>2]=Ge[F>>2],Ge[56+(0|Ge[l>>2])>>2]=Ge[O>>2],Ge[32+(0|Ge[l>>2])>>2]=Ge[M>>2],Ge[36+(0|Ge[l>>2])>>2]=Ge[b>>2],Ge[40+(0|Ge[l>>2])>>2]=Ge[y>>2],Ge[60+(0|Ge[l>>2])>>2]=Ge[g>>2],Ge[Ge[d>>2]>>2]=(0|Ge[w>>2])-(0|Ge[f>>2]),Ge[Ge[S>>2]>>2]=(0|Ge[A>>2])-(0|Ge[Te>>2]),0!=(9&Ge[_>>2]|0)&0<=(0|Ge[p>>2])){ve=351;break e}break e}if(32!=(0|ve)){r:do{if(40==(0|ve)){if(Ge[20+((ve=0)|Ge[l>>2])>>2]=7&Ge[O>>2],Ge[O>>2]=(0|Ge[O>>2])>>>3,Ge[F>>2]=(0|Ge[F>>2])-3,Ge[24+(0|Ge[l>>2])>>2]=(0|Ge[20+(0|Ge[l>>2])>>2])>>>1,!(0|Ge[24+(0|Ge[l>>2])>>2])){if((0|Ge[F>>2])>>>0<(7&Ge[F>>2])>>>0){ve=42;break}ve=50;break}if(3==(0|Ge[24+(0|Ge[l>>2])>>2])){ve=100;continue e}if(1!=(0|Ge[24+(0|Ge[l>>2])>>2])){Ge[b>>2]=0,ve=112;break}for(Ge[I>>2]=64+(0|Ge[l>>2]),Ge[44+(0|Ge[l>>2])>>2]=288,Ge[44+(0|Ge[l>>2])+4>>2]=32,Ue=64+(0|Ge[l>>2])+3488|0,Ge[Ue>>2]=84215045,Ge[Ue+4>>2]=84215045,Ge[Ue+8>>2]=84215045,Ge[Ue+12>>2]=84215045,Ge[Ue+16>>2]=84215045,Ge[Ue+20>>2]=84215045,Ge[Ue+24>>2]=84215045,Ge[Ue+28>>2]=84215045,Ge[L>>2]=0;!(143<(0|Ge[L>>2])>>>0);)Ue=0|Ge[I>>2],Ge[I>>2]=Ue+1,Xe[Ue>>0]=8,Ge[L>>2]=1+(0|Ge[L>>2]);for(;!(255<(0|Ge[L>>2])>>>0);)Ue=0|Ge[I>>2],Ge[I>>2]=Ue+1,Xe[Ue>>0]=9,Ge[L>>2]=1+(0|Ge[L>>2]);for(;!(279<(0|Ge[L>>2])>>>0);)Ue=0|Ge[I>>2],Ge[I>>2]=Ue+1,Xe[Ue>>0]=7,Ge[L>>2]=1+(0|Ge[L>>2]);for(;;){if(287<(0|Ge[L>>2])>>>0){ve=136;break r}Ue=0|Ge[I>>2],Ge[I>>2]=Ue+1,Xe[Ue>>0]=8,Ge[L>>2]=1+(0|Ge[L>>2])}}}while(0);if(42!=(0|ve)){50==(0|ve)&&(ve=0,Ge[O>>2]=(0|Ge[O>>2])>>>(7&Ge[F>>2]),Ge[F>>2]=(0|Ge[F>>2])-(7&Ge[F>>2]),Ge[b>>2]=0,ve=51);r:for(;;){switch(0|ve){case 51:if(4<=((ve=0)|Ge[b>>2])>>>0){if(Ue=qe[10528+(0|Ge[l>>2])>>0]|qe[10528+(0|Ge[l>>2])+1>>0]<<8,(0|(Ge[b>>2]=Ue))!=(65535^(qe[10528+(0|Ge[l>>2])+2>>0]|qe[10528+(0|Ge[l>>2])+3>>0]<<8)|0)){ve=73;continue e}ve=74;continue r}if(!(0|Ge[F>>2])){ve=63;break r}if((0|Ge[F>>2])>>>0<8){ve=54;continue r}ve=62;continue r;case 54:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){ve=55;continue e}ve=60;break r;case 62:Xe[10528+((ve=0)|Ge[l>>2])+(0|Ge[b>>2])>>0]=Ge[O>>2],Ge[O>>2]=(0|Ge[O>>2])>>>8,Ge[F>>2]=(0|Ge[F>>2])-8,ve=71;continue r;case 71:ve=0,Ge[b>>2]=1+(0|Ge[b>>2]),ve=51;continue r;case 74:if(!((ve=0)|Ge[b>>2]&&0!=(0|Ge[F>>2]))){ve=88;continue r}if((0|Ge[F>>2])>>>0<8){ve=76;continue r}ve=84;continue r;case 76:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){ve=77;continue e}ve=82;break r;case 84:ve=0,Ge[M>>2]=255&Ge[O>>2],Ge[O>>2]=(0|Ge[O>>2])>>>8,Ge[F>>2]=(0|Ge[F>>2])-8,ve=85;continue e;case 88:if((ve=0)|Ge[b>>2]){ve=89;continue e}ve=316;break;case 112:if(((ve=0)|Ge[b>>2])>>>0<3){if((0|Ge[F>>2])>>>0<(0|Xe[1331+(0|Ge[b>>2])>>0])>>>0){ve=114;continue r}ve=122;continue r}er(64+(0|Ge[l>>2])+6976|0,0,288),Ge[b>>2]=0,ve=124;break;case 114:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){ve=115;continue e}ve=120;break r;case 122:Ge[44+((ve=0)|Ge[l>>2])+(Ge[b>>2]<<2)>>2]=Ge[O>>2]&(1<>2])>>0])-1,Ge[O>>2]=(0|Ge[O>>2])>>>(0|Xe[1331+(0|Ge[b>>2])>>0]),Ge[F>>2]=(0|Ge[F>>2])-(0|Xe[1331+(0|Ge[b>>2])>>0]),Ue=44+(0|Ge[l>>2])+(Ge[b>>2]<<2)|0,Ge[Ue>>2]=(0|Ge[Ue>>2])+(0|Ge[72+(Ge[b>>2]<<2)>>2]),Ge[b>>2]=1+(0|Ge[b>>2]),ve=112;continue r;case 126:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){ve=127;continue e}ve=132;break r;case 134:ve=0,Ge[B>>2]=7&Ge[O>>2],Ge[O>>2]=(0|Ge[O>>2])>>>3,Ge[F>>2]=(0|Ge[F>>2])-3,Xe[64+(0|Ge[l>>2])+6976+(0|qe[1335+(0|Ge[b>>2])>>0])>>0]=Ge[B>>2],Ge[b>>2]=1+(0|Ge[b>>2]),ve=124;break;case 136:if((ve=0)<=(0|Ge[24+(0|Ge[l>>2])>>2])){for(Ge[z>>2]=64+(0|Ge[l>>2])+(3488*(0|Ge[24+(0|Ge[l>>2])>>2])|0),Ue=q,Ye=Ue+64|0;Ue=Ue+4|(Ge[Ue>>2]=0),(0|Ue)<(0|Ye););for(er(288+(0|Ge[z>>2])|0,0,2048),er(2336+(0|Ge[z>>2])|0,0,1152),Ge[V>>2]=0;!((0|Ge[V>>2])>>>0>=(0|Ge[44+(0|Ge[l>>2])+(Ge[24+(0|Ge[l>>2])>>2]<<2)>>2])>>>0);)Ue=q+(qe[(0|Ge[z>>2])+(0|Ge[V>>2])>>0]<<2)|0,Ge[Ue>>2]=1+(0|Ge[Ue>>2]),Ge[V>>2]=1+(0|Ge[V>>2]);for(Ge[W>>2]=0,Ge[X>>2]=0,Ge[4+G>>2]=0,Ge[G>>2]=0,Ge[V>>2]=1;!(15<(0|Ge[V>>2])>>>0);)Ge[W>>2]=(0|Ge[W>>2])+(0|Ge[q+(Ge[V>>2]<<2)>>2]),Ue=(0|Ge[X>>2])+(0|Ge[q+(Ge[V>>2]<<2)>>2])<<1,Ge[X>>2]=Ue,Ge[G+(1+(0|Ge[V>>2])<<2)>>2]=Ue,Ge[V>>2]=1+(0|Ge[V>>2]);if(65536!=(0|Ge[X>>2])&1<(0|Ge[W>>2])>>>0){ve=144;continue e}for(Ge[U>>2]=-1,Ge[j>>2]=0;!((0|Ge[j>>2])>>>0>=(0|Ge[44+(0|Ge[l>>2])+(Ge[24+(0|Ge[l>>2])>>2]<<2)>>2])>>>0);){Ge[Z>>2]=0,Ge[$>>2]=qe[(0|Ge[z>>2])+(0|Ge[j>>2])>>0];t:do{if(0|Ge[$>>2]){for(Ue=G+(Ge[$>>2]<<2)|0,Ye=0|Ge[Ue>>2],Ge[Ue>>2]=Ye+1,Ge[Q>>2]=Ye,Ge[J>>2]=Ge[$>>2];!((0|Ge[J>>2])>>>0<=0);)Ge[Z>>2]=Ge[Z>>2]<<1|1&Ge[Q>>2],Ge[J>>2]=(0|Ge[J>>2])-1,Ge[Q>>2]=(0|Ge[Q>>2])>>>1;if((0|Ge[$>>2])>>>0<=10)for(je[ee>>1]=Ge[$>>2]<<9|Ge[j>>2];;){if(1024<=(0|Ge[Z>>2])>>>0)break t;je[288+(0|Ge[z>>2])+(Ge[Z>>2]<<1)>>1]=0|je[ee>>1],Ge[Z>>2]=(0|Ge[Z>>2])+(1<>2])}for(Ye=0|je[288+(0|Ge[z>>2])+((1023&Ge[Z>>2])<<1)>>1],(Ge[Y>>2]=Ye)||(je[288+(0|Ge[z>>2])+((1023&Ge[Z>>2])<<1)>>1]=Ge[U>>2],Ge[Y>>2]=Ge[U>>2],Ge[U>>2]=(0|Ge[U>>2])-2),Ge[Z>>2]=(0|Ge[Z>>2])>>>9,Ge[K>>2]=Ge[$>>2];Ye=11<(0|Ge[K>>2])>>>0,Ue=(0|Ge[Z>>2])>>>1,Ge[Z>>2]=Ue,Ge[Y>>2]=(0|Ge[Y>>2])-(1&Ue),Ye;)0|je[2336+(0|Ge[z>>2])+(0-(0|Ge[Y>>2])-1<<1)>>1]?Ge[Y>>2]=je[2336+(0|Ge[z>>2])+(0-(0|Ge[Y>>2])-1<<1)>>1]:(je[2336+(0|Ge[z>>2])+(0-(0|Ge[Y>>2])-1<<1)>>1]=Ge[U>>2],Ge[Y>>2]=Ge[U>>2],Ge[U>>2]=(0|Ge[U>>2])-2),Ge[K>>2]=(0|Ge[K>>2])-1;je[2336+(0|Ge[z>>2])+(0-(0|Ge[Y>>2])-1<<1)>>1]=Ge[j>>2]}}while(0);Ge[j>>2]=1+(0|Ge[j>>2])}ve=2==(0|Ge[24+(0|Ge[l>>2])>>2])?(Ge[b>>2]=0,167):210}else ve=211;break;case 170:if(ve=0,Ge[te>>2]=je[64+(0|Ge[l>>2])+6976+288+((1023&Ge[O>>2])<<1)>>1],0<=(0|Ge[te>>2])){if(Ge[ne>>2]=Ge[te>>2]>>9,!(0|Ge[ne>>2])){ve=178;break r}if((0|Ge[F>>2])>>>0>=(0|Ge[ne>>2])>>>0){ve=187;continue r}ve=178;break r}if((0|Ge[F>>2])>>>0<=10){ve=178;break r}Ge[ne>>2]=10;do{if(Ye=~Ge[te>>2],Ue=0|Ge[O>>2],Ce=0|Ge[ne>>2],Ge[ne>>2]=Ce+1,Ge[te>>2]=je[64+(0|Ge[l>>2])+6976+2336+(Ye+(Ue>>>Ce&1)<<1)>>1],0<=(0|Ge[te>>2]))break}while((0|Ge[F>>2])>>>0>=(1+(0|Ge[ne>>2])|0)>>>0);if(0<=(0|Ge[te>>2])){ve=187;continue r}ve=178;break r;case 187:if(Ce=(ve=0)|je[64+(0|Ge[l>>2])+6976+288+((1023&Ge[O>>2])<<1)>>1],0<=(0|(Ge[te>>2]=Ce)))Ge[ne>>2]=Ge[te>>2]>>9,Ge[te>>2]=511&Ge[te>>2];else for(Ge[ne>>2]=10;Ce=~Ge[te>>2],Ue=0|Ge[O>>2],Ye=0|Ge[ne>>2],Ge[ne>>2]=Ye+1,Ge[te>>2]=je[64+(0|Ge[l>>2])+6976+2336+(Ce+(Ue>>>Ye&1)<<1)>>1],(0|Ge[te>>2])<0;);if(Ge[M>>2]=Ge[te>>2],Ge[O>>2]=(0|Ge[O>>2])>>>(0|Ge[ne>>2]),Ge[F>>2]=(0|Ge[F>>2])-(0|Ge[ne>>2]),Ye=0|Ge[M>>2],(0|Ge[M>>2])>>>0<16){Ue=0|Ge[b>>2],Ge[b>>2]=Ue+1,Xe[10532+(0|Ge[l>>2])+Ue>>0]=Ye,ve=167;break}if(!(16!=(0|Ye)|0!=(0|Ge[b>>2]))){ve=194;continue e}if(Ge[y>>2]=Xe[(0|Ge[M>>2])-16+1354>>0],(0|Ge[F>>2])>>>0<(0|Ge[y>>2])>>>0){ve=196;continue r}ve=204;continue r;case 196:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){ve=197;continue e}ve=202;break r;case 204:ve=0,Ge[re>>2]=Ge[O>>2]&(1<>2])-1,Ge[O>>2]=(0|Ge[O>>2])>>>(0|Ge[y>>2]),Ge[F>>2]=(0|Ge[F>>2])-(0|Ge[y>>2]),Ge[re>>2]=(0|Ge[re>>2])+(0|Xe[(0|Ge[M>>2])-16+1358>>0]),Ve=16==(0|Ge[M>>2])?0|qe[10532+(0|Ge[l>>2])+((0|Ge[b>>2])-1)>>0]:0,er(10532+(0|Ge[l>>2])+(0|Ge[b>>2])|0,255&Ve|0,0|Ge[re>>2]),Ge[b>>2]=(0|Ge[b>>2])+(0|Ge[re>>2]),ve=167;break;case 212:if(4<=(((ve=0)|Ge[R>>2])-(0|Ge[w>>2])|0)&&2<=((0|Ge[k>>2])-(0|Ge[A>>2])|0)){if((0|Ge[F>>2])>>>0<15&&(Ge[O>>2]=Ge[O>>2]|(qe[Ge[w>>2]>>0]|qe[1+(0|Ge[w>>2])>>0]<<8)<>2],Ge[w>>2]=2+(0|Ge[w>>2]),Ge[F>>2]=16+(0|Ge[F>>2])),Ye=0|je[64+(0|Ge[l>>2])+288+((1023&Ge[O>>2])<<1)>>1],0<=(0|(Ge[le>>2]=Ye)))Ge[fe>>2]=Ge[le>>2]>>9;else for(Ge[fe>>2]=10;Ye=~Ge[le>>2],Ue=0|Ge[O>>2],Ce=0|Ge[fe>>2],Ge[fe>>2]=Ce+1,Ge[le>>2]=je[64+(0|Ge[l>>2])+2336+(Ye+(Ue>>>Ce&1)<<1)>>1],(0|Ge[le>>2])<0;);if(Ge[b>>2]=Ge[le>>2],Ge[O>>2]=(0|Ge[O>>2])>>>(0|Ge[fe>>2]),Ge[F>>2]=(0|Ge[F>>2])-(0|Ge[fe>>2]),256&Ge[b>>2]|0){ve=257;break}if((0|Ge[F>>2])>>>0<15&&(Ge[O>>2]=Ge[O>>2]|(qe[Ge[w>>2]>>0]|qe[1+(0|Ge[w>>2])>>0]<<8)<>2],Ge[w>>2]=2+(0|Ge[w>>2]),Ge[F>>2]=16+(0|Ge[F>>2])),Ce=0|je[64+(0|Ge[l>>2])+288+((1023&Ge[O>>2])<<1)>>1],0<=(0|(Ge[le>>2]=Ce)))Ge[fe>>2]=Ge[le>>2]>>9;else for(Ge[fe>>2]=10;Ce=~Ge[le>>2],Ue=0|Ge[O>>2],Ye=0|Ge[fe>>2],Ge[fe>>2]=Ye+1,Ge[le>>2]=je[64+(0|Ge[l>>2])+2336+(Ce+(Ue>>>Ye&1)<<1)>>1],(0|Ge[le>>2])<0;);if(Ge[O>>2]=(0|Ge[O>>2])>>>(0|Ge[fe>>2]),Ge[F>>2]=(0|Ge[F>>2])-(0|Ge[fe>>2]),Xe[Ge[A>>2]>>0]=Ge[b>>2],256&Ge[le>>2]|0){Ge[A>>2]=1+(0|Ge[A>>2]),Ge[b>>2]=Ge[le>>2],ve=257;break}Xe[1+(0|Ge[A>>2])>>0]=Ge[le>>2],Ge[A>>2]=2+(0|Ge[A>>2]),ve=212;continue r}if(15<=(0|Ge[F>>2])>>>0){ve=233;continue r}if(((0|Ge[R>>2])-(0|Ge[w>>2])|0)<2){ve=216;continue r}Ge[O>>2]=Ge[O>>2]|(qe[Ge[w>>2]>>0]<>2]|qe[1+(0|Ge[w>>2])>>0]<<8+(0|Ge[F>>2])),Ge[w>>2]=2+(0|Ge[w>>2]),Ge[F>>2]=16+(0|Ge[F>>2]),ve=233;continue r;case 216:if(ve=0,Ge[se>>2]=je[64+(0|Ge[l>>2])+288+((1023&Ge[O>>2])<<1)>>1],0<=(0|Ge[se>>2])){if(Ge[ue>>2]=Ge[se>>2]>>9,!(0|Ge[ue>>2])){ve=224;break r}if((0|Ge[F>>2])>>>0>=(0|Ge[ue>>2])>>>0){ve=233;continue r}ve=224;break r}if((0|Ge[F>>2])>>>0<=10){ve=224;break r}Ge[ue>>2]=10;do{if(Ye=~Ge[se>>2],Ue=0|Ge[O>>2],Ce=0|Ge[ue>>2],Ge[ue>>2]=Ce+1,Ge[se>>2]=je[64+(0|Ge[l>>2])+2336+(Ye+(Ue>>>Ce&1)<<1)>>1],0<=(0|Ge[se>>2]))break}while((0|Ge[F>>2])>>>0>=(1+(0|Ge[ue>>2])|0)>>>0);if(0<=(0|Ge[se>>2])){ve=233;continue r}ve=224;break r;case 233:if(Ce=(ve=0)|je[64+(0|Ge[l>>2])+288+((1023&Ge[O>>2])<<1)>>1],0<=(0|(Ge[se>>2]=Ce)))Ge[ue>>2]=Ge[se>>2]>>9,Ge[se>>2]=511&Ge[se>>2];else for(Ge[ue>>2]=10;Ce=~Ge[se>>2],Ue=0|Ge[O>>2],Ye=0|Ge[ue>>2],Ge[ue>>2]=Ye+1,Ge[se>>2]=je[64+(0|Ge[l>>2])+2336+(Ce+(Ue>>>Ye&1)<<1)>>1],(0|Ge[se>>2])<0;);if(Ge[b>>2]=Ge[se>>2],Ge[O>>2]=(0|Ge[O>>2])>>>(0|Ge[ue>>2]),Ge[F>>2]=(0|Ge[F>>2])-(0|Ge[ue>>2]),!(256<=(0|Ge[b>>2])>>>0)){ve=238;continue e}ve=257;break;case 260:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){ve=261;continue e}ve=266;break r;case 268:ve=0,Ge[de>>2]=Ge[O>>2]&(1<>2])-1,Ge[O>>2]=(0|Ge[O>>2])>>>(0|Ge[y>>2]),Ge[F>>2]=(0|Ge[F>>2])-(0|Ge[y>>2]),Ge[b>>2]=(0|Ge[b>>2])+(0|Ge[de>>2]),ve=269;break;case 271:if(ve=0,Ge[Se>>2]=je[64+(0|Ge[l>>2])+3488+288+((1023&Ge[O>>2])<<1)>>1],0<=(0|Ge[Se>>2])){if(Ge[_e>>2]=Ge[Se>>2]>>9,!(0|Ge[_e>>2])){ve=279;break r}if((0|Ge[F>>2])>>>0>=(0|Ge[_e>>2])>>>0){ve=288;continue r}ve=279;break r}if((0|Ge[F>>2])>>>0<=10){ve=279;break r}Ge[_e>>2]=10;do{if(Ye=~Ge[Se>>2],Ue=0|Ge[O>>2],Ce=0|Ge[_e>>2],Ge[_e>>2]=Ce+1,Ge[Se>>2]=je[64+(0|Ge[l>>2])+3488+2336+(Ye+(Ue>>>Ce&1)<<1)>>1],0<=(0|Ge[Se>>2]))break}while((0|Ge[F>>2])>>>0>=(1+(0|Ge[_e>>2])|0)>>>0);if(0<=(0|Ge[Se>>2])){ve=288;continue r}ve=279;break r;case 288:if(Ce=(ve=0)|je[64+(0|Ge[l>>2])+3488+288+((1023&Ge[O>>2])<<1)>>1],0<=(0|(Ge[Se>>2]=Ce)))Ge[_e>>2]=Ge[Se>>2]>>9,Ge[Se>>2]=511&Ge[Se>>2];else for(Ge[_e>>2]=10;Ce=~Ge[Se>>2],Ue=0|Ge[O>>2],Ye=0|Ge[_e>>2],Ge[_e>>2]=Ye+1,Ge[Se>>2]=je[64+(0|Ge[l>>2])+3488+2336+(Ce+(Ue>>>Ye&1)<<1)>>1],(0|Ge[Se>>2])<0;);if(Ge[M>>2]=Ge[Se>>2],Ge[O>>2]=(0|Ge[O>>2])>>>(0|Ge[_e>>2]),Ge[F>>2]=(0|Ge[F>>2])-(0|Ge[_e>>2]),Ge[y>>2]=Ge[332+(Ge[M>>2]<<2)>>2],Ge[M>>2]=Ge[460+(Ge[M>>2]<<2)>>2],0|Ge[y>>2]){if((0|Ge[F>>2])>>>0<(0|Ge[y>>2])>>>0){ve=294;continue r}ve=302;continue r}ve=303;break;case 294:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){ve=295;continue e}ve=300;break r;case 302:ve=0,Ge[he>>2]=Ge[O>>2]&(1<>2])-1,Ge[O>>2]=(0|Ge[O>>2])>>>(0|Ge[y>>2]),Ge[F>>2]=(0|Ge[F>>2])-(0|Ge[y>>2]),Ge[M>>2]=(0|Ge[M>>2])+(0|Ge[he>>2]),ve=303;break;case 307:if(Ye=(ve=0)|Ge[b>>2],Ge[b>>2]=Ye+-1,0|Ye){ve=308;continue e}ve=211;break;case 319:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){ve=320;continue e}ve=325;break r;case 327:ve=0,Ge[O>>2]=(0|Ge[O>>2])>>>(7&Ge[F>>2]),Ge[F>>2]=(0|Ge[F>>2])-(7&Ge[F>>2]),Ge[b>>2]=0,ve=328;continue r;case 328:if(4<=((ve=0)|Ge[b>>2])>>>0){ve=348;continue e}if(!(0|Ge[F>>2])){ve=340;break r}if((0|Ge[F>>2])>>>0<8){ve=331;continue r}ve=339;continue r;case 331:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){ve=332;continue e}ve=337;break r;case 339:ve=0,Ge[Me>>2]=255&Ge[O>>2],Ge[O>>2]=(0|Ge[O>>2])>>>8,Ge[F>>2]=(0|Ge[F>>2])-8,ve=347;continue e}do{if(124==(0|ve)){if(((ve=0)|Ge[b>>2])>>>0<(0|Ge[44+(0|Ge[l>>2])+8>>2])>>>0){if((0|Ge[F>>2])>>>0<3){ve=126;continue r}ve=134;continue r}Ge[44+(0|Ge[l>>2])+8>>2]=19,ve=136;continue r}if(167==(0|ve)){if(((ve=0)|Ge[b>>2])>>>0>=((0|Ge[44+(0|Ge[l>>2])>>2])+(0|Ge[44+(0|Ge[l>>2])+4>>2])|0)>>>0){if(((0|Ge[44+(0|Ge[l>>2])>>2])+(0|Ge[44+(0|Ge[l>>2])+4>>2])|0)!=(0|Ge[b>>2])){ve=208;continue e}tr(64+(0|Ge[l>>2])|0,10532+(0|Ge[l>>2])|0,0|Ge[44+(0|Ge[l>>2])>>2]),tr(64+(0|Ge[l>>2])+3488|0,10532+(0|Ge[l>>2])+(0|Ge[44+(0|Ge[l>>2])>>2])|0,0|Ge[44+(0|Ge[l>>2])+4>>2]),ve=210;break}if(15<=(0|Ge[F>>2])>>>0){ve=187;continue r}if(((0|Ge[R>>2])-(0|Ge[w>>2])|0)<2){ve=170;continue r}Ge[O>>2]=Ge[O>>2]|(qe[Ge[w>>2]>>0]<>2]|qe[1+(0|Ge[w>>2])>>0]<<8+(0|Ge[F>>2])),Ge[w>>2]=2+(0|Ge[w>>2]),Ge[F>>2]=16+(0|Ge[F>>2]),ve=187;continue r}if(257==(0|ve))if(ve=0,Ye=511&Ge[b>>2],256!=(0|(Ge[b>>2]=Ye))){if(Ge[y>>2]=Ge[84+((0|Ge[b>>2])-257<<2)>>2],Ge[b>>2]=Ge[208+((0|Ge[b>>2])-257<<2)>>2],0|Ge[y>>2]){if((0|Ge[F>>2])>>>0<(0|Ge[y>>2])>>>0){ve=260;continue r}ve=268;continue r}ve=269}else ve=316;else if(303==(0|ve)){if(ve=0,Ge[g>>2]=(0|Ge[A>>2])-(0|Ge[E>>2]),(0|Ge[M>>2])>>>0>(0|Ge[g>>2])>>>0&&4&Ge[_>>2]|0){ve=305;continue e}if(Ge[ae>>2]=(0|Ge[E>>2])+((0|Ge[g>>2])-(0|Ge[M>>2])&Ge[T>>2]),(((0|Ge[A>>2])>>>0>(0|Ge[ae>>2])>>>0?0|Ge[A>>2]:0|Ge[ae>>2])+(0|Ge[b>>2])|0)>>>0>(0|Ge[k>>2])>>>0){ve=307;continue r}for(;Xe[Ge[A>>2]>>0]=0|Xe[Ge[ae>>2]>>0],Xe[1+(0|Ge[A>>2])>>0]=0|Xe[1+(0|Ge[ae>>2])>>0],Xe[2+(0|Ge[A>>2])>>0]=0|Xe[2+(0|Ge[ae>>2])>>0],Ge[A>>2]=3+(0|Ge[A>>2]),Ge[ae>>2]=3+(0|Ge[ae>>2]),Ye=(0|Ge[b>>2])-3|0,Ge[b>>2]=Ye,2<(0|Ye););ve=(0<(0|Ge[b>>2])&&(Xe[Ge[A>>2]>>0]=0|Xe[Ge[ae>>2]>>0],1<(0|Ge[b>>2])&&(Xe[1+(0|Ge[A>>2])>>0]=0|Xe[1+(0|Ge[ae>>2])>>0]),Ge[A>>2]=(0|Ge[A>>2])+(0|Ge[b>>2])),211)}}while(0);if(210!=(0|ve))if(211!=(0|ve)){if(269==(0|ve))ve=15<=((ve=0)|Ge[F>>2])>>>0?288:((0|Ge[R>>2])-(0|Ge[w>>2])|0)<2?271:(Ge[O>>2]=Ge[O>>2]|(qe[Ge[w>>2]>>0]<>2]|qe[1+(0|Ge[w>>2])>>0]<<8+(0|Ge[F>>2])),Ge[w>>2]=2+(0|Ge[w>>2]),Ge[F>>2]=16+(0|Ge[F>>2]),288);else if(316==(0|ve)){if((ve=0)!=(1&Ge[20+(0|Ge[l>>2])>>2]|0)^1){ve=31;continue e}if(!(1&Ge[_>>2])){ve=348;continue e}(0|Ge[F>>2])>>>0<(7&Ge[F>>2])>>>0?ve=319:ve=327}}else ve=0,ve=212;else Ye=24+((ve=0)|Ge[l>>2])|0,Ge[Ye>>2]=(0|Ge[Ye>>2])-1,ve=136}switch(0|ve){case 60:Ye=(ve=0)|Ge[w>>2],Ge[w>>2]=Ye+1,Ge[D>>2]=qe[Ye>>0],ve=61;continue e;case 63:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){ve=64;continue e}Ye=0|Ge[w>>2],Ge[w>>2]=Ye+1,Ie=0|Xe[Ye>>0],Le=0|Ge[b>>2],xe=0|Ge[l>>2],ve=70;continue e;case 82:Ye=(ve=0)|Ge[w>>2],Ge[w>>2]=Ye+1,Ge[P>>2]=qe[Ye>>0],ve=83;continue e;case 120:Ye=(ve=0)|Ge[w>>2],Ge[w>>2]=Ye+1,Ge[x>>2]=qe[Ye>>0],ve=121;continue e;case 132:Ye=(ve=0)|Ge[w>>2],Ge[w>>2]=Ye+1,Ge[H>>2]=qe[Ye>>0],ve=133;continue e;case 178:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){ve=179;continue e}Ye=0|Ge[w>>2],Ge[w>>2]=Ye+1,Ge[oe>>2]=qe[Ye>>0],ve=185;continue e;case 202:Ye=(ve=0)|Ge[w>>2],Ge[w>>2]=Ye+1,Ge[ie>>2]=qe[Ye>>0],ve=203;continue e;case 224:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){ve=225;continue e}Ye=0|Ge[w>>2],Ge[w>>2]=Ye+1,Ge[ce>>2]=qe[Ye>>0],ve=231;continue e;case 266:Ye=(ve=0)|Ge[w>>2],Ge[w>>2]=Ye+1,Ge[Ee>>2]=qe[Ye>>0],ve=267;continue e;case 279:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){ve=280;continue e}Ye=0|Ge[w>>2],Ge[w>>2]=Ye+1,Ge[me>>2]=qe[Ye>>0],ve=286;continue e;case 300:Ye=(ve=0)|Ge[w>>2],Ge[w>>2]=Ye+1,Ge[pe>>2]=qe[Ye>>0],ve=301;continue e;case 325:Ye=(ve=0)|Ge[w>>2],Ge[w>>2]=Ye+1,Ge[Fe>>2]=qe[Ye>>0],ve=326;continue e;case 337:Ye=(ve=0)|Ge[w>>2],Ge[w>>2]=Ye+1,Ge[be>>2]=qe[Ye>>0],ve=338;continue e;case 340:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){ve=341;continue e}Ye=0|Ge[w>>2],Ge[w>>2]=Ye+1,Ge[Me>>2]=qe[Ye>>0],ve=347;continue e}}else ve=((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0?43:(Ue=0|Ge[w>>2],Ge[w>>2]=Ue+1,Ge[N>>2]=qe[Ue>>0],49)}else ve=((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0?33:(Ue=0|Ge[w>>2],Ge[w>>2]=Ue+1,Ge[v>>2]=qe[Ue>>0],39)}if(351==(0|ve)){for(Ge[ye>>2]=Ge[Te>>2],Ge[Oe>>2]=Ge[Ge[S>>2]>>2],Ge[Re>>2]=65535&Ge[28+(0|Ge[l>>2])>>2],Ge[Ae>>2]=(0|Ge[28+(0|Ge[l>>2])>>2])>>>16,Ge[ke>>2]=((0|Ge[Oe>>2])>>>0)%5552|0;0|Ge[Oe>>2];){for(Ge[we>>2]=0;!((7+(0|Ge[we>>2])|0)>>>0>=(0|Ge[ke>>2])>>>0);)Ge[Re>>2]=(0|Ge[Re>>2])+(0|qe[Ge[ye>>2]>>0]),Ge[Ae>>2]=(0|Ge[Ae>>2])+(0|Ge[Re>>2]),Ge[Re>>2]=(0|Ge[Re>>2])+(0|qe[1+(0|Ge[ye>>2])>>0]),Ge[Ae>>2]=(0|Ge[Ae>>2])+(0|Ge[Re>>2]),Ge[Re>>2]=(0|Ge[Re>>2])+(0|qe[2+(0|Ge[ye>>2])>>0]),Ge[Ae>>2]=(0|Ge[Ae>>2])+(0|Ge[Re>>2]),Ge[Re>>2]=(0|Ge[Re>>2])+(0|qe[3+(0|Ge[ye>>2])>>0]),Ge[Ae>>2]=(0|Ge[Ae>>2])+(0|Ge[Re>>2]),Ge[Re>>2]=(0|Ge[Re>>2])+(0|qe[4+(0|Ge[ye>>2])>>0]),Ge[Ae>>2]=(0|Ge[Ae>>2])+(0|Ge[Re>>2]),Ge[Re>>2]=(0|Ge[Re>>2])+(0|qe[5+(0|Ge[ye>>2])>>0]),Ge[Ae>>2]=(0|Ge[Ae>>2])+(0|Ge[Re>>2]),Ge[Re>>2]=(0|Ge[Re>>2])+(0|qe[6+(0|Ge[ye>>2])>>0]),Ge[Ae>>2]=(0|Ge[Ae>>2])+(0|Ge[Re>>2]),Ge[Re>>2]=(0|Ge[Re>>2])+(0|qe[7+(0|Ge[ye>>2])>>0]),Ge[Ae>>2]=(0|Ge[Ae>>2])+(0|Ge[Re>>2]),Ge[we>>2]=8+(0|Ge[we>>2]),Ge[ye>>2]=8+(0|Ge[ye>>2]);for(;!((0|Ge[we>>2])>>>0>=(0|Ge[ke>>2])>>>0);)Te=0|Ge[ye>>2],Ge[ye>>2]=Te+1,Ge[Re>>2]=(0|Ge[Re>>2])+(0|qe[Te>>0]),Ge[Ae>>2]=(0|Ge[Ae>>2])+(0|Ge[Re>>2]),Ge[we>>2]=1+(0|Ge[we>>2]);Ge[Re>>2]=((0|Ge[Re>>2])>>>0)%65521|0,Ge[Ae>>2]=((0|Ge[Ae>>2])>>>0)%65521|0,Ge[Oe>>2]=(0|Ge[Oe>>2])-(0|Ge[ke>>2]),Ge[ke>>2]=5552}Ge[28+(0|Ge[l>>2])>>2]=(Ge[Ae>>2]<<16)+(0|Ge[Re>>2]),0==(0|Ge[p>>2])&&1&Ge[_>>2]|0&&(0|Ge[28+(0|Ge[l>>2])>>2])!=(0|Ge[16+(0|Ge[l>>2])>>2])&&(Ge[p>>2]=-2)}return Ge[c>>2]=Ge[p>>2],Ke=0|Ge[c>>2],Ze=We,0|Ke}return Ge[Ge[S>>2]>>2]=0,Ge[Ge[d>>2]>>2]=0,Ge[c>>2]=-3,Ke=0|Ge[c>>2],Ze=We,0|Ke}function x(e){e|=0;var r,t=0,n=0,o=0,i=0,a=0,s=0,u=0,c=0,l=0,f=0,d=0,E=0,S=0,_=0,m=0,h=0,p=0,F=0,M=0,b=0,y=0,O=0,w=0,R=0,A=0,k=0,T=0,g=0,v=0,N=0,D=0,P=0,C=0,I=0,L=0,x=0,B=0,H=0,U=0,Y=0,z=0,V=0,K=0,W=0,X=0,j=0,G=0,q=0,Z=0,J=0,Q=0,$=0,ee=0,re=0,te=0,ne=0,oe=0,ie=0,ae=0,se=0,ue=0,ce=0,le=0,fe=0,de=0,Ee=0,Se=0,_e=0,me=0,he=0,pe=0,Fe=0,Me=0,be=0,ye=Ze;(0|Je)<=(0|(Ze=Ze+16|0))&&Qe(16),t=ye;do{if(e>>>0<245){if(o=(n=e>>>0<11?16:e+11&-8)>>>3,3&(a=(i=0|Ge[948])>>>o)|0)return l=0|Ge[(c=(u=3832+((s=(1&a^1)+o|0)<<1<<2)|0)+8|0)>>2],(0|u)==(0|(d=0|Ge[(f=l+8|0)>>2]))?Ge[948]=i&~(1<>2]=u,Ge[c>>2]=d),d=s<<3,Ge[l+4>>2]=3|d,Ge[(s=l+d+4|0)>>2]=1|Ge[s>>2],Ze=ye,0|(E=f);if((f=0|Ge[950])>>>0>>0){if(0|a)return a=0|Ge[(c=(l=3832+((u=((s=(o=(s=((d=a<>>(d=s>>>12&16))>>>5&8)|d|(o=(a=o>>>s)>>>2&4)|(a=(l=a>>>o)>>>1&2)|(l=(c=l>>>a)>>>1&1))+(c>>>l)|0)<<1<<2)|0)+8|0)>>2],S=(0|l)==(0|(d=0|Ge[(o=a+8|0)>>2]))?(s=i&~(1<>2]=l,Ge[c>>2]=d,i),d=(u<<3)-n|0,Ge[a+4>>2]=3|n,Ge[(u=a+n|0)+4>>2]=1|d,Ge[u+d>>2]=d,0|f&&(a=0|Ge[953],l=3832+((c=f>>>3)<<1<<2)|0,m=S&(s=1<>2],s):(Ge[948]=S|s,(_=l)+8|0),Ge[m>>2]=a,Ge[_+12>>2]=a,Ge[a+8>>2]=_,Ge[a+12>>2]=l),Ge[950]=d,Ge[953]=u,Ze=ye,0|(E=o);if(o=0|Ge[949]){if(h=0|Ge[4096+(((u=(l=(u=(o&0-o)-1|0)>>>(d=u>>>12&16))>>>5&8)|d|(l=(a=l>>>u)>>>2&4)|(a=(s=a>>>l)>>>1&2)|(s=(c=s>>>a)>>>1&1))+(c>>>s)<<2)>>2],s=(-8&Ge[h+4>>2])-n|0,c=0|Ge[h+16+((0==(0|Ge[h+16>>2])&1)<<2)>>2])for(a=h,h=s,s=c;;){if(d=(l=(c=(-8&Ge[s+4>>2])-n|0)>>>0>>0)?c:h,c=l?s:a,!(s=0|Ge[s+16+((0==(0|Ge[s+16>>2])&1)<<2)>>2])){p=c,F=d;break}a=c,h=d}else p=h,F=s;if(p>>>0<(h=p+n|0)>>>0){a=0|Ge[p+24>>2],s=0|Ge[p+12>>2];do{if((0|s)==(0|p)){if(c=0|Ge[(d=p+20|0)>>2])b=c,y=d;else{if(!(u=0|Ge[(l=p+16|0)>>2])){M=0;break}b=u,y=l}for(;;)if(0|(c=0|Ge[(d=b+20|0)>>2]))b=c,y=d;else{if(!(c=0|Ge[(d=b+16|0)>>2]))break;b=c,y=d}Ge[y>>2]=0,M=b}else d=0|Ge[p+8>>2],Ge[d+12>>2]=s,Ge[s+8>>2]=d,M=s}while(0);do{if(0|a){if(s=0|Ge[p+28>>2],(0|p)==(0|Ge[(d=4096+(s<<2)|0)>>2])){if(!(Ge[d>>2]=M)){Ge[949]=o&~(1<>2])!=(0|p)&1)<<2)>>2]=M))break;Ge[M+24>>2]=a,0|(s=0|Ge[p+16>>2])&&(Ge[M+16>>2]=s,Ge[s+24>>2]=M),0|(s=0|Ge[p+20>>2])&&(Ge[M+20>>2]=s,Ge[s+24>>2]=M)}}while(0);return F>>>0<16?(a=F+n|0,Ge[p+4>>2]=3|a,Ge[(o=p+a+4|0)>>2]=1|Ge[o>>2]):(Ge[p+4>>2]=3|n,Ge[h+4>>2]=1|F,Ge[h+F>>2]=F,0|f&&(o=0|Ge[953],s=3832+((a=f>>>3)<<1<<2)|0,w=i&(d=1<>2],d):(Ge[948]=i|d,(O=s)+8|0),Ge[w>>2]=o,Ge[O+12>>2]=o,Ge[o+8>>2]=O,Ge[o+12>>2]=s),Ge[950]=F,Ge[953]=h),Ze=ye,0|(E=p+8|0)}R=n}else R=n}else R=n}else if(e>>>0<=4294967231)if(o=-8&(s=e+11|0),d=0|Ge[949]){a=0-o|0,A=(c=s>>>8)?16777215>>0?31:o>>>((k=14-((c=((l=c<<(s=(c+1048320|0)>>>16&8))+520192|0)>>>16&4)|s|(l=((u=l<>>16&2))+(u<>>15)|0)+7|0)&1|k<<1:0,k=0|Ge[4096+(A<<2)>>2];e:do{if(k)for(u=a,s=k,c=o<<(31==((l=0)|A)?0:25-(A>>>1)|0),D=0;;){if((P=(-8&Ge[s+4>>2])-o|0)>>>0>>0){if(!P){I=0,L=C=s,N=61;break e}x=s,B=P}else x=l,B=u;if(r=0==(0|(P=0|Ge[s+20>>2]))|(0|P)==(0|(s=0|Ge[s+16+(c>>>31<<2)>>2]))?D:P,P=0==(0|s)){T=r,g=x,v=B,N=57;break}l=x,u=B,c<<=1&(1^P),D=r}else g=T=0,v=a,N=57}while(0);if(57==(0|N)){if(0==(0|T)&0==(0|g)){if(!(a=d&((k=2<>>(a=k>>>12&16))>>>5&8)|a|(n=(h=n>>>k)>>>2&4)|(h=(i=h>>>n)>>>1&2)|(i=(f=i>>>h)>>>1&1))+(f>>>i)<<2)>>2]}else H=g,U=T;U?(C=H,I=v,L=U,N=61):(Y=H,z=v)}if(61==(0|N))for(;;){if(N=0,h=(f=(i=(-8&Ge[L+4>>2])-o|0)>>>0>>0)?i:I,i=f?L:C,!(L=0|Ge[L+16+((0==(0|Ge[L+16>>2])&1)<<2)>>2])){Y=i,z=h;break}C=i,I=h,N=61}if(0!=(0|Y)&&z>>>0<((0|Ge[950])-o|0)>>>0){if((h=Y+o|0)>>>0<=Y>>>0)return Ze=ye,(E=0)|E;i=0|Ge[Y+24>>2],f=0|Ge[Y+12>>2];do{if((0|f)==(0|Y)){if(a=0|Ge[(n=Y+20|0)>>2])K=a,W=n;else{if(!(D=0|Ge[(k=Y+16|0)>>2])){V=0;break}K=D,W=k}for(;;)if(0|(a=0|Ge[(n=K+20|0)>>2]))K=a,W=n;else{if(!(a=0|Ge[(n=K+16|0)>>2]))break;K=a,W=n}Ge[W>>2]=0,V=K}else n=0|Ge[Y+8>>2],Ge[n+12>>2]=f,Ge[f+8>>2]=n,V=f}while(0);do{if(i){if(f=0|Ge[Y+28>>2],(0|Y)==(0|Ge[(n=4096+(f<<2)|0)>>2])){if(!(Ge[n>>2]=V)){n=d&~(1<>2])!=(0|Y)&1)<<2)>>2]=V)){X=d;break}Ge[V+24>>2]=i,0|(n=0|Ge[Y+16>>2])&&(Ge[V+16>>2]=n,Ge[n+24>>2]=V),X=((n=0|Ge[Y+20>>2])&&(Ge[V+20>>2]=n,Ge[n+24>>2]=V),d)}else X=d}while(0);do{if(16<=z>>>0){if(Ge[Y+4>>2]=3|o,Ge[h+4>>2]=1|z,d=(Ge[h+z>>2]=z)>>>3,z>>>0<256){i=3832+(d<<1<<2)|0,G=(n=0|Ge[948])&(f=1<>2],f):(Ge[948]=n|f,(j=i)+8|0),Ge[G>>2]=h,Ge[j+12>>2]=h,Ge[h+8>>2]=j,Ge[h+12>>2]=i;break}if(a=4096+((q=(i=z>>>8)?16777215>>0?31:z>>>((a=14-((i=((n=i<<(f=(i+1048320|0)>>>16&8))+520192|0)>>>16&4)|f|(n=((d=n<>>16&2))+(d<>>15)|0)+7|0)&1|a<<1:0)<<2)|0,Ge[h+28>>2]=q,Ge[(n=h+16|0)+4>>2]=0,Ge[n>>2]=0,!(X&(n=1<>2]=h,Ge[h+24>>2]=a,Ge[h+12>>2]=h,Ge[h+8>>2]=h;break}for(n=z<<(31==(0|q)?0:25-(q>>>1)|0),d=0|Ge[a>>2];;){if((-8&Ge[d+4>>2]|0)==(0|z)){N=97;break}if(!(a=0|Ge[(Z=d+16+(n>>>31<<2)|0)>>2])){N=96;break}n<<=1,d=a}if(96==(0|N)){Ge[Z>>2]=h,Ge[h+24>>2]=d,Ge[h+12>>2]=h,Ge[h+8>>2]=h;break}if(97==(0|N)){a=0|Ge[(n=d+8|0)>>2],Ge[a+12>>2]=h,Ge[n>>2]=h,Ge[h+8>>2]=a,Ge[h+12>>2]=d,Ge[h+24>>2]=0;break}}else a=z+o|0,Ge[Y+4>>2]=3|a,Ge[(n=Y+a+4|0)>>2]=1|Ge[n>>2]}while(0);return Ze=ye,0|(E=Y+8|0)}R=o}else R=o;else R=-1}while(0);if(R>>>0<=(Y=0|Ge[950])>>>0)return z=Y-R|0,Z=0|Ge[953],15>>0?(q=Z+R|0,Ge[953]=q,Ge[950]=z,Ge[q+4>>2]=1|z,Ge[q+z>>2]=z,Ge[Z+4>>2]=3|R):(Ge[950]=0,Ge[953]=0,Ge[Z+4>>2]=3|Y,Ge[(z=Z+Y+4|0)>>2]=1|Ge[z>>2]),Ze=ye,0|(E=Z+8|0);if(R>>>0<(Z=0|Ge[951])>>>0)return z=Z-R|0,Ge[951]=z,q=(Y=0|Ge[954])+R|0,Ge[954]=q,Ge[q+4>>2]=1|z,Ge[Y+4>>2]=3|R,Ze=ye,0|(E=Y+8|0);if(J=0|Ge[1066]?0|Ge[1068]:(Ge[1068]=4096,Ge[1067]=4096,Ge[1069]=-1,Ge[1070]=-1,Ge[1071]=0,Ge[1059]=0,Y=-16&t^1431655768,Ge[t>>2]=Y,Ge[1066]=Y,4096),Y=R+48|0,(J=(z=J+(t=R+47|0)|0)&(q=0-J|0))>>>0<=R>>>0)return Ze=ye,(E=0)|E;if(0|(X=0|Ge[1058])&&(G=(j=0|Ge[1056])+J|0)>>>0<=j>>>0|X>>>0>>0)return Ze=ye,(E=0)|E;e:do{if(4&Ge[1059])oe=0,N=133;else{X=0|Ge[954];r:do{if(X){for(G=4240;!((j=0|Ge[G>>2])>>>0<=X>>>0&&(j+(0|Ge[(Q=G+4|0)>>2])|0)>>>0>X>>>0);){if(!(j=0|Ge[G+8>>2])){N=118;break r}G=j}if((d=z-Z&q)>>>0<2147483647)if((0|(j=0|Oe(0|d)))==((0|Ge[G>>2])+(0|Ge[Q>>2])|0)){if(-1!=(0|j)){ee=d,re=j,N=135;break e}$=d}else te=j,ne=d,N=126;else $=0}else N=118}while(0);do{if(118==(0|N))if(-1!=(0|(X=0|Oe(0)))&&(o=X,d=(V=(0==((j=(d=0|Ge[1067])+-1|0)&o|0)?0:(j+o&0-d)-o|0)+J|0)+(o=0|Ge[1056])|0,R>>>0>>0&V>>>0<2147483647)){if(0|(j=0|Ge[1058])&&d>>>0<=o>>>0|j>>>0>>0){$=0;break}if((0|(j=0|Oe(0|V)))==(0|X)){ee=V,re=X,N=135;break e}te=j,ne=V,N=126}else $=0}while(0);do{if(126==(0|N)){if(V=0-ne|0,!(ne>>>0>>0&ne>>>0<2147483647&-1!=(0|te))){if(-1==(0|te)){$=0;break}ee=ne,re=te,N=135;break e}if(2147483647<=(X=t-ne+(j=0|Ge[1068])&0-j)>>>0){ee=ne,re=te,N=135;break e}if(-1==(0|Oe(0|X))){Oe(0|V),$=0;break}ee=X+ne|0,re=te,N=135;break e}}while(0);Ge[1059]=4|Ge[1059],oe=$,N=133}}while(0);if(133==(0|N)&&J>>>0<2147483647&&!(-1==(0|($=0|Oe(0|J)))|1^(ne=(R+40|0)>>>0<(te=(J=0|Oe(0))-$|0)>>>0)|$>>>0>>0&-1!=(0|$)&-1!=(0|J)^1)&&(ee=ne?te:oe,re=$,N=135),135==(0|N)){$=(0|Ge[1056])+ee|0,(Ge[1056]=$)>>>0>(0|Ge[1057])>>>0&&(Ge[1057]=$),$=0|Ge[954];do{if($){for(oe=4240;;){if((0|re)==((ie=0|Ge[oe>>2])+(se=0|Ge[(ae=oe+4|0)>>2])|0)){N=145;break}if(!(te=0|Ge[oe+8>>2]))break;oe=te}if(145==(0|N)&&0==(8&Ge[oe+12>>2]|0)&&$>>>0>>0&ie>>>0<=$>>>0){Ge[ae>>2]=se+ee,te=$+(ne=0==(7&(te=$+8|0)|0)?0:0-te&7)|0,J=(0|Ge[951])+(ee-ne)|0,Ge[954]=te,Ge[951]=J,Ge[te+4>>2]=1|J,Ge[te+J+4>>2]=40,Ge[955]=Ge[1070];break}for(re>>>0<(0|Ge[952])>>>0&&(Ge[952]=re),J=re+ee|0,te=4240;;){if((0|Ge[te>>2])==(0|J)){N=153;break}if(!(ne=0|Ge[te+8>>2]))break;te=ne}if(153==(0|N)&&0==(8&Ge[te+12>>2]|0)){Ge[te>>2]=re,Ge[(oe=te+4|0)>>2]=(0|Ge[oe>>2])+ee,ne=re+(0==(7&(oe=re+8|0)|0)?0:0-oe&7)|0,t=J+(0==(7&(oe=J+8|0)|0)?0:0-oe&7)|0,oe=ne+R|0,Y=t-ne-R|0,Ge[ne+4>>2]=3|R;do{if((0|t)!=(0|$)){if((0|t)==(0|Ge[953])){Q=(0|Ge[950])+Y|0,Ge[950]=Q,Ge[953]=oe,Ge[oe+4>>2]=1|Q,Ge[oe+Q>>2]=Q;break}if(1==(3&(Q=0|Ge[t+4>>2])|0)){q=-8&Q,Z=Q>>>3;e:do{if(Q>>>0<256){if(z=0|Ge[t+8>>2],(0|(X=0|Ge[t+12>>2]))==(0|z)){Ge[948]=Ge[948]&~(1<>2]=X,Ge[X+8>>2]=z;break}z=0|Ge[t+24>>2],X=0|Ge[t+12>>2];do{if((0|X)==(0|t)){if(d=0|Ge[(j=(V=t+16|0)+4|0)>>2])ce=d,le=j;else{if(!(o=0|Ge[V>>2])){ue=0;break}ce=o,le=V}for(;;)if(0|(d=0|Ge[(j=ce+20|0)>>2]))ce=d,le=j;else{if(!(d=0|Ge[(j=ce+16|0)>>2]))break;ce=d,le=j}Ge[le>>2]=0,ue=ce}else j=0|Ge[t+8>>2],Ge[j+12>>2]=X,Ge[X+8>>2]=j,ue=X}while(0);if(!z)break;j=4096+((X=0|Ge[t+28>>2])<<2)|0;do{if((0|t)==(0|Ge[j>>2])){if(0|(Ge[j>>2]=ue))break;Ge[949]=Ge[949]&~(1<>2])!=(0|t)&1)<<2)>>2]=ue))break e}while(0)}while((Ge[ue+24>>2]=z,0|(j=0|Ge[(X=t+16|0)>>2])&&(Ge[ue+16>>2]=j,Ge[j+24>>2]=ue),j=0|Ge[X+4>>2])&&(Ge[ue+20>>2]=j,Ge[j+24>>2]=ue,0));fe=t+q|0,de=q+Y|0}else fe=t,de=Y;if(Ge[(Z=fe+4|0)>>2]=-2&Ge[Z>>2],Ge[oe+4>>2]=1|de,Z=(Ge[oe+de>>2]=de)>>>3,de>>>0<256){Q=3832+(Z<<1<<2)|0,Se=(G=0|Ge[948])&(j=1<>2],j):(Ge[948]=G|j,(Ee=Q)+8|0),Ge[Se>>2]=oe,Ge[Ee+12>>2]=oe,Ge[oe+8>>2]=Ee,Ge[oe+12>>2]=Q;break}Q=de>>>8;do{if(Q){if(16777215>>0){_e=31;break}_e=de>>>((d=14-((Z=((G=Q<<(j=(Q+1048320|0)>>>16&8))+520192|0)>>>16&4)|j|(G=((X=G<>>16&2))+(X<>>15)|0)+7|0)&1|d<<1}else _e=0}while(0);if(Q=4096+(_e<<2)|0,Ge[oe+28>>2]=_e,Ge[(q=oe+16|0)+4>>2]=0,!((q=(Ge[q>>2]=0)|Ge[949])&(d=1<<_e))){Ge[949]=q|d,Ge[Q>>2]=oe,Ge[oe+24>>2]=Q,Ge[oe+12>>2]=oe,Ge[oe+8>>2]=oe;break}for(d=de<<(31==(0|_e)?0:25-(_e>>>1)|0),q=0|Ge[Q>>2];;){if((-8&Ge[q+4>>2]|0)==(0|de)){N=194;break}if(!(Q=0|Ge[(me=q+16+(d>>>31<<2)|0)>>2])){N=193;break}d<<=1,q=Q}if(193==(0|N)){Ge[me>>2]=oe,Ge[oe+24>>2]=q,Ge[oe+12>>2]=oe,Ge[oe+8>>2]=oe;break}if(194==(0|N)){Q=0|Ge[(d=q+8|0)>>2],Ge[Q+12>>2]=oe,Ge[d>>2]=oe,Ge[oe+8>>2]=Q,Ge[oe+12>>2]=q,Ge[oe+24>>2]=0;break}}else Q=(0|Ge[951])+Y|0,Ge[951]=Q,Ge[954]=oe,Ge[oe+4>>2]=1|Q}while(0);return Ze=ye,0|(E=ne+8|0)}for(oe=4240;!((Y=0|Ge[oe>>2])>>>0<=$>>>0&&$>>>0<(he=Y+(0|Ge[oe+4>>2])|0)>>>0);)oe=0|Ge[oe+8>>2];for(oe=he+-47|0,ne=oe+8|0,Y=oe+(0==(7&ne|0)?0:0-ne&7)|0,ne=$+16|0,oe=Y>>>0>>0?$:Y,Y=oe+8|0,t=re+8|0,J=0==(7&t|0)?0:0-t&7,t=re+J|0,te=ee+-40-J|0,Ge[954]=t,Ge[951]=te,Ge[t+4>>2]=1|te,Ge[t+te+4>>2]=40,Ge[955]=Ge[1070],te=oe+4|0,Ge[te>>2]=27,Ge[Y>>2]=Ge[1060],Ge[Y+4>>2]=Ge[1061],Ge[Y+8>>2]=Ge[1062],Ge[Y+12>>2]=Ge[1063],Ge[1060]=re,Ge[1061]=ee,Ge[1063]=0,Ge[1062]=Y,Y=oe+24|0;Ge[(Y=(t=Y)+4|0)>>2]=7,(t+8|0)>>>0>>0;);if((0|oe)!=(0|$)){if(Y=oe-$|0,Ge[te>>2]=-2&Ge[te>>2],Ge[$+4>>2]=1|Y,t=(Ge[oe>>2]=Y)>>>3,Y>>>0<256){J=3832+(t<<1<<2)|0,Fe=(Q=0|Ge[948])&(d=1<>2],d):(Ge[948]=Q|d,(pe=J)+8|0),Ge[Fe>>2]=$,Ge[pe+12>>2]=$,Ge[$+8>>2]=pe,Ge[$+12>>2]=J;break}if(G=4096+((Me=(J=Y>>>8)?16777215>>0?31:Y>>>((G=14-((J=((Q=J<<(d=(J+1048320|0)>>>16&8))+520192|0)>>>16&4)|d|(Q=((t=Q<>>16&2))+(t<>>15)|0)+7|0)&1|G<<1:0)<<2)|0,Ge[$+28>>2]=Me,Ge[$+20>>2]=0,!((Q=(Ge[ne>>2]=0)|Ge[949])&(t=1<>2]=$,Ge[$+24>>2]=G,Ge[$+12>>2]=$,Ge[$+8>>2]=$;break}for(t=Y<<(31==(0|Me)?0:25-(Me>>>1)|0),Q=0|Ge[G>>2];;){if((-8&Ge[Q+4>>2]|0)==(0|Y)){N=216;break}if(!(G=0|Ge[(be=Q+16+(t>>>31<<2)|0)>>2])){N=215;break}t<<=1,Q=G}if(215==(0|N)){Ge[be>>2]=$,Ge[$+24>>2]=Q,Ge[$+12>>2]=$,Ge[$+8>>2]=$;break}if(216==(0|N)){Y=0|Ge[(t=Q+8|0)>>2],Ge[Y+12>>2]=$,Ge[t>>2]=$,Ge[$+8>>2]=Y,Ge[$+12>>2]=Q,Ge[$+24>>2]=0;break}}}else{for(Y=0|Ge[952],0==(0|Y)|re>>>0>>0&&(Ge[952]=re),Ge[1060]=re,Ge[1061]=ee,Ge[1063]=0,Ge[957]=Ge[1066],Ge[956]=-1,Y=0;Ge[(t=3832+(Y<<1<<2)|0)+12>>2]=t,Ge[t+8>>2]=t,Y=Y+1|0,32!=(0|Y););Y=re+(Q=0==(7&(Y=re+8|0)|0)?0:0-Y&7)|0,t=ee+-40-Q|0,Ge[954]=Y,Ge[951]=t,Ge[Y+4>>2]=1|t,Ge[Y+t+4>>2]=40,Ge[955]=Ge[1070]}}while(0);if(R>>>0<(ee=0|Ge[951])>>>0)return re=ee-R|0,Ge[951]=re,$=(ee=0|Ge[954])+R|0,Ge[954]=$,Ge[$+4>>2]=1|re,Ge[ee+4>>2]=3|R,Ze=ye,0|(E=ee+8|0)}return Ge[(ee=652)>>2]=12,Ze=ye,(E=0)|E}function B(e){var r,t,n,o=0,i=0,a=0,s=0,u=0,c=0,l=0,f=0,d=0,E=0,S=0,_=0,m=0,h=0,p=0,F=0,M=0,b=0,y=0,O=0,w=0,R=0,A=0,k=0,T=0;if(e|=0){o=e+-8|0,i=0|Ge[952],r=o+(e=-8&(a=0|Ge[e+-4>>2]))|0;do{if(1&a)d=e,E=f=o;else{if(s=0|Ge[o>>2],!(3&a))return;if(t=s+e|0,(u=o+(0-s)|0)>>>0>>0)return;if((0|u)==(0|Ge[953])){if(3==(3&(l=0|Ge[(c=4+r|0)>>2])|0))return Ge[950]=t,Ge[c>>2]=-2&l,Ge[u+4>>2]=1|t,void(Ge[u+t>>2]=t);d=t,E=f=u;break}if(l=s>>>3,s>>>0<256){if(s=0|Ge[u+8>>2],(0|(c=0|Ge[u+12>>2]))==(0|s)){Ge[948]=Ge[948]&~(1<>2]=c,Ge[c+8>>2]=s,d=t,E=f=u;break}s=0|Ge[u+24>>2],c=0|Ge[u+12>>2];do{if((0|c)==(0|u)){if(_=0|Ge[(S=(l=u+16|0)+4|0)>>2])h=_,p=S;else{if(!(n=0|Ge[l>>2])){m=0;break}h=n,p=l}for(;;)if(0|(_=0|Ge[(S=h+20|0)>>2]))h=_,p=S;else{if(!(_=0|Ge[(S=h+16|0)>>2]))break;h=_,p=S}Ge[p>>2]=0,m=h}else S=0|Ge[u+8>>2],Ge[S+12>>2]=c,Ge[c+8>>2]=S,m=c}while(0);if(s){if(c=0|Ge[u+28>>2],(0|u)==(0|Ge[(S=4096+(c<<2)|0)>>2])){if(!(Ge[S>>2]=m)){Ge[949]=Ge[949]&~(1<>2])!=(0|u)&1)<<2)>>2]=m)){d=t,E=f=u;break}Ge[m+24>>2]=s,0|(S=0|Ge[(c=u+16|0)>>2])&&(Ge[m+16>>2]=S,Ge[S+24>>2]=m),E=f=(d=((S=0|Ge[c+4>>2])&&(Ge[m+20>>2]=S,Ge[S+24>>2]=m),t),u)}else d=t,E=f=u}}while(0);if(!(r>>>0<=E>>>0)&&1&(e=0|Ge[(o=4+r|0)>>2])){if(2&e)Ge[o>>2]=-2&e,Ge[f+4>>2]=1|d,y=Ge[E+d>>2]=d;else{if(m=0|Ge[953],(0|r)==(0|Ge[954]))return h=(0|Ge[951])+d|0,Ge[951]=h,Ge[954]=f,Ge[f+4>>2]=1|h,(0|f)!=(0|m)?void 0:(Ge[953]=0,void(Ge[950]=0));if((0|r)==(0|m))return m=(0|Ge[950])+d|0,Ge[950]=m,Ge[953]=E,Ge[f+4>>2]=1|m,void(Ge[E+m>>2]=m);m=(-8&e)+d|0,h=e>>>3;do{if(e>>>0<256){if(p=0|Ge[8+r>>2],(0|(i=0|Ge[12+r>>2]))==(0|p)){Ge[948]=Ge[948]&~(1<>2]=i,Ge[i+8>>2]=p;break}p=0|Ge[24+r>>2],i=0|Ge[12+r>>2];do{if((0|i)==(0|r)){if(c=0|Ge[(S=(a=16+r|0)+4|0)>>2])M=c,b=S;else{if(!(_=0|Ge[a>>2])){F=0;break}M=_,b=a}for(;;)if(0|(c=0|Ge[(S=M+20|0)>>2]))M=c,b=S;else{if(!(c=0|Ge[(S=M+16|0)>>2]))break;M=c,b=S}Ge[b>>2]=0,F=M}else S=0|Ge[8+r>>2],Ge[S+12>>2]=i,Ge[i+8>>2]=S,F=i}while(0);if(0|p){if(i=0|Ge[28+r>>2],(0|r)==(0|Ge[(u=4096+(i<<2)|0)>>2])){if(!(Ge[u>>2]=F)){Ge[949]=Ge[949]&~(1<>2])!=(0|r)&1)<<2)>>2]=F))break;Ge[F+24>>2]=p,0|(u=0|Ge[(i=16+r|0)>>2])&&(Ge[F+16>>2]=u,Ge[u+24>>2]=F),0|(u=0|Ge[i+4>>2])&&(Ge[F+20>>2]=u,Ge[u+24>>2]=F)}}while(0);if(Ge[f+4>>2]=1|m,Ge[E+m>>2]=m,(0|f)==(0|Ge[953]))return void(Ge[950]=m);y=m}if(d=y>>>3,y>>>0<256)return E=3832+(d<<1<<2)|0,w=(e=0|Ge[948])&(o=1<>2],o):(Ge[948]=e|o,(O=E)+8|0),Ge[w>>2]=f,Ge[O+12>>2]=f,Ge[f+8>>2]=O,void(Ge[f+12>>2]=E);e=4096+((R=(E=y>>>8)?16777215>>0?31:y>>>((e=14-((E=((w=E<<(O=(E+1048320|0)>>>16&8))+520192|0)>>>16&4)|O|(w=((o=w<>>16&2))+(o<>>15)|0)+7|0)&1|e<<1:0)<<2)|0,Ge[f+28>>2]=R,Ge[f+20>>2]=0,w=(Ge[f+16>>2]=0)|Ge[949],o=1<>>1)|0),E=0|Ge[e>>2];;){if((-8&Ge[E+4>>2]|0)==(0|y)){A=73;break}if(!(d=0|Ge[(k=E+16+(O>>>31<<2)|0)>>2])){A=72;break}O<<=1,E=d}if(72==(0|A)){Ge[k>>2]=f,Ge[f+24>>2]=E,Ge[f+12>>2]=f,Ge[f+8>>2]=f;break}if(73==(0|A)){p=0|Ge[(O=E+8|0)>>2],Ge[p+12>>2]=f,Ge[O>>2]=f,Ge[f+8>>2]=p,Ge[f+12>>2]=E,Ge[f+24>>2]=0;break}}else Ge[949]=w|o,Ge[e>>2]=f,Ge[f+24>>2]=e,Ge[f+12>>2]=f,Ge[f+8>>2]=f}while(0);if(f=(0|Ge[956])-1|0,!(Ge[956]=f)){for(T=4248;f=0|Ge[T>>2];)T=f+8|0;Ge[956]=-1}}}}function H(e,r,t){e|=0,r|=0,t|=0;var n,o,i,a,s,u,c,l,f,d,E=0,S=0,_=0,m=0,h=0,p=0,F=0,M=Ze;(0|Je)<=(0|(Ze=Ze+48|0))&&Qe(48),n=M+16|0,o=(E=M)+32|0,a=0|Ge[(i=e+28|0)>>2],Ge[o>>2]=a,u=(0|Ge[(s=e+20|0)>>2])-a|0,Ge[4+o>>2]=u,Ge[8+o>>2]=r,r=u+(Ge[12+o>>2]=t)|0,u=e+60|0,Ge[E>>2]=Ge[u>>2],Ge[E+4>>2]=o,Ge[E+8>>2]=2,a=0|U(0|R(146,0|E));e:do{if((0|r)!=(0|a)){for(E=2,S=r,_=o,m=a;!((0|m)<0);){if(S=S-m|0,f=((c=(h=0|Ge[_+4>>2])>>>0>>0)<<31>>31)+E|0,d=m-(c?h:0)|0,Ge[(l=c?_+8|0:_)>>2]=(0|Ge[l>>2])+d,Ge[(h=l+4|0)>>2]=(0|Ge[h>>2])-d,Ge[n>>2]=Ge[u>>2],Ge[4+n>>2]=l,Ge[8+n>>2]=f,(0|S)==(0|(m=0|U(0|R(146,0|n))))){p=3;break e}E=f,_=l}Ge[e+16>>2]=0,Ge[i>>2]=0,Ge[s>>2]=0,Ge[e>>2]=32|Ge[e>>2],F=2==(0|E)?0:t-(0|Ge[_+4>>2])|0}else p=3}while(0);return 3==(0|p)&&(p=0|Ge[e+44>>2],Ge[e+16>>2]=p+(0|Ge[e+48>>2]),Ge[i>>2]=p,Ge[s>>2]=p,F=t),Ze=M,0|F}function U(e){return 0|(4294963200<(e|=0)>>>0?(Ge[163]=0-e,-1):e)}function Y(){return 652}function z(e,r,t,n,o){e|=0,r|=0,t|=0,n|=0,o|=0;var i,a,s,u,c,l,f,d,E,S,_=0,m=0,h=0,p=0,F=0,M=0,b=0,y=0,O=0,w=0,R=0,A=0,k=0,T=0,g=0,v=0,N=0,D=0,P=0,C=0,I=0,L=0,x=0,B=0,H=0,U=0,Y=0,z=0,V=0,K=0,W=0,X=0,j=0,G=0,q=0,Z=0,J=0,Q=0,$=0,ee=0,re=0,te=0,ne=0,oe=0,ie=0,ae=0,se=0,ue=0,ce=0,le=0,fe=0,de=0,Ee=0,Se=0,_e=0,me=0,he=0,pe=0,Fe=0,Me=0,be=0,ye=0,Oe=0,we=0,Re=0,Ae=0,ke=Ze;(0|Je)<=(0|(Ze=Ze+64|0))&&Qe(64),c=(a=ke)+20|0,l=0!=(0|e),d=f=40+(s=ke+24|0)|0,E=39+s|0,s=4+(u=ke+8|0)|0,h=m=_=0,p=Ge[(i=ke+16|0)>>2]=r;e:for(;;){do{if(-1<(0|m)){if((2147483647-m|0)<(0|_)){Ge[(r=652)>>2]=75,F=-1;break}F=_+m|0;break}}while(F=m,0);if(!((r=0|Xe[p>>0])<<24>>24)){M=87;break}b=r,y=p;r:for(;;){switch(b<<24>>24){case 37:w=O=y,M=9;break r;case 0:A=R=y;break r}r=y+1|0,Ge[i>>2]=r,b=0|Xe[r>>0],y=r}r:do{if(9==(0|M))for(;;){if(37!=((M=0)|Xe[w+1>>0])){R=O,A=w;break r}if(r=O+1|0,k=w+2|0,Ge[i>>2]=k,37!=(0|Xe[k>>0])){R=r,A=k;break}O=r,w=k,M=9}}while(0);if(k=R-p|0,l&&De(e,p,k),0|k)_=k,m=F,p=A;else{N=(r=(0|Xe[(k=A+1|0)>>0])-48|0)>>>0<10?(g=(T=36==(0|Xe[A+2>>0]))?r:-1,v=T?1:h,T?A+3|0:k):(g=-1,v=h,k),Ge[i>>2]=N,T=((k=0|Xe[N>>0])<<24>>24)-32|0;r:do{if(T>>>0<32)for(r=0,D=k,P=T,C=N;;){if(!(75913&(I=1<>2]=I,32<=(P=((U=0|Xe[I>>0])<<24>>24)-32|0)>>>0){L=H,x=U,B=I;break}r=H,D=U,C=I}else L=0,x=k,B=N}while(0);if(x<<24>>24==42){if((T=(0|Xe[(k=B+1|0)>>0])-48|0)>>>0<10&&36==(0|Xe[B+2>>0]))Ge[o+(T<<2)>>2]=10,Y=0|Ge[n+((0|Xe[k>>0])-48<<3)>>2],z=1,V=B+3|0;else{if(0|v){K=-1;break}V=(z=l?(T=3+(0|Ge[t>>2])&-4,C=0|Ge[T>>2],Ge[t>>2]=T+4,Y=C,0):Y=0,k)}W=(k=(0|Y)<0)?0-Y|0:Y,X=k?8192|L:L,j=z,G=Ge[i>>2]=V}else{if((0|(k=0|Pe(i)))<0){K=-1;break}W=k,X=L,j=v,G=0|Ge[i>>2]}do{if(46==(0|Xe[G>>0])){if(42!=(0|Xe[G+1>>0])){Ge[i>>2]=G+1,q=k=0|Pe(i),Z=0|Ge[i>>2];break}if((C=(0|Xe[(k=G+2|0)>>0])-48|0)>>>0<10&&36==(0|Xe[G+3>>0])){Ge[o+(C<<2)>>2]=10,T=G+4|0,q=C=0|Ge[n+((0|Xe[k>>0])-48<<3)>>2],Z=Ge[i>>2]=T;break}if(0|j){K=-1;break e}q=l?(T=3+(0|Ge[t>>2])&-4,C=0|Ge[T>>2],Ge[t>>2]=T+4,C):0,Z=Ge[i>>2]=k}else q=-1,Z=G}while(0);for(k=0,C=Z;;){if(57<((0|Xe[C>>0])-65|0)>>>0){K=-1;break e}if(J=C+1|0,Ge[i>>2]=J,!((($=255&(Q=0|Xe[(0|Xe[C>>0])-65+(1362+(58*k|0))>>0]))+-1|0)>>>0<8))break;k=$,C=J}if(!(Q<<24>>24)){K=-1;break}T=-1<(0|g);do{if(Q<<24>>24==19){if(T){K=-1;break e}M=49}else{if(T){Ge[o+(g<<2)>>2]=$,r=0|Ge[(D=n+(g<<3)|0)+4>>2],Ge[(P=a)>>2]=Ge[D>>2],Ge[P+4>>2]=r,M=49;break}if(!l){K=0;break e}Ce(a,$,t)}}while(0);if(49!=(0|M)||(M=0,l)){r=0!=(0|k)&3==(15&(T=0|Xe[C>>0])|0)?-33&T:T,T=-65537&X,P=0==(8192&X|0)?X:T;r:do{switch(0|r){case 110:switch((255&k)<<24>>24){case 0:case 1:_=0,m=Ge[Ge[a>>2]>>2]=F,h=j,p=J;continue e;case 2:D=0|Ge[a>>2],Ge[D>>2]=F,Ge[D+4>>2]=((0|F)<0)<<31>>31,_=0,m=F,h=j,p=J;continue e;case 3:_=0,m=je[Ge[a>>2]>>1]=F,h=j,p=J;continue e;case 4:_=0,m=Xe[Ge[a>>2]>>0]=F,h=j,p=J;continue e;case 6:_=0,m=Ge[Ge[a>>2]>>2]=F,h=j,p=J;continue e;case 7:D=0|Ge[a>>2],Ge[D>>2]=F,Ge[D+4>>2]=((0|F)<0)<<31>>31,_=0,m=F,h=j,p=J;continue e;default:_=0,m=F,h=j,p=J;continue e}break;case 112:ee=120,re=8>>0?q:8,te=8|P,M=61;break;case 88:case 120:ee=r,re=q,te=P,M=61;break;case 111:ne=D=0|function(e,r,t){t|=0;var n=0,o=0;if(0==(0|(e|=0))&0==(0|(r|=0)))n=t;else for(o=t,t=r,r=e;;){if(Xe[(e=o+-1|0)>>0]=7&r|48,0==(0|(r=0|Ve(0|r,0|t,3)))&0==(0|(t=ve))){n=e;break}o=e}return 0|n}(I=0|Ge[(D=a)>>2],U=0|Ge[D+4>>2],f),ie=1826,ae=(oe=0)==(8&P|0)|(0|(H=d-D|0))<(0|q)?q:H+1|0,se=P,ue=I,ce=U,M=67;break;case 105:case 100:if(I=0|Ge[(U=a)>>2],(0|(H=0|Ge[U+4>>2]))<0){U=0|Ye(0,0,0|I,0|H),D=ve,le=1,fe=1826,de=Ge[(S=a)>>2]=U,Ee=Ge[S+4>>2]=D,M=66;break r}le=0!=(2049&P|0)&1,fe=0==(2048&P|0)?0==(1&P|0)?1826:1828:1827,de=I,Ee=H,M=66;break r;case 117:fe=1826,de=(le=0)|Ge[(H=a)>>2],Ee=0|Ge[H+4>>2],M=66;break;case 99:Xe[E>>0]=Ge[a>>2],Se=E,_e=0,me=1826,he=f,pe=1,Fe=T;break;case 109:Me=0|(0|function(e,r){e|=0,r|=0;var t=0,n=0,o=0,i=0,a=0,s=0;t=0;for(;;){if((0|qe[1896+t>>0])==(0|e)){n=2;break}if(87==(0|(o=t+1|0))){i=1984,a=87,n=5;break}t=o}2==(0|n)&&(t?(i=1984,a=t,n=5):s=1984);if(5==(0|n))for(;;){for(n=0,t=i;t=(e=t)+1|0,0!=(0|Xe[e>>0]););if(!(a=a+-1|0)){s=t;break}i=t,n=5}return 0|function(e,r){return 0|function(e,r){e|=0;var t=0;t=(r|=0)?0|function(e,r,t){r|=0,t|=0;var n=0,o=0,i=0,a=0,s=0,u=0,c=0,l=0,f=0,d=0,E=0,S=0,_=0,m=0,h=0;n=1794895138+(0|Ge[(e|=0)>>2])|0,o=0|Ue(0|Ge[e+8>>2],n),i=0|Ue(0|Ge[e+12>>2],n),a=0|Ue(0|Ge[e+16>>2],n);t:do{if(o>>>0>>2>>>0&&(s=r-(o<<2)|0,i>>>0>>0&a>>>0>>0)&&0==(3&(a|i)|0)){for(s=i>>>2,u=a>>>2,c=0,l=o;;){if(_=0|Ue(0|Ge[e+((S=(E=(d=c+(f=l>>>1)|0)<<1)+s|0)<<2)>>2],n),!((m=0|Ue(0|Ge[e+(1+S<<2)>>2],n))>>>0>>0&_>>>0<(r-m|0)>>>0)){h=0;break t}if(0|Xe[e+(m+_)>>0]){h=0;break t}if(!(_=0|function(e,r){r|=0;var t=0,n=0,o=0,i=0,t=0|Xe[(e|=0)>>0],n=0|Xe[r>>0];if(t<<24>>24==0||t<<24>>24!=n<<24>>24)o=n,i=t;else{for(t=r,r=e;t=t+1|0,e=0|Xe[(r=r+1|0)>>0],n=0|Xe[t>>0],e<<24>>24!=0&&e<<24>>24==n<<24>>24;);o=n,i=e}return(255&i)-(255&o)|0}(t,e+m|0)))break;if(m=(0|_)<0,1==(0|l)){h=0;break t}c=m?c:d,l=m?f:l-f|0}c=0|Ue(0|Ge[e+((l=E+u|0)<<2)>>2],n),s=0|Ue(0|Ge[e+(l+1<<2)>>2],n),h=s>>>0>>0&c>>>0<(r-s|0)>>>0&&0==(0|Xe[e+(s+c)>>0])?e+s|0:0}else h=0}while(0);return 0|h}(0|Ge[r>>2],0|Ge[r+4>>2],e):0;return 0|(0|t?t:e)}(e|=0,r|=0)}(s,0|Ge[r+20>>2])}(0|Ge[(H=652)>>2]|0,0|Ge[194])),M=71;break;case 115:Me=0|(H=0|Ge[a>>2])?H:1836,M=71;break;case 67:Ge[u>>2]=Ge[a>>2],Ge[s>>2]=0,be=-1,ye=Ge[a>>2]=u,M=75;break;case 83:H=0|Ge[a>>2],M=q?(be=q,ye=H,75):(xe(e,32,W,0,P),Oe=0,84);break;case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:_=0|function(e,r,t,n,o,i){e|=0,r=+r,t|=0,n|=0,o|=0,i|=0;var a=0,s=0,u=0,c=0,l=0,f=0,d=0,E=0,S=0,_=0,m=0,h=0,p=0,F=0,M=0,b=0,y=0,O=0,w=0,R=0,A=0,k=0,T=0,g=0,v=0,N=0,D=0,P=0,C=0,I=0,L=0,x=0,B=0,H=0,U=0,Y=0,z=0,V=0,K=0,W=0,X=0,j=0,G=0,q=0,Z=0,J=0,Q=0,$=0,ee=0,re=0,te=0,ne=0,oe=0,ie=0,ae=0,se=0,ue=0,ce=0,le=0,fe=0,de=0,Ee=0,Se=0,_e=0,me=0,he=0,pe=0,Fe=0,Me=0,be=0,ye=0,Oe=0,we=0;(0|(Ze=(a=Ze)+560|0))>=(0|Je)&&Qe(560);s=a+8|0,l=c=(u=a)+524|0,f=a+512|0,Ge[u>>2]=0,d=12+f|0,He(r),_=(0|ve)<0?(E=-r,S=1,1843):(E=r,S=0!=(2049&o|0)&1,0==(2048&o|0)?0==(1&o|0)?1844:1849:1846);He(E),m=2146435072&ve;do{if(m>>>0<2146435072|2146435072==(0|m)&!1){if(r=2*+function(e,r){return+ +function e(r,t){r=+r;t|=0;var n=0,o=0,i=0,a=0,s=0,u=0,c=0;Te[ge>>3]=r;n=0|Ge[ge>>2];o=0|Ge[ge+4>>2];i=0|Ve(0|n,0|o,52);switch(2047&i){case 0:u=0!=r?(a=+e(0x10000000000000000*r,t),s=a,(0|Ge[t>>2])-64|0):(s=r,0),Ge[t>>2]=u,c=s;break;case 2047:c=r;break;default:Ge[t>>2]=(2047&i)-1022,Ge[ge>>2]=n,Ge[ge+4>>2]=-2146435073&o|1071644672,c=+Te[ge>>3]}return+c}(e=+e,r|=0)}(E,u),(h=0!=r)&&(Ge[u>>2]=(0|Ge[u>>2])-1),97==(0|(p=32|i))){M=0==(0|(F=32&i))?_:_+9|0,b=2|S,y=12-n|0;do{if(!(11>>0|0==(0|y))){for(O=8,w=y;w=w+-1|0,O*=16,0!=(0|w););if(45==(0|Xe[M>>0])){R=-(O+(-r-O));break}R=r+O-O;break}}while(R=r,0);for(y=0|Ge[u>>2],A=0|Ie(w=(0|y)<0?0-y|0:y,((0|w)<0)<<31>>31,d),k=(0|A)==(0|d)?(Xe[(w=11+f|0)>>0]=48,w):A,Xe[k+-1>>0]=43+(y>>31&2),Xe[(y=k+-2|0)>>0]=i+15,A=(0|n)<1,w=0==(8&o|0),T=c,g=R;v=~~g,N=T+1|0,Xe[T>>0]=qe[1878+v>>0]|F,g=16*(g-(0|v)),D=1!=(N-l|0)||w&A&0==g?N:(Xe[N>>0]=46,T+2|0),0!=g;)T=D;xe(e,32,t,F=(A=d-y|0)+b+(w=0!=(0|n)&((T=D-l|0)+-2|0)<(0|n)?n+2|0:T)|0,o),De(e,M,b),xe(e,48,t,F,65536^o),De(e,c,T),xe(e,48,w-T|0,0,0),De(e,y,A),xe(e,32,t,F,8192^o),P=F;break}for(F=(0|n)<0?6:n,I=h?(A=(0|Ge[u>>2])-28|0,Ge[u>>2]=A,C=268435456*r,A):(C=r,0|Ge[u>>2]),A=(0|I)<0?s:288+s|0,T=A,g=C;w=~~g>>>0,Ge[T>>2]=w,T=T+4|0,g=1e9*(g-(w>>>0)),0!=g;);if(0<(0|I))for(h=A,y=T,b=I;;){if(M=(0|b)<29?b:29,h>>>0<=(w=y+-4|0)>>>0){for(N=w,w=0;v=0|Ke(0|Ge[N>>2],0,0|M),L=0|ze(0|v,0|ve,0|w,0),x=0|rr(0|L,0|(v=ve),1e9,0),Ge[N>>2]=x,w=0|We(0|L,0|v,1e9,0),N=N+-4|0,h>>>0<=N>>>0;);B=w?(Ge[(N=h+-4|0)>>2]=w,N):h}else B=h;for(N=y;!(N>>>0<=B>>>0||0|Ge[(v=N+-4|0)>>2]);)N=v;if(w=(0|Ge[u>>2])-M|0,!(0<(0|(Ge[u>>2]=w)))){H=B,U=N,Y=w;break}h=B,y=N,b=w}else H=A,U=T,Y=I;if((0|Y)<0)for(b=1+((F+25|0)/9|0)|0,y=102==(0|p),h=H,w=U,v=Y;;){if(x=(0|(L=0-v|0))<9?L:9,h>>>0>>0){for(L=(1<>>x,V=0,K=h;W=0|Ge[K>>2],Ge[K>>2]=(W>>>x)+V,V=0|Ne(W&L,z),K=K+4|0,K>>>0>>0;);K=0==(0|Ge[h>>2])?h+4|0:h,j=V?(Ge[w>>2]=V,X=K,w+4|0):(X=K,w)}else X=0==(0|Ge[h>>2])?h+4|0:h,j=w;if(z=(0|b)<(j-(K=y?A:X)>>2|0)?K+(b<<2)|0:j,v=(0|Ge[u>>2])+x|0,0<=(0|(Ge[u>>2]=v))){G=X,q=z;break}h=X,w=z}else G=H,q=U;if(w=A,G>>>0>>0)if(h=9*(w-G>>2)|0,(v=0|Ge[G>>2])>>>0<10)Z=h;else for(b=h,h=10;;){if(y=b+1|0,v>>>0<(h=10*h|0)>>>0){Z=y;break}b=y}else Z=0;if((0|(v=F-(102!=(0|p)?Z:0)+(((h=0!=(0|F))&(b=103==(0|p)))<<31>>31)|0))<((9*(q-w>>2)|0)-9|0)){if(v=A+4+(((0|(y=v+9216|0))/9|0)-1024<<2)|0,(0|(T=1+((0|y)%9|0)|0))<9)for(y=T,T=10;;){if(z=10*T|0,9==(0|(y=y+1|0))){J=z;break}T=z}else J=10;if(T=0|Ge[v>>2],(p=(v+4|0)==(0|q))&0==(0|(y=(T>>>0)%(J>>>0)|0)))ne=v,oe=Z,ie=G;else if(O=0==(1&((T>>>0)/(J>>>0)|0)|0)?9007199254740992:9007199254740994,g=y>>>0<(z=(0|J)/2|0)>>>0?.5:p&(0|y)==(0|z)?1:1.5,$=S?(z=45==(0|Xe[_>>0]),Q=z?-g:g,z?-O:O):(Q=g,O),z=T-y|0,Ge[v>>2]=z,$+Q!=$){if(y=z+J|0,999999999<(Ge[v>>2]=y)>>>0)for(y=G,z=v;;){if(T=z+-4|0,Ge[z>>2]=0,ee=T>>>0>>0?(Ge[(p=y+-4|0)>>2]=0,p):y,p=1+(0|Ge[T>>2])|0,!(999999999<(Ge[T>>2]=p)>>>0)){re=ee,te=T;break}y=ee,z=T}else re=G,te=v;if(z=9*(w-re>>2)|0,(y=0|Ge[re>>2])>>>0<10)ne=te,oe=z,ie=re;else for(T=z,z=10;;){if(p=T+1|0,y>>>0<(z=10*z|0)>>>0){ne=te,oe=p,ie=re;break}T=p}}else ne=v,oe=Z,ie=G;ae=oe,se=(T=ne+4|0)>>>0>>0?T:q,ue=ie}else ae=Z,se=q,ue=G;for(T=se;;){if(T>>>0<=ue>>>0){ce=0;break}if(0|Ge[(z=T+-4|0)>>2]){ce=1;break}T=z}v=0-ae|0;do{if(b){if(fe=(0|ae)<(0|(z=(1&(1^h))+F|0))&-5<(0|ae)?(le=i+-1|0,z+-1-ae|0):(le=i+-2|0,z+-1|0),!(z=8&o)){if(ce&&0!=(0|(y=0|Ge[T+-4>>2])))if((y>>>0)%10|0)de=0;else for(p=0,K=10;;){if(L=p+1|0,(y>>>0)%((K=10*K|0)>>>0)|0){de=L;break}p=L}else de=9;if(p=(9*(T-w>>2)|0)-9|0,102==(32|le)){Ee=le,Se=(0|fe)<(0|(y=0<(0|(K=p-de|0))?K:0))?fe:y,_e=0;break}Ee=le,Se=(0|fe)<(0|(p=0<(0|(y=p+ae-de|0))?y:0))?fe:p,_e=0;break}Ee=le,Se=fe,_e=z}else Ee=i,Se=F,_e=8&o}while(0);if(w=0!=(0|(F=Se|_e))&1,h=102==(32|Ee))he=(me=0)<(0|ae)?ae:0;else{if(p=0|Ie(b=(0|ae)<0?v:ae,((0|b)<0)<<31>>31,d),((b=d)-p|0)<2)for(y=p;;){if(Xe[(K=y+-1|0)>>0]=48,!((b-K|0)<2)){pe=K;break}y=K}else pe=p;Xe[pe+-1>>0]=43+(ae>>31&2),Xe[(y=pe+-2|0)>>0]=Ee,he=b-(me=y)|0}if(xe(e,32,t,y=S+1+Se+w+he|0,o),De(e,_,S),xe(e,48,t,y,65536^o),h){x=K=9+c|0,V=8+c|0,L=v=A>>>0>>0?A:ue;do{if(N=0|Ie(0|Ge[L>>2],0,K),(0|L)==(0|v))Fe=(0|N)==(0|K)?(Xe[V>>0]=48,V):N;else if(c>>>0>>0)for(er(0|c,48,N-l|0),M=N;;){if(!(c>>>0<(W=M+-1|0)>>>0)){Fe=W;break}M=W}else Fe=N}while(De(e,Fe,x-Fe|0),(L=L+4|0)>>>0<=A>>>0);if(0|F&&De(e,1894,1),L>>>0>>0&0<(0|Se))for(A=Se,x=L;;){if(V=0|Ie(0|Ge[x>>2],0,K),c>>>0>>0)for(er(0|c,48,V-l|0),v=V;;){if(!(c>>>0<(h=v+-1|0)>>>0)){Me=h;break}v=h}else Me=V;if(De(e,Me,(0|A)<9?A:9),v=A+-9|0,!((x=x+4|0)>>>0>>0&9<(0|A))){be=v;break}A=v}else be=Se;xe(e,48,be+9|0,9,0)}else{if(A=ce?T:ue+4|0,-1<(0|Se))for(K=0==(0|_e),L=x=9+c|0,F=0-l|0,v=8+c|0,N=Se,h=ue;;){w=0|Ie(0|Ge[h>>2],0,x),ye=(0|w)==(0|x)?(Xe[v>>0]=48,v):w;do{if((0|h)==(0|ue)){if(w=ye+1|0,De(e,ye,1),K&(0|N)<1){Oe=w;break}De(e,1894,1),Oe=w}else{if(ye>>>0<=c>>>0){Oe=ye;break}for(er(0|c,48,ye+F|0),w=ye;;){if(!(c>>>0<(b=w+-1|0)>>>0)){Oe=b;break}w=b}}}while(0);if(De(e,Oe,(0|(V=L-Oe|0))<(0|N)?V:N),!((h=h+4|0)>>>0>>0&-1<(0|(w=N-V|0)))){we=w;break}N=w}else we=Se;xe(e,48,we+18|0,18,0),De(e,me,d-me|0)}xe(e,32,t,y,8192^o),P=y}else N=0!=(32&i|0),xe(e,32,t,A=S+3|0,-65537&o),De(e,_,S),De(e,E!=E|!1?N?1870:1874:N?1862:1866,3),xe(e,32,t,A,8192^o),P=A}while(0);return Ze=a,0|((0|P)<(0|t)?t:P)}(e,+Te[a>>3],W,q,P,r),m=F,h=j,p=J;continue e;default:Se=p,_e=0,me=1826,he=f,pe=q,Fe=P}}while(0);r:do{if(61==(0|M))ne=r=(M=0)|function(e,r,t,n){t|=0,n|=0;var o=0,i=0;if(0==(0|(e|=0))&0==(0|(r|=0)))o=t;else for(i=t,t=r,r=e;;){if(Xe[(e=i+-1|0)>>0]=0|qe[1878+(15&r)>>0]|n,0==(0|(r=0|Ve(0|r,0|t,4)))&0==(0|(t=ve))){o=e;break}i=e}return 0|o}(k=0|Ge[(r=a)>>2],C=0|Ge[r+4>>2],f,32&ee),oe=(H=0==(8&te|0)|0==(0|k)&0==(0|C))?0:2,ie=H?1826:1826+(ee>>4)|0,ae=re,se=te,ue=k,ce=C,M=67;else if(66==(0|M))ne=(M=0)|Ie(de,Ee,f),oe=le,ie=fe,ae=q,se=P,ue=de,ce=Ee,M=67;else if(71==(0|M))me=1826,he=(k=(_e=M=0)==(0|(C=0|Le(Se=Me,0,q))))?Me+q|0:C,pe=k?q:C-Me|0,Fe=T;else if(75==(0|M)){for(C=ye,H=k=M=0;;){if(!(r=0|Ge[C>>2])){we=k,Re=H;break}if((0|(I=0|Be(c,r)))<0|(be-k|0)>>>0>>0){we=k,Re=I;break}if(!((r=I+k|0)>>>0>>0)){we=r,Re=I;break}C=C+4|0,k=r,H=I}if((0|Re)<0){K=-1;break e}if(xe(e,32,W,we,P),we)for(H=ye,k=0;;){if(!(C=0|Ge[H>>2])){Oe=we,M=84;break r}if((0|we)<(0|(k=(I=0|Be(c,C))+k|0))){Oe=we,M=84;break r}if(De(e,c,I),we>>>0<=k>>>0){Oe=we,M=84;break}H=H+4|0}else Oe=0,M=84}}while(0);if(67==(0|M))k=d-ne+(1&(1^(T=(M=0)!=(0|ue)|0!=(0|ce))))|0,Se=(H=0!=(0|ae)|T)?ne:f,_e=oe,me=ie,he=f,pe=!H||(0|k)<(0|ae)?ae:k,Fe=-1<(0|ae)?-65537&se:se;else if(84==(0|M)){M=0,xe(e,32,W,Oe,8192^P),_=(0|Oe)<(0|W)?W:Oe,m=F,h=j,p=J;continue}xe(e,32,I=(0|W)<(0|(T=(H=(0|pe)<(0|(k=he-Se|0))?k:pe)+_e|0))?T:W,T,Fe),De(e,me,_e),xe(e,48,I,T,65536^Fe),xe(e,48,H,k,0),De(e,Se,k),xe(e,32,I,T,8192^Fe),_=I,m=F,h=j,p=J}else _=0,m=F,h=j,p=J}}e:do{if(87==(0|M))if(e)K=F;else if(h){for(J=1;;){if(!(p=0|Ge[o+(J<<2)>>2])){Ae=J;break}if(Ce(n+(J<<3)|0,p,t),10<=(0|(J=J+1|0))){K=1;break e}}for(;;){if(0|Ge[o+(Ae<<2)>>2]){K=-1;break e}if(10<=(0|(Ae=Ae+1|0))){K=1;break}}}else K=0}while(0);return Ze=ke,0|K}function V(){return 0}function K(){0}function De(e,r,t){r|=0,t|=0,32&Ge[(e|=0)>>2]||W(r,t,e)}function Pe(e){var r=0,t=0,n=0,o=0,i=0,r=0|Ge[(e|=0)>>2];if((t=(0|Xe[r>>0])-48|0)>>>0<10)for(n=0,o=r,r=t;;){if(t=r+(10*n|0)|0,o=o+1|0,Ge[e>>2]=o,10<=(r=(0|Xe[o>>0])-48|0)>>>0){i=t;break}n=t}else i=0;return 0|i}function Ce(e,r,t){e|=0,r|=0,t|=0;var n,o=0,i=0,a=0,s=0;e:do{if(r>>>0<=20){switch(0|r){case 9:o=3+(0|Ge[t>>2])&-4,i=0|Ge[o>>2],Ge[t>>2]=o+4,Ge[e>>2]=i;break e;case 10:i=3+(0|Ge[t>>2])&-4,o=0|Ge[i>>2],Ge[t>>2]=i+4,Ge[(i=e)>>2]=o,Ge[i+4>>2]=((0|o)<0)<<31>>31;break e;case 11:o=3+(0|Ge[t>>2])&-4,i=0|Ge[o>>2],Ge[t>>2]=o+4,Ge[(o=e)>>2]=i,Ge[o+4>>2]=0;break e;case 12:o=7+(0|Ge[t>>2])&-8,n=0|Ge[(i=o)>>2],a=0|Ge[i+4>>2],Ge[t>>2]=o+8,Ge[(o=e)>>2]=n,Ge[o+4>>2]=a;break e;case 13:a=3+(0|Ge[t>>2])&-4,o=0|Ge[a>>2],Ge[t>>2]=a+4,a=(65535&o)<<16>>16,Ge[(o=e)>>2]=a,Ge[o+4>>2]=((0|a)<0)<<31>>31;break e;case 14:a=3+(0|Ge[t>>2])&-4,o=0|Ge[a>>2],Ge[t>>2]=a+4,Ge[(a=e)>>2]=65535&o,Ge[a+4>>2]=0;break e;case 15:a=3+(0|Ge[t>>2])&-4,o=0|Ge[a>>2],Ge[t>>2]=a+4,a=(255&o)<<24>>24,Ge[(o=e)>>2]=a,Ge[o+4>>2]=((0|a)<0)<<31>>31;break e;case 16:a=3+(0|Ge[t>>2])&-4,o=0|Ge[a>>2],Ge[t>>2]=a+4,Ge[(a=e)>>2]=255&o,Ge[a+4>>2]=0;break e;case 17:case 18:a=7+(0|Ge[t>>2])&-8,s=+Te[a>>3],Ge[t>>2]=a+8,Te[e>>3]=s;break e;default:break e}}}while(0)}function Ie(e,r,t){t|=0;var n=0,o=0,i=0,a=0,s=0,u=0;if(0<(r|=0)>>>0|0==(0|r)&4294967295<(e|=0)>>>0){for(n=t,o=e,i=r;r=0|rr(0|o,0|i,10,0),Xe[(n=n+-1|0)>>0]=255&r|48,o=0|We(0|(r=o),0|i,10,0),9>>0|9==(0|i)&4294967295>>0;)i=ve;a=o,s=n}else a=e,s=t;if(a)for(t=a,a=s;;){if(Xe[(s=a+-1|0)>>0]=(t>>>0)%10|48,t>>>0<10){u=s;break}t=(t>>>0)/10|0,a=s}else u=s;return 0|u}function Le(e,r,t){e|=0;var n,o,i,a,s=0,u=0,c=0,l=0,f=0,d=0,E=0,S=0,_=0,m=0,h=0,p=0,F=0,M=0,b=0,y=255&(r|=0),s=0!=(0|(t|=0));e:do{if(s&0!=(3&e|0))for(n=255&r,u=e,c=t;;){if((0|Xe[u>>0])==n<<24>>24){l=u,f=c,d=6;break e}if(!((a=0!=(0|(i=c+-1|0)))&0!=(3&(o=u+1|0)|0))){E=o,S=i,_=a,d=5;break}u=o,c=i}else E=e,S=t,_=s,d=5}while(0);5==(0|d)&&(_?(l=E,f=S,d=6):(m=E,h=0));e:do{if(6==(0|d))if(E=255&r,(0|Xe[l>>0])==E<<24>>24)m=l,h=f;else{S=0|Ne(y,16843009);r:do{if(3>>0){for(_=l,s=f;!((-2139062144&(t=Ge[_>>2]^S)^-2139062144)&t+-16843009|0);){if(t=_+4|0,!(3<(e=s+-4|0)>>>0)){p=t,F=e,d=11;break r}_=t,s=e}M=_,b=s}else p=l,F=f,d=11}while(0);if(11==(0|d)){if(!F){m=p,h=0;break}M=p,b=F}for(;;){if((0|Xe[M>>0])==E<<24>>24){m=M,h=b;break e}if(S=M+1|0,!(b=b+-1|0)){m=S,h=0;break}M=S}}}while(0);return 0|(0|h?m:0)}function xe(e,r,t,n,o){e|=0,r|=0,t|=0,n|=0,o|=0;var i,a=0,s=Ze;if((0|Je)<=(0|(Ze=Ze+256|0))&&Qe(256),i=s,(0|n)<(0|t)&0==(73728&o|0)){if(er(0|i,0|r,0|((o=t-n|0)>>>0<256?o:256)),255>>0){for(r=t-n|0,n=o;De(e,i,256),n=n+-256|0,255>>0;);a=255&r}else a=o;De(e,i,a)}Ze=s}function Be(e,r){r|=0;return 0|((e|=0)?0|function(e,r){e|=0,r|=0,0;var t=0;do{if(e){if(r>>>0<128){Xe[e>>0]=r,t=1;break}if(!(0|Ge[Ge[776>>2]>>2])){if(57216==(-128&r|0)){Xe[e>>0]=r,t=1;break}Ge[652>>2]=84,t=-1;break}if(r>>>0<2048){Xe[e>>0]=r>>>6|192,Xe[e+1>>0]=63&r|128,t=2;break}if(r>>>0<55296|57344==(-8192&r|0)){Xe[e>>0]=r>>>12|224,Xe[e+1>>0]=r>>>6&63|128,Xe[e+2>>0]=63&r|128,t=3;break}if((r+-65536|0)>>>0<1048576){Xe[e>>0]=r>>>18|240,Xe[e+1>>0]=r>>>12&63|128,Xe[e+2>>0]=r>>>6&63|128,Xe[e+3>>0]=63&r|128,t=4;break}Ge[652>>2]=84,t=-1;break}}while(t=1,0);return 0|t}(e,r):0)}function He(e){e=+e;var r;return Te[ge>>3]=e,r=0|Ge[ge>>2],ve=0|Ge[ge+4>>2],0|r}function Ue(e,r){var t=0|ce(0|(e|=0));return 0|(0==(0|(r|=0))?e:t)}function W(e,r,t){e|=0,r|=0;var n,o=0,i=0,a=0,s=0,u=0,c=0,l=0,f=0,d=0,E=0;(i=0|Ge[(o=(t|=0)+16|0)>>2])?(a=i,s=5):0|X(t)?u=0:(a=0|Ge[o>>2],s=5);e:do{if(5==(0|s)){if((a-(n=o=0|Ge[(i=t+20|0)>>2])|0)>>>0>>0){u=0|de[7&Ge[t+36>>2]](t,e,r);break}r:do{if(-1<(0|Xe[t+75>>0])){for(o=r;;){if(!o){c=0,l=e,f=r,d=n;break r}if(10==(0|Xe[e+(E=o+-1|0)>>0]))break;o=E}if((E=0|de[7&Ge[t+36>>2]](t,e,o))>>>0>>0){u=E;break e}l=e+(c=o)|0,f=r-o|0,d=0|Ge[i>>2]}else c=0,l=e,f=r,d=n}while(0);tr(0|d,0|l,0|f),Ge[i>>2]=(0|Ge[i>>2])+f,u=c+f|0}}while(0);return 0|u}function X(e){var r=0,t=0|Xe[(r=(e|=0)+74|0)>>0];return Xe[r>>0]=255+t|t,0|(8&(t=0|Ge[e>>2])?(Ge[e>>2]=32|t,-1):(Ge[e+8>>2]=0,r=(Ge[e+4>>2]=0)|Ge[e+44>>2],Ge[e+28>>2]=r,Ge[e+20>>2]=r,Ge[e+16>>2]=r+(0|Ge[e+48>>2]),0))}function j(e){var r,t=0,n=0,o=0,i=0,a=0,s=0,u=0,c=0,t=e|=0;e:do{if(3&t)for(i=e,a=t;;){if(!(0|Xe[i>>0])){s=a;break e}if(!(3&(a=r=i+1|0))){n=r,o=4;break}i=r}else n=e,o=4}while(0);if(4==(0|o)){for(o=n;!((-2139062144&(u=0|Ge[o>>2])^-2139062144)&u+-16843009);)o=o+4|0;if((255&u)<<24>>24)for(u=o;;){if(!(0|Xe[(o=u+1|0)>>0])){c=o;break}u=o}else c=o;s=c}return s-t|0}function G(e,r){var t=0|function(e,r){e|=0;var t=0,n=0,o=0,i=0,a=0,s=0,u=0,c=0,l=0;t=255&(r|=0);e:do{if(t){if(3&e)for(i=255&r,a=e;;){if((s=0|Xe[a>>0])<<24>>24==0||s<<24>>24==i<<24>>24){n=a;break e}if(!(3&(s=a+1|0))){o=s;break}a=s}else o=e;a=0|Ne(t,16843009),i=0|Ge[o>>2];r:do{if((-2139062144&i^-2139062144)&i+-16843009)l=o;else for(s=o,u=i;;){if((-2139062144&(c=u^a)^-2139062144)&c-16843009|0){l=s;break r}if((-2139062144&(u=0|Ge[(c=s+4|0)>>2])^-2139062144)&u+-16843009|0){l=c;break}s=c}}while(0);for(a=255&r,i=l;;){if((s=0|Xe[i>>0])<<24>>24==0||s<<24>>24==a<<24>>24){n=i;break}i=i+1|0}}else n=e+(0|j(e))|0}while(0);return 0|n}(e|=0,r|=0);return 0|((0|Xe[t>>0])==(255&r)<<24>>24?t:0)}function q(e,r){r|=0;var t=0;return((0|function(e,r,t,n){e|=0,n|=0;var o=0,i=0,a=0,s=0,u=0;o=0|Ne(t|=0,r|=0),i=0==(0|r)?0:t,s=-1<(0|Ge[n+76>>2])?(t=!0,a=0|W(e,o,n),t||K(),a):0|W(e,o,n);u=(0|s)==(0|o)?i:(s>>>0)/(r>>>0)|0;return 0|u}(e|=0,1,t=0|j(e),r))!=(0|t))<<31>>31|0}function Z(e){var r,t;0|Ge[(e|=0)+68>>2]&&(t=e+112|0,0|(r=0|Ge[e+116>>2])&&(Ge[112+r>>2]=Ge[t>>2]),e=0|Ge[t>>2],Ge[(e?e+116|0:820)>>2]=r)}function J(e,r){e|=0,r|=0;var t,n,o=0,i=0,a=0,s=0,u=0,c=0,l=Ze;(0|Je)<=(0|(Ze=Ze+16|0))&&Qe(16),n=255&r,Xe[(t=l)>>0]=n,(i=0|Ge[(o=e+16|0)>>2])?(a=i,s=4):0|X(e)?u=-1:(a=0|Ge[o>>2],s=4);do{if(4==(0|s)){if((o=0|Ge[(i=e+20|0)>>2])>>>0>>0&&(0|(c=255&r))!=(0|Xe[e+75>>0])){Ge[i>>2]=o+1,Xe[o>>0]=n,u=c;break}u=1==(0|de[7&Ge[e+36>>2]](e,t,1))?0|qe[t>>0]:-1}}while(0);return Ze=l,0|u}function Q(){return b(4352),4360}function $(){g(4352)}function ee(e){var r,t,n,o=0,i=0,a=0,o=(Ge[(e|=0)+76>>2],0);return Z(e),(r=0!=(1&Ge[e>>2]|0))||(i=0|Q(),n=e+56|0,0|(t=0|Ge[e+52>>2])&&(Ge[56+t>>2]=Ge[n>>2]),0|(a=0|Ge[n>>2])&&(Ge[a+52>>2]=t),(0|Ge[i>>2])==(0|e)&&(Ge[i>>2]=a),$()),a=0|re(e),i=0|fe[1&Ge[e+12>>2]](e)|a,0|(a=0|Ge[e+92>>2])&&B(a),r?0|o&&K():B(e),0|i}function re(e){e|=0;var r=0,t=0,n=0,o=0,i=0,a=0,s=0;do{if(e){if((0|Ge[e+76>>2])<=-1){r=0|te(e);break}r=((t=!0)||K(),n=0|te(e))}else{if(o=0|Ge[240]?0|re(0|Ge[240]):0,n=0|Q(),t=0|Ge[n>>2])for(n=t,t=o;;){if(a=(Ge[n+76>>2],0),s=(0|Ge[n+20>>2])>>>0>(0|Ge[n+28>>2])>>>0?0|te(n)|t:t,0|a&&K(),!(n=0|Ge[n+56>>2])){i=s;break}t=s}else i=o;$(),r=i}}while(0);return 0|r}function te(e){var r,t,n,o,i=0,a=(e|=0)+28|0;return 0|((0|Ge[(i=e+20|0)>>2])>>>0>(0|Ge[a>>2])>>>0&&(de[7&Ge[e+36>>2]](e,0,0),0==(0|Ge[i>>2]))?-1:((t=0|Ge[(r=e+4|0)>>2])>>>0<(o=0|Ge[(n=e+8|0)>>2])>>>0&&de[7&Ge[e+40>>2]](e,t-o|0,1),Ge[e+16>>2]=0,Ge[a>>2]=0,Ge[i>>2]=0,Ge[n>>2]=0,Ge[r>>2]=0))}function ne(e,r,t){e|=0,r|=0;var n=0,n=1==(0|(t|=0))?r-(0|Ge[e+8>>2])+(0|Ge[e+4>>2])|0:r,o=e+28|0;return 0|((0|Ge[(r=e+20|0)>>2])>>>0>(0|Ge[o>>2])>>>0&&(de[7&Ge[e+36>>2]](e,0,0),0==(0|Ge[r>>2]))?-1:(Ge[e+16>>2]=0,Ge[o>>2]=0,((Ge[r>>2]=0)|de[7&Ge[e+40>>2]](e,n,t))<0?-1:(Ge[e+8>>2]=0,Ge[e+4>>2]=0,Ge[e>>2]=-17&Ge[e>>2],0)))}function oe(e){var r=0,t=0,r=128&Ge[(e|=0)>>2]&&(0|Ge[e+20>>2])>>>0>(0|Ge[e+28>>2])>>>0?2:1;return 0|((0|(t=0|de[7&Ge[e+40>>2]](e,0,r)))<0?t:t-(0|Ge[e+8>>2])+(0|Ge[e+4>>2])+(0|Ge[e+20>>2])-(0|Ge[e+28>>2])|0)}function ie(e,r){e|=0,r|=0;var t,n=Ze;return(0|Je)<=(0|(Ze=Ze+16|0))&&Qe(16),Ge[(t=n)>>2]=r,r=0|function(e,r,t){e|=0,r|=0,t|=0;var n,o,i,a,s,u,c,l=0,f=0,d=0,E=0,S=0,_=0,m=Ze;for(Ze=Ze+224|0,(0|Je)<=(0|Ze)&&Qe(224),n=m+120|0,l=m+80|0,c=m,o=m+136|0,f=l,d=f+40|0;f=f+4|(Ge[f>>2]=0),(0|f)<(0|d););return Ge[n>>2]=Ge[t>>2],E=(0|z(0,r,n,c,l))<0?-1:(S=-1<(0|Ge[e+76>>2])?0|V():0,f=32&(t=0|Ge[e>>2]),(0|Xe[e+74>>0])<1&&(Ge[e>>2]=-33&t),_=0|Ge[(t=e+48|0)>>2]?0|z(e,r,n,c,l):(i=0|Ge[(d=e+44|0)>>2],Ge[d>>2]=o,Ge[(a=e+28|0)>>2]=o,Ge[(s=e+20|0)>>2]=o,Ge[t>>2]=80,Ge[(u=e+16|0)>>2]=80+o,o=0|z(e,r,n,c,l),i?(de[7&Ge[e+36>>2]](e,0,0),c=0==(0|Ge[s>>2])?-1:o,Ge[d>>2]=i,Ge[t>>2]=0,Ge[u>>2]=0,Ge[a>>2]=0,Ge[s>>2]=0,c):o),l=0|Ge[e>>2],Ge[e>>2]=l|f,0|S&&K(),0==(32&l|0)?_:-1),Ze=m,0|E}(0|Ge[208],e,t),Ze=n,0|r}function ae(e){e|=0;var r=0,t=0,n=0,o=0,i=0|Ge[208],r=(Ge[76+i>>2],0);do{if((0|q(e,i))<0)t=1;else{if(10!=(0|Xe[75+i>>0])&&(o=0|Ge[(n=20+i|0)>>2])>>>0<(0|Ge[16+i>>2])>>>0){Ge[n>>2]=o+1,Xe[o>>0]=10,t=0;break}t=(0|J(i,10))<0}}while(0);return 0|r&&K(),t<<31>>31|0}function Ye(e,r,t,n){r|=0,n|=0;return 0|(ve=r-n-((e|=0)>>>0<(t|=0)>>>0|0)>>>0,e-t>>>0|0)}function ze(e,r,t,n){var o=0;return 0|(ve=(r|=0)+(n|=0)+((o=(e|=0)+(t|=0)>>>0)>>>0>>0|0)>>>0,0|o)}function er(e,r,t){r|=0;var n,o,i,a=(e|=0)+(t|=0)|0;if(r&=255,67<=(0|t)){for(;3&e;)Xe[e>>0]=r,e=e+1|0;for(o=(n=-4&a|0)-64|0,i=r|r<<8|r<<16|r<<24;(0|e)<=(0|o);)Ge[e>>2]=i,Ge[e+4>>2]=i,Ge[e+8>>2]=i,Ge[e+12>>2]=i,Ge[e+16>>2]=i,Ge[e+20>>2]=i,Ge[e+24>>2]=i,Ge[e+28>>2]=i,Ge[e+32>>2]=i,Ge[e+36>>2]=i,Ge[e+40>>2]=i,Ge[e+44>>2]=i,Ge[e+48>>2]=i,Ge[e+52>>2]=i,Ge[e+56>>2]=i,Ge[e+60>>2]=i,e=e+64|0;for(;(0|e)<(0|n);)Ge[e>>2]=i,e=e+4|0}for(;(0|e)<(0|a);)Xe[e>>0]=r,e=e+1|0;return a-t|0}function Ve(e,r,t){return e|=0,r|=0,(0|(t|=0))<32?(ve=r>>>t,e>>>t|(r&(1<>>t-32|(ve=0)}function Ke(e,r,t){return e|=0,r|=0,(0|(t|=0))<32?(ve=r<>>32-t,e<>0]))<8?0|r:(0|(r=0|Xe[E+(e>>8&255)>>0]))<8?r+8|0:(0|(r=0|Xe[E+(e>>16&255)>>0]))<8?r+16|0:24+(0|Xe[E+(e>>>24)>>0])|0}function ue(e,r,t,n,o){o|=0;var i,a,s,u=0,c=0,l=0,f=0,d=0,E=0,S=0,_=0,m=0,h=0,p=0,F=0,M=0,b=0,y=0,O=0,w=0,R=0,A=0,k=0,T=0,g=0,v=0,N=0,u=e|=0,f=t|=0,E=d=n|=0;if(!(l=c=r|=0))return S=0!=(0|o),E?(S&&(Ge[o>>2]=0|e,Ge[o+4>>2]=0&r),(m=_=0)|(ve=_,m)):(S&&(Ge[o>>2]=(u>>>0)%(f>>>0),Ge[o+4>>2]=0),(_=0)|(ve=_,m=(u>>>0)/(f>>>0)>>>0));S=0==(0|E);do{if(f){if(!S){if((h=(0|D(0|E))-(0|D(0|l))|0)>>>0<=31){y=u>>>((b=p=h+1|0)>>>0)&(M=h-31>>31)|l<<(F=31-h|0),O=l>>>(p>>>0)&M,w=0,R=u<>2]=0|e,Ge[o+4>>2]=c|0&r,(m=_=0)|(ve=_,m)):(m=_=0)|(ve=_,m)}if((F=f-1|0)&f|0){y=(h=32-(M=33+(0|D(0|f))-(0|D(0|l))|0)|0)-1>>31&l>>>((a=M-32|0)>>>0)|(l<>>((b=M)>>>0))&(s=a>>31),O=s&l>>>(M>>>0),w=u<<(p=64-M|0)&(i=h>>31),R=(l<>>(a>>>0))&i|u<>31;break}return 0|o&&(Ge[o>>2]=F&u,Ge[o+4>>2]=0),1==(0|f)?0|(ve=_=c|0&r,m=0|e):(F=0|se(0|f),0|(ve=_=l>>>(F>>>0)|0,m=l<<32-F|u>>>(F>>>0)|0))}if(S)return 0|o&&(Ge[o>>2]=(l>>>0)%(f>>>0),Ge[o+4>>2]=0),(_=0)|(ve=_,m=(l>>>0)/(f>>>0)>>>0);if(!u)return 0|o&&(Ge[o>>2]=0,Ge[o+4>>2]=(l>>>0)%(E>>>0)),(_=0)|(ve=_,m=(l>>>0)/(E>>>0)>>>0);if(!((F=E-1|0)&E))return 0|o&&(Ge[o>>2]=0|e,Ge[o+4>>2]=F&l|0&r),m=l>>>(((_=0)|se(0|E))>>>0),0|(ve=_,m);if((F=(0|D(0|E))-(0|D(0|l))|0)>>>0<=30){y=l<<(h=31-F|0)|u>>>((b=M=F+1|0)>>>0),O=l>>>(M>>>0),w=0,R=u<>2]=0|e,Ge[o+4>>2]=c|0&r),(m=_=0)|(ve=_,m)}while(0);if(b){for(r=0|t,t=d|0&n,n=0|ze(0|r,0|t,-1,-1),d=ve,c=R,R=w,w=O,O=y,y=b,b=0;c=R>>>31|(e=c)<<1,R=b|R<<1,Ye(0|n,0|d,0|(u=O<<1|e>>>31|0),0|(e=O>>>31|w<<1|0)),b=1&(E=(l=ve)>>31|((0|l)<0?-1:0)<<1),O=0|Ye(0|u,0|e,E&r|0,(((0|l)<0?-1:0)>>31|((0|l)<0?-1:0)<<1)&t|0),w=ve,y=y-1|0,0!=(0|y););A=c,k=R,T=w,g=O,v=0,N=b}else A=R,k=w,T=O,g=y,N=v=0;return b=k,(k=0)|o&&(Ge[o>>2]=g,Ge[o+4>>2]=T),0|(ve=_=(0|b)>>>31|(A|k)<<1|0&(k<<1|b>>>31)|v,m=-2&(b<<1|0)|N)}function We(e,r,t,n){return 0|ue(e|=0,r|=0,t|=0,n|=0,0)}function Oe(e){var r,t;return 0<(0|(e=(e|=0)+15&-16|0))&(0|(t=(r=0|Ge[d>>2])+e|0))<(0|r)|(0|t)<0?(h(),O(12),-1):(0|(Ge[d>>2]=t))>(0|m())&&0==(0|_())?(Ge[d>>2]=r,O(12),-1):0|r}function rr(e,r,t,n){var o,i=Ze;return Ze=Ze+16|0,ue(e|=0,r|=0,t|=0,n|=0,o=0|i),Ze=i,0|(ve=0|Ge[4+o>>2],0|Ge[o>>2])}function tr(e,r,t){e|=0,r|=0;var n,o,i=0;if(8192<=(0|(t|=0)))return 0|k(0|e,0|r,0|t);if(n=0|e,o=e+t|0,(3&e)==(3&r)){for(;3&e;){if(!t)return 0|n;Xe[e>>0]=0|Xe[r>>0],e=e+1|0,r=r+1|0,t=t-1|0}for(t=(i=-4&o|0)-64|0;(0|e)<=(0|t);)Ge[e>>2]=Ge[r>>2],Ge[e+4>>2]=Ge[r+4>>2],Ge[e+8>>2]=Ge[r+8>>2],Ge[e+12>>2]=Ge[r+12>>2],Ge[e+16>>2]=Ge[r+16>>2],Ge[e+20>>2]=Ge[r+20>>2],Ge[e+24>>2]=Ge[r+24>>2],Ge[e+28>>2]=Ge[r+28>>2],Ge[e+32>>2]=Ge[r+32>>2],Ge[e+36>>2]=Ge[r+36>>2],Ge[e+40>>2]=Ge[r+40>>2],Ge[e+44>>2]=Ge[r+44>>2],Ge[e+48>>2]=Ge[r+48>>2],Ge[e+52>>2]=Ge[r+52>>2],Ge[e+56>>2]=Ge[r+56>>2],Ge[e+60>>2]=Ge[r+60>>2],e=e+64|0,r=r+64|0;for(;(0|e)<(0|i);)Ge[e>>2]=Ge[r>>2],e=e+4|0,r=r+4|0}else for(i=o-4|0;(0|e)<(0|i);)Xe[e>>0]=0|Xe[r>>0],Xe[e+1>>0]=0|Xe[r+1>>0],Xe[e+2>>0]=0|Xe[r+2>>0],Xe[e+3>>0]=0|Xe[r+3>>0],e=e+4|0,r=r+4|0;for(;(0|e)<(0|o);)Xe[e>>0]=0|Xe[r>>0],e=e+1|0,r=r+1|0;return 0|n}function ce(e){return(255&(e|=0))<<24|(e>>8&255)<<16|(e>>16&255)<<8|e>>>24|0}function le(e,r,t){return F(1),0}var fe=[function(e){return p(0),0},function(e){e|=0;var r,t=Ze;return(0|Je)<=(0|(Ze=Ze+16|0))&&Qe(16),r=t,e=0|(e=0|Ge[e+60>>2],0|(e|=0)),Ge[r>>2]=e,e=0|U(0|y(6,0|r)),Ze=t,0|e}],de=[le,function(e,r,t){e|=0,r|=0,t|=0;var n=0,o=Ze;return(0|Je)<=(0|(Ze=Ze+32|0))&&Qe(32),n=o,Ge[e+36>>2]=3,0==(64&Ge[e>>2]|0)&&(Ge[n>>2]=Ge[e+60>>2],Ge[n+4>>2]=21523,Ge[n+8>>2]=o+16,0|T(54,0|n))&&(Xe[e+75>>0]=-1),n=0|H(e,r,t),Ze=o,0|n},function(e,r,t){e|=0,r|=0,t|=0;var n,o,i=0,a=Ze;return(0|Je)<=(0|(Ze=Ze+32|0))&&Qe(32),o=(n=a)+20|0,Ge[n>>2]=Ge[e+60>>2],Ge[n+4>>2]=0,Ge[n+8>>2]=r,Ge[n+12>>2]=o,Ge[n+16>>2]=t,i=(0|U(0|w(140,0|n)))<0?Ge[o>>2]=-1:0|Ge[o>>2],Ze=a,0|i},H,function(e,r,t){e|=0,r|=0,t|=0;var n,o,i,a,s,u=0,c=0,l=Ze;return(0|Je)<=(0|(Ze=Ze+32|0))&&Qe(32),Ge[(o=(n=l)+16|0)>>2]=r,u=4+o|0,a=0|Ge[(i=e+48|0)>>2],Ge[u>>2]=t-(0!=(0|a)&1),s=e+44|0,Ge[8+o>>2]=Ge[s>>2],Ge[12+o>>2]=a,Ge[n>>2]=Ge[e+60>>2],Ge[n+4>>2]=o,Ge[n+8>>2]=2,c=1<=(0|(o=0|U(0|v(145,0|n))))?(n=0|Ge[u>>2])>>>0>>0?(u=0|Ge[s>>2],Ge[(s=e+4|0)>>2]=u,Ge[e+8>>2]=u+(o-n),0|Ge[i>>2]&&(Ge[s>>2]=u+1,Xe[r+(t+-1)>>0]=0|Xe[u>>0]),t):o:(Ge[e>>2]=Ge[e>>2]|48&o^16,o),Ze=l,0|c},le,le,le];return{_llvm_bswap_i32:ce,_i64Subtract:Ye,___udivdi3:We,setThrew:function(e,r){e|=0,r|=0,S||(S=e,0)},_bitshift64Lshr:Ve,_bitshift64Shl:Ke,_fflush:re,___errno_location:Y,_extract:function(e){return N(e|=0,0),1},_memset:er,_sbrk:Oe,_memcpy:tr,stackAlloc:function(e){var r=Ze;return(0|Je)<=(0|(Ze=(Ze=Ze+(e|=0)|0)+15&-16))&&Qe(0|e),0|r},___uremdi3:rr,getTempRet0:function(){return 0|ve},setTempRet0:function(e){ve=e|=0},_i64Add:ze,dynCall_iiii:function(e,r,t,n){return r|=0,t|=0,n|=0,0|de[7&(e|=0)](0|r,0|t,0|n)},_emscripten_get_global_libc:function(){return 4288},dynCall_ii:function(e,r){return r|=0,0|fe[1&(e|=0)](0|r)},stackSave:function(){return 0|Ze},_free:B,runPostSets:function(){},establishStackSpace:function(e,r){Ze=e|=0,Je=r|=0},stackRestore:function(e){Ze=e|=0},_malloc:x,_emscripten_replace_memory:function(e){return!(16777215&f(e)||f(e)<=16777215||2147483648>2],e=-16&(r+e+15|0);if((HEAP32[DYNAMICTOP_PTR>>2]=e,TOTAL_MEMORY<=e)&&!enlargeMemory())return HEAP32[DYNAMICTOP_PTR>>2]=r,0;return r},alignMemory:function(e,r){return e=Math.ceil(e/(r||16))*(r||16)},makeBigInt:function(e,r,t){return t?+(e>>>0)+4294967296*(r>>>0):+(e>>>0)+4294967296*(0|r)},GLOBAL_BASE:8,QUANTUM_SIZE:4,__dummy__:0};Module.Runtime=Runtime;var ABORT=0,EXITSTATUS=0,cwrap,ccall;function assert(e,r){e||abort("Assertion failed: "+r)}function getCFunc(_0x5d9040){var _0x23b817=Module["_"+_0x5d9040];if(!_0x23b817)try{_0x23b817=eval("_"+_0x5d9040)}catch(_0x2989f0){}return assert(_0x23b817,"Cannot call unknown function "+_0x5d9040+" (perhaps LLVM optimizations or closure removed it?)"),_0x23b817}function setValue(e,r,t,n){switch("*"===(t=t||"i8").charAt(t.length-1)&&(t="i32"),t){case"i1":case"i8":HEAP8[e>>0]=r;break;case"i16":HEAP16[e>>1]=r;break;case"i32":HEAP32[e>>2]=r;break;case"i64":tempI64=[r>>>0,(tempDouble=r,1<=+Math_abs(tempDouble)?0>>0:~~+Math_ceil((tempDouble-(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[e>>2]=tempI64[0],HEAP32[e+4>>2]=tempI64[1];break;case"float":HEAPF32[e>>2]=r;break;case"double":HEAPF64[e>>3]=r;break;default:abort("invalid type for setValue: "+t)}}function getValue(e,r,t){switch("*"===(r=r||"i8").charAt(r.length-1)&&(r="i32"),r){case"i1":case"i8":return HEAP8[e>>0];case"i16":return HEAP16[e>>1];case"i32":case"i64":return HEAP32[e>>2];case"float":return HEAPF32[e>>2];case"double":return HEAPF64[e>>3];default:abort("invalid type for setValue: "+r)}return null}!function(){var _0x2ad24a={stackSave:function(){Runtime.stackSave()},stackRestore:function(){Runtime.stackRestore()},arrayToC:function(e){var r=Runtime.stackAlloc(e.length);return writeArrayToMemory(e,r),r},stringToC:function(e){var r,t=0;return null!=e&&0!==e&&(r=1+(e.length<<2),stringToUTF8(e,t=Runtime.stackAlloc(r),r)),t}},_0x3c7171={string:_0x2ad24a.stringToC,array:_0x2ad24a.arrayToC};ccall=function(e,r,t,n,o){var e=getCFunc(e),i=[],a=0;if(assert("array"!==r,'Return type should not be "array".'),n)for(var s=0;s>2]=0;for(u=s+i;n>0]=0;return s}if("i8"===a)return e.subarray||e.slice?HEAPU8.set(e,s):HEAPU8.set(new Uint8Array(e),s),s;for(var c,l,f,d=0;d>0],(0!=t||r)&&(o++,!r||o!=r););r=r||o;var i="";if(n<128){for(var a;0>0];if(!t)return r;r+=String.fromCharCode(t)}}function stringToAscii(e,r){return writeAsciiToMemory(e,r,!1)}Module.ALLOC_NORMAL=ALLOC_NORMAL,Module.ALLOC_STACK=ALLOC_STACK,Module.ALLOC_STATIC=ALLOC_STATIC,Module.ALLOC_DYNAMIC=ALLOC_DYNAMIC,Module.ALLOC_NONE=ALLOC_NONE,Module.allocate=allocate,Module.getMemory=getMemory,Module.Pointer_stringify=Pointer_stringify,Module.AsciiToString=AsciiToString,Module.stringToAscii=stringToAscii;var UTF8Decoder="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function UTF8ArrayToString(e,r){for(var t=r;e[t];)++t;if(16>10,56320|1023&o))):u+=String.fromCharCode((31&a)<<6|s)):u+=String.fromCharCode(a)}}function UTF8ToString(e){return UTF8ArrayToString(HEAPU8,e)}function stringToUTF8Array(e,r,t,n){if(!(0>6,r[t++]=128|63&s}else if(s<=65535){if(i<=t+2)break;r[t++]=224|s>>12,r[t++]=128|s>>6&63,r[t++]=128|63&s}else if(s<=2097151){if(i<=t+3)break;r[t++]=240|s>>18,r[t++]=128|s>>12&63,r[t++]=128|s>>6&63,r[t++]=128|63&s}else if(s<=67108863){if(i<=t+4)break;r[t++]=248|s>>24,r[t++]=128|s>>18&63,r[t++]=128|s>>12&63,r[t++]=128|s>>6&63,r[t++]=128|63&s}else{if(i<=t+5)break;r[t++]=252|s>>30,r[t++]=128|s>>24&63,r[t++]=128|s>>18&63,r[t++]=128|s>>12&63,r[t++]=128|s>>6&63,r[t++]=128|63&s}}return r[t]=0,t-o}function stringToUTF8(e,r,t){return assert("number"==typeof t,"stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),stringToUTF8Array(e,HEAPU8,r,t)}function lengthBytesUTF8(e){for(var r=0,t=0;t>2)-1]=34821223,HEAPU32[(STACK_MAX>>2)-2]=2310721022}function checkStackCookie(){if(34821223==HEAPU32[(STACK_MAX>>2)-1]&&2310721022==HEAPU32[(STACK_MAX>>2)-2]||abort("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x02135467, but received 0x"+HEAPU32[(STACK_MAX>>2)-2].toString(16)+" "+HEAPU32[(STACK_MAX>>2)-1].toString(16)),1668509029!==HEAP32[0])throw"Runtime error: The application has corrupted its heap memory area (address zero)!"}function abortStackOverflow(e){abort("Stack overflow! Attempted to allocate "+e+" bytes on the stack, but stack has only "+(STACK_MAX-Module.asm.stackSave()+e)+" bytes available!")}function abortOnCannotGrowMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+TOTAL_MEMORY+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or (4) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}function enlargeMemory(){assert(HEAP32[DYNAMICTOP_PTR>>2]>TOTAL_MEMORY);var e=Module.usingWasm?WASM_PAGE_SIZE:ASMJS_PAGE_SIZE,r=2147483648-e;if(HEAP32[DYNAMICTOP_PTR>>2]>r)return Module.printErr("Cannot enlarge memory, asked to go up to "+HEAP32[DYNAMICTOP_PTR>>2]+" bytes, but the limit is "+r+" bytes!"),!1;var t=TOTAL_MEMORY;for(TOTAL_MEMORY=Math.max(TOTAL_MEMORY,MIN_TOTAL_MEMORY);TOTAL_MEMORY>2];)TOTAL_MEMORY=TOTAL_MEMORY<=536870912?alignUp(2*TOTAL_MEMORY,e):Math.min(alignUp((3*TOTAL_MEMORY+2147483648)/4,e),r);var n=Date.now(),o=Module.reallocBuffer(TOTAL_MEMORY);return o&&o.byteLength==TOTAL_MEMORY?(updateGlobalBuffer(o),updateGlobalBufferViews(),Module.printErr("enlarged memory arrays from "+t+" to "+TOTAL_MEMORY+", took "+(Date.now()-n)+" ms (has ArrayBuffer.transfer? "+!!ArrayBuffer.transfer+")"),Module.usingWasm||Module.printErr("Warning: Enlarging memory arrays, this is not fast! "+[t,TOTAL_MEMORY]),!0):(Module.printErr("Failed to grow the heap from "+t+" bytes to "+TOTAL_MEMORY+" bytes, not enough memory!"),o&&Module.printErr("Expected to get back a buffer of size "+TOTAL_MEMORY+" bytes, but instead got back a buffer of size "+o.byteLength),TOTAL_MEMORY=t,!1)}STATIC_BASE=STATICTOP=STACK_BASE=STACKTOP=STACK_MAX=DYNAMIC_BASE=DYNAMICTOP_PTR=0,staticSealed=!1,Module.reallocBuffer||(Module.reallocBuffer=function(e){var r,t;try{ArrayBuffer.transfer?t=ArrayBuffer.transfer(buffer,e):(r=HEAP8,t=new ArrayBuffer(e),new Int8Array(t).set(r))}catch(e){return!1}return!!_emscripten_replace_memory(t)&&t});try{byteLength=Function.prototype.call.bind(Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength").get),byteLength(new ArrayBuffer(4))}catch(_0x5226f8){byteLength=function(e){return e.byteLength}}var TOTAL_STACK=Module.TOTAL_STACK||5242880,TOTAL_MEMORY=Module.TOTAL_MEMORY||16777216;function getTotalMemory(){return TOTAL_MEMORY}if(TOTAL_MEMORY>0]=e.charCodeAt(n);t||(HEAP8[r>>0]=0)}Module.addOnPreRun=addOnPreRun,Module.addOnInit=addOnInit,Module.addOnPreMain=addOnPreMain,Module.addOnExit=addOnExit,Module.addOnPostRun=addOnPostRun,Module.intArrayFromString=intArrayFromString,Module.intArrayToString=intArrayToString,Module.writeStringToMemory=writeStringToMemory,Module.writeArrayToMemory=writeArrayToMemory,Module.writeAsciiToMemory=writeAsciiToMemory,Math.imul&&-5===Math.imul(4294967295,5)||(Math.imul=function(e,r){var t=65535&e,n=65535&r;return t*n+((e>>>16)*n+t*(r>>>16)<<16)|0}),Math.imul=Math.imul,Math.clz32||(Math.clz32=function(e){e>>>=0;for(var r=0;r<32;r++)if(e&1<<31-r)return r;return 32}),Math.clz32=Math.clz32,Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Math.trunc=Math.trunc;var Math_abs=Math.abs,Math_cos=Math.cos,Math_sin=Math.sin,Math_tan=Math.tan,Math_acos=Math.acos,Math_asin=Math.asin,Math_atan=Math.atan,Math_atan2=Math.atan2,Math_exp=Math.exp,Math_log=Math.log,Math_sqrt=Math.sqrt,Math_ceil=Math.ceil,Math_floor=Math.floor,Math_pow=Math.pow,Math_imul=Math.imul,Math_fround=Math.fround,Math_round=Math.round,Math_min=Math.min,Math_clz32=Math.clz32,Math_trunc=Math.trunc,runDependencies=0,runDependencyWatcher=null,dependenciesFulfilled=null,runDependencyTracking={};function getUniqueRunDependency(e){for(var r=e;;){if(!runDependencyTracking[e])return e;e=r+Math.random()}return e}function addRunDependency(e){runDependencies++,Module.monitorRunDependencies&&Module.monitorRunDependencies(runDependencies),e?(assert(!runDependencyTracking[e]),runDependencyTracking[e]=1,null===runDependencyWatcher&&"undefined"!=typeof setInterval&&(runDependencyWatcher=setInterval(function(){if(ABORT)return clearInterval(runDependencyWatcher),void(runDependencyWatcher=null);var e,r=!1;for(e in runDependencyTracking)r||(r=!0,Module.printErr("still waiting on run dependencies:")),Module.printErr("dependency: "+e);r&&Module.printErr("(end of list)")},1e4))):Module.printErr("warning: run dependency added without ID")}function removeRunDependency(e){runDependencies--,Module.monitorRunDependencies&&Module.monitorRunDependencies(runDependencies),e?(assert(runDependencyTracking[e]),delete runDependencyTracking[e]):Module.printErr("warning: run dependency removed without ID"),0==runDependencies&&(null!==runDependencyWatcher&&(clearInterval(runDependencyWatcher),runDependencyWatcher=null),dependenciesFulfilled&&(e=dependenciesFulfilled,dependenciesFulfilled=null,e()))}Module.addRunDependency=addRunDependency,Module.removeRunDependency=removeRunDependency,Module.preloadedImages={},Module.preloadedAudios={};var ASM_CONSTS=[function(e,r,t){for(var n=new Uint8Array(r),o=0;o>2]=e:Module.printErr("failed to set errno from JS"),e}var PATH={splitPath:function(e){return/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1)},normalizeArray:function(e,r){for(var t=0,n=e.length-1;0<=n;n--){var o=e[n];"."===o?e.splice(n,1):".."===o?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:function(e){var r="/"===e.charAt(0),t="/"===e.substr(-1);return(e=PATH.normalizeArray(e.split("/").filter(function(e){return!!e}),!r).join("/"))||r||(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:function(e){var r=PATH.splitPath(e),e=r[0],r=r[1];return e||r?e+(r=r&&r.substr(0,r.length-1)):"."},basename:function(e){if("/"===e)return"/";var r=e.lastIndexOf("/");return-1===r?e:e.substr(r+1)},extname:function(e){return PATH.splitPath(e)[3]},join:function(){var e=Array.prototype.slice.call(arguments,0);return PATH.normalize(e.join("/"))},join2:function(e,r){return PATH.normalize(e+"/"+r)},resolve:function(){for(var e="",r=!1,t=arguments.length-1;-1<=t&&!r;t--){var n=0<=t?arguments[t]:FS.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,r="/"===n.charAt(0)}return(r?"/":"")+(e=PATH.normalizeArray(e.split("/").filter(function(e){return!!e}),!r).join("/"))||"."},relative:function(e,r){function t(e){for(var r=0;re.contents.length&&(e.contents=MEMFS.getFileDataAsRegularArray(e),e.usedBytes=e.contents.length),!e.contents||e.contents.subarray){var t=e.contents?e.contents.length:0;if(r<=t)return;r=Math.max(r,t*(t<1048576?2:1.125)|0),0!=t&&(r=Math.max(r,256));t=e.contents;return e.contents=new Uint8Array(r),void(0r)e.contents.length=r;else for(;e.contents.length=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-o,n);if(assert(0<=a),8t.timestamp)&&(a.push(e),i++)});var t=[];if(Object.keys(o.entries).forEach(function(e){o.entries[e];n.entries[e]||(t.push(e),i++)}),!i)return r(null);var s=0,e=("remote"===n.type?n:o).db.transaction([IDBFS.DB_STORE_NAME],"readwrite"),u=e.objectStore(IDBFS.DB_STORE_NAME);function c(e){return e?c.errored?void 0:(c.errored=!0,r(e)):++s>=i?r(null):void 0}e.onerror=function(e){c(this.error),e.preventDefault()},a.sort().forEach(function(t){"local"===o.type?IDBFS.loadRemoteEntry(u,t,function(e,r){return e?c(e):void IDBFS.storeLocalEntry(t,r,c)}):IDBFS.loadLocalEntry(t,function(e,r){return e?c(e):void IDBFS.storeRemoteEntry(u,t,r,c)})}),t.sort().reverse().forEach(function(e){"local"===o.type?IDBFS.removeLocalEntry(e,c):IDBFS.removeRemoteEntry(u,e,c)})}},NODEFS={isWindows:!1,staticInit:function(){NODEFS.isWindows=!!process.platform.match(/^win/)},mount:function(e){return assert(ENVIRONMENT_IS_NODE),NODEFS.createNode(null,"/",NODEFS.getMode(e.opts.root),0)},createNode:function(e,r,t,n){if(!FS.isDir(t)&&!FS.isFile(t)&&!FS.isLink(t))throw new FS.ErrnoError(ERRNO_CODES.EINVAL);t=FS.createNode(e,r,t);return t.node_ops=NODEFS.node_ops,t.stream_ops=NODEFS.stream_ops,t},getMode:function(e){var r;try{r=fs.lstatSync(e),NODEFS.isWindows&&(r.mode=r.mode|(146&r.mode)>>1)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return r.mode},realPath:function(e){for(var r=[];e.parent!==e;)r.push(e.name),e=e.parent;return r.push(e.mount.opts.root),r.reverse(),PATH.join.apply(null,r)},flagsToPermissionStringMap:{0:"r",1:"r+",2:"r+",64:"r",65:"r+",66:"r+",129:"rx+",193:"rx+",514:"w+",577:"w",578:"w+",705:"wx",706:"wx+",1024:"a",1025:"a",1026:"a+",1089:"a",1090:"a+",1153:"ax",1154:"ax+",1217:"ax",1218:"ax+",4096:"rs",4098:"rs+"},flagsToPermissionString:function(e){if(e&=-2097153,e&=-2049,e&=-32769,(e&=-524289)in NODEFS.flagsToPermissionStringMap)return NODEFS.flagsToPermissionStringMap[e];throw new FS.ErrnoError(ERRNO_CODES.EINVAL)},node_ops:{getattr:function(e){var r,t=NODEFS.realPath(e);try{r=fs.lstatSync(t)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return NODEFS.isWindows&&!r.blksize&&(r.blksize=4096),NODEFS.isWindows&&!r.blocks&&(r.blocks=(r.size+r.blksize-1)/r.blksize|0),{dev:r.dev,ino:r.ino,mode:r.mode,nlink:r.nlink,uid:r.uid,gid:r.gid,rdev:r.rdev,size:r.size,atime:r.atime,mtime:r.mtime,ctime:r.ctime,blksize:r.blksize,blocks:r.blocks}},setattr:function(e,r){var t,n=NODEFS.realPath(e);try{void 0!==r.mode&&(fs.chmodSync(n,r.mode),e.mode=r.mode),void 0!==r.timestamp&&(t=new Date(r.timestamp),fs.utimesSync(n,t,t)),void 0!==r.size&&fs.truncateSync(n,r.size)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},lookup:function(e,r){var t=PATH.join2(NODEFS.realPath(e),r),t=NODEFS.getMode(t);return NODEFS.createNode(e,r,t)},mknod:function(e,r,t,n){var o=NODEFS.createNode(e,r,t,n),i=NODEFS.realPath(o);try{FS.isDir(o.mode)?fs.mkdirSync(i,o.mode):fs.writeFileSync(i,"",{mode:o.mode})}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return o},rename:function(e,r,t){var n=NODEFS.realPath(e),o=PATH.join2(NODEFS.realPath(r),t);try{fs.renameSync(n,o)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},unlink:function(e,r){var t=PATH.join2(NODEFS.realPath(e),r);try{fs.unlinkSync(t)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},rmdir:function(e,r){var t=PATH.join2(NODEFS.realPath(e),r);try{fs.rmdirSync(t)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},readdir:function(e){var r=NODEFS.realPath(e);try{return fs.readdirSync(r)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},symlink:function(e,r,t){var n=PATH.join2(NODEFS.realPath(e),r);try{fs.symlinkSync(t,n)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},readlink:function(e){var r=NODEFS.realPath(e);try{return r=fs.readlinkSync(r),NODEJS_PATH.relative(NODEJS_PATH.resolve(e.mount.opts.root),r)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}},stream_ops:{open:function(e){var r=NODEFS.realPath(e.node);try{FS.isFile(e.node.mode)&&(e.nfd=fs.openSync(r,NODEFS.flagsToPermissionString(e.flags)))}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},close:function(e){try{FS.isFile(e.node.mode)&&e.nfd&&fs.closeSync(e.nfd)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},read:function(e,r,t,n,o){if(0===n)return 0;var i,a=new Buffer(n);try{i=fs.readSync(e.nfd,a,0,n,o)}catch(e){throw new FS.ErrnoError(ERRNO_CODES[e.code])}if(0=e.node.size)return 0;o=e.node.contents.slice(o,o+n),n=WORKERFS.reader.readAsArrayBuffer(o);return r.set(new Uint8Array(n),t),o.size},write:function(e,r,t,n,o){throw new FS.ErrnoError(ERRNO_CODES.EIO)},llseek:function(e,r,t){if(1===t?r+=e.position:2===t&&FS.isFile(e.node.mode)&&(r+=e.node.size),r<0)throw new FS.ErrnoError(ERRNO_CODES.EINVAL);return r}}};STATICTOP+=16,STATICTOP+=16,STATICTOP+=16;var FS={root:null,mounts:[],devices:[null],streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,trackingDelegate:{},tracking:{openFlags:{READ:1,WRITE:2}},ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,handleFSError:function(e){if(!(e instanceof FS.ErrnoError))throw e+" : "+stackTrace();return ___setErrNo(e.errno)},lookupPath:function(e,r){if(r=r||{},!(e=PATH.resolve(FS.cwd(),e)))return{path:"",node:null};var t,n={follow_mount:!0,recurse_count:0};for(t in n)void 0===r[t]&&(r[t]=n[t]);if(8>>0)%FS.nameTable.length},hashAddNode:function(e){var r=FS.hashName(e.parent.id,e.name);e.name_next=FS.nameTable[r],FS.nameTable[r]=e},hashRemoveNode:function(e){var r=FS.hashName(e.parent.id,e.name);if(FS.nameTable[r]===e)FS.nameTable[r]=e.name_next;else for(var t=FS.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode:function(e,r){var t=FS.mayLookup(e);if(t)throw new FS.ErrnoError(t,e);for(var t=FS.hashName(e.id,r),n=FS.nameTable[t];n;n=n.name_next){var o=n.name;if(n.parent.id===e.id&&o===r)return n}return FS.lookup(e,r)},createNode:function(e,r,t,n){FS.FSNode||(FS.FSNode=function(e,r,t,n){e=e||this,this.parent=e,this.mount=e.mount,this.mounted=null,this.id=FS.nextInode++,this.name=r,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=n},FS.FSNode.prototype={},Object.defineProperties(FS.FSNode.prototype,{read:{get:function(){return 365==(365&this.mode)},set:function(e){e?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146==(146&this.mode)},set:function(e){e?this.mode|=146:this.mode&=-147}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}}));n=new FS.FSNode(e,r,t,n);return FS.hashAddNode(n),n},destroyNode:function(e){FS.hashRemoveNode(e)},isRoot:function(e){return e===e.parent},isMountpoint:function(e){return!!e.mounted},isFile:function(e){return 32768==(61440&e)},isDir:function(e){return 16384==(61440&e)},isLink:function(e){return 40960==(61440&e)},isChrdev:function(e){return 8192==(61440&e)},isBlkdev:function(e){return 24576==(61440&e)},isFIFO:function(e){return 4096==(61440&e)},isSocket:function(e){return 49152==(49152&e)},flagModes:{r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218},modeStringToFlags:function(e){var r=FS.flagModes[e];if(void 0===r)throw new Error("Unknown file open mode: "+e);return r},flagsToPermissionString:function(e){var r=["r","w","rw"][3&e];return 512&e&&(r+="w"),r},nodePermissions:function(e,r){return FS.ignorePermissions||(-1===r.indexOf("r")||292&e.mode)&&(-1===r.indexOf("w")||146&e.mode)&&(-1===r.indexOf("x")||73&e.mode)?0:ERRNO_CODES.EACCES},mayLookup:function(e){var r=FS.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:ERRNO_CODES.EACCES)},mayCreate:function(e,r){try{FS.lookupNode(e,r);return ERRNO_CODES.EEXIST}catch(e){}return FS.nodePermissions(e,"wx")},mayDelete:function(e,r,t){var n;try{n=FS.lookupNode(e,r)}catch(e){return e.errno}var o=FS.nodePermissions(e,"wx");if(o)return o;if(t){if(!FS.isDir(n.mode))return ERRNO_CODES.ENOTDIR;if(FS.isRoot(n)||FS.getPath(n)===FS.cwd())return ERRNO_CODES.EBUSY}else if(FS.isDir(n.mode))return ERRNO_CODES.EISDIR;return 0},mayOpen:function(e,r){return e?FS.isLink(e.mode)?ERRNO_CODES.ELOOP:FS.isDir(e.mode)&&("r"!==FS.flagsToPermissionString(r)||512&r)?ERRNO_CODES.EISDIR:FS.nodePermissions(e,FS.flagsToPermissionString(r)):ERRNO_CODES.ENOENT},MAX_OPEN_FDS:4096,nextfd:function(e,r){e=e||0,r=r||FS.MAX_OPEN_FDS;for(var t=e;t<=r;t++)if(!FS.streams[t])return t;throw new FS.ErrnoError(ERRNO_CODES.EMFILE)},getStream:function(e){return FS.streams[e]},createStream:function(e,r,t){FS.FSStream||(FS.FSStream=function(){},FS.FSStream.prototype={},Object.defineProperties(FS.FSStream.prototype,{object:{get:function(){return this.node},set:function(e){this.node=e}},isRead:{get:function(){return 1!=(2097155&this.flags)}},isWrite:{get:function(){return 0!=(2097155&this.flags)}},isAppend:{get:function(){return 1024&this.flags}}}));var n,o=new FS.FSStream;for(n in e)o[n]=e[n];e=o;t=FS.nextfd(r,t);return e.fd=t,FS.streams[t]=e},closeStream:function(e){FS.streams[e]=null},chrdev_stream_ops:{open:function(e){var r=FS.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek:function(){throw new FS.ErrnoError(ERRNO_CODES.ESPIPE)}},major:function(e){return e>>8},minor:function(e){return 255&e},makedev:function(e,r){return e<<8|r},registerDevice:function(e,r){FS.devices[e]={stream_ops:r}},getDevice:function(e){return FS.devices[e]},getMounts:function(e){for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push.apply(t,n.mounts)}return r},syncfs:function(r,t){"function"==typeof r&&(t=r,r=!1),FS.syncFSRequests++,1=n.length&&i(null)}n.forEach(function(e){return e.type.syncfs?void e.type.syncfs(e,r,a):a(null)})},mount:function(e,r,t){var n="/"===t,o=!t;if(n&&FS.root)throw new FS.ErrnoError(ERRNO_CODES.EBUSY);if(!n&&!o){var i=FS.lookupPath(t,{follow_mount:!1});if(t=i.path,i=i.node,FS.isMountpoint(i))throw new FS.ErrnoError(ERRNO_CODES.EBUSY);if(!FS.isDir(i.mode))throw new FS.ErrnoError(ERRNO_CODES.ENOTDIR)}t={type:e,opts:r,mountpoint:t,mounts:[]},e=e.mount(t);return(e.mount=t).root=e,n?FS.root=e:i&&(i.mounted=t,i.mount&&i.mount.mounts.push(t)),e},unmount:function(e){var r=FS.lookupPath(e,{follow_mount:!1});if(!FS.isMountpoint(r.node))throw new FS.ErrnoError(ERRNO_CODES.EINVAL);var e=r.node,r=e.mounted,n=FS.getMounts(r);Object.keys(FS.nameTable).forEach(function(e){for(var r=FS.nameTable[e];r;){var t=r.name_next;-1!==n.indexOf(r.mount)&&FS.destroyNode(r),r=t}}),e.mounted=null;r=e.mount.mounts.indexOf(r);assert(-1!==r),e.mount.mounts.splice(r,1)},lookup:function(e,r){return e.node_ops.lookup(e,r)},mknod:function(e,r,t){var n=FS.lookupPath(e,{parent:!0}).node,o=PATH.basename(e);if(!o||"."===o||".."===o)throw new FS.ErrnoError(ERRNO_CODES.EINVAL);e=FS.mayCreate(n,o);if(e)throw new FS.ErrnoError(e);if(!n.node_ops.mknod)throw new FS.ErrnoError(ERRNO_CODES.EPERM);return n.node_ops.mknod(n,o,r,t)},create:function(e,r){return r=void 0!==r?r:438,r&=4095,r|=32768,FS.mknod(e,r,0)},mkdir:function(e,r){return r=void 0!==r?r:511,r&=1023,r|=16384,FS.mknod(e,r,0)},mkdirTree:function(e,r){for(var t=e.split("/"),n="",o=0;othis.length-1||e<0)){var r=e%this.chunkSize,e=e/this.chunkSize|0;return this.getter(e)[r]}},o.prototype.setDataGetter=function(e){this.getter=e},o.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",a,!1),e.send(null),!(200<=e.status&&e.status<300||304===e.status))throw new Error("Couldn't load "+a+". Status: "+e.status);var n=Number(e.getResponseHeader("Content-length")),r=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,t=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,o=1048576;r||(o=n);var i=this;i.setDataGetter(function(e){var r=e*o,t=(e+1)*o-1,t=Math.min(t,n-1);if(void 0===i.chunks[e]&&(i.chunks[e]=function(e,r){if(r=i.length)return 0;var a=Math.min(i.length-o,n);if(assert(0<=a),i.slice)for(var s=0;s>2]=n.dev,HEAP32[t+4>>2]=0,HEAP32[t+8>>2]=n.ino,HEAP32[t+12>>2]=n.mode,HEAP32[t+16>>2]=n.nlink,HEAP32[t+20>>2]=n.uid,HEAP32[t+24>>2]=n.gid,HEAP32[t+28>>2]=n.rdev,HEAP32[t+32>>2]=0,HEAP32[t+36>>2]=n.size,HEAP32[t+40>>2]=4096,HEAP32[t+44>>2]=n.blocks,HEAP32[t+48>>2]=n.atime.getTime()/1e3|0,HEAP32[t+52>>2]=0,HEAP32[t+56>>2]=n.mtime.getTime()/1e3|0,HEAP32[t+60>>2]=0,HEAP32[t+64>>2]=n.ctime.getTime()/1e3|0,HEAP32[t+68>>2]=0,HEAP32[t+72>>2]=n.ino,0},doMsync:function(e,r,t,n){e=new Uint8Array(HEAPU8.subarray(e,e+t));FS.msync(r,e,0,t,n)},doMkdir:function(e,r){return"/"===(e=PATH.normalize(e))[e.length-1]&&(e=e.substr(0,e.length-1)),FS.mkdir(e,r,0),0},doMknod:function(e,r,t){switch(61440&r){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-ERRNO_CODES.EINVAL}return FS.mknod(e,r,t),0},doReadlink:function(e,r,t){if(t<=0)return-ERRNO_CODES.EINVAL;var n=FS.readlink(e),o=Math.min(t,lengthBytesUTF8(n)),e=HEAP8[r+o];return stringToUTF8(n,r,t+1),HEAP8[r+o]=e,o},doAccess:function(e,r){if(-8&r)return-ERRNO_CODES.EINVAL;var t=FS.lookupPath(e,{follow:!0}).node,e="";return 4&r&&(e+="r"),2&r&&(e+="w"),1&r&&(e+="x"),e&&FS.nodePermissions(t,e)?-ERRNO_CODES.EACCES:0},doDup:function(e,r,t){var n=FS.getStream(t);return n&&FS.close(n),FS.open(e,r,0,t,t).fd},doReadv:function(e,r,t,n){for(var o=0,i=0;i>2],s=HEAP32[r+(8*i+4)>>2],a=FS.read(e,HEAP8,a,s,n);if(a<0)return-1;if(o+=a,a>2],s=HEAP32[r+(8*i+4)>>2],s=FS.write(e,HEAP8,a,s,n);if(s<0)return-1;o+=s}return o},varargs:0,get:function(e){return SYSCALLS.varargs+=4,HEAP32[SYSCALLS.varargs-4>>2]},getStr:function(){return Pointer_stringify(SYSCALLS.get())},getStreamFromFD:function(){var e=FS.getStream(SYSCALLS.get());if(!e)throw new FS.ErrnoError(ERRNO_CODES.EBADF);return e},getSocketFromFD:function(){var e=SOCKFS.getSocket(SYSCALLS.get());if(!e)throw new FS.ErrnoError(ERRNO_CODES.EBADF);return e},getSocketAddress:function(e){var r=SYSCALLS.get(),t=SYSCALLS.get();if(e&&0===r)return null;t=__read_sockaddr(r,t);if(t.errno)throw new FS.ErrnoError(t.errno);return t.addr=DNS.lookup_addr(t.addr)||t.addr,t},get64:function(){var e=SYSCALLS.get(),r=SYSCALLS.get();return assert(0<=e?0===r:-1===r),e},getZero:function(){assert(0===SYSCALLS.get())}};function ___syscall5(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStr(),n=SYSCALLS.get(),o=SYSCALLS.get();return FS.open(t,n,o).fd}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function ___lock(){}function ___unlock(){}function ___syscall6(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStreamFromFD();return FS.close(t),0}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}var cttz_i8=allocate([8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0],"i8",ALLOC_STATIC),fs,NODEJS_PATH;function _emscripten_memcpy_big(e,r,t){return HEAPU8.set(HEAPU8.subarray(r,r+t),e),e}function ___syscall140(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStreamFromFD(),n=(SYSCALLS.get(),SYSCALLS.get()),o=SYSCALLS.get(),i=SYSCALLS.get(),n=n;return FS.llseek(t,n,i),HEAP32[o>>2]=t.position,t.getdents&&0===n&&0===i&&(t.getdents=null),0}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function ___syscall146(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStreamFromFD(),n=SYSCALLS.get(),o=SYSCALLS.get();return SYSCALLS.doWritev(t,n,o)}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function ___syscall54(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStreamFromFD(),n=SYSCALLS.get();switch(n){case 21505:case 21506:return t.tty?0:-ERRNO_CODES.ENOTTY;case 21519:if(!t.tty)return-ERRNO_CODES.ENOTTY;var o=SYSCALLS.get();return HEAP32[o>>2]=0;case 21520:return t.tty?-ERRNO_CODES.EINVAL:-ERRNO_CODES.ENOTTY;case 21531:o=SYSCALLS.get();return FS.ioctl(t,n,o);case 21523:return t.tty?0:-ERRNO_CODES.ENOTTY;default:abort("bad ioctl syscall "+n)}}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function ___syscall221(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStreamFromFD();switch(SYSCALLS.get()){case 0:return(n=SYSCALLS.get())<0?-ERRNO_CODES.EINVAL:FS.open(t.path,t.flags,0,n).fd;case 1:case 2:return 0;case 3:return t.flags;case 4:var n=SYSCALLS.get();return t.flags|=n,0;case 12:case 12:n=SYSCALLS.get();return HEAP16[n+0>>1]=2,0;case 13:case 14:case 13:case 14:return 0;case 16:case 8:return-ERRNO_CODES.EINVAL;case 9:return ___setErrNo(ERRNO_CODES.EINVAL),-1;default:return-ERRNO_CODES.EINVAL}}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function ___syscall145(e,r){SYSCALLS.varargs=r;try{var t=SYSCALLS.getStreamFromFD(),n=SYSCALLS.get(),o=SYSCALLS.get();return SYSCALLS.doReadv(t,n,o)}catch(e){return void 0!==FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function nullFunc_ii(e){Module.printErr("Invalid function pointer called with signature 'ii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"),Module.printErr("Build with ASSERTIONS=2 for more info."),abort(e)}function nullFunc_iiii(e){Module.printErr("Invalid function pointer called with signature 'iiii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"),Module.printErr("Build with ASSERTIONS=2 for more info."),abort(e)}function invoke_ii(e,r){try{return Module.dynCall_ii(e,r)}catch(e){if("number"!=typeof e&&"longjmp"!==e)throw e;Module.setThrew(1,0)}}function invoke_iiii(e,r,t,n){try{return Module.dynCall_iiii(e,r,t,n)}catch(e){if("number"!=typeof e&&"longjmp"!==e)throw e;Module.setThrew(1,0)}}FS.staticInit(),__ATINIT__.unshift(function(){Module.noFSInit||FS.init.initialized||FS.init()}),__ATMAIN__.push(function(){FS.ignorePermissions=!1}),__ATEXIT__.push(function(){FS.quit()}),Module.FS_createFolder=FS.createFolder,Module.FS_createPath=FS.createPath,Module.FS_createDataFile=FS.createDataFile,Module.FS_createPreloadedFile=FS.createPreloadedFile,Module.FS_createLazyFile=FS.createLazyFile,Module.FS_createLink=FS.createLink,Module.FS_createDevice=FS.createDevice,Module.FS_unlink=FS.unlink,__ATINIT__.unshift(function(){TTY.init()}),__ATEXIT__.push(function(){TTY.shutdown()}),ENVIRONMENT_IS_NODE&&(fs=require("fs"),NODEJS_PATH=require("path"),NODEFS.staticInit()),DYNAMICTOP_PTR=allocate(1,"i32",ALLOC_STATIC),STACK_BASE=STACKTOP=Runtime.alignMemory(STATICTOP),STACK_MAX=STACK_BASE+TOTAL_STACK,DYNAMIC_BASE=Runtime.alignMemory(STACK_MAX),HEAP32[DYNAMICTOP_PTR>>2]=DYNAMIC_BASE,staticSealed=!0,assert(DYNAMIC_BASE=(0|Je)&&Qe(48);n=t+32|0,o=t+16|0,i=t,s=0|Le(3788,0|Xe[r>>0],4)?(a=0|function(e){var r=0,t=0,n=0,o=0;return r=0==(0|G(e=e|0,43)),t=0|Xe[e>>0],n=r?t<<24>>24!=114&1:2,r=0==(0|G(e,120)),o=r?n:128|n,n=0==(0|G(e,101)),e=n?o:524288|o,o=t<<24>>24==114?e:64|e,e=t<<24>>24==119?512|o:o,0|(t<<24>>24==97?1024|e:e)}(r),Ge[i>>2]=e,Ge[i+4>>2]=32768|a,Ge[i+8>>2]=438,e=0|U(0|A(5,0|i)),0<=(0|e)?(524288&a|0&&(Ge[o>>2]=e,Ge[o+4>>2]=2,Ge[o+8>>2]=1,M(221,0|o)),(o=0|function(e,r){e|=0,r|=0;var t=0,n=0,o=0,i=0,a=0,s=0,u=0,c=0,l=0,f=0,d=0,E=0,S=0;(0|(Ze=(t=Ze)+64|0))>=(0|Je)&&Qe(64);if(n=t+40|0,o=t+24|0,i=t+16|0,s=(a=t)+56|0,0|Le(3788,(u=0|Xe[r>>0])<<24>>24,4))if(c=0|x(1156)){for(f=c,d=f+124|0;Ge[f>>2]=0,f=f+4|0,(0|f)<(0|d););0|G(r,43)||(Ge[c>>2]=u<<24>>24==114?8:4),E=0|G(r,101)?(Ge[a>>2]=e,Ge[a+4>>2]=2,Ge[a+8>>2]=1,M(221,0|a),0|Xe[r>>0]):u,S=E<<24>>24==97?(Ge[i>>2]=e,Ge[4+i>>2]=3,1024&(E=0|M(221,0|i))||(Ge[o>>2]=e,Ge[o+4>>2]=4,Ge[o+8>>2]=1024|E,M(221,0|o)),o=128|Ge[c>>2],Ge[c>>2]=o):0|Ge[c>>2],Ge[c+60>>2]=e,Ge[c+44>>2]=c+132,Ge[c+48>>2]=1024,Xe[(o=c+75|0)>>0]=-1,0==(8&S|0)&&(Ge[n>>2]=e,Ge[4+n>>2]=21523,Ge[8+n>>2]=s,0==(0|T(54,0|n)))&&(Xe[o>>0]=10),Ge[c+32>>2]=4,Ge[c+36>>2]=3,Ge[c+40>>2]=2,Ge[c+12>>2]=1,0|Ge[1073]||(Ge[c+76>>2]=-1),function(e){e|=0;var r=0,t=0;r=0|Q(),Ge[e+56>>2]=Ge[r>>2],0|(t=0|Ge[r>>2])&&(Ge[52+t>>2]=e),Ge[r>>2]=e,$()}(c),l=c}else l=0;else Ge[(c=652)>>2]=22,l=0;return Ze=t,0|l}(e,r))||(Ge[n>>2]=e,y(6,0|n),0)):0):(Ge[(o=652)>>2]=22,0);return Ze=t,0|s}(e|=0,964);do{if(0|s){if(o=s,a=2,function(e,r,t){r|=0,t|=0;var n=0,o=0;-1<(0|Ge[76+(e|=0)>>2])?(n=0==(0|V()),o=0|ne(e,r,t),n||K()):ne(e,r,t)}(o|=i=0,i|=0,a|=0),e=0|(i=s,0|function(e){var r=0,t=0,n=0;n=-1<(0|Ge[76+(e|=0)>>2])?(r=0==(0|V()),t=0|oe(e),r||K(),t):0|oe(e);return 0|n}(i|=0)),a=s,i=void 0,-1<((i=0)|Ge[76+(a|=0)>>2])?(i=0==(0|V()),ne(a,0,0),Ge[a>>2]=-33&Ge[a>>2],i||K()):(ne(a,0,0),Ge[a>>2]=-33&Ge[a>>2]),t=0|x(e+1|0))return(0|(n=0|function(e,r,t,n){e|=0,n|=0;var o=0,i=0,a=0,s=0,u=0,c=0,l=0,f=0,d=0,E=0;o=0|Ne(t|=0,r|=0),i=0==(0|r)?0:t,a=-1<(0|Ge[n+76>>2])?0|V():0;s=0|Xe[(t=n+74|0)>>0],Xe[t>>0]=s+255|s,t=0|Ge[(s=n+4|0)>>2],u=(0|Ge[n+8>>2])-t|0,c=u>>>0>>0?u:o,f=0<(0|u)?(tr(0|e,0|t,0|c),Ge[s>>2]=t+c,l=o-c|0,e+c|0):(l=o,e);e:do{if(l){for(e=n+32|0,c=l,t=f;!(0|function(e){var r=0,t=0,n=0;t=0|Xe[(r=74+(e|=0)|0)>>0],Xe[r>>0]=255+t|t,r=e+28|0,(0|Ge[(t=e+20|0)>>2])>>>0>(0|Ge[r>>2])>>>0&&de[7&Ge[e+36>>2]](e,0,0);Ge[e+16>>2]=0,Ge[r>>2]=0,Ge[t>>2]=0,n=4&(t=0|Ge[e>>2])?(Ge[e>>2]=32|t,-1):(r=(0|Ge[e+44>>2])+(0|Ge[e+48>>2])|0,Ge[e+8>>2]=r,Ge[e+4>>2]=r,t<<27>>31);return 0|n}(n)||((s=0|de[7&Ge[e>>2]](n,t,c))+1|0)>>>0<2);){if(!(u=c-s|0)){d=13;break e}c=u,t=t+s|0}0|a&&K(),E=((o-c|0)>>>0)/(r>>>0)|0}else d=13}while(0);13==(0|d)&&(E=(a&&K(),i));return 0|E}(t,1,e,s)))<(0|e)&&ae(1256),Ge[r>>2]=t,Xe[t+e>>0]=0,ee(s),0|n;ae(1230),ee(s);break}}while(0);return(Ge[r>>2]=0)|-1}function N(e,r){e|=0,r|=0;var t,n,o,i,a,s,u,c,l,f,d,E,S,_,m,h,p,F,M,b=0,y=0,O=0,w=0,R=0,A=0,k=0,T=0,g=0,v=0,N=0,D=0;if((0|Je)<=(0|(Ze=(r=Ze)+4192|0))&&Qe(4192),t=r+32|0,n=r+24|0,o=r+16|0,i=r+8|0,a=(b=r)+40|0,u=r+88|0,((Ge[(s=r+36|0)>>2]=0)|(c=0|I(e,s)))<22)return Ge[b>>2]=182,ie(967,b),B(0|Ge[s>>2]),Ze=r,0;b=c-22|0;e:do{if(22<(0|b)){for(y=(e=0|Ge[s>>2])+c|0,O=b;101010256!=((0|qe[(A=(R=(w=e+O|0)+1|0)+1|0)+1>>0])<<24|((0|qe[A>>0])<<16|((0|qe[R>>0])<<8|0|qe[w>>0]))|0)||(w+22+((0|qe[(R=w+20|0)+1>>0])<<8|0|qe[R>>0])|0)!=(0|y);)if((0|(O=O+-1|0))<=22)break e;if(A=e+((0|qe[(R=(y=(O=w+16|0)+1|0)+1|0)+1>>0])<<24|((0|qe[R>>0])<<16|((0|qe[y>>0])<<8|0|qe[O>>0])))|0,33639248==((0|qe[A+3>>0])<<24|((0|qe[A+2>>0])<<16|((0|qe[A+1>>0])<<8|0|qe[A>>0]))|0))for(O=A,y=0;;){if(R=((0|qe[O+27>>0])<<24|((0|qe[O+26>>0])<<16|((0|qe[O+25>>0])<<8|0|qe[O+24>>0])))+y|0,O=O+(46+((0|qe[O+29>>0])<<8|0|qe[O+28>>0])+((0|qe[O+31>>0])<<8|0|qe[O+30>>0])+((0|qe[O+33>>0])<<8|0|qe[O+32>>0]))|0,33639248!=((0|qe[O+3>>0])<<24|((0|qe[O+2>>0])<<16|((0|qe[O+1>>0])<<8|0|qe[O>>0]))|0)){k=R;break}y=R}else k=0;y=4+a|0,O=12+a|0,R=16+a|0;r:do{if(33639248==((0|qe[A+3>>0])<<24|((0|qe[A+2>>0])<<16|((0|qe[A+1>>0])<<8|0|qe[A>>0]))|0)){for(T=0,g=A;v=0|Xe[g+10>>0],N=0|Xe[g+11>>0],l=(0|qe[g+19>>0])<<24|((0|qe[g+18>>0])<<16|((0|qe[g+17>>0])<<8|0|qe[g+16>>0])),f=(0|qe[g+23>>0])<<24|((0|qe[g+22>>0])<<16|((0|qe[g+21>>0])<<8|0|qe[g+20>>0])),d=(0|qe[g+27>>0])<<24|((0|qe[g+26>>0])<<16|((0|qe[g+25>>0])<<8|0|qe[g+24>>0])),E=(0|qe[g+29>>0])<<8|0|qe[g+28>>0],S=(0|qe[g+33>>0])<<8|0|qe[g+32>>0],_=(0|qe[g+31>>0])<<8|0|qe[g+30>>0],er(0|u,0,4096),!(4095>>0);){switch(tr(0|u,g+46|0,0|E),p=28+(m=e+((0|qe[g+45>>0])<<24|((0|qe[g+44>>0])<<16|((0|qe[g+43>>0])<<8|0|qe[g+42>>0])))|0)|0,F=30+m+((0|qe[1+(h=26+m|0)>>0])<<8|0|qe[h>>0])+((0|qe[1+p>>0])<<8|0|qe[p>>0])|0,(65535&((255&N)<<8|255&v))<<16>>16){case 0:P(0,0|u,0|d,0|F),D=15;break;case 8:D=15}if(15==(0|D)&&(D=0)|(v=0|x(d))){for(N=a,p=N+48|0;N=N+4|(Ge[N>>2]=0),(0|N)<(0|p););do{if(!(0|function(e,r){e|=0,r|=0;var t=0,n=0,o=0,i=0,a=0,s=0;(0|(Ze=(t=Ze)+16|0))>=(0|Je)&&Qe(16);if(n=t+12|0,i=t+4|0,Ge[(o=(a=t)+8|0)>>2]=e,Ge[i>>2]=r,!(0|Ge[o>>2]))return Ge[n>>2]=-2,s=0|Ge[n>>2],Ze=t,0|s;if(15!=(0|Ge[i>>2])&&15!=(0-(0|Ge[i>>2])|0))return Ge[n>>2]=-1e4,s=0|Ge[n>>2],Ze=t,0|s;return Ge[36+(0|Ge[o>>2])>>2]=0,Ge[40+(0|Ge[o>>2])>>2]=0,Ge[24+(0|Ge[o>>2])>>2]=0,Ge[8+(0|Ge[o>>2])>>2]=0,Ge[20+(0|Ge[o>>2])>>2]=0,Ge[44+(0|Ge[o>>2])>>2]=0,r=0|x(43784),Ge[a>>2]=r,Ze=(s=(0|Ge[a>>2]?(Ge[28+(0|Ge[o>>2])>>2]=Ge[a>>2],Ge[Ge[a>>2]>>2]=0,Ge[10992+(0|Ge[a>>2])>>2]=0,Ge[10996+(0|Ge[a>>2])>>2]=0,Ge[43780+(0|Ge[a>>2])>>2]=1,Ge[11e3+(0|Ge[a>>2])>>2]=1,Ge[11004+(0|Ge[a>>2])>>2]=0,Ge[11008+(0|Ge[a>>2])>>2]=Ge[i>>2],Ge[n>>2]=0):Ge[n>>2]=-4,0|Ge[n>>2]),t),0|s}(a,-15))){if(Ge[a>>2]=F,Ge[y>>2]=f,Ge[O>>2]=v,Ge[R>>2]=d,N=1==(0|function(e,r,t,n){e|=0,r|=0,t|=0,n|=0;var o=0,i=0,a=0,s=0,u=0,c=0,l=0,f=0,d=0,E=0,S=0,_=0,m=0,h=0,p=0,F=0,M=0,b=0;(0|(Ze=(o=Ze)+64|0))>=(0|Je)&&Qe(64);if(i=o+48|0,s=o+40|0,u=o+36|0,c=o+32|0,l=o+28|0,f=o+24|0,d=o+20|0,E=o+16|0,S=o+12|0,_=o+8|0,m=o+4|0,Ge[(a=(h=o)+44|0)>>2]=e,Ge[s>>2]=r,Ge[u>>2]=t,Ge[c>>2]=n,Ge[E>>2]=8,0|Ge[a>>2]&&0|Ge[28+(0|Ge[a>>2])>>2]){if(1==(0|Ge[s>>2])&&(Ge[s>>2]=2),0!=(0|Ge[s>>2])&2!=(0|Ge[s>>2])&4!=(0|Ge[s>>2]))return Ge[i>>2]=-2,p=0|Ge[i>>2],Ze=o,0|p;if(Ge[l>>2]=Ge[28+(0|Ge[a>>2])>>2],0<(0|Ge[11008+(0|Ge[l>>2])>>2])&&(Ge[E>>2]=1|Ge[E>>2]),Ge[m>>2]=Ge[4+(0|Ge[a>>2])>>2],Ge[d>>2]=Ge[11e3+(0|Ge[l>>2])>>2],((Ge[11e3+(0|Ge[l>>2])>>2]=0)|Ge[43780+(0|Ge[l>>2])>>2])<0)return Ge[i>>2]=-3,p=0|Ge[i>>2],Ze=o,0|p;if(4!=(0|Ge[s>>2])&&0!=(0|Ge[11004+(0|Ge[l>>2])>>2]))return Ge[i>>2]=-2,p=0|Ge[i>>2],Ze=o,0|p;if(n=11004+(0|Ge[l>>2])|0,Ge[n>>2]=Ge[n>>2]|4==(0|Ge[s>>2]),4==(0|Ge[s>>2])&0!=(0|Ge[d>>2]))return Ge[E>>2]=4|Ge[E>>2],Ge[S>>2]=Ge[4+(0|Ge[a>>2])>>2],Ge[_>>2]=Ge[16+(0|Ge[a>>2])>>2],d=0|L(0|Ge[l>>2],0|Ge[Ge[a>>2]>>2],S,0|Ge[12+(0|Ge[a>>2])>>2],0|Ge[12+(0|Ge[a>>2])>>2],_,0|Ge[E>>2],0|Ge[u>>2],0|Ge[c>>2]),Ge[h>>2]=d,Ge[43780+(0|Ge[l>>2])>>2]=Ge[h>>2],d=0|Ge[a>>2],Ge[d>>2]=(0|Ge[d>>2])+(0|Ge[S>>2]),d=4+(0|Ge[a>>2])|0,Ge[d>>2]=(0|Ge[d>>2])-(0|Ge[S>>2]),d=8+(0|Ge[a>>2])|0,Ge[d>>2]=(0|Ge[d>>2])+(0|Ge[S>>2]),Ge[40+(0|Ge[a>>2])>>2]=Ge[28+(0|Ge[l>>2])>>2],d=12+(0|Ge[a>>2])|0,Ge[d>>2]=(0|Ge[d>>2])+(0|Ge[_>>2]),d=16+(0|Ge[a>>2])|0,Ge[d>>2]=(0|Ge[d>>2])-(0|Ge[_>>2]),d=20+(0|Ge[a>>2])|0,Ge[d>>2]=(0|Ge[d>>2])+(0|Ge[_>>2]),Ze=(p=((0|Ge[h>>2])<0?Ge[i>>2]=-3:0|Ge[h>>2]?(Ge[43780+(0|Ge[l>>2])>>2]=-1,Ge[i>>2]=-5):Ge[i>>2]=1,0|Ge[i>>2]),o),0|p;if(4!=(0|Ge[s>>2])&&(Ge[E>>2]=2|Ge[E>>2]),0|Ge[10996+(0|Ge[l>>2])>>2])return Ge[f>>2]=Ge[((0|Ge[10996+(0|Ge[l>>2])>>2])>>>0<(0|Ge[16+(0|Ge[a>>2])>>2])>>>0?10996+(0|Ge[l>>2])|0:16+(0|Ge[a>>2])|0)>>2],tr(0|Ge[12+(0|Ge[a>>2])>>2],11012+(0|Ge[l>>2])+(0|Ge[10992+(0|Ge[l>>2])>>2])|0,0|Ge[f>>2]),d=12+(0|Ge[a>>2])|0,Ge[d>>2]=(0|Ge[d>>2])+(0|Ge[f>>2]),d=16+(0|Ge[a>>2])|0,Ge[d>>2]=(0|Ge[d>>2])-(0|Ge[f>>2]),d=20+(0|Ge[a>>2])|0,Ge[d>>2]=(0|Ge[d>>2])+(0|Ge[f>>2]),d=10996+(0|Ge[l>>2])|0,Ge[d>>2]=(0|Ge[d>>2])-(0|Ge[f>>2]),Ge[10992+(0|Ge[l>>2])>>2]=(0|Ge[10992+(0|Ge[l>>2])>>2])+(0|Ge[f>>2])&32767,F=0|Ge[43780+(0|Ge[l>>2])>>2]?0:0!=(0|Ge[10996+(0|Ge[l>>2])>>2])^1,Ge[i>>2]=F?1:0,p=0|Ge[i>>2],Ze=o,0|p;for(;;){if(Ge[S>>2]=Ge[4+(0|Ge[a>>2])>>2],Ge[_>>2]=32768-(0|Ge[10992+(0|Ge[l>>2])>>2]),F=0|L(0|Ge[l>>2],0|Ge[Ge[a>>2]>>2],S,11012+(0|Ge[l>>2])|0,11012+(0|Ge[l>>2])+(0|Ge[10992+(0|Ge[l>>2])>>2])|0,_,0|Ge[E>>2],0|Ge[u>>2],0|Ge[c>>2]),Ge[h>>2]=F,Ge[43780+(0|Ge[l>>2])>>2]=Ge[h>>2],F=0|Ge[a>>2],Ge[F>>2]=(0|Ge[F>>2])+(0|Ge[S>>2]),F=4+(0|Ge[a>>2])|0,Ge[F>>2]=(0|Ge[F>>2])-(0|Ge[S>>2]),F=8+(0|Ge[a>>2])|0,Ge[F>>2]=(0|Ge[F>>2])+(0|Ge[S>>2]),Ge[40+(0|Ge[a>>2])>>2]=Ge[28+(0|Ge[l>>2])>>2],Ge[10996+(0|Ge[l>>2])>>2]=Ge[_>>2],Ge[f>>2]=Ge[((0|Ge[10996+(0|Ge[l>>2])>>2])>>>0<(0|Ge[16+(0|Ge[a>>2])>>2])>>>0?10996+(0|Ge[l>>2])|0:16+(0|Ge[a>>2])|0)>>2],tr(0|Ge[12+(0|Ge[a>>2])>>2],11012+(0|Ge[l>>2])+(0|Ge[10992+(0|Ge[l>>2])>>2])|0,0|Ge[f>>2]),F=12+(0|Ge[a>>2])|0,Ge[F>>2]=(0|Ge[F>>2])+(0|Ge[f>>2]),F=16+(0|Ge[a>>2])|0,Ge[F>>2]=(0|Ge[F>>2])-(0|Ge[f>>2]),F=20+(0|Ge[a>>2])|0,Ge[F>>2]=(0|Ge[F>>2])+(0|Ge[f>>2]),F=10996+(0|Ge[l>>2])|0,Ge[F>>2]=(0|Ge[F>>2])-(0|Ge[f>>2]),Ge[10992+(0|Ge[l>>2])>>2]=(0|Ge[10992+(0|Ge[l>>2])>>2])+(0|Ge[f>>2])&32767,(0|Ge[h>>2])<0){M=27;break}if(!(1!=(0|Ge[h>>2])|0!=(0|Ge[m>>2]))){M=29;break}if(F=0==(0|Ge[h>>2]),4==(0|Ge[s>>2])){if(F){M=32;break}if(0|Ge[16+(0|Ge[a>>2])>>2])continue;M=34;break}if(F){M=39;break}if(!(0|Ge[4+(0|Ge[a>>2])>>2])){M=39;break}if(!(0|Ge[16+(0|Ge[a>>2])>>2])){M=39;break}if(0|Ge[10996+(0|Ge[l>>2])>>2]){M=39;break}}if(27==(0|M))return Ge[i>>2]=-3,p=0|Ge[i>>2],Ze=o,0|p;if(29==(0|M))return Ge[i>>2]=-5,p=0|Ge[i>>2],Ze=o,0|p;if(32==(0|M))return Ge[i>>2]=0|Ge[10996+(0|Ge[l>>2])>>2]?-5:1,p=0|Ge[i>>2],Ze=o,0|p;if(34==(0|M))return Ge[i>>2]=-5,p=0|Ge[i>>2],Ze=o,0|p;if(39==(0|M))return b=0|Ge[h>>2]?0:0!=(0|Ge[10996+(0|Ge[l>>2])>>2])^1,Ge[i>>2]=b?1:0,p=0|Ge[i>>2],Ze=o,0|p}return Ge[i>>2]=-2,p=0|Ge[i>>2],Ze=o,0|p}(a,4,k,T)),function(e){e|=0;var r=0,t=0,n=0;if((0|(Ze=(r=Ze)+16|0))>=(0|Je)&&Qe(16),t=r+4|0,Ge[(n=r)>>2]=e,!(0|Ge[n>>2]))return Ge[t>>2]=-2,Ge[t>>2],Ze=r;0|Ge[28+(0|Ge[n>>2])>>2]&&(B(0|Ge[28+(0|Ge[n>>2])>>2]),Ge[28+(0|Ge[n>>2])>>2]=0),Ge[t>>2]=0,Ge[t>>2],Ze=r}(a),!N){B(v);break}if((0|(N=0|function(e,r,t){e|=0,r|=0,t|=0;var n=0,o=0,i=0,a=0,s=0,u=0,c=0,l=0,f=0;(0|(Ze=(n=Ze)+32|0))>=(0|Je)&&Qe(32);if(o=n+20|0,a=n+12|0,s=n+8|0,u=n+4|0,l=(c=n)+24|0,Ge[(i=n+16|0)>>2]=e,Ge[a>>2]=r,Ge[s>>2]=t,Ge[u>>2]=Ge[a>>2],Ge[c>>2]=Ge[i>>2],!(0|Ge[u>>2]))return Ge[o>>2]=0,f=0|Ge[o>>2],Ze=n,0|f;Ge[c>>2]=~Ge[c>>2];for(;i=0|Ge[s>>2],Ge[s>>2]=i-1,i;)i=0|Ge[u>>2],Ge[u>>2]=1+i,Xe[l>>0]=0|Xe[i>>0],Ge[c>>2]=(0|Ge[c>>2])>>>4^Ge[8+((15&Ge[c>>2]^15&(0|qe[l>>0]))<<2)>>2],Ge[c>>2]=(0|Ge[c>>2])>>>4^Ge[8+((15&Ge[c>>2]^(0|qe[l>>0])>>4)<<2)>>2];return Ge[o>>2]=~Ge[c>>2],f=0|Ge[o>>2],Ze=n,0|f}(0,v,d)))==(0|l)){P(0,0|u,0|d,0|v),B(v);break}Ge[o>>2]=N,Ge[4+o>>2]=l,ie(1175,o),B(v);break}}while(B(v),0)}if(M=10,function(e,r){var t=0,n=0,o=0,i=0,a=0,s=0;n=t=255&(e|=0),0<=(0|Ge[76+(r|=0)>>2])&&0!=(0|V())?(a=(0|n)!=(0|Xe[r+75>>0])&&(i=0|Ge[(o=r+20|0)>>2])>>>0<(0|Ge[r+16>>2])>>>0?(Ge[o>>2]=i+1,Xe[i>>0]=t,n):0|J(r,e),K()):s=3;do{if(3==(0|s)){if((0|n)!=(0|Xe[r+75>>0])&&(i=0|Ge[(a=r+20|0)>>2])>>>0<(0|Ge[r+16>>2])>>>0){Ge[a>>2]=i+1,Xe[i>>0]=t,0;break}J(r,e)}}while(0)}(M|=0,0|Ge[208]),33639248!=((0|qe[(g=g+(46+E+_+S)|0)+3>>0])<<24|((0|qe[g+2>>0])<<16|((0|qe[g+1>>0])<<8|0|qe[g>>0]))|0))break r;T=d+T|0}return Ge[n>>2]=240,ie(967,n),B(0|Ge[s>>2]),Ze=r,0}}while(0);return C(1),Ge[t>>2]=307,ie(967,t),B(0|Ge[s>>2]),Ze=r,0}}while(0);return Ge[i>>2]=188,ie(967,i),B(0|Ge[s>>2]),Ze=r,0}function L(e,r,t,n,o,i,a,s,u){e|=0,r|=0,t|=0,n|=0,o|=0,i|=0,a|=0,s|=0,u|=0;var c,l,f,d,E,S,_,m,h,p,F,M,b,y,O,w,R,A,k,T,g,v,N,D,P,C,I,L,x,B,H,U,Y,z,V,K,W,X,j,G,q,Z,J,Q,$,ee,re,te,ne,oe,ie,ae,se,ue,ce,le,fe,de,Ee,Se,_e,me,he,pe,Fe,Me,be,ye,Oe,we,Re,Ae,ke,Te=0,ge=0,ve=0,Ne=0,De=0,Pe=0,Ce=0,Ie=0,Le=0,xe=0,Be=0,He=0,Ue=0,Ye=0,ze=0,Ve=0,Ke=0,We=Ze;if((0|Je)<=(0|(Ze=Ze+432|0))&&Qe(432),c=We+416|0,f=We+408|0,d=We+404|0,E=We+400|0,Te=We+396|0,S=We+392|0,_=We+388|0,m=We+384|0,h=We+380|0,p=We+376|0,F=We+372|0,M=We+368|0,b=We+364|0,y=We+360|0,O=We+356|0,w=We+352|0,R=We+348|0,A=We+344|0,k=We+340|0,T=We+336|0,g=We+332|0,v=We+328|0,N=We+324|0,D=We+320|0,P=We+316|0,C=We+312|0,I=We+308|0,L=We+304|0,x=We+300|0,B=We+296|0,H=We+292|0,U=We+288|0,Y=We+284|0,z=We+280|0,V=We+276|0,K=We+272|0,W=We+268|0,X=We+264|0,j=We+260|0,G=We+192|0,q=We+128|0,Z=We+120|0,J=We+116|0,Q=We+112|0,$=We+108|0,ee=We+420|0,re=We+104|0,te=We+100|0,ne=We+96|0,oe=We+92|0,ie=We+88|0,ae=We+84|0,se=We+80|0,ue=We+76|0,ce=We+72|0,le=We+68|0,fe=We+64|0,de=We+60|0,Ee=We+56|0,Se=We+52|0,_e=We+48|0,me=We+44|0,he=We+40|0,pe=We+36|0,Fe=We+32|0,Me=We+28|0,be=We+24|0,ye=We+20|0,Oe=We+16|0,we=We+12|0,Re=We+8|0,Ae=We+4|0,Ge[(l=(ke=We)+412|0)>>2]=e,Ge[f>>2]=r,Ge[d>>2]=t,Ge[E>>2]=n,Ge[Te>>2]=o,Ge[S>>2]=i,Ge[_>>2]=a,Ge[m>>2]=s,Ge[h>>2]=u,Ge[p>>2]=-1,Ge[w>>2]=Ge[f>>2],Ge[R>>2]=(0|Ge[f>>2])+(0|Ge[Ge[d>>2]>>2]),Ge[A>>2]=Ge[Te>>2],Ge[k>>2]=(0|Ge[Te>>2])+(0|Ge[Ge[S>>2]>>2]),ge=4&Ge[_>>2]|0?-1:(0|Ge[Te>>2])-(0|Ge[E>>2])+(0|Ge[Ge[S>>2]>>2])-1|0,Ge[T>>2]=ge,0==(1+(0|Ge[T>>2])&Ge[T>>2]|0)&&(0|Ge[Te>>2])>>>0>=(0|Ge[E>>2])>>>0){switch(Ge[F>>2]=Ge[4+(0|Ge[l>>2])>>2],Ge[O>>2]=Ge[56+(0|Ge[l>>2])>>2],Ge[M>>2]=Ge[32+(0|Ge[l>>2])>>2],Ge[b>>2]=Ge[36+(0|Ge[l>>2])>>2],Ge[y>>2]=Ge[40+(0|Ge[l>>2])>>2],Ge[g>>2]=Ge[60+(0|Ge[l>>2])>>2],0|Ge[Ge[l>>2]>>2]){case 0:Ge[12+(0|Ge[l>>2])>>2]=0,Ge[8+(0|Ge[l>>2])>>2]=0,Ge[y>>2]=0,Ge[b>>2]=0,Ge[M>>2]=0,Ge[F>>2]=0,Ge[O>>2]=0,Ge[28+(0|Ge[l>>2])>>2]=1,ve=(Ge[16+(0|Ge[l>>2])>>2]=1)&Ge[_>>2]|0?(0|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0?9:(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ne=0|qe[ge>>0],De=0|Ge[l>>2],15):31;break;case 1:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ne=0|qe[ge>>0],De=0|Ge[l>>2],15):9;break;case 2:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Pe=0|Ge[l>>2],Ce=0|qe[ge>>0],22):16;break;case 36:ve=30;break;case 3:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[v>>2]=qe[ge>>0],39):33;break;case 5:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[N>>2]=qe[ge>>0],49):43;break;case 6:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[D>>2]=qe[ge>>0],61):55;break;case 7:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ie=0|Xe[ge>>0],Le=0|Ge[b>>2],xe=0|Ge[l>>2],70):64;break;case 39:ve=73;break;case 51:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[P>>2]=qe[ge>>0],83):77;break;case 52:ve=85;break;case 9:ve=89;break;case 38:ve=91;break;case 40:ve=94;break;case 10:ve=100;break;case 11:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[x>>2]=qe[ge>>0],121):115;break;case 14:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[H>>2]=qe[ge>>0],133):127;break;case 35:ve=144;break;case 16:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[oe>>2]=qe[ge>>0],185):179;break;case 17:ve=194;break;case 18:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[ie>>2]=qe[ge>>0],203):197;break;case 21:ve=208;break;case 23:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[ce>>2]=qe[ge>>0],231):225;break;case 24:ve=238;break;case 25:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[Ee>>2]=qe[ge>>0],267):261;break;case 26:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[me>>2]=qe[ge>>0],286):280;break;case 27:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[pe>>2]=qe[ge>>0],301):295;break;case 37:ve=305;break;case 53:ve=308;break;case 32:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[Fe>>2]=qe[ge>>0],326):320;break;case 41:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[be>>2]=qe[ge>>0],338):332;break;case 42:ve=(0|Ge[w>>2])>>>0<(0|Ge[R>>2])>>>0?(ge=0|Ge[w>>2],Ge[w>>2]=ge+1,Ge[Me>>2]=qe[ge>>0],347):341;break;case 34:ve=348;break;default:ve=350}do{if(9==(0|ve)){if(2&Ge[_>>2]|0){Be=Ge[p>>2]=1,He=0|Ge[l>>2],ve=349;break}De=(Ne=0)|Ge[l>>2],ve=15;break}}while(0);15==(0|ve)&&(Ge[De+8>>2]=Ne,ve=(0|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0?16:(Ne=0|Ge[w>>2],Ge[w>>2]=Ne+1,Pe=0|Ge[l>>2],Ce=0|qe[Ne>>0],22));do{if(16==(0|ve)){if(2&Ge[_>>2]|0){Ge[p>>2]=1,He=0|Ge[l>>(Be=2)],ve=349;break}Pe=0|Ge[l>>2],Ce=0,ve=22;break}}while(0);22==(0|ve)&&(Ge[Pe+12>>2]=Ce,Ue=(((Ge[8+(0|Ge[l>>2])>>2]<<8)+(0|Ge[12+(0|Ge[l>>2])>>2])|0)>>>0)%31|0||32&Ge[12+(0|Ge[l>>2])>>2]|0?1:8!=(15&Ge[8+(0|Ge[l>>2])>>2]|0),Ge[b>>2]=1&Ue,4&Ge[_>>2]||(Ye=32768<1<<8+((0|Ge[8+(0|Ge[l>>2])>>2])>>>4)>>>0?1:(1+(0|Ge[T>>2])|0)>>>0<1<<8+((0|Ge[8+(0|Ge[l>>2])>>2])>>>4)>>>0,Ge[b>>2]=Ge[b>>2]|1&Ye),ve=0|Ge[b>>2]?30:31),30==(0|ve)&&(Ge[p>>2]=-1,Be=36,He=0|Ge[l>>2],ve=349);e:for(;;){switch(0|ve){case 31:$e(2,((ve=0)|Ge[h>>2])+(0|Ge[g>>2])|0,0|Ge[m>>2]),ve=(0|Ge[F>>2])>>>0<3?32:40;break;case 33:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=3,He=0|Ge[l>>2],ve=349;continue e}Ge[v>>2]=0,ve=39;continue e;case 39:ve=0,Ge[O>>2]=Ge[O>>2]|Ge[v>>2]<>2],Ge[F>>2]=8+(0|Ge[F>>2]),ve=(0|Ge[F>>2])>>>0<3?32:40;break;case 43:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=5,He=0|Ge[l>>2],ve=349;continue e}Ge[N>>2]=0,ve=49;continue e;case 49:ve=0,Ge[O>>2]=Ge[O>>2]|Ge[N>>2]<>2],Ge[F>>2]=8+(0|Ge[F>>2]),ve=(0|Ge[F>>2])>>>0<(7&Ge[F>>2])>>>0?42:50;break;case 55:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=6,He=0|Ge[l>>2],ve=349;continue e}Ge[D>>2]=0,ve=61;continue e;case 61:ve=0,Ge[O>>2]=Ge[O>>2]|Ge[D>>2]<>2],Ge[F>>2]=8+(0|Ge[F>>2]),ve=(0|Ge[F>>2])>>>0<8?54:62;break;case 64:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=7,He=0|Ge[l>>2],ve=349;continue e}Le=(Ie=0)|Ge[b>>2],xe=0|Ge[l>>2],ve=70;continue e;case 70:Xe[xe+10528+Le>>(ve=0)]=Ie,ve=71;break;case 73:ve=0,Ge[p>>2]=-1,Be=39,He=0|Ge[l>>2],ve=349;continue e;case 77:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=51,He=0|Ge[l>>2],ve=349;continue e}Ge[P>>2]=0,ve=83;continue e;case 83:ve=0,Ge[O>>2]=Ge[O>>2]|Ge[P>>2]<>2],Ge[F>>2]=8+(0|Ge[F>>2]),ve=(0|Ge[F>>2])>>>0<8?76:84;break;case 85:if(((ve=0)|Ge[A>>2])>>>0>=(0|Ge[k>>2])>>>0){Ge[p>>2]=2,Be=52,He=0|Ge[l>>2],ve=349;continue e}Ye=255&Ge[M>>2],Ue=0|Ge[A>>2],Ge[A>>2]=Ue+1,Xe[Ue>>0]=Ye,Ge[b>>2]=(0|Ge[b>>2])-1,ve=74;break;case 89:if(((ve=0)|Ge[A>>2])>>>0<(0|Ge[k>>2])>>>0){ve=91;continue e}Ge[p>>2]=2,Be=9,He=0|Ge[l>>2],ve=349;continue e;case 91:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){if(!(2&Ge[_>>2])){ve=94;continue e}Ge[p>>2]=1,Be=38,He=0|Ge[l>>2],ve=349;continue e}ze=(((Ye=((0|Ge[k>>2])-(0|Ge[A>>2])|0)>>>0<((0|Ge[R>>2])-(0|Ge[w>>2])|0)>>>0)?0|Ge[k>>2]:0|Ge[R>>2])-(Ye?0|Ge[A>>2]:0|Ge[w>>2])|0)>>>0<(0|Ge[b>>2])>>>0?((Ye=((0|Ge[k>>2])-(0|Ge[A>>2])|0)>>>0<((0|Ge[R>>2])-(0|Ge[w>>2])|0)>>>0)?0|Ge[k>>2]:0|Ge[R>>2])-(Ye?0|Ge[A>>2]:0|Ge[w>>2])|0:0|Ge[b>>2],Ge[C>>2]=ze,tr(0|Ge[A>>2],0|Ge[w>>2],0|Ge[C>>2]),Ge[w>>2]=(0|Ge[w>>2])+(0|Ge[C>>2]),Ge[A>>2]=(0|Ge[A>>2])+(0|Ge[C>>2]),Ge[b>>2]=(0|Ge[b>>2])-(0|Ge[C>>2]),ve=88;break;case 94:ve=0,Ge[p>>2]=-1,Be=40,He=0|Ge[l>>2],ve=349;continue e;case 100:ve=0,Ge[p>>2]=-1,Be=10,He=0|Ge[l>>2],ve=349;continue e;case 115:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=11,He=0|Ge[l>>2],ve=349;continue e}Ge[x>>2]=0,ve=121;continue e;case 121:ve=0,Ge[O>>2]=Ge[O>>2]|Ge[x>>2]<>2],Ge[F>>2]=8+(0|Ge[F>>2]),ve=(0|Ge[F>>2])>>>0<(0|Xe[1331+(0|Ge[b>>2])>>0])>>>0?114:122;break;case 127:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=14,He=0|Ge[l>>2],ve=349;continue e}Ge[H>>2]=0,ve=133;continue e;case 133:ve=0,Ge[O>>2]=Ge[O>>2]|Ge[H>>2]<>2],Ge[F>>2]=8+(0|Ge[F>>2]),ve=(0|Ge[F>>2])>>>0<3?126:134;break;case 144:ve=0,Ge[p>>2]=-1,Be=35,He=0|Ge[l>>2],ve=349;continue e;case 179:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=16,He=0|Ge[l>>2],ve=349;continue e}Ge[oe>>2]=0,ve=185;continue e;case 185:ve=0,Ge[O>>2]=Ge[O>>2]|Ge[oe>>2]<>2],Ge[F>>2]=8+(0|Ge[F>>2]),ve=(0|Ge[F>>2])>>>0<15?170:187;break;case 194:ve=0,Ge[p>>2]=-1,Be=17,He=0|Ge[l>>2],ve=349;continue e;case 197:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=18,He=0|Ge[l>>2],ve=349;continue e}Ge[ie>>2]=0,ve=203;continue e;case 203:ve=0,Ge[O>>2]=Ge[O>>2]|Ge[ie>>2]<>2],Ge[F>>2]=8+(0|Ge[F>>2]),ve=(0|Ge[F>>2])>>>0<(0|Ge[y>>2])>>>0?196:204;break;case 208:ve=0,Ge[p>>2]=-1,Be=21,He=0|Ge[l>>2],ve=349;continue e;case 225:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=23,He=0|Ge[l>>2],ve=349;continue e}Ge[ce>>2]=0,ve=231;continue e;case 231:ve=0,Ge[O>>2]=Ge[O>>2]|Ge[ce>>2]<>2],Ge[F>>2]=8+(0|Ge[F>>2]),ve=(0|Ge[F>>2])>>>0<15?216:233;break;case 238:if(((ve=0)|Ge[A>>2])>>>0>=(0|Ge[k>>2])>>>0){Ge[p>>2]=2,Be=24,He=0|Ge[l>>2],ve=349;continue e}Ye=255&Ge[b>>2],Ue=0|Ge[A>>2],Ge[A>>2]=Ue+1,Xe[Ue>>0]=Ye,ve=212;break;case 261:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=25,He=0|Ge[l>>2],ve=349;continue e}Ge[Ee>>2]=0,ve=267;continue e;case 267:ve=0,Ge[O>>2]=Ge[O>>2]|Ge[Ee>>2]<>2],Ge[F>>2]=8+(0|Ge[F>>2]),ve=(0|Ge[F>>2])>>>0<(0|Ge[y>>2])>>>0?260:268;break;case 280:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=26,He=0|Ge[l>>2],ve=349;continue e}Ge[me>>2]=0,ve=286;continue e;case 286:ve=0,Ge[O>>2]=Ge[O>>2]|Ge[me>>2]<>2],Ge[F>>2]=8+(0|Ge[F>>2]),ve=(0|Ge[F>>2])>>>0<15?271:288;break;case 295:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=27,He=0|Ge[l>>2],ve=349;continue e}Ge[pe>>2]=0,ve=301;continue e;case 301:ve=0,Ge[O>>2]=Ge[O>>2]|Ge[pe>>2]<>2],Ge[F>>2]=8+(0|Ge[F>>2]),ve=(0|Ge[F>>2])>>>0<(0|Ge[y>>2])>>>0?294:302;break;case 305:ve=0,Ge[p>>2]=-1,Be=37,He=0|Ge[l>>2],ve=349;continue e;case 308:if(((ve=0)|Ge[A>>2])>>>0>=(0|Ge[k>>2])>>>0){Ge[p>>2]=2,Be=53,He=0|Ge[l>>2],ve=349;continue e}Ye=0|Ge[g>>2],Ge[g>>2]=Ye+1,Ue=0|Xe[(0|Ge[E>>2])+(Ye-(0|Ge[M>>2])&Ge[T>>2])>>0],Ye=0|Ge[A>>2],Ge[A>>2]=Ye+1,Xe[Ye>>0]=Ue,ve=307;break;case 320:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=32,He=0|Ge[l>>2],ve=349;continue e}Ge[Fe>>2]=0,ve=326;continue e;case 326:ve=0,Ge[O>>2]=Ge[O>>2]|Ge[Fe>>2]<>2],Ge[F>>2]=8+(0|Ge[F>>2]),ve=(0|Ge[F>>2])>>>0<(7&Ge[F>>2])>>>0?319:327;break;case 332:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=41,He=0|Ge[l>>2],ve=349;continue e}Ge[be>>2]=0,ve=338;continue e;case 338:ve=0,Ge[O>>2]=Ge[O>>2]|Ge[be>>2]<>2],Ge[F>>2]=8+(0|Ge[F>>2]),ve=(0|Ge[F>>2])>>>0<8?331:339;break;case 341:if(ve=0,2&Ge[_>>2]|0){Ge[p>>2]=1,Be=42,He=0|Ge[l>>2],ve=349;continue e}Ge[Me>>2]=0,ve=347;continue e;case 347:Ge[16+((ve=0)|Ge[l>>2])>>2]=Ge[16+(0|Ge[l>>2])>>2]<<8|Ge[Me>>2],Ge[b>>2]=1+(0|Ge[b>>2]),ve=328;break;case 348:ve=0,Be=34,He=(Ge[p>>2]=0)|Ge[l>>2],ve=349;continue e;case 349:ve=0,Ge[He>>2]=Be,ve=350;continue e;case 350:if(Ge[4+((ve=0)|Ge[l>>2])>>2]=Ge[F>>2],Ge[56+(0|Ge[l>>2])>>2]=Ge[O>>2],Ge[32+(0|Ge[l>>2])>>2]=Ge[M>>2],Ge[36+(0|Ge[l>>2])>>2]=Ge[b>>2],Ge[40+(0|Ge[l>>2])>>2]=Ge[y>>2],Ge[60+(0|Ge[l>>2])>>2]=Ge[g>>2],Ge[Ge[d>>2]>>2]=(0|Ge[w>>2])-(0|Ge[f>>2]),Ge[Ge[S>>2]>>2]=(0|Ge[A>>2])-(0|Ge[Te>>2]),0!=(9&Ge[_>>2]|0)&0<=(0|Ge[p>>2])){ve=351;break e}break e}if(32!=(0|ve)){r:do{if(40==(0|ve)){if(Ge[20+((ve=0)|Ge[l>>2])>>2]=7&Ge[O>>2],Ge[O>>2]=(0|Ge[O>>2])>>>3,Ge[F>>2]=(0|Ge[F>>2])-3,Ge[24+(0|Ge[l>>2])>>2]=(0|Ge[20+(0|Ge[l>>2])>>2])>>>1,!(0|Ge[24+(0|Ge[l>>2])>>2])){if((0|Ge[F>>2])>>>0<(7&Ge[F>>2])>>>0){ve=42;break}ve=50;break}if(3==(0|Ge[24+(0|Ge[l>>2])>>2])){ve=100;continue e}if(1!=(0|Ge[24+(0|Ge[l>>2])>>2])){Ge[b>>2]=0,ve=112;break}for(Ge[I>>2]=64+(0|Ge[l>>2]),Ge[44+(0|Ge[l>>2])>>2]=288,Ge[44+(0|Ge[l>>2])+4>>2]=32,Ue=64+(0|Ge[l>>2])+3488|0,Ge[Ue>>2]=84215045,Ge[Ue+4>>2]=84215045,Ge[Ue+8>>2]=84215045,Ge[Ue+12>>2]=84215045,Ge[Ue+16>>2]=84215045,Ge[Ue+20>>2]=84215045,Ge[Ue+24>>2]=84215045,Ge[Ue+28>>2]=84215045,Ge[L>>2]=0;!(143<(0|Ge[L>>2])>>>0);)Ue=0|Ge[I>>2],Ge[I>>2]=Ue+1,Xe[Ue>>0]=8,Ge[L>>2]=1+(0|Ge[L>>2]);for(;!(255<(0|Ge[L>>2])>>>0);)Ue=0|Ge[I>>2],Ge[I>>2]=Ue+1,Xe[Ue>>0]=9,Ge[L>>2]=1+(0|Ge[L>>2]);for(;!(279<(0|Ge[L>>2])>>>0);)Ue=0|Ge[I>>2],Ge[I>>2]=Ue+1,Xe[Ue>>0]=7,Ge[L>>2]=1+(0|Ge[L>>2]);for(;;){if(287<(0|Ge[L>>2])>>>0){ve=136;break r}Ue=0|Ge[I>>2],Ge[I>>2]=Ue+1,Xe[Ue>>0]=8,Ge[L>>2]=1+(0|Ge[L>>2])}}}while(0);if(42!=(0|ve)){50==(0|ve)&&(ve=0,Ge[O>>2]=(0|Ge[O>>2])>>>(7&Ge[F>>2]),Ge[F>>2]=(0|Ge[F>>2])-(7&Ge[F>>2]),Ge[b>>2]=0,ve=51);r:for(;;){switch(0|ve){case 51:if(4<=((ve=0)|Ge[b>>2])>>>0){if(Ue=qe[10528+(0|Ge[l>>2])>>0]|qe[10528+(0|Ge[l>>2])+1>>0]<<8,(0|(Ge[b>>2]=Ue))!=(65535^(qe[10528+(0|Ge[l>>2])+2>>0]|qe[10528+(0|Ge[l>>2])+3>>0]<<8)|0)){ve=73;continue e}ve=74;continue r}if(!(0|Ge[F>>2])){ve=63;break r}if((0|Ge[F>>2])>>>0<8){ve=54;continue r}ve=62;continue r;case 54:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){ve=55;continue e}ve=60;break r;case 62:Xe[10528+((ve=0)|Ge[l>>2])+(0|Ge[b>>2])>>0]=Ge[O>>2],Ge[O>>2]=(0|Ge[O>>2])>>>8,Ge[F>>2]=(0|Ge[F>>2])-8,ve=71;continue r;case 71:ve=0,Ge[b>>2]=1+(0|Ge[b>>2]),ve=51;continue r;case 74:if(!((ve=0)|Ge[b>>2]&&0!=(0|Ge[F>>2]))){ve=88;continue r}if((0|Ge[F>>2])>>>0<8){ve=76;continue r}ve=84;continue r;case 76:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){ve=77;continue e}ve=82;break r;case 84:ve=0,Ge[M>>2]=255&Ge[O>>2],Ge[O>>2]=(0|Ge[O>>2])>>>8,Ge[F>>2]=(0|Ge[F>>2])-8,ve=85;continue e;case 88:if((ve=0)|Ge[b>>2]){ve=89;continue e}ve=316;break;case 112:if(((ve=0)|Ge[b>>2])>>>0<3){if((0|Ge[F>>2])>>>0<(0|Xe[1331+(0|Ge[b>>2])>>0])>>>0){ve=114;continue r}ve=122;continue r}er(64+(0|Ge[l>>2])+6976|0,0,288),Ge[b>>2]=0,ve=124;break;case 114:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){ve=115;continue e}ve=120;break r;case 122:Ge[44+((ve=0)|Ge[l>>2])+(Ge[b>>2]<<2)>>2]=Ge[O>>2]&(1<>2])>>0])-1,Ge[O>>2]=(0|Ge[O>>2])>>>(0|Xe[1331+(0|Ge[b>>2])>>0]),Ge[F>>2]=(0|Ge[F>>2])-(0|Xe[1331+(0|Ge[b>>2])>>0]),Ue=44+(0|Ge[l>>2])+(Ge[b>>2]<<2)|0,Ge[Ue>>2]=(0|Ge[Ue>>2])+(0|Ge[72+(Ge[b>>2]<<2)>>2]),Ge[b>>2]=1+(0|Ge[b>>2]),ve=112;continue r;case 126:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){ve=127;continue e}ve=132;break r;case 134:ve=0,Ge[B>>2]=7&Ge[O>>2],Ge[O>>2]=(0|Ge[O>>2])>>>3,Ge[F>>2]=(0|Ge[F>>2])-3,Xe[64+(0|Ge[l>>2])+6976+(0|qe[1335+(0|Ge[b>>2])>>0])>>0]=Ge[B>>2],Ge[b>>2]=1+(0|Ge[b>>2]),ve=124;break;case 136:if((ve=0)<=(0|Ge[24+(0|Ge[l>>2])>>2])){for(Ge[z>>2]=64+(0|Ge[l>>2])+(3488*(0|Ge[24+(0|Ge[l>>2])>>2])|0),Ue=q,Ye=Ue+64|0;Ue=Ue+4|(Ge[Ue>>2]=0),(0|Ue)<(0|Ye););for(er(288+(0|Ge[z>>2])|0,0,2048),er(2336+(0|Ge[z>>2])|0,0,1152),Ge[V>>2]=0;!((0|Ge[V>>2])>>>0>=(0|Ge[44+(0|Ge[l>>2])+(Ge[24+(0|Ge[l>>2])>>2]<<2)>>2])>>>0);)Ue=q+(qe[(0|Ge[z>>2])+(0|Ge[V>>2])>>0]<<2)|0,Ge[Ue>>2]=1+(0|Ge[Ue>>2]),Ge[V>>2]=1+(0|Ge[V>>2]);for(Ge[W>>2]=0,Ge[X>>2]=0,Ge[4+G>>2]=0,Ge[G>>2]=0,Ge[V>>2]=1;!(15<(0|Ge[V>>2])>>>0);)Ge[W>>2]=(0|Ge[W>>2])+(0|Ge[q+(Ge[V>>2]<<2)>>2]),Ue=(0|Ge[X>>2])+(0|Ge[q+(Ge[V>>2]<<2)>>2])<<1,Ge[X>>2]=Ue,Ge[G+(1+(0|Ge[V>>2])<<2)>>2]=Ue,Ge[V>>2]=1+(0|Ge[V>>2]);if(65536!=(0|Ge[X>>2])&1<(0|Ge[W>>2])>>>0){ve=144;continue e}for(Ge[U>>2]=-1,Ge[j>>2]=0;!((0|Ge[j>>2])>>>0>=(0|Ge[44+(0|Ge[l>>2])+(Ge[24+(0|Ge[l>>2])>>2]<<2)>>2])>>>0);){Ge[Z>>2]=0,Ge[$>>2]=qe[(0|Ge[z>>2])+(0|Ge[j>>2])>>0];t:do{if(0|Ge[$>>2]){for(Ue=G+(Ge[$>>2]<<2)|0,Ye=0|Ge[Ue>>2],Ge[Ue>>2]=Ye+1,Ge[Q>>2]=Ye,Ge[J>>2]=Ge[$>>2];!((0|Ge[J>>2])>>>0<=0);)Ge[Z>>2]=Ge[Z>>2]<<1|1&Ge[Q>>2],Ge[J>>2]=(0|Ge[J>>2])-1,Ge[Q>>2]=(0|Ge[Q>>2])>>>1;if((0|Ge[$>>2])>>>0<=10)for(je[ee>>1]=Ge[$>>2]<<9|Ge[j>>2];;){if(1024<=(0|Ge[Z>>2])>>>0)break t;je[288+(0|Ge[z>>2])+(Ge[Z>>2]<<1)>>1]=0|je[ee>>1],Ge[Z>>2]=(0|Ge[Z>>2])+(1<>2])}for(Ye=0|je[288+(0|Ge[z>>2])+((1023&Ge[Z>>2])<<1)>>1],(Ge[Y>>2]=Ye)||(je[288+(0|Ge[z>>2])+((1023&Ge[Z>>2])<<1)>>1]=Ge[U>>2],Ge[Y>>2]=Ge[U>>2],Ge[U>>2]=(0|Ge[U>>2])-2),Ge[Z>>2]=(0|Ge[Z>>2])>>>9,Ge[K>>2]=Ge[$>>2];Ye=11<(0|Ge[K>>2])>>>0,Ue=(0|Ge[Z>>2])>>>1,Ge[Z>>2]=Ue,Ge[Y>>2]=(0|Ge[Y>>2])-(1&Ue),Ye;)0|je[2336+(0|Ge[z>>2])+(0-(0|Ge[Y>>2])-1<<1)>>1]?Ge[Y>>2]=je[2336+(0|Ge[z>>2])+(0-(0|Ge[Y>>2])-1<<1)>>1]:(je[2336+(0|Ge[z>>2])+(0-(0|Ge[Y>>2])-1<<1)>>1]=Ge[U>>2],Ge[Y>>2]=Ge[U>>2],Ge[U>>2]=(0|Ge[U>>2])-2),Ge[K>>2]=(0|Ge[K>>2])-1;je[2336+(0|Ge[z>>2])+(0-(0|Ge[Y>>2])-1<<1)>>1]=Ge[j>>2]}}while(0);Ge[j>>2]=1+(0|Ge[j>>2])}ve=2==(0|Ge[24+(0|Ge[l>>2])>>2])?(Ge[b>>2]=0,167):210}else ve=211;break;case 170:if(ve=0,Ge[te>>2]=je[64+(0|Ge[l>>2])+6976+288+((1023&Ge[O>>2])<<1)>>1],0<=(0|Ge[te>>2])){if(Ge[ne>>2]=Ge[te>>2]>>9,!(0|Ge[ne>>2])){ve=178;break r}if((0|Ge[F>>2])>>>0>=(0|Ge[ne>>2])>>>0){ve=187;continue r}ve=178;break r}if((0|Ge[F>>2])>>>0<=10){ve=178;break r}Ge[ne>>2]=10;do{if(Ye=~Ge[te>>2],Ue=0|Ge[O>>2],Ce=0|Ge[ne>>2],Ge[ne>>2]=Ce+1,Ge[te>>2]=je[64+(0|Ge[l>>2])+6976+2336+(Ye+(Ue>>>Ce&1)<<1)>>1],0<=(0|Ge[te>>2]))break}while((0|Ge[F>>2])>>>0>=(1+(0|Ge[ne>>2])|0)>>>0);if(0<=(0|Ge[te>>2])){ve=187;continue r}ve=178;break r;case 187:if(Ce=(ve=0)|je[64+(0|Ge[l>>2])+6976+288+((1023&Ge[O>>2])<<1)>>1],0<=(0|(Ge[te>>2]=Ce)))Ge[ne>>2]=Ge[te>>2]>>9,Ge[te>>2]=511&Ge[te>>2];else for(Ge[ne>>2]=10;Ce=~Ge[te>>2],Ue=0|Ge[O>>2],Ye=0|Ge[ne>>2],Ge[ne>>2]=Ye+1,Ge[te>>2]=je[64+(0|Ge[l>>2])+6976+2336+(Ce+(Ue>>>Ye&1)<<1)>>1],(0|Ge[te>>2])<0;);if(Ge[M>>2]=Ge[te>>2],Ge[O>>2]=(0|Ge[O>>2])>>>(0|Ge[ne>>2]),Ge[F>>2]=(0|Ge[F>>2])-(0|Ge[ne>>2]),Ye=0|Ge[M>>2],(0|Ge[M>>2])>>>0<16){Ue=0|Ge[b>>2],Ge[b>>2]=Ue+1,Xe[10532+(0|Ge[l>>2])+Ue>>0]=Ye,ve=167;break}if(!(16!=(0|Ye)|0!=(0|Ge[b>>2]))){ve=194;continue e}if(Ge[y>>2]=Xe[(0|Ge[M>>2])-16+1354>>0],(0|Ge[F>>2])>>>0<(0|Ge[y>>2])>>>0){ve=196;continue r}ve=204;continue r;case 196:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){ve=197;continue e}ve=202;break r;case 204:ve=0,Ge[re>>2]=Ge[O>>2]&(1<>2])-1,Ge[O>>2]=(0|Ge[O>>2])>>>(0|Ge[y>>2]),Ge[F>>2]=(0|Ge[F>>2])-(0|Ge[y>>2]),Ge[re>>2]=(0|Ge[re>>2])+(0|Xe[(0|Ge[M>>2])-16+1358>>0]),Ve=16==(0|Ge[M>>2])?0|qe[10532+(0|Ge[l>>2])+((0|Ge[b>>2])-1)>>0]:0,er(10532+(0|Ge[l>>2])+(0|Ge[b>>2])|0,255&Ve|0,0|Ge[re>>2]),Ge[b>>2]=(0|Ge[b>>2])+(0|Ge[re>>2]),ve=167;break;case 212:if(4<=(((ve=0)|Ge[R>>2])-(0|Ge[w>>2])|0)&&2<=((0|Ge[k>>2])-(0|Ge[A>>2])|0)){if((0|Ge[F>>2])>>>0<15&&(Ge[O>>2]=Ge[O>>2]|(qe[Ge[w>>2]>>0]|qe[1+(0|Ge[w>>2])>>0]<<8)<>2],Ge[w>>2]=2+(0|Ge[w>>2]),Ge[F>>2]=16+(0|Ge[F>>2])),Ye=0|je[64+(0|Ge[l>>2])+288+((1023&Ge[O>>2])<<1)>>1],0<=(0|(Ge[le>>2]=Ye)))Ge[fe>>2]=Ge[le>>2]>>9;else for(Ge[fe>>2]=10;Ye=~Ge[le>>2],Ue=0|Ge[O>>2],Ce=0|Ge[fe>>2],Ge[fe>>2]=Ce+1,Ge[le>>2]=je[64+(0|Ge[l>>2])+2336+(Ye+(Ue>>>Ce&1)<<1)>>1],(0|Ge[le>>2])<0;);if(Ge[b>>2]=Ge[le>>2],Ge[O>>2]=(0|Ge[O>>2])>>>(0|Ge[fe>>2]),Ge[F>>2]=(0|Ge[F>>2])-(0|Ge[fe>>2]),256&Ge[b>>2]|0){ve=257;break}if((0|Ge[F>>2])>>>0<15&&(Ge[O>>2]=Ge[O>>2]|(qe[Ge[w>>2]>>0]|qe[1+(0|Ge[w>>2])>>0]<<8)<>2],Ge[w>>2]=2+(0|Ge[w>>2]),Ge[F>>2]=16+(0|Ge[F>>2])),Ce=0|je[64+(0|Ge[l>>2])+288+((1023&Ge[O>>2])<<1)>>1],0<=(0|(Ge[le>>2]=Ce)))Ge[fe>>2]=Ge[le>>2]>>9;else for(Ge[fe>>2]=10;Ce=~Ge[le>>2],Ue=0|Ge[O>>2],Ye=0|Ge[fe>>2],Ge[fe>>2]=Ye+1,Ge[le>>2]=je[64+(0|Ge[l>>2])+2336+(Ce+(Ue>>>Ye&1)<<1)>>1],(0|Ge[le>>2])<0;);if(Ge[O>>2]=(0|Ge[O>>2])>>>(0|Ge[fe>>2]),Ge[F>>2]=(0|Ge[F>>2])-(0|Ge[fe>>2]),Xe[Ge[A>>2]>>0]=Ge[b>>2],256&Ge[le>>2]|0){Ge[A>>2]=1+(0|Ge[A>>2]),Ge[b>>2]=Ge[le>>2],ve=257;break}Xe[1+(0|Ge[A>>2])>>0]=Ge[le>>2],Ge[A>>2]=2+(0|Ge[A>>2]),ve=212;continue r}if(15<=(0|Ge[F>>2])>>>0){ve=233;continue r}if(((0|Ge[R>>2])-(0|Ge[w>>2])|0)<2){ve=216;continue r}Ge[O>>2]=Ge[O>>2]|(qe[Ge[w>>2]>>0]<>2]|qe[1+(0|Ge[w>>2])>>0]<<8+(0|Ge[F>>2])),Ge[w>>2]=2+(0|Ge[w>>2]),Ge[F>>2]=16+(0|Ge[F>>2]),ve=233;continue r;case 216:if(ve=0,Ge[se>>2]=je[64+(0|Ge[l>>2])+288+((1023&Ge[O>>2])<<1)>>1],0<=(0|Ge[se>>2])){if(Ge[ue>>2]=Ge[se>>2]>>9,!(0|Ge[ue>>2])){ve=224;break r}if((0|Ge[F>>2])>>>0>=(0|Ge[ue>>2])>>>0){ve=233;continue r}ve=224;break r}if((0|Ge[F>>2])>>>0<=10){ve=224;break r}Ge[ue>>2]=10;do{if(Ye=~Ge[se>>2],Ue=0|Ge[O>>2],Ce=0|Ge[ue>>2],Ge[ue>>2]=Ce+1,Ge[se>>2]=je[64+(0|Ge[l>>2])+2336+(Ye+(Ue>>>Ce&1)<<1)>>1],0<=(0|Ge[se>>2]))break}while((0|Ge[F>>2])>>>0>=(1+(0|Ge[ue>>2])|0)>>>0);if(0<=(0|Ge[se>>2])){ve=233;continue r}ve=224;break r;case 233:if(Ce=(ve=0)|je[64+(0|Ge[l>>2])+288+((1023&Ge[O>>2])<<1)>>1],0<=(0|(Ge[se>>2]=Ce)))Ge[ue>>2]=Ge[se>>2]>>9,Ge[se>>2]=511&Ge[se>>2];else for(Ge[ue>>2]=10;Ce=~Ge[se>>2],Ue=0|Ge[O>>2],Ye=0|Ge[ue>>2],Ge[ue>>2]=Ye+1,Ge[se>>2]=je[64+(0|Ge[l>>2])+2336+(Ce+(Ue>>>Ye&1)<<1)>>1],(0|Ge[se>>2])<0;);if(Ge[b>>2]=Ge[se>>2],Ge[O>>2]=(0|Ge[O>>2])>>>(0|Ge[ue>>2]),Ge[F>>2]=(0|Ge[F>>2])-(0|Ge[ue>>2]),!(256<=(0|Ge[b>>2])>>>0)){ve=238;continue e}ve=257;break;case 260:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){ve=261;continue e}ve=266;break r;case 268:ve=0,Ge[de>>2]=Ge[O>>2]&(1<>2])-1,Ge[O>>2]=(0|Ge[O>>2])>>>(0|Ge[y>>2]),Ge[F>>2]=(0|Ge[F>>2])-(0|Ge[y>>2]),Ge[b>>2]=(0|Ge[b>>2])+(0|Ge[de>>2]),ve=269;break;case 271:if(ve=0,Ge[Se>>2]=je[64+(0|Ge[l>>2])+3488+288+((1023&Ge[O>>2])<<1)>>1],0<=(0|Ge[Se>>2])){if(Ge[_e>>2]=Ge[Se>>2]>>9,!(0|Ge[_e>>2])){ve=279;break r}if((0|Ge[F>>2])>>>0>=(0|Ge[_e>>2])>>>0){ve=288;continue r}ve=279;break r}if((0|Ge[F>>2])>>>0<=10){ve=279;break r}Ge[_e>>2]=10;do{if(Ye=~Ge[Se>>2],Ue=0|Ge[O>>2],Ce=0|Ge[_e>>2],Ge[_e>>2]=Ce+1,Ge[Se>>2]=je[64+(0|Ge[l>>2])+3488+2336+(Ye+(Ue>>>Ce&1)<<1)>>1],0<=(0|Ge[Se>>2]))break}while((0|Ge[F>>2])>>>0>=(1+(0|Ge[_e>>2])|0)>>>0);if(0<=(0|Ge[Se>>2])){ve=288;continue r}ve=279;break r;case 288:if(Ce=(ve=0)|je[64+(0|Ge[l>>2])+3488+288+((1023&Ge[O>>2])<<1)>>1],0<=(0|(Ge[Se>>2]=Ce)))Ge[_e>>2]=Ge[Se>>2]>>9,Ge[Se>>2]=511&Ge[Se>>2];else for(Ge[_e>>2]=10;Ce=~Ge[Se>>2],Ue=0|Ge[O>>2],Ye=0|Ge[_e>>2],Ge[_e>>2]=Ye+1,Ge[Se>>2]=je[64+(0|Ge[l>>2])+3488+2336+(Ce+(Ue>>>Ye&1)<<1)>>1],(0|Ge[Se>>2])<0;);if(Ge[M>>2]=Ge[Se>>2],Ge[O>>2]=(0|Ge[O>>2])>>>(0|Ge[_e>>2]),Ge[F>>2]=(0|Ge[F>>2])-(0|Ge[_e>>2]),Ge[y>>2]=Ge[332+(Ge[M>>2]<<2)>>2],Ge[M>>2]=Ge[460+(Ge[M>>2]<<2)>>2],0|Ge[y>>2]){if((0|Ge[F>>2])>>>0<(0|Ge[y>>2])>>>0){ve=294;continue r}ve=302;continue r}ve=303;break;case 294:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){ve=295;continue e}ve=300;break r;case 302:ve=0,Ge[he>>2]=Ge[O>>2]&(1<>2])-1,Ge[O>>2]=(0|Ge[O>>2])>>>(0|Ge[y>>2]),Ge[F>>2]=(0|Ge[F>>2])-(0|Ge[y>>2]),Ge[M>>2]=(0|Ge[M>>2])+(0|Ge[he>>2]),ve=303;break;case 307:if(Ye=(ve=0)|Ge[b>>2],Ge[b>>2]=Ye+-1,0|Ye){ve=308;continue e}ve=211;break;case 319:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){ve=320;continue e}ve=325;break r;case 327:ve=0,Ge[O>>2]=(0|Ge[O>>2])>>>(7&Ge[F>>2]),Ge[F>>2]=(0|Ge[F>>2])-(7&Ge[F>>2]),Ge[b>>2]=0,ve=328;continue r;case 328:if(4<=((ve=0)|Ge[b>>2])>>>0){ve=348;continue e}if(!(0|Ge[F>>2])){ve=340;break r}if((0|Ge[F>>2])>>>0<8){ve=331;continue r}ve=339;continue r;case 331:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){ve=332;continue e}ve=337;break r;case 339:ve=0,Ge[Me>>2]=255&Ge[O>>2],Ge[O>>2]=(0|Ge[O>>2])>>>8,Ge[F>>2]=(0|Ge[F>>2])-8,ve=347;continue e}do{if(124==(0|ve)){if(((ve=0)|Ge[b>>2])>>>0<(0|Ge[44+(0|Ge[l>>2])+8>>2])>>>0){if((0|Ge[F>>2])>>>0<3){ve=126;continue r}ve=134;continue r}Ge[44+(0|Ge[l>>2])+8>>2]=19,ve=136;continue r}if(167==(0|ve)){if(((ve=0)|Ge[b>>2])>>>0>=((0|Ge[44+(0|Ge[l>>2])>>2])+(0|Ge[44+(0|Ge[l>>2])+4>>2])|0)>>>0){if(((0|Ge[44+(0|Ge[l>>2])>>2])+(0|Ge[44+(0|Ge[l>>2])+4>>2])|0)!=(0|Ge[b>>2])){ve=208;continue e}tr(64+(0|Ge[l>>2])|0,10532+(0|Ge[l>>2])|0,0|Ge[44+(0|Ge[l>>2])>>2]),tr(64+(0|Ge[l>>2])+3488|0,10532+(0|Ge[l>>2])+(0|Ge[44+(0|Ge[l>>2])>>2])|0,0|Ge[44+(0|Ge[l>>2])+4>>2]),ve=210;break}if(15<=(0|Ge[F>>2])>>>0){ve=187;continue r}if(((0|Ge[R>>2])-(0|Ge[w>>2])|0)<2){ve=170;continue r}Ge[O>>2]=Ge[O>>2]|(qe[Ge[w>>2]>>0]<>2]|qe[1+(0|Ge[w>>2])>>0]<<8+(0|Ge[F>>2])),Ge[w>>2]=2+(0|Ge[w>>2]),Ge[F>>2]=16+(0|Ge[F>>2]),ve=187;continue r}if(257==(0|ve))if(ve=0,Ye=511&Ge[b>>2],256!=(0|(Ge[b>>2]=Ye))){if(Ge[y>>2]=Ge[84+((0|Ge[b>>2])-257<<2)>>2],Ge[b>>2]=Ge[208+((0|Ge[b>>2])-257<<2)>>2],0|Ge[y>>2]){if((0|Ge[F>>2])>>>0<(0|Ge[y>>2])>>>0){ve=260;continue r}ve=268;continue r}ve=269}else ve=316;else if(303==(0|ve)){if(ve=0,Ge[g>>2]=(0|Ge[A>>2])-(0|Ge[E>>2]),(0|Ge[M>>2])>>>0>(0|Ge[g>>2])>>>0&&4&Ge[_>>2]|0){ve=305;continue e}if(Ge[ae>>2]=(0|Ge[E>>2])+((0|Ge[g>>2])-(0|Ge[M>>2])&Ge[T>>2]),(((0|Ge[A>>2])>>>0>(0|Ge[ae>>2])>>>0?0|Ge[A>>2]:0|Ge[ae>>2])+(0|Ge[b>>2])|0)>>>0>(0|Ge[k>>2])>>>0){ve=307;continue r}for(;Xe[Ge[A>>2]>>0]=0|Xe[Ge[ae>>2]>>0],Xe[1+(0|Ge[A>>2])>>0]=0|Xe[1+(0|Ge[ae>>2])>>0],Xe[2+(0|Ge[A>>2])>>0]=0|Xe[2+(0|Ge[ae>>2])>>0],Ge[A>>2]=3+(0|Ge[A>>2]),Ge[ae>>2]=3+(0|Ge[ae>>2]),Ye=(0|Ge[b>>2])-3|0,Ge[b>>2]=Ye,2<(0|Ye););ve=(0<(0|Ge[b>>2])&&(Xe[Ge[A>>2]>>0]=0|Xe[Ge[ae>>2]>>0],1<(0|Ge[b>>2])&&(Xe[1+(0|Ge[A>>2])>>0]=0|Xe[1+(0|Ge[ae>>2])>>0]),Ge[A>>2]=(0|Ge[A>>2])+(0|Ge[b>>2])),211)}}while(0);if(210!=(0|ve))if(211!=(0|ve)){if(269==(0|ve))ve=15<=((ve=0)|Ge[F>>2])>>>0?288:((0|Ge[R>>2])-(0|Ge[w>>2])|0)<2?271:(Ge[O>>2]=Ge[O>>2]|(qe[Ge[w>>2]>>0]<>2]|qe[1+(0|Ge[w>>2])>>0]<<8+(0|Ge[F>>2])),Ge[w>>2]=2+(0|Ge[w>>2]),Ge[F>>2]=16+(0|Ge[F>>2]),288);else if(316==(0|ve)){if((ve=0)!=(1&Ge[20+(0|Ge[l>>2])>>2]|0)^1){ve=31;continue e}if(!(1&Ge[_>>2])){ve=348;continue e}(0|Ge[F>>2])>>>0<(7&Ge[F>>2])>>>0?ve=319:ve=327}}else ve=0,ve=212;else Ye=24+((ve=0)|Ge[l>>2])|0,Ge[Ye>>2]=(0|Ge[Ye>>2])-1,ve=136}switch(0|ve){case 60:Ye=(ve=0)|Ge[w>>2],Ge[w>>2]=Ye+1,Ge[D>>2]=qe[Ye>>0],ve=61;continue e;case 63:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){ve=64;continue e}Ye=0|Ge[w>>2],Ge[w>>2]=Ye+1,Ie=0|Xe[Ye>>0],Le=0|Ge[b>>2],xe=0|Ge[l>>2],ve=70;continue e;case 82:Ye=(ve=0)|Ge[w>>2],Ge[w>>2]=Ye+1,Ge[P>>2]=qe[Ye>>0],ve=83;continue e;case 120:Ye=(ve=0)|Ge[w>>2],Ge[w>>2]=Ye+1,Ge[x>>2]=qe[Ye>>0],ve=121;continue e;case 132:Ye=(ve=0)|Ge[w>>2],Ge[w>>2]=Ye+1,Ge[H>>2]=qe[Ye>>0],ve=133;continue e;case 178:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){ve=179;continue e}Ye=0|Ge[w>>2],Ge[w>>2]=Ye+1,Ge[oe>>2]=qe[Ye>>0],ve=185;continue e;case 202:Ye=(ve=0)|Ge[w>>2],Ge[w>>2]=Ye+1,Ge[ie>>2]=qe[Ye>>0],ve=203;continue e;case 224:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){ve=225;continue e}Ye=0|Ge[w>>2],Ge[w>>2]=Ye+1,Ge[ce>>2]=qe[Ye>>0],ve=231;continue e;case 266:Ye=(ve=0)|Ge[w>>2],Ge[w>>2]=Ye+1,Ge[Ee>>2]=qe[Ye>>0],ve=267;continue e;case 279:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){ve=280;continue e}Ye=0|Ge[w>>2],Ge[w>>2]=Ye+1,Ge[me>>2]=qe[Ye>>0],ve=286;continue e;case 300:Ye=(ve=0)|Ge[w>>2],Ge[w>>2]=Ye+1,Ge[pe>>2]=qe[Ye>>0],ve=301;continue e;case 325:Ye=(ve=0)|Ge[w>>2],Ge[w>>2]=Ye+1,Ge[Fe>>2]=qe[Ye>>0],ve=326;continue e;case 337:Ye=(ve=0)|Ge[w>>2],Ge[w>>2]=Ye+1,Ge[be>>2]=qe[Ye>>0],ve=338;continue e;case 340:if(((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0){ve=341;continue e}Ye=0|Ge[w>>2],Ge[w>>2]=Ye+1,Ge[Me>>2]=qe[Ye>>0],ve=347;continue e}}else ve=((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0?43:(Ue=0|Ge[w>>2],Ge[w>>2]=Ue+1,Ge[N>>2]=qe[Ue>>0],49)}else ve=((ve=0)|Ge[w>>2])>>>0>=(0|Ge[R>>2])>>>0?33:(Ue=0|Ge[w>>2],Ge[w>>2]=Ue+1,Ge[v>>2]=qe[Ue>>0],39)}if(351==(0|ve)){for(Ge[ye>>2]=Ge[Te>>2],Ge[Oe>>2]=Ge[Ge[S>>2]>>2],Ge[Re>>2]=65535&Ge[28+(0|Ge[l>>2])>>2],Ge[Ae>>2]=(0|Ge[28+(0|Ge[l>>2])>>2])>>>16,Ge[ke>>2]=((0|Ge[Oe>>2])>>>0)%5552|0;0|Ge[Oe>>2];){for(Ge[we>>2]=0;!((7+(0|Ge[we>>2])|0)>>>0>=(0|Ge[ke>>2])>>>0);)Ge[Re>>2]=(0|Ge[Re>>2])+(0|qe[Ge[ye>>2]>>0]),Ge[Ae>>2]=(0|Ge[Ae>>2])+(0|Ge[Re>>2]),Ge[Re>>2]=(0|Ge[Re>>2])+(0|qe[1+(0|Ge[ye>>2])>>0]),Ge[Ae>>2]=(0|Ge[Ae>>2])+(0|Ge[Re>>2]),Ge[Re>>2]=(0|Ge[Re>>2])+(0|qe[2+(0|Ge[ye>>2])>>0]),Ge[Ae>>2]=(0|Ge[Ae>>2])+(0|Ge[Re>>2]),Ge[Re>>2]=(0|Ge[Re>>2])+(0|qe[3+(0|Ge[ye>>2])>>0]),Ge[Ae>>2]=(0|Ge[Ae>>2])+(0|Ge[Re>>2]),Ge[Re>>2]=(0|Ge[Re>>2])+(0|qe[4+(0|Ge[ye>>2])>>0]),Ge[Ae>>2]=(0|Ge[Ae>>2])+(0|Ge[Re>>2]),Ge[Re>>2]=(0|Ge[Re>>2])+(0|qe[5+(0|Ge[ye>>2])>>0]),Ge[Ae>>2]=(0|Ge[Ae>>2])+(0|Ge[Re>>2]),Ge[Re>>2]=(0|Ge[Re>>2])+(0|qe[6+(0|Ge[ye>>2])>>0]),Ge[Ae>>2]=(0|Ge[Ae>>2])+(0|Ge[Re>>2]),Ge[Re>>2]=(0|Ge[Re>>2])+(0|qe[7+(0|Ge[ye>>2])>>0]),Ge[Ae>>2]=(0|Ge[Ae>>2])+(0|Ge[Re>>2]),Ge[we>>2]=8+(0|Ge[we>>2]),Ge[ye>>2]=8+(0|Ge[ye>>2]);for(;!((0|Ge[we>>2])>>>0>=(0|Ge[ke>>2])>>>0);)Te=0|Ge[ye>>2],Ge[ye>>2]=Te+1,Ge[Re>>2]=(0|Ge[Re>>2])+(0|qe[Te>>0]),Ge[Ae>>2]=(0|Ge[Ae>>2])+(0|Ge[Re>>2]),Ge[we>>2]=1+(0|Ge[we>>2]);Ge[Re>>2]=((0|Ge[Re>>2])>>>0)%65521|0,Ge[Ae>>2]=((0|Ge[Ae>>2])>>>0)%65521|0,Ge[Oe>>2]=(0|Ge[Oe>>2])-(0|Ge[ke>>2]),Ge[ke>>2]=5552}Ge[28+(0|Ge[l>>2])>>2]=(Ge[Ae>>2]<<16)+(0|Ge[Re>>2]),0==(0|Ge[p>>2])&&1&Ge[_>>2]|0&&(0|Ge[28+(0|Ge[l>>2])>>2])!=(0|Ge[16+(0|Ge[l>>2])>>2])&&(Ge[p>>2]=-2)}return Ge[c>>2]=Ge[p>>2],Ke=0|Ge[c>>2],Ze=We,0|Ke}return Ge[Ge[S>>2]>>2]=0,Ge[Ge[d>>2]>>2]=0,Ge[c>>2]=-3,Ke=0|Ge[c>>2],Ze=We,0|Ke}function x(e){e|=0;var r,t=0,n=0,o=0,i=0,a=0,s=0,u=0,c=0,l=0,f=0,d=0,E=0,S=0,_=0,m=0,h=0,p=0,F=0,M=0,b=0,y=0,O=0,w=0,R=0,A=0,k=0,T=0,g=0,v=0,N=0,D=0,P=0,C=0,I=0,L=0,x=0,B=0,H=0,U=0,Y=0,z=0,V=0,K=0,W=0,X=0,j=0,G=0,q=0,Z=0,J=0,Q=0,$=0,ee=0,re=0,te=0,ne=0,oe=0,ie=0,ae=0,se=0,ue=0,ce=0,le=0,fe=0,de=0,Ee=0,Se=0,_e=0,me=0,he=0,pe=0,Fe=0,Me=0,be=0,ye=Ze;(0|Je)<=(0|(Ze=Ze+16|0))&&Qe(16),t=ye;do{if(e>>>0<245){if(o=(n=e>>>0<11?16:e+11&-8)>>>3,3&(a=(i=0|Ge[948])>>>o)|0)return l=0|Ge[(c=(u=3832+((s=(1&a^1)+o|0)<<1<<2)|0)+8|0)>>2],(0|u)==(0|(d=0|Ge[(f=l+8|0)>>2]))?Ge[948]=i&~(1<>2]=u,Ge[c>>2]=d),d=s<<3,Ge[l+4>>2]=3|d,Ge[(s=l+d+4|0)>>2]=1|Ge[s>>2],Ze=ye,0|(E=f);if((f=0|Ge[950])>>>0>>0){if(0|a)return a=0|Ge[(c=(l=3832+((u=((s=(o=(s=((d=a<>>(d=s>>>12&16))>>>5&8)|d|(o=(a=o>>>s)>>>2&4)|(a=(l=a>>>o)>>>1&2)|(l=(c=l>>>a)>>>1&1))+(c>>>l)|0)<<1<<2)|0)+8|0)>>2],S=(0|l)==(0|(d=0|Ge[(o=a+8|0)>>2]))?(s=i&~(1<>2]=l,Ge[c>>2]=d,i),d=(u<<3)-n|0,Ge[a+4>>2]=3|n,Ge[(u=a+n|0)+4>>2]=1|d,Ge[u+d>>2]=d,0|f&&(a=0|Ge[953],l=3832+((c=f>>>3)<<1<<2)|0,m=S&(s=1<>2],s):(Ge[948]=S|s,(_=l)+8|0),Ge[m>>2]=a,Ge[_+12>>2]=a,Ge[a+8>>2]=_,Ge[a+12>>2]=l),Ge[950]=d,Ge[953]=u,Ze=ye,0|(E=o);if(o=0|Ge[949]){if(h=0|Ge[4096+(((u=(l=(u=(o&0-o)-1|0)>>>(d=u>>>12&16))>>>5&8)|d|(l=(a=l>>>u)>>>2&4)|(a=(s=a>>>l)>>>1&2)|(s=(c=s>>>a)>>>1&1))+(c>>>s)<<2)>>2],s=(-8&Ge[h+4>>2])-n|0,c=0|Ge[h+16+((0==(0|Ge[h+16>>2])&1)<<2)>>2])for(a=h,h=s,s=c;;){if(d=(l=(c=(-8&Ge[s+4>>2])-n|0)>>>0>>0)?c:h,c=l?s:a,!(s=0|Ge[s+16+((0==(0|Ge[s+16>>2])&1)<<2)>>2])){p=c,F=d;break}a=c,h=d}else p=h,F=s;if(p>>>0<(h=p+n|0)>>>0){a=0|Ge[p+24>>2],s=0|Ge[p+12>>2];do{if((0|s)==(0|p)){if(c=0|Ge[(d=p+20|0)>>2])b=c,y=d;else{if(!(u=0|Ge[(l=p+16|0)>>2])){M=0;break}b=u,y=l}for(;;)if(0|(c=0|Ge[(d=b+20|0)>>2]))b=c,y=d;else{if(!(c=0|Ge[(d=b+16|0)>>2]))break;b=c,y=d}Ge[y>>2]=0,M=b}else d=0|Ge[p+8>>2],Ge[d+12>>2]=s,Ge[s+8>>2]=d,M=s}while(0);do{if(0|a){if(s=0|Ge[p+28>>2],(0|p)==(0|Ge[(d=4096+(s<<2)|0)>>2])){if(!(Ge[d>>2]=M)){Ge[949]=o&~(1<>2])!=(0|p)&1)<<2)>>2]=M))break;Ge[M+24>>2]=a,0|(s=0|Ge[p+16>>2])&&(Ge[M+16>>2]=s,Ge[s+24>>2]=M),0|(s=0|Ge[p+20>>2])&&(Ge[M+20>>2]=s,Ge[s+24>>2]=M)}}while(0);return F>>>0<16?(a=F+n|0,Ge[p+4>>2]=3|a,Ge[(o=p+a+4|0)>>2]=1|Ge[o>>2]):(Ge[p+4>>2]=3|n,Ge[h+4>>2]=1|F,Ge[h+F>>2]=F,0|f&&(o=0|Ge[953],s=3832+((a=f>>>3)<<1<<2)|0,w=i&(d=1<>2],d):(Ge[948]=i|d,(O=s)+8|0),Ge[w>>2]=o,Ge[O+12>>2]=o,Ge[o+8>>2]=O,Ge[o+12>>2]=s),Ge[950]=F,Ge[953]=h),Ze=ye,0|(E=p+8|0)}R=n}else R=n}else R=n}else if(e>>>0<=4294967231)if(o=-8&(s=e+11|0),d=0|Ge[949]){a=0-o|0,A=(c=s>>>8)?16777215>>0?31:o>>>((k=14-((c=((l=c<<(s=(c+1048320|0)>>>16&8))+520192|0)>>>16&4)|s|(l=((u=l<>>16&2))+(u<>>15)|0)+7|0)&1|k<<1:0,k=0|Ge[4096+(A<<2)>>2];e:do{if(k)for(u=a,s=k,c=o<<(31==((l=0)|A)?0:25-(A>>>1)|0),D=0;;){if((P=(-8&Ge[s+4>>2])-o|0)>>>0>>0){if(!P){I=0,L=C=s,N=61;break e}x=s,B=P}else x=l,B=u;if(r=0==(0|(P=0|Ge[s+20>>2]))|(0|P)==(0|(s=0|Ge[s+16+(c>>>31<<2)>>2]))?D:P,P=0==(0|s)){T=r,g=x,v=B,N=57;break}l=x,u=B,c<<=1&(1^P),D=r}else g=T=0,v=a,N=57}while(0);if(57==(0|N)){if(0==(0|T)&0==(0|g)){if(!(a=d&((k=2<>>(a=k>>>12&16))>>>5&8)|a|(n=(h=n>>>k)>>>2&4)|(h=(i=h>>>n)>>>1&2)|(i=(f=i>>>h)>>>1&1))+(f>>>i)<<2)>>2]}else H=g,U=T;U?(C=H,I=v,L=U,N=61):(Y=H,z=v)}if(61==(0|N))for(;;){if(N=0,h=(f=(i=(-8&Ge[L+4>>2])-o|0)>>>0>>0)?i:I,i=f?L:C,!(L=0|Ge[L+16+((0==(0|Ge[L+16>>2])&1)<<2)>>2])){Y=i,z=h;break}C=i,I=h,N=61}if(0!=(0|Y)&&z>>>0<((0|Ge[950])-o|0)>>>0){if((h=Y+o|0)>>>0<=Y>>>0)return Ze=ye,(E=0)|E;i=0|Ge[Y+24>>2],f=0|Ge[Y+12>>2];do{if((0|f)==(0|Y)){if(a=0|Ge[(n=Y+20|0)>>2])K=a,W=n;else{if(!(D=0|Ge[(k=Y+16|0)>>2])){V=0;break}K=D,W=k}for(;;)if(0|(a=0|Ge[(n=K+20|0)>>2]))K=a,W=n;else{if(!(a=0|Ge[(n=K+16|0)>>2]))break;K=a,W=n}Ge[W>>2]=0,V=K}else n=0|Ge[Y+8>>2],Ge[n+12>>2]=f,Ge[f+8>>2]=n,V=f}while(0);do{if(i){if(f=0|Ge[Y+28>>2],(0|Y)==(0|Ge[(n=4096+(f<<2)|0)>>2])){if(!(Ge[n>>2]=V)){n=d&~(1<>2])!=(0|Y)&1)<<2)>>2]=V)){X=d;break}Ge[V+24>>2]=i,0|(n=0|Ge[Y+16>>2])&&(Ge[V+16>>2]=n,Ge[n+24>>2]=V),X=((n=0|Ge[Y+20>>2])&&(Ge[V+20>>2]=n,Ge[n+24>>2]=V),d)}else X=d}while(0);do{if(16<=z>>>0){if(Ge[Y+4>>2]=3|o,Ge[h+4>>2]=1|z,d=(Ge[h+z>>2]=z)>>>3,z>>>0<256){i=3832+(d<<1<<2)|0,G=(n=0|Ge[948])&(f=1<>2],f):(Ge[948]=n|f,(j=i)+8|0),Ge[G>>2]=h,Ge[j+12>>2]=h,Ge[h+8>>2]=j,Ge[h+12>>2]=i;break}if(a=4096+((q=(i=z>>>8)?16777215>>0?31:z>>>((a=14-((i=((n=i<<(f=(i+1048320|0)>>>16&8))+520192|0)>>>16&4)|f|(n=((d=n<>>16&2))+(d<>>15)|0)+7|0)&1|a<<1:0)<<2)|0,Ge[h+28>>2]=q,Ge[(n=h+16|0)+4>>2]=0,Ge[n>>2]=0,!(X&(n=1<>2]=h,Ge[h+24>>2]=a,Ge[h+12>>2]=h,Ge[h+8>>2]=h;break}for(n=z<<(31==(0|q)?0:25-(q>>>1)|0),d=0|Ge[a>>2];;){if((-8&Ge[d+4>>2]|0)==(0|z)){N=97;break}if(!(a=0|Ge[(Z=d+16+(n>>>31<<2)|0)>>2])){N=96;break}n<<=1,d=a}if(96==(0|N)){Ge[Z>>2]=h,Ge[h+24>>2]=d,Ge[h+12>>2]=h,Ge[h+8>>2]=h;break}if(97==(0|N)){a=0|Ge[(n=d+8|0)>>2],Ge[a+12>>2]=h,Ge[n>>2]=h,Ge[h+8>>2]=a,Ge[h+12>>2]=d,Ge[h+24>>2]=0;break}}else a=z+o|0,Ge[Y+4>>2]=3|a,Ge[(n=Y+a+4|0)>>2]=1|Ge[n>>2]}while(0);return Ze=ye,0|(E=Y+8|0)}R=o}else R=o;else R=-1}while(0);if(R>>>0<=(Y=0|Ge[950])>>>0)return z=Y-R|0,Z=0|Ge[953],15>>0?(q=Z+R|0,Ge[953]=q,Ge[950]=z,Ge[q+4>>2]=1|z,Ge[q+z>>2]=z,Ge[Z+4>>2]=3|R):(Ge[950]=0,Ge[953]=0,Ge[Z+4>>2]=3|Y,Ge[(z=Z+Y+4|0)>>2]=1|Ge[z>>2]),Ze=ye,0|(E=Z+8|0);if(R>>>0<(Z=0|Ge[951])>>>0)return z=Z-R|0,Ge[951]=z,q=(Y=0|Ge[954])+R|0,Ge[954]=q,Ge[q+4>>2]=1|z,Ge[Y+4>>2]=3|R,Ze=ye,0|(E=Y+8|0);if(J=0|Ge[1066]?0|Ge[1068]:(Ge[1068]=4096,Ge[1067]=4096,Ge[1069]=-1,Ge[1070]=-1,Ge[1071]=0,Ge[1059]=0,Y=-16&t^1431655768,Ge[t>>2]=Y,Ge[1066]=Y,4096),Y=R+48|0,(J=(z=J+(t=R+47|0)|0)&(q=0-J|0))>>>0<=R>>>0)return Ze=ye,(E=0)|E;if(0|(X=0|Ge[1058])&&(G=(j=0|Ge[1056])+J|0)>>>0<=j>>>0|X>>>0>>0)return Ze=ye,(E=0)|E;e:do{if(4&Ge[1059])oe=0,N=133;else{X=0|Ge[954];r:do{if(X){for(G=4240;!((j=0|Ge[G>>2])>>>0<=X>>>0&&(j+(0|Ge[(Q=G+4|0)>>2])|0)>>>0>X>>>0);){if(!(j=0|Ge[G+8>>2])){N=118;break r}G=j}if((d=z-Z&q)>>>0<2147483647)if((0|(j=0|Oe(0|d)))==((0|Ge[G>>2])+(0|Ge[Q>>2])|0)){if(-1!=(0|j)){ee=d,re=j,N=135;break e}$=d}else te=j,ne=d,N=126;else $=0}else N=118}while(0);do{if(118==(0|N))if(-1!=(0|(X=0|Oe(0)))&&(o=X,d=(V=(0==((j=(d=0|Ge[1067])+-1|0)&o|0)?0:(j+o&0-d)-o|0)+J|0)+(o=0|Ge[1056])|0,R>>>0>>0&V>>>0<2147483647)){if(0|(j=0|Ge[1058])&&d>>>0<=o>>>0|j>>>0>>0){$=0;break}if((0|(j=0|Oe(0|V)))==(0|X)){ee=V,re=X,N=135;break e}te=j,ne=V,N=126}else $=0}while(0);do{if(126==(0|N)){if(V=0-ne|0,!(ne>>>0>>0&ne>>>0<2147483647&-1!=(0|te))){if(-1==(0|te)){$=0;break}ee=ne,re=te,N=135;break e}if(2147483647<=(X=t-ne+(j=0|Ge[1068])&0-j)>>>0){ee=ne,re=te,N=135;break e}if(-1==(0|Oe(0|X))){Oe(0|V),$=0;break}ee=X+ne|0,re=te,N=135;break e}}while(0);Ge[1059]=4|Ge[1059],oe=$,N=133}}while(0);if(133==(0|N)&&J>>>0<2147483647&&!(-1==(0|($=0|Oe(0|J)))|1^(ne=(R+40|0)>>>0<(te=(J=0|Oe(0))-$|0)>>>0)|$>>>0>>0&-1!=(0|$)&-1!=(0|J)^1)&&(ee=ne?te:oe,re=$,N=135),135==(0|N)){$=(0|Ge[1056])+ee|0,(Ge[1056]=$)>>>0>(0|Ge[1057])>>>0&&(Ge[1057]=$),$=0|Ge[954];do{if($){for(oe=4240;;){if((0|re)==((ie=0|Ge[oe>>2])+(se=0|Ge[(ae=oe+4|0)>>2])|0)){N=145;break}if(!(te=0|Ge[oe+8>>2]))break;oe=te}if(145==(0|N)&&0==(8&Ge[oe+12>>2]|0)&&$>>>0>>0&ie>>>0<=$>>>0){Ge[ae>>2]=se+ee,te=$+(ne=0==(7&(te=$+8|0)|0)?0:0-te&7)|0,J=(0|Ge[951])+(ee-ne)|0,Ge[954]=te,Ge[951]=J,Ge[te+4>>2]=1|J,Ge[te+J+4>>2]=40,Ge[955]=Ge[1070];break}for(re>>>0<(0|Ge[952])>>>0&&(Ge[952]=re),J=re+ee|0,te=4240;;){if((0|Ge[te>>2])==(0|J)){N=153;break}if(!(ne=0|Ge[te+8>>2]))break;te=ne}if(153==(0|N)&&0==(8&Ge[te+12>>2]|0)){Ge[te>>2]=re,Ge[(oe=te+4|0)>>2]=(0|Ge[oe>>2])+ee,ne=re+(0==(7&(oe=re+8|0)|0)?0:0-oe&7)|0,t=J+(0==(7&(oe=J+8|0)|0)?0:0-oe&7)|0,oe=ne+R|0,Y=t-ne-R|0,Ge[ne+4>>2]=3|R;do{if((0|t)!=(0|$)){if((0|t)==(0|Ge[953])){Q=(0|Ge[950])+Y|0,Ge[950]=Q,Ge[953]=oe,Ge[oe+4>>2]=1|Q,Ge[oe+Q>>2]=Q;break}if(1==(3&(Q=0|Ge[t+4>>2])|0)){q=-8&Q,Z=Q>>>3;e:do{if(Q>>>0<256){if(z=0|Ge[t+8>>2],(0|(X=0|Ge[t+12>>2]))==(0|z)){Ge[948]=Ge[948]&~(1<>2]=X,Ge[X+8>>2]=z;break}z=0|Ge[t+24>>2],X=0|Ge[t+12>>2];do{if((0|X)==(0|t)){if(d=0|Ge[(j=(V=t+16|0)+4|0)>>2])ce=d,le=j;else{if(!(o=0|Ge[V>>2])){ue=0;break}ce=o,le=V}for(;;)if(0|(d=0|Ge[(j=ce+20|0)>>2]))ce=d,le=j;else{if(!(d=0|Ge[(j=ce+16|0)>>2]))break;ce=d,le=j}Ge[le>>2]=0,ue=ce}else j=0|Ge[t+8>>2],Ge[j+12>>2]=X,Ge[X+8>>2]=j,ue=X}while(0);if(!z)break;j=4096+((X=0|Ge[t+28>>2])<<2)|0;do{if((0|t)==(0|Ge[j>>2])){if(0|(Ge[j>>2]=ue))break;Ge[949]=Ge[949]&~(1<>2])!=(0|t)&1)<<2)>>2]=ue))break e}while(0)}while((Ge[ue+24>>2]=z,0|(j=0|Ge[(X=t+16|0)>>2])&&(Ge[ue+16>>2]=j,Ge[j+24>>2]=ue),j=0|Ge[X+4>>2])&&(Ge[ue+20>>2]=j,Ge[j+24>>2]=ue,0));fe=t+q|0,de=q+Y|0}else fe=t,de=Y;if(Ge[(Z=fe+4|0)>>2]=-2&Ge[Z>>2],Ge[oe+4>>2]=1|de,Z=(Ge[oe+de>>2]=de)>>>3,de>>>0<256){Q=3832+(Z<<1<<2)|0,Se=(G=0|Ge[948])&(j=1<>2],j):(Ge[948]=G|j,(Ee=Q)+8|0),Ge[Se>>2]=oe,Ge[Ee+12>>2]=oe,Ge[oe+8>>2]=Ee,Ge[oe+12>>2]=Q;break}Q=de>>>8;do{if(Q){if(16777215>>0){_e=31;break}_e=de>>>((d=14-((Z=((G=Q<<(j=(Q+1048320|0)>>>16&8))+520192|0)>>>16&4)|j|(G=((X=G<>>16&2))+(X<>>15)|0)+7|0)&1|d<<1}else _e=0}while(0);if(Q=4096+(_e<<2)|0,Ge[oe+28>>2]=_e,Ge[(q=oe+16|0)+4>>2]=0,!((q=(Ge[q>>2]=0)|Ge[949])&(d=1<<_e))){Ge[949]=q|d,Ge[Q>>2]=oe,Ge[oe+24>>2]=Q,Ge[oe+12>>2]=oe,Ge[oe+8>>2]=oe;break}for(d=de<<(31==(0|_e)?0:25-(_e>>>1)|0),q=0|Ge[Q>>2];;){if((-8&Ge[q+4>>2]|0)==(0|de)){N=194;break}if(!(Q=0|Ge[(me=q+16+(d>>>31<<2)|0)>>2])){N=193;break}d<<=1,q=Q}if(193==(0|N)){Ge[me>>2]=oe,Ge[oe+24>>2]=q,Ge[oe+12>>2]=oe,Ge[oe+8>>2]=oe;break}if(194==(0|N)){Q=0|Ge[(d=q+8|0)>>2],Ge[Q+12>>2]=oe,Ge[d>>2]=oe,Ge[oe+8>>2]=Q,Ge[oe+12>>2]=q,Ge[oe+24>>2]=0;break}}else Q=(0|Ge[951])+Y|0,Ge[951]=Q,Ge[954]=oe,Ge[oe+4>>2]=1|Q}while(0);return Ze=ye,0|(E=ne+8|0)}for(oe=4240;!((Y=0|Ge[oe>>2])>>>0<=$>>>0&&$>>>0<(he=Y+(0|Ge[oe+4>>2])|0)>>>0);)oe=0|Ge[oe+8>>2];for(oe=he+-47|0,ne=oe+8|0,Y=oe+(0==(7&ne|0)?0:0-ne&7)|0,ne=$+16|0,oe=Y>>>0>>0?$:Y,Y=oe+8|0,t=re+8|0,J=0==(7&t|0)?0:0-t&7,t=re+J|0,te=ee+-40-J|0,Ge[954]=t,Ge[951]=te,Ge[t+4>>2]=1|te,Ge[t+te+4>>2]=40,Ge[955]=Ge[1070],te=oe+4|0,Ge[te>>2]=27,Ge[Y>>2]=Ge[1060],Ge[Y+4>>2]=Ge[1061],Ge[Y+8>>2]=Ge[1062],Ge[Y+12>>2]=Ge[1063],Ge[1060]=re,Ge[1061]=ee,Ge[1063]=0,Ge[1062]=Y,Y=oe+24|0;Ge[(Y=(t=Y)+4|0)>>2]=7,(t+8|0)>>>0>>0;);if((0|oe)!=(0|$)){if(Y=oe-$|0,Ge[te>>2]=-2&Ge[te>>2],Ge[$+4>>2]=1|Y,t=(Ge[oe>>2]=Y)>>>3,Y>>>0<256){J=3832+(t<<1<<2)|0,Fe=(Q=0|Ge[948])&(d=1<>2],d):(Ge[948]=Q|d,(pe=J)+8|0),Ge[Fe>>2]=$,Ge[pe+12>>2]=$,Ge[$+8>>2]=pe,Ge[$+12>>2]=J;break}if(G=4096+((Me=(J=Y>>>8)?16777215>>0?31:Y>>>((G=14-((J=((Q=J<<(d=(J+1048320|0)>>>16&8))+520192|0)>>>16&4)|d|(Q=((t=Q<>>16&2))+(t<>>15)|0)+7|0)&1|G<<1:0)<<2)|0,Ge[$+28>>2]=Me,Ge[$+20>>2]=0,!((Q=(Ge[ne>>2]=0)|Ge[949])&(t=1<>2]=$,Ge[$+24>>2]=G,Ge[$+12>>2]=$,Ge[$+8>>2]=$;break}for(t=Y<<(31==(0|Me)?0:25-(Me>>>1)|0),Q=0|Ge[G>>2];;){if((-8&Ge[Q+4>>2]|0)==(0|Y)){N=216;break}if(!(G=0|Ge[(be=Q+16+(t>>>31<<2)|0)>>2])){N=215;break}t<<=1,Q=G}if(215==(0|N)){Ge[be>>2]=$,Ge[$+24>>2]=Q,Ge[$+12>>2]=$,Ge[$+8>>2]=$;break}if(216==(0|N)){Y=0|Ge[(t=Q+8|0)>>2],Ge[Y+12>>2]=$,Ge[t>>2]=$,Ge[$+8>>2]=Y,Ge[$+12>>2]=Q,Ge[$+24>>2]=0;break}}}else{for(Y=0|Ge[952],0==(0|Y)|re>>>0>>0&&(Ge[952]=re),Ge[1060]=re,Ge[1061]=ee,Ge[1063]=0,Ge[957]=Ge[1066],Ge[956]=-1,Y=0;Ge[(t=3832+(Y<<1<<2)|0)+12>>2]=t,Ge[t+8>>2]=t,Y=Y+1|0,32!=(0|Y););Y=re+(Q=0==(7&(Y=re+8|0)|0)?0:0-Y&7)|0,t=ee+-40-Q|0,Ge[954]=Y,Ge[951]=t,Ge[Y+4>>2]=1|t,Ge[Y+t+4>>2]=40,Ge[955]=Ge[1070]}}while(0);if(R>>>0<(ee=0|Ge[951])>>>0)return re=ee-R|0,Ge[951]=re,$=(ee=0|Ge[954])+R|0,Ge[954]=$,Ge[$+4>>2]=1|re,Ge[ee+4>>2]=3|R,Ze=ye,0|(E=ee+8|0)}return Ge[(ee=652)>>2]=12,Ze=ye,(E=0)|E}function B(e){var r,t,n,o=0,i=0,a=0,s=0,u=0,c=0,l=0,f=0,d=0,E=0,S=0,_=0,m=0,h=0,p=0,F=0,M=0,b=0,y=0,O=0,w=0,R=0,A=0,k=0,T=0;if(e|=0){o=e+-8|0,i=0|Ge[952],r=o+(e=-8&(a=0|Ge[e+-4>>2]))|0;do{if(1&a)d=e,E=f=o;else{if(s=0|Ge[o>>2],!(3&a))return;if(t=s+e|0,(u=o+(0-s)|0)>>>0>>0)return;if((0|u)==(0|Ge[953])){if(3==(3&(l=0|Ge[(c=4+r|0)>>2])|0))return Ge[950]=t,Ge[c>>2]=-2&l,Ge[u+4>>2]=1|t,void(Ge[u+t>>2]=t);d=t,E=f=u;break}if(l=s>>>3,s>>>0<256){if(s=0|Ge[u+8>>2],(0|(c=0|Ge[u+12>>2]))==(0|s)){Ge[948]=Ge[948]&~(1<>2]=c,Ge[c+8>>2]=s,d=t,E=f=u;break}s=0|Ge[u+24>>2],c=0|Ge[u+12>>2];do{if((0|c)==(0|u)){if(_=0|Ge[(S=(l=u+16|0)+4|0)>>2])h=_,p=S;else{if(!(n=0|Ge[l>>2])){m=0;break}h=n,p=l}for(;;)if(0|(_=0|Ge[(S=h+20|0)>>2]))h=_,p=S;else{if(!(_=0|Ge[(S=h+16|0)>>2]))break;h=_,p=S}Ge[p>>2]=0,m=h}else S=0|Ge[u+8>>2],Ge[S+12>>2]=c,Ge[c+8>>2]=S,m=c}while(0);if(s){if(c=0|Ge[u+28>>2],(0|u)==(0|Ge[(S=4096+(c<<2)|0)>>2])){if(!(Ge[S>>2]=m)){Ge[949]=Ge[949]&~(1<>2])!=(0|u)&1)<<2)>>2]=m)){d=t,E=f=u;break}Ge[m+24>>2]=s,0|(S=0|Ge[(c=u+16|0)>>2])&&(Ge[m+16>>2]=S,Ge[S+24>>2]=m),E=f=(d=((S=0|Ge[c+4>>2])&&(Ge[m+20>>2]=S,Ge[S+24>>2]=m),t),u)}else d=t,E=f=u}}while(0);if(!(r>>>0<=E>>>0)&&1&(e=0|Ge[(o=4+r|0)>>2])){if(2&e)Ge[o>>2]=-2&e,Ge[f+4>>2]=1|d,y=Ge[E+d>>2]=d;else{if(m=0|Ge[953],(0|r)==(0|Ge[954]))return h=(0|Ge[951])+d|0,Ge[951]=h,Ge[954]=f,Ge[f+4>>2]=1|h,(0|f)!=(0|m)?void 0:(Ge[953]=0,void(Ge[950]=0));if((0|r)==(0|m))return m=(0|Ge[950])+d|0,Ge[950]=m,Ge[953]=E,Ge[f+4>>2]=1|m,void(Ge[E+m>>2]=m);m=(-8&e)+d|0,h=e>>>3;do{if(e>>>0<256){if(p=0|Ge[8+r>>2],(0|(i=0|Ge[12+r>>2]))==(0|p)){Ge[948]=Ge[948]&~(1<>2]=i,Ge[i+8>>2]=p;break}p=0|Ge[24+r>>2],i=0|Ge[12+r>>2];do{if((0|i)==(0|r)){if(c=0|Ge[(S=(a=16+r|0)+4|0)>>2])M=c,b=S;else{if(!(_=0|Ge[a>>2])){F=0;break}M=_,b=a}for(;;)if(0|(c=0|Ge[(S=M+20|0)>>2]))M=c,b=S;else{if(!(c=0|Ge[(S=M+16|0)>>2]))break;M=c,b=S}Ge[b>>2]=0,F=M}else S=0|Ge[8+r>>2],Ge[S+12>>2]=i,Ge[i+8>>2]=S,F=i}while(0);if(0|p){if(i=0|Ge[28+r>>2],(0|r)==(0|Ge[(u=4096+(i<<2)|0)>>2])){if(!(Ge[u>>2]=F)){Ge[949]=Ge[949]&~(1<>2])!=(0|r)&1)<<2)>>2]=F))break;Ge[F+24>>2]=p,0|(u=0|Ge[(i=16+r|0)>>2])&&(Ge[F+16>>2]=u,Ge[u+24>>2]=F),0|(u=0|Ge[i+4>>2])&&(Ge[F+20>>2]=u,Ge[u+24>>2]=F)}}while(0);if(Ge[f+4>>2]=1|m,Ge[E+m>>2]=m,(0|f)==(0|Ge[953]))return void(Ge[950]=m);y=m}if(d=y>>>3,y>>>0<256)return E=3832+(d<<1<<2)|0,w=(e=0|Ge[948])&(o=1<>2],o):(Ge[948]=e|o,(O=E)+8|0),Ge[w>>2]=f,Ge[O+12>>2]=f,Ge[f+8>>2]=O,void(Ge[f+12>>2]=E);e=4096+((R=(E=y>>>8)?16777215>>0?31:y>>>((e=14-((E=((w=E<<(O=(E+1048320|0)>>>16&8))+520192|0)>>>16&4)|O|(w=((o=w<>>16&2))+(o<>>15)|0)+7|0)&1|e<<1:0)<<2)|0,Ge[f+28>>2]=R,Ge[f+20>>2]=0,w=(Ge[f+16>>2]=0)|Ge[949],o=1<>>1)|0),E=0|Ge[e>>2];;){if((-8&Ge[E+4>>2]|0)==(0|y)){A=73;break}if(!(d=0|Ge[(k=E+16+(O>>>31<<2)|0)>>2])){A=72;break}O<<=1,E=d}if(72==(0|A)){Ge[k>>2]=f,Ge[f+24>>2]=E,Ge[f+12>>2]=f,Ge[f+8>>2]=f;break}if(73==(0|A)){p=0|Ge[(O=E+8|0)>>2],Ge[p+12>>2]=f,Ge[O>>2]=f,Ge[f+8>>2]=p,Ge[f+12>>2]=E,Ge[f+24>>2]=0;break}}else Ge[949]=w|o,Ge[e>>2]=f,Ge[f+24>>2]=e,Ge[f+12>>2]=f,Ge[f+8>>2]=f}while(0);if(f=(0|Ge[956])-1|0,!(Ge[956]=f)){for(T=4248;f=0|Ge[T>>2];)T=f+8|0;Ge[956]=-1}}}}function H(e,r,t){e|=0,r|=0,t|=0;var n,o,i,a,s,u,c,l,f,d,E=0,S=0,_=0,m=0,h=0,p=0,F=0,M=Ze;(0|Je)<=(0|(Ze=Ze+48|0))&&Qe(48),n=M+16|0,o=(E=M)+32|0,a=0|Ge[(i=e+28|0)>>2],Ge[o>>2]=a,u=(0|Ge[(s=e+20|0)>>2])-a|0,Ge[4+o>>2]=u,Ge[8+o>>2]=r,r=u+(Ge[12+o>>2]=t)|0,u=e+60|0,Ge[E>>2]=Ge[u>>2],Ge[E+4>>2]=o,Ge[E+8>>2]=2,a=0|U(0|R(146,0|E));e:do{if((0|r)!=(0|a)){for(E=2,S=r,_=o,m=a;!((0|m)<0);){if(S=S-m|0,f=((c=(h=0|Ge[_+4>>2])>>>0>>0)<<31>>31)+E|0,d=m-(c?h:0)|0,Ge[(l=c?_+8|0:_)>>2]=(0|Ge[l>>2])+d,Ge[(h=l+4|0)>>2]=(0|Ge[h>>2])-d,Ge[n>>2]=Ge[u>>2],Ge[4+n>>2]=l,Ge[8+n>>2]=f,(0|S)==(0|(m=0|U(0|R(146,0|n))))){p=3;break e}E=f,_=l}Ge[e+16>>2]=0,Ge[i>>2]=0,Ge[s>>2]=0,Ge[e>>2]=32|Ge[e>>2],F=2==(0|E)?0:t-(0|Ge[_+4>>2])|0}else p=3}while(0);return 3==(0|p)&&(p=0|Ge[e+44>>2],Ge[e+16>>2]=p+(0|Ge[e+48>>2]),Ge[i>>2]=p,Ge[s>>2]=p,F=t),Ze=M,0|F}function U(e){return 0|(4294963200<(e|=0)>>>0?(Ge[163]=0-e,-1):e)}function Y(){return 652}function z(e,r,t,n,o){e|=0,r|=0,t|=0,n|=0,o|=0;var i,a,s,u,c,l,f,d,E,S,_=0,m=0,h=0,p=0,F=0,M=0,b=0,y=0,O=0,w=0,R=0,A=0,k=0,T=0,g=0,v=0,N=0,D=0,P=0,C=0,I=0,L=0,x=0,B=0,H=0,U=0,Y=0,z=0,V=0,K=0,W=0,X=0,j=0,G=0,q=0,Z=0,J=0,Q=0,$=0,ee=0,re=0,te=0,ne=0,oe=0,ie=0,ae=0,se=0,ue=0,ce=0,le=0,fe=0,de=0,Ee=0,Se=0,_e=0,me=0,he=0,pe=0,Fe=0,Me=0,be=0,ye=0,Oe=0,we=0,Re=0,Ae=0,ke=Ze;(0|Je)<=(0|(Ze=Ze+64|0))&&Qe(64),c=(a=ke)+20|0,l=0!=(0|e),d=f=40+(s=ke+24|0)|0,E=39+s|0,s=4+(u=ke+8|0)|0,h=m=_=0,p=Ge[(i=ke+16|0)>>2]=r;e:for(;;){do{if(-1<(0|m)){if((2147483647-m|0)<(0|_)){Ge[(r=652)>>2]=75,F=-1;break}F=_+m|0;break}}while(F=m,0);if(!((r=0|Xe[p>>0])<<24>>24)){M=87;break}b=r,y=p;r:for(;;){switch(b<<24>>24){case 37:w=O=y,M=9;break r;case 0:A=R=y;break r}r=y+1|0,Ge[i>>2]=r,b=0|Xe[r>>0],y=r}r:do{if(9==(0|M))for(;;){if(37!=((M=0)|Xe[w+1>>0])){R=O,A=w;break r}if(r=O+1|0,k=w+2|0,Ge[i>>2]=k,37!=(0|Xe[k>>0])){R=r,A=k;break}O=r,w=k,M=9}}while(0);if(k=R-p|0,l&&De(e,p,k),0|k)_=k,m=F,p=A;else{N=(r=(0|Xe[(k=A+1|0)>>0])-48|0)>>>0<10?(g=(T=36==(0|Xe[A+2>>0]))?r:-1,v=T?1:h,T?A+3|0:k):(g=-1,v=h,k),Ge[i>>2]=N,T=((k=0|Xe[N>>0])<<24>>24)-32|0;r:do{if(T>>>0<32)for(r=0,D=k,P=T,C=N;;){if(!(75913&(I=1<>2]=I,32<=(P=((U=0|Xe[I>>0])<<24>>24)-32|0)>>>0){L=H,x=U,B=I;break}r=H,D=U,C=I}else L=0,x=k,B=N}while(0);if(x<<24>>24==42){if((T=(0|Xe[(k=B+1|0)>>0])-48|0)>>>0<10&&36==(0|Xe[B+2>>0]))Ge[o+(T<<2)>>2]=10,Y=0|Ge[n+((0|Xe[k>>0])-48<<3)>>2],z=1,V=B+3|0;else{if(0|v){K=-1;break}V=(z=l?(T=3+(0|Ge[t>>2])&-4,C=0|Ge[T>>2],Ge[t>>2]=T+4,Y=C,0):Y=0,k)}W=(k=(0|Y)<0)?0-Y|0:Y,X=k?8192|L:L,j=z,G=Ge[i>>2]=V}else{if((0|(k=0|Pe(i)))<0){K=-1;break}W=k,X=L,j=v,G=0|Ge[i>>2]}do{if(46==(0|Xe[G>>0])){if(42!=(0|Xe[G+1>>0])){Ge[i>>2]=G+1,q=k=0|Pe(i),Z=0|Ge[i>>2];break}if((C=(0|Xe[(k=G+2|0)>>0])-48|0)>>>0<10&&36==(0|Xe[G+3>>0])){Ge[o+(C<<2)>>2]=10,T=G+4|0,q=C=0|Ge[n+((0|Xe[k>>0])-48<<3)>>2],Z=Ge[i>>2]=T;break}if(0|j){K=-1;break e}q=l?(T=3+(0|Ge[t>>2])&-4,C=0|Ge[T>>2],Ge[t>>2]=T+4,C):0,Z=Ge[i>>2]=k}else q=-1,Z=G}while(0);for(k=0,C=Z;;){if(57<((0|Xe[C>>0])-65|0)>>>0){K=-1;break e}if(J=C+1|0,Ge[i>>2]=J,!((($=255&(Q=0|Xe[(0|Xe[C>>0])-65+(1362+(58*k|0))>>0]))+-1|0)>>>0<8))break;k=$,C=J}if(!(Q<<24>>24)){K=-1;break}T=-1<(0|g);do{if(Q<<24>>24==19){if(T){K=-1;break e}M=49}else{if(T){Ge[o+(g<<2)>>2]=$,r=0|Ge[(D=n+(g<<3)|0)+4>>2],Ge[(P=a)>>2]=Ge[D>>2],Ge[P+4>>2]=r,M=49;break}if(!l){K=0;break e}Ce(a,$,t)}}while(0);if(49!=(0|M)||(M=0,l)){r=0!=(0|k)&3==(15&(T=0|Xe[C>>0])|0)?-33&T:T,T=-65537&X,P=0==(8192&X|0)?X:T;r:do{switch(0|r){case 110:switch((255&k)<<24>>24){case 0:case 1:_=0,m=Ge[Ge[a>>2]>>2]=F,h=j,p=J;continue e;case 2:D=0|Ge[a>>2],Ge[D>>2]=F,Ge[D+4>>2]=((0|F)<0)<<31>>31,_=0,m=F,h=j,p=J;continue e;case 3:_=0,m=je[Ge[a>>2]>>1]=F,h=j,p=J;continue e;case 4:_=0,m=Xe[Ge[a>>2]>>0]=F,h=j,p=J;continue e;case 6:_=0,m=Ge[Ge[a>>2]>>2]=F,h=j,p=J;continue e;case 7:D=0|Ge[a>>2],Ge[D>>2]=F,Ge[D+4>>2]=((0|F)<0)<<31>>31,_=0,m=F,h=j,p=J;continue e;default:_=0,m=F,h=j,p=J;continue e}break;case 112:ee=120,re=8>>0?q:8,te=8|P,M=61;break;case 88:case 120:ee=r,re=q,te=P,M=61;break;case 111:ne=D=0|function(e,r,t){t|=0;var n=0,o=0;if(0==(0|(e|=0))&0==(0|(r|=0)))n=t;else for(o=t,t=r,r=e;;){if(Xe[(e=o+-1|0)>>0]=7&r|48,0==(0|(r=0|Ve(0|r,0|t,3)))&0==(0|(t=ve))){n=e;break}o=e}return 0|n}(I=0|Ge[(D=a)>>2],U=0|Ge[D+4>>2],f),ie=1826,ae=(oe=0)==(8&P|0)|(0|(H=d-D|0))<(0|q)?q:H+1|0,se=P,ue=I,ce=U,M=67;break;case 105:case 100:if(I=0|Ge[(U=a)>>2],(0|(H=0|Ge[U+4>>2]))<0){U=0|Ye(0,0,0|I,0|H),D=ve,le=1,fe=1826,de=Ge[(S=a)>>2]=U,Ee=Ge[S+4>>2]=D,M=66;break r}le=0!=(2049&P|0)&1,fe=0==(2048&P|0)?0==(1&P|0)?1826:1828:1827,de=I,Ee=H,M=66;break r;case 117:fe=1826,de=(le=0)|Ge[(H=a)>>2],Ee=0|Ge[H+4>>2],M=66;break;case 99:Xe[E>>0]=Ge[a>>2],Se=E,_e=0,me=1826,he=f,pe=1,Fe=T;break;case 109:Me=0|(0|function(e,r){e|=0,r|=0;var t=0,n=0,o=0,i=0,a=0,s=0;t=0;for(;;){if((0|qe[1896+t>>0])==(0|e)){n=2;break}if(87==(0|(o=t+1|0))){i=1984,a=87,n=5;break}t=o}2==(0|n)&&(t?(i=1984,a=t,n=5):s=1984);if(5==(0|n))for(;;){for(n=0,t=i;t=(e=t)+1|0,0!=(0|Xe[e>>0]););if(!(a=a+-1|0)){s=t;break}i=t,n=5}return 0|function(e,r){return 0|function(e,r){e|=0;var t=0;t=(r|=0)?0|function(e,r,t){r|=0,t|=0;var n=0,o=0,i=0,a=0,s=0,u=0,c=0,l=0,f=0,d=0,E=0,S=0,_=0,m=0,h=0;n=1794895138+(0|Ge[(e|=0)>>2])|0,o=0|Ue(0|Ge[e+8>>2],n),i=0|Ue(0|Ge[e+12>>2],n),a=0|Ue(0|Ge[e+16>>2],n);t:do{if(o>>>0>>2>>>0&&(s=r-(o<<2)|0,i>>>0>>0&a>>>0>>0)&&0==(3&(a|i)|0)){for(s=i>>>2,u=a>>>2,c=0,l=o;;){if(_=0|Ue(0|Ge[e+((S=(E=(d=c+(f=l>>>1)|0)<<1)+s|0)<<2)>>2],n),!((m=0|Ue(0|Ge[e+(1+S<<2)>>2],n))>>>0>>0&_>>>0<(r-m|0)>>>0)){h=0;break t}if(0|Xe[e+(m+_)>>0]){h=0;break t}if(!(_=0|function(e,r){r|=0;var t=0,n=0,o=0,i=0,t=0|Xe[(e|=0)>>0],n=0|Xe[r>>0];if(t<<24>>24==0||t<<24>>24!=n<<24>>24)o=n,i=t;else{for(t=r,r=e;t=t+1|0,e=0|Xe[(r=r+1|0)>>0],n=0|Xe[t>>0],e<<24>>24!=0&&e<<24>>24==n<<24>>24;);o=n,i=e}return(255&i)-(255&o)|0}(t,e+m|0)))break;if(m=(0|_)<0,1==(0|l)){h=0;break t}c=m?c:d,l=m?f:l-f|0}c=0|Ue(0|Ge[e+((l=E+u|0)<<2)>>2],n),s=0|Ue(0|Ge[e+(l+1<<2)>>2],n),h=s>>>0>>0&c>>>0<(r-s|0)>>>0&&0==(0|Xe[e+(s+c)>>0])?e+s|0:0}else h=0}while(0);return 0|h}(0|Ge[r>>2],0|Ge[r+4>>2],e):0;return 0|(0|t?t:e)}(e|=0,r|=0)}(s,0|Ge[r+20>>2])}(0|Ge[(H=652)>>2]|0,0|Ge[194])),M=71;break;case 115:Me=0|(H=0|Ge[a>>2])?H:1836,M=71;break;case 67:Ge[u>>2]=Ge[a>>2],Ge[s>>2]=0,be=-1,ye=Ge[a>>2]=u,M=75;break;case 83:H=0|Ge[a>>2],M=q?(be=q,ye=H,75):(xe(e,32,W,0,P),Oe=0,84);break;case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:_=0|function(e,r,t,n,o,i){e|=0,r=+r,t|=0,n|=0,o|=0,i|=0;var a=0,s=0,u=0,c=0,l=0,f=0,d=0,E=0,S=0,_=0,m=0,h=0,p=0,F=0,M=0,b=0,y=0,O=0,w=0,R=0,A=0,k=0,T=0,g=0,v=0,N=0,D=0,P=0,C=0,I=0,L=0,x=0,B=0,H=0,U=0,Y=0,z=0,V=0,K=0,W=0,X=0,j=0,G=0,q=0,Z=0,J=0,Q=0,$=0,ee=0,re=0,te=0,ne=0,oe=0,ie=0,ae=0,se=0,ue=0,ce=0,le=0,fe=0,de=0,Ee=0,Se=0,_e=0,me=0,he=0,pe=0,Fe=0,Me=0,be=0,ye=0,Oe=0,we=0;(0|(Ze=(a=Ze)+560|0))>=(0|Je)&&Qe(560);s=a+8|0,l=c=(u=a)+524|0,f=a+512|0,Ge[u>>2]=0,d=12+f|0,He(r),_=(0|ve)<0?(E=-r,S=1,1843):(E=r,S=0!=(2049&o|0)&1,0==(2048&o|0)?0==(1&o|0)?1844:1849:1846);He(E),m=2146435072&ve;do{if(m>>>0<2146435072|2146435072==(0|m)&!1){if(r=2*+function(e,r){return+ +function e(r,t){r=+r;t|=0;var n=0,o=0,i=0,a=0,s=0,u=0,c=0;Te[ge>>3]=r;n=0|Ge[ge>>2];o=0|Ge[ge+4>>2];i=0|Ve(0|n,0|o,52);switch(2047&i){case 0:u=0!=r?(a=+e(0x10000000000000000*r,t),s=a,(0|Ge[t>>2])-64|0):(s=r,0),Ge[t>>2]=u,c=s;break;case 2047:c=r;break;default:Ge[t>>2]=(2047&i)-1022,Ge[ge>>2]=n,Ge[ge+4>>2]=-2146435073&o|1071644672,c=+Te[ge>>3]}return+c}(e=+e,r|=0)}(E,u),(h=0!=r)&&(Ge[u>>2]=(0|Ge[u>>2])-1),97==(0|(p=32|i))){M=0==(0|(F=32&i))?_:_+9|0,b=2|S,y=12-n|0;do{if(!(11>>0|0==(0|y))){for(O=8,w=y;w=w+-1|0,O*=16,0!=(0|w););if(45==(0|Xe[M>>0])){R=-(O+(-r-O));break}R=r+O-O;break}}while(R=r,0);for(y=0|Ge[u>>2],A=0|Ie(w=(0|y)<0?0-y|0:y,((0|w)<0)<<31>>31,d),k=(0|A)==(0|d)?(Xe[(w=11+f|0)>>0]=48,w):A,Xe[k+-1>>0]=43+(y>>31&2),Xe[(y=k+-2|0)>>0]=i+15,A=(0|n)<1,w=0==(8&o|0),T=c,g=R;v=~~g,N=T+1|0,Xe[T>>0]=qe[1878+v>>0]|F,g=16*(g-(0|v)),D=1!=(N-l|0)||w&A&0==g?N:(Xe[N>>0]=46,T+2|0),0!=g;)T=D;xe(e,32,t,F=(A=d-y|0)+b+(w=0!=(0|n)&((T=D-l|0)+-2|0)<(0|n)?n+2|0:T)|0,o),De(e,M,b),xe(e,48,t,F,65536^o),De(e,c,T),xe(e,48,w-T|0,0,0),De(e,y,A),xe(e,32,t,F,8192^o),P=F;break}for(F=(0|n)<0?6:n,I=h?(A=(0|Ge[u>>2])-28|0,Ge[u>>2]=A,C=268435456*r,A):(C=r,0|Ge[u>>2]),A=(0|I)<0?s:288+s|0,T=A,g=C;w=~~g>>>0,Ge[T>>2]=w,T=T+4|0,g=1e9*(g-(w>>>0)),0!=g;);if(0<(0|I))for(h=A,y=T,b=I;;){if(M=(0|b)<29?b:29,h>>>0<=(w=y+-4|0)>>>0){for(N=w,w=0;v=0|Ke(0|Ge[N>>2],0,0|M),L=0|ze(0|v,0|ve,0|w,0),x=0|rr(0|L,0|(v=ve),1e9,0),Ge[N>>2]=x,w=0|We(0|L,0|v,1e9,0),N=N+-4|0,h>>>0<=N>>>0;);B=w?(Ge[(N=h+-4|0)>>2]=w,N):h}else B=h;for(N=y;!(N>>>0<=B>>>0||0|Ge[(v=N+-4|0)>>2]);)N=v;if(w=(0|Ge[u>>2])-M|0,!(0<(0|(Ge[u>>2]=w)))){H=B,U=N,Y=w;break}h=B,y=N,b=w}else H=A,U=T,Y=I;if((0|Y)<0)for(b=1+((F+25|0)/9|0)|0,y=102==(0|p),h=H,w=U,v=Y;;){if(x=(0|(L=0-v|0))<9?L:9,h>>>0>>0){for(L=(1<>>x,V=0,K=h;W=0|Ge[K>>2],Ge[K>>2]=(W>>>x)+V,V=0|Ne(W&L,z),K=K+4|0,K>>>0>>0;);K=0==(0|Ge[h>>2])?h+4|0:h,j=V?(Ge[w>>2]=V,X=K,w+4|0):(X=K,w)}else X=0==(0|Ge[h>>2])?h+4|0:h,j=w;if(z=(0|b)<(j-(K=y?A:X)>>2|0)?K+(b<<2)|0:j,v=(0|Ge[u>>2])+x|0,0<=(0|(Ge[u>>2]=v))){G=X,q=z;break}h=X,w=z}else G=H,q=U;if(w=A,G>>>0>>0)if(h=9*(w-G>>2)|0,(v=0|Ge[G>>2])>>>0<10)Z=h;else for(b=h,h=10;;){if(y=b+1|0,v>>>0<(h=10*h|0)>>>0){Z=y;break}b=y}else Z=0;if((0|(v=F-(102!=(0|p)?Z:0)+(((h=0!=(0|F))&(b=103==(0|p)))<<31>>31)|0))<((9*(q-w>>2)|0)-9|0)){if(v=A+4+(((0|(y=v+9216|0))/9|0)-1024<<2)|0,(0|(T=1+((0|y)%9|0)|0))<9)for(y=T,T=10;;){if(z=10*T|0,9==(0|(y=y+1|0))){J=z;break}T=z}else J=10;if(T=0|Ge[v>>2],(p=(v+4|0)==(0|q))&0==(0|(y=(T>>>0)%(J>>>0)|0)))ne=v,oe=Z,ie=G;else if(O=0==(1&((T>>>0)/(J>>>0)|0)|0)?9007199254740992:9007199254740994,g=y>>>0<(z=(0|J)/2|0)>>>0?.5:p&(0|y)==(0|z)?1:1.5,$=S?(z=45==(0|Xe[_>>0]),Q=z?-g:g,z?-O:O):(Q=g,O),z=T-y|0,Ge[v>>2]=z,$+Q!=$){if(y=z+J|0,999999999<(Ge[v>>2]=y)>>>0)for(y=G,z=v;;){if(T=z+-4|0,Ge[z>>2]=0,ee=T>>>0>>0?(Ge[(p=y+-4|0)>>2]=0,p):y,p=1+(0|Ge[T>>2])|0,!(999999999<(Ge[T>>2]=p)>>>0)){re=ee,te=T;break}y=ee,z=T}else re=G,te=v;if(z=9*(w-re>>2)|0,(y=0|Ge[re>>2])>>>0<10)ne=te,oe=z,ie=re;else for(T=z,z=10;;){if(p=T+1|0,y>>>0<(z=10*z|0)>>>0){ne=te,oe=p,ie=re;break}T=p}}else ne=v,oe=Z,ie=G;ae=oe,se=(T=ne+4|0)>>>0>>0?T:q,ue=ie}else ae=Z,se=q,ue=G;for(T=se;;){if(T>>>0<=ue>>>0){ce=0;break}if(0|Ge[(z=T+-4|0)>>2]){ce=1;break}T=z}v=0-ae|0;do{if(b){if(fe=(0|ae)<(0|(z=(1&(1^h))+F|0))&-5<(0|ae)?(le=i+-1|0,z+-1-ae|0):(le=i+-2|0,z+-1|0),!(z=8&o)){if(ce&&0!=(0|(y=0|Ge[T+-4>>2])))if((y>>>0)%10|0)de=0;else for(p=0,K=10;;){if(L=p+1|0,(y>>>0)%((K=10*K|0)>>>0)|0){de=L;break}p=L}else de=9;if(p=(9*(T-w>>2)|0)-9|0,102==(32|le)){Ee=le,Se=(0|fe)<(0|(y=0<(0|(K=p-de|0))?K:0))?fe:y,_e=0;break}Ee=le,Se=(0|fe)<(0|(p=0<(0|(y=p+ae-de|0))?y:0))?fe:p,_e=0;break}Ee=le,Se=fe,_e=z}else Ee=i,Se=F,_e=8&o}while(0);if(w=0!=(0|(F=Se|_e))&1,h=102==(32|Ee))he=(me=0)<(0|ae)?ae:0;else{if(p=0|Ie(b=(0|ae)<0?v:ae,((0|b)<0)<<31>>31,d),((b=d)-p|0)<2)for(y=p;;){if(Xe[(K=y+-1|0)>>0]=48,!((b-K|0)<2)){pe=K;break}y=K}else pe=p;Xe[pe+-1>>0]=43+(ae>>31&2),Xe[(y=pe+-2|0)>>0]=Ee,he=b-(me=y)|0}if(xe(e,32,t,y=S+1+Se+w+he|0,o),De(e,_,S),xe(e,48,t,y,65536^o),h){x=K=9+c|0,V=8+c|0,L=v=A>>>0>>0?A:ue;do{if(N=0|Ie(0|Ge[L>>2],0,K),(0|L)==(0|v))Fe=(0|N)==(0|K)?(Xe[V>>0]=48,V):N;else if(c>>>0>>0)for(er(0|c,48,N-l|0),M=N;;){if(!(c>>>0<(W=M+-1|0)>>>0)){Fe=W;break}M=W}else Fe=N}while(De(e,Fe,x-Fe|0),(L=L+4|0)>>>0<=A>>>0);if(0|F&&De(e,1894,1),L>>>0>>0&0<(0|Se))for(A=Se,x=L;;){if(V=0|Ie(0|Ge[x>>2],0,K),c>>>0>>0)for(er(0|c,48,V-l|0),v=V;;){if(!(c>>>0<(h=v+-1|0)>>>0)){Me=h;break}v=h}else Me=V;if(De(e,Me,(0|A)<9?A:9),v=A+-9|0,!((x=x+4|0)>>>0>>0&9<(0|A))){be=v;break}A=v}else be=Se;xe(e,48,be+9|0,9,0)}else{if(A=ce?T:ue+4|0,-1<(0|Se))for(K=0==(0|_e),L=x=9+c|0,F=0-l|0,v=8+c|0,N=Se,h=ue;;){w=0|Ie(0|Ge[h>>2],0,x),ye=(0|w)==(0|x)?(Xe[v>>0]=48,v):w;do{if((0|h)==(0|ue)){if(w=ye+1|0,De(e,ye,1),K&(0|N)<1){Oe=w;break}De(e,1894,1),Oe=w}else{if(ye>>>0<=c>>>0){Oe=ye;break}for(er(0|c,48,ye+F|0),w=ye;;){if(!(c>>>0<(b=w+-1|0)>>>0)){Oe=b;break}w=b}}}while(0);if(De(e,Oe,(0|(V=L-Oe|0))<(0|N)?V:N),!((h=h+4|0)>>>0>>0&-1<(0|(w=N-V|0)))){we=w;break}N=w}else we=Se;xe(e,48,we+18|0,18,0),De(e,me,d-me|0)}xe(e,32,t,y,8192^o),P=y}else N=0!=(32&i|0),xe(e,32,t,A=S+3|0,-65537&o),De(e,_,S),De(e,E!=E|!1?N?1870:1874:N?1862:1866,3),xe(e,32,t,A,8192^o),P=A}while(0);return Ze=a,0|((0|P)<(0|t)?t:P)}(e,+Te[a>>3],W,q,P,r),m=F,h=j,p=J;continue e;default:Se=p,_e=0,me=1826,he=f,pe=q,Fe=P}}while(0);r:do{if(61==(0|M))ne=r=(M=0)|function(e,r,t,n){t|=0,n|=0;var o=0,i=0;if(0==(0|(e|=0))&0==(0|(r|=0)))o=t;else for(i=t,t=r,r=e;;){if(Xe[(e=i+-1|0)>>0]=0|qe[1878+(15&r)>>0]|n,0==(0|(r=0|Ve(0|r,0|t,4)))&0==(0|(t=ve))){o=e;break}i=e}return 0|o}(k=0|Ge[(r=a)>>2],C=0|Ge[r+4>>2],f,32&ee),oe=(H=0==(8&te|0)|0==(0|k)&0==(0|C))?0:2,ie=H?1826:1826+(ee>>4)|0,ae=re,se=te,ue=k,ce=C,M=67;else if(66==(0|M))ne=(M=0)|Ie(de,Ee,f),oe=le,ie=fe,ae=q,se=P,ue=de,ce=Ee,M=67;else if(71==(0|M))me=1826,he=(k=(_e=M=0)==(0|(C=0|Le(Se=Me,0,q))))?Me+q|0:C,pe=k?q:C-Me|0,Fe=T;else if(75==(0|M)){for(C=ye,H=k=M=0;;){if(!(r=0|Ge[C>>2])){we=k,Re=H;break}if((0|(I=0|Be(c,r)))<0|(be-k|0)>>>0>>0){we=k,Re=I;break}if(!((r=I+k|0)>>>0>>0)){we=r,Re=I;break}C=C+4|0,k=r,H=I}if((0|Re)<0){K=-1;break e}if(xe(e,32,W,we,P),we)for(H=ye,k=0;;){if(!(C=0|Ge[H>>2])){Oe=we,M=84;break r}if((0|we)<(0|(k=(I=0|Be(c,C))+k|0))){Oe=we,M=84;break r}if(De(e,c,I),we>>>0<=k>>>0){Oe=we,M=84;break}H=H+4|0}else Oe=0,M=84}}while(0);if(67==(0|M))k=d-ne+(1&(1^(T=(M=0)!=(0|ue)|0!=(0|ce))))|0,Se=(H=0!=(0|ae)|T)?ne:f,_e=oe,me=ie,he=f,pe=!H||(0|k)<(0|ae)?ae:k,Fe=-1<(0|ae)?-65537&se:se;else if(84==(0|M)){M=0,xe(e,32,W,Oe,8192^P),_=(0|Oe)<(0|W)?W:Oe,m=F,h=j,p=J;continue}xe(e,32,I=(0|W)<(0|(T=(H=(0|pe)<(0|(k=he-Se|0))?k:pe)+_e|0))?T:W,T,Fe),De(e,me,_e),xe(e,48,I,T,65536^Fe),xe(e,48,H,k,0),De(e,Se,k),xe(e,32,I,T,8192^Fe),_=I,m=F,h=j,p=J}else _=0,m=F,h=j,p=J}}e:do{if(87==(0|M))if(e)K=F;else if(h){for(J=1;;){if(!(p=0|Ge[o+(J<<2)>>2])){Ae=J;break}if(Ce(n+(J<<3)|0,p,t),10<=(0|(J=J+1|0))){K=1;break e}}for(;;){if(0|Ge[o+(Ae<<2)>>2]){K=-1;break e}if(10<=(0|(Ae=Ae+1|0))){K=1;break}}}else K=0}while(0);return Ze=ke,0|K}function V(){return 0}function K(){0}function De(e,r,t){r|=0,t|=0,32&Ge[(e|=0)>>2]||W(r,t,e)}function Pe(e){var r=0,t=0,n=0,o=0,i=0,r=0|Ge[(e|=0)>>2];if((t=(0|Xe[r>>0])-48|0)>>>0<10)for(n=0,o=r,r=t;;){if(t=r+(10*n|0)|0,o=o+1|0,Ge[e>>2]=o,10<=(r=(0|Xe[o>>0])-48|0)>>>0){i=t;break}n=t}else i=0;return 0|i}function Ce(e,r,t){e|=0,r|=0,t|=0;var n,o=0,i=0,a=0,s=0;e:do{if(r>>>0<=20){switch(0|r){case 9:o=3+(0|Ge[t>>2])&-4,i=0|Ge[o>>2],Ge[t>>2]=o+4,Ge[e>>2]=i;break e;case 10:i=3+(0|Ge[t>>2])&-4,o=0|Ge[i>>2],Ge[t>>2]=i+4,Ge[(i=e)>>2]=o,Ge[i+4>>2]=((0|o)<0)<<31>>31;break e;case 11:o=3+(0|Ge[t>>2])&-4,i=0|Ge[o>>2],Ge[t>>2]=o+4,Ge[(o=e)>>2]=i,Ge[o+4>>2]=0;break e;case 12:o=7+(0|Ge[t>>2])&-8,n=0|Ge[(i=o)>>2],a=0|Ge[i+4>>2],Ge[t>>2]=o+8,Ge[(o=e)>>2]=n,Ge[o+4>>2]=a;break e;case 13:a=3+(0|Ge[t>>2])&-4,o=0|Ge[a>>2],Ge[t>>2]=a+4,a=(65535&o)<<16>>16,Ge[(o=e)>>2]=a,Ge[o+4>>2]=((0|a)<0)<<31>>31;break e;case 14:a=3+(0|Ge[t>>2])&-4,o=0|Ge[a>>2],Ge[t>>2]=a+4,Ge[(a=e)>>2]=65535&o,Ge[a+4>>2]=0;break e;case 15:a=3+(0|Ge[t>>2])&-4,o=0|Ge[a>>2],Ge[t>>2]=a+4,a=(255&o)<<24>>24,Ge[(o=e)>>2]=a,Ge[o+4>>2]=((0|a)<0)<<31>>31;break e;case 16:a=3+(0|Ge[t>>2])&-4,o=0|Ge[a>>2],Ge[t>>2]=a+4,Ge[(a=e)>>2]=255&o,Ge[a+4>>2]=0;break e;case 17:case 18:a=7+(0|Ge[t>>2])&-8,s=+Te[a>>3],Ge[t>>2]=a+8,Te[e>>3]=s;break e;default:break e}}}while(0)}function Ie(e,r,t){t|=0;var n=0,o=0,i=0,a=0,s=0,u=0;if(0<(r|=0)>>>0|0==(0|r)&4294967295<(e|=0)>>>0){for(n=t,o=e,i=r;r=0|rr(0|o,0|i,10,0),Xe[(n=n+-1|0)>>0]=255&r|48,o=0|We(0|(r=o),0|i,10,0),9>>0|9==(0|i)&4294967295>>0;)i=ve;a=o,s=n}else a=e,s=t;if(a)for(t=a,a=s;;){if(Xe[(s=a+-1|0)>>0]=(t>>>0)%10|48,t>>>0<10){u=s;break}t=(t>>>0)/10|0,a=s}else u=s;return 0|u}function Le(e,r,t){e|=0;var n,o,i,a,s=0,u=0,c=0,l=0,f=0,d=0,E=0,S=0,_=0,m=0,h=0,p=0,F=0,M=0,b=0,y=255&(r|=0),s=0!=(0|(t|=0));e:do{if(s&0!=(3&e|0))for(n=255&r,u=e,c=t;;){if((0|Xe[u>>0])==n<<24>>24){l=u,f=c,d=6;break e}if(!((a=0!=(0|(i=c+-1|0)))&0!=(3&(o=u+1|0)|0))){E=o,S=i,_=a,d=5;break}u=o,c=i}else E=e,S=t,_=s,d=5}while(0);5==(0|d)&&(_?(l=E,f=S,d=6):(m=E,h=0));e:do{if(6==(0|d))if(E=255&r,(0|Xe[l>>0])==E<<24>>24)m=l,h=f;else{S=0|Ne(y,16843009);r:do{if(3>>0){for(_=l,s=f;!((-2139062144&(t=Ge[_>>2]^S)^-2139062144)&t+-16843009|0);){if(t=_+4|0,!(3<(e=s+-4|0)>>>0)){p=t,F=e,d=11;break r}_=t,s=e}M=_,b=s}else p=l,F=f,d=11}while(0);if(11==(0|d)){if(!F){m=p,h=0;break}M=p,b=F}for(;;){if((0|Xe[M>>0])==E<<24>>24){m=M,h=b;break e}if(S=M+1|0,!(b=b+-1|0)){m=S,h=0;break}M=S}}}while(0);return 0|(0|h?m:0)}function xe(e,r,t,n,o){e|=0,r|=0,t|=0,n|=0,o|=0;var i,a=0,s=Ze;if((0|Je)<=(0|(Ze=Ze+256|0))&&Qe(256),i=s,(0|n)<(0|t)&0==(73728&o|0)){if(er(0|i,0|r,0|((o=t-n|0)>>>0<256?o:256)),255>>0){for(r=t-n|0,n=o;De(e,i,256),n=n+-256|0,255>>0;);a=255&r}else a=o;De(e,i,a)}Ze=s}function Be(e,r){r|=0;return 0|((e|=0)?0|function(e,r){e|=0,r|=0,0;var t=0;do{if(e){if(r>>>0<128){Xe[e>>0]=r,t=1;break}if(!(0|Ge[Ge[776>>2]>>2])){if(57216==(-128&r|0)){Xe[e>>0]=r,t=1;break}Ge[652>>2]=84,t=-1;break}if(r>>>0<2048){Xe[e>>0]=r>>>6|192,Xe[e+1>>0]=63&r|128,t=2;break}if(r>>>0<55296|57344==(-8192&r|0)){Xe[e>>0]=r>>>12|224,Xe[e+1>>0]=r>>>6&63|128,Xe[e+2>>0]=63&r|128,t=3;break}if((r+-65536|0)>>>0<1048576){Xe[e>>0]=r>>>18|240,Xe[e+1>>0]=r>>>12&63|128,Xe[e+2>>0]=r>>>6&63|128,Xe[e+3>>0]=63&r|128,t=4;break}Ge[652>>2]=84,t=-1;break}}while(t=1,0);return 0|t}(e,r):0)}function He(e){e=+e;var r;return Te[ge>>3]=e,r=0|Ge[ge>>2],ve=0|Ge[ge+4>>2],0|r}function Ue(e,r){var t=0|ce(0|(e|=0));return 0|(0==(0|(r|=0))?e:t)}function W(e,r,t){e|=0,r|=0;var n,o=0,i=0,a=0,s=0,u=0,c=0,l=0,f=0,d=0,E=0;(i=0|Ge[(o=(t|=0)+16|0)>>2])?(a=i,s=5):0|X(t)?u=0:(a=0|Ge[o>>2],s=5);e:do{if(5==(0|s)){if((a-(n=o=0|Ge[(i=t+20|0)>>2])|0)>>>0>>0){u=0|de[7&Ge[t+36>>2]](t,e,r);break}r:do{if(-1<(0|Xe[t+75>>0])){for(o=r;;){if(!o){c=0,l=e,f=r,d=n;break r}if(10==(0|Xe[e+(E=o+-1|0)>>0]))break;o=E}if((E=0|de[7&Ge[t+36>>2]](t,e,o))>>>0>>0){u=E;break e}l=e+(c=o)|0,f=r-o|0,d=0|Ge[i>>2]}else c=0,l=e,f=r,d=n}while(0);tr(0|d,0|l,0|f),Ge[i>>2]=(0|Ge[i>>2])+f,u=c+f|0}}while(0);return 0|u}function X(e){var r=0,t=0|Xe[(r=(e|=0)+74|0)>>0];return Xe[r>>0]=255+t|t,0|(8&(t=0|Ge[e>>2])?(Ge[e>>2]=32|t,-1):(Ge[e+8>>2]=0,r=(Ge[e+4>>2]=0)|Ge[e+44>>2],Ge[e+28>>2]=r,Ge[e+20>>2]=r,Ge[e+16>>2]=r+(0|Ge[e+48>>2]),0))}function j(e){var r,t=0,n=0,o=0,i=0,a=0,s=0,u=0,c=0,t=e|=0;e:do{if(3&t)for(i=e,a=t;;){if(!(0|Xe[i>>0])){s=a;break e}if(!(3&(a=r=i+1|0))){n=r,o=4;break}i=r}else n=e,o=4}while(0);if(4==(0|o)){for(o=n;!((-2139062144&(u=0|Ge[o>>2])^-2139062144)&u+-16843009);)o=o+4|0;if((255&u)<<24>>24)for(u=o;;){if(!(0|Xe[(o=u+1|0)>>0])){c=o;break}u=o}else c=o;s=c}return s-t|0}function G(e,r){var t=0|function(e,r){e|=0;var t=0,n=0,o=0,i=0,a=0,s=0,u=0,c=0,l=0;t=255&(r|=0);e:do{if(t){if(3&e)for(i=255&r,a=e;;){if((s=0|Xe[a>>0])<<24>>24==0||s<<24>>24==i<<24>>24){n=a;break e}if(!(3&(s=a+1|0))){o=s;break}a=s}else o=e;a=0|Ne(t,16843009),i=0|Ge[o>>2];r:do{if((-2139062144&i^-2139062144)&i+-16843009)l=o;else for(s=o,u=i;;){if((-2139062144&(c=u^a)^-2139062144)&c-16843009|0){l=s;break r}if((-2139062144&(u=0|Ge[(c=s+4|0)>>2])^-2139062144)&u+-16843009|0){l=c;break}s=c}}while(0);for(a=255&r,i=l;;){if((s=0|Xe[i>>0])<<24>>24==0||s<<24>>24==a<<24>>24){n=i;break}i=i+1|0}}else n=e+(0|j(e))|0}while(0);return 0|n}(e|=0,r|=0);return 0|((0|Xe[t>>0])==(255&r)<<24>>24?t:0)}function q(e,r){r|=0;var t=0;return((0|function(e,r,t,n){e|=0,n|=0;var o=0,i=0,a=0,s=0,u=0;o=0|Ne(t|=0,r|=0),i=0==(0|r)?0:t,s=-1<(0|Ge[n+76>>2])?(t=!0,a=0|W(e,o,n),t||K(),a):0|W(e,o,n);u=(0|s)==(0|o)?i:(s>>>0)/(r>>>0)|0;return 0|u}(e|=0,1,t=0|j(e),r))!=(0|t))<<31>>31|0}function Z(e){var r,t;0|Ge[(e|=0)+68>>2]&&(t=e+112|0,0|(r=0|Ge[e+116>>2])&&(Ge[112+r>>2]=Ge[t>>2]),e=0|Ge[t>>2],Ge[(e?e+116|0:820)>>2]=r)}function J(e,r){e|=0,r|=0;var t,n,o=0,i=0,a=0,s=0,u=0,c=0,l=Ze;(0|Je)<=(0|(Ze=Ze+16|0))&&Qe(16),n=255&r,Xe[(t=l)>>0]=n,(i=0|Ge[(o=e+16|0)>>2])?(a=i,s=4):0|X(e)?u=-1:(a=0|Ge[o>>2],s=4);do{if(4==(0|s)){if((o=0|Ge[(i=e+20|0)>>2])>>>0>>0&&(0|(c=255&r))!=(0|Xe[e+75>>0])){Ge[i>>2]=o+1,Xe[o>>0]=n,u=c;break}u=1==(0|de[7&Ge[e+36>>2]](e,t,1))?0|qe[t>>0]:-1}}while(0);return Ze=l,0|u}function Q(){return b(4352),4360}function $(){g(4352)}function ee(e){var r,t,n,o=0,i=0,a=0,o=(Ge[(e|=0)+76>>2],0);return Z(e),(r=0!=(1&Ge[e>>2]|0))||(i=0|Q(),n=e+56|0,0|(t=0|Ge[e+52>>2])&&(Ge[56+t>>2]=Ge[n>>2]),0|(a=0|Ge[n>>2])&&(Ge[a+52>>2]=t),(0|Ge[i>>2])==(0|e)&&(Ge[i>>2]=a),$()),a=0|re(e),i=0|fe[1&Ge[e+12>>2]](e)|a,0|(a=0|Ge[e+92>>2])&&B(a),r?0|o&&K():B(e),0|i}function re(e){e|=0;var r=0,t=0,n=0,o=0,i=0,a=0,s=0;do{if(e){if((0|Ge[e+76>>2])<=-1){r=0|te(e);break}r=((t=!0)||K(),n=0|te(e))}else{if(o=0|Ge[240]?0|re(0|Ge[240]):0,n=0|Q(),t=0|Ge[n>>2])for(n=t,t=o;;){if(a=(Ge[n+76>>2],0),s=(0|Ge[n+20>>2])>>>0>(0|Ge[n+28>>2])>>>0?0|te(n)|t:t,0|a&&K(),!(n=0|Ge[n+56>>2])){i=s;break}t=s}else i=o;$(),r=i}}while(0);return 0|r}function te(e){var r,t,n,o,i=0,a=(e|=0)+28|0;return 0|((0|Ge[(i=e+20|0)>>2])>>>0>(0|Ge[a>>2])>>>0&&(de[7&Ge[e+36>>2]](e,0,0),0==(0|Ge[i>>2]))?-1:((t=0|Ge[(r=e+4|0)>>2])>>>0<(o=0|Ge[(n=e+8|0)>>2])>>>0&&de[7&Ge[e+40>>2]](e,t-o|0,1),Ge[e+16>>2]=0,Ge[a>>2]=0,Ge[i>>2]=0,Ge[n>>2]=0,Ge[r>>2]=0))}function ne(e,r,t){e|=0,r|=0;var n=0,n=1==(0|(t|=0))?r-(0|Ge[e+8>>2])+(0|Ge[e+4>>2])|0:r,o=e+28|0;return 0|((0|Ge[(r=e+20|0)>>2])>>>0>(0|Ge[o>>2])>>>0&&(de[7&Ge[e+36>>2]](e,0,0),0==(0|Ge[r>>2]))?-1:(Ge[e+16>>2]=0,Ge[o>>2]=0,((Ge[r>>2]=0)|de[7&Ge[e+40>>2]](e,n,t))<0?-1:(Ge[e+8>>2]=0,Ge[e+4>>2]=0,Ge[e>>2]=-17&Ge[e>>2],0)))}function oe(e){var r=0,t=0,r=128&Ge[(e|=0)>>2]&&(0|Ge[e+20>>2])>>>0>(0|Ge[e+28>>2])>>>0?2:1;return 0|((0|(t=0|de[7&Ge[e+40>>2]](e,0,r)))<0?t:t-(0|Ge[e+8>>2])+(0|Ge[e+4>>2])+(0|Ge[e+20>>2])-(0|Ge[e+28>>2])|0)}function ie(e,r){e|=0,r|=0;var t,n=Ze;return(0|Je)<=(0|(Ze=Ze+16|0))&&Qe(16),Ge[(t=n)>>2]=r,r=0|function(e,r,t){e|=0,r|=0,t|=0;var n,o,i,a,s,u,c,l=0,f=0,d=0,E=0,S=0,_=0,m=Ze;for(Ze=Ze+224|0,(0|Je)<=(0|Ze)&&Qe(224),n=m+120|0,l=m+80|0,c=m,o=m+136|0,f=l,d=f+40|0;f=f+4|(Ge[f>>2]=0),(0|f)<(0|d););return Ge[n>>2]=Ge[t>>2],E=(0|z(0,r,n,c,l))<0?-1:(S=-1<(0|Ge[e+76>>2])?0|V():0,f=32&(t=0|Ge[e>>2]),(0|Xe[e+74>>0])<1&&(Ge[e>>2]=-33&t),_=0|Ge[(t=e+48|0)>>2]?0|z(e,r,n,c,l):(i=0|Ge[(d=e+44|0)>>2],Ge[d>>2]=o,Ge[(a=e+28|0)>>2]=o,Ge[(s=e+20|0)>>2]=o,Ge[t>>2]=80,Ge[(u=e+16|0)>>2]=80+o,o=0|z(e,r,n,c,l),i?(de[7&Ge[e+36>>2]](e,0,0),c=0==(0|Ge[s>>2])?-1:o,Ge[d>>2]=i,Ge[t>>2]=0,Ge[u>>2]=0,Ge[a>>2]=0,Ge[s>>2]=0,c):o),l=0|Ge[e>>2],Ge[e>>2]=l|f,0|S&&K(),0==(32&l|0)?_:-1),Ze=m,0|E}(0|Ge[208],e,t),Ze=n,0|r}function ae(e){e|=0;var r=0,t=0,n=0,o=0,i=0|Ge[208],r=(Ge[76+i>>2],0);do{if((0|q(e,i))<0)t=1;else{if(10!=(0|Xe[75+i>>0])&&(o=0|Ge[(n=20+i|0)>>2])>>>0<(0|Ge[16+i>>2])>>>0){Ge[n>>2]=o+1,Xe[o>>0]=10,t=0;break}t=(0|J(i,10))<0}}while(0);return 0|r&&K(),t<<31>>31|0}function Ye(e,r,t,n){r|=0,n|=0;return 0|(ve=r-n-((e|=0)>>>0<(t|=0)>>>0|0)>>>0,e-t>>>0|0)}function ze(e,r,t,n){var o=0;return 0|(ve=(r|=0)+(n|=0)+((o=(e|=0)+(t|=0)>>>0)>>>0>>0|0)>>>0,0|o)}function er(e,r,t){r|=0;var n,o,i,a=(e|=0)+(t|=0)|0;if(r&=255,67<=(0|t)){for(;3&e;)Xe[e>>0]=r,e=e+1|0;for(o=(n=-4&a|0)-64|0,i=r|r<<8|r<<16|r<<24;(0|e)<=(0|o);)Ge[e>>2]=i,Ge[e+4>>2]=i,Ge[e+8>>2]=i,Ge[e+12>>2]=i,Ge[e+16>>2]=i,Ge[e+20>>2]=i,Ge[e+24>>2]=i,Ge[e+28>>2]=i,Ge[e+32>>2]=i,Ge[e+36>>2]=i,Ge[e+40>>2]=i,Ge[e+44>>2]=i,Ge[e+48>>2]=i,Ge[e+52>>2]=i,Ge[e+56>>2]=i,Ge[e+60>>2]=i,e=e+64|0;for(;(0|e)<(0|n);)Ge[e>>2]=i,e=e+4|0}for(;(0|e)<(0|a);)Xe[e>>0]=r,e=e+1|0;return a-t|0}function Ve(e,r,t){return e|=0,r|=0,(0|(t|=0))<32?(ve=r>>>t,e>>>t|(r&(1<>>t-32|(ve=0)}function Ke(e,r,t){return e|=0,r|=0,(0|(t|=0))<32?(ve=r<>>32-t,e<>0]))<8?0|r:(0|(r=0|Xe[E+(e>>8&255)>>0]))<8?r+8|0:(0|(r=0|Xe[E+(e>>16&255)>>0]))<8?r+16|0:24+(0|Xe[E+(e>>>24)>>0])|0}function ue(e,r,t,n,o){o|=0;var i,a,s,u=0,c=0,l=0,f=0,d=0,E=0,S=0,_=0,m=0,h=0,p=0,F=0,M=0,b=0,y=0,O=0,w=0,R=0,A=0,k=0,T=0,g=0,v=0,N=0,u=e|=0,f=t|=0,E=d=n|=0;if(!(l=c=r|=0))return S=0!=(0|o),E?(S&&(Ge[o>>2]=0|e,Ge[o+4>>2]=0&r),(m=_=0)|(ve=_,m)):(S&&(Ge[o>>2]=(u>>>0)%(f>>>0),Ge[o+4>>2]=0),(_=0)|(ve=_,m=(u>>>0)/(f>>>0)>>>0));S=0==(0|E);do{if(f){if(!S){if((h=(0|D(0|E))-(0|D(0|l))|0)>>>0<=31){y=u>>>((b=p=h+1|0)>>>0)&(M=h-31>>31)|l<<(F=31-h|0),O=l>>>(p>>>0)&M,w=0,R=u<>2]=0|e,Ge[o+4>>2]=c|0&r,(m=_=0)|(ve=_,m)):(m=_=0)|(ve=_,m)}if((F=f-1|0)&f|0){y=(h=32-(M=33+(0|D(0|f))-(0|D(0|l))|0)|0)-1>>31&l>>>((a=M-32|0)>>>0)|(l<>>((b=M)>>>0))&(s=a>>31),O=s&l>>>(M>>>0),w=u<<(p=64-M|0)&(i=h>>31),R=(l<>>(a>>>0))&i|u<>31;break}return 0|o&&(Ge[o>>2]=F&u,Ge[o+4>>2]=0),1==(0|f)?0|(ve=_=c|0&r,m=0|e):(F=0|se(0|f),0|(ve=_=l>>>(F>>>0)|0,m=l<<32-F|u>>>(F>>>0)|0))}if(S)return 0|o&&(Ge[o>>2]=(l>>>0)%(f>>>0),Ge[o+4>>2]=0),(_=0)|(ve=_,m=(l>>>0)/(f>>>0)>>>0);if(!u)return 0|o&&(Ge[o>>2]=0,Ge[o+4>>2]=(l>>>0)%(E>>>0)),(_=0)|(ve=_,m=(l>>>0)/(E>>>0)>>>0);if(!((F=E-1|0)&E))return 0|o&&(Ge[o>>2]=0|e,Ge[o+4>>2]=F&l|0&r),m=l>>>(((_=0)|se(0|E))>>>0),0|(ve=_,m);if((F=(0|D(0|E))-(0|D(0|l))|0)>>>0<=30){y=l<<(h=31-F|0)|u>>>((b=M=F+1|0)>>>0),O=l>>>(M>>>0),w=0,R=u<>2]=0|e,Ge[o+4>>2]=c|0&r),(m=_=0)|(ve=_,m)}while(0);if(b){for(r=0|t,t=d|0&n,n=0|ze(0|r,0|t,-1,-1),d=ve,c=R,R=w,w=O,O=y,y=b,b=0;c=R>>>31|(e=c)<<1,R=b|R<<1,Ye(0|n,0|d,0|(u=O<<1|e>>>31|0),0|(e=O>>>31|w<<1|0)),b=1&(E=(l=ve)>>31|((0|l)<0?-1:0)<<1),O=0|Ye(0|u,0|e,E&r|0,(((0|l)<0?-1:0)>>31|((0|l)<0?-1:0)<<1)&t|0),w=ve,y=y-1|0,0!=(0|y););A=c,k=R,T=w,g=O,v=0,N=b}else A=R,k=w,T=O,g=y,N=v=0;return b=k,(k=0)|o&&(Ge[o>>2]=g,Ge[o+4>>2]=T),0|(ve=_=(0|b)>>>31|(A|k)<<1|0&(k<<1|b>>>31)|v,m=-2&(b<<1|0)|N)}function We(e,r,t,n){return 0|ue(e|=0,r|=0,t|=0,n|=0,0)}function Oe(e){var r,t;return 0<(0|(e=(e|=0)+15&-16|0))&(0|(t=(r=0|Ge[d>>2])+e|0))<(0|r)|(0|t)<0?(h(),O(12),-1):(0|(Ge[d>>2]=t))>(0|m())&&0==(0|_())?(Ge[d>>2]=r,O(12),-1):0|r}function rr(e,r,t,n){var o,i=Ze;return Ze=Ze+16|0,ue(e|=0,r|=0,t|=0,n|=0,o=0|i),Ze=i,0|(ve=0|Ge[4+o>>2],0|Ge[o>>2])}function tr(e,r,t){e|=0,r|=0;var n,o,i=0;if(8192<=(0|(t|=0)))return 0|k(0|e,0|r,0|t);if(n=0|e,o=e+t|0,(3&e)==(3&r)){for(;3&e;){if(!t)return 0|n;Xe[e>>0]=0|Xe[r>>0],e=e+1|0,r=r+1|0,t=t-1|0}for(t=(i=-4&o|0)-64|0;(0|e)<=(0|t);)Ge[e>>2]=Ge[r>>2],Ge[e+4>>2]=Ge[r+4>>2],Ge[e+8>>2]=Ge[r+8>>2],Ge[e+12>>2]=Ge[r+12>>2],Ge[e+16>>2]=Ge[r+16>>2],Ge[e+20>>2]=Ge[r+20>>2],Ge[e+24>>2]=Ge[r+24>>2],Ge[e+28>>2]=Ge[r+28>>2],Ge[e+32>>2]=Ge[r+32>>2],Ge[e+36>>2]=Ge[r+36>>2],Ge[e+40>>2]=Ge[r+40>>2],Ge[e+44>>2]=Ge[r+44>>2],Ge[e+48>>2]=Ge[r+48>>2],Ge[e+52>>2]=Ge[r+52>>2],Ge[e+56>>2]=Ge[r+56>>2],Ge[e+60>>2]=Ge[r+60>>2],e=e+64|0,r=r+64|0;for(;(0|e)<(0|i);)Ge[e>>2]=Ge[r>>2],e=e+4|0,r=r+4|0}else for(i=o-4|0;(0|e)<(0|i);)Xe[e>>0]=0|Xe[r>>0],Xe[e+1>>0]=0|Xe[r+1>>0],Xe[e+2>>0]=0|Xe[r+2>>0],Xe[e+3>>0]=0|Xe[r+3>>0],e=e+4|0,r=r+4|0;for(;(0|e)<(0|o);)Xe[e>>0]=0|Xe[r>>0],e=e+1|0,r=r+1|0;return 0|n}function ce(e){return(255&(e|=0))<<24|(e>>8&255)<<16|(e>>16&255)<<8|e>>>24|0}function le(e,r,t){return F(1),0}var fe=[function(e){return p(0),0},function(e){e|=0;var r,t=Ze;return(0|Je)<=(0|(Ze=Ze+16|0))&&Qe(16),r=t,e=0|(e=0|Ge[e+60>>2],0|(e|=0)),Ge[r>>2]=e,e=0|U(0|y(6,0|r)),Ze=t,0|e}],de=[le,function(e,r,t){e|=0,r|=0,t|=0;var n=0,o=Ze;return(0|Je)<=(0|(Ze=Ze+32|0))&&Qe(32),n=o,Ge[e+36>>2]=3,0==(64&Ge[e>>2]|0)&&(Ge[n>>2]=Ge[e+60>>2],Ge[n+4>>2]=21523,Ge[n+8>>2]=o+16,0|T(54,0|n))&&(Xe[e+75>>0]=-1),n=0|H(e,r,t),Ze=o,0|n},function(e,r,t){e|=0,r|=0,t|=0;var n,o,i=0,a=Ze;return(0|Je)<=(0|(Ze=Ze+32|0))&&Qe(32),o=(n=a)+20|0,Ge[n>>2]=Ge[e+60>>2],Ge[n+4>>2]=0,Ge[n+8>>2]=r,Ge[n+12>>2]=o,Ge[n+16>>2]=t,i=(0|U(0|w(140,0|n)))<0?Ge[o>>2]=-1:0|Ge[o>>2],Ze=a,0|i},H,function(e,r,t){e|=0,r|=0,t|=0;var n,o,i,a,s,u=0,c=0,l=Ze;return(0|Je)<=(0|(Ze=Ze+32|0))&&Qe(32),Ge[(o=(n=l)+16|0)>>2]=r,u=4+o|0,a=0|Ge[(i=e+48|0)>>2],Ge[u>>2]=t-(0!=(0|a)&1),s=e+44|0,Ge[8+o>>2]=Ge[s>>2],Ge[12+o>>2]=a,Ge[n>>2]=Ge[e+60>>2],Ge[n+4>>2]=o,Ge[n+8>>2]=2,c=1<=(0|(o=0|U(0|v(145,0|n))))?(n=0|Ge[u>>2])>>>0>>0?(u=0|Ge[s>>2],Ge[(s=e+4|0)>>2]=u,Ge[e+8>>2]=u+(o-n),0|Ge[i>>2]&&(Ge[s>>2]=u+1,Xe[r+(t+-1)>>0]=0|Xe[u>>0]),t):o:(Ge[e>>2]=Ge[e>>2]|48&o^16,o),Ze=l,0|c},le,le,le];return{_llvm_bswap_i32:ce,_i64Subtract:Ye,___udivdi3:We,setThrew:function(e,r){e|=0,r|=0,S||(S=e,0)},_bitshift64Lshr:Ve,_bitshift64Shl:Ke,_fflush:re,___errno_location:Y,_extract:function(e){return N(e|=0,0),1},_memset:er,_sbrk:Oe,_memcpy:tr,stackAlloc:function(e){var r=Ze;return(0|Je)<=(0|(Ze=(Ze=Ze+(e|=0)|0)+15&-16))&&Qe(0|e),0|r},___uremdi3:rr,getTempRet0:function(){return 0|ve},setTempRet0:function(e){ve=e|=0},_i64Add:ze,dynCall_iiii:function(e,r,t,n){return r|=0,t|=0,n|=0,0|de[7&(e|=0)](0|r,0|t,0|n)},_emscripten_get_global_libc:function(){return 4288},dynCall_ii:function(e,r){return r|=0,0|fe[1&(e|=0)](0|r)},stackSave:function(){return 0|Ze},_free:B,runPostSets:function(){},establishStackSpace:function(e,r){Ze=e|=0,Je=r|=0},stackRestore:function(e){Ze=e|=0},_malloc:x,_emscripten_replace_memory:function(e){return!(16777215&f(e)||f(e)<=16777215||2147483648=e);)++d;if(16f?e+=String.fromCharCode(f):(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else e+=String.fromCharCode(f)}return e}function F(a,b){return a?D(pa,a,b):""} -function qa(a,b,d,e){if(!(0=k){var l=a.charCodeAt(++h);k=65536+((k&1023)<<10)|l&1023}if(127>=k){if(d>=e)break;b[d++]=k}else{if(2047>=k){if(d+1>=e)break;b[d++]=192|k>>6}else{if(65535>=k){if(d+2>=e)break;b[d++]=224|k>>12}else{if(d+3>=e)break;b[d++]=240|k>>18;b[d++]=128|k>>12&63}b[d++]=128|k>>6&63}b[d++]=128|k&63}}b[d]=0;return d-f}function ra(a,b,d){return qa(a,pa,b,d)} -function sa(a){for(var b=0,d=0;d=e&&(e=65536+((e&1023)<<10)|a.charCodeAt(++d)&1023);127>=e?++b:b=2047>=e?b+2:65535>=e?b+3:b+4}return b}function ta(a){var b=sa(a)+1,d=ua(b);d&&qa(a,G,d,b);return d}var va,G,pa,H; -function wa(a){va=a;c.HEAP8=G=new Int8Array(a);c.HEAP16=new Int16Array(a);c.HEAP32=H=new Int32Array(a);c.HEAPU8=pa=new Uint8Array(a);c.HEAPU16=new Uint16Array(a);c.HEAPU32=new Uint32Array(a);c.HEAPF32=new Float32Array(a);c.HEAPF64=new Float64Array(a)}var xa=c.INITIAL_MEMORY||16777216;c.wasmMemory?y=c.wasmMemory:y=new WebAssembly.Memory({initial:xa/65536,maximum:32768});y&&(va=y.buffer);xa=va.byteLength;wa(va);H[16784]=5310176; -function ya(a){for(;0>2]=a}function R(){for(var a="",b=!1,d=arguments.length-1;-1<=d&&!b;d--){b=0<=d?arguments[d]:S.cwd();if("string"!==typeof b)throw new TypeError("Arguments to path.resolve must be strings");if(!b)return"";a=b+"/"+a;b="/"===b.charAt(0)}a=Va(a.split("/").filter(function(e){return!!e}),!b).join("/");return(b?"/":"")+a||"."} -function $a(a,b){function d(k){for(var l=0;lq?[]:k.slice(l,q-l+1)}a=R(a).substr(1);b=R(b).substr(1);a=d(a.split("/"));b=d(b.split("/"));for(var e=Math.min(a.length,b.length),f=e,h=0;h=b||(b=Math.max(b,d*(1048576>d?2:1.125)>>>0),0!=d&&(b=Math.max(b,256)),d=a.sa,a.sa=new Uint8Array(b),0b)a.sa.length=b;else for(;a.sa.length=a.node.za)return 0;a=Math.min(a.node.za-f,e);if(8b)throw new S.ra(28);return b},Xa:function(a,b,d){T.ac(a.node,b+d);a.node.za=Math.max(a.node.za,b+d)},ab:function(a,b,d,e,f,h,k){if(!S.isFile(a.node.mode))throw new S.ra(43);a=a.node.sa;if(k&2||a.buffer!==b.buffer){if(0=a.node.size)return 0;a=a.node.sa.slice(f,f+e);e=U.Fb.readAsArrayBuffer(a);b.set(new Uint8Array(e),d);return a.size},write:function(){throw new S.ra(29); -},Ha:function(a,b,d){1===d?b+=a.position:2===d&&S.isFile(a.node.mode)&&(b+=a.node.size);if(0>b)throw new S.ra(28);return b}}},S={root:null,cb:[],Zb:{},streams:[],Rc:1,La:null,Yb:"/",xb:!1,jc:!0,Da:{},oc:{mc:{tc:1,uc:2}},ra:null,ub:{},Gc:null,nb:0,Lc:function(a){if(!(a instanceof S.ra)){a:{var b=Error();if(!b.stack){try{throw Error();}catch(d){b=d}if(!b.stack){b="(no stack trace available)";break a}}b=b.stack.toString()}c.extraStackTrace&&(b+="\n"+c.extraStackTrace());b=Ta(b);throw a+" : "+b;}return Ya(a.wa)}, -ya:function(a,b){a=R(S.cwd(),a);b=b||{};if(!a)return{path:"",node:null};var d={tb:!0,Gb:0},e;for(e in d)void 0===b[e]&&(b[e]=d[e]);if(8>>0)%S.La.length},hc:function(a){var b=S.wb(a.parent.id,a.name);a.Ra=S.La[b];S.La[b]=a},ic:function(a){var b=S.wb(a.parent.id,a.name);if(S.La[b]===a)S.La[b]=a.Ra;else for(b=S.La[b];b;){if(b.Ra===a){b.Ra=a.Ra;break}b=b.Ra}},Na:function(a,b){var d=S.Oc(a);if(d)throw new S.ra(d,a);for(d= -S.La[S.wb(a.id,b)];d;d=d.Ra){var e=d.name;if(d.parent.id===a.id&&e===b)return d}return S.lookup(a,b)},createNode:function(a,b,d,e){a=new S.rc(a,b,d,e);S.hc(a);return a},sb:function(a){S.ic(a)},kb:function(a){return a===a.parent},Pa:function(a){return!!a.bb},isFile:function(a){return 32768===(a&61440)},Ba:function(a){return 16384===(a&61440)},Sa:function(a){return 40960===(a&61440)},jb:function(a){return 8192===(a&61440)},Mc:function(a){return 24576===(a&61440)},isFIFO:function(a){return 4096===(a& -61440)},isSocket:function(a){return 49152===(a&49152)},Hc:{r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218},Qc:function(a){var b=S.Hc[a];if("undefined"===typeof b)throw Error("Unknown file open mode: "+a);return b},bc:function(a){var b=["r","w","rw"][a&3];a&512&&(b+="w");return b},Oa:function(a,b){if(S.jc)return 0;if(-1===b.indexOf("r")||a.mode&292){if(-1!==b.indexOf("w")&&!(a.mode&146)||-1!==b.indexOf("x")&&!(a.mode&73))return 2}else return 2; -return 0},Oc:function(a){var b=S.Oa(a,"x");return b?b:a.ta.lookup?0:2},Bb:function(a,b){try{return S.Na(a,b),20}catch(d){}return S.Oa(a,"wx")},lb:function(a,b,d){try{var e=S.Na(a,b)}catch(f){return f.wa}if(a=S.Oa(a,"wx"))return a;if(d){if(!S.Ba(e.mode))return 54;if(S.kb(e)||S.Ja(e)===S.cwd())return 10}else if(S.Ba(e.mode))return 31;return 0},Pc:function(a,b){return a?S.Sa(a.mode)?32:S.Ba(a.mode)&&("r"!==S.bc(b)||b&512)?31:S.Oa(a,S.bc(b)):44},sc:4096,Sc:function(a,b){b=b||S.sc;for(a=a||0;a<=b;a++)if(!S.streams[a])return a; -throw new S.ra(33);},Ya:function(a){return S.streams[a]},Fc:function(a,b,d){S.pb||(S.pb=function(){},S.pb.prototype={object:{get:function(){return this.node},set:function(h){this.node=h}}});var e=new S.pb,f;for(f in a)e[f]=a[f];a=e;b=S.Sc(b,d);a.fd=b;return S.streams[b]=a},zc:function(a){S.streams[a]=null},yc:{open:function(a){a.ua=S.Kc(a.node.rdev).ua;a.ua.open&&a.ua.open(a)},Ha:function(){throw new S.ra(70);}},Ab:function(a){return a>>8},ld:function(a){return a&255},Qa:function(a,b){return a<<8| -b},Hb:function(a,b){S.Zb[a]={ua:b}},Kc:function(a){return S.Zb[a]},dc:function(a){var b=[];for(a=[a];a.length;){var d=a.pop();b.push(d);a.push.apply(a,d.cb)}return b},nc:function(a,b){function d(k){S.nb--;return b(k)}function e(k){if(k){if(!e.Ea)return e.Ea=!0,d(k)}else++h>=f.length&&d(null)}"function"===typeof a&&(b=a,a=!1);S.nb++;1b)throw new S.ra(28);var d;"string"===typeof a?d=S.ya(a,{Fa:!0}).node:d=a;if(!d.ta.Ca)throw new S.ra(63);if(S.Ba(d.mode))throw new S.ra(31);if(!S.isFile(d.mode))throw new S.ra(28);if(a=S.Oa(d,"w"))throw new S.ra(a);d.ta.Ca(d,{size:b,timestamp:Date.now()})},Ic:function(a,b){a=S.Ya(a);if(!a)throw new S.ra(8);if(0===(a.flags&2097155))throw new S.ra(28);S.truncate(a.node,b)},ad:function(a, -b,d){a=S.ya(a,{Fa:!0}).node;a.ta.Ca(a,{timestamp:Math.max(b,d)})},open:function(a,b,d,e,f){if(""===a)throw new S.ra(44);b="string"===typeof b?S.Qc(b):b;d=b&64?("undefined"===typeof d?438:d)&4095|32768:0;if("object"===typeof a)var h=a;else{a=O(a);try{h=S.ya(a,{Fa:!(b&131072)}).node}catch(l){}}var k=!1;if(b&64)if(h){if(b&128)throw new S.ra(20);}else h=S.Ka(a,d,0),k=!0;if(!h)throw new S.ra(44);S.jb(h.mode)&&(b&=-513);if(b&65536&&!S.Ba(h.mode))throw new S.ra(54);if(!k&&(d=S.Pc(h,b)))throw new S.ra(d); -b&512&&S.truncate(h,0);b&=-131713;e=S.Fc({node:h,path:S.Ja(h),flags:b,seekable:!0,position:0,ua:h.ua,Zc:[],error:!1},e,f);e.ua.open&&e.ua.open(e);!c.logReadFiles||b&1||(S.Eb||(S.Eb={}),a in S.Eb||(S.Eb[a]=1,v("FS.trackingDelegate error on read file: "+a)));try{S.Da.onOpenFile&&(f=0,1!==(b&2097155)&&(f|=S.oc.mc.tc),0!==(b&2097155)&&(f|=S.oc.mc.uc),S.Da.onOpenFile(a,f))}catch(l){v("FS.trackingDelegate['onOpenFile']('"+a+"', flags) threw an exception: "+l.message)}return e},close:function(a){if(S.$a(a))throw new S.ra(8); -a.vb&&(a.vb=null);try{a.ua.close&&a.ua.close(a)}catch(b){throw b;}finally{S.zc(a.fd)}a.fd=null},$a:function(a){return null===a.fd},Ha:function(a,b,d){if(S.$a(a))throw new S.ra(8);if(!a.seekable||!a.ua.Ha)throw new S.ra(70);if(0!=d&&1!=d&&2!=d)throw new S.ra(28);a.position=a.ua.Ha(a,b,d);a.Zc=[];return a.position},read:function(a,b,d,e,f){if(0>e||0>f)throw new S.ra(28);if(S.$a(a))throw new S.ra(8);if(1===(a.flags&2097155))throw new S.ra(8);if(S.Ba(a.node.mode))throw new S.ra(31);if(!a.ua.read)throw new S.ra(28); -var h="undefined"!==typeof f;if(!h)f=a.position;else if(!a.seekable)throw new S.ra(70);b=a.ua.read(a,b,d,e,f);h||(a.position+=b);return b},write:function(a,b,d,e,f,h){if(0>e||0>f)throw new S.ra(28);if(S.$a(a))throw new S.ra(8);if(0===(a.flags&2097155))throw new S.ra(8);if(S.Ba(a.node.mode))throw new S.ra(31);if(!a.ua.write)throw new S.ra(28);a.seekable&&a.flags&1024&&S.Ha(a,0,2);var k="undefined"!==typeof f;if(!k)f=a.position;else if(!a.seekable)throw new S.ra(70);b=a.ua.write(a,b,d,e,f,h);k||(a.position+= -b);try{if(a.path&&S.Da.onWriteToFile)S.Da.onWriteToFile(a.path)}catch(l){v("FS.trackingDelegate['onWriteToFile']('"+a.path+"') threw an exception: "+l.message)}return b},Xa:function(a,b,d){if(S.$a(a))throw new S.ra(8);if(0>b||0>=d)throw new S.ra(28);if(0===(a.flags&2097155))throw new S.ra(8);if(!S.isFile(a.node.mode)&&!S.Ba(a.node.mode))throw new S.ra(43);if(!a.ua.Xa)throw new S.ra(138);a.ua.Xa(a,b,d)},ab:function(a,b,d,e,f,h,k){if(0!==(h&2)&&0===(k&2)&&2!==(a.flags&2097155))throw new S.ra(2);if(1=== -(a.flags&2097155))throw new S.ra(2);if(!a.ua.ab)throw new S.ra(43);return a.ua.ab(a,b,d,e,f,h,k)},eb:function(a,b,d,e,f){return a&&a.ua.eb?a.ua.eb(a,b,d,e,f):0},nd:function(){return 0},kc:function(a,b,d){if(!a.ua.kc)throw new S.ra(59);return a.ua.kc(a,b,d)},readFile:function(a,b){b=b||{};b.flags=b.flags||"r";b.encoding=b.encoding||"binary";if("utf8"!==b.encoding&&"binary"!==b.encoding)throw Error('Invalid encoding type "'+b.encoding+'"');var d,e=S.open(a,b.flags);a=S.stat(a).size;var f=new Uint8Array(a); -S.read(e,f,0,a,0);"utf8"===b.encoding?d=D(f,0):"binary"===b.encoding&&(d=f);S.close(e);return d},writeFile:function(a,b,d){d=d||{};d.flags=d.flags||"w";a=S.open(a,d.flags,d.mode);if("string"===typeof b){var e=new Uint8Array(sa(b)+1);b=qa(b,e,0,e.length);S.write(a,e,0,b,void 0,d.xc)}else if(ArrayBuffer.isView(b))S.write(a,b,0,b.byteLength,void 0,d.xc);else throw Error("Unsupported data type");S.close(a)},cwd:function(){return S.Yb},chdir:function(a){a=S.ya(a,{Fa:!0});if(null===a.node)throw new S.ra(44); -if(!S.Ba(a.node.mode))throw new S.ra(54);var b=S.Oa(a.node,"x");if(b)throw new S.ra(b);S.Yb=a.path},Bc:function(){S.mkdir("/tmp");S.mkdir("/home");S.mkdir("/home/web_user")},Ac:function(){S.mkdir("/dev");S.Hb(S.Qa(1,3),{read:function(){return 0},write:function(e,f,h,k){return k}});S.mb("/dev/null",S.Qa(1,3));bb(S.Qa(5,0),eb);bb(S.Qa(6,0),fb);S.mb("/dev/tty",S.Qa(5,0));S.mb("/dev/tty1",S.Qa(6,0));if("object"===typeof crypto&&"function"===typeof crypto.getRandomValues){var a=new Uint8Array(1);var b= -function(){crypto.getRandomValues(a);return a[0]}}else if(ea)try{var d=require("crypto");b=function(){return d.randomBytes(1)[0]}}catch(e){}b||(b=function(){u("random_device")});S.Ia("/dev","random",b);S.Ia("/dev","urandom",b);S.mkdir("/dev/shm");S.mkdir("/dev/shm/tmp")},Dc:function(){S.mkdir("/proc");S.mkdir("/proc/self");S.mkdir("/proc/self/fd");S.Aa({Aa:function(){var a=S.createNode("/proc/self","fd",16895,73);a.ta={lookup:function(b,d){var e=S.Ya(+d);if(!e)throw new S.ra(8);b={parent:null,Aa:{lc:"fake"}, -ta:{readlink:function(){return e.path}}};return b.parent=b}};return a}},{},"/proc/self/fd")},Ec:function(){c.stdin?S.Ia("/dev","stdin",c.stdin):S.symlink("/dev/tty","/dev/stdin");c.stdout?S.Ia("/dev","stdout",null,c.stdout):S.symlink("/dev/tty","/dev/stdout");c.stderr?S.Ia("/dev","stderr",null,c.stderr):S.symlink("/dev/tty1","/dev/stderr");S.open("/dev/stdin","r");S.open("/dev/stdout","w");S.open("/dev/stderr","w")},$b:function(){S.ra||(S.ra=function(a,b){this.node=b;this.Xc=function(d){this.wa=d}; -this.Xc(a);this.message="FS error"},S.ra.prototype=Error(),S.ra.prototype.constructor=S.ra,[44].forEach(function(a){S.ub[a]=new S.ra(a);S.ub[a].stack=""}))},Yc:function(){S.$b();S.La=Array(4096);S.Aa(T,{},"/");S.Bc();S.Ac();S.Dc();S.Gc={MEMFS:T,WORKERFS:U}},Za:function(a,b,d){S.Za.xb=!0;S.$b();c.stdin=a||c.stdin;c.stdout=b||c.stdout;c.stderr=d||c.stderr;S.Ec()},quit:function(){S.Za.xb=!1;var a=c._fflush;a&&a(0);for(a=0;athis.length-1||0>n)){var t=n%this.chunkSize;return this.fc(n/this.chunkSize|0)[t]}};h.prototype.fb=function(n){this.fc=n};h.prototype.Rb=function(){var n=new XMLHttpRequest;n.open("HEAD",d,!1);n.send(null);if(!(200<=n.status&&300>n.status||304===n.status))throw Error("Couldn't load "+ -d+". Status: "+n.status);var t=Number(n.getResponseHeader("Content-length")),w,C=(w=n.getResponseHeader("Accept-Ranges"))&&"bytes"===w;n=(w=n.getResponseHeader("Content-Encoding"))&&"gzip"===w;var B=1048576;C||(B=t);var A=this;A.fb(function(I){var J=I*B,aa=(I+1)*B-1;aa=Math.min(aa,t-1);if("undefined"===typeof A.Ea[I]){var bc=A.Ea;if(J>aa)throw Error("invalid range ("+J+", "+aa+") or no bytes requested!");if(aa>t-1)throw Error("only "+t+" bytes available! programmer error!");var E=new XMLHttpRequest; -E.open("GET",d,!1);t!==B&&E.setRequestHeader("Range","bytes="+J+"-"+aa);"undefined"!=typeof Uint8Array&&(E.responseType="arraybuffer");E.overrideMimeType&&E.overrideMimeType("text/plain; charset=x-user-defined");E.send(null);if(!(200<=E.status&&300>E.status||304===E.status))throw Error("Couldn't load "+d+". Status: "+E.status);J=void 0!==E.response?new Uint8Array(E.response||[]):db(E.responseText||"",!0);bc[I]=J}if("undefined"===typeof A.Ea[I])throw Error("doXHR failed!");return A.Ea[I]});if(n||!t)B= -t=1,B=t=this.fc(0).length,ka("LazyFiles on gzip forces download of the whole file when length is accessed");this.wc=t;this.vc=B;this.zb=!0};if("undefined"!==typeof XMLHttpRequest){if(!m)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var k=new h;Object.defineProperties(k,{length:{get:function(){this.zb||this.Rb();return this.wc}},chunkSize:{get:function(){this.zb||this.Rb();return this.vc}}});k={yb:!1,sa:k}}else k={yb:!1,url:d}; -var l=S.Cc(a,b,k,e,f);k.sa?l.sa=k.sa:k.url&&(l.sa=null,l.url=k.url);Object.defineProperties(l,{za:{get:function(){return this.sa.length}}});var q={};Object.keys(l.ua).forEach(function(n){var t=l.ua[n];q[n]=function(){if(!S.cc(l))throw new S.ra(29);return t.apply(null,arguments)}});q.read=function(n,t,w,C,B){if(!S.cc(l))throw new S.ra(29);n=n.node.sa;if(B>=n.length)return 0;C=Math.min(n.length-B,C);if(n.slice)for(var A=0;A>2]=e.dev;H[d+4>>2]=0;H[d+8>>2]=e.ino;H[d+12>>2]=e.mode;H[d+16>>2]=e.nlink;H[d+20>>2]=e.uid;H[d+24>>2]=e.gid;H[d+28>>2]=e.rdev;H[d+32>>2]=0;N=[e.size>>>0,(M=e.size,1<=+Fa(M)?0>>0:~~+Ga((M-+(~~M>>>0))/4294967296)>>>0:0)];H[d+40>>2]=N[0];H[d+44>>2]=N[1];H[d+48>>2]=4096;H[d+52>>2]=e.blocks;H[d+56>>2]=e.atime.getTime()/1E3|0;H[d+60>>2]=0;H[d+64>>2]=e.mtime.getTime()/ -1E3|0;H[d+68>>2]=0;H[d+72>>2]=e.ctime.getTime()/1E3|0;H[d+76>>2]=0;N=[e.ino>>>0,(M=e.ino,1<=+Fa(M)?0>>0:~~+Ga((M-+(~~M>>>0))/4294967296)>>>0:0)];H[d+80>>2]=N[0];H[d+84>>2]=N[1];return 0}var jb=void 0;function kb(a){a=S.Ya(a);if(!a)throw new S.ra(8);return a}var lb={}; -function mb(){if(!nb){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"===typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:ca||"./this.program"},b;for(b in lb)a[b]=lb[b];var d=[];for(b in a)d.push(b+"="+a[b]);nb=d}return nb}var nb;ra("GMT",67200,4); -function ob(){function a(h){return(h=h.toTimeString().match(/\(([A-Za-z ]+)\)$/))?h[1]:"GMT"}if(!pb){pb=!0;H[qb()>>2]=60*(new Date).getTimezoneOffset();var b=(new Date).getFullYear(),d=new Date(b,0,1);b=new Date(b,6,1);H[rb()>>2]=Number(d.getTimezoneOffset()!=b.getTimezoneOffset());var e=a(d),f=a(b);e=ta(e);f=ta(f);b.getTimezoneOffset()>2]=e,H[sb()+4>>2]=f):(H[sb()>>2]=f,H[sb()+4>>2]=e)}}var pb; -function tb(a,b,d,e){a||(a=this);this.parent=a;this.Aa=a.Aa;this.bb=null;this.id=S.Rc++;this.name=b;this.mode=d;this.ta={};this.ua={};this.rdev=e}Object.defineProperties(tb.prototype,{read:{get:function(){return 365===(this.mode&365)},set:function(a){a?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146===(this.mode&146)},set:function(a){a?this.mode|=146:this.mode&=-147}},Nc:{get:function(){return S.Ba(this.mode)}},yb:{get:function(){return S.jb(this.mode)}}});S.rc=tb;S.Yc();var gb; -c.FS_createFolder=S.Tb;c.FS_createPath=S.Wb;c.FS_createDataFile=S.hb;c.FS_createPreloadedFile=S.Xb;c.FS_createLazyFile=S.Ub;c.FS_createLink=S.Vb;c.FS_createDevice=S.Ia;c.FS_unlink=S.unlink;function db(a,b){var d=Array(sa(a)+1);a=qa(a,d,0,d.length);b&&(d.length=a);return d} -var ub={b:function(a){return ua(a)},a:function(a){"uncaught_exception"in Ua?Ua.Ea++:Ua.Ea=1;throw a;},A:function(a,b){try{a=F(a);if(b&-8)var d=-28;else{var e;(e=S.ya(a,{Fa:!0}).node)?(a="",b&4&&(a+="r"),b&2&&(a+="w"),b&1&&(a+="x"),d=a&&S.Oa(e,a)?-2:0):d=-44}return d}catch(f){return"undefined"!==typeof S&&f instanceof S.ra||u(f),-f.wa}},F:function(a,b){try{return a=F(a),S.chmod(a,b),0}catch(d){return"undefined"!==typeof S&&d instanceof S.ra||u(d),-d.wa}},z:function(a){try{var b=kb(a);return S.open(b.path, -b.flags,0).fd}catch(d){return"undefined"!==typeof S&&d instanceof S.ra||u(d),-d.wa}},t:function(a,b,d){try{return S.Ic(a,d),0}catch(e){return"undefined"!==typeof S&&e instanceof S.ra||u(e),-e.wa}},c:function(){return 42},x:function(a,b,d){try{return a=F(a),S.chown(a,b,d),0}catch(e){return"undefined"!==typeof S&&e instanceof S.ra||u(e),-e.wa}},B:function(){return-34},E:function(a,b){try{return a=F(a),ib(S.lstat,a,b)}catch(d){return"undefined"!==typeof S&&d instanceof S.ra||u(d),-d.wa}},G:function(a, -b){try{return a=F(a),a=O(a),"/"===a[a.length-1]&&(a=a.substr(0,a.length-1)),S.mkdir(a,b,0),0}catch(d){return"undefined"!==typeof S&&d instanceof S.ra||u(d),-d.wa}},j:function(a,b,d){jb=d;try{var e=F(a);jb+=4;return S.open(e,b,H[jb-4>>2]).fd}catch(f){return"undefined"!==typeof S&&f instanceof S.ra||u(f),-f.wa}},w:function(a,b,d){try{var e=kb(a);return S.read(e,G,b,d)}catch(f){return"undefined"!==typeof S&&f instanceof S.ra||u(f),-f.wa}},r:function(a){try{return a=F(a),S.rmdir(a),0}catch(b){return"undefined"!== -typeof S&&b instanceof S.ra||u(b),-b.wa}},D:function(a,b){try{return a=F(a),ib(S.stat,a,b)}catch(d){return"undefined"!==typeof S&&d instanceof S.ra||u(d),-d.wa}},v:function(a,b){try{return a=F(a),b=F(b),S.symlink(a,b),0}catch(d){return"undefined"!==typeof S&&d instanceof S.ra||u(d),-d.wa}},H:function(a){try{var b=hb;hb=a;return b}catch(d){return"undefined"!==typeof S&&d instanceof S.ra||u(d),-d.wa}},s:function(a){try{return a=F(a),S.unlink(a),0}catch(b){return"undefined"!==typeof S&&b instanceof S.ra|| -u(b),-b.wa}},o:function(){u()},m:function(a,b,d){pa.copyWithin(a,b,b+d)},n:function(a){a>>>=0;var b=pa.length;if(2147483648=d;d*=2){var e=b*(1+.2/d);e=Math.min(e,a+100663296);e=Math.max(16777216,a,e);0>>16);wa(y.buffer);var f=1;break a}catch(h){}f=void 0}if(f)return!0}return!1},p:function(a,b){var d=0;mb().forEach(function(e,f){var h=b+d;f=H[a+4*f>>2]=h;for(h=0;h>0]= -e.charCodeAt(h);G[f>>0]=0;d+=e.length+1});return 0},q:function(a,b){var d=mb();H[a>>2]=d.length;var e=0;d.forEach(function(f){e+=f.length+1});H[b>>2]=e;return 0},C:function(a){try{var b=kb(a);S.close(b);return 0}catch(d){return"undefined"!==typeof S&&d instanceof S.ra||u(d),d.wa}},u:function(a,b){try{var d=kb(a);G[b>>0]=d.tty?2:S.Ba(d.mode)?3:S.Sa(d.mode)?7:4;return 0}catch(e){return"undefined"!==typeof S&&e instanceof S.ra||u(e),e.wa}},l:function(a,b,d,e,f){try{var h=kb(a);a=4294967296*d+(b>>>0); -if(-9007199254740992>=a||9007199254740992<=a)return-61;S.Ha(h,a,e);N=[h.position>>>0,(M=h.position,1<=+Fa(M)?0>>0:~~+Ga((M-+(~~M>>>0))/4294967296)>>>0:0)];H[f>>2]=N[0];H[f+4>>2]=N[1];h.vb&&0===a&&0===e&&(h.vb=null);return 0}catch(k){return"undefined"!==typeof S&&k instanceof S.ra||u(k),k.wa}},y:function(a,b,d,e){try{a:{for(var f=kb(a),h=a=0;h>2],H[b+(8*h+4)>>2],void 0);if(0>k){var l=-1;break a}a+=k}l=a}H[e>>2]=l;return 0}catch(q){return"undefined"!== -typeof S&&q instanceof S.ra||u(q),q.wa}},I:function(){return 0},d:function(){throw"getgrnam: TODO";},e:function(){throw"getpwnam: TODO";},h:function(a){ob();a=new Date(1E3*H[a>>2]);H[16788]=a.getSeconds();H[16789]=a.getMinutes();H[16790]=a.getHours();H[16791]=a.getDate();H[16792]=a.getMonth();H[16793]=a.getFullYear()-1900;H[16794]=a.getDay();var b=new Date(a.getFullYear(),0,1);H[16795]=(a.getTime()-b.getTime())/864E5|0;H[16797]=-(60*a.getTimezoneOffset());var d=(new Date(a.getFullYear(),6,1)).getTimezoneOffset(); -b=b.getTimezoneOffset();a=(d!=b&&a.getTimezoneOffset()==Math.min(b,d))|0;H[16796]=a;a=H[sb()+(a?4:0)>>2];H[16798]=a;return 67152},memory:y,g:function(a){ob();var b=new Date(H[a+20>>2]+1900,H[a+16>>2],H[a+12>>2],H[a+8>>2],H[a+4>>2],H[a>>2],0),d=H[a+32>>2],e=b.getTimezoneOffset(),f=new Date(b.getFullYear(),0,1),h=(new Date(b.getFullYear(),6,1)).getTimezoneOffset(),k=f.getTimezoneOffset(),l=Math.min(k,h);0>d?H[a+32>>2]=Number(h!=k&&l==e):0>2]=b.getDay();H[a+28>>2]=(b.getTime()-f.getTime())/864E5|0;return b.getTime()/1E3|0},f:function(){},table:z,k:function(a){var b=Date.now()/1E3|0;a&&(H[a>>2]=b);return b},i:function(a,b){b?(b=H[b+4>>2],b*=1E3):b=Date.now();a=F(a);try{return S.ad(a,b,b),0}catch(d){return S.Lc(d),-1}}},vb=function(){function a(f){c.asm=f.exports;Ma("wasm-instantiate")}function b(f){a(f.instance)}function d(f){return Ra().then(function(h){return WebAssembly.instantiate(h,e)}).then(f,function(h){v("failed to asynchronously prepare wasm: "+ -h);u(h)})}var e={a:ub};La("wasm-instantiate");if(c.instantiateWasm)try{return c.instantiateWasm(e,a)}catch(f){return v("Module.instantiateWasm callback failed with error: "+f),!1}(function(){if(ma||"function"!==typeof WebAssembly.instantiateStreaming||Oa()||Na("file://")||"function"!==typeof fetch)return d(b);fetch(L,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(b,function(h){v("wasm streaming compile failed: "+h);v("falling back to ArrayBuffer instantiation"); -d(b)})})})();return{}}();c.asm=vb; -var Sa=c.___wasm_call_ctors=function(){return(Sa=c.___wasm_call_ctors=c.asm.J).apply(null,arguments)},wb=c._emscripten_bind_RARHeaderDataEx_RARHeaderDataEx_0=function(){return(wb=c._emscripten_bind_RARHeaderDataEx_RARHeaderDataEx_0=c.asm.K).apply(null,arguments)},xb=c._emscripten_bind_RARHeaderDataEx_set_UnpSize_1=function(){return(xb=c._emscripten_bind_RARHeaderDataEx_set_UnpSize_1=c.asm.L).apply(null,arguments)},yb=c._emscripten_bind_RARHeaderDataEx_set_PackSize_1=function(){return(yb=c._emscripten_bind_RARHeaderDataEx_set_PackSize_1= -c.asm.M).apply(null,arguments)},zb=c._emscripten_bind_RARHeaderDataEx_get_Flags_0=function(){return(zb=c._emscripten_bind_RARHeaderDataEx_get_Flags_0=c.asm.N).apply(null,arguments)},Ab=c._emscripten_bind_RARHeaderDataEx_set_Flags_1=function(){return(Ab=c._emscripten_bind_RARHeaderDataEx_set_Flags_1=c.asm.O).apply(null,arguments)},Bb=c._emscripten_bind_RARHeaderDataEx___destroy___0=function(){return(Bb=c._emscripten_bind_RARHeaderDataEx___destroy___0=c.asm.P).apply(null,arguments)},Cb=c._emscripten_bind_RAROpenArchiveDataEx_RAROpenArchiveDataEx_0= -function(){return(Cb=c._emscripten_bind_RAROpenArchiveDataEx_RAROpenArchiveDataEx_0=c.asm.Q).apply(null,arguments)},Db=c._emscripten_bind_RAROpenArchiveDataEx_get_ArcName_0=function(){return(Db=c._emscripten_bind_RAROpenArchiveDataEx_get_ArcName_0=c.asm.R).apply(null,arguments)},Eb=c._emscripten_bind_RAROpenArchiveDataEx_set_ArcName_1=function(){return(Eb=c._emscripten_bind_RAROpenArchiveDataEx_set_ArcName_1=c.asm.S).apply(null,arguments)},Fb=c._emscripten_bind_RAROpenArchiveDataEx_get_OpenMode_0= -function(){return(Fb=c._emscripten_bind_RAROpenArchiveDataEx_get_OpenMode_0=c.asm.T).apply(null,arguments)},Gb=c._emscripten_bind_RAROpenArchiveDataEx_set_OpenMode_1=function(){return(Gb=c._emscripten_bind_RAROpenArchiveDataEx_set_OpenMode_1=c.asm.U).apply(null,arguments)},Hb=c._emscripten_bind_RAROpenArchiveDataEx_get_Callback_0=function(){return(Hb=c._emscripten_bind_RAROpenArchiveDataEx_get_Callback_0=c.asm.V).apply(null,arguments)},Ib=c._emscripten_bind_RAROpenArchiveDataEx_set_Callback_1=function(){return(Ib= -c._emscripten_bind_RAROpenArchiveDataEx_set_Callback_1=c.asm.W).apply(null,arguments)},Jb=c._emscripten_bind_RAROpenArchiveDataEx_get_OpenResult_0=function(){return(Jb=c._emscripten_bind_RAROpenArchiveDataEx_get_OpenResult_0=c.asm.X).apply(null,arguments)},Kb=c._emscripten_bind_RAROpenArchiveDataEx_set_OpenResult_1=function(){return(Kb=c._emscripten_bind_RAROpenArchiveDataEx_set_OpenResult_1=c.asm.Y).apply(null,arguments)},Lb=c._emscripten_bind_RAROpenArchiveDataEx_get_Flags_0=function(){return(Lb= -c._emscripten_bind_RAROpenArchiveDataEx_get_Flags_0=c.asm.Z).apply(null,arguments)},Mb=c._emscripten_bind_RAROpenArchiveDataEx_set_Flags_1=function(){return(Mb=c._emscripten_bind_RAROpenArchiveDataEx_set_Flags_1=c.asm._).apply(null,arguments)},Nb=c._emscripten_bind_RAROpenArchiveDataEx___destroy___0=function(){return(Nb=c._emscripten_bind_RAROpenArchiveDataEx___destroy___0=c.asm.$).apply(null,arguments)},Ob=c._emscripten_bind_VoidPtr___destroy___0=function(){return(Ob=c._emscripten_bind_VoidPtr___destroy___0= -c.asm.aa).apply(null,arguments)},Pb=c._emscripten_bind_RARHeaderDataEx_get_FileNameW_0=function(){return(Pb=c._emscripten_bind_RARHeaderDataEx_get_FileNameW_0=c.asm.ba).apply(null,arguments)},Qb=c._emscripten_bind_RARHeaderDataEx_set_FileNameW_1=function(){return(Qb=c._emscripten_bind_RARHeaderDataEx_set_FileNameW_1=c.asm.ca).apply(null,arguments)},Rb=c._emscripten_bind_RARHeaderDataEx_get_UnpSize_0=function(){return(Rb=c._emscripten_bind_RARHeaderDataEx_get_UnpSize_0=c.asm.da).apply(null,arguments)}, -Sb=c._emscripten_bind_RARHeaderDataEx_get_PackSize_0=function(){return(Sb=c._emscripten_bind_RARHeaderDataEx_get_PackSize_0=c.asm.ea).apply(null,arguments)};c._free=function(){return(c._free=c.asm.fa).apply(null,arguments)};var ua=c._malloc=function(){return(ua=c._malloc=c.asm.ga).apply(null,arguments)},Za=c.___errno_location=function(){return(Za=c.___errno_location=c.asm.ha).apply(null,arguments)};c._RAROpenArchiveEx=function(){return(c._RAROpenArchiveEx=c.asm.ia).apply(null,arguments)}; -c._RARCloseArchive=function(){return(c._RARCloseArchive=c.asm.ja).apply(null,arguments)};c._RARReadHeaderEx=function(){return(c._RARReadHeaderEx=c.asm.ka).apply(null,arguments)};c._RARProcessFileW=function(){return(c._RARProcessFileW=c.asm.la).apply(null,arguments)};c._RARSetPassword=function(){return(c._RARSetPassword=c.asm.ma).apply(null,arguments)}; -var sb=c.__get_tzname=function(){return(sb=c.__get_tzname=c.asm.na).apply(null,arguments)},rb=c.__get_daylight=function(){return(rb=c.__get_daylight=c.asm.oa).apply(null,arguments)},qb=c.__get_timezone=function(){return(qb=c.__get_timezone=c.asm.pa).apply(null,arguments)};c.dynCall_vi=function(){return(c.dynCall_vi=c.asm.qa).apply(null,arguments)};c.asm=vb;c.getMemory=function(a){if(Da)a=ua(a);else{var b=H[16784];H[16784]=b+a+15&-16;a=b}return a};c.UTF8ToString=F;c.stringToUTF8=ra; -c.addRunDependency=La;c.removeRunDependency=Ma;c.FS_createFolder=S.Tb;c.FS_createPath=S.Wb;c.FS_createDataFile=S.hb;c.FS_createPreloadedFile=S.Xb;c.FS_createLazyFile=S.Ub;c.FS_createLink=S.Vb;c.FS_createDevice=S.Ia;c.FS_unlink=S.unlink; -c.addFunction=function(a,b){if(!x){x=new WeakMap;for(var d=0;d=Yb){assert(0>=1;break;case 4:e>>=2;break;case 8:e>>=3}for(var f=0;f=e);)++d;if(16f?e+=String.fromCharCode(f):(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else e+=String.fromCharCode(f)}return e}function F(a,b){return a?D(pa,a,b):""} +function qa(a,b,d,e){if(!(0=k){var l=a.charCodeAt(++h);k=65536+((k&1023)<<10)|l&1023}if(127>=k){if(d>=e)break;b[d++]=k}else{if(2047>=k){if(d+1>=e)break;b[d++]=192|k>>6}else{if(65535>=k){if(d+2>=e)break;b[d++]=224|k>>12}else{if(d+3>=e)break;b[d++]=240|k>>18;b[d++]=128|k>>12&63}b[d++]=128|k>>6&63}b[d++]=128|k&63}}b[d]=0;return d-f}function ra(a,b,d){return qa(a,pa,b,d)} +function sa(a){for(var b=0,d=0;d=e&&(e=65536+((e&1023)<<10)|a.charCodeAt(++d)&1023);127>=e?++b:b=2047>=e?b+2:65535>=e?b+3:b+4}return b}function ta(a){var b=sa(a)+1,d=ua(b);d&&qa(a,G,d,b);return d}var va,G,pa,H; +function wa(a){va=a;c.HEAP8=G=new Int8Array(a);c.HEAP16=new Int16Array(a);c.HEAP32=H=new Int32Array(a);c.HEAPU8=pa=new Uint8Array(a);c.HEAPU16=new Uint16Array(a);c.HEAPU32=new Uint32Array(a);c.HEAPF32=new Float32Array(a);c.HEAPF64=new Float64Array(a)}var xa=c.INITIAL_MEMORY||16777216;c.wasmMemory?y=c.wasmMemory:y=new WebAssembly.Memory({initial:xa/65536,maximum:32768});y&&(va=y.buffer);xa=va.byteLength;wa(va);H[16784]=5310176; +function ya(a){for(;0>2]=a}function R(){for(var a="",b=!1,d=arguments.length-1;-1<=d&&!b;d--){b=0<=d?arguments[d]:S.cwd();if("string"!==typeof b)throw new TypeError("Arguments to path.resolve must be strings");if(!b)return"";a=b+"/"+a;b="/"===b.charAt(0)}a=Va(a.split("/").filter(function(e){return!!e}),!b).join("/");return(b?"/":"")+a||"."} +function $a(a,b){function d(k){for(var l=0;lq?[]:k.slice(l,q-l+1)}a=R(a).substr(1);b=R(b).substr(1);a=d(a.split("/"));b=d(b.split("/"));for(var e=Math.min(a.length,b.length),f=e,h=0;h=b||(b=Math.max(b,d*(1048576>d?2:1.125)>>>0),0!=d&&(b=Math.max(b,256)),d=a.sa,a.sa=new Uint8Array(b),0b)a.sa.length=b;else for(;a.sa.length=a.node.za)return 0;a=Math.min(a.node.za-f,e);if(8b)throw new S.ra(28);return b},Xa:function(a,b,d){T.ac(a.node,b+d);a.node.za=Math.max(a.node.za,b+d)},ab:function(a,b,d,e,f,h,k){if(!S.isFile(a.node.mode))throw new S.ra(43);a=a.node.sa;if(k&2||a.buffer!==b.buffer){if(0=a.node.size)return 0;a=a.node.sa.slice(f,f+e);e=U.Fb.readAsArrayBuffer(a);b.set(new Uint8Array(e),d);return a.size},write:function(){throw new S.ra(29); +},Ha:function(a,b,d){1===d?b+=a.position:2===d&&S.isFile(a.node.mode)&&(b+=a.node.size);if(0>b)throw new S.ra(28);return b}}},S={root:null,cb:[],Zb:{},streams:[],Rc:1,La:null,Yb:"/",xb:!1,jc:!0,Da:{},oc:{mc:{tc:1,uc:2}},ra:null,ub:{},Gc:null,nb:0,Lc:function(a){if(!(a instanceof S.ra)){a:{var b=Error();if(!b.stack){try{throw Error();}catch(d){b=d}if(!b.stack){b="(no stack trace available)";break a}}b=b.stack.toString()}c.extraStackTrace&&(b+="\n"+c.extraStackTrace());b=Ta(b);throw a+" : "+b;}return Ya(a.wa)}, +ya:function(a,b){a=R(S.cwd(),a);b=b||{};if(!a)return{path:"",node:null};var d={tb:!0,Gb:0},e;for(e in d)void 0===b[e]&&(b[e]=d[e]);if(8>>0)%S.La.length},hc:function(a){var b=S.wb(a.parent.id,a.name);a.Ra=S.La[b];S.La[b]=a},ic:function(a){var b=S.wb(a.parent.id,a.name);if(S.La[b]===a)S.La[b]=a.Ra;else for(b=S.La[b];b;){if(b.Ra===a){b.Ra=a.Ra;break}b=b.Ra}},Na:function(a,b){var d=S.Oc(a);if(d)throw new S.ra(d,a);for(d= +S.La[S.wb(a.id,b)];d;d=d.Ra){var e=d.name;if(d.parent.id===a.id&&e===b)return d}return S.lookup(a,b)},createNode:function(a,b,d,e){a=new S.rc(a,b,d,e);S.hc(a);return a},sb:function(a){S.ic(a)},kb:function(a){return a===a.parent},Pa:function(a){return!!a.bb},isFile:function(a){return 32768===(a&61440)},Ba:function(a){return 16384===(a&61440)},Sa:function(a){return 40960===(a&61440)},jb:function(a){return 8192===(a&61440)},Mc:function(a){return 24576===(a&61440)},isFIFO:function(a){return 4096===(a& +61440)},isSocket:function(a){return 49152===(a&49152)},Hc:{r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218},Qc:function(a){var b=S.Hc[a];if("undefined"===typeof b)throw Error("Unknown file open mode: "+a);return b},bc:function(a){var b=["r","w","rw"][a&3];a&512&&(b+="w");return b},Oa:function(a,b){if(S.jc)return 0;if(-1===b.indexOf("r")||a.mode&292){if(-1!==b.indexOf("w")&&!(a.mode&146)||-1!==b.indexOf("x")&&!(a.mode&73))return 2}else return 2; +return 0},Oc:function(a){var b=S.Oa(a,"x");return b?b:a.ta.lookup?0:2},Bb:function(a,b){try{return S.Na(a,b),20}catch(d){}return S.Oa(a,"wx")},lb:function(a,b,d){try{var e=S.Na(a,b)}catch(f){return f.wa}if(a=S.Oa(a,"wx"))return a;if(d){if(!S.Ba(e.mode))return 54;if(S.kb(e)||S.Ja(e)===S.cwd())return 10}else if(S.Ba(e.mode))return 31;return 0},Pc:function(a,b){return a?S.Sa(a.mode)?32:S.Ba(a.mode)&&("r"!==S.bc(b)||b&512)?31:S.Oa(a,S.bc(b)):44},sc:4096,Sc:function(a,b){b=b||S.sc;for(a=a||0;a<=b;a++)if(!S.streams[a])return a; +throw new S.ra(33);},Ya:function(a){return S.streams[a]},Fc:function(a,b,d){S.pb||(S.pb=function(){},S.pb.prototype={object:{get:function(){return this.node},set:function(h){this.node=h}}});var e=new S.pb,f;for(f in a)e[f]=a[f];a=e;b=S.Sc(b,d);a.fd=b;return S.streams[b]=a},zc:function(a){S.streams[a]=null},yc:{open:function(a){a.ua=S.Kc(a.node.rdev).ua;a.ua.open&&a.ua.open(a)},Ha:function(){throw new S.ra(70);}},Ab:function(a){return a>>8},ld:function(a){return a&255},Qa:function(a,b){return a<<8| +b},Hb:function(a,b){S.Zb[a]={ua:b}},Kc:function(a){return S.Zb[a]},dc:function(a){var b=[];for(a=[a];a.length;){var d=a.pop();b.push(d);a.push.apply(a,d.cb)}return b},nc:function(a,b){function d(k){S.nb--;return b(k)}function e(k){if(k){if(!e.Ea)return e.Ea=!0,d(k)}else++h>=f.length&&d(null)}"function"===typeof a&&(b=a,a=!1);S.nb++;1b)throw new S.ra(28);var d;"string"===typeof a?d=S.ya(a,{Fa:!0}).node:d=a;if(!d.ta.Ca)throw new S.ra(63);if(S.Ba(d.mode))throw new S.ra(31);if(!S.isFile(d.mode))throw new S.ra(28);if(a=S.Oa(d,"w"))throw new S.ra(a);d.ta.Ca(d,{size:b,timestamp:Date.now()})},Ic:function(a,b){a=S.Ya(a);if(!a)throw new S.ra(8);if(0===(a.flags&2097155))throw new S.ra(28);S.truncate(a.node,b)},ad:function(a, +b,d){a=S.ya(a,{Fa:!0}).node;a.ta.Ca(a,{timestamp:Math.max(b,d)})},open:function(a,b,d,e,f){if(""===a)throw new S.ra(44);b="string"===typeof b?S.Qc(b):b;d=b&64?("undefined"===typeof d?438:d)&4095|32768:0;if("object"===typeof a)var h=a;else{a=O(a);try{h=S.ya(a,{Fa:!(b&131072)}).node}catch(l){}}var k=!1;if(b&64)if(h){if(b&128)throw new S.ra(20);}else h=S.Ka(a,d,0),k=!0;if(!h)throw new S.ra(44);S.jb(h.mode)&&(b&=-513);if(b&65536&&!S.Ba(h.mode))throw new S.ra(54);if(!k&&(d=S.Pc(h,b)))throw new S.ra(d); +b&512&&S.truncate(h,0);b&=-131713;e=S.Fc({node:h,path:S.Ja(h),flags:b,seekable:!0,position:0,ua:h.ua,Zc:[],error:!1},e,f);e.ua.open&&e.ua.open(e);!c.logReadFiles||b&1||(S.Eb||(S.Eb={}),a in S.Eb||(S.Eb[a]=1,v("FS.trackingDelegate error on read file: "+a)));try{S.Da.onOpenFile&&(f=0,1!==(b&2097155)&&(f|=S.oc.mc.tc),0!==(b&2097155)&&(f|=S.oc.mc.uc),S.Da.onOpenFile(a,f))}catch(l){v("FS.trackingDelegate['onOpenFile']('"+a+"', flags) threw an exception: "+l.message)}return e},close:function(a){if(S.$a(a))throw new S.ra(8); +a.vb&&(a.vb=null);try{a.ua.close&&a.ua.close(a)}catch(b){throw b;}finally{S.zc(a.fd)}a.fd=null},$a:function(a){return null===a.fd},Ha:function(a,b,d){if(S.$a(a))throw new S.ra(8);if(!a.seekable||!a.ua.Ha)throw new S.ra(70);if(0!=d&&1!=d&&2!=d)throw new S.ra(28);a.position=a.ua.Ha(a,b,d);a.Zc=[];return a.position},read:function(a,b,d,e,f){if(0>e||0>f)throw new S.ra(28);if(S.$a(a))throw new S.ra(8);if(1===(a.flags&2097155))throw new S.ra(8);if(S.Ba(a.node.mode))throw new S.ra(31);if(!a.ua.read)throw new S.ra(28); +var h="undefined"!==typeof f;if(!h)f=a.position;else if(!a.seekable)throw new S.ra(70);b=a.ua.read(a,b,d,e,f);h||(a.position+=b);return b},write:function(a,b,d,e,f,h){if(0>e||0>f)throw new S.ra(28);if(S.$a(a))throw new S.ra(8);if(0===(a.flags&2097155))throw new S.ra(8);if(S.Ba(a.node.mode))throw new S.ra(31);if(!a.ua.write)throw new S.ra(28);a.seekable&&a.flags&1024&&S.Ha(a,0,2);var k="undefined"!==typeof f;if(!k)f=a.position;else if(!a.seekable)throw new S.ra(70);b=a.ua.write(a,b,d,e,f,h);k||(a.position+= +b);try{if(a.path&&S.Da.onWriteToFile)S.Da.onWriteToFile(a.path)}catch(l){v("FS.trackingDelegate['onWriteToFile']('"+a.path+"') threw an exception: "+l.message)}return b},Xa:function(a,b,d){if(S.$a(a))throw new S.ra(8);if(0>b||0>=d)throw new S.ra(28);if(0===(a.flags&2097155))throw new S.ra(8);if(!S.isFile(a.node.mode)&&!S.Ba(a.node.mode))throw new S.ra(43);if(!a.ua.Xa)throw new S.ra(138);a.ua.Xa(a,b,d)},ab:function(a,b,d,e,f,h,k){if(0!==(h&2)&&0===(k&2)&&2!==(a.flags&2097155))throw new S.ra(2);if(1=== +(a.flags&2097155))throw new S.ra(2);if(!a.ua.ab)throw new S.ra(43);return a.ua.ab(a,b,d,e,f,h,k)},eb:function(a,b,d,e,f){return a&&a.ua.eb?a.ua.eb(a,b,d,e,f):0},nd:function(){return 0},kc:function(a,b,d){if(!a.ua.kc)throw new S.ra(59);return a.ua.kc(a,b,d)},readFile:function(a,b){b=b||{};b.flags=b.flags||"r";b.encoding=b.encoding||"binary";if("utf8"!==b.encoding&&"binary"!==b.encoding)throw Error('Invalid encoding type "'+b.encoding+'"');var d,e=S.open(a,b.flags);a=S.stat(a).size;var f=new Uint8Array(a); +S.read(e,f,0,a,0);"utf8"===b.encoding?d=D(f,0):"binary"===b.encoding&&(d=f);S.close(e);return d},writeFile:function(a,b,d){d=d||{};d.flags=d.flags||"w";a=S.open(a,d.flags,d.mode);if("string"===typeof b){var e=new Uint8Array(sa(b)+1);b=qa(b,e,0,e.length);S.write(a,e,0,b,void 0,d.xc)}else if(ArrayBuffer.isView(b))S.write(a,b,0,b.byteLength,void 0,d.xc);else throw Error("Unsupported data type");S.close(a)},cwd:function(){return S.Yb},chdir:function(a){a=S.ya(a,{Fa:!0});if(null===a.node)throw new S.ra(44); +if(!S.Ba(a.node.mode))throw new S.ra(54);var b=S.Oa(a.node,"x");if(b)throw new S.ra(b);S.Yb=a.path},Bc:function(){S.mkdir("/tmp");S.mkdir("/home");S.mkdir("/home/web_user")},Ac:function(){S.mkdir("/dev");S.Hb(S.Qa(1,3),{read:function(){return 0},write:function(e,f,h,k){return k}});S.mb("/dev/null",S.Qa(1,3));bb(S.Qa(5,0),eb);bb(S.Qa(6,0),fb);S.mb("/dev/tty",S.Qa(5,0));S.mb("/dev/tty1",S.Qa(6,0));if("object"===typeof crypto&&"function"===typeof crypto.getRandomValues){var a=new Uint8Array(1);var b= +function(){crypto.getRandomValues(a);return a[0]}}else if(ea)try{var d=require("crypto");b=function(){return d.randomBytes(1)[0]}}catch(e){}b||(b=function(){u("random_device")});S.Ia("/dev","random",b);S.Ia("/dev","urandom",b);S.mkdir("/dev/shm");S.mkdir("/dev/shm/tmp")},Dc:function(){S.mkdir("/proc");S.mkdir("/proc/self");S.mkdir("/proc/self/fd");S.Aa({Aa:function(){var a=S.createNode("/proc/self","fd",16895,73);a.ta={lookup:function(b,d){var e=S.Ya(+d);if(!e)throw new S.ra(8);b={parent:null,Aa:{lc:"fake"}, +ta:{readlink:function(){return e.path}}};return b.parent=b}};return a}},{},"/proc/self/fd")},Ec:function(){c.stdin?S.Ia("/dev","stdin",c.stdin):S.symlink("/dev/tty","/dev/stdin");c.stdout?S.Ia("/dev","stdout",null,c.stdout):S.symlink("/dev/tty","/dev/stdout");c.stderr?S.Ia("/dev","stderr",null,c.stderr):S.symlink("/dev/tty1","/dev/stderr");S.open("/dev/stdin","r");S.open("/dev/stdout","w");S.open("/dev/stderr","w")},$b:function(){S.ra||(S.ra=function(a,b){this.node=b;this.Xc=function(d){this.wa=d}; +this.Xc(a);this.message="FS error"},S.ra.prototype=Error(),S.ra.prototype.constructor=S.ra,[44].forEach(function(a){S.ub[a]=new S.ra(a);S.ub[a].stack=""}))},Yc:function(){S.$b();S.La=Array(4096);S.Aa(T,{},"/");S.Bc();S.Ac();S.Dc();S.Gc={MEMFS:T,WORKERFS:U}},Za:function(a,b,d){S.Za.xb=!0;S.$b();c.stdin=a||c.stdin;c.stdout=b||c.stdout;c.stderr=d||c.stderr;S.Ec()},quit:function(){S.Za.xb=!1;var a=c._fflush;a&&a(0);for(a=0;athis.length-1||0>n)){var t=n%this.chunkSize;return this.fc(n/this.chunkSize|0)[t]}};h.prototype.fb=function(n){this.fc=n};h.prototype.Rb=function(){var n=new XMLHttpRequest;n.open("HEAD",d,!1);n.send(null);if(!(200<=n.status&&300>n.status||304===n.status))throw Error("Couldn't load "+ +d+". Status: "+n.status);var t=Number(n.getResponseHeader("Content-length")),w,C=(w=n.getResponseHeader("Accept-Ranges"))&&"bytes"===w;n=(w=n.getResponseHeader("Content-Encoding"))&&"gzip"===w;var B=1048576;C||(B=t);var A=this;A.fb(function(I){var J=I*B,aa=(I+1)*B-1;aa=Math.min(aa,t-1);if("undefined"===typeof A.Ea[I]){var bc=A.Ea;if(J>aa)throw Error("invalid range ("+J+", "+aa+") or no bytes requested!");if(aa>t-1)throw Error("only "+t+" bytes available! programmer error!");var E=new XMLHttpRequest; +E.open("GET",d,!1);t!==B&&E.setRequestHeader("Range","bytes="+J+"-"+aa);"undefined"!=typeof Uint8Array&&(E.responseType="arraybuffer");E.overrideMimeType&&E.overrideMimeType("text/plain; charset=x-user-defined");E.send(null);if(!(200<=E.status&&300>E.status||304===E.status))throw Error("Couldn't load "+d+". Status: "+E.status);J=void 0!==E.response?new Uint8Array(E.response||[]):db(E.responseText||"",!0);bc[I]=J}if("undefined"===typeof A.Ea[I])throw Error("doXHR failed!");return A.Ea[I]});if(n||!t)B= +t=1,B=t=this.fc(0).length,ka("LazyFiles on gzip forces download of the whole file when length is accessed");this.wc=t;this.vc=B;this.zb=!0};if("undefined"!==typeof XMLHttpRequest){if(!m)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var k=new h;Object.defineProperties(k,{length:{get:function(){this.zb||this.Rb();return this.wc}},chunkSize:{get:function(){this.zb||this.Rb();return this.vc}}});k={yb:!1,sa:k}}else k={yb:!1,url:d}; +var l=S.Cc(a,b,k,e,f);k.sa?l.sa=k.sa:k.url&&(l.sa=null,l.url=k.url);Object.defineProperties(l,{za:{get:function(){return this.sa.length}}});var q={};Object.keys(l.ua).forEach(function(n){var t=l.ua[n];q[n]=function(){if(!S.cc(l))throw new S.ra(29);return t.apply(null,arguments)}});q.read=function(n,t,w,C,B){if(!S.cc(l))throw new S.ra(29);n=n.node.sa;if(B>=n.length)return 0;C=Math.min(n.length-B,C);if(n.slice)for(var A=0;A>2]=e.dev;H[d+4>>2]=0;H[d+8>>2]=e.ino;H[d+12>>2]=e.mode;H[d+16>>2]=e.nlink;H[d+20>>2]=e.uid;H[d+24>>2]=e.gid;H[d+28>>2]=e.rdev;H[d+32>>2]=0;N=[e.size>>>0,(M=e.size,1<=+Fa(M)?0>>0:~~+Ga((M-+(~~M>>>0))/4294967296)>>>0:0)];H[d+40>>2]=N[0];H[d+44>>2]=N[1];H[d+48>>2]=4096;H[d+52>>2]=e.blocks;H[d+56>>2]=e.atime.getTime()/1E3|0;H[d+60>>2]=0;H[d+64>>2]=e.mtime.getTime()/ +1E3|0;H[d+68>>2]=0;H[d+72>>2]=e.ctime.getTime()/1E3|0;H[d+76>>2]=0;N=[e.ino>>>0,(M=e.ino,1<=+Fa(M)?0>>0:~~+Ga((M-+(~~M>>>0))/4294967296)>>>0:0)];H[d+80>>2]=N[0];H[d+84>>2]=N[1];return 0}var jb=void 0;function kb(a){a=S.Ya(a);if(!a)throw new S.ra(8);return a}var lb={}; +function mb(){if(!nb){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"===typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:ca||"./this.program"},b;for(b in lb)a[b]=lb[b];var d=[];for(b in a)d.push(b+"="+a[b]);nb=d}return nb}var nb;ra("GMT",67200,4); +function ob(){function a(h){return(h=h.toTimeString().match(/\(([A-Za-z ]+)\)$/))?h[1]:"GMT"}if(!pb){pb=!0;H[qb()>>2]=60*(new Date).getTimezoneOffset();var b=(new Date).getFullYear(),d=new Date(b,0,1);b=new Date(b,6,1);H[rb()>>2]=Number(d.getTimezoneOffset()!=b.getTimezoneOffset());var e=a(d),f=a(b);e=ta(e);f=ta(f);b.getTimezoneOffset()>2]=e,H[sb()+4>>2]=f):(H[sb()>>2]=f,H[sb()+4>>2]=e)}}var pb; +function tb(a,b,d,e){a||(a=this);this.parent=a;this.Aa=a.Aa;this.bb=null;this.id=S.Rc++;this.name=b;this.mode=d;this.ta={};this.ua={};this.rdev=e}Object.defineProperties(tb.prototype,{read:{get:function(){return 365===(this.mode&365)},set:function(a){a?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146===(this.mode&146)},set:function(a){a?this.mode|=146:this.mode&=-147}},Nc:{get:function(){return S.Ba(this.mode)}},yb:{get:function(){return S.jb(this.mode)}}});S.rc=tb;S.Yc();var gb; +c.FS_createFolder=S.Tb;c.FS_createPath=S.Wb;c.FS_createDataFile=S.hb;c.FS_createPreloadedFile=S.Xb;c.FS_createLazyFile=S.Ub;c.FS_createLink=S.Vb;c.FS_createDevice=S.Ia;c.FS_unlink=S.unlink;function db(a,b){var d=Array(sa(a)+1);a=qa(a,d,0,d.length);b&&(d.length=a);return d} +var ub={b:function(a){return ua(a)},a:function(a){"uncaught_exception"in Ua?Ua.Ea++:Ua.Ea=1;throw a;},A:function(a,b){try{a=F(a);if(b&-8)var d=-28;else{var e;(e=S.ya(a,{Fa:!0}).node)?(a="",b&4&&(a+="r"),b&2&&(a+="w"),b&1&&(a+="x"),d=a&&S.Oa(e,a)?-2:0):d=-44}return d}catch(f){return"undefined"!==typeof S&&f instanceof S.ra||u(f),-f.wa}},F:function(a,b){try{return a=F(a),S.chmod(a,b),0}catch(d){return"undefined"!==typeof S&&d instanceof S.ra||u(d),-d.wa}},z:function(a){try{var b=kb(a);return S.open(b.path, +b.flags,0).fd}catch(d){return"undefined"!==typeof S&&d instanceof S.ra||u(d),-d.wa}},t:function(a,b,d){try{return S.Ic(a,d),0}catch(e){return"undefined"!==typeof S&&e instanceof S.ra||u(e),-e.wa}},c:function(){return 42},x:function(a,b,d){try{return a=F(a),S.chown(a,b,d),0}catch(e){return"undefined"!==typeof S&&e instanceof S.ra||u(e),-e.wa}},B:function(){return-34},E:function(a,b){try{return a=F(a),ib(S.lstat,a,b)}catch(d){return"undefined"!==typeof S&&d instanceof S.ra||u(d),-d.wa}},G:function(a, +b){try{return a=F(a),a=O(a),"/"===a[a.length-1]&&(a=a.substr(0,a.length-1)),S.mkdir(a,b,0),0}catch(d){return"undefined"!==typeof S&&d instanceof S.ra||u(d),-d.wa}},j:function(a,b,d){jb=d;try{var e=F(a);jb+=4;return S.open(e,b,H[jb-4>>2]).fd}catch(f){return"undefined"!==typeof S&&f instanceof S.ra||u(f),-f.wa}},w:function(a,b,d){try{var e=kb(a);return S.read(e,G,b,d)}catch(f){return"undefined"!==typeof S&&f instanceof S.ra||u(f),-f.wa}},r:function(a){try{return a=F(a),S.rmdir(a),0}catch(b){return"undefined"!== +typeof S&&b instanceof S.ra||u(b),-b.wa}},D:function(a,b){try{return a=F(a),ib(S.stat,a,b)}catch(d){return"undefined"!==typeof S&&d instanceof S.ra||u(d),-d.wa}},v:function(a,b){try{return a=F(a),b=F(b),S.symlink(a,b),0}catch(d){return"undefined"!==typeof S&&d instanceof S.ra||u(d),-d.wa}},H:function(a){try{var b=hb;hb=a;return b}catch(d){return"undefined"!==typeof S&&d instanceof S.ra||u(d),-d.wa}},s:function(a){try{return a=F(a),S.unlink(a),0}catch(b){return"undefined"!==typeof S&&b instanceof S.ra|| +u(b),-b.wa}},o:function(){u()},m:function(a,b,d){pa.copyWithin(a,b,b+d)},n:function(a){a>>>=0;var b=pa.length;if(2147483648=d;d*=2){var e=b*(1+.2/d);e=Math.min(e,a+100663296);e=Math.max(16777216,a,e);0>>16);wa(y.buffer);var f=1;break a}catch(h){}f=void 0}if(f)return!0}return!1},p:function(a,b){var d=0;mb().forEach(function(e,f){var h=b+d;f=H[a+4*f>>2]=h;for(h=0;h>0]= +e.charCodeAt(h);G[f>>0]=0;d+=e.length+1});return 0},q:function(a,b){var d=mb();H[a>>2]=d.length;var e=0;d.forEach(function(f){e+=f.length+1});H[b>>2]=e;return 0},C:function(a){try{var b=kb(a);S.close(b);return 0}catch(d){return"undefined"!==typeof S&&d instanceof S.ra||u(d),d.wa}},u:function(a,b){try{var d=kb(a);G[b>>0]=d.tty?2:S.Ba(d.mode)?3:S.Sa(d.mode)?7:4;return 0}catch(e){return"undefined"!==typeof S&&e instanceof S.ra||u(e),e.wa}},l:function(a,b,d,e,f){try{var h=kb(a);a=4294967296*d+(b>>>0); +if(-9007199254740992>=a||9007199254740992<=a)return-61;S.Ha(h,a,e);N=[h.position>>>0,(M=h.position,1<=+Fa(M)?0>>0:~~+Ga((M-+(~~M>>>0))/4294967296)>>>0:0)];H[f>>2]=N[0];H[f+4>>2]=N[1];h.vb&&0===a&&0===e&&(h.vb=null);return 0}catch(k){return"undefined"!==typeof S&&k instanceof S.ra||u(k),k.wa}},y:function(a,b,d,e){try{a:{for(var f=kb(a),h=a=0;h>2],H[b+(8*h+4)>>2],void 0);if(0>k){var l=-1;break a}a+=k}l=a}H[e>>2]=l;return 0}catch(q){return"undefined"!== +typeof S&&q instanceof S.ra||u(q),q.wa}},I:function(){return 0},d:function(){throw"getgrnam: TODO";},e:function(){throw"getpwnam: TODO";},h:function(a){ob();a=new Date(1E3*H[a>>2]);H[16788]=a.getSeconds();H[16789]=a.getMinutes();H[16790]=a.getHours();H[16791]=a.getDate();H[16792]=a.getMonth();H[16793]=a.getFullYear()-1900;H[16794]=a.getDay();var b=new Date(a.getFullYear(),0,1);H[16795]=(a.getTime()-b.getTime())/864E5|0;H[16797]=-(60*a.getTimezoneOffset());var d=(new Date(a.getFullYear(),6,1)).getTimezoneOffset(); +b=b.getTimezoneOffset();a=(d!=b&&a.getTimezoneOffset()==Math.min(b,d))|0;H[16796]=a;a=H[sb()+(a?4:0)>>2];H[16798]=a;return 67152},memory:y,g:function(a){ob();var b=new Date(H[a+20>>2]+1900,H[a+16>>2],H[a+12>>2],H[a+8>>2],H[a+4>>2],H[a>>2],0),d=H[a+32>>2],e=b.getTimezoneOffset(),f=new Date(b.getFullYear(),0,1),h=(new Date(b.getFullYear(),6,1)).getTimezoneOffset(),k=f.getTimezoneOffset(),l=Math.min(k,h);0>d?H[a+32>>2]=Number(h!=k&&l==e):0>2]=b.getDay();H[a+28>>2]=(b.getTime()-f.getTime())/864E5|0;return b.getTime()/1E3|0},f:function(){},table:z,k:function(a){var b=Date.now()/1E3|0;a&&(H[a>>2]=b);return b},i:function(a,b){b?(b=H[b+4>>2],b*=1E3):b=Date.now();a=F(a);try{return S.ad(a,b,b),0}catch(d){return S.Lc(d),-1}}},vb=function(){function a(f){c.asm=f.exports;Ma("wasm-instantiate")}function b(f){a(f.instance)}function d(f){return Ra().then(function(h){return WebAssembly.instantiate(h,e)}).then(f,function(h){v("failed to asynchronously prepare wasm: "+ +h);u(h)})}var e={a:ub};La("wasm-instantiate");if(c.instantiateWasm)try{return c.instantiateWasm(e,a)}catch(f){return v("Module.instantiateWasm callback failed with error: "+f),!1}(function(){if(ma||"function"!==typeof WebAssembly.instantiateStreaming||Oa()||Na("file://")||"function"!==typeof fetch)return d(b);fetch(L,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(b,function(h){v("wasm streaming compile failed: "+h);v("falling back to ArrayBuffer instantiation"); +d(b)})})})();return{}}();c.asm=vb; +var Sa=c.___wasm_call_ctors=function(){return(Sa=c.___wasm_call_ctors=c.asm.J).apply(null,arguments)},wb=c._emscripten_bind_RARHeaderDataEx_RARHeaderDataEx_0=function(){return(wb=c._emscripten_bind_RARHeaderDataEx_RARHeaderDataEx_0=c.asm.K).apply(null,arguments)},xb=c._emscripten_bind_RARHeaderDataEx_set_UnpSize_1=function(){return(xb=c._emscripten_bind_RARHeaderDataEx_set_UnpSize_1=c.asm.L).apply(null,arguments)},yb=c._emscripten_bind_RARHeaderDataEx_set_PackSize_1=function(){return(yb=c._emscripten_bind_RARHeaderDataEx_set_PackSize_1= +c.asm.M).apply(null,arguments)},zb=c._emscripten_bind_RARHeaderDataEx_get_Flags_0=function(){return(zb=c._emscripten_bind_RARHeaderDataEx_get_Flags_0=c.asm.N).apply(null,arguments)},Ab=c._emscripten_bind_RARHeaderDataEx_set_Flags_1=function(){return(Ab=c._emscripten_bind_RARHeaderDataEx_set_Flags_1=c.asm.O).apply(null,arguments)},Bb=c._emscripten_bind_RARHeaderDataEx___destroy___0=function(){return(Bb=c._emscripten_bind_RARHeaderDataEx___destroy___0=c.asm.P).apply(null,arguments)},Cb=c._emscripten_bind_RAROpenArchiveDataEx_RAROpenArchiveDataEx_0= +function(){return(Cb=c._emscripten_bind_RAROpenArchiveDataEx_RAROpenArchiveDataEx_0=c.asm.Q).apply(null,arguments)},Db=c._emscripten_bind_RAROpenArchiveDataEx_get_ArcName_0=function(){return(Db=c._emscripten_bind_RAROpenArchiveDataEx_get_ArcName_0=c.asm.R).apply(null,arguments)},Eb=c._emscripten_bind_RAROpenArchiveDataEx_set_ArcName_1=function(){return(Eb=c._emscripten_bind_RAROpenArchiveDataEx_set_ArcName_1=c.asm.S).apply(null,arguments)},Fb=c._emscripten_bind_RAROpenArchiveDataEx_get_OpenMode_0= +function(){return(Fb=c._emscripten_bind_RAROpenArchiveDataEx_get_OpenMode_0=c.asm.T).apply(null,arguments)},Gb=c._emscripten_bind_RAROpenArchiveDataEx_set_OpenMode_1=function(){return(Gb=c._emscripten_bind_RAROpenArchiveDataEx_set_OpenMode_1=c.asm.U).apply(null,arguments)},Hb=c._emscripten_bind_RAROpenArchiveDataEx_get_Callback_0=function(){return(Hb=c._emscripten_bind_RAROpenArchiveDataEx_get_Callback_0=c.asm.V).apply(null,arguments)},Ib=c._emscripten_bind_RAROpenArchiveDataEx_set_Callback_1=function(){return(Ib= +c._emscripten_bind_RAROpenArchiveDataEx_set_Callback_1=c.asm.W).apply(null,arguments)},Jb=c._emscripten_bind_RAROpenArchiveDataEx_get_OpenResult_0=function(){return(Jb=c._emscripten_bind_RAROpenArchiveDataEx_get_OpenResult_0=c.asm.X).apply(null,arguments)},Kb=c._emscripten_bind_RAROpenArchiveDataEx_set_OpenResult_1=function(){return(Kb=c._emscripten_bind_RAROpenArchiveDataEx_set_OpenResult_1=c.asm.Y).apply(null,arguments)},Lb=c._emscripten_bind_RAROpenArchiveDataEx_get_Flags_0=function(){return(Lb= +c._emscripten_bind_RAROpenArchiveDataEx_get_Flags_0=c.asm.Z).apply(null,arguments)},Mb=c._emscripten_bind_RAROpenArchiveDataEx_set_Flags_1=function(){return(Mb=c._emscripten_bind_RAROpenArchiveDataEx_set_Flags_1=c.asm._).apply(null,arguments)},Nb=c._emscripten_bind_RAROpenArchiveDataEx___destroy___0=function(){return(Nb=c._emscripten_bind_RAROpenArchiveDataEx___destroy___0=c.asm.$).apply(null,arguments)},Ob=c._emscripten_bind_VoidPtr___destroy___0=function(){return(Ob=c._emscripten_bind_VoidPtr___destroy___0= +c.asm.aa).apply(null,arguments)},Pb=c._emscripten_bind_RARHeaderDataEx_get_FileNameW_0=function(){return(Pb=c._emscripten_bind_RARHeaderDataEx_get_FileNameW_0=c.asm.ba).apply(null,arguments)},Qb=c._emscripten_bind_RARHeaderDataEx_set_FileNameW_1=function(){return(Qb=c._emscripten_bind_RARHeaderDataEx_set_FileNameW_1=c.asm.ca).apply(null,arguments)},Rb=c._emscripten_bind_RARHeaderDataEx_get_UnpSize_0=function(){return(Rb=c._emscripten_bind_RARHeaderDataEx_get_UnpSize_0=c.asm.da).apply(null,arguments)}, +Sb=c._emscripten_bind_RARHeaderDataEx_get_PackSize_0=function(){return(Sb=c._emscripten_bind_RARHeaderDataEx_get_PackSize_0=c.asm.ea).apply(null,arguments)};c._free=function(){return(c._free=c.asm.fa).apply(null,arguments)};var ua=c._malloc=function(){return(ua=c._malloc=c.asm.ga).apply(null,arguments)},Za=c.___errno_location=function(){return(Za=c.___errno_location=c.asm.ha).apply(null,arguments)};c._RAROpenArchiveEx=function(){return(c._RAROpenArchiveEx=c.asm.ia).apply(null,arguments)}; +c._RARCloseArchive=function(){return(c._RARCloseArchive=c.asm.ja).apply(null,arguments)};c._RARReadHeaderEx=function(){return(c._RARReadHeaderEx=c.asm.ka).apply(null,arguments)};c._RARProcessFileW=function(){return(c._RARProcessFileW=c.asm.la).apply(null,arguments)};c._RARSetPassword=function(){return(c._RARSetPassword=c.asm.ma).apply(null,arguments)}; +var sb=c.__get_tzname=function(){return(sb=c.__get_tzname=c.asm.na).apply(null,arguments)},rb=c.__get_daylight=function(){return(rb=c.__get_daylight=c.asm.oa).apply(null,arguments)},qb=c.__get_timezone=function(){return(qb=c.__get_timezone=c.asm.pa).apply(null,arguments)};c.dynCall_vi=function(){return(c.dynCall_vi=c.asm.qa).apply(null,arguments)};c.asm=vb;c.getMemory=function(a){if(Da)a=ua(a);else{var b=H[16784];H[16784]=b+a+15&-16;a=b}return a};c.UTF8ToString=F;c.stringToUTF8=ra; +c.addRunDependency=La;c.removeRunDependency=Ma;c.FS_createFolder=S.Tb;c.FS_createPath=S.Wb;c.FS_createDataFile=S.hb;c.FS_createPreloadedFile=S.Xb;c.FS_createLazyFile=S.Ub;c.FS_createLink=S.Vb;c.FS_createDevice=S.Ia;c.FS_unlink=S.unlink; +c.addFunction=function(a,b){if(!x){x=new WeakMap;for(var d=0;d=Yb){assert(0>=1;break;case 4:e>>=2;break;case 8:e>>=3}for(var f=0;fspan { - align-items: inherit; - display: flex; - width: 100%; -} -.ejs_settings_main_bar:hover { - background: rgba(var(--ejs-primary-color),1); - color: #fff; - cursor: pointer; -} -.ejs_settings_main_bar:hover::after { - border-left-color: currentColor; -} -.ejs_settings_main_bar_selected { - align-items: center; - display: flex; - margin-left: auto; - margin-right: -5px; - overflow: hidden; - padding-left: 25px; - pointer-events: none; -} -.ejs_setting_menu { - padding: 7px; -} -.ejs_back_button { - font-weight: 500; - margin: 7px; - margin-bottom: 3px; - padding-left: 28px; - position: relative; - width: calc(100% - 14px); - align-items: center; - color: #999; - display: flex; - font-size: 13px; - padding: 4px 11px; - user-select: none; - - background: transparent; - border: 0; - border-radius: 3px; - cursor: pointer; - flex-shrink: 0; - overflow: visible; - transition: all .3s ease; -} -.ejs_back_button:hover { - background: rgba(var(--ejs-primary-color),1); - color: #fff; -} -.ejs_back_button:hover::after { - border-right-color: currentColor; -} -.ejs_back_button::before { - background: #b7c5cd; - box-shadow: 0 1px 0 #fff; - content: ''; - height: 1px; - left: 0; - margin-top: 4px; - overflow: hidden; - position: absolute; - right: 0; - top: 100%; -} -.ejs_back_button::after { - border: 4px solid transparent; - border-right-color: rgba(79,91,95,0.8); - left: 7px; - content: ''; - position: absolute; - top: 50%; - transform: translateY(-50%); -} -.ejs_menu_text_a { - align-items: center; - display: flex; - font-size: 13px; - padding: 4px 11px; - user-select: none; - width: 100%; -} -.ejs_option_row { - padding-left: 7px; -} -.ejs_option_row:hover::before { - background: rgba(0,0,0,0.1); -} -.ejs_option_row::before { - background: rgba(204,204,204,0.1); - content: ''; - display: block; - flex-shrink: 0; - height: 16px; - margin-right: 10px; - transition: all .3s ease; - width: 16px; - border-radius: 100%; -} -.ejs_option_row::after { - background: #fff; - border: 0; - height: 6px; - left: 12px; - opacity: 0; - top: 50%; - transform: translateY(-50%) scale(0); - transition: transform .3s ease,opacity .3s ease; - width: 6px; - border-radius: 100%; - content: ''; - position: absolute; -} -.ejs_option_row_selected::before { - background: rgba(var(--ejs-primary-color),1); -} -.ejs_option_row_selected::after { - opacity: 1; - transform: translateY(-50%) scale(1); -} -.ejs_option_row>span { - align-items: center; - display: flex; - width: 100%; -} -.ejs_button_style { - margin: 0px; - background: transparent; - border: 0; - border-radius: 3px; - cursor: pointer; - flex-shrink: 0; - overflow: visible; - padding: 7px; - position: relative; - transition: all .3s ease; - - align-items: center; - color: #999; - display: flex; - font-size: 13px; - user-select: none; - width: 100%; -} -.ejs_button_style:hover { - background: rgba(var(--ejs-primary-color),1); - color: #fff; -} - -.ejs_cheat_heading { - margin-top: 0 !important; - margin-bottom: 0 !important; - font-weight: 600 !important; - font-size: 1.25rem; - line-height: 1.25 !important; - color: rgba(var(--ejs-primary-color),1) !important; -} -.ejs_cheat_close { - font: inherit; - line-height: inherit; - width: auto; - background: transparent; - border: 0; - color: #bcbcbc !important; - cursor: pointer; -} -.ejs_cheat_close::before { - content: "\2715"; - color: #bcbcbc !important; - font: inherit; - line-height: inherit; - width: auto; -} -.ejs_cheat_header { - display: flex; - justify-content: space-between; - align-items: center; -} -.ejs_cheat_main { - margin-top: 2rem; - margin-bottom: 2rem; - line-height: 1.5; - color: rgba(0,0,0,0.8); - text-align: left; - color: #bcbcbc !important; - border: unset; -} -.ejs_cheat_code { - color: #000 !important; - font-size: 1rem; - padding: .4rem; - max-width: 100%; -} -@keyframes ejs_cheat_animation{ - from{ - transform:translateY(15%) - } - to{ - transform:translateY(0) - } -} -.ejs_cheat_parent { - background-color: rgba(0,0,0,0.8); - border: 1px solid rgba(238,238,238,0.2); - padding: 30px; - min-width: 200px; - max-width: 500px; - max-height: 100vh; - border-radius: 4px; - overflow-y: auto; - box-sizing: border-box; - will-change: transform; - animation: ejs_cheat_animation .3s cubic-bezier(0,0,0.2,1); - font-size: 14px; -} -.ejs_popup_container_box { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - background: rgba(0,0,0,0.6); - display: flex; - justify-content: center; - align-items: center; -} -.ejs_popup_submit { - touch-action: manipulation; - font: inherit; - line-height: inherit; - width: auto; -} -.ejs_button_button { - color: #fff !important; - padding-left: 1rem; - padding-right: 1rem; - padding-top: .5rem; - padding-bottom: .5rem; - background-color: #929292; - border-radius: .25rem; - border-style: none; - border-width: 0; - cursor: pointer; - -webkit-appearance: button; - appearance: button; - text-transform: none; - overflow: visible; - margin: 0; - will-change: transform; - transition: transform .25s ease-out,-webkit-transform .25s ease-out; -} -.ejs_button_button:hover { - transform: scale(1.05); -} -.ejs_cheat_rows { - max-width: 320px; - margin: 0 auto; - text-align: left; - width: 100%; - float: none; - user-select: text !important; -} -.ejs_cheat_row { - padding-left: 2.25rem; - position: relative; - padding: .2em 0; - clear: both; -} -.ejs_cheat_row:hover { - background-color: rgba(0,0,0,0.8); -} -.ejs_cheat_row input[type=checkbox] { - position: absolute; - z-index: -1; - opacity: 0; - box-sizing: border-box; - width: auto; -} -.ejs_cheat_row label { - position: relative; - margin-bottom: 0; - vertical-align: top; - word-break: break-word; -} - -.ejs_cheat_row label::before { - position: absolute; - top: 0rem; - display: block; - height: 1rem; - content: ""; - background-color: #fff; - border: #adb5bd solid 1px; - left: -2.25rem; - width: 1.75rem; - pointer-events: all; - border-radius: .5rem; -} - -.ejs_cheat_row input:checked+label::before { - color: #fff; - border-color: rgba(var(--ejs-primary-color),1); - background-color: rgba(var(--ejs-primary-color),1); -} - -.ejs_cheat_row label::after { - position: absolute; - display: block; - content: ""; - background-repeat: no-repeat; - background-position: center center; - top: calc(0rem + 2px); - left: calc(-2.25rem + 2px); - width: calc(1rem - 4px); - height: calc(1rem - 4px); - background-color: #adb5bd; - border-radius: .5rem; - transition: transform .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out,-webkit-transform .15s ease-in-out; -} -.ejs_cheat_row input:checked+label::after { - background-color: #fff; - -webkit-transform: translateX(0.75rem); - transform: translateX(0.75rem); -} - -.ejs_cheat_row_button { - position: absolute; - padding: .1rem .5rem; - background-color: rgba(var(--ejs-primary-color),1); - color: #fff !important; - border-radius: .25rem; - cursor: pointer; - right: .025rem; - border: 0; -} - -@media (max-width: 574px) { - .ejs_volume_parent input[type='range'] { - width: 100%; - } -} -@media (min-width: 575px) { - .ejs_volume_parent { - max-width: 110px; - } -} -.ejs_volume_parent { - align-items: center; - display: flex; - flex: 1; - position: relative; -} -/* -@media (max-width: 574px) { - .ejs_volume_parent { - padding-right: 0px; - } - .ejs_volume_parent input[type='range'] { - display: none; - } -} -@media (min-width: 575px) { - .ejs_volume_parent { - padding-right: 15px; - } - .ejs_volume_parent input[type='range'] { - display: block; - } -}*/ -.ejs_volume_parent { - padding-right: 15px; -} -.ejs_volume_parent input[type='range'] { - display: block; -} -.ejs_volume_parent::-webkit-media-controls{ - display: none; -} -.ejs_volume_parent input[type='range']{ - -webkit-appearance:none; - appearance: none; - border:0; - border-radius:28px; - color:rgba(var(--ejs-primary-color), 1); - margin:0; - padding:0; - transition:box-shadow 0.3s ease; - width:100% -} - -.ejs_volume_parent input[type='range']::-webkit-slider-runnable-track{ - background-color:rgba(255,255,255,0.25); - box-shadow: 0 0 0 5px rgba(var(--ejs-primary-color), 0.5); - outline:0; - background: transparent; - border:0; - border-radius:3px; - height:6px; - transition:box-shadow 0.3s ease; - user-select:none; - background-image:linear-gradient(to right, currentColor var(--value, 0%), transparent var(--value, 0%)) -} -.ejs_volume_parent input[type='range']::-webkit-slider-thumb{ - background:#fff; - border:0; - border-radius:100%; - box-shadow:0 1px 1px rgba(0,0,0,0.15),0 0 0 1px rgba(47,52,61,0.2); - height:14px; - position:relative; - transition:all 0.2s ease; - width:14px; - -webkit-appearance:none; - margin-top:-4px -} -.ejs_volume_parent input[type='range']::-moz-range-track{ - background-color:rgba(255,255,255,0.25); - box-shadow:0 0 0 5px rgba(var(--ejs-primary-color), 0.5); - outline:0; - background:transparent; - border:0; - border-radius:3px; - height:6px; - transition:box-shadow 0.3s ease; - user-select:none -} -.ejs_volume_parent input[type='range']::-moz-range-thumb{ - background:#fff; - border:0; - border-radius:100%; - box-shadow:0 1px 1px rgba(0,0,0,0.15),0 0 0 1px rgba(47,52,61,0.2); - height:14px; - position:relative; - transition:all 0.2s ease; - width:14px -} -.ejs_volume_parent input[type='range']::-moz-range-progress{ - background:currentColor; - border-radius:3px; - height:6px -} -.ejs_volume_parent input[type='range']::-ms-track{ - background-color:rgba(255,255,255,0.25); - box-shadow:0 0 0 5px rgba(var(--ejs-primary-color), 0.5); - outline:0; - background:transparent; - border:0; - border-radius:3px; - height:6px; - transition:box-shadow 0.3s ease; - user-select:none; - color:transparent -} -.ejs_volume_parent input[type='range']::-ms-fill-upper{ - background:transparent; - border:0; - border-radius:3px; - height:6px; - transition:box-shadow 0.3s ease; - user-select:none -} -.ejs_volume_parent input[type='range']::-ms-fill-lower{ - background:transparent; - border:0; - border-radius:3px; - height:6px; - transition:box-shadow 0.3s ease; - user-select:none; - background:currentColor -} -.ejs_volume_parent input[type='range']::-ms-thumb{ - background:#fff; - border:0; - border-radius:100%; - box-shadow:0 1px 1px rgba(0,0,0,0.15),0 0 0 1px rgba(47,52,61,0.2); - height:14px; - position:relative; - transition:all 0.2s ease; - width:14px; - margin-top:0 -} -.ejs_volume_parent input[type='range']::-ms-tooltip{ - display:none -} -.ejs_volume_parent input[type='range']:focus{ - outline:0 -} -.ejs_volume_parent input[type='range']::-moz-focus-outer{ - border:0 -} - -.ejs_volume_parent input[type='range']:active::-webkit-slider-thumb { - box-shadow:0 1px 1px rgba(0,0,0,0.15),0 0 0 1px rgba(47,52,61,0.2),0 0 0 3px rgba(255,255,255,0.5) -} -.ejs_volume_parent input[type='range']:active::-moz-range-thumb { - box-shadow:0 1px 1px rgba(0,0,0,0.15),0 0 0 1px rgba(47,52,61,0.2),0 0 0 3px rgba(255,255,255,0.5) -} -.ejs_volume_parent input[type='range']:active::-ms-thumb { - box-shadow:0 1px 1px rgba(0,0,0,0.15),0 0 0 1px rgba(47,52,61,0.2),0 0 0 3px rgba(255,255,255,0.5) -} - -.ejs_message { - float: none; - overflow: hidden; - position: absolute; - top: 0; - color: red; - font-size: 17px; - padding: 10px; - text-align: left; - text-shadow: rgb(0, 0, 0) 1px 1px 1px; -} - -.ejs_virtualGamepad_open { - display: inline-block; - width: 30px; - height: 30px; - color: #fff; - position: absolute; - top: 5px; - right: 5px; - opacity: .5; - z-index: 999; -} -.ejs_virtualGamepad_open svg { - fill: currentColor; -} - -.ejs_netplay_header { - margin-top: .5rem; - margin-bottom: .5rem; - line-height: 1.5; - color: rgba(0,0,0,.8); - text-align: left; -} -.ejs_netplay_header input, .ejs_netplay_header select { - font-size: 1rem; - padding: .4rem; - max-width: 100%; - color: #000!important; - background-color: #fff!important; - margin: 0; - height: 2rem; - display: block; - font-family: Arial; - border: 0px; -} -.ejs_netplay_name_heading { - margin-top: 0!important; - margin-bottom: 0!important; - font-weight: 600!important; - font-size: 1.25rem; - line-height: 1.25!important; - color: rgba(var(--ejs-primary-color),1)!important; - display: flex; - justify-content: space-between; - align-items: center; -} -.ejs_netplay_table { - font-family: Avenir,"Avenir Next","Helvetica Neue","Segoe UI",Helvetica,Arial,sans-serif; - font-size: 0.8rem; - padding: 0 10px; -} -.ejs_netplay_join_button { - float: none; - padding: .1rem .5rem; - background-color: rgba(var(--ejs-primary-color),1); - color: #fff!important; - border-radius: .25rem; - cursor: pointer; -} -.ejs_netplay_table_row:hover { - background-color: #2d2d2d; -} +.ejs_parent { + background: #000; + overflow: hidden; + position: relative; + font-family: Avenir, "Avenir Next", "Helvetica Neue", "Segoe UI", Helvetica, Arial, sans-serif; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + font-weight: 500; + line-height: 1.7; + width: 100%; + height: 100%; + color: #bcbcbc; + outline-width: 0; + outline: none; + font-size: 14px; +} + +.ejs_parent *, .ejs_parent *::after, .ejs_parent *::before { + font-family: Avenir, "Avenir Next", "Helvetica Neue", "Segoe UI", Helvetica, Arial, sans-serif; + box-sizing: border-box; + + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.ejs_parent ::-webkit-scrollbar{ + width: 8px; + height: 16px; + background-color: transparent; +} +.ejs_parent ::-webkit-scrollbar-thumb{ + border-radius: 0; + -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); + background-color: #f5f5f5; +} +.ejs_parent ::-webkit-scrollbar-track{ + -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); + border-radius: 10px; + background-color: transparent; +} +.ejs_parent { + scrollbar-face-color:#F5F5F5; + scrollbar-highlight-color:transparent; + scrollbar-3dlight-color:transparent; + scrollbar-darkshadow-color:transparent; + scrollbar-Shadow-color:transparent; + scrollbar-arrow-color:#fff; + scrollbar-track-color:transparent; + scrollbar-width:thin; + scrollbar-color:transparent #f5f5f5; +} + +.ejs_ad_iframe { + position: absolute; + left: 50%; + top: 50%; + z-index: 1; + transform: translate(-50%, -50%); +} +.ejs_ad_close { + cursor: pointer; +} +.ejs_ad_close:after { + content: ""; + position: absolute; + border-left: 20px solid transparent; + border-right: 20px solid #a7a7a77d; + border-top: 20px solid #a7a7a77d; + border-bottom: 20px solid transparent; + right: 0; +} +.ejs_ad_close a { + right: 4px; + top: 4px; + position: absolute; + border: 0; + padding: 0; + width: 15px; + height: 15px; + z-index: 99; +} +.ejs_ad_close a:before { + content: ""; + border-bottom: 1px solid #fff; + transform: rotate(45deg) translateY(-45%); + width: 15px; + height: 15px; + display: block; + position: absolute; + top: 0; + right: 0; +} +.ejs_ad_close a:after { + content: ""; + border-bottom: 1px solid #fff; + width: 15px; + height: 15px; + display: block; + position: absolute; + right: 0; + background: transparent; + top: 0; + transform: rotate(-45deg) translateY(-50%) translateX(0); +} + +.ejs_game { + width: inherit; + height: inherit; + background-color: var(--ejs-background-color); + cursor: default; + position: relative; + overflow: hidden; +} + +.ejs_game_background { + background-image: var(--ejs-background-image); + background-size: contain; + background-position: center center; + background-repeat: no-repeat; + text-align: -webkit-auto; +} + +.ejs_game_background_blur:before, +.ejs_game_background_blur:after { + content: ""; + position: absolute; + width: 100%; + height: 100%; + background: var(--ejs-background-image); + background-repeat: no-repeat; + background-position: center; + background-size: contain; +} + +.ejs_game_background_blur:before { + background-size: cover; + filter: blur(10px); + transform: scale(1.1); +} + +.ejs_start_button { + position: absolute; + bottom: 65px; + left: 50%; + transform: translateX(-50%); + cursor: pointer; + box-sizing: inherit; + display: flex; + justify-content: center; + text-shadow: 0 1px 1px rgba(0,0,0,0.5); + font-size: 20px; + line-height: 45px; + text-transform: uppercase; + font-weight: bolder; + position: relative; + text-decoration: none; + width: fit-content; + padding-left: 40px; + padding-right: 40px; + white-space: nowrap; + height: 45px; + border: 0; + color: #fff !important; + border-radius: 35px; + text-align: center; + background-color: rgba(var(--ejs-primary-color),1); + box-shadow: 0 0 0 0 #222, 0 0px 0px 0 #111, inset 0 0px 0px 0 rgba(250,250,250,0.2), inset 0 0px 0px 0px rgba(0,0,0,0.5); +} + +.ejs_start_button_border { + border: 0.5px solid #333; +} + +.ejs_start_button:active, .ejs_start_button:hover { + animation: ejs_start_button_pulse 2s infinite; +} + +@keyframes ejs_start_button_pulse { + 50% { + box-shadow: 0 0 0 0 #222, 0 3px 7px 0 #111, inset 0 1px 1px 0 rgba(250,250,250,0.2), inset 0 0px 15px 1px rgba(0,0,0,0.5); + } + 0%, 100% { + box-shadow: 0 0 0 0 #222, 0 0px 0px 0 #111, inset 0 0px 0px 0 rgba(250,250,250,0.2), inset 0 0px 0px 0px rgba(0,0,0,0.5); + } + } + +.ejs_loading_text { + position: absolute; + bottom: 20px; + font-weight: 500; + left: 50%; + transform: translateX(-50%); + box-sizing: inherit; + font-size: 12px; + color: #bcbcbc; +} + +.ejs_loading_text_glow { + background-color: rgba(0, 0, 0, 0.9); + border-radius: 10px; + padding: 1px 5px 1px 5px; + box-shadow: 0 0 30px rgba(0, 0, 0, 0.9); +} + +.ejs_canvas { + width: 100%; + height: 100%; +} + +.ejs_context_menu { + position: absolute; + display: none; + z-index: 9; + background: rgba(16,16,16,0.9); + border-radius: 3px; + font-size: 13px; + min-width: 140px; + padding: 8px; + box-sizing: inherit; +} + +.ejs_context_menu li { + padding: 4px 11px; + text-align: center; +} + +.ejs_context_menu li a { + color: #999; + display: block; + font-size: 13px; +} +.ejs_context_menu ul { + color: #999; + display: block; + font-size: 13px; + list-style: none; + margin: 0; + padding: 0; +} + +.ejs_context_menu li:hover { + background: rgba(var(--ejs-primary-color),1); + border-radius: 4px; + box-shadow: 0 0 0 5px rgba(var(--ejs-primary-color),0.5); + outline: 0; +} +.ejs_context_menu li:hover a { + color: #fff; +} + +.ejs_list_selector { + background: rgba(0,0,0,0.5); + border-radius: 3px; + font-size: 13px; + min-width: 140px; + padding: 8px; + box-sizing: inherit; + float: left; + position: absolute; + width: 10%; + max-width: 15%; + top: 10%; + left: 0px; + height: 80%; + overflow: auto; +} + +.ejs_list_selector li { + padding: 4px 11px; + text-align: center; +} + +.ejs_list_selector li a { + color: #999 !important; + display: block; + font-size: 13px; +} +.ejs_list_selector ul { + color: #999 !important; + display: block; + font-size: 13px; + list-style: none; + margin: 0; + padding: 0; +} + +.ejs_list_selector li:hover { + background: rgba(var(--ejs-primary-color),1); + border-radius: 4px; + box-shadow: 0 0 0 5px rgba(var(--ejs-primary-color),0.5); + outline: 0; +} +.ejs_list_selector li:hover a { + color: #fff !important; +} + +.ejs_svg_rotate { + transform: rotate(90deg); +} +.ejs_small_screen .ejs_settings_parent::after { + right: 15px; +} +.ejs_small_screen .ejs_settings_center_right { + right: -35% +} +.ejs_small_screen .ejs_settings_center_left { + right: -135% +} +.ejs_small_screen .ejs_settings_center_right::after { + right: 25%; +} +.ejs_small_screen .ejs_settings_center_left::after { + left: 25%; +} +.ejs_small_screen .ejs_menu_bar { + transition: opacity .4s ease-in-out,transform .4s ease-in-out; + position: absolute; + transform: translate(-50%,0); + width: 300px; + max-height: 260px; + display: flex; + flex-wrap: wrap; + align-items: flex-start; + background: rgba(0,0,0,.9); + padding: 10px; + z-index: 9999; + left: 50%; + bottom: 0; +} +.ejs_small_screen .ejs_menu_bar_hidden { + opacity: 0; + pointer-events: none; + transform: translate(-50%, 100%); +} +.ejs_small_screen .ejs_menu_button { + width: 135px; + margin: 0px; + margin-left: 2px!important; + margin-right: 0!important; + line-height: 1; + background: 0 0; + border: 0; + border-radius: 3px; + color: inherit; + cursor: pointer; + flex-shrink: 0; + overflow: visible; + padding: 7px; + position: relative; + transition: all .3s ease; +} +.ejs_small_screen .ejs_menu_button:hover { + background: rgba(var(--ejs-primary-color),1); + color: #fff; +} +.ejs_small_screen .ejs_menu_button svg { + float: left; + transition: transform .3s ease; +} +.ejs_small_screen .ejs_menu_text { + position: static; + color: #fff; + background: 0 0; + opacity: 1; + padding: 0; + transform: scale(.8)!important; + font-size: 12px; +} +.ejs_small_screen .ejs_menu_bar_spacer { + display:none; +} +.ejs_small_screen .ejs_volume_parent span { + display: none; +} +.ejs_small_screen .ejs_volume_parent button { + width: 30px; +} + +.ejs_big_screen .ejs_menu_bar_hidden { + opacity: 0; + pointer-events: none; + transform: translateY(100%); +} +.ejs_big_screen .ejs_settings_parent { + right: -3px; +} +.ejs_big_screen .ejs_settings_parent::after { + right: 15px; +} +.ejs_big_screen .ejs_settings_text { + display: none; +} +.ejs_big_screen .ejs_menu_bar_spacer { + flex:1; +} +.ejs_big_screen .ejs_menu_button svg { + transition: transform .3s ease; +} +.ejs_big_screen .ejs_menu_button { + width: auto; + margin: auto; + font-family: Avenir, "Avenir Next", "Helvetica Neue", "Segoe UI", Helvetica, Arial, sans-serif; + margin-right: 2px; + touch-action: manipulation; + background: transparent; + border: 0; + border-radius: 3px; + color: inherit; + cursor: pointer; + flex-shrink: 0; + overflow: visible; + padding: 7px; + position: relative; + transition: all .3s ease; +} + +.ejs_big_screen .ejs_menu_button:hover { + background: rgba(var(--ejs-primary-color),1); + color: #fff; +} + +.ejs_big_screen .ejs_menu_button:hover .ejs_menu_text { + transform: translate(0,0) scale(1); + opacity: 1; +} + +.ejs_big_screen .ejs_menu_text_right { + right: 0; + left: auto !important; +} + +.ejs_big_screen .ejs_menu_text { + left: 0; + background: rgba(255,255,255,0.9); + border-radius: 3px; + bottom: 100%; + box-shadow: 0 1px 2px rgba(0,0,0,0.15); + color: #4f5b5f; + font-size: 14px; + font-weight: 500; + line-height: 1.3; + margin-bottom: 10px; + opacity: 0; + padding: 5px 7.5px; + pointer-events: none; + position: absolute; + transform: translate(0,10px) scale(0.8); + transform-origin: 0 100%; + transition: transform .2s .1s ease,opacity .2s .1s ease; + white-space: nowrap; + z-index: 2; +} + +.ejs_big_screen .ejs_menu_text::before { + border-left: 4px solid transparent; + border-right: 4px solid transparent; + border-top: 4px solid rgba(255,255,255,0.9); + bottom: -4px; + content: ''; + height: 0; + left: 16px; + position: absolute; + transform: translateX(-50%); + width: 0; + z-index: 2; +} +.ejs_big_screen .ejs_menu_text_right::before { + left: auto !important; + right: 16px; + transform: translateX(50%) !important; +} +.ejs_big_screen .ejs_menu_bar { + padding: 15px 10px 10px; + background: linear-gradient(rgba(0,0,0,0),rgba(0,0,0,0.7)); + border-bottom-left-radius: inherit; + border-bottom-right-radius: inherit; + bottom: 0; + color: #fff; + left: 0; + position: absolute; + right: 0; + transition: opacity .4s ease-in-out,transform .4s ease-in-out; + z-index: 9999; + align-items: center; + display: flex; + justify-content: flex-start; + text-align: center; +} + + +.ejs_menu_bar svg { + display: block; + fill: currentColor; + height: 18px; + pointer-events: none; + width: 18px; +} + +.ejs_popup_container { + background: rgba(0,0,0,0.8); + text-align: center; + z-index: 9999; + height: 100%; + overflow: hidden; + position: absolute; + top: 0; + width: 100%; + color: #ccc; +} + +.ejs_popup_container *, .ejs_popup_container *::after, .ejs_popup_container *::before { + box-sizing: border-box; + color: #bcbcbc !important; + + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.ejs_popup_container h4 { + color: #ccc; + font-size: 24px; + margin: 0; + padding: 10px; +} + +.ejs_button { + border-radius: .25rem; + font-size: .875rem; + padding-left: 1rem; + padding-right: 1rem; + padding-top: .5rem; + padding-bottom: .5rem; + display: inline-block; + background-color: rgba(var(--ejs-primary-color),1); + margin: 0 10px; + color: #fff !important; + touch-action: manipulation; + cursor: pointer; +} + +.ejs_popup_body { + height: calc(100% - 130px); + overflow: auto; +} + +.ejs_control_body { + color: #bcbcbc !important; + border: unset; +} + +.ejs_control_body input[type='text'] { + background-color: #fff; + border: 1px solid #000; + font-size: 12px; + font-weight: 700; + color: #000 !important; +} +.ejs_control_player_bar { + margin: 0; + padding: 0; +} +.ejs_control_player_bar ul { + list-style: none; +} +.ejs_control_player_bar li { + color: #bcbcbc !important; + display: inline-block; +} +.ejs_control_player_bar a { + padding: 2px 5px; + color: #bcbcbc !important; + font-size: 14px; + cursor: pointer; +} + +.ejs_control_selected { + border-bottom: 1px solid #fff; + background-color: #fff; +} +.ejs_control_selected a { + color: #000 !important; +} + +.ejs_control_bar:hover { + background-color: #2d2d2d; +} +.ejs_control_set_button { + float: none; + padding: .1rem .5rem; + background-color: rgba(var(--ejs-primary-color),1); + color: #fff !important; + border-radius: .25rem; + cursor: pointer; + font-size: 14px; +} + +.ejs_control_row label::before { + top: -0.15rem !important; +} + +.ejs_control_row label::after { + top: calc(-0.15rem + 2px) !important; +} + +.ejs_popup_box { + position: absolute; + width: 300px; + top: 50%; + margin-left: -150px; + margin-top: -50px; + left: 50%; + background: rgba(0,0,0,0.8) !important; + padding: 15px 0; +} + +.ejs_virtualGamepad_parent { + width: 100%; + position: absolute; + bottom: 50px; +} +.ejs_virtualGamepad_top { + position: absolute; + bottom: 250px; + width: 100%; +} +.ejs_virtualGamepad_bottom { + position: absolute; + bottom: 10px; + height: 30px; + width: 124px; + left: 50%; + margin-left: -62px; +} +.ejs_virtualGamepad_left { + position: absolute; + bottom: 50px; + width: 125px; + height: 125px; + left: 10px; +} +.ejs_virtualGamepad_right { + position: absolute; + bottom: 50px; + width: 130px; + height: 130px; + right: 10px; +} +.ejs_virtualGamepad_button { + position: absolute; + font-size: 20px; + width: 50px; + height: 50px; + text-align: center; + line-height: 50px; + border: 1px solid #ccc; + border-radius: 50%; + font-size: 30px; + font-weight: bold; + background-color: rgba(255,255,255,0.15); + user-select: none; + transition: all .2s; +} +.ejs_virtualGamepad_button_down { + background-color:#000000ad; +} + +.ejs_dpad_main { + touch-action: none; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + opacity: .7; +} +.ejs_dpad_horizontal { + width: 100%; + height: 36px; + transform: translate(0,-50%); + position: absolute; + left: 0; + top: 50%; + border-radius: 5px; + overflow: hidden; +} +.ejs_dpad_horizontal:before { + content: ""; + position: absolute; + left: 0; + top: 50%; + z-index: 1; + transform: translate(0,-50%); + width: 0; + height: 0; + border: 8px solid; + border-color: transparent #333 transparent transparent; +} +.ejs_dpad_horizontal:after { + content: ""; + position: absolute; + right: 0; + top: 50%; + z-index: 1; + transform: translate(0,-50%); + width: 0; + height: 0; + border: 8px solid; + border-color: transparent transparent transparent #333; +} +.ejs_dpad_vertical { + width: 36px; + height: 100%; + transform: translate(-50%,0); + position: absolute; + left: 50%; + border-radius: 5px; + overflow: hidden; +} +.ejs_dpad_vertical:before { + content: ""; + position: absolute; + top: 0; + left: 50%; + z-index: 1; + transform: translate(-50%,0); + width: 0; + height: 0; + border: 8px solid; + border-color: transparent transparent #333 transparent; +} +.ejs_dpad_vertical:after { + content: ""; + position: absolute; + bottom: 0; + left: 50%; + z-index: 1; + transform: translate(-50%,0); + width: 0; + height: 0; + border: 8px solid; + border-color: #333 transparent transparent transparent; +} +.ejs_dpad_bar { + position: absolute; + width: 100%; + height: 100%; + background: #787878; +} +.ejs_dpad_left_pressed .ejs_dpad_horizontal:before { + border-right-color:#fff; +} +.ejs_dpad_right_pressed .ejs_dpad_horizontal:after { + border-left-color:#fff; +} +.ejs_dpad_up_pressed .ejs_dpad_vertical:before { + border-bottom-color:#fff; +} +.ejs_dpad_down_pressed .ejs_dpad_vertical:after { + border-top-color:#fff +} + +@keyframes ejs_settings_parent_animation{ + 0%{ + opacity:0.5; + transform:translateY(10px) + } + to{ + opacity:1; + transform:translateY(0) + } +} + +.ejs_settings_parent { + animation: ejs_settings_parent_animation .2s ease; + background: rgba(16,16,16,0.9); + border-radius: 4px; + bottom: 100%; + box-shadow: 0 1px 2px rgba(0,0,0,0.15); + color: #4f5b5f; + font-size: 16px; + margin-bottom: 10px; + position: absolute; + text-align: left; + white-space: nowrap; + z-index: 9999; +} +.ejs_settings_parent::after { + border: 4px solid transparent; + border-top-color: rgba(16,16,16,0.9); + content: ''; + height: 0; + position: absolute; + top: 100%; + width: 0; +} +.ejs_settings_transition { + overflow: hidden; + transition: height .35s cubic-bezier(0.4,0,0.2,1),width .35s cubic-bezier(0.4,0,0.2,1); +} +.ejs_settings_main_bar { + align-items: center; + color: #999; + display: flex; + font-size: 13px; + padding: 4px 11px; + user-select: none; + width: 100%; + padding-right: 28px; + background: transparent; + border: 0; + border-radius: 3px; + flex-shrink: 0; + overflow: visible; + position: relative; + transition: all .3s ease; + box-sizing: border-box; +} +.ejs_settings_main_bar::after { + border: 4px solid transparent; + content: ''; + position: absolute; + top: 50%; + transform: translateY(-50%); + border-left-color: rgba(79,91,95,0.8); + right: 5px; +} +.ejs_settings_main_bar>span { + align-items: inherit; + display: flex; + width: 100%; +} +.ejs_settings_main_bar:hover { + background: rgba(var(--ejs-primary-color),1); + color: #fff; + cursor: pointer; +} +.ejs_settings_main_bar:hover::after { + border-left-color: currentColor; +} +.ejs_settings_main_bar_selected { + align-items: center; + display: flex; + margin-left: auto; + margin-right: -5px; + overflow: hidden; + padding-left: 25px; + pointer-events: none; +} +.ejs_setting_menu { + padding: 7px; +} +.ejs_back_button { + font-weight: 500; + margin: 7px; + margin-bottom: 3px; + padding-left: 28px; + position: relative; + width: calc(100% - 14px); + align-items: center; + color: #999; + display: flex; + font-size: 13px; + padding: 4px 11px; + user-select: none; + + background: transparent; + border: 0; + border-radius: 3px; + cursor: pointer; + flex-shrink: 0; + overflow: visible; + transition: all .3s ease; +} +.ejs_back_button:hover { + background: rgba(var(--ejs-primary-color),1); + color: #fff; +} +.ejs_back_button:hover::after { + border-right-color: currentColor; +} +.ejs_back_button::before { + background: #b7c5cd; + box-shadow: 0 1px 0 #fff; + content: ''; + height: 1px; + left: 0; + margin-top: 4px; + overflow: hidden; + position: absolute; + right: 0; + top: 100%; +} +.ejs_back_button::after { + border: 4px solid transparent; + border-right-color: rgba(79,91,95,0.8); + left: 7px; + content: ''; + position: absolute; + top: 50%; + transform: translateY(-50%); +} +.ejs_menu_text_a { + align-items: center; + display: flex; + font-size: 13px; + padding: 4px 11px; + user-select: none; + width: 100%; +} +.ejs_option_row { + padding-left: 7px; +} +.ejs_option_row:hover::before { + background: rgba(0,0,0,0.1); +} +.ejs_option_row::before { + background: rgba(204,204,204,0.1); + content: ''; + display: block; + flex-shrink: 0; + height: 16px; + margin-right: 10px; + transition: all .3s ease; + width: 16px; + border-radius: 100%; +} +.ejs_option_row::after { + background: #fff; + border: 0; + height: 6px; + left: 12px; + opacity: 0; + top: 50%; + transform: translateY(-50%) scale(0); + transition: transform .3s ease,opacity .3s ease; + width: 6px; + border-radius: 100%; + content: ''; + position: absolute; +} +.ejs_option_row_selected::before { + background: rgba(var(--ejs-primary-color),1); +} +.ejs_option_row_selected::after { + opacity: 1; + transform: translateY(-50%) scale(1); +} +.ejs_option_row>span { + align-items: center; + display: flex; + width: 100%; +} +.ejs_button_style { + margin: 0px; + background: transparent; + border: 0; + border-radius: 3px; + cursor: pointer; + flex-shrink: 0; + overflow: visible; + padding: 7px; + position: relative; + transition: all .3s ease; + + align-items: center; + color: #999; + display: flex; + font-size: 13px; + user-select: none; + width: 100%; +} +.ejs_button_style:hover { + background: rgba(var(--ejs-primary-color),1); + color: #fff; +} + +.ejs_cheat_heading { + margin-top: 0 !important; + margin-bottom: 0 !important; + font-weight: 600 !important; + font-size: 1.25rem; + line-height: 1.25 !important; + color: rgba(var(--ejs-primary-color),1) !important; +} +.ejs_cheat_close { + font: inherit; + line-height: inherit; + width: auto; + background: transparent; + border: 0; + color: #bcbcbc !important; + cursor: pointer; +} +.ejs_cheat_close::before { + content: "\2715"; + color: #bcbcbc !important; + font: inherit; + line-height: inherit; + width: auto; +} +.ejs_cheat_header { + display: flex; + justify-content: space-between; + align-items: center; +} +.ejs_cheat_main { + margin-top: 2rem; + margin-bottom: 2rem; + line-height: 1.5; + color: rgba(0,0,0,0.8); + text-align: left; + color: #bcbcbc !important; + border: unset; +} +.ejs_cheat_code { + color: #000 !important; + font-size: 1rem; + padding: .4rem; + max-width: 100%; +} +@keyframes ejs_cheat_animation{ + from{ + transform:translateY(15%) + } + to{ + transform:translateY(0) + } +} +.ejs_cheat_parent { + background-color: rgba(0,0,0,0.8); + border: 1px solid rgba(238,238,238,0.2); + padding: 30px; + min-width: 200px; + max-width: 500px; + max-height: 100vh; + border-radius: 4px; + overflow-y: auto; + box-sizing: border-box; + will-change: transform; + animation: ejs_cheat_animation .3s cubic-bezier(0,0,0.2,1); + font-size: 14px; +} +.ejs_popup_container_box { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: rgba(0,0,0,0.6); + display: flex; + justify-content: center; + align-items: center; +} +.ejs_popup_submit { + touch-action: manipulation; + font: inherit; + line-height: inherit; + width: auto; +} +.ejs_button_button { + color: #fff !important; + padding-left: 1rem; + padding-right: 1rem; + padding-top: .5rem; + padding-bottom: .5rem; + background-color: #929292; + border-radius: .25rem; + border-style: none; + border-width: 0; + cursor: pointer; + -webkit-appearance: button; + appearance: button; + text-transform: none; + overflow: visible; + margin: 0; + will-change: transform; + transition: transform .25s ease-out,-webkit-transform .25s ease-out; +} +.ejs_button_button:hover { + transform: scale(1.05); +} +.ejs_cheat_rows { + max-width: 320px; + margin: 0 auto; + text-align: left; + width: 100%; + float: none; + user-select: text !important; +} +.ejs_cheat_row { + padding-left: 2.25rem; + position: relative; + padding: .2em 0; + clear: both; +} +.ejs_cheat_row:hover { + background-color: rgba(0,0,0,0.8); +} +.ejs_cheat_row input[type=checkbox] { + position: absolute; + z-index: -1; + opacity: 0; + box-sizing: border-box; + width: auto; +} +.ejs_cheat_row label { + position: relative; + margin-bottom: 0; + vertical-align: top; + word-break: break-word; +} + +.ejs_cheat_row label::before { + position: absolute; + top: 0rem; + display: block; + height: 1rem; + content: ""; + background-color: #fff; + border: #adb5bd solid 1px; + left: -2.25rem; + width: 1.75rem; + pointer-events: all; + border-radius: .5rem; +} + +.ejs_cheat_row input:checked+label::before { + color: #fff; + border-color: rgba(var(--ejs-primary-color),1); + background-color: rgba(var(--ejs-primary-color),1); +} + +.ejs_cheat_row label::after { + position: absolute; + display: block; + content: ""; + background-repeat: no-repeat; + background-position: center center; + top: calc(0rem + 2px); + left: calc(-2.25rem + 2px); + width: calc(1rem - 4px); + height: calc(1rem - 4px); + background-color: #adb5bd; + border-radius: .5rem; + transition: transform .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out,-webkit-transform .15s ease-in-out; +} +.ejs_cheat_row input:checked+label::after { + background-color: #fff; + -webkit-transform: translateX(0.75rem); + transform: translateX(0.75rem); +} + +.ejs_cheat_row_button { + position: absolute; + padding: .1rem .5rem; + background-color: rgba(var(--ejs-primary-color),1); + color: #fff !important; + border-radius: .25rem; + cursor: pointer; + right: .025rem; + border: 0; +} + +.ejs_small_screen .ejs_volume_parent input[type='range'] { + width: 100%; +} +.ejs_big_screen .ejs_volume_parent { + max-width: 110px; +} +.ejs_volume_parent { + align-items: center; + display: flex; + flex: 1; + position: relative; +} +.ejs_volume_parent { + padding-right: 15px; +} +.ejs_volume_parent input[type='range'] { + display: block; +} +.ejs_volume_parent::-webkit-media-controls{ + display: none; +} +.ejs_volume_parent input[type='range']{ + -webkit-appearance:none; + appearance: none; + border:0; + border-radius:28px; + color:rgba(var(--ejs-primary-color), 1); + margin:0; + padding:0; + transition:box-shadow 0.3s ease; + width:100% +} + +.ejs_volume_parent input[type='range']::-webkit-slider-runnable-track{ + background-color:rgba(255,255,255,0.25); + outline:0; + background: transparent; + border:0; + border-radius:3px; + height:6px; + transition:box-shadow 0.3s ease; + user-select:none; + background-image:linear-gradient(to right, currentColor var(--value, 0%), transparent var(--value, 0%)) +} +.ejs_volume_parent input[type='range']::-webkit-slider-thumb{ + background:#fff; + border:0; + border-radius:100%; + box-shadow:0 1px 1px rgba(0,0,0,0.15),0 0 0 1px rgba(47,52,61,0.2); + height:14px; + position:relative; + transition:all 0.2s ease; + width:14px; + -webkit-appearance:none; + margin-top:-4px +} +.ejs_volume_parent input[type='range']::-moz-range-track{ + background-color:rgba(255,255,255,0.25); + outline:0; + background:transparent; + border:0; + border-radius:3px; + height:6px; + transition:box-shadow 0.3s ease; + user-select:none +} +.ejs_volume_parent input[type='range']::-moz-range-thumb{ + background:#fff; + border:0; + border-radius:100%; + box-shadow:0 1px 1px rgba(0,0,0,0.15),0 0 0 1px rgba(47,52,61,0.2); + height:14px; + position:relative; + transition:all 0.2s ease; + width:14px +} +.ejs_volume_parent input[type='range']::-moz-range-progress{ + background:currentColor; + border-radius:3px; + height:6px +} +.ejs_volume_parent input[type='range']::-ms-track{ + background-color:rgba(255,255,255,0.25); + outline:0; + background:transparent; + border:0; + border-radius:3px; + height:6px; + transition:box-shadow 0.3s ease; + user-select:none; + color:transparent +} +.ejs_volume_parent input[type='range']::-ms-fill-upper{ + background:transparent; + border:0; + border-radius:3px; + height:6px; + transition:box-shadow 0.3s ease; + user-select:none +} +.ejs_volume_parent input[type='range']::-ms-fill-lower{ + background:transparent; + border:0; + border-radius:3px; + height:6px; + transition:box-shadow 0.3s ease; + user-select:none; + background:currentColor +} +.ejs_volume_parent input[type='range']::-ms-thumb{ + background:#fff; + border:0; + border-radius:100%; + box-shadow:0 1px 1px rgba(0,0,0,0.15),0 0 0 1px rgba(47,52,61,0.2); + height:14px; + position:relative; + transition:all 0.2s ease; + width:14px; + margin-top:0 +} +.ejs_volume_parent input[type='range']::-ms-tooltip{ + display:none +} +.ejs_volume_parent input[type='range']:focus{ + outline:0 +} +.ejs_volume_parent input[type='range']::-moz-focus-outer{ + border:0 +} + +.ejs_volume_parent input[type='range']:active::-webkit-slider-thumb { + box-shadow:0 1px 1px rgba(0,0,0,0.15),0 0 0 1px rgba(47,52,61,0.2),0 0 0 3px rgba(255,255,255,0.5) +} +.ejs_volume_parent input[type='range']:active::-moz-range-thumb { + box-shadow:0 1px 1px rgba(0,0,0,0.15),0 0 0 1px rgba(47,52,61,0.2),0 0 0 3px rgba(255,255,255,0.5) +} +.ejs_volume_parent input[type='range']:active::-ms-thumb { + box-shadow:0 1px 1px rgba(0,0,0,0.15),0 0 0 1px rgba(47,52,61,0.2),0 0 0 3px rgba(255,255,255,0.5) +} + +.ejs_message { + float: none; + overflow: hidden; + position: absolute; + top: 0; + color: red; + font-size: 17px; + padding: 10px; + text-align: left; + text-shadow: rgb(0, 0, 0) 1px 1px 1px; +} + +.ejs_virtualGamepad_open { + display: inline-block; + width: 30px; + height: 30px; + color: #fff; + position: absolute; + top: 5px; + right: 5px; + opacity: .5; + z-index: 999; +} +.ejs_virtualGamepad_open svg { + fill: currentColor; +} + +.ejs_netplay_header { + margin-top: .5rem; + margin-bottom: .5rem; + line-height: 1.5; + color: rgba(0,0,0,.8); + text-align: left; +} +.ejs_netplay_header input, .ejs_netplay_header select { + font-size: 1rem; + padding: .4rem; + max-width: 100%; + color: #000!important; + background-color: #fff!important; + margin: 0; + height: 2rem; + display: block; + font-family: Arial; + border: 0px; +} +.ejs_netplay_name_heading { + margin-top: 0!important; + margin-bottom: 0!important; + font-weight: 600!important; + font-size: 1.25rem; + line-height: 1.25!important; + color: rgba(var(--ejs-primary-color),1)!important; + display: flex; + justify-content: space-between; + align-items: center; +} +.ejs_netplay_table { + font-family: Avenir,"Avenir Next","Helvetica Neue","Segoe UI",Helvetica,Arial,sans-serif; + font-size: 0.8rem; + padding: 0 10px; +} +.ejs_netplay_join_button { + float: none; + padding: .1rem .5rem; + background-color: rgba(var(--ejs-primary-color),1); + color: #fff!important; + border-radius: .25rem; + cursor: pointer; +} +.ejs_netplay_table_row:hover { + background-color: #2d2d2d; +} diff --git a/semag/emulatorjs/data/emulator.js b/semag/emulatorjs/data/emulator.js index af1cf996..e9a7328b 100644 --- a/semag/emulatorjs/data/emulator.js +++ b/semag/emulatorjs/data/emulator.js @@ -1,4780 +1,5041 @@ -class EmulatorJS { - version = 11; //Increase by 1 when cores are updated - getCore(generic) { - const core = this.config.system; - /*todo: - Systems: msx - - Cores: - - FreeChaF - - FreeIntv - - NeoCD - - O2EM - - Vecx - */ - if (generic) { - const options = { - 'a5200': 'atari5200', - 'beetle_vb': 'vb', - 'desmume': 'nds', - 'desmume2015': 'nds', - 'fbalpha2012_cps1': 'arcade', - 'fbalpha2012_cps2': 'arcade', - 'fbneo': 'arcade', - 'fceumm': 'nes', - 'gambatte': 'gb', - 'gearcoleco': 'coleco', - 'genesis_plus_gx': 'sega', - 'handy': 'lynx', - 'mame2003': 'mame2003', - 'mame2003_plus': 'mame2003', - 'mednafen_ngp': 'ngp', - 'mednafen_pce': 'pce', - 'mednafen_pcfx': 'pcfx', - 'mednafen_psx_hw': 'psx', - 'mednafen_wswan': 'ws', - 'melonds': 'nds', - 'mgba': 'gba', - 'mupen64plus_next': 'n64', - 'nestopia': 'nes', - 'opera': '3do', - 'parallel_n64': 'n64', - 'pcsx_rearmed': 'psx', - 'picodrive': 'sega', - 'ppsspp': 'psp', - 'prosystem': 'atari7800', - 'snes9x': 'snes', - 'stella2014': 'atari2600', - 'virtualjaguar': 'jaguar', - 'yabause': 'segaSaturn', - 'puae': 'amiga', - 'vice_x64': 'c64' - } - return options[core] || core; - } - const options = { - 'jaguar': 'virtualjaguar', - 'lynx': 'handy', - 'segaSaturn': 'yabause', - 'segaMS': 'genesis_plus_gx', - 'segaMD': 'genesis_plus_gx', - 'segaGG': 'genesis_plus_gx', - 'segaCD': 'genesis_plus_gx', - 'sega32x': 'picodrive', - 'atari2600': 'stella2014', - 'atari7800': 'prosystem', - 'nes': 'fceumm', - 'snes': 'snes9x', - 'atari5200': 'a5200', - 'gb': 'gambatte', - 'gba': 'mgba', - 'vb': 'beetle_vb', - 'n64': 'mupen64plus_next', - 'nds': 'melonds', - 'mame2003': 'mame2003_plus', - 'arcade': 'fbneo', - 'psx': 'pcsx_rearmed', - '3do': 'opera', - 'psp': 'ppsspp', - 'pce': 'mednafen_pce', - 'pcfx': 'mednafen_pcfx', - 'ngp': 'mednafen_ngp', - 'ws': 'mednafen_wswan', - 'coleco': 'gearcoleco', - 'amiga': 'puae', - 'c64': 'vice_x64' - } - if (this.isSafari && this.isMobile && this.getCore(true) === "n64") { - return "parallel_n64"; - } - return options[core] || core; - } - extensions = { - 'a5200': ['a52', 'bin'], - 'amiga': ['adf', 'adz', 'dms', 'fdi', 'ipf', 'raw', 'hdf', 'hdz', 'lha', 'slave', 'info', 'cue', 'ccd', 'chd', 'nrg', 'mds', 'iso', 'uae', 'm3u', 'zip', '7z'], - 'desmume': ['nds', 'bin'], - 'desmume2015': ['nds', 'bin'], - 'fbalpha2012_cps1': ['zip'], - 'fbalpha2012_cps2': ['zip'], - 'fbneo': ['zip', '7z'], - 'fceumm': ['fds', 'nes', 'unif', 'unf'], - 'gambatte': ['gb', 'gbc', 'dmg'], - 'gearcoleco': ['col', 'cv', 'bin', 'rom'], - 'genesis_plus_gx': ['m3u', 'mdx', 'md', 'smd', 'gen', 'bin', 'cue', 'iso', 'chd', 'bms', 'sms', 'gg', 'sg', '68k', 'sgd'], - 'handy': ['lnx'], - 'mame2003': ['zip'], - 'mame2003_plus': ['zip'], - 'mednafen_ngp': ['ngp', 'ngc'], - 'mednafen_pce': ['pce', 'cue', 'ccd', 'iso', 'img', 'bin', 'chd'], - 'mednafen_pcfx': ['cue', 'ccd', 'toc', 'chd'], - 'mednafen_psx': ['cue', 'toc', 'm3u', 'ccd', 'exe', 'pbp', 'chd'], - 'mednafen_wswan': ['ws', 'wsc', 'pc2'], - 'mednafen_psx_hw': ['cue', 'toc', 'm3u', 'ccd', 'exe', 'pbp', 'chd'], - 'beetle_vb': ['vb', 'vboy', 'bin'], - 'melonds': ['nds'], - 'mgba': ['gb', 'gbc', 'gba'], - 'mupen64plus_next': ['n64', 'v64', 'z64', 'bin', 'u1', 'ndd', 'gb'], - 'nestopia': ['fds', 'nes', 'unif', 'unf'], - 'opera': ['iso', 'bin', 'chd', 'cue'], - 'parallel_n64': ['n64', 'v64', 'z64', 'bin', 'u1', 'ndd', 'gb'], - 'pcsx_rearmed': ['bin', 'cue', 'img', 'mdf', 'pbp', 'toc', 'cbn', 'm3u', 'ccd'], - 'picodrive': ['bin', 'gen', 'smd', 'md', '32x', 'cue', 'iso', 'sms', '68k', 'chd'], - 'ppsspp': ['elf', 'iso', 'cso', 'prx', 'pbp'], - 'prosystem': ['a78', 'bin'], - 'snes9x': ['smc', 'sfc', 'swc', 'fig', 'bs', 'st'], - 'stella2014': ['a26', 'bin', 'zip'], - 'vice_x64': ['d64', 'd6z', 'd71', 'd7z', 'd80', 'd81', 'd82', 'd8z', 'g64', 'g6z', 'g41', 'g4z', 'x64', 'x6z', 'nib', 'nbz', 'd2m', 'd4m', 't64', 'tap', 'tcrt', 'prg', 'p00', 'crt', 'bin', 'cmd', 'm3u', 'vfl', 'vsf', 'zip', '7z', 'gz', '20', '40', '60', 'a0', 'b0', 'rom'], - 'virtualjaguar': ['j64', 'jag', 'rom', 'abs', 'cof', 'bin', 'prg'], - 'yabause': ['cue', 'iso', 'ccd', 'mds', 'chd', 'zip', 'm3u'] - } - createElement(type) { - return document.createElement(type); - } - addEventListener(element, listener, callback) { - const listeners = listener.split(" "); - let rv = []; - for (let i=0; i { - if (opts.method === 'HEAD') { - cb({headers:{}}); - return; - } else { - cb({headers:{}, data:game}); - return; - } - }) - return; - } - const basePath = notWithPath ? '' : this.config.dataPath; - path = basePath + path; - if (!notWithPath && this.config.filePaths) { - if (typeof this.config.filePaths[path.split('/').pop()] === "string") { - path = this.config.filePaths[path.split('/').pop()]; - } - } - let url; - try {url=new URL(path)}catch(e){}; - if ((url && ['http:', 'https:'].includes(url.protocol)) || !url) { - const xhr = new XMLHttpRequest(); - if (progressCB instanceof Function) { - xhr.addEventListener('progress', (e) => { - const progress = e.total ? ' '+Math.floor(e.loaded / e.total * 100).toString()+'%' : ' '+(e.loaded/1048576).toFixed(2)+'MB'; - progressCB(progress); - }); - } - xhr.onload = function() { - if (xhr.readyState === xhr.DONE) { - let data = xhr.response; - if (xhr.status.toString().startsWith("4") || xhr.status.toString().startsWith("5")) { - cb(-1); - return; - } - try {data=JSON.parse(data)}catch(e){} - cb({ - data: data, - headers: { - "content-length": xhr.getResponseHeader('content-length') - } - }); - } - } - if (opts.responseType) xhr.responseType = opts.responseType; - xhr.onerror = () => cb(-1); - xhr.open(opts.method, path, true); - xhr.send(); - } else { - (async () => { - //Most commonly blob: urls. Not sure what else it could be - if (opts.method === 'HEAD') { - cb({headers:{}}); - return; - } - let res; - try { - res = await fetch(path); - if ((opts.type && opts.type.toLowerCase() === 'arraybuffer') || !opts.type) { - res = await res.arrayBuffer(); - } else { - res = await res.text(); - try {res = JSON.parse(res)} catch(e) {} - } - } catch(e) { - cb(-1); - } - if (path.startsWith('blob:')) URL.revokeObjectURL(path); - cb({ - data: res, - headers: {} - }); - })(); - } - } - toData(data, rv) { - if (!(data instanceof ArrayBuffer) && !(data instanceof Uint8Array) && !(data instanceof Blob)) return null; - if (rv) return true; - return new Promise(async (resolve) => { - if (data instanceof ArrayBuffer) { - resolve(new Uint8Array(data)); - } else if (data instanceof Uint8Array) { - resolve(data); - } else if (data instanceof Blob) { - resolve(new Uint8Array(await data.arrayBuffer())); - } - resolve(); - }) - } - checkForUpdates() { - } - constructor(element, config) { - this.ejs_version = "4.0.8"; - this.ejs_num_version = 40.8; - this.debug = (window.EJS_DEBUG_XX === true); - if (this.debug || (window.location && ['localhost', '127.0.0.1'].includes(location.hostname))) this.checkForUpdates(); - this.netplayEnabled = (window.EJS_DEBUG_XX === true) && (window.EJS_EXPERIMENTAL_NETPLAY === true); - this.settingsLanguage = window.EJS_settingsLanguage || false; - this.config = config; - this.currentPopup = null; - this.isFastForward = false; - this.isSlowMotion = false; - this.rewindEnabled = this.loadRewindEnabled(); - this.touch = false; - this.cheats = []; - this.started = false; - this.volume = (typeof this.config.volume === "number") ? this.config.volume : 0.5; - if (this.config.defaultControllers) this.defaultControllers = this.config.defaultControllers; - this.muted = false; - this.paused = true; - this.listeners = []; - this.missingLang = []; - this.setElements(element); - this.setColor(this.config.color || ""); - this.config.alignStartButton = (typeof this.config.alignStartButton === "string") ? this.config.alignStartButton : "bottom"; - this.config.backgroundColor = (typeof this.config.backgroundColor === "string") ? this.config.backgroundColor : "rgb(51, 51, 51)"; - if (this.config.adUrl) { - this.config.adSize = (Array.isArray(this.config.adSize)) ? this.config.adSize : ["300px", "250px"]; - this.setupAds(this.config.adUrl, this.config.adSize[0], this.config.adSize[1]); - } - this.canvas = this.createElement('canvas'); - this.canvas.classList.add('ejs_canvas'); - this.bindListeners(); - this.config.netplayUrl = this.config.netplayUrl || "https://netplay.emulatorjs.org"; - this.fullscreen = false; - this.isMobile = (function() { - let check = false; - (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) check = true;})(navigator.userAgent||navigator.vendor||window.opera); - return check; - })(); - this.isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); - this.storage = { - rom: new window.EJS_STORAGE("EmulatorJS-roms", "rom"), - bios: new window.EJS_STORAGE("EmulatorJS-bios", "bios"), - core: new window.EJS_STORAGE("EmulatorJS-core", "core"), - states: new window.EJS_STORAGE("EmulatorJS-states", "states") - } - - this.game.classList.add("ejs_game"); - if (typeof this.config.backgroundImg === "string") { - this.game.classList.add("ejs_game_background"); - if (this.config.backgroundBlur) this.game.classList.add("ejs_game_background_blur"); - this.game.setAttribute("style", "--ejs-background-image: url("+this.config.backgroundImg+"); --ejs-background-color: "+this.config.backgroundColor+";"); - this.on("start", () => { - this.game.classList.remove("ejs_game_background"); - if (this.config.backgroundBlur) this.game.classList.remove("ejs_game_background_blur"); - }) - } else { - this.game.setAttribute("style", "--ejs-background-color: "+this.config.backgroundColor+";"); - } - - if (Array.isArray(this.config.cheats)) { - for (let i=0; i -1 && this.config.adMode < 3) ? this.config.adMode : 2; - div.classList.add("ejs_ad_iframe"); - const frame = this.createElement("iframe"); - frame.src = ads; - frame.setAttribute("scrolling", "no"); - frame.setAttribute("frameborder", "no"); - frame.style.width = width; - frame.style.height = height; - const closeParent = this.createElement("div"); - closeParent.classList.add("ejs_ad_close"); - const closeButton = this.createElement("a"); - closeParent.appendChild(closeButton); - closeParent.setAttribute("hidden", ""); - div.appendChild(closeParent); - div.appendChild(frame); - if (this.config.adMode !== 1) { - this.elements.parent.appendChild(div); - } - this.addEventListener(closeButton, "click", () => { - div.remove(); - }) - - this.on("start-clicked", () => { - if (this.config.adMode === 0) div.remove(); - if (this.config.adMode === 1){ - this.elements.parent.appendChild(div); - } - }) - - this.on("start", () => { - closeParent.removeAttribute("hidden"); - const time = (typeof this.config.adTimer === "number" && this.config.adTimer > 0) ? this.config.adTimer : 10000; - if (this.config.adTimer === -1) div.remove(); - if (this.config.adTimer === 0) return; - setTimeout(() => { - div.remove(); - }, time); - }) - - } - adBlocked(url, del){ - if (del){ - document.querySelector('div[class="ejs_ad_iframe"]').remove(); - } else { - try { - document.querySelector('div[class="ejs_ad_iframe"]').remove(); - } catch(e) {} - this.config.adUrl = url; - this.setupAds(this.config.adUrl, this.config.adSize[0], this.config.adSize[1]); - } - } - functions = {}; - on(event, func) { - if (!Array.isArray(this.functions[event])) this.functions[event] = []; - this.functions[event].push(func); - } - callEvent(event, data) { - if (!Array.isArray(this.functions[event])) return 0; - this.functions[event].forEach(e => e(data)); - return this.functions[event].length; - } - setElements(element) { - const game = this.createElement("div"); - const elem = document.querySelector(element); - elem.innerHTML = ""; - elem.appendChild(game); - this.game = game; - - this.elements = { - main: this.game, - parent: elem - } - this.elements.parent.classList.add("ejs_parent"); - this.elements.parent.setAttribute("tabindex", -1); - } - // Start button - createStartButton() { - const button = this.createElement("div"); - button.classList.add("ejs_start_button"); - let border = 0; - if (typeof this.config.backgroundImg === "string"){ - button.classList.add("ejs_start_button_border"); - border = 1; - } - button.innerText = (typeof this.config.startBtnName === 'string') ? this.config.startBtnName : this.localization("Start Game"); - if (this.config.alignStartButton == "top"){ - button.style.bottom = "calc(100% - 20px)"; - }else if (this.config.alignStartButton == "center"){ - button.style.bottom = "calc(50% + 22.5px + "+border+"px)"; - } - this.elements.parent.appendChild(button); - this.addEventListener(button, "touchstart", () => { - this.touch = true; - }) - this.addEventListener(button, "click", this.startButtonClicked.bind(this)); - if (this.config.startOnLoad === true) { - this.startButtonClicked(button); - } - setTimeout(() => { - this.callEvent("ready"); - }, 20); - } - startButtonClicked(e) { - this.callEvent("start-clicked"); - if (e.pointerType === "touch") { - this.touch = true; - } - if (e.preventDefault) { - e.preventDefault(); - e.target.remove(); - } else { - e.remove(); - } - this.createText(); - this.downloadGameCore(); - } - // End start button - createText() { - this.textElem = this.createElement("div"); - this.textElem.classList.add("ejs_loading_text"); - if (typeof this.config.backgroundImg === "string") this.textElem.classList.add("ejs_loading_text_glow"); - this.textElem.innerText = this.localization("Loading..."); - this.elements.parent.appendChild(this.textElem); - } - localization(text, log) { - if (typeof text === "undefined") return; - text = text.toString(); - if (text.includes("EmulatorJS v")) return text; - if (this.config.langJson) { - if (typeof log === "undefined") log = true; - if (!this.config.langJson[text] && log) { - if (!this.missingLang.includes(text)) this.missingLang.push(text); - console.log("Translation not found for '"+text+"'. Language set to '"+this.config.language+"'"); - } - return this.config.langJson[text] || text; - } - return text; - } - checkCompression(data, msg, fileCbFunc) { - if (msg) { - this.textElem.innerText = msg; - } - //to be put in another file - function isCompressed(data) { //https://www.garykessler.net/library/file_sigs.html - //todo. Use hex instead of numbers - if ((data[0] === 80 && data[1] === 75) && ((data[2] === 3 && data[3] === 4) || (data[2] === 5 && data[3] === 6) || (data[2] === 7 && data[3] === 8))) { - return 'zip'; - } else if (data[0] === 55 && data[1] === 122 && data[2] === 188 && data[3] === 175 && data[4] === 39 && data[5] === 28) { - return '7z'; - } else if ((data[0] === 82 && data[1] === 97 && data[2] === 114 && data[3] === 33 && data[4] === 26 && data[5] === 7) && ((data[6] === 0) || (data[6] === 1 && data[7] == 0))) { - return 'rar'; - } - } - const createWorker = (path) => { - return new Promise((resolve, reject) => { - this.downloadFile(path, (res) => { - if (res === -1) { - this.textElem.innerText = this.localization('Network Error'); - this.textElem.style.color = "red"; - return; - } - const blob = new Blob([res.data], { - 'type': 'application/javascript' - }) - const url = window.URL.createObjectURL(blob); - resolve(new Worker(url)); - }, null, false, {responseType: "arraybuffer", method: "GET"}); - }) - } - const files = {}; - let res; - const onMessage = (data) => { - if (!data.data) return; - //data.data.t/ 4=progress, 2 is file, 1 is zip done - if (data.data.t === 4 && msg) { - const pg = data.data; - const num = Math.floor(pg.current / pg.total * 100); - if (isNaN(num)) return; - const progress = ' '+num.toString()+'%'; - this.textElem.innerText = msg + progress; - } - if (data.data.t === 2) { - if (typeof fileCbFunc === "function") { - fileCbFunc(data.data.file, data.data.data); - files[data.data.file] = true; - } else { - files[data.data.file] = data.data.data; - } - } - if (data.data.t === 1) { - res(files); - } - } - const decompress7z = (file) => { - return new Promise((resolve, reject) => { - res = resolve; - - createWorker('compression/extract7z.js').then((worker) => { - worker.onmessage = onMessage; - worker.postMessage(file); - //console.log(file); - }) - }) - } - const decompressRar = (file) => { - return new Promise((resolve, reject) => { - res = resolve; - - this.downloadFile("compression/libunrar.js", (res) => { - this.downloadFile("compression/libunrar.wasm", (res2) => { - if (res === -1 || res2 === -1) { - this.textElem.innerText = this.localization('Network Error'); - this.textElem.style.color = "red"; - return; - } - const path = URL.createObjectURL(new Blob([res2.data], {type: "application/wasm"})); - let data = '\nlet dataToPass = [];\nModule = {\n monitorRunDependencies: function(left) {\n if (left == 0) {\n setTimeout(function() {\n unrar(dataToPass, null);\n }, 100);\n }\n },\n onRuntimeInitialized: function() {\n },\n locateFile: function(file) {\n return \''+path+'\';\n }\n};\n'+res.data+'\nlet unrar = function(data, password) {\n let cb = function(fileName, fileSize, progress) {\n postMessage({"t":4,"current":progress,"total":fileSize, "name": fileName});\n };\n\n let rarContent = readRARContent(data.map(function(d) {\n return {\n name: d.name,\n content: new Uint8Array(d.content)\n }\n }), password, cb)\n let rec = function(entry) {\n if (!entry) return;\n if (entry.type === \'file\') {\n postMessage({"t":2,"file":entry.fullFileName,"size":entry.fileSize,"data":entry.fileContent});\n } else if (entry.type === \'dir\') {\n Object.keys(entry.ls).forEach(function(k) {\n rec(entry.ls[k]);\n })\n } else {\n throw "Unknown type";\n }\n }\n rec(rarContent);\n postMessage({"t":1});\n return rarContent;\n};\nonmessage = function(data) {\n dataToPass.push({name: \'test.rar\', content: data.data});\n};\n '; - const blob = new Blob([data], { - 'type': 'application/javascript' - }) - const url = window.URL.createObjectURL(blob); - const worker = new Worker(url); - worker.onmessage = onMessage; - worker.postMessage(file); - }, null, false, {responseType: "arraybuffer", method: "GET"}) - }, null, false, {responseType: "text", method: "GET"}); - - }) - } - const decompressZip = (file) => { - return new Promise((resolve, reject) => { - res = resolve; - - createWorker('compression/extractzip.js').then((worker) => { - worker.onmessage = onMessage; - worker.postMessage(file); - }) - }) - } - const compression = isCompressed(data.slice(0, 10)); - if (compression) { - //Need to do zip and rar still - if (compression === "7z") { - return decompress7z(data); - } else if (compression === "zip") { - return decompressZip(data); - } else if (compression === "rar") { - return decompressRar(data); - } - } else { - if (typeof fileCbFunc === "function") { - fileCbFunc("!!notCompressedData", data); - return new Promise(resolve => resolve({"!!notCompressedData": true})); - } else { - return new Promise(resolve => resolve({"!!notCompressedData": data})); - } - } - - } - downloadGameCore() { - this.textElem.innerText = this.localization("Download Game Core"); - if (this.config.threads && ((typeof window.SharedArrayBuffer) !== "function")) { - this.textElem.innerText = this.localization('Error for site owner')+"\n"+this.localization("Check console"); - this.textElem.style.color = "red"; - console.warn("Threads is set to true, but the SharedArrayBuffer function is not exposed. Threads requires 2 headers to be set when sending you html page. See https://stackoverflow.com/a/68630724"); - return; - } - const gotCore = (data) => { - this.checkCompression(new Uint8Array(data), this.localization("Decompress Game Core")).then((data) => { - let js, thread, wasm; - for (let k in data) { - if (k.endsWith(".wasm")) { - wasm = data[k]; - } else if (k.endsWith(".worker.js")) { - thread = data[k]; - } else if (k.endsWith(".js")) { - js = data[k]; - } - } - this.initGameCore(js, wasm, thread); - }); - } - this.storage.core.get(this.getCore()+'-wasm.data').then((result) => { - if (result && result.version === this.version && !this.debug) { - gotCore(result.data); - return; - } - let corePath = 'cores/'+this.getCore()+(this.config.threads ? "-thread" : "")+'-wasm.data'; - this.downloadFile(corePath, (res) => { - if (res === -1) { - this.textElem.innerText = this.localization('Network Error'); - this.textElem.style.color = "red"; - return; - } - gotCore(res.data); - this.storage.core.put(this.getCore()+'-wasm.data', { - version: this.version, - data: res.data - }); - }, (progress) => { - this.textElem.innerText = this.localization("Download Game Core") + progress; - }, false, {responseType: "arraybuffer", method: "GET"}); - }) - } - initGameCore(js, wasm, thread) { - this.initModule(wasm, thread); - let script = this.createElement("script"); - script.src = URL.createObjectURL(new Blob([js], {type: "application/javascript"})); - document.body.appendChild(script); - } - getBaseFileName() { - //Only once game and core is loaded - if (!this.started) return null; - if (typeof this.config.gameName === "string") { - const invalidCharacters = /[#<$+%>!`&*'|{}/\\?"=@:^\r\n]/ig; - const name = this.config.gameName.replace(invalidCharacters, "").trim(); - if (name) return name; - } - let parts = this.fileName.split("."); - parts.splice(parts.length-1, 1); - return parts.join("."); - } - saveInBrowserSupported() { - return !!window.indexedDB && (typeof this.config.gameName === "string" || !this.config.gameUrl.startsWith("blob:")); - } - displayMessage(message) { - if (!this.msgElem) { - this.msgElem = this.createElement("div"); - this.msgElem.classList.add("ejs_message"); - this.elements.parent.appendChild(this.msgElem); - } - clearTimeout(this.msgTimeout); - this.msgTimeout = setTimeout(() => { - this.msgElem.innerText = ""; - }, 3000) - this.msgElem.innerText = message; - } - downloadStartState() { - return new Promise((resolve, reject) => { - if (typeof this.config.loadState !== "string" && !this.toData(this.config.loadState, true)) { - resolve(); - return; - } - this.textElem.innerText = this.localization("Download Game State"); - - this.downloadFile(this.config.loadState, (res) => { - if (res === -1) { - this.textElem.innerText = this.localization('Network Error'); - this.textElem.style.color = "red"; - return; - } - this.on("start", () => { - setTimeout(() => { - this.gameManager.loadState(new Uint8Array(res.data)); - }, 10); - }) - resolve(); - }, (progress) => { - this.textElem.innerText = this.localization("Download Game State") + progress; - }, true, {responseType: "arraybuffer", method: "GET"}); - }) - } - downloadGamePatch() { - return new Promise((resolve, reject) => { - if ((typeof this.config.gamePatchUrl !== "string" || !this.config.gamePatchUrl.trim()) && !this.toData(this.config.gamePatchUrl, true)) { - resolve(); - return; - } - this.textElem.innerText = this.localization("Download Game Patch"); - const gotData = (data) => { - this.checkCompression(new Uint8Array(data), this.localization("Decompress Game Patch")).then((data) => { - for (const k in data) { - if (k === "!!notCompressedData") { - FS.writeFile(this.config.gamePatchUrl.split('/').pop().split("#")[0].split("?")[0], data[k]); - break; - } - if (k.endsWith('/')) continue; - FS.writeFile("/" + k.split('/').pop(), data[k]); - } - resolve(); - }) - } - - this.downloadFile(this.config.gamePatchUrl, (res) => { - this.storage.rom.get(this.config.gamePatchUrl.split("/").pop()).then((result) => { - if (result && result['content-length'] === res.headers['content-length'] && !this.debug) { - gotData(result.data); - return; - } - this.downloadFile(this.config.gamePatchUrl, (res) => { - if (res === -1) { - this.textElem.innerText = this.localization('Network Error'); - this.textElem.style.color = "red"; - return; - } - if (this.toData(this.config.gamePatchUrl, true)) { - this.config.gamePatchUrl = "game"; - } - gotData(res.data); - const limit = (typeof this.config.cacheLimit === "number") ? this.config.cacheLimit : 1073741824; - if (parseFloat(res.headers['content-length']) < limit && this.saveInBrowserSupported() && this.config.gamePatchUrl !== "game") { - this.storage.rom.put(this.config.gamePatchUrl.split("/").pop(), { - "content-length": res.headers['content-length'], - data: res.data - }) - } - }, (progress) => { - this.textElem.innerText = this.localization("Download Game Patch") + progress; - }, true, {responseType: "arraybuffer", method: "GET"}); - }) - }, null, true, {method: "HEAD"}) - }) - } - downloadGameParent() { - return new Promise((resolve, reject) => { - if ((typeof this.config.gameParentUrl !== "string" || !this.config.gameParentUrl.trim()) && !this.toData(this.config.gameParentUrl, true)) { - resolve(); - return; - } - this.textElem.innerText = this.localization("Download Game Parent"); - const gotData = (data) => { - this.checkCompression(new Uint8Array(data), this.localization("Decompress Game Parent")).then((data) => { - for (const k in data) { - if (k === "!!notCompressedData") { - FS.writeFile(this.config.gameParentUrl.split('/').pop().split("#")[0].split("?")[0], data[k]); - break; - } - if (k.endsWith('/')) continue; - FS.writeFile("/" + k.split('/').pop(), data[k]); - } - resolve(); - }) - } - - this.downloadFile(this.config.gameParentUrl, (res) => { - this.storage.rom.get(this.config.gameParentUrl.split("/").pop()).then((result) => { - if (result && result['content-length'] === res.headers['content-length'] && !this.debug) { - gotData(result.data); - return; - } - this.downloadFile(this.config.gameParentUrl, (res) => { - if (res === -1) { - this.textElem.innerText = this.localization('Network Error'); - this.textElem.style.color = "red"; - return; - } - if (this.toData(this.config.gameParentUrl, true)) { - this.config.gameParentUrl = "game"; - } - gotData(res.data); - const limit = (typeof this.config.cacheLimit === "number") ? this.config.cacheLimit : 1073741824; - if (parseFloat(res.headers['content-length']) < limit && this.saveInBrowserSupported() && this.config.gameParentUrl !== "game") { - this.storage.rom.put(this.config.gameParentUrl.split("/").pop(), { - "content-length": res.headers['content-length'], - data: res.data - }) - } - }, (progress) => { - this.textElem.innerText = this.localization("Download Game Parent") + progress; - }, true, {responseType: "arraybuffer", method: "GET"}); - }) - }, null, true, {method: "HEAD"}) - }) - } - downloadBios() { - return new Promise((resolve, reject) => { - if ((typeof this.config.biosUrl !== "string" || !this.config.biosUrl.trim()) && !this.toData(this.config.biosUrl, true)) { - resolve(); - return; - } - this.textElem.innerText = this.localization("Download Game BIOS"); - const gotBios = (data) => { - this.checkCompression(new Uint8Array(data), this.localization("Decompress Game BIOS")).then((data) => { - for (const k in data) { - if (k === "!!notCompressedData") { - FS.writeFile(this.config.biosUrl.split('/').pop().split("#")[0].split("?")[0], data[k]); - break; - } - if (k.endsWith('/')) continue; - FS.writeFile("/" + k.split('/').pop(), data[k]); - } - resolve(); - }) - } - - this.downloadFile(this.config.biosUrl, (res) => { - if (res === -1) { - this.textElem.innerText = this.localization('Network Error'); - this.textElem.style.color = "red"; - return; - } - this.storage.bios.get(this.config.biosUrl.split("/").pop()).then((result) => { - if (result && result['content-length'] === res.headers['content-length'] && !this.debug) { - gotBios(result.data); - return; - } - this.downloadFile(this.config.biosUrl, (res) => { - if (res === -1) { - this.textElem.innerText = this.localization('Network Error'); - this.textElem.style.color = "red"; - return; - } - if (this.toData(this.config.biosUrl, true)) { - this.config.biosUrl = "game"; - } - gotBios(res.data); - if (this.saveInBrowserSupported() && this.config.biosUrl !== "game") { - this.storage.bios.put(this.config.biosUrl.split("/").pop(), { - "content-length": res.headers['content-length'], - data: res.data - }) - } - }, (progress) => { - this.textElem.innerText = this.localization("Download Game BIOS") + progress; - }, true, {responseType: "arraybuffer", method: "GET"}); - }) - }, null, true, {method: "HEAD"}) - }) - } - downloadRom() { - const extractFileNameFromUrl = url => { - if (!url) return null; - return url.split('/').pop().split("#")[0].split("?")[0]; - }; - const supportsExt = (ext) => { - const core = this.getCore(); - if (!this.extensions[core]) return false; - return this.extensions[core].includes(ext); - }; - - return new Promise(resolve => { - this.textElem.innerText = this.localization("Download Game Data"); - - const gotGameData = (data) => { - if (['arcade', 'mame2003'].includes(this.getCore(true))) { - this.fileName = extractFileNameFromUrl(this.config.gameUrl); - FS.writeFile(this.fileName, new Uint8Array(data)); - resolve(); - return; - } - - const altName = this.config.gameUrl.startsWith("blob:") ? (this.config.gameName || "game") : extractFileNameFromUrl(this.config.gameUrl); - - let disableCue = false; - if (['pcsx_rearmed', 'genesis_plus_gx', 'picodrive', 'mednafen_pce', 'vice_x64'].includes(this.getCore()) && this.config.disableCue === undefined) { - disableCue = true; - } else { - disableCue = this.config.disableCue; - } - - let fileNames = []; - this.checkCompression(new Uint8Array(data), this.localization("Decompress Game Data"), (fileName, fileData) => { - if (fileName.includes("/")) { - const paths = fileName.split("/"); - let cp = ""; - for (let i=0; i { - let isoFile = null; - let supportedFile = null; - let cueFile = null; - let selectedCueExt = null; - fileNames.forEach(fileName => { - const ext = fileName.split('.').pop().toLowerCase(); - if (supportedFile === null && supportsExt(ext)) { - supportedFile = fileName; - } - if (isoFile === null && ['iso', 'cso', 'chd', 'elf'].includes(ext)) { - isoFile = fileName; - } - if (['cue', 'ccd', 'toc', 'm3u'].includes(ext)) { - if (this.getCore(true) === 'psx') { - //always prefer m3u files for psx cores - if (selectedCueExt !== 'm3u') { - if (cueFile === null || ext === 'm3u') { - cueFile = fileName; - selectedCueExt = ext; - } - } - } else { - //prefer cue or ccd files over toc or m3u - if (!['cue', 'ccd'].includes(selectedCueExt)) { - if (cueFile === null || ['cue', 'ccd'].includes(ext)) { - cueFile = fileName; - selectedCueExt = ext; - } - } - } - } - }); - if (supportedFile !== null) { - this.fileName = supportedFile; - } else { - this.fileName = fileNames[0]; - } - if (isoFile !== null && (supportsExt('iso') || supportsExt('cso') || supportsExt('chd') || supportsExt('elf'))) { - this.fileName = isoFile; - } else if (supportsExt('cue') || supportsExt('ccd') || supportsExt('toc') || supportsExt('m3u')) { - if (cueFile !== null) { - this.fileName = cueFile; - } else if (!disableCue) { - this.fileName = this.gameManager.createCueFile(fileNames); - } - } - resolve(); - }); - } - - this.downloadFile(this.config.gameUrl, (res) => { - if (res === -1) { - this.textElem.innerText = this.localization('Network Error'); - this.textElem.style.color = "red"; - return; - } - const name = (typeof this.config.gameUrl === "string") ? this.config.gameUrl.split('/').pop() : "game"; - this.storage.rom.get(name).then((result) => { - if (result && result['content-length'] === res.headers['content-length'] && !this.debug && name !== "game") { - gotGameData(result.data); - return; - } - this.downloadFile(this.config.gameUrl, (res) => { - if (res === -1) { - this.textElem.innerText = this.localization('Network Error'); - this.textElem.style.color = "red"; - return; - } - if (this.toData(this.config.gameUrl, true)) { - this.config.gameUrl = "game"; - } - gotGameData(res.data); - const limit = (typeof this.config.cacheLimit === "number") ? this.config.cacheLimit : 1073741824; - if (parseFloat(res.headers['content-length']) < limit && this.saveInBrowserSupported() && this.config.gameUrl !== "game") { - this.storage.rom.put(this.config.gameUrl.split("/").pop(), { - "content-length": res.headers['content-length'], - data: res.data - }) - } - }, (progress) => { - this.textElem.innerText = this.localization("Download Game Data") + progress; - }, true, {responseType: "arraybuffer", method: "GET"}); - }) - }, null, true, {method: "HEAD"}) - }) - } - downloadFiles() { - (async () => { - this.gameManager = new window.EJS_GameManager(this.Module, this); - if (this.getCore() === "ppsspp") { - await this.gameManager.loadPpssppAssets(); - } - await this.downloadRom(); - await this.downloadBios(); - await this.downloadStartState(); - await this.downloadGameParent(); - await this.downloadGamePatch(); - this.startGame(); - })(); - } - initModule(wasmData, threadData) { - window.Module = { - 'noInitialRun': true, - 'onRuntimeInitialized': this.downloadFiles.bind(this), - 'arguments': [], - 'preRun': [], - 'postRun': [], - 'canvas': this.canvas, - 'print': (msg) => { - if (this.debug) { - console.log(msg); - } - }, - 'printErr': (msg) => { - if (this.debug) { - console.log(msg); - } - }, - 'totalDependencies': 0, - 'monitorRunDependencies': () => {}, - 'locateFile': function(fileName) { - if (this.debug) console.log(fileName); - if (fileName.endsWith(".wasm")) { - return URL.createObjectURL(new Blob([wasmData], {type: "application/wasm"})); - } else if (fileName.endsWith(".worker.js")) { - return URL.createObjectURL(new Blob([threadData], {type: "application/javascript"})); - } - } - }; - this.Module = window.Module; - } - startGame() { - try { - const args = []; - if (this.debug) args.push('-v'); - args.push('/'+this.fileName); - if (this.debug) console.log(args); - this.Module.callMain(args); - if (typeof this.config.softLoad === "number" && this.config.softLoad > 0) { - this.resetTimeout = setTimeout(() => { - this.gameManager.restart(); - }, this.config.softLoad * 1000); - } - this.Module.resumeMainLoop(); - this.checkSupportedOpts(); - this.setupSettingsMenu(); - this.loadSettings(); - this.updateCheatUI(); - this.updateGamepadLabels(); - if (!this.muted) this.setVolume(this.volume); - this.elements.parent.focus(); - this.textElem.remove(); - this.textElem = null; - this.game.classList.remove("ejs_game"); - this.game.appendChild(this.canvas); - this.handleResize(); - this.started = true; - this.paused = false; - if (this.touch) { - this.virtualGamepad.style.display = ""; - } - this.handleResize(); - if (this.config.fullscreenOnLoad) { - try { - this.toggleFullscreen(true); - } catch(e) { - if (this.debug) console.warn("Could not fullscreen on load"); - } - } - if (this.isSafari && this.isMobile) { - //Safari is --- funny - this.checkStarted(); - } - } catch(e) { - console.warn("failed to start game", e); - this.textElem.innerText = this.localization("Failed to start game"); - this.textElem.style.color = "red"; - return; - } - this.callEvent("start"); - } - checkStarted() { - (async() => { - let sleep = (ms) => new Promise(r => setTimeout(r, ms)); - let state = "suspended"; - let popup; - while (state === "suspended") { - if (!window.AL) return; - window.AL.currentCtx.sources.forEach(ctx => { - state = ctx.gain.context.state; - }); - if (state !== "suspended") break; - if (!popup) { - popup = this.createPopup("", {}); - const button = this.createElement("button"); - button.innerText = "Click to resume Emulator"; - button.classList.add("ejs_menu_button"); - button.style.width = "25%"; - button.style.height = "25%"; - popup.appendChild(button); - popup.style["text-align"] = "center"; - popup.style["font-size"] = "28px"; - } - await sleep(10); - } - if (popup) this.closePopup(); - })(); - } - bindListeners() { - this.createContextMenu(); - this.createBottomMenuBar(); - this.createControlSettingMenu(); - this.createCheatsMenu() - this.createNetplayMenu(); - this.setVirtualGamepad(); - this.addEventListener(this.elements.parent, "keydown keyup", this.keyChange.bind(this)); - this.addEventListener(this.elements.parent, "mousedown touchstart", (e) => { - if (document.activeElement !== this.elements.parent) this.elements.parent.focus(); - }) - this.addEventListener(window, "resize", this.handleResize.bind(this)); - //this.addEventListener(window, "blur", e => console.log(e), true); //TODO - add "click to make keyboard keys work" message? - - let counter = 0; - this.elements.statePopupPanel = this.createPopup("", {}, true); - this.elements.statePopupPanel.innerText = "Drop save state here to load"; - this.elements.statePopupPanel.style["text-align"] = "center"; - this.elements.statePopupPanel.style["font-size"] = "28px"; - this.addEventListener(this.elements.parent, "dragenter", (e) => { - e.preventDefault(); - if (!this.started) return; - counter++; - this.elements.statePopupPanel.parentElement.style.display = "block"; - }); - this.addEventListener(this.elements.parent, "dragover", (e) => { - e.preventDefault(); - }); - this.addEventListener(this.elements.parent, "dragleave", (e) => { - e.preventDefault(); - if (!this.started) return; - counter--; - if (counter === 0) { - this.elements.statePopupPanel.parentElement.style.display = "none"; - } - }); - this.addEventListener(this.elements.parent, "dragend", (e) => { - e.preventDefault(); - if (!this.started) return; - counter = 0; - this.elements.statePopupPanel.parentElement.style.display = "none"; - }); - this.addEventListener(this.elements.parent, "drop", (e) => { - e.preventDefault(); - if (!this.started) return; - this.elements.statePopupPanel.parentElement.style.display = "none"; - counter = 0; - const items = e.dataTransfer.items; - let file; - for (let i=0; i { - this.gameManager.loadState(new Uint8Array(data)); - }) - }); - - this.gamepad = new GamepadHandler(); //https://github.com/ethanaobrien/Gamepad - this.gamepad.on('connected', (e) => { - if (!this.gamepadLabels) return; - this.updateGamepadLabels(); - }) - this.gamepad.on('disconnected', (e) => { - setTimeout(this.updateGamepadLabels.bind(this), 10); - }) - this.gamepad.on('axischanged', this.gamepadEvent.bind(this)); - this.gamepad.on('buttondown', this.gamepadEvent.bind(this)); - this.gamepad.on('buttonup', this.gamepadEvent.bind(this)); - } - checkSupportedOpts() { - if (!this.gameManager.supportsStates()) { - this.elements.bottomBar.saveState[0].style.display = "none"; - this.elements.bottomBar.loadState[0].style.display = "none"; - this.elements.bottomBar.netplay[0].style.display = "none"; - this.elements.contextMenu.save.style.display = "none"; - this.elements.contextMenu.load.style.display = "none"; - } - if (typeof this.config.gameId !== "number" || !this.config.netplayUrl || this.netplayEnabled === false) { - this.elements.bottomBar.netplay[0].style.display = "none"; - } - } - updateGamepadLabels() { - for (let i=0; i { - if (this.started) { - this.elements.contextmenu.style.display = "block"; - this.elements.contextmenu.style.left = e.offsetX+"px"; - this.elements.contextmenu.style.top = e.offsetY+"px"; - } - e.preventDefault(); - }) - const hideMenu = () => { - this.elements.contextmenu.style.display = "none"; - } - this.addEventListener(this.elements.contextmenu, 'contextmenu', (e) => e.preventDefault()); - this.addEventListener(this.elements.parent, 'contextmenu', (e) => e.preventDefault()); - this.addEventListener(this.game, 'mousedown', hideMenu); - const parent = this.createElement("ul"); - const addButton = (title, hidden, functi0n) => { - //

  • '+title+'
  • - const li = this.createElement("li"); - if (hidden) li.hidden = true; - const a = this.createElement("a"); - if (functi0n instanceof Function) { - this.addEventListener(li, 'click', (e) => { - e.preventDefault(); - functi0n(); - }); - } - a.href = "#"; - a.onclick = "return false"; - a.innerText = this.localization(title); - li.appendChild(a); - parent.appendChild(li); - hideMenu(); - return li; - } - let screenshotUrl; - const screenshot = addButton("Take Screenshot", false, () => { - if (screenshotUrl) URL.revokeObjectURL(screenshotUrl); - const screenshot = this.gameManager.screenshot(); - const blob = new Blob([screenshot]); - screenshotUrl = URL.createObjectURL(blob); - const a = this.createElement("a"); - a.href = screenshotUrl; - const date = new Date(); - a.download = this.getBaseFileName()+"-"+date.getMonth()+"-"+date.getDate()+"-"+date.getFullYear()+".png"; - a.click(); - hideMenu(); - }); - const qSave = addButton("Quick Save", false, () => { - const slot = this.settings['save-state-slot'] ? this.settings['save-state-slot'] : "1"; - this.gameManager.quickSave(slot); - this.displayMessage(this.localization("SAVED STATE TO SLOT")+" "+slot); - hideMenu(); - }); - const qLoad = addButton("Quick Load", false, () => { - const slot = this.settings['save-state-slot'] ? this.settings['save-state-slot'] : "1"; - this.gameManager.quickLoad(slot); - this.displayMessage(this.localization("LOADED STATE FROM SLOT")+" "+slot); - hideMenu(); - }); - this.elements.contextMenu = { - screenshot: screenshot, - save: qSave, - load: qLoad - } - addButton("EmulatorJS v"+this.ejs_version, false, () => { - hideMenu(); - const body = this.createPopup("EmulatorJS", { - "Close": () => { - this.closePopup(); - } - }); - - const menu = this.createElement('div'); - menu.classList.add("ejs_list_selector"); - const parent = this.createElement("ul"); - const addButton = (title, hidden, functi0n) => { - const li = this.createElement("li"); - if (hidden) li.hidden = true; - const a = this.createElement("a"); - if (functi0n instanceof Function) { - this.addEventListener(li, 'click', (e) => { - e.preventDefault(); - functi0n(); - }); - } - a.href = "#"; - a.onclick = "return false"; - a.innerText = this.localization(title); - li.appendChild(a); - parent.appendChild(li); - hideMenu(); - return li; - } - //body.style["padding-left"] = "20%"; - const home = this.createElement("div"); - const license = this.createElement("div"); - license.style.display = "none"; - const retroarch = this.createElement("div"); - retroarch.style.display = "none"; - body.appendChild(home); - body.appendChild(license); - body.appendChild(retroarch); - - let current = home; - home.innerText = "EmulatorJS v"+this.ejs_version; - home.appendChild(this.createElement("br")); - home.appendChild(this.createElement("br")); - const gh = this.createElement("a"); - gh.href = "https://github.com/EmulatorJS/EmulatorJS"; - gh.target = "_blank"; - gh.innerText = this.localization("View on GitHub"); - home.appendChild(gh); - home.appendChild(this.createElement("br")); - const dc = this.createElement("a"); - dc.href = "https://discord.gg/6akryGkETU"; - dc.target = "_blank"; - dc.innerText = this.localization("Join the discord"); - home.appendChild(dc); - home.appendChild(this.createElement("br")); - menu.appendChild(parent); - body.appendChild(menu); - const setElem = (element) => { - if (current === element) return; - if (current) { - current.style.display = "none"; - } - current = element; - element.style.display = ""; - } - addButton("Home", false, () => { - setElem(home); - }) - addButton("EmulatorJS License", false, () => { - setElem(license); - }) - addButton("RetroArch License", false, () => { - setElem(retroarch); - }) - //Todo - Core specific licenses, contributors. - - retroarch.innerText = "This project is powered by "; - const a = this.createElement("a"); - a.href = "https://github.com/libretro/RetroArch"; - a.target = "_blank"; - a.innerText = "RetroArch"; - retroarch.appendChild(a); - const licenseLink = this.createElement("a"); - licenseLink.target = "_blank"; - licenseLink.href = "https://github.com/libretro/RetroArch/blob/master/COPYING"; - licenseLink.innerText = "View the RetroArch license here."; - a.appendChild(this.createElement("br")); - a.appendChild(licenseLink); - - license.style['text-align'] = "center"; - license.style['padding'] = "10px"; - //license.style["white-space"] = "pre-wrap"; - license.innerText = ' GNU GENERAL PUBLIC LICENSE\n Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. \n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n Preamble\n\n The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works. By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users. We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors. You can apply it to\nyour programs, too.\n\n When we speak of free software, we are referring to freedom, not\nprice. Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights. Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received. You must make sure that they, too, receive\nor can get the source code. And you must show them these terms so they\nknow their rights.\n\n Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n For the developers\' and authors\' protection, the GPL clearly explains\nthat there is no warranty for this free software. For both users\' and\nauthors\' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so. This is fundamentally incompatible with the aim of\nprotecting users\' freedom to change the software. The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable. Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts. If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary. To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n The precise terms and conditions for copying, distribution and\nmodification follow.\n\n TERMS AND CONDITIONS\n\n 0. Definitions.\n\n "This License" refers to version 3 of the GNU General Public License.\n\n "Copyright" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n "The Program" refers to any copyrightable work licensed under this\nLicense. Each licensee is addressed as "you". "Licensees" and\n"recipients" may be individuals or organizations.\n\n To "modify" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy. The resulting work is called a "modified version" of the\nearlier work or a work "based on" the earlier work.\n\n A "covered work" means either the unmodified Program or a work based\non the Program.\n\n To "propagate" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy. Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n To "convey" a work means any kind of propagation that enables other\nparties to make or receive copies. Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n An interactive user interface displays "Appropriate Legal Notices"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License. If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n 1. Source Code.\n\n The "source code" for a work means the preferred form of the work\nfor making modifications to it. "Object code" means any non-source\nform of a work.\n\n A "Standard Interface" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n The "System Libraries" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form. A\n"Major Component", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n The "Corresponding Source" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities. However, it does not include the work\'s\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work. For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n The Corresponding Source for a work in source code form is that\nsame work.\n\n 2. Basic Permissions.\n\n All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met. This License explicitly affirms your unlimited\npermission to run the unmodified Program. The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work. This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force. You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright. Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n Conveying under any other circumstances is permitted solely under\nthe conditions stated below. Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n 3. Protecting Users\' Legal Rights From Anti-Circumvention Law.\n\n No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work\'s\nusers, your or third parties\' legal rights to forbid circumvention of\ntechnological measures.\n\n 4. Conveying Verbatim Copies.\n\n You may convey verbatim copies of the Program\'s source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n 5. Conveying Modified Source Versions.\n\n You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n a) The work must carry prominent notices stating that you modified\n it, and giving a relevant date.\n\n b) The work must carry prominent notices stating that it is\n released under this License and any conditions added under section\n 7. This requirement modifies the requirement in section 4 to\n "keep intact all notices".\n\n c) You must license the entire work, as a whole, under this\n License to anyone who comes into possession of a copy. This\n License will therefore apply, along with any applicable section 7\n additional terms, to the whole of the work, and all its parts,\n regardless of how they are packaged. This License gives no\n permission to license the work in any other way, but it does not\n invalidate such permission if you have separately received it.\n\n d) If the work has interactive user interfaces, each must display\n Appropriate Legal Notices; however, if the Program has interactive\n interfaces that do not display Appropriate Legal Notices, your\n work need not make them do so.\n\n A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n"aggregate" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation\'s users\nbeyond what the individual works permit. Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n 6. Conveying Non-Source Forms.\n\n You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n a) Convey the object code in, or embodied in, a physical product\n (including a physical distribution medium), accompanied by the\n Corresponding Source fixed on a durable physical medium\n customarily used for software interchange.\n\n b) Convey the object code in, or embodied in, a physical product\n (including a physical distribution medium), accompanied by a\n written offer, valid for at least three years and valid for as\n long as you offer spare parts or customer support for that product\n model, to give anyone who possesses the object code either (1) a\n copy of the Corresponding Source for all the software in the\n product that is covered by this License, on a durable physical\n medium customarily used for software interchange, for a price no\n more than your reasonable cost of physically performing this\n conveying of source, or (2) access to copy the\n Corresponding Source from a network server at no charge.\n\n c) Convey individual copies of the object code with a copy of the\n written offer to provide the Corresponding Source. This\n alternative is allowed only occasionally and noncommercially, and\n only if you received the object code with such an offer, in accord\n with subsection 6b.\n\n d) Convey the object code by offering access from a designated\n place (gratis or for a charge), and offer equivalent access to the\n Corresponding Source in the same way through the same place at no\n further charge. You need not require recipients to copy the\n Corresponding Source along with the object code. If the place to\n copy the object code is a network server, the Corresponding Source\n may be on a different server (operated by you or a third party)\n that supports equivalent copying facilities, provided you maintain\n clear directions next to the object code saying where to find the\n Corresponding Source. Regardless of what server hosts the\n Corresponding Source, you remain obligated to ensure that it is\n available for as long as needed to satisfy these requirements.\n\n e) Convey the object code using peer-to-peer transmission, provided\n you inform other peers where the object code and Corresponding\n Source of the work are being offered to the general public at no\n charge under subsection 6d.\n\n A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n A "User Product" is either (1) a "consumer product", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling. In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage. For a particular\nproduct received by a particular user, "normally used" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product. A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n "Installation Information" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source. The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information. But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed. Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n 7. Additional Terms.\n\n "Additional permissions" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law. If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit. (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.) You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n a) Disclaiming warranty or limiting liability differently from the\n terms of sections 15 and 16 of this License; or\n\n b) Requiring preservation of specified reasonable legal notices or\n author attributions in that material or in the Appropriate Legal\n Notices displayed by works containing it; or\n\n c) Prohibiting misrepresentation of the origin of that material, or\n requiring that modified versions of such material be marked in\n reasonable ways as different from the original version; or\n\n d) Limiting the use for publicity purposes of names of licensors or\n authors of the material; or\n\n e) Declining to grant rights under trademark law for use of some\n trade names, trademarks, or service marks; or\n\n f) Requiring indemnification of licensors and authors of that\n material by anyone who conveys the material (or modified versions of\n it) with contractual assumptions of liability to the recipient, for\n any liability that these contractual assumptions directly impose on\n those licensors and authors.\n\n All other non-permissive additional terms are considered "further\nrestrictions" within the meaning of section 10. If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term. If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n 8. Termination.\n\n You may not propagate or modify a covered work except as expressly\nprovided under this License. Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License. If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n 9. Acceptance Not Required for Having Copies.\n\n You are not required to accept this License in order to receive or\nrun a copy of the Program. Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance. However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work. These actions infringe copyright if you do\nnot accept this License. Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n 10. Automatic Licensing of Downstream Recipients.\n\n Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License. You are not responsible\nfor enforcing compliance by third parties with this License.\n\n An "entity transaction" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations. If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party\'s predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License. For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n 11. Patents.\n\n A "contributor" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based. The\nwork thus licensed is called the contributor\'s "contributor version".\n\n A contributor\'s "essential patent claims" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version. For\npurposes of this definition, "control" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor\'s essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n In the following three paragraphs, a "patent license" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement). To "grant" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients. "Knowingly relying" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient\'s use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n A patent license is "discriminatory" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License. You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n 12. No Surrender of Others\' Freedom.\n\n If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License. If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all. For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n 13. Use with the GNU Affero General Public License.\n\n Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work. The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n 14. Revised Versions of this License.\n\n The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time. Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n Each version is given a distinguishing version number. If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License "or any later version" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation. If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy\'s\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n Later license versions may give you additional or different\npermissions. However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n 15. Disclaimer of Warranty.\n\n THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n 16. Limitation of Liability.\n\n IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n 17. Interpretation of Sections 15 and 16.\n\n If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n END OF TERMS AND CONDITIONS\n\n How to Apply These Terms to Your New Programs\n\n If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n To do so, attach the following notices to the program. It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe "copyright" line and a pointer to where the full notice is found.\n\n EmulatorJS: RetroArch on the web\n Copyright (C) 2023 Ethan O\'Brien\n\n This program is free software: you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see .\n\nAlso add information on how to contact you by electronic and paper mail.\n\n If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n EmulatorJS Copyright (C) 2023 Ethan O\'Brien\n This program comes with ABSOLUTELY NO WARRANTY; for details type `show w\'.\n This is free software, and you are welcome to redistribute it\n under certain conditions; type `show c\' for details.\n\nThe hypothetical commands `show w\' and `show c\' should show the appropriate\nparts of the General Public License. Of course, your program\'s commands\nmight be different; for a GUI interface, you would use an "about box".\n\n You should also get your employer (if you work as a programmer) or school,\nif any, to sign a "copyright disclaimer" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n.\n\n The GNU General Public License does not permit incorporating your program\ninto proprietary programs. If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library. If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License. But first, please read\n.\n'; - }); - - if (this.config.buttonOpts) { - if (this.config.buttonOpts.screenshot === false) screenshot.setAttribute("hidden", ""); - if (this.config.buttonOpts.quickSave === false) qSave.setAttribute("hidden", ""); - if (this.config.buttonOpts.quickLoad === false) qLoad.setAttribute("hidden", ""); - } - - this.elements.contextmenu.appendChild(parent); - - this.elements.parent.appendChild(this.elements.contextmenu); - } - closePopup() { - if (this.currentPopup !== null) { - try { - this.currentPopup.remove(); - } catch(e){} - this.currentPopup = null; - } - } - //creates a full box popup. - createPopup(popupTitle, buttons, hidden) { - if (!hidden) this.closePopup(); - const popup = this.createElement('div'); - popup.classList.add("ejs_popup_container"); - this.elements.parent.appendChild(popup); - const title = this.createElement("h4"); - title.innerText = this.localization(popupTitle); - const main = this.createElement("div"); - main.classList.add("ejs_popup_body"); - - popup.appendChild(title); - popup.appendChild(main); - - for (let k in buttons) { - const button = this.createElement("a"); - if (buttons[k] instanceof Function) { - button.addEventListener("click", (e) => { - buttons[k](); - e.preventDefault(); - }); - } - button.classList.add("ejs_button"); - button.innerText = this.localization(k); - popup.appendChild(button); - } - if (!hidden) { - this.currentPopup = popup; - } else { - popup.style.display = "none"; - } - - return main; - } - selectFile() { - return new Promise((resolve, reject) => { - const file = this.createElement("input"); - file.type = "file"; - this.addEventListener(file, "change", (e) => { - resolve(e.target.files[0]); - }) - file.click(); - }) - } - isPopupOpen() { - return this.cheatMenu.style.display !== "none" || this.netplayMenu.style.display !== "none" || this.controlMenu.style.display !== "none" || this.currentPopup !== null; - } - isChild(first, second) { - if (!first || !second) return false; - const adown = first.nodeType === 9 ? first.documentElement : first; - - if (first === second) return true; - - if (adown.contains) { - return adown.contains(second); - } - - return first.compareDocumentPosition && first.compareDocumentPosition(second) & 16; - } - createBottomMenuBar() { - this.elements.menu = this.createElement("div"); - this.elements.menu.classList.add("ejs_menu_bar"); - this.elements.menu.classList.add("ejs_menu_bar_hidden"); - - let timeout = null; - let ignoreEvents = false; - const hide = () => { - if (this.paused || this.settingsMenuOpen) return; - this.elements.menu.classList.add("ejs_menu_bar_hidden"); - } - - this.addEventListener(this.elements.parent, 'mousemove click', (e) => { - if (e.pointerType === "touch") return; - if (!this.started || ignoreEvents || document.pointerLockElement === this.canvas) return; - if (this.isPopupOpen()) return; - clearTimeout(timeout); - timeout = setTimeout(hide, 3000); - this.elements.menu.classList.remove("ejs_menu_bar_hidden"); - }) - this.addEventListener(this.elements.menu, 'touchstart touchend', (e) => { - if (!this.started) return; - if (this.isPopupOpen()) return; - clearTimeout(timeout); - timeout = setTimeout(hide, 3000); - this.elements.menu.classList.remove("ejs_menu_bar_hidden"); - }) - this.menu = { - close: () => { - if (!this.started) return; - clearTimeout(timeout); - this.elements.menu.classList.add("ejs_menu_bar_hidden"); - }, - open: () => { - if (!this.started) return; - clearTimeout(timeout); - timeout = setTimeout(hide, 3000); - this.elements.menu.classList.remove("ejs_menu_bar_hidden"); - }, - toggle: () => { - if (!this.started) return; - clearTimeout(timeout); - if (this.elements.menu.classList.contains("ejs_menu_bar_hidden")) { - timeout = setTimeout(hide, 3000); - } - this.elements.menu.classList.toggle("ejs_menu_bar_hidden"); - - } - } - this.elements.parent.appendChild(this.elements.menu); - - let tmout; - this.addEventListener(this.elements.parent, "mousedown touchstart", (e) => { - if (this.isChild(this.elements.menu, e.target) || this.isChild(this.elements.menuToggle, e.target)) return; - if (!this.started || this.elements.menu.classList.contains("ejs_menu_bar_hidden") || this.isPopupOpen()) return; - const width = this.elements.parent.getBoundingClientRect().width; - if (width > 575) return; - clearTimeout(tmout); - tmout = setTimeout(() => { - ignoreEvents = false; - }, 2000) - ignoreEvents = true; - this.menu.close(); - }) - - - //Now add buttons - const addButton = (title, image, callback, element, both) => { - const button = this.createElement("button"); - button.type = "button"; - const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); - svg.setAttribute("role", "presentation"); - svg.setAttribute("focusable", "false"); - svg.innerHTML = image; - const text = this.createElement("span"); - text.innerText = this.localization(title); - if (title == "Enter Fullscreen" || title == "Exit Fullscreen") text.classList.add("ejs_menu_text_right"); - text.classList.add("ejs_menu_text"); - - button.classList.add("ejs_menu_button"); - button.appendChild(svg); - button.appendChild(text); - if (element) { - element.appendChild(button); - } else { - this.elements.menu.appendChild(button); - } - if (callback instanceof Function) { - this.addEventListener(button, 'click', callback); - } - return both ? [button, svg, text] : button; - } - - //todo. Center text on not restart button - - const restartButton = addButton("Restart", '', () => { - if (this.isNetplay && this.netplay.owner) { - this.gameManager.saveSaveFiles(); - this.gameManager.restart(); - this.netplay.reset(); - this.netplay.sendMessage({restart:true}); - this.play(); - } else if (!this.isNetplay) { - this.gameManager.saveSaveFiles(); - this.gameManager.restart(); - } - }); - const pauseButton = addButton("Pause", '', () => { - if (this.isNetplay && this.netplay.owner) { - this.pause(); - this.netplay.sendMessage({pause:true}); - } else if (!this.isNetplay) { - this.pause(); - } - }); - const playButton = addButton("Play", '', () => { - if (this.isNetplay && this.netplay.owner) { - this.play(); - this.netplay.sendMessage({play:true}); - } else if (!this.isNetplay) { - this.play(); - } - }); - playButton.style.display = "none"; - this.togglePlaying = (dontUpdate) => { - this.paused = !this.paused; - if (!dontUpdate) { - if (this.paused) { - pauseButton.style.display = "none"; - playButton.style.display = ""; - } else { - pauseButton.style.display = ""; - playButton.style.display = "none"; - } - } - this.gameManager.toggleMainLoop(this.paused ? 0 : 1); - - //I now realize its not easy to pause it while the cursor is locked, just in case I guess - if (this.getCore(true) === "nds") { - if (this.canvas.exitPointerLock) { - this.canvas.exitPointerLock(); - } else if (this.canvas.mozExitPointerLock) { - this.canvas.mozExitPointerLock(); - } - } - } - this.play = (dontUpdate) => { - if (this.paused) this.togglePlaying(dontUpdate); - } - this.pause = (dontUpdate) => { - if (!this.paused) this.togglePlaying(dontUpdate); - } - - let stateUrl; - const saveState = addButton("Save State", '', async () => { - const state = await this.gameManager.getState(); - const called = this.callEvent("save", { - screenshot: this.gameManager.screenshot(), - state: state - }); - if (called > 0) return; - if (stateUrl) URL.revokeObjectURL(stateUrl); - if (this.settings['save-state-location'] === "browser" && this.saveInBrowserSupported()) { - this.storage.states.put(this.getBaseFileName()+".state", state); - this.displayMessage(this.localization("SAVE SAVED TO BROWSER")); - } else { - const blob = new Blob([state]); - stateUrl = URL.createObjectURL(blob); - const a = this.createElement("a"); - a.href = stateUrl; - a.download = this.getBaseFileName()+".state"; - a.click(); - } - }); - const loadState = addButton("Load State", '', async () => { - const called = this.callEvent("load"); - if (called > 0) return; - if (this.settings['save-state-location'] === "browser" && this.saveInBrowserSupported()) { - this.storage.states.get(this.getBaseFileName()+".state").then(e => { - this.gameManager.loadState(e); - this.displayMessage(this.localization("SAVE LOADED FROM BROWSER")); - }) - } else { - const file = await this.selectFile(); - const state = new Uint8Array(await file.arrayBuffer()); - this.gameManager.loadState(state); - } - }); - const controlMenu = addButton("Control Settings", '', () => { - this.controlMenu.style.display = ""; - }); - const cheatMenu = addButton("Cheats", '', () => { - this.cheatMenu.style.display = ""; - }); - - const cache = addButton("Cache Manager", '', () => { - this.openCacheMenu(); - }); - - let savUrl; - - const saveSavFiles = addButton("Export Save File", '', async () => { - const file = await this.gameManager.getSaveFile(); - const blob = new Blob([file]); - savUrl = URL.createObjectURL(blob); - const a = this.createElement("a"); - a.href = savUrl; - a.download = this.gameManager.getSaveFilePath().split("/").pop(); - a.click(); - }); - const loadSavFiles = addButton("Import Save File", '', async () => { - const file = await this.selectFile(); - const sav = new Uint8Array(await file.arrayBuffer()); - const path = this.gameManager.getSaveFilePath(); - const paths = path.split("/"); - let cp = ""; - for (let i=0; i', async () => { - this.openNetplayMenu(); - }); - - const spacer = this.createElement("span"); - spacer.classList.add("ejs_menu_bar_spacer"); - this.elements.menu.appendChild(spacer); - - const volumeSettings = this.createElement("div"); - volumeSettings.classList.add("ejs_volume_parent"); - const muteButton = addButton("Mute", '', () => { - muteButton.style.display = "none"; - unmuteButton.style.display = ""; - this.muted = true; - this.setVolume(0); - }, volumeSettings); - const unmuteButton = addButton("Unmute", '', () => { - if (this.volume === 0) this.volume = 0.5; - muteButton.style.display = ""; - unmuteButton.style.display = "none"; - this.muted = false; - this.setVolume(this.volume); - }, volumeSettings); - unmuteButton.style.display = "none"; - - const volumeSlider = this.createElement("input"); - volumeSlider.setAttribute("data-range", "volume"); - volumeSlider.setAttribute("type", "range"); - volumeSlider.setAttribute("min", 0); - volumeSlider.setAttribute("max", 1); - volumeSlider.setAttribute("step", 0.01); - volumeSlider.setAttribute("autocomplete", "off"); - volumeSlider.setAttribute("role", "slider"); - volumeSlider.setAttribute("aria-label", "Volume"); - volumeSlider.setAttribute("aria-valuemin", 0); - volumeSlider.setAttribute("aria-valuemax", 100); - - this.setVolume = (volume) => { - this.saveSettings(); - this.muted = (volume === 0); - volumeSlider.value = volume; - volumeSlider.setAttribute("aria-valuenow", volume*100); - volumeSlider.setAttribute("aria-valuetext", (volume*100).toFixed(1) + "%"); - volumeSlider.setAttribute("style", "--value: "+volume*100+"%;margin-left: 5px;position: relative;z-index: 2;"); - if (window.AL && AL.currentCtx && AL.currentCtx.sources) { - AL.currentCtx.sources.forEach(e => { - e.gain.gain.value = volume; - }) - } - if (!this.config.buttonOpts || this.config.buttonOpts.mute !== false) { - unmuteButton.style.display = (volume === 0) ? "" : "none"; - muteButton.style.display = (volume === 0) ? "none" : ""; - } - } - - this.addEventListener(volumeSlider, "change mousemove touchmove mousedown touchstart mouseup", (e) => { - setTimeout(() => { - const newVal = parseFloat(volumeSlider.value); - if (newVal === 0 && this.muted) return; - this.volume = newVal; - this.setVolume(this.volume); - }, 5); - }) - - if (!this.config.buttonOpts || this.config.buttonOpts.volume !== false) { - volumeSettings.appendChild(volumeSlider); - } - - this.elements.menu.appendChild(volumeSettings); - - this.settingParent = this.createElement("div"); - this.settingsMenuOpen = false; - const settingButton = addButton("Settings", '', () => { - this.settingsMenuOpen = !this.settingsMenuOpen; - settingButton[1].classList.toggle("ejs_svg_rotate", this.settingsMenuOpen); - this.settingsMenu.style.display = this.settingsMenuOpen ? "" : "none"; - settingButton[2].classList.toggle("ejs_settings_text", this.settingsMenuOpen); - }, this.settingParent, true); - this.elements.menu.appendChild(this.settingParent); - this.closeSettingsMenu = () => { - if (!this.settingsMenu) return; - this.settingsMenuOpen = false; - settingButton[1].classList.toggle("ejs_svg_rotate", this.settingsMenuOpen); - settingButton[2].classList.toggle("ejs_settings_text", this.settingsMenuOpen); - this.settingsMenu.style.display = "none"; - } - this.addEventListener(this.elements.parent, "mousedown touchstart", (e) => { - if (this.isChild(this.settingsMenu, e.target)) return; - if (e.pointerType === "touch") return; - if (e.target === settingButton[0] || e.target === settingButton[2]) return; - this.closeSettingsMenu(); - }) - this.addEventListener(this.canvas, "click", (e) => { - if (e.pointerType === "touch") return; - if (this.getCore(true) === "nds" && !this.paused) { - if (this.canvas.requestPointerLock) { - this.canvas.requestPointerLock(); - } else if (this.canvas.mozRequestPointerLock) { - this.canvas.mozRequestPointerLock(); - } - this.menu.close(); - } - }) - - const enter = addButton("Enter Fullscreen", '', () => { - this.toggleFullscreen(true); - }); - const exit = addButton("Exit Fullscreen", '', () => { - this.toggleFullscreen(false); - }); - exit.style.display = "none"; - - this.toggleFullscreen = (fullscreen) => { - if (fullscreen) { - if (this.elements.parent.requestFullscreen) { - this.elements.parent.requestFullscreen(); - } else if (this.elements.parent.mozRequestFullScreen) { - this.elements.parent.mozRequestFullScreen(); - } else if (this.elements.parent.webkitRequestFullscreen) { - this.elements.parent.webkitRequestFullscreen(); - } else if (this.elements.parent.msRequestFullscreen) { - this.elements.parent.msRequestFullscreen(); - } - exit.style.display = ""; - enter.style.display = "none"; - if (this.isMobile) { - try { - screen.orientation.lock(this.getCore(true) === "nds" ? "portrait" : "landscape").catch(e => {});; - } catch(e) {} - } - } else { - if (document.exitFullscreen) { - document.exitFullscreen(); - } else if (document.webkitExitFullscreen) { - document.webkitExitFullscreen(); - } else if (document.mozCancelFullScreen) { - document.mozCancelFullScreen(); - } else if (document.msExitFullscreen) { - document.msExitFullscreen(); - } - exit.style.display = "none"; - enter.style.display = ""; - if (this.isMobile) { - try { - screen.orientation.unlock(); - } catch(e) {} - } - } - } - - - this.addEventListener(document, "webkitfullscreenchange mozfullscreenchange fullscreenchange", (e) => { - if (e.target !== this.elements.parent) return; - if (document.fullscreenElement === null) { - exit.style.display = "none"; - enter.style.display = ""; - } else { - //not sure if this is possible, lets put it here anyways - exit.style.display = ""; - enter.style.display = "none"; - } - }) - - const hasFullscreen = !!(this.elements.parent.requestFullscreen || this.elements.parent.mozRequestFullScreen || this.elements.parent.webkitRequestFullscreen || this.elements.parent.msRequestFullscreen); - - if (!hasFullscreen) { - exit.style.display = "none"; - enter.style.display = "none"; - } - - this.elements.bottomBar = { - playPause: [pauseButton, playButton], - restart: [restartButton], - settings: [settingButton], - fullscreen: [enter, exit], - saveState: [saveState], - loadState: [loadState], - gamepad: [controlMenu], - cheat: [cheatMenu], - cacheManager: [cache], - saveSavFiles: [saveSavFiles], - loadSavFiles: [loadSavFiles], - netplay: [netplay] - } - - - if (this.config.buttonOpts) { - if (this.debug) console.log(this.config.buttonOpts); - if (this.config.buttonOpts.playPause === false) { - pauseButton.style.display = "none"; - playButton.style.display = "none"; - } - if (this.config.buttonOpts.restart === false) restartButton.style.display = "none" - if (this.config.buttonOpts.settings === false) settingButton[0].style.display = "none" - if (this.config.buttonOpts.fullscreen === false) { - enter.style.display = "none"; - exit.style.display = "none"; - } - if (this.config.buttonOpts.mute === false) { - muteButton.style.display = "none"; - unmuteButton.style.display = "none"; - } - if (this.config.buttonOpts.saveState === false) saveState.style.display = "none" - if (this.config.buttonOpts.loadState === false) loadState.style.display = "none" - if (this.config.buttonOpts.saveSavFiles === false) saveSavFiles.style.display = "none" - if (this.config.buttonOpts.loadSavFiles === false) loadSavFiles.style.display = "none" - if (this.config.buttonOpts.gamepad === false) controlMenu.style.display = "none" - if (this.config.buttonOpts.cheat === false) cheatMenu.style.display = "none" - if (this.config.buttonOpts.cacheManager === false) cache.style.display = "none" - if (this.config.buttonOpts.netplay === false) netplay.style.display = "none" - } - } - openCacheMenu() { - (async () => { - const list = this.createElement("table"); - const tbody = this.createElement("tbody"); - const body = this.createPopup("Cache Manager", { - "Clear All": async () => { - const roms = await this.storage.rom.getSizes(); - for (const k in roms) { - await this.storage.rom.remove(k); - } - tbody.innerHTML = ""; - }, - "Close": () => { - this.closePopup(); - } - }); - const roms = await this.storage.rom.getSizes(); - list.style.width = "100%"; - list.style["padding-left"] = "10px"; - list.style["text-align"] = "left"; - body.appendChild(list); - list.appendChild(tbody); - const getSize = function(size) { - let i = -1; - do { - size /= 1024, i++; - } while (size > 1024); - return Math.max(size, 0.1).toFixed(1) + [' kB', ' MB', ' GB', ' TB', 'PB', 'EB', 'ZB', 'YB'][i]; - } - for (const k in roms) { - const line = this.createElement("tr"); - const name = this.createElement("td"); - const size = this.createElement("td"); - const remove = this.createElement("td"); - remove.style.cursor = "pointer"; - name.innerText = k; - size.innerText = getSize(roms[k]); - - const a = this.createElement("a"); - a.innerText = this.localization("Remove"); - this.addEventListener(remove, "click", () => { - this.storage.rom.remove(k); - line.remove(); - }) - remove.appendChild(a); - - line.appendChild(name); - line.appendChild(size); - line.appendChild(remove); - tbody.appendChild(line); - } - - })(); - } - getControlScheme() { - if (this.config.controlScheme && typeof this.config.controlScheme === 'string') { - return this.config.controlScheme; - } else { - return this.getCore(true); - } - } - createControlSettingMenu() { - let buttonListeners = []; - this.checkGamepadInputs = () => buttonListeners.forEach(elem => elem()); - this.gamepadLabels = []; - this.controls = JSON.parse(JSON.stringify(this.defaultControllers)); - const body = this.createPopup("Control Settings", { - "Reset": () => { - this.controls = JSON.parse(JSON.stringify(this.defaultControllers)); - this.setupKeys(); - this.checkGamepadInputs(); - this.saveSettings(); - }, - "Clear": () => { - this.controls = {0:{},1:{},2:{},3:{}}; - this.setupKeys(); - this.checkGamepadInputs(); - this.saveSettings(); - }, - "Close": () => { - this.controlMenu.style.display = "none"; - } - }, true); - this.setupKeys(); - this.controlMenu = body.parentElement; - body.classList.add("ejs_control_body"); - - let buttons; - if (['nes', 'gb'].includes(this.getControlScheme())) { - buttons = [ - {id: 8, label: this.localization('A')}, - {id: 0, label: this.localization('B')}, - {id: 2, label: this.localization('SELECT')}, - {id: 3, label: this.localization('START')}, - {id: 4, label: this.localization('UP')}, - {id: 5, label: this.localization('DOWN')}, - {id: 6, label: this.localization('LEFT')}, - {id: 7, label: this.localization('RIGHT')}, - ]; - } else if ('snes' === this.getControlScheme()) { - buttons = [ - {id: 8, label: this.localization('A')}, - {id: 0, label: this.localization('B')}, - {id: 9, label: this.localization('X')}, - {id: 1, label: this.localization('Y')}, - {id: 2, label: this.localization('SELECT')}, - {id: 3, label: this.localization('START')}, - {id: 4, label: this.localization('UP')}, - {id: 5, label: this.localization('DOWN')}, - {id: 6, label: this.localization('LEFT')}, - {id: 7, label: this.localization('RIGHT')}, - {id: 10, label: this.localization('L')}, - {id: 11, label: this.localization('R')}, - ]; - } else if ('n64' === this.getControlScheme()) { - buttons = [ - {id: 0, label: this.localization('A')}, - {id: 1, label: this.localization('B')}, - {id: 3, label: this.localization('START')}, - {id: 4, label: this.localization('D-PAD UP')}, - {id: 5, label: this.localization('D-PAD DOWN')}, - {id: 6, label: this.localization('D-PAD LEFT')}, - {id: 7, label: this.localization('D-PAD RIGHT')}, - {id: 10, label: this.localization('L')}, - {id: 11, label: this.localization('R')}, - {id: 12, label: this.localization('Z')}, - {id: 19, label: this.localization('STICK UP')}, - {id: 18, label: this.localization('STICK DOWN')}, - {id: 17, label: this.localization('STICK LEFT')}, - {id: 16, label: this.localization('STICK RIGHT')}, - {id: 23, label: this.localization('C-PAD UP')}, - {id: 22, label: this.localization('C-PAD DOWN')}, - {id: 21, label: this.localization('C-PAD LEFT')}, - {id: 20, label: this.localization('C-PAD RIGHT')}, - ]; - } else if ('gba' === this.getControlScheme()) { - buttons = [ - {id: 8, label: this.localization('A')}, - {id: 0, label: this.localization('B')}, - {id: 10, label: this.localization('L')}, - {id: 11, label: this.localization('R')}, - {id: 2, label: this.localization('SELECT')}, - {id: 3, label: this.localization('START')}, - {id: 4, label: this.localization('UP')}, - {id: 5, label: this.localization('DOWN')}, - {id: 6, label: this.localization('LEFT')}, - {id: 7, label: this.localization('RIGHT')}, - ]; - } else if ('nds' === this.getControlScheme()) { - buttons = [ - {id: 8, label: this.localization('A')}, - {id: 0, label: this.localization('B')}, - {id: 9, label: this.localization('X')}, - {id: 1, label: this.localization('Y')}, - {id: 2, label: this.localization('SELECT')}, - {id: 3, label: this.localization('START')}, - {id: 4, label: this.localization('UP')}, - {id: 5, label: this.localization('DOWN')}, - {id: 6, label: this.localization('LEFT')}, - {id: 7, label: this.localization('RIGHT')}, - {id: 10, label: this.localization('L')}, - {id: 11, label: this.localization('R')}, - {id: 14, label: this.localization('Microphone')}, - ]; - } else if ('vb' === this.getControlScheme()) { - buttons = [ - {id: 8, label: this.localization('A')}, - {id: 0, label: this.localization('B')}, - {id: 10, label: this.localization('L')}, - {id: 11, label: this.localization('R')}, - {id: 2, label: this.localization('SELECT')}, - {id: 3, label: this.localization('START')}, - {id: 4, label: this.localization('LEFT D-PAD UP')}, - {id: 5, label: this.localization('LEFT D-PAD DOWN')}, - {id: 6, label: this.localization('LEFT D-PAD LEFT')}, - {id: 7, label: this.localization('LEFT D-PAD RIGHT')}, - {id: 19, label: this.localization('RIGHT D-PAD UP')}, - {id: 18, label: this.localization('RIGHT D-PAD DOWN')}, - {id: 17, label: this.localization('RIGHT D-PAD LEFT')}, - {id: 16, label: this.localization('RIGHT D-PAD RIGHT')}, - ]; - } else if (['segaMD', 'segaCD', 'sega32x'].includes(this.getControlScheme())) { - buttons = [ - {id: 1, label: this.localization('A')}, - {id: 0, label: this.localization('B')}, - {id: 8, label: this.localization('C')}, - {id: 10, label: this.localization('X')}, - {id: 9, label: this.localization('Y')}, - {id: 11, label: this.localization('Z')}, - {id: 3, label: this.localization('START')}, - {id: 2, label: this.localization('MODE')}, - {id: 4, label: this.localization('UP')}, - {id: 5, label: this.localization('DOWN')}, - {id: 6, label: this.localization('LEFT')}, - {id: 7, label: this.localization('RIGHT')}, - ]; - } else if ('segaMS' === this.getControlScheme()) { - buttons = [ - {id: 0, label: this.localization('BUTTON 1 / START')}, - {id: 8, label: this.localization('BUTTON 2')}, - {id: 4, label: this.localization('UP')}, - {id: 5, label: this.localization('DOWN')}, - {id: 6, label: this.localization('LEFT')}, - {id: 7, label: this.localization('RIGHT')}, - ]; - } else if ('segaGG' === this.getControlScheme()) { - buttons = [ - {id: 0, label: this.localization('BUTTON 1')}, - {id: 8, label: this.localization('BUTTON 2')}, - {id: 3, label: this.localization('START')}, - {id: 4, label: this.localization('UP')}, - {id: 5, label: this.localization('DOWN')}, - {id: 6, label: this.localization('LEFT')}, - {id: 7, label: this.localization('RIGHT')}, - ]; - } else if ('segaSaturn' === this.getControlScheme()) { - buttons = [ - {id: 1, label: this.localization('A')}, - {id: 0, label: this.localization('B')}, - {id: 8, label: this.localization('C')}, - {id: 9, label: this.localization('X')}, - {id: 10, label: this.localization('Y')}, - {id: 11, label: this.localization('Z')}, - {id: 12, label: this.localization('L')}, - {id: 13, label: this.localization('R')}, - {id: 3, label: this.localization('START')}, - {id: 4, label: this.localization('UP')}, - {id: 5, label: this.localization('DOWN')}, - {id: 6, label: this.localization('LEFT')}, - {id: 7, label: this.localization('RIGHT')}, - ]; - } else if ('3do' === this.getControlScheme()) { - buttons = [ - {id: 1, label: this.localization('A')}, - {id: 0, label: this.localization('B')}, - {id: 8, label: this.localization('C')}, - {id: 10, label: this.localization('L')}, - {id: 11, label: this.localization('R')}, - {id: 2, label: this.localization('X')}, - {id: 3, label: this.localization('P')}, - {id: 4, label: this.localization('UP')}, - {id: 5, label: this.localization('DOWN')}, - {id: 6, label: this.localization('LEFT')}, - {id: 7, label: this.localization('RIGHT')}, - ]; - } else if ('atari2600' === this.getControlScheme()) { - buttons = [ - {id: 0, label: this.localization('FIRE')}, - {id: 2, label: this.localization('SELECT')}, - {id: 3, label: this.localization('RESET')}, - {id: 4, label: this.localization('UP')}, - {id: 5, label: this.localization('DOWN')}, - {id: 6, label: this.localization('LEFT')}, - {id: 7, label: this.localization('RIGHT')}, - {id: 10, label: this.localization('LEFT DIFFICULTY A')}, - {id: 12, label: this.localization('LEFT DIFFICULTY B')}, - {id: 11, label: this.localization('RIGHT DIFFICULTY A')}, - {id: 13, label: this.localization('RIGHT DIFFICULTY B')}, - {id: 14, label: this.localization('COLOR')}, - {id: 15, label: this.localization('B/W')}, - ]; - } else if ('atari7800' === this.getControlScheme()) { - buttons = [ - {id: 0, label: this.localization('BUTTON 1')}, - {id: 8, label: this.localization('BUTTON 2')}, - {id: 2, label: this.localization('SELECT')}, - {id: 3, label: this.localization('PAUSE')}, - {id: 9, label: this.localization('RESET')}, - {id: 4, label: this.localization('UP')}, - {id: 5, label: this.localization('DOWN')}, - {id: 6, label: this.localization('LEFT')}, - {id: 7, label: this.localization('RIGHT')}, - {id: 10, label: this.localization('LEFT DIFFICULTY')}, - {id: 11, label: this.localization('RIGHT DIFFICULTY')}, - ]; - } else if ('lynx' === this.getControlScheme()) { - buttons = [ - {id: 8, label: this.localization('A')}, - {id: 0, label: this.localization('B')}, - {id: 10, label: this.localization('OPTION 1')}, - {id: 11, label: this.localization('OPTION 2')}, - {id: 3, label: this.localization('START')}, - {id: 4, label: this.localization('UP')}, - {id: 5, label: this.localization('DOWN')}, - {id: 6, label: this.localization('LEFT')}, - {id: 7, label: this.localization('RIGHT')}, - ]; - } else if ('jaguar' === this.getControlScheme()) { - buttons = [ - {id: 8, label: this.localization('A')}, - {id: 0, label: this.localization('B')}, - {id: 1, label: this.localization('C')}, - {id: 2, label: this.localization('PAUSE')}, - {id: 3, label: this.localization('OPTION')}, - {id: 4, label: this.localization('UP')}, - {id: 5, label: this.localization('DOWN')}, - {id: 6, label: this.localization('LEFT')}, - {id: 7, label: this.localization('RIGHT')}, - ]; - } else if ('pce' === this.getControlScheme()) { - buttons = [ - {id: 8, label: this.localization('I')}, - {id: 0, label: this.localization('II')}, - {id: 2, label: this.localization('SELECT')}, - {id: 3, label: this.localization('RUN')}, - {id: 4, label: this.localization('UP')}, - {id: 5, label: this.localization('DOWN')}, - {id: 6, label: this.localization('LEFT')}, - {id: 7, label: this.localization('RIGHT')}, - ]; - } else if ('ngp' === this.getControlScheme()) { - buttons = [ - {id: 0, label: this.localization('A')}, - {id: 8, label: this.localization('B')}, - {id: 3, label: this.localization('OPTION')}, - {id: 4, label: this.localization('UP')}, - {id: 5, label: this.localization('DOWN')}, - {id: 6, label: this.localization('LEFT')}, - {id: 7, label: this.localization('RIGHT')}, - ]; - } else if ('ws' === this.getControlScheme()) { - buttons = [ - {id: 8, label: this.localization('A')}, - {id: 0, label: this.localization('B')}, - {id: 3, label: this.localization('START')}, - {id: 4, label: this.localization('X UP')}, - {id: 5, label: this.localization('X DOWN')}, - {id: 6, label: this.localization('X LEFT')}, - {id: 7, label: this.localization('X RIGHT')}, - {id: 13, label: this.localization('Y UP')}, - {id: 12, label: this.localization('Y DOWN')}, - {id: 10, label: this.localization('Y LEFT')}, - {id: 11, label: this.localization('Y RIGHT')}, - ]; - } else if ('coleco' === this.getControlScheme()) { - buttons = [ - {id: 8, label: this.localization('LEFT BUTTON')}, - {id: 0, label: this.localization('RIGHT BUTTON')}, - {id: 9, label: this.localization('1')}, - {id: 1, label: this.localization('2')}, - {id: 11, label: this.localization('3')}, - {id: 10, label: this.localization('4')}, - {id: 13, label: this.localization('5')}, - {id: 12, label: this.localization('6')}, - {id: 15, label: this.localization('7')}, - {id: 14, label: this.localization('8')}, - {id: 2, label: this.localization('*')}, - {id: 3, label: this.localization('#')}, - {id: 4, label: this.localization('UP')}, - {id: 5, label: this.localization('DOWN')}, - {id: 6, label: this.localization('LEFT')}, - {id: 7, label: this.localization('RIGHT')}, - ]; - } else if ('pcfx' === this.getControlScheme()) { - buttons = [ - {id: 8, label: this.localization('I')}, - {id: 0, label: this.localization('II')}, - {id: 9, label: this.localization('III')}, - {id: 1, label: this.localization('IV')}, - {id: 10, label: this.localization('V')}, - {id: 11, label: this.localization('VI')}, - {id: 3, label: this.localization('RUN')}, - {id: 2, label: this.localization('SELECT')}, - {id: 12, label: this.localization('MODE1')}, - {id: 13, label: this.localization('MODE2')}, - {id: 4, label: this.localization('UP')}, - {id: 5, label: this.localization('DOWN')}, - {id: 6, label: this.localization('LEFT')}, - {id: 7, label: this.localization('RIGHT')}, - ]; - } else { - buttons = [ - {id: 0, label: this.localization('B')}, - {id: 1, label: this.localization('Y')}, - {id: 2, label: this.localization('SELECT')}, - {id: 3, label: this.localization('START')}, - {id: 4, label: this.localization('UP')}, - {id: 5, label: this.localization('DOWN')}, - {id: 6, label: this.localization('LEFT')}, - {id: 7, label: this.localization('RIGHT')}, - {id: 8, label: this.localization('A')}, - {id: 9, label: this.localization('X')}, - {id: 10, label: this.localization('L')}, - {id: 11, label: this.localization('R')}, - {id: 12, label: this.localization('L2')}, - {id: 13, label: this.localization('R2')}, - {id: 14, label: this.localization('L3')}, - {id: 15, label: this.localization('R3')}, - {id: 19, label: this.localization('L STICK UP')}, - {id: 18, label: this.localization('L STICK DOWN')}, - {id: 17, label: this.localization('L STICK LEFT')}, - {id: 16, label: this.localization('L STICK RIGHT')}, - {id: 23, label: this.localization('R STICK UP')}, - {id: 22, label: this.localization('R STICK DOWN')}, - {id: 21, label: this.localization('R STICK LEFT')}, - {id: 20, label: this.localization('R STICK RIGHT')}, - ]; - } - if (['arcade', 'mame'].includes(this.getControlScheme())) { - for (const buttonIdx in buttons) { - if (buttons[buttonIdx].id === 2) { - buttons[buttonIdx].label = this.localization('INSERT COIN'); - } - } - } - buttons.push( - {id: 24, label: this.localization('QUICK SAVE STATE')}, - {id: 25, label: this.localization('QUICK LOAD STATE')}, - {id: 26, label: this.localization('CHANGE STATE SLOT')}, - {id: 27, label: this.localization('FAST FORWARD')}, - {id: 29, label: this.localization('SLOW MOTION')}, - {id: 28, label: this.localization('REWIND')} - ); - //if (_this.statesSupported === false) { - // delete buttons[24]; - // delete buttons[25]; - // delete buttons[26]; - //} - let selectedPlayer; - let players = []; - let playerDivs = []; - - const playerSelect = this.createElement("ul"); - playerSelect.classList.add("ejs_control_player_bar"); - for (let i=1; i<5; i++) { - const playerContainer = this.createElement("li"); - playerContainer.classList.add("tabs-title"); - playerContainer.setAttribute("role", "presentation"); - const player = this.createElement("a"); - player.innerText = this.localization("Player")+" "+i; - player.setAttribute("role", "tab"); - player.setAttribute("aria-controls", "controls-"+(i-1)); - player.setAttribute("aria-selected", "false"); - player.id = "controls-"+(i-1)+"-label"; - this.addEventListener(player, "click", (e) => { - e.preventDefault(); - players[selectedPlayer].classList.remove("ejs_control_selected"); - playerDivs[selectedPlayer].setAttribute("hidden", ""); - selectedPlayer = i-1; - players[i-1].classList.add("ejs_control_selected"); - playerDivs[i-1].removeAttribute("hidden"); - }) - playerContainer.appendChild(player); - playerSelect.appendChild(playerContainer); - players.push(playerContainer); - } - body.appendChild(playerSelect); - - const controls = this.createElement("div"); - for (let i=0; i<4; i++) { - if (!this.controls[i]) this.controls[i] = {}; - const player = this.createElement("div"); - const playerTitle = this.createElement("div"); - - const gamepadTitle = this.createElement("div"); - gamepadTitle.style = "font-size:12px;"; - gamepadTitle.innerText = this.localization("Connected Gamepad")+": "; - - const gamepadName = this.createElement("span"); - this.gamepadLabels.push(gamepadName); - gamepadName.innerText = "n/a"; - gamepadTitle.appendChild(gamepadName); - - const leftPadding = this.createElement("div"); - leftPadding.style = "width:25%;float:left;"; - leftPadding.innerHTML = " "; - - const aboutParent = this.createElement("div"); - aboutParent.style = "font-size:12px;width:50%;float:left;"; - const gamepad = this.createElement("div"); - gamepad.style = "text-align:center;width:50%;float:left;"; - gamepad.innerText = this.localization("Gamepad"); - aboutParent.appendChild(gamepad); - const keyboard = this.createElement("div"); - keyboard.style = "text-align:center;width:50%;float:left;"; - keyboard.innerText = this.localization("Keyboard"); - aboutParent.appendChild(keyboard); - - const headingPadding = this.createElement("div"); - headingPadding.style = "clear:both;"; - - playerTitle.appendChild(gamepadTitle); - playerTitle.appendChild(leftPadding); - playerTitle.appendChild(aboutParent); - - if ((this.touch || navigator.maxTouchPoints > 0) && i === 0) { - const vgp = this.createElement("div"); - vgp.style = "width:25%;float:right;clear:none;padding:0;font-size: 11px;padding-left: 2.25rem;"; - vgp.classList.add("ejs_control_row"); - vgp.classList.add("ejs_cheat_row"); - const input = this.createElement("input"); - input.type = "checkbox"; - input.checked = true; - input.value = "o"; - input.id = "ejs_vp"; - vgp.appendChild(input); - const label = this.createElement("label"); - label.for = "ejs_vp"; - label.innerText = "Virtual Gamepad"; - vgp.appendChild(label); - label.addEventListener("click", (e) => { - input.checked = !input.checked; - this.changeSettingOption('virtual-gamepad', input.checked ? 'enabled' : "disabled"); - }) - this.on("start", (e) => { - if (this.settings["virtual-gamepad"] === "disabled") { - input.checked = false; - } - }) - playerTitle.appendChild(vgp); - } - - playerTitle.appendChild(headingPadding); - - - player.appendChild(playerTitle); - - for (const buttonIdx in buttons) { - const k = buttons[buttonIdx].id; - const controlLabel = buttons[buttonIdx].label; - - const buttonText = this.createElement("div"); - buttonText.setAttribute("data-id", k); - buttonText.setAttribute("data-index", i); - buttonText.setAttribute("data-label", controlLabel); - buttonText.style = "margin-bottom:10px;"; - buttonText.classList.add("ejs_control_bar"); - - - const title = this.createElement("div"); - title.style = "width:25%;float:left;font-size:12px;"; - const label = this.createElement("label"); - label.innerText = controlLabel+":"; - title.appendChild(label); - - const textBoxes = this.createElement("div"); - textBoxes.style = "width:50%;float:left;"; - - const textBox1Parent = this.createElement("div"); - textBox1Parent.style = "width:50%;float:left;padding: 0 5px;"; - const textBox1 = this.createElement("input"); - textBox1.style = "text-align:center;height:25px;width: 100%;"; - textBox1.type = "text"; - textBox1.setAttribute("readonly", ""); - textBox1.setAttribute("placeholder", ""); - textBox1Parent.appendChild(textBox1); - - const textBox2Parent = this.createElement("div"); - textBox2Parent.style = "width:50%;float:left;padding: 0 5px;"; - const textBox2 = this.createElement("input"); - textBox2.style = "text-align:center;height:25px;width: 100%;"; - textBox2.type = "text"; - textBox2.setAttribute("readonly", ""); - textBox2.setAttribute("placeholder", ""); - textBox2Parent.appendChild(textBox2); - - buttonListeners.push(() => { - textBox2.value = ""; - textBox1.value = ""; - if (this.controls[i][k] && this.controls[i][k].value !== undefined) { - let value = this.keyMap[this.controls[i][k].value]; - value = this.localization(value); - textBox2.value = value; - } - if (this.controls[i][k] && this.controls[i][k].value2 !== undefined && this.controls[i][k].value2 !== "") { - let value2 = this.controls[i][k].value2.toString(); - if (value2.includes(":")) { - value2 = value2.split(":"); - value2 = this.localization(value2[0]) + ":" + this.localization(value2[1]) - } else if (!isNaN(value2)){ - value2 = this.localization("BUTTON")+" "+this.localization(value2); - } else { - value2 = this.localization(value2); - } - textBox1.value = value2; - } - }) - - if (this.controls[i][k] && this.controls[i][k].value) { - let value = this.keyMap[this.controls[i][k].value]; - value = this.localization(value); - textBox2.value = value; - } - if (this.controls[i][k] && this.controls[i][k].value2) { - let value2 = this.controls[i][k].value2.toString(); - if (value2.includes(":")) { - value2 = value2.split(":"); - value2 = this.localization(value2[0]) + ":" + this.localization(value2[1]) - } else if (!isNaN(value2)){ - value2 = this.localization("BUTTON")+" "+this.localization(value2); - } else { - value2 = this.localization(value2); - } - textBox1.value = value2; - } - - textBoxes.appendChild(textBox1Parent); - textBoxes.appendChild(textBox2Parent); - - const padding = this.createElement("div"); - padding.style = "clear:both;"; - textBoxes.appendChild(padding); - - const setButton = this.createElement("div"); - setButton.style = "width:25%;float:left;"; - const button = this.createElement("a"); - button.classList.add("ejs_control_set_button"); - button.innerText = this.localization("Set"); - setButton.appendChild(button); - - const padding2 = this.createElement("div"); - padding2.style = "clear:both;"; - - buttonText.appendChild(title); - buttonText.appendChild(textBoxes); - buttonText.appendChild(setButton); - buttonText.appendChild(padding2); - - player.appendChild(buttonText); - - this.addEventListener(buttonText, "mousedown", (e) => { - e.preventDefault(); - this.controlPopup.parentElement.parentElement.removeAttribute("hidden"); - this.controlPopup.innerText = "[ " + controlLabel + " ]\n"+this.localization("Press Keyboard"); - this.controlPopup.setAttribute("button-num", k); - this.controlPopup.setAttribute("player-num", i); - }) - } - controls.appendChild(player); - player.setAttribute("hidden", ""); - playerDivs.push(player); - } - body.appendChild(controls); - - - selectedPlayer = 0; - players[0].classList.add("ejs_control_selected"); - playerDivs[0].removeAttribute("hidden"); - - - const popup = this.createElement('div'); - popup.classList.add("ejs_popup_container"); - const popupMsg = this.createElement("div"); - this.addEventListener(popup, "mousedown click touchstart", (e) => { - if (this.isChild(popupMsg, e.target)) return; - this.controlPopup.parentElement.parentElement.setAttribute("hidden", ""); - }) - const btn = this.createElement("a"); - btn.classList.add("ejs_control_set_button"); - btn.innerText = this.localization("Clear"); - this.addEventListener(btn, "mousedown click touchstart", (e) => { - const num = this.controlPopup.getAttribute("button-num"); - const player = this.controlPopup.getAttribute("player-num"); - if (!this.controls[player][num]) { - this.controls[player][num] = {}; - } - this.controls[player][num].value = 0; - this.controls[player][num].value2 = ""; - this.controlPopup.parentElement.parentElement.setAttribute("hidden", ""); - this.checkGamepadInputs(); - this.saveSettings(); - }) - popupMsg.classList.add("ejs_popup_box"); - popupMsg.innerText = ""; - popup.setAttribute("hidden", ""); - const popMsg = this.createElement("div"); - this.controlPopup = popMsg; - popup.appendChild(popupMsg); - popupMsg.appendChild(popMsg); - popupMsg.appendChild(this.createElement("br")); - popupMsg.appendChild(btn); - this.controlMenu.appendChild(popup); - - } - defaultControllers = { - 0: { - 0: { - 'value': 'x', - 'value2': 'BUTTON_2' - }, - 1: { - 'value': 's', - 'value2': 'BUTTON_4' - }, - 2: { - 'value': 'v', - 'value2': 'SELECT' - }, - 3: { - 'value': 'enter', - 'value2': 'START' - }, - 4: { - 'value': 'up arrow', - 'value2': 'DPAD_UP' - }, - 5: { - 'value': 'down arrow', - 'value2': 'DPAD_DOWN' - }, - 6: { - 'value': 'left arrow', - 'value2': 'DPAD_LEFT' - }, - 7: { - 'value': 'right arrow', - 'value2': 'DPAD_RIGHT' - }, - 8: { - 'value': 'z', - 'value2': 'BUTTON_1' - }, - 9: { - 'value': 'a', - 'value2': 'BUTTON_3' - }, - 10: { - 'value': 'q', - 'value2': 'LEFT_TOP_SHOULDER' - }, - 11: { - 'value': 'e', - 'value2': 'RIGHT_TOP_SHOULDER' - }, - 12: { - 'value': 'tab', - 'value2': 'LEFT_BOTTOM_SHOULDER' - }, - 13: { - 'value': 'r', - 'value2': 'RIGHT_BOTTOM_SHOULDER' - }, - 14: { - 'value': '', - 'value2': 'LEFT_STICK', - }, - 15: { - 'value': '', - 'value2': 'RIGHT_STICK', - }, - 16: { - 'value': 'h', - 'value2': 'LEFT_STICK_X:+1' - }, - 17: { - 'value': 'f', - 'value2': 'LEFT_STICK_X:-1' - }, - 18: { - 'value': 'g', - 'value2': 'LEFT_STICK_Y:+1' - }, - 19: { - 'value': 't', - 'value2': 'LEFT_STICK_Y:-1' - }, - 20: { - 'value': 'l', - 'value2': 'RIGHT_STICK_X:+1' - }, - 21: { - 'value': 'j', - 'value2': 'RIGHT_STICK_X:-1' - }, - 22: { - 'value': 'k', - 'value2': 'RIGHT_STICK_Y:+1' - }, - 23: { - 'value': 'i', - 'value2': 'RIGHT_STICK_Y:-1' - }, - 24: { - 'value': '1' - }, - 25: { - 'value': '2' - }, - 26: { - 'value': '3' - }, - 27: {}, - 28: {}, - 29: {}, - }, - 1: {}, - 2: {}, - 3: {} - } - keyMap = { - 0: '', - 8: 'backspace', - 9: 'tab', - 13: 'enter', - 16: 'shift', - 17: 'ctrl', - 18: 'alt', - 19: 'pause/break', - 20: 'caps lock', - 27: 'escape', - 32: 'space', - 33: 'page up', - 34: 'page down', - 35: 'end', - 36: 'home', - 37: 'left arrow', - 38: 'up arrow', - 39: 'right arrow', - 40: 'down arrow', - 45: 'insert', - 46: 'delete', - 48: '0', - 49: '1', - 50: '2', - 51: '3', - 52: '4', - 53: '5', - 54: '6', - 55: '7', - 56: '8', - 57: '9', - 65: 'a', - 66: 'b', - 67: 'c', - 68: 'd', - 69: 'e', - 70: 'f', - 71: 'g', - 72: 'h', - 73: 'i', - 74: 'j', - 75: 'k', - 76: 'l', - 77: 'm', - 78: 'n', - 79: 'o', - 80: 'p', - 81: 'q', - 82: 'r', - 83: 's', - 84: 't', - 85: 'u', - 86: 'v', - 87: 'w', - 88: 'x', - 89: 'y', - 90: 'z', - 91: 'left window key', - 92: 'right window key', - 93: 'select key', - 96: 'numpad 0', - 97: 'numpad 1', - 98: 'numpad 2', - 99: 'numpad 3', - 100: 'numpad 4', - 101: 'numpad 5', - 102: 'numpad 6', - 103: 'numpad 7', - 104: 'numpad 8', - 105: 'numpad 9', - 106: 'multiply', - 107: 'add', - 109: 'subtract', - 110: 'decimal point', - 111: 'divide', - 112: 'f1', - 113: 'f2', - 114: 'f3', - 115: 'f4', - 116: 'f5', - 117: 'f6', - 118: 'f7', - 119: 'f8', - 120: 'f9', - 121: 'f10', - 122: 'f11', - 123: 'f12', - 144: 'num lock', - 145: 'scroll lock', - 186: 'semi-colon', - 187: 'equal sign', - 188: 'comma', - 189: 'dash', - 190: 'period', - 191: 'forward slash', - 192: 'grave accent', - 219: 'open bracket', - 220: 'back slash', - 221: 'close braket', - 222: 'single quote' - } - controls; - setupKeys(){ - for (let i=0; i<4; i++) { - for (let j=0; j<30; j++) { - if (this.controls[i][j] && this.keyMap) { - this.controls[i][j].value = Number(this.keyLookup(this.controls[i][j])); - if(this.controls[i][j].value === -1){ - console.warn("Invalid key for control "+j+" player "+i+" with value "+this.keyMap[this.keyLookup(this.defaultControllers[i][j])]); - } - } - } - } - } - keyLookup(controllerkey){ - for (var key in this.keyMap) { - if (this.keyMap[key] === controllerkey.value || key === controllerkey.value) { - return key; - } else if (controllerkey.value === undefined) { - return 0; - } - } - return -1; - } - keyChange(e) { - if (e.repeat) return; - if (!this.started) return; - if (this.controlPopup.parentElement.parentElement.getAttribute("hidden") === null) { - const num = this.controlPopup.getAttribute("button-num"); - const player = this.controlPopup.getAttribute("player-num"); - if (!this.controls[player][num]) { - this.controls[player][num] = {}; - } - this.controls[player][num].value = e.keyCode; - this.controlPopup.parentElement.parentElement.setAttribute("hidden", ""); - this.checkGamepadInputs(); - this.saveSettings(); - return; - } - if (this.settingsMenu.style.display !== "none" || this.isPopupOpen()) return; - e.preventDefault(); - const special = [16, 17, 18, 19, 20, 21, 22, 23]; - for (let i=0; i<4; i++) { - for (let j=0; j<30; j++) { - if (this.controls[i][j] && this.controls[i][j].value === e.keyCode) { - this.gameManager.simulateInput(i, j, (e.type === 'keyup' ? 0 : (special.includes(j) ? 0x7fff : 1))); - } - } - } - } - gamepadEvent(e) { - if (!this.started) return; - const value = function(value) { - if (value > 0.5 || value < -0.5) { - return (value > 0) ? 1 : -1; - } else { - return 0; - } - }(e.value || 0); - if (this.controlPopup.parentElement.parentElement.getAttribute("hidden") === null) { - if ('buttonup' === e.type || (e.type === "axischanged" && value === 0)) return; - const num = this.controlPopup.getAttribute("button-num"); - const player = parseInt(this.controlPopup.getAttribute("player-num")); - if (e.gamepadIndex !== player) return; - if (!this.controls[player][num]) { - this.controls[player][num] = {}; - } - this.controls[player][num].value2 = e.label; - this.controlPopup.parentElement.parentElement.setAttribute("hidden", ""); - this.checkGamepadInputs(); - this.saveSettings(); - return; - } - if (this.settingsMenu.style.display !== "none" || this.isPopupOpen()) return; - const special = [16, 17, 18, 19, 20, 21, 22, 23]; - for (let i=0; i<4; i++) { - if (e.gamepadIndex !== i) continue; - for (let j=0; j<30; j++) { - if (!this.controls[i][j] || this.controls[i][j].value2 === undefined) { - continue; - } - const controlValue = this.controls[i][j].value2; - - if (['buttonup', 'buttondown'].includes(e.type) && (controlValue === e.label || controlValue === e.index)) { - this.gameManager.simulateInput(i, j, (e.type === 'buttonup' ? 0 : (special.includes(j) ? 0x7fff : 1))); - } else if (e.type === "axischanged") { - if (typeof controlValue === 'string' && controlValue.split(":")[0] === e.axis) { - if (special.includes(j)) { - if (e.axis === 'LEFT_STICK_X') { - if (e.value > 0) { - this.gameManager.simulateInput(i, 16, 0x7fff * e.value); - this.gameManager.simulateInput(i, 17, 0); - } else { - this.gameManager.simulateInput(i, 17, -0x7fff * e.value); - this.gameManager.simulateInput(i, 16, 0); - } - } else if (e.axis === 'LEFT_STICK_Y') { - if (e.value > 0) { - this.gameManager.simulateInput(i, 18, 0x7fff * e.value); - this.gameManager.simulateInput(i, 19, 0); - } else { - this.gameManager.simulateInput(i, 19, -0x7fff * e.value); - this.gameManager.simulateInput(i, 18, 0); - } - } else if (e.axis === 'RIGHT_STICK_X') { - if (e.value > 0) { - this.gameManager.simulateInput(i, 20, 0x7fff * e.value); - this.gameManager.simulateInput(i, 21, 0); - } else { - this.gameManager.simulateInput(i, 21, -0x7fff * e.value); - this.gameManager.simulateInput(i, 20, 0); - } - } else if (e.axis === 'RIGHT_STICK_Y') { - if (e.value > 0) { - this.gameManager.simulateInput(i, 22, 0x7fff * e.value); - this.gameManager.simulateInput(i, 23, 0); - } else { - this.gameManager.simulateInput(i, 23, 0x7fff * e.value); - this.gameManager.simulateInput(i, 22, 0); - } - } - } else if (value === 0 || controlValue === e.label || controlValue === `${e.axis}:${value}`) { - this.gameManager.simulateInput(i, j, ((value === 0) ? 0 : 1)); - } - } - } - } - } - } - setVirtualGamepad() { - this.virtualGamepad = this.createElement("div"); - this.toggleVirtualGamepad = (show) => { - this.virtualGamepad.style.display = show ? "" : "none"; - } - this.virtualGamepad.classList.add("ejs_virtualGamepad_parent"); - this.elements.parent.appendChild(this.virtualGamepad); - - const speedControlButtons = [ - {"type":"button","text":"Fast","id":"speed-fast","location":"center","left":-35,"top":50,"fontSize":15,"block":true,"input_value":27}, - {"type":"button","text":"Slow","id":"speed-slow","location":"center","left":95,"top":50,"fontSize":15,"block":true,"input_value":29}, - ]; - if (this.rewindEnabled) { - speedControlButtons.push({"type":"button","text":"Rewind","id":"speed-rewind","location":"center","left":30,"top":50,"fontSize":15,"block":true,"input_value":28}); - } - - let info; - if (this.config.VirtualGamepadSettings && function(set) { - if (!Array.isArray(set)) { - console.warn("Virtual gamepad settings is not array! Using default gamepad settings"); - return false; - } - if (!set.length) { - console.warn("Virtual gamepad settings is empty! Using default gamepad settings"); - return false; - } - for (let i=0; i { - left.classList.toggle("ejs_virtualGamepad_left", !enabled); - right.classList.toggle("ejs_virtualGamepad_right", !enabled); - left.classList.toggle("ejs_virtualGamepad_right", enabled); - right.classList.toggle("ejs_virtualGamepad_left", enabled); - } - - const leftHandedMode = false; - const blockCSS = 'height:31px;text-align:center;border:1px solid #ccc;border-radius:5px;line-height:31px;'; - - for (let i=0; i { - e.preventDefault(); - if (e.type === 'touchend' || e.type === 'touchcancel') { - e.target.classList.remove("ejs_virtualGamepad_button_down"); - window.setTimeout(() => { - this.gameManager.simulateInput(0, value, 0); - }) - } else { - e.target.classList.add("ejs_virtualGamepad_button_down"); - this.gameManager.simulateInput(0, value, 1); - } - }) - } - } - - const createDPad = (opts) => { - const container = opts.container; - const callback = opts.event; - const dpadMain = this.createElement("div"); - dpadMain.classList.add("ejs_dpad_main"); - const vertical = this.createElement("div"); - vertical.classList.add("ejs_dpad_vertical"); - const horizontal = this.createElement("div"); - horizontal.classList.add("ejs_dpad_horizontal"); - const bar1 = this.createElement("div"); - bar1.classList.add("ejs_dpad_bar"); - const bar2 = this.createElement("div"); - bar2.classList.add("ejs_dpad_bar"); - - horizontal.appendChild(bar1); - vertical.appendChild(bar2); - dpadMain.appendChild(vertical); - dpadMain.appendChild(horizontal); - - const updateCb = (e) => { - e.preventDefault(); - const touch = e.targetTouches[0]; - if (!touch) return; - const rect = dpadMain.getBoundingClientRect(); - const x = touch.clientX - rect.left - dpadMain.clientWidth / 2; - const y = touch.clientY - rect.top - dpadMain.clientHeight / 2; - let up = 0, - down = 0, - left = 0, - right = 0, - angle = Math.atan(x / y) / (Math.PI / 180); - - if (y <= -10) { - up = 1; - } - if (y >= 10) { - down = 1; - } - - if (x >= 10) { - right = 1; - left = 0; - if (angle < 0 && angle >= -35 || angle > 0 && angle <= 35) { - right = 0; - } - up = (angle < 0 && angle >= -55 ? 1 : 0); - down = (angle > 0 && angle <= 55 ? 1 : 0); - } - - if (x <= -10) { - right = 0; - left = 1; - if (angle < 0 && angle >= -35 || angle > 0 && angle <= 35) { - left = 0; - } - up = (angle > 0 && angle <= 55 ? 1 : 0); - down = (angle < 0 && angle >= -55 ? 1 : 0); - } - - dpadMain.classList.toggle("ejs_dpad_up_pressed", up); - dpadMain.classList.toggle("ejs_dpad_down_pressed", down); - dpadMain.classList.toggle("ejs_dpad_right_pressed", right); - dpadMain.classList.toggle("ejs_dpad_left_pressed", left); - - callback(up, down, left, right); - } - const cancelCb = (e) => { - e.preventDefault(); - dpadMain.classList.remove("ejs_dpad_up_pressed"); - dpadMain.classList.remove("ejs_dpad_down_pressed"); - dpadMain.classList.remove("ejs_dpad_right_pressed"); - dpadMain.classList.remove("ejs_dpad_left_pressed"); - - callback(0, 0, 0, 0); - } - - this.addEventListener(dpadMain, 'touchstart touchmove', updateCb); - this.addEventListener(dpadMain, 'touchend touchcancel', cancelCb); - - - container.appendChild(dpadMain); - } - - info.forEach((dpad, index) => { - if (dpad.type !== 'dpad') return; - if (leftHandedMode && ['left', 'right'].includes(dpad.location)) { - dpad.location = (dpad.location==='left') ? 'right' : 'left'; - const amnt = JSON.parse(JSON.stringify(dpad)); - if (amnt.left) { - dpad.right = amnt.left; - } - if (amnt.right) { - dpad.left = amnt.right; - } - } - const elem = this.createElement("div"); - let style = ''; - if (dpad.left) { - style += 'left:'+dpad.left+';'; - } - if (dpad.right) { - style += 'right:'+dpad.right+';'; - } - if (dpad.top) { - style += 'top:'+dpad.top+';'; - } - elem.style = style; - elems[dpad.location].appendChild(elem); - createDPad({container: elem, event: (up, down, left, right) => { - if (dpad.joystickInput) { - if (up === 1) up=0x7fff; - if (down === 1) down=0x7fff; - if (left === 1) left=0x7fff; - if (right === 1) right=0x7fff; - } - this.gameManager.simulateInput(0, dpad.inputValues[0], up); - this.gameManager.simulateInput(0, dpad.inputValues[1], down); - this.gameManager.simulateInput(0, dpad.inputValues[2], left); - this.gameManager.simulateInput(0, dpad.inputValues[3], right); - }}); - }) - - - info.forEach((zone, index) => { - if (zone.type !== 'zone') return; - if (leftHandedMode && ['left', 'right'].includes(zone.location)) { - zone.location = (zone.location==='left') ? 'right' : 'left'; - const amnt = JSON.parse(JSON.stringify(zone)); - if (amnt.left) { - zone.right = amnt.left; - } - if (amnt.right) { - zone.left = amnt.right; - } - } - const elem = this.createElement("div"); - this.addEventListener(elem, "touchstart touchmove touchend touchcancel", (e) => { - e.preventDefault(); - }); - elems[zone.location].appendChild(elem); - const zoneObj = nipplejs.create({ - 'zone': elem, - 'mode': 'static', - 'position': { - 'left': zone.left, - 'top': zone.top - }, - 'color': zone.color || 'red' - }); - zoneObj.on('end', () => { - this.gameManager.simulateInput(0, zone.inputValues[0], 0); - this.gameManager.simulateInput(0, zone.inputValues[1], 0); - this.gameManager.simulateInput(0, zone.inputValues[2], 0); - this.gameManager.simulateInput(0, zone.inputValues[3], 0); - }); - zoneObj.on('move', (e, info) => { - const degree = info.angle.degree; - const distance = info.distance; - if (zone.joystickInput === true) { - let x = 0, y = 0; - if (degree > 0 && degree <= 45) { - x = distance / 50; - y = -0.022222222222222223 * degree * distance / 50; - } - if (degree > 45 && degree <= 90) { - x = 0.022222222222222223 * (90 - degree) * distance / 50; - y = -distance / 50; - } - if (degree > 90 && degree <= 135) { - x = 0.022222222222222223 * (90 - degree) * distance / 50; - y = -distance / 50; - } - if (degree > 135 && degree <= 180) { - x = -distance / 50; - y = -0.022222222222222223 * (180 - degree) * distance / 50; - } - if (degree > 135 && degree <= 225) { - x = -distance / 50; - y = -0.022222222222222223 * (180 - degree) * distance / 50; - } - if (degree > 225 && degree <= 270) { - x = -0.022222222222222223 * (270 - degree) * distance / 50; - y = distance / 50; - } - if (degree > 270 && degree <= 315) { - x = -0.022222222222222223 * (270 - degree) * distance / 50; - y = distance / 50; - } - if (degree > 315 && degree <= 359.9) { - x = distance / 50; - y = 0.022222222222222223 * (360 - degree) * distance / 50; - } - if (x > 0) { - this.gameManager.simulateInput(0, zone.inputValues[0], 0x7fff * x); - this.gameManager.simulateInput(0, zone.inputValues[1], 0); - } else { - this.gameManager.simulateInput(0, zone.inputValues[1], 0x7fff * -x); - this.gameManager.simulateInput(0, zone.inputValues[0], 0); - } - if (y > 0) { - this.gameManager.simulateInput(0, zone.inputValues[2], 0x7fff * y); - this.gameManager.simulateInput(0, zone.inputValues[3], 0); - } else { - this.gameManager.simulateInput(0, zone.inputValues[3], 0x7fff * -y); - this.gameManager.simulateInput(0, zone.inputValues[2], 0); - } - - } else { - if (degree >= 30 && degree < 150) { - this.gameManager.simulateInput(0, zone.inputValues[0], 1); - } else { - window.setTimeout(() => { - this.gameManager.simulateInput(0, zone.inputValues[0], 0); - }, 30); - } - if (degree >= 210 && degree < 330) { - this.gameManager.simulateInput(0, zone.inputValues[1], 1); - } else { - window.setTimeout(() => { - this.gameManager.simulateInput(0, zone.inputValues[1], 0); - }, 30); - } - if (degree >= 120 && degree < 240) { - this.gameManager.simulateInput(0, zone.inputValues[2], 1); - } else { - window.setTimeout(() => { - this.gameManager.simulateInput(0, zone.inputValues[2], 0); - }, 30); - } - if (degree >= 300 || degree >= 0 && degree < 60) { - this.gameManager.simulateInput(0, zone.inputValues[3], 1); - } else { - window.setTimeout(() => { - this.gameManager.simulateInput(0, zone.inputValues[3], 0); - }, 30); - } - } - }); - }) - - if (this.touch || navigator.maxTouchPoints > 0) { - const menuButton = this.createElement("div"); - menuButton.innerHTML = ''; - menuButton.classList.add("ejs_virtualGamepad_open"); - menuButton.style.display = "none"; - this.on("start", () => menuButton.style.display = ""); - this.elements.parent.appendChild(menuButton); - let timeout; - let ready = true; - this.addEventListener(menuButton, "touchstart touchend mousedown mouseup click", (e) => { - if (!ready) return; - clearTimeout(timeout); - timeout = setTimeout(() => { - ready = true; - }, 2000) - ready = false; - e.preventDefault(); - this.menu.toggle(); - }) - this.elements.menuToggle = menuButton; - } - - this.virtualGamepad.style.display = "none"; - } - handleResize() { - if (this.virtualGamepad) { - if (this.virtualGamepad.style.display === "none") { - this.virtualGamepad.style.opacity = 0; - this.virtualGamepad.style.display = ""; - setTimeout(() => { - this.virtualGamepad.style.display = "none"; - this.virtualGamepad.style.opacity = ""; - }, 250) - } - } - if (!this.Module) return; - const dpr = window.devicePixelRatio || 1; - const positionInfo = this.elements.parent.getBoundingClientRect(); - const width = positionInfo.width * dpr; - const height = (positionInfo.height * dpr); - this.Module.setCanvasSize(width, height); - if (!this.handleSettingsResize) return; - this.handleSettingsResize(); - } - getElementSize(element) { - let elem = element.cloneNode(true); - elem.style.position = 'absolute'; - elem.style.opacity = 0; - elem.removeAttribute('hidden'); - element.parentNode.appendChild(elem); - const res = elem.getBoundingClientRect(); - elem.remove(); - return { - 'width': res.width, - 'height': res.height - }; - } - saveSettings() { - if (!window.localStorage || !this.settingsLoaded) return; - const coreSpecific = { - controlSettings: this.controls, - settings: this.settings, - cheats: this.cheats - } - const ejs_settings = { - volume: this.volume, - muted: this.muted - } - localStorage.setItem("ejs-settings", JSON.stringify(ejs_settings)); - localStorage.setItem("ejs-"+this.getCore()+"-settings", JSON.stringify(coreSpecific)); - } - loadRewindEnabled() { - if (!window.localStorage) return; - let coreSpecific = localStorage.getItem("ejs-"+this.getCore()+"-settings"); - try { - coreSpecific = JSON.parse(coreSpecific); - if (!coreSpecific || !coreSpecific.settings) { - return false; - } - return coreSpecific.settings.rewindEnabled === 'enabled'; - } catch (e) { - console.warn("Could not load previous settings", e); - return false; - } - } - loadSettings() { - if (!window.localStorage) return; - this.settingsLoaded = true; - let ejs_settings = localStorage.getItem("ejs-settings"); - let coreSpecific = localStorage.getItem("ejs-"+this.getCore()+"-settings"); - if (coreSpecific) { - try { - coreSpecific = JSON.parse(coreSpecific); - if (!(coreSpecific.controlSettings instanceof Object) || !(coreSpecific.settings instanceof Object) || !Array.isArray(coreSpecific.cheats)) return; - this.controls = coreSpecific.controlSettings; - this.checkGamepadInputs(); - for (const k in coreSpecific.settings) { - this.changeSettingOption(k, coreSpecific.settings[k]); - } - for (let i=0; i { - if (this.isFastForward) this.gameManager.toggleFastForward(1); - }, 10) - } else if (option === "fastForward") { - if (value === "enabled") { - this.isFastForward = true; - this.gameManager.toggleFastForward(1); - } else if (value === "disabled") { - this.isFastForward = false; - this.gameManager.toggleFastForward(0); - } - } else if (option === 'sm-ratio') { - if (this.isSlowMotion) this.gameManager.toggleSlowMotion(0); - this.gameManager.setSlowMotionRatio(parseFloat(value)); - setTimeout(() => { - if (this.isSlowMotion) this.gameManager.toggleSlowMotion(1); - }, 10); - } else if (option === 'slowMotion') { - if (value === "enabled") { - this.isSlowMotion = true; - this.gameManager.toggleSlowMotion(1); - } else if (value === "disabled") { - this.isSlowMotion = false; - this.gameManager.toggleSlowMotion(0); - } - } else if (option === "rewind-granularity") { - if (this.rewindEnabled) { - this.gameManager.setRewindGranularity(parseInt(value)); - } - } - this.gameManager.setVariable(option, value); - this.saveSettings(); - } - setupSettingsMenu() { - this.settingsMenu = this.createElement("div"); - this.settingsMenu.classList.add("ejs_settings_parent"); - const nested = this.createElement("div"); - nested.classList.add("ejs_settings_transition"); - this.settings = {}; - - const home = this.createElement("div"); - home.style.overflow = "auto"; - const menus = []; - this.handleSettingsResize = () => { - let needChange = false; - if (this.settingsMenu.style.display !== "") { - this.settingsMenu.style.opacity = "0"; - this.settingsMenu.style.display = ""; - needChange = true; - } - const x = this.settingsMenu.parentElement.getBoundingClientRect().x; - let height = this.elements.parent.getBoundingClientRect().height; - let width = this.elements.parent.getBoundingClientRect().width; - if (height > 375) height = 375; - home.style['max-height'] = (height - 95) + "px"; - nested.style['max-height'] = (height - 95) + "px"; - for (let i=0; i= width/2) && (width < 575)); - if (needChange) { - this.settingsMenu.style.display = "none"; - this.settingsMenu.style.opacity = ""; - } - } - - home.classList.add("ejs_setting_menu"); - nested.appendChild(home); - let funcs = []; - this.changeSettingOption = (title, newValue) => { - this.settings[title] = newValue; - funcs.forEach(e => e(title)); - } - let allOpts = {}; - - const addToMenu = (title, id, options, defaultOption) => { - const menuOption = this.createElement("div"); - menuOption.classList.add("ejs_settings_main_bar"); - const span = this.createElement("span"); - span.innerText = title; - - const current = this.createElement("div"); - current.innerText = ""; - current.classList.add("ejs_settings_main_bar_selected"); - span.appendChild(current); - - menuOption.appendChild(span); - home.appendChild(menuOption); - - const menu = this.createElement("div"); - menus.push(menu); - menu.style.overflow = "auto"; - menu.setAttribute("hidden", ""); - const button = this.createElement("button"); - const goToHome = () => { - const homeSize = this.getElementSize(home); - nested.style.width = (homeSize.width+20) + "px"; - nested.style.height = homeSize.height + "px"; - menu.setAttribute("hidden", ""); - home.removeAttribute("hidden"); - } - this.addEventListener(menuOption, "click", (e) => { - const targetSize = this.getElementSize(menu); - nested.style.width = (targetSize.width+20) + "px"; - nested.style.height = targetSize.height + "px"; - menu.removeAttribute("hidden"); - home.setAttribute("hidden", ""); - }) - this.addEventListener(button, "click", goToHome); - - button.type = "button"; - button.classList.add("ejs_back_button"); - menu.appendChild(button); - const pageTitle = this.createElement("span"); - pageTitle.innerText = title; - pageTitle.classList.add("ejs_menu_text_a"); - button.appendChild(pageTitle); - - const optionsMenu = this.createElement("div"); - optionsMenu.classList.add("ejs_setting_menu"); - //optionsMenu.style["max-height"] = "385px"; - //optionsMenu.style.overflow = "auto"; - - let buttons = []; - let opts = options; - if (Array.isArray(options)) { - opts = {}; - for (let i=0; i { - if (id !== title) return; - for (let j=0; j { - this.settings[id] = opt; - for (let j=0; j 1) { - const diskLabels = {}; - for (let i=0; i 0) { - addToMenu(this.localization('Virtual Gamepad'), 'virtual-gamepad', { - 'enabled': this.localization("Enabled"), - 'disabled': this.localization("Disabled") - }, this.isMobile ? 'enabled' : 'disabled'); - addToMenu(this.localization('Left Handed Mode'), 'virtual-gamepad-left-handed-mode', { - 'enabled': this.localization("Enabled"), - 'disabled': this.localization("Disabled") - }, 'disabled'); - } - let coreOpts; - try { - coreOpts = this.gameManager.getCoreOptions(); - } catch(e){} - if (coreOpts) { - coreOpts.split('\n').forEach((line, index) => { - let option = line.split('; '); - let name = option[0]; - let options = option[1].split('|'), - optionName = name.split("|")[0].replace(/_/g, ' ').replace(/.+\-(.+)/, '$1'); - options.slice(1, -1); - if (options.length === 1) return; - let availableOptions = {}; - for (let i=0; i 1) ? name.split("|")[1] : options[0].replace('(Default) ', '')); - }) - } - - this.settingsMenu.appendChild(nested); - - this.settingParent.appendChild(this.settingsMenu); - this.settingParent.style.position = "relative"; - - const homeSize = this.getElementSize(home); - nested.style.width = (homeSize.width+20) + "px"; - nested.style.height = homeSize.height + "px"; - - this.settingsMenu.style.display = "none"; - - if (this.debug) { - console.log("Available core options", allOpts); - } - - if (this.config.defaultOptions) { - for (const k in this.config.defaultOptions) { - this.changeSettingOption(k, this.config.defaultOptions[k]); - } - } - } - createSubPopup(hidden) { - const popup = this.createElement('div'); - popup.classList.add("ejs_popup_container"); - popup.classList.add("ejs_popup_container_box"); - const popupMsg = this.createElement("div"); - popupMsg.innerText = ""; - if (hidden) popup.setAttribute("hidden", ""); - popup.appendChild(popupMsg); - return [popup, popupMsg]; - } - createNetplayMenu() { - const body = this.createPopup("Netplay", { - "Create a Room": () => { - if (this.isNetplay) { - this.netplay.leaveRoom(); - } else { - this.netplay.showOpenRoomDialog(); - } - }, - "Close": () => { - this.netplayMenu.style.display = "none"; - this.netplay.updateList.stop(); - } - }, true); - this.netplayMenu = body.parentElement; - const createButton = this.netplayMenu.getElementsByTagName("a")[0]; - const rooms = this.createElement("div"); - const title = this.createElement("strong"); - title.innerText = this.localization("Rooms"); - const table = this.createElement("table"); - table.classList.add("ejs_netplay_table"); - table.style.width = "100%"; - table.setAttribute("cellspacing", "0"); - const thead = this.createElement("thead"); - const row = this.createElement("tr"); - const addToHeader = (text) => { - const item = this.createElement("td"); - item.innerText = text; - item.style["text-align"] = "center"; - row.appendChild(item); - return item; - } - thead.appendChild(row); - addToHeader("Room Name").style["text-align"] = "left"; - addToHeader("Players").style.width = "80px"; - addToHeader("").style.width = "80px"; //"join" button - table.appendChild(thead); - const tbody = this.createElement("tbody"); - - table.appendChild(tbody); - rooms.appendChild(title); - rooms.appendChild(table); - - - const joined = this.createElement("div"); - const title2 = this.createElement("strong"); - title2.innerText = "{roomname}"; - const password = this.createElement("div"); - password.innerText = "Password: "; - const table2 = this.createElement("table"); - table2.classList.add("ejs_netplay_table"); - table2.style.width = "100%"; - table2.setAttribute("cellspacing", "0"); - const thead2 = this.createElement("thead"); - const row2 = this.createElement("tr"); - const addToHeader2 = (text) => { - const item = this.createElement("td"); - item.innerText = text; - row2.appendChild(item); - return item; - } - thead2.appendChild(row2); - addToHeader2("Player").style.width = "80px"; - addToHeader2("Name"); - addToHeader2("").style.width = "80px"; //"join" button - table2.appendChild(thead2); - const tbody2 = this.createElement("tbody"); - - table2.appendChild(tbody2); - joined.appendChild(title2); - joined.appendChild(password); - joined.appendChild(table2); - - joined.style.display = "none"; - body.appendChild(rooms); - body.appendChild(joined); - - this.openNetplayMenu = () => { - this.netplayMenu.style.display = ""; - if (!this.netplay || (this.netplay && !this.netplay.name)) { - this.netplay = {}; - this.netplay.table = tbody; - this.netplay.playerTable = tbody2; - this.netplay.passwordElem = password; - this.netplay.roomNameElem = title2; - this.netplay.createButton = createButton; - this.netplay.tabs = [rooms, joined]; - this.defineNetplayFunctions(); - const popups = this.createSubPopup(); - this.netplayMenu.appendChild(popups[0]); - popups[1].classList.add("ejs_cheat_parent"); //Hehe - const popup = popups[1]; - - const header = this.createElement("div"); - const title = this.createElement("h2"); - title.innerText = this.localization("Set Player Name"); - title.classList.add("ejs_netplay_name_heading"); - header.appendChild(title); - popup.appendChild(header); - - const main = this.createElement("div"); - main.classList.add("ejs_netplay_header"); - const head = this.createElement("strong"); - head.innerText = this.localization("Player Name"); - const input = this.createElement("input"); - input.type = "text"; - input.setAttribute("maxlength", 20); - - main.appendChild(head); - main.appendChild(this.createElement("br")); - main.appendChild(input); - popup.appendChild(main); - - popup.appendChild(this.createElement("br")); - const submit = this.createElement("button"); - submit.classList.add("ejs_button_button"); - submit.classList.add("ejs_popup_submit"); - submit.style["background-color"] = "rgba(var(--ejs-primary-color),1)"; - submit.innerText = this.localization("Submit"); - popup.appendChild(submit); - this.addEventListener(submit, "click", (e) => { - if (!input.value.trim()) return; - this.netplay.name = input.value.trim(); - popups[0].remove(); - }) - } - this.netplay.updateList.start(); - } - } - defineNetplayFunctions() { - function guidGenerator() { - const S4 = function() { - return (((1+Math.random())*0x10000)|0).toString(16).substring(1); - }; - return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4()); - } - this.netplay.url = this.config.netplayUrl; - while (this.netplay.url.endsWith("/")) { - this.netplay.url = this.netplay.url.substring(0, this.netplay.url.length-1); - } - this.netplay.current_frame = 0; - this.netplay.getOpenRooms = async () => { - return JSON.parse(await (await fetch(this.netplay.url+"/list?domain="+window.location.host+"&game_id="+this.config.gameId)).text()); - } - this.netplay.updateTableList = async () => { - const addToTable = (id, name, current, max) => { - const row = this.createElement("tr"); - row.classList.add("ejs_netplay_table_row"); - const addToHeader = (text) => { - const item = this.createElement("td"); - item.innerText = text; - item.style.padding = "10px 0"; - item.style["text-align"] = "center"; - row.appendChild(item); - return item; - } - addToHeader(name).style["text-align"] = "left"; - addToHeader(current + "/" + max).style.width = "80px"; - - const parent = addToHeader(""); - parent.style.width = "80px"; - this.netplay.table.appendChild(row); - if (current < max) { - const join = this.createElement("button"); - join.classList.add("ejs_netplay_join_button"); - join.classList.add("ejs_button_button"); - join.style["background-color"] = "rgba(var(--ejs-primary-color),1)"; - join.innerText = this.localization("Join"); - parent.appendChild(join); - this.addEventListener(join, "click", (e) => { - this.netplay.joinRoom(id, name); - }) - return join; - } - } - const open = await this.netplay.getOpenRooms(); - //console.log(open); - this.netplay.table.innerHTML = ""; - for (const k in open) { - addToTable(k, open[k].room_name, open[k].current, open[k].max);//todo: password - } - } - this.netplay.showOpenRoomDialog = () => { - const popups = this.createSubPopup(); - this.netplayMenu.appendChild(popups[0]); - popups[1].classList.add("ejs_cheat_parent"); //Hehe - const popup = popups[1]; - - const header = this.createElement("div"); - const title = this.createElement("h2"); - title.innerText = this.localization("Create a room"); - title.classList.add("ejs_netplay_name_heading"); - header.appendChild(title); - popup.appendChild(header); - - const main = this.createElement("div"); - - main.classList.add("ejs_netplay_header"); - const rnhead = this.createElement("strong"); - rnhead.innerText = this.localization("Room Name"); - const rninput = this.createElement("input"); - rninput.type = "text"; - rninput.setAttribute("maxlength", 20); - - const maxhead = this.createElement("strong"); - maxhead.innerText = this.localization("Max Players"); - const maxinput = this.createElement("select"); - maxinput.setAttribute("disabled", "disabled"); - const val2 = this.createElement("option"); - val2.value = 2; - val2.innerText = "2"; - const val3 = this.createElement("option"); - val3.value = 3; - val3.innerText = "3"; - const val4 = this.createElement("option"); - val4.value = 4; - val4.innerText = "4"; - maxinput.appendChild(val2); - maxinput.appendChild(val3); - maxinput.appendChild(val4); - - - const pwhead = this.createElement("strong"); - pwhead.innerText = this.localization("Password (optional)"); - const pwinput = this.createElement("input"); - pwinput.type = "text"; - pwinput.setAttribute("maxlength", 20); - - main.appendChild(rnhead); - main.appendChild(this.createElement("br")); - main.appendChild(rninput); - - main.appendChild(maxhead); - main.appendChild(this.createElement("br")); - main.appendChild(maxinput); - - main.appendChild(pwhead); - main.appendChild(this.createElement("br")); - main.appendChild(pwinput); - - popup.appendChild(main); - - popup.appendChild(this.createElement("br")); - const submit = this.createElement("button"); - submit.classList.add("ejs_button_button"); - submit.classList.add("ejs_popup_submit"); - submit.style["background-color"] = "rgba(var(--ejs-primary-color),1)"; - submit.style.margin = "0 10px"; - submit.innerText = this.localization("Submit"); - popup.appendChild(submit); - this.addEventListener(submit, "click", (e) => { - if (!rninput.value.trim()) return; - this.netplay.openRoom(rninput.value.trim(), parseInt(maxinput.value), pwinput.value.trim()); - popups[0].remove(); - }) - const close = this.createElement("button"); - close.classList.add("ejs_button_button"); - close.classList.add("ejs_popup_submit"); - close.style.margin = "0 10px"; - close.innerText = this.localization("Close"); - popup.appendChild(close); - this.addEventListener(close, "click", (e) => { - popups[0].remove(); - }) - } - this.netplay.startSocketIO = (callback) => { - this.netplay.socket = io(this.netplay.url); - this.netplay.socket.on("connect", () => callback()); - this.netplay.socket.on("users-updated", (users) => { - this.netplay.reset(); - if (this.debug) console.log(users); - this.netplay.players = users; - this.netplay.updatePlayersTable(); - if (this.netplay.owner) this.netplay.sync(); - }) - this.netplay.socket.on("disconnect", () => this.netplay.roomLeft()); - this.netplay.socket.on("data-message", (data) => { - this.netplay.dataMessage(data); - }) - } - this.netplay.openRoom = (roomName, maxPlayers, password) => { - const sessionid = guidGenerator(); - this.netplay.playerID = guidGenerator(); - this.netplay.players = {}; - this.netplay.extra = { - domain: window.location.host, - game_id: this.config.gameId, - room_name: roomName, - player_name: this.netplay.name, - userid: this.netplay.playerID, - sessionid: sessionid - } - this.netplay.players[this.netplay.playerID] = this.netplay.extra; - this.netplay.users = {}; - - this.netplay.startSocketIO((error) => { - this.netplay.socket.emit("open-room", { - extra: this.netplay.extra, - maxPlayers: maxPlayers, - password: password - }, (error) => { - if (error) { - if (this.debug) console.log("error: ", error); - return; - } - this.netplay.roomJoined(true, roomName, password, sessionid); - }) - }); - } - this.netplay.leaveRoom = () => { - if (this.debug) console.log("asd"); - this.netplay.roomLeft(); - } - this.netplay.joinRoom = (sessionid, roomName) => { - this.netplay.playerID = guidGenerator(); - this.netplay.players = {}; - this.netplay.extra = { - domain: window.location.host, - game_id: this.config.gameId, - room_name: roomName, - player_name: this.netplay.name, - userid: this.netplay.playerID, - sessionid: sessionid - } - this.netplay.players[this.netplay.playerID] = this.netplay.extra; - - this.netplay.startSocketIO((error) => { - this.netplay.socket.emit("join-room", { - extra: this.netplay.extra//, - //password: password - }, (error, users) => { - if (error) { - if (this.debug) console.log("error: ", error); - return; - } - this.netplay.players = users; - //this.netplay.roomJoined(false, roomName, password, sessionid); - this.netplay.roomJoined(false, roomName, "", sessionid); - }) - }); - } - this.netplay.roomJoined = (isOwner, roomName, password, roomId) => { - //Will already assume this.netplay.players has been refreshed - this.isNetplay = true; - this.netplay.inputs = {}; - this.netplay.owner = isOwner; - if (this.debug) console.log(this.netplay.extra); - this.netplay.roomNameElem.innerText = roomName; - this.netplay.tabs[0].style.display = "none"; - this.netplay.tabs[1].style.display = ""; - if (password) { - this.netplay.passwordElem.style.display = ""; - this.netplay.passwordElem.innerText = this.localization("Password")+": "+password - } else { - this.netplay.passwordElem.style.display = "none"; - } - this.netplay.createButton.innerText = this.localization("Leave Room"); - this.netplay.updatePlayersTable(); - if (!this.netplay.owner) { - this.netplay.oldStyles = [ - this.elements.bottomBar.cheat[0].style.display, - this.elements.bottomBar.playPause[0].style.display, - this.elements.bottomBar.playPause[1].style.display, - this.elements.bottomBar.restart[0].style.display, - this.elements.bottomBar.loadState[0].style.display, - this.elements.bottomBar.saveState[0].style.display, - this.elements.bottomBar.saveSavFiles[0].style.display, - this.elements.bottomBar.loadSavFiles[0].style.display, - this.elements.contextMenu.save.style.display, - this.elements.contextMenu.load.style.display - ] - this.elements.bottomBar.cheat[0].style.display = "none"; - this.elements.bottomBar.playPause[0].style.display = "none"; - this.elements.bottomBar.playPause[1].style.display = "none"; - this.elements.bottomBar.restart[0].style.display = "none"; - this.elements.bottomBar.loadState[0].style.display = "none"; - this.elements.bottomBar.saveState[0].style.display = "none"; - this.elements.bottomBar.saveSavFiles[0].style.display = "none"; - this.elements.bottomBar.loadSavFiles[0].style.display = "none"; - this.elements.contextMenu.save.style.display = "none"; - this.elements.contextMenu.load.style.display = "none"; - this.gameManager.resetCheat(); - } else { - this.netplay.oldStyles = [ - this.elements.bottomBar.cheat[0].style.display - ] - } - this.elements.bottomBar.cheat[0].style.display = "none"; - } - this.netplay.updatePlayersTable = () => { - const table = this.netplay.playerTable; - table.innerHTML = ""; - const addToTable = (num, playerName) => { - const row = this.createElement("tr"); - const addToHeader = (text) => { - const item = this.createElement("td"); - item.innerText = text; - row.appendChild(item); - return item; - } - addToHeader(num).style.width = "80px"; - addToHeader(playerName); - addToHeader("").style.width = "80px"; //"join" button - table.appendChild(row); - } - let i=1; - for (const k in this.netplay.players) { - addToTable(i, this.netplay.players[k].player_name); - i++; - } - } - this.netplay.roomLeft = () => { - this.isNetplay = false; - this.netplay.tabs[0].style.display = ""; - this.netplay.tabs[1].style.display = "none"; - this.netplay.extra = null; - this.netplay.playerID = null; - this.netplay.createButton.innerText = this.localization("Create a Room"); - this.netplay.socket.disconnect(); - this.elements.bottomBar.cheat[0].style.display = this.netplay.oldStyles[0]; - if (!this.netplay.owner) { - this.elements.bottomBar.playPause[0].style.display = this.netplay.oldStyles[1]; - this.elements.bottomBar.playPause[1].style.display = this.netplay.oldStyles[2]; - this.elements.bottomBar.restart[0].style.display = this.netplay.oldStyles[3]; - this.elements.bottomBar.loadState[0].style.display = this.netplay.oldStyles[4]; - this.elements.bottomBar.saveState[0].style.display = this.netplay.oldStyles[5]; - this.elements.bottomBar.saveSavFiles[0].style.display = this.netplay.oldStyles[6]; - this.elements.bottomBar.loadSavFiles[0].style.display = this.netplay.oldStyles[7]; - this.elements.contextMenu.save.style.display = this.netplay.oldStyles[8]; - this.elements.contextMenu.load.style.display = this.netplay.oldStyles[9]; - } - this.updateCheatUI(); - } - this.netplay.setLoading = (loading) => { - if (this.debug) console.log("loading:", loading); - } - let syncing = false; - this.netplay.sync = async () => { - if (syncing) return; - syncing = true; - if (this.debug) console.log("sync") - this.netplay.ready = 0; - const state = await this.gameManager.getState(); - this.netplay.sendMessage({ - state: state - }); - this.netplay.setLoading(true); - this.pause(true); - this.netplay.ready++; - this.netplay.current_frame = 0; - if (this.netplay.ready === this.netplay.getUserCount()) { - this.play(true); - } - syncing = false; - } - this.netplay.getUserIndex = (user) => { - let i=0; - for (const k in this.netplay.players) { - if (k === user) return i; - i++; - } - return -1; - } - this.netplay.getUserCount = () => { - let i=0; - for (const k in this.netplay.players) i++; - return i; - } - let justReset = false; - this.netplay.dataMessage = (data) => { - //console.log(data); - if (data.sync === true && this.netplay.owner) { - this.netplay.sync(); - } - if (data.state) { - this.netplay.wait = true; - this.netplay.setLoading(true); - this.pause(true); - this.gameManager.loadState(new Uint8Array(data.state)); - this.netplay.sendMessage({ready:true}); - } - if (data.play && !this.owner) { - this.play(true); - } - if (data.pause && !this.owner) { - this.pause(true); - } - if (data.ready && this.netplay.owner) { - this.netplay.ready++; - if (this.netplay.ready === this.netplay.getUserCount()) { - this.netplay.sendMessage({readyready:true}); - this.netplay.reset(); - setTimeout(() => this.play(true), 48); - this.netplay.setLoading(false); - } - } - if (data.readyready) { - this.netplay.setLoading(false); - this.netplay.reset(); - this.play(true); - } - if (data.shortPause) console.log(data.shortPause); - if (data.shortPause && data.shortPause !== this.netplay.playerID) { - this.pause(true); - this.netplay.wait = true; - setTimeout(() => this.play(true), 48); - } - if (data["sync-control"]) { - data["sync-control"].forEach((value) => { - let inFrame = parseInt(value.frame); - let frame = this.netplay.currentFrame; - if (!value.connected_input || value.connected_input[0] < 0) return; - //if (value.connected_input[0] === this.netplay.getUserIndex(this.netplay.playerID)) return; - console.log(value, inFrame, frame); - if (inFrame === frame) { - inFrame++; - this.gameManager.functions.simulateInput(value.connected_input[0], value.connected_input[1], value.connected_input[2]); - } - this.netplay.inputsData[inFrame] || (this.netplay.inputsData[inFrame] = []); - this.netplay.inputsData[frame] || (this.netplay.inputsData[frame] = []); - if (this.netplay.owner) { - this.netplay.inputsData[frame].push(value); - this.gameManager.functions.simulateInput(value.connected_input[0], value.connected_input[1], value.connected_input[2]); - if (frame - 10 >= inFrame) { - this.netplay.wait = true; - this.pause(true); - setTimeout(() => { - this.play(true); - this.netplay.wait = false; - }, 48) - } - } else { - this.netplay.inputsData[inFrame].push(value); - if (this.netplay.inputsData[frame]) { - this.play(true); - } - if (frame + 10 <= inFrame && inFrame > this.netplay.init_frame + 100) { - this.netplay.sendMessage({shortPause:this.netplay.playerID}); - } - } - }); - } - if (data.restart) { - this.gameManager.restart(); - this.netplay.reset(); - this.play(true); - } - } - this.netplay.simulateInput = (player, index, value, resp) => { - if (!this.isNetplay) return; - if (player !== 0 && !resp) return; - player = this.netplay.getUserIndex(this.netplay.playerID); - let frame = this.netplay.currentFrame; - if (this.netplay.owner) { - if (!this.netplay.inputsData[frame]) { - this.netplay.inputsData[frame] = []; - } - this.netplay.inputsData[frame].push({ - frame: frame, - connected_input: [player, index, value] - }) - this.gameManager.functions.simulateInput(player, index, value); - } else { - this.netplay.sendMessage({ - "sync-control": [{ - frame: frame+10, - connected_input: [player, index, value] - }] - }) - } - } - this.netplay.sendMessage = (data) => { - this.netplay.socket.emit("data-message", data); - } - this.netplay.reset = () => { - this.netplay.init_frame = this.netplay.currentFrame; - this.netplay.inputsData = {}; - } - //let fps; - //let lastTime; - this.netplay.init_frame = 0; - this.netplay.currentFrame = 0; - this.netplay.inputsData = {}; - this.Module.postMainLoop = () => { - //const newTime = window.performance.now(); - //fps = 1000 / (newTime - lastTime); - //console.log(fps); - //lastTime = newTime; - - //frame syncing - working - //control syncing - broken - this.netplay.currentFrame = parseInt(this.gameManager.getFrameNum()) - this.netplay.init_frame; - if (!this.isNetplay) return; - if (this.netplay.owner) { - let to_send = []; - let i = this.netplay.currentFrame-1; - this.netplay.inputsData[i] ? this.netplay.inputsData[i].forEach((value) => { - value.frame+=10; - to_send.push(value); - }) : to_send.push({frame: i+10}); - this.netplay.sendMessage({"sync-control": to_send}); - } else { - if (this.netplay.currentFrame <= 0 || this.netplay.inputsData[this.netplay.currentFrame]) { - this.netplay.wait = false; - this.play(); - this.netplay.inputsData[this.netplay.currentFrame].forEach((value) => { - if (!value.connected_input) return; - console.log(value.connected_input); - this.gameManager.functions.simulateInput(value.connected_input[0], value.connected_input[1], value.connected_input[2]); - }) - } else if (!this.netplay.syncing) { - console.log("sync"); - this.pause(true); - this.netplay.sendMessage({sync:true}); - this.netplay.syncing = true; - } - } - if (this.netplay.currentFrame % 100 === 0) { - Object.keys(this.netplay.inputsData).forEach(value => { - if (value < this.netplay.currentFrame - 50) { - this.netplay.inputsData[value] = null; - delete this.netplay.inputsData[value]; - } - }) - } - - - } - - this.netplay.updateList = { - start: () => { - this.netplay.updateList.interval = setInterval(this.netplay.updateTableList.bind(this), 1000); - }, - stop: () => { - clearInterval(this.netplay.updateList.interval); - } - } - } - createCheatsMenu() { - const body = this.createPopup("Cheats", { - "Add Cheat": () => { - const popups = this.createSubPopup(); - this.cheatMenu.appendChild(popups[0]); - popups[1].classList.add("ejs_cheat_parent"); - popups[1].style.width = "100%"; - const popup = popups[1]; - const header = this.createElement("div"); - header.classList.add("ejs_cheat_header"); - const title = this.createElement("h2"); - title.innerText = this.localization("Add Cheat Code"); - title.classList.add("ejs_cheat_heading"); - const close = this.createElement("button"); - close.classList.add("ejs_cheat_close"); - header.appendChild(title); - header.appendChild(close); - popup.appendChild(header); - this.addEventListener(close, "click", (e) => { - popups[0].remove(); - }) - - const main = this.createElement("div"); - main.classList.add("ejs_cheat_main"); - const header3 = this.createElement("strong"); - header3.innerText = this.localization("Code"); - main.appendChild(header3); - main.appendChild(this.createElement("br")); - const mainText = this.createElement("textarea"); - mainText.classList.add("ejs_cheat_code"); - mainText.style.width = "100%"; - mainText.style.height = "80px"; - main.appendChild(mainText); - main.appendChild(this.createElement("br")); - const header2 = this.createElement("strong"); - header2.innerText = this.localization("Description"); - main.appendChild(header2); - main.appendChild(this.createElement("br")); - const mainText2 = this.createElement("input"); - mainText2.type = "text"; - mainText2.classList.add("ejs_cheat_code"); - main.appendChild(mainText2); - main.appendChild(this.createElement("br")); - popup.appendChild(main); - - const footer = this.createElement("footer"); - const submit = this.createElement("button"); - const closeButton = this.createElement("button"); - submit.innerText = this.localization("Submit"); - closeButton.innerText = this.localization("Close"); - submit.classList.add("ejs_button_button"); - closeButton.classList.add("ejs_button_button"); - submit.classList.add("ejs_popup_submit"); - closeButton.classList.add("ejs_popup_submit"); - submit.style["background-color"] = "rgba(var(--ejs-primary-color),1)"; - footer.appendChild(submit); - const span = this.createElement("span"); - span.innerText = " "; - footer.appendChild(span); - footer.appendChild(closeButton); - popup.appendChild(footer); - - this.addEventListener(submit, "click", (e) => { - if (!mainText.value.trim() || !mainText2.value.trim()) return; - popups[0].remove(); - this.cheats.push({ - code: mainText.value, - desc: mainText2.value, - checked: false - }); - this.updateCheatUI(); - this.saveSettings(); - }) - this.addEventListener(closeButton, "click", (e) => { - popups[0].remove(); - }) - - }, - "Close": () => { - this.cheatMenu.style.display = "none"; - } - }, true); - this.cheatMenu = body.parentElement; - this.cheatMenu.getElementsByTagName("h4")[0].style["padding-bottom"] = "0px"; - const msg = this.createElement("div"); - msg.style["padding-top"] = "0px"; - msg.style["padding-bottom"] = "15px"; - msg.innerText = "Note that some cheats require a restart to disable."; - body.appendChild(msg); - const rows = this.createElement("div"); - body.appendChild(rows); - rows.classList.add("ejs_cheat_rows"); - this.elements.cheatRows = rows; - } - updateCheatUI() { - this.elements.cheatRows.innerHTML = ""; - - const addToMenu = (desc, checked, code, is_permanent, i) => { - const row = this.createElement("div"); - row.classList.add("ejs_cheat_row"); - const input = this.createElement("input"); - input.type = "checkbox"; - input.checked = checked; - input.value = i; - input.id = "ejs_cheat_switch_"+i; - row.appendChild(input); - const label = this.createElement("label"); - label.for = "ejs_cheat_switch_"+i; - label.innerText = desc; - row.appendChild(label); - label.addEventListener("click", (e) => { - input.checked = !input.checked; - this.cheats[i].checked = input.checked; - this.cheatChanged(input.checked, code, i); - this.saveSettings(); - }) - if (!is_permanent) { - const close = this.createElement("a"); - close.classList.add("ejs_cheat_row_button"); - close.innerText = "×"; - row.appendChild(close); - close.addEventListener("click", (e) => { - this.cheatChanged(false, code, i); - this.cheats.splice(i, 1); - this.updateCheatUI(); - this.saveSettings(); - }) - } - this.elements.cheatRows.appendChild(row); - this.cheatChanged(checked, code, i); - } - this.gameManager.resetCheat(); - for (let i=0; i { + if (opts.method === 'HEAD') { + cb({headers:{}}); + return; + } else { + cb({headers:{}, data:game}); + return; + } + }) + return; + } + const basePath = notWithPath ? '' : this.config.dataPath; + path = basePath + path; + if (!notWithPath && this.config.filePaths) { + if (typeof this.config.filePaths[path.split('/').pop()] === "string") { + path = this.config.filePaths[path.split('/').pop()]; + } + } + let url; + try {url=new URL(path)}catch(e){}; + if ((url && ['http:', 'https:'].includes(url.protocol)) || !url) { + const xhr = new XMLHttpRequest(); + if (progressCB instanceof Function) { + xhr.addEventListener('progress', (e) => { + const progress = e.total ? ' '+Math.floor(e.loaded / e.total * 100).toString()+'%' : ' '+(e.loaded/1048576).toFixed(2)+'MB'; + progressCB(progress); + }); + } + xhr.onload = function() { + if (xhr.readyState === xhr.DONE) { + let data = xhr.response; + if (xhr.status.toString().startsWith("4") || xhr.status.toString().startsWith("5")) { + cb(-1); + return; + } + try {data=JSON.parse(data)}catch(e){} + cb({ + data: data, + headers: { + "content-length": xhr.getResponseHeader('content-length') + } + }); + } + } + if (opts.responseType) xhr.responseType = opts.responseType; + xhr.onerror = () => cb(-1); + xhr.open(opts.method, path, true); + xhr.send(); + } else { + (async () => { + //Most commonly blob: urls. Not sure what else it could be + if (opts.method === 'HEAD') { + cb({headers:{}}); + return; + } + let res; + try { + res = await fetch(path); + if ((opts.type && opts.type.toLowerCase() === 'arraybuffer') || !opts.type) { + res = await res.arrayBuffer(); + } else { + res = await res.text(); + try {res = JSON.parse(res)} catch(e) {} + } + } catch(e) { + cb(-1); + } + if (path.startsWith('blob:')) URL.revokeObjectURL(path); + cb({ + data: res, + headers: {} + }); + })(); + } + } + toData(data, rv) { + if (!(data instanceof ArrayBuffer) && !(data instanceof Uint8Array) && !(data instanceof Blob)) return null; + if (rv) return true; + return new Promise(async (resolve) => { + if (data instanceof ArrayBuffer) { + resolve(new Uint8Array(data)); + } else if (data instanceof Uint8Array) { + resolve(data); + } else if (data instanceof Blob) { + resolve(new Uint8Array(await data.arrayBuffer())); + } + resolve(); + }) + } + checkForUpdates() { + fetch('https://cdn.emulatorjs.org/stable/data/version.json').then(response => { + if (response.ok) { + response.text().then(body => { + let version = JSON.parse(body); + if (this.ejs_num_version < version.current_version) { + console.log('Using EmulatorJS version ' + this.ejs_num_version + ' but the newest version is ' + version.current_version + '\nopen https://github.com/EmulatorJS/EmulatorJS to update'); + } + }) + } + }) + } + constructor(element, config) { + this.ejs_version = "4.0.11"; + this.ejs_num_version = 401.1; + this.debug = (window.EJS_DEBUG_XX === true); + if (this.debug || (window.location && ['localhost', '127.0.0.1'].includes(location.hostname))) this.checkForUpdates(); + this.netplayEnabled = (window.EJS_DEBUG_XX === true) && (window.EJS_EXPERIMENTAL_NETPLAY === true); + this.settingsLanguage = window.EJS_settingsLanguage || false; + this.config = config; + this.currentPopup = null; + this.isFastForward = false; + this.isSlowMotion = false; + this.rewindEnabled = this.loadRewindEnabled(); + this.touch = false; + this.cheats = []; + this.started = false; + this.volume = (typeof this.config.volume === "number") ? this.config.volume : 0.5; + if (this.config.defaultControllers) this.defaultControllers = this.config.defaultControllers; + this.muted = false; + this.paused = true; + this.listeners = []; + this.missingLang = []; + this.setElements(element); + this.setColor(this.config.color || ""); + this.config.alignStartButton = (typeof this.config.alignStartButton === "string") ? this.config.alignStartButton : "bottom"; + this.config.backgroundColor = (typeof this.config.backgroundColor === "string") ? this.config.backgroundColor : "rgb(51, 51, 51)"; + if (this.config.adUrl) { + this.config.adSize = (Array.isArray(this.config.adSize)) ? this.config.adSize : ["300px", "250px"]; + this.setupAds(this.config.adUrl, this.config.adSize[0], this.config.adSize[1]); + } + this.canvas = this.createElement('canvas'); + this.canvas.classList.add('ejs_canvas'); + this.bindListeners(); + this.config.netplayUrl = this.config.netplayUrl || "https://netplay.emulatorjs.org"; + this.fullscreen = false; + this.supportsWebgl2 = !!document.createElement('canvas').getContext('webgl2'); + this.isMobile = (function() { + let check = false; + (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) check = true;})(navigator.userAgent||navigator.vendor||window.opera); + return check; + })(); + this.isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); + if (this.config.disableDatabases) { + this.storage = { + rom: new window.EJS_DUMMYSTORAGE(), + bios: new window.EJS_DUMMYSTORAGE(), + core: new window.EJS_DUMMYSTORAGE() + } + } else { + this.storage = { + rom: new window.EJS_STORAGE("EmulatorJS-roms", "rom"), + bios: new window.EJS_STORAGE("EmulatorJS-bios", "bios"), + core: new window.EJS_STORAGE("EmulatorJS-core", "core") + } + } + // This is not cache. This is save data + this.storage.states = new window.EJS_STORAGE("EmulatorJS-states", "states"); + + this.game.classList.add("ejs_game"); + if (typeof this.config.backgroundImg === "string") { + this.game.classList.add("ejs_game_background"); + if (this.config.backgroundBlur) this.game.classList.add("ejs_game_background_blur"); + this.game.setAttribute("style", "--ejs-background-image: url("+this.config.backgroundImg+"); --ejs-background-color: "+this.config.backgroundColor+";"); + this.on("start", () => { + this.game.classList.remove("ejs_game_background"); + if (this.config.backgroundBlur) this.game.classList.remove("ejs_game_background_blur"); + }) + } else { + this.game.setAttribute("style", "--ejs-background-color: "+this.config.backgroundColor+";"); + } + + if (Array.isArray(this.config.cheats)) { + for (let i=0; i -1 && this.config.adMode < 3) ? this.config.adMode : 2; + div.classList.add("ejs_ad_iframe"); + const frame = this.createElement("iframe"); + frame.src = ads; + frame.setAttribute("scrolling", "no"); + frame.setAttribute("frameborder", "no"); + frame.style.width = width; + frame.style.height = height; + const closeParent = this.createElement("div"); + closeParent.classList.add("ejs_ad_close"); + const closeButton = this.createElement("a"); + closeParent.appendChild(closeButton); + closeParent.setAttribute("hidden", ""); + div.appendChild(closeParent); + div.appendChild(frame); + if (this.config.adMode !== 1) { + this.elements.parent.appendChild(div); + } + this.addEventListener(closeButton, "click", () => { + div.remove(); + }) + + this.on("start-clicked", () => { + if (this.config.adMode === 0) div.remove(); + if (this.config.adMode === 1){ + this.elements.parent.appendChild(div); + } + }) + + this.on("start", () => { + closeParent.removeAttribute("hidden"); + const time = (typeof this.config.adTimer === "number" && this.config.adTimer > 0) ? this.config.adTimer : 10000; + if (this.config.adTimer === -1) div.remove(); + if (this.config.adTimer === 0) return; + setTimeout(() => { + div.remove(); + }, time); + }) + + } + adBlocked(url, del){ + if (del){ + document.querySelector('div[class="ejs_ad_iframe"]').remove(); + } else { + try { + document.querySelector('div[class="ejs_ad_iframe"]').remove(); + } catch(e) {} + this.config.adUrl = url; + this.setupAds(this.config.adUrl, this.config.adSize[0], this.config.adSize[1]); + } + } + functions = {}; + on(event, func) { + if (!Array.isArray(this.functions[event])) this.functions[event] = []; + this.functions[event].push(func); + } + callEvent(event, data) { + if (!Array.isArray(this.functions[event])) return 0; + this.functions[event].forEach(e => e(data)); + return this.functions[event].length; + } + setElements(element) { + const game = this.createElement("div"); + const elem = document.querySelector(element); + elem.innerHTML = ""; + elem.appendChild(game); + this.game = game; + + this.elements = { + main: this.game, + parent: elem + } + this.elements.parent.classList.add("ejs_parent"); + this.elements.parent.setAttribute("tabindex", -1); + } + // Start button + createStartButton() { + const button = this.createElement("div"); + button.classList.add("ejs_start_button"); + let border = 0; + if (typeof this.config.backgroundImg === "string"){ + button.classList.add("ejs_start_button_border"); + border = 1; + } + button.innerText = (typeof this.config.startBtnName === 'string') ? this.config.startBtnName : this.localization("Start Game"); + if (this.config.alignStartButton == "top"){ + button.style.bottom = "calc(100% - 20px)"; + }else if (this.config.alignStartButton == "center"){ + button.style.bottom = "calc(50% + 22.5px + "+border+"px)"; + } + this.elements.parent.appendChild(button); + this.addEventListener(button, "touchstart", () => { + this.touch = true; + }) + this.addEventListener(button, "click", this.startButtonClicked.bind(this)); + if (this.config.startOnLoad === true) { + this.startButtonClicked(button); + } + setTimeout(() => { + this.callEvent("ready"); + }, 20); + } + startButtonClicked(e) { + this.callEvent("start-clicked"); + if (e.pointerType === "touch") { + this.touch = true; + } + if (e.preventDefault) { + e.preventDefault(); + e.target.remove(); + } else { + e.remove(); + } + this.createText(); + this.downloadGameCore(); + } + // End start button + createText() { + this.textElem = this.createElement("div"); + this.textElem.classList.add("ejs_loading_text"); + if (typeof this.config.backgroundImg === "string") this.textElem.classList.add("ejs_loading_text_glow"); + this.textElem.innerText = this.localization("Loading..."); + this.elements.parent.appendChild(this.textElem); + } + localization(text, log) { + if (typeof text === "undefined") return; + text = text.toString(); + if (text.includes("EmulatorJS v")) return text; + if (this.config.langJson) { + if (typeof log === "undefined") log = true; + if (!this.config.langJson[text] && log) { + if (!this.missingLang.includes(text)) this.missingLang.push(text); + console.log("Translation not found for '"+text+"'. Language set to '"+this.config.language+"'"); + } + return this.config.langJson[text] || text; + } + return text; + } + isCompressed(data) { //https://www.garykessler.net/library/file_sigs.html + //todo. Use hex instead of numbers + if ((data[0] === 80 && data[1] === 75) && ((data[2] === 3 && data[3] === 4) || (data[2] === 5 && data[3] === 6) || (data[2] === 7 && data[3] === 8))) { + return 'zip'; + } else if (data[0] === 55 && data[1] === 122 && data[2] === 188 && data[3] === 175 && data[4] === 39 && data[5] === 28) { + return '7z'; + } else if ((data[0] === 82 && data[1] === 97 && data[2] === 114 && data[3] === 33 && data[4] === 26 && data[5] === 7) && ((data[6] === 0) || (data[6] === 1 && data[7] == 0))) { + return 'rar'; + } + } + checkCompression(data, msg, fileCbFunc) { + if (msg) { + this.textElem.innerText = msg; + } + //to be put in another file + const createWorker = (path) => { + return new Promise((resolve, reject) => { + this.downloadFile(path, (res) => { + if (res === -1) { + this.textElem.innerText = this.localization('Network Error'); + this.textElem.style.color = "red"; + return; + } + const blob = new Blob([res.data], { + 'type': 'application/javascript' + }) + const url = window.URL.createObjectURL(blob); + resolve(new Worker(url)); + }, null, false, {responseType: "arraybuffer", method: "GET"}); + }) + } + const files = {}; + let res; + const onMessage = (data) => { + if (!data.data) return; + //data.data.t/ 4=progress, 2 is file, 1 is zip done + if (data.data.t === 4 && msg) { + const pg = data.data; + const num = Math.floor(pg.current / pg.total * 100); + if (isNaN(num)) return; + const progress = ' '+num.toString()+'%'; + this.textElem.innerText = msg + progress; + } + if (data.data.t === 2) { + if (typeof fileCbFunc === "function") { + fileCbFunc(data.data.file, data.data.data); + files[data.data.file] = true; + } else { + files[data.data.file] = data.data.data; + } + } + if (data.data.t === 1) { + res(files); + } + } + const decompress7z = (file) => { + return new Promise((resolve, reject) => { + res = resolve; + + createWorker('compression/extract7z.js').then((worker) => { + worker.onmessage = onMessage; + worker.postMessage(file); + //console.log(file); + }) + }) + } + const decompressRar = (file) => { + return new Promise((resolve, reject) => { + res = resolve; + + this.downloadFile("compression/libunrar.js", (res) => { + this.downloadFile("compression/libunrar.wasm", (res2) => { + if (res === -1 || res2 === -1) { + this.textElem.innerText = this.localization('Network Error'); + this.textElem.style.color = "red"; + return; + } + const path = URL.createObjectURL(new Blob([res2.data], {type: "application/wasm"})); + let data = '\nlet dataToPass = [];\nModule = {\n monitorRunDependencies: function(left) {\n if (left == 0) {\n setTimeout(function() {\n unrar(dataToPass, null);\n }, 100);\n }\n },\n onRuntimeInitialized: function() {\n },\n locateFile: function(file) {\n return \''+path+'\';\n }\n};\n'+res.data+'\nlet unrar = function(data, password) {\n let cb = function(fileName, fileSize, progress) {\n postMessage({"t":4,"current":progress,"total":fileSize, "name": fileName});\n };\n\n let rarContent = readRARContent(data.map(function(d) {\n return {\n name: d.name,\n content: new Uint8Array(d.content)\n }\n }), password, cb)\n let rec = function(entry) {\n if (!entry) return;\n if (entry.type === \'file\') {\n postMessage({"t":2,"file":entry.fullFileName,"size":entry.fileSize,"data":entry.fileContent});\n } else if (entry.type === \'dir\') {\n Object.keys(entry.ls).forEach(function(k) {\n rec(entry.ls[k]);\n })\n } else {\n throw "Unknown type";\n }\n }\n rec(rarContent);\n postMessage({"t":1});\n return rarContent;\n};\nonmessage = function(data) {\n dataToPass.push({name: \'test.rar\', content: data.data});\n};\n '; + const blob = new Blob([data], { + 'type': 'application/javascript' + }) + const url = window.URL.createObjectURL(blob); + const worker = new Worker(url); + worker.onmessage = onMessage; + worker.postMessage(file); + }, null, false, {responseType: "arraybuffer", method: "GET"}) + }, null, false, {responseType: "text", method: "GET"}); + + }) + } + const decompressZip = (file) => { + return new Promise((resolve, reject) => { + res = resolve; + + createWorker('compression/extractzip.js').then((worker) => { + worker.onmessage = onMessage; + worker.postMessage(file); + }) + }) + } + const compression = this.isCompressed(data.slice(0, 10)); + if (compression) { + //Need to do zip and rar still + if (compression === "7z") { + return decompress7z(data); + } else if (compression === "zip") { + return decompressZip(data); + } else if (compression === "rar") { + return decompressRar(data); + } + } else { + if (typeof fileCbFunc === "function") { + fileCbFunc("!!notCompressedData", data); + return new Promise(resolve => resolve({"!!notCompressedData": true})); + } else { + return new Promise(resolve => resolve({"!!notCompressedData": data})); + } + } + + } + downloadGameCore() { + this.textElem.innerText = this.localization("Download Game Core"); + if (this.config.threads && ((typeof window.SharedArrayBuffer) !== "function")) { + this.textElem.innerText = this.localization('Error for site owner')+"\n"+this.localization("Check console"); + this.textElem.style.color = "red"; + console.warn("Threads is set to true, but the SharedArrayBuffer function is not exposed. Threads requires 2 headers to be set when sending you html page. See https://stackoverflow.com/a/68630724"); + return; + } + const gotCore = (data) => { + this.checkCompression(new Uint8Array(data), this.localization("Decompress Game Core")).then((data) => { + let js, thread, wasm; + for (let k in data) { + if (k.endsWith(".wasm")) { + wasm = data[k]; + } else if (k.endsWith(".worker.js")) { + thread = data[k]; + } else if (k.endsWith(".js")) { + js = data[k]; + } + } + this.initGameCore(js, wasm, thread); + }); + } + let legacy = (this.supportsWebgl2 ? "" : "-legacy"); + let filename = this.getCore()+(this.config.threads ? "-thread" : "")+legacy+"-wasm.data"; + this.storage.core.get(filename).then((result) => { + if (result && result.version === this.version && !this.debug) { + gotCore(result.data); + return; + } + let corePath = 'cores/'+filename; + this.downloadFile(corePath, (res) => { + if (res === -1) { + console.log("File not found, attemping to fetch from emulatorjs cdn"); + this.downloadFile("https://cdn.emulatorjs.org/stable/data/"+corePath, (res) => { + if (res === -1) { + if (!this.supportsWebgl2) { + this.textElem.innerText = this.localization('Outdated graphics driver'); + } else { + this.textElem.innerText = this.localization('Network Error'); + } + this.textElem.style.color = "red"; + return; + } + console.warn("File was not found locally, but was found on the emulatorjs cdn.\nIt is recommended to download the latest release from here: https://cdn.emulatorjs.org/releases/"); + gotCore(res.data); + this.storage.core.put(filename, { + version: this.version, + data: res.data + }); + }, (progress) => { + this.textElem.innerText = this.localization("Download Game Core") + progress; + }, true, {responseType: "arraybuffer", method: "GET"}) + return; + } + gotCore(res.data); + this.storage.core.put(filename, { + version: this.version, + data: res.data + }); + }, (progress) => { + this.textElem.innerText = this.localization("Download Game Core") + progress; + }, false, {responseType: "arraybuffer", method: "GET"}); + }) + } + initGameCore(js, wasm, thread) { + this.initModule(wasm, thread); + let script = this.createElement("script"); + script.src = URL.createObjectURL(new Blob([js], {type: "application/javascript"})); + document.body.appendChild(script); + } + getBaseFileName(force) { + //Only once game and core is loaded + if (!this.started && !force) return null; + if (force && this.config.gameUrl !== "game" && !this.config.gameUrl.startsWith("blob:")) { + return this.config.gameUrl.split('/').pop().split("#")[0].split("?")[0]; + } + if (typeof this.config.gameName === "string") { + const invalidCharacters = /[#<$+%>!`&*'|{}/\\?"=@:^\r\n]/ig; + const name = this.config.gameName.replace(invalidCharacters, "").trim(); + if (name) return name; + } + let parts = this.fileName.split("."); + parts.splice(parts.length-1, 1); + return parts.join("."); + } + saveInBrowserSupported() { + return !!window.indexedDB && (typeof this.config.gameName === "string" || !this.config.gameUrl.startsWith("blob:")); + } + displayMessage(message, time) { + if (!this.msgElem) { + this.msgElem = this.createElement("div"); + this.msgElem.classList.add("ejs_message"); + this.elements.parent.appendChild(this.msgElem); + } + clearTimeout(this.msgTimeout); + this.msgTimeout = setTimeout(() => { + this.msgElem.innerText = ""; + }, (typeof time === "number" && time > 0) ? time : 3000) + this.msgElem.innerText = message; + } + downloadStartState() { + return new Promise((resolve, reject) => { + if (typeof this.config.loadState !== "string" && !this.toData(this.config.loadState, true)) { + resolve(); + return; + } + this.textElem.innerText = this.localization("Download Game State"); + + this.downloadFile(this.config.loadState, (res) => { + if (res === -1) { + this.textElem.innerText = this.localization('Network Error'); + this.textElem.style.color = "red"; + return; + } + this.on("start", () => { + setTimeout(() => { + this.gameManager.loadState(new Uint8Array(res.data)); + }, 10); + }) + resolve(); + }, (progress) => { + this.textElem.innerText = this.localization("Download Game State") + progress; + }, true, {responseType: "arraybuffer", method: "GET"}); + }) + } + downloadGamePatch() { + return new Promise((resolve, reject) => { + if ((typeof this.config.gamePatchUrl !== "string" || !this.config.gamePatchUrl.trim()) && !this.toData(this.config.gamePatchUrl, true)) { + resolve(); + return; + } + this.textElem.innerText = this.localization("Download Game Patch"); + const gotData = (data) => { + this.checkCompression(new Uint8Array(data), this.localization("Decompress Game Patch")).then((data) => { + for (const k in data) { + if (k === "!!notCompressedData") { + FS.writeFile(this.config.gamePatchUrl.split('/').pop().split("#")[0].split("?")[0], data[k]); + break; + } + if (k.endsWith('/')) continue; + FS.writeFile("/" + k.split('/').pop(), data[k]); + } + resolve(); + }) + } + + this.downloadFile(this.config.gamePatchUrl, (res) => { + this.storage.rom.get(this.config.gamePatchUrl.split("/").pop()).then((result) => { + if (result && result['content-length'] === res.headers['content-length'] && !this.debug) { + gotData(result.data); + return; + } + this.downloadFile(this.config.gamePatchUrl, (res) => { + if (res === -1) { + this.textElem.innerText = this.localization('Network Error'); + this.textElem.style.color = "red"; + return; + } + if (this.toData(this.config.gamePatchUrl, true)) { + this.config.gamePatchUrl = "game"; + } + gotData(res.data); + const limit = (typeof this.config.cacheLimit === "number") ? this.config.cacheLimit : 1073741824; + if (parseFloat(res.headers['content-length']) < limit && this.saveInBrowserSupported() && this.config.gamePatchUrl !== "game") { + this.storage.rom.put(this.config.gamePatchUrl.split("/").pop(), { + "content-length": res.headers['content-length'], + data: res.data + }) + } + }, (progress) => { + this.textElem.innerText = this.localization("Download Game Patch") + progress; + }, true, {responseType: "arraybuffer", method: "GET"}); + }) + }, null, true, {method: "HEAD"}) + }) + } + downloadGameParent() { + return new Promise((resolve, reject) => { + if ((typeof this.config.gameParentUrl !== "string" || !this.config.gameParentUrl.trim()) && !this.toData(this.config.gameParentUrl, true)) { + resolve(); + return; + } + this.textElem.innerText = this.localization("Download Game Parent"); + const gotData = (data) => { + this.checkCompression(new Uint8Array(data), this.localization("Decompress Game Parent")).then((data) => { + for (const k in data) { + if (k === "!!notCompressedData") { + FS.writeFile(this.config.gameParentUrl.split('/').pop().split("#")[0].split("?")[0], data[k]); + break; + } + if (k.endsWith('/')) continue; + FS.writeFile("/" + k.split('/').pop(), data[k]); + } + resolve(); + }) + } + + this.downloadFile(this.config.gameParentUrl, (res) => { + this.storage.rom.get(this.config.gameParentUrl.split("/").pop()).then((result) => { + if (result && result['content-length'] === res.headers['content-length'] && !this.debug) { + gotData(result.data); + return; + } + this.downloadFile(this.config.gameParentUrl, (res) => { + if (res === -1) { + this.textElem.innerText = this.localization('Network Error'); + this.textElem.style.color = "red"; + return; + } + if (this.toData(this.config.gameParentUrl, true)) { + this.config.gameParentUrl = "game"; + } + gotData(res.data); + const limit = (typeof this.config.cacheLimit === "number") ? this.config.cacheLimit : 1073741824; + if (parseFloat(res.headers['content-length']) < limit && this.saveInBrowserSupported() && this.config.gameParentUrl !== "game") { + this.storage.rom.put(this.config.gameParentUrl.split("/").pop(), { + "content-length": res.headers['content-length'], + data: res.data + }) + } + }, (progress) => { + this.textElem.innerText = this.localization("Download Game Parent") + progress; + }, true, {responseType: "arraybuffer", method: "GET"}); + }) + }, null, true, {method: "HEAD"}) + }) + } + downloadBios() { + return new Promise((resolve, reject) => { + if ((typeof this.config.biosUrl !== "string" || !this.config.biosUrl.trim()) && !this.toData(this.config.biosUrl, true)) { + resolve(); + return; + } + this.textElem.innerText = this.localization("Download Game BIOS"); + const gotBios = (data) => { + this.checkCompression(new Uint8Array(data), this.localization("Decompress Game BIOS")).then((data) => { + for (const k in data) { + if (k === "!!notCompressedData") { + FS.writeFile(this.config.biosUrl.split('/').pop().split("#")[0].split("?")[0], data[k]); + break; + } + if (k.endsWith('/')) continue; + FS.writeFile("/" + k.split('/').pop(), data[k]); + } + resolve(); + }) + } + + this.downloadFile(this.config.biosUrl, (res) => { + if (res === -1) { + this.textElem.innerText = this.localization('Network Error'); + this.textElem.style.color = "red"; + return; + } + this.storage.bios.get(this.config.biosUrl.split("/").pop()).then((result) => { + if (result && result['content-length'] === res.headers['content-length'] && !this.debug) { + gotBios(result.data); + return; + } + this.downloadFile(this.config.biosUrl, (res) => { + if (res === -1) { + this.textElem.innerText = this.localization('Network Error'); + this.textElem.style.color = "red"; + return; + } + if (this.toData(this.config.biosUrl, true)) { + this.config.biosUrl = "game"; + } + gotBios(res.data); + if (this.saveInBrowserSupported() && this.config.biosUrl !== "game") { + this.storage.bios.put(this.config.biosUrl.split("/").pop(), { + "content-length": res.headers['content-length'], + data: res.data + }) + } + }, (progress) => { + this.textElem.innerText = this.localization("Download Game BIOS") + progress; + }, true, {responseType: "arraybuffer", method: "GET"}); + }) + }, null, true, {method: "HEAD"}) + }) + } + downloadRom() { + const supportsExt = (ext) => { + const core = this.getCore(); + if (!this.extensions[core]) return false; + return this.extensions[core].includes(ext); + }; + + return new Promise(resolve => { + this.textElem.innerText = this.localization("Download Game Data"); + + const gotGameData = (data) => { + if (['arcade', 'mame'].includes(this.getCore(true))) { + this.fileName = this.getBaseFileName(true); + FS.writeFile(this.fileName, new Uint8Array(data)); + resolve(); + return; + } + + const altName = this.getBaseFileName(true); + + let disableCue = false; + if (['pcsx_rearmed', 'genesis_plus_gx', 'picodrive', 'mednafen_pce', 'vice_x64', 'vice_x64sc', 'vice_x128', 'vice_xvic', 'vice_xplus4', 'vice_xpet'].includes(this.getCore()) && this.config.disableCue === undefined) { + disableCue = true; + } else { + disableCue = this.config.disableCue; + } + + let fileNames = []; + this.checkCompression(new Uint8Array(data), this.localization("Decompress Game Data"), (fileName, fileData) => { + if (fileName.includes("/")) { + const paths = fileName.split("/"); + let cp = ""; + for (let i=0; i { + let isoFile = null; + let supportedFile = null; + let cueFile = null; + let selectedCueExt = null; + fileNames.forEach(fileName => { + const ext = fileName.split('.').pop().toLowerCase(); + if (supportedFile === null && supportsExt(ext)) { + supportedFile = fileName; + } + if (isoFile === null && ['iso', 'cso', 'chd', 'elf'].includes(ext)) { + isoFile = fileName; + } + if (['cue', 'ccd', 'toc', 'm3u'].includes(ext)) { + if (this.getCore(true) === 'psx') { + //always prefer m3u files for psx cores + if (selectedCueExt !== 'm3u') { + if (cueFile === null || ext === 'm3u') { + cueFile = fileName; + selectedCueExt = ext; + } + } + } else { + //prefer cue or ccd files over toc or m3u + if (!['cue', 'ccd'].includes(selectedCueExt)) { + if (cueFile === null || ['cue', 'ccd'].includes(ext)) { + cueFile = fileName; + selectedCueExt = ext; + } + } + } + } + }); + if (supportedFile !== null) { + this.fileName = supportedFile; + } else { + this.fileName = fileNames[0]; + } + if (isoFile !== null && (supportsExt('iso') || supportsExt('cso') || supportsExt('chd') || supportsExt('elf'))) { + this.fileName = isoFile; + } else if (supportsExt('cue') || supportsExt('ccd') || supportsExt('toc') || supportsExt('m3u')) { + if (cueFile !== null) { + this.fileName = cueFile; + } else if (!disableCue) { + this.fileName = this.gameManager.createCueFile(fileNames); + } + } + resolve(); + }); + } + + this.downloadFile(this.config.gameUrl, (res) => { + if (res === -1) { + this.textElem.innerText = this.localization('Network Error'); + this.textElem.style.color = "red"; + return; + } + const name = (typeof this.config.gameUrl === "string") ? this.config.gameUrl.split('/').pop() : "game"; + this.storage.rom.get(name).then((result) => { + if (result && result['content-length'] === res.headers['content-length'] && !this.debug && name !== "game") { + gotGameData(result.data); + return; + } + this.downloadFile(this.config.gameUrl, (res) => { + if (res === -1) { + this.textElem.innerText = this.localization('Network Error'); + this.textElem.style.color = "red"; + return; + } + if (this.toData(this.config.gameUrl, true)) { + this.config.gameUrl = "game"; + } + gotGameData(res.data); + const limit = (typeof this.config.cacheLimit === "number") ? this.config.cacheLimit : 1073741824; + if (parseFloat(res.headers['content-length']) < limit && this.saveInBrowserSupported() && this.config.gameUrl !== "game") { + this.storage.rom.put(this.config.gameUrl.split("/").pop(), { + "content-length": res.headers['content-length'], + data: res.data + }) + } + }, (progress) => { + this.textElem.innerText = this.localization("Download Game Data") + progress; + }, true, {responseType: "arraybuffer", method: "GET"}); + }) + }, null, true, {method: "HEAD"}) + }) + } + downloadFiles() { + (async () => { + this.gameManager = new window.EJS_GameManager(this.Module, this); + await this.gameManager.loadExternalFiles(); + if (this.getCore() === "ppsspp") { + await this.gameManager.loadPpssppAssets(); + } + await this.downloadRom(); + await this.downloadBios(); + await this.downloadStartState(); + await this.downloadGameParent(); + await this.downloadGamePatch(); + this.startGame(); + })(); + } + initModule(wasmData, threadData) { + window.Module = { + 'noInitialRun': true, + 'onRuntimeInitialized': this.downloadFiles.bind(this), + 'arguments': [], + 'preRun': [], + 'postRun': [], + 'canvas': this.canvas, + 'print': (msg) => { + if (this.debug) { + console.log(msg); + } + }, + 'printErr': (msg) => { + if (this.debug) { + console.log(msg); + } + }, + 'totalDependencies': 0, + 'monitorRunDependencies': () => {}, + 'locateFile': function(fileName) { + if (this.debug) console.log(fileName); + if (fileName.endsWith(".wasm")) { + return URL.createObjectURL(new Blob([wasmData], {type: "application/wasm"})); + } else if (fileName.endsWith(".worker.js")) { + return URL.createObjectURL(new Blob([threadData], {type: "application/javascript"})); + } + } + }; + this.Module = window.Module; + } + startGame() { + try { + const args = []; + if (this.debug) args.push('-v'); + args.push('/'+this.fileName); + if (this.debug) console.log(args); + this.Module.callMain(args); + if (typeof this.config.softLoad === "number" && this.config.softLoad > 0) { + this.resetTimeout = setTimeout(() => { + this.gameManager.restart(); + }, this.config.softLoad * 1000); + } + this.Module.resumeMainLoop(); + this.checkSupportedOpts(); + this.setupSettingsMenu(); + this.loadSettings(); + this.updateCheatUI(); + this.updateGamepadLabels(); + if (!this.muted) this.setVolume(this.volume); + this.elements.parent.focus(); + this.textElem.remove(); + this.textElem = null; + this.game.classList.remove("ejs_game"); + this.game.appendChild(this.canvas); + this.handleResize(); + this.started = true; + this.paused = false; + if (this.touch) { + this.virtualGamepad.style.display = ""; + } + this.handleResize(); + if (this.config.fullscreenOnLoad) { + try { + this.toggleFullscreen(true); + } catch(e) { + if (this.debug) console.warn("Could not fullscreen on load"); + } + } + this.menu.open(); + if (this.isSafari && this.isMobile) { + //Safari is --- funny + this.checkStarted(); + } + } catch(e) { + console.warn("failed to start game", e); + this.textElem.innerText = this.localization("Failed to start game"); + this.textElem.style.color = "red"; + return; + } + this.callEvent("start"); + } + checkStarted() { + (async() => { + let sleep = (ms) => new Promise(r => setTimeout(r, ms)); + let state = "suspended"; + let popup; + while (state === "suspended") { + if (!window.AL) return; + window.AL.currentCtx.sources.forEach(ctx => { + state = ctx.gain.context.state; + }); + if (state !== "suspended") break; + if (!popup) { + popup = this.createPopup("", {}); + const button = this.createElement("button"); + button.innerText = "Click to resume Emulator"; + button.classList.add("ejs_menu_button"); + button.style.width = "25%"; + button.style.height = "25%"; + popup.appendChild(button); + popup.style["text-align"] = "center"; + popup.style["font-size"] = "28px"; + } + await sleep(10); + } + if (popup) this.closePopup(); + })(); + } + bindListeners() { + this.createContextMenu(); + this.createBottomMenuBar(); + this.createControlSettingMenu(); + this.createCheatsMenu() + this.createNetplayMenu(); + this.setVirtualGamepad(); + this.addEventListener(this.elements.parent, "keydown keyup", this.keyChange.bind(this)); + this.addEventListener(this.elements.parent, "mousedown touchstart", (e) => { + if (document.activeElement !== this.elements.parent) this.elements.parent.focus(); + }) + this.addEventListener(window, "resize", this.handleResize.bind(this)); + //this.addEventListener(window, "blur", e => console.log(e), true); //TODO - add "click to make keyboard keys work" message? + + let counter = 0; + this.elements.statePopupPanel = this.createPopup("", {}, true); + this.elements.statePopupPanel.innerText = "Drop save state here to load"; + this.elements.statePopupPanel.style["text-align"] = "center"; + this.elements.statePopupPanel.style["font-size"] = "28px"; + + //to fix a funny apple bug + this.addEventListener(window, "webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange", () => { + setTimeout(() => { + this.handleResize.bind(this); + this.elements.parent.focus(); + }, 0); + }); + this.addEventListener(this.elements.parent, "dragenter", (e) => { + e.preventDefault(); + if (!this.started) return; + counter++; + this.elements.statePopupPanel.parentElement.style.display = "block"; + }); + this.addEventListener(this.elements.parent, "dragover", (e) => { + e.preventDefault(); + }); + this.addEventListener(this.elements.parent, "dragleave", (e) => { + e.preventDefault(); + if (!this.started) return; + counter--; + if (counter === 0) { + this.elements.statePopupPanel.parentElement.style.display = "none"; + } + }); + this.addEventListener(this.elements.parent, "dragend", (e) => { + e.preventDefault(); + if (!this.started) return; + counter = 0; + this.elements.statePopupPanel.parentElement.style.display = "none"; + }); + this.addEventListener(this.elements.parent, "drop", (e) => { + e.preventDefault(); + if (!this.started) return; + this.elements.statePopupPanel.parentElement.style.display = "none"; + counter = 0; + const items = e.dataTransfer.items; + let file; + for (let i=0; i { + this.gameManager.loadState(new Uint8Array(data)); + }) + }); + + this.gamepad = new GamepadHandler(); //https://github.com/ethanaobrien/Gamepad + this.gamepad.on('connected', (e) => { + if (!this.gamepadLabels) return; + this.updateGamepadLabels(); + }) + this.gamepad.on('disconnected', (e) => { + setTimeout(this.updateGamepadLabels.bind(this), 10); + }) + this.gamepad.on('axischanged', this.gamepadEvent.bind(this)); + this.gamepad.on('buttondown', this.gamepadEvent.bind(this)); + this.gamepad.on('buttonup', this.gamepadEvent.bind(this)); + } + checkSupportedOpts() { + if (!this.gameManager.supportsStates()) { + this.elements.bottomBar.saveState[0].style.display = "none"; + this.elements.bottomBar.loadState[0].style.display = "none"; + this.elements.bottomBar.netplay[0].style.display = "none"; + this.elements.contextMenu.save.style.display = "none"; + this.elements.contextMenu.load.style.display = "none"; + } + if (typeof this.config.gameId !== "number" || !this.config.netplayUrl || this.netplayEnabled === false) { + this.elements.bottomBar.netplay[0].style.display = "none"; + } + } + updateGamepadLabels() { + for (let i=0; i { + if (this.started) { + this.elements.contextmenu.style.display = "block"; + this.elements.contextmenu.style.left = e.offsetX+"px"; + this.elements.contextmenu.style.top = e.offsetY+"px"; + } + e.preventDefault(); + }) + const hideMenu = () => { + this.elements.contextmenu.style.display = "none"; + } + this.addEventListener(this.elements.contextmenu, 'contextmenu', (e) => e.preventDefault()); + this.addEventListener(this.elements.parent, 'contextmenu', (e) => e.preventDefault()); + this.addEventListener(this.game, 'mousedown', hideMenu); + const parent = this.createElement("ul"); + const addButton = (title, hidden, functi0n) => { + //
  • '+title+'
  • + const li = this.createElement("li"); + if (hidden) li.hidden = true; + const a = this.createElement("a"); + if (functi0n instanceof Function) { + this.addEventListener(li, 'click', (e) => { + e.preventDefault(); + functi0n(); + }); + } + a.href = "#"; + a.onclick = "return false"; + a.innerText = this.localization(title); + li.appendChild(a); + parent.appendChild(li); + hideMenu(); + return li; + } + let screenshotUrl; + const screenshot = addButton("Take Screenshot", false, () => { + if (screenshotUrl) URL.revokeObjectURL(screenshotUrl); + this.gameManager.screenshot().then(screenshot => { + const blob = new Blob([screenshot]); + screenshotUrl = URL.createObjectURL(blob); + const a = this.createElement("a"); + a.href = screenshotUrl; + const date = new Date(); + a.download = this.getBaseFileName()+"-"+date.getMonth()+"-"+date.getDate()+"-"+date.getFullYear()+".png"; + a.click(); + hideMenu(); + }); + }); + + let screenMediaRecorder = null; + const startScreenRecording = addButton("Start screen recording", false, () => { + if (screenMediaRecorder !== null) { + screenMediaRecorder.stop(); + } + screenMediaRecorder = this.screenRecord(); + startScreenRecording.setAttribute("hidden", "hidden"); + stopScreenRecording.removeAttribute("hidden"); + hideMenu(); + }); + const stopScreenRecording = addButton("Stop screen recording", true, () => { + if (screenMediaRecorder !== null) { + screenMediaRecorder.stop(); + screenMediaRecorder = null; + } + startScreenRecording.removeAttribute("hidden"); + stopScreenRecording.setAttribute("hidden", "hidden"); + hideMenu(); + }); + + const qSave = addButton("Quick Save", false, () => { + const slot = this.settings['save-state-slot'] ? this.settings['save-state-slot'] : "1"; + this.gameManager.quickSave(slot); + this.displayMessage(this.localization("SAVED STATE TO SLOT")+" "+slot); + hideMenu(); + }); + const qLoad = addButton("Quick Load", false, () => { + const slot = this.settings['save-state-slot'] ? this.settings['save-state-slot'] : "1"; + this.gameManager.quickLoad(slot); + this.displayMessage(this.localization("LOADED STATE FROM SLOT")+" "+slot); + hideMenu(); + }); + this.elements.contextMenu = { + screenshot: screenshot, + startScreenRecording: startScreenRecording, + stopScreenRecording: stopScreenRecording, + save: qSave, + load: qLoad + } + addButton("EmulatorJS v"+this.ejs_version, false, () => { + hideMenu(); + const body = this.createPopup("EmulatorJS", { + "Close": () => { + this.closePopup(); + } + }); + + const menu = this.createElement('div'); + menu.classList.add("ejs_list_selector"); + const parent = this.createElement("ul"); + const addButton = (title, hidden, functi0n) => { + const li = this.createElement("li"); + if (hidden) li.hidden = true; + const a = this.createElement("a"); + if (functi0n instanceof Function) { + this.addEventListener(li, 'click', (e) => { + e.preventDefault(); + functi0n(); + }); + } + a.href = "#"; + a.onclick = "return false"; + a.innerText = this.localization(title); + li.appendChild(a); + parent.appendChild(li); + hideMenu(); + return li; + } + //body.style["padding-left"] = "20%"; + const home = this.createElement("div"); + const license = this.createElement("div"); + license.style.display = "none"; + const retroarch = this.createElement("div"); + retroarch.style.display = "none"; + body.appendChild(home); + body.appendChild(license); + body.appendChild(retroarch); + + let current = home; + home.innerText = "EmulatorJS v"+this.ejs_version; + home.appendChild(this.createElement("br")); + home.appendChild(this.createElement("br")); + const gh = this.createElement("a"); + gh.href = "https://github.com/EmulatorJS/EmulatorJS"; + gh.target = "_blank"; + gh.innerText = this.localization("View on GitHub"); + home.appendChild(gh); + home.appendChild(this.createElement("br")); + const dc = this.createElement("a"); + dc.href = "https://discord.gg/6akryGkETU"; + dc.target = "_blank"; + dc.innerText = this.localization("Join the discord"); + home.appendChild(dc); + home.appendChild(this.createElement("br")); + menu.appendChild(parent); + body.appendChild(menu); + const setElem = (element) => { + if (current === element) return; + if (current) { + current.style.display = "none"; + } + current = element; + element.style.display = ""; + } + addButton("Home", false, () => { + setElem(home); + }) + addButton("EmulatorJS License", false, () => { + setElem(license); + }) + addButton("RetroArch License", false, () => { + setElem(retroarch); + }) + //Todo - Core specific licenses, contributors. + + retroarch.innerText = "This project is powered by "; + const a = this.createElement("a"); + a.href = "https://github.com/libretro/RetroArch"; + a.target = "_blank"; + a.innerText = "RetroArch"; + retroarch.appendChild(a); + const licenseLink = this.createElement("a"); + licenseLink.target = "_blank"; + licenseLink.href = "https://github.com/libretro/RetroArch/blob/master/COPYING"; + licenseLink.innerText = "View the RetroArch license here."; + a.appendChild(this.createElement("br")); + a.appendChild(licenseLink); + + license.style['text-align'] = "center"; + license.style['padding'] = "10px"; + //license.style["white-space"] = "pre-wrap"; + license.innerText = ' GNU GENERAL PUBLIC LICENSE\n Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. \n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n Preamble\n\n The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works. By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users. We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors. You can apply it to\nyour programs, too.\n\n When we speak of free software, we are referring to freedom, not\nprice. Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights. Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received. You must make sure that they, too, receive\nor can get the source code. And you must show them these terms so they\nknow their rights.\n\n Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n For the developers\' and authors\' protection, the GPL clearly explains\nthat there is no warranty for this free software. For both users\' and\nauthors\' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so. This is fundamentally incompatible with the aim of\nprotecting users\' freedom to change the software. The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable. Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts. If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary. To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n The precise terms and conditions for copying, distribution and\nmodification follow.\n\n TERMS AND CONDITIONS\n\n 0. Definitions.\n\n "This License" refers to version 3 of the GNU General Public License.\n\n "Copyright" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n "The Program" refers to any copyrightable work licensed under this\nLicense. Each licensee is addressed as "you". "Licensees" and\n"recipients" may be individuals or organizations.\n\n To "modify" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy. The resulting work is called a "modified version" of the\nearlier work or a work "based on" the earlier work.\n\n A "covered work" means either the unmodified Program or a work based\non the Program.\n\n To "propagate" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy. Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n To "convey" a work means any kind of propagation that enables other\nparties to make or receive copies. Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n An interactive user interface displays "Appropriate Legal Notices"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License. If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n 1. Source Code.\n\n The "source code" for a work means the preferred form of the work\nfor making modifications to it. "Object code" means any non-source\nform of a work.\n\n A "Standard Interface" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n The "System Libraries" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form. A\n"Major Component", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n The "Corresponding Source" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities. However, it does not include the work\'s\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work. For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n The Corresponding Source for a work in source code form is that\nsame work.\n\n 2. Basic Permissions.\n\n All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met. This License explicitly affirms your unlimited\npermission to run the unmodified Program. The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work. This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force. You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright. Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n Conveying under any other circumstances is permitted solely under\nthe conditions stated below. Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n 3. Protecting Users\' Legal Rights From Anti-Circumvention Law.\n\n No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work\'s\nusers, your or third parties\' legal rights to forbid circumvention of\ntechnological measures.\n\n 4. Conveying Verbatim Copies.\n\n You may convey verbatim copies of the Program\'s source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n 5. Conveying Modified Source Versions.\n\n You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n a) The work must carry prominent notices stating that you modified\n it, and giving a relevant date.\n\n b) The work must carry prominent notices stating that it is\n released under this License and any conditions added under section\n 7. This requirement modifies the requirement in section 4 to\n "keep intact all notices".\n\n c) You must license the entire work, as a whole, under this\n License to anyone who comes into possession of a copy. This\n License will therefore apply, along with any applicable section 7\n additional terms, to the whole of the work, and all its parts,\n regardless of how they are packaged. This License gives no\n permission to license the work in any other way, but it does not\n invalidate such permission if you have separately received it.\n\n d) If the work has interactive user interfaces, each must display\n Appropriate Legal Notices; however, if the Program has interactive\n interfaces that do not display Appropriate Legal Notices, your\n work need not make them do so.\n\n A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n"aggregate" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation\'s users\nbeyond what the individual works permit. Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n 6. Conveying Non-Source Forms.\n\n You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n a) Convey the object code in, or embodied in, a physical product\n (including a physical distribution medium), accompanied by the\n Corresponding Source fixed on a durable physical medium\n customarily used for software interchange.\n\n b) Convey the object code in, or embodied in, a physical product\n (including a physical distribution medium), accompanied by a\n written offer, valid for at least three years and valid for as\n long as you offer spare parts or customer support for that product\n model, to give anyone who possesses the object code either (1) a\n copy of the Corresponding Source for all the software in the\n product that is covered by this License, on a durable physical\n medium customarily used for software interchange, for a price no\n more than your reasonable cost of physically performing this\n conveying of source, or (2) access to copy the\n Corresponding Source from a network server at no charge.\n\n c) Convey individual copies of the object code with a copy of the\n written offer to provide the Corresponding Source. This\n alternative is allowed only occasionally and noncommercially, and\n only if you received the object code with such an offer, in accord\n with subsection 6b.\n\n d) Convey the object code by offering access from a designated\n place (gratis or for a charge), and offer equivalent access to the\n Corresponding Source in the same way through the same place at no\n further charge. You need not require recipients to copy the\n Corresponding Source along with the object code. If the place to\n copy the object code is a network server, the Corresponding Source\n may be on a different server (operated by you or a third party)\n that supports equivalent copying facilities, provided you maintain\n clear directions next to the object code saying where to find the\n Corresponding Source. Regardless of what server hosts the\n Corresponding Source, you remain obligated to ensure that it is\n available for as long as needed to satisfy these requirements.\n\n e) Convey the object code using peer-to-peer transmission, provided\n you inform other peers where the object code and Corresponding\n Source of the work are being offered to the general public at no\n charge under subsection 6d.\n\n A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n A "User Product" is either (1) a "consumer product", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling. In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage. For a particular\nproduct received by a particular user, "normally used" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product. A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n "Installation Information" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source. The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information. But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed. Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n 7. Additional Terms.\n\n "Additional permissions" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law. If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit. (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.) You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n a) Disclaiming warranty or limiting liability differently from the\n terms of sections 15 and 16 of this License; or\n\n b) Requiring preservation of specified reasonable legal notices or\n author attributions in that material or in the Appropriate Legal\n Notices displayed by works containing it; or\n\n c) Prohibiting misrepresentation of the origin of that material, or\n requiring that modified versions of such material be marked in\n reasonable ways as different from the original version; or\n\n d) Limiting the use for publicity purposes of names of licensors or\n authors of the material; or\n\n e) Declining to grant rights under trademark law for use of some\n trade names, trademarks, or service marks; or\n\n f) Requiring indemnification of licensors and authors of that\n material by anyone who conveys the material (or modified versions of\n it) with contractual assumptions of liability to the recipient, for\n any liability that these contractual assumptions directly impose on\n those licensors and authors.\n\n All other non-permissive additional terms are considered "further\nrestrictions" within the meaning of section 10. If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term. If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n 8. Termination.\n\n You may not propagate or modify a covered work except as expressly\nprovided under this License. Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License. If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n 9. Acceptance Not Required for Having Copies.\n\n You are not required to accept this License in order to receive or\nrun a copy of the Program. Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance. However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work. These actions infringe copyright if you do\nnot accept this License. Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n 10. Automatic Licensing of Downstream Recipients.\n\n Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License. You are not responsible\nfor enforcing compliance by third parties with this License.\n\n An "entity transaction" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations. If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party\'s predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License. For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n 11. Patents.\n\n A "contributor" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based. The\nwork thus licensed is called the contributor\'s "contributor version".\n\n A contributor\'s "essential patent claims" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version. For\npurposes of this definition, "control" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor\'s essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n In the following three paragraphs, a "patent license" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement). To "grant" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients. "Knowingly relying" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient\'s use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n A patent license is "discriminatory" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License. You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n 12. No Surrender of Others\' Freedom.\n\n If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License. If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all. For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n 13. Use with the GNU Affero General Public License.\n\n Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work. The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n 14. Revised Versions of this License.\n\n The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time. Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n Each version is given a distinguishing version number. If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License "or any later version" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation. If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy\'s\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n Later license versions may give you additional or different\npermissions. However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n 15. Disclaimer of Warranty.\n\n THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n 16. Limitation of Liability.\n\n IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n 17. Interpretation of Sections 15 and 16.\n\n If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n END OF TERMS AND CONDITIONS\n\n How to Apply These Terms to Your New Programs\n\n If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n To do so, attach the following notices to the program. It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe "copyright" line and a pointer to where the full notice is found.\n\n EmulatorJS: RetroArch on the web\n Copyright (C) 2023 Ethan O\'Brien\n\n This program is free software: you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see .\n\nAlso add information on how to contact you by electronic and paper mail.\n\n If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n EmulatorJS Copyright (C) 2023 Ethan O\'Brien\n This program comes with ABSOLUTELY NO WARRANTY; for details type `show w\'.\n This is free software, and you are welcome to redistribute it\n under certain conditions; type `show c\' for details.\n\nThe hypothetical commands `show w\' and `show c\' should show the appropriate\nparts of the General Public License. Of course, your program\'s commands\nmight be different; for a GUI interface, you would use an "about box".\n\n You should also get your employer (if you work as a programmer) or school,\nif any, to sign a "copyright disclaimer" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n.\n\n The GNU General Public License does not permit incorporating your program\ninto proprietary programs. If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library. If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License. But first, please read\n.\n'; + }); + + if (this.config.buttonOpts) { + if (this.config.buttonOpts.screenshot === false) screenshot.setAttribute("hidden", ""); + if (this.config.buttonOpts.screenRecord === false) startScreenRecording.setAttribute("hidden", ""); + if (this.config.buttonOpts.quickSave === false) qSave.setAttribute("hidden", ""); + if (this.config.buttonOpts.quickLoad === false) qLoad.setAttribute("hidden", ""); + } + + this.elements.contextmenu.appendChild(parent); + + this.elements.parent.appendChild(this.elements.contextmenu); + } + closePopup() { + if (this.currentPopup !== null) { + try { + this.currentPopup.remove(); + } catch(e){} + this.currentPopup = null; + } + } + //creates a full box popup. + createPopup(popupTitle, buttons, hidden) { + if (!hidden) this.closePopup(); + const popup = this.createElement('div'); + popup.classList.add("ejs_popup_container"); + this.elements.parent.appendChild(popup); + const title = this.createElement("h4"); + title.innerText = this.localization(popupTitle); + const main = this.createElement("div"); + main.classList.add("ejs_popup_body"); + + popup.appendChild(title); + popup.appendChild(main); + + const padding = this.createElement("div"); + padding.style["padding-top"] = "10px"; + popup.appendChild(padding); + + for (let k in buttons) { + const button = this.createElement("a"); + if (buttons[k] instanceof Function) { + button.addEventListener("click", (e) => { + buttons[k](); + e.preventDefault(); + }); + } + button.classList.add("ejs_button"); + button.innerText = this.localization(k); + popup.appendChild(button); + } + if (!hidden) { + this.currentPopup = popup; + } else { + popup.style.display = "none"; + } + + return main; + } + selectFile() { + return new Promise((resolve, reject) => { + const file = this.createElement("input"); + file.type = "file"; + this.addEventListener(file, "change", (e) => { + resolve(e.target.files[0]); + }) + file.click(); + }) + } + isPopupOpen() { + return this.cheatMenu.style.display !== "none" || this.netplayMenu.style.display !== "none" || this.controlMenu.style.display !== "none" || this.currentPopup !== null; + } + isChild(first, second) { + if (!first || !second) return false; + const adown = first.nodeType === 9 ? first.documentElement : first; + + if (first === second) return true; + + if (adown.contains) { + return adown.contains(second); + } + + return first.compareDocumentPosition && first.compareDocumentPosition(second) & 16; + } + createBottomMenuBar() { + this.elements.menu = this.createElement("div"); + + //prevent weird glitch on some devices + this.elements.menu.style.opacity = 0; + this.on("start", (e) => { + this.elements.menu.style.opacity = ""; + }) + this.elements.menu.classList.add("ejs_menu_bar"); + this.elements.menu.classList.add("ejs_menu_bar_hidden"); + + let timeout = null; + let ignoreEvents = false; + const hide = () => { + if (this.paused || this.settingsMenuOpen) return; + this.elements.menu.classList.add("ejs_menu_bar_hidden"); + } + + this.addEventListener(this.elements.parent, 'mousemove click', (e) => { + if (e.pointerType === "touch") return; + if (!this.started || ignoreEvents || document.pointerLockElement === this.canvas) return; + if (this.isPopupOpen()) return; + clearTimeout(timeout); + timeout = setTimeout(hide, 3000); + this.elements.menu.classList.remove("ejs_menu_bar_hidden"); + }) + this.addEventListener(this.elements.menu, 'touchstart touchend', (e) => { + if (!this.started) return; + if (this.isPopupOpen()) return; + clearTimeout(timeout); + timeout = setTimeout(hide, 3000); + this.elements.menu.classList.remove("ejs_menu_bar_hidden"); + }) + this.menu = { + close: () => { + if (!this.started) return; + clearTimeout(timeout); + this.elements.menu.classList.add("ejs_menu_bar_hidden"); + }, + open: () => { + if (!this.started) return; + clearTimeout(timeout); + timeout = setTimeout(hide, 3000); + this.elements.menu.classList.remove("ejs_menu_bar_hidden"); + }, + toggle: () => { + if (!this.started) return; + clearTimeout(timeout); + if (this.elements.menu.classList.contains("ejs_menu_bar_hidden")) { + timeout = setTimeout(hide, 3000); + } + this.elements.menu.classList.toggle("ejs_menu_bar_hidden"); + + } + } + this.elements.parent.appendChild(this.elements.menu); + + let tmout; + this.addEventListener(this.elements.parent, "mousedown touchstart", (e) => { + if (this.isChild(this.elements.menu, e.target) || this.isChild(this.elements.menuToggle, e.target)) return; + if (!this.started || this.elements.menu.classList.contains("ejs_menu_bar_hidden") || this.isPopupOpen()) return; + const width = this.elements.parent.getBoundingClientRect().width; + if (width > 575) return; + clearTimeout(tmout); + tmout = setTimeout(() => { + ignoreEvents = false; + }, 2000) + ignoreEvents = true; + this.menu.close(); + }) + + + let paddingSet = false; + //Now add buttons + const addButton = (title, image, callback, element, both) => { + const button = this.createElement("button"); + button.type = "button"; + const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); + svg.setAttribute("role", "presentation"); + svg.setAttribute("focusable", "false"); + svg.innerHTML = image; + const text = this.createElement("span"); + text.innerText = this.localization(title); + if (paddingSet) text.classList.add("ejs_menu_text_right"); + text.classList.add("ejs_menu_text"); + + button.classList.add("ejs_menu_button"); + button.appendChild(svg); + button.appendChild(text); + if (element) { + element.appendChild(button); + } else { + this.elements.menu.appendChild(button); + } + if (callback instanceof Function) { + this.addEventListener(button, 'click', callback); + } + return both ? [button, svg, text] : button; + } + + const restartButton = addButton("Restart", '', () => { + if (this.isNetplay && this.netplay.owner) { + this.gameManager.saveSaveFiles(); + this.gameManager.restart(); + this.netplay.reset(); + this.netplay.sendMessage({restart:true}); + this.play(); + } else if (!this.isNetplay) { + this.gameManager.saveSaveFiles(); + this.gameManager.restart(); + } + }); + const pauseButton = addButton("Pause", '', () => { + if (this.isNetplay && this.netplay.owner) { + this.pause(); + this.netplay.sendMessage({pause:true}); + } else if (!this.isNetplay) { + this.pause(); + } + }); + const playButton = addButton("Play", '', () => { + if (this.isNetplay && this.netplay.owner) { + this.play(); + this.netplay.sendMessage({play:true}); + } else if (!this.isNetplay) { + this.play(); + } + }); + playButton.style.display = "none"; + this.togglePlaying = (dontUpdate) => { + this.paused = !this.paused; + if (!dontUpdate) { + if (this.paused) { + pauseButton.style.display = "none"; + playButton.style.display = ""; + } else { + pauseButton.style.display = ""; + playButton.style.display = "none"; + } + } + this.gameManager.toggleMainLoop(this.paused ? 0 : 1); + + //I now realize its not easy to pause it while the cursor is locked, just in case I guess + if (this.getCore(true) === "nds") { + if (this.canvas.exitPointerLock) { + this.canvas.exitPointerLock(); + } else if (this.canvas.mozExitPointerLock) { + this.canvas.mozExitPointerLock(); + } + } + } + this.play = (dontUpdate) => { + if (this.paused) this.togglePlaying(dontUpdate); + } + this.pause = (dontUpdate) => { + if (!this.paused) this.togglePlaying(dontUpdate); + } + + let stateUrl; + const saveState = addButton("Save State", '', async () => { + const state = this.gameManager.getState(); + const called = this.callEvent("save", { + screenshot: await this.gameManager.screenshot(), + state: state + }); + if (called > 0) return; + if (stateUrl) URL.revokeObjectURL(stateUrl); + if (this.settings['save-state-location'] === "browser" && this.saveInBrowserSupported()) { + this.storage.states.put(this.getBaseFileName()+".state", state); + this.displayMessage(this.localization("SAVE SAVED TO BROWSER")); + } else { + const blob = new Blob([state]); + stateUrl = URL.createObjectURL(blob); + const a = this.createElement("a"); + a.href = stateUrl; + a.download = this.getBaseFileName()+".state"; + a.click(); + } + }); + const loadState = addButton("Load State", '', async () => { + const called = this.callEvent("load"); + if (called > 0) return; + if (this.settings['save-state-location'] === "browser" && this.saveInBrowserSupported()) { + this.storage.states.get(this.getBaseFileName()+".state").then(e => { + this.gameManager.loadState(e); + this.displayMessage(this.localization("SAVE LOADED FROM BROWSER")); + }) + } else { + const file = await this.selectFile(); + const state = new Uint8Array(await file.arrayBuffer()); + this.gameManager.loadState(state); + } + }); + const controlMenu = addButton("Control Settings", '', () => { + this.controlMenu.style.display = ""; + }); + const cheatMenu = addButton("Cheats", '', () => { + this.cheatMenu.style.display = ""; + }); + + const cache = addButton("Cache Manager", '', () => { + this.openCacheMenu(); + }); + if (this.config.disableDatabases) cache.style.display = "none"; + + let savUrl; + + const saveSavFiles = addButton("Export Save File", '', async () => { + const file = await this.gameManager.getSaveFile(); + const blob = new Blob([file]); + savUrl = URL.createObjectURL(blob); + const a = this.createElement("a"); + a.href = savUrl; + a.download = this.gameManager.getSaveFilePath().split("/").pop(); + a.click(); + }); + const loadSavFiles = addButton("Import Save File", '', async () => { + const file = await this.selectFile(); + const sav = new Uint8Array(await file.arrayBuffer()); + const path = this.gameManager.getSaveFilePath(); + const paths = path.split("/"); + let cp = ""; + for (let i=0; i', async () => { + this.openNetplayMenu(); + }); + + const spacer = this.createElement("span"); + spacer.classList.add("ejs_menu_bar_spacer"); + this.elements.menu.appendChild(spacer); + paddingSet = true; + + const volumeSettings = this.createElement("div"); + volumeSettings.classList.add("ejs_volume_parent"); + const muteButton = addButton("Mute", '', () => { + muteButton.style.display = "none"; + unmuteButton.style.display = ""; + this.muted = true; + this.setVolume(0); + }, volumeSettings); + const unmuteButton = addButton("Unmute", '', () => { + if (this.volume === 0) this.volume = 0.5; + muteButton.style.display = ""; + unmuteButton.style.display = "none"; + this.muted = false; + this.setVolume(this.volume); + }, volumeSettings); + unmuteButton.style.display = "none"; + + const volumeSlider = this.createElement("input"); + volumeSlider.setAttribute("data-range", "volume"); + volumeSlider.setAttribute("type", "range"); + volumeSlider.setAttribute("min", 0); + volumeSlider.setAttribute("max", 1); + volumeSlider.setAttribute("step", 0.01); + volumeSlider.setAttribute("autocomplete", "off"); + volumeSlider.setAttribute("role", "slider"); + volumeSlider.setAttribute("aria-label", "Volume"); + volumeSlider.setAttribute("aria-valuemin", 0); + volumeSlider.setAttribute("aria-valuemax", 100); + + this.setVolume = (volume) => { + this.saveSettings(); + this.muted = (volume === 0); + volumeSlider.value = volume; + volumeSlider.setAttribute("aria-valuenow", volume*100); + volumeSlider.setAttribute("aria-valuetext", (volume*100).toFixed(1) + "%"); + volumeSlider.setAttribute("style", "--value: "+volume*100+"%;margin-left: 5px;position: relative;z-index: 2;"); + if (window.AL && AL.currentCtx && AL.currentCtx.sources) { + AL.currentCtx.sources.forEach(e => { + e.gain.gain.value = volume; + }) + } + if (!this.config.buttonOpts || this.config.buttonOpts.mute !== false) { + unmuteButton.style.display = (volume === 0) ? "" : "none"; + muteButton.style.display = (volume === 0) ? "none" : ""; + } + } + + this.addEventListener(volumeSlider, "change mousemove touchmove mousedown touchstart mouseup", (e) => { + setTimeout(() => { + const newVal = parseFloat(volumeSlider.value); + if (newVal === 0 && this.muted) return; + this.volume = newVal; + this.setVolume(this.volume); + }, 5); + }) + + if (!this.config.buttonOpts || this.config.buttonOpts.volume !== false) { + volumeSettings.appendChild(volumeSlider); + } + + this.elements.menu.appendChild(volumeSettings); + + const contextMenuButton = addButton("Context Menu", '', () => { + if (this.elements.contextmenu.style.display == "none") { + this.elements.contextmenu.style.display = "block"; + this.elements.contextmenu.style.left = (getComputedStyle(this.elements.parent).width.split("px")[0]/2 - getComputedStyle(this.elements.contextmenu).width.split("px")[0]/2)+"px"; + this.elements.contextmenu.style.top = (getComputedStyle(this.elements.parent).height.split("px")[0]/2 - getComputedStyle(this.elements.contextmenu).height.split("px")[0]/2)+"px"; + } else { + this.elements.contextmenu.style.display = "none"; + } + }); + + this.settingParent = this.createElement("div"); + this.settingsMenuOpen = false; + const settingButton = addButton("Settings", '', () => { + this.settingsMenuOpen = !this.settingsMenuOpen; + settingButton[1].classList.toggle("ejs_svg_rotate", this.settingsMenuOpen); + this.settingsMenu.style.display = this.settingsMenuOpen ? "" : "none"; + settingButton[2].classList.toggle("ejs_settings_text", this.settingsMenuOpen); + }, this.settingParent, true); + this.elements.menu.appendChild(this.settingParent); + this.closeSettingsMenu = () => { + if (!this.settingsMenu) return; + this.settingsMenuOpen = false; + settingButton[1].classList.toggle("ejs_svg_rotate", this.settingsMenuOpen); + settingButton[2].classList.toggle("ejs_settings_text", this.settingsMenuOpen); + this.settingsMenu.style.display = "none"; + } + this.addEventListener(this.elements.parent, "mousedown touchstart", (e) => { + if (this.isChild(this.settingsMenu, e.target)) return; + if (e.pointerType === "touch") return; + if (e.target === settingButton[0] || e.target === settingButton[2]) return; + this.closeSettingsMenu(); + }) + this.addEventListener(this.canvas, "click", (e) => { + if (e.pointerType === "touch") return; + if (this.getCore(true) === "nds" && !this.paused) { + if (this.canvas.requestPointerLock) { + this.canvas.requestPointerLock(); + } else if (this.canvas.mozRequestPointerLock) { + this.canvas.mozRequestPointerLock(); + } + this.menu.close(); + } + }) + + const enter = addButton("Enter Fullscreen", '', () => { + this.toggleFullscreen(true); + }); + const exit = addButton("Exit Fullscreen", '', () => { + this.toggleFullscreen(false); + }); + exit.style.display = "none"; + + this.toggleFullscreen = (fullscreen) => { + if (fullscreen) { + if (this.elements.parent.requestFullscreen) { + this.elements.parent.requestFullscreen(); + } else if (this.elements.parent.mozRequestFullScreen) { + this.elements.parent.mozRequestFullScreen(); + } else if (this.elements.parent.webkitRequestFullscreen) { + this.elements.parent.webkitRequestFullscreen(); + } else if (this.elements.parent.msRequestFullscreen) { + this.elements.parent.msRequestFullscreen(); + } + exit.style.display = ""; + enter.style.display = "none"; + if (this.isMobile) { + try { + screen.orientation.lock(this.getCore(true) === "nds" ? "portrait" : "landscape").catch(e => {});; + } catch(e) {} + } + } else { + if (document.exitFullscreen) { + document.exitFullscreen(); + } else if (document.webkitExitFullscreen) { + document.webkitExitFullscreen(); + } else if (document.mozCancelFullScreen) { + document.mozCancelFullScreen(); + } else if (document.msExitFullscreen) { + document.msExitFullscreen(); + } + exit.style.display = "none"; + enter.style.display = ""; + if (this.isMobile) { + try { + screen.orientation.unlock(); + } catch(e) {} + } + } + } + + + this.addEventListener(document, "webkitfullscreenchange mozfullscreenchange fullscreenchange", (e) => { + if (e.target !== this.elements.parent) return; + if (document.fullscreenElement === null) { + exit.style.display = "none"; + enter.style.display = ""; + } else { + //not sure if this is possible, lets put it here anyways + exit.style.display = ""; + enter.style.display = "none"; + } + }) + + const hasFullscreen = !!(this.elements.parent.requestFullscreen || this.elements.parent.mozRequestFullScreen || this.elements.parent.webkitRequestFullscreen || this.elements.parent.msRequestFullscreen); + + if (!hasFullscreen) { + exit.style.display = "none"; + enter.style.display = "none"; + } + + this.elements.bottomBar = { + playPause: [pauseButton, playButton], + restart: [restartButton], + settings: [settingButton], + contextMenu: [contextMenuButton], + fullscreen: [enter, exit], + saveState: [saveState], + loadState: [loadState], + gamepad: [controlMenu], + cheat: [cheatMenu], + cacheManager: [cache], + saveSavFiles: [saveSavFiles], + loadSavFiles: [loadSavFiles], + netplay: [netplay] + } + + + if (this.config.buttonOpts) { + if (this.debug) console.log(this.config.buttonOpts); + if (this.config.buttonOpts.playPause === false) { + pauseButton.style.display = "none"; + playButton.style.display = "none"; + } + if (this.config.buttonOpts.contextMenuButton === false) contextMenuButton.style.display = "none" + if (this.config.buttonOpts.restart === false) restartButton.style.display = "none" + if (this.config.buttonOpts.settings === false) settingButton[0].style.display = "none" + if (this.config.buttonOpts.fullscreen === false) { + enter.style.display = "none"; + exit.style.display = "none"; + } + if (this.config.buttonOpts.mute === false) { + muteButton.style.display = "none"; + unmuteButton.style.display = "none"; + } + if (this.config.buttonOpts.saveState === false) saveState.style.display = "none" + if (this.config.buttonOpts.loadState === false) loadState.style.display = "none" + if (this.config.buttonOpts.saveSavFiles === false) saveSavFiles.style.display = "none" + if (this.config.buttonOpts.loadSavFiles === false) loadSavFiles.style.display = "none" + if (this.config.buttonOpts.gamepad === false) controlMenu.style.display = "none" + if (this.config.buttonOpts.cheat === false) cheatMenu.style.display = "none" + if (this.config.buttonOpts.cacheManager === false) cache.style.display = "none" + if (this.config.buttonOpts.netplay === false) netplay.style.display = "none" + } + } + openCacheMenu() { + (async () => { + const list = this.createElement("table"); + const tbody = this.createElement("tbody"); + const body = this.createPopup("Cache Manager", { + "Clear All": async () => { + const roms = await this.storage.rom.getSizes(); + for (const k in roms) { + await this.storage.rom.remove(k); + } + tbody.innerHTML = ""; + }, + "Close": () => { + this.closePopup(); + } + }); + const roms = await this.storage.rom.getSizes(); + list.style.width = "100%"; + list.style["padding-left"] = "10px"; + list.style["text-align"] = "left"; + body.appendChild(list); + list.appendChild(tbody); + const getSize = function(size) { + let i = -1; + do { + size /= 1024, i++; + } while (size > 1024); + return Math.max(size, 0.1).toFixed(1) + [' kB', ' MB', ' GB', ' TB', 'PB', 'EB', 'ZB', 'YB'][i]; + } + for (const k in roms) { + const line = this.createElement("tr"); + const name = this.createElement("td"); + const size = this.createElement("td"); + const remove = this.createElement("td"); + remove.style.cursor = "pointer"; + name.innerText = k; + size.innerText = getSize(roms[k]); + + const a = this.createElement("a"); + a.innerText = this.localization("Remove"); + this.addEventListener(remove, "click", () => { + this.storage.rom.remove(k); + line.remove(); + }) + remove.appendChild(a); + + line.appendChild(name); + line.appendChild(size); + line.appendChild(remove); + tbody.appendChild(line); + } + + })(); + } + getControlScheme() { + if (this.config.controlScheme && typeof this.config.controlScheme === 'string') { + return this.config.controlScheme; + } else { + return this.getCore(true); + } + } + createControlSettingMenu() { + let buttonListeners = []; + this.checkGamepadInputs = () => buttonListeners.forEach(elem => elem()); + this.gamepadLabels = []; + this.controls = JSON.parse(JSON.stringify(this.defaultControllers)); + const body = this.createPopup("Control Settings", { + "Reset": () => { + this.controls = JSON.parse(JSON.stringify(this.defaultControllers)); + this.setupKeys(); + this.checkGamepadInputs(); + this.saveSettings(); + }, + "Clear": () => { + this.controls = {0:{},1:{},2:{},3:{}}; + this.setupKeys(); + this.checkGamepadInputs(); + this.saveSettings(); + }, + "Close": () => { + this.controlMenu.style.display = "none"; + } + }, true); + this.setupKeys(); + this.controlMenu = body.parentElement; + body.classList.add("ejs_control_body"); + + let buttons; + if ("gb" === this.getControlScheme()) { + buttons = [ + {id: 8, label: this.localization('A')}, + {id: 0, label: this.localization('B')}, + {id: 2, label: this.localization('SELECT')}, + {id: 3, label: this.localization('START')}, + {id: 4, label: this.localization('UP')}, + {id: 5, label: this.localization('DOWN')}, + {id: 6, label: this.localization('LEFT')}, + {id: 7, label: this.localization('RIGHT')}, + ]; + } else if ("nes" === this.getControlScheme()) { + buttons = [ + {id: 8, label: this.localization('A')}, + {id: 0, label: this.localization('B')}, + {id: 2, label: this.localization('SELECT')}, + {id: 3, label: this.localization('START')}, + {id: 4, label: this.localization('UP')}, + {id: 5, label: this.localization('DOWN')}, + {id: 6, label: this.localization('LEFT')}, + {id: 7, label: this.localization('RIGHT')}, + {id: 10, label: this.localization('EJECT')},//Famicon games only + {id: 11, label: this.localization('SWAP DISKS')}, + ]; + } else if ('snes' === this.getControlScheme()) { + buttons = [ + {id: 8, label: this.localization('A')}, + {id: 0, label: this.localization('B')}, + {id: 9, label: this.localization('X')}, + {id: 1, label: this.localization('Y')}, + {id: 2, label: this.localization('SELECT')}, + {id: 3, label: this.localization('START')}, + {id: 4, label: this.localization('UP')}, + {id: 5, label: this.localization('DOWN')}, + {id: 6, label: this.localization('LEFT')}, + {id: 7, label: this.localization('RIGHT')}, + {id: 10, label: this.localization('L')}, + {id: 11, label: this.localization('R')}, + ]; + } else if ('n64' === this.getControlScheme()) { + buttons = [ + {id: 0, label: this.localization('A')}, + {id: 1, label: this.localization('B')}, + {id: 3, label: this.localization('START')}, + {id: 4, label: this.localization('D-PAD UP')}, + {id: 5, label: this.localization('D-PAD DOWN')}, + {id: 6, label: this.localization('D-PAD LEFT')}, + {id: 7, label: this.localization('D-PAD RIGHT')}, + {id: 10, label: this.localization('L')}, + {id: 11, label: this.localization('R')}, + {id: 12, label: this.localization('Z')}, + {id: 19, label: this.localization('STICK UP')}, + {id: 18, label: this.localization('STICK DOWN')}, + {id: 17, label: this.localization('STICK LEFT')}, + {id: 16, label: this.localization('STICK RIGHT')}, + {id: 23, label: this.localization('C-PAD UP')}, + {id: 22, label: this.localization('C-PAD DOWN')}, + {id: 21, label: this.localization('C-PAD LEFT')}, + {id: 20, label: this.localization('C-PAD RIGHT')}, + ]; + } else if ('gba' === this.getControlScheme()) { + buttons = [ + {id: 8, label: this.localization('A')}, + {id: 0, label: this.localization('B')}, + {id: 10, label: this.localization('L')}, + {id: 11, label: this.localization('R')}, + {id: 2, label: this.localization('SELECT')}, + {id: 3, label: this.localization('START')}, + {id: 4, label: this.localization('UP')}, + {id: 5, label: this.localization('DOWN')}, + {id: 6, label: this.localization('LEFT')}, + {id: 7, label: this.localization('RIGHT')}, + ]; + } else if ('nds' === this.getControlScheme()) { + buttons = [ + {id: 8, label: this.localization('A')}, + {id: 0, label: this.localization('B')}, + {id: 9, label: this.localization('X')}, + {id: 1, label: this.localization('Y')}, + {id: 2, label: this.localization('SELECT')}, + {id: 3, label: this.localization('START')}, + {id: 4, label: this.localization('UP')}, + {id: 5, label: this.localization('DOWN')}, + {id: 6, label: this.localization('LEFT')}, + {id: 7, label: this.localization('RIGHT')}, + {id: 10, label: this.localization('L')}, + {id: 11, label: this.localization('R')}, + {id: 14, label: this.localization('Microphone')}, + ]; + } else if ('vb' === this.getControlScheme()) { + buttons = [ + {id: 8, label: this.localization('A')}, + {id: 0, label: this.localization('B')}, + {id: 10, label: this.localization('L')}, + {id: 11, label: this.localization('R')}, + {id: 2, label: this.localization('SELECT')}, + {id: 3, label: this.localization('START')}, + {id: 4, label: this.localization('LEFT D-PAD UP')}, + {id: 5, label: this.localization('LEFT D-PAD DOWN')}, + {id: 6, label: this.localization('LEFT D-PAD LEFT')}, + {id: 7, label: this.localization('LEFT D-PAD RIGHT')}, + {id: 19, label: this.localization('RIGHT D-PAD UP')}, + {id: 18, label: this.localization('RIGHT D-PAD DOWN')}, + {id: 17, label: this.localization('RIGHT D-PAD LEFT')}, + {id: 16, label: this.localization('RIGHT D-PAD RIGHT')}, + ]; + } else if (['segaMD', 'segaCD', 'sega32x'].includes(this.getControlScheme())) { + buttons = [ + {id: 1, label: this.localization('A')}, + {id: 0, label: this.localization('B')}, + {id: 8, label: this.localization('C')}, + {id: 10, label: this.localization('X')}, + {id: 9, label: this.localization('Y')}, + {id: 11, label: this.localization('Z')}, + {id: 3, label: this.localization('START')}, + {id: 2, label: this.localization('MODE')}, + {id: 4, label: this.localization('UP')}, + {id: 5, label: this.localization('DOWN')}, + {id: 6, label: this.localization('LEFT')}, + {id: 7, label: this.localization('RIGHT')}, + ]; + } else if ('segaMS' === this.getControlScheme()) { + buttons = [ + {id: 0, label: this.localization('BUTTON 1 / START')}, + {id: 8, label: this.localization('BUTTON 2')}, + {id: 4, label: this.localization('UP')}, + {id: 5, label: this.localization('DOWN')}, + {id: 6, label: this.localization('LEFT')}, + {id: 7, label: this.localization('RIGHT')}, + ]; + } else if ('segaGG' === this.getControlScheme()) { + buttons = [ + {id: 0, label: this.localization('BUTTON 1')}, + {id: 8, label: this.localization('BUTTON 2')}, + {id: 3, label: this.localization('START')}, + {id: 4, label: this.localization('UP')}, + {id: 5, label: this.localization('DOWN')}, + {id: 6, label: this.localization('LEFT')}, + {id: 7, label: this.localization('RIGHT')}, + ]; + } else if ('segaSaturn' === this.getControlScheme()) { + buttons = [ + {id: 1, label: this.localization('A')}, + {id: 0, label: this.localization('B')}, + {id: 8, label: this.localization('C')}, + {id: 9, label: this.localization('X')}, + {id: 10, label: this.localization('Y')}, + {id: 11, label: this.localization('Z')}, + {id: 12, label: this.localization('L')}, + {id: 13, label: this.localization('R')}, + {id: 3, label: this.localization('START')}, + {id: 4, label: this.localization('UP')}, + {id: 5, label: this.localization('DOWN')}, + {id: 6, label: this.localization('LEFT')}, + {id: 7, label: this.localization('RIGHT')}, + ]; + } else if ('3do' === this.getControlScheme()) { + buttons = [ + {id: 1, label: this.localization('A')}, + {id: 0, label: this.localization('B')}, + {id: 8, label: this.localization('C')}, + {id: 10, label: this.localization('L')}, + {id: 11, label: this.localization('R')}, + {id: 2, label: this.localization('X')}, + {id: 3, label: this.localization('P')}, + {id: 4, label: this.localization('UP')}, + {id: 5, label: this.localization('DOWN')}, + {id: 6, label: this.localization('LEFT')}, + {id: 7, label: this.localization('RIGHT')}, + ]; + } else if ('atari2600' === this.getControlScheme()) { + buttons = [ + {id: 0, label: this.localization('FIRE')}, + {id: 2, label: this.localization('SELECT')}, + {id: 3, label: this.localization('RESET')}, + {id: 4, label: this.localization('UP')}, + {id: 5, label: this.localization('DOWN')}, + {id: 6, label: this.localization('LEFT')}, + {id: 7, label: this.localization('RIGHT')}, + {id: 10, label: this.localization('LEFT DIFFICULTY A')}, + {id: 12, label: this.localization('LEFT DIFFICULTY B')}, + {id: 11, label: this.localization('RIGHT DIFFICULTY A')}, + {id: 13, label: this.localization('RIGHT DIFFICULTY B')}, + {id: 14, label: this.localization('COLOR')}, + {id: 15, label: this.localization('B/W')}, + ]; + } else if ('atari7800' === this.getControlScheme()) { + buttons = [ + {id: 0, label: this.localization('BUTTON 1')}, + {id: 8, label: this.localization('BUTTON 2')}, + {id: 2, label: this.localization('SELECT')}, + {id: 3, label: this.localization('PAUSE')}, + {id: 9, label: this.localization('RESET')}, + {id: 4, label: this.localization('UP')}, + {id: 5, label: this.localization('DOWN')}, + {id: 6, label: this.localization('LEFT')}, + {id: 7, label: this.localization('RIGHT')}, + {id: 10, label: this.localization('LEFT DIFFICULTY')}, + {id: 11, label: this.localization('RIGHT DIFFICULTY')}, + ]; + } else if ('lynx' === this.getControlScheme()) { + buttons = [ + {id: 8, label: this.localization('A')}, + {id: 0, label: this.localization('B')}, + {id: 10, label: this.localization('OPTION 1')}, + {id: 11, label: this.localization('OPTION 2')}, + {id: 3, label: this.localization('START')}, + {id: 4, label: this.localization('UP')}, + {id: 5, label: this.localization('DOWN')}, + {id: 6, label: this.localization('LEFT')}, + {id: 7, label: this.localization('RIGHT')}, + ]; + } else if ('jaguar' === this.getControlScheme()) { + buttons = [ + {id: 8, label: this.localization('A')}, + {id: 0, label: this.localization('B')}, + {id: 1, label: this.localization('C')}, + {id: 2, label: this.localization('PAUSE')}, + {id: 3, label: this.localization('OPTION')}, + {id: 4, label: this.localization('UP')}, + {id: 5, label: this.localization('DOWN')}, + {id: 6, label: this.localization('LEFT')}, + {id: 7, label: this.localization('RIGHT')}, + ]; + } else if ('pce' === this.getControlScheme()) { + buttons = [ + {id: 8, label: this.localization('I')}, + {id: 0, label: this.localization('II')}, + {id: 2, label: this.localization('SELECT')}, + {id: 3, label: this.localization('RUN')}, + {id: 4, label: this.localization('UP')}, + {id: 5, label: this.localization('DOWN')}, + {id: 6, label: this.localization('LEFT')}, + {id: 7, label: this.localization('RIGHT')}, + ]; + } else if ('ngp' === this.getControlScheme()) { + buttons = [ + {id: 0, label: this.localization('A')}, + {id: 8, label: this.localization('B')}, + {id: 3, label: this.localization('OPTION')}, + {id: 4, label: this.localization('UP')}, + {id: 5, label: this.localization('DOWN')}, + {id: 6, label: this.localization('LEFT')}, + {id: 7, label: this.localization('RIGHT')}, + ]; + } else if ('ws' === this.getControlScheme()) { + buttons = [ + {id: 8, label: this.localization('A')}, + {id: 0, label: this.localization('B')}, + {id: 3, label: this.localization('START')}, + {id: 4, label: this.localization('X UP')}, + {id: 5, label: this.localization('X DOWN')}, + {id: 6, label: this.localization('X LEFT')}, + {id: 7, label: this.localization('X RIGHT')}, + {id: 13, label: this.localization('Y UP')}, + {id: 12, label: this.localization('Y DOWN')}, + {id: 10, label: this.localization('Y LEFT')}, + {id: 11, label: this.localization('Y RIGHT')}, + ]; + } else if ('coleco' === this.getControlScheme()) { + buttons = [ + {id: 8, label: this.localization('LEFT BUTTON')}, + {id: 0, label: this.localization('RIGHT BUTTON')}, + {id: 9, label: this.localization('1')}, + {id: 1, label: this.localization('2')}, + {id: 11, label: this.localization('3')}, + {id: 10, label: this.localization('4')}, + {id: 13, label: this.localization('5')}, + {id: 12, label: this.localization('6')}, + {id: 15, label: this.localization('7')}, + {id: 14, label: this.localization('8')}, + {id: 2, label: this.localization('*')}, + {id: 3, label: this.localization('#')}, + {id: 4, label: this.localization('UP')}, + {id: 5, label: this.localization('DOWN')}, + {id: 6, label: this.localization('LEFT')}, + {id: 7, label: this.localization('RIGHT')}, + ]; + } else if ('pcfx' === this.getControlScheme()) { + buttons = [ + {id: 8, label: this.localization('I')}, + {id: 0, label: this.localization('II')}, + {id: 9, label: this.localization('III')}, + {id: 1, label: this.localization('IV')}, + {id: 10, label: this.localization('V')}, + {id: 11, label: this.localization('VI')}, + {id: 3, label: this.localization('RUN')}, + {id: 2, label: this.localization('SELECT')}, + {id: 12, label: this.localization('MODE1')}, + {id: 13, label: this.localization('MODE2')}, + {id: 4, label: this.localization('UP')}, + {id: 5, label: this.localization('DOWN')}, + {id: 6, label: this.localization('LEFT')}, + {id: 7, label: this.localization('RIGHT')}, + ]; + } else { + buttons = [ + {id: 0, label: this.localization('B')}, + {id: 1, label: this.localization('Y')}, + {id: 2, label: this.localization('SELECT')}, + {id: 3, label: this.localization('START')}, + {id: 4, label: this.localization('UP')}, + {id: 5, label: this.localization('DOWN')}, + {id: 6, label: this.localization('LEFT')}, + {id: 7, label: this.localization('RIGHT')}, + {id: 8, label: this.localization('A')}, + {id: 9, label: this.localization('X')}, + {id: 10, label: this.localization('L')}, + {id: 11, label: this.localization('R')}, + {id: 12, label: this.localization('L2')}, + {id: 13, label: this.localization('R2')}, + {id: 14, label: this.localization('L3')}, + {id: 15, label: this.localization('R3')}, + {id: 19, label: this.localization('L STICK UP')}, + {id: 18, label: this.localization('L STICK DOWN')}, + {id: 17, label: this.localization('L STICK LEFT')}, + {id: 16, label: this.localization('L STICK RIGHT')}, + {id: 23, label: this.localization('R STICK UP')}, + {id: 22, label: this.localization('R STICK DOWN')}, + {id: 21, label: this.localization('R STICK LEFT')}, + {id: 20, label: this.localization('R STICK RIGHT')}, + ]; + } + if (['arcade', 'mame'].includes(this.getControlScheme())) { + for (const buttonIdx in buttons) { + if (buttons[buttonIdx].id === 2) { + buttons[buttonIdx].label = this.localization('INSERT COIN'); + } + } + } + buttons.push( + {id: 24, label: this.localization('QUICK SAVE STATE')}, + {id: 25, label: this.localization('QUICK LOAD STATE')}, + {id: 26, label: this.localization('CHANGE STATE SLOT')}, + {id: 27, label: this.localization('FAST FORWARD')}, + {id: 29, label: this.localization('SLOW MOTION')}, + {id: 28, label: this.localization('REWIND')} + ); + let nums = []; + for (let i=0; i { + e.preventDefault(); + players[selectedPlayer].classList.remove("ejs_control_selected"); + playerDivs[selectedPlayer].setAttribute("hidden", ""); + selectedPlayer = i-1; + players[i-1].classList.add("ejs_control_selected"); + playerDivs[i-1].removeAttribute("hidden"); + }) + playerContainer.appendChild(player); + playerSelect.appendChild(playerContainer); + players.push(playerContainer); + } + body.appendChild(playerSelect); + + const controls = this.createElement("div"); + for (let i=0; i<4; i++) { + if (!this.controls[i]) this.controls[i] = {}; + const player = this.createElement("div"); + const playerTitle = this.createElement("div"); + + const gamepadTitle = this.createElement("div"); + gamepadTitle.style = "font-size:12px;"; + gamepadTitle.innerText = this.localization("Connected Gamepad")+": "; + + const gamepadName = this.createElement("span"); + this.gamepadLabels.push(gamepadName); + gamepadName.innerText = "n/a"; + gamepadTitle.appendChild(gamepadName); + + const leftPadding = this.createElement("div"); + leftPadding.style = "width:25%;float:left;"; + leftPadding.innerHTML = " "; + + const aboutParent = this.createElement("div"); + aboutParent.style = "font-size:12px;width:50%;float:left;"; + const gamepad = this.createElement("div"); + gamepad.style = "text-align:center;width:50%;float:left;"; + gamepad.innerText = this.localization("Gamepad"); + aboutParent.appendChild(gamepad); + const keyboard = this.createElement("div"); + keyboard.style = "text-align:center;width:50%;float:left;"; + keyboard.innerText = this.localization("Keyboard"); + aboutParent.appendChild(keyboard); + + const headingPadding = this.createElement("div"); + headingPadding.style = "clear:both;"; + + playerTitle.appendChild(gamepadTitle); + playerTitle.appendChild(leftPadding); + playerTitle.appendChild(aboutParent); + + if ((this.touch || navigator.maxTouchPoints > 0) && i === 0) { + const vgp = this.createElement("div"); + vgp.style = "width:25%;float:right;clear:none;padding:0;font-size: 11px;padding-left: 2.25rem;"; + vgp.classList.add("ejs_control_row"); + vgp.classList.add("ejs_cheat_row"); + const input = this.createElement("input"); + input.type = "checkbox"; + input.checked = true; + input.value = "o"; + input.id = "ejs_vp"; + vgp.appendChild(input); + const label = this.createElement("label"); + label.for = "ejs_vp"; + label.innerText = "Virtual Gamepad"; + vgp.appendChild(label); + label.addEventListener("click", (e) => { + input.checked = !input.checked; + this.changeSettingOption('virtual-gamepad', input.checked ? 'enabled' : "disabled"); + }) + this.on("start", (e) => { + if (this.settings["virtual-gamepad"] === "disabled") { + input.checked = false; + } + }) + playerTitle.appendChild(vgp); + } + + playerTitle.appendChild(headingPadding); + + + player.appendChild(playerTitle); + + for (const buttonIdx in buttons) { + const k = buttons[buttonIdx].id; + const controlLabel = buttons[buttonIdx].label; + + const buttonText = this.createElement("div"); + buttonText.setAttribute("data-id", k); + buttonText.setAttribute("data-index", i); + buttonText.setAttribute("data-label", controlLabel); + buttonText.style = "margin-bottom:10px;"; + buttonText.classList.add("ejs_control_bar"); + + + const title = this.createElement("div"); + title.style = "width:25%;float:left;font-size:12px;"; + const label = this.createElement("label"); + label.innerText = controlLabel+":"; + title.appendChild(label); + + const textBoxes = this.createElement("div"); + textBoxes.style = "width:50%;float:left;"; + + const textBox1Parent = this.createElement("div"); + textBox1Parent.style = "width:50%;float:left;padding: 0 5px;"; + const textBox1 = this.createElement("input"); + textBox1.style = "text-align:center;height:25px;width: 100%;"; + textBox1.type = "text"; + textBox1.setAttribute("readonly", ""); + textBox1.setAttribute("placeholder", ""); + textBox1Parent.appendChild(textBox1); + + const textBox2Parent = this.createElement("div"); + textBox2Parent.style = "width:50%;float:left;padding: 0 5px;"; + const textBox2 = this.createElement("input"); + textBox2.style = "text-align:center;height:25px;width: 100%;"; + textBox2.type = "text"; + textBox2.setAttribute("readonly", ""); + textBox2.setAttribute("placeholder", ""); + textBox2Parent.appendChild(textBox2); + + buttonListeners.push(() => { + textBox2.value = ""; + textBox1.value = ""; + if (this.controls[i][k] && this.controls[i][k].value !== undefined) { + let value = this.keyMap[this.controls[i][k].value]; + value = this.localization(value); + textBox2.value = value; + } + if (this.controls[i][k] && this.controls[i][k].value2 !== undefined && this.controls[i][k].value2 !== "") { + let value2 = this.controls[i][k].value2.toString(); + if (value2.includes(":")) { + value2 = value2.split(":"); + value2 = this.localization(value2[0]) + ":" + this.localization(value2[1]) + } else if (!isNaN(value2)){ + value2 = this.localization("BUTTON")+" "+this.localization(value2); + } else { + value2 = this.localization(value2); + } + textBox1.value = value2; + } + }) + + if (this.controls[i][k] && this.controls[i][k].value) { + let value = this.keyMap[this.controls[i][k].value]; + value = this.localization(value); + textBox2.value = value; + } + if (this.controls[i][k] && this.controls[i][k].value2) { + let value2 = this.controls[i][k].value2.toString(); + if (value2.includes(":")) { + value2 = value2.split(":"); + value2 = this.localization(value2[0]) + ":" + this.localization(value2[1]) + } else if (!isNaN(value2)){ + value2 = this.localization("BUTTON")+" "+this.localization(value2); + } else { + value2 = this.localization(value2); + } + textBox1.value = value2; + } + + textBoxes.appendChild(textBox1Parent); + textBoxes.appendChild(textBox2Parent); + + const padding = this.createElement("div"); + padding.style = "clear:both;"; + textBoxes.appendChild(padding); + + const setButton = this.createElement("div"); + setButton.style = "width:25%;float:left;"; + const button = this.createElement("a"); + button.classList.add("ejs_control_set_button"); + button.innerText = this.localization("Set"); + setButton.appendChild(button); + + const padding2 = this.createElement("div"); + padding2.style = "clear:both;"; + + buttonText.appendChild(title); + buttonText.appendChild(textBoxes); + buttonText.appendChild(setButton); + buttonText.appendChild(padding2); + + player.appendChild(buttonText); + + this.addEventListener(buttonText, "mousedown", (e) => { + e.preventDefault(); + this.controlPopup.parentElement.parentElement.removeAttribute("hidden"); + this.controlPopup.innerText = "[ " + controlLabel + " ]\n"+this.localization("Press Keyboard"); + this.controlPopup.setAttribute("button-num", k); + this.controlPopup.setAttribute("player-num", i); + }) + } + controls.appendChild(player); + player.setAttribute("hidden", ""); + playerDivs.push(player); + } + body.appendChild(controls); + + + selectedPlayer = 0; + players[0].classList.add("ejs_control_selected"); + playerDivs[0].removeAttribute("hidden"); + + + const popup = this.createElement('div'); + popup.classList.add("ejs_popup_container"); + const popupMsg = this.createElement("div"); + this.addEventListener(popup, "mousedown click touchstart", (e) => { + if (this.isChild(popupMsg, e.target)) return; + this.controlPopup.parentElement.parentElement.setAttribute("hidden", ""); + }) + const btn = this.createElement("a"); + btn.classList.add("ejs_control_set_button"); + btn.innerText = this.localization("Clear"); + this.addEventListener(btn, "mousedown click touchstart", (e) => { + const num = this.controlPopup.getAttribute("button-num"); + const player = this.controlPopup.getAttribute("player-num"); + if (!this.controls[player][num]) { + this.controls[player][num] = {}; + } + this.controls[player][num].value = 0; + this.controls[player][num].value2 = ""; + this.controlPopup.parentElement.parentElement.setAttribute("hidden", ""); + this.checkGamepadInputs(); + this.saveSettings(); + }) + popupMsg.classList.add("ejs_popup_box"); + popupMsg.innerText = ""; + popup.setAttribute("hidden", ""); + const popMsg = this.createElement("div"); + this.controlPopup = popMsg; + popup.appendChild(popupMsg); + popupMsg.appendChild(popMsg); + popupMsg.appendChild(this.createElement("br")); + popupMsg.appendChild(btn); + this.controlMenu.appendChild(popup); + + } + defaultControllers = { + 0: { + 0: { + 'value': 'x', + 'value2': 'BUTTON_2' + }, + 1: { + 'value': 's', + 'value2': 'BUTTON_4' + }, + 2: { + 'value': 'v', + 'value2': 'SELECT' + }, + 3: { + 'value': 'enter', + 'value2': 'START' + }, + 4: { + 'value': 'up arrow', + 'value2': 'DPAD_UP' + }, + 5: { + 'value': 'down arrow', + 'value2': 'DPAD_DOWN' + }, + 6: { + 'value': 'left arrow', + 'value2': 'DPAD_LEFT' + }, + 7: { + 'value': 'right arrow', + 'value2': 'DPAD_RIGHT' + }, + 8: { + 'value': 'z', + 'value2': 'BUTTON_1' + }, + 9: { + 'value': 'a', + 'value2': 'BUTTON_3' + }, + 10: { + 'value': 'q', + 'value2': 'LEFT_TOP_SHOULDER' + }, + 11: { + 'value': 'e', + 'value2': 'RIGHT_TOP_SHOULDER' + }, + 12: { + 'value': 'tab', + 'value2': 'LEFT_BOTTOM_SHOULDER' + }, + 13: { + 'value': 'r', + 'value2': 'RIGHT_BOTTOM_SHOULDER' + }, + 14: { + 'value': '', + 'value2': 'LEFT_STICK', + }, + 15: { + 'value': '', + 'value2': 'RIGHT_STICK', + }, + 16: { + 'value': 'h', + 'value2': 'LEFT_STICK_X:+1' + }, + 17: { + 'value': 'f', + 'value2': 'LEFT_STICK_X:-1' + }, + 18: { + 'value': 'g', + 'value2': 'LEFT_STICK_Y:+1' + }, + 19: { + 'value': 't', + 'value2': 'LEFT_STICK_Y:-1' + }, + 20: { + 'value': 'l', + 'value2': 'RIGHT_STICK_X:+1' + }, + 21: { + 'value': 'j', + 'value2': 'RIGHT_STICK_X:-1' + }, + 22: { + 'value': 'k', + 'value2': 'RIGHT_STICK_Y:+1' + }, + 23: { + 'value': 'i', + 'value2': 'RIGHT_STICK_Y:-1' + }, + 24: { + 'value': '1' + }, + 25: { + 'value': '2' + }, + 26: { + 'value': '3' + }, + 27: {}, + 28: {}, + 29: {}, + }, + 1: {}, + 2: {}, + 3: {} + } + keyMap = { + 0: '', + 8: 'backspace', + 9: 'tab', + 13: 'enter', + 16: 'shift', + 17: 'ctrl', + 18: 'alt', + 19: 'pause/break', + 20: 'caps lock', + 27: 'escape', + 32: 'space', + 33: 'page up', + 34: 'page down', + 35: 'end', + 36: 'home', + 37: 'left arrow', + 38: 'up arrow', + 39: 'right arrow', + 40: 'down arrow', + 45: 'insert', + 46: 'delete', + 48: '0', + 49: '1', + 50: '2', + 51: '3', + 52: '4', + 53: '5', + 54: '6', + 55: '7', + 56: '8', + 57: '9', + 65: 'a', + 66: 'b', + 67: 'c', + 68: 'd', + 69: 'e', + 70: 'f', + 71: 'g', + 72: 'h', + 73: 'i', + 74: 'j', + 75: 'k', + 76: 'l', + 77: 'm', + 78: 'n', + 79: 'o', + 80: 'p', + 81: 'q', + 82: 'r', + 83: 's', + 84: 't', + 85: 'u', + 86: 'v', + 87: 'w', + 88: 'x', + 89: 'y', + 90: 'z', + 91: 'left window key', + 92: 'right window key', + 93: 'select key', + 96: 'numpad 0', + 97: 'numpad 1', + 98: 'numpad 2', + 99: 'numpad 3', + 100: 'numpad 4', + 101: 'numpad 5', + 102: 'numpad 6', + 103: 'numpad 7', + 104: 'numpad 8', + 105: 'numpad 9', + 106: 'multiply', + 107: 'add', + 109: 'subtract', + 110: 'decimal point', + 111: 'divide', + 112: 'f1', + 113: 'f2', + 114: 'f3', + 115: 'f4', + 116: 'f5', + 117: 'f6', + 118: 'f7', + 119: 'f8', + 120: 'f9', + 121: 'f10', + 122: 'f11', + 123: 'f12', + 144: 'num lock', + 145: 'scroll lock', + 186: 'semi-colon', + 187: 'equal sign', + 188: 'comma', + 189: 'dash', + 190: 'period', + 191: 'forward slash', + 192: 'grave accent', + 219: 'open bracket', + 220: 'back slash', + 221: 'close braket', + 222: 'single quote' + } + controls; + setupKeys() { + for (let i=0; i<4; i++) { + for (let j=0; j<30; j++) { + if (this.controls[i][j]) { + this.controls[i][j].value = parseInt(this.keyLookup(this.controls[i][j].value)); + if (this.controls[i][j].value === -1 && this.debug) { + delete this.controls[i][j].value; + console.warn("Invalid key for control "+j+" player "+i); + } + } + } + } + } + keyLookup(controllerkey) { + if (controllerkey === undefined) return 0; + if (typeof controllerkey === "number") return controllerkey; + controllerkey = controllerkey.toString().toLowerCase() + const values = Object.values(this.keyMap); + if (values.includes(controllerkey)) { + const index = values.indexOf(controllerkey); + return Object.keys(this.keyMap)[index]; + } + return -1; + } + keyChange(e) { + if (e.repeat) return; + if (!this.started) return; + if (this.controlPopup.parentElement.parentElement.getAttribute("hidden") === null) { + const num = this.controlPopup.getAttribute("button-num"); + const player = this.controlPopup.getAttribute("player-num"); + if (!this.controls[player][num]) { + this.controls[player][num] = {}; + } + this.controls[player][num].value = e.keyCode; + this.controlPopup.parentElement.parentElement.setAttribute("hidden", ""); + this.checkGamepadInputs(); + this.saveSettings(); + return; + } + if (this.settingsMenu.style.display !== "none" || this.isPopupOpen()) return; + e.preventDefault(); + const special = [16, 17, 18, 19, 20, 21, 22, 23]; + for (let i=0; i<4; i++) { + for (let j=0; j<30; j++) { + if (this.controls[i][j] && this.controls[i][j].value === e.keyCode) { + this.gameManager.simulateInput(i, j, (e.type === 'keyup' ? 0 : (special.includes(j) ? 0x7fff : 1))); + } + } + } + } + gamepadEvent(e) { + if (!this.started) return; + const value = function(value) { + if (value > 0.5 || value < -0.5) { + return (value > 0) ? 1 : -1; + } else { + return 0; + } + }(e.value || 0); + if (this.controlPopup.parentElement.parentElement.getAttribute("hidden") === null) { + if ('buttonup' === e.type || (e.type === "axischanged" && value === 0)) return; + const num = this.controlPopup.getAttribute("button-num"); + const player = parseInt(this.controlPopup.getAttribute("player-num")); + if (e.gamepadIndex !== player) return; + if (!this.controls[player][num]) { + this.controls[player][num] = {}; + } + this.controls[player][num].value2 = e.label; + this.controlPopup.parentElement.parentElement.setAttribute("hidden", ""); + this.checkGamepadInputs(); + this.saveSettings(); + return; + } + if (this.settingsMenu.style.display !== "none" || this.isPopupOpen()) return; + const special = [16, 17, 18, 19, 20, 21, 22, 23]; + for (let i=0; i<4; i++) { + if (e.gamepadIndex !== i) continue; + for (let j=0; j<30; j++) { + if (!this.controls[i][j] || this.controls[i][j].value2 === undefined) { + continue; + } + const controlValue = this.controls[i][j].value2; + + if (['buttonup', 'buttondown'].includes(e.type) && (controlValue === e.label || controlValue === e.index)) { + this.gameManager.simulateInput(i, j, (e.type === 'buttonup' ? 0 : (special.includes(j) ? 0x7fff : 1))); + } else if (e.type === "axischanged") { + if (typeof controlValue === 'string' && controlValue.split(":")[0] === e.axis) { + if (special.includes(j)) { + if (e.axis === 'LEFT_STICK_X') { + if (e.value > 0) { + this.gameManager.simulateInput(i, 16, 0x7fff * e.value); + this.gameManager.simulateInput(i, 17, 0); + } else { + this.gameManager.simulateInput(i, 17, -0x7fff * e.value); + this.gameManager.simulateInput(i, 16, 0); + } + } else if (e.axis === 'LEFT_STICK_Y') { + if (e.value > 0) { + this.gameManager.simulateInput(i, 18, 0x7fff * e.value); + this.gameManager.simulateInput(i, 19, 0); + } else { + this.gameManager.simulateInput(i, 19, -0x7fff * e.value); + this.gameManager.simulateInput(i, 18, 0); + } + } else if (e.axis === 'RIGHT_STICK_X') { + if (e.value > 0) { + this.gameManager.simulateInput(i, 20, 0x7fff * e.value); + this.gameManager.simulateInput(i, 21, 0); + } else { + this.gameManager.simulateInput(i, 21, -0x7fff * e.value); + this.gameManager.simulateInput(i, 20, 0); + } + } else if (e.axis === 'RIGHT_STICK_Y') { + if (e.value > 0) { + this.gameManager.simulateInput(i, 22, 0x7fff * e.value); + this.gameManager.simulateInput(i, 23, 0); + } else { + this.gameManager.simulateInput(i, 23, 0x7fff * e.value); + this.gameManager.simulateInput(i, 22, 0); + } + } + } else if (value === 0 || controlValue === e.label || controlValue === `${e.axis}:${value}`) { + this.gameManager.simulateInput(i, j, ((value === 0) ? 0 : 1)); + } + } + } + } + } + } + setVirtualGamepad() { + this.virtualGamepad = this.createElement("div"); + this.toggleVirtualGamepad = (show) => { + this.virtualGamepad.style.display = show ? "" : "none"; + } + this.virtualGamepad.classList.add("ejs_virtualGamepad_parent"); + this.elements.parent.appendChild(this.virtualGamepad); + + const speedControlButtons = [ + {"type":"button","text":"Fast","id":"speed-fast","location":"center","left":-35,"top":50,"fontSize":15,"block":true,"input_value":27}, + {"type":"button","text":"Slow","id":"speed-slow","location":"center","left":95,"top":50,"fontSize":15,"block":true,"input_value":29}, + ]; + if (this.rewindEnabled) { + speedControlButtons.push({"type":"button","text":"Rewind","id":"speed-rewind","location":"center","left":30,"top":50,"fontSize":15,"block":true,"input_value":28}); + } + + let info; + if (this.config.VirtualGamepadSettings && function(set) { + if (!Array.isArray(set)) { + console.warn("Virtual gamepad settings is not array! Using default gamepad settings"); + return false; + } + if (!set.length) { + console.warn("Virtual gamepad settings is empty! Using default gamepad settings"); + return false; + } + for (let i=0; i { + left.classList.toggle("ejs_virtualGamepad_left", !enabled); + right.classList.toggle("ejs_virtualGamepad_right", !enabled); + left.classList.toggle("ejs_virtualGamepad_right", enabled); + right.classList.toggle("ejs_virtualGamepad_left", enabled); + } + + const leftHandedMode = false; + const blockCSS = 'height:31px;text-align:center;border:1px solid #ccc;border-radius:5px;line-height:31px;'; + + for (let i=0; i { + e.preventDefault(); + if (e.type === 'touchend' || e.type === 'touchcancel') { + e.target.classList.remove("ejs_virtualGamepad_button_down"); + window.setTimeout(() => { + this.gameManager.simulateInput(0, value, 0); + }) + } else { + e.target.classList.add("ejs_virtualGamepad_button_down"); + this.gameManager.simulateInput(0, value, 1); + } + }) + } + } + + const createDPad = (opts) => { + const container = opts.container; + const callback = opts.event; + const dpadMain = this.createElement("div"); + dpadMain.classList.add("ejs_dpad_main"); + const vertical = this.createElement("div"); + vertical.classList.add("ejs_dpad_vertical"); + const horizontal = this.createElement("div"); + horizontal.classList.add("ejs_dpad_horizontal"); + const bar1 = this.createElement("div"); + bar1.classList.add("ejs_dpad_bar"); + const bar2 = this.createElement("div"); + bar2.classList.add("ejs_dpad_bar"); + + horizontal.appendChild(bar1); + vertical.appendChild(bar2); + dpadMain.appendChild(vertical); + dpadMain.appendChild(horizontal); + + const updateCb = (e) => { + e.preventDefault(); + const touch = e.targetTouches[0]; + if (!touch) return; + const rect = dpadMain.getBoundingClientRect(); + const x = touch.clientX - rect.left - dpadMain.clientWidth / 2; + const y = touch.clientY - rect.top - dpadMain.clientHeight / 2; + let up = 0, + down = 0, + left = 0, + right = 0, + angle = Math.atan(x / y) / (Math.PI / 180); + + if (y <= -10) { + up = 1; + } + if (y >= 10) { + down = 1; + } + + if (x >= 10) { + right = 1; + left = 0; + if (angle < 0 && angle >= -35 || angle > 0 && angle <= 35) { + right = 0; + } + up = (angle < 0 && angle >= -55 ? 1 : 0); + down = (angle > 0 && angle <= 55 ? 1 : 0); + } + + if (x <= -10) { + right = 0; + left = 1; + if (angle < 0 && angle >= -35 || angle > 0 && angle <= 35) { + left = 0; + } + up = (angle > 0 && angle <= 55 ? 1 : 0); + down = (angle < 0 && angle >= -55 ? 1 : 0); + } + + dpadMain.classList.toggle("ejs_dpad_up_pressed", up); + dpadMain.classList.toggle("ejs_dpad_down_pressed", down); + dpadMain.classList.toggle("ejs_dpad_right_pressed", right); + dpadMain.classList.toggle("ejs_dpad_left_pressed", left); + + callback(up, down, left, right); + } + const cancelCb = (e) => { + e.preventDefault(); + dpadMain.classList.remove("ejs_dpad_up_pressed"); + dpadMain.classList.remove("ejs_dpad_down_pressed"); + dpadMain.classList.remove("ejs_dpad_right_pressed"); + dpadMain.classList.remove("ejs_dpad_left_pressed"); + + callback(0, 0, 0, 0); + } + + this.addEventListener(dpadMain, 'touchstart touchmove', updateCb); + this.addEventListener(dpadMain, 'touchend touchcancel', cancelCb); + + + container.appendChild(dpadMain); + } + + info.forEach((dpad, index) => { + if (dpad.type !== 'dpad') return; + if (leftHandedMode && ['left', 'right'].includes(dpad.location)) { + dpad.location = (dpad.location==='left') ? 'right' : 'left'; + const amnt = JSON.parse(JSON.stringify(dpad)); + if (amnt.left) { + dpad.right = amnt.left; + } + if (amnt.right) { + dpad.left = amnt.right; + } + } + const elem = this.createElement("div"); + let style = ''; + if (dpad.left) { + style += 'left:'+dpad.left+';'; + } + if (dpad.right) { + style += 'right:'+dpad.right+';'; + } + if (dpad.top) { + style += 'top:'+dpad.top+';'; + } + elem.style = style; + elems[dpad.location].appendChild(elem); + createDPad({container: elem, event: (up, down, left, right) => { + if (dpad.joystickInput) { + if (up === 1) up=0x7fff; + if (down === 1) down=0x7fff; + if (left === 1) left=0x7fff; + if (right === 1) right=0x7fff; + } + this.gameManager.simulateInput(0, dpad.inputValues[0], up); + this.gameManager.simulateInput(0, dpad.inputValues[1], down); + this.gameManager.simulateInput(0, dpad.inputValues[2], left); + this.gameManager.simulateInput(0, dpad.inputValues[3], right); + }}); + }) + + + info.forEach((zone, index) => { + if (zone.type !== 'zone') return; + if (leftHandedMode && ['left', 'right'].includes(zone.location)) { + zone.location = (zone.location==='left') ? 'right' : 'left'; + const amnt = JSON.parse(JSON.stringify(zone)); + if (amnt.left) { + zone.right = amnt.left; + } + if (amnt.right) { + zone.left = amnt.right; + } + } + const elem = this.createElement("div"); + this.addEventListener(elem, "touchstart touchmove touchend touchcancel", (e) => { + e.preventDefault(); + }); + elems[zone.location].appendChild(elem); + const zoneObj = nipplejs.create({ + 'zone': elem, + 'mode': 'static', + 'position': { + 'left': zone.left, + 'top': zone.top + }, + 'color': zone.color || 'red' + }); + zoneObj.on('end', () => { + this.gameManager.simulateInput(0, zone.inputValues[0], 0); + this.gameManager.simulateInput(0, zone.inputValues[1], 0); + this.gameManager.simulateInput(0, zone.inputValues[2], 0); + this.gameManager.simulateInput(0, zone.inputValues[3], 0); + }); + zoneObj.on('move', (e, info) => { + const degree = info.angle.degree; + const distance = info.distance; + if (zone.joystickInput === true) { + let x = 0, y = 0; + if (degree > 0 && degree <= 45) { + x = distance / 50; + y = -0.022222222222222223 * degree * distance / 50; + } + if (degree > 45 && degree <= 90) { + x = 0.022222222222222223 * (90 - degree) * distance / 50; + y = -distance / 50; + } + if (degree > 90 && degree <= 135) { + x = 0.022222222222222223 * (90 - degree) * distance / 50; + y = -distance / 50; + } + if (degree > 135 && degree <= 180) { + x = -distance / 50; + y = -0.022222222222222223 * (180 - degree) * distance / 50; + } + if (degree > 135 && degree <= 225) { + x = -distance / 50; + y = -0.022222222222222223 * (180 - degree) * distance / 50; + } + if (degree > 225 && degree <= 270) { + x = -0.022222222222222223 * (270 - degree) * distance / 50; + y = distance / 50; + } + if (degree > 270 && degree <= 315) { + x = -0.022222222222222223 * (270 - degree) * distance / 50; + y = distance / 50; + } + if (degree > 315 && degree <= 359.9) { + x = distance / 50; + y = 0.022222222222222223 * (360 - degree) * distance / 50; + } + if (x > 0) { + this.gameManager.simulateInput(0, zone.inputValues[0], 0x7fff * x); + this.gameManager.simulateInput(0, zone.inputValues[1], 0); + } else { + this.gameManager.simulateInput(0, zone.inputValues[1], 0x7fff * -x); + this.gameManager.simulateInput(0, zone.inputValues[0], 0); + } + if (y > 0) { + this.gameManager.simulateInput(0, zone.inputValues[2], 0x7fff * y); + this.gameManager.simulateInput(0, zone.inputValues[3], 0); + } else { + this.gameManager.simulateInput(0, zone.inputValues[3], 0x7fff * -y); + this.gameManager.simulateInput(0, zone.inputValues[2], 0); + } + + } else { + if (degree >= 30 && degree < 150) { + this.gameManager.simulateInput(0, zone.inputValues[0], 1); + } else { + window.setTimeout(() => { + this.gameManager.simulateInput(0, zone.inputValues[0], 0); + }, 30); + } + if (degree >= 210 && degree < 330) { + this.gameManager.simulateInput(0, zone.inputValues[1], 1); + } else { + window.setTimeout(() => { + this.gameManager.simulateInput(0, zone.inputValues[1], 0); + }, 30); + } + if (degree >= 120 && degree < 240) { + this.gameManager.simulateInput(0, zone.inputValues[2], 1); + } else { + window.setTimeout(() => { + this.gameManager.simulateInput(0, zone.inputValues[2], 0); + }, 30); + } + if (degree >= 300 || degree >= 0 && degree < 60) { + this.gameManager.simulateInput(0, zone.inputValues[3], 1); + } else { + window.setTimeout(() => { + this.gameManager.simulateInput(0, zone.inputValues[3], 0); + }, 30); + } + } + }); + }) + + if (this.touch || navigator.maxTouchPoints > 0) { + const menuButton = this.createElement("div"); + menuButton.innerHTML = ''; + menuButton.classList.add("ejs_virtualGamepad_open"); + menuButton.style.display = "none"; + this.on("start", () => menuButton.style.display = ""); + this.elements.parent.appendChild(menuButton); + let timeout; + let ready = true; + this.addEventListener(menuButton, "touchstart touchend mousedown mouseup click", (e) => { + if (!ready) return; + clearTimeout(timeout); + timeout = setTimeout(() => { + ready = true; + }, 2000) + ready = false; + e.preventDefault(); + this.menu.toggle(); + }) + this.elements.menuToggle = menuButton; + } + + this.virtualGamepad.style.display = "none"; + } + handleResize() { + if (this.virtualGamepad) { + if (this.virtualGamepad.style.display === "none") { + this.virtualGamepad.style.opacity = 0; + this.virtualGamepad.style.display = ""; + setTimeout(() => { + this.virtualGamepad.style.display = "none"; + this.virtualGamepad.style.opacity = ""; + }, 250) + } + } + const positionInfo = this.elements.parent.getBoundingClientRect(); + this.game.parentElement.classList.toggle("ejs_small_screen", positionInfo.width <= 575); + //This wouldnt work using :not()... strange. + this.game.parentElement.classList.toggle("ejs_big_screen", positionInfo.width > 575); + + if (!this.Module) return; + const dpr = window.devicePixelRatio || 1; + const width = positionInfo.width * dpr; + const height = (positionInfo.height * dpr); + this.Module.setCanvasSize(width, height); + if (!this.handleSettingsResize) return; + this.handleSettingsResize(); + } + getElementSize(element) { + let elem = element.cloneNode(true); + elem.style.position = 'absolute'; + elem.style.opacity = 0; + elem.removeAttribute('hidden'); + element.parentNode.appendChild(elem); + const res = elem.getBoundingClientRect(); + elem.remove(); + return { + 'width': res.width, + 'height': res.height + }; + } + saveSettings() { + if (!window.localStorage || this.config.disableLocalStorage || !this.settingsLoaded) return; + const coreSpecific = { + controlSettings: this.controls, + settings: this.settings, + cheats: this.cheats + } + const ejs_settings = { + volume: this.volume, + muted: this.muted + } + localStorage.setItem("ejs-settings", JSON.stringify(ejs_settings)); + localStorage.setItem("ejs-"+this.getCore()+"-settings", JSON.stringify(coreSpecific)); + } + loadRewindEnabled() { + if (!window.localStorage || this.config.disableLocalStorage) { + if (this.config.defaultOptions && this.config.defaultOptions.rewindEnabled) { + return this.config.defaultOptions.rewindEnabled === 'enabled'; + } + return false; + } + let coreSpecific = localStorage.getItem("ejs-"+this.getCore()+"-settings"); + try { + coreSpecific = JSON.parse(coreSpecific); + if (!coreSpecific || !coreSpecific.settings) { + return false; + } + return coreSpecific.settings.rewindEnabled === 'enabled'; + } catch (e) { + console.warn("Could not load previous settings", e); + return false; + } + } + loadSettings() { + if (!window.localStorage || this.config.disableLocalStorage) return; + this.settingsLoaded = true; + let ejs_settings = localStorage.getItem("ejs-settings"); + let coreSpecific = localStorage.getItem("ejs-"+this.getCore()+"-settings"); + if (coreSpecific) { + try { + coreSpecific = JSON.parse(coreSpecific); + if (!(coreSpecific.controlSettings instanceof Object) || !(coreSpecific.settings instanceof Object) || !Array.isArray(coreSpecific.cheats)) return; + this.controls = coreSpecific.controlSettings; + this.checkGamepadInputs(); + for (const k in coreSpecific.settings) { + this.changeSettingOption(k, coreSpecific.settings[k]); + } + for (let i=0; i { + if (this.isFastForward) this.gameManager.toggleFastForward(1); + }, 10) + } else if (option === "fastForward") { + if (value === "enabled") { + this.isFastForward = true; + this.gameManager.toggleFastForward(1); + } else if (value === "disabled") { + this.isFastForward = false; + this.gameManager.toggleFastForward(0); + } + } else if (option === 'sm-ratio') { + if (this.isSlowMotion) this.gameManager.toggleSlowMotion(0); + this.gameManager.setSlowMotionRatio(parseFloat(value)); + setTimeout(() => { + if (this.isSlowMotion) this.gameManager.toggleSlowMotion(1); + }, 10); + } else if (option === 'slowMotion') { + if (value === "enabled") { + this.isSlowMotion = true; + this.gameManager.toggleSlowMotion(1); + } else if (value === "disabled") { + this.isSlowMotion = false; + this.gameManager.toggleSlowMotion(0); + } + } else if (option === "rewind-granularity") { + if (this.rewindEnabled) { + this.gameManager.setRewindGranularity(parseInt(value)); + } + } + this.gameManager.setVariable(option, value); + this.saveSettings(); + } + setupSettingsMenu() { + this.settingsMenu = this.createElement("div"); + this.settingsMenu.classList.add("ejs_settings_parent"); + const nested = this.createElement("div"); + nested.classList.add("ejs_settings_transition"); + this.settings = {}; + + const home = this.createElement("div"); + home.style.overflow = "auto"; + const menus = []; + this.handleSettingsResize = () => { + let needChange = false; + if (this.settingsMenu.style.display !== "") { + this.settingsMenu.style.opacity = "0"; + this.settingsMenu.style.display = ""; + needChange = true; + } + let height = this.elements.parent.getBoundingClientRect().height; + let w2 = this.settingParent.parentElement.getBoundingClientRect().width; + let settingsX = this.settingParent.getBoundingClientRect().x; + if (w2 > window.innerWidth) settingsX += (w2 - window.innerWidth); + const onTheRight = settingsX > (w2-15)/2; + if (height > 375) height = 375; + home.style['max-height'] = (height - 95) + "px"; + nested.style['max-height'] = (height - 95) + "px"; + for (let i=0; i { + this.settings[title] = newValue; + funcs.forEach(e => e(title)); + } + let allOpts = {}; + + const addToMenu = (title, id, options, defaultOption) => { + const menuOption = this.createElement("div"); + menuOption.classList.add("ejs_settings_main_bar"); + const span = this.createElement("span"); + span.innerText = title; + + const current = this.createElement("div"); + current.innerText = ""; + current.classList.add("ejs_settings_main_bar_selected"); + span.appendChild(current); + + menuOption.appendChild(span); + home.appendChild(menuOption); + + const menu = this.createElement("div"); + menus.push(menu); + menu.style.overflow = "auto"; + menu.setAttribute("hidden", ""); + const button = this.createElement("button"); + const goToHome = () => { + const homeSize = this.getElementSize(home); + nested.style.width = (homeSize.width+20) + "px"; + nested.style.height = homeSize.height + "px"; + menu.setAttribute("hidden", ""); + home.removeAttribute("hidden"); + } + this.addEventListener(menuOption, "click", (e) => { + const targetSize = this.getElementSize(menu); + nested.style.width = (targetSize.width+20) + "px"; + nested.style.height = targetSize.height + "px"; + menu.removeAttribute("hidden"); + home.setAttribute("hidden", ""); + }) + this.addEventListener(button, "click", goToHome); + + button.type = "button"; + button.classList.add("ejs_back_button"); + menu.appendChild(button); + const pageTitle = this.createElement("span"); + pageTitle.innerText = title; + pageTitle.classList.add("ejs_menu_text_a"); + button.appendChild(pageTitle); + + const optionsMenu = this.createElement("div"); + optionsMenu.classList.add("ejs_setting_menu"); + //optionsMenu.style["max-height"] = "385px"; + //optionsMenu.style.overflow = "auto"; + + let buttons = []; + let opts = options; + if (Array.isArray(options)) { + opts = {}; + for (let i=0; i { + if (id !== title) return; + for (let j=0; j { + this.settings[id] = opt; + for (let j=0; j 1) { + const diskLabels = {}; + for (let i=0; i 0) { + addToMenu(this.localization('Virtual Gamepad'), 'virtual-gamepad', { + 'enabled': this.localization("Enabled"), + 'disabled': this.localization("Disabled") + }, this.isMobile ? 'enabled' : 'disabled'); + addToMenu(this.localization('Left Handed Mode'), 'virtual-gamepad-left-handed-mode', { + 'enabled': this.localization("Enabled"), + 'disabled': this.localization("Disabled") + }, 'disabled'); + } + let coreOpts; + try { + coreOpts = this.gameManager.getCoreOptions(); + } catch(e){} + if (coreOpts) { + coreOpts.split('\n').forEach((line, index) => { + let option = line.split('; '); + let name = option[0]; + let options = option[1].split('|'), + optionName = name.split("|")[0].replace(/_/g, ' ').replace(/.+\-(.+)/, '$1'); + options.slice(1, -1); + if (options.length === 1) return; + let availableOptions = {}; + for (let i=0; i 1) ? name.split("|")[1] : options[0].replace('(Default) ', '')); + }) + } + + this.settingsMenu.appendChild(nested); + + this.settingParent.appendChild(this.settingsMenu); + this.settingParent.style.position = "relative"; + + const homeSize = this.getElementSize(home); + nested.style.width = (homeSize.width+20) + "px"; + nested.style.height = homeSize.height + "px"; + + this.settingsMenu.style.display = "none"; + + if (this.debug) { + console.log("Available core options", allOpts); + } + + if (this.config.defaultOptions) { + for (const k in this.config.defaultOptions) { + this.changeSettingOption(k, this.config.defaultOptions[k]); + } + } + } + createSubPopup(hidden) { + const popup = this.createElement('div'); + popup.classList.add("ejs_popup_container"); + popup.classList.add("ejs_popup_container_box"); + const popupMsg = this.createElement("div"); + popupMsg.innerText = ""; + if (hidden) popup.setAttribute("hidden", ""); + popup.appendChild(popupMsg); + return [popup, popupMsg]; + } + createNetplayMenu() { + const body = this.createPopup("Netplay", { + "Create a Room": () => { + if (this.isNetplay) { + this.netplay.leaveRoom(); + } else { + this.netplay.showOpenRoomDialog(); + } + }, + "Close": () => { + this.netplayMenu.style.display = "none"; + this.netplay.updateList.stop(); + } + }, true); + this.netplayMenu = body.parentElement; + const createButton = this.netplayMenu.getElementsByTagName("a")[0]; + const rooms = this.createElement("div"); + const title = this.createElement("strong"); + title.innerText = this.localization("Rooms"); + const table = this.createElement("table"); + table.classList.add("ejs_netplay_table"); + table.style.width = "100%"; + table.setAttribute("cellspacing", "0"); + const thead = this.createElement("thead"); + const row = this.createElement("tr"); + const addToHeader = (text) => { + const item = this.createElement("td"); + item.innerText = text; + item.style["text-align"] = "center"; + row.appendChild(item); + return item; + } + thead.appendChild(row); + addToHeader("Room Name").style["text-align"] = "left"; + addToHeader("Players").style.width = "80px"; + addToHeader("").style.width = "80px"; //"join" button + table.appendChild(thead); + const tbody = this.createElement("tbody"); + + table.appendChild(tbody); + rooms.appendChild(title); + rooms.appendChild(table); + + + const joined = this.createElement("div"); + const title2 = this.createElement("strong"); + title2.innerText = "{roomname}"; + const password = this.createElement("div"); + password.innerText = "Password: "; + const table2 = this.createElement("table"); + table2.classList.add("ejs_netplay_table"); + table2.style.width = "100%"; + table2.setAttribute("cellspacing", "0"); + const thead2 = this.createElement("thead"); + const row2 = this.createElement("tr"); + const addToHeader2 = (text) => { + const item = this.createElement("td"); + item.innerText = text; + row2.appendChild(item); + return item; + } + thead2.appendChild(row2); + addToHeader2("Player").style.width = "80px"; + addToHeader2("Name"); + addToHeader2("").style.width = "80px"; //"join" button + table2.appendChild(thead2); + const tbody2 = this.createElement("tbody"); + + table2.appendChild(tbody2); + joined.appendChild(title2); + joined.appendChild(password); + joined.appendChild(table2); + + joined.style.display = "none"; + body.appendChild(rooms); + body.appendChild(joined); + + this.openNetplayMenu = () => { + this.netplayMenu.style.display = ""; + if (!this.netplay || (this.netplay && !this.netplay.name)) { + this.netplay = {}; + this.netplay.table = tbody; + this.netplay.playerTable = tbody2; + this.netplay.passwordElem = password; + this.netplay.roomNameElem = title2; + this.netplay.createButton = createButton; + this.netplay.tabs = [rooms, joined]; + this.defineNetplayFunctions(); + const popups = this.createSubPopup(); + this.netplayMenu.appendChild(popups[0]); + popups[1].classList.add("ejs_cheat_parent"); //Hehe + const popup = popups[1]; + + const header = this.createElement("div"); + const title = this.createElement("h2"); + title.innerText = this.localization("Set Player Name"); + title.classList.add("ejs_netplay_name_heading"); + header.appendChild(title); + popup.appendChild(header); + + const main = this.createElement("div"); + main.classList.add("ejs_netplay_header"); + const head = this.createElement("strong"); + head.innerText = this.localization("Player Name"); + const input = this.createElement("input"); + input.type = "text"; + input.setAttribute("maxlength", 20); + + main.appendChild(head); + main.appendChild(this.createElement("br")); + main.appendChild(input); + popup.appendChild(main); + + popup.appendChild(this.createElement("br")); + const submit = this.createElement("button"); + submit.classList.add("ejs_button_button"); + submit.classList.add("ejs_popup_submit"); + submit.style["background-color"] = "rgba(var(--ejs-primary-color),1)"; + submit.innerText = this.localization("Submit"); + popup.appendChild(submit); + this.addEventListener(submit, "click", (e) => { + if (!input.value.trim()) return; + this.netplay.name = input.value.trim(); + popups[0].remove(); + }) + } + this.netplay.updateList.start(); + } + } + defineNetplayFunctions() { + function guidGenerator() { + const S4 = function() { + return (((1+Math.random())*0x10000)|0).toString(16).substring(1); + }; + return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4()); + } + this.netplay.url = this.config.netplayUrl; + while (this.netplay.url.endsWith("/")) { + this.netplay.url = this.netplay.url.substring(0, this.netplay.url.length-1); + } + this.netplay.current_frame = 0; + this.netplay.getOpenRooms = async () => { + return JSON.parse(await (await fetch(this.netplay.url+"/list?domain="+window.location.host+"&game_id="+this.config.gameId)).text()); + } + this.netplay.updateTableList = async () => { + const addToTable = (id, name, current, max) => { + const row = this.createElement("tr"); + row.classList.add("ejs_netplay_table_row"); + const addToHeader = (text) => { + const item = this.createElement("td"); + item.innerText = text; + item.style.padding = "10px 0"; + item.style["text-align"] = "center"; + row.appendChild(item); + return item; + } + addToHeader(name).style["text-align"] = "left"; + addToHeader(current + "/" + max).style.width = "80px"; + + const parent = addToHeader(""); + parent.style.width = "80px"; + this.netplay.table.appendChild(row); + if (current < max) { + const join = this.createElement("button"); + join.classList.add("ejs_netplay_join_button"); + join.classList.add("ejs_button_button"); + join.style["background-color"] = "rgba(var(--ejs-primary-color),1)"; + join.innerText = this.localization("Join"); + parent.appendChild(join); + this.addEventListener(join, "click", (e) => { + this.netplay.joinRoom(id, name); + }) + return join; + } + } + const open = await this.netplay.getOpenRooms(); + //console.log(open); + this.netplay.table.innerHTML = ""; + for (const k in open) { + addToTable(k, open[k].room_name, open[k].current, open[k].max);//todo: password + } + } + this.netplay.showOpenRoomDialog = () => { + const popups = this.createSubPopup(); + this.netplayMenu.appendChild(popups[0]); + popups[1].classList.add("ejs_cheat_parent"); //Hehe + const popup = popups[1]; + + const header = this.createElement("div"); + const title = this.createElement("h2"); + title.innerText = this.localization("Create a room"); + title.classList.add("ejs_netplay_name_heading"); + header.appendChild(title); + popup.appendChild(header); + + const main = this.createElement("div"); + + main.classList.add("ejs_netplay_header"); + const rnhead = this.createElement("strong"); + rnhead.innerText = this.localization("Room Name"); + const rninput = this.createElement("input"); + rninput.type = "text"; + rninput.setAttribute("maxlength", 20); + + const maxhead = this.createElement("strong"); + maxhead.innerText = this.localization("Max Players"); + const maxinput = this.createElement("select"); + maxinput.setAttribute("disabled", "disabled"); + const val2 = this.createElement("option"); + val2.value = 2; + val2.innerText = "2"; + const val3 = this.createElement("option"); + val3.value = 3; + val3.innerText = "3"; + const val4 = this.createElement("option"); + val4.value = 4; + val4.innerText = "4"; + maxinput.appendChild(val2); + maxinput.appendChild(val3); + maxinput.appendChild(val4); + + + const pwhead = this.createElement("strong"); + pwhead.innerText = this.localization("Password (optional)"); + const pwinput = this.createElement("input"); + pwinput.type = "text"; + pwinput.setAttribute("maxlength", 20); + + main.appendChild(rnhead); + main.appendChild(this.createElement("br")); + main.appendChild(rninput); + + main.appendChild(maxhead); + main.appendChild(this.createElement("br")); + main.appendChild(maxinput); + + main.appendChild(pwhead); + main.appendChild(this.createElement("br")); + main.appendChild(pwinput); + + popup.appendChild(main); + + popup.appendChild(this.createElement("br")); + const submit = this.createElement("button"); + submit.classList.add("ejs_button_button"); + submit.classList.add("ejs_popup_submit"); + submit.style["background-color"] = "rgba(var(--ejs-primary-color),1)"; + submit.style.margin = "0 10px"; + submit.innerText = this.localization("Submit"); + popup.appendChild(submit); + this.addEventListener(submit, "click", (e) => { + if (!rninput.value.trim()) return; + this.netplay.openRoom(rninput.value.trim(), parseInt(maxinput.value), pwinput.value.trim()); + popups[0].remove(); + }) + const close = this.createElement("button"); + close.classList.add("ejs_button_button"); + close.classList.add("ejs_popup_submit"); + close.style.margin = "0 10px"; + close.innerText = this.localization("Close"); + popup.appendChild(close); + this.addEventListener(close, "click", (e) => { + popups[0].remove(); + }) + } + this.netplay.startSocketIO = (callback) => { + this.netplay.socket = io(this.netplay.url); + this.netplay.socket.on("connect", () => callback()); + this.netplay.socket.on("users-updated", (users) => { + this.netplay.reset(); + if (this.debug) console.log(users); + this.netplay.players = users; + this.netplay.updatePlayersTable(); + if (this.netplay.owner) this.netplay.sync(); + }) + this.netplay.socket.on("disconnect", () => this.netplay.roomLeft()); + this.netplay.socket.on("data-message", (data) => { + this.netplay.dataMessage(data); + }) + } + this.netplay.openRoom = (roomName, maxPlayers, password) => { + const sessionid = guidGenerator(); + this.netplay.playerID = guidGenerator(); + this.netplay.players = {}; + this.netplay.extra = { + domain: window.location.host, + game_id: this.config.gameId, + room_name: roomName, + player_name: this.netplay.name, + userid: this.netplay.playerID, + sessionid: sessionid + } + this.netplay.players[this.netplay.playerID] = this.netplay.extra; + this.netplay.users = {}; + + this.netplay.startSocketIO((error) => { + this.netplay.socket.emit("open-room", { + extra: this.netplay.extra, + maxPlayers: maxPlayers, + password: password + }, (error) => { + if (error) { + if (this.debug) console.log("error: ", error); + return; + } + this.netplay.roomJoined(true, roomName, password, sessionid); + }) + }); + } + this.netplay.leaveRoom = () => { + if (this.debug) console.log("asd"); + this.netplay.roomLeft(); + } + this.netplay.joinRoom = (sessionid, roomName) => { + this.netplay.playerID = guidGenerator(); + this.netplay.players = {}; + this.netplay.extra = { + domain: window.location.host, + game_id: this.config.gameId, + room_name: roomName, + player_name: this.netplay.name, + userid: this.netplay.playerID, + sessionid: sessionid + } + this.netplay.players[this.netplay.playerID] = this.netplay.extra; + + this.netplay.startSocketIO((error) => { + this.netplay.socket.emit("join-room", { + extra: this.netplay.extra//, + //password: password + }, (error, users) => { + if (error) { + if (this.debug) console.log("error: ", error); + return; + } + this.netplay.players = users; + //this.netplay.roomJoined(false, roomName, password, sessionid); + this.netplay.roomJoined(false, roomName, "", sessionid); + }) + }); + } + this.netplay.roomJoined = (isOwner, roomName, password, roomId) => { + //Will already assume this.netplay.players has been refreshed + this.isNetplay = true; + this.netplay.inputs = {}; + this.netplay.owner = isOwner; + if (this.debug) console.log(this.netplay.extra); + this.netplay.roomNameElem.innerText = roomName; + this.netplay.tabs[0].style.display = "none"; + this.netplay.tabs[1].style.display = ""; + if (password) { + this.netplay.passwordElem.style.display = ""; + this.netplay.passwordElem.innerText = this.localization("Password")+": "+password + } else { + this.netplay.passwordElem.style.display = "none"; + } + this.netplay.createButton.innerText = this.localization("Leave Room"); + this.netplay.updatePlayersTable(); + if (!this.netplay.owner) { + this.netplay.oldStyles = [ + this.elements.bottomBar.cheat[0].style.display, + this.elements.bottomBar.playPause[0].style.display, + this.elements.bottomBar.playPause[1].style.display, + this.elements.bottomBar.restart[0].style.display, + this.elements.bottomBar.loadState[0].style.display, + this.elements.bottomBar.saveState[0].style.display, + this.elements.bottomBar.saveSavFiles[0].style.display, + this.elements.bottomBar.loadSavFiles[0].style.display, + this.elements.contextMenu.save.style.display, + this.elements.contextMenu.load.style.display + ] + this.elements.bottomBar.cheat[0].style.display = "none"; + this.elements.bottomBar.playPause[0].style.display = "none"; + this.elements.bottomBar.playPause[1].style.display = "none"; + this.elements.bottomBar.restart[0].style.display = "none"; + this.elements.bottomBar.loadState[0].style.display = "none"; + this.elements.bottomBar.saveState[0].style.display = "none"; + this.elements.bottomBar.saveSavFiles[0].style.display = "none"; + this.elements.bottomBar.loadSavFiles[0].style.display = "none"; + this.elements.contextMenu.save.style.display = "none"; + this.elements.contextMenu.load.style.display = "none"; + this.gameManager.resetCheat(); + } else { + this.netplay.oldStyles = [ + this.elements.bottomBar.cheat[0].style.display + ] + } + this.elements.bottomBar.cheat[0].style.display = "none"; + } + this.netplay.updatePlayersTable = () => { + const table = this.netplay.playerTable; + table.innerHTML = ""; + const addToTable = (num, playerName) => { + const row = this.createElement("tr"); + const addToHeader = (text) => { + const item = this.createElement("td"); + item.innerText = text; + row.appendChild(item); + return item; + } + addToHeader(num).style.width = "80px"; + addToHeader(playerName); + addToHeader("").style.width = "80px"; //"join" button + table.appendChild(row); + } + let i=1; + for (const k in this.netplay.players) { + addToTable(i, this.netplay.players[k].player_name); + i++; + } + } + this.netplay.roomLeft = () => { + this.isNetplay = false; + this.netplay.tabs[0].style.display = ""; + this.netplay.tabs[1].style.display = "none"; + this.netplay.extra = null; + this.netplay.playerID = null; + this.netplay.createButton.innerText = this.localization("Create a Room"); + this.netplay.socket.disconnect(); + this.elements.bottomBar.cheat[0].style.display = this.netplay.oldStyles[0]; + if (!this.netplay.owner) { + this.elements.bottomBar.playPause[0].style.display = this.netplay.oldStyles[1]; + this.elements.bottomBar.playPause[1].style.display = this.netplay.oldStyles[2]; + this.elements.bottomBar.restart[0].style.display = this.netplay.oldStyles[3]; + this.elements.bottomBar.loadState[0].style.display = this.netplay.oldStyles[4]; + this.elements.bottomBar.saveState[0].style.display = this.netplay.oldStyles[5]; + this.elements.bottomBar.saveSavFiles[0].style.display = this.netplay.oldStyles[6]; + this.elements.bottomBar.loadSavFiles[0].style.display = this.netplay.oldStyles[7]; + this.elements.contextMenu.save.style.display = this.netplay.oldStyles[8]; + this.elements.contextMenu.load.style.display = this.netplay.oldStyles[9]; + } + this.updateCheatUI(); + } + this.netplay.setLoading = (loading) => { + if (this.debug) console.log("loading:", loading); + } + let syncing = false; + this.netplay.sync = async () => { + if (syncing) return; + syncing = true; + if (this.debug) console.log("sync") + this.netplay.ready = 0; + const state = this.gameManager.getState(); + this.netplay.sendMessage({ + state: state + }); + this.netplay.setLoading(true); + this.pause(true); + this.netplay.ready++; + this.netplay.current_frame = 0; + if (this.netplay.ready === this.netplay.getUserCount()) { + this.play(true); + } + syncing = false; + } + this.netplay.getUserIndex = (user) => { + let i=0; + for (const k in this.netplay.players) { + if (k === user) return i; + i++; + } + return -1; + } + this.netplay.getUserCount = () => { + let i=0; + for (const k in this.netplay.players) i++; + return i; + } + let justReset = false; + this.netplay.dataMessage = (data) => { + //console.log(data); + if (data.sync === true && this.netplay.owner) { + this.netplay.sync(); + } + if (data.state) { + this.netplay.wait = true; + this.netplay.setLoading(true); + this.pause(true); + this.gameManager.loadState(new Uint8Array(data.state)); + this.netplay.sendMessage({ready:true}); + } + if (data.play && !this.owner) { + this.play(true); + } + if (data.pause && !this.owner) { + this.pause(true); + } + if (data.ready && this.netplay.owner) { + this.netplay.ready++; + if (this.netplay.ready === this.netplay.getUserCount()) { + this.netplay.sendMessage({readyready:true}); + this.netplay.reset(); + setTimeout(() => this.play(true), 48); + this.netplay.setLoading(false); + } + } + if (data.readyready) { + this.netplay.setLoading(false); + this.netplay.reset(); + this.play(true); + } + if (data.shortPause) console.log(data.shortPause); + if (data.shortPause && data.shortPause !== this.netplay.playerID) { + this.pause(true); + this.netplay.wait = true; + setTimeout(() => this.play(true), 48); + } + if (data["sync-control"]) { + data["sync-control"].forEach((value) => { + let inFrame = parseInt(value.frame); + let frame = this.netplay.currentFrame; + if (!value.connected_input || value.connected_input[0] < 0) return; + //if (value.connected_input[0] === this.netplay.getUserIndex(this.netplay.playerID)) return; + console.log(value, inFrame, frame); + if (inFrame === frame) { + inFrame++; + this.gameManager.functions.simulateInput(value.connected_input[0], value.connected_input[1], value.connected_input[2]); + } + this.netplay.inputsData[inFrame] || (this.netplay.inputsData[inFrame] = []); + this.netplay.inputsData[frame] || (this.netplay.inputsData[frame] = []); + if (this.netplay.owner) { + this.netplay.inputsData[frame].push(value); + this.gameManager.functions.simulateInput(value.connected_input[0], value.connected_input[1], value.connected_input[2]); + if (frame - 10 >= inFrame) { + this.netplay.wait = true; + this.pause(true); + setTimeout(() => { + this.play(true); + this.netplay.wait = false; + }, 48) + } + } else { + this.netplay.inputsData[inFrame].push(value); + if (this.netplay.inputsData[frame]) { + this.play(true); + } + if (frame + 10 <= inFrame && inFrame > this.netplay.init_frame + 100) { + this.netplay.sendMessage({shortPause:this.netplay.playerID}); + } + } + }); + } + if (data.restart) { + this.gameManager.restart(); + this.netplay.reset(); + this.play(true); + } + } + this.netplay.simulateInput = (player, index, value, resp) => { + if (!this.isNetplay) return; + if (player !== 0 && !resp) return; + player = this.netplay.getUserIndex(this.netplay.playerID); + let frame = this.netplay.currentFrame; + if (this.netplay.owner) { + if (!this.netplay.inputsData[frame]) { + this.netplay.inputsData[frame] = []; + } + this.netplay.inputsData[frame].push({ + frame: frame, + connected_input: [player, index, value] + }) + this.gameManager.functions.simulateInput(player, index, value); + } else { + this.netplay.sendMessage({ + "sync-control": [{ + frame: frame+10, + connected_input: [player, index, value] + }] + }) + } + } + this.netplay.sendMessage = (data) => { + this.netplay.socket.emit("data-message", data); + } + this.netplay.reset = () => { + this.netplay.init_frame = this.netplay.currentFrame; + this.netplay.inputsData = {}; + } + //let fps; + //let lastTime; + this.netplay.init_frame = 0; + this.netplay.currentFrame = 0; + this.netplay.inputsData = {}; + this.Module.postMainLoop = () => { + //const newTime = window.performance.now(); + //fps = 1000 / (newTime - lastTime); + //console.log(fps); + //lastTime = newTime; + + //frame syncing - working + //control syncing - broken + this.netplay.currentFrame = parseInt(this.gameManager.getFrameNum()) - this.netplay.init_frame; + if (!this.isNetplay) return; + if (this.netplay.owner) { + let to_send = []; + let i = this.netplay.currentFrame-1; + this.netplay.inputsData[i] ? this.netplay.inputsData[i].forEach((value) => { + value.frame+=10; + to_send.push(value); + }) : to_send.push({frame: i+10}); + this.netplay.sendMessage({"sync-control": to_send}); + } else { + if (this.netplay.currentFrame <= 0 || this.netplay.inputsData[this.netplay.currentFrame]) { + this.netplay.wait = false; + this.play(); + this.netplay.inputsData[this.netplay.currentFrame].forEach((value) => { + if (!value.connected_input) return; + console.log(value.connected_input); + this.gameManager.functions.simulateInput(value.connected_input[0], value.connected_input[1], value.connected_input[2]); + }) + } else if (!this.netplay.syncing) { + console.log("sync"); + this.pause(true); + this.netplay.sendMessage({sync:true}); + this.netplay.syncing = true; + } + } + if (this.netplay.currentFrame % 100 === 0) { + Object.keys(this.netplay.inputsData).forEach(value => { + if (value < this.netplay.currentFrame - 50) { + this.netplay.inputsData[value] = null; + delete this.netplay.inputsData[value]; + } + }) + } + + + } + + this.netplay.updateList = { + start: () => { + this.netplay.updateList.interval = setInterval(this.netplay.updateTableList.bind(this), 1000); + }, + stop: () => { + clearInterval(this.netplay.updateList.interval); + } + } + } + createCheatsMenu() { + const body = this.createPopup("Cheats", { + "Add Cheat": () => { + const popups = this.createSubPopup(); + this.cheatMenu.appendChild(popups[0]); + popups[1].classList.add("ejs_cheat_parent"); + popups[1].style.width = "100%"; + const popup = popups[1]; + const header = this.createElement("div"); + header.classList.add("ejs_cheat_header"); + const title = this.createElement("h2"); + title.innerText = this.localization("Add Cheat Code"); + title.classList.add("ejs_cheat_heading"); + const close = this.createElement("button"); + close.classList.add("ejs_cheat_close"); + header.appendChild(title); + header.appendChild(close); + popup.appendChild(header); + this.addEventListener(close, "click", (e) => { + popups[0].remove(); + }) + + const main = this.createElement("div"); + main.classList.add("ejs_cheat_main"); + const header3 = this.createElement("strong"); + header3.innerText = this.localization("Code"); + main.appendChild(header3); + main.appendChild(this.createElement("br")); + const mainText = this.createElement("textarea"); + mainText.classList.add("ejs_cheat_code"); + mainText.style.width = "100%"; + mainText.style.height = "80px"; + main.appendChild(mainText); + main.appendChild(this.createElement("br")); + const header2 = this.createElement("strong"); + header2.innerText = this.localization("Description"); + main.appendChild(header2); + main.appendChild(this.createElement("br")); + const mainText2 = this.createElement("input"); + mainText2.type = "text"; + mainText2.classList.add("ejs_cheat_code"); + main.appendChild(mainText2); + main.appendChild(this.createElement("br")); + popup.appendChild(main); + + const footer = this.createElement("footer"); + const submit = this.createElement("button"); + const closeButton = this.createElement("button"); + submit.innerText = this.localization("Submit"); + closeButton.innerText = this.localization("Close"); + submit.classList.add("ejs_button_button"); + closeButton.classList.add("ejs_button_button"); + submit.classList.add("ejs_popup_submit"); + closeButton.classList.add("ejs_popup_submit"); + submit.style["background-color"] = "rgba(var(--ejs-primary-color),1)"; + footer.appendChild(submit); + const span = this.createElement("span"); + span.innerText = " "; + footer.appendChild(span); + footer.appendChild(closeButton); + popup.appendChild(footer); + + this.addEventListener(submit, "click", (e) => { + if (!mainText.value.trim() || !mainText2.value.trim()) return; + popups[0].remove(); + this.cheats.push({ + code: mainText.value, + desc: mainText2.value, + checked: false + }); + this.updateCheatUI(); + this.saveSettings(); + }) + this.addEventListener(closeButton, "click", (e) => { + popups[0].remove(); + }) + + }, + "Close": () => { + this.cheatMenu.style.display = "none"; + } + }, true); + this.cheatMenu = body.parentElement; + this.cheatMenu.getElementsByTagName("h4")[0].style["padding-bottom"] = "0px"; + const msg = this.createElement("div"); + msg.style["padding-top"] = "0px"; + msg.style["padding-bottom"] = "15px"; + msg.innerText = "Note that some cheats require a restart to disable."; + body.appendChild(msg); + const rows = this.createElement("div"); + body.appendChild(rows); + rows.classList.add("ejs_cheat_rows"); + this.elements.cheatRows = rows; + } + updateCheatUI() { + this.elements.cheatRows.innerHTML = ""; + + const addToMenu = (desc, checked, code, is_permanent, i) => { + const row = this.createElement("div"); + row.classList.add("ejs_cheat_row"); + const input = this.createElement("input"); + input.type = "checkbox"; + input.checked = checked; + input.value = i; + input.id = "ejs_cheat_switch_"+i; + row.appendChild(input); + const label = this.createElement("label"); + label.for = "ejs_cheat_switch_"+i; + label.innerText = desc; + row.appendChild(label); + label.addEventListener("click", (e) => { + input.checked = !input.checked; + this.cheats[i].checked = input.checked; + this.cheatChanged(input.checked, code, i); + this.saveSettings(); + }) + if (!is_permanent) { + const close = this.createElement("a"); + close.classList.add("ejs_cheat_row_button"); + close.innerText = "×"; + row.appendChild(close); + close.addEventListener("click", (e) => { + this.cheatChanged(false, code, i); + this.cheats.splice(i, 1); + this.updateCheatUI(); + this.saveSettings(); + }) + } + this.elements.cheatRows.appendChild(row); + this.cheatChanged(checked, code, i); + } + this.gameManager.resetCheat(); + for (let i=0; i node.connect(merger)); + + const destination = audioContext.createMediaStreamDestination(); + merger.connect(destination); + + const audioTracks = destination.stream.getAudioTracks(); + if (audioTracks.length !== 0) { + audioTrack = audioTracks[0]; + } + } + + const stream = new MediaStream(); + if (videoTrack && videoTrack.readyState === 'live') { + stream.addTrack(videoTrack); + } + if (audioTrack && audioTrack.readyState === 'live') { + stream.addTrack(audioTrack); + } + return stream; + } + + screenRecord() { + const captureScreenWidth= (this.config.screenRecording && (typeof this.config.screenRecording.width == "number")) ? this.config.screenRecording.width : 800; + const captureScreenHeight = (this.config.screenRecording && (typeof this.config.screenRecording.height == "number")) ? this.config.screenRecording.height : 600; + const captureFps = (this.config.screenRecording && (typeof this.config.screenRecording.fps == "number")) ? this.config.screenRecording.fps : 30; + const captureVideoBitrate = (this.config.screenRecording && (typeof this.config.screenRecording.videoBitrate == "number")) ? this.config.screenRecording.videoBitrate : 2 * 1024 * 1014; + const captureAudioBitrate = (this.config.screenRecording && (typeof this.config.screenRecording.audioBitrate == "number")) ? this.config.screenRecording.audioBitrate : 256 * 1024; + + const captureCanvas = document.createElement('canvas'); + captureCanvas.width = captureScreenWidth; + captureCanvas.height = captureScreenHeight; + captureCanvas.style.position = 'absolute'; + captureCanvas.style.top = '-999px'; + captureCanvas.style.bottom = '-999px'; + document.getElementsByTagName('body')[0].append(captureCanvas); + + const captureCtx = captureCanvas.getContext('2d', { alpha: false }); + captureCtx.fillStyle = '#000'; + + let animation = true; + + const drawNextFrame = () => { + const scaleX = captureScreenWidth / this.canvas.width; + const scaleY = captureScreenHeight / this.canvas.height; + const scale = Math.max(scaleY, scaleX); + const width = this.canvas.width * scale; + const height = this.canvas.height * scale; + const startX = (captureScreenWidth - width) / 2; + const startY = (captureScreenHeight - height) / 2; + captureCtx.drawImage(this.canvas, Math.round(startX), Math.round(startY), Math.round(width), Math.round(height)); + if (animation) { + requestAnimationFrame(drawNextFrame); + } + }; + requestAnimationFrame(drawNextFrame); + + const chunks = []; + const tracks = this.collectScreenRecordingMediaTracks(captureCanvas, captureFps); + const recorder = new MediaRecorder(tracks, { + videoBitsPerSecond: captureVideoBitrate, + audioBitsPerSecond: captureAudioBitrate, + }); + recorder.addEventListener('dataavailable', e => { + chunks.push(e.data); + }); + recorder.addEventListener('stop', () => { + const blob = new Blob(chunks); + const url = URL.createObjectURL(blob); + const date = new Date(); + const a = document.createElement('a'); + a.href = url; + a.download = this.getBaseFileName()+"-"+date.getMonth()+"-"+date.getDate()+"-"+date.getFullYear()+".webm"; + a.click(); + + animation = false; + captureCanvas.remove(); + }); + recorder.start(); + + return recorder; + } + +} +window.EmulatorJS = EmulatorJS; diff --git a/semag/emulatorjs/data/emulator.min.css b/semag/emulatorjs/data/emulator.min.css index ad240a65..2bab0f1e 100644 --- a/semag/emulatorjs/data/emulator.min.css +++ b/semag/emulatorjs/data/emulator.min.css @@ -1 +1 @@ -.ejs_parent{background:#000;overflow:hidden;position:relative;font-family:Avenir,"Avenir Next","Helvetica Neue","Segoe UI",Helvetica,Arial,sans-serif;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;font-weight:500;line-height:1.7;width:100%;height:100%;color:#bcbcbc;outline-width:0;outline:0;font-size:14px}.ejs_parent *,.ejs_parent *::after,.ejs_parent *::before{font-family:Avenir,"Avenir Next","Helvetica Neue","Segoe UI",Helvetica,Arial,sans-serif;box-sizing:border-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ejs_parent ::-webkit-scrollbar{width:8px;height:16px;background-color:transparent}.ejs_parent ::-webkit-scrollbar-thumb{border-radius:0;-webkit-box-shadow:inset 0 0 6px rgba(0,0,0,0.3);background-color:#f5f5f5}.ejs_parent ::-webkit-scrollbar-track{-webkit-box-shadow:inset 0 0 6px rgba(0,0,0,0.3);border-radius:10px;background-color:transparent}.ejs_parent{scrollbar-face-color:#f5f5f5;scrollbar-highlight-color:transparent;scrollbar-3dlight-color:transparent;scrollbar-darkshadow-color:transparent;scrollbar-Shadow-color:transparent;scrollbar-arrow-color:#fff;scrollbar-track-color:transparent;scrollbar-width:thin;scrollbar-color:transparent #f5f5f5}.ejs_ad_iframe{position:absolute;left:50%;top:50%;z-index:1;transform:translate(-50%,-50%)}.ejs_ad_close{cursor:pointer}.ejs_ad_close:after{content:"";position:absolute;border-left:20px solid transparent;border-right:20px solid #a7a7a77d;border-top:20px solid #a7a7a77d;border-bottom:20px solid transparent;right:0}.ejs_ad_close a{right:4px;top:4px;position:absolute;border:0;padding:0;width:15px;height:15px;z-index:99}.ejs_ad_close a:before{content:"";border-bottom:1px solid #fff;transform:rotate(45deg) translateY(-45%);width:15px;height:15px;display:block;position:absolute;top:0;right:0}.ejs_ad_close a:after{content:"";border-bottom:1px solid #fff;width:15px;height:15px;display:block;position:absolute;right:0;background:transparent;top:0;transform:rotate(-45deg) translateY(-50%) translateX(0)}.ejs_game{width:inherit;height:inherit;background-color:var(--ejs-background-color);cursor:default;position:relative;overflow:hidden}.ejs_game_background{background-image:var(--ejs-background-image);background-size:contain;background-position:center center;background-repeat:no-repeat;text-align:-webkit-auto}.ejs_game_background_blur:before,.ejs_game_background_blur:after{content:"";position:absolute;width:100%;height:100%;background:var(--ejs-background-image);background-repeat:no-repeat;background-position:center;background-size:contain}.ejs_game_background_blur:before{background-size:cover;filter:blur(10px);transform:scale(1.1)}.ejs_start_button{position:absolute;bottom:65px;left:50%;transform:translateX(-50%);cursor:pointer;box-sizing:inherit;display:flex;justify-content:center;text-shadow:0 1px 1px rgba(0,0,0,0.5);font-size:20px;line-height:45px;text-transform:uppercase;font-weight:bolder;position:relative;text-decoration:none;width:fit-content;padding-left:40px;padding-right:40px;white-space:nowrap;height:45px;border:0;color:#fff !important;border-radius:35px;text-align:center;background-color:rgba(var(--ejs-primary-color),1);box-shadow:0 0 0 0 #222,0 0 0 0 #111,inset 0 0 0 0 rgba(250,250,250,0.2),inset 0 0 0 0 rgba(0,0,0,0.5)}.ejs_start_button_border{border:.5px solid #333}.ejs_start_button:active,.ejs_start_button:hover{animation:ejs_start_button_pulse 2s infinite}@keyframes ejs_start_button_pulse{50%{box-shadow:0 0 0 0 #222,0 3px 7px 0 #111,inset 0 1px 1px 0 rgba(250,250,250,0.2),inset 0 0 15px 1px rgba(0,0,0,0.5)}0%,100%{box-shadow:0 0 0 0 #222,0 0 0 0 #111,inset 0 0 0 0 rgba(250,250,250,0.2),inset 0 0 0 0 rgba(0,0,0,0.5)}}.ejs_loading_text{position:absolute;bottom:20px;font-weight:500;left:50%;transform:translateX(-50%);box-sizing:inherit;font-size:12px;color:#bcbcbc}.ejs_loading_text_glow{background-color:rgba(0,0,0,0.9);border-radius:10px;padding:1px 5px 1px 5px;box-shadow:0 0 30px rgba(0,0,0,0.9)}.ejs_canvas{width:100%;height:100%}.ejs_context_menu{position:absolute;display:none;z-index:9;background:rgba(16,16,16,0.9);border-radius:3px;font-size:13px;min-width:140px;padding:8px;box-sizing:inherit}.ejs_context_menu li{padding:4px 11px;text-align:center}.ejs_context_menu li a{color:#999;display:block;font-size:13px}.ejs_context_menu ul{color:#999;display:block;font-size:13px;list-style:none;margin:0;padding:0}.ejs_context_menu li:hover{background:rgba(var(--ejs-primary-color),1);border-radius:4px;box-shadow:0 0 0 5px rgba(var(--ejs-primary-color),0.5);outline:0}.ejs_context_menu li:hover a{color:#fff}.ejs_list_selector{background:rgba(0,0,0,0.5);border-radius:3px;font-size:13px;min-width:140px;padding:8px;box-sizing:inherit;float:left;position:absolute;width:10%;max-width:15%;top:10%;left:0;height:80%;overflow:auto}.ejs_list_selector li{padding:4px 11px;text-align:center}.ejs_list_selector li a{color:#999 !important;display:block;font-size:13px}.ejs_list_selector ul{color:#999 !important;display:block;font-size:13px;list-style:none;margin:0;padding:0}.ejs_list_selector li:hover{background:rgba(var(--ejs-primary-color),1);border-radius:4px;box-shadow:0 0 0 5px rgba(var(--ejs-primary-color),0.5);outline:0}.ejs_list_selector li:hover a{color:#fff !important}.ejs_svg_rotate{transform:rotate(90deg)}@media(max-width:574px){.ejs_settings_parent::after{right:15px}.ejs_settings_center_right{right:-35%}.ejs_settings_center_left{right:-135%}.ejs_settings_center_right::after{right:25%}.ejs_settings_center_left::after{left:25%}.ejs_menu_bar{transition:opacity .4s ease-in-out,transform .4s ease-in-out;position:absolute;transform:translate(-50%,0);width:300px;max-height:260px;display:flex;flex-wrap:wrap;align-items:flex-start;background:rgba(0,0,0,.9);padding:10px;z-index:9999;left:50%;bottom:0}.ejs_menu_bar_hidden{opacity:0;pointer-events:none;transform:translate(-50%,100%)}.ejs_menu_button{width:135px;margin:0;margin-left:2px !important;margin-right:0 !important;line-height:1;background:0;border:0;border-radius:3px;color:inherit;cursor:pointer;flex-shrink:0;overflow:visible;padding:7px;position:relative;transition:all .3s ease}.ejs_menu_button:hover{background:rgba(var(--ejs-primary-color),1);color:#fff}.ejs_menu_button svg{float:left;transition:transform .3s ease}.ejs_menu_text{position:static;color:#fff;background:0;opacity:1;padding:0;transform:scale(.8) !important;font-size:12px}.ejs_menu_bar_spacer{display:none}.ejs_volume_parent span{display:none}.ejs_volume_parent button{width:30px}}@media(min-width:575px){.ejs_menu_bar_hidden{opacity:0;pointer-events:none;transform:translateY(100%)}.ejs_settings_parent{right:-3px}.ejs_settings_parent::after{right:15px}.ejs_settings_text{display:none}.ejs_menu_bar_spacer{flex:1}.ejs_menu_button svg{transition:transform .3s ease}.ejs_menu_button{width:auto;margin:auto;font-family:Avenir,"Avenir Next","Helvetica Neue","Segoe UI",Helvetica,Arial,sans-serif;margin-right:2px;touch-action:manipulation;background:transparent;border:0;border-radius:3px;color:inherit;cursor:pointer;flex-shrink:0;overflow:visible;padding:7px;position:relative;transition:all .3s ease}.ejs_menu_button:hover{background:rgba(var(--ejs-primary-color),1);color:#fff}.ejs_menu_button:hover .ejs_menu_text{transform:translate(0,0) scale(1);opacity:1}.ejs_menu_text_right{right:0;left:auto !important}.ejs_menu_text{left:0;background:rgba(255,255,255,0.9);border-radius:3px;bottom:100%;box-shadow:0 1px 2px rgba(0,0,0,0.15);color:#4f5b5f;font-size:14px;font-weight:500;line-height:1.3;margin-bottom:10px;opacity:0;padding:5px 7.5px;pointer-events:none;position:absolute;transform:translate(0,10px) scale(0.8);transform-origin:0 100%;transition:transform .2s .1s ease,opacity .2s .1s ease;white-space:nowrap;z-index:2}.ejs_menu_text::before{border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid rgba(255,255,255,0.9);bottom:-4px;content:'';height:0;left:16px;position:absolute;transform:translateX(-50%);width:0;z-index:2}.ejs_menu_text_right::before{left:auto !important;right:16px;transform:translateX(50%) !important}.ejs_menu_bar{padding:15px 10px 10px;background:linear-gradient(rgba(0,0,0,0),rgba(0,0,0,0.7));border-bottom-left-radius:inherit;border-bottom-right-radius:inherit;bottom:0;color:#fff;left:0;position:absolute;right:0;transition:opacity .4s ease-in-out,transform .4s ease-in-out;z-index:9999;align-items:center;display:flex;justify-content:flex-start;text-align:center}}.ejs_menu_bar svg{display:block;fill:currentColor;height:18px;pointer-events:none;width:18px}.ejs_popup_container{background:rgba(0,0,0,0.8);text-align:center;z-index:9999;height:100%;overflow:hidden;position:absolute;top:0;width:100%;color:#ccc}.ejs_popup_container *,.ejs_popup_container *::after,.ejs_popup_container *::before{box-sizing:border-box;color:#bcbcbc !important;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ejs_popup_container h4{color:#ccc;font-size:24px;margin:0;padding:10px}.ejs_button{border-radius:.25rem;font-size:.875rem;padding-left:1rem;padding-right:1rem;padding-top:.5rem;padding-bottom:.5rem;display:inline-block;background-color:rgba(var(--ejs-primary-color),1);margin:0 10px;color:#fff !important;touch-action:manipulation;cursor:pointer}.ejs_popup_body{height:calc(100% - 130px);overflow:auto}.ejs_control_body{color:#bcbcbc !important;border:unset}.ejs_control_body input[type='text']{background-color:#fff;border:1px solid #000;font-size:12px;font-weight:700;color:#000 !important}.ejs_control_player_bar{margin:0;padding:0}.ejs_control_player_bar ul{list-style:none}.ejs_control_player_bar li{color:#bcbcbc !important;display:inline-block}.ejs_control_player_bar a{padding:2px 5px;color:#bcbcbc !important;font-size:14px;cursor:pointer}.ejs_control_selected{border-bottom:1px solid #fff;background-color:#fff}.ejs_control_selected a{color:#000 !important}.ejs_control_bar:hover{background-color:#2d2d2d}.ejs_control_set_button{float:none;padding:.1rem .5rem;background-color:rgba(var(--ejs-primary-color),1);color:#fff !important;border-radius:.25rem;cursor:pointer;font-size:14px}.ejs_control_row label::before{top:-0.15rem !important}.ejs_control_row label::after{top:calc(-0.15rem + 2px) !important}.ejs_popup_box{position:absolute;width:300px;top:50%;margin-left:-150px;margin-top:-50px;left:50%;background:rgba(0,0,0,0.8) !important;padding:15px 0}.ejs_virtualGamepad_parent{width:100%;position:absolute;bottom:50px}.ejs_virtualGamepad_top{position:absolute;bottom:250px;width:100%}.ejs_virtualGamepad_bottom{position:absolute;bottom:10px;height:30px;width:124px;left:50%;margin-left:-62px}.ejs_virtualGamepad_left{position:absolute;bottom:50px;width:125px;height:125px;left:10px}.ejs_virtualGamepad_right{position:absolute;bottom:50px;width:130px;height:130px;right:10px}.ejs_virtualGamepad_button{position:absolute;font-size:20px;width:50px;height:50px;text-align:center;line-height:50px;border:1px solid #ccc;border-radius:50%;font-size:30px;font-weight:bold;background-color:rgba(255,255,255,0.15);user-select:none;transition:all .2s}.ejs_virtualGamepad_button_down{background-color:#000000ad}.ejs_dpad_main{touch-action:none;position:absolute;top:0;left:0;width:100%;height:100%;opacity:.7}.ejs_dpad_horizontal{width:100%;height:36px;transform:translate(0,-50%);position:absolute;left:0;top:50%;border-radius:5px;overflow:hidden}.ejs_dpad_horizontal:before{content:"";position:absolute;left:0;top:50%;z-index:1;transform:translate(0,-50%);width:0;height:0;border:8px solid;border-color:transparent #333 transparent transparent}.ejs_dpad_horizontal:after{content:"";position:absolute;right:0;top:50%;z-index:1;transform:translate(0,-50%);width:0;height:0;border:8px solid;border-color:transparent transparent transparent #333}.ejs_dpad_vertical{width:36px;height:100%;transform:translate(-50%,0);position:absolute;left:50%;border-radius:5px;overflow:hidden}.ejs_dpad_vertical:before{content:"";position:absolute;top:0;left:50%;z-index:1;transform:translate(-50%,0);width:0;height:0;border:8px solid;border-color:transparent transparent #333 transparent}.ejs_dpad_vertical:after{content:"";position:absolute;bottom:0;left:50%;z-index:1;transform:translate(-50%,0);width:0;height:0;border:8px solid;border-color:#333 transparent transparent transparent}.ejs_dpad_bar{position:absolute;width:100%;height:100%;background:#787878}.ejs_dpad_left_pressed .ejs_dpad_horizontal:before{border-right-color:#fff}.ejs_dpad_right_pressed .ejs_dpad_horizontal:after{border-left-color:#fff}.ejs_dpad_up_pressed .ejs_dpad_vertical:before{border-bottom-color:#fff}.ejs_dpad_down_pressed .ejs_dpad_vertical:after{border-top-color:#fff}@keyframes ejs_settings_parent_animation{0%{opacity:.5;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.ejs_settings_parent{animation:ejs_settings_parent_animation .2s ease;background:rgba(16,16,16,0.9);border-radius:4px;bottom:100%;box-shadow:0 1px 2px rgba(0,0,0,0.15);color:#4f5b5f;font-size:16px;margin-bottom:10px;position:absolute;text-align:left;white-space:nowrap;z-index:9999}.ejs_settings_parent::after{border:4px solid transparent;border-top-color:rgba(16,16,16,0.9);content:'';height:0;position:absolute;top:100%;width:0}.ejs_settings_transition{overflow:hidden;transition:height .35s cubic-bezier(0.4,0,0.2,1),width .35s cubic-bezier(0.4,0,0.2,1)}.ejs_settings_main_bar{align-items:center;color:#999;display:flex;font-size:13px;padding:4px 11px;user-select:none;width:100%;padding-right:28px;background:transparent;border:0;border-radius:3px;flex-shrink:0;overflow:visible;position:relative;transition:all .3s ease;box-sizing:border-box}.ejs_settings_main_bar::after{border:4px solid transparent;content:'';position:absolute;top:50%;transform:translateY(-50%);border-left-color:rgba(79,91,95,0.8);right:5px}.ejs_settings_main_bar>span{align-items:inherit;display:flex;width:100%}.ejs_settings_main_bar:hover{background:rgba(var(--ejs-primary-color),1);color:#fff;cursor:pointer}.ejs_settings_main_bar:hover::after{border-left-color:currentColor}.ejs_settings_main_bar_selected{align-items:center;display:flex;margin-left:auto;margin-right:-5px;overflow:hidden;padding-left:25px;pointer-events:none}.ejs_setting_menu{padding:7px}.ejs_back_button{font-weight:500;margin:7px;margin-bottom:3px;padding-left:28px;position:relative;width:calc(100% - 14px);align-items:center;color:#999;display:flex;font-size:13px;padding:4px 11px;user-select:none;background:transparent;border:0;border-radius:3px;cursor:pointer;flex-shrink:0;overflow:visible;transition:all .3s ease}.ejs_back_button:hover{background:rgba(var(--ejs-primary-color),1);color:#fff}.ejs_back_button:hover::after{border-right-color:currentColor}.ejs_back_button::before{background:#b7c5cd;box-shadow:0 1px 0 #fff;content:'';height:1px;left:0;margin-top:4px;overflow:hidden;position:absolute;right:0;top:100%}.ejs_back_button::after{border:4px solid transparent;border-right-color:rgba(79,91,95,0.8);left:7px;content:'';position:absolute;top:50%;transform:translateY(-50%)}.ejs_menu_text_a{align-items:center;display:flex;font-size:13px;padding:4px 11px;user-select:none;width:100%}.ejs_option_row{padding-left:7px}.ejs_option_row:hover::before{background:rgba(0,0,0,0.1)}.ejs_option_row::before{background:rgba(204,204,204,0.1);content:'';display:block;flex-shrink:0;height:16px;margin-right:10px;transition:all .3s ease;width:16px;border-radius:100%}.ejs_option_row::after{background:#fff;border:0;height:6px;left:12px;opacity:0;top:50%;transform:translateY(-50%) scale(0);transition:transform .3s ease,opacity .3s ease;width:6px;border-radius:100%;content:'';position:absolute}.ejs_option_row_selected::before{background:rgba(var(--ejs-primary-color),1)}.ejs_option_row_selected::after{opacity:1;transform:translateY(-50%) scale(1)}.ejs_option_row>span{align-items:center;display:flex;width:100%}.ejs_button_style{margin:0;background:transparent;border:0;border-radius:3px;cursor:pointer;flex-shrink:0;overflow:visible;padding:7px;position:relative;transition:all .3s ease;align-items:center;color:#999;display:flex;font-size:13px;user-select:none;width:100%}.ejs_button_style:hover{background:rgba(var(--ejs-primary-color),1);color:#fff}.ejs_cheat_heading{margin-top:0 !important;margin-bottom:0 !important;font-weight:600 !important;font-size:1.25rem;line-height:1.25 !important;color:rgba(var(--ejs-primary-color),1) !important}.ejs_cheat_close{font:inherit;line-height:inherit;width:auto;background:transparent;border:0;color:#bcbcbc !important;cursor:pointer}.ejs_cheat_close::before{content:"\2715";color:#bcbcbc !important;font:inherit;line-height:inherit;width:auto}.ejs_cheat_header{display:flex;justify-content:space-between;align-items:center}.ejs_cheat_main{margin-top:2rem;margin-bottom:2rem;line-height:1.5;color:rgba(0,0,0,0.8);text-align:left;color:#bcbcbc !important;border:unset}.ejs_cheat_code{color:#000 !important;font-size:1rem;padding:.4rem;max-width:100%}@keyframes ejs_cheat_animation{from{transform:translateY(15%)}to{transform:translateY(0)}}.ejs_cheat_parent{background-color:rgba(0,0,0,0.8);border:1px solid rgba(238,238,238,0.2);padding:30px;min-width:200px;max-width:500px;max-height:100vh;border-radius:4px;overflow-y:auto;box-sizing:border-box;will-change:transform;animation:ejs_cheat_animation .3s cubic-bezier(0,0,0.2,1);font-size:14px}.ejs_popup_container_box{position:absolute;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.6);display:flex;justify-content:center;align-items:center}.ejs_popup_submit{touch-action:manipulation;font:inherit;line-height:inherit;width:auto}.ejs_button_button{color:#fff !important;padding-left:1rem;padding-right:1rem;padding-top:.5rem;padding-bottom:.5rem;background-color:#929292;border-radius:.25rem;border-style:none;border-width:0;cursor:pointer;-webkit-appearance:button;appearance:button;text-transform:none;overflow:visible;margin:0;will-change:transform;transition:transform .25s ease-out,-webkit-transform .25s ease-out}.ejs_button_button:hover{transform:scale(1.05)}.ejs_cheat_rows{max-width:320px;margin:0 auto;text-align:left;width:100%;float:none;user-select:text !important}.ejs_cheat_row{padding-left:2.25rem;position:relative;padding:.2em 0;clear:both}.ejs_cheat_row:hover{background-color:rgba(0,0,0,0.8)}.ejs_cheat_row input[type=checkbox]{position:absolute;z-index:-1;opacity:0;box-sizing:border-box;width:auto}.ejs_cheat_row label{position:relative;margin-bottom:0;vertical-align:top;word-break:break-word}.ejs_cheat_row label::before{position:absolute;top:0;display:block;height:1rem;content:"";background-color:#fff;border:#adb5bd solid 1px;left:-2.25rem;width:1.75rem;pointer-events:all;border-radius:.5rem}.ejs_cheat_row input:checked+label::before{color:#fff;border-color:rgba(var(--ejs-primary-color),1);background-color:rgba(var(--ejs-primary-color),1)}.ejs_cheat_row label::after{position:absolute;display:block;content:"";background-repeat:no-repeat;background-position:center center;top:calc(0rem + 2px);left:calc(-2.25rem + 2px);width:calc(1rem - 4px);height:calc(1rem - 4px);background-color:#adb5bd;border-radius:.5rem;transition:transform .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out,-webkit-transform .15s ease-in-out}.ejs_cheat_row input:checked+label::after{background-color:#fff;-webkit-transform:translateX(0.75rem);transform:translateX(0.75rem)}.ejs_cheat_row_button{position:absolute;padding:.1rem .5rem;background-color:rgba(var(--ejs-primary-color),1);color:#fff !important;border-radius:.25rem;cursor:pointer;right:.025rem;border:0}@media(max-width:574px){.ejs_volume_parent input[type='range']{width:100%}}@media(min-width:575px){.ejs_volume_parent{max-width:110px}}.ejs_volume_parent{align-items:center;display:flex;flex:1;position:relative}.ejs_volume_parent{padding-right:15px}.ejs_volume_parent input[type='range']{display:block}.ejs_volume_parent::-webkit-media-controls{display:none}.ejs_volume_parent input[type='range']{-webkit-appearance:none;appearance:none;border:0;border-radius:28px;color:rgba(var(--ejs-primary-color),1);margin:0;padding:0;transition:box-shadow .3s ease;width:100%}.ejs_volume_parent input[type='range']::-webkit-slider-runnable-track{background-color:rgba(255,255,255,0.25);box-shadow:0 0 0 5px rgba(var(--ejs-primary-color),0.5);outline:0;background:transparent;border:0;border-radius:3px;height:6px;transition:box-shadow .3s ease;user-select:none;background-image:linear-gradient(to right,currentColor var(--value,0),transparent var(--value,0))}.ejs_volume_parent input[type='range']::-webkit-slider-thumb{background:#fff;border:0;border-radius:100%;box-shadow:0 1px 1px rgba(0,0,0,0.15),0 0 0 1px rgba(47,52,61,0.2);height:14px;position:relative;transition:all .2s ease;width:14px;-webkit-appearance:none;margin-top:-4px}.ejs_volume_parent input[type='range']::-moz-range-track{background-color:rgba(255,255,255,0.25);box-shadow:0 0 0 5px rgba(var(--ejs-primary-color),0.5);outline:0;background:transparent;border:0;border-radius:3px;height:6px;transition:box-shadow .3s ease;user-select:none}.ejs_volume_parent input[type='range']::-moz-range-thumb{background:#fff;border:0;border-radius:100%;box-shadow:0 1px 1px rgba(0,0,0,0.15),0 0 0 1px rgba(47,52,61,0.2);height:14px;position:relative;transition:all .2s ease;width:14px}.ejs_volume_parent input[type='range']::-moz-range-progress{background:currentColor;border-radius:3px;height:6px}.ejs_volume_parent input[type='range']::-ms-track{background-color:rgba(255,255,255,0.25);box-shadow:0 0 0 5px rgba(var(--ejs-primary-color),0.5);outline:0;background:transparent;border:0;border-radius:3px;height:6px;transition:box-shadow .3s ease;user-select:none;color:transparent}.ejs_volume_parent input[type='range']::-ms-fill-upper{background:transparent;border:0;border-radius:3px;height:6px;transition:box-shadow .3s ease;user-select:none}.ejs_volume_parent input[type='range']::-ms-fill-lower{background:transparent;border:0;border-radius:3px;height:6px;transition:box-shadow .3s ease;user-select:none;background:currentColor}.ejs_volume_parent input[type='range']::-ms-thumb{background:#fff;border:0;border-radius:100%;box-shadow:0 1px 1px rgba(0,0,0,0.15),0 0 0 1px rgba(47,52,61,0.2);height:14px;position:relative;transition:all .2s ease;width:14px;margin-top:0}.ejs_volume_parent input[type='range']::-ms-tooltip{display:none}.ejs_volume_parent input[type='range']:focus{outline:0}.ejs_volume_parent input[type='range']::-moz-focus-outer{border:0}.ejs_volume_parent input[type='range']:active::-webkit-slider-thumb{box-shadow:0 1px 1px rgba(0,0,0,0.15),0 0 0 1px rgba(47,52,61,0.2),0 0 0 3px rgba(255,255,255,0.5)}.ejs_volume_parent input[type='range']:active::-moz-range-thumb{box-shadow:0 1px 1px rgba(0,0,0,0.15),0 0 0 1px rgba(47,52,61,0.2),0 0 0 3px rgba(255,255,255,0.5)}.ejs_volume_parent input[type='range']:active::-ms-thumb{box-shadow:0 1px 1px rgba(0,0,0,0.15),0 0 0 1px rgba(47,52,61,0.2),0 0 0 3px rgba(255,255,255,0.5)}.ejs_message{float:none;overflow:hidden;position:absolute;top:0;color:red;font-size:17px;padding:10px;text-align:left;text-shadow:#000 1px 1px 1px}.ejs_virtualGamepad_open{display:inline-block;width:30px;height:30px;color:#fff;position:absolute;top:5px;right:5px;opacity:.5;z-index:999}.ejs_virtualGamepad_open svg{fill:currentColor}.ejs_netplay_header{margin-top:.5rem;margin-bottom:.5rem;line-height:1.5;color:rgba(0,0,0,.8);text-align:left}.ejs_netplay_header input,.ejs_netplay_header select{font-size:1rem;padding:.4rem;max-width:100%;color:#000 !important;background-color:#fff !important;margin:0;height:2rem;display:block;font-family:Arial;border:0}.ejs_netplay_name_heading{margin-top:0 !important;margin-bottom:0 !important;font-weight:600 !important;font-size:1.25rem;line-height:1.25 !important;color:rgba(var(--ejs-primary-color),1) !important;display:flex;justify-content:space-between;align-items:center}.ejs_netplay_table{font-family:Avenir,"Avenir Next","Helvetica Neue","Segoe UI",Helvetica,Arial,sans-serif;font-size:.8rem;padding:0 10px}.ejs_netplay_join_button{float:none;padding:.1rem .5rem;background-color:rgba(var(--ejs-primary-color),1);color:#fff !important;border-radius:.25rem;cursor:pointer}.ejs_netplay_table_row:hover{background-color:#2d2d2d} \ No newline at end of file +.ejs_parent{background:#000;overflow:hidden;position:relative;font-family:Avenir,"Avenir Next","Helvetica Neue","Segoe UI",Helvetica,Arial,sans-serif;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;font-weight:500;line-height:1.7;width:100%;height:100%;color:#bcbcbc;outline-width:0;outline:0;font-size:14px}.ejs_parent *,.ejs_parent *::after,.ejs_parent *::before{font-family:Avenir,"Avenir Next","Helvetica Neue","Segoe UI",Helvetica,Arial,sans-serif;box-sizing:border-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ejs_parent ::-webkit-scrollbar{width:8px;height:16px;background-color:transparent}.ejs_parent ::-webkit-scrollbar-thumb{border-radius:0;-webkit-box-shadow:inset 0 0 6px rgba(0,0,0,0.3);background-color:#f5f5f5}.ejs_parent ::-webkit-scrollbar-track{-webkit-box-shadow:inset 0 0 6px rgba(0,0,0,0.3);border-radius:10px;background-color:transparent}.ejs_parent{scrollbar-face-color:#f5f5f5;scrollbar-highlight-color:transparent;scrollbar-3dlight-color:transparent;scrollbar-darkshadow-color:transparent;scrollbar-Shadow-color:transparent;scrollbar-arrow-color:#fff;scrollbar-track-color:transparent;scrollbar-width:thin;scrollbar-color:transparent #f5f5f5}.ejs_ad_iframe{position:absolute;left:50%;top:50%;z-index:1;transform:translate(-50%,-50%)}.ejs_ad_close{cursor:pointer}.ejs_ad_close:after{content:"";position:absolute;border-left:20px solid transparent;border-right:20px solid #a7a7a77d;border-top:20px solid #a7a7a77d;border-bottom:20px solid transparent;right:0}.ejs_ad_close a{right:4px;top:4px;position:absolute;border:0;padding:0;width:15px;height:15px;z-index:99}.ejs_ad_close a:before{content:"";border-bottom:1px solid #fff;transform:rotate(45deg) translateY(-45%);width:15px;height:15px;display:block;position:absolute;top:0;right:0}.ejs_ad_close a:after{content:"";border-bottom:1px solid #fff;width:15px;height:15px;display:block;position:absolute;right:0;background:transparent;top:0;transform:rotate(-45deg) translateY(-50%) translateX(0)}.ejs_game{width:inherit;height:inherit;background-color:var(--ejs-background-color);cursor:default;position:relative;overflow:hidden}.ejs_game_background{background-image:var(--ejs-background-image);background-size:contain;background-position:center center;background-repeat:no-repeat;text-align:-webkit-auto}.ejs_game_background_blur:before,.ejs_game_background_blur:after{content:"";position:absolute;width:100%;height:100%;background:var(--ejs-background-image);background-repeat:no-repeat;background-position:center;background-size:contain}.ejs_game_background_blur:before{background-size:cover;filter:blur(10px);transform:scale(1.1)}.ejs_start_button{position:absolute;bottom:65px;left:50%;transform:translateX(-50%);cursor:pointer;box-sizing:inherit;display:flex;justify-content:center;text-shadow:0 1px 1px rgba(0,0,0,0.5);font-size:20px;line-height:45px;text-transform:uppercase;font-weight:bolder;position:relative;text-decoration:none;width:fit-content;padding-left:40px;padding-right:40px;white-space:nowrap;height:45px;border:0;color:#fff !important;border-radius:35px;text-align:center;background-color:rgba(var(--ejs-primary-color),1);box-shadow:0 0 0 0 #222,0 0 0 0 #111,inset 0 0 0 0 rgba(250,250,250,0.2),inset 0 0 0 0 rgba(0,0,0,0.5)}.ejs_start_button_border{border:.5px solid #333}.ejs_start_button:active,.ejs_start_button:hover{animation:ejs_start_button_pulse 2s infinite}@keyframes ejs_start_button_pulse{50%{box-shadow:0 0 0 0 #222,0 3px 7px 0 #111,inset 0 1px 1px 0 rgba(250,250,250,0.2),inset 0 0 15px 1px rgba(0,0,0,0.5)}0%,100%{box-shadow:0 0 0 0 #222,0 0 0 0 #111,inset 0 0 0 0 rgba(250,250,250,0.2),inset 0 0 0 0 rgba(0,0,0,0.5)}}.ejs_loading_text{position:absolute;bottom:20px;font-weight:500;left:50%;transform:translateX(-50%);box-sizing:inherit;font-size:12px;color:#bcbcbc}.ejs_loading_text_glow{background-color:rgba(0,0,0,0.9);border-radius:10px;padding:1px 5px 1px 5px;box-shadow:0 0 30px rgba(0,0,0,0.9)}.ejs_canvas{width:100%;height:100%}.ejs_context_menu{position:absolute;display:none;z-index:9;background:rgba(16,16,16,0.9);border-radius:3px;font-size:13px;min-width:140px;padding:8px;box-sizing:inherit}.ejs_context_menu li{padding:4px 11px;text-align:center}.ejs_context_menu li a{color:#999;display:block;font-size:13px}.ejs_context_menu ul{color:#999;display:block;font-size:13px;list-style:none;margin:0;padding:0}.ejs_context_menu li:hover{background:rgba(var(--ejs-primary-color),1);border-radius:4px;box-shadow:0 0 0 5px rgba(var(--ejs-primary-color),0.5);outline:0}.ejs_context_menu li:hover a{color:#fff}.ejs_list_selector{background:rgba(0,0,0,0.5);border-radius:3px;font-size:13px;min-width:140px;padding:8px;box-sizing:inherit;float:left;position:absolute;width:10%;max-width:15%;top:10%;left:0;height:80%;overflow:auto}.ejs_list_selector li{padding:4px 11px;text-align:center}.ejs_list_selector li a{color:#999 !important;display:block;font-size:13px}.ejs_list_selector ul{color:#999 !important;display:block;font-size:13px;list-style:none;margin:0;padding:0}.ejs_list_selector li:hover{background:rgba(var(--ejs-primary-color),1);border-radius:4px;box-shadow:0 0 0 5px rgba(var(--ejs-primary-color),0.5);outline:0}.ejs_list_selector li:hover a{color:#fff !important}.ejs_svg_rotate{transform:rotate(90deg)}.ejs_small_screen .ejs_settings_parent::after{right:15px}.ejs_small_screen .ejs_settings_center_right{right:-35%}.ejs_small_screen .ejs_settings_center_left{right:-135%}.ejs_small_screen .ejs_settings_center_right::after{right:25%}.ejs_small_screen .ejs_settings_center_left::after{left:25%}.ejs_small_screen .ejs_menu_bar{transition:opacity .4s ease-in-out,transform .4s ease-in-out;position:absolute;transform:translate(-50%,0);width:300px;max-height:260px;display:flex;flex-wrap:wrap;align-items:flex-start;background:rgba(0,0,0,.9);padding:10px;z-index:9999;left:50%;bottom:0}.ejs_small_screen .ejs_menu_bar_hidden{opacity:0;pointer-events:none;transform:translate(-50%,100%)}.ejs_small_screen .ejs_menu_button{width:135px;margin:0;margin-left:2px !important;margin-right:0 !important;line-height:1;background:0;border:0;border-radius:3px;color:inherit;cursor:pointer;flex-shrink:0;overflow:visible;padding:7px;position:relative;transition:all .3s ease}.ejs_small_screen .ejs_menu_button:hover{background:rgba(var(--ejs-primary-color),1);color:#fff}.ejs_small_screen .ejs_menu_button svg{float:left;transition:transform .3s ease}.ejs_small_screen .ejs_menu_text{position:static;color:#fff;background:0;opacity:1;padding:0;transform:scale(.8) !important;font-size:12px}.ejs_small_screen .ejs_menu_bar_spacer{display:none}.ejs_small_screen .ejs_volume_parent span{display:none}.ejs_small_screen .ejs_volume_parent button{width:30px}.ejs_big_screen .ejs_menu_bar_hidden{opacity:0;pointer-events:none;transform:translateY(100%)}.ejs_big_screen .ejs_settings_parent{right:-3px}.ejs_big_screen .ejs_settings_parent::after{right:15px}.ejs_big_screen .ejs_settings_text{display:none}.ejs_big_screen .ejs_menu_bar_spacer{flex:1}.ejs_big_screen .ejs_menu_button svg{transition:transform .3s ease}.ejs_big_screen .ejs_menu_button{width:auto;margin:auto;font-family:Avenir,"Avenir Next","Helvetica Neue","Segoe UI",Helvetica,Arial,sans-serif;margin-right:2px;touch-action:manipulation;background:transparent;border:0;border-radius:3px;color:inherit;cursor:pointer;flex-shrink:0;overflow:visible;padding:7px;position:relative;transition:all .3s ease}.ejs_big_screen .ejs_menu_button:hover{background:rgba(var(--ejs-primary-color),1);color:#fff}.ejs_big_screen .ejs_menu_button:hover .ejs_menu_text{transform:translate(0,0) scale(1);opacity:1}.ejs_big_screen .ejs_menu_text_right{right:0;left:auto !important}.ejs_big_screen .ejs_menu_text{left:0;background:rgba(255,255,255,0.9);border-radius:3px;bottom:100%;box-shadow:0 1px 2px rgba(0,0,0,0.15);color:#4f5b5f;font-size:14px;font-weight:500;line-height:1.3;margin-bottom:10px;opacity:0;padding:5px 7.5px;pointer-events:none;position:absolute;transform:translate(0,10px) scale(0.8);transform-origin:0 100%;transition:transform .2s .1s ease,opacity .2s .1s ease;white-space:nowrap;z-index:2}.ejs_big_screen .ejs_menu_text::before{border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid rgba(255,255,255,0.9);bottom:-4px;content:'';height:0;left:16px;position:absolute;transform:translateX(-50%);width:0;z-index:2}.ejs_big_screen .ejs_menu_text_right::before{left:auto !important;right:16px;transform:translateX(50%) !important}.ejs_big_screen .ejs_menu_bar{padding:15px 10px 10px;background:linear-gradient(rgba(0,0,0,0),rgba(0,0,0,0.7));border-bottom-left-radius:inherit;border-bottom-right-radius:inherit;bottom:0;color:#fff;left:0;position:absolute;right:0;transition:opacity .4s ease-in-out,transform .4s ease-in-out;z-index:9999;align-items:center;display:flex;justify-content:flex-start;text-align:center}.ejs_menu_bar svg{display:block;fill:currentColor;height:18px;pointer-events:none;width:18px}.ejs_popup_container{background:rgba(0,0,0,0.8);text-align:center;z-index:9999;height:100%;overflow:hidden;position:absolute;top:0;width:100%;color:#ccc}.ejs_popup_container *,.ejs_popup_container *::after,.ejs_popup_container *::before{box-sizing:border-box;color:#bcbcbc !important;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ejs_popup_container h4{color:#ccc;font-size:24px;margin:0;padding:10px}.ejs_button{border-radius:.25rem;font-size:.875rem;padding-left:1rem;padding-right:1rem;padding-top:.5rem;padding-bottom:.5rem;display:inline-block;background-color:rgba(var(--ejs-primary-color),1);margin:0 10px;color:#fff !important;touch-action:manipulation;cursor:pointer}.ejs_popup_body{height:calc(100% - 130px);overflow:auto}.ejs_control_body{color:#bcbcbc !important;border:unset}.ejs_control_body input[type='text']{background-color:#fff;border:1px solid #000;font-size:12px;font-weight:700;color:#000 !important}.ejs_control_player_bar{margin:0;padding:0}.ejs_control_player_bar ul{list-style:none}.ejs_control_player_bar li{color:#bcbcbc !important;display:inline-block}.ejs_control_player_bar a{padding:2px 5px;color:#bcbcbc !important;font-size:14px;cursor:pointer}.ejs_control_selected{border-bottom:1px solid #fff;background-color:#fff}.ejs_control_selected a{color:#000 !important}.ejs_control_bar:hover{background-color:#2d2d2d}.ejs_control_set_button{float:none;padding:.1rem .5rem;background-color:rgba(var(--ejs-primary-color),1);color:#fff !important;border-radius:.25rem;cursor:pointer;font-size:14px}.ejs_control_row label::before{top:-0.15rem !important}.ejs_control_row label::after{top:calc(-0.15rem + 2px) !important}.ejs_popup_box{position:absolute;width:300px;top:50%;margin-left:-150px;margin-top:-50px;left:50%;background:rgba(0,0,0,0.8) !important;padding:15px 0}.ejs_virtualGamepad_parent{width:100%;position:absolute;bottom:50px}.ejs_virtualGamepad_top{position:absolute;bottom:250px;width:100%}.ejs_virtualGamepad_bottom{position:absolute;bottom:10px;height:30px;width:124px;left:50%;margin-left:-62px}.ejs_virtualGamepad_left{position:absolute;bottom:50px;width:125px;height:125px;left:10px}.ejs_virtualGamepad_right{position:absolute;bottom:50px;width:130px;height:130px;right:10px}.ejs_virtualGamepad_button{position:absolute;font-size:20px;width:50px;height:50px;text-align:center;line-height:50px;border:1px solid #ccc;border-radius:50%;font-size:30px;font-weight:bold;background-color:rgba(255,255,255,0.15);user-select:none;transition:all .2s}.ejs_virtualGamepad_button_down{background-color:#000000ad}.ejs_dpad_main{touch-action:none;position:absolute;top:0;left:0;width:100%;height:100%;opacity:.7}.ejs_dpad_horizontal{width:100%;height:36px;transform:translate(0,-50%);position:absolute;left:0;top:50%;border-radius:5px;overflow:hidden}.ejs_dpad_horizontal:before{content:"";position:absolute;left:0;top:50%;z-index:1;transform:translate(0,-50%);width:0;height:0;border:8px solid;border-color:transparent #333 transparent transparent}.ejs_dpad_horizontal:after{content:"";position:absolute;right:0;top:50%;z-index:1;transform:translate(0,-50%);width:0;height:0;border:8px solid;border-color:transparent transparent transparent #333}.ejs_dpad_vertical{width:36px;height:100%;transform:translate(-50%,0);position:absolute;left:50%;border-radius:5px;overflow:hidden}.ejs_dpad_vertical:before{content:"";position:absolute;top:0;left:50%;z-index:1;transform:translate(-50%,0);width:0;height:0;border:8px solid;border-color:transparent transparent #333 transparent}.ejs_dpad_vertical:after{content:"";position:absolute;bottom:0;left:50%;z-index:1;transform:translate(-50%,0);width:0;height:0;border:8px solid;border-color:#333 transparent transparent transparent}.ejs_dpad_bar{position:absolute;width:100%;height:100%;background:#787878}.ejs_dpad_left_pressed .ejs_dpad_horizontal:before{border-right-color:#fff}.ejs_dpad_right_pressed .ejs_dpad_horizontal:after{border-left-color:#fff}.ejs_dpad_up_pressed .ejs_dpad_vertical:before{border-bottom-color:#fff}.ejs_dpad_down_pressed .ejs_dpad_vertical:after{border-top-color:#fff}@keyframes ejs_settings_parent_animation{0%{opacity:.5;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.ejs_settings_parent{animation:ejs_settings_parent_animation .2s ease;background:rgba(16,16,16,0.9);border-radius:4px;bottom:100%;box-shadow:0 1px 2px rgba(0,0,0,0.15);color:#4f5b5f;font-size:16px;margin-bottom:10px;position:absolute;text-align:left;white-space:nowrap;z-index:9999}.ejs_settings_parent::after{border:4px solid transparent;border-top-color:rgba(16,16,16,0.9);content:'';height:0;position:absolute;top:100%;width:0}.ejs_settings_transition{overflow:hidden;transition:height .35s cubic-bezier(0.4,0,0.2,1),width .35s cubic-bezier(0.4,0,0.2,1)}.ejs_settings_main_bar{align-items:center;color:#999;display:flex;font-size:13px;padding:4px 11px;user-select:none;width:100%;padding-right:28px;background:transparent;border:0;border-radius:3px;flex-shrink:0;overflow:visible;position:relative;transition:all .3s ease;box-sizing:border-box}.ejs_settings_main_bar::after{border:4px solid transparent;content:'';position:absolute;top:50%;transform:translateY(-50%);border-left-color:rgba(79,91,95,0.8);right:5px}.ejs_settings_main_bar>span{align-items:inherit;display:flex;width:100%}.ejs_settings_main_bar:hover{background:rgba(var(--ejs-primary-color),1);color:#fff;cursor:pointer}.ejs_settings_main_bar:hover::after{border-left-color:currentColor}.ejs_settings_main_bar_selected{align-items:center;display:flex;margin-left:auto;margin-right:-5px;overflow:hidden;padding-left:25px;pointer-events:none}.ejs_setting_menu{padding:7px}.ejs_back_button{font-weight:500;margin:7px;margin-bottom:3px;padding-left:28px;position:relative;width:calc(100% - 14px);align-items:center;color:#999;display:flex;font-size:13px;padding:4px 11px;user-select:none;background:transparent;border:0;border-radius:3px;cursor:pointer;flex-shrink:0;overflow:visible;transition:all .3s ease}.ejs_back_button:hover{background:rgba(var(--ejs-primary-color),1);color:#fff}.ejs_back_button:hover::after{border-right-color:currentColor}.ejs_back_button::before{background:#b7c5cd;box-shadow:0 1px 0 #fff;content:'';height:1px;left:0;margin-top:4px;overflow:hidden;position:absolute;right:0;top:100%}.ejs_back_button::after{border:4px solid transparent;border-right-color:rgba(79,91,95,0.8);left:7px;content:'';position:absolute;top:50%;transform:translateY(-50%)}.ejs_menu_text_a{align-items:center;display:flex;font-size:13px;padding:4px 11px;user-select:none;width:100%}.ejs_option_row{padding-left:7px}.ejs_option_row:hover::before{background:rgba(0,0,0,0.1)}.ejs_option_row::before{background:rgba(204,204,204,0.1);content:'';display:block;flex-shrink:0;height:16px;margin-right:10px;transition:all .3s ease;width:16px;border-radius:100%}.ejs_option_row::after{background:#fff;border:0;height:6px;left:12px;opacity:0;top:50%;transform:translateY(-50%) scale(0);transition:transform .3s ease,opacity .3s ease;width:6px;border-radius:100%;content:'';position:absolute}.ejs_option_row_selected::before{background:rgba(var(--ejs-primary-color),1)}.ejs_option_row_selected::after{opacity:1;transform:translateY(-50%) scale(1)}.ejs_option_row>span{align-items:center;display:flex;width:100%}.ejs_button_style{margin:0;background:transparent;border:0;border-radius:3px;cursor:pointer;flex-shrink:0;overflow:visible;padding:7px;position:relative;transition:all .3s ease;align-items:center;color:#999;display:flex;font-size:13px;user-select:none;width:100%}.ejs_button_style:hover{background:rgba(var(--ejs-primary-color),1);color:#fff}.ejs_cheat_heading{margin-top:0 !important;margin-bottom:0 !important;font-weight:600 !important;font-size:1.25rem;line-height:1.25 !important;color:rgba(var(--ejs-primary-color),1) !important}.ejs_cheat_close{font:inherit;line-height:inherit;width:auto;background:transparent;border:0;color:#bcbcbc !important;cursor:pointer}.ejs_cheat_close::before{content:"\2715";color:#bcbcbc !important;font:inherit;line-height:inherit;width:auto}.ejs_cheat_header{display:flex;justify-content:space-between;align-items:center}.ejs_cheat_main{margin-top:2rem;margin-bottom:2rem;line-height:1.5;color:rgba(0,0,0,0.8);text-align:left;color:#bcbcbc !important;border:unset}.ejs_cheat_code{color:#000 !important;font-size:1rem;padding:.4rem;max-width:100%}@keyframes ejs_cheat_animation{from{transform:translateY(15%)}to{transform:translateY(0)}}.ejs_cheat_parent{background-color:rgba(0,0,0,0.8);border:1px solid rgba(238,238,238,0.2);padding:30px;min-width:200px;max-width:500px;max-height:100vh;border-radius:4px;overflow-y:auto;box-sizing:border-box;will-change:transform;animation:ejs_cheat_animation .3s cubic-bezier(0,0,0.2,1);font-size:14px}.ejs_popup_container_box{position:absolute;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.6);display:flex;justify-content:center;align-items:center}.ejs_popup_submit{touch-action:manipulation;font:inherit;line-height:inherit;width:auto}.ejs_button_button{color:#fff !important;padding-left:1rem;padding-right:1rem;padding-top:.5rem;padding-bottom:.5rem;background-color:#929292;border-radius:.25rem;border-style:none;border-width:0;cursor:pointer;-webkit-appearance:button;appearance:button;text-transform:none;overflow:visible;margin:0;will-change:transform;transition:transform .25s ease-out,-webkit-transform .25s ease-out}.ejs_button_button:hover{transform:scale(1.05)}.ejs_cheat_rows{max-width:320px;margin:0 auto;text-align:left;width:100%;float:none;user-select:text !important}.ejs_cheat_row{padding-left:2.25rem;position:relative;padding:.2em 0;clear:both}.ejs_cheat_row:hover{background-color:rgba(0,0,0,0.8)}.ejs_cheat_row input[type=checkbox]{position:absolute;z-index:-1;opacity:0;box-sizing:border-box;width:auto}.ejs_cheat_row label{position:relative;margin-bottom:0;vertical-align:top;word-break:break-word}.ejs_cheat_row label::before{position:absolute;top:0;display:block;height:1rem;content:"";background-color:#fff;border:#adb5bd solid 1px;left:-2.25rem;width:1.75rem;pointer-events:all;border-radius:.5rem}.ejs_cheat_row input:checked+label::before{color:#fff;border-color:rgba(var(--ejs-primary-color),1);background-color:rgba(var(--ejs-primary-color),1)}.ejs_cheat_row label::after{position:absolute;display:block;content:"";background-repeat:no-repeat;background-position:center center;top:calc(0rem + 2px);left:calc(-2.25rem + 2px);width:calc(1rem - 4px);height:calc(1rem - 4px);background-color:#adb5bd;border-radius:.5rem;transition:transform .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out,-webkit-transform .15s ease-in-out}.ejs_cheat_row input:checked+label::after{background-color:#fff;-webkit-transform:translateX(0.75rem);transform:translateX(0.75rem)}.ejs_cheat_row_button{position:absolute;padding:.1rem .5rem;background-color:rgba(var(--ejs-primary-color),1);color:#fff !important;border-radius:.25rem;cursor:pointer;right:.025rem;border:0}.ejs_small_screen .ejs_volume_parent input[type='range']{width:100%}.ejs_big_screen .ejs_volume_parent{max-width:110px}.ejs_volume_parent{align-items:center;display:flex;flex:1;position:relative}.ejs_volume_parent{padding-right:15px}.ejs_volume_parent input[type='range']{display:block}.ejs_volume_parent::-webkit-media-controls{display:none}.ejs_volume_parent input[type='range']{-webkit-appearance:none;appearance:none;border:0;border-radius:28px;color:rgba(var(--ejs-primary-color),1);margin:0;padding:0;transition:box-shadow .3s ease;width:100%}.ejs_volume_parent input[type='range']::-webkit-slider-runnable-track{background-color:rgba(255,255,255,0.25);outline:0;background:transparent;border:0;border-radius:3px;height:6px;transition:box-shadow .3s ease;user-select:none;background-image:linear-gradient(to right,currentColor var(--value,0),transparent var(--value,0))}.ejs_volume_parent input[type='range']::-webkit-slider-thumb{background:#fff;border:0;border-radius:100%;box-shadow:0 1px 1px rgba(0,0,0,0.15),0 0 0 1px rgba(47,52,61,0.2);height:14px;position:relative;transition:all .2s ease;width:14px;-webkit-appearance:none;margin-top:-4px}.ejs_volume_parent input[type='range']::-moz-range-track{background-color:rgba(255,255,255,0.25);outline:0;background:transparent;border:0;border-radius:3px;height:6px;transition:box-shadow .3s ease;user-select:none}.ejs_volume_parent input[type='range']::-moz-range-thumb{background:#fff;border:0;border-radius:100%;box-shadow:0 1px 1px rgba(0,0,0,0.15),0 0 0 1px rgba(47,52,61,0.2);height:14px;position:relative;transition:all .2s ease;width:14px}.ejs_volume_parent input[type='range']::-moz-range-progress{background:currentColor;border-radius:3px;height:6px}.ejs_volume_parent input[type='range']::-ms-track{background-color:rgba(255,255,255,0.25);outline:0;background:transparent;border:0;border-radius:3px;height:6px;transition:box-shadow .3s ease;user-select:none;color:transparent}.ejs_volume_parent input[type='range']::-ms-fill-upper{background:transparent;border:0;border-radius:3px;height:6px;transition:box-shadow .3s ease;user-select:none}.ejs_volume_parent input[type='range']::-ms-fill-lower{background:transparent;border:0;border-radius:3px;height:6px;transition:box-shadow .3s ease;user-select:none;background:currentColor}.ejs_volume_parent input[type='range']::-ms-thumb{background:#fff;border:0;border-radius:100%;box-shadow:0 1px 1px rgba(0,0,0,0.15),0 0 0 1px rgba(47,52,61,0.2);height:14px;position:relative;transition:all .2s ease;width:14px;margin-top:0}.ejs_volume_parent input[type='range']::-ms-tooltip{display:none}.ejs_volume_parent input[type='range']:focus{outline:0}.ejs_volume_parent input[type='range']::-moz-focus-outer{border:0}.ejs_volume_parent input[type='range']:active::-webkit-slider-thumb{box-shadow:0 1px 1px rgba(0,0,0,0.15),0 0 0 1px rgba(47,52,61,0.2),0 0 0 3px rgba(255,255,255,0.5)}.ejs_volume_parent input[type='range']:active::-moz-range-thumb{box-shadow:0 1px 1px rgba(0,0,0,0.15),0 0 0 1px rgba(47,52,61,0.2),0 0 0 3px rgba(255,255,255,0.5)}.ejs_volume_parent input[type='range']:active::-ms-thumb{box-shadow:0 1px 1px rgba(0,0,0,0.15),0 0 0 1px rgba(47,52,61,0.2),0 0 0 3px rgba(255,255,255,0.5)}.ejs_message{float:none;overflow:hidden;position:absolute;top:0;color:red;font-size:17px;padding:10px;text-align:left;text-shadow:#000 1px 1px 1px}.ejs_virtualGamepad_open{display:inline-block;width:30px;height:30px;color:#fff;position:absolute;top:5px;right:5px;opacity:.5;z-index:999}.ejs_virtualGamepad_open svg{fill:currentColor}.ejs_netplay_header{margin-top:.5rem;margin-bottom:.5rem;line-height:1.5;color:rgba(0,0,0,.8);text-align:left}.ejs_netplay_header input,.ejs_netplay_header select{font-size:1rem;padding:.4rem;max-width:100%;color:#000 !important;background-color:#fff !important;margin:0;height:2rem;display:block;font-family:Arial;border:0}.ejs_netplay_name_heading{margin-top:0 !important;margin-bottom:0 !important;font-weight:600 !important;font-size:1.25rem;line-height:1.25 !important;color:rgba(var(--ejs-primary-color),1) !important;display:flex;justify-content:space-between;align-items:center}.ejs_netplay_table{font-family:Avenir,"Avenir Next","Helvetica Neue","Segoe UI",Helvetica,Arial,sans-serif;font-size:.8rem;padding:0 10px}.ejs_netplay_join_button{float:none;padding:.1rem .5rem;background-color:rgba(var(--ejs-primary-color),1);color:#fff !important;border-radius:.25rem;cursor:pointer}.ejs_netplay_table_row:hover{background-color:#2d2d2d} \ No newline at end of file diff --git a/semag/emulatorjs/data/gamepad.js b/semag/emulatorjs/data/gamepad.js index ff87f2bb..2cfc4bd1 100644 --- a/semag/emulatorjs/data/gamepad.js +++ b/semag/emulatorjs/data/gamepad.js @@ -1,159 +1,150 @@ -class GamepadHandler { - gamepads; - timeout; - listeners; - constructor() { - this.buttonLabels = { - 0: 'BUTTON_1', - 1: 'BUTTON_2', - 2: 'BUTTON_3', - 3: 'BUTTON_4', - 4: 'LEFT_TOP_SHOULDER', - 5: 'RIGHT_TOP_SHOULDER', - 6: 'LEFT_BOTTOM_SHOULDER', - 7: 'RIGHT_BOTTOM_SHOULDER', - 8: 'SELECT', - 9: 'START', - 10: 'LEFT_STICK', - 11: 'RIGHT_STICK', - 12: 'DPAD_UP', - 13: 'DPAD_DOWN', - 14: 'DPAD_LEFT', - 15: 'DPAD_RIGHT', - }; - this.gamepads = []; - this.listeners = {}; - this.timeout = null; - this.loop(); - } - terminate() { - window.clearTimeout(this.timeout); - } - getGamepads() { - return navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []); - } - loop() { - this.updateGamepadState(); - this.timeout = setTimeout(this.loop.bind(this), 10); - } - updateGamepadState() { - let gamepads = this.getGamepads(); - if (!gamepads) return; - if (!Array.isArray(gamepads) && gamepads.length) { - let gp = []; - for (let i=0; i { - if (!gamepad) return; - let hasGamepad = false; - this.gamepads.forEach((oldGamepad, oldIndex) => { - if (oldGamepad.index !== gamepad.index) return; - const gamepadToSave = { - axes: [], - buttons: {}, - index: oldGamepad.index, - id: oldGamepad.id - } - hasGamepad = true; - - oldGamepad.axes.forEach((axis, axisIndex) => { - const val = (axis < 0.01 && axis > -0.01) ? 0 : axis; - const newVal = (gamepad.axes[axisIndex] < 0.01 && gamepad.axes[axisIndex] > -0.01) ? 0 : gamepad.axes[axisIndex]; - if (newVal !== val) { - const axis = ['LEFT_STICK_X', 'LEFT_STICK_Y', 'RIGHT_STICK_X', 'RIGHT_STICK_Y'][axisIndex]; - if (!axis) return; - this.dispatchEvent('axischanged', { - axis: axis, - value: newVal, - index: gamepad.index, - label: this.getAxisLabel(axis, newVal), - gamepadIndex: gamepad.index, - }); - } - gamepadToSave.axes[axisIndex] = newVal; - }) - - gamepad.buttons.forEach((button, buttonIndex) => { - let pressed = oldGamepad.buttons[buttonIndex] === 1.0; - if (typeof oldGamepad.buttons[buttonIndex] === "object") { - pressed = oldGamepad.buttons[buttonIndex].pressed; - } - let pressed2 = button === 1.0; - if (typeof button === "object") { - pressed2 = button.pressed; - } - gamepadToSave.buttons[buttonIndex] = {pressed:pressed2}; - if (pressed !== pressed2) { - if (pressed2) { - this.dispatchEvent('buttondown', {index: buttonIndex, label: this.getButtonLabel(buttonIndex), gamepadIndex: gamepad.index}); - } else { - this.dispatchEvent('buttonup', {index: buttonIndex, label:this.getButtonLabel(buttonIndex), gamepadIndex: gamepad.index}); - } - } - - }) - this.gamepads[oldIndex] = gamepadToSave; - }) - if (!hasGamepad) { - this.gamepads.push(gamepads[index]); - this.dispatchEvent('connected', {gamepadIndex: gamepad.index}); - } - }); - - for (let j=0; j 0.5 || value < -0.5) { - if (value > 0) { - valueLabel = '+1'; - } else { - valueLabel = '-1'; - } - } - if (!axis || !valueLabel) { - return null; - } - return `${axis}:${valueLabel}`; - } -} - -window.GamepadHandler = GamepadHandler; +class GamepadHandler { + gamepads; + timeout; + listeners; + constructor() { + this.buttonLabels = { + 0: 'BUTTON_1', + 1: 'BUTTON_2', + 2: 'BUTTON_3', + 3: 'BUTTON_4', + 4: 'LEFT_TOP_SHOULDER', + 5: 'RIGHT_TOP_SHOULDER', + 6: 'LEFT_BOTTOM_SHOULDER', + 7: 'RIGHT_BOTTOM_SHOULDER', + 8: 'SELECT', + 9: 'START', + 10: 'LEFT_STICK', + 11: 'RIGHT_STICK', + 12: 'DPAD_UP', + 13: 'DPAD_DOWN', + 14: 'DPAD_LEFT', + 15: 'DPAD_RIGHT', + }; + this.gamepads = []; + this.listeners = {}; + this.timeout = null; + this.loop(); + } + terminate() { + window.clearTimeout(this.timeout); + } + getGamepads() { + return navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []); + } + loop() { + this.updateGamepadState(); + this.timeout = setTimeout(this.loop.bind(this), 10); + } + updateGamepadState() { + const gamepads = this.getGamepads(); + gamepads.forEach((gamepad, index) => { + if (!gamepad) return; + let hasGamepad = false; + this.gamepads.forEach((oldGamepad, oldIndex) => { + if (oldGamepad.index !== gamepad.index) return; + const gamepadToSave = { + axes: [], + buttons: {}, + index: oldGamepad.index, + id: oldGamepad.id + } + hasGamepad = true; + + oldGamepad.axes.forEach((axis, axisIndex) => { + const val = (axis < 0.01 && axis > -0.01) ? 0 : axis; + const newVal = (gamepad.axes[axisIndex] < 0.01 && gamepad.axes[axisIndex] > -0.01) ? 0 : gamepad.axes[axisIndex]; + if (newVal !== val) { + const axis = ['LEFT_STICK_X', 'LEFT_STICK_Y', 'RIGHT_STICK_X', 'RIGHT_STICK_Y'][axisIndex]; + if (!axis) return; + this.dispatchEvent('axischanged', { + axis: axis, + value: newVal, + index: gamepad.index, + label: this.getAxisLabel(axis, newVal), + gamepadIndex: gamepad.index, + }); + } + gamepadToSave.axes[axisIndex] = newVal; + }) + + gamepad.buttons.forEach((button, buttonIndex) => { + let pressed = oldGamepad.buttons[buttonIndex] === 1.0; + if (typeof oldGamepad.buttons[buttonIndex] === "object") { + pressed = oldGamepad.buttons[buttonIndex].pressed; + } + let pressed2 = button === 1.0; + if (typeof button === "object") { + pressed2 = button.pressed; + } + gamepadToSave.buttons[buttonIndex] = {pressed:pressed2}; + if (pressed !== pressed2) { + if (pressed2) { + this.dispatchEvent('buttondown', {index: buttonIndex, label: this.getButtonLabel(buttonIndex), gamepadIndex: gamepad.index}); + } else { + this.dispatchEvent('buttonup', {index: buttonIndex, label:this.getButtonLabel(buttonIndex), gamepadIndex: gamepad.index}); + } + } + + }) + this.gamepads[oldIndex] = gamepadToSave; + }) + if (!hasGamepad) { + this.gamepads.push(gamepads[index]); + this.dispatchEvent('connected', {gamepadIndex: gamepad.index}); + } + }); + + for (let j=0; j 0.5 || value < -0.5) { + if (value > 0) { + valueLabel = '+1'; + } else { + valueLabel = '-1'; + } + } + if (!axis || !valueLabel) { + return null; + } + return `${axis}:${valueLabel}`; + } +} + +window.GamepadHandler = GamepadHandler; diff --git a/semag/emulatorjs/data/loader.js b/semag/emulatorjs/data/loader.js index 7b903ca5..db60e86b 100644 --- a/semag/emulatorjs/data/loader.js +++ b/semag/emulatorjs/data/loader.js @@ -1,117 +1,117 @@ -(async function() { - const folderPath = (path) => path.substring(0, path.length - path.split('/').pop().length); - let scriptPath = (typeof window.EJS_pathtodata === "string") ? window.EJS_pathtodata : folderPath((new URL(document.currentScript.src)).pathname); - if (!scriptPath.endsWith('/')) scriptPath+='/'; - //console.log(scriptPath); - function loadScript(file) { - return new Promise(function (resolve, reject) { - let script = document.createElement('script'); - script.src = function() { - if ('undefined' != typeof EJS_paths && typeof EJS_paths[file] === 'string') { - return EJS_paths[file]; - } else { - return scriptPath+file; - } - }(); - script.onload = resolve; - document.head.appendChild(script); - }) - } - function loadStyle(file) { - return new Promise(function(resolve, reject) { - let css = document.createElement('link'); - css.rel = 'stylesheet'; - css.href = function() { - if ('undefined' != typeof EJS_paths && typeof EJS_paths[file] === 'string') { - return EJS_paths[file]; - } else { - return scriptPath+file; - } - }(); - css.onload = resolve; - document.head.appendChild(css); - }) - } - - if (('undefined' != typeof EJS_DEBUG_XX && true === EJS_DEBUG_XX)) { - await loadScript('emulator.js'); - await loadScript('controls.js'); - await loadScript('nipplejs.js'); - await loadScript('shaders.js'); - await loadScript('storage.js'); - await loadScript('gamepad.js'); - await loadScript('GameManager.js'); - await loadScript('socket.io.min.js'); - await loadStyle('emulator.css'); - } else { - await loadScript('emulator.min.js'); - await loadScript('controls.js'); - await loadStyle('emulator.min.css'); - - } - const config = {}; - config.gameUrl = window.EJS_gameUrl; - config.dataPath = scriptPath; - config.system = window.EJS_core; - config.biosUrl = window.EJS_biosUrl; - config.gameName = window.EJS_gameName; - config.color = window.EJS_color; - config.adUrl = window.EJS_AdUrl; - config.adMode = window.EJS_AdMode; - config.adTimer = window.EJS_AdTimer; - config.adSize = window.EJS_AdSize; - config.alignStartButton = window.EJS_alignStartButton; - config.VirtualGamepadSettings = window.EJS_VirtualGamepadSettings; - config.buttonOpts = window.EJS_Buttons; - config.volume = window.EJS_volume; - config.defaultControllers = window.EJS_defaultControls; - config.startOnLoad = window.EJS_startOnLoaded; - config.fullscreenOnLoad = window.EJS_fullscreenOnLoaded; - config.filePaths = window.EJS_paths; - config.loadState = window.EJS_loadStateURL; - config.cacheLimit = window.EJS_CacheLimit; - config.cheats = window.EJS_cheats; - config.defaultOptions = window.EJS_defaultOptions; - config.gamePatchUrl = window.EJS_gamePatchUrl; - config.gameParentUrl = window.EJS_gameParentUrl; - config.netplayUrl = window.EJS_netplayServer; - config.gameId = window.EJS_gameID; - config.backgroundImg = window.EJS_backgroundImage; - config.backgroundBlur = window.EJS_backgroundBlur; - config.backgroundColor = window.EJS_backgroundColor; - config.controlScheme = window.EJS_controlScheme; - config.threads = window.EJS_threads; - config.disableCue = window.EJS_disableCue; - config.startBtnName = window.EJS_startButtonName; - config.softLoad = window.EJS_softLoad; - - if (typeof window.EJS_language === "string" && window.EJS_language !== "en-US") { - try { - let path; - if ('undefined' != typeof EJS_paths && typeof EJS_paths[window.EJS_language] === 'string') { - path = EJS_paths[window.EJS_language]; - } else { - path = scriptPath+"localization/"+window.EJS_language+".json"; - } - config.language = window.EJS_language; - config.langJson = JSON.parse(await (await fetch(path)).text()); - } catch(e) { - config.langJson = {}; - } - } - - window.EJS_emulator = new EmulatorJS(EJS_player, config); - window.EJS_adBlocked = (url, del) => window.EJS_emulator.adBlocked(url, del); - if (typeof window.EJS_ready === "function") { - window.EJS_emulator.on("ready", window.EJS_ready); - } - if (typeof window.EJS_onGameStart === "function") { - window.EJS_emulator.on("start", window.EJS_onGameStart); - } - if (typeof window.EJS_onLoadState === "function") { - window.EJS_emulator.on("load", window.EJS_onLoadState); - } - if (typeof window.EJS_onSaveState === "function") { - window.EJS_emulator.on("save", window.EJS_onSaveState); - } -})(); +(async function() { + const folderPath = (path) => path.substring(0, path.length - path.split('/').pop().length); + let scriptPath = (typeof window.EJS_pathtodata === "string") ? window.EJS_pathtodata : folderPath((new URL(document.currentScript.src)).pathname); + if (!scriptPath.endsWith('/')) scriptPath+='/'; + //console.log(scriptPath); + function loadScript(file) { + return new Promise(function (resolve, reject) { + let script = document.createElement('script'); + script.src = function() { + if ('undefined' != typeof EJS_paths && typeof EJS_paths[file] === 'string') { + return EJS_paths[file]; + } else { + return scriptPath+file; + } + }(); + script.onload = resolve; + document.head.appendChild(script); + }) + } + function loadStyle(file) { + return new Promise(function(resolve, reject) { + let css = document.createElement('link'); + css.rel = 'stylesheet'; + css.href = function() { + if ('undefined' != typeof EJS_paths && typeof EJS_paths[file] === 'string') { + return EJS_paths[file]; + } else { + return scriptPath+file; + } + }(); + css.onload = resolve; + document.head.appendChild(css); + }) + } + + if (('undefined' != typeof EJS_DEBUG_XX && true === EJS_DEBUG_XX)) { + await loadScript('emulator.js'); + await loadScript('controls.js'); + await loadScript('nipplejs.js'); + await loadScript('shaders.js'); + await loadScript('storage.js'); + await loadScript('gamepad.js'); + await loadScript('GameManager.js'); + await loadScript('socket.io.min.js'); + await loadStyle('emulator.css'); + } else { + await loadScript('emulator.min.js'); + await loadScript('controls.js'); + await loadStyle('emulator.min.css'); + + } + const config = {}; + config.gameUrl = window.EJS_gameUrl; + config.dataPath = scriptPath; + config.system = window.EJS_core; + config.biosUrl = window.EJS_biosUrl; + config.gameName = window.EJS_gameName; + config.color = window.EJS_color; + config.adUrl = window.EJS_AdUrl; + config.adMode = window.EJS_AdMode; + config.adTimer = window.EJS_AdTimer; + config.adSize = window.EJS_AdSize; + config.alignStartButton = window.EJS_alignStartButton; + config.VirtualGamepadSettings = window.EJS_VirtualGamepadSettings; + config.buttonOpts = window.EJS_Buttons; + config.volume = window.EJS_volume; + config.defaultControllers = window.EJS_defaultControls; + config.startOnLoad = window.EJS_startOnLoaded; + config.fullscreenOnLoad = window.EJS_fullscreenOnLoaded; + config.filePaths = window.EJS_paths; + config.loadState = window.EJS_loadStateURL; + config.cacheLimit = window.EJS_CacheLimit; + config.cheats = window.EJS_cheats; + config.defaultOptions = window.EJS_defaultOptions; + config.gamePatchUrl = window.EJS_gamePatchUrl; + config.gameParentUrl = window.EJS_gameParentUrl; + config.netplayUrl = window.EJS_netplayServer; + config.gameId = window.EJS_gameID; + config.backgroundImg = window.EJS_backgroundImage; + config.backgroundBlur = window.EJS_backgroundBlur; + config.backgroundColor = window.EJS_backgroundColor; + config.controlScheme = window.EJS_controlScheme; + config.threads = window.EJS_threads; + config.disableCue = window.EJS_disableCue; + config.startBtnName = window.EJS_startButtonName; + config.softLoad = window.EJS_softLoad; + + if (typeof window.EJS_language === "string" && window.EJS_language !== "en-US") { + try { + let path; + if ('undefined' != typeof EJS_paths && typeof EJS_paths[window.EJS_language] === 'string') { + path = EJS_paths[window.EJS_language]; + } else { + path = scriptPath+"localization/"+window.EJS_language+".json"; + } + config.language = window.EJS_language; + config.langJson = JSON.parse(await (await fetch(path)).text()); + } catch(e) { + config.langJson = {}; + } + } + + window.EJS_emulator = new EmulatorJS(EJS_player, config); + window.EJS_adBlocked = (url, del) => window.EJS_emulator.adBlocked(url, del); + if (typeof window.EJS_ready === "function") { + window.EJS_emulator.on("ready", window.EJS_ready); + } + if (typeof window.EJS_onGameStart === "function") { + window.EJS_emulator.on("start", window.EJS_onGameStart); + } + if (typeof window.EJS_onLoadState === "function") { + window.EJS_emulator.on("load", window.EJS_onLoadState); + } + if (typeof window.EJS_onSaveState === "function") { + window.EJS_emulator.on("save", window.EJS_onSaveState); + } +})(); diff --git a/semag/emulatorjs/data/localization/Translate.html b/semag/emulatorjs/data/localization/Translate.html index d1ac1e36..49b89df8 100644 --- a/semag/emulatorjs/data/localization/Translate.html +++ b/semag/emulatorjs/data/localization/Translate.html @@ -1,347 +1,348 @@ - - - - - EmulalorJS | Translate Languages - - - -
    -

    Translate Languages

    - -
    -
    - - - - - - + + + + + EmulalorJS | Translate Languages + + + +
    +

    Translate Languages

    + +
    +
    + + + + + + \ No newline at end of file diff --git a/semag/emulatorjs/data/localization/af-FR.json b/semag/emulatorjs/data/localization/af-FR.json index ebfa601c..96944d13 100644 --- a/semag/emulatorjs/data/localization/af-FR.json +++ b/semag/emulatorjs/data/localization/af-FR.json @@ -1,301 +1,301 @@ -{ - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7", - "8": "8", - "9": "9", - "Restart": "Redémarrage", - "Pause": "Pause", - "Play": "Jouer", - "Save State": "Enregistrer l'état", - "Load State": "État de chargement", - "Control Settings": "Paramètres de contrôle", - "Cheats": "Astuces", - "Cache Manager": "Gestionnaire de cache", - "Export Save File": "Exporter le fichier de sauvegarde", - "Import Save File": "Importer le fichier de sauvegarde", - "Netplay": "Jeu en réseau", - "Mute": "Muet", - "Unmute": "Rétablir le son", - "Settings": "Paramètres", - "Enter Fullscreen": "Passer en mode plein écran", - "Exit Fullscreen": "Quitter le mode plein écran", - "Reset": "Réinitialiser", - "Clear": "Clair", - "Close": "Fermer", - "QUICK SAVE STATE": "ÉTAT DE SAUVEGARDE RAPIDE", - "QUICK LOAD STATE": "ÉTAT DE CHARGEMENT RAPIDE", - "CHANGE STATE SLOT": "CHANGER L'EMPLACEMENT D'ÉTAT", - "FAST FORWARD": "AVANCE RAPIDE", - "Player": "Joueur", - "Connected Gamepad": "Manette connectée", - "Gamepad": "Manette de jeu", - "Keyboard": "Clavier", - "Set": "Ensemble", - "Add Cheat": "Ajouter une triche", - "Create a Room": "Créer une pièce", - "Rooms": "Pièces", - "Start Game": "Démarrer jeu", - "Loading...": "Chargement...", - "Download Game Core": "Télécharger le noyau du jeu", - "Decompress Game Core": "Décompresser le noyau du jeu", - "Download Game Data": "Télécharger les données du jeu", - "Decompress Game Data": "Décompresser les données de jeu", - "Shaders": "Shaders", - "Disabled": "Désactivé", - "2xScaleHQ": "2xScaleHQ", - "4xScaleHQ": "4xScaleHQ", - "CRT easymode": "Mode facile CRT", - "CRT aperture": "Ouverture CRT", - "CRT geom": "géomètre CRT", - "CRT mattias": "Mattias CRT", - "FPS": "FPS", - "show": "montrer", - "hide": "cacher", - "Fast Forward Ratio": "Rapport d'avance rapide", - "Fast Forward": "Avance rapide", - "Enabled": "Activé", - "Save State Slot": "Enregistrer l'emplacement d'état", - "Save State Location": "Enregistrer l'emplacement de l'état", - "Download": "Télécharger", - "Keep in Browser": "Conserver dans le navigateur", - "Auto": "Auto", - "NTSC": "NTSC", - "PAL": "COPAIN", - "Dendy": "Dendy", - "8:7 PAR": "PAR 8:7", - "4:3": "4:3", - "Low": "Faible", - "High": "Haut", - "Very High": "Très haut", - "None": "Aucun", - "Player 1": "Joueur 1", - "Player 2": "Joueur 2", - "Both": "Les deux", - "SAVED STATE TO SLOT": "ÉTAT SAUVEGARDÉ DANS L'EMPLACEMENT", - "LOADED STATE FROM SLOT": "ÉTAT CHARGÉ À PARTIR DE L'EMPLACEMENT", - "SET SAVE STATE SLOT TO": "SET SAVE STATE SLOT TO", - "Network Error": "Erreur réseau", - "Submit": "Soumettre", - "Description": "Description", - "Code": "Code", - "Add Cheat Code": "Ajouter un code de triche", - "Leave Room": "Quitter la pièce", - "Password": "Mot de passe", - "Password (optional)": "Mot de passe (facultatif)", - "Max Players": "Le maximum de joueurs", - "Room Name": "Nom de la salle", - "Join": "Rejoindre", - "Player Name": "Nom de joueur", - "Set Player Name": "Définir le nom du joueur", - "Left Handed Mode": "Mode gaucher", - "Virtual Gamepad": "Manette de jeu virtuelle", - "Disk": "Disque", - "Press Keyboard": "Appuyez sur le clavier", - "INSERT COIN": "INSÉRER UNE PIÈCE", - "Remove": "Retirer", - "SAVE LOADED FROM BROWSER": "ENREGISTRER CHARGÉ À PARTIR DU NAVIGATEUR", - "SAVE SAVED TO BROWSER": "ENREGISTRER ENREGISTRÉ DANS LE NAVIGATEUR", - "Join the discord": "Rejoignez la discorde", - "View on GitHub": "Afficher sur GitHub", - "Failed to start game": "Impossible de démarrer le jeu", - "Download Game BIOS": "Télécharger le BIOS du jeu", - "Decompress Game BIOS": "Décompresser le BIOS du jeu", - "Download Game Parent": "Télécharger le jeu Parent", - "Decompress Game Parent": "Décompresser le jeu parent", - "Download Game Patch": "Télécharger le patch du jeu", - "Decompress Game Patch": "Décompresser le patch du jeu", - "Download Game State": "Télécharger l'état du jeu", - "Check console": "Vérifier la console", - "Error for site owner": "Erreur pour le propriétaire du site", - "EmulatorJS": "EmulatorJS", - "Clear All": "Tout effacer", - "Take Screenshot": "Prendre une capture d'écran", - "Quick Save": "Sauvegarde rapide", - "Quick Load": "Chargement rapide", - "REWIND": "REMBOBINER", - "Rewind Enabled (requires restart)": "Rewind activé (nécessite un redémarrage)", - "Rewind Granularity": "Rembobiner la granularité", - "Slow Motion Ratio": "Rapport de ralenti", - "Slow Motion": "Ralenti", - "Home": "Maison", - "EmulatorJS License": "Licence EmulatorJS", - "RetroArch License": "Licence RetroArch", - "SLOW MOTION": "RALENTI", - "A": "UN", - "B": "B", - "SELECT": "SÉLECTIONNER", - "START": "COMMENCER", - "UP": "EN HAUT", - "DOWN": "VERS LE BAS", - "LEFT": "GAUCHE", - "RIGHT": "DROITE", - "X": "X", - "Y": "Oui", - "L": "L", - "R": "R", - "Z": "Z", - "STICK UP": "BÂTON VERS LE HAUT", - "STICK DOWN": "COLLER", - "STICK LEFT": "BÂTON GAUCHE", - "STICK RIGHT": "COLLEZ À DROITE", - "C-PAD UP": "C-PAD VERS LE HAUT", - "C-PAD DOWN": "C-PAD EN BAS", - "C-PAD LEFT": "C-PAD GAUCHE", - "C-PAD RIGHT": "C-PAD DROIT", - "MICROPHONE": "MICROPHONE", - "BUTTON 1 / START": "BOUTON 1 / DÉMARRER", - "BUTTON 2": "BOUTON 2", - "BUTTON": "BOUTON", - "LEFT D-PAD UP": "D-PAD GAUCHE HAUT", - "LEFT D-PAD DOWN": "D-PAD GAUCHE BAS", - "LEFT D-PAD LEFT": "D-PAD GAUCHE GAUCHE", - "LEFT D-PAD RIGHT": "D-PAD GAUCHE DROITE", - "RIGHT D-PAD UP": "D-PAD DROIT VERS LE HAUT", - "RIGHT D-PAD DOWN": "D-PAD DROIT BAS", - "RIGHT D-PAD LEFT": "D-PAD DROIT GAUCHE", - "RIGHT D-PAD RIGHT": "DROITE D-PAD DROITE", - "C": "C", - "MODE": "MODE", - "FIRE": "FEU", - "RESET": "RÉINITIALISER", - "LEFT DIFFICULTY A": "GAUCHE DIFFICULTÉ A", - "LEFT DIFFICULTY B": "GAUCHE DIFFICULTÉ B", - "RIGHT DIFFICULTY A": "BONNE DIFFICULTÉ A", - "RIGHT DIFFICULTY B": "DROITE DIFFICULTE B", - "COLOR": "COULEUR", - "B/W": "N/B", - "PAUSE": "PAUSE", - "OPTION": "OPTION", - "OPTION 1": "OPTION 1", - "OPTION 2": "OPTION 2", - "L2": "L2", - "R2": "R2", - "L3": "L3", - "R3": "R3", - "L STICK UP": "L BÂTON VERS LE HAUT", - "L STICK DOWN": "L BÂTON VERS LE BAS", - "L STICK LEFT": "BÂTON L GAUCHE", - "L STICK RIGHT": "L BÂTON DROIT", - "R STICK UP": "R STICK UP", - "R STICK DOWN": "BÂTON R ENFONCÉ", - "R STICK LEFT": "R STICK GAUCHE", - "R STICK RIGHT": "BÂTON R DROIT", - "Start": "Commencer", - "Select": "Sélectionner", - "Fast": "Rapide", - "Slow": "Lent", - "a": "un", - "b": "b", - "c": "c", - "d": "d", - "e": "e", - "f": "F", - "g": "g", - "h": "h", - "i": "je", - "j": "j", - "k": "k", - "l": "je", - "m": "m", - "n": "n", - "o": "o", - "p": "p", - "q": "q", - "r": "r", - "s": "s", - "t": "t", - "u": "tu", - "v": "v", - "w": "w", - "x": "X", - "y": "y", - "z": "z", - "enter": "entrer", - "escape": "s'échapper", - "space": "espace", - "tab": "languette", - "backspace": "retour arrière", - "delete": "supprimer", - "arrowup": "flèche vers le haut", - "arrowdown": "flèche vers le bas", - "arrowleft": "flèche gauche", - "arrowright": "flèche droite", - "f1": "f1", - "f2": "f2", - "f3": "f3", - "f4": "f4", - "f5": "f5", - "f6": "f6", - "f7": "f7", - "f8": "f8", - "f9": "f9", - "f10": "f10", - "f11": "f11", - "f12": "f12", - "shift": "changement", - "control": "contrôle", - "alt": "autre", - "meta": "méta", - "capslock": "verrouillage des majuscules", - "insert": "insérer", - "home": "maison", - "end": "fin", - "pageup": "pageup", - "pagedown": "bas de page", - "!": "!", - "@": "@", - "#": "#", - "$": "$", - "%": "%", - "^": "^", - "&": "&", - "*": "*", - "(": "(", - ")": ")", - "-": "-", - "_": "_", - "+": "+", - "=": "=", - "[": "[", - "]": "]", - "{": "{", - "}": "}", - ";": ";", - ":": ":", - "'": "'", - "\"": "\"", - ",": ",", - ".": ".", - "<": "<", - ">": ">", - "/": "/", - "?": "?", - "LEFT_STICK_X": "LEFT_STICK_X", - "LEFT_STICK_Y": "LEFT_STICK_Y", - "RIGHT_STICK_X": "RIGHT_STICK_X", - "RIGHT_STICK_Y": "RIGHT_STICK_Y", - "LEFT_TRIGGER": "GÂCHETTE GAUCHE", - "RIGHT_TRIGGER": "RIGHT_TRIGGER", - "A_BUTTON": "UN BOUTON", - "B_BUTTON": "B_BUTTON", - "X_BUTTON": "X_BUTTON", - "Y_BUTTON": "Y_BUTTON", - "START_BUTTON": "BOUTON START", - "SELECT_BUTTON": "SELECT_BUTTON", - "L1_BUTTON": "L1_BUTTON", - "R1_BUTTON": "R1_BUTTON", - "L2_BUTTON": "L2_BUTTON", - "R2_BUTTON": "R2_BUTTON", - "LEFT_THUMB_BUTTON": "LEFT_THUMB_BUTTON", - "RIGHT_THUMB_BUTTON": "RIGHT_THUMB_BUTTON", - "DPAD_UP": "DPAD_UP", - "DPAD_DOWN": "DPAD_DOWN", - "DPAD_LEFT": "DPAD_LEFT", - "DPAD_RIGHT": "DPAD_RIGHT" +{ + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7", + "8": "8", + "9": "9", + "Restart": "Redémarrage", + "Pause": "Pause", + "Play": "Jouer", + "Save State": "Enregistrer l'état", + "Load State": "État de chargement", + "Control Settings": "Paramètres de contrôle", + "Cheats": "Astuces", + "Cache Manager": "Gestionnaire de cache", + "Export Save File": "Exporter le fichier de sauvegarde", + "Import Save File": "Importer le fichier de sauvegarde", + "Netplay": "Jeu en réseau", + "Mute": "Muet", + "Unmute": "Rétablir le son", + "Settings": "Paramètres", + "Enter Fullscreen": "Passer en mode plein écran", + "Exit Fullscreen": "Quitter le mode plein écran", + "Reset": "Réinitialiser", + "Clear": "Clair", + "Close": "Fermer", + "QUICK SAVE STATE": "ÉTAT DE SAUVEGARDE RAPIDE", + "QUICK LOAD STATE": "ÉTAT DE CHARGEMENT RAPIDE", + "CHANGE STATE SLOT": "CHANGER L'EMPLACEMENT D'ÉTAT", + "FAST FORWARD": "AVANCE RAPIDE", + "Player": "Joueur", + "Connected Gamepad": "Manette connectée", + "Gamepad": "Manette de jeu", + "Keyboard": "Clavier", + "Set": "Ensemble", + "Add Cheat": "Ajouter une triche", + "Create a Room": "Créer une pièce", + "Rooms": "Pièces", + "Start Game": "Démarrer jeu", + "Loading...": "Chargement...", + "Download Game Core": "Télécharger le noyau du jeu", + "Decompress Game Core": "Décompresser le noyau du jeu", + "Download Game Data": "Télécharger les données du jeu", + "Decompress Game Data": "Décompresser les données de jeu", + "Shaders": "Shaders", + "Disabled": "Désactivé", + "2xScaleHQ": "2xScaleHQ", + "4xScaleHQ": "4xScaleHQ", + "CRT easymode": "Mode facile CRT", + "CRT aperture": "Ouverture CRT", + "CRT geom": "géomètre CRT", + "CRT mattias": "Mattias CRT", + "FPS": "FPS", + "show": "montrer", + "hide": "cacher", + "Fast Forward Ratio": "Rapport d'avance rapide", + "Fast Forward": "Avance rapide", + "Enabled": "Activé", + "Save State Slot": "Enregistrer l'emplacement d'état", + "Save State Location": "Enregistrer l'emplacement de l'état", + "Download": "Télécharger", + "Keep in Browser": "Conserver dans le navigateur", + "Auto": "Auto", + "NTSC": "NTSC", + "PAL": "COPAIN", + "Dendy": "Dendy", + "8:7 PAR": "PAR 8:7", + "4:3": "4:3", + "Low": "Faible", + "High": "Haut", + "Very High": "Très haut", + "None": "Aucun", + "Player 1": "Joueur 1", + "Player 2": "Joueur 2", + "Both": "Les deux", + "SAVED STATE TO SLOT": "ÉTAT SAUVEGARDÉ DANS L'EMPLACEMENT", + "LOADED STATE FROM SLOT": "ÉTAT CHARGÉ À PARTIR DE L'EMPLACEMENT", + "SET SAVE STATE SLOT TO": "SET SAVE STATE SLOT TO", + "Network Error": "Erreur réseau", + "Submit": "Soumettre", + "Description": "Description", + "Code": "Code", + "Add Cheat Code": "Ajouter un code de triche", + "Leave Room": "Quitter la pièce", + "Password": "Mot de passe", + "Password (optional)": "Mot de passe (facultatif)", + "Max Players": "Le maximum de joueurs", + "Room Name": "Nom de la salle", + "Join": "Rejoindre", + "Player Name": "Nom de joueur", + "Set Player Name": "Définir le nom du joueur", + "Left Handed Mode": "Mode gaucher", + "Virtual Gamepad": "Manette de jeu virtuelle", + "Disk": "Disque", + "Press Keyboard": "Appuyez sur le clavier", + "INSERT COIN": "INSÉRER UNE PIÈCE", + "Remove": "Retirer", + "SAVE LOADED FROM BROWSER": "ENREGISTRER CHARGÉ À PARTIR DU NAVIGATEUR", + "SAVE SAVED TO BROWSER": "ENREGISTRER ENREGISTRÉ DANS LE NAVIGATEUR", + "Join the discord": "Rejoignez la discorde", + "View on GitHub": "Afficher sur GitHub", + "Failed to start game": "Impossible de démarrer le jeu", + "Download Game BIOS": "Télécharger le BIOS du jeu", + "Decompress Game BIOS": "Décompresser le BIOS du jeu", + "Download Game Parent": "Télécharger le jeu Parent", + "Decompress Game Parent": "Décompresser le jeu parent", + "Download Game Patch": "Télécharger le patch du jeu", + "Decompress Game Patch": "Décompresser le patch du jeu", + "Download Game State": "Télécharger l'état du jeu", + "Check console": "Vérifier la console", + "Error for site owner": "Erreur pour le propriétaire du site", + "EmulatorJS": "EmulatorJS", + "Clear All": "Tout effacer", + "Take Screenshot": "Prendre une capture d'écran", + "Quick Save": "Sauvegarde rapide", + "Quick Load": "Chargement rapide", + "REWIND": "REMBOBINER", + "Rewind Enabled (requires restart)": "Rewind activé (nécessite un redémarrage)", + "Rewind Granularity": "Rembobiner la granularité", + "Slow Motion Ratio": "Rapport de ralenti", + "Slow Motion": "Ralenti", + "Home": "Maison", + "EmulatorJS License": "Licence EmulatorJS", + "RetroArch License": "Licence RetroArch", + "SLOW MOTION": "RALENTI", + "A": "UN", + "B": "B", + "SELECT": "SÉLECTIONNER", + "START": "COMMENCER", + "UP": "EN HAUT", + "DOWN": "VERS LE BAS", + "LEFT": "GAUCHE", + "RIGHT": "DROITE", + "X": "X", + "Y": "Oui", + "L": "L", + "R": "R", + "Z": "Z", + "STICK UP": "BÂTON VERS LE HAUT", + "STICK DOWN": "COLLER", + "STICK LEFT": "BÂTON GAUCHE", + "STICK RIGHT": "COLLEZ À DROITE", + "C-PAD UP": "C-PAD VERS LE HAUT", + "C-PAD DOWN": "C-PAD EN BAS", + "C-PAD LEFT": "C-PAD GAUCHE", + "C-PAD RIGHT": "C-PAD DROIT", + "MICROPHONE": "MICROPHONE", + "BUTTON 1 / START": "BOUTON 1 / DÉMARRER", + "BUTTON 2": "BOUTON 2", + "BUTTON": "BOUTON", + "LEFT D-PAD UP": "D-PAD GAUCHE HAUT", + "LEFT D-PAD DOWN": "D-PAD GAUCHE BAS", + "LEFT D-PAD LEFT": "D-PAD GAUCHE GAUCHE", + "LEFT D-PAD RIGHT": "D-PAD GAUCHE DROITE", + "RIGHT D-PAD UP": "D-PAD DROIT VERS LE HAUT", + "RIGHT D-PAD DOWN": "D-PAD DROIT BAS", + "RIGHT D-PAD LEFT": "D-PAD DROIT GAUCHE", + "RIGHT D-PAD RIGHT": "DROITE D-PAD DROITE", + "C": "C", + "MODE": "MODE", + "FIRE": "FEU", + "RESET": "RÉINITIALISER", + "LEFT DIFFICULTY A": "GAUCHE DIFFICULTÉ A", + "LEFT DIFFICULTY B": "GAUCHE DIFFICULTÉ B", + "RIGHT DIFFICULTY A": "BONNE DIFFICULTÉ A", + "RIGHT DIFFICULTY B": "DROITE DIFFICULTE B", + "COLOR": "COULEUR", + "B/W": "N/B", + "PAUSE": "PAUSE", + "OPTION": "OPTION", + "OPTION 1": "OPTION 1", + "OPTION 2": "OPTION 2", + "L2": "L2", + "R2": "R2", + "L3": "L3", + "R3": "R3", + "L STICK UP": "L BÂTON VERS LE HAUT", + "L STICK DOWN": "L BÂTON VERS LE BAS", + "L STICK LEFT": "BÂTON L GAUCHE", + "L STICK RIGHT": "L BÂTON DROIT", + "R STICK UP": "R STICK UP", + "R STICK DOWN": "BÂTON R ENFONCÉ", + "R STICK LEFT": "R STICK GAUCHE", + "R STICK RIGHT": "BÂTON R DROIT", + "Start": "Commencer", + "Select": "Sélectionner", + "Fast": "Rapide", + "Slow": "Lent", + "a": "un", + "b": "b", + "c": "c", + "d": "d", + "e": "e", + "f": "F", + "g": "g", + "h": "h", + "i": "je", + "j": "j", + "k": "k", + "l": "je", + "m": "m", + "n": "n", + "o": "o", + "p": "p", + "q": "q", + "r": "r", + "s": "s", + "t": "t", + "u": "tu", + "v": "v", + "w": "w", + "x": "X", + "y": "y", + "z": "z", + "enter": "entrer", + "escape": "s'échapper", + "space": "espace", + "tab": "languette", + "backspace": "retour arrière", + "delete": "supprimer", + "arrowup": "flèche vers le haut", + "arrowdown": "flèche vers le bas", + "arrowleft": "flèche gauche", + "arrowright": "flèche droite", + "f1": "f1", + "f2": "f2", + "f3": "f3", + "f4": "f4", + "f5": "f5", + "f6": "f6", + "f7": "f7", + "f8": "f8", + "f9": "f9", + "f10": "f10", + "f11": "f11", + "f12": "f12", + "shift": "changement", + "control": "contrôle", + "alt": "autre", + "meta": "méta", + "capslock": "verrouillage des majuscules", + "insert": "insérer", + "home": "maison", + "end": "fin", + "pageup": "pageup", + "pagedown": "bas de page", + "!": "!", + "@": "@", + "#": "#", + "$": "$", + "%": "%", + "^": "^", + "&": "&", + "*": "*", + "(": "(", + ")": ")", + "-": "-", + "_": "_", + "+": "+", + "=": "=", + "[": "[", + "]": "]", + "{": "{", + "}": "}", + ";": ";", + ":": ":", + "'": "'", + "\"": "\"", + ",": ",", + ".": ".", + "<": "<", + ">": ">", + "/": "/", + "?": "?", + "LEFT_STICK_X": "LEFT_STICK_X", + "LEFT_STICK_Y": "LEFT_STICK_Y", + "RIGHT_STICK_X": "RIGHT_STICK_X", + "RIGHT_STICK_Y": "RIGHT_STICK_Y", + "LEFT_TRIGGER": "GÂCHETTE GAUCHE", + "RIGHT_TRIGGER": "RIGHT_TRIGGER", + "A_BUTTON": "UN BOUTON", + "B_BUTTON": "B_BUTTON", + "X_BUTTON": "X_BUTTON", + "Y_BUTTON": "Y_BUTTON", + "START_BUTTON": "BOUTON START", + "SELECT_BUTTON": "SELECT_BUTTON", + "L1_BUTTON": "L1_BUTTON", + "R1_BUTTON": "R1_BUTTON", + "L2_BUTTON": "L2_BUTTON", + "R2_BUTTON": "R2_BUTTON", + "LEFT_THUMB_BUTTON": "LEFT_THUMB_BUTTON", + "RIGHT_THUMB_BUTTON": "RIGHT_THUMB_BUTTON", + "DPAD_UP": "DPAD_UP", + "DPAD_DOWN": "DPAD_DOWN", + "DPAD_LEFT": "DPAD_LEFT", + "DPAD_RIGHT": "DPAD_RIGHT" } \ No newline at end of file diff --git a/semag/emulatorjs/data/localization/ar-AR.json b/semag/emulatorjs/data/localization/ar-AR.json index 6c6f715c..b5289fc4 100644 --- a/semag/emulatorjs/data/localization/ar-AR.json +++ b/semag/emulatorjs/data/localization/ar-AR.json @@ -1,301 +1,301 @@ -{ - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7", - "8": "8", - "9": "9", - "Restart": "إعادة تشغيل", - "Pause": "يوقف", - "Play": "يلعب", - "Save State": "حالة الحفظ", - "Load State": "الدولة الحمل", - "Control Settings": "إعدادات التحكم", - "Cheats": "غش", - "Cache Manager": "مدير ذاكرة التخزين المؤقت", - "Export Save File": "تصدير حفظ الملف", - "Import Save File": "استيراد حفظ ملف", - "Netplay": "نيت بلاي", - "Mute": "صامت", - "Unmute": "إعادة الصوت", - "Settings": "إعدادات", - "Enter Fullscreen": "أدخل ملء الشاشة", - "Exit Fullscreen": "الخروج من الشاشة الكاملة", - "Reset": "إعادة ضبط", - "Clear": "واضح", - "Close": "يغلق", - "QUICK SAVE STATE": "حالة الحفظ السريع", - "QUICK LOAD STATE": "حالة التحميل السريع", - "CHANGE STATE SLOT": "تغيير فتحة الدولة", - "FAST FORWARD": "تقدم سريع", - "Player": "لاعب", - "Connected Gamepad": "Gamepad متصل", - "Gamepad": "لوحة الألعاب", - "Keyboard": "لوحة المفاتيح", - "Set": "تعيين", - "Add Cheat": "أضف الغش", - "Create a Room": "أنشئ غرفة", - "Rooms": "غرف", - "Start Game": "بدء اللعبة", - "Loading...": "تحميل...", - "Download Game Core": "تحميل Game Core", - "Decompress Game Core": "فك ضغط جوهر اللعبة", - "Download Game Data": "تنزيل بيانات اللعبة", - "Decompress Game Data": "فك ضغط بيانات اللعبة", - "Shaders": "شادر", - "Disabled": "عاجز", - "2xScaleHQ": "2xScaleHQ", - "4xScaleHQ": "4xScaleHQ", - "CRT easymode": "وضع CRT السهل", - "CRT aperture": "فتحة CRT", - "CRT geom": "CRT geom", - "CRT mattias": "CRT ماتياس", - "FPS": "FPS", - "show": "يعرض", - "hide": "يخفي", - "Fast Forward Ratio": "نسبة التقديم السريع", - "Fast Forward": "تقديم سريع", - "Enabled": "ممكن", - "Save State Slot": "حفظ الدولة فتحة", - "Save State Location": "حفظ موقع الدولة", - "Download": "تحميل", - "Keep in Browser": "ابق في المتصفح", - "Auto": "آلي", - "NTSC": "NTSC", - "PAL": "صديق", - "Dendy": "دندي", - "8:7 PAR": "8: 7 PAR", - "4:3": "4: 3", - "Low": "قليل", - "High": "عالي", - "Very High": "عالي جدا", - "None": "لا أحد", - "Player 1": "اللاعب 1", - "Player 2": "اللاعب 2", - "Both": "كلاهما", - "SAVED STATE TO SLOT": "الدولة المحفوظة في فتحة", - "LOADED STATE FROM SLOT": "حالة محملة من الفتحة", - "SET SAVE STATE SLOT TO": "تعيين فتحة حفظ الحالة إلى", - "Network Error": "خطأ في الشبكة", - "Submit": "يُقدِّم", - "Description": "وصف", - "Code": "شفرة", - "Add Cheat Code": "أضف كود الغش", - "Leave Room": "غادر الغرفة", - "Password": "كلمة المرور", - "Password (optional)": "كلمة المرور (اختياري)", - "Max Players": "ماكس لاعبين", - "Room Name": "اسم الغرفة", - "Join": "ينضم", - "Player Name": "اسم اللاعب", - "Set Player Name": "تعيين اسم اللاعب", - "Left Handed Mode": "وضع اليد اليسرى", - "Virtual Gamepad": "لوحة الألعاب الافتراضية", - "Disk": "القرص", - "Press Keyboard": "اضغط على لوحة المفاتيح", - "INSERT COIN": "إدراج عملة", - "Remove": "يزيل", - "SAVE LOADED FROM BROWSER": "وفر محملًا من المتصفح", - "SAVE SAVED TO BROWSER": "تم الحفظ في المتصفح", - "Join the discord": "انضم إلى الفتنة", - "View on GitHub": "عرض على جيثب", - "Failed to start game": "فشل بدء اللعبة", - "Download Game BIOS": "تنزيل Game BIOS", - "Decompress Game BIOS": "فك ضغط Game BIOS", - "Download Game Parent": "تحميل Game Parent", - "Decompress Game Parent": "فك ضغط لعبة الوالد", - "Download Game Patch": "تنزيل Game Patch", - "Decompress Game Patch": "فك ضغط لعبة التصحيح", - "Download Game State": "تنزيل Game State", - "Check console": "تحقق من وحدة التحكم", - "Error for site owner": "خطأ لمالك الموقع", - "EmulatorJS": "المحاكي JS", - "Clear All": "امسح الكل", - "Take Screenshot": "خد لقطة للشاشة", - "Quick Save": "الحفظ السريع", - "Quick Load": "تحميل سريع", - "REWIND": "الترجيع", - "Rewind Enabled (requires restart)": "تم تمكين الترجيع (يتطلب إعادة التشغيل)", - "Rewind Granularity": "الترجيع المحبب", - "Slow Motion Ratio": "نسبة الحركة البطيئة", - "Slow Motion": "حركة بطيئة", - "Home": "بيت", - "EmulatorJS License": "رخصة EmulatorJS", - "RetroArch License": "ترخيص RetroArch", - "SLOW MOTION": "حركة بطيئة", - "A": "أ", - "B": "ب", - "SELECT": "يختار", - "START": "يبدأ", - "UP": "أعلى", - "DOWN": "تحت", - "LEFT": "غادر", - "RIGHT": "يمين", - "X": "X", - "Y": "ص", - "L": "إل", - "R": "ص", - "Z": "ض", - "STICK UP": "التصق", - "STICK DOWN": "التصق اسفل", - "STICK LEFT": "العصا اليسرى", - "STICK RIGHT": "العصا لليمين", - "C-PAD UP": "C-PAD UP", - "C-PAD DOWN": "C-PAD لأسفل", - "C-PAD LEFT": "يسار C-PAD", - "C-PAD RIGHT": "حق C-PAD", - "MICROPHONE": "ميكروفون", - "BUTTON 1 / START": "زر 1 / بدء", - "BUTTON 2": "الزر 2", - "BUTTON": "زر", - "LEFT D-PAD UP": "اليسار D-PAD UP", - "LEFT D-PAD DOWN": "اليسار D-PAD لأسفل", - "LEFT D-PAD LEFT": "اليسار D-PAD اليسار", - "LEFT D-PAD RIGHT": "اليسار D-PAD لليمين", - "RIGHT D-PAD UP": "حق D-PAD UP", - "RIGHT D-PAD DOWN": "لليمين D-PAD لأسفل", - "RIGHT D-PAD LEFT": "اليمين D-PAD اليسار", - "RIGHT D-PAD RIGHT": "حق D-PAD لليمين", - "C": "ج", - "MODE": "وضع", - "FIRE": "نار", - "RESET": "إعادة ضبط", - "LEFT DIFFICULTY A": "الصعوبة اليسرى أ", - "LEFT DIFFICULTY B": "الصعوبة اليسرى ب", - "RIGHT DIFFICULTY A": "الصعوبة الصحيحة أ", - "RIGHT DIFFICULTY B": "الصعوبة الصحيحة ب", - "COLOR": "لون", - "B/W": "ب / دبليو", - "PAUSE": "يوقف", - "OPTION": "خيار", - "OPTION 1": "الخيار 1", - "OPTION 2": "الخيار 2", - "L2": "L2", - "R2": "R2", - "L3": "L3", - "R3": "R3", - "L STICK UP": "إلصاق", - "L STICK DOWN": "العصا لأسفل", - "L STICK LEFT": "L العصا اليسار", - "L STICK RIGHT": "L العصا لليمين", - "R STICK UP": "R التصق", - "R STICK DOWN": "R العصا لأسفل", - "R STICK LEFT": "R العصا اليسار", - "R STICK RIGHT": "R العصا لليمين", - "Start": "يبدأ", - "Select": "يختار", - "Fast": "سريع", - "Slow": "بطيء", - "a": "أ", - "b": "ب", - "c": "ج", - "d": "د", - "e": "ه", - "f": "F", - "g": "ز", - "h": "ح", - "i": "أنا", - "j": "ي", - "k": "ك", - "l": "ل", - "m": "م", - "n": "ن", - "o": "ا", - "p": "ص", - "q": "ف", - "r": "ص", - "s": "س", - "t": "ر", - "u": "ش", - "v": "الخامس", - "w": "ث", - "x": "x", - "y": "ذ", - "z": "ض", - "enter": "يدخل", - "escape": "يهرب", - "space": "فضاء", - "tab": "فاتورة غير مدفوعة", - "backspace": "مسافة للخلف", - "delete": "يمسح", - "arrowup": "السهم", - "arrowdown": "السهم للاسفل", - "arrowleft": "السهم", - "arrowright": "السهم", - "f1": "و 1", - "f2": "f2", - "f3": "f3", - "f4": "f4", - "f5": "f5", - "f6": "و 6", - "f7": "f7", - "f8": "و ٨", - "f9": "و 9", - "f10": "f10", - "f11": "و 11", - "f12": "f12", - "shift": "يحول", - "control": "يتحكم", - "alt": "بديل", - "meta": "ميتا", - "capslock": "caps lock", - "insert": "إدراج", - "home": "بيت", - "end": "نهاية", - "pageup": "pageup", - "pagedown": "اسفل الصفحة", - "!": "!", - "@": "@", - "#": "#", - "$": "$", - "%": "٪", - "^": "^", - "&": "&", - "*": "*", - "(": "(", - ")": ")", - "-": "-", - "_": "_", - "+": "+", - "=": "=", - "[": "[", - "]": "]", - "{": "{", - "}": "}", - ";": "؛", - ":": ":", - "'": "\"", - "\"": "\"", - ",": "و", - ".": ".", - "<": "<", - ">": ">", - "/": "/", - "?": "؟", - "LEFT_STICK_X": "LEFT_STICK_X", - "LEFT_STICK_Y": "LEFT_STICK_Y", - "RIGHT_STICK_X": "RIGHT_STICK_X", - "RIGHT_STICK_Y": "RIGHT_STICK_Y", - "LEFT_TRIGGER": "الزناد الأيسر", - "RIGHT_TRIGGER": "الزناد الأيمن", - "A_BUTTON": "الزر", - "B_BUTTON": "B_BUTTON", - "X_BUTTON": "X_BUTTON", - "Y_BUTTON": "Y_BUTTON", - "START_BUTTON": "START_BUTTON", - "SELECT_BUTTON": "حدد زر", - "L1_BUTTON": "L1_BUTTON", - "R1_BUTTON": "R1_BUTTON", - "L2_BUTTON": "L2_BUTTON", - "R2_BUTTON": "R2_BUTTON", - "LEFT_THUMB_BUTTON": "LEFT_THUMB_BUTTON", - "RIGHT_THUMB_BUTTON": "RIGHT_THUMB_BUTTON", - "DPAD_UP": "DPAD_UP", - "DPAD_DOWN": "DPAD_DOWN", - "DPAD_LEFT": "DPAD_LEFT", - "DPAD_RIGHT": "DPAD_RIGHT" +{ + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7", + "8": "8", + "9": "9", + "Restart": "إعادة تشغيل", + "Pause": "يوقف", + "Play": "يلعب", + "Save State": "حالة الحفظ", + "Load State": "الدولة الحمل", + "Control Settings": "إعدادات التحكم", + "Cheats": "غش", + "Cache Manager": "مدير ذاكرة التخزين المؤقت", + "Export Save File": "تصدير حفظ الملف", + "Import Save File": "استيراد حفظ ملف", + "Netplay": "نيت بلاي", + "Mute": "صامت", + "Unmute": "إعادة الصوت", + "Settings": "إعدادات", + "Enter Fullscreen": "أدخل ملء الشاشة", + "Exit Fullscreen": "الخروج من الشاشة الكاملة", + "Reset": "إعادة ضبط", + "Clear": "واضح", + "Close": "يغلق", + "QUICK SAVE STATE": "حالة الحفظ السريع", + "QUICK LOAD STATE": "حالة التحميل السريع", + "CHANGE STATE SLOT": "تغيير فتحة الدولة", + "FAST FORWARD": "تقدم سريع", + "Player": "لاعب", + "Connected Gamepad": "Gamepad متصل", + "Gamepad": "لوحة الألعاب", + "Keyboard": "لوحة المفاتيح", + "Set": "تعيين", + "Add Cheat": "أضف الغش", + "Create a Room": "أنشئ غرفة", + "Rooms": "غرف", + "Start Game": "بدء اللعبة", + "Loading...": "تحميل...", + "Download Game Core": "تحميل Game Core", + "Decompress Game Core": "فك ضغط جوهر اللعبة", + "Download Game Data": "تنزيل بيانات اللعبة", + "Decompress Game Data": "فك ضغط بيانات اللعبة", + "Shaders": "شادر", + "Disabled": "عاجز", + "2xScaleHQ": "2xScaleHQ", + "4xScaleHQ": "4xScaleHQ", + "CRT easymode": "وضع CRT السهل", + "CRT aperture": "فتحة CRT", + "CRT geom": "CRT geom", + "CRT mattias": "CRT ماتياس", + "FPS": "FPS", + "show": "يعرض", + "hide": "يخفي", + "Fast Forward Ratio": "نسبة التقديم السريع", + "Fast Forward": "تقديم سريع", + "Enabled": "ممكن", + "Save State Slot": "حفظ الدولة فتحة", + "Save State Location": "حفظ موقع الدولة", + "Download": "تحميل", + "Keep in Browser": "ابق في المتصفح", + "Auto": "آلي", + "NTSC": "NTSC", + "PAL": "صديق", + "Dendy": "دندي", + "8:7 PAR": "8: 7 PAR", + "4:3": "4: 3", + "Low": "قليل", + "High": "عالي", + "Very High": "عالي جدا", + "None": "لا أحد", + "Player 1": "اللاعب 1", + "Player 2": "اللاعب 2", + "Both": "كلاهما", + "SAVED STATE TO SLOT": "الدولة المحفوظة في فتحة", + "LOADED STATE FROM SLOT": "حالة محملة من الفتحة", + "SET SAVE STATE SLOT TO": "تعيين فتحة حفظ الحالة إلى", + "Network Error": "خطأ في الشبكة", + "Submit": "يُقدِّم", + "Description": "وصف", + "Code": "شفرة", + "Add Cheat Code": "أضف كود الغش", + "Leave Room": "غادر الغرفة", + "Password": "كلمة المرور", + "Password (optional)": "كلمة المرور (اختياري)", + "Max Players": "ماكس لاعبين", + "Room Name": "اسم الغرفة", + "Join": "ينضم", + "Player Name": "اسم اللاعب", + "Set Player Name": "تعيين اسم اللاعب", + "Left Handed Mode": "وضع اليد اليسرى", + "Virtual Gamepad": "لوحة الألعاب الافتراضية", + "Disk": "القرص", + "Press Keyboard": "اضغط على لوحة المفاتيح", + "INSERT COIN": "إدراج عملة", + "Remove": "يزيل", + "SAVE LOADED FROM BROWSER": "وفر محملًا من المتصفح", + "SAVE SAVED TO BROWSER": "تم الحفظ في المتصفح", + "Join the discord": "انضم إلى الفتنة", + "View on GitHub": "عرض على جيثب", + "Failed to start game": "فشل بدء اللعبة", + "Download Game BIOS": "تنزيل Game BIOS", + "Decompress Game BIOS": "فك ضغط Game BIOS", + "Download Game Parent": "تحميل Game Parent", + "Decompress Game Parent": "فك ضغط لعبة الوالد", + "Download Game Patch": "تنزيل Game Patch", + "Decompress Game Patch": "فك ضغط لعبة التصحيح", + "Download Game State": "تنزيل Game State", + "Check console": "تحقق من وحدة التحكم", + "Error for site owner": "خطأ لمالك الموقع", + "EmulatorJS": "المحاكي JS", + "Clear All": "امسح الكل", + "Take Screenshot": "خد لقطة للشاشة", + "Quick Save": "الحفظ السريع", + "Quick Load": "تحميل سريع", + "REWIND": "الترجيع", + "Rewind Enabled (requires restart)": "تم تمكين الترجيع (يتطلب إعادة التشغيل)", + "Rewind Granularity": "الترجيع المحبب", + "Slow Motion Ratio": "نسبة الحركة البطيئة", + "Slow Motion": "حركة بطيئة", + "Home": "بيت", + "EmulatorJS License": "رخصة EmulatorJS", + "RetroArch License": "ترخيص RetroArch", + "SLOW MOTION": "حركة بطيئة", + "A": "أ", + "B": "ب", + "SELECT": "يختار", + "START": "يبدأ", + "UP": "أعلى", + "DOWN": "تحت", + "LEFT": "غادر", + "RIGHT": "يمين", + "X": "X", + "Y": "ص", + "L": "إل", + "R": "ص", + "Z": "ض", + "STICK UP": "التصق", + "STICK DOWN": "التصق اسفل", + "STICK LEFT": "العصا اليسرى", + "STICK RIGHT": "العصا لليمين", + "C-PAD UP": "C-PAD UP", + "C-PAD DOWN": "C-PAD لأسفل", + "C-PAD LEFT": "يسار C-PAD", + "C-PAD RIGHT": "حق C-PAD", + "MICROPHONE": "ميكروفون", + "BUTTON 1 / START": "زر 1 / بدء", + "BUTTON 2": "الزر 2", + "BUTTON": "زر", + "LEFT D-PAD UP": "اليسار D-PAD UP", + "LEFT D-PAD DOWN": "اليسار D-PAD لأسفل", + "LEFT D-PAD LEFT": "اليسار D-PAD اليسار", + "LEFT D-PAD RIGHT": "اليسار D-PAD لليمين", + "RIGHT D-PAD UP": "حق D-PAD UP", + "RIGHT D-PAD DOWN": "لليمين D-PAD لأسفل", + "RIGHT D-PAD LEFT": "اليمين D-PAD اليسار", + "RIGHT D-PAD RIGHT": "حق D-PAD لليمين", + "C": "ج", + "MODE": "وضع", + "FIRE": "نار", + "RESET": "إعادة ضبط", + "LEFT DIFFICULTY A": "الصعوبة اليسرى أ", + "LEFT DIFFICULTY B": "الصعوبة اليسرى ب", + "RIGHT DIFFICULTY A": "الصعوبة الصحيحة أ", + "RIGHT DIFFICULTY B": "الصعوبة الصحيحة ب", + "COLOR": "لون", + "B/W": "ب / دبليو", + "PAUSE": "يوقف", + "OPTION": "خيار", + "OPTION 1": "الخيار 1", + "OPTION 2": "الخيار 2", + "L2": "L2", + "R2": "R2", + "L3": "L3", + "R3": "R3", + "L STICK UP": "إلصاق", + "L STICK DOWN": "العصا لأسفل", + "L STICK LEFT": "L العصا اليسار", + "L STICK RIGHT": "L العصا لليمين", + "R STICK UP": "R التصق", + "R STICK DOWN": "R العصا لأسفل", + "R STICK LEFT": "R العصا اليسار", + "R STICK RIGHT": "R العصا لليمين", + "Start": "يبدأ", + "Select": "يختار", + "Fast": "سريع", + "Slow": "بطيء", + "a": "أ", + "b": "ب", + "c": "ج", + "d": "د", + "e": "ه", + "f": "F", + "g": "ز", + "h": "ح", + "i": "أنا", + "j": "ي", + "k": "ك", + "l": "ل", + "m": "م", + "n": "ن", + "o": "ا", + "p": "ص", + "q": "ف", + "r": "ص", + "s": "س", + "t": "ر", + "u": "ش", + "v": "الخامس", + "w": "ث", + "x": "x", + "y": "ذ", + "z": "ض", + "enter": "يدخل", + "escape": "يهرب", + "space": "فضاء", + "tab": "فاتورة غير مدفوعة", + "backspace": "مسافة للخلف", + "delete": "يمسح", + "arrowup": "السهم", + "arrowdown": "السهم للاسفل", + "arrowleft": "السهم", + "arrowright": "السهم", + "f1": "و 1", + "f2": "f2", + "f3": "f3", + "f4": "f4", + "f5": "f5", + "f6": "و 6", + "f7": "f7", + "f8": "و ٨", + "f9": "و 9", + "f10": "f10", + "f11": "و 11", + "f12": "f12", + "shift": "يحول", + "control": "يتحكم", + "alt": "بديل", + "meta": "ميتا", + "capslock": "caps lock", + "insert": "إدراج", + "home": "بيت", + "end": "نهاية", + "pageup": "pageup", + "pagedown": "اسفل الصفحة", + "!": "!", + "@": "@", + "#": "#", + "$": "$", + "%": "٪", + "^": "^", + "&": "&", + "*": "*", + "(": "(", + ")": ")", + "-": "-", + "_": "_", + "+": "+", + "=": "=", + "[": "[", + "]": "]", + "{": "{", + "}": "}", + ";": "؛", + ":": ":", + "'": "\"", + "\"": "\"", + ",": "و", + ".": ".", + "<": "<", + ">": ">", + "/": "/", + "?": "؟", + "LEFT_STICK_X": "LEFT_STICK_X", + "LEFT_STICK_Y": "LEFT_STICK_Y", + "RIGHT_STICK_X": "RIGHT_STICK_X", + "RIGHT_STICK_Y": "RIGHT_STICK_Y", + "LEFT_TRIGGER": "الزناد الأيسر", + "RIGHT_TRIGGER": "الزناد الأيمن", + "A_BUTTON": "الزر", + "B_BUTTON": "B_BUTTON", + "X_BUTTON": "X_BUTTON", + "Y_BUTTON": "Y_BUTTON", + "START_BUTTON": "START_BUTTON", + "SELECT_BUTTON": "حدد زر", + "L1_BUTTON": "L1_BUTTON", + "R1_BUTTON": "R1_BUTTON", + "L2_BUTTON": "L2_BUTTON", + "R2_BUTTON": "R2_BUTTON", + "LEFT_THUMB_BUTTON": "LEFT_THUMB_BUTTON", + "RIGHT_THUMB_BUTTON": "RIGHT_THUMB_BUTTON", + "DPAD_UP": "DPAD_UP", + "DPAD_DOWN": "DPAD_DOWN", + "DPAD_LEFT": "DPAD_LEFT", + "DPAD_RIGHT": "DPAD_RIGHT" } \ No newline at end of file diff --git a/semag/emulatorjs/data/localization/ben-BEN.json b/semag/emulatorjs/data/localization/ben-BEN.json index aeee5699..7288114b 100644 --- a/semag/emulatorjs/data/localization/ben-BEN.json +++ b/semag/emulatorjs/data/localization/ben-BEN.json @@ -1,301 +1,301 @@ -{ - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7", - "8": "8", - "9": "9", - "Restart": "আবার শুরু", - "Pause": "বিরতি", - "Play": "খেলা", - "Save State": "রাষ্ট্র সংরক্ষণ", - "Load State": "লোড স্টেট", - "Control Settings": "নিয়ন্ত্রণ সেটিংস", - "Cheats": "প্রতারণা করে", - "Cache Manager": "ক্যাশে ম্যানেজার", - "Export Save File": "সেভ ফাইল রপ্তানি করুন", - "Import Save File": "সেভ ফাইল ইম্পোর্ট করুন", - "Netplay": "নেটপ্লে", - "Mute": "নিঃশব্দ", - "Unmute": "আনমিউট করুন", - "Settings": "সেটিংস", - "Enter Fullscreen": "পূর্ণ পর্দায়ই যান", - "Exit Fullscreen": "পূর্ণ পর্দা সরান", - "Reset": "রিসেট", - "Clear": "পরিষ্কার", - "Close": "বন্ধ", - "QUICK SAVE STATE": "দ্রুত সেভ স্টেট", - "QUICK LOAD STATE": "দ্রুত লোড অবস্থা", - "CHANGE STATE SLOT": "রাজ্য স্লট পরিবর্তন করুন", - "FAST FORWARD": "দ্রুত অগ্রগামী", - "Player": "প্লেয়ার", - "Connected Gamepad": "সংযুক্ত গেমপ্যাড", - "Gamepad": "গেমপ্যাড", - "Keyboard": "কীবোর্ড", - "Set": "সেট", - "Add Cheat": "প্রতারণা যোগ করুন", - "Create a Room": "একটি রুম তৈরি করুন", - "Rooms": "রুম", - "Start Game": "খেলা শুরু কর", - "Loading...": "লোড হচ্ছে...", - "Download Game Core": "গেম কোর ডাউনলোড করুন", - "Decompress Game Core": "ডিকম্প্রেস গেম কোর", - "Download Game Data": "গেম ডেটা ডাউনলোড করুন", - "Decompress Game Data": "গেম ডেটা ডিকম্প্রেস করুন", - "Shaders": "শেডার্স", - "Disabled": "অক্ষম", - "2xScaleHQ": "2xScaleHQ", - "4xScaleHQ": "4xScaleHQ", - "CRT easymode": "সিআরটি ইজিমোড", - "CRT aperture": "CRT অ্যাপারচার", - "CRT geom": "CRT geom", - "CRT mattias": "সিআরটি ম্যাটিয়াস", - "FPS": "FPS", - "show": "প্রদর্শন", - "hide": "লুকান", - "Fast Forward Ratio": "দ্রুত ফরোয়ার্ড অনুপাত", - "Fast Forward": "দ্রুত অগ্রগামী", - "Enabled": "সক্রিয়", - "Save State Slot": "রাজ্য স্লট সংরক্ষণ করুন", - "Save State Location": "রাজ্য অবস্থান সংরক্ষণ করুন", - "Download": "ডাউনলোড করুন", - "Keep in Browser": "ব্রাউজারে রাখুন", - "Auto": "অটো", - "NTSC": "এনটিএসসি", - "PAL": "অন্তরঙ্গ বন্ধু", - "Dendy": "ডেন্ডি", - "8:7 PAR": "8:7 PAR", - "4:3": "4:3", - "Low": "কম", - "High": "উচ্চ", - "Very High": "সুউচ্চ", - "None": "কোনোটিই নয়", - "Player 1": "খেলোয়াড় 1", - "Player 2": "প্লেয়ার 2", - "Both": "উভয়", - "SAVED STATE TO SLOT": "স্লটে রাজ্য সংরক্ষণ করা হয়েছে", - "LOADED STATE FROM SLOT": "স্লট থেকে রাজ্য লোড", - "SET SAVE STATE SLOT TO": "সেভ স্টেট স্লট সেট করুন", - "Network Error": "নেটওয়ার্ক ত্রুটি", - "Submit": "জমা দিন", - "Description": "বর্ণনা", - "Code": "কোড", - "Add Cheat Code": "চিট কোড যোগ করুন", - "Leave Room": "ছুটি রুম", - "Password": "পাসওয়ার্ড", - "Password (optional)": "পাসওয়ার্ড (ঐচ্ছিক)", - "Max Players": "সর্বোচ্চ খেলোয়াড়", - "Room Name": "রুমের নাম", - "Join": "যোগদান করুন", - "Player Name": "প্লেয়ারের নাম", - "Set Player Name": "প্লেয়ারের নাম সেট করুন", - "Left Handed Mode": "বাম হাতের মোড", - "Virtual Gamepad": "ভার্চুয়াল গেমপ্যাড", - "Disk": "ডিস্ক", - "Press Keyboard": "কীবোর্ড টিপুন", - "INSERT COIN": "মুদ্রা প্রবেশ করান", - "Remove": "অপসারণ", - "SAVE LOADED FROM BROWSER": "ব্রাউজার থেকে লোড সংরক্ষণ করুন", - "SAVE SAVED TO BROWSER": "ব্রাউজারে সংরক্ষণ করুন", - "Join the discord": "বিরোধে যোগ দিন", - "View on GitHub": "GitHub এ দেখুন", - "Failed to start game": "খেলা শুরু করতে ব্যর্থ", - "Download Game BIOS": "গেম BIOS ডাউনলোড করুন", - "Decompress Game BIOS": "গেম BIOS ডিকম্প্রেস করুন", - "Download Game Parent": "গেম প্যারেন্ট ডাউনলোড করুন", - "Decompress Game Parent": "ডিকম্প্রেস গেম প্যারেন্ট", - "Download Game Patch": "গেম প্যাচ ডাউনলোড করুন", - "Decompress Game Patch": "ডিকম্প্রেস গেম প্যাচ", - "Download Game State": "গেম স্টেট ডাউনলোড করুন", - "Check console": "কনসোল চেক করুন", - "Error for site owner": "সাইটের মালিকের জন্য ত্রুটি", - "EmulatorJS": "এমুলেটরজেএস", - "Clear All": "সব পরিষ্কার করে দাও", - "Take Screenshot": "স্ক্রিনশট নাও", - "Quick Save": "দ্রুত সংরক্ষণ", - "Quick Load": "দ্রুত লোড", - "REWIND": "রিওয়াইন্ড করুন", - "Rewind Enabled (requires restart)": "রিওয়াইন্ড সক্ষম (রিস্টার্ট প্রয়োজন)", - "Rewind Granularity": "রিওয়াইন্ড গ্রানুলারিটি", - "Slow Motion Ratio": "ধীর গতির অনুপাত", - "Slow Motion": "ধীর গতি", - "Home": "বাড়ি", - "EmulatorJS License": "এমুলেটরজেএস লাইসেন্স", - "RetroArch License": "রেট্রোআর্ক লাইসেন্স", - "SLOW MOTION": "ধীর গতি", - "A": "ক", - "B": "খ", - "SELECT": "নির্বাচন করুন", - "START": "শুরু", - "UP": "ইউপি", - "DOWN": "নিচে", - "LEFT": "বাম", - "RIGHT": "ডান", - "X": "এক্স", - "Y": "Y", - "L": "এল", - "R": "আর", - "Z": "জেড", - "STICK UP": "লেগে থাকা", - "STICK DOWN": "নিচে লাঠি", - "STICK LEFT": "স্টিক বাম", - "STICK RIGHT": "ডানে থাকুন", - "C-PAD UP": "সি-প্যাড ইউপি", - "C-PAD DOWN": "সি-প্যাড ডাউন", - "C-PAD LEFT": "সি-প্যাড বাম", - "C-PAD RIGHT": "সি-প্যাড ডান", - "MICROPHONE": "মাইক্রোফোন", - "BUTTON 1 / START": "বোতাম 1 / শুরু করুন", - "BUTTON 2": "বোতাম 2", - "BUTTON": "বোতাম", - "LEFT D-PAD UP": "বাম ডি-প্যাড আপ", - "LEFT D-PAD DOWN": "বাম ডি-প্যাড নিচে", - "LEFT D-PAD LEFT": "বাম ডি-প্যাড বাম", - "LEFT D-PAD RIGHT": "বাম ডি-প্যাড ডান", - "RIGHT D-PAD UP": "ডান ডি-প্যাড আপ", - "RIGHT D-PAD DOWN": "ডানদিকে ডি-প্যাড ডাউন", - "RIGHT D-PAD LEFT": "ডান ডি-প্যাড বাম", - "RIGHT D-PAD RIGHT": "ডান ডি-প্যাড ডান", - "C": "গ", - "MODE": "মোড", - "FIRE": "আগুন", - "RESET": "রিসেট", - "LEFT DIFFICULTY A": "বাম অসুবিধা ক", - "LEFT DIFFICULTY B": "বাম অসুবিধা বি", - "RIGHT DIFFICULTY A": "ডান অসুবিধা ক", - "RIGHT DIFFICULTY B": "সঠিক অসুবিধা বি", - "COLOR": "রঙ", - "B/W": "B/W", - "PAUSE": "বিরতি", - "OPTION": "বিকল্প", - "OPTION 1": "বিকল্প 1", - "OPTION 2": "বিকল্প 2", - "L2": "L2", - "R2": "R2", - "L3": "L3", - "R3": "R3", - "L STICK UP": "এল স্টিক আপ", - "L STICK DOWN": "এল স্টিক ডাউন", - "L STICK LEFT": "L স্টিক বাম", - "L STICK RIGHT": "L স্টিক ডান", - "R STICK UP": "আর স্টিক আপ", - "R STICK DOWN": "আর স্টিক ডাউন", - "R STICK LEFT": "R স্টিক বাম", - "R STICK RIGHT": "R স্টিক ডান", - "Start": "শুরু করুন", - "Select": "নির্বাচন করুন", - "Fast": "দ্রুত", - "Slow": "ধীর", - "a": "ক", - "b": "খ", - "c": "গ", - "d": "d", - "e": "e", - "f": "চ", - "g": "g", - "h": "জ", - "i": "i", - "j": "j", - "k": "k", - "l": "l", - "m": "মি", - "n": "n", - "o": "o", - "p": "পি", - "q": "q", - "r": "r", - "s": "s", - "t": "t", - "u": "u", - "v": "v", - "w": "w", - "x": "এক্স", - "y": "y", - "z": "z", - "enter": "প্রবেশ করা", - "escape": "পলায়ন", - "space": "স্থান", - "tab": "ট্যাব", - "backspace": "ব্যাকস্পেস", - "delete": "মুছে ফেলা", - "arrowup": "তীরচিহ্ন", - "arrowdown": "তীর নিচে", - "arrowleft": "তীর বাম", - "arrowright": "তীর ডান", - "f1": "f1", - "f2": "f2", - "f3": "f3", - "f4": "f4", - "f5": "f5", - "f6": "f6", - "f7": "f7", - "f8": "f8", - "f9": "f9", - "f10": "f10", - "f11": "f11", - "f12": "f12", - "shift": "স্থানান্তর", - "control": "নিয়ন্ত্রণ", - "alt": "alt", - "meta": "মেটা", - "capslock": "ক্যাপস লক", - "insert": "সন্নিবেশ", - "home": "বাড়ি", - "end": "শেষ", - "pageup": "উপরের পাতা", - "pagedown": "পৃষ্ঠা নিচে নামানো", - "!": "!", - "@": "@", - "#": "#", - "$": "$", - "%": "%", - "^": "^", - "&": "এবং", - "*": "*", - "(": "(", - ")": ")", - "-": "-", - "_": "_", - "+": "+", - "=": "=", - "[": "[", - "]": "]", - "{": "{", - "}": "}", - ";": ";", - ":": ":", - "'": "'", - "\"": "\"", - ",": ",", - ".": ".", - "<": "<", - ">": ">", - "/": "/", - "?": "?", - "LEFT_STICK_X": "LEFT_STICK_X", - "LEFT_STICK_Y": "LEFT_STICK_Y", - "RIGHT_STICK_X": "RIGHT_STICK_X", - "RIGHT_STICK_Y": "RIGHT_STICK_Y", - "LEFT_TRIGGER": "LEFT_TRIGGER", - "RIGHT_TRIGGER": "RIGHT_TRIGGER", - "A_BUTTON": "একটি বোতাম", - "B_BUTTON": "B_BUTTON", - "X_BUTTON": "X_BUTTON", - "Y_BUTTON": "Y_BUTTON", - "START_BUTTON": "শুরু বোতাম", - "SELECT_BUTTON": "SELECT_BUTTON", - "L1_BUTTON": "L1_BUTTON", - "R1_BUTTON": "R1_BUTTON", - "L2_BUTTON": "L2_BUTTON", - "R2_BUTTON": "R2_BUTTON", - "LEFT_THUMB_BUTTON": "LEFT_THUMB_BUTTON", - "RIGHT_THUMB_BUTTON": "RIGHT_THUMB_BUTTON", - "DPAD_UP": "DPAD_UP", - "DPAD_DOWN": "DPAD_DOWN", - "DPAD_LEFT": "DPAD_LEFT", - "DPAD_RIGHT": "DPAD_RIGHT" +{ + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7", + "8": "8", + "9": "9", + "Restart": "আবার শুরু", + "Pause": "বিরতি", + "Play": "খেলা", + "Save State": "রাষ্ট্র সংরক্ষণ", + "Load State": "লোড স্টেট", + "Control Settings": "নিয়ন্ত্রণ সেটিংস", + "Cheats": "প্রতারণা করে", + "Cache Manager": "ক্যাশে ম্যানেজার", + "Export Save File": "সেভ ফাইল রপ্তানি করুন", + "Import Save File": "সেভ ফাইল ইম্পোর্ট করুন", + "Netplay": "নেটপ্লে", + "Mute": "নিঃশব্দ", + "Unmute": "আনমিউট করুন", + "Settings": "সেটিংস", + "Enter Fullscreen": "পূর্ণ পর্দায়ই যান", + "Exit Fullscreen": "পূর্ণ পর্দা সরান", + "Reset": "রিসেট", + "Clear": "পরিষ্কার", + "Close": "বন্ধ", + "QUICK SAVE STATE": "দ্রুত সেভ স্টেট", + "QUICK LOAD STATE": "দ্রুত লোড অবস্থা", + "CHANGE STATE SLOT": "রাজ্য স্লট পরিবর্তন করুন", + "FAST FORWARD": "দ্রুত অগ্রগামী", + "Player": "প্লেয়ার", + "Connected Gamepad": "সংযুক্ত গেমপ্যাড", + "Gamepad": "গেমপ্যাড", + "Keyboard": "কীবোর্ড", + "Set": "সেট", + "Add Cheat": "প্রতারণা যোগ করুন", + "Create a Room": "একটি রুম তৈরি করুন", + "Rooms": "রুম", + "Start Game": "খেলা শুরু কর", + "Loading...": "লোড হচ্ছে...", + "Download Game Core": "গেম কোর ডাউনলোড করুন", + "Decompress Game Core": "ডিকম্প্রেস গেম কোর", + "Download Game Data": "গেম ডেটা ডাউনলোড করুন", + "Decompress Game Data": "গেম ডেটা ডিকম্প্রেস করুন", + "Shaders": "শেডার্স", + "Disabled": "অক্ষম", + "2xScaleHQ": "2xScaleHQ", + "4xScaleHQ": "4xScaleHQ", + "CRT easymode": "সিআরটি ইজিমোড", + "CRT aperture": "CRT অ্যাপারচার", + "CRT geom": "CRT geom", + "CRT mattias": "সিআরটি ম্যাটিয়াস", + "FPS": "FPS", + "show": "প্রদর্শন", + "hide": "লুকান", + "Fast Forward Ratio": "দ্রুত ফরোয়ার্ড অনুপাত", + "Fast Forward": "দ্রুত অগ্রগামী", + "Enabled": "সক্রিয়", + "Save State Slot": "রাজ্য স্লট সংরক্ষণ করুন", + "Save State Location": "রাজ্য অবস্থান সংরক্ষণ করুন", + "Download": "ডাউনলোড করুন", + "Keep in Browser": "ব্রাউজারে রাখুন", + "Auto": "অটো", + "NTSC": "এনটিএসসি", + "PAL": "অন্তরঙ্গ বন্ধু", + "Dendy": "ডেন্ডি", + "8:7 PAR": "8:7 PAR", + "4:3": "4:3", + "Low": "কম", + "High": "উচ্চ", + "Very High": "সুউচ্চ", + "None": "কোনোটিই নয়", + "Player 1": "খেলোয়াড় 1", + "Player 2": "প্লেয়ার 2", + "Both": "উভয়", + "SAVED STATE TO SLOT": "স্লটে রাজ্য সংরক্ষণ করা হয়েছে", + "LOADED STATE FROM SLOT": "স্লট থেকে রাজ্য লোড", + "SET SAVE STATE SLOT TO": "সেভ স্টেট স্লট সেট করুন", + "Network Error": "নেটওয়ার্ক ত্রুটি", + "Submit": "জমা দিন", + "Description": "বর্ণনা", + "Code": "কোড", + "Add Cheat Code": "চিট কোড যোগ করুন", + "Leave Room": "ছুটি রুম", + "Password": "পাসওয়ার্ড", + "Password (optional)": "পাসওয়ার্ড (ঐচ্ছিক)", + "Max Players": "সর্বোচ্চ খেলোয়াড়", + "Room Name": "রুমের নাম", + "Join": "যোগদান করুন", + "Player Name": "প্লেয়ারের নাম", + "Set Player Name": "প্লেয়ারের নাম সেট করুন", + "Left Handed Mode": "বাম হাতের মোড", + "Virtual Gamepad": "ভার্চুয়াল গেমপ্যাড", + "Disk": "ডিস্ক", + "Press Keyboard": "কীবোর্ড টিপুন", + "INSERT COIN": "মুদ্রা প্রবেশ করান", + "Remove": "অপসারণ", + "SAVE LOADED FROM BROWSER": "ব্রাউজার থেকে লোড সংরক্ষণ করুন", + "SAVE SAVED TO BROWSER": "ব্রাউজারে সংরক্ষণ করুন", + "Join the discord": "বিরোধে যোগ দিন", + "View on GitHub": "GitHub এ দেখুন", + "Failed to start game": "খেলা শুরু করতে ব্যর্থ", + "Download Game BIOS": "গেম BIOS ডাউনলোড করুন", + "Decompress Game BIOS": "গেম BIOS ডিকম্প্রেস করুন", + "Download Game Parent": "গেম প্যারেন্ট ডাউনলোড করুন", + "Decompress Game Parent": "ডিকম্প্রেস গেম প্যারেন্ট", + "Download Game Patch": "গেম প্যাচ ডাউনলোড করুন", + "Decompress Game Patch": "ডিকম্প্রেস গেম প্যাচ", + "Download Game State": "গেম স্টেট ডাউনলোড করুন", + "Check console": "কনসোল চেক করুন", + "Error for site owner": "সাইটের মালিকের জন্য ত্রুটি", + "EmulatorJS": "এমুলেটরজেএস", + "Clear All": "সব পরিষ্কার করে দাও", + "Take Screenshot": "স্ক্রিনশট নাও", + "Quick Save": "দ্রুত সংরক্ষণ", + "Quick Load": "দ্রুত লোড", + "REWIND": "রিওয়াইন্ড করুন", + "Rewind Enabled (requires restart)": "রিওয়াইন্ড সক্ষম (রিস্টার্ট প্রয়োজন)", + "Rewind Granularity": "রিওয়াইন্ড গ্রানুলারিটি", + "Slow Motion Ratio": "ধীর গতির অনুপাত", + "Slow Motion": "ধীর গতি", + "Home": "বাড়ি", + "EmulatorJS License": "এমুলেটরজেএস লাইসেন্স", + "RetroArch License": "রেট্রোআর্ক লাইসেন্স", + "SLOW MOTION": "ধীর গতি", + "A": "ক", + "B": "খ", + "SELECT": "নির্বাচন করুন", + "START": "শুরু", + "UP": "ইউপি", + "DOWN": "নিচে", + "LEFT": "বাম", + "RIGHT": "ডান", + "X": "এক্স", + "Y": "Y", + "L": "এল", + "R": "আর", + "Z": "জেড", + "STICK UP": "লেগে থাকা", + "STICK DOWN": "নিচে লাঠি", + "STICK LEFT": "স্টিক বাম", + "STICK RIGHT": "ডানে থাকুন", + "C-PAD UP": "সি-প্যাড ইউপি", + "C-PAD DOWN": "সি-প্যাড ডাউন", + "C-PAD LEFT": "সি-প্যাড বাম", + "C-PAD RIGHT": "সি-প্যাড ডান", + "MICROPHONE": "মাইক্রোফোন", + "BUTTON 1 / START": "বোতাম 1 / শুরু করুন", + "BUTTON 2": "বোতাম 2", + "BUTTON": "বোতাম", + "LEFT D-PAD UP": "বাম ডি-প্যাড আপ", + "LEFT D-PAD DOWN": "বাম ডি-প্যাড নিচে", + "LEFT D-PAD LEFT": "বাম ডি-প্যাড বাম", + "LEFT D-PAD RIGHT": "বাম ডি-প্যাড ডান", + "RIGHT D-PAD UP": "ডান ডি-প্যাড আপ", + "RIGHT D-PAD DOWN": "ডানদিকে ডি-প্যাড ডাউন", + "RIGHT D-PAD LEFT": "ডান ডি-প্যাড বাম", + "RIGHT D-PAD RIGHT": "ডান ডি-প্যাড ডান", + "C": "গ", + "MODE": "মোড", + "FIRE": "আগুন", + "RESET": "রিসেট", + "LEFT DIFFICULTY A": "বাম অসুবিধা ক", + "LEFT DIFFICULTY B": "বাম অসুবিধা বি", + "RIGHT DIFFICULTY A": "ডান অসুবিধা ক", + "RIGHT DIFFICULTY B": "সঠিক অসুবিধা বি", + "COLOR": "রঙ", + "B/W": "B/W", + "PAUSE": "বিরতি", + "OPTION": "বিকল্প", + "OPTION 1": "বিকল্প 1", + "OPTION 2": "বিকল্প 2", + "L2": "L2", + "R2": "R2", + "L3": "L3", + "R3": "R3", + "L STICK UP": "এল স্টিক আপ", + "L STICK DOWN": "এল স্টিক ডাউন", + "L STICK LEFT": "L স্টিক বাম", + "L STICK RIGHT": "L স্টিক ডান", + "R STICK UP": "আর স্টিক আপ", + "R STICK DOWN": "আর স্টিক ডাউন", + "R STICK LEFT": "R স্টিক বাম", + "R STICK RIGHT": "R স্টিক ডান", + "Start": "শুরু করুন", + "Select": "নির্বাচন করুন", + "Fast": "দ্রুত", + "Slow": "ধীর", + "a": "ক", + "b": "খ", + "c": "গ", + "d": "d", + "e": "e", + "f": "চ", + "g": "g", + "h": "জ", + "i": "i", + "j": "j", + "k": "k", + "l": "l", + "m": "মি", + "n": "n", + "o": "o", + "p": "পি", + "q": "q", + "r": "r", + "s": "s", + "t": "t", + "u": "u", + "v": "v", + "w": "w", + "x": "এক্স", + "y": "y", + "z": "z", + "enter": "প্রবেশ করা", + "escape": "পলায়ন", + "space": "স্থান", + "tab": "ট্যাব", + "backspace": "ব্যাকস্পেস", + "delete": "মুছে ফেলা", + "arrowup": "তীরচিহ্ন", + "arrowdown": "তীর নিচে", + "arrowleft": "তীর বাম", + "arrowright": "তীর ডান", + "f1": "f1", + "f2": "f2", + "f3": "f3", + "f4": "f4", + "f5": "f5", + "f6": "f6", + "f7": "f7", + "f8": "f8", + "f9": "f9", + "f10": "f10", + "f11": "f11", + "f12": "f12", + "shift": "স্থানান্তর", + "control": "নিয়ন্ত্রণ", + "alt": "alt", + "meta": "মেটা", + "capslock": "ক্যাপস লক", + "insert": "সন্নিবেশ", + "home": "বাড়ি", + "end": "শেষ", + "pageup": "উপরের পাতা", + "pagedown": "পৃষ্ঠা নিচে নামানো", + "!": "!", + "@": "@", + "#": "#", + "$": "$", + "%": "%", + "^": "^", + "&": "এবং", + "*": "*", + "(": "(", + ")": ")", + "-": "-", + "_": "_", + "+": "+", + "=": "=", + "[": "[", + "]": "]", + "{": "{", + "}": "}", + ";": ";", + ":": ":", + "'": "'", + "\"": "\"", + ",": ",", + ".": ".", + "<": "<", + ">": ">", + "/": "/", + "?": "?", + "LEFT_STICK_X": "LEFT_STICK_X", + "LEFT_STICK_Y": "LEFT_STICK_Y", + "RIGHT_STICK_X": "RIGHT_STICK_X", + "RIGHT_STICK_Y": "RIGHT_STICK_Y", + "LEFT_TRIGGER": "LEFT_TRIGGER", + "RIGHT_TRIGGER": "RIGHT_TRIGGER", + "A_BUTTON": "একটি বোতাম", + "B_BUTTON": "B_BUTTON", + "X_BUTTON": "X_BUTTON", + "Y_BUTTON": "Y_BUTTON", + "START_BUTTON": "শুরু বোতাম", + "SELECT_BUTTON": "SELECT_BUTTON", + "L1_BUTTON": "L1_BUTTON", + "R1_BUTTON": "R1_BUTTON", + "L2_BUTTON": "L2_BUTTON", + "R2_BUTTON": "R2_BUTTON", + "LEFT_THUMB_BUTTON": "LEFT_THUMB_BUTTON", + "RIGHT_THUMB_BUTTON": "RIGHT_THUMB_BUTTON", + "DPAD_UP": "DPAD_UP", + "DPAD_DOWN": "DPAD_DOWN", + "DPAD_LEFT": "DPAD_LEFT", + "DPAD_RIGHT": "DPAD_RIGHT" } \ No newline at end of file diff --git a/semag/emulatorjs/data/localization/de-GER.json b/semag/emulatorjs/data/localization/de-GER.json index 57bedc66..21671931 100644 --- a/semag/emulatorjs/data/localization/de-GER.json +++ b/semag/emulatorjs/data/localization/de-GER.json @@ -1,301 +1,301 @@ -{ - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7", - "8": "8", - "9": "9", - "Restart": "Neu starten", - "Pause": "Pause", - "Play": "Spielen", - "Save State": "Sicherer Staat", - "Load State": "Ladezustand", - "Control Settings": "Kontrolleinstellungen", - "Cheats": "Betrüger", - "Cache Manager": "Cache-Manager", - "Export Save File": "Speichern Sie die Datei exportieren", - "Import Save File": "Speicherdatei importieren", - "Netplay": "Spiel am Netz", - "Mute": "Stumm", - "Unmute": "Stummschaltung aufheben", - "Settings": "Einstellungen", - "Enter Fullscreen": "Vollbildmodus aktivieren", - "Exit Fullscreen": "Beenden Sie den Vollbildmodus", - "Reset": "Zurücksetzen", - "Clear": "Klar", - "Close": "Schließen", - "QUICK SAVE STATE": "SCHNELLER SPEICHERENZUSTAND", - "QUICK LOAD STATE": "SCHNELLER LADEZUSTAND", - "CHANGE STATE SLOT": "STATUS-SLOT ÄNDERN", - "FAST FORWARD": "SCHNELLER VORLAUF", - "Player": "Spieler", - "Connected Gamepad": "Verbundenes Gamepad", - "Gamepad": "Gamepad", - "Keyboard": "Tastatur", - "Set": "Satz", - "Add Cheat": "Cheat hinzufügen", - "Create a Room": "Erstellen Sie einen Raum", - "Rooms": "Räume", - "Start Game": "Spiel beginnen", - "Loading...": "Wird geladen...", - "Download Game Core": "Laden Sie Game Core herunter", - "Decompress Game Core": "Game Core entpacken", - "Download Game Data": "Spieldaten herunterladen", - "Decompress Game Data": "Spieldaten entpacken", - "Shaders": "Shader", - "Disabled": "Deaktiviert", - "2xScaleHQ": "2xScaleHQ", - "4xScaleHQ": "4xScaleHQ", - "CRT easymode": "CRT-Easymode", - "CRT aperture": "CRT-Blende", - "CRT geom": "CRT-geom", - "CRT mattias": "CRT Mattias", - "FPS": "FPS", - "show": "zeigen", - "hide": "verstecken", - "Fast Forward Ratio": "Schnellvorlaufverhältnis", - "Fast Forward": "Schneller Vorlauf", - "Enabled": "Ermöglicht", - "Save State Slot": "Status-Slot speichern", - "Save State Location": "Bundeslandstandort speichern", - "Download": "Herunterladen", - "Keep in Browser": "Im Browser behalten", - "Auto": "Auto", - "NTSC": "NTSC", - "PAL": "KUMPEL", - "Dendy": "Dendy", - "8:7 PAR": "8:7 PAR", - "4:3": "4:3", - "Low": "Niedrig", - "High": "Hoch", - "Very High": "Sehr hoch", - "None": "Keiner", - "Player 1": "Spieler 1", - "Player 2": "Spieler 2", - "Both": "Beide", - "SAVED STATE TO SLOT": "STATUS FÜR SLOT GESPEICHERT", - "LOADED STATE FROM SLOT": "GELADENER STATUS VON SLOT", - "SET SAVE STATE SLOT TO": "SAVE STATE SLOT EINSTELLEN AUF", - "Network Error": "Netzwerkfehler", - "Submit": "Einreichen", - "Description": "Beschreibung", - "Code": "Code", - "Add Cheat Code": "Cheat-Code hinzufügen", - "Leave Room": "Zimmer verlassen", - "Password": "Passwort", - "Password (optional)": "Passwort (optional)", - "Max Players": "Maximale Spieleranzahl", - "Room Name": "Raumname", - "Join": "Verbinden", - "Player Name": "Spielername", - "Set Player Name": "Legen Sie den Spielernamen fest", - "Left Handed Mode": "Linkshänder-Modus", - "Virtual Gamepad": "Virtuelles Gamepad", - "Disk": "Scheibe", - "Press Keyboard": "Drücken Sie Tastatur", - "INSERT COIN": "MÜNZE EINWERFEN", - "Remove": "Entfernen", - "SAVE LOADED FROM BROWSER": "SPEICHERN VOM BROWSER GELADEN", - "SAVE SAVED TO BROWSER": "SPEICHERN IM BROWSER GESPEICHERT", - "Join the discord": "Treten Sie dem Discord bei", - "View on GitHub": "Auf GitHub ansehen", - "Failed to start game": "Das Spiel konnte nicht gestartet werden", - "Download Game BIOS": "Laden Sie das Spiel-BIOS herunter", - "Decompress Game BIOS": "Dekomprimieren Sie das Spiel-BIOS", - "Download Game Parent": "Laden Sie Game Parent herunter", - "Decompress Game Parent": "Dekomprimieren Sie das übergeordnete Spiel", - "Download Game Patch": "Laden Sie den Spiel-Patch herunter", - "Decompress Game Patch": "Dekomprimieren Sie den Spiel-Patch", - "Download Game State": "Spielstatus herunterladen", - "Check console": "Überprüfen Sie die Konsole", - "Error for site owner": "Fehler für Websitebesitzer", - "EmulatorJS": "EmulatorJS", - "Clear All": "Alles löschen", - "Take Screenshot": "Einen Screenshot machen", - "Quick Save": "Schnellspeichern", - "Quick Load": "Schnell laden", - "REWIND": "ZURÜCKSPULEN", - "Rewind Enabled (requires restart)": "Rücklauf aktiviert (Neustart erforderlich)", - "Rewind Granularity": "Granularität zurückspulen", - "Slow Motion Ratio": "Zeitlupenverhältnis", - "Slow Motion": "Zeitlupe", - "Home": "Heim", - "EmulatorJS License": "EmulatorJS-Lizenz", - "RetroArch License": "RetroArch-Lizenz", - "SLOW MOTION": "ZEITLUPE", - "A": "A", - "B": "B", - "SELECT": "WÄHLEN", - "START": "START", - "UP": "HOCH", - "DOWN": "RUNTER", - "LEFT": "LINKS", - "RIGHT": "RECHTS", - "X": "X", - "Y": "Y", - "L": "L", - "R": "R", - "Z": "Z", - "STICK UP": "Bleiben Sie dran", - "STICK DOWN": "HALTE DICH", - "STICK LEFT": "LINKS STEHEN", - "STICK RIGHT": "HALTEN SIE SICH NACH RECHTS", - "C-PAD UP": "C-PAD nach oben", - "C-PAD DOWN": "C-PAD NACH UNTEN", - "C-PAD LEFT": "C-PAD LINKS", - "C-PAD RIGHT": "C-PAD RECHTS", - "MICROPHONE": "MIKROFON", - "BUTTON 1 / START": "TASTE 1 / START", - "BUTTON 2": "TASTE 2", - "BUTTON": "TASTE", - "LEFT D-PAD UP": "LINKES D-PAD NACH OBEN", - "LEFT D-PAD DOWN": "LINKES D-PAD NACH UNTEN", - "LEFT D-PAD LEFT": "LINKES D-PAD LINKS", - "LEFT D-PAD RIGHT": "LINKES D-PAD RECHTS", - "RIGHT D-PAD UP": "RECHTES D-PAD NACH OBEN", - "RIGHT D-PAD DOWN": "RECHTES D-PAD NACH UNTEN", - "RIGHT D-PAD LEFT": "RECHTES D-PAD LINKS", - "RIGHT D-PAD RIGHT": "RECHTES D-PAD RECHTS", - "C": "C", - "MODE": "MODUS", - "FIRE": "FEUER", - "RESET": "ZURÜCKSETZEN", - "LEFT DIFFICULTY A": "SCHWIERIGKEIT LINKS A", - "LEFT DIFFICULTY B": "SCHWIERIGKEIT LINKS B", - "RIGHT DIFFICULTY A": "RECHTER SCHWIERIGKEIT A", - "RIGHT DIFFICULTY B": "RECHTER SCHWIERIGKEIT B", - "COLOR": "FARBE", - "B/W": "S/W", - "PAUSE": "PAUSE", - "OPTION": "MÖGLICHKEIT", - "OPTION 1": "OPTION 1", - "OPTION 2": "OPTION 2", - "L2": "L2", - "R2": "R2", - "L3": "L3", - "R3": "R3", - "L STICK UP": "L BLEIB DURCH", - "L STICK DOWN": "L HALTE DICH", - "L STICK LEFT": "L STICK LINKS", - "L STICK RIGHT": "L HALTE NACH RECHTS", - "R STICK UP": "R HALTEN SIE SICH AUF", - "R STICK DOWN": "R HALTEN SIE SICH NACH UNTEN", - "R STICK LEFT": "R STICK LINKS", - "R STICK RIGHT": "R STICK NACH RECHTS", - "Start": "Start", - "Select": "Wählen", - "Fast": "Schnell", - "Slow": "Langsam", - "a": "A", - "b": "B", - "c": "C", - "d": "D", - "e": "e", - "f": "F", - "g": "G", - "h": "H", - "i": "ich", - "j": "J", - "k": "k", - "l": "l", - "m": "M", - "n": "N", - "o": "Ö", - "p": "P", - "q": "Q", - "r": "R", - "s": "S", - "t": "T", - "u": "u", - "v": "v", - "w": "w", - "x": "X", - "y": "j", - "z": "z", - "enter": "eingeben", - "escape": "Flucht", - "space": "Raum", - "tab": "Tab", - "backspace": "Rücktaste", - "delete": "löschen", - "arrowup": "Pfeil nach oben", - "arrowdown": "Pfeil nach unten", - "arrowleft": "Pfeil nach links", - "arrowright": "Pfeil nach rechts", - "f1": "f1", - "f2": "f2", - "f3": "f3", - "f4": "f4", - "f5": "f5", - "f6": "f6", - "f7": "f7", - "f8": "f8", - "f9": "f9", - "f10": "f10", - "f11": "f11", - "f12": "f12", - "shift": "Schicht", - "control": "Kontrolle", - "alt": "alt", - "meta": "Meta", - "capslock": "Feststelltaste", - "insert": "einfügen", - "home": "heim", - "end": "Ende", - "pageup": "Seite nach oben", - "pagedown": "Bild nach unten", - "!": "!", - "@": "@", - "#": "#", - "$": "$", - "%": "%", - "^": "^", - "&": "&", - "*": "*", - "(": "(", - ")": ")", - "-": "-", - "_": "_", - "+": "+", - "=": "=", - "[": "[", - "]": "]", - "{": "{", - "}": "}", - ";": ";", - ":": ":", - "'": "'", - "\"": "\"", - ",": ",", - ".": ".", - "<": "<", - ">": ">", - "/": "/", - "?": "?", - "LEFT_STICK_X": "LEFT_STICK_X", - "LEFT_STICK_Y": "LEFT_STICK_Y", - "RIGHT_STICK_X": "RIGHT_STICK_X", - "RIGHT_STICK_Y": "RIGHT_STICK_Y", - "LEFT_TRIGGER": "LINKER TRIGGER", - "RIGHT_TRIGGER": "RIGHT_TRIGGER", - "A_BUTTON": "EIN KNOPF", - "B_BUTTON": "B_BUTTON", - "X_BUTTON": "X_BUTTON", - "Y_BUTTON": "Y_BUTTON", - "START_BUTTON": "START KNOPF", - "SELECT_BUTTON": "AUSWAHLKNOPF", - "L1_BUTTON": "L1_TASTE", - "R1_BUTTON": "R1_BUTTON", - "L2_BUTTON": "L2_TASTE", - "R2_BUTTON": "R2_BUTTON", - "LEFT_THUMB_BUTTON": "LEFT_THUMB_BUTTON", - "RIGHT_THUMB_BUTTON": "RIGHT_THUMB_BUTTON", - "DPAD_UP": "DPAD_UP", - "DPAD_DOWN": "DPAD_DOWN", - "DPAD_LEFT": "DPAD_LEFT", - "DPAD_RIGHT": "DPAD_RIGHT" +{ + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7", + "8": "8", + "9": "9", + "Restart": "Neu starten", + "Pause": "Pause", + "Play": "Spielen", + "Save State": "Sicherer Staat", + "Load State": "Ladezustand", + "Control Settings": "Kontrolleinstellungen", + "Cheats": "Betrüger", + "Cache Manager": "Cache-Manager", + "Export Save File": "Speichern Sie die Datei exportieren", + "Import Save File": "Speicherdatei importieren", + "Netplay": "Spiel am Netz", + "Mute": "Stumm", + "Unmute": "Stummschaltung aufheben", + "Settings": "Einstellungen", + "Enter Fullscreen": "Vollbildmodus aktivieren", + "Exit Fullscreen": "Beenden Sie den Vollbildmodus", + "Reset": "Zurücksetzen", + "Clear": "Klar", + "Close": "Schließen", + "QUICK SAVE STATE": "SCHNELLER SPEICHERENZUSTAND", + "QUICK LOAD STATE": "SCHNELLER LADEZUSTAND", + "CHANGE STATE SLOT": "STATUS-SLOT ÄNDERN", + "FAST FORWARD": "SCHNELLER VORLAUF", + "Player": "Spieler", + "Connected Gamepad": "Verbundenes Gamepad", + "Gamepad": "Gamepad", + "Keyboard": "Tastatur", + "Set": "Satz", + "Add Cheat": "Cheat hinzufügen", + "Create a Room": "Erstellen Sie einen Raum", + "Rooms": "Räume", + "Start Game": "Spiel beginnen", + "Loading...": "Wird geladen...", + "Download Game Core": "Laden Sie Game Core herunter", + "Decompress Game Core": "Game Core entpacken", + "Download Game Data": "Spieldaten herunterladen", + "Decompress Game Data": "Spieldaten entpacken", + "Shaders": "Shader", + "Disabled": "Deaktiviert", + "2xScaleHQ": "2xScaleHQ", + "4xScaleHQ": "4xScaleHQ", + "CRT easymode": "CRT-Easymode", + "CRT aperture": "CRT-Blende", + "CRT geom": "CRT-geom", + "CRT mattias": "CRT Mattias", + "FPS": "FPS", + "show": "zeigen", + "hide": "verstecken", + "Fast Forward Ratio": "Schnellvorlaufverhältnis", + "Fast Forward": "Schneller Vorlauf", + "Enabled": "Ermöglicht", + "Save State Slot": "Status-Slot speichern", + "Save State Location": "Bundeslandstandort speichern", + "Download": "Herunterladen", + "Keep in Browser": "Im Browser behalten", + "Auto": "Auto", + "NTSC": "NTSC", + "PAL": "KUMPEL", + "Dendy": "Dendy", + "8:7 PAR": "8:7 PAR", + "4:3": "4:3", + "Low": "Niedrig", + "High": "Hoch", + "Very High": "Sehr hoch", + "None": "Keiner", + "Player 1": "Spieler 1", + "Player 2": "Spieler 2", + "Both": "Beide", + "SAVED STATE TO SLOT": "STATUS FÜR SLOT GESPEICHERT", + "LOADED STATE FROM SLOT": "GELADENER STATUS VON SLOT", + "SET SAVE STATE SLOT TO": "SAVE STATE SLOT EINSTELLEN AUF", + "Network Error": "Netzwerkfehler", + "Submit": "Einreichen", + "Description": "Beschreibung", + "Code": "Code", + "Add Cheat Code": "Cheat-Code hinzufügen", + "Leave Room": "Zimmer verlassen", + "Password": "Passwort", + "Password (optional)": "Passwort (optional)", + "Max Players": "Maximale Spieleranzahl", + "Room Name": "Raumname", + "Join": "Verbinden", + "Player Name": "Spielername", + "Set Player Name": "Legen Sie den Spielernamen fest", + "Left Handed Mode": "Linkshänder-Modus", + "Virtual Gamepad": "Virtuelles Gamepad", + "Disk": "Scheibe", + "Press Keyboard": "Drücken Sie Tastatur", + "INSERT COIN": "MÜNZE EINWERFEN", + "Remove": "Entfernen", + "SAVE LOADED FROM BROWSER": "SPEICHERN VOM BROWSER GELADEN", + "SAVE SAVED TO BROWSER": "SPEICHERN IM BROWSER GESPEICHERT", + "Join the discord": "Treten Sie dem Discord bei", + "View on GitHub": "Auf GitHub ansehen", + "Failed to start game": "Das Spiel konnte nicht gestartet werden", + "Download Game BIOS": "Laden Sie das Spiel-BIOS herunter", + "Decompress Game BIOS": "Dekomprimieren Sie das Spiel-BIOS", + "Download Game Parent": "Laden Sie Game Parent herunter", + "Decompress Game Parent": "Dekomprimieren Sie das übergeordnete Spiel", + "Download Game Patch": "Laden Sie den Spiel-Patch herunter", + "Decompress Game Patch": "Dekomprimieren Sie den Spiel-Patch", + "Download Game State": "Spielstatus herunterladen", + "Check console": "Überprüfen Sie die Konsole", + "Error for site owner": "Fehler für Websitebesitzer", + "EmulatorJS": "EmulatorJS", + "Clear All": "Alles löschen", + "Take Screenshot": "Einen Screenshot machen", + "Quick Save": "Schnellspeichern", + "Quick Load": "Schnell laden", + "REWIND": "ZURÜCKSPULEN", + "Rewind Enabled (requires restart)": "Rücklauf aktiviert (Neustart erforderlich)", + "Rewind Granularity": "Granularität zurückspulen", + "Slow Motion Ratio": "Zeitlupenverhältnis", + "Slow Motion": "Zeitlupe", + "Home": "Heim", + "EmulatorJS License": "EmulatorJS-Lizenz", + "RetroArch License": "RetroArch-Lizenz", + "SLOW MOTION": "ZEITLUPE", + "A": "A", + "B": "B", + "SELECT": "WÄHLEN", + "START": "START", + "UP": "HOCH", + "DOWN": "RUNTER", + "LEFT": "LINKS", + "RIGHT": "RECHTS", + "X": "X", + "Y": "Y", + "L": "L", + "R": "R", + "Z": "Z", + "STICK UP": "Bleiben Sie dran", + "STICK DOWN": "HALTE DICH", + "STICK LEFT": "LINKS STEHEN", + "STICK RIGHT": "HALTEN SIE SICH NACH RECHTS", + "C-PAD UP": "C-PAD nach oben", + "C-PAD DOWN": "C-PAD NACH UNTEN", + "C-PAD LEFT": "C-PAD LINKS", + "C-PAD RIGHT": "C-PAD RECHTS", + "MICROPHONE": "MIKROFON", + "BUTTON 1 / START": "TASTE 1 / START", + "BUTTON 2": "TASTE 2", + "BUTTON": "TASTE", + "LEFT D-PAD UP": "LINKES D-PAD NACH OBEN", + "LEFT D-PAD DOWN": "LINKES D-PAD NACH UNTEN", + "LEFT D-PAD LEFT": "LINKES D-PAD LINKS", + "LEFT D-PAD RIGHT": "LINKES D-PAD RECHTS", + "RIGHT D-PAD UP": "RECHTES D-PAD NACH OBEN", + "RIGHT D-PAD DOWN": "RECHTES D-PAD NACH UNTEN", + "RIGHT D-PAD LEFT": "RECHTES D-PAD LINKS", + "RIGHT D-PAD RIGHT": "RECHTES D-PAD RECHTS", + "C": "C", + "MODE": "MODUS", + "FIRE": "FEUER", + "RESET": "ZURÜCKSETZEN", + "LEFT DIFFICULTY A": "SCHWIERIGKEIT LINKS A", + "LEFT DIFFICULTY B": "SCHWIERIGKEIT LINKS B", + "RIGHT DIFFICULTY A": "RECHTER SCHWIERIGKEIT A", + "RIGHT DIFFICULTY B": "RECHTER SCHWIERIGKEIT B", + "COLOR": "FARBE", + "B/W": "S/W", + "PAUSE": "PAUSE", + "OPTION": "MÖGLICHKEIT", + "OPTION 1": "OPTION 1", + "OPTION 2": "OPTION 2", + "L2": "L2", + "R2": "R2", + "L3": "L3", + "R3": "R3", + "L STICK UP": "L BLEIB DURCH", + "L STICK DOWN": "L HALTE DICH", + "L STICK LEFT": "L STICK LINKS", + "L STICK RIGHT": "L HALTE NACH RECHTS", + "R STICK UP": "R HALTEN SIE SICH AUF", + "R STICK DOWN": "R HALTEN SIE SICH NACH UNTEN", + "R STICK LEFT": "R STICK LINKS", + "R STICK RIGHT": "R STICK NACH RECHTS", + "Start": "Start", + "Select": "Wählen", + "Fast": "Schnell", + "Slow": "Langsam", + "a": "A", + "b": "B", + "c": "C", + "d": "D", + "e": "e", + "f": "F", + "g": "G", + "h": "H", + "i": "ich", + "j": "J", + "k": "k", + "l": "l", + "m": "M", + "n": "N", + "o": "Ö", + "p": "P", + "q": "Q", + "r": "R", + "s": "S", + "t": "T", + "u": "u", + "v": "v", + "w": "w", + "x": "X", + "y": "j", + "z": "z", + "enter": "eingeben", + "escape": "Flucht", + "space": "Raum", + "tab": "Tab", + "backspace": "Rücktaste", + "delete": "löschen", + "arrowup": "Pfeil nach oben", + "arrowdown": "Pfeil nach unten", + "arrowleft": "Pfeil nach links", + "arrowright": "Pfeil nach rechts", + "f1": "f1", + "f2": "f2", + "f3": "f3", + "f4": "f4", + "f5": "f5", + "f6": "f6", + "f7": "f7", + "f8": "f8", + "f9": "f9", + "f10": "f10", + "f11": "f11", + "f12": "f12", + "shift": "Schicht", + "control": "Kontrolle", + "alt": "alt", + "meta": "Meta", + "capslock": "Feststelltaste", + "insert": "einfügen", + "home": "heim", + "end": "Ende", + "pageup": "Seite nach oben", + "pagedown": "Bild nach unten", + "!": "!", + "@": "@", + "#": "#", + "$": "$", + "%": "%", + "^": "^", + "&": "&", + "*": "*", + "(": "(", + ")": ")", + "-": "-", + "_": "_", + "+": "+", + "=": "=", + "[": "[", + "]": "]", + "{": "{", + "}": "}", + ";": ";", + ":": ":", + "'": "'", + "\"": "\"", + ",": ",", + ".": ".", + "<": "<", + ">": ">", + "/": "/", + "?": "?", + "LEFT_STICK_X": "LEFT_STICK_X", + "LEFT_STICK_Y": "LEFT_STICK_Y", + "RIGHT_STICK_X": "RIGHT_STICK_X", + "RIGHT_STICK_Y": "RIGHT_STICK_Y", + "LEFT_TRIGGER": "LINKER TRIGGER", + "RIGHT_TRIGGER": "RIGHT_TRIGGER", + "A_BUTTON": "EIN KNOPF", + "B_BUTTON": "B_BUTTON", + "X_BUTTON": "X_BUTTON", + "Y_BUTTON": "Y_BUTTON", + "START_BUTTON": "START KNOPF", + "SELECT_BUTTON": "AUSWAHLKNOPF", + "L1_BUTTON": "L1_TASTE", + "R1_BUTTON": "R1_BUTTON", + "L2_BUTTON": "L2_TASTE", + "R2_BUTTON": "R2_BUTTON", + "LEFT_THUMB_BUTTON": "LEFT_THUMB_BUTTON", + "RIGHT_THUMB_BUTTON": "RIGHT_THUMB_BUTTON", + "DPAD_UP": "DPAD_UP", + "DPAD_DOWN": "DPAD_DOWN", + "DPAD_LEFT": "DPAD_LEFT", + "DPAD_RIGHT": "DPAD_RIGHT" } \ No newline at end of file diff --git a/semag/emulatorjs/data/localization/el-GR.json b/semag/emulatorjs/data/localization/el-GR.json index 161daa84..b1cfacbc 100644 --- a/semag/emulatorjs/data/localization/el-GR.json +++ b/semag/emulatorjs/data/localization/el-GR.json @@ -1,301 +1,301 @@ -{ - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7", - "8": "8", - "9": "9", - "Restart": "Επανεκκίνηση", - "Pause": "Παύση", - "Play": "Παίζω", - "Save State": "Save State", - "Load State": "Κατάσταση φόρτωσης", - "Control Settings": "Ρυθμίσεις ελέγχου", - "Cheats": "Απατεώνες", - "Cache Manager": "Διαχειριστής προσωρινής μνήμης", - "Export Save File": "Εξαγωγή Αποθήκευση αρχείου", - "Import Save File": "Εισαγωγή Αποθήκευση αρχείου", - "Netplay": "Netplay", - "Mute": "Βουβός", - "Unmute": "Κατάργηση σίγασης", - "Settings": "Ρυθμίσεις", - "Enter Fullscreen": "Εισέλθετε σε πλήρη οθόνη", - "Exit Fullscreen": "Έξοδος από την πλήρη οθόνη", - "Reset": "Επαναφορά", - "Clear": "Σαφή", - "Close": "Κλείσε", - "QUICK SAVE STATE": "ΓΡΗΓΟΡΗ ΑΠΟΘΗΚΕΥΣΗ ΚΑΤΑΣΤΑΣΗΣ", - "QUICK LOAD STATE": "ΚΑΤΑΣΤΑΣΗ ΓΡΗΓΟΡΗΣ ΦΟΡΤΩΣΗΣ", - "CHANGE STATE SLOT": "ΑΛΛΑΓΗ ΚΑΤΑΣΤΑΣΗΣ ΣΛΟΤ", - "FAST FORWARD": "ΓΡΗΓΟΡΗ ΠΡΟΩΘΗΣΗ", - "Player": "Παίχτης", - "Connected Gamepad": "Συνδεδεμένο Gamepad", - "Gamepad": "Gamepad", - "Keyboard": "Πληκτρολόγιο", - "Set": "Σειρά", - "Add Cheat": "Προσθήκη εξαπάτησης", - "Create a Room": "Δημιουργήστε ένα δωμάτιο", - "Rooms": "Δωμάτια", - "Start Game": "Ξεκίνα το παιχνίδι", - "Loading...": "Φόρτωση...", - "Download Game Core": "Κατεβάστε το Game Core", - "Decompress Game Core": "Αποσυμπιέστε τον πυρήνα του παιχνιδιού", - "Download Game Data": "Λήψη δεδομένων παιχνιδιού", - "Decompress Game Data": "Αποσυμπίεση δεδομένων παιχνιδιού", - "Shaders": "Shaders", - "Disabled": "άτομα με ειδικές ανάγκες", - "2xScaleHQ": "2xScaleHQ", - "4xScaleHQ": "4xScaleHQ", - "CRT easymode": "CRT easymode", - "CRT aperture": "Διάφραγμα CRT", - "CRT geom": "CRT γεωμ", - "CRT mattias": "CRT mattias", - "FPS": "FPS", - "show": "προβολή", - "hide": "κρύβω", - "Fast Forward Ratio": "Αναλογία Fast Forward", - "Fast Forward": "Γρήγορη προώθηση", - "Enabled": "Ενεργοποιημένο", - "Save State Slot": "Save State Slot", - "Save State Location": "Αποθήκευση τοποθεσίας κατάστασης", - "Download": "Κατεβάστε", - "Keep in Browser": "Διατήρηση στο πρόγραμμα περιήγησης", - "Auto": "Αυτο", - "NTSC": "NTSC", - "PAL": "ΦΙΛΑΡΑΚΟΣ", - "Dendy": "Dendy", - "8:7 PAR": "8:7 ΠΑΡ", - "4:3": "4:3", - "Low": "Χαμηλός", - "High": "Υψηλός", - "Very High": "Πολύ ψηλά", - "None": "Κανένας", - "Player 1": "Παίκτης 1", - "Player 2": "Παίκτης 2", - "Both": "Και τα δυο", - "SAVED STATE TO SLOT": "ΣΩΘΗΚΕ ΠΟΛΙΤΕΙΑ ΣΤΟ ΣΛΟΤ", - "LOADED STATE FROM SLOT": "ΦΟΡΤΩΜΕΝΗ ΚΑΤΑΣΤΑΣΗ ΑΠΟ ΣΛΟΤ", - "SET SAVE STATE SLOT TO": "ΡΥΘΜΙΣΗ ΑΠΟΘΗΚΕΥΣΗ ΚΑΤΑΣΤΑΣΗΣ ΣΤΟΙΧΗΣ ΣΤΟ", - "Network Error": "Σφάλμα δικτύου", - "Submit": "υποβάλλουν", - "Description": "Περιγραφή", - "Code": "Κώδικας", - "Add Cheat Code": "Προσθέστε τον κωδικό εξαπάτησης", - "Leave Room": "Έξοδος από το δωμάτιο", - "Password": "Κωδικός πρόσβασης", - "Password (optional)": "Κωδικός πρόσβασης (προαιρετικό)", - "Max Players": "Μέγιστος αριθμός παικτών", - "Room Name": "Ονομα δωματίου", - "Join": "Συμμετοχή", - "Player Name": "Ονομα παίκτη", - "Set Player Name": "Ορισμός ονόματος παίκτη", - "Left Handed Mode": "Λειτουργία Αριστερόχειρας", - "Virtual Gamepad": "Εικονικό Gamepad", - "Disk": "Δίσκος", - "Press Keyboard": "Πατήστε Πληκτρολόγιο", - "INSERT COIN": "ΕΙΣΑΓΕΤΕ ΝΟΜΙΣΜΑ", - "Remove": "Αφαιρώ", - "SAVE LOADED FROM BROWSER": "ΑΠΟΘΗΚΕΥΣΗ ΦΟΡΤΩΜΕΝΟΥ ΑΠΟ ΤΟ BROWSER", - "SAVE SAVED TO BROWSER": "ΑΠΟΘΗΚΕΥΣΗ ΑΠΟΘΗΚΕΥΤΗΚΕ ΣΤΟ BROWSER", - "Join the discord": "Συμμετάσχετε στη διχόνοια", - "View on GitHub": "Προβολή στο GitHub", - "Failed to start game": "Απέτυχε η έναρξη του παιχνιδιού", - "Download Game BIOS": "Κατεβάστε το παιχνίδι BIOS", - "Decompress Game BIOS": "Αποσυμπίεση του BIOS του παιχνιδιού", - "Download Game Parent": "Κατεβάστε το παιχνίδι Parent", - "Decompress Game Parent": "Αποσυμπίεση γονέα παιχνιδιού", - "Download Game Patch": "Κατεβάστε το Patch παιχνιδιού", - "Decompress Game Patch": "Αποσυμπιέστε το Patch παιχνιδιού", - "Download Game State": "Λήψη κατάστασης παιχνιδιού", - "Check console": "Ελέγξτε την κονσόλα", - "Error for site owner": "Σφάλμα για τον ιδιοκτήτη του ιστότοπου", - "EmulatorJS": "EmulatorJS", - "Clear All": "Τα καθαρίζω όλα", - "Take Screenshot": "Λήψη στιγμιότυπου οθόνης", - "Quick Save": "ΓΡΗΓΟΡΗ ΑΠΟΘΗΚΕΥΣΗ", - "Quick Load": "Γρήγορη φόρτωση", - "REWIND": "ΠΙΣΩ ΠΙΣΩ", - "Rewind Enabled (requires restart)": "Το Rewind Enabled (απαιτεί επανεκκίνηση)", - "Rewind Granularity": "Rewind Granularity", - "Slow Motion Ratio": "Αναλογία αργής κίνησης", - "Slow Motion": "Αργή κίνηση", - "Home": "Σπίτι", - "EmulatorJS License": "Άδεια EmulatorJS", - "RetroArch License": "Άδεια RetroArch", - "SLOW MOTION": "ΑΡΓΗ ΚΙΝΗΣΗ", - "A": "ΕΝΑ", - "B": "σι", - "SELECT": "ΕΠΙΛΕΓΩ", - "START": "ΑΡΧΗ", - "UP": "ΠΑΝΩ", - "DOWN": "ΚΑΤΩ", - "LEFT": "ΑΡΙΣΤΕΡΑ", - "RIGHT": "ΣΩΣΤΑ", - "X": "Χ", - "Y": "Υ", - "L": "μεγάλο", - "R": "R", - "Z": "Ζ", - "STICK UP": "ΜΕΝΩ ΠΙΣΤΟΣ ΣΕ ΚΑΤΙ", - "STICK DOWN": "ΚΟΛΛΗΤΕ ΚΑΤΩ", - "STICK LEFT": "ΚΟΛΛΑ ΑΡΙΣΤΕΡΑ", - "STICK RIGHT": "ΚΟΛΛΗ ΣΩΣΤΟ", - "C-PAD UP": "C-PAD UP", - "C-PAD DOWN": "C-PAD DOWN", - "C-PAD LEFT": "C-PAD ΑΡΙΣΤΕΡΑ", - "C-PAD RIGHT": "C-PAD ΔΕΞΙΑ", - "MICROPHONE": "ΜΙΚΡΟΦΩΝΟ", - "BUTTON 1 / START": "ΚΟΥΜΠΙ 1 / ΕΝΑΡΞΗ", - "BUTTON 2": "ΚΟΥΜΠΙ 2", - "BUTTON": "ΚΟΥΜΠΙ", - "LEFT D-PAD UP": "ΑΡΙΣΤΕΡΟ D-PAD ΕΠΑΝΩ", - "LEFT D-PAD DOWN": "ΑΡΙΣΤΕΡΟ D-PAD ΚΑΤΩ", - "LEFT D-PAD LEFT": "ΑΡΙΣΤΕΡΟ D-PAD ΑΡΙΣΤΕΡΑ", - "LEFT D-PAD RIGHT": "ΑΡΙΣΤΕΡΟ D-PAD ΔΕΞΙΑ", - "RIGHT D-PAD UP": "ΔΕΞΙ D-PAD UP", - "RIGHT D-PAD DOWN": "ΔΕΞΙΟ D-PAD ΚΑΤΩ", - "RIGHT D-PAD LEFT": "ΔΕΞΙ D-PAD ΑΡΙΣΤΕΡΑ", - "RIGHT D-PAD RIGHT": "ΔΕΞΙΟ D-PAD ΔΕΞΙΑ", - "C": "ντο", - "MODE": "ΤΡΟΠΟΣ", - "FIRE": "ΦΩΤΙΑ", - "RESET": "ΕΠΑΝΑΦΟΡΑ", - "LEFT DIFFICULTY A": "ΑΡΙΣΤΕΡΑ ΔΥΣΚΟΛΙΑ Α", - "LEFT DIFFICULTY B": "ΑΡΙΣΤΕΡΑ ΔΥΣΚΟΛΙΑ Β", - "RIGHT DIFFICULTY A": "ΣΩΣΤΗ ΔΥΣΚΟΛΙΑ Α", - "RIGHT DIFFICULTY B": "ΣΩΣΤΗ ΔΥΣΚΟΛΙΑ Β", - "COLOR": "ΧΡΩΜΑ", - "B/W": "Β/Δ", - "PAUSE": "ΠΑΥΣΗ", - "OPTION": "ΕΠΙΛΟΓΗ", - "OPTION 1": "ΕΠΙΛΟΓΗ 1", - "OPTION 2": "ΕΠΙΛΟΓΗ 2", - "L2": "L2", - "R2": "R2", - "L3": "L3", - "R3": "R3", - "L STICK UP": "L ΚΟΛΛΗΣΗ", - "L STICK DOWN": "L ΚΟΛΛΗΤΕ ΚΑΤΩ", - "L STICK LEFT": "L STICK ΑΡΙΣΤΕΡΑ", - "L STICK RIGHT": "L ΚΟΛΛΑ ΔΕΞΙΑ", - "R STICK UP": "R ΚΟΛΛΗΣΗ", - "R STICK DOWN": "R ΚΟΛΛΗΤΕ ΚΑΤΩ", - "R STICK LEFT": "R STICK ΑΡΙΣΤΕΡΑ", - "R STICK RIGHT": "R ΚΟΛΛΑ ΔΕΞΙΑ", - "Start": "Αρχή", - "Select": "Επιλέγω", - "Fast": "Γρήγορα", - "Slow": "Αργός", - "a": "ένα", - "b": "σι", - "c": "ντο", - "d": "ρε", - "e": "μι", - "f": "φά", - "g": "σολ", - "h": "η", - "i": "Εγώ", - "j": "ι", - "k": "κ", - "l": "μεγάλο", - "m": "Μ", - "n": "n", - "o": "ο", - "p": "Π", - "q": "q", - "r": "r", - "s": "μικρό", - "t": "t", - "u": "u", - "v": "v", - "w": "w", - "x": "Χ", - "y": "y", - "z": "z", - "enter": "εισαγω", - "escape": "διαφυγή", - "space": "χώρος", - "tab": "αυτί", - "backspace": "backspace", - "delete": "διαγράφω", - "arrowup": "βέλος επάνω", - "arrowdown": "βέλος προς τα κάτω", - "arrowleft": "αριστερό βέλος", - "arrowright": "βέλος δεξιά", - "f1": "στ1", - "f2": "στ2", - "f3": "f3", - "f4": "f4", - "f5": "f5", - "f6": "στ6", - "f7": "f7", - "f8": "f8", - "f9": "f9", - "f10": "f10", - "f11": "f11", - "f12": "f12", - "shift": "βάρδια", - "control": "έλεγχος", - "alt": "alt", - "meta": "μετα", - "capslock": "κεφαλαία", - "insert": "εισάγετε", - "home": "Σπίτι", - "end": "τέλος", - "pageup": "σελίδα προς τα πάνω", - "pagedown": "σελίδα κάτω", - "!": "!", - "@": "@", - "#": "#", - "$": "$", - "%": "%", - "^": "^", - "&": "&", - "*": "*", - "(": "(", - ")": ")", - "-": "-", - "_": "_", - "+": "+", - "=": "=", - "[": "[", - "]": "]", - "{": "{", - "}": "}", - ";": ";", - ":": ":", - "'": "'", - "\"": "\"", - ",": ",", - ".": ".", - "<": "<", - ">": ">", - "/": "/", - "?": "?", - "LEFT_STICK_X": "LEFT_STICK_X", - "LEFT_STICK_Y": "LEFT_STICK_Y", - "RIGHT_STICK_X": "RIGHT_STICK_X", - "RIGHT_STICK_Y": "RIGHT_STICK_Y", - "LEFT_TRIGGER": "LEFT_TRIGGER", - "RIGHT_TRIGGER": "RIGHT_TRIGGER", - "A_BUTTON": "ΕΝΑ ΚΟΥΜΠΙ", - "B_BUTTON": "B_BUTTON", - "X_BUTTON": "X_BUTTON", - "Y_BUTTON": "Y_BUTTON", - "START_BUTTON": "ΚΟΥΜΠΙ ΕΚΚΙΝΗΣΗΣ", - "SELECT_BUTTON": "SELECT_BUTTON", - "L1_BUTTON": "L1_BUTTON", - "R1_BUTTON": "R1_BUTTON", - "L2_BUTTON": "L2_BUTTON", - "R2_BUTTON": "R2_BUTTON", - "LEFT_THUMB_BUTTON": "LEFT_THUMB_BUTTON", - "RIGHT_THUMB_BUTTON": "RIGHT_THUMB_BUTTON", - "DPAD_UP": "DPAD_UP", - "DPAD_DOWN": "DPAD_DOWN", - "DPAD_LEFT": "DPAD_LEFT", - "DPAD_RIGHT": "DPAD_RIGHT" +{ + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7", + "8": "8", + "9": "9", + "Restart": "Επανεκκίνηση", + "Pause": "Παύση", + "Play": "Παίζω", + "Save State": "Save State", + "Load State": "Κατάσταση φόρτωσης", + "Control Settings": "Ρυθμίσεις ελέγχου", + "Cheats": "Απατεώνες", + "Cache Manager": "Διαχειριστής προσωρινής μνήμης", + "Export Save File": "Εξαγωγή Αποθήκευση αρχείου", + "Import Save File": "Εισαγωγή Αποθήκευση αρχείου", + "Netplay": "Netplay", + "Mute": "Βουβός", + "Unmute": "Κατάργηση σίγασης", + "Settings": "Ρυθμίσεις", + "Enter Fullscreen": "Εισέλθετε σε πλήρη οθόνη", + "Exit Fullscreen": "Έξοδος από την πλήρη οθόνη", + "Reset": "Επαναφορά", + "Clear": "Σαφή", + "Close": "Κλείσε", + "QUICK SAVE STATE": "ΓΡΗΓΟΡΗ ΑΠΟΘΗΚΕΥΣΗ ΚΑΤΑΣΤΑΣΗΣ", + "QUICK LOAD STATE": "ΚΑΤΑΣΤΑΣΗ ΓΡΗΓΟΡΗΣ ΦΟΡΤΩΣΗΣ", + "CHANGE STATE SLOT": "ΑΛΛΑΓΗ ΚΑΤΑΣΤΑΣΗΣ ΣΛΟΤ", + "FAST FORWARD": "ΓΡΗΓΟΡΗ ΠΡΟΩΘΗΣΗ", + "Player": "Παίχτης", + "Connected Gamepad": "Συνδεδεμένο Gamepad", + "Gamepad": "Gamepad", + "Keyboard": "Πληκτρολόγιο", + "Set": "Σειρά", + "Add Cheat": "Προσθήκη εξαπάτησης", + "Create a Room": "Δημιουργήστε ένα δωμάτιο", + "Rooms": "Δωμάτια", + "Start Game": "Ξεκίνα το παιχνίδι", + "Loading...": "Φόρτωση...", + "Download Game Core": "Κατεβάστε το Game Core", + "Decompress Game Core": "Αποσυμπιέστε τον πυρήνα του παιχνιδιού", + "Download Game Data": "Λήψη δεδομένων παιχνιδιού", + "Decompress Game Data": "Αποσυμπίεση δεδομένων παιχνιδιού", + "Shaders": "Shaders", + "Disabled": "άτομα με ειδικές ανάγκες", + "2xScaleHQ": "2xScaleHQ", + "4xScaleHQ": "4xScaleHQ", + "CRT easymode": "CRT easymode", + "CRT aperture": "Διάφραγμα CRT", + "CRT geom": "CRT γεωμ", + "CRT mattias": "CRT mattias", + "FPS": "FPS", + "show": "προβολή", + "hide": "κρύβω", + "Fast Forward Ratio": "Αναλογία Fast Forward", + "Fast Forward": "Γρήγορη προώθηση", + "Enabled": "Ενεργοποιημένο", + "Save State Slot": "Save State Slot", + "Save State Location": "Αποθήκευση τοποθεσίας κατάστασης", + "Download": "Κατεβάστε", + "Keep in Browser": "Διατήρηση στο πρόγραμμα περιήγησης", + "Auto": "Αυτο", + "NTSC": "NTSC", + "PAL": "ΦΙΛΑΡΑΚΟΣ", + "Dendy": "Dendy", + "8:7 PAR": "8:7 ΠΑΡ", + "4:3": "4:3", + "Low": "Χαμηλός", + "High": "Υψηλός", + "Very High": "Πολύ ψηλά", + "None": "Κανένας", + "Player 1": "Παίκτης 1", + "Player 2": "Παίκτης 2", + "Both": "Και τα δυο", + "SAVED STATE TO SLOT": "ΣΩΘΗΚΕ ΠΟΛΙΤΕΙΑ ΣΤΟ ΣΛΟΤ", + "LOADED STATE FROM SLOT": "ΦΟΡΤΩΜΕΝΗ ΚΑΤΑΣΤΑΣΗ ΑΠΟ ΣΛΟΤ", + "SET SAVE STATE SLOT TO": "ΡΥΘΜΙΣΗ ΑΠΟΘΗΚΕΥΣΗ ΚΑΤΑΣΤΑΣΗΣ ΣΤΟΙΧΗΣ ΣΤΟ", + "Network Error": "Σφάλμα δικτύου", + "Submit": "υποβάλλουν", + "Description": "Περιγραφή", + "Code": "Κώδικας", + "Add Cheat Code": "Προσθέστε τον κωδικό εξαπάτησης", + "Leave Room": "Έξοδος από το δωμάτιο", + "Password": "Κωδικός πρόσβασης", + "Password (optional)": "Κωδικός πρόσβασης (προαιρετικό)", + "Max Players": "Μέγιστος αριθμός παικτών", + "Room Name": "Ονομα δωματίου", + "Join": "Συμμετοχή", + "Player Name": "Ονομα παίκτη", + "Set Player Name": "Ορισμός ονόματος παίκτη", + "Left Handed Mode": "Λειτουργία Αριστερόχειρας", + "Virtual Gamepad": "Εικονικό Gamepad", + "Disk": "Δίσκος", + "Press Keyboard": "Πατήστε Πληκτρολόγιο", + "INSERT COIN": "ΕΙΣΑΓΕΤΕ ΝΟΜΙΣΜΑ", + "Remove": "Αφαιρώ", + "SAVE LOADED FROM BROWSER": "ΑΠΟΘΗΚΕΥΣΗ ΦΟΡΤΩΜΕΝΟΥ ΑΠΟ ΤΟ BROWSER", + "SAVE SAVED TO BROWSER": "ΑΠΟΘΗΚΕΥΣΗ ΑΠΟΘΗΚΕΥΤΗΚΕ ΣΤΟ BROWSER", + "Join the discord": "Συμμετάσχετε στη διχόνοια", + "View on GitHub": "Προβολή στο GitHub", + "Failed to start game": "Απέτυχε η έναρξη του παιχνιδιού", + "Download Game BIOS": "Κατεβάστε το παιχνίδι BIOS", + "Decompress Game BIOS": "Αποσυμπίεση του BIOS του παιχνιδιού", + "Download Game Parent": "Κατεβάστε το παιχνίδι Parent", + "Decompress Game Parent": "Αποσυμπίεση γονέα παιχνιδιού", + "Download Game Patch": "Κατεβάστε το Patch παιχνιδιού", + "Decompress Game Patch": "Αποσυμπιέστε το Patch παιχνιδιού", + "Download Game State": "Λήψη κατάστασης παιχνιδιού", + "Check console": "Ελέγξτε την κονσόλα", + "Error for site owner": "Σφάλμα για τον ιδιοκτήτη του ιστότοπου", + "EmulatorJS": "EmulatorJS", + "Clear All": "Τα καθαρίζω όλα", + "Take Screenshot": "Λήψη στιγμιότυπου οθόνης", + "Quick Save": "ΓΡΗΓΟΡΗ ΑΠΟΘΗΚΕΥΣΗ", + "Quick Load": "Γρήγορη φόρτωση", + "REWIND": "ΠΙΣΩ ΠΙΣΩ", + "Rewind Enabled (requires restart)": "Το Rewind Enabled (απαιτεί επανεκκίνηση)", + "Rewind Granularity": "Rewind Granularity", + "Slow Motion Ratio": "Αναλογία αργής κίνησης", + "Slow Motion": "Αργή κίνηση", + "Home": "Σπίτι", + "EmulatorJS License": "Άδεια EmulatorJS", + "RetroArch License": "Άδεια RetroArch", + "SLOW MOTION": "ΑΡΓΗ ΚΙΝΗΣΗ", + "A": "ΕΝΑ", + "B": "σι", + "SELECT": "ΕΠΙΛΕΓΩ", + "START": "ΑΡΧΗ", + "UP": "ΠΑΝΩ", + "DOWN": "ΚΑΤΩ", + "LEFT": "ΑΡΙΣΤΕΡΑ", + "RIGHT": "ΣΩΣΤΑ", + "X": "Χ", + "Y": "Υ", + "L": "μεγάλο", + "R": "R", + "Z": "Ζ", + "STICK UP": "ΜΕΝΩ ΠΙΣΤΟΣ ΣΕ ΚΑΤΙ", + "STICK DOWN": "ΚΟΛΛΗΤΕ ΚΑΤΩ", + "STICK LEFT": "ΚΟΛΛΑ ΑΡΙΣΤΕΡΑ", + "STICK RIGHT": "ΚΟΛΛΗ ΣΩΣΤΟ", + "C-PAD UP": "C-PAD UP", + "C-PAD DOWN": "C-PAD DOWN", + "C-PAD LEFT": "C-PAD ΑΡΙΣΤΕΡΑ", + "C-PAD RIGHT": "C-PAD ΔΕΞΙΑ", + "MICROPHONE": "ΜΙΚΡΟΦΩΝΟ", + "BUTTON 1 / START": "ΚΟΥΜΠΙ 1 / ΕΝΑΡΞΗ", + "BUTTON 2": "ΚΟΥΜΠΙ 2", + "BUTTON": "ΚΟΥΜΠΙ", + "LEFT D-PAD UP": "ΑΡΙΣΤΕΡΟ D-PAD ΕΠΑΝΩ", + "LEFT D-PAD DOWN": "ΑΡΙΣΤΕΡΟ D-PAD ΚΑΤΩ", + "LEFT D-PAD LEFT": "ΑΡΙΣΤΕΡΟ D-PAD ΑΡΙΣΤΕΡΑ", + "LEFT D-PAD RIGHT": "ΑΡΙΣΤΕΡΟ D-PAD ΔΕΞΙΑ", + "RIGHT D-PAD UP": "ΔΕΞΙ D-PAD UP", + "RIGHT D-PAD DOWN": "ΔΕΞΙΟ D-PAD ΚΑΤΩ", + "RIGHT D-PAD LEFT": "ΔΕΞΙ D-PAD ΑΡΙΣΤΕΡΑ", + "RIGHT D-PAD RIGHT": "ΔΕΞΙΟ D-PAD ΔΕΞΙΑ", + "C": "ντο", + "MODE": "ΤΡΟΠΟΣ", + "FIRE": "ΦΩΤΙΑ", + "RESET": "ΕΠΑΝΑΦΟΡΑ", + "LEFT DIFFICULTY A": "ΑΡΙΣΤΕΡΑ ΔΥΣΚΟΛΙΑ Α", + "LEFT DIFFICULTY B": "ΑΡΙΣΤΕΡΑ ΔΥΣΚΟΛΙΑ Β", + "RIGHT DIFFICULTY A": "ΣΩΣΤΗ ΔΥΣΚΟΛΙΑ Α", + "RIGHT DIFFICULTY B": "ΣΩΣΤΗ ΔΥΣΚΟΛΙΑ Β", + "COLOR": "ΧΡΩΜΑ", + "B/W": "Β/Δ", + "PAUSE": "ΠΑΥΣΗ", + "OPTION": "ΕΠΙΛΟΓΗ", + "OPTION 1": "ΕΠΙΛΟΓΗ 1", + "OPTION 2": "ΕΠΙΛΟΓΗ 2", + "L2": "L2", + "R2": "R2", + "L3": "L3", + "R3": "R3", + "L STICK UP": "L ΚΟΛΛΗΣΗ", + "L STICK DOWN": "L ΚΟΛΛΗΤΕ ΚΑΤΩ", + "L STICK LEFT": "L STICK ΑΡΙΣΤΕΡΑ", + "L STICK RIGHT": "L ΚΟΛΛΑ ΔΕΞΙΑ", + "R STICK UP": "R ΚΟΛΛΗΣΗ", + "R STICK DOWN": "R ΚΟΛΛΗΤΕ ΚΑΤΩ", + "R STICK LEFT": "R STICK ΑΡΙΣΤΕΡΑ", + "R STICK RIGHT": "R ΚΟΛΛΑ ΔΕΞΙΑ", + "Start": "Αρχή", + "Select": "Επιλέγω", + "Fast": "Γρήγορα", + "Slow": "Αργός", + "a": "ένα", + "b": "σι", + "c": "ντο", + "d": "ρε", + "e": "μι", + "f": "φά", + "g": "σολ", + "h": "η", + "i": "Εγώ", + "j": "ι", + "k": "κ", + "l": "μεγάλο", + "m": "Μ", + "n": "n", + "o": "ο", + "p": "Π", + "q": "q", + "r": "r", + "s": "μικρό", + "t": "t", + "u": "u", + "v": "v", + "w": "w", + "x": "Χ", + "y": "y", + "z": "z", + "enter": "εισαγω", + "escape": "διαφυγή", + "space": "χώρος", + "tab": "αυτί", + "backspace": "backspace", + "delete": "διαγράφω", + "arrowup": "βέλος επάνω", + "arrowdown": "βέλος προς τα κάτω", + "arrowleft": "αριστερό βέλος", + "arrowright": "βέλος δεξιά", + "f1": "στ1", + "f2": "στ2", + "f3": "f3", + "f4": "f4", + "f5": "f5", + "f6": "στ6", + "f7": "f7", + "f8": "f8", + "f9": "f9", + "f10": "f10", + "f11": "f11", + "f12": "f12", + "shift": "βάρδια", + "control": "έλεγχος", + "alt": "alt", + "meta": "μετα", + "capslock": "κεφαλαία", + "insert": "εισάγετε", + "home": "Σπίτι", + "end": "τέλος", + "pageup": "σελίδα προς τα πάνω", + "pagedown": "σελίδα κάτω", + "!": "!", + "@": "@", + "#": "#", + "$": "$", + "%": "%", + "^": "^", + "&": "&", + "*": "*", + "(": "(", + ")": ")", + "-": "-", + "_": "_", + "+": "+", + "=": "=", + "[": "[", + "]": "]", + "{": "{", + "}": "}", + ";": ";", + ":": ":", + "'": "'", + "\"": "\"", + ",": ",", + ".": ".", + "<": "<", + ">": ">", + "/": "/", + "?": "?", + "LEFT_STICK_X": "LEFT_STICK_X", + "LEFT_STICK_Y": "LEFT_STICK_Y", + "RIGHT_STICK_X": "RIGHT_STICK_X", + "RIGHT_STICK_Y": "RIGHT_STICK_Y", + "LEFT_TRIGGER": "LEFT_TRIGGER", + "RIGHT_TRIGGER": "RIGHT_TRIGGER", + "A_BUTTON": "ΕΝΑ ΚΟΥΜΠΙ", + "B_BUTTON": "B_BUTTON", + "X_BUTTON": "X_BUTTON", + "Y_BUTTON": "Y_BUTTON", + "START_BUTTON": "ΚΟΥΜΠΙ ΕΚΚΙΝΗΣΗΣ", + "SELECT_BUTTON": "SELECT_BUTTON", + "L1_BUTTON": "L1_BUTTON", + "R1_BUTTON": "R1_BUTTON", + "L2_BUTTON": "L2_BUTTON", + "R2_BUTTON": "R2_BUTTON", + "LEFT_THUMB_BUTTON": "LEFT_THUMB_BUTTON", + "RIGHT_THUMB_BUTTON": "RIGHT_THUMB_BUTTON", + "DPAD_UP": "DPAD_UP", + "DPAD_DOWN": "DPAD_DOWN", + "DPAD_LEFT": "DPAD_LEFT", + "DPAD_RIGHT": "DPAD_RIGHT" } \ No newline at end of file diff --git a/semag/emulatorjs/data/localization/en.json b/semag/emulatorjs/data/localization/en.json index 51cd70ad..273d77b5 100644 --- a/semag/emulatorjs/data/localization/en.json +++ b/semag/emulatorjs/data/localization/en.json @@ -1,301 +1,302 @@ -{ - "0": "-0", - "1": "-1", - "2": "-2", - "3": "-3", - "4": "-4", - "5": "-5", - "6": "-6", - "7": "-7", - "8": "-8", - "9": "-9", - "Restart": "-Restart", - "Pause": "-Pause", - "Play": "-Play", - "Save State": "-Save State", - "Load State": "-Load State", - "Control Settings": "-Control Settings", - "Cheats": "-Cheats", - "Cache Manager": "-Cache Manager", - "Export Save File": "-Export Save File", - "Import Save File": "-Import Save File", - "Netplay": "-Netplay", - "Mute": "-Mute", - "Unmute": "-Unmute", - "Settings": "-Settings", - "Enter Fullscreen": "-Enter Fullscreen", - "Exit Fullscreen": "-Exit Fullscreen", - "Reset": "-Reset", - "Clear": "-Clear", - "Close": "-Close", - "QUICK SAVE STATE": "-QUICK SAVE STATE", - "QUICK LOAD STATE": "-QUICK LOAD STATE", - "CHANGE STATE SLOT": "-CHANGE STATE SLOT", - "FAST FORWARD": "-FAST FORWARD", - "Player": "-Player", - "Connected Gamepad": "-Connected Gamepad", - "Gamepad": "-Gamepad", - "Keyboard": "-Keyboard", - "Set": "-Set", - "Add Cheat": "-Add Cheat", - "Create a Room": "-Create a Room", - "Rooms": "-Rooms", - "Start Game": "-Start Game", - "Loading...": "-Loading...", - "Download Game Core": "-Download Game Core", - "Decompress Game Core": "-Decompress Game Core", - "Download Game Data": "-Download Game Data", - "Decompress Game Data": "-Decompress Game Data", - "Shaders": "-Shaders", - "Disabled": "-Disabled", - "2xScaleHQ": "-2xScaleHQ", - "4xScaleHQ": "-4xScaleHQ", - "CRT easymode": "-CRT easymode", - "CRT aperture": "-CRT aperture", - "CRT geom": "-CRT geom", - "CRT mattias": "-CRT mattias", - "FPS": "-FPS", - "show": "-show", - "hide": "-hide", - "Fast Forward Ratio": "-Fast Forward Ratio", - "Fast Forward": "-Fast Forward", - "Enabled": "-Enabled", - "Save State Slot": "-Save State Slot", - "Save State Location": "-Save State Location", - "Download": "-Download", - "Keep in Browser": "-Keep in Browser", - "Auto": "-Auto", - "NTSC": "-NTSC", - "PAL": "-PAL", - "Dendy": "-Dendy", - "8:7 PAR": "-8:7 PAR", - "4:3": "-4:3", - "Low": "-Low", - "High": "-High", - "Very High": "-Very High", - "None": "-None", - "Player 1": "-Player 1", - "Player 2": "-Player 2", - "Both": "-Both", - "SAVED STATE TO SLOT": "-SAVED STATE TO SLOT", - "LOADED STATE FROM SLOT": "-LOADED STATE FROM SLOT", - "SET SAVE STATE SLOT TO": "-SET SAVE STATE SLOT TO", - "Network Error": "-Network Error", - "Submit": "-Submit", - "Description": "-Description", - "Code": "-Code", - "Add Cheat Code": "-Add Cheat Code", - "Leave Room": "-Leave Room", - "Password": "-Password", - "Password (optional)": "-Password (optional)", - "Max Players": "-Max Players", - "Room Name": "-Room Name", - "Join": "-Join", - "Player Name": "-Player Name", - "Set Player Name": "-Set Player Name", - "Left Handed Mode": "-Left Handed Mode", - "Virtual Gamepad": "-Virtual Gamepad", - "Disk": "-Disk", - "Press Keyboard": "-Press Keyboard", - "INSERT COIN": "-INSERT COIN", - "Remove": "-Remove", - "SAVE LOADED FROM BROWSER": "-SAVE LOADED FROM BROWSER", - "SAVE SAVED TO BROWSER": "-SAVE SAVED TO BROWSER", - "Join the discord": "-Join the discord", - "View on GitHub": "-View on GitHub", - "Failed to start game": "-Failed to start game", - "Download Game BIOS": "-Download Game BIOS", - "Decompress Game BIOS": "-Decompress Game BIOS", - "Download Game Parent": "-Download Game Parent", - "Decompress Game Parent": "-Decompress Game Parent", - "Download Game Patch": "-Download Game Patch", - "Decompress Game Patch": "-Decompress Game Patch", - "Download Game State": "-Download Game State", - "Check console": "-Check console", - "Error for site owner": "-Error for site owner", - "EmulatorJS": "-EmulatorJS", - "Clear All": "-Clear All", - "Take Screenshot": "-Take Screenshot", - "Quick Save": "-Quick Save", - "Quick Load": "-Quick Load", - "REWIND": "-REWIND", - "Rewind Enabled (requires restart)": "-Rewind Enabled (requires restart)", - "Rewind Granularity": "-Rewind Granularity", - "Slow Motion Ratio": "-Slow Motion Ratio", - "Slow Motion": "-Slow Motion", - "Home": "-Home", - "EmulatorJS License": "-EmulatorJS License", - "RetroArch License": "-RetroArch License", - "SLOW MOTION": "-SLOW MOTION", - "A": "-A", - "B": "-B", - "SELECT": "-SELECT", - "START": "-START", - "UP": "-UP", - "DOWN": "-DOWN", - "LEFT": "-LEFT", - "RIGHT": "-RIGHT", - "X": "-X", - "Y": "-Y", - "L": "-L", - "R": "-R", - "Z": "-Z", - "STICK UP": "-STICK UP", - "STICK DOWN": "-STICK DOWN", - "STICK LEFT": "-STICK LEFT", - "STICK RIGHT": "-STICK RIGHT", - "C-PAD UP": "-C-PAD UP", - "C-PAD DOWN": "-C-PAD DOWN", - "C-PAD LEFT": "-C-PAD LEFT", - "C-PAD RIGHT": "-C-PAD RIGHT", - "MICROPHONE": "-MICROPHONE", - "BUTTON 1 / START": "-BUTTON 1 / START", - "BUTTON 2": "-BUTTON 2", - "BUTTON": "-BUTTON", - "LEFT D-PAD UP": "-LEFT D-PAD UP", - "LEFT D-PAD DOWN": "-LEFT D-PAD DOWN", - "LEFT D-PAD LEFT": "-LEFT D-PAD LEFT", - "LEFT D-PAD RIGHT": "-LEFT D-PAD RIGHT", - "RIGHT D-PAD UP": "-RIGHT D-PAD UP", - "RIGHT D-PAD DOWN": "-RIGHT D-PAD DOWN", - "RIGHT D-PAD LEFT": "-RIGHT D-PAD LEFT", - "RIGHT D-PAD RIGHT": "-RIGHT D-PAD RIGHT", - "C": "-C", - "MODE": "-MODE", - "FIRE": "-FIRE", - "RESET": "-RESET", - "LEFT DIFFICULTY A": "-LEFT DIFFICULTY A", - "LEFT DIFFICULTY B": "-LEFT DIFFICULTY B", - "RIGHT DIFFICULTY A": "-RIGHT DIFFICULTY A", - "RIGHT DIFFICULTY B": "-RIGHT DIFFICULTY B", - "COLOR": "-COLOR", - "B/W": "-B/W", - "PAUSE": "-PAUSE", - "OPTION": "-OPTION", - "OPTION 1": "-OPTION 1", - "OPTION 2": "-OPTION 2", - "L2": "-L2", - "R2": "-R2", - "L3": "-L3", - "R3": "-R3", - "L STICK UP": "-L STICK UP", - "L STICK DOWN": "-L STICK DOWN", - "L STICK LEFT": "-L STICK LEFT", - "L STICK RIGHT": "-L STICK RIGHT", - "R STICK UP": "-R STICK UP", - "R STICK DOWN": "-R STICK DOWN", - "R STICK LEFT": "-R STICK LEFT", - "R STICK RIGHT": "-R STICK RIGHT", - "Start": "-Start", - "Select": "-Select", - "Fast": "-Fast", - "Slow": "-Slow", - "a": "-a", - "b": "-b", - "c": "-c", - "d": "-d", - "e": "-e", - "f": "-f", - "g": "-g", - "h": "-h", - "i": "-i", - "j": "-j", - "k": "-k", - "l": "-l", - "m": "-m", - "n": "-n", - "o": "-o", - "p": "-p", - "q": "-q", - "r": "-r", - "s": "-s", - "t": "-t", - "u": "-u", - "v": "-v", - "w": "-w", - "x": "-x", - "y": "-y", - "z": "-z", - "enter": "-enter", - "escape": "-escape", - "space": "-space", - "tab": "-tab", - "backspace": "-backspace", - "delete": "-delete", - "arrowup": "-arrowup", - "arrowdown": "-arrowdown", - "arrowleft": "-arrowleft", - "arrowright": "-arrowright", - "f1": "-f1", - "f2": "-f2", - "f3": "-f3", - "f4": "-f4", - "f5": "-f5", - "f6": "-f6", - "f7": "-f7", - "f8": "-f8", - "f9": "-f9", - "f10": "-f10", - "f11": "-f11", - "f12": "-f12", - "shift": "-shift", - "control": "-control", - "alt": "-alt", - "meta": "-meta", - "capslock": "-capslock", - "insert": "-insert", - "home": "-home", - "end": "-end", - "pageup": "-pageup", - "pagedown": "-pagedown", - "!": "-!", - "@": "-@", - "#": "-#", - "$": "-$", - "%": "-%", - "^": "-^", - "&": "-&", - "*": "-*", - "(": "-(", - ")": "-)", - "-": "--", - "_": "-_", - "+": "-+", - "=": "-=", - "[": "-[", - "]": "-]", - "{": "-{", - "}": "-}", - ";": "-;", - ":": "-:", - "'": "-'", - "\"": "-\"", - ",": "-,", - ".": "-.", - "<": "-<", - ">": "->", - "/": "-/", - "?": "-?", - "LEFT_STICK_X": "-LEFT_STICK_X", - "LEFT_STICK_Y": "-LEFT_STICK_Y", - "RIGHT_STICK_X": "-RIGHT_STICK_X", - "RIGHT_STICK_Y": "-RIGHT_STICK_Y", - "LEFT_TRIGGER": "-LEFT_TRIGGER", - "RIGHT_TRIGGER": "-RIGHT_TRIGGER", - "A_BUTTON": "-A_BUTTON", - "B_BUTTON": "-B_BUTTON", - "X_BUTTON": "-X_BUTTON", - "Y_BUTTON": "-Y_BUTTON", - "START_BUTTON": "-START_BUTTON", - "SELECT_BUTTON": "-SELECT_BUTTON", - "L1_BUTTON": "-L1_BUTTON", - "R1_BUTTON": "-R1_BUTTON", - "L2_BUTTON": "-L2_BUTTON", - "R2_BUTTON": "-R2_BUTTON", - "LEFT_THUMB_BUTTON": "-LEFT_THUMB_BUTTON", - "RIGHT_THUMB_BUTTON": "-RIGHT_THUMB_BUTTON", - "DPAD_UP": "-DPAD_UP", - "DPAD_DOWN": "-DPAD_DOWN", - "DPAD_LEFT": "-DPAD_LEFT", - "DPAD_RIGHT": "-DPAD_RIGHT" -} +{ + "0": "-0", + "1": "-1", + "2": "-2", + "3": "-3", + "4": "-4", + "5": "-5", + "6": "-6", + "7": "-7", + "8": "-8", + "9": "-9", + "Restart": "-Restart", + "Pause": "-Pause", + "Play": "-Play", + "Save State": "-Save State", + "Load State": "-Load State", + "Control Settings": "-Control Settings", + "Cheats": "-Cheats", + "Cache Manager": "-Cache Manager", + "Export Save File": "-Export Save File", + "Import Save File": "-Import Save File", + "Netplay": "-Netplay", + "Mute": "-Mute", + "Unmute": "-Unmute", + "Settings": "-Settings", + "Enter Fullscreen": "-Enter Fullscreen", + "Exit Fullscreen": "-Exit Fullscreen", + "Context Menu": "-Context Menu", + "Reset": "-Reset", + "Clear": "-Clear", + "Close": "-Close", + "QUICK SAVE STATE": "-QUICK SAVE STATE", + "QUICK LOAD STATE": "-QUICK LOAD STATE", + "CHANGE STATE SLOT": "-CHANGE STATE SLOT", + "FAST FORWARD": "-FAST FORWARD", + "Player": "-Player", + "Connected Gamepad": "-Connected Gamepad", + "Gamepad": "-Gamepad", + "Keyboard": "-Keyboard", + "Set": "-Set", + "Add Cheat": "-Add Cheat", + "Create a Room": "-Create a Room", + "Rooms": "-Rooms", + "Start Game": "-Start Game", + "Loading...": "-Loading...", + "Download Game Core": "-Download Game Core", + "Decompress Game Core": "-Decompress Game Core", + "Download Game Data": "-Download Game Data", + "Decompress Game Data": "-Decompress Game Data", + "Shaders": "-Shaders", + "Disabled": "-Disabled", + "2xScaleHQ": "-2xScaleHQ", + "4xScaleHQ": "-4xScaleHQ", + "CRT easymode": "-CRT easymode", + "CRT aperture": "-CRT aperture", + "CRT geom": "-CRT geom", + "CRT mattias": "-CRT mattias", + "FPS": "-FPS", + "show": "-show", + "hide": "-hide", + "Fast Forward Ratio": "-Fast Forward Ratio", + "Fast Forward": "-Fast Forward", + "Enabled": "-Enabled", + "Save State Slot": "-Save State Slot", + "Save State Location": "-Save State Location", + "Download": "-Download", + "Keep in Browser": "-Keep in Browser", + "Auto": "-Auto", + "NTSC": "-NTSC", + "PAL": "-PAL", + "Dendy": "-Dendy", + "8:7 PAR": "-8:7 PAR", + "4:3": "-4:3", + "Low": "-Low", + "High": "-High", + "Very High": "-Very High", + "None": "-None", + "Player 1": "-Player 1", + "Player 2": "-Player 2", + "Both": "-Both", + "SAVED STATE TO SLOT": "-SAVED STATE TO SLOT", + "LOADED STATE FROM SLOT": "-LOADED STATE FROM SLOT", + "SET SAVE STATE SLOT TO": "-SET SAVE STATE SLOT TO", + "Network Error": "-Network Error", + "Submit": "-Submit", + "Description": "-Description", + "Code": "-Code", + "Add Cheat Code": "-Add Cheat Code", + "Leave Room": "-Leave Room", + "Password": "-Password", + "Password (optional)": "-Password (optional)", + "Max Players": "-Max Players", + "Room Name": "-Room Name", + "Join": "-Join", + "Player Name": "-Player Name", + "Set Player Name": "-Set Player Name", + "Left Handed Mode": "-Left Handed Mode", + "Virtual Gamepad": "-Virtual Gamepad", + "Disk": "-Disk", + "Press Keyboard": "-Press Keyboard", + "INSERT COIN": "-INSERT COIN", + "Remove": "-Remove", + "SAVE LOADED FROM BROWSER": "-SAVE LOADED FROM BROWSER", + "SAVE SAVED TO BROWSER": "-SAVE SAVED TO BROWSER", + "Join the discord": "-Join the discord", + "View on GitHub": "-View on GitHub", + "Failed to start game": "-Failed to start game", + "Download Game BIOS": "-Download Game BIOS", + "Decompress Game BIOS": "-Decompress Game BIOS", + "Download Game Parent": "-Download Game Parent", + "Decompress Game Parent": "-Decompress Game Parent", + "Download Game Patch": "-Download Game Patch", + "Decompress Game Patch": "-Decompress Game Patch", + "Download Game State": "-Download Game State", + "Check console": "-Check console", + "Error for site owner": "-Error for site owner", + "EmulatorJS": "-EmulatorJS", + "Clear All": "-Clear All", + "Take Screenshot": "-Take Screenshot", + "Quick Save": "-Quick Save", + "Quick Load": "-Quick Load", + "REWIND": "-REWIND", + "Rewind Enabled (requires restart)": "-Rewind Enabled (requires restart)", + "Rewind Granularity": "-Rewind Granularity", + "Slow Motion Ratio": "-Slow Motion Ratio", + "Slow Motion": "-Slow Motion", + "Home": "-Home", + "EmulatorJS License": "-EmulatorJS License", + "RetroArch License": "-RetroArch License", + "SLOW MOTION": "-SLOW MOTION", + "A": "-A", + "B": "-B", + "SELECT": "-SELECT", + "START": "-START", + "UP": "-UP", + "DOWN": "-DOWN", + "LEFT": "-LEFT", + "RIGHT": "-RIGHT", + "X": "-X", + "Y": "-Y", + "L": "-L", + "R": "-R", + "Z": "-Z", + "STICK UP": "-STICK UP", + "STICK DOWN": "-STICK DOWN", + "STICK LEFT": "-STICK LEFT", + "STICK RIGHT": "-STICK RIGHT", + "C-PAD UP": "-C-PAD UP", + "C-PAD DOWN": "-C-PAD DOWN", + "C-PAD LEFT": "-C-PAD LEFT", + "C-PAD RIGHT": "-C-PAD RIGHT", + "MICROPHONE": "-MICROPHONE", + "BUTTON 1 / START": "-BUTTON 1 / START", + "BUTTON 2": "-BUTTON 2", + "BUTTON": "-BUTTON", + "LEFT D-PAD UP": "-LEFT D-PAD UP", + "LEFT D-PAD DOWN": "-LEFT D-PAD DOWN", + "LEFT D-PAD LEFT": "-LEFT D-PAD LEFT", + "LEFT D-PAD RIGHT": "-LEFT D-PAD RIGHT", + "RIGHT D-PAD UP": "-RIGHT D-PAD UP", + "RIGHT D-PAD DOWN": "-RIGHT D-PAD DOWN", + "RIGHT D-PAD LEFT": "-RIGHT D-PAD LEFT", + "RIGHT D-PAD RIGHT": "-RIGHT D-PAD RIGHT", + "C": "-C", + "MODE": "-MODE", + "FIRE": "-FIRE", + "RESET": "-RESET", + "LEFT DIFFICULTY A": "-LEFT DIFFICULTY A", + "LEFT DIFFICULTY B": "-LEFT DIFFICULTY B", + "RIGHT DIFFICULTY A": "-RIGHT DIFFICULTY A", + "RIGHT DIFFICULTY B": "-RIGHT DIFFICULTY B", + "COLOR": "-COLOR", + "B/W": "-B/W", + "PAUSE": "-PAUSE", + "OPTION": "-OPTION", + "OPTION 1": "-OPTION 1", + "OPTION 2": "-OPTION 2", + "L2": "-L2", + "R2": "-R2", + "L3": "-L3", + "R3": "-R3", + "L STICK UP": "-L STICK UP", + "L STICK DOWN": "-L STICK DOWN", + "L STICK LEFT": "-L STICK LEFT", + "L STICK RIGHT": "-L STICK RIGHT", + "R STICK UP": "-R STICK UP", + "R STICK DOWN": "-R STICK DOWN", + "R STICK LEFT": "-R STICK LEFT", + "R STICK RIGHT": "-R STICK RIGHT", + "Start": "-Start", + "Select": "-Select", + "Fast": "-Fast", + "Slow": "-Slow", + "a": "-a", + "b": "-b", + "c": "-c", + "d": "-d", + "e": "-e", + "f": "-f", + "g": "-g", + "h": "-h", + "i": "-i", + "j": "-j", + "k": "-k", + "l": "-l", + "m": "-m", + "n": "-n", + "o": "-o", + "p": "-p", + "q": "-q", + "r": "-r", + "s": "-s", + "t": "-t", + "u": "-u", + "v": "-v", + "w": "-w", + "x": "-x", + "y": "-y", + "z": "-z", + "enter": "-enter", + "escape": "-escape", + "space": "-space", + "tab": "-tab", + "backspace": "-backspace", + "delete": "-delete", + "arrowup": "-arrowup", + "arrowdown": "-arrowdown", + "arrowleft": "-arrowleft", + "arrowright": "-arrowright", + "f1": "-f1", + "f2": "-f2", + "f3": "-f3", + "f4": "-f4", + "f5": "-f5", + "f6": "-f6", + "f7": "-f7", + "f8": "-f8", + "f9": "-f9", + "f10": "-f10", + "f11": "-f11", + "f12": "-f12", + "shift": "-shift", + "control": "-control", + "alt": "-alt", + "meta": "-meta", + "capslock": "-capslock", + "insert": "-insert", + "home": "-home", + "end": "-end", + "pageup": "-pageup", + "pagedown": "-pagedown", + "!": "-!", + "@": "-@", + "#": "-#", + "$": "-$", + "%": "-%", + "^": "-^", + "&": "-&", + "*": "-*", + "(": "-(", + ")": "-)", + "-": "--", + "_": "-_", + "+": "-+", + "=": "-=", + "[": "-[", + "]": "-]", + "{": "-{", + "}": "-}", + ";": "-;", + ":": "-:", + "'": "-'", + "\"": "-\"", + ",": "-,", + ".": "-.", + "<": "-<", + ">": "->", + "/": "-/", + "?": "-?", + "LEFT_STICK_X": "-LEFT_STICK_X", + "LEFT_STICK_Y": "-LEFT_STICK_Y", + "RIGHT_STICK_X": "-RIGHT_STICK_X", + "RIGHT_STICK_Y": "-RIGHT_STICK_Y", + "LEFT_TRIGGER": "-LEFT_TRIGGER", + "RIGHT_TRIGGER": "-RIGHT_TRIGGER", + "A_BUTTON": "-A_BUTTON", + "B_BUTTON": "-B_BUTTON", + "X_BUTTON": "-X_BUTTON", + "Y_BUTTON": "-Y_BUTTON", + "START_BUTTON": "-START_BUTTON", + "SELECT_BUTTON": "-SELECT_BUTTON", + "L1_BUTTON": "-L1_BUTTON", + "R1_BUTTON": "-R1_BUTTON", + "L2_BUTTON": "-L2_BUTTON", + "R2_BUTTON": "-R2_BUTTON", + "LEFT_THUMB_BUTTON": "-LEFT_THUMB_BUTTON", + "RIGHT_THUMB_BUTTON": "-RIGHT_THUMB_BUTTON", + "DPAD_UP": "-DPAD_UP", + "DPAD_DOWN": "-DPAD_DOWN", + "DPAD_LEFT": "-DPAD_LEFT", + "DPAD_RIGHT": "-DPAD_RIGHT" +} diff --git a/semag/emulatorjs/data/localization/es-ES.json b/semag/emulatorjs/data/localization/es-ES.json index fa19e433..afa0b50b 100644 --- a/semag/emulatorjs/data/localization/es-ES.json +++ b/semag/emulatorjs/data/localization/es-ES.json @@ -1,301 +1,301 @@ -{ - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7", - "8": "8", - "9": "9", - "Restart": "Reanudar", - "Pause": "Pausa", - "Play": "Jugar", - "Save State": "Guardar Estado", - "Load State": "Estado de carga", - "Control Settings": "Ajustes de control", - "Cheats": "trucos", - "Cache Manager": "Administrador de caché", - "Export Save File": "Exportar archivo guardado", - "Import Save File": "Importar archivo guardado", - "Netplay": "Juego de red", - "Mute": "Silenciar", - "Unmute": "No silenciar", - "Settings": "Ajustes", - "Enter Fullscreen": "Ingrese a pantalla completa", - "Exit Fullscreen": "Salir de pantalla completa", - "Reset": "Reiniciar", - "Clear": "Claro", - "Close": "Cerca", - "QUICK SAVE STATE": "ESTADO DE GUARDADO RÁPIDO", - "QUICK LOAD STATE": "ESTADO DE CARGA RÁPIDA", - "CHANGE STATE SLOT": "CAMBIAR ESTADO SLOT", - "FAST FORWARD": "AVANCE RÁPIDO", - "Player": "Jugador", - "Connected Gamepad": "Mando conectado", - "Gamepad": "mando", - "Keyboard": "Teclado", - "Set": "Colocar", - "Add Cheat": "Añadir truco", - "Create a Room": "Crear una habitación", - "Rooms": "Habitaciones", - "Start Game": "Empezar juego", - "Loading...": "Cargando...", - "Download Game Core": "Descargar Game Core", - "Decompress Game Core": "Descomprimir Game Core", - "Download Game Data": "Descargar datos del juego", - "Decompress Game Data": "Descomprimir datos del juego", - "Shaders": "sombreadores", - "Disabled": "Desactivado", - "2xScaleHQ": "2xEscalaHQ", - "4xScaleHQ": "4xEscalaHQ", - "CRT easymode": "modo fácil CRT", - "CRT aperture": "Apertura de tubo de rayos catódicos", - "CRT geom": "geometría CRT", - "CRT mattias": "CRT mattias", - "FPS": "FPS", - "show": "espectáculo", - "hide": "esconder", - "Fast Forward Ratio": "Relación de avance rápido", - "Fast Forward": "Avance rápido", - "Enabled": "Activado", - "Save State Slot": "Guardar ranura de estado", - "Save State Location": "Guardar ubicación de estado", - "Download": "Descargar", - "Keep in Browser": "Mantener en el navegador", - "Auto": "Auto", - "NTSC": "NTSC", - "PAL": "CAMARADA", - "Dendy": "Dendy", - "8:7 PAR": "8:7 PAR", - "4:3": "4:3", - "Low": "Bajo", - "High": "Alto", - "Very High": "Muy alto", - "None": "Ninguno", - "Player 1": "Jugador 1", - "Player 2": "jugador 2", - "Both": "Ambos", - "SAVED STATE TO SLOT": "ESTADO GUARDADO EN RANURA", - "LOADED STATE FROM SLOT": "ESTADO CARGADO DESDE LA RANURA", - "SET SAVE STATE SLOT TO": "ESTABLECER GUARDAR RANURA DE ESTADO EN", - "Network Error": "Error de red", - "Submit": "Entregar", - "Description": "Descripción", - "Code": "Código", - "Add Cheat Code": "Agregar código de trucos", - "Leave Room": "Dejar la habitación", - "Password": "Contraseña", - "Password (optional)": "Contraseña (opcional)", - "Max Players": "Jugadores máximos", - "Room Name": "Nombre de la habitación", - "Join": "Unirse", - "Player Name": "Nombre del jugador", - "Set Player Name": "Establecer nombre de jugador", - "Left Handed Mode": "Modo para zurdos", - "Virtual Gamepad": "Mando virtual", - "Disk": "Disco", - "Press Keyboard": "Oprimá teclado", - "INSERT COIN": "INSERTE MONEDA", - "Remove": "Eliminar", - "SAVE LOADED FROM BROWSER": "GUARDAR CARGADO DESDE EL NAVEGADOR", - "SAVE SAVED TO BROWSER": "GUARDAR GUARDADO EN EL NAVEGADOR", - "Join the discord": "Únete a la discordia", - "View on GitHub": "Ver en GitHub", - "Failed to start game": "No se pudo iniciar el juego", - "Download Game BIOS": "Descargar BIOS del juego", - "Decompress Game BIOS": "Descomprimir BIOS del juego", - "Download Game Parent": "Descargar juego para padres", - "Decompress Game Parent": "Padre del juego de descompresión", - "Download Game Patch": "Descargar el parche del juego", - "Decompress Game Patch": "Parche de descompresión del juego", - "Download Game State": "Descargar estado del juego", - "Check console": "Comprobar consola", - "Error for site owner": "Error para el propietario del sitio", - "EmulatorJS": "EmuladorJS", - "Clear All": "Limpiar todo", - "Take Screenshot": "Tomar captura de pantalla", - "Quick Save": "Guardado rápido", - "Quick Load": "Carga rápida", - "REWIND": "REBOBINAR", - "Rewind Enabled (requires restart)": "Rebobinado habilitado (requiere reinicio)", - "Rewind Granularity": "Granularidad de rebobinado", - "Slow Motion Ratio": "Relación de cámara lenta", - "Slow Motion": "Camara lenta", - "Home": "Hogar", - "EmulatorJS License": "Licencia EmulatorJS", - "RetroArch License": "Licencia RetroArch", - "SLOW MOTION": "CAMARA LENTA", - "A": "A", - "B": "B", - "SELECT": "SELECCIONAR", - "START": "COMENZAR", - "UP": "ARRIBA", - "DOWN": "ABAJO", - "LEFT": "IZQUIERDA", - "RIGHT": "BIEN", - "X": "X", - "Y": "Y", - "L": "L", - "R": "R", - "Z": "Z", - "STICK UP": "PEGARSE", - "STICK DOWN": "PEGAR", - "STICK LEFT": "PALO IZQUIERDO", - "STICK RIGHT": "PEGAR A LA DERECHA", - "C-PAD UP": "C-PAD ARRIBA", - "C-PAD DOWN": "C-PAD ABAJO", - "C-PAD LEFT": "C-PAD IZQUIERDO", - "C-PAD RIGHT": "C-PAD DERECHO", - "MICROPHONE": "MICRÓFONO", - "BUTTON 1 / START": "BOTÓN 1 / INICIO", - "BUTTON 2": "BOTÓN 2", - "BUTTON": "BOTÓN", - "LEFT D-PAD UP": "D-PAD IZQUIERDO ARRIBA", - "LEFT D-PAD DOWN": "D-PAD IZQUIERDO ABAJO", - "LEFT D-PAD LEFT": "D-PAD IZQUIERDO IZQUIERDO", - "LEFT D-PAD RIGHT": "D-PAD IZQUIERDO DERECHO", - "RIGHT D-PAD UP": "D-PAD DERECHO ARRIBA", - "RIGHT D-PAD DOWN": "D-PAD DERECHO ABAJO", - "RIGHT D-PAD LEFT": "D-PAD DERECHO IZQUIERDO", - "RIGHT D-PAD RIGHT": "D-PAD DERECHO DERECHO", - "C": "C", - "MODE": "MODO", - "FIRE": "FUEGO", - "RESET": "REINICIAR", - "LEFT DIFFICULTY A": "IZQUIERDA DIFICULTAD A", - "LEFT DIFFICULTY B": "IZQUIERDA DIFICULTAD B", - "RIGHT DIFFICULTY A": "CORRECTA DIFICULTAD A", - "RIGHT DIFFICULTY B": "CORRECTA DIFICULTAD B", - "COLOR": "COLOR", - "B/W": "B/N", - "PAUSE": "PAUSA", - "OPTION": "OPCIÓN", - "OPTION 1": "OPCIÓN 1", - "OPTION 2": "OPCION 2", - "L2": "L2", - "R2": "R2", - "L3": "L3", - "R3": "R3", - "L STICK UP": "L STICK UP", - "L STICK DOWN": "L STICK ABAJO", - "L STICK LEFT": "PALO L IZQUIERDO", - "L STICK RIGHT": "PALO L DERECHO", - "R STICK UP": "R STICK UP", - "R STICK DOWN": "PALO R HACIA ABAJO", - "R STICK LEFT": "PALANCA R IZQUIERDA", - "R STICK RIGHT": "PALANCA R DERECHA", - "Start": "Comenzar", - "Select": "Seleccionar", - "Fast": "Rápido", - "Slow": "Lento", - "a": "a", - "b": "b", - "c": "C", - "d": "d", - "e": "mi", - "f": "F", - "g": "gramo", - "h": "h", - "i": "i", - "j": "j", - "k": "k", - "l": "yo", - "m": "metro", - "n": "norte", - "o": "o", - "p": "pag", - "q": "q", - "r": "r", - "s": "s", - "t": "t", - "u": "tu", - "v": "v", - "w": "w", - "x": "X", - "y": "y", - "z": "z", - "enter": "ingresar", - "escape": "escapar", - "space": "espacio", - "tab": "pestaña", - "backspace": "retroceso", - "delete": "borrar", - "arrowup": "flecha arriba", - "arrowdown": "flecha abajo", - "arrowleft": "flecha izquierda", - "arrowright": "flecha derecha", - "f1": "f1", - "f2": "f2", - "f3": "f3", - "f4": "f4", - "f5": "f5", - "f6": "f6", - "f7": "f7", - "f8": "f8", - "f9": "f9", - "f10": "f10", - "f11": "f11", - "f12": "f12", - "shift": "cambio", - "control": "control", - "alt": "alternativa", - "meta": "meta", - "capslock": "Bloq Mayús", - "insert": "insertar", - "home": "hogar", - "end": "fin", - "pageup": "página arriba", - "pagedown": "Página abajo", - "!": "!", - "@": "@", - "#": "#", - "$": "ps", - "%": "%", - "^": "^", - "&": "&", - "*": "*", - "(": "(", - ")": ")", - "-": "-", - "_": "_", - "+": "+", - "=": "=", - "[": "[", - "]": "]", - "{": "{", - "}": "}", - ";": ";", - ":": ":", - "'": "'", - "\"": "\"", - ",": ",", - ".": ".", - "<": "<", - ">": ">", - "/": "/", - "?": "?", - "LEFT_STICK_X": "LEFT_STICK_X", - "LEFT_STICK_Y": "LEFT_STICK_Y", - "RIGHT_STICK_X": "PALO_DERECHO_X", - "RIGHT_STICK_Y": "PALO_DERECHO_Y", - "LEFT_TRIGGER": "GATILLO IZQUIERDO", - "RIGHT_TRIGGER": "DERECHO_TRIGGER", - "A_BUTTON": "UN BOTÓN", - "B_BUTTON": "B_BOTÓN", - "X_BUTTON": "BOTÓN_X", - "Y_BUTTON": "BOTÓN Y_", - "START_BUTTON": "BOTÓN DE INICIO", - "SELECT_BUTTON": "SELECCIONAR_BOTÓN", - "L1_BUTTON": "L1_BOTÓN", - "R1_BUTTON": "R1_BOTÓN", - "L2_BUTTON": "L2_BOTÓN", - "R2_BUTTON": "R2_BOTÓN", - "LEFT_THUMB_BUTTON": "LEFT_THUMB_BUTTON", - "RIGHT_THUMB_BUTTON": "DERECHO_THUMB_BOTÓN", - "DPAD_UP": "DPAD ARRIBA", - "DPAD_DOWN": "DPAD_ABAJO", - "DPAD_LEFT": "DPAD_IZQUIERDA", - "DPAD_RIGHT": "DPAD_DERECHO" +{ + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7", + "8": "8", + "9": "9", + "Restart": "Reanudar", + "Pause": "Pausa", + "Play": "Jugar", + "Save State": "Guardar Estado", + "Load State": "Estado de carga", + "Control Settings": "Ajustes de control", + "Cheats": "trucos", + "Cache Manager": "Administrador de caché", + "Export Save File": "Exportar archivo guardado", + "Import Save File": "Importar archivo guardado", + "Netplay": "Juego de red", + "Mute": "Silenciar", + "Unmute": "No silenciar", + "Settings": "Ajustes", + "Enter Fullscreen": "Ingrese a pantalla completa", + "Exit Fullscreen": "Salir de pantalla completa", + "Reset": "Reiniciar", + "Clear": "Claro", + "Close": "Cerca", + "QUICK SAVE STATE": "ESTADO DE GUARDADO RÁPIDO", + "QUICK LOAD STATE": "ESTADO DE CARGA RÁPIDA", + "CHANGE STATE SLOT": "CAMBIAR ESTADO SLOT", + "FAST FORWARD": "AVANCE RÁPIDO", + "Player": "Jugador", + "Connected Gamepad": "Mando conectado", + "Gamepad": "mando", + "Keyboard": "Teclado", + "Set": "Colocar", + "Add Cheat": "Añadir truco", + "Create a Room": "Crear una habitación", + "Rooms": "Habitaciones", + "Start Game": "Empezar juego", + "Loading...": "Cargando...", + "Download Game Core": "Descargar Game Core", + "Decompress Game Core": "Descomprimir Game Core", + "Download Game Data": "Descargar datos del juego", + "Decompress Game Data": "Descomprimir datos del juego", + "Shaders": "sombreadores", + "Disabled": "Desactivado", + "2xScaleHQ": "2xEscalaHQ", + "4xScaleHQ": "4xEscalaHQ", + "CRT easymode": "modo fácil CRT", + "CRT aperture": "Apertura de tubo de rayos catódicos", + "CRT geom": "geometría CRT", + "CRT mattias": "CRT mattias", + "FPS": "FPS", + "show": "espectáculo", + "hide": "esconder", + "Fast Forward Ratio": "Relación de avance rápido", + "Fast Forward": "Avance rápido", + "Enabled": "Activado", + "Save State Slot": "Guardar ranura de estado", + "Save State Location": "Guardar ubicación de estado", + "Download": "Descargar", + "Keep in Browser": "Mantener en el navegador", + "Auto": "Auto", + "NTSC": "NTSC", + "PAL": "CAMARADA", + "Dendy": "Dendy", + "8:7 PAR": "8:7 PAR", + "4:3": "4:3", + "Low": "Bajo", + "High": "Alto", + "Very High": "Muy alto", + "None": "Ninguno", + "Player 1": "Jugador 1", + "Player 2": "jugador 2", + "Both": "Ambos", + "SAVED STATE TO SLOT": "ESTADO GUARDADO EN RANURA", + "LOADED STATE FROM SLOT": "ESTADO CARGADO DESDE LA RANURA", + "SET SAVE STATE SLOT TO": "ESTABLECER GUARDAR RANURA DE ESTADO EN", + "Network Error": "Error de red", + "Submit": "Entregar", + "Description": "Descripción", + "Code": "Código", + "Add Cheat Code": "Agregar código de trucos", + "Leave Room": "Dejar la habitación", + "Password": "Contraseña", + "Password (optional)": "Contraseña (opcional)", + "Max Players": "Jugadores máximos", + "Room Name": "Nombre de la habitación", + "Join": "Unirse", + "Player Name": "Nombre del jugador", + "Set Player Name": "Establecer nombre de jugador", + "Left Handed Mode": "Modo para zurdos", + "Virtual Gamepad": "Mando virtual", + "Disk": "Disco", + "Press Keyboard": "Oprimá teclado", + "INSERT COIN": "INSERTE MONEDA", + "Remove": "Eliminar", + "SAVE LOADED FROM BROWSER": "GUARDAR CARGADO DESDE EL NAVEGADOR", + "SAVE SAVED TO BROWSER": "GUARDAR GUARDADO EN EL NAVEGADOR", + "Join the discord": "Únete a la discordia", + "View on GitHub": "Ver en GitHub", + "Failed to start game": "No se pudo iniciar el juego", + "Download Game BIOS": "Descargar BIOS del juego", + "Decompress Game BIOS": "Descomprimir BIOS del juego", + "Download Game Parent": "Descargar juego para padres", + "Decompress Game Parent": "Padre del juego de descompresión", + "Download Game Patch": "Descargar el parche del juego", + "Decompress Game Patch": "Parche de descompresión del juego", + "Download Game State": "Descargar estado del juego", + "Check console": "Comprobar consola", + "Error for site owner": "Error para el propietario del sitio", + "EmulatorJS": "EmuladorJS", + "Clear All": "Limpiar todo", + "Take Screenshot": "Tomar captura de pantalla", + "Quick Save": "Guardado rápido", + "Quick Load": "Carga rápida", + "REWIND": "REBOBINAR", + "Rewind Enabled (requires restart)": "Rebobinado habilitado (requiere reinicio)", + "Rewind Granularity": "Granularidad de rebobinado", + "Slow Motion Ratio": "Relación de cámara lenta", + "Slow Motion": "Camara lenta", + "Home": "Hogar", + "EmulatorJS License": "Licencia EmulatorJS", + "RetroArch License": "Licencia RetroArch", + "SLOW MOTION": "CAMARA LENTA", + "A": "A", + "B": "B", + "SELECT": "SELECCIONAR", + "START": "COMENZAR", + "UP": "ARRIBA", + "DOWN": "ABAJO", + "LEFT": "IZQUIERDA", + "RIGHT": "BIEN", + "X": "X", + "Y": "Y", + "L": "L", + "R": "R", + "Z": "Z", + "STICK UP": "PEGARSE", + "STICK DOWN": "PEGAR", + "STICK LEFT": "PALO IZQUIERDO", + "STICK RIGHT": "PEGAR A LA DERECHA", + "C-PAD UP": "C-PAD ARRIBA", + "C-PAD DOWN": "C-PAD ABAJO", + "C-PAD LEFT": "C-PAD IZQUIERDO", + "C-PAD RIGHT": "C-PAD DERECHO", + "MICROPHONE": "MICRÓFONO", + "BUTTON 1 / START": "BOTÓN 1 / INICIO", + "BUTTON 2": "BOTÓN 2", + "BUTTON": "BOTÓN", + "LEFT D-PAD UP": "D-PAD IZQUIERDO ARRIBA", + "LEFT D-PAD DOWN": "D-PAD IZQUIERDO ABAJO", + "LEFT D-PAD LEFT": "D-PAD IZQUIERDO IZQUIERDO", + "LEFT D-PAD RIGHT": "D-PAD IZQUIERDO DERECHO", + "RIGHT D-PAD UP": "D-PAD DERECHO ARRIBA", + "RIGHT D-PAD DOWN": "D-PAD DERECHO ABAJO", + "RIGHT D-PAD LEFT": "D-PAD DERECHO IZQUIERDO", + "RIGHT D-PAD RIGHT": "D-PAD DERECHO DERECHO", + "C": "C", + "MODE": "MODO", + "FIRE": "FUEGO", + "RESET": "REINICIAR", + "LEFT DIFFICULTY A": "IZQUIERDA DIFICULTAD A", + "LEFT DIFFICULTY B": "IZQUIERDA DIFICULTAD B", + "RIGHT DIFFICULTY A": "CORRECTA DIFICULTAD A", + "RIGHT DIFFICULTY B": "CORRECTA DIFICULTAD B", + "COLOR": "COLOR", + "B/W": "B/N", + "PAUSE": "PAUSA", + "OPTION": "OPCIÓN", + "OPTION 1": "OPCIÓN 1", + "OPTION 2": "OPCION 2", + "L2": "L2", + "R2": "R2", + "L3": "L3", + "R3": "R3", + "L STICK UP": "L STICK UP", + "L STICK DOWN": "L STICK ABAJO", + "L STICK LEFT": "PALO L IZQUIERDO", + "L STICK RIGHT": "PALO L DERECHO", + "R STICK UP": "R STICK UP", + "R STICK DOWN": "PALO R HACIA ABAJO", + "R STICK LEFT": "PALANCA R IZQUIERDA", + "R STICK RIGHT": "PALANCA R DERECHA", + "Start": "Comenzar", + "Select": "Seleccionar", + "Fast": "Rápido", + "Slow": "Lento", + "a": "a", + "b": "b", + "c": "C", + "d": "d", + "e": "mi", + "f": "F", + "g": "gramo", + "h": "h", + "i": "i", + "j": "j", + "k": "k", + "l": "yo", + "m": "metro", + "n": "norte", + "o": "o", + "p": "pag", + "q": "q", + "r": "r", + "s": "s", + "t": "t", + "u": "tu", + "v": "v", + "w": "w", + "x": "X", + "y": "y", + "z": "z", + "enter": "ingresar", + "escape": "escapar", + "space": "espacio", + "tab": "pestaña", + "backspace": "retroceso", + "delete": "borrar", + "arrowup": "flecha arriba", + "arrowdown": "flecha abajo", + "arrowleft": "flecha izquierda", + "arrowright": "flecha derecha", + "f1": "f1", + "f2": "f2", + "f3": "f3", + "f4": "f4", + "f5": "f5", + "f6": "f6", + "f7": "f7", + "f8": "f8", + "f9": "f9", + "f10": "f10", + "f11": "f11", + "f12": "f12", + "shift": "cambio", + "control": "control", + "alt": "alternativa", + "meta": "meta", + "capslock": "Bloq Mayús", + "insert": "insertar", + "home": "hogar", + "end": "fin", + "pageup": "página arriba", + "pagedown": "Página abajo", + "!": "!", + "@": "@", + "#": "#", + "$": "ps", + "%": "%", + "^": "^", + "&": "&", + "*": "*", + "(": "(", + ")": ")", + "-": "-", + "_": "_", + "+": "+", + "=": "=", + "[": "[", + "]": "]", + "{": "{", + "}": "}", + ";": ";", + ":": ":", + "'": "'", + "\"": "\"", + ",": ",", + ".": ".", + "<": "<", + ">": ">", + "/": "/", + "?": "?", + "LEFT_STICK_X": "LEFT_STICK_X", + "LEFT_STICK_Y": "LEFT_STICK_Y", + "RIGHT_STICK_X": "PALO_DERECHO_X", + "RIGHT_STICK_Y": "PALO_DERECHO_Y", + "LEFT_TRIGGER": "GATILLO IZQUIERDO", + "RIGHT_TRIGGER": "DERECHO_TRIGGER", + "A_BUTTON": "UN BOTÓN", + "B_BUTTON": "B_BOTÓN", + "X_BUTTON": "BOTÓN_X", + "Y_BUTTON": "BOTÓN Y_", + "START_BUTTON": "BOTÓN DE INICIO", + "SELECT_BUTTON": "SELECCIONAR_BOTÓN", + "L1_BUTTON": "L1_BOTÓN", + "R1_BUTTON": "R1_BOTÓN", + "L2_BUTTON": "L2_BOTÓN", + "R2_BUTTON": "R2_BOTÓN", + "LEFT_THUMB_BUTTON": "LEFT_THUMB_BUTTON", + "RIGHT_THUMB_BUTTON": "DERECHO_THUMB_BOTÓN", + "DPAD_UP": "DPAD ARRIBA", + "DPAD_DOWN": "DPAD_ABAJO", + "DPAD_LEFT": "DPAD_IZQUIERDA", + "DPAD_RIGHT": "DPAD_DERECHO" } \ No newline at end of file diff --git a/semag/emulatorjs/data/localization/hi-HI.json b/semag/emulatorjs/data/localization/hi-HI.json index 98f13fe7..25017e0b 100644 --- a/semag/emulatorjs/data/localization/hi-HI.json +++ b/semag/emulatorjs/data/localization/hi-HI.json @@ -1,301 +1,301 @@ -{ - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7", - "8": "8", - "9": "9", - "Restart": "पुनः आरंभ करें", - "Pause": "विराम", - "Play": "खेल", - "Save State": "राज्य बचाओ", - "Load State": "राज्य लोड करें", - "Control Settings": "नियंत्रण सेटिंग्स", - "Cheats": "Cheats", - "Cache Manager": "कैश मैनेजर", - "Export Save File": "फ़ाइल सहेजें निर्यात करें", - "Import Save File": "सहेजें फ़ाइल आयात करें", - "Netplay": "कुल चालन", - "Mute": "आवाज़ बंद करना", - "Unmute": "अनम्यूट", - "Settings": "समायोजन", - "Enter Fullscreen": "पूर्ण स्क्रीन दर्ज करें", - "Exit Fullscreen": "पूर्ण स्क्रीन से बाहर निकलें", - "Reset": "रीसेट", - "Clear": "स्पष्ट", - "Close": "बंद करना", - "QUICK SAVE STATE": "त्वरित सहेजें राज्य", - "QUICK LOAD STATE": "त्वरित लोड स्थिति", - "CHANGE STATE SLOT": "स्टेट स्लॉट बदलें", - "FAST FORWARD": "तेजी से आगे बढ़ना", - "Player": "खिलाड़ी", - "Connected Gamepad": "कनेक्टेड गेमपैड", - "Gamepad": "गेमपैड", - "Keyboard": "कीबोर्ड", - "Set": "तय करना", - "Add Cheat": "धोखा जोड़ें", - "Create a Room": "एक कमरा बनाएँ", - "Rooms": "कमरा", - "Start Game": "खेल शुरू", - "Loading...": "लोड हो रहा है...", - "Download Game Core": "गेम कोर डाउनलोड करें", - "Decompress Game Core": "डीकंप्रेस गेम कोर", - "Download Game Data": "गेम डेटा डाउनलोड करें", - "Decompress Game Data": "गेम डेटा को डीकंप्रेस करें", - "Shaders": "शेडर्स", - "Disabled": "अक्षम", - "2xScaleHQ": "2xस्केलHQ", - "4xScaleHQ": "4xस्केलHQ", - "CRT easymode": "सीआरटी आसान मोड", - "CRT aperture": "सीआरटी एपर्चर", - "CRT geom": "सीआरटी जियोम", - "CRT mattias": "सीआरटी मैटियास", - "FPS": "एफपीएस", - "show": "दिखाओ", - "hide": "छिपाना", - "Fast Forward Ratio": "तेजी से आगे बढ़ने का अनुपात", - "Fast Forward": "तेजी से आगे बढ़ना", - "Enabled": "सक्रिय", - "Save State Slot": "राज्य स्लॉट सहेजें", - "Save State Location": "राज्य स्थान सहेजें", - "Download": "डाउनलोड करना", - "Keep in Browser": "ब्राउज़र में रखें", - "Auto": "ऑटो", - "NTSC": "एनटीएससी", - "PAL": "दोस्त", - "Dendy": "डेंडी", - "8:7 PAR": "8:7 बराबर", - "4:3": "4:3", - "Low": "कम", - "High": "उच्च", - "Very High": "बहुत ऊँचा", - "None": "कोई नहीं", - "Player 1": "खिलाड़ी 1", - "Player 2": "खिलाड़ी 2", - "Both": "दोनों", - "SAVED STATE TO SLOT": "स्लॉट के लिए राज्य सहेजा गया", - "LOADED STATE FROM SLOT": "स्लॉट से लोड किया गया राज्य", - "SET SAVE STATE SLOT TO": "सेव स्टेट स्लॉट को सेट करें", - "Network Error": "नेटवर्क त्रुटि", - "Submit": "जमा करना", - "Description": "विवरण", - "Code": "कोड", - "Add Cheat Code": "धोखा कोड जोड़ें", - "Leave Room": "कमरा छोड़ दो", - "Password": "पासवर्ड", - "Password (optional)": "पासवर्ड (वैकल्पिक)", - "Max Players": "अधिकतम खिलाड़ी", - "Room Name": "कमरे का नाम", - "Join": "जोड़ना", - "Player Name": "खिलाड़ी का नाम", - "Set Player Name": "खिलाड़ी का नाम सेट करें", - "Left Handed Mode": "बाएं हाथ का मोड", - "Virtual Gamepad": "वर्चुअल गेमपैड", - "Disk": "डिस्क", - "Press Keyboard": "कीबोर्ड दबाएँ", - "INSERT COIN": "सिक्का डालें", - "Remove": "निकालना", - "SAVE LOADED FROM BROWSER": "ब्राउज़र से लोड किया गया सेव करें", - "SAVE SAVED TO BROWSER": "ब्राउज़र में सहेजा गया सहेजें", - "Join the discord": "कलह में शामिल हों", - "View on GitHub": "GitHub पर देखें", - "Failed to start game": "गेम प्रारंभ करने में विफल", - "Download Game BIOS": "गेम BIOS डाउनलोड करें", - "Decompress Game BIOS": "डीकंप्रेस गेम BIOS", - "Download Game Parent": "गेम पेरेंट डाउनलोड करें", - "Decompress Game Parent": "डीकंप्रेस गेम पेरेंट", - "Download Game Patch": "गेम पैच डाउनलोड करें", - "Decompress Game Patch": "डीकंप्रेस गेम पैच", - "Download Game State": "गेम स्टेट डाउनलोड करें", - "Check console": "कंसोल की जाँच करें", - "Error for site owner": "साइट स्वामी के लिए त्रुटि", - "EmulatorJS": "एम्यूलेटरजेएस", - "Clear All": "सभी साफ करें", - "Take Screenshot": "स्क्रीनशॉट लीजिये", - "Quick Save": "तत्काल बचत", - "Quick Load": "त्वरित लोड", - "REWIND": "अतीत", - "Rewind Enabled (requires restart)": "रिवाइंड सक्षम (पुनः आरंभ करने की आवश्यकता है)", - "Rewind Granularity": "ग्रैन्युलैरिटी को रिवाइंड करें", - "Slow Motion Ratio": "धीमी गति अनुपात", - "Slow Motion": "धीमी गति", - "Home": "घर", - "EmulatorJS License": "एम्यूलेटरजेएस लाइसेंस", - "RetroArch License": "रेट्रोआर्क लाइसेंस", - "SLOW MOTION": "धीमी गति", - "A": "ए", - "B": "बी", - "SELECT": "चुनना", - "START": "शुरू", - "UP": "ऊपर", - "DOWN": "नीचे", - "LEFT": "बाएं", - "RIGHT": "सही", - "X": "एक्स", - "Y": "वाई", - "L": "एल", - "R": "आर", - "Z": "जेड", - "STICK UP": "फैला होना", - "STICK DOWN": "चिपकाना", - "STICK LEFT": "बाईं ओर चिपकाएँ", - "STICK RIGHT": "दाएँ चिपकाएँ", - "C-PAD UP": "सी-पैड यूपी", - "C-PAD DOWN": "सी-पैड नीचे", - "C-PAD LEFT": "सी-पैड बचा", - "C-PAD RIGHT": "सी-पैड दाएँ", - "MICROPHONE": "माइक्रोफोन", - "BUTTON 1 / START": "बटन 1 / प्रारंभ करें", - "BUTTON 2": "बटन 2", - "BUTTON": "बटन", - "LEFT D-PAD UP": "डी-पैड ऊपर छोड़ दिया", - "LEFT D-PAD DOWN": "डी-पैड नीचे छोड़ दिया", - "LEFT D-PAD LEFT": "बायां डी-पैड बायां", - "LEFT D-PAD RIGHT": "बाएँ डी-पैड दाएँ", - "RIGHT D-PAD UP": "दायां डी-पैड ऊपर", - "RIGHT D-PAD DOWN": "दायां डी-पैड नीचे", - "RIGHT D-PAD LEFT": "दायां डी-पैड बायां", - "RIGHT D-PAD RIGHT": "दाएँ डी-पैड दाएँ", - "C": "सी", - "MODE": "तरीका", - "FIRE": "आग", - "RESET": "रीसेट", - "LEFT DIFFICULTY A": "बाएं कठिनाई ए", - "LEFT DIFFICULTY B": "बाएं कठिनाई बी", - "RIGHT DIFFICULTY A": "सही कठिनाई ए", - "RIGHT DIFFICULTY B": "सही कठिनाई बी", - "COLOR": "रंग", - "B/W": "बी/डब्ल्यू", - "PAUSE": "विराम", - "OPTION": "विकल्प", - "OPTION 1": "विकल्प 1", - "OPTION 2": "विकल्प 2", - "L2": "एल2", - "R2": "आर2", - "L3": "एल3", - "R3": "आर3", - "L STICK UP": "एल चिपक जाओ", - "L STICK DOWN": "एल चिपक जाओ", - "L STICK LEFT": "एल बाईं ओर चिपकाएँ", - "L STICK RIGHT": "एल दाईं ओर चिपकाएँ", - "R STICK UP": "आर चिपको", - "R STICK DOWN": "आर नीचे रहो", - "R STICK LEFT": "आर बाईं ओर चिपकाएँ", - "R STICK RIGHT": "आर दाईं ओर चिपकाएँ", - "Start": "शुरू", - "Select": "चुनना", - "Fast": "तेज़", - "Slow": "धीमा", - "a": "ए", - "b": "बी", - "c": "सी", - "d": "डी", - "e": "इ", - "f": "एफ", - "g": "जी", - "h": "एच", - "i": "मैं", - "j": "जे", - "k": "क", - "l": "एल", - "m": "एम", - "n": "एन", - "o": "हे", - "p": "पी", - "q": "क्यू", - "r": "आर", - "s": "एस", - "t": "टी", - "u": "यू", - "v": "वी", - "w": "डब्ल्यू", - "x": "एक्स", - "y": "य", - "z": "जेड", - "enter": "प्रवेश करना", - "escape": "पलायन", - "space": "अंतरिक्ष", - "tab": "टैब", - "backspace": "बैकस्पेस", - "delete": "मिटाना", - "arrowup": "ऊपरी तीर", - "arrowdown": "नीचे दर्शित तीर", - "arrowleft": "तीरबाएँ", - "arrowright": "तीर दाहिना", - "f1": "एफ1", - "f2": "f2", - "f3": "f3", - "f4": "एफ4", - "f5": "f5", - "f6": "एफ6", - "f7": "f7", - "f8": "एफ8", - "f9": "f9", - "f10": "f10", - "f11": "f11", - "f12": "f12", - "shift": "बदलाव", - "control": "नियंत्रण", - "alt": "वैकल्पिक", - "meta": "मेटा", - "capslock": "कैप्स लॉक", - "insert": "डालना", - "home": "घर", - "end": "अंत", - "pageup": "पेज अप", - "pagedown": "पेज नीचे", - "!": "!", - "@": "@", - "#": "#", - "$": "$", - "%": "%", - "^": "^", - "&": "&", - "*": "*", - "(": "(", - ")": ")", - "-": "-", - "_": "_", - "+": "+", - "=": "=", - "[": "[", - "]": "]", - "{": "{", - "}": "}", - ";": ";", - ":": ":", - "'": "'", - "\"": "\"", - ",": ",", - ".": ".", - "<": "<", - ">": ">", - "/": "/", - "?": "?", - "LEFT_STICK_X": "LEFT_STICK_X", - "LEFT_STICK_Y": "LEFT_STICK_Y", - "RIGHT_STICK_X": "RIGHT_STICK_X", - "RIGHT_STICK_Y": "RIGHT_STICK_Y", - "LEFT_TRIGGER": "LEFT_TRIGGER", - "RIGHT_TRIGGER": "RIGHT_TRIGGER", - "A_BUTTON": "एक बटन", - "B_BUTTON": "बी_बटन", - "X_BUTTON": "X_बटन", - "Y_BUTTON": "Y_बटन", - "START_BUTTON": "प्रारंभ करें बटन", - "SELECT_BUTTON": "SELECT_BUTTON", - "L1_BUTTON": "L1_बटन", - "R1_BUTTON": "R1_बटन", - "L2_BUTTON": "L2_बटन", - "R2_BUTTON": "R2_बटन", - "LEFT_THUMB_BUTTON": "LEFT_THUMB_बटन", - "RIGHT_THUMB_BUTTON": "RIGHT_THUMB_बटन", - "DPAD_UP": "डीपीएडी_यूपी", - "DPAD_DOWN": "डीपीएडी_डाउन", - "DPAD_LEFT": "DPAD_LEFT", - "DPAD_RIGHT": "डीपीएडी_दाएँ" +{ + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7", + "8": "8", + "9": "9", + "Restart": "पुनः आरंभ करें", + "Pause": "विराम", + "Play": "खेल", + "Save State": "राज्य बचाओ", + "Load State": "राज्य लोड करें", + "Control Settings": "नियंत्रण सेटिंग्स", + "Cheats": "Cheats", + "Cache Manager": "कैश मैनेजर", + "Export Save File": "फ़ाइल सहेजें निर्यात करें", + "Import Save File": "सहेजें फ़ाइल आयात करें", + "Netplay": "कुल चालन", + "Mute": "आवाज़ बंद करना", + "Unmute": "अनम्यूट", + "Settings": "समायोजन", + "Enter Fullscreen": "पूर्ण स्क्रीन दर्ज करें", + "Exit Fullscreen": "पूर्ण स्क्रीन से बाहर निकलें", + "Reset": "रीसेट", + "Clear": "स्पष्ट", + "Close": "बंद करना", + "QUICK SAVE STATE": "त्वरित सहेजें राज्य", + "QUICK LOAD STATE": "त्वरित लोड स्थिति", + "CHANGE STATE SLOT": "स्टेट स्लॉट बदलें", + "FAST FORWARD": "तेजी से आगे बढ़ना", + "Player": "खिलाड़ी", + "Connected Gamepad": "कनेक्टेड गेमपैड", + "Gamepad": "गेमपैड", + "Keyboard": "कीबोर्ड", + "Set": "तय करना", + "Add Cheat": "धोखा जोड़ें", + "Create a Room": "एक कमरा बनाएँ", + "Rooms": "कमरा", + "Start Game": "खेल शुरू", + "Loading...": "लोड हो रहा है...", + "Download Game Core": "गेम कोर डाउनलोड करें", + "Decompress Game Core": "डीकंप्रेस गेम कोर", + "Download Game Data": "गेम डेटा डाउनलोड करें", + "Decompress Game Data": "गेम डेटा को डीकंप्रेस करें", + "Shaders": "शेडर्स", + "Disabled": "अक्षम", + "2xScaleHQ": "2xस्केलHQ", + "4xScaleHQ": "4xस्केलHQ", + "CRT easymode": "सीआरटी आसान मोड", + "CRT aperture": "सीआरटी एपर्चर", + "CRT geom": "सीआरटी जियोम", + "CRT mattias": "सीआरटी मैटियास", + "FPS": "एफपीएस", + "show": "दिखाओ", + "hide": "छिपाना", + "Fast Forward Ratio": "तेजी से आगे बढ़ने का अनुपात", + "Fast Forward": "तेजी से आगे बढ़ना", + "Enabled": "सक्रिय", + "Save State Slot": "राज्य स्लॉट सहेजें", + "Save State Location": "राज्य स्थान सहेजें", + "Download": "डाउनलोड करना", + "Keep in Browser": "ब्राउज़र में रखें", + "Auto": "ऑटो", + "NTSC": "एनटीएससी", + "PAL": "दोस्त", + "Dendy": "डेंडी", + "8:7 PAR": "8:7 बराबर", + "4:3": "4:3", + "Low": "कम", + "High": "उच्च", + "Very High": "बहुत ऊँचा", + "None": "कोई नहीं", + "Player 1": "खिलाड़ी 1", + "Player 2": "खिलाड़ी 2", + "Both": "दोनों", + "SAVED STATE TO SLOT": "स्लॉट के लिए राज्य सहेजा गया", + "LOADED STATE FROM SLOT": "स्लॉट से लोड किया गया राज्य", + "SET SAVE STATE SLOT TO": "सेव स्टेट स्लॉट को सेट करें", + "Network Error": "नेटवर्क त्रुटि", + "Submit": "जमा करना", + "Description": "विवरण", + "Code": "कोड", + "Add Cheat Code": "धोखा कोड जोड़ें", + "Leave Room": "कमरा छोड़ दो", + "Password": "पासवर्ड", + "Password (optional)": "पासवर्ड (वैकल्पिक)", + "Max Players": "अधिकतम खिलाड़ी", + "Room Name": "कमरे का नाम", + "Join": "जोड़ना", + "Player Name": "खिलाड़ी का नाम", + "Set Player Name": "खिलाड़ी का नाम सेट करें", + "Left Handed Mode": "बाएं हाथ का मोड", + "Virtual Gamepad": "वर्चुअल गेमपैड", + "Disk": "डिस्क", + "Press Keyboard": "कीबोर्ड दबाएँ", + "INSERT COIN": "सिक्का डालें", + "Remove": "निकालना", + "SAVE LOADED FROM BROWSER": "ब्राउज़र से लोड किया गया सेव करें", + "SAVE SAVED TO BROWSER": "ब्राउज़र में सहेजा गया सहेजें", + "Join the discord": "कलह में शामिल हों", + "View on GitHub": "GitHub पर देखें", + "Failed to start game": "गेम प्रारंभ करने में विफल", + "Download Game BIOS": "गेम BIOS डाउनलोड करें", + "Decompress Game BIOS": "डीकंप्रेस गेम BIOS", + "Download Game Parent": "गेम पेरेंट डाउनलोड करें", + "Decompress Game Parent": "डीकंप्रेस गेम पेरेंट", + "Download Game Patch": "गेम पैच डाउनलोड करें", + "Decompress Game Patch": "डीकंप्रेस गेम पैच", + "Download Game State": "गेम स्टेट डाउनलोड करें", + "Check console": "कंसोल की जाँच करें", + "Error for site owner": "साइट स्वामी के लिए त्रुटि", + "EmulatorJS": "एम्यूलेटरजेएस", + "Clear All": "सभी साफ करें", + "Take Screenshot": "स्क्रीनशॉट लीजिये", + "Quick Save": "तत्काल बचत", + "Quick Load": "त्वरित लोड", + "REWIND": "अतीत", + "Rewind Enabled (requires restart)": "रिवाइंड सक्षम (पुनः आरंभ करने की आवश्यकता है)", + "Rewind Granularity": "ग्रैन्युलैरिटी को रिवाइंड करें", + "Slow Motion Ratio": "धीमी गति अनुपात", + "Slow Motion": "धीमी गति", + "Home": "घर", + "EmulatorJS License": "एम्यूलेटरजेएस लाइसेंस", + "RetroArch License": "रेट्रोआर्क लाइसेंस", + "SLOW MOTION": "धीमी गति", + "A": "ए", + "B": "बी", + "SELECT": "चुनना", + "START": "शुरू", + "UP": "ऊपर", + "DOWN": "नीचे", + "LEFT": "बाएं", + "RIGHT": "सही", + "X": "एक्स", + "Y": "वाई", + "L": "एल", + "R": "आर", + "Z": "जेड", + "STICK UP": "फैला होना", + "STICK DOWN": "चिपकाना", + "STICK LEFT": "बाईं ओर चिपकाएँ", + "STICK RIGHT": "दाएँ चिपकाएँ", + "C-PAD UP": "सी-पैड यूपी", + "C-PAD DOWN": "सी-पैड नीचे", + "C-PAD LEFT": "सी-पैड बचा", + "C-PAD RIGHT": "सी-पैड दाएँ", + "MICROPHONE": "माइक्रोफोन", + "BUTTON 1 / START": "बटन 1 / प्रारंभ करें", + "BUTTON 2": "बटन 2", + "BUTTON": "बटन", + "LEFT D-PAD UP": "डी-पैड ऊपर छोड़ दिया", + "LEFT D-PAD DOWN": "डी-पैड नीचे छोड़ दिया", + "LEFT D-PAD LEFT": "बायां डी-पैड बायां", + "LEFT D-PAD RIGHT": "बाएँ डी-पैड दाएँ", + "RIGHT D-PAD UP": "दायां डी-पैड ऊपर", + "RIGHT D-PAD DOWN": "दायां डी-पैड नीचे", + "RIGHT D-PAD LEFT": "दायां डी-पैड बायां", + "RIGHT D-PAD RIGHT": "दाएँ डी-पैड दाएँ", + "C": "सी", + "MODE": "तरीका", + "FIRE": "आग", + "RESET": "रीसेट", + "LEFT DIFFICULTY A": "बाएं कठिनाई ए", + "LEFT DIFFICULTY B": "बाएं कठिनाई बी", + "RIGHT DIFFICULTY A": "सही कठिनाई ए", + "RIGHT DIFFICULTY B": "सही कठिनाई बी", + "COLOR": "रंग", + "B/W": "बी/डब्ल्यू", + "PAUSE": "विराम", + "OPTION": "विकल्प", + "OPTION 1": "विकल्प 1", + "OPTION 2": "विकल्प 2", + "L2": "एल2", + "R2": "आर2", + "L3": "एल3", + "R3": "आर3", + "L STICK UP": "एल चिपक जाओ", + "L STICK DOWN": "एल चिपक जाओ", + "L STICK LEFT": "एल बाईं ओर चिपकाएँ", + "L STICK RIGHT": "एल दाईं ओर चिपकाएँ", + "R STICK UP": "आर चिपको", + "R STICK DOWN": "आर नीचे रहो", + "R STICK LEFT": "आर बाईं ओर चिपकाएँ", + "R STICK RIGHT": "आर दाईं ओर चिपकाएँ", + "Start": "शुरू", + "Select": "चुनना", + "Fast": "तेज़", + "Slow": "धीमा", + "a": "ए", + "b": "बी", + "c": "सी", + "d": "डी", + "e": "इ", + "f": "एफ", + "g": "जी", + "h": "एच", + "i": "मैं", + "j": "जे", + "k": "क", + "l": "एल", + "m": "एम", + "n": "एन", + "o": "हे", + "p": "पी", + "q": "क्यू", + "r": "आर", + "s": "एस", + "t": "टी", + "u": "यू", + "v": "वी", + "w": "डब्ल्यू", + "x": "एक्स", + "y": "य", + "z": "जेड", + "enter": "प्रवेश करना", + "escape": "पलायन", + "space": "अंतरिक्ष", + "tab": "टैब", + "backspace": "बैकस्पेस", + "delete": "मिटाना", + "arrowup": "ऊपरी तीर", + "arrowdown": "नीचे दर्शित तीर", + "arrowleft": "तीरबाएँ", + "arrowright": "तीर दाहिना", + "f1": "एफ1", + "f2": "f2", + "f3": "f3", + "f4": "एफ4", + "f5": "f5", + "f6": "एफ6", + "f7": "f7", + "f8": "एफ8", + "f9": "f9", + "f10": "f10", + "f11": "f11", + "f12": "f12", + "shift": "बदलाव", + "control": "नियंत्रण", + "alt": "वैकल्पिक", + "meta": "मेटा", + "capslock": "कैप्स लॉक", + "insert": "डालना", + "home": "घर", + "end": "अंत", + "pageup": "पेज अप", + "pagedown": "पेज नीचे", + "!": "!", + "@": "@", + "#": "#", + "$": "$", + "%": "%", + "^": "^", + "&": "&", + "*": "*", + "(": "(", + ")": ")", + "-": "-", + "_": "_", + "+": "+", + "=": "=", + "[": "[", + "]": "]", + "{": "{", + "}": "}", + ";": ";", + ":": ":", + "'": "'", + "\"": "\"", + ",": ",", + ".": ".", + "<": "<", + ">": ">", + "/": "/", + "?": "?", + "LEFT_STICK_X": "LEFT_STICK_X", + "LEFT_STICK_Y": "LEFT_STICK_Y", + "RIGHT_STICK_X": "RIGHT_STICK_X", + "RIGHT_STICK_Y": "RIGHT_STICK_Y", + "LEFT_TRIGGER": "LEFT_TRIGGER", + "RIGHT_TRIGGER": "RIGHT_TRIGGER", + "A_BUTTON": "एक बटन", + "B_BUTTON": "बी_बटन", + "X_BUTTON": "X_बटन", + "Y_BUTTON": "Y_बटन", + "START_BUTTON": "प्रारंभ करें बटन", + "SELECT_BUTTON": "SELECT_BUTTON", + "L1_BUTTON": "L1_बटन", + "R1_BUTTON": "R1_बटन", + "L2_BUTTON": "L2_बटन", + "R2_BUTTON": "R2_बटन", + "LEFT_THUMB_BUTTON": "LEFT_THUMB_बटन", + "RIGHT_THUMB_BUTTON": "RIGHT_THUMB_बटन", + "DPAD_UP": "डीपीएडी_यूपी", + "DPAD_DOWN": "डीपीएडी_डाउन", + "DPAD_LEFT": "DPAD_LEFT", + "DPAD_RIGHT": "डीपीएडी_दाएँ" } \ No newline at end of file diff --git a/semag/emulatorjs/data/localization/ja-JA.json b/semag/emulatorjs/data/localization/ja-JA.json index 1c0b012a..52c5d4ea 100644 --- a/semag/emulatorjs/data/localization/ja-JA.json +++ b/semag/emulatorjs/data/localization/ja-JA.json @@ -1,301 +1,301 @@ -{ - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7", - "8": "8", - "9": "9", - "Restart": "再起動", - "Pause": "一時停止", - "Play": "遊ぶ", - "Save State": "状態を保存", - "Load State": "ロード状態", - "Control Settings": "コントロール設定", - "Cheats": "チート", - "Cache Manager": "キャッシュマネージャー", - "Export Save File": "保存ファイルのエクスポート", - "Import Save File": "保存ファイルのインポート", - "Netplay": "ネットプレイ", - "Mute": "ミュート", - "Unmute": "ミュートを解除する", - "Settings": "設定", - "Enter Fullscreen": "全画面表示に入る", - "Exit Fullscreen": "全画面表示を終了する", - "Reset": "リセット", - "Clear": "クリア", - "Close": "近い", - "QUICK SAVE STATE": "状態のクイック保存", - "QUICK LOAD STATE": "クイックロード状態", - "CHANGE STATE SLOT": "状態スロットの変更", - "FAST FORWARD": "早送り", - "Player": "プレーヤー", - "Connected Gamepad": "接続されたゲームパッド", - "Gamepad": "ゲームパッド", - "Keyboard": "キーボード", - "Set": "セット", - "Add Cheat": "チートの追加", - "Create a Room": "ルームを作成する", - "Rooms": "部屋", - "Start Game": "ゲームをスタート", - "Loading...": "読み込み中...", - "Download Game Core": "ゲームコアをダウンロード", - "Decompress Game Core": "ゲームコアを解凍する", - "Download Game Data": "ゲームデータのダウンロード", - "Decompress Game Data": "ゲームデータを解凍する", - "Shaders": "シェーダ", - "Disabled": "無効", - "2xScaleHQ": "2xスケール本社", - "4xScaleHQ": "4xスケール本社", - "CRT easymode": "CRTイージーモード", - "CRT aperture": "CRTの絞り", - "CRT geom": "CRT ジオム", - "CRT mattias": "CRT マティアス", - "FPS": "FPS", - "show": "見せる", - "hide": "隠れる", - "Fast Forward Ratio": "早送り率", - "Fast Forward": "早送り", - "Enabled": "有効", - "Save State Slot": "状態保存スロット", - "Save State Location": "状態の保存場所", - "Download": "ダウンロード", - "Keep in Browser": "ブラウザ内に保持", - "Auto": "自動", - "NTSC": "NTSC", - "PAL": "パル", - "Dendy": "デンディ", - "8:7 PAR": "8:7 パー", - "4:3": "4:3", - "Low": "低い", - "High": "高い", - "Very High": "すごく高い", - "None": "なし", - "Player 1": "プレイヤー 1", - "Player 2": "プレイヤー2", - "Both": "両方", - "SAVED STATE TO SLOT": "状態をスロットに保存しました", - "LOADED STATE FROM SLOT": "スロットからロードされた状態", - "SET SAVE STATE SLOT TO": "状態保存スロットを次のように設定します", - "Network Error": "ネットワークエラー", - "Submit": "提出する", - "Description": "説明", - "Code": "コード", - "Add Cheat Code": "チートコードを追加する", - "Leave Room": "部屋を出る", - "Password": "パスワード", - "Password (optional)": "パスワード (オプション)", - "Max Players": "最大プレイヤー数", - "Room Name": "部屋の名前", - "Join": "参加する", - "Player Name": "プレーヤの名前", - "Set Player Name": "プレイヤー名の設定", - "Left Handed Mode": "左利きモード", - "Virtual Gamepad": "仮想ゲームパッド", - "Disk": "ディスク", - "Press Keyboard": "キーボードを押す", - "INSERT COIN": "コインを入れる", - "Remove": "取り除く", - "SAVE LOADED FROM BROWSER": "ブラウザからロードして保存", - "SAVE SAVED TO BROWSER": "保存 ブラウザに保存", - "Join the discord": "ディスコードに参加する", - "View on GitHub": "GitHub で見る", - "Failed to start game": "ゲームの開始に失敗しました", - "Download Game BIOS": "ゲーム BIOS をダウンロードする", - "Decompress Game BIOS": "ゲーム BIOS を解凍する", - "Download Game Parent": "ゲームの親をダウンロード", - "Decompress Game Parent": "ゲームの親を解凍する", - "Download Game Patch": "ゲームパッチをダウンロード", - "Decompress Game Patch": "ゲームパッチを解凍する", - "Download Game State": "ゲームステートのダウンロード", - "Check console": "コンソールを確認してください", - "Error for site owner": "サイト所有者のエラー", - "EmulatorJS": "エミュレータJS", - "Clear All": "すべてクリア", - "Take Screenshot": "スクリーンショットを撮ります", - "Quick Save": "クイックセーブ", - "Quick Load": "クイックロード", - "REWIND": "巻き戻し", - "Rewind Enabled (requires restart)": "巻き戻しが有効 (再起動が必要)", - "Rewind Granularity": "巻き戻し粒度", - "Slow Motion Ratio": "スローモーション比率", - "Slow Motion": "スローモーション", - "Home": "家", - "EmulatorJS License": "エミュレータJSライセンス", - "RetroArch License": "RetroArch ライセンス", - "SLOW MOTION": "スローモーション", - "A": "あ", - "B": "B", - "SELECT": "選択する", - "START": "始める", - "UP": "上", - "DOWN": "下", - "LEFT": "左", - "RIGHT": "右", - "X": "バツ", - "Y": "Y", - "L": "L", - "R": "R", - "Z": "Z", - "STICK UP": "上に突き出る", - "STICK DOWN": "スティックダウン", - "STICK LEFT": "左スティック", - "STICK RIGHT": "右スティック", - "C-PAD UP": "Cパッドアップ", - "C-PAD DOWN": "C-パッドを下へ", - "C-PAD LEFT": "C-パッド左", - "C-PAD RIGHT": "Cパッド右", - "MICROPHONE": "マイクロフォン", - "BUTTON 1 / START": "ボタン 1 / スタート", - "BUTTON 2": "ボタン2", - "BUTTON": "ボタン", - "LEFT D-PAD UP": "左方向パッドを上に", - "LEFT D-PAD DOWN": "左方向パッド下", - "LEFT D-PAD LEFT": "左十字キー左", - "LEFT D-PAD RIGHT": "左十字キー右", - "RIGHT D-PAD UP": "右方向パッド上", - "RIGHT D-PAD DOWN": "右方向パッド下", - "RIGHT D-PAD LEFT": "右十字キー左", - "RIGHT D-PAD RIGHT": "右十字キー右", - "C": "C", - "MODE": "モード", - "FIRE": "火", - "RESET": "リセット", - "LEFT DIFFICULTY A": "左の難易度A", - "LEFT DIFFICULTY B": "左の難易度B", - "RIGHT DIFFICULTY A": "右の難易度A", - "RIGHT DIFFICULTY B": "右の難易度B", - "COLOR": "色", - "B/W": "白黒", - "PAUSE": "一時停止", - "OPTION": "オプション", - "OPTION 1": "オプション1", - "OPTION 2": "オプション 2", - "L2": "L2", - "R2": "R2", - "L3": "L3", - "R3": "R3", - "L STICK UP": "Lスティックアップ", - "L STICK DOWN": "Lスティックダウン", - "L STICK LEFT": "Lスティック左", - "L STICK RIGHT": "Lスティック右", - "R STICK UP": "Rスティックアップ", - "R STICK DOWN": "Rスティックダウン", - "R STICK LEFT": "Rスティック左", - "R STICK RIGHT": "R右スティック", - "Start": "始める", - "Select": "選択する", - "Fast": "速い", - "Slow": "遅い", - "a": "ある", - "b": "b", - "c": "c", - "d": "d", - "e": "e", - "f": "f", - "g": "g", - "h": "h", - "i": "私", - "j": "j", - "k": "k", - "l": "私", - "m": "メートル", - "n": "n", - "o": "ああ", - "p": "p", - "q": "q", - "r": "r", - "s": "s", - "t": "t", - "u": "あなた", - "v": "v", - "w": "w", - "x": "バツ", - "y": "y", - "z": "z", - "enter": "入力", - "escape": "逃げる", - "space": "空間", - "tab": "タブ", - "backspace": "バックスペース", - "delete": "消去", - "arrowup": "アローアップ", - "arrowdown": "矢印", - "arrowleft": "矢印左", - "arrowright": "右矢印", - "f1": "f1", - "f2": "f2", - "f3": "f3", - "f4": "f4", - "f5": "f5", - "f6": "f6", - "f7": "f7", - "f8": "f8", - "f9": "f9", - "f10": "f10", - "f11": "f11", - "f12": "f12", - "shift": "シフト", - "control": "コントロール", - "alt": "代替", - "meta": "メタ", - "capslock": "キャップスロック", - "insert": "入れる", - "home": "家", - "end": "終わり", - "pageup": "ページアップ", - "pagedown": "ページダウン", - "!": "!", - "@": "@", - "#": "#", - "$": "$", - "%": "%", - "^": "^", - "&": "&", - "*": "*", - "(": "(", - ")": ")", - "-": "-", - "_": "_", - "+": "+", - "=": "=", - "[": "[", - "]": "】", - "{": "{", - "}": "}", - ";": ";", - ":": ":", - "'": "'", - "\"": "」", - ",": "、", - ".": "。", - "<": "<", - ">": ">", - "/": "/", - "?": "?", - "LEFT_STICK_X": "LEFT_STICK_X", - "LEFT_STICK_Y": "左スティック_Y", - "RIGHT_STICK_X": "RIGHT_STICK_X", - "RIGHT_STICK_Y": "右スティック_Y", - "LEFT_TRIGGER": "LEFT_TRIGGER", - "RIGHT_TRIGGER": "右トリガー", - "A_BUTTON": "ボタン", - "B_BUTTON": "B_ボタン", - "X_BUTTON": "X_ボタン", - "Y_BUTTON": "Y_ボタン", - "START_BUTTON": "スタートボタン", - "SELECT_BUTTON": "SELECT_BUTTON", - "L1_BUTTON": "L1_ボタン", - "R1_BUTTON": "R1_ボタン", - "L2_BUTTON": "L2_ボタン", - "R2_BUTTON": "R2_ボタン", - "LEFT_THUMB_BUTTON": "LEFT_THUMB_BUTTON", - "RIGHT_THUMB_BUTTON": "RIGHT_THUMB_BUTTON", - "DPAD_UP": "DPAD_UP", - "DPAD_DOWN": "DPAD_DOWN", - "DPAD_LEFT": "DPAD_LEFT", - "DPAD_RIGHT": "DPAD_RIGHT" +{ + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7", + "8": "8", + "9": "9", + "Restart": "再起動", + "Pause": "一時停止", + "Play": "遊ぶ", + "Save State": "状態を保存", + "Load State": "ロード状態", + "Control Settings": "コントロール設定", + "Cheats": "チート", + "Cache Manager": "キャッシュマネージャー", + "Export Save File": "保存ファイルのエクスポート", + "Import Save File": "保存ファイルのインポート", + "Netplay": "ネットプレイ", + "Mute": "ミュート", + "Unmute": "ミュートを解除する", + "Settings": "設定", + "Enter Fullscreen": "全画面表示に入る", + "Exit Fullscreen": "全画面表示を終了する", + "Reset": "リセット", + "Clear": "クリア", + "Close": "近い", + "QUICK SAVE STATE": "状態のクイック保存", + "QUICK LOAD STATE": "クイックロード状態", + "CHANGE STATE SLOT": "状態スロットの変更", + "FAST FORWARD": "早送り", + "Player": "プレーヤー", + "Connected Gamepad": "接続されたゲームパッド", + "Gamepad": "ゲームパッド", + "Keyboard": "キーボード", + "Set": "セット", + "Add Cheat": "チートの追加", + "Create a Room": "ルームを作成する", + "Rooms": "部屋", + "Start Game": "ゲームをスタート", + "Loading...": "読み込み中...", + "Download Game Core": "ゲームコアをダウンロード", + "Decompress Game Core": "ゲームコアを解凍する", + "Download Game Data": "ゲームデータのダウンロード", + "Decompress Game Data": "ゲームデータを解凍する", + "Shaders": "シェーダ", + "Disabled": "無効", + "2xScaleHQ": "2xスケール本社", + "4xScaleHQ": "4xスケール本社", + "CRT easymode": "CRTイージーモード", + "CRT aperture": "CRTの絞り", + "CRT geom": "CRT ジオム", + "CRT mattias": "CRT マティアス", + "FPS": "FPS", + "show": "見せる", + "hide": "隠れる", + "Fast Forward Ratio": "早送り率", + "Fast Forward": "早送り", + "Enabled": "有効", + "Save State Slot": "状態保存スロット", + "Save State Location": "状態の保存場所", + "Download": "ダウンロード", + "Keep in Browser": "ブラウザ内に保持", + "Auto": "自動", + "NTSC": "NTSC", + "PAL": "パル", + "Dendy": "デンディ", + "8:7 PAR": "8:7 パー", + "4:3": "4:3", + "Low": "低い", + "High": "高い", + "Very High": "すごく高い", + "None": "なし", + "Player 1": "プレイヤー 1", + "Player 2": "プレイヤー2", + "Both": "両方", + "SAVED STATE TO SLOT": "状態をスロットに保存しました", + "LOADED STATE FROM SLOT": "スロットからロードされた状態", + "SET SAVE STATE SLOT TO": "状態保存スロットを次のように設定します", + "Network Error": "ネットワークエラー", + "Submit": "提出する", + "Description": "説明", + "Code": "コード", + "Add Cheat Code": "チートコードを追加する", + "Leave Room": "部屋を出る", + "Password": "パスワード", + "Password (optional)": "パスワード (オプション)", + "Max Players": "最大プレイヤー数", + "Room Name": "部屋の名前", + "Join": "参加する", + "Player Name": "プレーヤの名前", + "Set Player Name": "プレイヤー名の設定", + "Left Handed Mode": "左利きモード", + "Virtual Gamepad": "仮想ゲームパッド", + "Disk": "ディスク", + "Press Keyboard": "キーボードを押す", + "INSERT COIN": "コインを入れる", + "Remove": "取り除く", + "SAVE LOADED FROM BROWSER": "ブラウザからロードして保存", + "SAVE SAVED TO BROWSER": "保存 ブラウザに保存", + "Join the discord": "ディスコードに参加する", + "View on GitHub": "GitHub で見る", + "Failed to start game": "ゲームの開始に失敗しました", + "Download Game BIOS": "ゲーム BIOS をダウンロードする", + "Decompress Game BIOS": "ゲーム BIOS を解凍する", + "Download Game Parent": "ゲームの親をダウンロード", + "Decompress Game Parent": "ゲームの親を解凍する", + "Download Game Patch": "ゲームパッチをダウンロード", + "Decompress Game Patch": "ゲームパッチを解凍する", + "Download Game State": "ゲームステートのダウンロード", + "Check console": "コンソールを確認してください", + "Error for site owner": "サイト所有者のエラー", + "EmulatorJS": "エミュレータJS", + "Clear All": "すべてクリア", + "Take Screenshot": "スクリーンショットを撮ります", + "Quick Save": "クイックセーブ", + "Quick Load": "クイックロード", + "REWIND": "巻き戻し", + "Rewind Enabled (requires restart)": "巻き戻しが有効 (再起動が必要)", + "Rewind Granularity": "巻き戻し粒度", + "Slow Motion Ratio": "スローモーション比率", + "Slow Motion": "スローモーション", + "Home": "家", + "EmulatorJS License": "エミュレータJSライセンス", + "RetroArch License": "RetroArch ライセンス", + "SLOW MOTION": "スローモーション", + "A": "あ", + "B": "B", + "SELECT": "選択する", + "START": "始める", + "UP": "上", + "DOWN": "下", + "LEFT": "左", + "RIGHT": "右", + "X": "バツ", + "Y": "Y", + "L": "L", + "R": "R", + "Z": "Z", + "STICK UP": "上に突き出る", + "STICK DOWN": "スティックダウン", + "STICK LEFT": "左スティック", + "STICK RIGHT": "右スティック", + "C-PAD UP": "Cパッドアップ", + "C-PAD DOWN": "C-パッドを下へ", + "C-PAD LEFT": "C-パッド左", + "C-PAD RIGHT": "Cパッド右", + "MICROPHONE": "マイクロフォン", + "BUTTON 1 / START": "ボタン 1 / スタート", + "BUTTON 2": "ボタン2", + "BUTTON": "ボタン", + "LEFT D-PAD UP": "左方向パッドを上に", + "LEFT D-PAD DOWN": "左方向パッド下", + "LEFT D-PAD LEFT": "左十字キー左", + "LEFT D-PAD RIGHT": "左十字キー右", + "RIGHT D-PAD UP": "右方向パッド上", + "RIGHT D-PAD DOWN": "右方向パッド下", + "RIGHT D-PAD LEFT": "右十字キー左", + "RIGHT D-PAD RIGHT": "右十字キー右", + "C": "C", + "MODE": "モード", + "FIRE": "火", + "RESET": "リセット", + "LEFT DIFFICULTY A": "左の難易度A", + "LEFT DIFFICULTY B": "左の難易度B", + "RIGHT DIFFICULTY A": "右の難易度A", + "RIGHT DIFFICULTY B": "右の難易度B", + "COLOR": "色", + "B/W": "白黒", + "PAUSE": "一時停止", + "OPTION": "オプション", + "OPTION 1": "オプション1", + "OPTION 2": "オプション 2", + "L2": "L2", + "R2": "R2", + "L3": "L3", + "R3": "R3", + "L STICK UP": "Lスティックアップ", + "L STICK DOWN": "Lスティックダウン", + "L STICK LEFT": "Lスティック左", + "L STICK RIGHT": "Lスティック右", + "R STICK UP": "Rスティックアップ", + "R STICK DOWN": "Rスティックダウン", + "R STICK LEFT": "Rスティック左", + "R STICK RIGHT": "R右スティック", + "Start": "始める", + "Select": "選択する", + "Fast": "速い", + "Slow": "遅い", + "a": "ある", + "b": "b", + "c": "c", + "d": "d", + "e": "e", + "f": "f", + "g": "g", + "h": "h", + "i": "私", + "j": "j", + "k": "k", + "l": "私", + "m": "メートル", + "n": "n", + "o": "ああ", + "p": "p", + "q": "q", + "r": "r", + "s": "s", + "t": "t", + "u": "あなた", + "v": "v", + "w": "w", + "x": "バツ", + "y": "y", + "z": "z", + "enter": "入力", + "escape": "逃げる", + "space": "空間", + "tab": "タブ", + "backspace": "バックスペース", + "delete": "消去", + "arrowup": "アローアップ", + "arrowdown": "矢印", + "arrowleft": "矢印左", + "arrowright": "右矢印", + "f1": "f1", + "f2": "f2", + "f3": "f3", + "f4": "f4", + "f5": "f5", + "f6": "f6", + "f7": "f7", + "f8": "f8", + "f9": "f9", + "f10": "f10", + "f11": "f11", + "f12": "f12", + "shift": "シフト", + "control": "コントロール", + "alt": "代替", + "meta": "メタ", + "capslock": "キャップスロック", + "insert": "入れる", + "home": "家", + "end": "終わり", + "pageup": "ページアップ", + "pagedown": "ページダウン", + "!": "!", + "@": "@", + "#": "#", + "$": "$", + "%": "%", + "^": "^", + "&": "&", + "*": "*", + "(": "(", + ")": ")", + "-": "-", + "_": "_", + "+": "+", + "=": "=", + "[": "[", + "]": "】", + "{": "{", + "}": "}", + ";": ";", + ":": ":", + "'": "'", + "\"": "」", + ",": "、", + ".": "。", + "<": "<", + ">": ">", + "/": "/", + "?": "?", + "LEFT_STICK_X": "LEFT_STICK_X", + "LEFT_STICK_Y": "左スティック_Y", + "RIGHT_STICK_X": "RIGHT_STICK_X", + "RIGHT_STICK_Y": "右スティック_Y", + "LEFT_TRIGGER": "LEFT_TRIGGER", + "RIGHT_TRIGGER": "右トリガー", + "A_BUTTON": "ボタン", + "B_BUTTON": "B_ボタン", + "X_BUTTON": "X_ボタン", + "Y_BUTTON": "Y_ボタン", + "START_BUTTON": "スタートボタン", + "SELECT_BUTTON": "SELECT_BUTTON", + "L1_BUTTON": "L1_ボタン", + "R1_BUTTON": "R1_ボタン", + "L2_BUTTON": "L2_ボタン", + "R2_BUTTON": "R2_ボタン", + "LEFT_THUMB_BUTTON": "LEFT_THUMB_BUTTON", + "RIGHT_THUMB_BUTTON": "RIGHT_THUMB_BUTTON", + "DPAD_UP": "DPAD_UP", + "DPAD_DOWN": "DPAD_DOWN", + "DPAD_LEFT": "DPAD_LEFT", + "DPAD_RIGHT": "DPAD_RIGHT" } \ No newline at end of file diff --git a/semag/emulatorjs/data/localization/jv-JV.json b/semag/emulatorjs/data/localization/jv-JV.json index 7d1a10c2..31ee1e96 100644 --- a/semag/emulatorjs/data/localization/jv-JV.json +++ b/semag/emulatorjs/data/localization/jv-JV.json @@ -1,301 +1,301 @@ -{ - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7", - "8": "8", - "9": "9", - "Restart": "Baleni meneh", - "Pause": "ngaso", - "Play": "Dolanan", - "Save State": "Simpen Negara", - "Load State": "Status beban", - "Control Settings": "Setelan Kontrol", - "Cheats": "Cidra", - "Cache Manager": "Cache Manager", - "Export Save File": "Ekspor Simpen File", - "Import Save File": "Ngimpor Simpen File", - "Netplay": "Netplay", - "Mute": "bisu", - "Unmute": "Unmute", - "Settings": "Setelan", - "Enter Fullscreen": "Ketik Fullscreen", - "Exit Fullscreen": "Metu Fullscreen", - "Reset": "Reset", - "Clear": "Cetha", - "Close": "Nutup", - "QUICK SAVE STATE": "CEPAT SAVE STATE", - "QUICK LOAD STATE": "STATE LOAD CEPAT", - "CHANGE STATE SLOT": "GANTI STATE slot", - "FAST FORWARD": "CEPAT MAJU", - "Player": "Pamuter", - "Connected Gamepad": "Gamepad sing disambungake", - "Gamepad": "Gamepad", - "Keyboard": "Papan ketik", - "Set": "Set", - "Add Cheat": "Tambah Ngapusi", - "Create a Room": "Nggawe Kamar", - "Rooms": "kamar", - "Start Game": "Miwiti Game", - "Loading...": "Loading...", - "Download Game Core": "Unduh Game Core", - "Decompress Game Core": "Decompress Game Core", - "Download Game Data": "Unduh Data Game", - "Decompress Game Data": "Decompress Game Data", - "Shaders": "Shaders", - "Disabled": "dipatèni", - "2xScaleHQ": "2xSkalaHQ", - "4xScaleHQ": "4xSkalaHQ", - "CRT easymode": "Mode gampang CRT", - "CRT aperture": "bukaan CRT", - "CRT geom": "CRT geom", - "CRT mattias": "CRT mattias", - "FPS": "FPS", - "show": "nuduhake", - "hide": "ndhelikake", - "Fast Forward Ratio": "Rasio Maju Cepet", - "Fast Forward": "Cepet Maju", - "Enabled": "diaktifake", - "Save State Slot": "Simpen State Slot", - "Save State Location": "Simpen Lokasi Negara", - "Download": "Ngundhuh", - "Keep in Browser": "Simpen ing Browser", - "Auto": "Auto", - "NTSC": "NTSC", - "PAL": "PAL", - "Dendy": "Dendy", - "8:7 PAR": "8:7 PAR", - "4:3": "4:3", - "Low": "kurang", - "High": "dhuwur", - "Very High": "Dhuwur banget", - "None": "ora ana", - "Player 1": "Pamuter 1", - "Player 2": "Pamuter 2", - "Both": "loro-lorone", - "SAVED STATE TO SLOT": "STATE disimpen kanggo slot", - "LOADED STATE FROM SLOT": "STATE dimuat saka slot", - "SET SAVE STATE SLOT TO": "SET Simpen STATE slot TO", - "Network Error": "Kesalahan Jaringan", - "Submit": "Kirimake", - "Description": "Katrangan", - "Code": "Kode", - "Add Cheat Code": "Tambah Kode Ngapusi", - "Leave Room": "Ninggalake Kamar", - "Password": "Sandi", - "Password (optional)": "Sandi (opsional)", - "Max Players": "Pemain Max", - "Room Name": "Jeneng Kamar", - "Join": "gabung", - "Player Name": "Jeneng Pamuter", - "Set Player Name": "Setel Jeneng Player", - "Left Handed Mode": "Mode Tangan Kiri", - "Virtual Gamepad": "Gamepad virtual", - "Disk": "Disk", - "Press Keyboard": "Pencet Keyboard", - "INSERT COIN": "INSERT COIN", - "Remove": "Mbusak", - "SAVE LOADED FROM BROWSER": "Simpen dimuat saka BROWSER", - "SAVE SAVED TO BROWSER": "SAVE disimpen menyang BROWSER", - "Join the discord": "Melu discord", - "View on GitHub": "Deleng ing GitHub", - "Failed to start game": "Gagal miwiti game", - "Download Game BIOS": "Unduh Game BIOS", - "Decompress Game BIOS": "Decompress Game BIOS", - "Download Game Parent": "Unduh Game Parent", - "Decompress Game Parent": "Decompress Game Induk", - "Download Game Patch": "Unduh Game Patch", - "Decompress Game Patch": "Decompress Game Patch", - "Download Game State": "Unduh Game State", - "Check console": "Priksa konsol", - "Error for site owner": "Kesalahan kanggo pemilik situs", - "EmulatorJS": "EmulatorJS", - "Clear All": "Busek kabeh", - "Take Screenshot": "Njupuk Screenshot", - "Quick Save": "Cepet Simpen", - "Quick Load": "Muat cepet", - "REWIND": "REWIND", - "Rewind Enabled (requires restart)": "Rewind Enabled (mbutuhake urip maneh)", - "Rewind Granularity": "Rewind Granularity", - "Slow Motion Ratio": "Rasio Slow Motion", - "Slow Motion": "Gerakan alon", - "Home": "Ngarep", - "EmulatorJS License": "Lisensi EmulatorJS", - "RetroArch License": "Lisensi RetroArch", - "SLOW MOTION": "GERAKAN ALON", - "A": "A", - "B": "B", - "SELECT": "PILIH", - "START": "MULAI", - "UP": "UP", - "DOWN": "TURUN", - "LEFT": "KIRI", - "RIGHT": "TETEP", - "X": "X", - "Y": "Y", - "L": "L", - "R": "R", - "Z": "Z", - "STICK UP": "TETEP", - "STICK DOWN": "TETEP", - "STICK LEFT": "STIK KIRI", - "STICK RIGHT": "TETEP KANAN", - "C-PAD UP": "C-PAD UP", - "C-PAD DOWN": "C-PAD TURUN", - "C-PAD LEFT": "C-PAD ngiwa", - "C-PAD RIGHT": "C-PAD KANAN", - "MICROPHONE": "MIKROFON", - "BUTTON 1 / START": "TOMBOL 1 / MULAI", - "BUTTON 2": "TOMBOL 2", - "BUTTON": "TOMBOL", - "LEFT D-PAD UP": "Ngiwa D-PAD UP", - "LEFT D-PAD DOWN": "Ngiwa D-PAD mudhun", - "LEFT D-PAD LEFT": "KIRI D-PAD KIRI", - "LEFT D-PAD RIGHT": "KIRI D-PAD TEngen", - "RIGHT D-PAD UP": "TEngen D-PAD UP", - "RIGHT D-PAD DOWN": "TEngen D-PAD mudhun", - "RIGHT D-PAD LEFT": "TEngen D-PAD ngiwa", - "RIGHT D-PAD RIGHT": "TEngen D-PAD TEngen", - "C": "C", - "MODE": "MODE", - "FIRE": "KEBURU", - "RESET": "RESET", - "LEFT DIFFICULTY A": "KESULITAN KIRI A", - "LEFT DIFFICULTY B": "KESULITAN KIRIB", - "RIGHT DIFFICULTY A": "KESULITAN TEPAT A", - "RIGHT DIFFICULTY B": "KESULITAN B", - "COLOR": "WARNA", - "B/W": "B/W", - "PAUSE": "ngaso", - "OPTION": "PILIHAN", - "OPTION 1": "PILIHAN 1", - "OPTION 2": "PILIHAN 2", - "L2": "L2", - "R2": "R2", - "L3": "L3", - "R3": "R3", - "L STICK UP": "L LANGGENG", - "L STICK DOWN": "L TETEP", - "L STICK LEFT": "L STIK KIRI", - "L STICK RIGHT": "L TEKAN KANGEN", - "R STICK UP": "R TETEP", - "R STICK DOWN": "R TETEP", - "R STICK LEFT": "R STICK ngiwa", - "R STICK RIGHT": "R STIKES TEngen", - "Start": "Miwiti", - "Select": "Pilih", - "Fast": "Cepet", - "Slow": "alon-alon", - "a": "a", - "b": "b", - "c": "c", - "d": "d", - "e": "e", - "f": "f", - "g": "g", - "h": "h", - "i": "i", - "j": "j", - "k": "k", - "l": "l", - "m": "m", - "n": "n", - "o": "o", - "p": "p", - "q": "q", - "r": "r", - "s": "s", - "t": "t", - "u": "u", - "v": "v", - "w": "w", - "x": "x", - "y": "y", - "z": "z", - "enter": "mlebu", - "escape": "uwal", - "space": "panggonan", - "tab": "tab", - "backspace": "backspace", - "delete": "mbusak", - "arrowup": "panahan", - "arrowdown": "panah mudhun", - "arrowleft": "panah ngiwa", - "arrowright": "panah tengen", - "f1": "f1", - "f2": "f2", - "f3": "f3", - "f4": "f4", - "f5": "f5", - "f6": "f6", - "f7": "f7", - "f8": "f8", - "f9": "f9", - "f10": "f10", - "f11": "f11", - "f12": "f12", - "shift": "ngalih", - "control": "kontrol", - "alt": "alt", - "meta": "meta", - "capslock": "capslock", - "insert": "nglebokake", - "home": "ngarep", - "end": "pungkasan", - "pageup": "pageup", - "pagedown": "pagedown", - "!": "!", - "@": "@", - "#": "#", - "$": "$", - "%": "%", - "^": "^", - "&": "&", - "*": "*", - "(": "(", - ")": ")", - "-": "-", - "_": "_", - "+": "+", - "=": "=", - "[": "[", - "]": "]", - "{": "{", - "}": "}", - ";": ";", - ":": ":", - "'": "'", - "\"": "\"", - ",": ",", - ".": ".", - "<": "<", - ">": ">", - "/": "/", - "?": "?", - "LEFT_STICK_X": "LEFT_STICK_X", - "LEFT_STICK_Y": "LEFT_STICK_Y", - "RIGHT_STICK_X": "RIGHT_STICK_X", - "RIGHT_STICK_Y": "RIGHT_STICK_Y", - "LEFT_TRIGGER": "LEFT_TRIGGER", - "RIGHT_TRIGGER": "RIGHT_TRIGGER", - "A_BUTTON": "A_BUTTON", - "B_BUTTON": "B_BUTTON", - "X_BUTTON": "X_BUTTON", - "Y_BUTTON": "Y_BUTTON", - "START_BUTTON": "START_BUTTON", - "SELECT_BUTTON": "SELECT_BUTTON", - "L1_BUTTON": "L1_TOMBOL", - "R1_BUTTON": "R1_TOMBOL", - "L2_BUTTON": "L2_TOMBOL", - "R2_BUTTON": "R2_BUTTON", - "LEFT_THUMB_BUTTON": "TOMBOL_LEFT_THUMB_BUTTON", - "RIGHT_THUMB_BUTTON": "RIGHT_THUMB_BUTTON", - "DPAD_UP": "DPAD_UP", - "DPAD_DOWN": "DPAD_DOWN", - "DPAD_LEFT": "DPAD_LEFT", - "DPAD_RIGHT": "DPAD_RIGHT" +{ + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7", + "8": "8", + "9": "9", + "Restart": "Baleni meneh", + "Pause": "ngaso", + "Play": "Dolanan", + "Save State": "Simpen Negara", + "Load State": "Status beban", + "Control Settings": "Setelan Kontrol", + "Cheats": "Cidra", + "Cache Manager": "Cache Manager", + "Export Save File": "Ekspor Simpen File", + "Import Save File": "Ngimpor Simpen File", + "Netplay": "Netplay", + "Mute": "bisu", + "Unmute": "Unmute", + "Settings": "Setelan", + "Enter Fullscreen": "Ketik Fullscreen", + "Exit Fullscreen": "Metu Fullscreen", + "Reset": "Reset", + "Clear": "Cetha", + "Close": "Nutup", + "QUICK SAVE STATE": "CEPAT SAVE STATE", + "QUICK LOAD STATE": "STATE LOAD CEPAT", + "CHANGE STATE SLOT": "GANTI STATE slot", + "FAST FORWARD": "CEPAT MAJU", + "Player": "Pamuter", + "Connected Gamepad": "Gamepad sing disambungake", + "Gamepad": "Gamepad", + "Keyboard": "Papan ketik", + "Set": "Set", + "Add Cheat": "Tambah Ngapusi", + "Create a Room": "Nggawe Kamar", + "Rooms": "kamar", + "Start Game": "Miwiti Game", + "Loading...": "Loading...", + "Download Game Core": "Unduh Game Core", + "Decompress Game Core": "Decompress Game Core", + "Download Game Data": "Unduh Data Game", + "Decompress Game Data": "Decompress Game Data", + "Shaders": "Shaders", + "Disabled": "dipatèni", + "2xScaleHQ": "2xSkalaHQ", + "4xScaleHQ": "4xSkalaHQ", + "CRT easymode": "Mode gampang CRT", + "CRT aperture": "bukaan CRT", + "CRT geom": "CRT geom", + "CRT mattias": "CRT mattias", + "FPS": "FPS", + "show": "nuduhake", + "hide": "ndhelikake", + "Fast Forward Ratio": "Rasio Maju Cepet", + "Fast Forward": "Cepet Maju", + "Enabled": "diaktifake", + "Save State Slot": "Simpen State Slot", + "Save State Location": "Simpen Lokasi Negara", + "Download": "Ngundhuh", + "Keep in Browser": "Simpen ing Browser", + "Auto": "Auto", + "NTSC": "NTSC", + "PAL": "PAL", + "Dendy": "Dendy", + "8:7 PAR": "8:7 PAR", + "4:3": "4:3", + "Low": "kurang", + "High": "dhuwur", + "Very High": "Dhuwur banget", + "None": "ora ana", + "Player 1": "Pamuter 1", + "Player 2": "Pamuter 2", + "Both": "loro-lorone", + "SAVED STATE TO SLOT": "STATE disimpen kanggo slot", + "LOADED STATE FROM SLOT": "STATE dimuat saka slot", + "SET SAVE STATE SLOT TO": "SET Simpen STATE slot TO", + "Network Error": "Kesalahan Jaringan", + "Submit": "Kirimake", + "Description": "Katrangan", + "Code": "Kode", + "Add Cheat Code": "Tambah Kode Ngapusi", + "Leave Room": "Ninggalake Kamar", + "Password": "Sandi", + "Password (optional)": "Sandi (opsional)", + "Max Players": "Pemain Max", + "Room Name": "Jeneng Kamar", + "Join": "gabung", + "Player Name": "Jeneng Pamuter", + "Set Player Name": "Setel Jeneng Player", + "Left Handed Mode": "Mode Tangan Kiri", + "Virtual Gamepad": "Gamepad virtual", + "Disk": "Disk", + "Press Keyboard": "Pencet Keyboard", + "INSERT COIN": "INSERT COIN", + "Remove": "Mbusak", + "SAVE LOADED FROM BROWSER": "Simpen dimuat saka BROWSER", + "SAVE SAVED TO BROWSER": "SAVE disimpen menyang BROWSER", + "Join the discord": "Melu discord", + "View on GitHub": "Deleng ing GitHub", + "Failed to start game": "Gagal miwiti game", + "Download Game BIOS": "Unduh Game BIOS", + "Decompress Game BIOS": "Decompress Game BIOS", + "Download Game Parent": "Unduh Game Parent", + "Decompress Game Parent": "Decompress Game Induk", + "Download Game Patch": "Unduh Game Patch", + "Decompress Game Patch": "Decompress Game Patch", + "Download Game State": "Unduh Game State", + "Check console": "Priksa konsol", + "Error for site owner": "Kesalahan kanggo pemilik situs", + "EmulatorJS": "EmulatorJS", + "Clear All": "Busek kabeh", + "Take Screenshot": "Njupuk Screenshot", + "Quick Save": "Cepet Simpen", + "Quick Load": "Muat cepet", + "REWIND": "REWIND", + "Rewind Enabled (requires restart)": "Rewind Enabled (mbutuhake urip maneh)", + "Rewind Granularity": "Rewind Granularity", + "Slow Motion Ratio": "Rasio Slow Motion", + "Slow Motion": "Gerakan alon", + "Home": "Ngarep", + "EmulatorJS License": "Lisensi EmulatorJS", + "RetroArch License": "Lisensi RetroArch", + "SLOW MOTION": "GERAKAN ALON", + "A": "A", + "B": "B", + "SELECT": "PILIH", + "START": "MULAI", + "UP": "UP", + "DOWN": "TURUN", + "LEFT": "KIRI", + "RIGHT": "TETEP", + "X": "X", + "Y": "Y", + "L": "L", + "R": "R", + "Z": "Z", + "STICK UP": "TETEP", + "STICK DOWN": "TETEP", + "STICK LEFT": "STIK KIRI", + "STICK RIGHT": "TETEP KANAN", + "C-PAD UP": "C-PAD UP", + "C-PAD DOWN": "C-PAD TURUN", + "C-PAD LEFT": "C-PAD ngiwa", + "C-PAD RIGHT": "C-PAD KANAN", + "MICROPHONE": "MIKROFON", + "BUTTON 1 / START": "TOMBOL 1 / MULAI", + "BUTTON 2": "TOMBOL 2", + "BUTTON": "TOMBOL", + "LEFT D-PAD UP": "Ngiwa D-PAD UP", + "LEFT D-PAD DOWN": "Ngiwa D-PAD mudhun", + "LEFT D-PAD LEFT": "KIRI D-PAD KIRI", + "LEFT D-PAD RIGHT": "KIRI D-PAD TEngen", + "RIGHT D-PAD UP": "TEngen D-PAD UP", + "RIGHT D-PAD DOWN": "TEngen D-PAD mudhun", + "RIGHT D-PAD LEFT": "TEngen D-PAD ngiwa", + "RIGHT D-PAD RIGHT": "TEngen D-PAD TEngen", + "C": "C", + "MODE": "MODE", + "FIRE": "KEBURU", + "RESET": "RESET", + "LEFT DIFFICULTY A": "KESULITAN KIRI A", + "LEFT DIFFICULTY B": "KESULITAN KIRIB", + "RIGHT DIFFICULTY A": "KESULITAN TEPAT A", + "RIGHT DIFFICULTY B": "KESULITAN B", + "COLOR": "WARNA", + "B/W": "B/W", + "PAUSE": "ngaso", + "OPTION": "PILIHAN", + "OPTION 1": "PILIHAN 1", + "OPTION 2": "PILIHAN 2", + "L2": "L2", + "R2": "R2", + "L3": "L3", + "R3": "R3", + "L STICK UP": "L LANGGENG", + "L STICK DOWN": "L TETEP", + "L STICK LEFT": "L STIK KIRI", + "L STICK RIGHT": "L TEKAN KANGEN", + "R STICK UP": "R TETEP", + "R STICK DOWN": "R TETEP", + "R STICK LEFT": "R STICK ngiwa", + "R STICK RIGHT": "R STIKES TEngen", + "Start": "Miwiti", + "Select": "Pilih", + "Fast": "Cepet", + "Slow": "alon-alon", + "a": "a", + "b": "b", + "c": "c", + "d": "d", + "e": "e", + "f": "f", + "g": "g", + "h": "h", + "i": "i", + "j": "j", + "k": "k", + "l": "l", + "m": "m", + "n": "n", + "o": "o", + "p": "p", + "q": "q", + "r": "r", + "s": "s", + "t": "t", + "u": "u", + "v": "v", + "w": "w", + "x": "x", + "y": "y", + "z": "z", + "enter": "mlebu", + "escape": "uwal", + "space": "panggonan", + "tab": "tab", + "backspace": "backspace", + "delete": "mbusak", + "arrowup": "panahan", + "arrowdown": "panah mudhun", + "arrowleft": "panah ngiwa", + "arrowright": "panah tengen", + "f1": "f1", + "f2": "f2", + "f3": "f3", + "f4": "f4", + "f5": "f5", + "f6": "f6", + "f7": "f7", + "f8": "f8", + "f9": "f9", + "f10": "f10", + "f11": "f11", + "f12": "f12", + "shift": "ngalih", + "control": "kontrol", + "alt": "alt", + "meta": "meta", + "capslock": "capslock", + "insert": "nglebokake", + "home": "ngarep", + "end": "pungkasan", + "pageup": "pageup", + "pagedown": "pagedown", + "!": "!", + "@": "@", + "#": "#", + "$": "$", + "%": "%", + "^": "^", + "&": "&", + "*": "*", + "(": "(", + ")": ")", + "-": "-", + "_": "_", + "+": "+", + "=": "=", + "[": "[", + "]": "]", + "{": "{", + "}": "}", + ";": ";", + ":": ":", + "'": "'", + "\"": "\"", + ",": ",", + ".": ".", + "<": "<", + ">": ">", + "/": "/", + "?": "?", + "LEFT_STICK_X": "LEFT_STICK_X", + "LEFT_STICK_Y": "LEFT_STICK_Y", + "RIGHT_STICK_X": "RIGHT_STICK_X", + "RIGHT_STICK_Y": "RIGHT_STICK_Y", + "LEFT_TRIGGER": "LEFT_TRIGGER", + "RIGHT_TRIGGER": "RIGHT_TRIGGER", + "A_BUTTON": "A_BUTTON", + "B_BUTTON": "B_BUTTON", + "X_BUTTON": "X_BUTTON", + "Y_BUTTON": "Y_BUTTON", + "START_BUTTON": "START_BUTTON", + "SELECT_BUTTON": "SELECT_BUTTON", + "L1_BUTTON": "L1_TOMBOL", + "R1_BUTTON": "R1_TOMBOL", + "L2_BUTTON": "L2_TOMBOL", + "R2_BUTTON": "R2_BUTTON", + "LEFT_THUMB_BUTTON": "TOMBOL_LEFT_THUMB_BUTTON", + "RIGHT_THUMB_BUTTON": "RIGHT_THUMB_BUTTON", + "DPAD_UP": "DPAD_UP", + "DPAD_DOWN": "DPAD_DOWN", + "DPAD_LEFT": "DPAD_LEFT", + "DPAD_RIGHT": "DPAD_RIGHT" } \ No newline at end of file diff --git a/semag/emulatorjs/data/localization/ko-KO.json b/semag/emulatorjs/data/localization/ko-KO.json index 133c673b..2a2bb32a 100644 --- a/semag/emulatorjs/data/localization/ko-KO.json +++ b/semag/emulatorjs/data/localization/ko-KO.json @@ -1,301 +1,301 @@ -{ - "0": "0", - "1": "1", - "2": "2", - "3": "삼", - "4": "4", - "5": "5", - "6": "6", - "7": "7", - "8": "8", - "9": "9", - "Restart": "재시작", - "Pause": "정지시키다", - "Play": "놀다", - "Save State": "상태 저장", - "Load State": "로드 상태", - "Control Settings": "제어 설정", - "Cheats": "치트", - "Cache Manager": "캐시 관리자", - "Export Save File": "저장 파일 내보내기", - "Import Save File": "저장 파일 가져오기", - "Netplay": "넷플레이", - "Mute": "무음", - "Unmute": "음소거 해제", - "Settings": "설정", - "Enter Fullscreen": "전체 화면 시작", - "Exit Fullscreen": "전체화면 종료", - "Reset": "초기화", - "Clear": "분명한", - "Close": "닫다", - "QUICK SAVE STATE": "빠른 저장 상태", - "QUICK LOAD STATE": "빠른 로드 상태", - "CHANGE STATE SLOT": "상태 슬롯 변경", - "FAST FORWARD": "빨리 감기", - "Player": "플레이어", - "Connected Gamepad": "연결된 게임패드", - "Gamepad": "게임패드", - "Keyboard": "건반", - "Set": "세트", - "Add Cheat": "치트 추가", - "Create a Room": "방 만들기", - "Rooms": "객실", - "Start Game": "게임을 시작하다", - "Loading...": "로드 중...", - "Download Game Core": "게임 코어 다운로드", - "Decompress Game Core": "게임 코어 압축 해제", - "Download Game Data": "게임 데이터 다운로드", - "Decompress Game Data": "게임 데이터 압축 해제", - "Shaders": "셰이더", - "Disabled": "장애가 있는", - "2xScaleHQ": "2xScaleHQ", - "4xScaleHQ": "4xScaleHQ", - "CRT easymode": "브라운관 이지모드", - "CRT aperture": "CRT 조리개", - "CRT geom": "브라운관 검", - "CRT mattias": "CRT 마티아스", - "FPS": "FPS", - "show": "보여주다", - "hide": "숨다", - "Fast Forward Ratio": "빨리 감기 비율", - "Fast Forward": "빨리 감기", - "Enabled": "사용", - "Save State Slot": "상태 슬롯 저장", - "Save State Location": "상태 위치 저장", - "Download": "다운로드", - "Keep in Browser": "브라우저에 보관", - "Auto": "자동", - "NTSC": "NTSC", - "PAL": "단짝", - "Dendy": "덴디", - "8:7 PAR": "8:7 동점", - "4:3": "4:3", - "Low": "낮은", - "High": "높은", - "Very High": "매우 높음", - "None": "없음", - "Player 1": "플레이어 1", - "Player 2": "플레이어 2", - "Both": "둘 다", - "SAVED STATE TO SLOT": "슬롯에 저장된 상태", - "LOADED STATE FROM SLOT": "슬롯에서 로드된 상태", - "SET SAVE STATE SLOT TO": "저장 상태 슬롯을 다음으로 설정", - "Network Error": "네트워크 오류", - "Submit": "제출하다", - "Description": "설명", - "Code": "암호", - "Add Cheat Code": "치트 코드 추가", - "Leave Room": "방 나가기", - "Password": "비밀번호", - "Password (optional)": "비밀번호(선택 사항)", - "Max Players": "최대 플레이어", - "Room Name": "방 이름", - "Join": "가입하다", - "Player Name": "선수 이름", - "Set Player Name": "플레이어 이름 설정", - "Left Handed Mode": "왼손잡이 모드", - "Virtual Gamepad": "가상 게임패드", - "Disk": "디스크", - "Press Keyboard": "키보드 누르기", - "INSERT COIN": "동전을 넣으세요", - "Remove": "제거하다", - "SAVE LOADED FROM BROWSER": "브라우저에서 불러온 저장", - "SAVE SAVED TO BROWSER": "저장 브라우저에 저장됨", - "Join the discord": "불화에 동참하십시오", - "View on GitHub": "GitHub에서 보기", - "Failed to start game": "게임을 시작하지 못했습니다.", - "Download Game BIOS": "게임 BIOS 다운로드", - "Decompress Game BIOS": "게임 BIOS 압축 해제", - "Download Game Parent": "게임 부모 다운로드", - "Decompress Game Parent": "게임 부모 압축 해제", - "Download Game Patch": "게임 패치 다운로드", - "Decompress Game Patch": "게임 패치 압축 해제", - "Download Game State": "게임 상태 다운로드", - "Check console": "콘솔 확인", - "Error for site owner": "사이트 소유자 오류", - "EmulatorJS": "EmulatorJS", - "Clear All": "모두 지우기", - "Take Screenshot": "스크린 샷을 찍다", - "Quick Save": "빠른 저장", - "Quick Load": "빠른 로드", - "REWIND": "되감기", - "Rewind Enabled (requires restart)": "되감기 활성화됨(다시 시작해야 함)", - "Rewind Granularity": "되감기 세분성", - "Slow Motion Ratio": "슬로우 모션 비율", - "Slow Motion": "느린", - "Home": "집", - "EmulatorJS License": "EmulatorJS 라이선스", - "RetroArch License": "레트로아크 라이선스", - "SLOW MOTION": "느린", - "A": "ㅏ", - "B": "비", - "SELECT": "선택하다", - "START": "시작", - "UP": "위로", - "DOWN": "아래에", - "LEFT": "왼쪽", - "RIGHT": "오른쪽", - "X": "엑스", - "Y": "와이", - "L": "엘", - "R": "아르 자형", - "Z": "지", - "STICK UP": "스틱 업", - "STICK DOWN": "스틱 다운", - "STICK LEFT": "스틱 왼쪽", - "STICK RIGHT": "스틱 오른쪽", - "C-PAD UP": "C 패드 위로", - "C-PAD DOWN": "C패드 다운", - "C-PAD LEFT": "C 패드 왼쪽", - "C-PAD RIGHT": "C 패드 오른쪽", - "MICROPHONE": "마이크로폰", - "BUTTON 1 / START": "버튼 1 / 시작", - "BUTTON 2": "버튼 2", - "BUTTON": "단추", - "LEFT D-PAD UP": "왼쪽 방향 패드 위로", - "LEFT D-PAD DOWN": "왼쪽 방향 패드 아래로", - "LEFT D-PAD LEFT": "왼쪽 방향 패드 왼쪽", - "LEFT D-PAD RIGHT": "왼쪽 방향 패드 오른쪽", - "RIGHT D-PAD UP": "오른쪽 방향 패드 위로", - "RIGHT D-PAD DOWN": "오른쪽 방향 패드 아래로", - "RIGHT D-PAD LEFT": "오른쪽 방향 패드 왼쪽", - "RIGHT D-PAD RIGHT": "오른쪽 방향 패드 오른쪽", - "C": "씨", - "MODE": "방법", - "FIRE": "불", - "RESET": "초기화", - "LEFT DIFFICULTY A": "왼쪽 난이도 A", - "LEFT DIFFICULTY B": "왼쪽 난이도 B", - "RIGHT DIFFICULTY A": "오른쪽 난이도 A", - "RIGHT DIFFICULTY B": "오른쪽 난이도 B", - "COLOR": "색상", - "B/W": "흑백", - "PAUSE": "정지시키다", - "OPTION": "옵션", - "OPTION 1": "옵션 1", - "OPTION 2": "옵션 2", - "L2": "L2", - "R2": "R2", - "L3": "L3", - "R3": "R3", - "L STICK UP": "L 스틱 업", - "L STICK DOWN": "L 스틱 다운", - "L STICK LEFT": "왼쪽 스틱", - "L STICK RIGHT": "L 오른쪽 스틱", - "R STICK UP": "R 스틱 업", - "R STICK DOWN": "R 스틱 다운", - "R STICK LEFT": "R 스틱 왼쪽", - "R STICK RIGHT": "R 오른쪽 스틱", - "Start": "시작", - "Select": "선택하다", - "Fast": "빠른", - "Slow": "느린", - "a": "ㅏ", - "b": "비", - "c": "씨", - "d": "디", - "e": "이자형", - "f": "에프", - "g": "g", - "h": "시간", - "i": "나", - "j": "제이", - "k": "케이", - "l": "엘", - "m": "중", - "n": "N", - "o": "영형", - "p": "피", - "q": "큐", - "r": "아르 자형", - "s": "에스", - "t": "티", - "u": "유", - "v": "V", - "w": "승", - "x": "엑스", - "y": "와이", - "z": "지", - "enter": "입력하다", - "escape": "탈출하다", - "space": "공간", - "tab": "탭", - "backspace": "역행 키이", - "delete": "삭제", - "arrowup": "화살촉", - "arrowdown": "화살표 방향", - "arrowleft": "왼쪽 화살표", - "arrowright": "오른쪽 화살표", - "f1": "f1", - "f2": "f2", - "f3": "f3", - "f4": "f4", - "f5": "f5", - "f6": "f6", - "f7": "f7", - "f8": "f8", - "f9": "f9", - "f10": "f10", - "f11": "f11", - "f12": "f12", - "shift": "옮기다", - "control": "제어", - "alt": "대안", - "meta": "메타", - "capslock": "캡스락", - "insert": "끼워 넣다", - "home": "집", - "end": "끝", - "pageup": "페이지 위로", - "pagedown": "페이지 다운", - "!": "!", - "@": "@", - "#": "#", - "$": "$", - "%": "%", - "^": "^^", - "&": "&", - "*": "*", - "(": "(", - ")": ")", - "-": "-", - "_": "_", - "+": "+", - "=": "=", - "[": "[", - "]": "]", - "{": "{", - "}": "}", - ";": ";", - ":": ":", - "'": "'", - "\"": "\"", - ",": ",", - ".": ".", - "<": "<", - ">": ">", - "/": "/", - "?": "?", - "LEFT_STICK_X": "왼쪽_스틱_X", - "LEFT_STICK_Y": "왼쪽_스틱_Y", - "RIGHT_STICK_X": "RIGHT_STICK_X", - "RIGHT_STICK_Y": "오른쪽_스틱_Y", - "LEFT_TRIGGER": "왼쪽_트리거", - "RIGHT_TRIGGER": "RIGHT_TRIGGER", - "A_BUTTON": "단추", - "B_BUTTON": "B_버튼", - "X_BUTTON": "X_버튼", - "Y_BUTTON": "Y_버튼", - "START_BUTTON": "시작 버튼", - "SELECT_BUTTON": "선택_버튼", - "L1_BUTTON": "L1_버튼", - "R1_BUTTON": "R1_버튼", - "L2_BUTTON": "L2_버튼", - "R2_BUTTON": "R2_버튼", - "LEFT_THUMB_BUTTON": "LEFT_THUMB_BUTTON", - "RIGHT_THUMB_BUTTON": "RIGHT_THUMB_BUTTON", - "DPAD_UP": "DPAD_UP", - "DPAD_DOWN": "DPAD_DOWN", - "DPAD_LEFT": "DPAD_LEFT", - "DPAD_RIGHT": "DPAD_RIGHT" +{ + "0": "0", + "1": "1", + "2": "2", + "3": "삼", + "4": "4", + "5": "5", + "6": "6", + "7": "7", + "8": "8", + "9": "9", + "Restart": "재시작", + "Pause": "정지시키다", + "Play": "놀다", + "Save State": "상태 저장", + "Load State": "로드 상태", + "Control Settings": "제어 설정", + "Cheats": "치트", + "Cache Manager": "캐시 관리자", + "Export Save File": "저장 파일 내보내기", + "Import Save File": "저장 파일 가져오기", + "Netplay": "넷플레이", + "Mute": "무음", + "Unmute": "음소거 해제", + "Settings": "설정", + "Enter Fullscreen": "전체 화면 시작", + "Exit Fullscreen": "전체화면 종료", + "Reset": "초기화", + "Clear": "분명한", + "Close": "닫다", + "QUICK SAVE STATE": "빠른 저장 상태", + "QUICK LOAD STATE": "빠른 로드 상태", + "CHANGE STATE SLOT": "상태 슬롯 변경", + "FAST FORWARD": "빨리 감기", + "Player": "플레이어", + "Connected Gamepad": "연결된 게임패드", + "Gamepad": "게임패드", + "Keyboard": "건반", + "Set": "세트", + "Add Cheat": "치트 추가", + "Create a Room": "방 만들기", + "Rooms": "객실", + "Start Game": "게임을 시작하다", + "Loading...": "로드 중...", + "Download Game Core": "게임 코어 다운로드", + "Decompress Game Core": "게임 코어 압축 해제", + "Download Game Data": "게임 데이터 다운로드", + "Decompress Game Data": "게임 데이터 압축 해제", + "Shaders": "셰이더", + "Disabled": "장애가 있는", + "2xScaleHQ": "2xScaleHQ", + "4xScaleHQ": "4xScaleHQ", + "CRT easymode": "브라운관 이지모드", + "CRT aperture": "CRT 조리개", + "CRT geom": "브라운관 검", + "CRT mattias": "CRT 마티아스", + "FPS": "FPS", + "show": "보여주다", + "hide": "숨다", + "Fast Forward Ratio": "빨리 감기 비율", + "Fast Forward": "빨리 감기", + "Enabled": "사용", + "Save State Slot": "상태 슬롯 저장", + "Save State Location": "상태 위치 저장", + "Download": "다운로드", + "Keep in Browser": "브라우저에 보관", + "Auto": "자동", + "NTSC": "NTSC", + "PAL": "단짝", + "Dendy": "덴디", + "8:7 PAR": "8:7 동점", + "4:3": "4:3", + "Low": "낮은", + "High": "높은", + "Very High": "매우 높음", + "None": "없음", + "Player 1": "플레이어 1", + "Player 2": "플레이어 2", + "Both": "둘 다", + "SAVED STATE TO SLOT": "슬롯에 저장된 상태", + "LOADED STATE FROM SLOT": "슬롯에서 로드된 상태", + "SET SAVE STATE SLOT TO": "저장 상태 슬롯을 다음으로 설정", + "Network Error": "네트워크 오류", + "Submit": "제출하다", + "Description": "설명", + "Code": "암호", + "Add Cheat Code": "치트 코드 추가", + "Leave Room": "방 나가기", + "Password": "비밀번호", + "Password (optional)": "비밀번호(선택 사항)", + "Max Players": "최대 플레이어", + "Room Name": "방 이름", + "Join": "가입하다", + "Player Name": "선수 이름", + "Set Player Name": "플레이어 이름 설정", + "Left Handed Mode": "왼손잡이 모드", + "Virtual Gamepad": "가상 게임패드", + "Disk": "디스크", + "Press Keyboard": "키보드 누르기", + "INSERT COIN": "동전을 넣으세요", + "Remove": "제거하다", + "SAVE LOADED FROM BROWSER": "브라우저에서 불러온 저장", + "SAVE SAVED TO BROWSER": "저장 브라우저에 저장됨", + "Join the discord": "불화에 동참하십시오", + "View on GitHub": "GitHub에서 보기", + "Failed to start game": "게임을 시작하지 못했습니다.", + "Download Game BIOS": "게임 BIOS 다운로드", + "Decompress Game BIOS": "게임 BIOS 압축 해제", + "Download Game Parent": "게임 부모 다운로드", + "Decompress Game Parent": "게임 부모 압축 해제", + "Download Game Patch": "게임 패치 다운로드", + "Decompress Game Patch": "게임 패치 압축 해제", + "Download Game State": "게임 상태 다운로드", + "Check console": "콘솔 확인", + "Error for site owner": "사이트 소유자 오류", + "EmulatorJS": "EmulatorJS", + "Clear All": "모두 지우기", + "Take Screenshot": "스크린 샷을 찍다", + "Quick Save": "빠른 저장", + "Quick Load": "빠른 로드", + "REWIND": "되감기", + "Rewind Enabled (requires restart)": "되감기 활성화됨(다시 시작해야 함)", + "Rewind Granularity": "되감기 세분성", + "Slow Motion Ratio": "슬로우 모션 비율", + "Slow Motion": "느린", + "Home": "집", + "EmulatorJS License": "EmulatorJS 라이선스", + "RetroArch License": "레트로아크 라이선스", + "SLOW MOTION": "느린", + "A": "ㅏ", + "B": "비", + "SELECT": "선택하다", + "START": "시작", + "UP": "위로", + "DOWN": "아래에", + "LEFT": "왼쪽", + "RIGHT": "오른쪽", + "X": "엑스", + "Y": "와이", + "L": "엘", + "R": "아르 자형", + "Z": "지", + "STICK UP": "스틱 업", + "STICK DOWN": "스틱 다운", + "STICK LEFT": "스틱 왼쪽", + "STICK RIGHT": "스틱 오른쪽", + "C-PAD UP": "C 패드 위로", + "C-PAD DOWN": "C패드 다운", + "C-PAD LEFT": "C 패드 왼쪽", + "C-PAD RIGHT": "C 패드 오른쪽", + "MICROPHONE": "마이크로폰", + "BUTTON 1 / START": "버튼 1 / 시작", + "BUTTON 2": "버튼 2", + "BUTTON": "단추", + "LEFT D-PAD UP": "왼쪽 방향 패드 위로", + "LEFT D-PAD DOWN": "왼쪽 방향 패드 아래로", + "LEFT D-PAD LEFT": "왼쪽 방향 패드 왼쪽", + "LEFT D-PAD RIGHT": "왼쪽 방향 패드 오른쪽", + "RIGHT D-PAD UP": "오른쪽 방향 패드 위로", + "RIGHT D-PAD DOWN": "오른쪽 방향 패드 아래로", + "RIGHT D-PAD LEFT": "오른쪽 방향 패드 왼쪽", + "RIGHT D-PAD RIGHT": "오른쪽 방향 패드 오른쪽", + "C": "씨", + "MODE": "방법", + "FIRE": "불", + "RESET": "초기화", + "LEFT DIFFICULTY A": "왼쪽 난이도 A", + "LEFT DIFFICULTY B": "왼쪽 난이도 B", + "RIGHT DIFFICULTY A": "오른쪽 난이도 A", + "RIGHT DIFFICULTY B": "오른쪽 난이도 B", + "COLOR": "색상", + "B/W": "흑백", + "PAUSE": "정지시키다", + "OPTION": "옵션", + "OPTION 1": "옵션 1", + "OPTION 2": "옵션 2", + "L2": "L2", + "R2": "R2", + "L3": "L3", + "R3": "R3", + "L STICK UP": "L 스틱 업", + "L STICK DOWN": "L 스틱 다운", + "L STICK LEFT": "왼쪽 스틱", + "L STICK RIGHT": "L 오른쪽 스틱", + "R STICK UP": "R 스틱 업", + "R STICK DOWN": "R 스틱 다운", + "R STICK LEFT": "R 스틱 왼쪽", + "R STICK RIGHT": "R 오른쪽 스틱", + "Start": "시작", + "Select": "선택하다", + "Fast": "빠른", + "Slow": "느린", + "a": "ㅏ", + "b": "비", + "c": "씨", + "d": "디", + "e": "이자형", + "f": "에프", + "g": "g", + "h": "시간", + "i": "나", + "j": "제이", + "k": "케이", + "l": "엘", + "m": "중", + "n": "N", + "o": "영형", + "p": "피", + "q": "큐", + "r": "아르 자형", + "s": "에스", + "t": "티", + "u": "유", + "v": "V", + "w": "승", + "x": "엑스", + "y": "와이", + "z": "지", + "enter": "입력하다", + "escape": "탈출하다", + "space": "공간", + "tab": "탭", + "backspace": "역행 키이", + "delete": "삭제", + "arrowup": "화살촉", + "arrowdown": "화살표 방향", + "arrowleft": "왼쪽 화살표", + "arrowright": "오른쪽 화살표", + "f1": "f1", + "f2": "f2", + "f3": "f3", + "f4": "f4", + "f5": "f5", + "f6": "f6", + "f7": "f7", + "f8": "f8", + "f9": "f9", + "f10": "f10", + "f11": "f11", + "f12": "f12", + "shift": "옮기다", + "control": "제어", + "alt": "대안", + "meta": "메타", + "capslock": "캡스락", + "insert": "끼워 넣다", + "home": "집", + "end": "끝", + "pageup": "페이지 위로", + "pagedown": "페이지 다운", + "!": "!", + "@": "@", + "#": "#", + "$": "$", + "%": "%", + "^": "^^", + "&": "&", + "*": "*", + "(": "(", + ")": ")", + "-": "-", + "_": "_", + "+": "+", + "=": "=", + "[": "[", + "]": "]", + "{": "{", + "}": "}", + ";": ";", + ":": ":", + "'": "'", + "\"": "\"", + ",": ",", + ".": ".", + "<": "<", + ">": ">", + "/": "/", + "?": "?", + "LEFT_STICK_X": "왼쪽_스틱_X", + "LEFT_STICK_Y": "왼쪽_스틱_Y", + "RIGHT_STICK_X": "RIGHT_STICK_X", + "RIGHT_STICK_Y": "오른쪽_스틱_Y", + "LEFT_TRIGGER": "왼쪽_트리거", + "RIGHT_TRIGGER": "RIGHT_TRIGGER", + "A_BUTTON": "단추", + "B_BUTTON": "B_버튼", + "X_BUTTON": "X_버튼", + "Y_BUTTON": "Y_버튼", + "START_BUTTON": "시작 버튼", + "SELECT_BUTTON": "선택_버튼", + "L1_BUTTON": "L1_버튼", + "R1_BUTTON": "R1_버튼", + "L2_BUTTON": "L2_버튼", + "R2_BUTTON": "R2_버튼", + "LEFT_THUMB_BUTTON": "LEFT_THUMB_BUTTON", + "RIGHT_THUMB_BUTTON": "RIGHT_THUMB_BUTTON", + "DPAD_UP": "DPAD_UP", + "DPAD_DOWN": "DPAD_DOWN", + "DPAD_LEFT": "DPAD_LEFT", + "DPAD_RIGHT": "DPAD_RIGHT" } \ No newline at end of file diff --git a/semag/emulatorjs/data/localization/pt-BR.json b/semag/emulatorjs/data/localization/pt-BR.json index 44338b2d..2d495e44 100644 --- a/semag/emulatorjs/data/localization/pt-BR.json +++ b/semag/emulatorjs/data/localization/pt-BR.json @@ -1,361 +1,361 @@ -{ - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7", - "8": "8", - "9": "9", - "10": "10", - "11": "11", - "12": "12", - "13": "13", - "14": "14", - "15": "15", - "Restart": "Reset", - "Pause": "Pausar", - "Play": "Jogar", - "Save State": "Armazenar Save State", - "Load State": "Carregar Save State", - "Control Settings": "Configurações do Controle", - "Cheats": "Trapaças", - "Cache Manager": "Gerenciador de cache", - "Export Save File": "Armazenar Save State", - "Import Save File": "Carregar Save State", - "Netplay": "Netplay", - "Mute": "Mudo", - "Unmute": "Desmutar", - "Settings": "Ajustes", - "Enter Fullscreen": "Tela cheia", - "Exit Fullscreen": "Sair da tela cheia", - "Reset": "Resetar", - "Clear": "Limpar", - "Close": "Fechar", - "QUICK SAVE STATE": "ARMAZENAR SAVE STATE RAPIDAMENTE", - "QUICK LOAD STATE": "CARREGAR SAVE STATE RAPIDAMENTE", - "CHANGE STATE SLOT": "TROCAR SLOT DO SAVE STATE", - "FAST FORWARD": "AVANÇO RÁPIDO", - "Player": "Jogador", - "Connected Gamepad": "Controle conectado", - "Gamepad": "Controle", - "Keyboard": "Teclado", - "Set": "Definir", - "Add Cheat": "Adicionar Trapaça", - "Create a Room": "Criar uma Sala", - "Rooms": "Salas", - "Start Game": "Jogar", - "Loading...": "Carregando", - "Download Game Core": "Carregando emulador do videogame", - "Decompress Game Core": "Descompactando emulador do videogame", - "Download Game Data": "Carregando dados do jogo", - "Decompress Game Data": "Descompactando dados do jogo", - "Shaders": "Sombreamento", - "Disabled": "Desativado", - "2xScaleHQ": "2xScaleHQ", - "4xScaleHQ": "4xScaleHQ", - "CRT easymode": "CRT easymode", - "CRT aperture": "CRT aperture", - "CRT geom": "CRT geom", - "CRT mattias": "CRT mattias", - "FPS": "FPS", - "show": "mostrar", - "hide": "ocultar", - "Fast Forward Ratio": "Taxa de avanço rápido", - "Fast Forward": "Avanço rápido", - "Enabled": "Ativado", - "Save State Slot": "Slot do Save State", - "Save State Location": "Local do Save State", - "Download": "Download", - "Keep in Browser": "Manter no Browser", - "Auto": "Auto", - "NTSC": "NTSC", - "PAL": "PAL", - "Dendy": "Dendy", - "8:7 PAR": "8:7 PAR", - "4:3": "4:3", - "Low": "Baixo", - "High": "Alto", - "Very High": "Muito alto", - "None": "Nenhum", - "Player 1": "Jogador 1", - "Player 2": "Jogador 2", - "Both": "Ambos", - "SAVED STATE TO SLOT": "SAVE STATE ARMAZENDO NO SLOT", - "LOADED STATE FROM SLOT": "SAVE STATE CARREGADO DO SLOT", - "SET SAVE STATE SLOT TO": "SAVE STATE DEFINIDO PARA SLOT", - "Network Error": "Erro de rede", - "Submit": "Enviar", - "Description": "Descrição", - "Code": "Código", - "Add Cheat Code": "Adicionar trapaça", - "Leave Room": "Sair da sala", - "Password": "Senha", - "Password (optional)": "Senha (opcional)", - "Max Players": "Max de Jogadores", - "Room Name": "Nome da Sala", - "Join": "Entrar", - "Player Name": "Nome do Jogador", - "Set Player Name": "Definir nome do Jogador", - "Left Handed Mode": "Modo canhoto", - "Virtual Gamepad": "Controle virtual", - "Disk": "Disco", - "Press Keyboard": "Pressione uma tecla", - "INSERT COIN": "Insira uma ficha", - "Remove": "Remover", - "SAVE LOADED FROM BROWSER": "SAVE STATE CARREGADO DO BROWSER", - "SAVE SAVED TO BROWSER": "SAVE STATE ARMAZENADO NO BROWSER", - "Join the discord": "Participar do discord", - "View on GitHub": "Ver no GitHub", - "Failed to start game": "Falha ao iniciar o jogo", - "Download Game BIOS": "Carregando bios do videogame", - "Decompress Game BIOS": "Descompactando bios do videogame", - "Download Game Parent": "Carregando arquivo principal do jogo", - "Decompress Game Parent": "Descompactando arquivo principal do jogo", - "Download Game Patch": "Carregando Patch do jogo", - "Decompress Game Patch": "Descompactando Patch do Jogo", - "Download Game State": "Carregando Save State", - "Check console": "Verificar videogame", - "Error for site owner": "Erro para proprietário do site", - "EmulatorJS": "EmulatorJS", - "Clear All": "Limpar todos", - "Take Screenshot": "Capturar tela", - "Quick Save": "Salvar rapidamente", - "Quick Load": "Carregar Rapidmente", - "REWIND": "RETROCEDER", - "Rewind Enabled (requires restart)": "Camera lenta ativada(Necessário reiniciar)", - "Rewind Granularity": "Granularidade do retrocesso", - "Slow Motion Ratio": "Taxa de camera lenta", - "Slow Motion": "Camera lenta", - "Home": "Ínicio", - "EmulatorJS License": "Licença do EmulatorJS", - "RetroArch License": "Licença do RetroArch", - "SLOW MOTION": "CAMERA LENTA", - "A": "A", - "B": "B", - "SELECT": "SELECT", - "START": "START", - "UP": "CIMA", - "DOWN": "BAIXO", - "LEFT": "ESQUERDA", - "RIGHT": "DIREITA", - "X": "X", - "Y": "Y", - "L": "ESQ", - "R": "DIR", - "Z": "Z", - "STICK UP": "ANALÓGICO - CIMA", - "STICK DOWN": "ANALÓGICO - BAIXO", - "STICK LEFT": "ANALÓGICO - ESQUERDA", - "STICK RIGHT": "ANALÓGICO - DIREITA", - "C-PAD UP": "DIRECIONAL - CIMA", - "C-PAD DOWN": "DIRECIONAL - BAIXO", - "C-PAD LEFT": "DIRECIONAL - ESQUERDA", - "C-PAD RIGHT": "DIRECIONAL - DIREITA", - "MICROPHONE": "MICROFONE", - "BUTTON 1 / START": "BOTÃO 1 / START", - "BUTTON 2": "BOTÃO 2", - "BUTTON": "BOTÃO", - "LEFT D-PAD UP": "DIRECIONAL ESQUERDO - CIMA", - "LEFT D-PAD DOWN": "DIRECIONAL ESQUERDO - BAIXO", - "LEFT D-PAD LEFT": "DIRECIONAL ESQUERDO - ESQUERDA", - "LEFT D-PAD RIGHT": "DIRECIONAL ESQUERDO - DIREITA", - "RIGHT D-PAD UP": "DIRECIONAL DIREITO - CIMA", - "RIGHT D-PAD DOWN": "DIRECIONAL DIREITO - BAIXO", - "RIGHT D-PAD LEFT": "DIRECIONAL DIREITO - ESQUERDA", - "RIGHT D-PAD RIGHT": "DIRECIONAL DIREITO - DIREITA", - "C": "C", - "MODE": "MODO", - "Mode": "Modo", - "FIRE": "ATIRA", - "RESET": "RESET", - "LEFT DIFFICULTY A": "DIFICULDADE DA ESQUERDA - NÍVEL A", - "LEFT DIFFICULTY B": "DIFICULDADE DA ESQUERDA - NÍVEL B", - "RIGHT DIFFICULTY A": "DIFICULDADE DA DIREITA - NÍVEL A", - "RIGHT DIFFICULTY B": "DIFICULDADE DA DIREITA - NÍVEL B", - "COLOR": "COLORIDO", - "B/W": "PRETO E BRANCO", - "PAUSE": "PAUSAR", - "OPTION": "OPÇÃO", - "OPTION 1": "OPÇÃO 1", - "OPTION 2": "OPÇÃO 2", - "L2": "ESQ 2", - "R2": "DIR 2", - "L3": "ESQ 3", - "R3": "DIR 3", - "L STICK UP": "ANALÓGICO ESQ - CIMA", - "L STICK DOWN": "ANALÓGICO ESQ - BAIXO", - "L STICK LEFT": "ANALÓGICO ESQ - ESQUERDA", - "L STICK RIGHT": "ANALÓGICO ESQ -DIREITA", - "R STICK UP": "ANALÓGICO DIR - CIMA", - "R STICK DOWN": "ANALÓGICO DIR - BAIXO", - "R STICK LEFT": "ANALÓGICO DIR - ESQUERDA", - "R STICK RIGHT": "ANALÓGICO DIR - DIREITA", - "Start": "Start", - "Select": "Select", - "Fast": "Rápido", - "Slow": "Lento", - "a": "a", - "b": "b", - "c": "c", - "d": "d", - "e": "e", - "f": "f", - "g": "g", - "h": "h", - "i": "i", - "j": "j", - "k": "k", - "l": "l", - "m": "m", - "n": "n", - "o": "o", - "p": "p", - "q": "q", - "r": "r", - "s": "s", - "t": "t", - "u": "u", - "v": "v", - "w": "c", - "x": "x", - "y": "y", - "z": "z", - "enter": "enter", - "escape": "esc", - "space": "espaço", - "tab": "tab", - "backspace": "retorna", - "delete": "delete", - "arrowup": "seta para cima", - "arrowdown": "seta para baixo", - "arrowleft": "seta para a esquerda", - "arrowright": "seta para a direita", - "f1": "f1", - "f2": "f2", - "f3": "f3", - "f4": "f4", - "f5": "f5", - "f6": "f6", - "f7": "f7", - "f8": "f8", - "f9": "f9", - "f10": "f10", - "f11": "f11", - "f12": "f12", - "shift": "shift", - "control": "control", - "alt": "alt", - "meta": "meta", - "capslock": "Caps Lock", - "insert": "inserir", - "home": "home", - "end": "end", - "pageup": "subir página", - "pagedown": "descer página", - "!": "!", - "@": "@", - "#": "#", - "$": "$", - "%": "%", - "^": "^", - "&": "&", - "*": "*", - "(": "(", - ")": ")", - "-": "-", - "_": "_", - "+": "+", - "=": "=", - "[": "[", - "]": "]", - "{": "{", - "}": "}", - ";": ";", - ":": ":", - "'": "'", - "\"": "\"", - ",": ",", - ".": ".", - "<": "<", - ">": ">", - "/": "/", - "?": "?", - "LEFT_STICK_X": "ANALÓGICO ESQUERDO - EIXO HORIZONTAL", - "LEFT_STICK_Y": "ANALÓGICO ESQUERDO - EIXO VERTICAL", - "RIGHT_STICK_X": "ANALÓGICO DIREITO - EIXO HORIZONTAL", - "RIGHT_STICK_Y": "ANALÓGICO DIREITO - EIXO VERTICAL", - "LEFT_TRIGGER": "GATILHO ESQUERDO", - "RIGHT_TRIGGER": "GATILHO ESQUERDO", - "A_BUTTON": "BOTÃO A", - "B_BUTTON": "BOTÃO B", - "X_BUTTON": "BOTÃO X", - "Y_BUTTON": "BOTÃO Y", - "START_BUTTON": "BOTÃO START", - "SELECT_BUTTON": "BOTÃO SELECT", - "L1_BUTTON": "BOTÃO ESQ 1", - "R1_BUTTON": "BOTÃO DIR 1", - "L2_BUTTON": "BOTÃO ESQ 2", - "R2_BUTTON": "BOTÃO DIR 2", - "LEFT_THUMB_BUTTON": "BOTÃO DO ANALÓGICO ESQUERDO", - "RIGHT_THUMB_BUTTON": "BOTÃO DO ANALÓGICO DIREITO", - "DPAD_UP": "DIRECIONAL - CIMA", - "DPAD_DOWN": "DIRECIONAL - BAIXO", - "DPAD_LEFT": "DIRECIONAL - ESQUERDA", - "DPAD_RIGHT": "DIRECIONAL - DIREITA", - "genesis plus gx frameskip threshold": "genesis plus gx - limite de pulo de quadros", - "genesis plus gx lowpass range": "genesis plus gx - alcance do passa-baixa", - "genesis plus gx psg preamp": "genesis plus gx - psg pré-amplificador", - "genesis plus gx fm preamp": "genesis plus gx - pré-amplificador fm", - "genesis plus gx cdda volume": "genesis plus gx - cdda volume", - "genesis plus gx pcm volume": "genesis plus gx - pcm volume", - "genesis plus gx audio eq low": "genesis plus gx - eq áudio baixo", - "genesis plus gx audio eq mid": "genesis plus gx - eq áudio medio", - "genesis plus gx audio eq high": "genesis plus gx - eq áudio alto", - "genesis plus gx enhanced vscroll limit": "genesis plus gx - limite de rolagem vertical aprimorada", - "genesis plus gx psg channel 0 volume": "genesis plus gx - psg channel 0 volume", - "genesis plus gx psg channel 1 volume": "genesis plus gx - psg channel 1 volume", - "genesis plus gx psg channel 2 volume": "genesis plus gx - psg channel 2 volume", - "genesis plus gx psg channel 3 volume": "genesis plus gx - psg channel 3 volume", - "genesis plus gx md channel 0 volume": "genesis plus gx - md channel 0 volume", - "genesis plus gx md channel 1 volume": "genesis plus gx - md channel 1 volume", - "genesis plus gx md channel 2 volume": "genesis plus gx - md channel 2 volume", - "genesis plus gx md channel 3 volume": "genesis plus gx - md channel 3 volume", - "genesis plus gx md channel 4 volume": "genesis plus gx - md channel 4 volume", - "genesis plus gx md channel 5 volume": "genesis plus gx - md channel 5 volume", - "genesis plus gx sms fm channel 0 volume": "genesis plus gx - sms fm channel 0 volume", - "genesis plus gx sms fm channel 1 volume": "genesis plus gx - sms fm channel 1 volume", - "genesis plus gx sms fm channel 2 volume": "genesis plus gx - sms fm channel 2 volume", - "genesis plus gx sms fm channel 3 volume": "genesis plus gx - sms fm channel 3 volume", - "genesis plus gx sms fm channel 4 volume": "genesis plus gx - sms fm channel 4 volume", - "genesis plus gx sms fm channel 5 volume": "genesis plus gx - sms fm channel 5 volume", - "genesis plus gx sms fm channel 6 volume": "genesis plus gx - sms fm channel 6 volume", - "genesis plus gx sms fm channel 7 volume": "genesis plus gx - sms fm channel 7 volume", - "genesis plus gx sms fm channel 8 volume": "genesis plus gx - sms fm channel 8 volume", - "stella2014 stelladaptor analog sensitivity": "stella2014 - Sensibilidade do Analógico", - "stella2014 stelladaptor analog center": "stella2014 - Centro do Analógico", - "1.0x (12.50Mhz)": "1.0x (12.50Mhz)", - "1.1x (13.75Mhz)": "1.1x (13.75Mhz)", - "1.2x (15.00Mhz)": "1.2x (15.00Mhz)", - "1.5x (18.75Mhz)": "1.5x (18.75Mhz)", - "1.6x (20.00Mhz)": "1.6x (20.00Mhz)", - "1.8x (22.50Mhz)": "1.8x (22.50Mhz)", - "2.0x (25.00Mhz)": "2.0x (25.00Mhz)", - "opera cpu overclock": "Overclock do cpu Opera", - "0RGB1555": "0RGB1555", - "RGB565": "RGB565", - "XRGB8888": "XRGB8888", - "opera vdlp pixel format": "Formato vdlp do pixel Opera", - "opera nvram version": "Versão da nvram do Opera", - "opera active devices": "Dispositivos Opera ativados", - "pcsx rearmed psxclock": "pcsx rearmed - psxclock", - "pcsx rearmed frameskip threshold": "pcsx rearmed - limite de pulo de quadros", - "pcsx rearmed frameskip interval": "pcsx rearmed - intervalo de pulo de quadros", - "pcsx rearmed input sensitivity": "pcsx rearmed - sensibilidade de entrada", - "pcsx rearmed gunconadjustx": "pcsx rearmed - gunconadjustx", - "pcsx rearmed gunconadjusty": "pcsx rearmed - gunconadjusty", - "pcsx rearmed gunconadjustratiox": "pcsx rearmed - gunconadjustratiox", - "pcsx rearmed gunconadjustratioy": "pcsx rearmed - gunconadjustratioy" -} +{ + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7", + "8": "8", + "9": "9", + "10": "10", + "11": "11", + "12": "12", + "13": "13", + "14": "14", + "15": "15", + "Restart": "Reset", + "Pause": "Pausar", + "Play": "Jogar", + "Save State": "Armazenar Save State", + "Load State": "Carregar Save State", + "Control Settings": "Configurações do Controle", + "Cheats": "Trapaças", + "Cache Manager": "Gerenciador de cache", + "Export Save File": "Armazenar Save State", + "Import Save File": "Carregar Save State", + "Netplay": "Netplay", + "Mute": "Mudo", + "Unmute": "Desmutar", + "Settings": "Ajustes", + "Enter Fullscreen": "Tela cheia", + "Exit Fullscreen": "Sair da tela cheia", + "Reset": "Resetar", + "Clear": "Limpar", + "Close": "Fechar", + "QUICK SAVE STATE": "ARMAZENAR SAVE STATE RAPIDAMENTE", + "QUICK LOAD STATE": "CARREGAR SAVE STATE RAPIDAMENTE", + "CHANGE STATE SLOT": "TROCAR SLOT DO SAVE STATE", + "FAST FORWARD": "AVANÇO RÁPIDO", + "Player": "Jogador", + "Connected Gamepad": "Controle conectado", + "Gamepad": "Controle", + "Keyboard": "Teclado", + "Set": "Definir", + "Add Cheat": "Adicionar Trapaça", + "Create a Room": "Criar uma Sala", + "Rooms": "Salas", + "Start Game": "Jogar", + "Loading...": "Carregando", + "Download Game Core": "Carregando emulador do videogame", + "Decompress Game Core": "Descompactando emulador do videogame", + "Download Game Data": "Carregando dados do jogo", + "Decompress Game Data": "Descompactando dados do jogo", + "Shaders": "Sombreamento", + "Disabled": "Desativado", + "2xScaleHQ": "2xScaleHQ", + "4xScaleHQ": "4xScaleHQ", + "CRT easymode": "CRT easymode", + "CRT aperture": "CRT aperture", + "CRT geom": "CRT geom", + "CRT mattias": "CRT mattias", + "FPS": "FPS", + "show": "mostrar", + "hide": "ocultar", + "Fast Forward Ratio": "Taxa de avanço rápido", + "Fast Forward": "Avanço rápido", + "Enabled": "Ativado", + "Save State Slot": "Slot do Save State", + "Save State Location": "Local do Save State", + "Download": "Download", + "Keep in Browser": "Manter no Browser", + "Auto": "Auto", + "NTSC": "NTSC", + "PAL": "PAL", + "Dendy": "Dendy", + "8:7 PAR": "8:7 PAR", + "4:3": "4:3", + "Low": "Baixo", + "High": "Alto", + "Very High": "Muito alto", + "None": "Nenhum", + "Player 1": "Jogador 1", + "Player 2": "Jogador 2", + "Both": "Ambos", + "SAVED STATE TO SLOT": "SAVE STATE ARMAZENDO NO SLOT", + "LOADED STATE FROM SLOT": "SAVE STATE CARREGADO DO SLOT", + "SET SAVE STATE SLOT TO": "SAVE STATE DEFINIDO PARA SLOT", + "Network Error": "Erro de rede", + "Submit": "Enviar", + "Description": "Descrição", + "Code": "Código", + "Add Cheat Code": "Adicionar trapaça", + "Leave Room": "Sair da sala", + "Password": "Senha", + "Password (optional)": "Senha (opcional)", + "Max Players": "Max de Jogadores", + "Room Name": "Nome da Sala", + "Join": "Entrar", + "Player Name": "Nome do Jogador", + "Set Player Name": "Definir nome do Jogador", + "Left Handed Mode": "Modo canhoto", + "Virtual Gamepad": "Controle virtual", + "Disk": "Disco", + "Press Keyboard": "Pressione uma tecla", + "INSERT COIN": "Insira uma ficha", + "Remove": "Remover", + "SAVE LOADED FROM BROWSER": "SAVE STATE CARREGADO DO BROWSER", + "SAVE SAVED TO BROWSER": "SAVE STATE ARMAZENADO NO BROWSER", + "Join the discord": "Participar do discord", + "View on GitHub": "Ver no GitHub", + "Failed to start game": "Falha ao iniciar o jogo", + "Download Game BIOS": "Carregando bios do videogame", + "Decompress Game BIOS": "Descompactando bios do videogame", + "Download Game Parent": "Carregando arquivo principal do jogo", + "Decompress Game Parent": "Descompactando arquivo principal do jogo", + "Download Game Patch": "Carregando Patch do jogo", + "Decompress Game Patch": "Descompactando Patch do Jogo", + "Download Game State": "Carregando Save State", + "Check console": "Verificar videogame", + "Error for site owner": "Erro para proprietário do site", + "EmulatorJS": "EmulatorJS", + "Clear All": "Limpar todos", + "Take Screenshot": "Capturar tela", + "Quick Save": "Salvar rapidamente", + "Quick Load": "Carregar Rapidmente", + "REWIND": "RETROCEDER", + "Rewind Enabled (requires restart)": "Camera lenta ativada(Necessário reiniciar)", + "Rewind Granularity": "Granularidade do retrocesso", + "Slow Motion Ratio": "Taxa de camera lenta", + "Slow Motion": "Camera lenta", + "Home": "Ínicio", + "EmulatorJS License": "Licença do EmulatorJS", + "RetroArch License": "Licença do RetroArch", + "SLOW MOTION": "CAMERA LENTA", + "A": "A", + "B": "B", + "SELECT": "SELECT", + "START": "START", + "UP": "CIMA", + "DOWN": "BAIXO", + "LEFT": "ESQUERDA", + "RIGHT": "DIREITA", + "X": "X", + "Y": "Y", + "L": "ESQ", + "R": "DIR", + "Z": "Z", + "STICK UP": "ANALÓGICO - CIMA", + "STICK DOWN": "ANALÓGICO - BAIXO", + "STICK LEFT": "ANALÓGICO - ESQUERDA", + "STICK RIGHT": "ANALÓGICO - DIREITA", + "C-PAD UP": "DIRECIONAL - CIMA", + "C-PAD DOWN": "DIRECIONAL - BAIXO", + "C-PAD LEFT": "DIRECIONAL - ESQUERDA", + "C-PAD RIGHT": "DIRECIONAL - DIREITA", + "MICROPHONE": "MICROFONE", + "BUTTON 1 / START": "BOTÃO 1 / START", + "BUTTON 2": "BOTÃO 2", + "BUTTON": "BOTÃO", + "LEFT D-PAD UP": "DIRECIONAL ESQUERDO - CIMA", + "LEFT D-PAD DOWN": "DIRECIONAL ESQUERDO - BAIXO", + "LEFT D-PAD LEFT": "DIRECIONAL ESQUERDO - ESQUERDA", + "LEFT D-PAD RIGHT": "DIRECIONAL ESQUERDO - DIREITA", + "RIGHT D-PAD UP": "DIRECIONAL DIREITO - CIMA", + "RIGHT D-PAD DOWN": "DIRECIONAL DIREITO - BAIXO", + "RIGHT D-PAD LEFT": "DIRECIONAL DIREITO - ESQUERDA", + "RIGHT D-PAD RIGHT": "DIRECIONAL DIREITO - DIREITA", + "C": "C", + "MODE": "MODO", + "Mode": "Modo", + "FIRE": "ATIRA", + "RESET": "RESET", + "LEFT DIFFICULTY A": "DIFICULDADE DA ESQUERDA - NÍVEL A", + "LEFT DIFFICULTY B": "DIFICULDADE DA ESQUERDA - NÍVEL B", + "RIGHT DIFFICULTY A": "DIFICULDADE DA DIREITA - NÍVEL A", + "RIGHT DIFFICULTY B": "DIFICULDADE DA DIREITA - NÍVEL B", + "COLOR": "COLORIDO", + "B/W": "PRETO E BRANCO", + "PAUSE": "PAUSAR", + "OPTION": "OPÇÃO", + "OPTION 1": "OPÇÃO 1", + "OPTION 2": "OPÇÃO 2", + "L2": "ESQ 2", + "R2": "DIR 2", + "L3": "ESQ 3", + "R3": "DIR 3", + "L STICK UP": "ANALÓGICO ESQ - CIMA", + "L STICK DOWN": "ANALÓGICO ESQ - BAIXO", + "L STICK LEFT": "ANALÓGICO ESQ - ESQUERDA", + "L STICK RIGHT": "ANALÓGICO ESQ -DIREITA", + "R STICK UP": "ANALÓGICO DIR - CIMA", + "R STICK DOWN": "ANALÓGICO DIR - BAIXO", + "R STICK LEFT": "ANALÓGICO DIR - ESQUERDA", + "R STICK RIGHT": "ANALÓGICO DIR - DIREITA", + "Start": "Start", + "Select": "Select", + "Fast": "Rápido", + "Slow": "Lento", + "a": "a", + "b": "b", + "c": "c", + "d": "d", + "e": "e", + "f": "f", + "g": "g", + "h": "h", + "i": "i", + "j": "j", + "k": "k", + "l": "l", + "m": "m", + "n": "n", + "o": "o", + "p": "p", + "q": "q", + "r": "r", + "s": "s", + "t": "t", + "u": "u", + "v": "v", + "w": "c", + "x": "x", + "y": "y", + "z": "z", + "enter": "enter", + "escape": "esc", + "space": "espaço", + "tab": "tab", + "backspace": "retorna", + "delete": "delete", + "arrowup": "seta para cima", + "arrowdown": "seta para baixo", + "arrowleft": "seta para a esquerda", + "arrowright": "seta para a direita", + "f1": "f1", + "f2": "f2", + "f3": "f3", + "f4": "f4", + "f5": "f5", + "f6": "f6", + "f7": "f7", + "f8": "f8", + "f9": "f9", + "f10": "f10", + "f11": "f11", + "f12": "f12", + "shift": "shift", + "control": "control", + "alt": "alt", + "meta": "meta", + "capslock": "Caps Lock", + "insert": "inserir", + "home": "home", + "end": "end", + "pageup": "subir página", + "pagedown": "descer página", + "!": "!", + "@": "@", + "#": "#", + "$": "$", + "%": "%", + "^": "^", + "&": "&", + "*": "*", + "(": "(", + ")": ")", + "-": "-", + "_": "_", + "+": "+", + "=": "=", + "[": "[", + "]": "]", + "{": "{", + "}": "}", + ";": ";", + ":": ":", + "'": "'", + "\"": "\"", + ",": ",", + ".": ".", + "<": "<", + ">": ">", + "/": "/", + "?": "?", + "LEFT_STICK_X": "ANALÓGICO ESQUERDO - EIXO HORIZONTAL", + "LEFT_STICK_Y": "ANALÓGICO ESQUERDO - EIXO VERTICAL", + "RIGHT_STICK_X": "ANALÓGICO DIREITO - EIXO HORIZONTAL", + "RIGHT_STICK_Y": "ANALÓGICO DIREITO - EIXO VERTICAL", + "LEFT_TRIGGER": "GATILHO ESQUERDO", + "RIGHT_TRIGGER": "GATILHO ESQUERDO", + "A_BUTTON": "BOTÃO A", + "B_BUTTON": "BOTÃO B", + "X_BUTTON": "BOTÃO X", + "Y_BUTTON": "BOTÃO Y", + "START_BUTTON": "BOTÃO START", + "SELECT_BUTTON": "BOTÃO SELECT", + "L1_BUTTON": "BOTÃO ESQ 1", + "R1_BUTTON": "BOTÃO DIR 1", + "L2_BUTTON": "BOTÃO ESQ 2", + "R2_BUTTON": "BOTÃO DIR 2", + "LEFT_THUMB_BUTTON": "BOTÃO DO ANALÓGICO ESQUERDO", + "RIGHT_THUMB_BUTTON": "BOTÃO DO ANALÓGICO DIREITO", + "DPAD_UP": "DIRECIONAL - CIMA", + "DPAD_DOWN": "DIRECIONAL - BAIXO", + "DPAD_LEFT": "DIRECIONAL - ESQUERDA", + "DPAD_RIGHT": "DIRECIONAL - DIREITA", + "genesis plus gx frameskip threshold": "genesis plus gx - limite de pulo de quadros", + "genesis plus gx lowpass range": "genesis plus gx - alcance do passa-baixa", + "genesis plus gx psg preamp": "genesis plus gx - psg pré-amplificador", + "genesis plus gx fm preamp": "genesis plus gx - pré-amplificador fm", + "genesis plus gx cdda volume": "genesis plus gx - cdda volume", + "genesis plus gx pcm volume": "genesis plus gx - pcm volume", + "genesis plus gx audio eq low": "genesis plus gx - eq áudio baixo", + "genesis plus gx audio eq mid": "genesis plus gx - eq áudio medio", + "genesis plus gx audio eq high": "genesis plus gx - eq áudio alto", + "genesis plus gx enhanced vscroll limit": "genesis plus gx - limite de rolagem vertical aprimorada", + "genesis plus gx psg channel 0 volume": "genesis plus gx - psg channel 0 volume", + "genesis plus gx psg channel 1 volume": "genesis plus gx - psg channel 1 volume", + "genesis plus gx psg channel 2 volume": "genesis plus gx - psg channel 2 volume", + "genesis plus gx psg channel 3 volume": "genesis plus gx - psg channel 3 volume", + "genesis plus gx md channel 0 volume": "genesis plus gx - md channel 0 volume", + "genesis plus gx md channel 1 volume": "genesis plus gx - md channel 1 volume", + "genesis plus gx md channel 2 volume": "genesis plus gx - md channel 2 volume", + "genesis plus gx md channel 3 volume": "genesis plus gx - md channel 3 volume", + "genesis plus gx md channel 4 volume": "genesis plus gx - md channel 4 volume", + "genesis plus gx md channel 5 volume": "genesis plus gx - md channel 5 volume", + "genesis plus gx sms fm channel 0 volume": "genesis plus gx - sms fm channel 0 volume", + "genesis plus gx sms fm channel 1 volume": "genesis plus gx - sms fm channel 1 volume", + "genesis plus gx sms fm channel 2 volume": "genesis plus gx - sms fm channel 2 volume", + "genesis plus gx sms fm channel 3 volume": "genesis plus gx - sms fm channel 3 volume", + "genesis plus gx sms fm channel 4 volume": "genesis plus gx - sms fm channel 4 volume", + "genesis plus gx sms fm channel 5 volume": "genesis plus gx - sms fm channel 5 volume", + "genesis plus gx sms fm channel 6 volume": "genesis plus gx - sms fm channel 6 volume", + "genesis plus gx sms fm channel 7 volume": "genesis plus gx - sms fm channel 7 volume", + "genesis plus gx sms fm channel 8 volume": "genesis plus gx - sms fm channel 8 volume", + "stella2014 stelladaptor analog sensitivity": "stella2014 - Sensibilidade do Analógico", + "stella2014 stelladaptor analog center": "stella2014 - Centro do Analógico", + "1.0x (12.50Mhz)": "1.0x (12.50Mhz)", + "1.1x (13.75Mhz)": "1.1x (13.75Mhz)", + "1.2x (15.00Mhz)": "1.2x (15.00Mhz)", + "1.5x (18.75Mhz)": "1.5x (18.75Mhz)", + "1.6x (20.00Mhz)": "1.6x (20.00Mhz)", + "1.8x (22.50Mhz)": "1.8x (22.50Mhz)", + "2.0x (25.00Mhz)": "2.0x (25.00Mhz)", + "opera cpu overclock": "Overclock do cpu Opera", + "0RGB1555": "0RGB1555", + "RGB565": "RGB565", + "XRGB8888": "XRGB8888", + "opera vdlp pixel format": "Formato vdlp do pixel Opera", + "opera nvram version": "Versão da nvram do Opera", + "opera active devices": "Dispositivos Opera ativados", + "pcsx rearmed psxclock": "pcsx rearmed - psxclock", + "pcsx rearmed frameskip threshold": "pcsx rearmed - limite de pulo de quadros", + "pcsx rearmed frameskip interval": "pcsx rearmed - intervalo de pulo de quadros", + "pcsx rearmed input sensitivity": "pcsx rearmed - sensibilidade de entrada", + "pcsx rearmed gunconadjustx": "pcsx rearmed - gunconadjustx", + "pcsx rearmed gunconadjusty": "pcsx rearmed - gunconadjusty", + "pcsx rearmed gunconadjustratiox": "pcsx rearmed - gunconadjustratiox", + "pcsx rearmed gunconadjustratioy": "pcsx rearmed - gunconadjustratioy" +} diff --git a/semag/emulatorjs/data/localization/readme.md b/semag/emulatorjs/data/localization/readme.md index 55eafe69..3052db21 100644 --- a/semag/emulatorjs/data/localization/readme.md +++ b/semag/emulatorjs/data/localization/readme.md @@ -1,53 +1,53 @@ - -# Localization - -Supported languages - -`en-US` - English US
    -`pt-BR` - Portuguese
    -`es-ES` - Spanish
    -`el-GR` - Greek
    -`ja-JA` - Japanese
    -`zh-CN` - Chinese
    -`hi-HI` - Hindi
    -`ar-AR` - Arabic
    -`jv-JV` - Javanese
    -`ben-BEN` - Bengali
    -`ru-RU` - Russian
    -`de-GER` - German
    -`ko-KO` - Korean
    -`af-FR` - French
    - -default: `en-US` - - -add the line to your code to use - -``` -EJS_language = ''; //language -``` - -If the language file is not found or there was an error fetching the file, the emulator will default to english. - -## Credits - -Translated for `es-ES` by [@cesarcristianodeoliveira](https://github.com/cesarcristianodeoliveira)
    -Translated for `el-GR` by [@imneckro](https://github.com/imneckro)
    -Translated for `ja-JA`, `hi-HI`, `ar-AR`, `jv-JV`, `ben-BEN`, `ru-RU`, `de-GER`, `ko-KO`, `af-FR` by [@allancoding](https://github.com/allancoding)
    -Translated for `pt-BR` originally by [@allancoding](https://github.com/allancoding) and updated by [@zmarteline](https://github.com/zmarteline)
    -Translated for `zh-CN` originally by [@allancoding](https://github.com/allancoding) and updated by [@eric183](https://github.com/eric183)
    -Translated for `pt-BR` originally by [@allancoding](https://github.com/allancoding) and updated by [@zmarteline](https://github.com/zmarteline)
    - -## Contributing - -Download the default `en.json` file and simply translate all the words that start with the `-` (remove the dash afterwards) then perform a pull request or open an issue with the file uploaded and I will add your work. - -The `retroarch.json` are all the setting names for the menu. They will default to english if not found. You can set `EJS_settingsLanguage` to `true` to see the missing retroarch settings names for the current language. You can translate them and add the to the language file. - -The control maping traslations for controllers are diffrent for each controller. They will need to be added to the language file if they are not in the default `en.json` file. - -You can also use the [Translation Helper](Translate.html) tool to help you translate the file. - -Please contribute!! - -Enything that is incorrect or needs to be fix please perform a pull request! + +# Localization + +Supported languages + +`en-US` - English US
    +`pt-BR` - Portuguese
    +`es-ES` - Spanish
    +`el-GR` - Greek
    +`ja-JA` - Japanese
    +`zh-CN` - Chinese
    +`hi-HI` - Hindi
    +`ar-AR` - Arabic
    +`jv-JV` - Javanese
    +`ben-BEN` - Bengali
    +`ru-RU` - Russian
    +`de-GER` - German
    +`ko-KO` - Korean
    +`af-FR` - French
    + +default: `en-US` + + +add the line to your code to use + +``` +EJS_language = ''; //language +``` + +If the language file is not found or there was an error fetching the file, the emulator will default to english. + +## Credits + +Translated for `es-ES` by [@cesarcristianodeoliveira](https://github.com/cesarcristianodeoliveira)
    +Translated for `el-GR` by [@imneckro](https://github.com/imneckro)
    +Translated for `ja-JA`, `hi-HI`, `ar-AR`, `jv-JV`, `ben-BEN`, `ru-RU`, `de-GER`, `ko-KO`, `af-FR` by [@allancoding](https://github.com/allancoding)
    +Translated for `pt-BR` originally by [@allancoding](https://github.com/allancoding) and updated by [@zmarteline](https://github.com/zmarteline)
    +Translated for `zh-CN` originally by [@allancoding](https://github.com/allancoding) and updated by [@eric183](https://github.com/eric183)
    +Translated for `pt-BR` originally by [@allancoding](https://github.com/allancoding) and updated by [@zmarteline](https://github.com/zmarteline)
    + +## Contributing + +Download the default `en.json` file and simply translate all the words that start with the `-` (remove the dash afterwards) then perform a pull request or open an issue with the file uploaded and I will add your work. + +The `retroarch.json` are all the setting names for the menu. They will default to english if not found. You can set `EJS_settingsLanguage` to `true` to see the missing retroarch settings names for the current language. You can translate them and add the to the language file. + +The control maping traslations for controllers are diffrent for each controller. They will need to be added to the language file if they are not in the default `en.json` file. + +You can also use the [Translation Helper](Translate.html) tool to help you translate the file. + +Please contribute!! + +Enything that is incorrect or needs to be fix please perform a pull request! diff --git a/semag/emulatorjs/data/localization/retroarch.json b/semag/emulatorjs/data/localization/retroarch.json index 4bd1f9b3..bba2ef3e 100644 --- a/semag/emulatorjs/data/localization/retroarch.json +++ b/semag/emulatorjs/data/localization/retroarch.json @@ -1,617 +1,617 @@ -{ - "fceumm region": "-fceumm region", - "fceumm sndquality": "-fceumm sndquality", - "fceumm aspect": "-fceumm aspect", - "fceumm overscan h left": "-fceumm overscan h left", - "fceumm overscan h right": "-fceumm overscan h right", - "fceumm overscan v top": "-fceumm overscan v top", - "fceumm overscan v bottom": "-fceumm overscan v bottom", - "fceumm turbo enable": "-fceumm turbo enable", - "fceumm turbo delay": "-fceumm turbo delay", - "fceumm zapper tolerance": "-fceumm zapper tolerance", - "fceumm mouse sensitivity": "-fceumm mouse sensitivity", - "50%": "-50%", - "60%": "-60%", - "70%": "-70%", - "80%": "-80%", - "90%": "-90%", - "100%": "-100%", - "150%": "-150%", - "200%": "-200%", - "250%": "-250%", - "300%": "-300%", - "350%": "-350%", - "400%": "-400%", - "450%": "-450%", - "500%": "-500%", - "snes9x overclock superfx": "-snes9x overclock superfx", - "snes9x superscope crosshair": "-snes9x superscope crosshair", - "White": "-White", - "White (blend)": "-White (blend)", - "Red": "-Red", - "Red (blend)": "-Red (blend)", - "Orange": "-Orange", - "Orange (blend)": "-Orange (blend)", - "Yellow": "-Yellow", - "Yellow (blend)": "-Yellow (blend)", - "Green": "-Green", - "Green (blend)": "-Green (blend)", - "Cyan": "-Cyan", - "Cyan (blend)": "-Cyan (blend)", - "Sky": "-Sky", - "Sky (blend)": "-Sky (blend)", - "Blue": "-Blue", - "Blue (blend)": "-Blue (blend)", - "Violet": "-Violet", - "Violet (blend)": "-Violet (blend)", - "Pink": "-Pink", - "Pink (blend)": "-Pink (blend)", - "Purple": "-Purple", - "Purple (blend)": "-Purple (blend)", - "Black": "-Black", - "Black (blend)": "-Black (blend)", - "25% Grey": "-25% Grey", - "25% Grey (blend)": "-25% Grey (blend)", - "50% Grey": "-50% Grey", - "50% Grey (blend)": "-50% Grey (blend)", - "75% Grey": "-75% Grey", - "75% Grey (blend)": "-75% Grey (blend)", - "snes9x superscope color": "-snes9x superscope color", - "snes9x justifier1 crosshair": "-snes9x justifier1 crosshair", - "snes9x justifier1 color": "-snes9x justifier1 color", - "snes9x justifier2 crosshair": "-snes9x justifier2 crosshair", - "snes9x justifier2 color": "-snes9x justifier2 color", - "snes9x rifle crosshair": "-snes9x rifle crosshair", - "snes9x rifle color": "-snes9x rifle color", - "1.0x (12.50Mhz)": "-1.0x (12.50Mhz)", - "1.1x (13.75Mhz)": "-1.1x (13.75Mhz)", - "1.2x (15.00Mhz)": "-1.2x (15.00Mhz)", - "1.5x (18.75Mhz)": "-1.5x (18.75Mhz)", - "1.6x (20.00Mhz)": "-1.6x (20.00Mhz)", - "1.8x (22.50Mhz)": "-1.8x (22.50Mhz)", - "2.0x (25.00Mhz)": "-2.0x (25.00Mhz)", - "opera cpu overclock": "-opera cpu overclock", - "0RGB1555": "-0RGB1555", - "RGB565": "-RGB565", - "XRGB8888": "-XRGB8888", - "opera vdlp pixel format": "-opera vdlp pixel format", - "opera nvram version": "-opera nvram version", - "opera active devices": "-opera active devices", - "stella2014 stelladaptor analog sensitivity": "-stella2014 stelladaptor analog sensitivity", - "stella2014 stelladaptor analog center": "-stella2014 stelladaptor analog center", - "handy frameskip threshold": "-handy frameskip threshold", - "320x240": "-320x240", - "640x480": "-640x480", - "960x720": "-960x720", - "1280x960": "-1280x960", - "1440x1080": "-1440x1080", - "1600x1200": "-1600x1200", - "1920x1440": "-1920x1440", - "2240x1680": "-2240x1680", - "2560x1920": "-2560x1920", - "2880x2160": "-2880x2160", - "3200x2400": "-3200x2400", - "3520x2640": "-3520x2640", - "3840x2880": "-3840x2880", - "43screensize": "-43screensize", - "3point": "-3point", - "standard": "-standard", - "BilinearMode": "-BilinearMode", - "MultiSampling": "-MultiSampling", - "FXAA": "-FXAA", - "Software": "-Software", - "FromMem": "-FromMem", - "EnableCopyDepthToRDRAM": "-EnableCopyDepthToRDRAM", - "Stripped": "-Stripped", - "OnePiece": "-OnePiece", - "BackgroundMode": "-BackgroundMode", - "OverscanTop": "-OverscanTop", - "OverscanLeft": "-OverscanLeft", - "OverscanRight": "-OverscanRight", - "OverscanBottom": "-OverscanBottom", - "MaxHiResTxVramLimit": "-MaxHiResTxVramLimit", - "MaxTxCacheSize": "-MaxTxCacheSize", - "Smooth filtering 1": "-Smooth filtering 1", - "Smooth filtering 2": "-Smooth filtering 2", - "Smooth filtering 3": "-Smooth filtering 3", - "Smooth filtering 4": "-Smooth filtering 4", - "Sharp filtering 1": "-Sharp filtering 1", - "Sharp filtering 2": "-Sharp filtering 2", - "txFilterMode": "-txFilterMode", - "As Is": "-As Is", - "X2": "-X2", - "X2SAI": "-X2SAI", - "HQ2X": "-HQ2X", - "HQ2XS": "-HQ2XS", - "LQ2X": "-LQ2X", - "LQ2XS": "-LQ2XS", - "HQ4X": "-HQ4X", - "2xBRZ": "-2xBRZ", - "3xBRZ": "-3xBRZ", - "4xBRZ": "-4xBRZ", - "5xBRZ": "-5xBRZ", - "6xBRZ": "-6xBRZ", - "txEnhancementMode": "-txEnhancementMode", - "Original": "-Original", - "Fullspeed": "-Fullspeed", - "Framerate": "-Framerate", - "virefresh": "-virefresh", - "CountPerOp": "-CountPerOp", - "CountPerOpDenomPot": "-CountPerOpDenomPot", - "deadzone": "-deadzone", - "sensitivity": "-sensitivity", - "C1": "-C1", - "C2": "-C2", - "C3": "-C3", - "C4": "-C4", - "cbutton": "-cbutton", - "none": "-none", - "memory": "-memory", - "rumble": "-rumble", - "transfer": "-transfer", - "pak1": "-pak1", - "pak2": "-pak2", - "pak3": "-pak3", - "pak4": "-pak4", - "Autodetect": "-Autodetect", - "Game Boy": "-Game Boy", - "Super Game Boy": "-Super Game Boy", - "Game Boy Color": "-Game Boy Color", - "Game Boy Advance": "-Game Boy Advance", - "mgba gb model": "-mgba gb model", - "ON": "-ON", - "OFF": "-OFF", - "mgba use bios": "-mgba use bios", - "mgba skip bios": "-mgba skip bios", - "Grayscale": "-Grayscale", - "DMG Green": "-DMG Green", - "GB Pocket": "-GB Pocket", - "GB Light": "-GB Light", - "GBC Brown ↑": "-GBC Brown ↑", - "GBC Red ↑A": "-GBC Red ↑A", - "GBC Dark Brown ↑B": "-GBC Dark Brown ↑B", - "GBC Pale Yellow ↓": "-GBC Pale Yellow ↓", - "GBC Orange ↓A": "-GBC Orange ↓A", - "GBC Yellow ↓B": "-GBC Yellow ↓B", - "GBC Blue ←": "-GBC Blue ←", - "GBC Dark Blue ←A": "-GBC Dark Blue ←A", - "GBC Gray ←B": "-GBC Gray ←B", - "GBC Green →": "-GBC Green →", - "GBC Dark Green →A": "-GBC Dark Green →A", - "GBC Reverse →B": "-GBC Reverse →B", - "SGB 1-A": "-SGB 1-A", - "SGB 1-B": "-SGB 1-B", - "SGB 1-C": "-SGB 1-C", - "SGB 1-D": "-SGB 1-D", - "SGB 1-E": "-SGB 1-E", - "SGB 1-F": "-SGB 1-F", - "SGB 1-G": "-SGB 1-G", - "SGB 1-H": "-SGB 1-H", - "SGB 2-A": "-SGB 2-A", - "SGB 2-B": "-SGB 2-B", - "SGB 2-C": "-SGB 2-C", - "SGB 2-D": "-SGB 2-D", - "SGB 2-E": "-SGB 2-E", - "SGB 2-F": "-SGB 2-F", - "SGB 2-G": "-SGB 2-G", - "SGB 2-H": "-SGB 2-H", - "SGB 3-A": "-SGB 3-A", - "SGB 3-B": "-SGB 3-B", - "SGB 3-C": "-SGB 3-C", - "SGB 3-D": "-SGB 3-D", - "SGB 3-E": "-SGB 3-E", - "SGB 3-F": "-SGB 3-F", - "SGB 3-G": "-SGB 3-G", - "SGB 3-H": "-SGB 3-H", - "SGB 4-A": "-SGB 4-A", - "SGB 4-B": "-SGB 4-B", - "SGB 4-C": "-SGB 4-C", - "SGB 4-D": "-SGB 4-D", - "SGB 4-E": "-SGB 4-E", - "SGB 4-F": "-SGB 4-F", - "SGB 4-G": "-SGB 4-G", - "SGB 4-H": "-SGB 4-H", - "mgba gb colors": "-mgba gb colors", - "mgba sgb borders": "-mgba sgb borders", - "mgba color correction": "-mgba color correction", - "mgba solar sensor level": "-mgba solar sensor level", - "mgba force gbp": "-mgba force gbp", - "Remove Known": "-Remove Known", - "Detect and Remove": "-Detect and Remove", - "Don't Remove": "-Don't Remove", - "mgba idle optimization": "-mgba idle optimization", - "mgba frameskip threshold": "-mgba frameskip threshold", - "mgba frameskip interval": "-mgba frameskip interval", - "GB - DMG": "-GB - DMG", - "GB - Pocket": "-GB - Pocket", - "GB - Light": "-GB - Light", - "GBC - Blue": "-GBC - Blue", - "GBC - Brown": "-GBC - Brown", - "GBC - Dark Blue": "-GBC - Dark Blue", - "GBC - Dark Brown": "-GBC - Dark Brown", - "GBC - Dark Green": "-GBC - Dark Green", - "GBC - Grayscale": "-GBC - Grayscale", - "GBC - Green": "-GBC - Green", - "GBC - Inverted": "-GBC - Inverted", - "GBC - Orange": "-GBC - Orange", - "GBC - Pastel Mix": "-GBC - Pastel Mix", - "GBC - Red": "-GBC - Red", - "GBC - Yellow": "-GBC - Yellow", - "SGB - 1A": "-SGB - 1A", - "SGB - 1B": "-SGB - 1B", - "SGB - 1C": "-SGB - 1C", - "SGB - 1D": "-SGB - 1D", - "SGB - 1E": "-SGB - 1E", - "SGB - 1F": "-SGB - 1F", - "SGB - 1G": "-SGB - 1G", - "SGB - 1H": "-SGB - 1H", - "SGB - 2A": "-SGB - 2A", - "SGB - 2B": "-SGB - 2B", - "SGB - 2C": "-SGB - 2C", - "SGB - 2D": "-SGB - 2D", - "SGB - 2E": "-SGB - 2E", - "SGB - 2F": "-SGB - 2F", - "SGB - 2G": "-SGB - 2G", - "SGB - 2H": "-SGB - 2H", - "SGB - 3A": "-SGB - 3A", - "SGB - 3B": "-SGB - 3B", - "SGB - 3C": "-SGB - 3C", - "SGB - 3D": "-SGB - 3D", - "SGB - 3E": "-SGB - 3E", - "SGB - 3F": "-SGB - 3F", - "SGB - 3G": "-SGB - 3G", - "SGB - 3H": "-SGB - 3H", - "SGB - 4A": "-SGB - 4A", - "SGB - 4B": "-SGB - 4B", - "SGB - 4C": "-SGB - 4C", - "SGB - 4D": "-SGB - 4D", - "SGB - 4E": "-SGB - 4E", - "SGB - 4F": "-SGB - 4F", - "SGB - 4G": "-SGB - 4G", - "SGB - 4H": "-SGB - 4H", - "Special 1": "-Special 1", - "Special 2": "-Special 2", - "Special 3": "-Special 3", - "Special 4 (TI-83 Legacy)": "-Special 4 (TI-83 Legacy)", - "TWB64 - Pack 1": "-TWB64 - Pack 1", - "TWB64 - Pack 2": "-TWB64 - Pack 2", - "PixelShift - Pack 1": "-PixelShift - Pack 1", - "gambatte gb internal palette": "-gambatte gb internal palette", - "TWB64 001 - Aqours Blue": "-TWB64 001 - Aqours Blue", - "TWB64 002 - Anime Expo Ver.": "-TWB64 002 - Anime Expo Ver.", - "TWB64 003 - SpongeBob Yellow": "-TWB64 003 - SpongeBob Yellow", - "TWB64 004 - Patrick Star Pink": "-TWB64 004 - Patrick Star Pink", - "TWB64 005 - Neon Red": "-TWB64 005 - Neon Red", - "TWB64 006 - Neon Blue": "-TWB64 006 - Neon Blue", - "TWB64 007 - Neon Yellow": "-TWB64 007 - Neon Yellow", - "TWB64 008 - Neon Green": "-TWB64 008 - Neon Green", - "TWB64 009 - Neon Pink": "-TWB64 009 - Neon Pink", - "TWB64 010 - Mario Red": "-TWB64 010 - Mario Red", - "TWB64 011 - Nick Orange": "-TWB64 011 - Nick Orange", - "TWB64 012 - Virtual Boy Ver.": "-TWB64 012 - Virtual Boy Ver.", - "TWB64 013 - Golden Wild": "-TWB64 013 - Golden Wild", - "TWB64 014 - Builder Yellow": "-TWB64 014 - Builder Yellow", - "TWB64 015 - Classic Blurple": "-TWB64 015 - Classic Blurple", - "TWB64 016 - 765 Production Ver.": "-TWB64 016 - 765 Production Ver.", - "TWB64 017 - Superball Ivory": "-TWB64 017 - Superball Ivory", - "TWB64 018 - Crunchyroll Orange": "-TWB64 018 - Crunchyroll Orange", - "TWB64 019 - Muse Pink": "-TWB64 019 - Muse Pink", - "TWB64 020 - Nijigasaki Yellow": "-TWB64 020 - Nijigasaki Yellow", - "TWB64 021 - Gamate Ver.": "-TWB64 021 - Gamate Ver.", - "TWB64 022 - Greenscale Ver.": "-TWB64 022 - Greenscale Ver.", - "TWB64 023 - Odyssey Gold": "-TWB64 023 - Odyssey Gold", - "TWB64 024 - Super Saiyan God": "-TWB64 024 - Super Saiyan God", - "TWB64 025 - Super Saiyan Blue": "-TWB64 025 - Super Saiyan Blue", - "TWB64 026 - Bizarre Pink": "-TWB64 026 - Bizarre Pink", - "TWB64 027 - Nintendo Switch Lite Ver.": "-TWB64 027 - Nintendo Switch Lite Ver.", - "TWB64 028 - Game.com Ver.": "-TWB64 028 - Game.com Ver.", - "TWB64 029 - Sanrio Pink": "-TWB64 029 - Sanrio Pink", - "TWB64 030 - BANDAI NAMCO Ver.": "-TWB64 030 - BANDAI NAMCO Ver.", - "TWB64 031 - Cosmo Green": "-TWB64 031 - Cosmo Green", - "TWB64 032 - Wanda Pink": "-TWB64 032 - Wanda Pink", - "TWB64 033 - Link's Awakening DX Ver.": "-TWB64 033 - Link's Awakening DX Ver.", - "TWB64 034 - Travel Wood": "-TWB64 034 - Travel Wood", - "TWB64 035 - Pokemon Ver.": "-TWB64 035 - Pokemon Ver.", - "TWB64 036 - Game Grump Orange": "-TWB64 036 - Game Grump Orange", - "TWB64 037 - Scooby-Doo Mystery Ver.": "-TWB64 037 - Scooby-Doo Mystery Ver.", - "TWB64 038 - Pokemon mini Ver.": "-TWB64 038 - Pokemon mini Ver.", - "TWB64 039 - Supervision Ver.": "-TWB64 039 - Supervision Ver.", - "TWB64 040 - DMG Ver.": "-TWB64 040 - DMG Ver.", - "TWB64 041 - Pocket Ver.": "-TWB64 041 - Pocket Ver.", - "TWB64 042 - Light Ver.": "-TWB64 042 - Light Ver.", - "TWB64 043 - Miraitowa Blue": "-TWB64 043 - Miraitowa Blue", - "TWB64 044 - Someity Pink": "-TWB64 044 - Someity Pink", - "TWB64 045 - Pikachu Yellow": "-TWB64 045 - Pikachu Yellow", - "TWB64 046 - Eevee Brown": "-TWB64 046 - Eevee Brown", - "TWB64 047 - Microvision Ver.": "-TWB64 047 - Microvision Ver.", - "TWB64 048 - TI-83 Ver.": "-TWB64 048 - TI-83 Ver.", - "TWB64 049 - Aegis Cherry": "-TWB64 049 - Aegis Cherry", - "TWB64 050 - Labo Fawn": "-TWB64 050 - Labo Fawn", - "TWB64 051 - MILLION LIVE GOLD!": "-TWB64 051 - MILLION LIVE GOLD!", - "TWB64 052 - Tokyo Midtown Ver.": "-TWB64 052 - Tokyo Midtown Ver.", - "TWB64 053 - VMU Ver.": "-TWB64 053 - VMU Ver.", - "TWB64 054 - Game Master Ver.": "-TWB64 054 - Game Master Ver.", - "TWB64 055 - Android Green": "-TWB64 055 - Android Green", - "TWB64 056 - Ticketmaster Azure": "-TWB64 056 - Ticketmaster Azure", - "TWB64 057 - Google Red": "-TWB64 057 - Google Red", - "TWB64 058 - Google Blue": "-TWB64 058 - Google Blue", - "TWB64 059 - Google Yellow": "-TWB64 059 - Google Yellow", - "TWB64 060 - Google Green": "-TWB64 060 - Google Green", - "TWB64 061 - WonderSwan Ver.": "-TWB64 061 - WonderSwan Ver.", - "TWB64 062 - Neo Geo Pocket Ver.": "-TWB64 062 - Neo Geo Pocket Ver.", - "TWB64 063 - Dew Green": "-TWB64 063 - Dew Green", - "TWB64 064 - Coca-Cola Red": "-TWB64 064 - Coca-Cola Red", - "TWB64 065 - GameKing Ver.": "-TWB64 065 - GameKing Ver.", - "TWB64 066 - Do The Dew Ver.": "-TWB64 066 - Do The Dew Ver.", - "TWB64 067 - Digivice Ver.": "-TWB64 067 - Digivice Ver.", - "TWB64 068 - Bikini Bottom Ver.": "-TWB64 068 - Bikini Bottom Ver.", - "TWB64 069 - Blossom Pink": "-TWB64 069 - Blossom Pink", - "TWB64 070 - Bubbles Blue": "-TWB64 070 - Bubbles Blue", - "TWB64 071 - Buttercup Green": "-TWB64 071 - Buttercup Green", - "TWB64 072 - NASCAR Ver.": "-TWB64 072 - NASCAR Ver.", - "TWB64 073 - Lemon-Lime Green": "-TWB64 073 - Lemon-Lime Green", - "TWB64 074 - Mega Man V Ver.": "-TWB64 074 - Mega Man V Ver.", - "TWB64 075 - Tamagotchi Ver.": "-TWB64 075 - Tamagotchi Ver.", - "TWB64 076 - Phantom Red": "-TWB64 076 - Phantom Red", - "TWB64 077 - Halloween Ver.": "-TWB64 077 - Halloween Ver.", - "TWB64 078 - Christmas Ver.": "-TWB64 078 - Christmas Ver.", - "TWB64 079 - Cardcaptor Pink": "-TWB64 079 - Cardcaptor Pink", - "TWB64 080 - Pretty Guardian Gold": "-TWB64 080 - Pretty Guardian Gold", - "TWB64 081 - Camouflage Ver.": "-TWB64 081 - Camouflage Ver.", - "TWB64 082 - Legendary Super Saiyan": "-TWB64 082 - Legendary Super Saiyan", - "TWB64 083 - Super Saiyan Rose": "-TWB64 083 - Super Saiyan Rose", - "TWB64 084 - Super Saiyan": "-TWB64 084 - Super Saiyan", - "TWB64 085 - Perfected Ultra Instinct": "-TWB64 085 - Perfected Ultra Instinct", - "TWB64 086 - Saint Snow Red": "-TWB64 086 - Saint Snow Red", - "TWB64 087 - Yellow Banana": "-TWB64 087 - Yellow Banana", - "TWB64 088 - Green Banana": "-TWB64 088 - Green Banana", - "TWB64 089 - Super Saiyan 3": "-TWB64 089 - Super Saiyan 3", - "TWB64 090 - Super Saiyan Blue Evolved": "-TWB64 090 - Super Saiyan Blue Evolved", - "TWB64 091 - Pocket Tales Ver.": "-TWB64 091 - Pocket Tales Ver.", - "TWB64 092 - Investigation Yellow": "-TWB64 092 - Investigation Yellow", - "TWB64 093 - S.E.E.S. Blue": "-TWB64 093 - S.E.E.S. Blue", - "TWB64 094 - Game Awards Cyan": "-TWB64 094 - Game Awards Cyan", - "TWB64 095 - Hokage Orange": "-TWB64 095 - Hokage Orange", - "TWB64 096 - Straw Hat Red": "-TWB64 096 - Straw Hat Red", - "TWB64 097 - Sword Art Cyan": "-TWB64 097 - Sword Art Cyan", - "TWB64 098 - Deku Alpha Emerald": "-TWB64 098 - Deku Alpha Emerald", - "TWB64 099 - Blue Stripes Ver.": "-TWB64 099 - Blue Stripes Ver.", - "TWB64 100 - Stone Orange": "-TWB64 100 - Stone Orange", - "gambatte gb palette twb64 1": "-gambatte gb palette twb64 1", - "TWB64 101 - 765PRO Pink": "-TWB64 101 - 765PRO Pink", - "TWB64 102 - CINDERELLA Blue": "-TWB64 102 - CINDERELLA Blue", - "TWB64 103 - MILLION Yellow!": "-TWB64 103 - MILLION Yellow!", - "TWB64 104 - SideM Green": "-TWB64 104 - SideM Green", - "TWB64 105 - SHINY Sky Blue": "-TWB64 105 - SHINY Sky Blue", - "TWB64 106 - Angry Volcano Ver.": "-TWB64 106 - Angry Volcano Ver.", - "TWB64 107 - Yo-kai Pink": "-TWB64 107 - Yo-kai Pink", - "TWB64 108 - Yo-kai Green": "-TWB64 108 - Yo-kai Green", - "TWB64 109 - Yo-kai Blue": "-TWB64 109 - Yo-kai Blue", - "TWB64 110 - Yo-kai Purple": "-TWB64 110 - Yo-kai Purple", - "TWB64 111 - Aquatic Iro": "-TWB64 111 - Aquatic Iro", - "TWB64 112 - Tea Midori": "-TWB64 112 - Tea Midori", - "TWB64 113 - Sakura Pink": "-TWB64 113 - Sakura Pink", - "TWB64 114 - Wisteria Murasaki": "-TWB64 114 - Wisteria Murasaki", - "TWB64 115 - Oni Aka": "-TWB64 115 - Oni Aka", - "TWB64 116 - Golden Kiiro": "-TWB64 116 - Golden Kiiro", - "TWB64 117 - Silver Shiro": "-TWB64 117 - Silver Shiro", - "TWB64 118 - Fruity Orange": "-TWB64 118 - Fruity Orange", - "TWB64 119 - AKB48 Pink": "-TWB64 119 - AKB48 Pink", - "TWB64 120 - Miku Blue": "-TWB64 120 - Miku Blue", - "TWB64 121 - Fairy Tail Red": "-TWB64 121 - Fairy Tail Red", - "TWB64 122 - Survey Corps Brown": "-TWB64 122 - Survey Corps Brown", - "TWB64 123 - Island Green": "-TWB64 123 - Island Green", - "TWB64 124 - Mania Plus Green": "-TWB64 124 - Mania Plus Green", - "TWB64 125 - Ninja Turtle Green": "-TWB64 125 - Ninja Turtle Green", - "TWB64 126 - Slime Blue": "-TWB64 126 - Slime Blue", - "TWB64 127 - Lime Midori": "-TWB64 127 - Lime Midori", - "TWB64 128 - Ghostly Aoi": "-TWB64 128 - Ghostly Aoi", - "TWB64 129 - Retro Bogeda": "-TWB64 129 - Retro Bogeda", - "TWB64 130 - Royal Blue": "-TWB64 130 - Royal Blue", - "TWB64 131 - Neon Purple": "-TWB64 131 - Neon Purple", - "TWB64 132 - Neon Orange": "-TWB64 132 - Neon Orange", - "TWB64 133 - Moonlight Vision": "-TWB64 133 - Moonlight Vision", - "TWB64 134 - Tokyo Red": "-TWB64 134 - Tokyo Red", - "TWB64 135 - Paris Gold": "-TWB64 135 - Paris Gold", - "TWB64 136 - Beijing Blue": "-TWB64 136 - Beijing Blue", - "TWB64 137 - Pac-Man Yellow": "-TWB64 137 - Pac-Man Yellow", - "TWB64 138 - Irish Green": "-TWB64 138 - Irish Green", - "TWB64 139 - Kakarot Orange": "-TWB64 139 - Kakarot Orange", - "TWB64 140 - Dragon Ball Orange": "-TWB64 140 - Dragon Ball Orange", - "TWB64 141 - Christmas Gold": "-TWB64 141 - Christmas Gold", - "TWB64 142 - Pepsi-Cola Blue": "-TWB64 142 - Pepsi-Cola Blue", - "TWB64 143 - Bubblun Green": "-TWB64 143 - Bubblun Green", - "TWB64 144 - Bobblun Blue": "-TWB64 144 - Bobblun Blue", - "TWB64 145 - Baja Blast Storm": "-TWB64 145 - Baja Blast Storm", - "TWB64 146 - Olympic Gold": "-TWB64 146 - Olympic Gold", - "TWB64 147 - Value Orange": "-TWB64 147 - Value Orange", - "TWB64 148 - Liella Purple!": "-TWB64 148 - Liella Purple!", - "TWB64 149 - Olympic Silver": "-TWB64 149 - Olympic Silver", - "TWB64 150 - Olympic Bronze": "-TWB64 150 - Olympic Bronze", - "TWB64 151 - ANA Sky Blue": "-TWB64 151 - ANA Sky Blue", - "TWB64 152 - Nijigasaki Orange": "-TWB64 152 - Nijigasaki Orange", - "TWB64 153 - HoloBlue": "-TWB64 153 - HoloBlue", - "TWB64 154 - Wrestling Red": "-TWB64 154 - Wrestling Red", - "TWB64 155 - Yoshi Egg Green": "-TWB64 155 - Yoshi Egg Green", - "TWB64 156 - Pokedex Red": "-TWB64 156 - Pokedex Red", - "TWB64 157 - Disney Dream Blue": "-TWB64 157 - Disney Dream Blue", - "TWB64 158 - Xbox Green": "-TWB64 158 - Xbox Green", - "TWB64 159 - Sonic Mega Blue": "-TWB64 159 - Sonic Mega Blue", - "TWB64 160 - G4 Orange": "-TWB64 160 - G4 Orange", - "TWB64 161 - Scarlett Green": "-TWB64 161 - Scarlett Green", - "TWB64 162 - Glitchy Blue": "-TWB64 162 - Glitchy Blue", - "TWB64 163 - Classic LCD": "-TWB64 163 - Classic LCD", - "TWB64 164 - 3DS Virtual Console Ver.": "-TWB64 164 - 3DS Virtual Console Ver.", - "TWB64 165 - PocketStation Ver.": "-TWB64 165 - PocketStation Ver.", - "TWB64 166 - Game and Gold": "-TWB64 166 - Game and Gold", - "TWB64 167 - Smurfy Blue": "-TWB64 167 - Smurfy Blue", - "TWB64 168 - Swampy Ogre Green": "-TWB64 168 - Swampy Ogre Green", - "TWB64 169 - Sailor Spinach Green": "-TWB64 169 - Sailor Spinach Green", - "TWB64 170 - Shenron Green": "-TWB64 170 - Shenron Green", - "TWB64 171 - Berserk Blood": "-TWB64 171 - Berserk Blood", - "TWB64 172 - Super Star Pink": "-TWB64 172 - Super Star Pink", - "TWB64 173 - Gamebuino Classic Ver.": "-TWB64 173 - Gamebuino Classic Ver.", - "TWB64 174 - Barbie Pink": "-TWB64 174 - Barbie Pink", - "TWB64 175 - Star Command Green": "-TWB64 175 - Star Command Green", - "TWB64 176 - Nokia 3310 Ver.": "-TWB64 176 - Nokia 3310 Ver.", - "TWB64 177 - Clover Green": "-TWB64 177 - Clover Green", - "TWB64 178 - Crash Orange": "-TWB64 178 - Crash Orange", - "TWB64 179 - Famicom Disk Yellow": "-TWB64 179 - Famicom Disk Yellow", - "TWB64 180 - Team Rocket Red": "-TWB64 180 - Team Rocket Red", - "TWB64 181 - SEIKO Timer Yellow": "-TWB64 181 - SEIKO Timer Yellow", - "TWB64 182 - PINK109": "-TWB64 182 - PINK109", - "TWB64 183 - Doraemon Blue": "-TWB64 183 - Doraemon Blue", - "TWB64 184 - Fury Blue": "-TWB64 184 - Fury Blue", - "TWB64 185 - Rockstar Orange": "-TWB64 185 - Rockstar Orange", - "TWB64 186 - Puyo Puyo Green": "-TWB64 186 - Puyo Puyo Green", - "TWB64 187 - Susan G. Pink": "-TWB64 187 - Susan G. Pink", - "TWB64 188 - Pizza Hut Red": "-TWB64 188 - Pizza Hut Red", - "TWB64 189 - Plumbob Green": "-TWB64 189 - Plumbob Green", - "TWB64 190 - Grand Ivory": "-TWB64 190 - Grand Ivory", - "TWB64 191 - Demon's Gold": "-TWB64 191 - Demon's Gold", - "TWB64 192 - SEGA Tokyo Blue": "-TWB64 192 - SEGA Tokyo Blue", - "TWB64 193 - Champion Blue": "-TWB64 193 - Champion Blue", - "TWB64 194 - DK Barrel Brown": "-TWB64 194 - DK Barrel Brown", - "TWB64 195 - Evangelion Green": "-TWB64 195 - Evangelion Green", - "TWB64 196 - Equestrian Purple": "-TWB64 196 - Equestrian Purple", - "TWB64 197 - Autobot Red": "-TWB64 197 - Autobot Red", - "TWB64 198 - Niconico Sea Green": "-TWB64 198 - Niconico Sea Green", - "TWB64 199 - Duracell Copper": "-TWB64 199 - Duracell Copper", - "TWB64 200 - TOKYO SKYTREE CLOUDY BLUE": "-TWB64 200 - TOKYO SKYTREE CLOUDY BLUE", - "gambatte gb palette twb64 2": "-gambatte gb palette twb64 2", - "PixelShift 01 - Arctic Green": "-PixelShift 01 - Arctic Green", - "PixelShift 02 - Arduboy": "-PixelShift 02 - Arduboy", - "PixelShift 03 - BGB 0.3 Emulator": "-PixelShift 03 - BGB 0.3 Emulator", - "PixelShift 04 - Camouflage": "-PixelShift 04 - Camouflage", - "PixelShift 05 - Chocolate Bar": "-PixelShift 05 - Chocolate Bar", - "PixelShift 06 - CMYK": "-PixelShift 06 - CMYK", - "PixelShift 07 - Cotton Candy": "-PixelShift 07 - Cotton Candy", - "PixelShift 08 - Easy Greens": "-PixelShift 08 - Easy Greens", - "PixelShift 09 - Gamate": "-PixelShift 09 - Gamate", - "PixelShift 10 - Game Boy Light": "-PixelShift 10 - Game Boy Light", - "PixelShift 11 - Game Boy Pocket": "-PixelShift 11 - Game Boy Pocket", - "PixelShift 12 - Game Boy Pocket Alt": "-PixelShift 12 - Game Boy Pocket Alt", - "PixelShift 13 - Game Pocket Computer": "-PixelShift 13 - Game Pocket Computer", - "PixelShift 14 - Game & Watch Ball": "-PixelShift 14 - Game & Watch Ball", - "PixelShift 15 - GB Backlight Blue": "-PixelShift 15 - GB Backlight Blue", - "PixelShift 16 - GB Backlight Faded": "-PixelShift 16 - GB Backlight Faded", - "PixelShift 17 - GB Backlight Orange": "-PixelShift 17 - GB Backlight Orange", - "PixelShift 18 - GB Backlight White ": "-PixelShift 18 - GB Backlight White ", - "PixelShift 19 - GB Backlight Yellow Dark": "-PixelShift 19 - GB Backlight Yellow Dark", - "PixelShift 20 - GB Bootleg": "-PixelShift 20 - GB Bootleg", - "PixelShift 21 - GB Hunter": "-PixelShift 21 - GB Hunter", - "PixelShift 22 - GB Kiosk": "-PixelShift 22 - GB Kiosk", - "PixelShift 23 - GB Kiosk 2": "-PixelShift 23 - GB Kiosk 2", - "PixelShift 24 - GB New": "-PixelShift 24 - GB New", - "PixelShift 25 - GB Nuked": "-PixelShift 25 - GB Nuked", - "PixelShift 26 - GB Old": "-PixelShift 26 - GB Old", - "PixelShift 27 - GBP Bivert": "-PixelShift 27 - GBP Bivert", - "PixelShift 28 - GB Washed Yellow Backlight": "-PixelShift 28 - GB Washed Yellow Backlight", - "PixelShift 29 - Ghost": "-PixelShift 29 - Ghost", - "PixelShift 30 - Glow In The Dark": "-PixelShift 30 - Glow In The Dark", - "PixelShift 31 - Gold Bar": "-PixelShift 31 - Gold Bar", - "PixelShift 32 - Grapefruit": "-PixelShift 32 - Grapefruit", - "PixelShift 33 - Gray Green Mix": "-PixelShift 33 - Gray Green Mix", - "PixelShift 34 - Missingno": "-PixelShift 34 - Missingno", - "PixelShift 35 - MS-Dos": "-PixelShift 35 - MS-Dos", - "PixelShift 36 - Newspaper": "-PixelShift 36 - Newspaper", - "PixelShift 37 - Pip-Boy": "-PixelShift 37 - Pip-Boy", - "PixelShift 38 - Pocket Girl": "-PixelShift 38 - Pocket Girl", - "PixelShift 39 - Silhouette": "-PixelShift 39 - Silhouette", - "PixelShift 40 - Sunburst": "-PixelShift 40 - Sunburst", - "PixelShift 41 - Technicolor": "-PixelShift 41 - Technicolor", - "PixelShift 42 - Tron": "-PixelShift 42 - Tron", - "PixelShift 43 - Vaporwave": "-PixelShift 43 - Vaporwave", - "PixelShift 44 - Virtual Boy": "-PixelShift 44 - Virtual Boy", - "PixelShift 45 - Wish": "-PixelShift 45 - Wish", - "gambatte gb palette pixelshift 1": "-gambatte gb palette pixelshift 1", - "gambatte dark filter level": "-gambatte dark filter level", - "GB": "-GB", - "GBC": "-GBC", - "GBA": "-GBA", - "gambatte gb hwmode": "-gambatte gb hwmode", - "gambatte turbo period": "-gambatte turbo period", - "gambatte rumble level": "-gambatte rumble level", - "pcsx rearmed psxclock": "-pcsx rearmed psxclock", - "pcsx rearmed frameskip threshold": "-pcsx rearmed frameskip threshold", - "pcsx rearmed frameskip interval": "-pcsx rearmed frameskip interval", - "pcsx rearmed input sensitivity": "-pcsx rearmed input sensitivity", - "pcsx rearmed gunconadjustx": "-pcsx rearmed gunconadjustx", - "pcsx rearmed gunconadjusty": "-pcsx rearmed gunconadjusty", - "pcsx rearmed gunconadjustratiox": "-pcsx rearmed gunconadjustratiox", - "pcsx rearmed gunconadjustratioy": "-pcsx rearmed gunconadjustratioy", - "Japan NTSC": "-Japan NTSC", - "Japan PAL": "-Japan PAL", - "US": "-US", - "Europe": "-Europe", - "picodrive region": "-picodrive region", - "Game Gear": "-Game Gear", - "Master System": "-Master System", - "SG-1000": "-SG-1000", - "SC-3000": "-SC-3000", - "picodrive smstype": "-picodrive smstype", - "Sega": "-Sega", - "Codemasters": "-Codemasters", - "Korea": "-Korea", - "Korea MSX": "-Korea MSX", - "Korea X-in-1": "-Korea X-in-1", - "Korea 4-Pak": "-Korea 4-Pak", - "Korea Janggun": "-Korea Janggun", - "Korea Nemesis": "-Korea Nemesis", - "Taiwan 8K RAM": "-Taiwan 8K RAM", - "picodrive smsmapper": "-picodrive smsmapper", - "PAR": "-PAR", - "CRT": "-CRT", - "picodrive aspect": "-picodrive aspect", - "native": "-native", - "picodrive sound rate": "-picodrive sound rate", - "picodrive lowpass range": "-picodrive lowpass range", - "picodrive frameskip threshold": "-picodrive frameskip threshold", - "genesis plus gx frameskip threshold": "-genesis plus gx frameskip threshold", - "genesis plus gx lowpass range": "-genesis plus gx lowpass range", - "genesis plus gx psg preamp": "-genesis plus gx psg preamp", - "genesis plus gx fm preamp": "-genesis plus gx fm preamp", - "genesis plus gx cdda volume": "-genesis plus gx cdda volume", - "genesis plus gx pcm volume": "-genesis plus gx pcm volume", - "genesis plus gx audio eq low": "-genesis plus gx audio eq low", - "genesis plus gx audio eq mid": "-genesis plus gx audio eq mid", - "genesis plus gx audio eq high": "-genesis plus gx audio eq high", - "genesis plus gx enhanced vscroll limit": "-genesis plus gx enhanced vscroll limit", - "genesis plus gx psg channel 0 volume": "-genesis plus gx psg channel 0 volume", - "genesis plus gx psg channel 1 volume": "-genesis plus gx psg channel 1 volume", - "genesis plus gx psg channel 2 volume": "-genesis plus gx psg channel 2 volume", - "genesis plus gx psg channel 3 volume": "-genesis plus gx psg channel 3 volume", - "genesis plus gx md channel 0 volume": "-genesis plus gx md channel 0 volume", - "genesis plus gx md channel 1 volume": "-genesis plus gx md channel 1 volume", - "genesis plus gx md channel 2 volume": "-genesis plus gx md channel 2 volume", - "genesis plus gx md channel 3 volume": "-genesis plus gx md channel 3 volume", - "genesis plus gx md channel 4 volume": "-genesis plus gx md channel 4 volume", - "genesis plus gx md channel 5 volume": "-genesis plus gx md channel 5 volume", - "genesis plus gx sms fm channel 0 volume": "-genesis plus gx sms fm channel 0 volume", - "genesis plus gx sms fm channel 1 volume": "-genesis plus gx sms fm channel 1 volume", - "genesis plus gx sms fm channel 2 volume": "-genesis plus gx sms fm channel 2 volume", - "genesis plus gx sms fm channel 3 volume": "-genesis plus gx sms fm channel 3 volume", - "genesis plus gx sms fm channel 4 volume": "-genesis plus gx sms fm channel 4 volume", - "genesis plus gx sms fm channel 5 volume": "-genesis plus gx sms fm channel 5 volume", - "genesis plus gx sms fm channel 6 volume": "-genesis plus gx sms fm channel 6 volume", - "genesis plus gx sms fm channel 7 volume": "-genesis plus gx sms fm channel 7 volume", - "genesis plus gx sms fm channel 8 volume": "-genesis plus gx sms fm channel 8 volume", - "anaglyph": "-anaglyph", - "cyberscope": "-cyberscope", - "side-by-side": "-side-by-side", - "vli": "-vli", - "hli": "-hli", - "vb 3dmode": "-vb 3dmode", - "black & red": "-black & red", - "black & white": "-black & white", - "black & blue": "-black & blue", - "black & cyan": "-black & cyan", - "black & electric cyan": "-black & electric cyan", - "black & green": "-black & green", - "black & magenta": "-black & magenta", - "black & yellow": "-black & yellow", - "vb color mode": "-vb color mode", - "accurate": "-accurate", - "fast": "-fast", - "vb cpu emulation": "-vb cpu emulation" +{ + "fceumm region": "-fceumm region", + "fceumm sndquality": "-fceumm sndquality", + "fceumm aspect": "-fceumm aspect", + "fceumm overscan h left": "-fceumm overscan h left", + "fceumm overscan h right": "-fceumm overscan h right", + "fceumm overscan v top": "-fceumm overscan v top", + "fceumm overscan v bottom": "-fceumm overscan v bottom", + "fceumm turbo enable": "-fceumm turbo enable", + "fceumm turbo delay": "-fceumm turbo delay", + "fceumm zapper tolerance": "-fceumm zapper tolerance", + "fceumm mouse sensitivity": "-fceumm mouse sensitivity", + "50%": "-50%", + "60%": "-60%", + "70%": "-70%", + "80%": "-80%", + "90%": "-90%", + "100%": "-100%", + "150%": "-150%", + "200%": "-200%", + "250%": "-250%", + "300%": "-300%", + "350%": "-350%", + "400%": "-400%", + "450%": "-450%", + "500%": "-500%", + "snes9x overclock superfx": "-snes9x overclock superfx", + "snes9x superscope crosshair": "-snes9x superscope crosshair", + "White": "-White", + "White (blend)": "-White (blend)", + "Red": "-Red", + "Red (blend)": "-Red (blend)", + "Orange": "-Orange", + "Orange (blend)": "-Orange (blend)", + "Yellow": "-Yellow", + "Yellow (blend)": "-Yellow (blend)", + "Green": "-Green", + "Green (blend)": "-Green (blend)", + "Cyan": "-Cyan", + "Cyan (blend)": "-Cyan (blend)", + "Sky": "-Sky", + "Sky (blend)": "-Sky (blend)", + "Blue": "-Blue", + "Blue (blend)": "-Blue (blend)", + "Violet": "-Violet", + "Violet (blend)": "-Violet (blend)", + "Pink": "-Pink", + "Pink (blend)": "-Pink (blend)", + "Purple": "-Purple", + "Purple (blend)": "-Purple (blend)", + "Black": "-Black", + "Black (blend)": "-Black (blend)", + "25% Grey": "-25% Grey", + "25% Grey (blend)": "-25% Grey (blend)", + "50% Grey": "-50% Grey", + "50% Grey (blend)": "-50% Grey (blend)", + "75% Grey": "-75% Grey", + "75% Grey (blend)": "-75% Grey (blend)", + "snes9x superscope color": "-snes9x superscope color", + "snes9x justifier1 crosshair": "-snes9x justifier1 crosshair", + "snes9x justifier1 color": "-snes9x justifier1 color", + "snes9x justifier2 crosshair": "-snes9x justifier2 crosshair", + "snes9x justifier2 color": "-snes9x justifier2 color", + "snes9x rifle crosshair": "-snes9x rifle crosshair", + "snes9x rifle color": "-snes9x rifle color", + "1.0x (12.50Mhz)": "-1.0x (12.50Mhz)", + "1.1x (13.75Mhz)": "-1.1x (13.75Mhz)", + "1.2x (15.00Mhz)": "-1.2x (15.00Mhz)", + "1.5x (18.75Mhz)": "-1.5x (18.75Mhz)", + "1.6x (20.00Mhz)": "-1.6x (20.00Mhz)", + "1.8x (22.50Mhz)": "-1.8x (22.50Mhz)", + "2.0x (25.00Mhz)": "-2.0x (25.00Mhz)", + "opera cpu overclock": "-opera cpu overclock", + "0RGB1555": "-0RGB1555", + "RGB565": "-RGB565", + "XRGB8888": "-XRGB8888", + "opera vdlp pixel format": "-opera vdlp pixel format", + "opera nvram version": "-opera nvram version", + "opera active devices": "-opera active devices", + "stella2014 stelladaptor analog sensitivity": "-stella2014 stelladaptor analog sensitivity", + "stella2014 stelladaptor analog center": "-stella2014 stelladaptor analog center", + "handy frameskip threshold": "-handy frameskip threshold", + "320x240": "-320x240", + "640x480": "-640x480", + "960x720": "-960x720", + "1280x960": "-1280x960", + "1440x1080": "-1440x1080", + "1600x1200": "-1600x1200", + "1920x1440": "-1920x1440", + "2240x1680": "-2240x1680", + "2560x1920": "-2560x1920", + "2880x2160": "-2880x2160", + "3200x2400": "-3200x2400", + "3520x2640": "-3520x2640", + "3840x2880": "-3840x2880", + "43screensize": "-43screensize", + "3point": "-3point", + "standard": "-standard", + "BilinearMode": "-BilinearMode", + "MultiSampling": "-MultiSampling", + "FXAA": "-FXAA", + "Software": "-Software", + "FromMem": "-FromMem", + "EnableCopyDepthToRDRAM": "-EnableCopyDepthToRDRAM", + "Stripped": "-Stripped", + "OnePiece": "-OnePiece", + "BackgroundMode": "-BackgroundMode", + "OverscanTop": "-OverscanTop", + "OverscanLeft": "-OverscanLeft", + "OverscanRight": "-OverscanRight", + "OverscanBottom": "-OverscanBottom", + "MaxHiResTxVramLimit": "-MaxHiResTxVramLimit", + "MaxTxCacheSize": "-MaxTxCacheSize", + "Smooth filtering 1": "-Smooth filtering 1", + "Smooth filtering 2": "-Smooth filtering 2", + "Smooth filtering 3": "-Smooth filtering 3", + "Smooth filtering 4": "-Smooth filtering 4", + "Sharp filtering 1": "-Sharp filtering 1", + "Sharp filtering 2": "-Sharp filtering 2", + "txFilterMode": "-txFilterMode", + "As Is": "-As Is", + "X2": "-X2", + "X2SAI": "-X2SAI", + "HQ2X": "-HQ2X", + "HQ2XS": "-HQ2XS", + "LQ2X": "-LQ2X", + "LQ2XS": "-LQ2XS", + "HQ4X": "-HQ4X", + "2xBRZ": "-2xBRZ", + "3xBRZ": "-3xBRZ", + "4xBRZ": "-4xBRZ", + "5xBRZ": "-5xBRZ", + "6xBRZ": "-6xBRZ", + "txEnhancementMode": "-txEnhancementMode", + "Original": "-Original", + "Fullspeed": "-Fullspeed", + "Framerate": "-Framerate", + "virefresh": "-virefresh", + "CountPerOp": "-CountPerOp", + "CountPerOpDenomPot": "-CountPerOpDenomPot", + "deadzone": "-deadzone", + "sensitivity": "-sensitivity", + "C1": "-C1", + "C2": "-C2", + "C3": "-C3", + "C4": "-C4", + "cbutton": "-cbutton", + "none": "-none", + "memory": "-memory", + "rumble": "-rumble", + "transfer": "-transfer", + "pak1": "-pak1", + "pak2": "-pak2", + "pak3": "-pak3", + "pak4": "-pak4", + "Autodetect": "-Autodetect", + "Game Boy": "-Game Boy", + "Super Game Boy": "-Super Game Boy", + "Game Boy Color": "-Game Boy Color", + "Game Boy Advance": "-Game Boy Advance", + "mgba gb model": "-mgba gb model", + "ON": "-ON", + "OFF": "-OFF", + "mgba use bios": "-mgba use bios", + "mgba skip bios": "-mgba skip bios", + "Grayscale": "-Grayscale", + "DMG Green": "-DMG Green", + "GB Pocket": "-GB Pocket", + "GB Light": "-GB Light", + "GBC Brown ↑": "-GBC Brown ↑", + "GBC Red ↑A": "-GBC Red ↑A", + "GBC Dark Brown ↑B": "-GBC Dark Brown ↑B", + "GBC Pale Yellow ↓": "-GBC Pale Yellow ↓", + "GBC Orange ↓A": "-GBC Orange ↓A", + "GBC Yellow ↓B": "-GBC Yellow ↓B", + "GBC Blue ←": "-GBC Blue ←", + "GBC Dark Blue ←A": "-GBC Dark Blue ←A", + "GBC Gray ←B": "-GBC Gray ←B", + "GBC Green →": "-GBC Green →", + "GBC Dark Green →A": "-GBC Dark Green →A", + "GBC Reverse →B": "-GBC Reverse →B", + "SGB 1-A": "-SGB 1-A", + "SGB 1-B": "-SGB 1-B", + "SGB 1-C": "-SGB 1-C", + "SGB 1-D": "-SGB 1-D", + "SGB 1-E": "-SGB 1-E", + "SGB 1-F": "-SGB 1-F", + "SGB 1-G": "-SGB 1-G", + "SGB 1-H": "-SGB 1-H", + "SGB 2-A": "-SGB 2-A", + "SGB 2-B": "-SGB 2-B", + "SGB 2-C": "-SGB 2-C", + "SGB 2-D": "-SGB 2-D", + "SGB 2-E": "-SGB 2-E", + "SGB 2-F": "-SGB 2-F", + "SGB 2-G": "-SGB 2-G", + "SGB 2-H": "-SGB 2-H", + "SGB 3-A": "-SGB 3-A", + "SGB 3-B": "-SGB 3-B", + "SGB 3-C": "-SGB 3-C", + "SGB 3-D": "-SGB 3-D", + "SGB 3-E": "-SGB 3-E", + "SGB 3-F": "-SGB 3-F", + "SGB 3-G": "-SGB 3-G", + "SGB 3-H": "-SGB 3-H", + "SGB 4-A": "-SGB 4-A", + "SGB 4-B": "-SGB 4-B", + "SGB 4-C": "-SGB 4-C", + "SGB 4-D": "-SGB 4-D", + "SGB 4-E": "-SGB 4-E", + "SGB 4-F": "-SGB 4-F", + "SGB 4-G": "-SGB 4-G", + "SGB 4-H": "-SGB 4-H", + "mgba gb colors": "-mgba gb colors", + "mgba sgb borders": "-mgba sgb borders", + "mgba color correction": "-mgba color correction", + "mgba solar sensor level": "-mgba solar sensor level", + "mgba force gbp": "-mgba force gbp", + "Remove Known": "-Remove Known", + "Detect and Remove": "-Detect and Remove", + "Don't Remove": "-Don't Remove", + "mgba idle optimization": "-mgba idle optimization", + "mgba frameskip threshold": "-mgba frameskip threshold", + "mgba frameskip interval": "-mgba frameskip interval", + "GB - DMG": "-GB - DMG", + "GB - Pocket": "-GB - Pocket", + "GB - Light": "-GB - Light", + "GBC - Blue": "-GBC - Blue", + "GBC - Brown": "-GBC - Brown", + "GBC - Dark Blue": "-GBC - Dark Blue", + "GBC - Dark Brown": "-GBC - Dark Brown", + "GBC - Dark Green": "-GBC - Dark Green", + "GBC - Grayscale": "-GBC - Grayscale", + "GBC - Green": "-GBC - Green", + "GBC - Inverted": "-GBC - Inverted", + "GBC - Orange": "-GBC - Orange", + "GBC - Pastel Mix": "-GBC - Pastel Mix", + "GBC - Red": "-GBC - Red", + "GBC - Yellow": "-GBC - Yellow", + "SGB - 1A": "-SGB - 1A", + "SGB - 1B": "-SGB - 1B", + "SGB - 1C": "-SGB - 1C", + "SGB - 1D": "-SGB - 1D", + "SGB - 1E": "-SGB - 1E", + "SGB - 1F": "-SGB - 1F", + "SGB - 1G": "-SGB - 1G", + "SGB - 1H": "-SGB - 1H", + "SGB - 2A": "-SGB - 2A", + "SGB - 2B": "-SGB - 2B", + "SGB - 2C": "-SGB - 2C", + "SGB - 2D": "-SGB - 2D", + "SGB - 2E": "-SGB - 2E", + "SGB - 2F": "-SGB - 2F", + "SGB - 2G": "-SGB - 2G", + "SGB - 2H": "-SGB - 2H", + "SGB - 3A": "-SGB - 3A", + "SGB - 3B": "-SGB - 3B", + "SGB - 3C": "-SGB - 3C", + "SGB - 3D": "-SGB - 3D", + "SGB - 3E": "-SGB - 3E", + "SGB - 3F": "-SGB - 3F", + "SGB - 3G": "-SGB - 3G", + "SGB - 3H": "-SGB - 3H", + "SGB - 4A": "-SGB - 4A", + "SGB - 4B": "-SGB - 4B", + "SGB - 4C": "-SGB - 4C", + "SGB - 4D": "-SGB - 4D", + "SGB - 4E": "-SGB - 4E", + "SGB - 4F": "-SGB - 4F", + "SGB - 4G": "-SGB - 4G", + "SGB - 4H": "-SGB - 4H", + "Special 1": "-Special 1", + "Special 2": "-Special 2", + "Special 3": "-Special 3", + "Special 4 (TI-83 Legacy)": "-Special 4 (TI-83 Legacy)", + "TWB64 - Pack 1": "-TWB64 - Pack 1", + "TWB64 - Pack 2": "-TWB64 - Pack 2", + "PixelShift - Pack 1": "-PixelShift - Pack 1", + "gambatte gb internal palette": "-gambatte gb internal palette", + "TWB64 001 - Aqours Blue": "-TWB64 001 - Aqours Blue", + "TWB64 002 - Anime Expo Ver.": "-TWB64 002 - Anime Expo Ver.", + "TWB64 003 - SpongeBob Yellow": "-TWB64 003 - SpongeBob Yellow", + "TWB64 004 - Patrick Star Pink": "-TWB64 004 - Patrick Star Pink", + "TWB64 005 - Neon Red": "-TWB64 005 - Neon Red", + "TWB64 006 - Neon Blue": "-TWB64 006 - Neon Blue", + "TWB64 007 - Neon Yellow": "-TWB64 007 - Neon Yellow", + "TWB64 008 - Neon Green": "-TWB64 008 - Neon Green", + "TWB64 009 - Neon Pink": "-TWB64 009 - Neon Pink", + "TWB64 010 - Mario Red": "-TWB64 010 - Mario Red", + "TWB64 011 - Nick Orange": "-TWB64 011 - Nick Orange", + "TWB64 012 - Virtual Boy Ver.": "-TWB64 012 - Virtual Boy Ver.", + "TWB64 013 - Golden Wild": "-TWB64 013 - Golden Wild", + "TWB64 014 - Builder Yellow": "-TWB64 014 - Builder Yellow", + "TWB64 015 - Classic Blurple": "-TWB64 015 - Classic Blurple", + "TWB64 016 - 765 Production Ver.": "-TWB64 016 - 765 Production Ver.", + "TWB64 017 - Superball Ivory": "-TWB64 017 - Superball Ivory", + "TWB64 018 - Crunchyroll Orange": "-TWB64 018 - Crunchyroll Orange", + "TWB64 019 - Muse Pink": "-TWB64 019 - Muse Pink", + "TWB64 020 - Nijigasaki Yellow": "-TWB64 020 - Nijigasaki Yellow", + "TWB64 021 - Gamate Ver.": "-TWB64 021 - Gamate Ver.", + "TWB64 022 - Greenscale Ver.": "-TWB64 022 - Greenscale Ver.", + "TWB64 023 - Odyssey Gold": "-TWB64 023 - Odyssey Gold", + "TWB64 024 - Super Saiyan God": "-TWB64 024 - Super Saiyan God", + "TWB64 025 - Super Saiyan Blue": "-TWB64 025 - Super Saiyan Blue", + "TWB64 026 - Bizarre Pink": "-TWB64 026 - Bizarre Pink", + "TWB64 027 - Nintendo Switch Lite Ver.": "-TWB64 027 - Nintendo Switch Lite Ver.", + "TWB64 028 - Game.com Ver.": "-TWB64 028 - Game.com Ver.", + "TWB64 029 - Sanrio Pink": "-TWB64 029 - Sanrio Pink", + "TWB64 030 - BANDAI NAMCO Ver.": "-TWB64 030 - BANDAI NAMCO Ver.", + "TWB64 031 - Cosmo Green": "-TWB64 031 - Cosmo Green", + "TWB64 032 - Wanda Pink": "-TWB64 032 - Wanda Pink", + "TWB64 033 - Link's Awakening DX Ver.": "-TWB64 033 - Link's Awakening DX Ver.", + "TWB64 034 - Travel Wood": "-TWB64 034 - Travel Wood", + "TWB64 035 - Pokemon Ver.": "-TWB64 035 - Pokemon Ver.", + "TWB64 036 - Game Grump Orange": "-TWB64 036 - Game Grump Orange", + "TWB64 037 - Scooby-Doo Mystery Ver.": "-TWB64 037 - Scooby-Doo Mystery Ver.", + "TWB64 038 - Pokemon mini Ver.": "-TWB64 038 - Pokemon mini Ver.", + "TWB64 039 - Supervision Ver.": "-TWB64 039 - Supervision Ver.", + "TWB64 040 - DMG Ver.": "-TWB64 040 - DMG Ver.", + "TWB64 041 - Pocket Ver.": "-TWB64 041 - Pocket Ver.", + "TWB64 042 - Light Ver.": "-TWB64 042 - Light Ver.", + "TWB64 043 - Miraitowa Blue": "-TWB64 043 - Miraitowa Blue", + "TWB64 044 - Someity Pink": "-TWB64 044 - Someity Pink", + "TWB64 045 - Pikachu Yellow": "-TWB64 045 - Pikachu Yellow", + "TWB64 046 - Eevee Brown": "-TWB64 046 - Eevee Brown", + "TWB64 047 - Microvision Ver.": "-TWB64 047 - Microvision Ver.", + "TWB64 048 - TI-83 Ver.": "-TWB64 048 - TI-83 Ver.", + "TWB64 049 - Aegis Cherry": "-TWB64 049 - Aegis Cherry", + "TWB64 050 - Labo Fawn": "-TWB64 050 - Labo Fawn", + "TWB64 051 - MILLION LIVE GOLD!": "-TWB64 051 - MILLION LIVE GOLD!", + "TWB64 052 - Tokyo Midtown Ver.": "-TWB64 052 - Tokyo Midtown Ver.", + "TWB64 053 - VMU Ver.": "-TWB64 053 - VMU Ver.", + "TWB64 054 - Game Master Ver.": "-TWB64 054 - Game Master Ver.", + "TWB64 055 - Android Green": "-TWB64 055 - Android Green", + "TWB64 056 - Ticketmaster Azure": "-TWB64 056 - Ticketmaster Azure", + "TWB64 057 - Google Red": "-TWB64 057 - Google Red", + "TWB64 058 - Google Blue": "-TWB64 058 - Google Blue", + "TWB64 059 - Google Yellow": "-TWB64 059 - Google Yellow", + "TWB64 060 - Google Green": "-TWB64 060 - Google Green", + "TWB64 061 - WonderSwan Ver.": "-TWB64 061 - WonderSwan Ver.", + "TWB64 062 - Neo Geo Pocket Ver.": "-TWB64 062 - Neo Geo Pocket Ver.", + "TWB64 063 - Dew Green": "-TWB64 063 - Dew Green", + "TWB64 064 - Coca-Cola Red": "-TWB64 064 - Coca-Cola Red", + "TWB64 065 - GameKing Ver.": "-TWB64 065 - GameKing Ver.", + "TWB64 066 - Do The Dew Ver.": "-TWB64 066 - Do The Dew Ver.", + "TWB64 067 - Digivice Ver.": "-TWB64 067 - Digivice Ver.", + "TWB64 068 - Bikini Bottom Ver.": "-TWB64 068 - Bikini Bottom Ver.", + "TWB64 069 - Blossom Pink": "-TWB64 069 - Blossom Pink", + "TWB64 070 - Bubbles Blue": "-TWB64 070 - Bubbles Blue", + "TWB64 071 - Buttercup Green": "-TWB64 071 - Buttercup Green", + "TWB64 072 - NASCAR Ver.": "-TWB64 072 - NASCAR Ver.", + "TWB64 073 - Lemon-Lime Green": "-TWB64 073 - Lemon-Lime Green", + "TWB64 074 - Mega Man V Ver.": "-TWB64 074 - Mega Man V Ver.", + "TWB64 075 - Tamagotchi Ver.": "-TWB64 075 - Tamagotchi Ver.", + "TWB64 076 - Phantom Red": "-TWB64 076 - Phantom Red", + "TWB64 077 - Halloween Ver.": "-TWB64 077 - Halloween Ver.", + "TWB64 078 - Christmas Ver.": "-TWB64 078 - Christmas Ver.", + "TWB64 079 - Cardcaptor Pink": "-TWB64 079 - Cardcaptor Pink", + "TWB64 080 - Pretty Guardian Gold": "-TWB64 080 - Pretty Guardian Gold", + "TWB64 081 - Camouflage Ver.": "-TWB64 081 - Camouflage Ver.", + "TWB64 082 - Legendary Super Saiyan": "-TWB64 082 - Legendary Super Saiyan", + "TWB64 083 - Super Saiyan Rose": "-TWB64 083 - Super Saiyan Rose", + "TWB64 084 - Super Saiyan": "-TWB64 084 - Super Saiyan", + "TWB64 085 - Perfected Ultra Instinct": "-TWB64 085 - Perfected Ultra Instinct", + "TWB64 086 - Saint Snow Red": "-TWB64 086 - Saint Snow Red", + "TWB64 087 - Yellow Banana": "-TWB64 087 - Yellow Banana", + "TWB64 088 - Green Banana": "-TWB64 088 - Green Banana", + "TWB64 089 - Super Saiyan 3": "-TWB64 089 - Super Saiyan 3", + "TWB64 090 - Super Saiyan Blue Evolved": "-TWB64 090 - Super Saiyan Blue Evolved", + "TWB64 091 - Pocket Tales Ver.": "-TWB64 091 - Pocket Tales Ver.", + "TWB64 092 - Investigation Yellow": "-TWB64 092 - Investigation Yellow", + "TWB64 093 - S.E.E.S. Blue": "-TWB64 093 - S.E.E.S. Blue", + "TWB64 094 - Game Awards Cyan": "-TWB64 094 - Game Awards Cyan", + "TWB64 095 - Hokage Orange": "-TWB64 095 - Hokage Orange", + "TWB64 096 - Straw Hat Red": "-TWB64 096 - Straw Hat Red", + "TWB64 097 - Sword Art Cyan": "-TWB64 097 - Sword Art Cyan", + "TWB64 098 - Deku Alpha Emerald": "-TWB64 098 - Deku Alpha Emerald", + "TWB64 099 - Blue Stripes Ver.": "-TWB64 099 - Blue Stripes Ver.", + "TWB64 100 - Stone Orange": "-TWB64 100 - Stone Orange", + "gambatte gb palette twb64 1": "-gambatte gb palette twb64 1", + "TWB64 101 - 765PRO Pink": "-TWB64 101 - 765PRO Pink", + "TWB64 102 - CINDERELLA Blue": "-TWB64 102 - CINDERELLA Blue", + "TWB64 103 - MILLION Yellow!": "-TWB64 103 - MILLION Yellow!", + "TWB64 104 - SideM Green": "-TWB64 104 - SideM Green", + "TWB64 105 - SHINY Sky Blue": "-TWB64 105 - SHINY Sky Blue", + "TWB64 106 - Angry Volcano Ver.": "-TWB64 106 - Angry Volcano Ver.", + "TWB64 107 - Yo-kai Pink": "-TWB64 107 - Yo-kai Pink", + "TWB64 108 - Yo-kai Green": "-TWB64 108 - Yo-kai Green", + "TWB64 109 - Yo-kai Blue": "-TWB64 109 - Yo-kai Blue", + "TWB64 110 - Yo-kai Purple": "-TWB64 110 - Yo-kai Purple", + "TWB64 111 - Aquatic Iro": "-TWB64 111 - Aquatic Iro", + "TWB64 112 - Tea Midori": "-TWB64 112 - Tea Midori", + "TWB64 113 - Sakura Pink": "-TWB64 113 - Sakura Pink", + "TWB64 114 - Wisteria Murasaki": "-TWB64 114 - Wisteria Murasaki", + "TWB64 115 - Oni Aka": "-TWB64 115 - Oni Aka", + "TWB64 116 - Golden Kiiro": "-TWB64 116 - Golden Kiiro", + "TWB64 117 - Silver Shiro": "-TWB64 117 - Silver Shiro", + "TWB64 118 - Fruity Orange": "-TWB64 118 - Fruity Orange", + "TWB64 119 - AKB48 Pink": "-TWB64 119 - AKB48 Pink", + "TWB64 120 - Miku Blue": "-TWB64 120 - Miku Blue", + "TWB64 121 - Fairy Tail Red": "-TWB64 121 - Fairy Tail Red", + "TWB64 122 - Survey Corps Brown": "-TWB64 122 - Survey Corps Brown", + "TWB64 123 - Island Green": "-TWB64 123 - Island Green", + "TWB64 124 - Mania Plus Green": "-TWB64 124 - Mania Plus Green", + "TWB64 125 - Ninja Turtle Green": "-TWB64 125 - Ninja Turtle Green", + "TWB64 126 - Slime Blue": "-TWB64 126 - Slime Blue", + "TWB64 127 - Lime Midori": "-TWB64 127 - Lime Midori", + "TWB64 128 - Ghostly Aoi": "-TWB64 128 - Ghostly Aoi", + "TWB64 129 - Retro Bogeda": "-TWB64 129 - Retro Bogeda", + "TWB64 130 - Royal Blue": "-TWB64 130 - Royal Blue", + "TWB64 131 - Neon Purple": "-TWB64 131 - Neon Purple", + "TWB64 132 - Neon Orange": "-TWB64 132 - Neon Orange", + "TWB64 133 - Moonlight Vision": "-TWB64 133 - Moonlight Vision", + "TWB64 134 - Tokyo Red": "-TWB64 134 - Tokyo Red", + "TWB64 135 - Paris Gold": "-TWB64 135 - Paris Gold", + "TWB64 136 - Beijing Blue": "-TWB64 136 - Beijing Blue", + "TWB64 137 - Pac-Man Yellow": "-TWB64 137 - Pac-Man Yellow", + "TWB64 138 - Irish Green": "-TWB64 138 - Irish Green", + "TWB64 139 - Kakarot Orange": "-TWB64 139 - Kakarot Orange", + "TWB64 140 - Dragon Ball Orange": "-TWB64 140 - Dragon Ball Orange", + "TWB64 141 - Christmas Gold": "-TWB64 141 - Christmas Gold", + "TWB64 142 - Pepsi-Cola Blue": "-TWB64 142 - Pepsi-Cola Blue", + "TWB64 143 - Bubblun Green": "-TWB64 143 - Bubblun Green", + "TWB64 144 - Bobblun Blue": "-TWB64 144 - Bobblun Blue", + "TWB64 145 - Baja Blast Storm": "-TWB64 145 - Baja Blast Storm", + "TWB64 146 - Olympic Gold": "-TWB64 146 - Olympic Gold", + "TWB64 147 - Value Orange": "-TWB64 147 - Value Orange", + "TWB64 148 - Liella Purple!": "-TWB64 148 - Liella Purple!", + "TWB64 149 - Olympic Silver": "-TWB64 149 - Olympic Silver", + "TWB64 150 - Olympic Bronze": "-TWB64 150 - Olympic Bronze", + "TWB64 151 - ANA Sky Blue": "-TWB64 151 - ANA Sky Blue", + "TWB64 152 - Nijigasaki Orange": "-TWB64 152 - Nijigasaki Orange", + "TWB64 153 - HoloBlue": "-TWB64 153 - HoloBlue", + "TWB64 154 - Wrestling Red": "-TWB64 154 - Wrestling Red", + "TWB64 155 - Yoshi Egg Green": "-TWB64 155 - Yoshi Egg Green", + "TWB64 156 - Pokedex Red": "-TWB64 156 - Pokedex Red", + "TWB64 157 - Disney Dream Blue": "-TWB64 157 - Disney Dream Blue", + "TWB64 158 - Xbox Green": "-TWB64 158 - Xbox Green", + "TWB64 159 - Sonic Mega Blue": "-TWB64 159 - Sonic Mega Blue", + "TWB64 160 - G4 Orange": "-TWB64 160 - G4 Orange", + "TWB64 161 - Scarlett Green": "-TWB64 161 - Scarlett Green", + "TWB64 162 - Glitchy Blue": "-TWB64 162 - Glitchy Blue", + "TWB64 163 - Classic LCD": "-TWB64 163 - Classic LCD", + "TWB64 164 - 3DS Virtual Console Ver.": "-TWB64 164 - 3DS Virtual Console Ver.", + "TWB64 165 - PocketStation Ver.": "-TWB64 165 - PocketStation Ver.", + "TWB64 166 - Game and Gold": "-TWB64 166 - Game and Gold", + "TWB64 167 - Smurfy Blue": "-TWB64 167 - Smurfy Blue", + "TWB64 168 - Swampy Ogre Green": "-TWB64 168 - Swampy Ogre Green", + "TWB64 169 - Sailor Spinach Green": "-TWB64 169 - Sailor Spinach Green", + "TWB64 170 - Shenron Green": "-TWB64 170 - Shenron Green", + "TWB64 171 - Berserk Blood": "-TWB64 171 - Berserk Blood", + "TWB64 172 - Super Star Pink": "-TWB64 172 - Super Star Pink", + "TWB64 173 - Gamebuino Classic Ver.": "-TWB64 173 - Gamebuino Classic Ver.", + "TWB64 174 - Barbie Pink": "-TWB64 174 - Barbie Pink", + "TWB64 175 - Star Command Green": "-TWB64 175 - Star Command Green", + "TWB64 176 - Nokia 3310 Ver.": "-TWB64 176 - Nokia 3310 Ver.", + "TWB64 177 - Clover Green": "-TWB64 177 - Clover Green", + "TWB64 178 - Crash Orange": "-TWB64 178 - Crash Orange", + "TWB64 179 - Famicom Disk Yellow": "-TWB64 179 - Famicom Disk Yellow", + "TWB64 180 - Team Rocket Red": "-TWB64 180 - Team Rocket Red", + "TWB64 181 - SEIKO Timer Yellow": "-TWB64 181 - SEIKO Timer Yellow", + "TWB64 182 - PINK109": "-TWB64 182 - PINK109", + "TWB64 183 - Doraemon Blue": "-TWB64 183 - Doraemon Blue", + "TWB64 184 - Fury Blue": "-TWB64 184 - Fury Blue", + "TWB64 185 - Rockstar Orange": "-TWB64 185 - Rockstar Orange", + "TWB64 186 - Puyo Puyo Green": "-TWB64 186 - Puyo Puyo Green", + "TWB64 187 - Susan G. Pink": "-TWB64 187 - Susan G. Pink", + "TWB64 188 - Pizza Hut Red": "-TWB64 188 - Pizza Hut Red", + "TWB64 189 - Plumbob Green": "-TWB64 189 - Plumbob Green", + "TWB64 190 - Grand Ivory": "-TWB64 190 - Grand Ivory", + "TWB64 191 - Demon's Gold": "-TWB64 191 - Demon's Gold", + "TWB64 192 - SEGA Tokyo Blue": "-TWB64 192 - SEGA Tokyo Blue", + "TWB64 193 - Champion Blue": "-TWB64 193 - Champion Blue", + "TWB64 194 - DK Barrel Brown": "-TWB64 194 - DK Barrel Brown", + "TWB64 195 - Evangelion Green": "-TWB64 195 - Evangelion Green", + "TWB64 196 - Equestrian Purple": "-TWB64 196 - Equestrian Purple", + "TWB64 197 - Autobot Red": "-TWB64 197 - Autobot Red", + "TWB64 198 - Niconico Sea Green": "-TWB64 198 - Niconico Sea Green", + "TWB64 199 - Duracell Copper": "-TWB64 199 - Duracell Copper", + "TWB64 200 - TOKYO SKYTREE CLOUDY BLUE": "-TWB64 200 - TOKYO SKYTREE CLOUDY BLUE", + "gambatte gb palette twb64 2": "-gambatte gb palette twb64 2", + "PixelShift 01 - Arctic Green": "-PixelShift 01 - Arctic Green", + "PixelShift 02 - Arduboy": "-PixelShift 02 - Arduboy", + "PixelShift 03 - BGB 0.3 Emulator": "-PixelShift 03 - BGB 0.3 Emulator", + "PixelShift 04 - Camouflage": "-PixelShift 04 - Camouflage", + "PixelShift 05 - Chocolate Bar": "-PixelShift 05 - Chocolate Bar", + "PixelShift 06 - CMYK": "-PixelShift 06 - CMYK", + "PixelShift 07 - Cotton Candy": "-PixelShift 07 - Cotton Candy", + "PixelShift 08 - Easy Greens": "-PixelShift 08 - Easy Greens", + "PixelShift 09 - Gamate": "-PixelShift 09 - Gamate", + "PixelShift 10 - Game Boy Light": "-PixelShift 10 - Game Boy Light", + "PixelShift 11 - Game Boy Pocket": "-PixelShift 11 - Game Boy Pocket", + "PixelShift 12 - Game Boy Pocket Alt": "-PixelShift 12 - Game Boy Pocket Alt", + "PixelShift 13 - Game Pocket Computer": "-PixelShift 13 - Game Pocket Computer", + "PixelShift 14 - Game & Watch Ball": "-PixelShift 14 - Game & Watch Ball", + "PixelShift 15 - GB Backlight Blue": "-PixelShift 15 - GB Backlight Blue", + "PixelShift 16 - GB Backlight Faded": "-PixelShift 16 - GB Backlight Faded", + "PixelShift 17 - GB Backlight Orange": "-PixelShift 17 - GB Backlight Orange", + "PixelShift 18 - GB Backlight White ": "-PixelShift 18 - GB Backlight White ", + "PixelShift 19 - GB Backlight Yellow Dark": "-PixelShift 19 - GB Backlight Yellow Dark", + "PixelShift 20 - GB Bootleg": "-PixelShift 20 - GB Bootleg", + "PixelShift 21 - GB Hunter": "-PixelShift 21 - GB Hunter", + "PixelShift 22 - GB Kiosk": "-PixelShift 22 - GB Kiosk", + "PixelShift 23 - GB Kiosk 2": "-PixelShift 23 - GB Kiosk 2", + "PixelShift 24 - GB New": "-PixelShift 24 - GB New", + "PixelShift 25 - GB Nuked": "-PixelShift 25 - GB Nuked", + "PixelShift 26 - GB Old": "-PixelShift 26 - GB Old", + "PixelShift 27 - GBP Bivert": "-PixelShift 27 - GBP Bivert", + "PixelShift 28 - GB Washed Yellow Backlight": "-PixelShift 28 - GB Washed Yellow Backlight", + "PixelShift 29 - Ghost": "-PixelShift 29 - Ghost", + "PixelShift 30 - Glow In The Dark": "-PixelShift 30 - Glow In The Dark", + "PixelShift 31 - Gold Bar": "-PixelShift 31 - Gold Bar", + "PixelShift 32 - Grapefruit": "-PixelShift 32 - Grapefruit", + "PixelShift 33 - Gray Green Mix": "-PixelShift 33 - Gray Green Mix", + "PixelShift 34 - Missingno": "-PixelShift 34 - Missingno", + "PixelShift 35 - MS-Dos": "-PixelShift 35 - MS-Dos", + "PixelShift 36 - Newspaper": "-PixelShift 36 - Newspaper", + "PixelShift 37 - Pip-Boy": "-PixelShift 37 - Pip-Boy", + "PixelShift 38 - Pocket Girl": "-PixelShift 38 - Pocket Girl", + "PixelShift 39 - Silhouette": "-PixelShift 39 - Silhouette", + "PixelShift 40 - Sunburst": "-PixelShift 40 - Sunburst", + "PixelShift 41 - Technicolor": "-PixelShift 41 - Technicolor", + "PixelShift 42 - Tron": "-PixelShift 42 - Tron", + "PixelShift 43 - Vaporwave": "-PixelShift 43 - Vaporwave", + "PixelShift 44 - Virtual Boy": "-PixelShift 44 - Virtual Boy", + "PixelShift 45 - Wish": "-PixelShift 45 - Wish", + "gambatte gb palette pixelshift 1": "-gambatte gb palette pixelshift 1", + "gambatte dark filter level": "-gambatte dark filter level", + "GB": "-GB", + "GBC": "-GBC", + "GBA": "-GBA", + "gambatte gb hwmode": "-gambatte gb hwmode", + "gambatte turbo period": "-gambatte turbo period", + "gambatte rumble level": "-gambatte rumble level", + "pcsx rearmed psxclock": "-pcsx rearmed psxclock", + "pcsx rearmed frameskip threshold": "-pcsx rearmed frameskip threshold", + "pcsx rearmed frameskip interval": "-pcsx rearmed frameskip interval", + "pcsx rearmed input sensitivity": "-pcsx rearmed input sensitivity", + "pcsx rearmed gunconadjustx": "-pcsx rearmed gunconadjustx", + "pcsx rearmed gunconadjusty": "-pcsx rearmed gunconadjusty", + "pcsx rearmed gunconadjustratiox": "-pcsx rearmed gunconadjustratiox", + "pcsx rearmed gunconadjustratioy": "-pcsx rearmed gunconadjustratioy", + "Japan NTSC": "-Japan NTSC", + "Japan PAL": "-Japan PAL", + "US": "-US", + "Europe": "-Europe", + "picodrive region": "-picodrive region", + "Game Gear": "-Game Gear", + "Master System": "-Master System", + "SG-1000": "-SG-1000", + "SC-3000": "-SC-3000", + "picodrive smstype": "-picodrive smstype", + "Sega": "-Sega", + "Codemasters": "-Codemasters", + "Korea": "-Korea", + "Korea MSX": "-Korea MSX", + "Korea X-in-1": "-Korea X-in-1", + "Korea 4-Pak": "-Korea 4-Pak", + "Korea Janggun": "-Korea Janggun", + "Korea Nemesis": "-Korea Nemesis", + "Taiwan 8K RAM": "-Taiwan 8K RAM", + "picodrive smsmapper": "-picodrive smsmapper", + "PAR": "-PAR", + "CRT": "-CRT", + "picodrive aspect": "-picodrive aspect", + "native": "-native", + "picodrive sound rate": "-picodrive sound rate", + "picodrive lowpass range": "-picodrive lowpass range", + "picodrive frameskip threshold": "-picodrive frameskip threshold", + "genesis plus gx frameskip threshold": "-genesis plus gx frameskip threshold", + "genesis plus gx lowpass range": "-genesis plus gx lowpass range", + "genesis plus gx psg preamp": "-genesis plus gx psg preamp", + "genesis plus gx fm preamp": "-genesis plus gx fm preamp", + "genesis plus gx cdda volume": "-genesis plus gx cdda volume", + "genesis plus gx pcm volume": "-genesis plus gx pcm volume", + "genesis plus gx audio eq low": "-genesis plus gx audio eq low", + "genesis plus gx audio eq mid": "-genesis plus gx audio eq mid", + "genesis plus gx audio eq high": "-genesis plus gx audio eq high", + "genesis plus gx enhanced vscroll limit": "-genesis plus gx enhanced vscroll limit", + "genesis plus gx psg channel 0 volume": "-genesis plus gx psg channel 0 volume", + "genesis plus gx psg channel 1 volume": "-genesis plus gx psg channel 1 volume", + "genesis plus gx psg channel 2 volume": "-genesis plus gx psg channel 2 volume", + "genesis plus gx psg channel 3 volume": "-genesis plus gx psg channel 3 volume", + "genesis plus gx md channel 0 volume": "-genesis plus gx md channel 0 volume", + "genesis plus gx md channel 1 volume": "-genesis plus gx md channel 1 volume", + "genesis plus gx md channel 2 volume": "-genesis plus gx md channel 2 volume", + "genesis plus gx md channel 3 volume": "-genesis plus gx md channel 3 volume", + "genesis plus gx md channel 4 volume": "-genesis plus gx md channel 4 volume", + "genesis plus gx md channel 5 volume": "-genesis plus gx md channel 5 volume", + "genesis plus gx sms fm channel 0 volume": "-genesis plus gx sms fm channel 0 volume", + "genesis plus gx sms fm channel 1 volume": "-genesis plus gx sms fm channel 1 volume", + "genesis plus gx sms fm channel 2 volume": "-genesis plus gx sms fm channel 2 volume", + "genesis plus gx sms fm channel 3 volume": "-genesis plus gx sms fm channel 3 volume", + "genesis plus gx sms fm channel 4 volume": "-genesis plus gx sms fm channel 4 volume", + "genesis plus gx sms fm channel 5 volume": "-genesis plus gx sms fm channel 5 volume", + "genesis plus gx sms fm channel 6 volume": "-genesis plus gx sms fm channel 6 volume", + "genesis plus gx sms fm channel 7 volume": "-genesis plus gx sms fm channel 7 volume", + "genesis plus gx sms fm channel 8 volume": "-genesis plus gx sms fm channel 8 volume", + "anaglyph": "-anaglyph", + "cyberscope": "-cyberscope", + "side-by-side": "-side-by-side", + "vli": "-vli", + "hli": "-hli", + "vb 3dmode": "-vb 3dmode", + "black & red": "-black & red", + "black & white": "-black & white", + "black & blue": "-black & blue", + "black & cyan": "-black & cyan", + "black & electric cyan": "-black & electric cyan", + "black & green": "-black & green", + "black & magenta": "-black & magenta", + "black & yellow": "-black & yellow", + "vb color mode": "-vb color mode", + "accurate": "-accurate", + "fast": "-fast", + "vb cpu emulation": "-vb cpu emulation" } \ No newline at end of file diff --git a/semag/emulatorjs/data/localization/ru-RU.json b/semag/emulatorjs/data/localization/ru-RU.json index 51098e61..849d52fa 100644 --- a/semag/emulatorjs/data/localization/ru-RU.json +++ b/semag/emulatorjs/data/localization/ru-RU.json @@ -1,301 +1,301 @@ -{ - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7", - "8": "8", - "9": "9", - "Restart": "Перезапуск", - "Pause": "Пауза", - "Play": "Играть", - "Save State": "Сохранить состояние", - "Load State": "Состояние загрузки", - "Control Settings": "Настройки управления", - "Cheats": "Читы", - "Cache Manager": "Менеджер кеша", - "Export Save File": "Экспорт файла сохранения", - "Import Save File": "Импорт файла сохранения", - "Netplay": "Сетевая игра", - "Mute": "Немой", - "Unmute": "Включить звук", - "Settings": "Настройки", - "Enter Fullscreen": "Войти в полноэкранный режим", - "Exit Fullscreen": "Выйти из полноэкранного режима", - "Reset": "Перезагрузить", - "Clear": "Прозрачный", - "Close": "Закрывать", - "QUICK SAVE STATE": "СОСТОЯНИЕ БЫСТРОГО СОХРАНЕНИЯ", - "QUICK LOAD STATE": "СОСТОЯНИЕ БЫСТРОЙ НАГРУЗКИ", - "CHANGE STATE SLOT": "ИЗМЕНИТЬ СОСТОЯНИЕ СЛОТА", - "FAST FORWARD": "ПЕРЕМОТКА ВПЕРЕД", - "Player": "Игрок", - "Connected Gamepad": "Подключенный геймпад", - "Gamepad": "Геймпад", - "Keyboard": "Клавиатура", - "Set": "Набор", - "Add Cheat": "Добавить чит", - "Create a Room": "Создать комнату", - "Rooms": "Номера", - "Start Game": "Начать игру", - "Loading...": "Загрузка...", - "Download Game Core": "Скачать игровое ядро", - "Decompress Game Core": "Распаковать игровое ядро", - "Download Game Data": "Скачать игровые данные", - "Decompress Game Data": "Распаковать игровые данные", - "Shaders": "Шейдеры", - "Disabled": "Неполноценный", - "2xScaleHQ": "2xScaleHQ", - "4xScaleHQ": "4xScaleHQ", - "CRT easymode": "ЭЛТ простой режим", - "CRT aperture": "ЭЛТ-диафрагма", - "CRT geom": "ЭЛТ геом", - "CRT mattias": "ЭЛТ Маттиас", - "FPS": "FPS", - "show": "показывать", - "hide": "скрывать", - "Fast Forward Ratio": "Скорость перемотки вперед", - "Fast Forward": "Перемотка вперед", - "Enabled": "Включено", - "Save State Slot": "Слот сохранения состояния", - "Save State Location": "Сохранить местоположение состояния", - "Download": "Скачать", - "Keep in Browser": "Сохранить в браузере", - "Auto": "Авто", - "NTSC": "НТСК", - "PAL": "ПРИЯТЕЛЬ", - "Dendy": "Денди", - "8:7 PAR": "8:7 пар.", - "4:3": "4:3", - "Low": "Низкий", - "High": "Высокий", - "Very High": "Очень высоко", - "None": "Никто", - "Player 1": "Игрок 1", - "Player 2": "Игрок 2", - "Both": "Оба", - "SAVED STATE TO SLOT": "СОХРАНЕННОЕ СОСТОЯНИЕ В СЛОТЕ", - "LOADED STATE FROM SLOT": "ЗАГРУЖЕННОЕ СОСТОЯНИЕ ИЗ СЛОТА", - "SET SAVE STATE SLOT TO": "УСТАНОВИТЕ СЛОТ СОХРАНЕНИЯ СОСТОЯНИЯ В", - "Network Error": "Ошибка сети", - "Submit": "Представлять на рассмотрение", - "Description": "Описание", - "Code": "Код", - "Add Cheat Code": "Добавить чит-код", - "Leave Room": "Покинуть комнату", - "Password": "Пароль", - "Password (optional)": "Пароль (необязательно)", - "Max Players": "Максимум игроков", - "Room Name": "Название комнаты", - "Join": "Присоединиться", - "Player Name": "Имя игрока", - "Set Player Name": "Установить имя игрока", - "Left Handed Mode": "Режим левой руки", - "Virtual Gamepad": "Виртуальный геймпад", - "Disk": "Диск", - "Press Keyboard": "Нажмите Клавиатура", - "INSERT COIN": "ВСТАВЬТЕ МОНЕТУ", - "Remove": "Удалять", - "SAVE LOADED FROM BROWSER": "СОХРАНИТЬ ЗАГРУЖАЕМЫЕ ИЗ БРАУЗЕРА", - "SAVE SAVED TO BROWSER": "СОХРАНИТЬ В БРАУЗЕРЕ", - "Join the discord": "Присоединяйтесь к разногласиям", - "View on GitHub": "Посмотреть на GitHub", - "Failed to start game": "Не удалось запустить игру", - "Download Game BIOS": "Скачать БИОС игры", - "Decompress Game BIOS": "Распаковать игровой BIOS", - "Download Game Parent": "Скачать игру Родитель", - "Decompress Game Parent": "Распаковать исходную игру", - "Download Game Patch": "Скачать патч для игры", - "Decompress Game Patch": "Распаковать игровой патч", - "Download Game State": "Скачать состояние игры", - "Check console": "Проверить консоль", - "Error for site owner": "Ошибка владельца сайта", - "EmulatorJS": "ЭмуляторJS", - "Clear All": "Очистить все", - "Take Screenshot": "Сделать снимок экрана", - "Quick Save": "Быстрое сохранение", - "Quick Load": "Быстрая загрузка", - "REWIND": "ПЕРЕМОТКА", - "Rewind Enabled (requires restart)": "Включена перемотка назад (требуется перезагрузка)", - "Rewind Granularity": "Детализация перемотки назад", - "Slow Motion Ratio": "Коэффициент замедленной съемки", - "Slow Motion": "Замедленная съемка", - "Home": "Дом", - "EmulatorJS License": "ЭмуляторJS Лицензия", - "RetroArch License": "Лицензия RetroArch", - "SLOW MOTION": "ЗАМЕДЛЕННАЯ СЪЕМКА", - "A": "А", - "B": "Б", - "SELECT": "ВЫБИРАТЬ", - "START": "НАЧИНАТЬ", - "UP": "ВВЕРХ", - "DOWN": "ВНИЗ", - "LEFT": "ЛЕВЫЙ", - "RIGHT": "ВЕРНО", - "X": "Икс", - "Y": "Д", - "L": "л", - "R": "р", - "Z": "Z", - "STICK UP": "ТОРЧАТЬ", - "STICK DOWN": "НАКЛЕЙКА ВНИЗ", - "STICK LEFT": "ПАЛКА ВЛЕВО", - "STICK RIGHT": "ДЕРЖАТЬ ВПРАВО", - "C-PAD UP": "C-PAD ВВЕРХ", - "C-PAD DOWN": "C-PAD ВНИЗ", - "C-PAD LEFT": "C-PAD ЛЕВЫЙ", - "C-PAD RIGHT": "C-ПОДДЕРЖКА ПРАВАЯ", - "MICROPHONE": "МИКРОФОН", - "BUTTON 1 / START": "КНОПКА 1 / СТАРТ", - "BUTTON 2": "КНОПКА 2", - "BUTTON": "КНОПКА", - "LEFT D-PAD UP": "ЛЕВЫЙ D-PAD ВВЕРХ", - "LEFT D-PAD DOWN": "ЛЕВЫЙ D-PAD ВНИЗ", - "LEFT D-PAD LEFT": "ЛЕВЫЙ D-PAD ЛЕВЫЙ", - "LEFT D-PAD RIGHT": "ЛЕВЫЙ D-PAD ПРАВЫЙ", - "RIGHT D-PAD UP": "ПРАВАЯ крестовина вверх", - "RIGHT D-PAD DOWN": "ПРАВАЯ D-PAD ВНИЗ", - "RIGHT D-PAD LEFT": "ПРАВАЯ D-PAD ЛЕВАЯ", - "RIGHT D-PAD RIGHT": "ПРАВАЯ D-PAD ПРАВАЯ", - "C": "С", - "MODE": "РЕЖИМ", - "FIRE": "ОГОНЬ", - "RESET": "ПЕРЕЗАГРУЗИТЬ", - "LEFT DIFFICULTY A": "ЛЕВАЯ ТРУДНОСТЬ А", - "LEFT DIFFICULTY B": "ЛЕВАЯ ТРУДНОСТЬ B", - "RIGHT DIFFICULTY A": "ПРАВИЛЬНАЯ СЛОЖНОСТЬ A", - "RIGHT DIFFICULTY B": "ПРАВИЛЬНАЯ СЛОЖНОСТЬ B", - "COLOR": "ЦВЕТ", - "B/W": "Ч/Б", - "PAUSE": "ПАУЗА", - "OPTION": "ВАРИАНТ", - "OPTION 1": "ОПЦИЯ 1", - "OPTION 2": "ВАРИАНТ 2", - "L2": "L2", - "R2": "R2", - "L3": "L3", - "R3": "R3", - "L STICK UP": "L ЗАСТАТЬ", - "L STICK DOWN": "L СТИКАТЬ ВНИЗ", - "L STICK LEFT": "L РУКОЯТКА ВЛЕВО", - "L STICK RIGHT": "L ПАЛКА ВПРАВО", - "R STICK UP": "R ЗАСТАТЬ", - "R STICK DOWN": "РУКОЯТКА ВНИЗ", - "R STICK LEFT": "РУКОЯТКА ВЛЕВО", - "R STICK RIGHT": "РУКОЯТКА ВПРАВО", - "Start": "Начинать", - "Select": "Выбирать", - "Fast": "Быстрый", - "Slow": "Медленный", - "a": "а", - "b": "б", - "c": "с", - "d": "г", - "e": "е", - "f": "ф", - "g": "г", - "h": "час", - "i": "я", - "j": "Дж", - "k": "к", - "l": "л", - "m": "м", - "n": "н", - "o": "о", - "p": "п", - "q": "д", - "r": "р", - "s": "с", - "t": "т", - "u": "ты", - "v": "в", - "w": "ж", - "x": "Икс", - "y": "у", - "z": "г", - "enter": "входить", - "escape": "побег", - "space": "космос", - "tab": "вкладка", - "backspace": "назад", - "delete": "удалить", - "arrowup": "стрелка вверх", - "arrowdown": "стрелка вниз", - "arrowleft": "стрелка влево", - "arrowright": "стреларайт", - "f1": "f1", - "f2": "f2", - "f3": "f3", - "f4": "f4", - "f5": "f5", - "f6": "f6", - "f7": "f7", - "f8": "f8", - "f9": "f9", - "f10": "f10", - "f11": "f11", - "f12": "f12", - "shift": "сдвиг", - "control": "контроль", - "alt": "альтернативный", - "meta": "мета", - "capslock": "капслок", - "insert": "вставлять", - "home": "дом", - "end": "конец", - "pageup": "подкачка", - "pagedown": "листать вниз", - "!": "!", - "@": "@", - "#": "#", - "$": "$", - "%": "%", - "^": "^", - "&": "&", - "*": "*", - "(": "(", - ")": ")", - "-": "-", - "_": "_", - "+": "+", - "=": "\"=\"", - "[": "[", - "]": "]", - "{": "{", - "}": "}", - ";": ";", - ":": ":", - "'": "'", - "\"": "\"", - ",": ",", - ".": ".", - "<": "<", - ">": ">", - "/": "/", - "?": "?", - "LEFT_STICK_X": "LEFT_STICK_X", - "LEFT_STICK_Y": "LEFT_STICK_Y", - "RIGHT_STICK_X": "RIGHT_STICK_X", - "RIGHT_STICK_Y": "RIGHT_STICK_Y", - "LEFT_TRIGGER": "LEFT_TRIGGER", - "RIGHT_TRIGGER": "RIGHT_TRIGGER", - "A_BUTTON": "КНОПКА", - "B_BUTTON": "B_BUTTON", - "X_BUTTON": "X_BUTTON", - "Y_BUTTON": "Y_BUTTON", - "START_BUTTON": "КНОПКА ПУСК", - "SELECT_BUTTON": "SELECT_BUTTON", - "L1_BUTTON": "L1_BUTTON", - "R1_BUTTON": "R1_BUTTON", - "L2_BUTTON": "L2_BUTTON", - "R2_BUTTON": "R2_BUTTON", - "LEFT_THUMB_BUTTON": "LEFT_THUMB_BUTTON", - "RIGHT_THUMB_BUTTON": "RIGHT_THUMB_BUTTON", - "DPAD_UP": "DPAD_UP", - "DPAD_DOWN": "DPAD_DOWN", - "DPAD_LEFT": "DPAD_LEFT", - "DPAD_RIGHT": "DPAD_RIGHT" +{ + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7", + "8": "8", + "9": "9", + "Restart": "Перезапустить", + "Pause": "Пауза", + "Play": "Играть", + "Save State": "Сохранить состояние", + "Load State": "Загрузить состояние", + "Control Settings": "Настройки управления", + "Cheats": "Читы", + "Cache Manager": "Управление кешем", + "Export Save File": "Экспорт файла сохранения", + "Import Save File": "Импорт файла сохранения", + "Netplay": "Сетевая игра", + "Mute": "Выключить звук", + "Unmute": "Включить звук", + "Settings": "Настройки", + "Enter Fullscreen": "Перейти в полноэкранный режим", + "Exit Fullscreen": "Выйти из полноэкранного режима", + "Reset": "Сбросить", + "Clear": "Очистить", + "Close": "Закрыть", + "QUICK SAVE STATE": "БЫСТРОЕ СОХРАНЕНИЕ СОСТОЯНИЯ", + "QUICK LOAD STATE": "БЫСТРАЯ ЗАГРУЗКА СОСТОЯНИЯ", + "CHANGE STATE SLOT": "ИЗМЕНИТЬ СЛОТ СОСТОЯНИЯ", + "FAST FORWARD": "ПЕРЕМОТКА ВПЕРЕД", + "Player": "Игрок", + "Connected Gamepad": "Подключенный геймпад", + "Gamepad": "Геймпад", + "Keyboard": "Клавиатура", + "Set": "Установить", + "Add Cheat": "Добавить чит", + "Create a Room": "Создать комнату", + "Rooms": "Комнаты", + "Start Game": "Начать игру", + "Loading...": "Загрузка...", + "Download Game Core": "Скачивание игрового ядра", + "Decompress Game Core": "Распаковка игрового ядра", + "Download Game Data": "Скачивание игровых данных", + "Decompress Game Data": "Распаковка игровых данных", + "Shaders": "Шейдеры", + "Disabled": "Отключено", + "2xScaleHQ": "Масштаб 2x HQ", + "4xScaleHQ": "Масштаб 4x HQ", + "CRT easymode": "ЭЛТ easymode", + "CRT aperture": "ЭЛТ aperture", + "CRT geom": "ЭЛТ geom", + "CRT mattias": "ЭЛТ matias", + "FPS": "FPS", + "show": "Показать", + "hide": "Скрыть", + "Fast Forward Ratio": "Скорость перемотки вперед", + "Fast Forward": "Перемотка вперед", + "Enabled": "Включено", + "Save State Slot": "Слот сохранения состояния", + "Save State Location": "Расположение сохраненного состояния", + "Download": "Скачать", + "Keep in Browser": "Сохранить в браузере", + "Auto": "Авто", + "NTSC": "NTSC", + "PAL": "PAL", + "Dendy": "Денди", + "8:7 PAR": "8:7 PAR", + "4:3": "4:3", + "Low": "Низко", + "High": "Высоко", + "Very High": "Очень высоко", + "None": "Ничего", + "Player 1": "Игрок 1", + "Player 2": "Игрок 2", + "Both": "Оба", + "SAVED STATE TO SLOT": "СОСТОЯНИЕ СОХРАНЕНО В СЛОТ", + "LOADED STATE FROM SLOT": "СОСТОЯНИЕ ЗАГРУЖЕНО ИЗ СЛОТА", + "SET SAVE STATE SLOT TO": "СЛОТ СОСТОЯНИЯ УСТАНОВЛЕН В", + "Network Error": "Ошибка сети", + "Submit": "Отправить", + "Description": "Описание", + "Code": "Код", + "Add Cheat Code": "Добавить чит-код", + "Leave Room": "Покинуть комнату", + "Password": "Пароль", + "Password (optional)": "Пароль (необязательно)", + "Max Players": "Максимум игроков", + "Room Name": "Название комнаты", + "Join": "Присоединиться", + "Player Name": "Имя игрока", + "Set Player Name": "Установить имя игрока", + "Left Handed Mode": "Режим для левши", + "Virtual Gamepad": "Виртуальный геймпад", + "Disk": "Диск", + "Press Keyboard": "Нажмите кнопку на клавиатуре", + "INSERT COIN": "ВСТАВЬТЕ МОНЕТУ", + "Remove": "Удалить", + "SAVE LOADED FROM BROWSER": "ЗАГРУЖЕНО ИЗ БРАУЗЕРА", + "SAVE SAVED TO BROWSER": "СОХРАНЕНО В БРАУЗЕРЕ", + "Join the discord": "Присоединяйтесь к discord", + "View on GitHub": "Посмотреть на GitHub", + "Failed to start game": "Не удалось запустить игру", + "Download Game BIOS": "Скачивание игрового BIOS", + "Decompress Game BIOS": "Распаковка игрового BIOS", + "Download Game Parent": "Скачивание дополнительных файлов игры", + "Decompress Game Parent": "Распаковка дополнительных файлов игры", + "Download Game Patch": "Скачивание патча для игры", + "Decompress Game Patch": "Распаковка патча для игры", + "Download Game State": "Скачивание состояния игры", + "Check console": "Проверьте консоль", + "Error for site owner": "Ошибка для владельца сайта", + "EmulatorJS": "EmulatorJS", + "Clear All": "Очистить все", + "Take Screenshot": "Сделать снимок экрана", + "Quick Save": "Быстрое сохранение", + "Quick Load": "Быстрая загрузка", + "REWIND": "ПЕРЕМОТКА НАЗАД", + "Rewind Enabled (requires restart)": "Включить перемотку назад (требуется перезапуск)", + "Rewind Granularity": "Скорость перемотки назад", + "Slow Motion Ratio": "Коэффициент замедления", + "Slow Motion": "Замедление", + "Home": "Домой", + "EmulatorJS License": "Лицензия EmulatorJS", + "RetroArch License": "Лицензия RetroArch", + "SLOW MOTION": "ЗАМЕДЛЕННИЕ", + "A": "A", + "B": "B", + "SELECT": "SELECT", + "START": "START", + "UP": "ВВЕРХ", + "DOWN": "ВНИЗ", + "LEFT": "ВЛЕВО", + "RIGHT": "ВПРАВО", + "X": "X", + "Y": "Y", + "L": "L", + "R": "R", + "Z": "Z", + "STICK UP": "СТИК ВВЕРХ", + "STICK DOWN": "СТИК ВНИЗ", + "STICK LEFT": "СТИК ВЛЕВО", + "STICK RIGHT": "СТИК ВПРАВО", + "C-PAD UP": "C-PAD ВВЕРХ", + "C-PAD DOWN": "C-PAD ВНИЗ", + "C-PAD LEFT": "C-PAD ВЛЕВО", + "C-PAD RIGHT": "C-PAD ВПРАВО", + "MICROPHONE": "МИКРОФОН", + "BUTTON 1 / START": "BUTTON 1 / START", + "BUTTON 2": "BUTTON 2", + "BUTTON": "КНОПКА", + "LEFT D-PAD UP": "ЛЕВЫЙ D-PAD ВВЕРХ", + "LEFT D-PAD DOWN": "ЛЕВЫЙ D-PAD ВНИЗ", + "LEFT D-PAD LEFT": "ЛЕВЫЙ D-PAD ВЛЕВО", + "LEFT D-PAD RIGHT": "ЛЕВЫЙ D-PAD ВПРАВО", + "RIGHT D-PAD UP": "ПРАВЫЙ D-PAD ВВЕРХ", + "RIGHT D-PAD DOWN": "ПРАВЫЙ D-PAD ВНИЗ", + "RIGHT D-PAD LEFT": "ПРАВЫЙ D-PAD ВЛЕВО", + "RIGHT D-PAD RIGHT": "ПРАВЫЙ D-PAD ВПРАВО", + "C": "С", + "MODE": "MODE", + "FIRE": "ОГОНЬ", + "RESET": "СБРОС", + "LEFT DIFFICULTY A": "ЛЕВАЯ СЛОЖНОСТЬ А", + "LEFT DIFFICULTY B": "ЛЕВАЯ СЛОЖНОСТЬ B", + "RIGHT DIFFICULTY A": "ПРАВАЯ СЛОЖНОСТЬ A", + "RIGHT DIFFICULTY B": "ПРАВАЯ СЛОЖНОСТЬ B", + "COLOR": "COLOR", + "B/W": "B/W", + "PAUSE": "PAUSE", + "OPTION": "OPTION", + "OPTION 1": "OPTION 1", + "OPTION 2": "OPTION 2", + "L2": "L2", + "R2": "R2", + "L3": "L3", + "R3": "R3", + "L STICK UP": "ЛЕЫЙ СТИК ВВЕРХ", + "L STICK DOWN": "ЛЕЫЙ СТИК ВНИЗ", + "L STICK LEFT": "ЛЕЫЙ СТИК ВЛЕВО", + "L STICK RIGHT": "ЛЕЫЙ СТИК ВПРАВО", + "R STICK UP": "ПРАВЫЙ СТИК ВВЕРХ", + "R STICK DOWN": "ПРАВЫЙ СТИК ВНИЗ", + "R STICK LEFT": "ПРАВЫЙ СТИК ВЛЕВО", + "R STICK RIGHT": "ПРАВЫЙ СТИК ВПРАВО", + "Start": "Start", + "Select": "Select", + "Fast": "Fast", + "Slow": "Slow", + "a": "a", + "b": "b", + "c": "c", + "d": "d", + "e": "e", + "f": "f", + "g": "g", + "h": "h", + "i": "i", + "j": "j", + "k": "k", + "l": "l", + "m": "m", + "n": "n", + "o": "o", + "p": "p", + "q": "q", + "r": "r", + "s": "s", + "t": "t", + "u": "u", + "v": "v", + "w": "w", + "x": "x", + "y": "y", + "z": "z", + "enter": "Ввод", + "escape": "Esc", + "space": "Пробел", + "tab": "Tab", + "backspace": "Backspace", + "delete": "Del", + "arrowup": "Стрелка вверх", + "arrowdown": "Стрелка вниз", + "arrowleft": "Стрелка влево", + "arrowright": "Стрелка вправо", + "f1": "F1", + "f2": "F2", + "f3": "F3", + "f4": "F4", + "f5": "F5", + "f6": "F6", + "f7": "F7", + "f8": "F8", + "f9": "F9", + "f10": "F10", + "f11": "F11", + "f12": "F12", + "shift": "Shift", + "control": "Ctrl", + "alt": "Alt", + "meta": "Meta", + "capslock": "Caps Lock", + "insert": "Insert", + "home": "Home", + "end": "End", + "pageup": "PgUp", + "pagedown": "PgDown", + "!": "!", + "@": "@", + "#": "#", + "$": "$", + "%": "%", + "^": "^", + "&": "&", + "*": "*", + "(": "(", + ")": ")", + "-": "-", + "_": "_", + "+": "+", + "=": "\"=\"", + "[": "[", + "]": "]", + "{": "{", + "}": "}", + ";": ";", + ":": ":", + "'": "'", + "\"": "\"", + ",": ",", + ".": ".", + "<": "<", + ">": ">", + "/": "/", + "?": "?", + "LEFT_STICK_X": "ЛЕВЫЙ_СТИК_X", + "LEFT_STICK_Y": "ЛЕВЫЙ_СТИК_Y", + "RIGHT_STICK_X": "ПРАВЫЙ_СТИК_X", + "RIGHT_STICK_Y": "ПРАВЫЙ_СТИК_Y", + "LEFT_TRIGGER": "ЛЕВЫЙ_ТРИГГЕР", + "RIGHT_TRIGGER": "ПРАВЫЙ_ТРИГГЕР", + "A_BUTTON": "КНОПКА_A", + "B_BUTTON": "КНОПКА_B", + "X_BUTTON": "КНОПКА_X", + "Y_BUTTON": "КНОПКА_Y", + "START_BUTTON": "КНОПКА_START", + "SELECT_BUTTON": "КНОПКА_SELECT", + "L1_BUTTON": "КНОПКА_L1", + "R1_BUTTON": "КНОПКА_R1", + "L2_BUTTON": "КНОПКА_L2", + "R2_BUTTON": "КНОПКА_R2", + "LEFT_THUMB_BUTTON": "ЛЕВАЯ_КНОПКА_БП", + "RIGHT_THUMB_BUTTON": "ПРАВАЯ_КНОПКА_БП", + "DPAD_UP": "DPAD_ВВЕРХ", + "DPAD_DOWN": "DPAD_ВНИЗ", + "DPAD_LEFT": "DPAD_ВЛЕВО", + "DPAD_RIGHT": "DPAD_СПРАВО" } \ No newline at end of file diff --git a/semag/emulatorjs/data/localization/zh-CN.json b/semag/emulatorjs/data/localization/zh-CN.json index 580aa2e5..d5eda6bf 100644 --- a/semag/emulatorjs/data/localization/zh-CN.json +++ b/semag/emulatorjs/data/localization/zh-CN.json @@ -1,301 +1,301 @@ -{ - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7", - "8": "8", - "9": "9", - "Restart": "重新开始", - "Pause": "暂停", - "Play": "玩", - "Save State": "保存状态", - "Load State": "负载状态", - "Control Settings": "控制设置", - "Cheats": "秘籍", - "Cache Manager": "缓存管理器", - "Export Save File": "导出保存文件", - "Import Save File": "导入保存文件", - "Netplay": "网络游戏", - "Mute": "沉默的", - "Unmute": "取消静音", - "Settings": "设置", - "Enter Fullscreen": "进入全屏", - "Exit Fullscreen": "退出全屏", - "Reset": "重置", - "Clear": "清除", - "Close": "关闭", - "QUICK SAVE STATE": "快速保存状态", - "QUICK LOAD STATE": "快速加载状态", - "CHANGE STATE SLOT": "改变状态槽", - "FAST FORWARD": "快进", - "Player": "玩家", - "Connected Gamepad": "连接游戏手柄", - "Gamepad": "游戏手柄", - "Keyboard": "键盘", - "Set": "放", - "Add Cheat": "添加作弊", - "Create a Room": "创建房间", - "Rooms": "客房", - "Start Game": "开始游戏", - "Loading...": "正在加载...", - "Download Game Core": "下载游戏核心", - "Decompress Game Core": "解压游戏核心", - "Download Game Data": "下载游戏数据", - "Decompress Game Data": "解压游戏数据", - "Shaders": "着色器", - "Disabled": "残疾人", - "2xScaleHQ": "2xScaleHQ", - "4xScaleHQ": "4xScaleHQ", - "CRT easymode": "CRT简易模式", - "CRT aperture": "CRT孔径", - "CRT geom": "CRT几何", - "CRT mattias": "CRT马蒂亚斯", - "FPS": "FPS", - "show": "展示", - "hide": "隐藏", - "Fast Forward Ratio": "快进比率", - "Fast Forward": "快进", - "Enabled": "启用", - "Save State Slot": "保存状态槽", - "Save State Location": "保存状态位置", - "Download": "下载", - "Keep in Browser": "保留在浏览器中", - "Auto": "汽车", - "NTSC": "NTSC", - "PAL": "朋友", - "Dendy": "丹迪", - "8:7 PAR": "8:7 帕", - "4:3": "4:3", - "Low": "低的", - "High": "高的", - "Very High": "很高", - "None": "没有任何", - "Player 1": "玩家1", - "Player 2": "玩家2", - "Both": "两个都", - "SAVED STATE TO SLOT": "已将状态保存到插槽", - "LOADED STATE FROM SLOT": "从插槽加载状态", - "SET SAVE STATE SLOT TO": "将保存状态槽设置为", - "Network Error": "网络错误", - "Submit": "提交", - "Description": "描述", - "Code": "代码", - "Add Cheat Code": "添加作弊码", - "Leave Room": "留出空间", - "Password": "密码", - "Password (optional)": "密码(可选)", - "Max Players": "最大玩家数", - "Room Name": "房间名称", - "Join": "加入", - "Player Name": "参赛者姓名", - "Set Player Name": "设置玩家名称", - "Left Handed Mode": "左手模式", - "Virtual Gamepad": "虚拟游戏手柄", - "Disk": "磁盘", - "Press Keyboard": "按键盘", - "INSERT COIN": "投币", - "Remove": "消除", - "SAVE LOADED FROM BROWSER": "保存从浏览器加载", - "SAVE SAVED TO BROWSER": "保存 已保存到浏览器", - "Join the discord": "加入不和谐的行列", - "View on GitHub": "在 GitHub 上查看", - "Failed to start game": "无法开始游戏", - "Download Game BIOS": "下载游戏BIOS", - "Decompress Game BIOS": "解压游戏BIOS", - "Download Game Parent": "下载游戏家长", - "Decompress Game Parent": "解压游戏父级", - "Download Game Patch": "下载游戏补丁", - "Decompress Game Patch": "解压游戏补丁", - "Download Game State": "下载游戏状态", - "Check console": "检查控制台", - "Error for site owner": "网站所有者的错误", - "EmulatorJS": "模拟器JS", - "Clear All": "全部清除", - "Take Screenshot": "截图", - "Quick Save": "快速保存", - "Quick Load": "快速加载", - "REWIND": "倒带", - "Rewind Enabled (requires restart)": "已启用快退(需要重新启动)", - "Rewind Granularity": "倒回粒度", - "Slow Motion Ratio": "慢动作比率", - "Slow Motion": "慢动作", - "Home": "家", - "EmulatorJS License": "EmulatorJS 许可证", - "RetroArch License": "RetroArch 许可证", - "SLOW MOTION": "慢动作", - "A": "A", - "B": "乙", - "SELECT": "选择", - "START": "开始", - "UP": "向上", - "DOWN": "向下", - "LEFT": "左边", - "RIGHT": "正确的", - "X": "X", - "Y": "是", - "L": "L", - "R": "右", - "Z": "Z", - "STICK UP": "竖起", - "STICK DOWN": "坚持下来", - "STICK LEFT": "向左摇杆", - "STICK RIGHT": "向右摇杆", - "C-PAD UP": "C-PAD 向上", - "C-PAD DOWN": "C-PAD 向下", - "C-PAD LEFT": "C-PAD 左", - "C-PAD RIGHT": "C-PAD 右", - "MICROPHONE": "麦克风", - "BUTTON 1 / START": "按钮 1 / 开始", - "BUTTON 2": "按钮2", - "BUTTON": "按钮", - "LEFT D-PAD UP": "左方向键向上", - "LEFT D-PAD DOWN": "左方向键按下", - "LEFT D-PAD LEFT": "左方向键左", - "LEFT D-PAD RIGHT": "左方向键 右", - "RIGHT D-PAD UP": "右方向键向上", - "RIGHT D-PAD DOWN": "右方向键向下", - "RIGHT D-PAD LEFT": "右方向键 左", - "RIGHT D-PAD RIGHT": "右方向键右", - "C": "C", - "MODE": "模式", - "FIRE": "火", - "RESET": "重置", - "LEFT DIFFICULTY A": "左难度A", - "LEFT DIFFICULTY B": "左难度B", - "RIGHT DIFFICULTY A": "正确难度A", - "RIGHT DIFFICULTY B": "正确难度B", - "COLOR": "颜色", - "B/W": "黑白", - "PAUSE": "暂停", - "OPTION": "选项", - "OPTION 1": "选项1", - "OPTION 2": "选项2", - "L2": "L2", - "R2": "R2", - "L3": "L3", - "R3": "R3", - "L STICK UP": "L 粘起来", - "L STICK DOWN": "L 坚持下来", - "L STICK LEFT": "L 向左摇杆", - "L STICK RIGHT": "L 向右摇杆", - "R STICK UP": "R 粘起来", - "R STICK DOWN": "R 向下摇杆", - "R STICK LEFT": "R 向左摇杆", - "R STICK RIGHT": "R 右摇杆", - "Start": "开始", - "Select": "选择", - "Fast": "快速地", - "Slow": "慢的", - "a": "A", - "b": "乙", - "c": "C", - "d": "d", - "e": "e", - "f": "F", - "g": "G", - "h": "H", - "i": "我", - "j": "j", - "k": "k", - "l": "我", - "m": "米", - "n": "n", - "o": "哦", - "p": "p", - "q": "q", - "r": "r", - "s": "s", - "t": "t", - "u": "你", - "v": "v", - "w": "w", - "x": "X", - "y": "y", - "z": "z", - "enter": "进入", - "escape": "逃脱", - "space": "空间", - "tab": "标签", - "backspace": "退格键", - "delete": "删除", - "arrowup": "向上箭头", - "arrowdown": "向下箭头", - "arrowleft": "向左箭头", - "arrowright": "向右箭头", - "f1": "f1", - "f2": "f2", - "f3": "f3", - "f4": "f4", - "f5": "f5", - "f6": "f6", - "f7": "f7", - "f8": "f8", - "f9": "f9", - "f10": "f10", - "f11": "f11", - "f12": "F12", - "shift": "转移", - "control": "控制", - "alt": "替代", - "meta": "元", - "capslock": "大写锁定", - "insert": "插入", - "home": "家", - "end": "结尾", - "pageup": "向上翻页", - "pagedown": "向下翻页", - "!": "!", - "@": "@", - "#": "#", - "$": "$", - "%": "%", - "^": "^", - "&": "&", - "*": "*", - "(": "(", - ")": ")", - "-": "-", - "_": "_", - "+": "+", - "=": "=", - "[": "[", - "]": "]", - "{": "{", - "}": "}", - ";": ";", - ":": ":", - "'": "'", - "\"": "”", - ",": ",", - ".": "。", - "<": "<", - ">": ">", - "/": "/", - "?": "?", - "LEFT_STICK_X": "LEFT_STICK_X", - "LEFT_STICK_Y": "LEFT_STICK_Y", - "RIGHT_STICK_X": "RIGHT_STICK_X", - "RIGHT_STICK_Y": "RIGHT_STICK_Y", - "LEFT_TRIGGER": "左触发", - "RIGHT_TRIGGER": "右触发", - "A_BUTTON": "一个按钮", - "B_BUTTON": "B_按钮", - "X_BUTTON": "X_按钮", - "Y_BUTTON": "Y_按钮", - "START_BUTTON": "开始按钮", - "SELECT_BUTTON": "选择按钮", - "L1_BUTTON": "L1_BUTTON", - "R1_BUTTON": "R1_按钮", - "L2_BUTTON": "L2_BUTTON", - "R2_BUTTON": "R2_BUTTON", - "LEFT_THUMB_BUTTON": "左拇指按钮", - "RIGHT_THUMB_BUTTON": "RIGHT_THUMB_BUTTON", - "DPAD_UP": "DPAD_UP", - "DPAD_DOWN": "DPAD_向下", - "DPAD_LEFT": "DPAD_左", - "DPAD_RIGHT": "DPAD_RIGHT" +{ + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7", + "8": "8", + "9": "9", + "Restart": "重新开始", + "Pause": "暂停", + "Play": "开始", + "Save State": "保存状态", + "Load State": "加载状态", + "Control Settings": "控制设置", + "Cheats": "秘籍", + "Cache Manager": "缓存管理器", + "Export Save File": "导出存档文件", + "Import Save File": "导入存档文件", + "Netplay": "网络游玩", + "Mute": "静音", + "Unmute": "取消静音", + "Settings": "设置", + "Enter Fullscreen": "进入全屏", + "Exit Fullscreen": "退出全屏", + "Reset": "重置", + "Clear": "清除", + "Close": "关闭", + "QUICK SAVE STATE": "快速保存状态", + "QUICK LOAD STATE": "快速加载状态", + "CHANGE STATE SLOT": "改变状态槽", + "FAST FORWARD": "快进", + "Player": "玩家", + "Connected Gamepad": "连接游戏手柄", + "Gamepad": "游戏手柄", + "Keyboard": "键盘", + "Set": "设置", + "Add Cheat": "添加作弊", + "Create a Room": "创建房间", + "Rooms": "房间", + "Start Game": "开始游戏", + "Loading...": "正在加载...", + "Download Game Core": "下载游戏核心", + "Decompress Game Core": "解压游戏核心", + "Download Game Data": "下载游戏数据", + "Decompress Game Data": "解压游戏数据", + "Shaders": "着色器", + "Disabled": "禁用", + "2xScaleHQ": "2xScaleHQ", + "4xScaleHQ": "4xScaleHQ", + "CRT easymode": "CRT简易模式", + "CRT aperture": "CRT荫栅式", + "CRT geom": "CRT几何", + "CRT mattias": "CRT马蒂亚斯", + "FPS": "FPS", + "show": "展示", + "hide": "隐藏", + "Fast Forward Ratio": "快进速率", + "Fast Forward": "快进", + "Enabled": "启用", + "Save State Slot": "保存状态槽", + "Save State Location": "保存状态位置", + "Download": "下载", + "Keep in Browser": "保留在浏览器中", + "Auto": "自动", + "NTSC": "NTSC", + "PAL": "PAL", + "Dendy": "Dendy", + "8:7 PAR": "8:7 PAR", + "4:3": "4:3", + "Low": "低", + "High": "高", + "Very High": "极高", + "None": "无", + "Player 1": "玩家1", + "Player 2": "玩家2", + "Both": "两者", + "SAVED STATE TO SLOT": "已将状态保存到插槽", + "LOADED STATE FROM SLOT": "已从插槽加载状态", + "SET SAVE STATE SLOT TO": "将保存状态槽设置为", + "Network Error": "网络错误", + "Submit": "提交", + "Description": "描述", + "Code": "代码", + "Add Cheat Code": "添加作弊码", + "Leave Room": "退出房间", + "Password": "密码", + "Password (optional)": "密码(可选)", + "Max Players": "最大玩家数", + "Room Name": "房间名称", + "Join": "加入", + "Player Name": "玩家名称", + "Set Player Name": "设置玩家名称", + "Left Handed Mode": "左手模式", + "Virtual Gamepad": "虚拟手柄", + "Disk": "磁盘", + "Press Keyboard": "按键盘", + "INSERT COIN": "投币", + "Remove": "消除", + "SAVE LOADED FROM BROWSER": "已从浏览器加载状态", + "SAVE SAVED TO BROWSER": "已将状态保存到浏览器", + "Join the discord": "加入discord", + "View on GitHub": "在GitHub上查看", + "Failed to start game": "无法开始游戏", + "Download Game BIOS": "下载游戏BIOS", + "Decompress Game BIOS": "解压游戏BIOS", + "Download Game Parent": "下载游戏父级", + "Decompress Game Parent": "解压游戏父级", + "Download Game Patch": "下载游戏补丁", + "Decompress Game Patch": "解压游戏补丁", + "Download Game State": "下载游戏状态", + "Check console": "检查控制台", + "Error for site owner": "给站长的错误提醒", + "EmulatorJS": "EmulatorJS", + "Clear All": "全部清除", + "Take Screenshot": "截图", + "Quick Save": "快速保存", + "Quick Load": "快速加载", + "REWIND": "快退", + "Rewind Enabled (requires restart)": "已启用快退(需要重新启动)", + "Rewind Granularity": "快退粒度", + "Slow Motion Ratio": "慢动作比率", + "Slow Motion": "慢动作", + "Home": "主页", + "EmulatorJS License": "EmulatorJS 许可证", + "RetroArch License": "RetroArch 许可证", + "SLOW MOTION": "慢动作", + "A": "A", + "B": "B", + "SELECT": "选择", + "START": "开始", + "UP": "向上", + "DOWN": "向下", + "LEFT": "向左", + "RIGHT": "向右", + "X": "X", + "Y": "Y", + "L": "L", + "R": "R", + "Z": "Z", + "STICK UP": "摇杆向上", + "STICK DOWN": "摇杆向下", + "STICK LEFT": "摇杆向左", + "STICK RIGHT": "摇杆向右", + "C-PAD UP": "C-PAD 向上", + "C-PAD DOWN": "C-PAD 向下", + "C-PAD LEFT": "C-PAD 向左", + "C-PAD RIGHT": "C-PAD 向右", + "MICROPHONE": "麦克风", + "BUTTON 1 / START": "按钮 1 / 开始", + "BUTTON 2": "按钮2", + "BUTTON": "按钮", + "LEFT D-PAD UP": "左方向键向上", + "LEFT D-PAD DOWN": "左方向键向下", + "LEFT D-PAD LEFT": "左方向键向左", + "LEFT D-PAD RIGHT": "左方向键向右", + "RIGHT D-PAD UP": "右方向键向上", + "RIGHT D-PAD DOWN": "右方向键向下", + "RIGHT D-PAD LEFT": "右方向键向左", + "RIGHT D-PAD RIGHT": "右方向键向右", + "C": "C", + "MODE": "模式", + "FIRE": "开火", + "RESET": "重置", + "LEFT DIFFICULTY A": "左难易度A", + "LEFT DIFFICULTY B": "左难易度B", + "RIGHT DIFFICULTY A": "右难易度A", + "RIGHT DIFFICULTY B": "右难易度B", + "COLOR": "彩色", + "B/W": "黑白", + "PAUSE": "暂停", + "OPTION": "选项", + "OPTION 1": "选项1", + "OPTION 2": "选项2", + "L2": "L2", + "R2": "R2", + "L3": "L3", + "R3": "R3", + "L STICK UP": "左摇杆向上", + "L STICK DOWN": "左摇杆向下", + "L STICK LEFT": "左摇杆向左", + "L STICK RIGHT": "左摇杆向右", + "R STICK UP": "右摇杆向上", + "R STICK DOWN": "右摇杆向下", + "R STICK LEFT": "右摇杆向左", + "R STICK RIGHT": "右摇杆向右", + "Start": "开始", + "Select": "选择", + "Fast": "加速", + "Slow": "减速", + "a": "a", + "b": "b", + "c": "d", + "d": "d", + "e": "e", + "f": "f", + "g": "g", + "h": "h", + "i": "i", + "j": "j", + "k": "k", + "l": "l", + "m": "m", + "n": "n", + "o": "o", + "p": "p", + "q": "q", + "r": "r", + "s": "s", + "t": "t", + "u": "u", + "v": "v", + "w": "w", + "x": "x", + "y": "y", + "z": "z", + "enter": "回车", + "escape": "Esc", + "space": "空格", + "tab": "Tab", + "backspace": "退格", + "delete": "删除", + "arrowup": "向上箭头", + "arrowdown": "向下箭头", + "arrowleft": "向左箭头", + "arrowright": "向右箭头", + "f1": "f1", + "f2": "f2", + "f3": "f3", + "f4": "f4", + "f5": "f5", + "f6": "f6", + "f7": "f7", + "f8": "f8", + "f9": "f9", + "f10": "f10", + "f11": "f11", + "f12": "F12", + "shift": "Shift", + "control": "Ctrl", + "alt": "Alt", + "meta": "Win", + "capslock": "大写锁定", + "insert": "Insert", + "home": "Home", + "end": "End", + "pageup": "向上翻页", + "pagedown": "向下翻页", + "!": "!", + "@": "@", + "#": "#", + "$": "$", + "%": "%", + "^": "^", + "&": "&", + "*": "*", + "(": "(", + ")": ")", + "-": "-", + "_": "_", + "+": "+", + "=": "=", + "[": "[", + "]": "]", + "{": "{", + "}": "}", + ";": ";", + ":": ":", + "'": "'", + "\"": "”", + ",": ",", + ".": "。", + "<": "<", + ">": ">", + "/": "/", + "?": "?", + "LEFT_STICK_X": "LEFT_STICK_X", + "LEFT_STICK_Y": "LEFT_STICK_Y", + "RIGHT_STICK_X": "RIGHT_STICK_X", + "RIGHT_STICK_Y": "RIGHT_STICK_Y", + "LEFT_TRIGGER": "左扳机", + "RIGHT_TRIGGER": "右扳机", + "A_BUTTON": "按键A", + "B_BUTTON": "按键B", + "X_BUTTON": "按键X", + "Y_BUTTON": "按键Y", + "START_BUTTON": "开始键", + "SELECT_BUTTON": "选择键", + "L1_BUTTON": "L1键", + "R1_BUTTON": "R1键", + "L2_BUTTON": "L2键", + "R2_BUTTON": "R2键", + "LEFT_THUMB_BUTTON": "左拇指按键", + "RIGHT_THUMB_BUTTON": "右拇指按键", + "DPAD_UP": "十字键向上", + "DPAD_DOWN": "十字键向下", + "DPAD_LEFT": "十字键向左", + "DPAD_RIGHT": "十字键向右" } \ No newline at end of file diff --git a/semag/emulatorjs/data/minify/README.md b/semag/emulatorjs/data/minify/README.md index 1daab784..75945a97 100644 --- a/semag/emulatorjs/data/minify/README.md +++ b/semag/emulatorjs/data/minify/README.md @@ -1,35 +1,35 @@ - -# Minifying - -Before pushing the script files onto your production
    -server it is recommended to minify them to save on
    -load times as well as bandwidth. - -
    - -## Requirements - -- **[NodeJS]** - -
    - -## Steps - -1. Open a terminal in `/data/minify` . - -2. Install the dependencies with: - - ```sh - npm install - ``` - -3. Start the minification with: - - ```sh - node index.js - ``` - - - - + +# Minifying + +Before pushing the script files onto your production
    +server it is recommended to minify them to save on
    +load times as well as bandwidth. + +
    + +## Requirements + +- **[NodeJS]** + +
    + +## Steps + +1. Open a terminal in `/data/minify` . + +2. Install the dependencies with: + + ```sh + npm install + ``` + +3. Start the minification with: + + ```sh + node index.js + ``` + + + + [NodeJS]: https://nodejs.org/en/download/ \ No newline at end of file diff --git a/semag/emulatorjs/data/minify/index.js b/semag/emulatorjs/data/minify/index.js index 8432fa4d..274cd7b8 100644 --- a/semag/emulatorjs/data/minify/index.js +++ b/semag/emulatorjs/data/minify/index.js @@ -1,27 +1,27 @@ -const UglifyJS = require("uglify-js"); -const fs = require('fs'); -const uglifycss = require('uglifycss'); - -let files = [ - 'nipplejs.js', - 'shaders.js', - 'storage.js', - 'gamepad.js', - 'GameManager.js', - 'socket.io.min.js', - 'emulator.js' -] -let code = "(function() {\n"; -for (let i=0; i /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../uglifycss/uglifycss" "$@" +else + exec node "$basedir/../uglifycss/uglifycss" "$@" +fi diff --git a/semag/emulatorjs/data/minify/node_modules/.bin/uglifycss.cmd b/semag/emulatorjs/data/minify/node_modules/.bin/uglifycss.cmd new file mode 100644 index 00000000..b475f651 --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/.bin/uglifycss.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\uglifycss\uglifycss" %* diff --git a/semag/emulatorjs/data/minify/node_modules/.bin/uglifycss.ps1 b/semag/emulatorjs/data/minify/node_modules/.bin/uglifycss.ps1 new file mode 100644 index 00000000..00a0daa9 --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/.bin/uglifycss.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../uglifycss/uglifycss" $args + } else { + & "$basedir/node$exe" "$basedir/../uglifycss/uglifycss" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../uglifycss/uglifycss" $args + } else { + & "node$exe" "$basedir/../uglifycss/uglifycss" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/semag/emulatorjs/data/minify/node_modules/.bin/uglifyjs b/semag/emulatorjs/data/minify/node_modules/.bin/uglifyjs new file mode 100644 index 00000000..56969388 --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/.bin/uglifyjs @@ -0,0 +1,16 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../uglify-js/bin/uglifyjs" "$@" +else + exec node "$basedir/../uglify-js/bin/uglifyjs" "$@" +fi diff --git a/semag/emulatorjs/data/minify/node_modules/.bin/uglifyjs.cmd b/semag/emulatorjs/data/minify/node_modules/.bin/uglifyjs.cmd new file mode 100644 index 00000000..136c7850 --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/.bin/uglifyjs.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\uglify-js\bin\uglifyjs" %* diff --git a/semag/emulatorjs/data/minify/node_modules/.bin/uglifyjs.ps1 b/semag/emulatorjs/data/minify/node_modules/.bin/uglifyjs.ps1 new file mode 100644 index 00000000..5e0bc56d --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/.bin/uglifyjs.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../uglify-js/bin/uglifyjs" $args + } else { + & "$basedir/node$exe" "$basedir/../uglify-js/bin/uglifyjs" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../uglify-js/bin/uglifyjs" $args + } else { + & "node$exe" "$basedir/../uglify-js/bin/uglifyjs" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/semag/emulatorjs/data/minify/node_modules/.package-lock.json b/semag/emulatorjs/data/minify/node_modules/.package-lock.json new file mode 100644 index 00000000..8e92407c --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/.package-lock.json @@ -0,0 +1,30 @@ +{ + "name": "emulatorjs-minify", + "version": "1.0.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/uglify-js": { + "version": "3.17.4", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", + "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/uglifycss": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/uglifycss/-/uglifycss-0.0.29.tgz", + "integrity": "sha512-J2SQ2QLjiknNGbNdScaNZsXgmMGI0kYNrXaDlr4obnPW9ni1jljb1NeEVWAiTgZ8z+EBWP2ozfT9vpy03rjlMQ==", + "bin": { + "uglifycss": "uglifycss" + }, + "engines": { + "node": ">=6.4.0" + } + } + } +} diff --git a/semag/emulatorjs/data/minify/node_modules/uglify-js/LICENSE b/semag/emulatorjs/data/minify/node_modules/uglify-js/LICENSE new file mode 100644 index 00000000..122e8fb9 --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/uglify-js/LICENSE @@ -0,0 +1,29 @@ +UglifyJS is released under the BSD license: + +Copyright 2012-2019 (c) Mihai Bazon + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. diff --git a/semag/emulatorjs/data/minify/node_modules/uglify-js/README.md b/semag/emulatorjs/data/minify/node_modules/uglify-js/README.md new file mode 100644 index 00000000..ba5f2a29 --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/uglify-js/README.md @@ -0,0 +1,1478 @@ +UglifyJS 3 +========== + +UglifyJS is a JavaScript parser, minifier, compressor and beautifier toolkit. + +#### Note: +- `uglify-js` supports JavaScript and most language features in ECMAScript. +- For more exotic parts of ECMAScript, process your source file with transpilers + like [Babel](https://babeljs.io/) before passing onto `uglify-js`. +- `uglify-js@3` has a simplified [API](#api-reference) and [CLI](#command-line-usage) + that is not backwards compatible with [`uglify-js@2`](https://github.com/mishoo/UglifyJS/tree/v2.x). + +Install +------- + +First make sure you have installed the latest version of [node.js](http://nodejs.org/) +(You may need to restart your computer after this step). + +From NPM for use as a command line app: + + npm install uglify-js -g + +From NPM for programmatic use: + + npm install uglify-js + +# Command line usage + + uglifyjs [input files] [options] + +UglifyJS can take multiple input files. It's recommended that you pass the +input files first, then pass the options. UglifyJS will parse input files +in sequence and apply any compression options. The files are parsed in the +same global scope, that is, a reference from a file to some +variable/function declared in another file will be matched properly. + +If no input file is specified, UglifyJS will read from STDIN. + +If you wish to pass your options before the input files, separate the two with +a double dash to prevent input files being used as option arguments: + + uglifyjs --compress --mangle -- input.js + +### Command line options + +``` + -h, --help Print usage information. + `--help options` for details on available options. + -V, --version Print version number. + -p, --parse Specify parser options: + `acorn` Use Acorn for parsing. + `bare_returns` Allow return outside of functions. + Useful when minifying CommonJS + modules and Userscripts that may + be anonymous function wrapped (IIFE) + by the .user.js engine `caller`. + `spidermonkey` Assume input files are SpiderMonkey + AST format (as JSON). + -c, --compress [options] Enable compressor/specify compressor options: + `pure_funcs` List of functions that can be safely + removed when their return values are + not used. + -m, --mangle [options] Mangle names/specify mangler options: + `reserved` List of names that should not be mangled. + --mangle-props [options] Mangle properties/specify mangler options: + `builtins` Mangle property names that overlaps + with standard JavaScript globals. + `debug` Add debug prefix and suffix. + `domprops` Mangle property names that overlaps + with DOM properties. + `keep_quoted` Only mangle unquoted properties. + `regex` Only mangle matched property names. + `reserved` List of names that should not be mangled. + -b, --beautify [options] Beautify output/specify output options: + `beautify` Enabled with `--beautify` by default. + `preamble` Preamble to prepend to the output. You + can use this to insert a comment, for + example for licensing information. + This will not be parsed, but the source + map will adjust for its presence. + `quote_style` Quote style: + 0 - auto + 1 - single + 2 - double + 3 - original + `wrap_iife` Wrap IIFEs in parentheses. Note: you may + want to disable `negate_iife` under + compressor options. + -O, --output-opts [options] Specify output options (`beautify` disabled by default). + -o, --output Output file path (default STDOUT). Specify `ast` or + `spidermonkey` to write UglifyJS or SpiderMonkey AST + as JSON to STDOUT respectively. + --annotations Process and preserve comment annotations. + (`/*@__PURE__*/` or `/*#__PURE__*/`) + --no-annotations Ignore and discard comment annotations. + --comments [filter] Preserve copyright comments in the output. By + default this works like Google Closure, keeping + JSDoc-style comments that contain "@license" or + "@preserve". You can optionally pass one of the + following arguments to this flag: + - "all" to keep all comments + - a valid JS RegExp like `/foo/` or `/^!/` to + keep only matching comments. + Note that currently not *all* comments can be + kept when compression is on, because of dead + code removal or cascading statements into + sequences. + --config-file Read `minify()` options from JSON file. + -d, --define [=value] Global definitions. + -e, --enclose [arg[:value]] Embed everything in a big function, with configurable + argument(s) & value(s). + --expression Parse a single expression, rather than a program + (for parsing JSON). + --ie Support non-standard Internet Explorer. + Equivalent to setting `ie: true` in `minify()` + for `compress`, `mangle` and `output` options. + By default UglifyJS will not try to be IE-proof. + --keep-fargs Do not mangle/drop function arguments. + --keep-fnames Do not mangle/drop function names. Useful for + code relying on Function.prototype.name. + --module Process input as ES module (implies --toplevel) + --name-cache File to hold mangled name mappings. + --self Build UglifyJS as a library (implies --wrap UglifyJS) + --source-map [options] Enable source map/specify source map options: + `base` Path to compute relative paths from input files. + `content` Input source map, useful if you're compressing + JS that was generated from some other original + code. Specify "inline" if the source map is + included within the sources. + `filename` Filename and/or location of the output source + (sets `file` attribute in source map). + `includeSources` Pass this flag if you want to include + the content of source files in the + source map as sourcesContent property. + `names` Include symbol names in the source map. + `root` Path to the original source to be included in + the source map. + `url` If specified, path to the source map to append in + `//# sourceMappingURL`. + --timings Display operations run time on STDERR. + --toplevel Compress and/or mangle variables in top level scope. + --v8 Support non-standard Chrome & Node.js + Equivalent to setting `v8: true` in `minify()` + for `mangle` and `output` options. + By default UglifyJS will not try to be v8-proof. + --verbose Print diagnostic messages. + --warn Print warning messages. + --webkit Support non-standard Safari/Webkit. + Equivalent to setting `webkit: true` in `minify()` + for `compress`, `mangle` and `output` options. + By default UglifyJS will not try to be Safari-proof. + --wrap Embed everything in a big function, making the + “exports” and “global” variables available. You + need to pass an argument to this option to + specify the name that your module will take + when included in, say, a browser. +``` + +Specify `--output` (`-o`) to declare the output file. Otherwise the output +goes to STDOUT. + +## CLI source map options + +UglifyJS can generate a source map file, which is highly useful for +debugging your compressed JavaScript. To get a source map, pass +`--source-map --output output.js` (source map will be written out to +`output.js.map`). + +Additional options: + +- `--source-map "filename=''"` to specify the name of the source map. The value of + `filename` is only used to set `file` attribute (see [the spec][sm-spec]) + in source map file. + +- `--source-map "root=''"` to pass the URL where the original files can be found. + +- `--source-map "names=false"` to omit symbol names if you want to reduce size + of the source map file. + +- `--source-map "url=''"` to specify the URL where the source map can be found. + Otherwise UglifyJS assumes HTTP `X-SourceMap` is being used and will omit the + `//# sourceMappingURL=` directive. + +For example: + + uglifyjs js/file1.js js/file2.js \ + -o foo.min.js -c -m \ + --source-map "root='http://foo.com/src',url='foo.min.js.map'" + +The above will compress and mangle `file1.js` and `file2.js`, will drop the +output in `foo.min.js` and the source map in `foo.min.js.map`. The source +mapping will refer to `http://foo.com/src/js/file1.js` and +`http://foo.com/src/js/file2.js` (in fact it will list `http://foo.com/src` +as the source map root, and the original files as `js/file1.js` and +`js/file2.js`). + +### Composed source map + +When you're compressing JS code that was output by a compiler such as +CoffeeScript, mapping to the JS code won't be too helpful. Instead, you'd +like to map back to the original code (i.e. CoffeeScript). UglifyJS has an +option to take an input source map. Assuming you have a mapping from +CoffeeScript → compiled JS, UglifyJS can generate a map from CoffeeScript → +compressed JS by mapping every token in the compiled JS to its original +location. + +To use this feature pass `--source-map "content='/path/to/input/source.map'"` +or `--source-map "content=inline"` if the source map is included inline with +the sources. + +## CLI compress options + +You need to pass `--compress` (`-c`) to enable the compressor. Optionally +you can pass a comma-separated list of [compress options](#compress-options). + +Options are in the form `foo=bar`, or just `foo` (the latter implies +a boolean option that you want to set `true`; it's effectively a +shortcut for `foo=true`). + +Example: + + uglifyjs file.js -c toplevel,sequences=false + +## CLI mangle options + +To enable the mangler you need to pass `--mangle` (`-m`). The following +(comma-separated) options are supported: + +- `eval` (default: `false`) — mangle names visible in scopes where `eval` or + `with` are used. + +- `reserved` (default: `[]`) — when mangling is enabled but you want to + prevent certain names from being mangled, you can declare those names with + `--mangle reserved` — pass a comma-separated list of names. For example: + + uglifyjs ... -m reserved=['$','require','exports'] + + to prevent the `require`, `exports` and `$` names from being changed. + +### CLI mangling property names (`--mangle-props`) + +**Note:** THIS WILL PROBABLY BREAK YOUR CODE. Mangling property names +is a separate step, different from variable name mangling. Pass +`--mangle-props` to enable it. It will mangle all properties in the +input code with the exception of built in DOM properties and properties +in core JavaScript classes. For example: + +```javascript +// example.js +var x = { + baz_: 0, + foo_: 1, + calc: function() { + return this.foo_ + this.baz_; + } +}; +x.bar_ = 2; +x["baz_"] = 3; +console.log(x.calc()); +``` +Mangle all properties (except for JavaScript `builtins`): +```bash +$ uglifyjs example.js -c -m --mangle-props +``` +```javascript +var x={o:0,_:1,l:function(){return this._+this.o}};x.t=2,x.o=3,console.log(x.l()); +``` +Mangle all properties except for `reserved` properties: +```bash +$ uglifyjs example.js -c -m --mangle-props reserved=[foo_,bar_] +``` +```javascript +var x={o:0,foo_:1,_:function(){return this.foo_+this.o}};x.bar_=2,x.o=3,console.log(x._()); +``` +Mangle all properties matching a `regex`: +```bash +$ uglifyjs example.js -c -m --mangle-props regex=/_$/ +``` +```javascript +var x={o:0,_:1,calc:function(){return this._+this.o}};x.l=2,x.o=3,console.log(x.calc()); +``` + +Combining mangle properties options: +```bash +$ uglifyjs example.js -c -m --mangle-props regex=/_$/,reserved=[bar_] +``` +```javascript +var x={o:0,_:1,calc:function(){return this._+this.o}};x.bar_=2,x.o=3,console.log(x.calc()); +``` + +In order for this to be of any use, we avoid mangling standard JS names by +default (`--mangle-props builtins` to override). + +A default exclusion file is provided in `tools/domprops.json` which should +cover most standard JS and DOM properties defined in various browsers. Pass +`--mangle-props domprops` to disable this feature. + +A regular expression can be used to define which property names should be +mangled. For example, `--mangle-props regex=/^_/` will only mangle property +names that start with an underscore. + +When you compress multiple files using this option, in order for them to +work together in the end we need to ensure somehow that one property gets +mangled to the same name in all of them. For this, pass `--name-cache filename.json` +and UglifyJS will maintain these mappings in a file which can then be reused. +It should be initially empty. Example: + +```bash +$ rm -f /tmp/cache.json # start fresh +$ uglifyjs file1.js file2.js --mangle-props --name-cache /tmp/cache.json -o part1.js +$ uglifyjs file3.js file4.js --mangle-props --name-cache /tmp/cache.json -o part2.js +``` + +Now, `part1.js` and `part2.js` will be consistent with each other in terms +of mangled property names. + +Using the name cache is not necessary if you compress all your files in a +single call to UglifyJS. + +### Mangling unquoted names (`--mangle-props keep_quoted`) + +Using quoted property name (`o["foo"]`) reserves the property name (`foo`) +so that it is not mangled throughout the entire script even when used in an +unquoted style (`o.foo`). Example: + +```javascript +// stuff.js +var o = { + "foo": 1, + bar: 3, +}; +o.foo += o.bar; +console.log(o.foo); +``` +```bash +$ uglifyjs stuff.js --mangle-props keep_quoted -c -m +``` +```javascript +var o={foo:1,o:3};o.foo+=o.o,console.log(o.foo); +``` + +If the minified output will be processed again by UglifyJS, consider specifying +`keep_quoted_props` so the same property names are preserved: + +```bash +$ uglifyjs stuff.js --mangle-props keep_quoted -c -m -O keep_quoted_props +``` +```javascript +var o={"foo":1,o:3};o.foo+=o.o,console.log(o.foo); +``` + +### Debugging property name mangling + +You can also pass `--mangle-props debug` in order to mangle property names +without completely obscuring them. For example the property `o.foo` +would mangle to `o._$foo$_` with this option. This allows property mangling +of a large codebase while still being able to debug the code and identify +where mangling is breaking things. + +```bash +$ uglifyjs stuff.js --mangle-props debug -c -m +``` +```javascript +var o={_$foo$_:1,_$bar$_:3};o._$foo$_+=o._$bar$_,console.log(o._$foo$_); +``` + +You can also pass a custom suffix using `--mangle-props debug=XYZ`. This would then +mangle `o.foo` to `o._$foo$XYZ_`. You can change this each time you compile a +script to identify how a property got mangled. One technique is to pass a +random number on every compile to simulate mangling changing with different +inputs (e.g. as you update the input script with new properties), and to help +identify mistakes like writing mangled keys to storage. + + +# API Reference + +Assuming installation via NPM, you can load UglifyJS in your application +like this: +```javascript +var UglifyJS = require("uglify-js"); +``` + +There is a single high level function, **`minify(code, options)`**, +which will perform all minification [phases](#minify-options) in a configurable +manner. By default `minify()` will enable the options [`compress`](#compress-options) +and [`mangle`](#mangle-options). Example: +```javascript +var code = "function add(first, second) { return first + second; }"; +var result = UglifyJS.minify(code); +console.log(result.error); // runtime error, or `undefined` if no error +console.log(result.code); // minified output: function add(n,d){return n+d} +``` + +You can `minify` more than one JavaScript file at a time by using an object +for the first argument where the keys are file names and the values are source +code: +```javascript +var code = { + "file1.js": "function add(first, second) { return first + second; }", + "file2.js": "console.log(add(1 + 2, 3 + 4));" +}; +var result = UglifyJS.minify(code); +console.log(result.code); +// function add(d,n){return d+n}console.log(add(3,7)); +``` + +The `toplevel` option: +```javascript +var code = { + "file1.js": "function add(first, second) { return first + second; }", + "file2.js": "console.log(add(1 + 2, 3 + 4));" +}; +var options = { toplevel: true }; +var result = UglifyJS.minify(code, options); +console.log(result.code); +// console.log(3+7); +``` + +The `nameCache` option: +```javascript +var options = { + mangle: { + toplevel: true, + }, + nameCache: {} +}; +var result1 = UglifyJS.minify({ + "file1.js": "function add(first, second) { return first + second; }" +}, options); +var result2 = UglifyJS.minify({ + "file2.js": "console.log(add(1 + 2, 3 + 4));" +}, options); +console.log(result1.code); +// function n(n,r){return n+r} +console.log(result2.code); +// console.log(n(3,7)); +``` + +You may persist the name cache to the file system in the following way: +```javascript +var cacheFileName = "/tmp/cache.json"; +var options = { + mangle: { + properties: true, + }, + nameCache: JSON.parse(fs.readFileSync(cacheFileName, "utf8")) +}; +fs.writeFileSync("part1.js", UglifyJS.minify({ + "file1.js": fs.readFileSync("file1.js", "utf8"), + "file2.js": fs.readFileSync("file2.js", "utf8") +}, options).code, "utf8"); +fs.writeFileSync("part2.js", UglifyJS.minify({ + "file3.js": fs.readFileSync("file3.js", "utf8"), + "file4.js": fs.readFileSync("file4.js", "utf8") +}, options).code, "utf8"); +fs.writeFileSync(cacheFileName, JSON.stringify(options.nameCache), "utf8"); +``` + +An example of a combination of `minify()` options: +```javascript +var code = { + "file1.js": "function add(first, second) { return first + second; }", + "file2.js": "console.log(add(1 + 2, 3 + 4));" +}; +var options = { + toplevel: true, + compress: { + global_defs: { + "@console.log": "alert" + }, + passes: 2 + }, + output: { + beautify: false, + preamble: "/* uglified */" + } +}; +var result = UglifyJS.minify(code, options); +console.log(result.code); +// /* uglified */ +// alert(10);" +``` + +To produce warnings: +```javascript +var code = "function f(){ var u; return 2 + 3; }"; +var options = { warnings: true }; +var result = UglifyJS.minify(code, options); +console.log(result.error); // runtime error, `undefined` in this case +console.log(result.warnings); // [ 'Dropping unused variable u [0:1,18]' ] +console.log(result.code); // function f(){return 5} +``` + +An error example: +```javascript +var result = UglifyJS.minify({"foo.js" : "if (0) else console.log(1);"}); +console.log(JSON.stringify(result.error)); +// {"message":"Unexpected token: keyword (else)","filename":"foo.js","line":1,"col":7,"pos":7} +``` +Note: unlike `uglify-js@2.x`, the `3.x` API does not throw errors. To +achieve a similar effect one could do the following: +```javascript +var result = UglifyJS.minify(code, options); +if (result.error) throw result.error; +``` + +## Minify options + +- `annotations` — pass `false` to ignore all comment annotations and elide them + from output. Useful when, for instance, external tools incorrectly applied + `/*@__PURE__*/` or `/*#__PURE__*/`. Pass `true` to both compress and retain + comment annotations in output to allow for further processing downstream. + +- `compress` (default: `{}`) — pass `false` to skip compressing entirely. + Pass an object to specify custom [compress options](#compress-options). + +- `expression` (default: `false`) — parse as a single expression, e.g. JSON. + +- `ie` (default: `false`) — enable workarounds for Internet Explorer bugs. + +- `keep_fargs` (default: `false`) — pass `true` to prevent discarding or mangling + of function arguments. + +- `keep_fnames` (default: `false`) — pass `true` to prevent discarding or mangling + of function names. Useful for code relying on `Function.prototype.name`. + +- `mangle` (default: `true`) — pass `false` to skip mangling names, or pass + an object to specify [mangle options](#mangle-options) (see below). + + - `mangle.properties` (default: `false`) — a subcategory of the mangle option. + Pass an object to specify custom [mangle property options](#mangle-properties-options). + +- `module` (default: `false`) — set to `true` if you wish to process input as + ES module, i.e. implicit `"use strict";` and support for top-level `await`, + alongside with `toplevel` enabled. + +- `nameCache` (default: `null`) — pass an empty object `{}` or a previously + used `nameCache` object if you wish to cache mangled variable and + property names across multiple invocations of `minify()`. Note: this is + a read/write property. `minify()` will read the name cache state of this + object and update it during minification so that it may be + reused or externally persisted by the user. + +- `output` (default: `null`) — pass an object if you wish to specify + additional [output options](#output-options). The defaults are optimized + for best compression. + +- `parse` (default: `{}`) — pass an object if you wish to specify some + additional [parse options](#parse-options). + +- `sourceMap` (default: `false`) — pass an object if you wish to specify + [source map options](#source-map-options). + +- `toplevel` (default: `false`) — set to `true` if you wish to enable top level + variable and function name mangling and to drop unused variables and functions. + +- `v8` (default: `false`) — enable workarounds for Chrome & Node.js bugs. + +- `warnings` (default: `false`) — pass `true` to return compressor warnings + in `result.warnings`. Use the value `"verbose"` for more detailed warnings. + +- `webkit` (default: `false`) — enable workarounds for Safari/WebKit bugs. + PhantomJS users should set this option to `true`. + +## Minify options structure + +```javascript +{ + parse: { + // parse options + }, + compress: { + // compress options + }, + mangle: { + // mangle options + + properties: { + // mangle property options + } + }, + output: { + // output options + }, + sourceMap: { + // source map options + }, + nameCache: null, // or specify a name cache object + toplevel: false, + warnings: false, +} +``` + +### Source map options + +To generate a source map: +```javascript +var result = UglifyJS.minify({"file1.js": "var a = function() {};"}, { + sourceMap: { + filename: "out.js", + url: "out.js.map" + } +}); +console.log(result.code); // minified output +console.log(result.map); // source map +``` + +Note that the source map is not saved in a file, it's just returned in +`result.map`. The value passed for `sourceMap.url` is only used to set +`//# sourceMappingURL=out.js.map` in `result.code`. The value of +`filename` is only used to set `file` attribute (see [the spec][sm-spec]) +in source map file. + +You can set option `sourceMap.url` to be `"inline"` and source map will +be appended to code. + +You can also specify sourceRoot property to be included in source map: +```javascript +var result = UglifyJS.minify({"file1.js": "var a = function() {};"}, { + sourceMap: { + root: "http://example.com/src", + url: "out.js.map" + } +}); +``` + +If you're compressing compiled JavaScript and have a source map for it, you +can use `sourceMap.content`: +```javascript +var result = UglifyJS.minify({"compiled.js": "compiled code"}, { + sourceMap: { + content: "content from compiled.js.map", + url: "minified.js.map" + } +}); +// same as before, it returns `code` and `map` +``` + +If you're using the `X-SourceMap` header instead, you can just omit `sourceMap.url`. + +If you wish to reduce file size of the source map, set option `sourceMap.names` +to be `false` and all symbol names will be omitted. + +## Parse options + +- `bare_returns` (default: `false`) — support top level `return` statements + +- `html5_comments` (default: `true`) — process HTML comment as workaround for + browsers which do not recognize `` in strings + +- `keep_quoted_props` (default: `false`) — when turned on, prevents stripping + quotes from property names in object literals. + +- `max_line_len` (default: `false`) — maximum line length (for uglified code) + +- `preamble` (default: `null`) — when passed it must be a string and + it will be prepended to the output literally. The source map will + adjust for this text. Can be used to insert a comment containing + licensing information, for example. + +- `preserve_line` (default: `false`) — pass `true` to retain line numbering on + a best effort basis. + +- `quote_keys` (default: `false`) — pass `true` to quote all keys in literal + objects + +- `quote_style` (default: `0`) — preferred quote style for strings (affects + quoted property names and directives as well): + - `0` — prefers double quotes, switches to single quotes when there are + more double quotes in the string itself. `0` is best for gzip size. + - `1` — always use single quotes + - `2` — always use double quotes + - `3` — always use the original quotes + +- `semicolons` (default: `true`) — separate statements with semicolons. If + you pass `false` then whenever possible we will use a newline instead of a + semicolon, leading to more readable output of uglified code (size before + gzip could be smaller; size after gzip insignificantly larger). + +- `shebang` (default: `true`) — preserve shebang `#!` in preamble (bash scripts) + +- `width` (default: `80`) — only takes effect when beautification is on, this + specifies an (orientative) line width that the beautifier will try to + obey. It refers to the width of the line text (excluding indentation). + It doesn't work very well currently, but it does make the code generated + by UglifyJS more readable. + +- `wrap_iife` (default: `false`) — pass `true` to wrap immediately invoked + function expressions. See + [#640](https://github.com/mishoo/UglifyJS/issues/640) for more details. + +# Miscellaneous + +### Keeping copyright notices or other comments + +You can pass `--comments` to retain certain comments in the output. By +default it will keep JSDoc-style comments that contain "@preserve", +"@license" or "@cc_on" (conditional compilation for IE). You can pass +`--comments all` to keep all the comments, or a valid JavaScript regexp to +keep only comments that match this regexp. For example `--comments /^!/` +will keep comments like `/*! Copyright Notice */`. + +Note, however, that there might be situations where comments are lost. For +example: +```javascript +function f() { + /** @preserve Foo Bar */ + function g() { + // this function is never called + } + return something(); +} +``` + +Even though it has "@preserve", the comment will be lost because the inner +function `g` (which is the AST node to which the comment is attached to) is +discarded by the compressor as not referenced. + +The safest comments where to place copyright information (or other info that +needs to be kept in the output) are comments attached to toplevel nodes. + +### The `unsafe` `compress` option + +It enables some transformations that *might* break code logic in certain +contrived cases, but should be fine for most code. You might want to try it +on your own code, it should reduce the minified size. Here's what happens +when this flag is on: + +- `new Array(1, 2, 3)` or `Array(1, 2, 3)` → `[ 1, 2, 3 ]` +- `new Object()` → `{}` +- `String(exp)` or `exp.toString()` → `"" + exp` +- `new Object/RegExp/Function/Error/Array (...)` → we discard the `new` + +### Conditional compilation + +You can use the `--define` (`-d`) switch in order to declare global +variables that UglifyJS will assume to be constants (unless defined in +scope). For example if you pass `--define DEBUG=false` then, coupled with +dead code removal UglifyJS will discard the following from the output: +```javascript +if (DEBUG) { + console.log("debug stuff"); +} +``` + +You can specify nested constants in the form of `--define env.DEBUG=false`. + +UglifyJS will warn about the condition being always false and about dropping +unreachable code; for now there is no option to turn off only this specific +warning, you can pass `warnings=false` to turn off *all* warnings. + +Another way of doing that is to declare your globals as constants in a +separate file and include it into the build. For example you can have a +`build/defines.js` file with the following: +```javascript +var DEBUG = false; +var PRODUCTION = true; +// etc. +``` + +and build your code like this: + + uglifyjs build/defines.js js/foo.js js/bar.js... -c + +UglifyJS will notice the constants and, since they cannot be altered, it +will evaluate references to them to the value itself and drop unreachable +code as usual. The build will contain the `const` declarations if you use +them. If you are targeting < ES6 environments which does not support `const`, +using `var` with `reduce_vars` (enabled by default) should suffice. + +### Conditional compilation API + +You can also use conditional compilation via the programmatic API. With the difference that the +property name is `global_defs` and is a compressor property: + +```javascript +var result = UglifyJS.minify(fs.readFileSync("input.js", "utf8"), { + compress: { + dead_code: true, + global_defs: { + DEBUG: false + } + } +}); +``` + +To replace an identifier with an arbitrary non-constant expression it is +necessary to prefix the `global_defs` key with `"@"` to instruct UglifyJS +to parse the value as an expression: +```javascript +UglifyJS.minify("alert('hello');", { + compress: { + global_defs: { + "@alert": "console.log" + } + } +}).code; +// returns: 'console.log("hello");' +``` + +Otherwise it would be replaced as string literal: +```javascript +UglifyJS.minify("alert('hello');", { + compress: { + global_defs: { + "alert": "console.log" + } + } +}).code; +// returns: '"console.log"("hello");' +``` + +### Using native Uglify AST with `minify()` +```javascript +// example: parse only, produce native Uglify AST + +var result = UglifyJS.minify(code, { + parse: {}, + compress: false, + mangle: false, + output: { + ast: true, + code: false // optional - faster if false + } +}); + +// result.ast contains native Uglify AST +``` +```javascript +// example: accept native Uglify AST input and then compress and mangle +// to produce both code and native AST. + +var result = UglifyJS.minify(ast, { + compress: {}, + mangle: {}, + output: { + ast: true, + code: true // optional - faster if false + } +}); + +// result.ast contains native Uglify AST +// result.code contains the minified code in string form. +``` + +### Working with Uglify AST + +Transversal and transformation of the native AST can be performed through +[`TreeWalker`](https://github.com/mishoo/UglifyJS/blob/master/lib/ast.js) and +[`TreeTransformer`](https://github.com/mishoo/UglifyJS/blob/master/lib/transform.js) +respectively. + +### ESTree / SpiderMonkey AST + +UglifyJS has its own abstract syntax tree format; for +[practical reasons](http://lisperator.net/blog/uglifyjs-why-not-switching-to-spidermonkey-ast/) +we can't easily change to using the SpiderMonkey AST internally. However, +UglifyJS now has a converter which can import a SpiderMonkey AST. + +For example [Acorn][acorn] is a super-fast parser that produces a +SpiderMonkey AST. It has a small CLI utility that parses one file and dumps +the AST in JSON on the standard output. To use UglifyJS to mangle and +compress that: + + acorn file.js | uglifyjs -p spidermonkey -m -c + +The `-p spidermonkey` option tells UglifyJS that all input files are not +JavaScript, but JS code described in SpiderMonkey AST in JSON. Therefore we +don't use our own parser in this case, but just transform that AST into our +internal AST. + +### Use Acorn for parsing + +More for fun, I added the `-p acorn` option which will use Acorn to do all +the parsing. If you pass this option, UglifyJS will `require("acorn")`. + +Acorn is really fast (e.g. 250ms instead of 380ms on some 650K code), but +converting the SpiderMonkey tree that Acorn produces takes another 150ms so +in total it's a bit more than just using UglifyJS's own parser. + +[acorn]: https://github.com/ternjs/acorn +[sm-spec]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k + +### Uglify Fast Minify Mode + +It's not well known, but whitespace removal and symbol mangling accounts +for 95% of the size reduction in minified code for most JavaScript - not +elaborate code transforms. One can simply disable `compress` to speed up +Uglify builds by 3 to 5 times. + +| d3.js | minify size | gzip size | minify time (seconds) | +| --- | ---: | ---: | ---: | +| original | 511,371 | 119,932 | - | +| uglify-js@3.13.0 mangle=false, compress=false | 363,988 | 95,695 | 0.56 | +| uglify-js@3.13.0 mangle=true, compress=false | 253,305 | 81,281 | 0.99 | +| uglify-js@3.13.0 mangle=true, compress=true | 244,436 | 79,854 | 5.30 | + +To enable fast minify mode from the CLI use: +``` +uglifyjs file.js -m +``` +To enable fast minify mode with the API use: +```javascript +UglifyJS.minify(code, { compress: false, mangle: true }); +``` + +### Source maps and debugging + +Various `compress` transforms that simplify, rearrange, inline and remove code +are known to have an adverse effect on debugging with source maps. This is +expected as code is optimized and mappings are often simply not possible as +some code no longer exists. For highest fidelity in source map debugging +disable the Uglify `compress` option and just use `mangle`. + +### Compiler assumptions + +To allow for better optimizations, the compiler makes various assumptions: + +- The code does not rely on preserving its runtime performance characteristics. + Typically uglified code will run faster due to less instructions and easier + inlining, but may be slower on rare occasions for a specific platform, e.g. + see [`reduce_funcs`](#compress-options). +- `.toString()` and `.valueOf()` don't have side effects, and for built-in + objects they have not been overridden. +- `undefined`, `NaN` and `Infinity` have not been externally redefined. +- `arguments.callee`, `arguments.caller` and `Function.prototype.caller` are not used. +- The code doesn't expect the contents of `Function.prototype.toString()` or + `Error.prototype.stack` to be anything in particular. +- Getting and setting properties on a plain object does not cause other side effects + (using `.watch()` or `Proxy`). +- Object properties can be added, removed and modified (not prevented with + `Object.defineProperty()`, `Object.defineProperties()`, `Object.freeze()`, + `Object.preventExtensions()` or `Object.seal()`). +- If array destructuring is present, index-like properties in `Array.prototype` + have not been overridden: + ```javascript + Object.prototype[0] = 42; + var [ a ] = []; + var { 0: b } = {}; + // 42 undefined + console.log([][0], a); + // 42 42 + console.log({}[0], b); + ``` +- Earlier versions of JavaScript will throw `SyntaxError` with the following: + ```javascript + ({ + p: 42, + get p() {}, + }); + // SyntaxError: Object literal may not have data and accessor property with + // the same name + ``` + UglifyJS may modify the input which in turn may suppress those errors. +- Iteration order of keys over an object which contains spread syntax in later + versions of Chrome and Node.js may be altered. +- When `toplevel` is enabled, UglifyJS effectively assumes input code is wrapped + within `function(){ ... }`, thus forbids aliasing of declared global variables: + ```javascript + A = "FAIL"; + var B = "FAIL"; + // can be `global`, `self`, `window` etc. + var top = function() { + return this; + }(); + // "PASS" + top.A = "PASS"; + console.log(A); + // "FAIL" after compress and/or mangle + top.B = "PASS"; + console.log(B); + ``` +- Use of `arguments` alongside destructuring as function parameters, e.g. + `function({}, arguments) {}` will result in `SyntaxError` in earlier versions + of Chrome and Node.js - UglifyJS may modify the input which in turn may + suppress those errors. +- Earlier versions of Chrome and Node.js will throw `ReferenceError` with the + following: + ```javascript + var a; + try { + throw 42; + } catch ({ + [a]: b, + // ReferenceError: a is not defined + }) { + let a; + } + ``` + UglifyJS may modify the input which in turn may suppress those errors. +- Later versions of JavaScript will throw `SyntaxError` with the following: + ```javascript + a => { + let a; + }; + // SyntaxError: Identifier 'a' has already been declared + ``` + UglifyJS may modify the input which in turn may suppress those errors. +- Later versions of JavaScript will throw `SyntaxError` with the following: + ```javascript + try { + // ... + } catch ({ message: a }) { + var a; + } + // SyntaxError: Identifier 'a' has already been declared + ``` + UglifyJS may modify the input which in turn may suppress those errors. +- Some versions of Chrome and Node.js will throw `ReferenceError` with the + following: + ```javascript + console.log(((a, b = function() { + return a; + // ReferenceError: a is not defined + }()) => b)()); + ``` + UglifyJS may modify the input which in turn may suppress those errors. +- Some arithmetic operations with `BigInt` may throw `TypeError`: + ```javascript + 1n + 1; + // TypeError: can't convert BigInt to number + ``` + UglifyJS may modify the input which in turn may suppress those errors. +- Some versions of JavaScript will throw `SyntaxError` with the + following: + ```javascript + console.log(String.raw`\uFo`); + // SyntaxError: Invalid Unicode escape sequence + ``` + UglifyJS may modify the input which in turn may suppress those errors. +- Some versions of JavaScript will throw `SyntaxError` with the + following: + ```javascript + try {} catch (e) { + for (var e of []); + } + // SyntaxError: Identifier 'e' has already been declared + ``` + UglifyJS may modify the input which in turn may suppress those errors. +- Some versions of Chrome and Node.js will give incorrect results with the + following: + ```javascript + console.log({ + ...{ + set 42(v) {}, + 42: "PASS", + }, + }); + // Expected: { '42': 'PASS' } + // Actual: { '42': undefined } + ``` + UglifyJS may modify the input which in turn may suppress those errors. +- Later versions of JavaScript will throw `SyntaxError` with the following: + ```javascript + var await; + class A { + static p = await; + } + // SyntaxError: Unexpected reserved word + ``` + UglifyJS may modify the input which in turn may suppress those errors. +- Later versions of JavaScript will throw `SyntaxError` with the following: + ```javascript + var async; + for (async of []); + // SyntaxError: The left-hand side of a for-of loop may not be 'async'. + ``` + UglifyJS may modify the input which in turn may suppress those errors. +- Some versions of Chrome and Node.js will give incorrect results with the + following: + ```javascript + console.log({ + ...console, + get 42() { + return "FAIL"; + }, + [42]: "PASS", + }[42], { + ...console, + get 42() { + return "FAIL"; + }, + 42: "PASS", + }[42]); + // Expected: "PASS PASS" + // Actual: "PASS FAIL" + ``` + UglifyJS may modify the input which in turn may suppress those errors. +- Earlier versions of JavaScript will throw `TypeError` with the following: + ```javascript + (function() { + { + const a = "foo"; + } + { + const a = "bar"; + } + })(); + // TypeError: const 'a' has already been declared + ``` + UglifyJS may modify the input which in turn may suppress those errors. +- Later versions of Chrome and Node.js will give incorrect results with the + following: + ```javascript + try { + class A { + static 42; + static get 42() {} + } + console.log("PASS"); + } catch (e) { + console.log("FAIL"); + } + // Expected: "PASS" + // Actual: "FAIL" + ``` + UglifyJS may modify the input which in turn may suppress those errors. +- Some versions of Chrome and Node.js will give incorrect results with the + following: + ```javascript + (async function(a) { + (function() { + var b = await => console.log("PASS"); + b(); + })(); + })().catch(console.error); + // Expected: "PASS" + // Actual: SyntaxError: Unexpected reserved word + ``` + UglifyJS may modify the input which in turn may suppress those errors. +- Later versions of Chrome and Node.js will give incorrect results with the + following: + ```javascript + try { + f(); + function f() { + throw 42; + } + } catch (e) { + console.log(typeof f, e); + } + // Expected: "function 42" + // Actual: "undefined 42" + ``` + UglifyJS may modify the input which in turn may suppress those errors. +- Later versions of JavaScript will throw `SyntaxError` with the following: + ```javascript + "use strict"; + console.log(function f() { + return f = "PASS"; + }()); + // Expected: "PASS" + // Actual: TypeError: invalid assignment to const 'f' + ``` + UglifyJS may modify the input which in turn may suppress those errors. +- Adobe ExtendScript will give incorrect results with the following: + ```javascript + alert(true ? "PASS" : false ? "FAIL" : null); + // Expected: "PASS" + // Actual: "FAIL" + ``` + UglifyJS may modify the input which in turn may suppress those errors. +- Adobe ExtendScript will give incorrect results with the following: + ```javascript + alert(42 ? null ? "FAIL" : "PASS" : "FAIL"); + // Expected: "PASS" + // Actual: SyntaxError: Expected: : + ``` + UglifyJS may modify the input which in turn may suppress those errors. diff --git a/semag/emulatorjs/data/minify/node_modules/uglify-js/bin/uglifyjs b/semag/emulatorjs/data/minify/node_modules/uglify-js/bin/uglifyjs new file mode 100644 index 00000000..49e5185e --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/uglify-js/bin/uglifyjs @@ -0,0 +1,605 @@ +#! /usr/bin/env node +// -*- js -*- + +"use strict"; + +require("../tools/tty"); + +var fs = require("fs"); +var info = require("../package.json"); +var path = require("path"); +var UglifyJS = require("../tools/node"); + +var skip_keys = [ "cname", "fixed", "in_arg", "inlined", "length_read", "parent_scope", "redef", "scope", "unused" ]; +var truthy_keys = [ "optional", "pure", "terminal", "uses_arguments", "uses_eval", "uses_with" ]; + +var files = {}; +var options = {}; +var short_forms = { + b: "beautify", + c: "compress", + d: "define", + e: "enclose", + h: "help", + m: "mangle", + o: "output", + O: "output-opts", + p: "parse", + v: "version", + V: "version", +}; +var args = process.argv.slice(2); +var paths = []; +var output, nameCache; +var specified = {}; +while (args.length) { + var arg = args.shift(); + if (arg[0] != "-") { + paths.push(arg); + } else if (arg == "--") { + paths = paths.concat(args); + break; + } else if (arg[1] == "-") { + process_option(arg.slice(2)); + } else [].forEach.call(arg.slice(1), function(letter, index, arg) { + if (!(letter in short_forms)) fatal("invalid option -" + letter); + process_option(short_forms[letter], index + 1 < arg.length); + }); +} + +function process_option(name, no_value) { + specified[name] = true; + switch (name) { + case "help": + switch (read_value()) { + case "ast": + print(UglifyJS.describe_ast()); + break; + case "options": + var text = []; + var toplevels = []; + var padding = ""; + var defaults = UglifyJS.default_options(); + for (var name in defaults) { + var option = defaults[name]; + if (option && typeof option == "object") { + text.push("--" + ({ + output: "beautify", + sourceMap: "source-map", + }[name] || name) + " options:"); + text.push(format_object(option)); + text.push(""); + } else { + if (padding.length < name.length) padding = Array(name.length + 1).join(" "); + toplevels.push([ { + keep_fargs: "keep-fargs", + keep_fnames: "keep-fnames", + nameCache: "name-cache", + }[name] || name, option ]); + } + } + toplevels.forEach(function(tokens) { + text.push("--" + tokens[0] + padding.slice(tokens[0].length - 2) + tokens[1]); + }); + print(text.join("\n")); + break; + default: + print([ + "Usage: uglifyjs [files...] [options]", + "", + "Options:", + " -h, --help Print usage information.", + " `--help options` for details on available options.", + " -v, -V, --version Print version number.", + " -p, --parse Specify parser options.", + " -c, --compress [options] Enable compressor/specify compressor options.", + " -m, --mangle [options] Mangle names/specify mangler options.", + " --mangle-props [options] Mangle properties/specify mangler options.", + " -b, --beautify [options] Beautify output/specify output options.", + " -O, --output-opts Output options (beautify disabled).", + " -o, --output Output file (default STDOUT).", + " --annotations Process and preserve comment annotations.", + " --no-annotations Ignore and discard comment annotations.", + " --comments [filter] Preserve copyright comments in the output.", + " --config-file Read minify() options from JSON file.", + " -d, --define [=value] Global definitions.", + " -e, --enclose [arg[,...][:value[,...]]] Embed everything in a big function, with configurable argument(s) & value(s).", + " --expression Parse a single expression, rather than a program.", + " --ie Support non-standard Internet Explorer.", + " --keep-fargs Do not mangle/drop function arguments.", + " --keep-fnames Do not mangle/drop function names. Useful for code relying on Function.prototype.name.", + " --module Process input as ES module (implies --toplevel)", + " --name-cache File to hold mangled name mappings.", + " --rename Force symbol expansion.", + " --no-rename Disable symbol expansion.", + " --self Build UglifyJS as a library (implies --wrap UglifyJS)", + " --source-map [options] Enable source map/specify source map options.", + " --timings Display operations run time on STDERR.", + " --toplevel Compress and/or mangle variables in toplevel scope.", + " --v8 Support non-standard Chrome & Node.js.", + " --validate Perform validation during AST manipulations.", + " --verbose Print diagnostic messages.", + " --warn Print warning messages.", + " --webkit Support non-standard Safari/Webkit.", + " --wrap Embed everything as a function with “exports” corresponding to “name” globally.", + "", + "(internal debug use only)", + " --in-situ Warning: replaces original source files with minified output.", + " --reduce-test Reduce a standalone test case (assumes cloned repository).", + ].join("\n")); + } + process.exit(); + case "version": + print(info.name + " " + info.version); + process.exit(); + case "config-file": + var config = JSON.parse(read_file(read_value(true))); + if (config.mangle && config.mangle.properties && config.mangle.properties.regex) { + config.mangle.properties.regex = UglifyJS.parse(config.mangle.properties.regex, { + expression: true, + }).value; + } + for (var key in config) if (!(key in options)) options[key] = config[key]; + break; + case "compress": + case "mangle": + options[name] = parse_js(read_value(), options[name]); + break; + case "source-map": + options.sourceMap = parse_js(read_value(), options.sourceMap); + break; + case "enclose": + options[name] = read_value(); + break; + case "annotations": + case "expression": + case "ie": + case "ie8": + case "module": + case "timings": + case "toplevel": + case "v8": + case "validate": + case "webkit": + options[name] = true; + break; + case "no-annotations": + options.annotations = false; + break; + case "keep-fargs": + options.keep_fargs = true; + break; + case "keep-fnames": + options.keep_fnames = true; + break; + case "wrap": + options[name] = read_value(true); + break; + case "verbose": + options.warnings = "verbose"; + break; + case "warn": + if (!options.warnings) options.warnings = true; + break; + case "beautify": + options.output = parse_js(read_value(), options.output); + if (!("beautify" in options.output)) options.output.beautify = true; + break; + case "output-opts": + options.output = parse_js(read_value(true), options.output); + break; + case "comments": + if (typeof options.output != "object") options.output = {}; + options.output.comments = read_value(); + if (options.output.comments === true) options.output.comments = "some"; + break; + case "define": + if (typeof options.compress != "object") options.compress = {}; + options.compress.global_defs = parse_js(read_value(true), options.compress.global_defs, "define"); + break; + case "mangle-props": + if (typeof options.mangle != "object") options.mangle = {}; + options.mangle.properties = parse_js(read_value(), options.mangle.properties); + break; + case "name-cache": + nameCache = read_value(true); + options.nameCache = JSON.parse(read_file(nameCache, "{}")); + break; + case "output": + output = read_value(true); + break; + case "parse": + options.parse = parse_js(read_value(true), options.parse); + break; + case "rename": + options.rename = true; + break; + case "no-rename": + options.rename = false; + break; + case "in-situ": + case "reduce-test": + case "self": + break; + default: + fatal("invalid option --" + name); + } + + function read_value(required) { + if (no_value || !args.length || args[0][0] == "-") { + if (required) fatal("missing option argument for --" + name); + return true; + } + return args.shift(); + } +} +if (!output && options.sourceMap && options.sourceMap.url != "inline") fatal("cannot write source map to STDOUT"); +if (specified["beautify"] && specified["output-opts"]) fatal("--beautify cannot be used with --output-opts"); +[ "compress", "mangle" ].forEach(function(name) { + if (!(name in options)) options[name] = false; +}); +if (/^ast|spidermonkey$/.test(output)) { + if (typeof options.output != "object") options.output = {}; + options.output.ast = true; + options.output.code = false; +} +if (options.parse && (options.parse.acorn || options.parse.spidermonkey) + && options.sourceMap && options.sourceMap.content == "inline") { + fatal("inline source map only works with built-in parser"); +} +if (options.warnings) { + UglifyJS.AST_Node.log_function(print_error, options.warnings == "verbose"); + delete options.warnings; +} +var convert_path = function(name) { + return name; +}; +if (typeof options.sourceMap == "object" && "base" in options.sourceMap) { + convert_path = function() { + var base = options.sourceMap.base; + delete options.sourceMap.base; + return function(name) { + return path.relative(base, name); + }; + }(); +} +if (specified["self"]) { + if (paths.length) UglifyJS.AST_Node.warn("Ignoring input files since --self was passed"); + if (!options.wrap) options.wrap = "UglifyJS"; + paths = UglifyJS.FILES; +} else if (paths.length) { + paths = simple_glob(paths); +} +if (specified["in-situ"]) { + if (output && output != "spidermonkey" || specified["reduce-test"] || specified["self"]) { + fatal("incompatible options specified"); + } + paths.forEach(function(name) { + print(name); + if (/^ast|spidermonkey$/.test(name)) fatal("invalid file name specified"); + files = {}; + files[convert_path(name)] = read_file(name); + output = name; + run(); + }); +} else if (paths.length) { + paths.forEach(function(name) { + files[convert_path(name)] = read_file(name); + }); + run(); +} else { + var timerId = process.stdin.isTTY && process.argv.length < 3 && setTimeout(function() { + print_error("Waiting for input... (use `--help` to print usage information)"); + }, 1500); + var chunks = []; + process.stdin.setEncoding("utf8"); + process.stdin.once("data", function() { + clearTimeout(timerId); + }).on("data", function(chunk) { + chunks.push(chunk); + }).on("end", function() { + files = { STDIN: chunks.join("") }; + run(); + }); + process.stdin.resume(); +} + +function convert_ast(fn) { + return UglifyJS.AST_Node.from_mozilla_ast(Object.keys(files).reduce(fn, null)); +} + +function run() { + var content = options.sourceMap && options.sourceMap.content; + if (content && content != "inline") { + UglifyJS.AST_Node.info("Using input source map: {content}", { + content : content, + }); + options.sourceMap.content = read_file(content, content); + } + try { + if (options.parse) { + if (options.parse.acorn) { + var annotations = Object.create(null); + files = convert_ast(function(toplevel, name) { + var content = files[name]; + var list = annotations[name] = []; + var prev = -1; + return require("acorn").parse(content, { + allowHashBang: true, + ecmaVersion: "latest", + locations: true, + onComment: function(block, text, start, end) { + var match = /[@#]__PURE__/.exec(text); + if (!match) { + if (start != prev) return; + match = [ list[prev] ]; + } + while (/\s/.test(content[end])) end++; + list[end] = match[0]; + prev = end; + }, + preserveParens: true, + program: toplevel, + sourceFile: name, + sourceType: "module", + }); + }); + files.walk(new UglifyJS.TreeWalker(function(node) { + if (!(node instanceof UglifyJS.AST_Call)) return; + var list = annotations[node.start.file]; + var pure = list[node.start.pos]; + if (!pure) { + var tokens = node.start.parens; + if (tokens) for (var i = 0; !pure && i < tokens.length; i++) { + pure = list[tokens[i].pos]; + } + } + if (pure) node.pure = pure; + })); + } else if (options.parse.spidermonkey) { + files = convert_ast(function(toplevel, name) { + var obj = JSON.parse(files[name]); + if (!toplevel) return obj; + toplevel.body = toplevel.body.concat(obj.body); + return toplevel; + }); + } + } + } catch (ex) { + fatal(ex); + } + var result; + if (specified["reduce-test"]) { + // load on demand - assumes cloned repository + var reduce_test = require("../test/reduce"); + if (Object.keys(files).length != 1) fatal("can only test on a single file"); + result = reduce_test(files[Object.keys(files)[0]], options, { + log: print_error, + verbose: true, + }); + } else { + result = UglifyJS.minify(files, options); + } + if (result.error) { + var ex = result.error; + if (ex.name == "SyntaxError") { + print_error("Parse error at " + ex.filename + ":" + ex.line + "," + ex.col); + var file = files[ex.filename]; + if (file) { + var col = ex.col; + var lines = file.split(/\r?\n/); + var line = lines[ex.line - 1]; + if (!line && !col) { + line = lines[ex.line - 2]; + col = line.length; + } + if (line) { + var limit = 70; + if (col > limit) { + line = line.slice(col - limit); + col = limit; + } + print_error(line.slice(0, 80)); + print_error(line.slice(0, col).replace(/\S/g, " ") + "^"); + } + } + } else if (ex.defs) { + print_error("Supported options:"); + print_error(format_object(ex.defs)); + } + fatal(ex); + } else if (output == "ast") { + if (!options.compress && !options.mangle) { + var toplevel = result.ast; + if (!(toplevel instanceof UglifyJS.AST_Toplevel)) { + if (!(toplevel instanceof UglifyJS.AST_Statement)) toplevel = new UglifyJS.AST_SimpleStatement({ + body: toplevel, + }); + toplevel = new UglifyJS.AST_Toplevel({ + body: [ toplevel ], + }); + } + toplevel.figure_out_scope({}); + } + print(JSON.stringify(result.ast, function(key, value) { + if (value) switch (key) { + case "enclosed": + return value.length ? value.map(symdef) : undefined; + case "functions": + case "globals": + case "variables": + return value.size() ? value.map(symdef) : undefined; + case "thedef": + return symdef(value); + } + if (skip_property(key, value)) return; + if (value instanceof UglifyJS.AST_Token) return; + if (value instanceof UglifyJS.Dictionary) return; + if (value instanceof UglifyJS.AST_Node) { + var result = { + _class: "AST_" + value.TYPE + }; + value.CTOR.PROPS.forEach(function(prop) { + result[prop] = value[prop]; + }); + return result; + } + return value; + }, 2)); + } else if (output == "spidermonkey") { + print(JSON.stringify(result.ast.to_mozilla_ast(), null, 2)); + } else if (output) { + var code; + if (result.ast) { + var opts = {}; + for (var name in options.output) { + if (!/^ast|code$/.test(name)) opts[name] = options.output[name]; + } + code = UglifyJS.AST_Node.from_mozilla_ast(result.ast.to_mozilla_ast()).print_to_string(opts); + } else { + code = result.code; + } + fs.writeFileSync(output, code); + if (result.map) fs.writeFileSync(output + ".map", result.map); + } else { + print(result.code); + } + if (nameCache) fs.writeFileSync(nameCache, JSON.stringify(options.nameCache)); + if (result.timings) for (var phase in result.timings) { + print_error("- " + phase + ": " + result.timings[phase].toFixed(3) + "s"); + } +} + +function fatal(message) { + if (message instanceof Error) { + message = message.stack.replace(/^\S*?Error:/, "ERROR:") + } else { + message = "ERROR: " + message; + } + print_error(message); + process.exit(1); +} + +// A file glob function that only supports "*" and "?" wildcards in the basename. +// Example: "foo/bar/*baz??.*.js" +// Argument `paths` must be an array of strings. +// Returns an array of strings. Garbage in, garbage out. +function simple_glob(paths) { + return paths.reduce(function(paths, glob) { + if (/\*|\?/.test(glob)) { + var dir = path.dirname(glob); + try { + var entries = fs.readdirSync(dir).filter(function(name) { + try { + return fs.statSync(path.join(dir, name)).isFile(); + } catch (ex) { + return false; + } + }); + } catch (ex) {} + if (entries) { + var pattern = "^" + path.basename(glob) + .replace(/[.+^$[\]\\(){}]/g, "\\$&") + .replace(/\*/g, "[^/\\\\]*") + .replace(/\?/g, "[^/\\\\]") + "$"; + var mod = process.platform === "win32" ? "i" : ""; + var rx = new RegExp(pattern, mod); + var results = entries.filter(function(name) { + return rx.test(name); + }).sort().map(function(name) { + return path.join(dir, name); + }); + if (results.length) { + [].push.apply(paths, results); + return paths; + } + } + } + paths.push(glob); + return paths; + }, []); +} + +function read_file(path, default_value) { + try { + return fs.readFileSync(path, "utf8"); + } catch (ex) { + if (ex.code == "ENOENT" && default_value != null) return default_value; + fatal(ex); + } +} + +function parse_js(value, options, flag) { + if (!options || typeof options != "object") options = Object.create(null); + if (typeof value == "string") try { + UglifyJS.parse(value, { + expression: true + }).walk(new UglifyJS.TreeWalker(function(node) { + if (node instanceof UglifyJS.AST_Assign) { + var name = node.left.print_to_string(); + var value = node.right; + if (flag) { + options[name] = value; + } else if (value instanceof UglifyJS.AST_Array) { + options[name] = value.elements.map(to_string); + } else { + options[name] = to_string(value); + } + return true; + } + if (node instanceof UglifyJS.AST_Symbol || node instanceof UglifyJS.AST_PropAccess) { + var name = node.print_to_string(); + options[name] = true; + return true; + } + if (!(node instanceof UglifyJS.AST_Sequence)) throw node; + + function to_string(value) { + return value instanceof UglifyJS.AST_Constant ? value.value : value.print_to_string({ + quote_keys: true + }); + } + })); + } catch (ex) { + if (flag) { + fatal("cannot parse arguments for '" + flag + "': " + value); + } else { + options[value] = null; + } + } + return options; +} + +function skip_property(key, value) { + return skip_keys.indexOf(key) >= 0 + // only skip truthy_keys if their value is falsy + || truthy_keys.indexOf(key) >= 0 && !value; +} + +function symdef(def) { + var ret = (1e6 + def.id) + " " + def.name; + if (def.mangled_name) ret += " " + def.mangled_name; + return ret; +} + +function format_object(obj) { + var lines = []; + var padding = ""; + Object.keys(obj).map(function(name) { + if (padding.length < name.length) padding = Array(name.length + 1).join(" "); + return [ name, JSON.stringify(obj[name]) ]; + }).forEach(function(tokens) { + lines.push(" " + tokens[0] + padding.slice(tokens[0].length - 2) + tokens[1]); + }); + return lines.join("\n"); +} + +function print_error(msg) { + process.stderr.write(msg); + process.stderr.write("\n"); +} + +function print(txt) { + process.stdout.write(txt); + process.stdout.write("\n"); +} diff --git a/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/ast.js b/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/ast.js new file mode 100644 index 00000000..16ea9c80 --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/ast.js @@ -0,0 +1,2356 @@ +/*********************************************************************** + + A JavaScript tokenizer / parser / beautifier / compressor. + https://github.com/mishoo/UglifyJS + + -------------------------------- (C) --------------------------------- + + Author: Mihai Bazon + + http://mihai.bazon.net/blog + + Distributed under the BSD license: + + Copyright 2012 (c) Mihai Bazon + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + ***********************************************************************/ + +"use strict"; + +function DEFNODE(type, props, methods, base) { + if (typeof base === "undefined") base = AST_Node; + props = props ? props.split(/\s+/) : []; + var self_props = props; + if (base && base.PROPS) props = props.concat(base.PROPS); + var code = [ + "return function AST_", type, "(props){", + // not essential, but speeds up compress by a few percent + "this._bits=0;", + "if(props){", + ]; + props.forEach(function(prop) { + code.push("this.", prop, "=props.", prop, ";"); + }); + code.push("}"); + var proto = Object.create(base && base.prototype); + if (methods.initialize || proto.initialize) code.push("this.initialize();"); + code.push("};"); + var ctor = new Function(code.join(""))(); + ctor.prototype = proto; + ctor.prototype.CTOR = ctor; + ctor.prototype.TYPE = ctor.TYPE = type; + if (base) { + ctor.BASE = base; + base.SUBCLASSES.push(ctor); + } + ctor.DEFMETHOD = function(name, method) { + this.prototype[name] = method; + }; + ctor.PROPS = props; + ctor.SELF_PROPS = self_props; + ctor.SUBCLASSES = []; + for (var name in methods) if (HOP(methods, name)) { + if (/^\$/.test(name)) { + ctor[name.substr(1)] = methods[name]; + } else { + ctor.DEFMETHOD(name, methods[name]); + } + } + if (typeof exports !== "undefined") exports["AST_" + type] = ctor; + return ctor; +} + +var AST_Token = DEFNODE("Token", "type value line col pos endline endcol endpos nlb comments_before comments_after file raw", { +}, null); + +var AST_Node = DEFNODE("Node", "start end", { + _clone: function(deep) { + if (deep) { + var self = this.clone(); + return self.transform(new TreeTransformer(function(node) { + if (node !== self) { + return node.clone(true); + } + })); + } + return new this.CTOR(this); + }, + clone: function(deep) { + return this._clone(deep); + }, + $documentation: "Base class of all AST nodes", + $propdoc: { + start: "[AST_Token] The first token of this node", + end: "[AST_Token] The last token of this node" + }, + equals: function(node) { + return this.TYPE == node.TYPE && this._equals(node); + }, + walk: function(visitor) { + visitor.visit(this); + }, + _validate: function() { + if (this.TYPE == "Node") throw new Error("should not instantiate AST_Node"); + }, + validate: function() { + var ctor = this.CTOR; + do { + ctor.prototype._validate.call(this); + } while (ctor = ctor.BASE); + }, + validate_ast: function() { + var marker = {}; + this.walk(new TreeWalker(function(node) { + if (node.validate_visited === marker) { + throw new Error(string_template("cannot reuse AST_{TYPE} from [{start}]", node)); + } + node.validate_visited = marker; + })); + }, +}, null); + +DEF_BITPROPS(AST_Node, [ + // AST_Node + "_optimized", + "_squeezed", + // AST_Call + "call_only", + // AST_Lambda + "collapse_scanning", + // AST_SymbolRef + "defined", + "evaluating", + "falsy", + // AST_SymbolRef + "in_arg", + // AST_Return + "in_bool", + // AST_SymbolRef + "is_undefined", + // AST_LambdaExpression + // AST_LambdaDefinition + "inlined", + // AST_Lambda + "length_read", + // AST_Yield + "nested", + // AST_Lambda + "new", + // AST_Call + // AST_PropAccess + "optional", + // AST_ClassProperty + "private", + // AST_Call + "pure", + // AST_Assign + "redundant", + // AST_Node + "single_use", + // AST_ClassProperty + "static", + // AST_Call + // AST_PropAccess + "terminal", + "truthy", + // AST_Scope + "uses_eval", + // AST_Scope + "uses_with", +]); + +(AST_Node.log_function = function(fn, verbose) { + if (typeof fn != "function") { + AST_Node.info = AST_Node.warn = noop; + return; + } + var printed = Object.create(null); + AST_Node.info = verbose ? function(text, props) { + log("INFO: " + string_template(text, props)); + } : noop; + AST_Node.warn = function(text, props) { + log("WARN: " + string_template(text, props)); + }; + + function log(msg) { + if (printed[msg]) return; + printed[msg] = true; + fn(msg); + } +})(); + +var restore_transforms = []; +AST_Node.enable_validation = function() { + AST_Node.disable_validation(); + (function validate_transform(ctor) { + ctor.SUBCLASSES.forEach(validate_transform); + if (!HOP(ctor.prototype, "transform")) return; + var transform = ctor.prototype.transform; + ctor.prototype.transform = function(tw, in_list) { + var node = transform.call(this, tw, in_list); + if (node instanceof AST_Node) { + node.validate(); + } else if (!(node === null || in_list && List.is_op(node))) { + throw new Error("invalid transformed value: " + node); + } + return node; + }; + restore_transforms.push(function() { + ctor.prototype.transform = transform; + }); + })(this); +}; + +AST_Node.disable_validation = function() { + var restore; + while (restore = restore_transforms.pop()) restore(); +}; + +function all_equals(k, l) { + return k.length == l.length && all(k, function(m, i) { + return m.equals(l[i]); + }); +} + +function list_equals(s, t) { + return s.length == t.length && all(s, function(u, i) { + return u == t[i]; + }); +} + +function prop_equals(u, v) { + if (u === v) return true; + if (u == null) return v == null; + return u instanceof AST_Node && v instanceof AST_Node && u.equals(v); +} + +/* -----[ statements ]----- */ + +var AST_Statement = DEFNODE("Statement", null, { + $documentation: "Base class of all statements", + _validate: function() { + if (this.TYPE == "Statement") throw new Error("should not instantiate AST_Statement"); + }, +}); + +var AST_Debugger = DEFNODE("Debugger", null, { + $documentation: "Represents a debugger statement", + _equals: return_true, +}, AST_Statement); + +var AST_Directive = DEFNODE("Directive", "quote value", { + $documentation: "Represents a directive, like \"use strict\";", + $propdoc: { + quote: "[string?] the original quote character", + value: "[string] The value of this directive as a plain string (it's not an AST_String!)", + }, + _equals: function(node) { + return this.value == node.value; + }, + _validate: function() { + if (this.quote != null) { + if (typeof this.quote != "string") throw new Error("quote must be string"); + if (!/^["']$/.test(this.quote)) throw new Error("invalid quote: " + this.quote); + } + if (typeof this.value != "string") throw new Error("value must be string"); + }, +}, AST_Statement); + +var AST_EmptyStatement = DEFNODE("EmptyStatement", null, { + $documentation: "The empty statement (empty block or simply a semicolon)", + _equals: return_true, +}, AST_Statement); + +function is_statement(node) { + return node instanceof AST_Statement + && !(node instanceof AST_ClassExpression) + && !(node instanceof AST_LambdaExpression); +} + +function validate_expression(value, prop, multiple, allow_spread, allow_hole) { + multiple = multiple ? "contain" : "be"; + if (!(value instanceof AST_Node)) throw new Error(prop + " must " + multiple + " AST_Node"); + if (value instanceof AST_DefaultValue) throw new Error(prop + " cannot " + multiple + " AST_DefaultValue"); + if (value instanceof AST_Destructured) throw new Error(prop + " cannot " + multiple + " AST_Destructured"); + if (value instanceof AST_Hole && !allow_hole) throw new Error(prop + " cannot " + multiple + " AST_Hole"); + if (value instanceof AST_Spread && !allow_spread) throw new Error(prop + " cannot " + multiple + " AST_Spread"); + if (is_statement(value)) throw new Error(prop + " cannot " + multiple + " AST_Statement"); + if (value instanceof AST_SymbolDeclaration) { + throw new Error(prop + " cannot " + multiple + " AST_SymbolDeclaration"); + } +} + +function must_be_expression(node, prop) { + validate_expression(node[prop], prop); +} + +var AST_SimpleStatement = DEFNODE("SimpleStatement", "body", { + $documentation: "A statement consisting of an expression, i.e. a = 1 + 2", + $propdoc: { + body: "[AST_Node] an expression node (should not be instanceof AST_Statement)", + }, + _equals: function(node) { + return this.body.equals(node.body); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.body.walk(visitor); + }); + }, + _validate: function() { + must_be_expression(this, "body"); + }, +}, AST_Statement); + +var AST_BlockScope = DEFNODE("BlockScope", "_var_names enclosed functions make_def parent_scope variables", { + $documentation: "Base class for all statements introducing a lexical scope", + $propdoc: { + enclosed: "[SymbolDef*/S] a list of all symbol definitions that are accessed from this scope or any inner scopes", + functions: "[Dictionary/S] like `variables`, but only lists function declarations", + parent_scope: "[AST_Scope?/S] link to the parent scope", + variables: "[Dictionary/S] a map of name ---> SymbolDef for all variables/functions defined in this scope", + }, + clone: function(deep) { + var node = this._clone(deep); + if (this.enclosed) node.enclosed = this.enclosed.slice(); + if (this.functions) node.functions = this.functions.clone(); + if (this.variables) node.variables = this.variables.clone(); + return node; + }, + pinned: function() { + return this.resolve().pinned(); + }, + resolve: function() { + return this.parent_scope.resolve(); + }, + _validate: function() { + if (this.TYPE == "BlockScope") throw new Error("should not instantiate AST_BlockScope"); + if (this.parent_scope == null) return; + if (!(this.parent_scope instanceof AST_BlockScope)) throw new Error("parent_scope must be AST_BlockScope"); + if (!(this.resolve() instanceof AST_Scope)) throw new Error("must be contained within AST_Scope"); + }, +}, AST_Statement); + +function walk_body(node, visitor) { + node.body.forEach(function(node) { + node.walk(visitor); + }); +} + +var AST_Block = DEFNODE("Block", "body", { + $documentation: "A body of statements (usually braced)", + $propdoc: { + body: "[AST_Statement*] an array of statements" + }, + _equals: function(node) { + return all_equals(this.body, node.body); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + walk_body(node, visitor); + }); + }, + _validate: function() { + if (this.TYPE == "Block") throw new Error("should not instantiate AST_Block"); + this.body.forEach(function(node) { + if (!is_statement(node)) throw new Error("body must contain AST_Statement"); + }); + }, +}, AST_BlockScope); + +var AST_BlockStatement = DEFNODE("BlockStatement", null, { + $documentation: "A block statement", +}, AST_Block); + +var AST_StatementWithBody = DEFNODE("StatementWithBody", "body", { + $documentation: "Base class for all statements that contain one nested body: `For`, `ForIn`, `Do`, `While`, `With`", + $propdoc: { + body: "[AST_Statement] the body; this should always be present, even if it's an AST_EmptyStatement" + }, + _validate: function() { + if (this.TYPE == "StatementWithBody") throw new Error("should not instantiate AST_StatementWithBody"); + if (!is_statement(this.body)) throw new Error("body must be AST_Statement"); + }, +}, AST_BlockScope); + +var AST_LabeledStatement = DEFNODE("LabeledStatement", "label", { + $documentation: "Statement with a label", + $propdoc: { + label: "[AST_Label] a label definition" + }, + _equals: function(node) { + return this.label.equals(node.label) + && this.body.equals(node.body); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.label.walk(visitor); + node.body.walk(visitor); + }); + }, + clone: function(deep) { + var node = this._clone(deep); + if (deep) { + var label = node.label; + var def = this.label; + node.walk(new TreeWalker(function(node) { + if (node instanceof AST_LoopControl) { + if (!node.label || node.label.thedef !== def) return; + node.label.thedef = label; + label.references.push(node); + return true; + } + if (node instanceof AST_Scope) return true; + })); + } + return node; + }, + _validate: function() { + if (!(this.label instanceof AST_Label)) throw new Error("label must be AST_Label"); + }, +}, AST_StatementWithBody); + +var AST_IterationStatement = DEFNODE("IterationStatement", null, { + $documentation: "Internal class. All loops inherit from it.", + _validate: function() { + if (this.TYPE == "IterationStatement") throw new Error("should not instantiate AST_IterationStatement"); + }, +}, AST_StatementWithBody); + +var AST_DWLoop = DEFNODE("DWLoop", "condition", { + $documentation: "Base class for do/while statements", + $propdoc: { + condition: "[AST_Node] the loop condition. Should not be instanceof AST_Statement" + }, + _equals: function(node) { + return this.body.equals(node.body) + && this.condition.equals(node.condition); + }, + _validate: function() { + if (this.TYPE == "DWLoop") throw new Error("should not instantiate AST_DWLoop"); + must_be_expression(this, "condition"); + }, +}, AST_IterationStatement); + +var AST_Do = DEFNODE("Do", null, { + $documentation: "A `do` statement", + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.body.walk(visitor); + node.condition.walk(visitor); + }); + }, +}, AST_DWLoop); + +var AST_While = DEFNODE("While", null, { + $documentation: "A `while` statement", + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.condition.walk(visitor); + node.body.walk(visitor); + }); + }, +}, AST_DWLoop); + +var AST_For = DEFNODE("For", "init condition step", { + $documentation: "A `for` statement", + $propdoc: { + init: "[AST_Node?] the `for` initialization code, or null if empty", + condition: "[AST_Node?] the `for` termination clause, or null if empty", + step: "[AST_Node?] the `for` update clause, or null if empty" + }, + _equals: function(node) { + return prop_equals(this.init, node.init) + && prop_equals(this.condition, node.condition) + && prop_equals(this.step, node.step) + && this.body.equals(node.body); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + if (node.init) node.init.walk(visitor); + if (node.condition) node.condition.walk(visitor); + if (node.step) node.step.walk(visitor); + node.body.walk(visitor); + }); + }, + _validate: function() { + if (this.init != null) { + if (!(this.init instanceof AST_Node)) throw new Error("init must be AST_Node"); + if (is_statement(this.init) && !(this.init instanceof AST_Definitions)) { + throw new Error("init cannot be AST_Statement"); + } + } + if (this.condition != null) must_be_expression(this, "condition"); + if (this.step != null) must_be_expression(this, "step"); + }, +}, AST_IterationStatement); + +var AST_ForEnumeration = DEFNODE("ForEnumeration", "init object", { + $documentation: "Base class for enumeration loops, i.e. `for ... in`, `for ... of` & `for await ... of`", + $propdoc: { + init: "[AST_Node] the assignment target during iteration", + object: "[AST_Node] the object to iterate over" + }, + _equals: function(node) { + return this.init.equals(node.init) + && this.object.equals(node.object) + && this.body.equals(node.body); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.init.walk(visitor); + node.object.walk(visitor); + node.body.walk(visitor); + }); + }, + _validate: function() { + if (this.TYPE == "ForEnumeration") throw new Error("should not instantiate AST_ForEnumeration"); + if (this.init instanceof AST_Definitions) { + if (this.init.definitions.length != 1) throw new Error("init must have single declaration"); + } else { + validate_destructured(this.init, function(node) { + if (!(node instanceof AST_PropAccess || node instanceof AST_SymbolRef)) { + throw new Error("init must be assignable: " + node.TYPE); + } + }); + } + must_be_expression(this, "object"); + }, +}, AST_IterationStatement); + +var AST_ForIn = DEFNODE("ForIn", null, { + $documentation: "A `for ... in` statement", +}, AST_ForEnumeration); + +var AST_ForOf = DEFNODE("ForOf", null, { + $documentation: "A `for ... of` statement", +}, AST_ForEnumeration); + +var AST_ForAwaitOf = DEFNODE("ForAwaitOf", null, { + $documentation: "A `for await ... of` statement", +}, AST_ForOf); + +var AST_With = DEFNODE("With", "expression", { + $documentation: "A `with` statement", + $propdoc: { + expression: "[AST_Node] the `with` expression" + }, + _equals: function(node) { + return this.expression.equals(node.expression) + && this.body.equals(node.body); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.expression.walk(visitor); + node.body.walk(visitor); + }); + }, + _validate: function() { + must_be_expression(this, "expression"); + }, +}, AST_StatementWithBody); + +/* -----[ scope and functions ]----- */ + +var AST_Scope = DEFNODE("Scope", "fn_defs may_call_this uses_eval uses_with", { + $documentation: "Base class for all statements introducing a lambda scope", + $propdoc: { + uses_eval: "[boolean/S] tells whether this scope contains a direct call to the global `eval`", + uses_with: "[boolean/S] tells whether this scope uses the `with` statement", + }, + pinned: function() { + return this.uses_eval || this.uses_with; + }, + resolve: return_this, + _validate: function() { + if (this.TYPE == "Scope") throw new Error("should not instantiate AST_Scope"); + }, +}, AST_Block); + +var AST_Toplevel = DEFNODE("Toplevel", "globals", { + $documentation: "The toplevel scope", + $propdoc: { + globals: "[Dictionary/S] a map of name ---> SymbolDef for all undeclared names", + }, + wrap: function(name) { + var body = this.body; + return parse([ + "(function(exports){'$ORIG';})(typeof ", + name, + "=='undefined'?(", + name, + "={}):", + name, + ");" + ].join(""), { + filename: "wrap=" + JSON.stringify(name) + }).transform(new TreeTransformer(function(node) { + if (node instanceof AST_Directive && node.value == "$ORIG") { + return List.splice(body); + } + })); + }, + enclose: function(args_values) { + if (typeof args_values != "string") args_values = ""; + var index = args_values.indexOf(":"); + if (index < 0) index = args_values.length; + var body = this.body; + return parse([ + "(function(", + args_values.slice(0, index), + '){"$ORIG"})(', + args_values.slice(index + 1), + ")" + ].join(""), { + filename: "enclose=" + JSON.stringify(args_values) + }).transform(new TreeTransformer(function(node) { + if (node instanceof AST_Directive && node.value == "$ORIG") { + return List.splice(body); + } + })); + } +}, AST_Scope); + +var AST_ClassInitBlock = DEFNODE("ClassInitBlock", null, { + $documentation: "Value for `class` static initialization blocks", +}, AST_Scope); + +var AST_Lambda = DEFNODE("Lambda", "argnames length_read rest safe_ids uses_arguments", { + $documentation: "Base class for functions", + $propdoc: { + argnames: "[(AST_DefaultValue|AST_Destructured|AST_SymbolFunarg)*] array of function arguments and/or destructured literals", + length_read: "[boolean/S] whether length property of this function is accessed", + rest: "[(AST_Destructured|AST_SymbolFunarg)?] rest parameter, or null if absent", + uses_arguments: "[boolean|number/S] whether this function accesses the arguments array", + }, + each_argname: function(visit) { + var tw = new TreeWalker(function(node) { + if (node instanceof AST_DefaultValue) { + node.name.walk(tw); + return true; + } + if (node instanceof AST_DestructuredKeyVal) { + node.value.walk(tw); + return true; + } + if (node instanceof AST_SymbolFunarg) visit(node); + }); + this.argnames.forEach(function(argname) { + argname.walk(tw); + }); + if (this.rest) this.rest.walk(tw); + }, + _equals: function(node) { + return prop_equals(this.rest, node.rest) + && prop_equals(this.name, node.name) + && prop_equals(this.value, node.value) + && all_equals(this.argnames, node.argnames) + && all_equals(this.body, node.body); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + if (node.name) node.name.walk(visitor); + node.argnames.forEach(function(argname) { + argname.walk(visitor); + }); + if (node.rest) node.rest.walk(visitor); + walk_body(node, visitor); + }); + }, + _validate: function() { + if (this.TYPE == "Lambda") throw new Error("should not instantiate AST_Lambda"); + this.argnames.forEach(function(node) { + validate_destructured(node, function(node) { + if (!(node instanceof AST_SymbolFunarg)) throw new Error("argnames must be AST_SymbolFunarg[]"); + }, true); + }); + if (this.rest != null) validate_destructured(this.rest, function(node) { + if (!(node instanceof AST_SymbolFunarg)) throw new Error("rest must be AST_SymbolFunarg"); + }); + }, +}, AST_Scope); + +var AST_Accessor = DEFNODE("Accessor", null, { + $documentation: "A getter/setter function", + _validate: function() { + if (this.name != null) throw new Error("name must be null"); + }, +}, AST_Lambda); + +var AST_LambdaExpression = DEFNODE("LambdaExpression", "inlined", { + $documentation: "Base class for function expressions", + $propdoc: { + inlined: "[boolean/S] whether this function has been inlined", + }, + _validate: function() { + if (this.TYPE == "LambdaExpression") throw new Error("should not instantiate AST_LambdaExpression"); + }, +}, AST_Lambda); + +function is_arrow(node) { + return node instanceof AST_Arrow || node instanceof AST_AsyncArrow; +} + +function is_async(node) { + return node instanceof AST_AsyncArrow + || node instanceof AST_AsyncDefun + || node instanceof AST_AsyncFunction + || node instanceof AST_AsyncGeneratorDefun + || node instanceof AST_AsyncGeneratorFunction; +} + +function is_generator(node) { + return node instanceof AST_AsyncGeneratorDefun + || node instanceof AST_AsyncGeneratorFunction + || node instanceof AST_GeneratorDefun + || node instanceof AST_GeneratorFunction; +} + +function walk_lambda(node, tw) { + if (is_arrow(node) && node.value) { + node.value.walk(tw); + } else { + walk_body(node, tw); + } +} + +var AST_Arrow = DEFNODE("Arrow", "value", { + $documentation: "An arrow function expression", + $propdoc: { + value: "[AST_Node?] simple return expression, or null if using function body.", + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.argnames.forEach(function(argname) { + argname.walk(visitor); + }); + if (node.rest) node.rest.walk(visitor); + if (node.value) { + node.value.walk(visitor); + } else { + walk_body(node, visitor); + } + }); + }, + _validate: function() { + if (this.name != null) throw new Error("name must be null"); + if (this.uses_arguments) throw new Error("uses_arguments must be false"); + if (this.value != null) { + must_be_expression(this, "value"); + if (this.body.length) throw new Error("body must be empty if value exists"); + } + }, +}, AST_LambdaExpression); + +var AST_AsyncArrow = DEFNODE("AsyncArrow", "value", { + $documentation: "An asynchronous arrow function expression", + $propdoc: { + value: "[AST_Node?] simple return expression, or null if using function body.", + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.argnames.forEach(function(argname) { + argname.walk(visitor); + }); + if (node.rest) node.rest.walk(visitor); + if (node.value) { + node.value.walk(visitor); + } else { + walk_body(node, visitor); + } + }); + }, + _validate: function() { + if (this.name != null) throw new Error("name must be null"); + if (this.uses_arguments) throw new Error("uses_arguments must be false"); + if (this.value != null) { + must_be_expression(this, "value"); + if (this.body.length) throw new Error("body must be empty if value exists"); + } + }, +}, AST_LambdaExpression); + +var AST_AsyncFunction = DEFNODE("AsyncFunction", "name", { + $documentation: "An asynchronous function expression", + $propdoc: { + name: "[AST_SymbolLambda?] the name of this function, or null if not specified", + }, + _validate: function() { + if (this.name != null) { + if (!(this.name instanceof AST_SymbolLambda)) throw new Error("name must be AST_SymbolLambda"); + } + }, +}, AST_LambdaExpression); + +var AST_AsyncGeneratorFunction = DEFNODE("AsyncGeneratorFunction", "name", { + $documentation: "An asynchronous generator function expression", + $propdoc: { + name: "[AST_SymbolLambda?] the name of this function, or null if not specified", + }, + _validate: function() { + if (this.name != null) { + if (!(this.name instanceof AST_SymbolLambda)) throw new Error("name must be AST_SymbolLambda"); + } + }, +}, AST_LambdaExpression); + +var AST_Function = DEFNODE("Function", "name", { + $documentation: "A function expression", + $propdoc: { + name: "[AST_SymbolLambda?] the name of this function, or null if not specified", + }, + _validate: function() { + if (this.name != null) { + if (!(this.name instanceof AST_SymbolLambda)) throw new Error("name must be AST_SymbolLambda"); + } + }, +}, AST_LambdaExpression); + +var AST_GeneratorFunction = DEFNODE("GeneratorFunction", "name", { + $documentation: "A generator function expression", + $propdoc: { + name: "[AST_SymbolLambda?] the name of this function, or null if not specified", + }, + _validate: function() { + if (this.name != null) { + if (!(this.name instanceof AST_SymbolLambda)) throw new Error("name must be AST_SymbolLambda"); + } + }, +}, AST_LambdaExpression); + +var AST_LambdaDefinition = DEFNODE("LambdaDefinition", "inlined name", { + $documentation: "Base class for function definitions", + $propdoc: { + inlined: "[boolean/S] whether this function has been inlined", + name: "[AST_SymbolDefun] the name of this function", + }, + _validate: function() { + if (this.TYPE == "LambdaDefinition") throw new Error("should not instantiate AST_LambdaDefinition"); + if (!(this.name instanceof AST_SymbolDefun)) throw new Error("name must be AST_SymbolDefun"); + }, +}, AST_Lambda); + +var AST_AsyncDefun = DEFNODE("AsyncDefun", null, { + $documentation: "An asynchronous function definition", +}, AST_LambdaDefinition); + +var AST_AsyncGeneratorDefun = DEFNODE("AsyncGeneratorDefun", null, { + $documentation: "An asynchronous generator function definition", +}, AST_LambdaDefinition); + +var AST_Defun = DEFNODE("Defun", null, { + $documentation: "A function definition", +}, AST_LambdaDefinition); + +var AST_GeneratorDefun = DEFNODE("GeneratorDefun", null, { + $documentation: "A generator function definition", +}, AST_LambdaDefinition); + +/* -----[ classes ]----- */ + +var AST_Class = DEFNODE("Class", "extends name properties", { + $documentation: "Base class for class literals", + $propdoc: { + extends: "[AST_Node?] the super class, or null if not specified", + properties: "[AST_ClassProperty*] array of class properties", + }, + _equals: function(node) { + return prop_equals(this.name, node.name) + && prop_equals(this.extends, node.extends) + && all_equals(this.properties, node.properties); + }, + resolve: function(def_class) { + return def_class ? this : this.parent_scope.resolve(); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + if (node.name) node.name.walk(visitor); + if (node.extends) node.extends.walk(visitor); + node.properties.forEach(function(prop) { + prop.walk(visitor); + }); + }); + }, + _validate: function() { + if (this.TYPE == "Class") throw new Error("should not instantiate AST_Class"); + if (this.extends != null) must_be_expression(this, "extends"); + this.properties.forEach(function(node) { + if (!(node instanceof AST_ClassProperty)) throw new Error("properties must contain AST_ClassProperty"); + }); + }, +}, AST_BlockScope); + +var AST_DefClass = DEFNODE("DefClass", null, { + $documentation: "A class definition", + $propdoc: { + name: "[AST_SymbolDefClass] the name of this class", + }, + _validate: function() { + if (!(this.name instanceof AST_SymbolDefClass)) throw new Error("name must be AST_SymbolDefClass"); + }, +}, AST_Class); + +var AST_ClassExpression = DEFNODE("ClassExpression", null, { + $documentation: "A class expression", + $propdoc: { + name: "[AST_SymbolClass?] the name of this class, or null if not specified", + }, + _validate: function() { + if (this.name != null) { + if (!(this.name instanceof AST_SymbolClass)) throw new Error("name must be AST_SymbolClass"); + } + }, +}, AST_Class); + +var AST_ClassProperty = DEFNODE("ClassProperty", "key private static value", { + $documentation: "Base class for `class` properties", + $propdoc: { + key: "[string|AST_Node?] property name (AST_Node for computed property, null for initialization block)", + private: "[boolean] whether this is a private property", + static: "[boolean] whether this is a static property", + value: "[AST_Node?] property value (AST_Accessor for getters/setters, AST_LambdaExpression for methods, null if not specified for fields)", + }, + _equals: function(node) { + return !this.private == !node.private + && !this.static == !node.static + && prop_equals(this.key, node.key) + && prop_equals(this.value, node.value); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + if (node.key instanceof AST_Node) node.key.walk(visitor); + if (node.value) node.value.walk(visitor); + }); + }, + _validate: function() { + if (this.TYPE == "ClassProperty") throw new Error("should not instantiate AST_ClassProperty"); + if (this instanceof AST_ClassInit) { + if (this.key != null) throw new Error("key must be null"); + } else if (typeof this.key != "string") { + if (!(this.key instanceof AST_Node)) throw new Error("key must be string or AST_Node"); + must_be_expression(this, "key"); + } + if(this.value != null) { + if (!(this.value instanceof AST_Node)) throw new Error("value must be AST_Node"); + } + }, +}); + +var AST_ClassField = DEFNODE("ClassField", null, { + $documentation: "A `class` field", + _validate: function() { + if(this.value != null) must_be_expression(this, "value"); + }, +}, AST_ClassProperty); + +var AST_ClassGetter = DEFNODE("ClassGetter", null, { + $documentation: "A `class` getter", + _validate: function() { + if (!(this.value instanceof AST_Accessor)) throw new Error("value must be AST_Accessor"); + }, +}, AST_ClassProperty); + +var AST_ClassSetter = DEFNODE("ClassSetter", null, { + $documentation: "A `class` setter", + _validate: function() { + if (!(this.value instanceof AST_Accessor)) throw new Error("value must be AST_Accessor"); + }, +}, AST_ClassProperty); + +var AST_ClassMethod = DEFNODE("ClassMethod", null, { + $documentation: "A `class` method", + _validate: function() { + if (!(this.value instanceof AST_LambdaExpression)) throw new Error("value must be AST_LambdaExpression"); + if (is_arrow(this.value)) throw new Error("value cannot be AST_Arrow or AST_AsyncArrow"); + if (this.value.name != null) throw new Error("name of class method's lambda must be null"); + }, +}, AST_ClassProperty); + +var AST_ClassInit = DEFNODE("ClassInit", null, { + $documentation: "A `class` static initialization block", + _validate: function() { + if (!this.static) throw new Error("static must be true"); + if (!(this.value instanceof AST_ClassInitBlock)) throw new Error("value must be AST_ClassInitBlock"); + }, + initialize: function() { + this.static = true; + }, +}, AST_ClassProperty); + +/* -----[ JUMPS ]----- */ + +var AST_Jump = DEFNODE("Jump", null, { + $documentation: "Base class for “jumps” (for now that's `return`, `throw`, `break` and `continue`)", + _validate: function() { + if (this.TYPE == "Jump") throw new Error("should not instantiate AST_Jump"); + }, +}, AST_Statement); + +var AST_Exit = DEFNODE("Exit", "value", { + $documentation: "Base class for “exits” (`return` and `throw`)", + $propdoc: { + value: "[AST_Node?] the value returned or thrown by this statement; could be null for AST_Return" + }, + _equals: function(node) { + return prop_equals(this.value, node.value); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + if (node.value) node.value.walk(visitor); + }); + }, + _validate: function() { + if (this.TYPE == "Exit") throw new Error("should not instantiate AST_Exit"); + }, +}, AST_Jump); + +var AST_Return = DEFNODE("Return", null, { + $documentation: "A `return` statement", + _validate: function() { + if (this.value != null) must_be_expression(this, "value"); + }, +}, AST_Exit); + +var AST_Throw = DEFNODE("Throw", null, { + $documentation: "A `throw` statement", + _validate: function() { + must_be_expression(this, "value"); + }, +}, AST_Exit); + +var AST_LoopControl = DEFNODE("LoopControl", "label", { + $documentation: "Base class for loop control statements (`break` and `continue`)", + $propdoc: { + label: "[AST_LabelRef?] the label, or null if none", + }, + _equals: function(node) { + return prop_equals(this.label, node.label); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + if (node.label) node.label.walk(visitor); + }); + }, + _validate: function() { + if (this.TYPE == "LoopControl") throw new Error("should not instantiate AST_LoopControl"); + if (this.label != null) { + if (!(this.label instanceof AST_LabelRef)) throw new Error("label must be AST_LabelRef"); + } + }, +}, AST_Jump); + +var AST_Break = DEFNODE("Break", null, { + $documentation: "A `break` statement" +}, AST_LoopControl); + +var AST_Continue = DEFNODE("Continue", null, { + $documentation: "A `continue` statement" +}, AST_LoopControl); + +/* -----[ IF ]----- */ + +var AST_If = DEFNODE("If", "condition alternative", { + $documentation: "A `if` statement", + $propdoc: { + condition: "[AST_Node] the `if` condition", + alternative: "[AST_Statement?] the `else` part, or null if not present" + }, + _equals: function(node) { + return this.body.equals(node.body) + && this.condition.equals(node.condition) + && prop_equals(this.alternative, node.alternative); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.condition.walk(visitor); + node.body.walk(visitor); + if (node.alternative) node.alternative.walk(visitor); + }); + }, + _validate: function() { + must_be_expression(this, "condition"); + if (this.alternative != null) { + if (!is_statement(this.alternative)) throw new Error("alternative must be AST_Statement"); + } + }, +}, AST_StatementWithBody); + +/* -----[ SWITCH ]----- */ + +var AST_Switch = DEFNODE("Switch", "expression", { + $documentation: "A `switch` statement", + $propdoc: { + expression: "[AST_Node] the `switch` “discriminant”" + }, + _equals: function(node) { + return this.expression.equals(node.expression) + && all_equals(this.body, node.body); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.expression.walk(visitor); + walk_body(node, visitor); + }); + }, + _validate: function() { + must_be_expression(this, "expression"); + this.body.forEach(function(node) { + if (!(node instanceof AST_SwitchBranch)) throw new Error("body must be AST_SwitchBranch[]"); + }); + }, +}, AST_Block); + +var AST_SwitchBranch = DEFNODE("SwitchBranch", null, { + $documentation: "Base class for `switch` branches", + _validate: function() { + if (this.TYPE == "SwitchBranch") throw new Error("should not instantiate AST_SwitchBranch"); + }, +}, AST_Block); + +var AST_Default = DEFNODE("Default", null, { + $documentation: "A `default` switch branch", +}, AST_SwitchBranch); + +var AST_Case = DEFNODE("Case", "expression", { + $documentation: "A `case` switch branch", + $propdoc: { + expression: "[AST_Node] the `case` expression" + }, + _equals: function(node) { + return this.expression.equals(node.expression) + && all_equals(this.body, node.body); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.expression.walk(visitor); + walk_body(node, visitor); + }); + }, + _validate: function() { + must_be_expression(this, "expression"); + }, +}, AST_SwitchBranch); + +/* -----[ EXCEPTIONS ]----- */ + +var AST_Try = DEFNODE("Try", "bcatch bfinally", { + $documentation: "A `try` statement", + $propdoc: { + bcatch: "[AST_Catch?] the catch block, or null if not present", + bfinally: "[AST_Finally?] the finally block, or null if not present" + }, + _equals: function(node) { + return all_equals(this.body, node.body) + && prop_equals(this.bcatch, node.bcatch) + && prop_equals(this.bfinally, node.bfinally); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + walk_body(node, visitor); + if (node.bcatch) node.bcatch.walk(visitor); + if (node.bfinally) node.bfinally.walk(visitor); + }); + }, + _validate: function() { + if (this.bcatch != null) { + if (!(this.bcatch instanceof AST_Catch)) throw new Error("bcatch must be AST_Catch"); + } + if (this.bfinally != null) { + if (!(this.bfinally instanceof AST_Finally)) throw new Error("bfinally must be AST_Finally"); + } + }, +}, AST_Block); + +var AST_Catch = DEFNODE("Catch", "argname", { + $documentation: "A `catch` node; only makes sense as part of a `try` statement", + $propdoc: { + argname: "[(AST_Destructured|AST_SymbolCatch)?] symbol for the exception, or null if not present", + }, + _equals: function(node) { + return prop_equals(this.argname, node.argname) + && all_equals(this.body, node.body); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + if (node.argname) node.argname.walk(visitor); + walk_body(node, visitor); + }); + }, + _validate: function() { + if (this.argname != null) validate_destructured(this.argname, function(node) { + if (!(node instanceof AST_SymbolCatch)) throw new Error("argname must be AST_SymbolCatch"); + }); + }, +}, AST_Block); + +var AST_Finally = DEFNODE("Finally", null, { + $documentation: "A `finally` node; only makes sense as part of a `try` statement" +}, AST_Block); + +/* -----[ VAR ]----- */ + +var AST_Definitions = DEFNODE("Definitions", "definitions", { + $documentation: "Base class for `var` nodes (variable declarations/initializations)", + $propdoc: { + definitions: "[AST_VarDef*] array of variable definitions" + }, + _equals: function(node) { + return all_equals(this.definitions, node.definitions); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.definitions.forEach(function(defn) { + defn.walk(visitor); + }); + }); + }, + _validate: function() { + if (this.TYPE == "Definitions") throw new Error("should not instantiate AST_Definitions"); + if (this.definitions.length < 1) throw new Error("must have at least one definition"); + }, +}, AST_Statement); + +var AST_Const = DEFNODE("Const", null, { + $documentation: "A `const` statement", + _validate: function() { + this.definitions.forEach(function(node) { + if (!(node instanceof AST_VarDef)) throw new Error("definitions must be AST_VarDef[]"); + validate_destructured(node.name, function(node) { + if (!(node instanceof AST_SymbolConst)) throw new Error("name must be AST_SymbolConst"); + }); + }); + }, +}, AST_Definitions); + +var AST_Let = DEFNODE("Let", null, { + $documentation: "A `let` statement", + _validate: function() { + this.definitions.forEach(function(node) { + if (!(node instanceof AST_VarDef)) throw new Error("definitions must be AST_VarDef[]"); + validate_destructured(node.name, function(node) { + if (!(node instanceof AST_SymbolLet)) throw new Error("name must be AST_SymbolLet"); + }); + }); + }, +}, AST_Definitions); + +var AST_Var = DEFNODE("Var", null, { + $documentation: "A `var` statement", + _validate: function() { + this.definitions.forEach(function(node) { + if (!(node instanceof AST_VarDef)) throw new Error("definitions must be AST_VarDef[]"); + validate_destructured(node.name, function(node) { + if (!(node instanceof AST_SymbolVar)) throw new Error("name must be AST_SymbolVar"); + }); + }); + }, +}, AST_Definitions); + +var AST_VarDef = DEFNODE("VarDef", "name value", { + $documentation: "A variable declaration; only appears in a AST_Definitions node", + $propdoc: { + name: "[AST_Destructured|AST_SymbolVar] name of the variable", + value: "[AST_Node?] initializer, or null of there's no initializer", + }, + _equals: function(node) { + return this.name.equals(node.name) + && prop_equals(this.value, node.value); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.name.walk(visitor); + if (node.value) node.value.walk(visitor); + }); + }, + _validate: function() { + if (this.value != null) must_be_expression(this, "value"); + }, +}); + +/* -----[ OTHER ]----- */ + +var AST_ExportDeclaration = DEFNODE("ExportDeclaration", "body", { + $documentation: "An `export` statement", + $propdoc: { + body: "[AST_DefClass|AST_Definitions|AST_LambdaDefinition] the statement to export", + }, + _equals: function(node) { + return this.body.equals(node.body); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.body.walk(visitor); + }); + }, + _validate: function() { + if (!(this.body instanceof AST_DefClass + || this.body instanceof AST_Definitions + || this.body instanceof AST_LambdaDefinition)) { + throw new Error("body must be AST_DefClass, AST_Definitions or AST_LambdaDefinition"); + } + }, +}, AST_Statement); + +var AST_ExportDefault = DEFNODE("ExportDefault", "body", { + $documentation: "An `export default` statement", + $propdoc: { + body: "[AST_Node] the default export", + }, + _equals: function(node) { + return this.body.equals(node.body); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.body.walk(visitor); + }); + }, + _validate: function() { + if (!(this.body instanceof AST_DefClass || this.body instanceof AST_LambdaDefinition)) { + must_be_expression(this, "body"); + } + }, +}, AST_Statement); + +var AST_ExportForeign = DEFNODE("ExportForeign", "aliases keys path", { + $documentation: "An `export ... from '...'` statement", + $propdoc: { + aliases: "[AST_String*] array of aliases to export", + keys: "[AST_String*] array of keys to import", + path: "[AST_String] the path to import module", + }, + _equals: function(node) { + return this.path.equals(node.path) + && all_equals(this.aliases, node.aliases) + && all_equals(this.keys, node.keys); + }, + _validate: function() { + if (this.aliases.length != this.keys.length) { + throw new Error("aliases:key length mismatch: " + this.aliases.length + " != " + this.keys.length); + } + this.aliases.forEach(function(name) { + if (!(name instanceof AST_String)) throw new Error("aliases must contain AST_String"); + }); + this.keys.forEach(function(name) { + if (!(name instanceof AST_String)) throw new Error("keys must contain AST_String"); + }); + if (!(this.path instanceof AST_String)) throw new Error("path must be AST_String"); + }, +}, AST_Statement); + +var AST_ExportReferences = DEFNODE("ExportReferences", "properties", { + $documentation: "An `export { ... }` statement", + $propdoc: { + properties: "[AST_SymbolExport*] array of aliases to export", + }, + _equals: function(node) { + return all_equals(this.properties, node.properties); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.properties.forEach(function(prop) { + prop.walk(visitor); + }); + }); + }, + _validate: function() { + this.properties.forEach(function(prop) { + if (!(prop instanceof AST_SymbolExport)) throw new Error("properties must contain AST_SymbolExport"); + }); + }, +}, AST_Statement); + +var AST_Import = DEFNODE("Import", "all default path properties", { + $documentation: "An `import` statement", + $propdoc: { + all: "[AST_SymbolImport?] the imported namespace, or null if not specified", + default: "[AST_SymbolImport?] the alias for default `export`, or null if not specified", + path: "[AST_String] the path to import module", + properties: "[(AST_SymbolImport*)?] array of aliases, or null if not specified", + }, + _equals: function(node) { + return this.path.equals(node.path) + && prop_equals(this.all, node.all) + && prop_equals(this.default, node.default) + && !this.properties == !node.properties + && (!this.properties || all_equals(this.properties, node.properties)); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + if (node.all) node.all.walk(visitor); + if (node.default) node.default.walk(visitor); + if (node.properties) node.properties.forEach(function(prop) { + prop.walk(visitor); + }); + }); + }, + _validate: function() { + if (this.all != null) { + if (!(this.all instanceof AST_SymbolImport)) throw new Error("all must be AST_SymbolImport"); + if (this.properties != null) throw new Error("cannot import both * and {} in the same statement"); + } + if (this.default != null) { + if (!(this.default instanceof AST_SymbolImport)) throw new Error("default must be AST_SymbolImport"); + if (this.default.key.value !== "") throw new Error("invalid default key: " + this.default.key.value); + } + if (!(this.path instanceof AST_String)) throw new Error("path must be AST_String"); + if (this.properties != null) this.properties.forEach(function(node) { + if (!(node instanceof AST_SymbolImport)) throw new Error("properties must contain AST_SymbolImport"); + }); + }, +}, AST_Statement); + +var AST_DefaultValue = DEFNODE("DefaultValue", "name value", { + $documentation: "A default value declaration", + $propdoc: { + name: "[AST_Destructured|AST_SymbolDeclaration] name of the variable", + value: "[AST_Node] value to assign if variable is `undefined`", + }, + _equals: function(node) { + return this.name.equals(node.name) + && this.value.equals(node.value); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.name.walk(visitor); + node.value.walk(visitor); + }); + }, + _validate: function() { + must_be_expression(this, "value"); + }, +}); + +function must_be_expressions(node, prop, allow_spread, allow_hole) { + node[prop].forEach(function(node) { + validate_expression(node, prop, true, allow_spread, allow_hole); + }); +} + +var AST_Call = DEFNODE("Call", "args expression optional pure terminal", { + $documentation: "A function call expression", + $propdoc: { + args: "[AST_Node*] array of arguments", + expression: "[AST_Node] expression to invoke as function", + optional: "[boolean] whether the expression is optional chaining", + pure: "[boolean/S] marker for side-effect-free call expression", + terminal: "[boolean] whether the chain has ended", + }, + _equals: function(node) { + return !this.optional == !node.optional + && this.expression.equals(node.expression) + && all_equals(this.args, node.args); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.expression.walk(visitor); + node.args.forEach(function(arg) { + arg.walk(visitor); + }); + }); + }, + _validate: function() { + must_be_expression(this, "expression"); + must_be_expressions(this, "args", true); + }, +}); + +var AST_New = DEFNODE("New", null, { + $documentation: "An object instantiation. Derives from a function call since it has exactly the same properties", + _validate: function() { + if (this.optional) throw new Error("optional must be false"); + if (this.terminal) throw new Error("terminal must be false"); + }, +}, AST_Call); + +var AST_Sequence = DEFNODE("Sequence", "expressions", { + $documentation: "A sequence expression (comma-separated expressions)", + $propdoc: { + expressions: "[AST_Node*] array of expressions (at least two)", + }, + _equals: function(node) { + return all_equals(this.expressions, node.expressions); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.expressions.forEach(function(expr) { + expr.walk(visitor); + }); + }); + }, + _validate: function() { + if (this.expressions.length < 2) throw new Error("expressions must contain multiple elements"); + must_be_expressions(this, "expressions"); + }, +}); + +function root_expr(prop) { + while (prop instanceof AST_PropAccess) prop = prop.expression; + return prop; +} + +var AST_PropAccess = DEFNODE("PropAccess", "expression optional property terminal", { + $documentation: "Base class for property access expressions, i.e. `a.foo` or `a[\"foo\"]`", + $propdoc: { + expression: "[AST_Node] the “container” expression", + optional: "[boolean] whether the expression is optional chaining", + property: "[AST_Node|string] the property to access. For AST_Dot this is always a plain string, while for AST_Sub it's an arbitrary AST_Node", + terminal: "[boolean] whether the chain has ended", + }, + _equals: function(node) { + return !this.optional == !node.optional + && prop_equals(this.property, node.property) + && this.expression.equals(node.expression); + }, + get_property: function() { + var p = this.property; + if (p instanceof AST_Constant) return p.value; + if (p instanceof AST_UnaryPrefix && p.operator == "void" && p.expression instanceof AST_Constant) return; + return p; + }, + _validate: function() { + if (this.TYPE == "PropAccess") throw new Error("should not instantiate AST_PropAccess"); + must_be_expression(this, "expression"); + }, +}); + +var AST_Dot = DEFNODE("Dot", "quoted", { + $documentation: "A dotted property access expression", + $propdoc: { + quoted: "[boolean] whether property is transformed from a quoted string", + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.expression.walk(visitor); + }); + }, + _validate: function() { + if (typeof this.property != "string") throw new Error("property must be string"); + }, +}, AST_PropAccess); + +var AST_Sub = DEFNODE("Sub", null, { + $documentation: "Index-style property access, i.e. `a[\"foo\"]`", + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.expression.walk(visitor); + node.property.walk(visitor); + }); + }, + _validate: function() { + must_be_expression(this, "property"); + }, +}, AST_PropAccess); + +var AST_Spread = DEFNODE("Spread", "expression", { + $documentation: "Spread expression in array/object literals or function calls", + $propdoc: { + expression: "[AST_Node] expression to be expanded", + }, + _equals: function(node) { + return this.expression.equals(node.expression); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.expression.walk(visitor); + }); + }, + _validate: function() { + must_be_expression(this, "expression"); + }, +}); + +var AST_Unary = DEFNODE("Unary", "operator expression", { + $documentation: "Base class for unary expressions", + $propdoc: { + operator: "[string] the operator", + expression: "[AST_Node] expression that this unary operator applies to", + }, + _equals: function(node) { + return this.operator == node.operator + && this.expression.equals(node.expression); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.expression.walk(visitor); + }); + }, + _validate: function() { + if (this.TYPE == "Unary") throw new Error("should not instantiate AST_Unary"); + if (typeof this.operator != "string") throw new Error("operator must be string"); + must_be_expression(this, "expression"); + }, +}); + +var AST_UnaryPrefix = DEFNODE("UnaryPrefix", null, { + $documentation: "Unary prefix expression, i.e. `typeof i` or `++i`" +}, AST_Unary); + +var AST_UnaryPostfix = DEFNODE("UnaryPostfix", null, { + $documentation: "Unary postfix expression, i.e. `i++`" +}, AST_Unary); + +var AST_Binary = DEFNODE("Binary", "operator left right", { + $documentation: "Binary expression, i.e. `a + b`", + $propdoc: { + left: "[AST_Node] left-hand side expression", + operator: "[string] the operator", + right: "[AST_Node] right-hand side expression" + }, + _equals: function(node) { + return this.operator == node.operator + && this.left.equals(node.left) + && this.right.equals(node.right); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.left.walk(visitor); + node.right.walk(visitor); + }); + }, + _validate: function() { + if (!(this instanceof AST_Assign)) must_be_expression(this, "left"); + if (typeof this.operator != "string") throw new Error("operator must be string"); + must_be_expression(this, "right"); + }, +}); + +var AST_Conditional = DEFNODE("Conditional", "condition consequent alternative", { + $documentation: "Conditional expression using the ternary operator, i.e. `a ? b : c`", + $propdoc: { + condition: "[AST_Node]", + consequent: "[AST_Node]", + alternative: "[AST_Node]" + }, + _equals: function(node) { + return this.condition.equals(node.condition) + && this.consequent.equals(node.consequent) + && this.alternative.equals(node.alternative); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.condition.walk(visitor); + node.consequent.walk(visitor); + node.alternative.walk(visitor); + }); + }, + _validate: function() { + must_be_expression(this, "condition"); + must_be_expression(this, "consequent"); + must_be_expression(this, "alternative"); + }, +}); + +var AST_Assign = DEFNODE("Assign", null, { + $documentation: "An assignment expression — `a = b + 5`", + _validate: function() { + if (this.operator.indexOf("=") < 0) throw new Error('operator must contain "="'); + if (this.left instanceof AST_Destructured) { + if (this.operator != "=") throw new Error("invalid destructuring operator: " + this.operator); + validate_destructured(this.left, function(node) { + if (!(node instanceof AST_PropAccess || node instanceof AST_SymbolRef)) { + throw new Error("left must be assignable: " + node.TYPE); + } + }); + } else if (!(this.left instanceof AST_Infinity + || this.left instanceof AST_NaN + || this.left instanceof AST_PropAccess && !this.left.optional + || this.left instanceof AST_SymbolRef + || this.left instanceof AST_Undefined)) { + throw new Error("left must be assignable"); + } + }, +}, AST_Binary); + +var AST_Await = DEFNODE("Await", "expression", { + $documentation: "An await expression", + $propdoc: { + expression: "[AST_Node] expression with Promise to resolve on", + }, + _equals: function(node) { + return this.expression.equals(node.expression); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.expression.walk(visitor); + }); + }, + _validate: function() { + must_be_expression(this, "expression"); + }, +}); + +var AST_Yield = DEFNODE("Yield", "expression nested", { + $documentation: "A yield expression", + $propdoc: { + expression: "[AST_Node?] return value for iterator, or null if undefined", + nested: "[boolean] whether to iterate over expression as generator", + }, + _equals: function(node) { + return !this.nested == !node.nested + && prop_equals(this.expression, node.expression); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + if (node.expression) node.expression.walk(visitor); + }); + }, + _validate: function() { + if (this.expression != null) { + must_be_expression(this, "expression"); + } else if (this.nested) { + throw new Error("yield* must contain expression"); + } + }, +}); + +/* -----[ LITERALS ]----- */ + +var AST_Array = DEFNODE("Array", "elements", { + $documentation: "An array literal", + $propdoc: { + elements: "[AST_Node*] array of elements" + }, + _equals: function(node) { + return all_equals(this.elements, node.elements); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.elements.forEach(function(element) { + element.walk(visitor); + }); + }); + }, + _validate: function() { + must_be_expressions(this, "elements", true, true); + }, +}); + +var AST_Destructured = DEFNODE("Destructured", "rest", { + $documentation: "Base class for destructured literal", + $propdoc: { + rest: "[(AST_Destructured|AST_SymbolDeclaration|AST_SymbolRef)?] rest parameter, or null if absent", + }, + _validate: function() { + if (this.TYPE == "Destructured") throw new Error("should not instantiate AST_Destructured"); + }, +}); + +function validate_destructured(node, check, allow_default) { + if (node instanceof AST_DefaultValue && allow_default) return validate_destructured(node.name, check); + if (node instanceof AST_Destructured) { + if (node.rest != null) validate_destructured(node.rest, check); + if (node instanceof AST_DestructuredArray) return node.elements.forEach(function(node) { + if (!(node instanceof AST_Hole)) validate_destructured(node, check, true); + }); + if (node instanceof AST_DestructuredObject) return node.properties.forEach(function(prop) { + validate_destructured(prop.value, check, true); + }); + } + check(node); +} + +var AST_DestructuredArray = DEFNODE("DestructuredArray", "elements", { + $documentation: "A destructured array literal", + $propdoc: { + elements: "[(AST_DefaultValue|AST_Destructured|AST_SymbolDeclaration|AST_SymbolRef)*] array of elements", + }, + _equals: function(node) { + return prop_equals(this.rest, node.rest) + && all_equals(this.elements, node.elements); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.elements.forEach(function(element) { + element.walk(visitor); + }); + if (node.rest) node.rest.walk(visitor); + }); + }, +}, AST_Destructured); + +var AST_DestructuredKeyVal = DEFNODE("DestructuredKeyVal", "key value", { + $documentation: "A key: value destructured property", + $propdoc: { + key: "[string|AST_Node] property name. For computed property this is an AST_Node.", + value: "[AST_DefaultValue|AST_Destructured|AST_SymbolDeclaration|AST_SymbolRef] property value", + }, + _equals: function(node) { + return prop_equals(this.key, node.key) + && this.value.equals(node.value); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + if (node.key instanceof AST_Node) node.key.walk(visitor); + node.value.walk(visitor); + }); + }, + _validate: function() { + if (typeof this.key != "string") { + if (!(this.key instanceof AST_Node)) throw new Error("key must be string or AST_Node"); + must_be_expression(this, "key"); + } + if (!(this.value instanceof AST_Node)) throw new Error("value must be AST_Node"); + }, +}); + +var AST_DestructuredObject = DEFNODE("DestructuredObject", "properties", { + $documentation: "A destructured object literal", + $propdoc: { + properties: "[AST_DestructuredKeyVal*] array of properties", + }, + _equals: function(node) { + return prop_equals(this.rest, node.rest) + && all_equals(this.properties, node.properties); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.properties.forEach(function(prop) { + prop.walk(visitor); + }); + if (node.rest) node.rest.walk(visitor); + }); + }, + _validate: function() { + this.properties.forEach(function(node) { + if (!(node instanceof AST_DestructuredKeyVal)) throw new Error("properties must be AST_DestructuredKeyVal[]"); + }); + }, +}, AST_Destructured); + +var AST_Object = DEFNODE("Object", "properties", { + $documentation: "An object literal", + $propdoc: { + properties: "[(AST_ObjectProperty|AST_Spread)*] array of properties" + }, + _equals: function(node) { + return all_equals(this.properties, node.properties); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + node.properties.forEach(function(prop) { + prop.walk(visitor); + }); + }); + }, + _validate: function() { + this.properties.forEach(function(node) { + if (!(node instanceof AST_ObjectProperty || node instanceof AST_Spread)) { + throw new Error("properties must contain AST_ObjectProperty and/or AST_Spread only"); + } + }); + }, +}); + +var AST_ObjectProperty = DEFNODE("ObjectProperty", "key value", { + $documentation: "Base class for literal object properties", + $propdoc: { + key: "[string|AST_Node] property name. For computed property this is an AST_Node.", + value: "[AST_Node] property value. For getters and setters this is an AST_Accessor.", + }, + _equals: function(node) { + return prop_equals(this.key, node.key) + && this.value.equals(node.value); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + if (node.key instanceof AST_Node) node.key.walk(visitor); + node.value.walk(visitor); + }); + }, + _validate: function() { + if (this.TYPE == "ObjectProperty") throw new Error("should not instantiate AST_ObjectProperty"); + if (typeof this.key != "string") { + if (!(this.key instanceof AST_Node)) throw new Error("key must be string or AST_Node"); + must_be_expression(this, "key"); + } + if (!(this.value instanceof AST_Node)) throw new Error("value must be AST_Node"); + }, +}); + +var AST_ObjectKeyVal = DEFNODE("ObjectKeyVal", null, { + $documentation: "A key: value object property", + _validate: function() { + must_be_expression(this, "value"); + }, +}, AST_ObjectProperty); + +var AST_ObjectMethod = DEFNODE("ObjectMethod", null, { + $documentation: "A key(){} object property", + _validate: function() { + if (!(this.value instanceof AST_LambdaExpression)) throw new Error("value must be AST_LambdaExpression"); + if (is_arrow(this.value)) throw new Error("value cannot be AST_Arrow or AST_AsyncArrow"); + if (this.value.name != null) throw new Error("name of object method's lambda must be null"); + }, +}, AST_ObjectKeyVal); + +var AST_ObjectSetter = DEFNODE("ObjectSetter", null, { + $documentation: "An object setter property", + _validate: function() { + if (!(this.value instanceof AST_Accessor)) throw new Error("value must be AST_Accessor"); + }, +}, AST_ObjectProperty); + +var AST_ObjectGetter = DEFNODE("ObjectGetter", null, { + $documentation: "An object getter property", + _validate: function() { + if (!(this.value instanceof AST_Accessor)) throw new Error("value must be AST_Accessor"); + }, +}, AST_ObjectProperty); + +var AST_Symbol = DEFNODE("Symbol", "scope name thedef", { + $documentation: "Base class for all symbols", + $propdoc: { + name: "[string] name of this symbol", + scope: "[AST_Scope/S] the current scope (not necessarily the definition scope)", + thedef: "[SymbolDef/S] the definition of this symbol" + }, + _equals: function(node) { + return this.thedef ? this.thedef === node.thedef : this.name == node.name; + }, + _validate: function() { + if (this.TYPE == "Symbol") throw new Error("should not instantiate AST_Symbol"); + if (typeof this.name != "string") throw new Error("name must be string"); + }, +}); + +var AST_SymbolDeclaration = DEFNODE("SymbolDeclaration", "init", { + $documentation: "A declaration symbol (symbol in var, function name or argument, symbol in catch)", +}, AST_Symbol); + +var AST_SymbolConst = DEFNODE("SymbolConst", null, { + $documentation: "Symbol defining a constant", +}, AST_SymbolDeclaration); + +var AST_SymbolImport = DEFNODE("SymbolImport", "key", { + $documentation: "Symbol defined by an `import` statement", + $propdoc: { + key: "[AST_String] the original `export` name", + }, + _equals: function(node) { + return this.name == node.name + && this.key.equals(node.key); + }, + _validate: function() { + if (!(this.key instanceof AST_String)) throw new Error("key must be AST_String"); + }, +}, AST_SymbolConst); + +var AST_SymbolLet = DEFNODE("SymbolLet", null, { + $documentation: "Symbol defining a lexical-scoped variable", +}, AST_SymbolDeclaration); + +var AST_SymbolVar = DEFNODE("SymbolVar", null, { + $documentation: "Symbol defining a variable", +}, AST_SymbolDeclaration); + +var AST_SymbolFunarg = DEFNODE("SymbolFunarg", "unused", { + $documentation: "Symbol naming a function argument", +}, AST_SymbolVar); + +var AST_SymbolDefun = DEFNODE("SymbolDefun", null, { + $documentation: "Symbol defining a function", +}, AST_SymbolDeclaration); + +var AST_SymbolLambda = DEFNODE("SymbolLambda", null, { + $documentation: "Symbol naming a function expression", +}, AST_SymbolDeclaration); + +var AST_SymbolDefClass = DEFNODE("SymbolDefClass", null, { + $documentation: "Symbol defining a class", +}, AST_SymbolConst); + +var AST_SymbolClass = DEFNODE("SymbolClass", null, { + $documentation: "Symbol naming a class expression", +}, AST_SymbolConst); + +var AST_SymbolCatch = DEFNODE("SymbolCatch", null, { + $documentation: "Symbol naming the exception in catch", +}, AST_SymbolDeclaration); + +var AST_Label = DEFNODE("Label", "references", { + $documentation: "Symbol naming a label (declaration)", + $propdoc: { + references: "[AST_LoopControl*] a list of nodes referring to this label" + }, + initialize: function() { + this.references = []; + this.thedef = this; + }, +}, AST_Symbol); + +var AST_SymbolRef = DEFNODE("SymbolRef", "fixed in_arg redef", { + $documentation: "Reference to some symbol (not definition/declaration)", +}, AST_Symbol); + +var AST_SymbolExport = DEFNODE("SymbolExport", "alias", { + $documentation: "Reference in an `export` statement", + $propdoc: { + alias: "[AST_String] the `export` alias", + }, + _equals: function(node) { + return this.name == node.name + && this.alias.equals(node.alias); + }, + _validate: function() { + if (!(this.alias instanceof AST_String)) throw new Error("alias must be AST_String"); + }, +}, AST_SymbolRef); + +var AST_LabelRef = DEFNODE("LabelRef", null, { + $documentation: "Reference to a label symbol", +}, AST_Symbol); + +var AST_ObjectIdentity = DEFNODE("ObjectIdentity", null, { + $documentation: "Base class for `super` & `this`", + _equals: return_true, + _validate: function() { + if (this.TYPE == "ObjectIdentity") throw new Error("should not instantiate AST_ObjectIdentity"); + }, +}, AST_Symbol); + +var AST_Super = DEFNODE("Super", null, { + $documentation: "The `super` symbol", + _validate: function() { + if (this.name !== "super") throw new Error('name must be "super"'); + }, +}, AST_ObjectIdentity); + +var AST_This = DEFNODE("This", null, { + $documentation: "The `this` symbol", + _validate: function() { + if (this.TYPE == "This" && this.name !== "this") throw new Error('name must be "this"'); + }, +}, AST_ObjectIdentity); + +var AST_NewTarget = DEFNODE("NewTarget", null, { + $documentation: "The `new.target` symbol", + initialize: function() { + this.name = "new.target"; + }, + _validate: function() { + if (this.name !== "new.target") throw new Error('name must be "new.target": ' + this.name); + }, +}, AST_This); + +var AST_Template = DEFNODE("Template", "expressions strings tag", { + $documentation: "A template literal, i.e. tag`str1${expr1}...strN${exprN}strN+1`", + $propdoc: { + expressions: "[AST_Node*] the placeholder expressions", + strings: "[string*] the raw text segments", + tag: "[AST_Node?] tag function, or null if absent", + }, + _equals: function(node) { + return prop_equals(this.tag, node.tag) + && list_equals(this.strings, node.strings) + && all_equals(this.expressions, node.expressions); + }, + walk: function(visitor) { + var node = this; + visitor.visit(node, function() { + if (node.tag) node.tag.walk(visitor); + node.expressions.forEach(function(expr) { + expr.walk(visitor); + }); + }); + }, + _validate: function() { + if (this.expressions.length + 1 != this.strings.length) { + throw new Error("malformed template with " + this.expressions.length + " placeholder(s) but " + this.strings.length + " text segment(s)"); + } + must_be_expressions(this, "expressions"); + this.strings.forEach(function(string) { + if (typeof string != "string") throw new Error("strings must contain string"); + }); + if (this.tag != null) must_be_expression(this, "tag"); + }, +}); + +var AST_Constant = DEFNODE("Constant", null, { + $documentation: "Base class for all constants", + _equals: function(node) { + return this.value === node.value; + }, + _validate: function() { + if (this.TYPE == "Constant") throw new Error("should not instantiate AST_Constant"); + }, +}); + +var AST_String = DEFNODE("String", "quote value", { + $documentation: "A string literal", + $propdoc: { + quote: "[string?] the original quote character", + value: "[string] the contents of this string", + }, + _validate: function() { + if (this.quote != null) { + if (typeof this.quote != "string") throw new Error("quote must be string"); + if (!/^["']$/.test(this.quote)) throw new Error("invalid quote: " + this.quote); + } + if (typeof this.value != "string") throw new Error("value must be string"); + }, +}, AST_Constant); + +var AST_Number = DEFNODE("Number", "value", { + $documentation: "A number literal", + $propdoc: { + value: "[number] the numeric value", + }, + _validate: function() { + if (typeof this.value != "number") throw new Error("value must be number"); + if (!isFinite(this.value)) throw new Error("value must be finite"); + if (this.value < 0) throw new Error("value cannot be negative"); + }, +}, AST_Constant); + +var AST_BigInt = DEFNODE("BigInt", "value", { + $documentation: "A BigInt literal", + $propdoc: { + value: "[string] the numeric representation", + }, + _validate: function() { + if (typeof this.value != "string") throw new Error("value must be string"); + if (this.value[0] == "-") throw new Error("value cannot be negative"); + }, +}, AST_Constant); + +var AST_RegExp = DEFNODE("RegExp", "value", { + $documentation: "A regexp literal", + $propdoc: { + value: "[RegExp] the actual regexp" + }, + _equals: function(node) { + return "" + this.value == "" + node.value; + }, + _validate: function() { + if (!(this.value instanceof RegExp)) throw new Error("value must be RegExp"); + }, +}, AST_Constant); + +var AST_Atom = DEFNODE("Atom", null, { + $documentation: "Base class for atoms", + _equals: return_true, + _validate: function() { + if (this.TYPE == "Atom") throw new Error("should not instantiate AST_Atom"); + }, +}, AST_Constant); + +var AST_Null = DEFNODE("Null", null, { + $documentation: "The `null` atom", + value: null, +}, AST_Atom); + +var AST_NaN = DEFNODE("NaN", null, { + $documentation: "The impossible value", + value: 0/0, +}, AST_Atom); + +var AST_Undefined = DEFNODE("Undefined", null, { + $documentation: "The `undefined` value", + value: function(){}(), +}, AST_Atom); + +var AST_Hole = DEFNODE("Hole", null, { + $documentation: "A hole in an array", + value: function(){}(), +}, AST_Atom); + +var AST_Infinity = DEFNODE("Infinity", null, { + $documentation: "The `Infinity` value", + value: 1/0, +}, AST_Atom); + +var AST_Boolean = DEFNODE("Boolean", null, { + $documentation: "Base class for booleans", + _validate: function() { + if (this.TYPE == "Boolean") throw new Error("should not instantiate AST_Boolean"); + }, +}, AST_Atom); + +var AST_False = DEFNODE("False", null, { + $documentation: "The `false` atom", + value: false, +}, AST_Boolean); + +var AST_True = DEFNODE("True", null, { + $documentation: "The `true` atom", + value: true, +}, AST_Boolean); + +/* -----[ TreeWalker ]----- */ + +function TreeWalker(callback) { + this.callback = callback; + this.directives = Object.create(null); + this.stack = []; +} +TreeWalker.prototype = { + visit: function(node, descend) { + this.push(node); + var done = this.callback(node, descend || noop); + if (!done && descend) descend(); + this.pop(); + }, + parent: function(n) { + return this.stack[this.stack.length - 2 - (n || 0)]; + }, + push: function(node) { + var value; + if (node instanceof AST_Class) { + this.directives = Object.create(this.directives); + value = "use strict"; + } else if (node instanceof AST_Directive) { + value = node.value; + } else if (node instanceof AST_Lambda) { + this.directives = Object.create(this.directives); + } + if (value && !this.directives[value]) this.directives[value] = node; + this.stack.push(node); + }, + pop: function() { + var node = this.stack.pop(); + if (node instanceof AST_Class || node instanceof AST_Lambda) { + this.directives = Object.getPrototypeOf(this.directives); + } + }, + self: function() { + return this.stack[this.stack.length - 1]; + }, + find_parent: function(type) { + var stack = this.stack; + for (var i = stack.length - 1; --i >= 0;) { + var x = stack[i]; + if (x instanceof type) return x; + } + }, + has_directive: function(type) { + var dir = this.directives[type]; + if (dir) return dir; + var node = this.stack[this.stack.length - 1]; + if (node instanceof AST_Scope) { + for (var i = 0; i < node.body.length; ++i) { + var st = node.body[i]; + if (!(st instanceof AST_Directive)) break; + if (st.value == type) return st; + } + } + }, + loopcontrol_target: function(node) { + var stack = this.stack; + if (node.label) for (var i = stack.length; --i >= 0;) { + var x = stack[i]; + if (x instanceof AST_LabeledStatement && x.label.name == node.label.name) + return x.body; + } else for (var i = stack.length; --i >= 0;) { + var x = stack[i]; + if (x instanceof AST_IterationStatement + || node instanceof AST_Break && x instanceof AST_Switch) + return x; + } + }, + in_boolean_context: function() { + for (var drop = true, level = 0, parent, self = this.self(); parent = this.parent(level++); self = parent) { + if (parent instanceof AST_Binary) switch (parent.operator) { + case "&&": + case "||": + if (parent.left === self) drop = false; + continue; + default: + return false; + } + if (parent instanceof AST_Conditional) { + if (parent.condition === self) return true; + continue; + } + if (parent instanceof AST_DWLoop) return parent.condition === self; + if (parent instanceof AST_For) return parent.condition === self; + if (parent instanceof AST_If) return parent.condition === self; + if (parent instanceof AST_Return) { + if (parent.in_bool) return true; + while (parent = this.parent(level++)) { + if (parent instanceof AST_Lambda) { + if (parent.name) return false; + parent = this.parent(level++); + if (parent.TYPE != "Call") return false; + break; + } + } + } + if (parent instanceof AST_Sequence) { + if (parent.tail_node() === self) continue; + return drop ? "d" : true; + } + if (parent instanceof AST_SimpleStatement) return drop ? "d" : true; + if (parent instanceof AST_UnaryPrefix) return parent.operator == "!"; + return false; + } + } +}; diff --git a/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/compress.js b/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/compress.js new file mode 100644 index 00000000..cde397cf --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/compress.js @@ -0,0 +1,14241 @@ +/*********************************************************************** + + A JavaScript tokenizer / parser / beautifier / compressor. + https://github.com/mishoo/UglifyJS + + -------------------------------- (C) --------------------------------- + + Author: Mihai Bazon + + http://mihai.bazon.net/blog + + Distributed under the BSD license: + + Copyright 2012 (c) Mihai Bazon + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + ***********************************************************************/ + +"use strict"; + +function Compressor(options, false_by_default) { + if (!(this instanceof Compressor)) + return new Compressor(options, false_by_default); + TreeTransformer.call(this, this.before, this.after); + this.options = defaults(options, { + annotations : !false_by_default, + arguments : !false_by_default, + arrows : !false_by_default, + assignments : !false_by_default, + awaits : !false_by_default, + booleans : !false_by_default, + collapse_vars : !false_by_default, + comparisons : !false_by_default, + conditionals : !false_by_default, + dead_code : !false_by_default, + default_values : !false_by_default, + directives : !false_by_default, + drop_console : false, + drop_debugger : !false_by_default, + evaluate : !false_by_default, + expression : false, + functions : !false_by_default, + global_defs : false, + hoist_exports : !false_by_default, + hoist_funs : false, + hoist_props : !false_by_default, + hoist_vars : false, + ie : false, + if_return : !false_by_default, + imports : !false_by_default, + inline : !false_by_default, + join_vars : !false_by_default, + keep_fargs : false_by_default, + keep_fnames : false, + keep_infinity : false, + loops : !false_by_default, + merge_vars : !false_by_default, + module : false, + negate_iife : !false_by_default, + objects : !false_by_default, + optional_chains : !false_by_default, + passes : 1, + properties : !false_by_default, + pure_funcs : null, + pure_getters : !false_by_default && "strict", + reduce_funcs : !false_by_default, + reduce_vars : !false_by_default, + rests : !false_by_default, + sequences : !false_by_default, + side_effects : !false_by_default, + spreads : !false_by_default, + strings : !false_by_default, + switches : !false_by_default, + templates : !false_by_default, + top_retain : null, + toplevel : !!(options && (options["module"] || options["top_retain"])), + typeofs : !false_by_default, + unsafe : false, + unsafe_comps : false, + unsafe_Function : false, + unsafe_math : false, + unsafe_proto : false, + unsafe_regexp : false, + unsafe_undefined: false, + unused : !false_by_default, + varify : !false_by_default, + webkit : false, + yields : !false_by_default, + }, true); + var evaluate = this.options["evaluate"]; + this.eval_threshold = /eager/.test(evaluate) ? 1 / 0 : +evaluate; + var global_defs = this.options["global_defs"]; + if (typeof global_defs == "object") for (var key in global_defs) { + if (/^@/.test(key) && HOP(global_defs, key)) { + global_defs[key.slice(1)] = parse(global_defs[key], { expression: true }); + } + } + if (this.options["inline"] === true) this.options["inline"] = 4; + this.drop_fargs = this.options["keep_fargs"] ? return_false : function(lambda, parent) { + if (lambda.length_read) return false; + var name = lambda.name; + if (!name) return parent && parent.TYPE == "Call" && parent.expression === lambda; + if (name.fixed_value() !== lambda) return false; + var def = name.definition(); + if (def.direct_access) return false; + var escaped = def.escaped; + return escaped && escaped.depth != 1; + }; + if (this.options["module"]) this.directives["use strict"] = true; + var pure_funcs = this.options["pure_funcs"]; + if (typeof pure_funcs == "function") { + this.pure_funcs = pure_funcs; + } else if (typeof pure_funcs == "string") { + this.pure_funcs = function(node) { + var expr; + if (node instanceof AST_Call) { + expr = node.expression; + } else if (node instanceof AST_Template) { + expr = node.tag; + } + return !(expr && pure_funcs === expr.print_to_string()); + }; + } else if (Array.isArray(pure_funcs)) { + this.pure_funcs = function(node) { + var expr; + if (node instanceof AST_Call) { + expr = node.expression; + } else if (node instanceof AST_Template) { + expr = node.tag; + } + return !(expr && member(expr.print_to_string(), pure_funcs)); + }; + } else { + this.pure_funcs = return_true; + } + var sequences = this.options["sequences"]; + this.sequences_limit = sequences == 1 ? 800 : sequences | 0; + var top_retain = this.options["top_retain"]; + if (top_retain instanceof RegExp) { + this.top_retain = function(def) { + return top_retain.test(def.name); + }; + } else if (typeof top_retain == "function") { + this.top_retain = top_retain; + } else if (top_retain) { + if (typeof top_retain == "string") { + top_retain = top_retain.split(/,/); + } + this.top_retain = function(def) { + return member(def.name, top_retain); + }; + } + var toplevel = this.options["toplevel"]; + this.toplevel = typeof toplevel == "string" ? { + funcs: /funcs/.test(toplevel), + vars: /vars/.test(toplevel) + } : { + funcs: toplevel, + vars: toplevel + }; +} + +Compressor.prototype = new TreeTransformer(function(node, descend, in_list) { + if (node._squeezed) return node; + var is_scope = node instanceof AST_Scope; + if (is_scope) { + if (this.option("arrows") && is_arrow(node) && node.value) { + node.body = [ node.first_statement() ]; + node.value = null; + } + node.hoist_properties(this); + node.hoist_declarations(this); + node.process_returns(this); + } + // Before https://github.com/mishoo/UglifyJS/pull/1602 AST_Node.optimize() + // would call AST_Node.transform() if a different instance of AST_Node is + // produced after OPT(). + // This corrupts TreeWalker.stack, which cause AST look-ups to malfunction. + // Migrate and defer all children's AST_Node.transform() to below, which + // will now happen after this parent AST_Node has been properly substituted + // thus gives a consistent AST snapshot. + descend(node, this); + // Existing code relies on how AST_Node.optimize() worked, and omitting the + // following replacement call would result in degraded efficiency of both + // output and performance. + descend(node, this); + var opt = node.optimize(this); + if (is_scope && opt === node && !this.has_directive("use asm") && !opt.pinned()) { + opt.drop_unused(this); + if (opt.merge_variables(this)) opt.drop_unused(this); + descend(opt, this); + } + if (opt === node) opt._squeezed = true; + return opt; +}); +Compressor.prototype.option = function(key) { + return this.options[key]; +}; +Compressor.prototype.exposed = function(def) { + if (def.exported) return true; + if (def.undeclared) return true; + if (!(def.global || def.scope.resolve() instanceof AST_Toplevel)) return false; + var toplevel = this.toplevel; + return !all(def.orig, function(sym) { + return toplevel[sym instanceof AST_SymbolDefun ? "funcs" : "vars"]; + }); +}; +Compressor.prototype.compress = function(node) { + node = node.resolve_defines(this); + node.hoist_exports(this); + if (this.option("expression")) node.process_expression(true); + var merge_vars = this.options.merge_vars; + var passes = +this.options.passes || 1; + var min_count = 1 / 0; + var stopping = false; + var mangle = { ie: this.option("ie") }; + for (var pass = 0; pass < passes; pass++) { + node.figure_out_scope(mangle); + if (pass > 0 || this.option("reduce_vars")) + node.reset_opt_flags(this); + this.options.merge_vars = merge_vars && (stopping || pass == passes - 1); + node = node.transform(this); + if (passes > 1) { + var count = 0; + node.walk(new TreeWalker(function() { + count++; + })); + AST_Node.info("pass {pass}: last_count: {min_count}, count: {count}", { + pass: pass, + min_count: min_count, + count: count, + }); + if (count < min_count) { + min_count = count; + stopping = false; + } else if (stopping) { + break; + } else { + stopping = true; + } + } + } + if (this.option("expression")) node.process_expression(false); + return node; +}; + +(function(OPT) { + OPT(AST_Node, function(self, compressor) { + return self; + }); + + AST_Toplevel.DEFMETHOD("hoist_exports", function(compressor) { + if (!compressor.option("hoist_exports")) return; + var body = this.body, props = []; + for (var i = 0; i < body.length; i++) { + var stat = body[i]; + if (stat instanceof AST_ExportDeclaration) { + body[i] = stat = stat.body; + if (stat instanceof AST_Definitions) { + stat.definitions.forEach(function(defn) { + defn.name.match_symbol(export_symbol, true); + }); + } else { + export_symbol(stat.name); + } + } else if (stat instanceof AST_ExportReferences) { + body.splice(i--, 1); + [].push.apply(props, stat.properties); + } + } + if (props.length) body.push(make_node(AST_ExportReferences, this, { properties: props })); + + function export_symbol(sym) { + if (!(sym instanceof AST_SymbolDeclaration)) return; + var node = make_node(AST_SymbolExport, sym); + node.alias = make_node(AST_String, node, { value: node.name }); + props.push(node); + } + }); + + AST_Scope.DEFMETHOD("process_expression", function(insert, transform) { + var self = this; + var tt = new TreeTransformer(function(node) { + if (insert) { + if (node instanceof AST_Directive) node = make_node(AST_SimpleStatement, node, { + body: make_node(AST_String, node), + }); + if (node instanceof AST_SimpleStatement) { + return transform ? transform(node) : make_node(AST_Return, node, { value: node.body }); + } + } else if (node instanceof AST_Return) { + if (transform) return transform(node); + var value = node.value; + if (value instanceof AST_String) return make_node(AST_Directive, value); + return make_node(AST_SimpleStatement, node, { + body: value || make_node(AST_UnaryPrefix, node, { + operator: "void", + expression: make_node(AST_Number, node, { value: 0 }), + }), + }); + } + if (node instanceof AST_Block) { + if (node instanceof AST_Lambda) { + if (node !== self) return node; + } else if (insert === "awaits" && node instanceof AST_Try) { + if (node.bfinally) return node; + } + for (var index = node.body.length; --index >= 0;) { + var stat = node.body[index]; + if (!is_declaration(stat, true)) { + node.body[index] = stat.transform(tt); + break; + } + } + } else if (node instanceof AST_If) { + node.body = node.body.transform(tt); + if (node.alternative) node.alternative = node.alternative.transform(tt); + } else if (node instanceof AST_With) { + node.body = node.body.transform(tt); + } + return node; + }); + self.transform(tt); + }); + AST_Toplevel.DEFMETHOD("unwrap_expression", function() { + var self = this; + switch (self.body.length) { + case 0: + return make_node(AST_UnaryPrefix, self, { + operator: "void", + expression: make_node(AST_Number, self, { value: 0 }), + }); + case 1: + var stat = self.body[0]; + if (stat instanceof AST_Directive) return make_node(AST_String, stat); + if (stat instanceof AST_SimpleStatement) return stat.body; + default: + return make_node(AST_Call, self, { + expression: make_node(AST_Function, self, { + argnames: [], + body: self.body, + }).init_vars(self), + args: [], + }); + } + }); + AST_Node.DEFMETHOD("wrap_expression", function() { + var self = this; + if (!is_statement(self)) self = make_node(AST_SimpleStatement, self, { body: self }); + if (!(self instanceof AST_Toplevel)) self = make_node(AST_Toplevel, self, { body: [ self ] }); + return self; + }); + + function read_property(obj, node) { + var key = node.get_property(); + if (key instanceof AST_Node) return; + var value; + if (obj instanceof AST_Array) { + var elements = obj.elements; + if (key == "length") return make_node_from_constant(elements.length, obj); + if (typeof key == "number" && key in elements) value = elements[key]; + } else if (obj instanceof AST_Lambda) { + if (key == "length") { + obj.length_read = true; + return make_node_from_constant(obj.argnames.length, obj); + } + } else if (obj instanceof AST_Object) { + key = "" + key; + var props = obj.properties; + for (var i = props.length; --i >= 0;) { + var prop = props[i]; + if (!can_hoist_property(prop)) return; + if (!value && props[i].key === key) value = props[i].value; + } + } + return value instanceof AST_SymbolRef && value.fixed_value() || value; + } + + function is_read_only_fn(value, name) { + if (value instanceof AST_Boolean) return native_fns.Boolean[name]; + if (value instanceof AST_Number) return native_fns.Number[name]; + if (value instanceof AST_String) return native_fns.String[name]; + if (name == "valueOf") return false; + if (value instanceof AST_Array) return native_fns.Array[name]; + if (value instanceof AST_Lambda) return native_fns.Function[name]; + if (value instanceof AST_Object) return native_fns.Object[name]; + if (value instanceof AST_RegExp) return native_fns.RegExp[name] && !value.value.global; + } + + function is_modified(compressor, tw, node, value, level, immutable, recursive) { + var parent = tw.parent(level); + if (compressor.option("unsafe") && parent instanceof AST_Dot && is_read_only_fn(value, parent.property)) { + return; + } + var lhs = is_lhs(node, parent); + if (lhs) return lhs; + if (level == 0 && value && value.is_constant()) return; + if (parent instanceof AST_Array) return is_modified(compressor, tw, parent, parent, level + 1); + if (parent instanceof AST_Assign) switch (parent.operator) { + case "=": + return is_modified(compressor, tw, parent, value, level + 1, immutable, recursive); + case "&&=": + case "||=": + case "??=": + return is_modified(compressor, tw, parent, parent, level + 1); + default: + return; + } + if (parent instanceof AST_Binary) { + if (!lazy_op[parent.operator]) return; + return is_modified(compressor, tw, parent, parent, level + 1); + } + if (parent instanceof AST_Call) { + return !immutable + && parent.expression === node + && !parent.is_expr_pure(compressor) + && (!(value instanceof AST_LambdaExpression) || !(parent instanceof AST_New) && value.contains_this()); + } + if (parent instanceof AST_Conditional) { + if (parent.condition === node) return; + return is_modified(compressor, tw, parent, parent, level + 1); + } + if (parent instanceof AST_ForEnumeration) return parent.init === node; + if (parent instanceof AST_ObjectKeyVal) { + if (parent.value !== node) return; + var obj = tw.parent(level + 1); + return is_modified(compressor, tw, obj, obj, level + 2); + } + if (parent instanceof AST_PropAccess) { + if (parent.expression !== node) return; + var prop = read_property(value, parent); + return (!immutable || recursive) && is_modified(compressor, tw, parent, prop, level + 1); + } + if (parent instanceof AST_Sequence) { + if (parent.tail_node() !== node) return; + return is_modified(compressor, tw, parent, value, level + 1, immutable, recursive); + } + } + + function is_lambda(node) { + return node instanceof AST_Class || node instanceof AST_Lambda; + } + + function safe_for_extends(node) { + return node instanceof AST_Class || node instanceof AST_Defun || node instanceof AST_Function; + } + + function is_arguments(def) { + return def.name == "arguments" && def.scope.uses_arguments; + } + + function cross_scope(def, sym) { + do { + if (def === sym) return false; + if (sym instanceof AST_Scope) return true; + } while (sym = sym.parent_scope); + } + + function can_drop_symbol(ref, compressor, keep_lambda) { + var def = ref.redef || ref.definition(); + if (ref.in_arg && is_funarg(def)) return false; + return all(def.orig, function(sym) { + if (sym instanceof AST_SymbolConst || sym instanceof AST_SymbolLet) { + if (sym instanceof AST_SymbolImport) return true; + return compressor && can_varify(compressor, sym); + } + return !(keep_lambda && sym instanceof AST_SymbolLambda); + }); + } + + function has_escaped(d, scope, node, parent) { + if (parent instanceof AST_Assign) return parent.operator == "=" && parent.right === node; + if (parent instanceof AST_Call) return parent.expression !== node || parent instanceof AST_New; + if (parent instanceof AST_ClassField) return parent.value === node && !parent.static; + if (parent instanceof AST_Exit) return parent.value === node && scope.resolve() !== d.scope.resolve(); + if (parent instanceof AST_VarDef) return parent.value === node; + } + + function make_ref(ref, fixed) { + var node = make_node(AST_SymbolRef, ref); + node.fixed = fixed || make_node(AST_Undefined, ref); + return node; + } + + function replace_ref(resolve, fixed) { + return function(node) { + var ref = resolve(node); + var node = make_ref(ref, fixed); + var def = ref.definition(); + def.references.push(node); + def.replaced++; + return node; + }; + } + + var RE_POSITIVE_INTEGER = /^(0|[1-9][0-9]*)$/; + (function(def) { + def(AST_Node, noop); + + function reset_def(tw, compressor, def) { + def.assignments = 0; + def.bool_return = 0; + def.drop_return = 0; + def.cross_loop = false; + def.direct_access = false; + def.escaped = []; + def.fixed = !def.const_redefs + && !def.scope.pinned() + && !compressor.exposed(def) + && !(def.init instanceof AST_LambdaExpression && def.init !== def.scope) + && def.init; + def.reassigned = 0; + def.recursive_refs = 0; + def.references = []; + def.single_use = undefined; + } + + function reset_block_variables(tw, compressor, scope) { + scope.variables.each(function(def) { + reset_def(tw, compressor, def); + }); + } + + function reset_variables(tw, compressor, scope) { + scope.fn_defs = []; + scope.variables.each(function(def) { + reset_def(tw, compressor, def); + var init = def.init; + if (init instanceof AST_LambdaDefinition) { + scope.fn_defs.push(init); + init.safe_ids = null; + } + if (def.fixed === null) { + def.safe_ids = tw.safe_ids; + mark(tw, def); + } else if (def.fixed) { + tw.loop_ids[def.id] = tw.in_loop; + mark(tw, def); + } + }); + scope.may_call_this = function() { + scope.may_call_this = scope.contains_this() ? return_true : return_false; + }; + if (scope.uses_arguments) scope.each_argname(function(node) { + node.definition().last_ref = false; + }); + if (compressor.option("ie")) scope.variables.each(function(def) { + var d = def.orig[0].definition(); + if (d !== def) d.fixed = false; + }); + } + + function safe_to_visit(tw, fn) { + var marker = fn.safe_ids; + return marker === undefined || marker === tw.safe_ids; + } + + function walk_fn_def(tw, fn) { + var was_scanning = tw.fn_scanning; + tw.fn_scanning = fn; + fn.walk(tw); + tw.fn_scanning = was_scanning; + } + + function revisit_fn_def(tw, fn) { + fn.enclosed.forEach(function(d) { + if (fn.variables.get(d.name) === d) return; + if (safe_to_read(tw, d)) return; + d.single_use = false; + var fixed = d.fixed; + if (typeof fixed == "function") fixed = fixed(); + if (fixed instanceof AST_Lambda && fixed.safe_ids !== undefined) return; + d.fixed = false; + }); + } + + function mark_fn_def(tw, def, fn) { + var marker = fn.safe_ids; + if (marker === undefined) return; + if (marker === false) return; + if (fn.parent_scope.resolve().may_call_this === return_true) { + if (member(fn, tw.fn_visited)) revisit_fn_def(tw, fn); + } else if (marker) { + var visited = member(fn, tw.fn_visited); + if (marker === tw.safe_ids) { + if (!visited) walk_fn_def(tw, fn); + } else if (visited) { + revisit_fn_def(tw, fn); + } else { + fn.safe_ids = false; + } + } else if (tw.fn_scanning && tw.fn_scanning !== def.scope.resolve()) { + fn.safe_ids = false; + } else { + fn.safe_ids = tw.safe_ids; + walk_fn_def(tw, fn); + } + } + + function pop_scope(tw, scope) { + var fn_defs = scope.fn_defs; + var tangled = scope.may_call_this === return_true ? fn_defs : fn_defs.filter(function(fn) { + if (fn.safe_ids === false) return true; + fn.safe_ids = tw.safe_ids; + walk_fn_def(tw, fn); + return false; + }); + pop(tw); + tangled.forEach(function(fn) { + fn.safe_ids = tw.safe_ids; + walk_fn_def(tw, fn); + }); + fn_defs.forEach(function(fn) { + fn.safe_ids = undefined; + }); + scope.fn_defs = undefined; + scope.may_call_this = undefined; + } + + function push(tw, sequential) { + var safe_ids = Object.create(tw.safe_ids); + if (!sequential) safe_ids.seq = {}; + tw.safe_ids = safe_ids; + } + + function pop(tw) { + tw.safe_ids = Object.getPrototypeOf(tw.safe_ids); + } + + function mark(tw, def) { + tw.safe_ids[def.id] = {}; + } + + function push_ref(def, ref) { + def.references.push(ref); + if (def.last_ref !== false) def.last_ref = ref; + } + + function safe_to_read(tw, def) { + if (def.single_use == "m") return false; + var safe = tw.safe_ids[def.id]; + if (safe) { + var in_order = HOP(tw.safe_ids, def.id); + if (!in_order) { + var seq = tw.safe_ids.seq; + if (!safe.read) { + safe.read = seq; + } else if (safe.read !== seq) { + safe.read = true; + } + } + if (def.fixed == null) { + if (is_arguments(def)) return false; + if (def.global && def.name == "arguments") return false; + tw.loop_ids[def.id] = null; + def.fixed = make_node(AST_Undefined, def.orig[0]); + if (in_order) def.safe_ids = undefined; + return true; + } + return !safe.assign || safe.assign === tw.safe_ids; + } + return def.fixed instanceof AST_LambdaDefinition; + } + + function safe_to_assign(tw, def, declare) { + if (!declare) { + if (is_funarg(def) && def.scope.uses_arguments && !tw.has_directive("use strict")) return false; + if (!all(def.orig, function(sym) { + return !(sym instanceof AST_SymbolConst); + })) return false; + } + if (def.fixed === undefined) return declare || all(def.orig, function(sym) { + return !(sym instanceof AST_SymbolLet); + }); + if (def.fixed === false || def.fixed === 0) return false; + var safe = tw.safe_ids[def.id]; + if (def.safe_ids) { + def.safe_ids[def.id] = false; + def.safe_ids = undefined; + return def.fixed === null || HOP(tw.safe_ids, def.id) && !safe.read; + } + if (!HOP(tw.safe_ids, def.id)) { + if (!safe) return false; + if (safe.read || tw.in_loop) { + var scope = tw.find_parent(AST_BlockScope); + if (scope instanceof AST_Class) return false; + if (def.scope.resolve() !== scope.resolve()) return false; + } + safe.assign = safe.assign && safe.assign !== tw.safe_ids ? true : tw.safe_ids; + } + if (def.fixed != null && safe.read) { + if (safe.read !== tw.safe_ids.seq) return false; + if (tw.loop_ids[def.id] !== tw.in_loop) return false; + } + return safe_to_read(tw, def) && all(def.orig, function(sym) { + return !(sym instanceof AST_SymbolLambda); + }); + } + + function ref_once(compressor, def) { + return compressor.option("unused") + && !def.scope.pinned() + && def.single_use !== false + && def.references.length - def.recursive_refs == 1 + && !(is_funarg(def) && def.scope.uses_arguments); + } + + function is_immutable(value) { + if (!value) return false; + if (value instanceof AST_Assign) { + var op = value.operator; + return op == "=" ? is_immutable(value.right) : !lazy_op[op.slice(0, -1)]; + } + if (value instanceof AST_Sequence) return is_immutable(value.tail_node()); + return value.is_constant() || is_lambda(value) || value instanceof AST_ObjectIdentity; + } + + function value_in_use(node, parent) { + if (parent instanceof AST_Array) return true; + if (parent instanceof AST_Binary) return lazy_op[parent.operator]; + if (parent instanceof AST_Conditional) return parent.condition !== node; + if (parent instanceof AST_Sequence) return parent.tail_node() === node; + if (parent instanceof AST_Spread) return true; + } + + function mark_escaped(tw, d, scope, node, value, level, depth) { + var parent = tw.parent(level); + if (value && value.is_constant()) return; + if (has_escaped(d, scope, node, parent)) { + d.escaped.push(parent); + if (depth > 1 && !(value && value.is_constant_expression(scope))) depth = 1; + if (!d.escaped.depth || d.escaped.depth > depth) d.escaped.depth = depth; + if (d.scope.resolve() !== scope.resolve()) d.escaped.cross_scope = true; + if (d.fixed) d.fixed.escaped = d.escaped; + return; + } else if (value_in_use(node, parent)) { + mark_escaped(tw, d, scope, parent, parent, level + 1, depth); + } else if (parent instanceof AST_ObjectKeyVal && parent.value === node) { + var obj = tw.parent(level + 1); + mark_escaped(tw, d, scope, obj, obj, level + 2, depth); + } else if (parent instanceof AST_PropAccess && parent.expression === node) { + value = read_property(value, parent); + mark_escaped(tw, d, scope, parent, value, level + 1, depth + 1); + if (value) return; + } + if (level > 0) return; + if (parent instanceof AST_Call && parent.expression === node) return; + if (parent instanceof AST_Sequence && parent.tail_node() !== node) return; + if (parent instanceof AST_SimpleStatement) return; + if (parent instanceof AST_Unary && !unary_side_effects[parent.operator]) return; + d.direct_access = true; + if (d.fixed) d.fixed.direct_access = true; + } + + function mark_assignment_to_arguments(node) { + if (!(node instanceof AST_Sub)) return; + var expr = node.expression; + if (!(expr instanceof AST_SymbolRef)) return; + var def = expr.definition(); + if (!is_arguments(def)) return; + var key = node.property; + if (key.is_constant()) key = key.value; + if (!(key instanceof AST_Node) && !RE_POSITIVE_INTEGER.test(key)) return; + def.reassigned++; + (key instanceof AST_Node ? def.scope.argnames : [ def.scope.argnames[key] ]).forEach(function(argname) { + if (argname instanceof AST_SymbolFunarg) argname.definition().fixed = false; + }); + } + + function make_fixed(save, fn) { + var prev_save, prev_value; + return function() { + var current = save(); + if (prev_save !== current) { + prev_save = current; + prev_value = fn(current); + } + return prev_value; + }; + } + + function make_fixed_default(compressor, node, save) { + var prev_save, prev_seq; + return function() { + if (prev_seq === node) return node; + var current = save(); + var ev = fuzzy_eval(compressor, current, true); + if (ev instanceof AST_Node) { + prev_seq = node; + } else if (prev_save !== current) { + prev_save = current; + prev_seq = ev === undefined ? make_sequence(node, [ current, node.value ]) : current; + } + return prev_seq; + }; + } + + function scan_declaration(tw, compressor, lhs, fixed, visit) { + var scanner = new TreeWalker(function(node) { + if (node instanceof AST_DefaultValue) { + reset_flags(node); + push(tw, true); + node.value.walk(tw); + pop(tw); + var save = fixed; + if (save) fixed = make_fixed_default(compressor, node, save); + node.name.walk(scanner); + fixed = save; + return true; + } + if (node instanceof AST_DestructuredArray) { + reset_flags(node); + var save = fixed; + node.elements.forEach(function(node, index) { + if (node instanceof AST_Hole) return reset_flags(node); + if (save) fixed = make_fixed(save, function(value) { + return make_node(AST_Sub, node, { + expression: value, + property: make_node(AST_Number, node, { value: index }), + }); + }); + node.walk(scanner); + }); + if (node.rest) { + var fixed_node; + if (save) fixed = compressor.option("rests") && make_fixed(save, function(value) { + if (!(value instanceof AST_Array)) return node; + for (var i = 0, len = node.elements.length; i < len; i++) { + if (value.elements[i] instanceof AST_Spread) return node; + } + if (!fixed_node) fixed_node = make_node(AST_Array, node, {}); + fixed_node.elements = value.elements.slice(len); + return fixed_node; + }); + node.rest.walk(scanner); + } + fixed = save; + return true; + } + if (node instanceof AST_DestructuredObject) { + reset_flags(node); + var save = fixed; + node.properties.forEach(function(node) { + reset_flags(node); + if (node.key instanceof AST_Node) { + push(tw); + node.key.walk(tw); + pop(tw); + } + if (save) fixed = make_fixed(save, function(value) { + var key = node.key; + var type = AST_Sub; + if (typeof key == "string") { + if (is_identifier_string(key)) { + type = AST_Dot; + } else { + key = make_node_from_constant(key, node); + } + } + return make_node(type, node, { + expression: value, + property: key, + }); + }); + node.value.walk(scanner); + }); + if (node.rest) { + fixed = false; + node.rest.walk(scanner); + } + fixed = save; + return true; + } + visit(node, fixed, function() { + var save_len = tw.stack.length; + for (var i = 0, len = scanner.stack.length - 1; i < len; i++) { + tw.stack.push(scanner.stack[i]); + } + node.walk(tw); + tw.stack.length = save_len; + }); + return true; + }); + lhs.walk(scanner); + } + + function reduce_iife(tw, descend, compressor) { + var fn = this; + fn.inlined = false; + var iife = tw.parent(); + var sequential = !is_async(fn) && !is_generator(fn); + var hit = !sequential; + var aborts = false; + fn.walk(new TreeWalker(function(node) { + if (hit) return aborts = true; + if (node instanceof AST_Return) return hit = true; + if (node instanceof AST_Scope && node !== fn) return true; + })); + if (aborts) push(tw, sequential); + reset_variables(tw, compressor, fn); + // Virtually turn IIFE parameters into variable definitions: + // (function(a,b) {...})(c,d) ---> (function() {var a=c,b=d; ...})() + // So existing transformation rules can work on them. + var safe = !fn.uses_arguments || tw.has_directive("use strict"); + fn.argnames.forEach(function(argname, i) { + var value = iife.args[i]; + scan_declaration(tw, compressor, argname, function() { + var j = fn.argnames.indexOf(argname); + var arg = j < 0 ? value : iife.args[j]; + if (arg instanceof AST_Sequence && arg.expressions.length < 2) arg = arg.expressions[0]; + return arg || make_node(AST_Undefined, iife); + }, visit); + }); + var rest = fn.rest, fixed_node; + if (rest) scan_declaration(tw, compressor, rest, compressor.option("rests") && function() { + if (fn.rest !== rest) return rest; + if (!fixed_node) fixed_node = make_node(AST_Array, fn, {}); + fixed_node.elements = iife.args.slice(fn.argnames.length); + return fixed_node; + }, visit); + walk_lambda(fn, tw); + var safe_ids = tw.safe_ids; + pop_scope(tw, fn); + if (!aborts) tw.safe_ids = safe_ids; + return true; + + function visit(node, fixed) { + var d = node.definition(); + if (fixed && safe && d.fixed === undefined) { + mark(tw, d); + tw.loop_ids[d.id] = tw.in_loop; + d.fixed = fixed; + d.fixed.assigns = [ node ]; + } else { + d.fixed = false; + } + } + } + + def(AST_Assign, function(tw, descend, compressor) { + var node = this; + var left = node.left; + var right = node.right; + var ld = left instanceof AST_SymbolRef && left.definition(); + var scan = ld || left instanceof AST_Destructured; + switch (node.operator) { + case "=": + if (left.equals(right) && !left.has_side_effects(compressor)) { + right.walk(tw); + walk_prop(left); + node.redundant = true; + return true; + } + if (ld && right instanceof AST_LambdaExpression) { + walk_assign(); + right.parent_scope.resolve().fn_defs.push(right); + right.safe_ids = null; + if (!ld.fixed || !node.write_only) mark_fn_def(tw, ld, right); + return true; + } + if (scan) { + right.walk(tw); + walk_assign(); + return true; + } + mark_assignment_to_arguments(left); + return; + case "&&=": + case "||=": + case "??=": + var lazy = true; + default: + if (!scan) { + mark_assignment_to_arguments(left); + return walk_lazy(); + } + ld.assignments++; + var fixed = ld.fixed; + if (is_modified(compressor, tw, node, node, 0)) { + ld.fixed = false; + return walk_lazy(); + } + var safe = safe_to_read(tw, ld); + if (lazy) push(tw, true); + right.walk(tw); + if (lazy) pop(tw); + if (safe && !left.in_arg && safe_to_assign(tw, ld)) { + push_ref(ld, left); + mark(tw, ld); + if (ld.single_use) ld.single_use = false; + left.fixed = ld.fixed = function() { + return make_node(AST_Binary, node, { + operator: node.operator.slice(0, -1), + left: make_ref(left, fixed), + right: node.right, + }); + }; + left.fixed.assigns = !fixed || !fixed.assigns ? [ ld.orig[0] ] : fixed.assigns.slice(); + left.fixed.assigns.push(node); + left.fixed.to_binary = replace_ref(function(node) { + return node.left; + }, fixed); + } else { + left.walk(tw); + ld.fixed = false; + } + return true; + } + + function walk_prop(lhs) { + reset_flags(lhs); + if (lhs instanceof AST_Dot) { + walk_prop(lhs.expression); + } else if (lhs instanceof AST_Sub) { + walk_prop(lhs.expression); + lhs.property.walk(tw); + } else if (lhs instanceof AST_SymbolRef) { + var d = lhs.definition(); + push_ref(d, lhs); + if (d.fixed) { + lhs.fixed = d.fixed; + if (lhs.fixed.assigns) { + lhs.fixed.assigns.push(node); + } else { + lhs.fixed.assigns = [ node ]; + } + } + } else { + lhs.walk(tw); + } + } + + function walk_assign() { + var recursive = ld && recursive_ref(tw, ld); + var modified = is_modified(compressor, tw, node, right, 0, is_immutable(right), recursive); + scan_declaration(tw, compressor, left, function() { + return node.right; + }, function(sym, fixed, walk) { + if (!(sym instanceof AST_SymbolRef)) { + mark_assignment_to_arguments(sym); + walk(); + return; + } + var d = sym.definition(); + d.assignments++; + if (!fixed || sym.in_arg || !safe_to_assign(tw, d)) { + walk(); + d.fixed = false; + } else { + push_ref(d, sym); + mark(tw, d); + if (left instanceof AST_Destructured + || d.orig.length == 1 && d.orig[0] instanceof AST_SymbolDefun) { + d.single_use = false; + } + tw.loop_ids[d.id] = tw.in_loop; + d.fixed = modified ? 0 : fixed; + sym.fixed = fixed; + sym.fixed.assigns = [ node ]; + mark_escaped(tw, d, sym.scope, node, right, 0, 1); + } + }); + } + + function walk_lazy() { + if (!lazy) return; + left.walk(tw); + push(tw, true); + right.walk(tw); + pop(tw); + return true; + } + }); + def(AST_Binary, function(tw) { + if (!lazy_op[this.operator]) return; + this.left.walk(tw); + push(tw, true); + this.right.walk(tw); + pop(tw); + return true; + }); + def(AST_BlockScope, function(tw, descend, compressor) { + reset_block_variables(tw, compressor, this); + }); + def(AST_Call, function(tw, descend) { + var node = this; + var exp = node.expression; + if (exp instanceof AST_LambdaExpression) { + var iife = is_iife_single(node); + node.args.forEach(function(arg) { + arg.walk(tw); + if (arg instanceof AST_Spread) iife = false; + }); + if (iife) exp.reduce_vars = reduce_iife; + exp.walk(tw); + if (iife) delete exp.reduce_vars; + return true; + } + if (node.TYPE == "Call") switch (tw.in_boolean_context()) { + case "d": + var drop = true; + case true: + mark_refs(exp, drop); + } + exp.walk(tw); + var optional = node.optional; + if (optional) push(tw, true); + node.args.forEach(function(arg) { + arg.walk(tw); + }); + if (optional) pop(tw); + var fixed = exp instanceof AST_SymbolRef && exp.fixed_value(); + if (fixed instanceof AST_Lambda) { + mark_fn_def(tw, exp.definition(), fixed); + } else { + tw.find_parent(AST_Scope).may_call_this(); + } + return true; + + function mark_refs(node, drop) { + if (node instanceof AST_Assign) { + if (node.operator != "=") return; + mark_refs(node.left, drop); + mark_refs(node.right, drop); + } else if (node instanceof AST_Binary) { + if (!lazy_op[node.operator]) return; + mark_refs(node.left, drop); + mark_refs(node.right, drop); + } else if (node instanceof AST_Conditional) { + mark_refs(node.consequent, drop); + mark_refs(node.alternative, drop); + } else if (node instanceof AST_SymbolRef) { + var def = node.definition(); + def.bool_return++; + if (drop) def.drop_return++; + } + } + }); + def(AST_Class, function(tw, descend, compressor) { + var node = this; + reset_block_variables(tw, compressor, node); + if (node.extends) node.extends.walk(tw); + var props = node.properties.filter(function(prop) { + reset_flags(prop); + if (prop.key instanceof AST_Node) { + tw.push(prop); + prop.key.walk(tw); + tw.pop(); + } + return prop.value; + }); + if (node.name) { + var d = node.name.definition(); + var parent = tw.parent(); + if (parent instanceof AST_ExportDeclaration || parent instanceof AST_ExportDefault) d.single_use = false; + if (safe_to_assign(tw, d, true)) { + mark(tw, d); + tw.loop_ids[d.id] = tw.in_loop; + d.fixed = function() { + return node; + }; + d.fixed.assigns = [ node ]; + if (!is_safe_lexical(d)) d.single_use = false; + } else { + d.fixed = false; + } + } + props.forEach(function(prop) { + tw.push(prop); + if (!prop.static || is_static_field_or_init(prop) && prop.value.contains_this()) { + push(tw); + prop.value.walk(tw); + pop(tw); + } else { + prop.value.walk(tw); + } + tw.pop(); + }); + return true; + }); + def(AST_ClassInitBlock, function(tw, descend, compressor) { + var node = this; + push(tw, true); + reset_variables(tw, compressor, node); + descend(); + pop_scope(tw, node); + return true; + }); + def(AST_Conditional, function(tw) { + this.condition.walk(tw); + push(tw, true); + this.consequent.walk(tw); + pop(tw); + push(tw, true); + this.alternative.walk(tw); + pop(tw); + return true; + }); + def(AST_DefaultValue, function(tw) { + push(tw, true); + this.value.walk(tw); + pop(tw); + this.name.walk(tw); + return true; + }); + def(AST_Do, function(tw) { + var save_loop = tw.in_loop; + tw.in_loop = this; + push(tw); + this.body.walk(tw); + if (has_loop_control(this, tw.parent())) { + pop(tw); + push(tw); + } + this.condition.walk(tw); + pop(tw); + tw.in_loop = save_loop; + return true; + }); + def(AST_For, function(tw, descend, compressor) { + var node = this; + reset_block_variables(tw, compressor, node); + if (node.init) node.init.walk(tw); + var save_loop = tw.in_loop; + tw.in_loop = node; + push(tw); + if (node.condition) node.condition.walk(tw); + node.body.walk(tw); + if (node.step) { + if (has_loop_control(node, tw.parent())) { + pop(tw); + push(tw); + } + node.step.walk(tw); + } + pop(tw); + tw.in_loop = save_loop; + return true; + }); + def(AST_ForEnumeration, function(tw, descend, compressor) { + var node = this; + reset_block_variables(tw, compressor, node); + node.object.walk(tw); + var save_loop = tw.in_loop; + tw.in_loop = node; + push(tw); + var init = node.init; + if (init instanceof AST_Definitions) { + init.definitions[0].name.mark_symbol(function(node) { + if (node instanceof AST_SymbolDeclaration) { + var def = node.definition(); + def.assignments++; + def.fixed = false; + } + }, tw); + } else if (init instanceof AST_Destructured || init instanceof AST_SymbolRef) { + init.mark_symbol(function(node) { + if (node instanceof AST_SymbolRef) { + var def = node.definition(); + push_ref(def, node); + def.assignments++; + if (!node.is_immutable()) def.fixed = false; + } + }, tw); + } else { + init.walk(tw); + } + node.body.walk(tw); + pop(tw); + tw.in_loop = save_loop; + return true; + }); + def(AST_If, function(tw) { + this.condition.walk(tw); + push(tw, true); + this.body.walk(tw); + pop(tw); + if (this.alternative) { + push(tw, true); + this.alternative.walk(tw); + pop(tw); + } + return true; + }); + def(AST_LabeledStatement, function(tw) { + push(tw, true); + this.body.walk(tw); + pop(tw); + return true; + }); + def(AST_Lambda, function(tw, descend, compressor) { + var fn = this; + if (!safe_to_visit(tw, fn)) return true; + if (!push_uniq(tw.fn_visited, fn)) return true; + fn.inlined = false; + push(tw); + reset_variables(tw, compressor, fn); + descend(); + pop_scope(tw, fn); + if (fn.name) mark_escaped(tw, fn.name.definition(), fn, fn.name, fn, 0, 1); + return true; + }); + def(AST_LambdaDefinition, function(tw, descend, compressor) { + var fn = this; + var def = fn.name.definition(); + var parent = tw.parent(); + if (parent instanceof AST_ExportDeclaration || parent instanceof AST_ExportDefault) def.single_use = false; + if (!safe_to_visit(tw, fn)) return true; + if (!push_uniq(tw.fn_visited, fn)) return true; + fn.inlined = false; + push(tw); + reset_variables(tw, compressor, fn); + descend(); + pop_scope(tw, fn); + return true; + }); + def(AST_Sub, function(tw) { + if (!this.optional) return; + this.expression.walk(tw); + push(tw, true); + this.property.walk(tw); + pop(tw); + return true; + }); + def(AST_Switch, function(tw, descend, compressor) { + var node = this; + reset_block_variables(tw, compressor, node); + node.expression.walk(tw); + var first = true; + node.body.forEach(function(branch) { + if (branch instanceof AST_Default) return; + branch.expression.walk(tw); + if (first) { + first = false; + push(tw, true); + } + }) + if (!first) pop(tw); + walk_body(node, tw); + return true; + }); + def(AST_SwitchBranch, function(tw) { + push(tw, true); + walk_body(this, tw); + pop(tw); + return true; + }); + def(AST_SymbolCatch, function() { + this.definition().fixed = false; + }); + def(AST_SymbolImport, function() { + this.definition().fixed = false; + }); + def(AST_SymbolRef, function(tw, descend, compressor) { + var ref = this; + var d = ref.definition(); + var fixed = d.fixed || d.last_ref && d.last_ref.fixed; + push_ref(d, ref); + if (d.references.length == 1 && !d.fixed && d.orig[0] instanceof AST_SymbolDefun) { + tw.loop_ids[d.id] = tw.in_loop; + } + var recursive = recursive_ref(tw, d); + if (recursive) recursive.enclosed.forEach(function(def) { + if (d === def) return; + if (def.scope.resolve() === recursive) return; + var assigns = def.fixed && def.fixed.assigns; + if (!assigns) return; + if (assigns[assigns.length - 1] instanceof AST_VarDef) return; + var safe = tw.safe_ids[def.id]; + if (!safe) return; + safe.assign = true; + }); + if (d.single_use == "m" && d.fixed) { + d.fixed = 0; + d.single_use = false; + } + switch (d.fixed) { + case 0: + if (!safe_to_read(tw, d)) d.fixed = false; + case false: + var redef = d.redefined(); + if (redef && cross_scope(d.scope, ref.scope)) redef.single_use = false; + break; + case undefined: + d.fixed = false; + break; + default: + if (!safe_to_read(tw, d)) { + d.fixed = false; + break; + } + if (ref.in_arg && d.orig[0] instanceof AST_SymbolLambda) ref.fixed = d.scope; + var value = ref.fixed_value(); + if (recursive) { + d.recursive_refs++; + } else if (value && ref_once(compressor, d)) { + d.in_loop = tw.loop_ids[d.id] !== tw.in_loop; + d.single_use = is_lambda(value) + && !value.pinned() + && (!d.in_loop || tw.parent() instanceof AST_Call) + || !d.in_loop + && d.scope === ref.scope.resolve() + && value.is_constant_expression(); + } else { + d.single_use = false; + } + if (is_modified(compressor, tw, ref, value, 0, is_immutable(value), recursive)) { + if (d.single_use) { + d.single_use = "m"; + } else { + d.fixed = 0; + } + } + if (d.fixed && tw.loop_ids[d.id] !== tw.in_loop) d.cross_loop = true; + mark_escaped(tw, d, ref.scope, ref, value, 0, 1); + break; + } + if (!ref.fixed) ref.fixed = d.fixed === 0 ? fixed : d.fixed; + var parent; + if (value instanceof AST_Lambda + && !((parent = tw.parent()) instanceof AST_Call && parent.expression === ref)) { + mark_fn_def(tw, d, value); + } + }); + def(AST_Template, function(tw, descend) { + var node = this; + var tag = node.tag; + if (!tag) return; + if (tag instanceof AST_LambdaExpression) { + node.expressions.forEach(function(exp) { + exp.walk(tw); + }); + tag.walk(tw); + return true; + } + tag.walk(tw); + node.expressions.forEach(function(exp) { + exp.walk(tw); + }); + var fixed = tag instanceof AST_SymbolRef && tag.fixed_value(); + if (fixed instanceof AST_Lambda) { + mark_fn_def(tw, tag.definition(), fixed); + } else { + tw.find_parent(AST_Scope).may_call_this(); + } + return true; + }); + def(AST_Toplevel, function(tw, descend, compressor) { + var node = this; + node.globals.each(function(def) { + reset_def(tw, compressor, def); + }); + push(tw, true); + reset_variables(tw, compressor, node); + descend(); + pop_scope(tw, node); + return true; + }); + def(AST_Try, function(tw, descend, compressor) { + var node = this; + reset_block_variables(tw, compressor, node); + push(tw, true); + walk_body(node, tw); + pop(tw); + if (node.bcatch) { + push(tw, true); + node.bcatch.walk(tw); + pop(tw); + } + if (node.bfinally) node.bfinally.walk(tw); + return true; + }); + def(AST_Unary, function(tw, descend) { + var node = this; + if (!UNARY_POSTFIX[node.operator]) return; + var exp = node.expression; + if (!(exp instanceof AST_SymbolRef)) { + mark_assignment_to_arguments(exp); + return; + } + var d = exp.definition(); + d.assignments++; + var fixed = d.fixed; + if (safe_to_read(tw, d) && !exp.in_arg && safe_to_assign(tw, d)) { + push_ref(d, exp); + mark(tw, d); + if (d.single_use) d.single_use = false; + d.fixed = function() { + return make_node(AST_Binary, node, { + operator: node.operator.slice(0, -1), + left: make_node(AST_UnaryPrefix, node, { + operator: "+", + expression: make_ref(exp, fixed), + }), + right: make_node(AST_Number, node, { value: 1 }), + }); + }; + d.fixed.assigns = fixed && fixed.assigns ? fixed.assigns.slice() : []; + d.fixed.assigns.push(node); + if (node instanceof AST_UnaryPrefix) { + exp.fixed = d.fixed; + } else { + exp.fixed = function() { + return make_node(AST_UnaryPrefix, node, { + operator: "+", + expression: make_ref(exp, fixed), + }); + }; + exp.fixed.assigns = fixed && fixed.assigns; + exp.fixed.to_prefix = replace_ref(function(node) { + return node.expression; + }, d.fixed); + } + } else { + exp.walk(tw); + d.fixed = false; + } + return true; + }); + def(AST_VarDef, function(tw, descend, compressor) { + var node = this; + var value = node.value; + if (value instanceof AST_LambdaExpression && node.name instanceof AST_SymbolDeclaration) { + walk_defn(); + value.parent_scope.resolve().fn_defs.push(value); + value.safe_ids = null; + var ld = node.name.definition(); + if (!ld.fixed) mark_fn_def(tw, ld, value); + } else if (value) { + value.walk(tw); + walk_defn(); + } else if (tw.parent() instanceof AST_Let) { + walk_defn(); + } + return true; + + function walk_defn() { + scan_declaration(tw, compressor, node.name, function() { + return node.value || make_node(AST_Undefined, node); + }, function(name, fixed) { + var d = name.definition(); + if (fixed && safe_to_assign(tw, d, true)) { + mark(tw, d); + tw.loop_ids[d.id] = tw.in_loop; + d.fixed = fixed; + d.fixed.assigns = [ node ]; + if (name instanceof AST_SymbolConst && d.redefined() + || !(can_drop_symbol(name) || is_safe_lexical(d))) { + d.single_use = false; + } + } else { + d.fixed = false; + } + }); + } + }); + def(AST_While, function(tw, descend) { + var save_loop = tw.in_loop; + tw.in_loop = this; + push(tw); + descend(); + pop(tw); + tw.in_loop = save_loop; + return true; + }); + })(function(node, func) { + node.DEFMETHOD("reduce_vars", func); + }); + + function reset_flags(node) { + node._squeezed = false; + node._optimized = false; + if (node instanceof AST_BlockScope) node._var_names = undefined; + if (node instanceof AST_SymbolRef) node.fixed = undefined; + } + + AST_Toplevel.DEFMETHOD("reset_opt_flags", function(compressor) { + var tw = new TreeWalker(compressor.option("reduce_vars") ? function(node, descend) { + reset_flags(node); + return node.reduce_vars(tw, descend, compressor); + } : reset_flags); + // Flow control for visiting lambda definitions + tw.fn_scanning = null; + tw.fn_visited = []; + // Record the loop body in which `AST_SymbolDeclaration` is first encountered + tw.in_loop = null; + tw.loop_ids = Object.create(null); + // Stack of look-up tables to keep track of whether a `SymbolDef` has been + // properly assigned before use: + // - `push()` & `pop()` when visiting conditional branches + // - backup & restore via `save_ids` when visiting out-of-order sections + tw.safe_ids = Object.create(null); + tw.safe_ids.seq = {}; + this.walk(tw); + }); + + AST_Symbol.DEFMETHOD("fixed_value", function(ref_only) { + var def = this.definition(); + var fixed = def.fixed; + if (fixed) { + if (this.fixed) fixed = this.fixed; + return (fixed instanceof AST_Node ? fixed : fixed()).tail_node(); + } + fixed = fixed === 0 && this.fixed; + if (!fixed) return fixed; + var value = (fixed instanceof AST_Node ? fixed : fixed()).tail_node(); + if (ref_only && def.escaped.depth != 1 && is_object(value, true)) return value; + if (value.is_constant()) return value; + }); + + AST_SymbolRef.DEFMETHOD("is_immutable", function() { + var def = this.redef || this.definition(); + if (!(def.orig[0] instanceof AST_SymbolLambda)) return false; + if (def.orig.length == 1) return true; + if (!this.in_arg) return false; + return !(def.orig[1] instanceof AST_SymbolFunarg); + }); + + AST_Node.DEFMETHOD("convert_symbol", noop); + function convert_destructured(type, process) { + return this.transform(new TreeTransformer(function(node, descend) { + if (node instanceof AST_DefaultValue) { + node = node.clone(); + node.name = node.name.transform(this); + return node; + } + if (node instanceof AST_Destructured) { + node = node.clone(); + descend(node, this); + return node; + } + if (node instanceof AST_DestructuredKeyVal) { + node = node.clone(); + node.value = node.value.transform(this); + return node; + } + return node.convert_symbol(type, process); + })); + } + AST_DefaultValue.DEFMETHOD("convert_symbol", convert_destructured); + AST_Destructured.DEFMETHOD("convert_symbol", convert_destructured); + function convert_symbol(type, process) { + var node = make_node(type, this); + return process(node, this) || node; + } + AST_SymbolDeclaration.DEFMETHOD("convert_symbol", convert_symbol); + AST_SymbolRef.DEFMETHOD("convert_symbol", convert_symbol); + + function process_to_assign(ref) { + var def = ref.definition(); + def.assignments++; + def.references.push(ref); + } + + function mark_destructured(process, tw) { + var marker = new TreeWalker(function(node) { + if (node instanceof AST_DefaultValue) { + node.value.walk(tw); + node.name.walk(marker); + return true; + } + if (node instanceof AST_DestructuredKeyVal) { + if (node.key instanceof AST_Node) node.key.walk(tw); + node.value.walk(marker); + return true; + } + return process(node); + }); + this.walk(marker); + } + AST_DefaultValue.DEFMETHOD("mark_symbol", mark_destructured); + AST_Destructured.DEFMETHOD("mark_symbol", mark_destructured); + function mark_symbol(process) { + return process(this); + } + AST_SymbolDeclaration.DEFMETHOD("mark_symbol", mark_symbol); + AST_SymbolRef.DEFMETHOD("mark_symbol", mark_symbol); + + AST_Node.DEFMETHOD("match_symbol", function(predicate) { + return predicate(this); + }); + function match_destructured(predicate, ignore_side_effects) { + var found = false; + var tw = new TreeWalker(function(node) { + if (found) return true; + if (node instanceof AST_DefaultValue) { + if (!ignore_side_effects) return found = true; + node.name.walk(tw); + return true; + } + if (node instanceof AST_DestructuredKeyVal) { + if (!ignore_side_effects && node.key instanceof AST_Node) return found = true; + node.value.walk(tw); + return true; + } + if (predicate(node)) return found = true; + }); + this.walk(tw); + return found; + } + AST_DefaultValue.DEFMETHOD("match_symbol", match_destructured); + AST_Destructured.DEFMETHOD("match_symbol", match_destructured); + + function in_async_generator(scope) { + return scope instanceof AST_AsyncGeneratorDefun || scope instanceof AST_AsyncGeneratorFunction; + } + + function find_scope(compressor) { + var level = 0, node = compressor.self(); + do { + if (node.variables) return node; + } while (node = compressor.parent(level++)); + } + + function find_try(compressor, level, node, scope, may_throw, sync) { + for (var parent; parent = compressor.parent(level++); node = parent) { + if (parent === scope) return false; + if (sync && parent instanceof AST_Lambda) { + if (parent.name || is_async(parent) || is_generator(parent)) return true; + } else if (parent instanceof AST_Try) { + if (parent.bfinally && parent.bfinally !== node) return true; + if (may_throw && parent.bcatch && parent.bcatch !== node) return true; + } + } + return false; + } + + var identifier_atom = makePredicate("Infinity NaN undefined"); + function is_lhs_read_only(lhs, compressor) { + if (lhs instanceof AST_Atom) return true; + if (lhs instanceof AST_ObjectIdentity) return true; + if (lhs instanceof AST_PropAccess) { + if (lhs.property === "__proto__") return true; + lhs = lhs.expression; + if (lhs instanceof AST_SymbolRef) { + if (lhs.is_immutable()) return false; + lhs = lhs.fixed_value(); + } + if (!lhs) return true; + if (lhs.tail_node().is_constant()) return true; + return is_lhs_read_only(lhs, compressor); + } + if (lhs instanceof AST_SymbolRef) { + if (lhs.is_immutable()) return true; + var def = lhs.definition(); + return compressor.exposed(def) && identifier_atom[def.name]; + } + return false; + } + + function make_node(ctor, orig, props) { + if (props) { + props.start = orig.start; + props.end = orig.end; + } else { + props = orig; + } + return new ctor(props); + } + + function make_sequence(orig, expressions) { + if (expressions.length == 1) return expressions[0]; + return make_node(AST_Sequence, orig, { expressions: expressions.reduce(merge_sequence, []) }); + } + + function make_node_from_constant(val, orig) { + switch (typeof val) { + case "string": + return make_node(AST_String, orig, { value: val }); + case "number": + if (isNaN(val)) return make_node(AST_NaN, orig); + if (isFinite(val)) { + return 1 / val < 0 ? make_node(AST_UnaryPrefix, orig, { + operator: "-", + expression: make_node(AST_Number, orig, { value: -val }), + }) : make_node(AST_Number, orig, { value: val }); + } + return val < 0 ? make_node(AST_UnaryPrefix, orig, { + operator: "-", + expression: make_node(AST_Infinity, orig), + }) : make_node(AST_Infinity, orig); + case "boolean": + return make_node(val ? AST_True : AST_False, orig); + case "undefined": + return make_node(AST_Undefined, orig); + default: + if (val === null) { + return make_node(AST_Null, orig); + } + if (val instanceof RegExp) { + return make_node(AST_RegExp, orig, { value: val }); + } + throw new Error(string_template("Can't handle constant of type: {type}", { type: typeof val })); + } + } + + function needs_unbinding(val) { + return val instanceof AST_PropAccess + || is_undeclared_ref(val) && val.name == "eval"; + } + + // we shouldn't compress (1,func)(something) to + // func(something) because that changes the meaning of + // the func (becomes lexical instead of global). + function maintain_this_binding(parent, orig, val) { + var wrap = false; + if (parent.TYPE == "Call") { + wrap = parent.expression === orig && needs_unbinding(val); + } else if (parent instanceof AST_Template) { + wrap = parent.tag === orig && needs_unbinding(val); + } else if (parent instanceof AST_UnaryPrefix) { + wrap = parent.operator == "delete" + || parent.operator == "typeof" && is_undeclared_ref(val); + } + return wrap ? make_sequence(orig, [ make_node(AST_Number, orig, { value: 0 }), val ]) : val; + } + + function merge_expression(base, target) { + var fixed_by_id = new Dictionary(); + base.walk(new TreeWalker(function(node) { + if (!(node instanceof AST_SymbolRef)) return; + var def = node.definition(); + var fixed = node.fixed; + if (!fixed || !fixed_by_id.has(def.id)) { + fixed_by_id.set(def.id, fixed); + } else if (fixed_by_id.get(def.id) !== fixed) { + fixed_by_id.set(def.id, false); + } + })); + if (fixed_by_id.size() > 0) target.walk(new TreeWalker(function(node) { + if (!(node instanceof AST_SymbolRef)) return; + var def = node.definition(); + var fixed = node.fixed; + if (!fixed || !fixed_by_id.has(def.id)) return; + if (fixed_by_id.get(def.id) !== fixed) node.fixed = false; + })); + return target; + } + + function merge_sequence(array, node) { + if (node instanceof AST_Sequence) { + [].push.apply(array, node.expressions); + } else { + array.push(node); + } + return array; + } + + function is_lexical_definition(stat) { + return stat instanceof AST_Const || stat instanceof AST_DefClass || stat instanceof AST_Let; + } + + function safe_to_trim(stat) { + if (stat instanceof AST_LambdaDefinition) { + var def = stat.name.definition(); + var scope = stat.name.scope; + return def.scope === scope || all(def.references, function(ref) { + var s = ref.scope; + do { + if (s === scope) return true; + } while (s = s.parent_scope); + }); + } + return !is_lexical_definition(stat); + } + + function as_statement_array(thing) { + if (thing === null) return []; + if (thing instanceof AST_BlockStatement) return all(thing.body, safe_to_trim) ? thing.body : [ thing ]; + if (thing instanceof AST_EmptyStatement) return []; + if (is_statement(thing)) return [ thing ]; + throw new Error("Can't convert thing to statement array"); + } + + function is_empty(thing) { + if (thing === null) return true; + if (thing instanceof AST_EmptyStatement) return true; + if (thing instanceof AST_BlockStatement) return thing.body.length == 0; + return false; + } + + function has_declarations_only(block) { + return all(block.body, function(stat) { + return is_empty(stat) + || stat instanceof AST_Defun + || stat instanceof AST_Var && declarations_only(stat); + }); + } + + function loop_body(x) { + if (x instanceof AST_IterationStatement) { + return x.body instanceof AST_BlockStatement ? x.body : x; + } + return x; + } + + function is_iife_call(node) { + if (node.TYPE != "Call") return false; + do { + node = node.expression; + } while (node instanceof AST_PropAccess); + return node instanceof AST_LambdaExpression ? !is_arrow(node) : is_iife_call(node); + } + + function is_iife_single(call) { + var exp = call.expression; + if (exp.name) return false; + if (!(call instanceof AST_New)) return true; + var found = false; + exp.walk(new TreeWalker(function(node) { + if (found) return true; + if (node instanceof AST_NewTarget) return found = true; + if (node instanceof AST_Scope && node !== exp) return true; + })); + return !found; + } + + function is_undeclared_ref(node) { + return node instanceof AST_SymbolRef && node.definition().undeclared; + } + + var global_names = makePredicate("Array Boolean clearInterval clearTimeout console Date decodeURI decodeURIComponent encodeURI encodeURIComponent Error escape eval EvalError Function isFinite isNaN JSON Map Math Number parseFloat parseInt RangeError ReferenceError RegExp Object Set setInterval setTimeout String SyntaxError TypeError unescape URIError WeakMap WeakSet"); + AST_SymbolRef.DEFMETHOD("is_declared", function(compressor) { + return this.defined + || !this.definition().undeclared + || compressor.option("unsafe") && global_names[this.name]; + }); + + function is_static_field_or_init(prop) { + return prop.static && prop.value && (prop instanceof AST_ClassField || prop instanceof AST_ClassInit); + } + + function declarations_only(node) { + return all(node.definitions, function(var_def) { + return !var_def.value; + }); + } + + function is_declaration(stat, lexical) { + if (stat instanceof AST_DefClass) return lexical && !stat.extends && all(stat.properties, function(prop) { + if (prop.key instanceof AST_Node) return false; + return !is_static_field_or_init(prop); + }); + if (stat instanceof AST_Definitions) return (lexical || stat instanceof AST_Var) && declarations_only(stat); + if (stat instanceof AST_ExportDeclaration) return is_declaration(stat.body, lexical); + if (stat instanceof AST_ExportDefault) return is_declaration(stat.body, lexical); + return stat instanceof AST_LambdaDefinition; + } + + function is_last_statement(body, stat) { + var index = body.lastIndexOf(stat); + if (index < 0) return false; + while (++index < body.length) { + if (!is_declaration(body[index], true)) return false; + } + return true; + } + + // Certain combination of unused name + side effect leads to invalid AST: + // https://github.com/mishoo/UglifyJS/issues/44 + // https://github.com/mishoo/UglifyJS/issues/1838 + // https://github.com/mishoo/UglifyJS/issues/3371 + // We fix it at this stage by moving the `var` outside the `for`. + function patch_for_init(node, in_list) { + var block; + if (node.init instanceof AST_BlockStatement) { + block = node.init; + node.init = block.body.pop(); + block.body.push(node); + } + if (node.init instanceof AST_Defun) { + if (!block) block = make_node(AST_BlockStatement, node, { body: [ node ] }); + block.body.splice(-1, 0, node.init); + node.init = null; + } else if (node.init instanceof AST_SimpleStatement) { + node.init = node.init.body; + } else if (is_empty(node.init)) { + node.init = null; + } + if (!block) return; + return in_list ? List.splice(block.body) : block; + } + + function tighten_body(statements, compressor) { + var in_lambda = last_of(compressor, function(node) { + return node instanceof AST_Lambda; + }); + var block_scope, iife_in_try, in_iife_single, in_loop, in_try, scope; + find_loop_scope_try(); + var changed, last_changed, max_iter = 10; + do { + last_changed = changed; + changed = 0; + if (eliminate_spurious_blocks(statements)) changed = 1; + if (!changed && last_changed == 1) break; + if (compressor.option("dead_code")) { + if (eliminate_dead_code(statements, compressor)) changed = 2; + if (!changed && last_changed == 2) break; + } + if (compressor.option("if_return")) { + if (handle_if_return(statements, compressor)) changed = 3; + if (!changed && last_changed == 3) break; + } + if (compressor.option("awaits") && compressor.option("side_effects")) { + if (trim_awaits(statements, compressor)) changed = 4; + if (!changed && last_changed == 4) break; + } + if (compressor.option("inline") >= 4) { + if (inline_iife(statements, compressor)) changed = 5; + if (!changed && last_changed == 5) break; + } + if (compressor.sequences_limit > 0) { + if (sequencesize(statements, compressor)) changed = 6; + if (!changed && last_changed == 6) break; + if (sequencesize_2(statements, compressor)) changed = 7; + if (!changed && last_changed == 7) break; + } + if (compressor.option("join_vars")) { + if (join_consecutive_vars(statements)) changed = 8; + if (!changed && last_changed == 8) break; + } + if (compressor.option("collapse_vars")) { + if (collapse(statements, compressor)) changed = 9; + } + } while (changed && max_iter-- > 0); + return statements; + + function last_of(compressor, predicate) { + var block = compressor.self(), level = 0, stat; + do { + if (block instanceof AST_Catch) { + block = compressor.parent(level++); + } else if (block instanceof AST_LabeledStatement) { + block = block.body; + } else if (block instanceof AST_SwitchBranch) { + var branches = compressor.parent(level); + if (branches.body[branches.body.length - 1] === block || has_break(block.body)) { + level++; + block = branches; + } + } + do { + stat = block; + if (predicate(stat)) return stat; + block = compressor.parent(level++); + } while (block instanceof AST_If); + } while (stat + && (block instanceof AST_BlockStatement + || block instanceof AST_Catch + || block instanceof AST_Scope + || block instanceof AST_SwitchBranch + || block instanceof AST_Try) + && is_last_statement(block.body, stat)); + + function has_break(stats) { + for (var i = stats.length; --i >= 0;) { + if (stats[i] instanceof AST_Break) return true; + } + return false; + } + } + + function find_loop_scope_try() { + var node = compressor.self(), level = 0; + do { + if (!block_scope && node.variables) block_scope = node; + if (node instanceof AST_Catch) { + if (compressor.parent(level).bfinally) { + if (!in_try) in_try = {}; + in_try.bfinally = true; + } + level++; + } else if (node instanceof AST_Finally) { + level++; + } else if (node instanceof AST_IterationStatement) { + in_loop = true; + } else if (node instanceof AST_Scope) { + scope = node; + break; + } else if (node instanceof AST_Try) { + if (!in_try) in_try = {}; + if (node.bcatch) in_try.bcatch = true; + if (node.bfinally) in_try.bfinally = true; + } + } while (node = compressor.parent(level++)); + } + + // Search from right to left for assignment-like expressions: + // - `var a = x;` + // - `a = x;` + // - `++a` + // For each candidate, scan from left to right for first usage, then try + // to fold assignment into the site for compression. + // Will not attempt to collapse assignments into or past code blocks + // which are not sequentially executed, e.g. loops and conditionals. + function collapse(statements, compressor) { + if (scope.pinned()) return; + var args; + var assignments = new Dictionary(); + var candidates = []; + var changed = false; + var declare_only = new Dictionary(); + var force_single; + var stat_index = statements.length; + var scanner = new TreeTransformer(function(node, descend) { + if (abort) return node; + // Skip nodes before `candidate` as quickly as possible + if (!hit) { + if (node !== hit_stack[hit_index]) return node; + hit_index++; + if (hit_index < hit_stack.length) return handle_custom_scan_order(node, scanner); + hit = true; + stop_after = (value_def ? find_stop_value : find_stop)(node, 0); + if (stop_after === node) abort = true; + return node; + } + var parent = scanner.parent(); + // Stop only if candidate is found within conditional branches + if (!stop_if_hit && in_conditional(node, parent)) { + stop_if_hit = parent; + } + // Cascade compound assignments + if (compound && scan_lhs && can_replace && !stop_if_hit + && node instanceof AST_Assign && node.operator != "=" && node.left.equals(lhs)) { + replaced++; + changed = true; + AST_Node.info("Cascading {this} [{start}]", node); + can_replace = false; + lvalues = get_lvalues(lhs); + node.right.transform(scanner); + clear_write_only(candidate); + var folded; + if (abort) { + folded = candidate; + } else { + abort = true; + folded = make_node(AST_Binary, candidate, { + operator: compound, + left: lhs.fixed && lhs.definition().fixed ? lhs.fixed.to_binary(candidate) : lhs, + right: rvalue, + }); + } + return make_node(AST_Assign, node, { + operator: "=", + left: node.left, + right: make_node(AST_Binary, node, { + operator: node.operator.slice(0, -1), + left: folded, + right: node.right, + }), + }); + } + // Stop immediately if these node types are encountered + if (should_stop(node, parent)) { + abort = true; + return node; + } + // Skip transient nodes caused by single-use variable replacement + if (node.single_use) return node; + // Replace variable with assignment when found + var hit_rhs; + if (!(node instanceof AST_SymbolDeclaration) + && (scan_lhs && lhs.equals(node) + || scan_rhs && (hit_rhs = scan_rhs(node, this)))) { + if (!can_replace || stop_if_hit && (hit_rhs || !lhs_local || !replace_all)) { + if (!hit_rhs && !value_def) abort = true; + return node; + } + if (is_lhs(node, parent)) { + if (value_def && !hit_rhs) assign_used = true; + return node; + } + if (!hit_rhs && verify_ref && node.fixed !== lhs.fixed) { + abort = true; + return node; + } + if (value_def) { + if (stop_if_hit && assign_pos == 0) assign_pos = remaining - replaced; + if (!hit_rhs) replaced++; + return node; + } + replaced++; + changed = abort = true; + AST_Node.info("Collapsing {this} [{start}]", node); + if (candidate.TYPE == "Binary") { + update_symbols(candidate, node); + return make_node(AST_Assign, candidate, { + operator: "=", + left: candidate.right.left, + right: candidate.operator == "&&" ? make_node(AST_Conditional, candidate, { + condition: candidate.left, + consequent: candidate.right.right, + alternative: node, + }) : make_node(AST_Conditional, candidate, { + condition: candidate.left, + consequent: node, + alternative: candidate.right.right, + }), + }); + } + if (candidate instanceof AST_UnaryPostfix) return make_node(AST_UnaryPrefix, candidate, { + operator: candidate.operator, + expression: lhs.fixed && lhs.definition().fixed ? lhs.fixed.to_prefix(candidate) : lhs, + }); + if (candidate instanceof AST_UnaryPrefix) { + clear_write_only(candidate); + return candidate; + } + update_symbols(rvalue, node); + if (candidate instanceof AST_VarDef) { + var def = candidate.name.definition(); + if (def.references.length - def.replaced == 1 && !compressor.exposed(def)) { + def.replaced++; + return maintain_this_binding(parent, node, rvalue); + } + return make_node(AST_Assign, candidate, { + operator: "=", + left: node, + right: rvalue, + }); + } + clear_write_only(rvalue); + var assign = candidate.clone(); + assign.right = rvalue; + return assign; + } + // Stop signals related to AST_SymbolRef + if (should_stop_ref(node, parent)) { + abort = true; + return node; + } + // These node types have child nodes that execute sequentially, + // but are otherwise not safe to scan into or beyond them. + if (is_last_node(node, parent) || may_throw(node)) { + stop_after = node; + if (node instanceof AST_Scope) abort = true; + } + // Scan but don't replace inside getter/setter + if (node instanceof AST_Accessor) { + var replace = can_replace; + can_replace = false; + descend(node, scanner); + can_replace = replace; + return signal_abort(node); + } + // Scan but don't replace inside destructuring expression + if (node instanceof AST_Destructured) { + var replace = can_replace; + can_replace = false; + descend(node, scanner); + can_replace = replace; + return signal_abort(node); + } + // Scan but don't replace inside default value + if (node instanceof AST_DefaultValue) { + node.name = node.name.transform(scanner); + var replace = can_replace; + can_replace = false; + node.value = node.value.transform(scanner); + can_replace = replace; + return signal_abort(node); + } + // Scan but don't replace inside block scope with colliding variable + if (node instanceof AST_BlockScope + && !(node instanceof AST_Scope) + && !(node.variables && node.variables.all(function(def) { + return !enclosed.has(def.name) && !lvalues.has(def.name); + }))) { + var replace = can_replace; + can_replace = false; + if (!handle_custom_scan_order(node, scanner)) descend(node, scanner); + can_replace = replace; + return signal_abort(node); + } + if (handle_custom_scan_order(node, scanner)) return signal_abort(node); + }, signal_abort); + var multi_replacer = new TreeTransformer(function(node) { + if (abort) return node; + // Skip nodes before `candidate` as quickly as possible + if (!hit) { + if (node !== hit_stack[hit_index]) return node; + hit_index++; + switch (hit_stack.length - hit_index) { + case 0: + hit = true; + if (assign_used) return node; + if (node !== candidate) return node; + if (node instanceof AST_VarDef) return node; + def.replaced++; + var parent = multi_replacer.parent(); + if (parent instanceof AST_Sequence && parent.tail_node() !== node) { + value_def.replaced++; + if (rvalue === rhs_value) return List.skip; + return make_sequence(rhs_value, rhs_value.expressions.slice(0, -1)); + } + return rvalue; + case 1: + if (!assign_used && node.body === candidate) { + hit = true; + def.replaced++; + value_def.replaced++; + return null; + } + default: + return handle_custom_scan_order(node, multi_replacer); + } + } + // Replace variable when found + if (node instanceof AST_SymbolRef && node.definition() === def) { + if (is_lhs(node, multi_replacer.parent())) return node; + if (!--replaced) abort = true; + AST_Node.info("Replacing {this} [{start}]", node); + var ref = rvalue.clone(); + ref.scope = node.scope; + ref.reference(); + if (replaced == assign_pos) { + abort = true; + return make_node(AST_Assign, candidate, { + operator: "=", + left: node, + right: ref, + }); + } + def.replaced++; + return ref; + } + // Skip (non-executed) functions and (leading) default case in switch statements + if (node instanceof AST_Default || node instanceof AST_Scope) return node; + }, function(node) { + return patch_sequence(node, multi_replacer); + }); + while (--stat_index >= 0) { + // Treat parameters as collapsible in IIFE, i.e. + // function(a, b){ ... }(x()); + // would be translated into equivalent assignments: + // var a = x(), b = undefined; + if (stat_index == 0 && compressor.option("unused")) extract_args(); + // Find collapsible assignments + var hit_stack = []; + extract_candidates(statements[stat_index]); + while (candidates.length > 0) { + hit_stack = candidates.pop(); + var hit_index = 0; + var candidate = hit_stack[hit_stack.length - 1]; + var assign_pos = -1; + var assign_used = false; + var verify_ref = false; + var remaining; + var value_def = null; + var stop_after = null; + var stop_if_hit = null; + var lhs = get_lhs(candidate); + var side_effects = lhs && lhs.has_side_effects(compressor); + var scan_lhs = lhs && (!side_effects || lhs instanceof AST_SymbolRef) + && !is_lhs_read_only(lhs, compressor); + var scan_rhs = foldable(candidate); + if (!scan_lhs && !scan_rhs) continue; + var compound = candidate instanceof AST_Assign && candidate.operator.slice(0, -1); + var funarg = candidate.name instanceof AST_SymbolFunarg; + var may_throw = return_false; + if (candidate.may_throw(compressor)) { + if (funarg && is_async(scope)) continue; + may_throw = in_try ? function(node) { + return node.has_side_effects(compressor); + } : side_effects_external; + } + var read_toplevel = false; + var modify_toplevel = false; + // Locate symbols which may execute code outside of scanning range + var enclosed = new Dictionary(); + var well_defined = true; + var lvalues = get_lvalues(candidate); + var lhs_local = is_lhs_local(lhs); + var rhs_value = get_rvalue(candidate); + var rvalue = rhs_value; + if (!side_effects) { + if (!compound && rvalue instanceof AST_Sequence) rvalue = rvalue.tail_node(); + side_effects = value_has_side_effects(); + } + var check_destructured = in_try || !lhs_local ? function(node) { + return node instanceof AST_Destructured; + } : return_false; + var replace_all = replace_all_symbols(candidate); + var hit = funarg; + var abort = false; + var replaced = 0; + var can_replace = !args || !hit; + if (!can_replace) { + for (var j = candidate.arg_index + 1; !abort && j < args.length; j++) { + if (args[j]) args[j].transform(scanner); + } + can_replace = true; + } + for (var i = stat_index; !abort && i < statements.length; i++) { + statements[i].transform(scanner); + } + if (value_def) { + if (!replaced || remaining > replaced + assign_used) { + candidates.push(hit_stack); + force_single = true; + continue; + } + if (replaced == assign_pos) assign_used = true; + var def = lhs.definition(); + abort = false; + hit_index = 0; + hit = funarg; + for (var i = stat_index; !abort && i < statements.length; i++) { + if (!statements[i].transform(multi_replacer)) statements.splice(i--, 1); + } + replaced = candidate instanceof AST_VarDef + && candidate === hit_stack[hit_stack.length - 1] + && def.references.length == def.replaced + && !compressor.exposed(def); + value_def.last_ref = false; + value_def.single_use = false; + changed = true; + } + if (replaced) remove_candidate(candidate); + } + } + return changed; + + function signal_abort(node) { + if (abort) return node; + if (stop_after === node) abort = true; + if (stop_if_hit === node) stop_if_hit = null; + return node; + } + + function handle_custom_scan_order(node, tt) { + if (!(node instanceof AST_BlockScope)) return; + // Skip (non-executed) functions + if (node instanceof AST_Scope) return node; + // Scan computed keys, static fields & initializers in class + if (node instanceof AST_Class) { + if (node.name) node.name = node.name.transform(tt); + if (!abort && node.extends) node.extends = node.extends.transform(tt); + var fields = [], stats = []; + for (var i = 0; !abort && i < node.properties.length; i++) { + var prop = node.properties[i]; + if (prop.key instanceof AST_Node) prop.key = prop.key.transform(tt); + if (!prop.static) continue; + if (prop instanceof AST_ClassField) { + if (prop.value) fields.push(prop); + } else if (prop instanceof AST_ClassInit) { + [].push.apply(stats, prop.value.body); + } + } + for (var i = 0; !abort && i < stats.length; i++) { + stats[i].transform(tt); + } + for (var i = 0; !abort && i < fields.length; i++) { + var prop = fields[i]; + prop.value = prop.value.transform(tt); + } + return node; + } + // Scan object only in a for-in/of statement + if (node instanceof AST_ForEnumeration) { + node.object = node.object.transform(tt); + abort = true; + return node; + } + // Scan first case expression only in a switch statement + if (node instanceof AST_Switch) { + node.expression = node.expression.transform(tt); + for (var i = 0; !abort && i < node.body.length; i++) { + var branch = node.body[i]; + if (branch instanceof AST_Case) { + if (!hit) { + if (branch !== hit_stack[hit_index]) continue; + hit_index++; + } + branch.expression = branch.expression.transform(tt); + if (!replace_all) break; + scan_rhs = false; + } + } + abort = true; + return node; + } + } + + function is_direct_assignment(node, parent) { + if (parent instanceof AST_Assign) return parent.operator == "=" && parent.left === node; + if (parent instanceof AST_DefaultValue) return parent.name === node; + if (parent instanceof AST_DestructuredArray) return true; + if (parent instanceof AST_DestructuredKeyVal) return parent.value === node; + } + + function should_stop(node, parent) { + if (node === rvalue) return true; + if (parent instanceof AST_For) { + if (node !== parent.init) return true; + } + if (node instanceof AST_Assign) { + return node.operator != "=" && lhs.equals(node.left); + } + if (node instanceof AST_Call) { + if (!(lhs instanceof AST_PropAccess)) return false; + if (!lhs.equals(node.expression)) return false; + return !(rvalue instanceof AST_LambdaExpression && !rvalue.contains_this()); + } + if (node instanceof AST_Class) return !compressor.has_directive("use strict"); + if (node instanceof AST_Debugger) return true; + if (node instanceof AST_Defun) return funarg && lhs.name === node.name.name; + if (node instanceof AST_DestructuredKeyVal) return node.key instanceof AST_Node; + if (node instanceof AST_DWLoop) return true; + if (node instanceof AST_LoopControl) return true; + if (node instanceof AST_Try) return true; + if (node instanceof AST_With) return true; + return false; + } + + function should_stop_ref(node, parent) { + if (!(node instanceof AST_SymbolRef)) return false; + if (node.is_declared(compressor)) { + if (node.fixed_value()) return false; + if (can_drop_symbol(node)) { + return !(parent instanceof AST_PropAccess && parent.expression === node) + && is_arguments(node.definition()); + } + } else if (is_direct_assignment(node, parent)) { + return false; + } + if (!replace_all) return true; + scan_rhs = false; + return false; + } + + function in_conditional(node, parent) { + if (parent instanceof AST_Assign) return parent.left !== node && lazy_op[parent.operator.slice(0, -1)]; + if (parent instanceof AST_Binary) return parent.left !== node && lazy_op[parent.operator]; + if (parent instanceof AST_Call) return parent.optional && parent.expression !== node; + if (parent instanceof AST_Case) return parent.expression !== node; + if (parent instanceof AST_Conditional) return parent.condition !== node; + if (parent instanceof AST_If) return parent.condition !== node; + if (parent instanceof AST_Sub) return parent.optional && parent.expression !== node; + } + + function is_last_node(node, parent) { + if (node instanceof AST_Await) return true; + if (node.TYPE == "Binary") return !can_drop_op(node.operator, node.right, compressor); + if (node instanceof AST_Call) { + var def, fn = node.expression; + if (fn instanceof AST_SymbolRef) { + def = fn.definition(); + fn = fn.fixed_value(); + } + if (!(fn instanceof AST_Lambda)) return !node.is_expr_pure(compressor); + if (def && recursive_ref(compressor, def, fn)) return true; + if (fn.collapse_scanning) return false; + fn.collapse_scanning = true; + var replace = can_replace; + can_replace = false; + var after = stop_after; + var if_hit = stop_if_hit; + for (var i = 0; !abort && i < fn.argnames.length; i++) { + if (arg_may_throw(reject, fn.argnames[i], node.args[i])) abort = true; + } + if (!abort) { + if (fn.rest && arg_may_throw(reject, fn.rest, make_node(AST_Array, node, { + elements: node.args.slice(i), + }))) { + abort = true; + } else if (is_arrow(fn) && fn.value) { + fn.value.transform(scanner); + } else for (var i = 0; !abort && i < fn.body.length; i++) { + var stat = fn.body[i]; + if (stat instanceof AST_Return) { + if (stat.value) stat.value.transform(scanner); + break; + } + stat.transform(scanner); + } + } + stop_if_hit = if_hit; + stop_after = after; + can_replace = replace; + fn.collapse_scanning = false; + if (!abort) return false; + abort = false; + return true; + } + if (node instanceof AST_Class) { + if (!in_try) return false; + var base = node.extends; + if (!base) return false; + if (base instanceof AST_SymbolRef) base = base.fixed_value(); + return !safe_for_extends(base); + } + if (node instanceof AST_Exit) { + if (in_try) { + if (in_try.bfinally) return true; + if (in_try.bcatch && node instanceof AST_Throw) return true; + } + return side_effects || lhs instanceof AST_PropAccess || may_modify(lhs); + } + if (node instanceof AST_Function) { + return compressor.option("ie") && node.name && lvalues.has(node.name.name); + } + if (node instanceof AST_ObjectIdentity) return symbol_in_lvalues(node, parent); + if (node instanceof AST_PropAccess) { + if (side_effects) return true; + var exp = node.expression; + if (exp instanceof AST_SymbolRef && is_arguments(exp.definition())) return true; + if (compressor.option("unsafe")) { + if (is_undeclared_ref(exp) && global_names[exp.name]) return false; + if (is_static_fn(exp)) return false; + } + if (!well_defined) return true; + if (value_def) return false; + if (!in_try && lhs_local) return false; + if (node.optional) return false; + return exp.may_throw_on_access(compressor); + } + if (node instanceof AST_Spread) return true; + if (node instanceof AST_SymbolRef) { + if (symbol_in_lvalues(node, parent)) return !is_direct_assignment(node, parent); + if (side_effects && may_modify(node)) return true; + var def = node.definition(); + return (in_try || def.scope.resolve() !== scope) && !can_drop_symbol(node); + } + if (node instanceof AST_Template) return !node.is_expr_pure(compressor); + if (node instanceof AST_VarDef) { + if (check_destructured(node.name)) return true; + return (node.value || parent instanceof AST_Let) && node.name.match_symbol(function(node) { + return node instanceof AST_SymbolDeclaration + && (lvalues.has(node.name) || side_effects && may_modify(node)); + }, true); + } + if (node instanceof AST_Yield) return true; + var sym = is_lhs(node.left, node); + if (!sym) return false; + if (sym instanceof AST_PropAccess) return true; + if (check_destructured(sym)) return true; + return sym.match_symbol(function(node) { + return node instanceof AST_SymbolRef + && (lvalues.has(node.name) || read_toplevel && compressor.exposed(node.definition())); + }, true); + + function reject(node) { + node.transform(scanner); + return abort; + } + } + + function arg_may_throw(reject, node, value) { + if (node instanceof AST_DefaultValue) { + return reject(node.value) + || arg_may_throw(reject, node.name, node.value) + || !is_undefined(value) && arg_may_throw(reject, node.name, value); + } + if (!value) return !(node instanceof AST_Symbol); + if (node instanceof AST_Destructured) { + if (node.rest && arg_may_throw(reject, node.rest)) return true; + if (node instanceof AST_DestructuredArray) { + if (value instanceof AST_Array) return !all(node.elements, function(element, index) { + return !arg_may_throw(reject, element, value[index]); + }); + if (!value.is_string(compressor)) return true; + return !all(node.elements, function(element) { + return !arg_may_throw(reject, element); + }); + } + if (node instanceof AST_DestructuredObject) { + if (value.may_throw_on_access(compressor)) return true; + return !all(node.properties, function(prop) { + if (prop.key instanceof AST_Node && reject(prop.key)) return false; + return !arg_may_throw(reject, prop.value); + }); + } + } + } + + function extract_args() { + if (in_iife_single === false) return; + var iife = compressor.parent(), fn = compressor.self(); + if (in_iife_single === undefined) { + if (!(fn instanceof AST_LambdaExpression) + || is_generator(fn) + || fn.uses_arguments + || fn.pinned() + || !(iife instanceof AST_Call) + || iife.expression !== fn + || !all(iife.args, function(arg) { + return !(arg instanceof AST_Spread); + })) { + in_iife_single = false; + return; + } + if (!is_iife_single(iife)) return; + in_iife_single = true; + } + var fn_strict = fn.in_strict_mode(compressor) + && !fn.parent_scope.resolve(true).in_strict_mode(compressor); + var has_await; + if (is_async(fn)) { + has_await = function(node) { + return node instanceof AST_Symbol && node.name == "await"; + }; + iife_in_try = true; + } else { + has_await = function(node) { + return node instanceof AST_Await && !tw.find_parent(AST_Scope); + }; + if (iife_in_try === undefined) iife_in_try = find_try(compressor, 1, iife, null, true, true); + } + var arg_scope = null; + var tw = new TreeWalker(function(node, descend) { + if (!arg) return true; + if (has_await(node) || node instanceof AST_Yield) { + arg = null; + return true; + } + if (node instanceof AST_ObjectIdentity) { + if (fn_strict || !arg_scope) arg = null; + return true; + } + if (node instanceof AST_SymbolRef) { + var def; + if (node.in_arg && !is_safe_lexical(node.definition()) + || (def = fn.variables.get(node.name)) && def !== node.definition()) { + arg = null; + } + return true; + } + if (node instanceof AST_Scope && !is_arrow(node)) { + var save_scope = arg_scope; + arg_scope = node; + descend(); + arg_scope = save_scope; + return true; + } + }); + args = iife.args.slice(); + var len = args.length; + var names = new Dictionary(); + for (var i = fn.argnames.length; --i >= 0;) { + var sym = fn.argnames[i]; + var arg = args[i]; + var value = null; + if (sym instanceof AST_DefaultValue) { + value = sym.value; + sym = sym.name; + args[len + i] = value; + } + if (sym instanceof AST_Destructured) { + if (iife_in_try && arg_may_throw(function(node) { + return node.has_side_effects(compressor); + }, sym, arg)) { + candidates.length = 0; + break; + } + args[len + i] = fn.argnames[i]; + continue; + } + if (names.has(sym.name)) continue; + names.set(sym.name, true); + if (value) arg = is_undefined(arg) ? value : null; + if (!arg && !value) { + arg = make_node(AST_Undefined, sym).transform(compressor); + } else if (arg instanceof AST_Lambda && arg.pinned()) { + arg = null; + } else if (arg) { + arg.walk(tw); + } + if (!arg) continue; + var candidate = make_node(AST_VarDef, sym, { + name: sym, + value: arg, + }); + candidate.name_index = i; + candidate.arg_index = value ? len + i : i; + candidates.unshift([ candidate ]); + } + if (fn.rest) args.push(fn.rest); + } + + function extract_candidates(expr, unused) { + hit_stack.push(expr); + if (expr instanceof AST_Array) { + expr.elements.forEach(function(node) { + extract_candidates(node, unused); + }); + } else if (expr instanceof AST_Assign) { + var lhs = expr.left; + if (!(lhs instanceof AST_Destructured)) candidates.push(hit_stack.slice()); + extract_candidates(lhs); + extract_candidates(expr.right); + if (lhs instanceof AST_SymbolRef && expr.operator == "=") { + assignments.set(lhs.name, (assignments.get(lhs.name) || 0) + 1); + } + } else if (expr instanceof AST_Await) { + extract_candidates(expr.expression, unused); + } else if (expr instanceof AST_Binary) { + var lazy = lazy_op[expr.operator]; + if (unused + && lazy + && expr.operator != "??" + && expr.right instanceof AST_Assign + && expr.right.operator == "=" + && !(expr.right.left instanceof AST_Destructured)) { + candidates.push(hit_stack.slice()); + } + extract_candidates(expr.left, !lazy && unused); + extract_candidates(expr.right, unused); + } else if (expr instanceof AST_Call) { + extract_candidates(expr.expression); + expr.args.forEach(extract_candidates); + } else if (expr instanceof AST_Case) { + extract_candidates(expr.expression); + } else if (expr instanceof AST_Conditional) { + extract_candidates(expr.condition); + extract_candidates(expr.consequent, unused); + extract_candidates(expr.alternative, unused); + } else if (expr instanceof AST_Definitions) { + expr.definitions.forEach(extract_candidates); + } else if (expr instanceof AST_Dot) { + extract_candidates(expr.expression); + } else if (expr instanceof AST_DWLoop) { + extract_candidates(expr.condition); + if (!(expr.body instanceof AST_Block)) { + extract_candidates(expr.body); + } + } else if (expr instanceof AST_Exit) { + if (expr.value) extract_candidates(expr.value); + } else if (expr instanceof AST_For) { + if (expr.init) extract_candidates(expr.init, true); + if (expr.condition) extract_candidates(expr.condition); + if (expr.step) extract_candidates(expr.step, true); + if (!(expr.body instanceof AST_Block)) { + extract_candidates(expr.body); + } + } else if (expr instanceof AST_ForEnumeration) { + extract_candidates(expr.object); + if (!(expr.body instanceof AST_Block)) { + extract_candidates(expr.body); + } + } else if (expr instanceof AST_If) { + extract_candidates(expr.condition); + if (!(expr.body instanceof AST_Block)) { + extract_candidates(expr.body); + } + if (expr.alternative && !(expr.alternative instanceof AST_Block)) { + extract_candidates(expr.alternative); + } + } else if (expr instanceof AST_Object) { + expr.properties.forEach(function(prop) { + hit_stack.push(prop); + if (prop.key instanceof AST_Node) extract_candidates(prop.key); + if (prop instanceof AST_ObjectKeyVal) extract_candidates(prop.value, unused); + hit_stack.pop(); + }); + } else if (expr instanceof AST_Sequence) { + var end = expr.expressions.length - (unused ? 0 : 1); + expr.expressions.forEach(function(node, index) { + extract_candidates(node, index < end); + }); + } else if (expr instanceof AST_SimpleStatement) { + extract_candidates(expr.body, true); + } else if (expr instanceof AST_Spread) { + extract_candidates(expr.expression); + } else if (expr instanceof AST_Sub) { + extract_candidates(expr.expression); + extract_candidates(expr.property); + } else if (expr instanceof AST_Switch) { + extract_candidates(expr.expression); + expr.body.forEach(extract_candidates); + } else if (expr instanceof AST_Unary) { + if (UNARY_POSTFIX[expr.operator]) { + candidates.push(hit_stack.slice()); + } else { + extract_candidates(expr.expression); + } + } else if (expr instanceof AST_VarDef) { + if (expr.name instanceof AST_SymbolVar) { + if (expr.value) { + var def = expr.name.definition(); + if (def.references.length > def.replaced) { + candidates.push(hit_stack.slice()); + } + } else { + declare_only.set(expr.name.name, (declare_only.get(expr.name.name) || 0) + 1); + } + } + if (expr.value) extract_candidates(expr.value); + } else if (expr instanceof AST_Yield) { + if (expr.expression) extract_candidates(expr.expression); + } + hit_stack.pop(); + } + + function find_stop(node, level) { + var parent = scanner.parent(level); + if (parent instanceof AST_Array) return node; + if (parent instanceof AST_Assign) return node; + if (parent instanceof AST_Await) return node; + if (parent instanceof AST_Binary) return node; + if (parent instanceof AST_Call) return node; + if (parent instanceof AST_Case) return node; + if (parent instanceof AST_Conditional) return node; + if (parent instanceof AST_Definitions) return find_stop_unused(parent, level + 1); + if (parent instanceof AST_Exit) return node; + if (parent instanceof AST_If) return node; + if (parent instanceof AST_IterationStatement) return node; + if (parent instanceof AST_ObjectProperty) return node; + if (parent instanceof AST_PropAccess) return node; + if (parent instanceof AST_Sequence) { + return (parent.tail_node() === node ? find_stop : find_stop_unused)(parent, level + 1); + } + if (parent instanceof AST_SimpleStatement) return find_stop_unused(parent, level + 1); + if (parent instanceof AST_Spread) return node; + if (parent instanceof AST_Switch) return node; + if (parent instanceof AST_Unary) return node; + if (parent instanceof AST_VarDef) return node; + if (parent instanceof AST_Yield) return node; + return null; + } + + function find_stop_logical(parent, op, level) { + var node; + do { + node = parent; + parent = scanner.parent(++level); + } while (parent instanceof AST_Assign && parent.operator.slice(0, -1) == op + || parent instanceof AST_Binary && parent.operator == op); + return node; + } + + function find_stop_expr(expr, cont, node, parent, level) { + var replace = can_replace; + can_replace = false; + var after = stop_after; + var if_hit = stop_if_hit; + var stack = scanner.stack; + scanner.stack = [ parent ]; + expr.transform(scanner); + scanner.stack = stack; + stop_if_hit = if_hit; + stop_after = after; + can_replace = replace; + if (abort) { + abort = false; + return node; + } + return cont(parent, level + 1); + } + + function find_stop_value(node, level) { + var parent = scanner.parent(level); + if (parent instanceof AST_Array) return find_stop_value(parent, level + 1); + if (parent instanceof AST_Assign) { + if (may_throw(parent)) return node; + if (parent.left.match_symbol(function(ref) { + return ref instanceof AST_SymbolRef && (lhs.name == ref.name || value_def.name == ref.name); + })) return node; + var op; + if (parent.left === node || !lazy_op[op = parent.operator.slice(0, -1)]) { + return find_stop_value(parent, level + 1); + } + return find_stop_logical(parent, op, level); + } + if (parent instanceof AST_Await) return find_stop_value(parent, level + 1); + if (parent instanceof AST_Binary) { + var op; + if (parent.left === node || !lazy_op[op = parent.operator]) { + return find_stop_value(parent, level + 1); + } + return find_stop_logical(parent, op, level); + } + if (parent instanceof AST_Call) return parent; + if (parent instanceof AST_Case) { + if (parent.expression !== node) return node; + return find_stop_value(parent, level + 1); + } + if (parent instanceof AST_Conditional) { + if (parent.condition !== node) return node; + return find_stop_value(parent, level + 1); + } + if (parent instanceof AST_Definitions) return find_stop_unused(parent, level + 1); + if (parent instanceof AST_Do) return node; + if (parent instanceof AST_Exit) return find_stop_unused(parent, level + 1); + if (parent instanceof AST_For) { + if (parent.init !== node && parent.condition !== node) return node; + return find_stop_value(parent, level + 1); + } + if (parent instanceof AST_ForEnumeration) { + if (parent.init !== node) return node; + return find_stop_value(parent, level + 1); + } + if (parent instanceof AST_If) { + if (parent.condition !== node) return node; + return find_stop_value(parent, level + 1); + } + if (parent instanceof AST_ObjectProperty) { + var obj = scanner.parent(level + 1); + return all(obj.properties, function(prop) { + return prop instanceof AST_ObjectKeyVal; + }) ? find_stop_value(obj, level + 2) : obj; + } + if (parent instanceof AST_PropAccess) { + var exp = parent.expression; + return exp === node ? find_stop_value(parent, level + 1) : node; + } + if (parent instanceof AST_Sequence) { + return (parent.tail_node() === node ? find_stop_value : find_stop_unused)(parent, level + 1); + } + if (parent instanceof AST_SimpleStatement) return find_stop_unused(parent, level + 1); + if (parent instanceof AST_Spread) return find_stop_value(parent, level + 1); + if (parent instanceof AST_Switch) { + if (parent.expression !== node) return node; + return find_stop_value(parent, level + 1); + } + if (parent instanceof AST_Unary) { + if (parent.operator == "delete") return node; + return find_stop_value(parent, level + 1); + } + if (parent instanceof AST_VarDef) return parent.name.match_symbol(function(sym) { + return sym instanceof AST_SymbolDeclaration && (lhs.name == sym.name || value_def.name == sym.name); + }) ? node : find_stop_value(parent, level + 1); + if (parent instanceof AST_While) { + if (parent.condition !== node) return node; + return find_stop_value(parent, level + 1); + } + if (parent instanceof AST_Yield) return find_stop_value(parent, level + 1); + return null; + } + + function find_stop_unused(node, level) { + var parent = scanner.parent(level); + if (is_last_node(node, parent)) return node; + if (in_conditional(node, parent)) return node; + if (parent instanceof AST_Array) return find_stop_unused(parent, level + 1); + if (parent instanceof AST_Assign) return check_assignment(parent.left); + if (parent instanceof AST_Await) return node; + if (parent instanceof AST_Binary) return find_stop_unused(parent, level + 1); + if (parent instanceof AST_Call) return find_stop_unused(parent, level + 1); + if (parent instanceof AST_Case) return find_stop_unused(parent, level + 1); + if (parent instanceof AST_Conditional) return find_stop_unused(parent, level + 1); + if (parent instanceof AST_Definitions) return find_stop_unused(parent, level + 1); + if (parent instanceof AST_Exit) return find_stop_unused(parent, level + 1); + if (parent instanceof AST_If) return find_stop_unused(parent, level + 1); + if (parent instanceof AST_IterationStatement) return node; + if (parent instanceof AST_ObjectProperty) { + var obj = scanner.parent(level + 1); + return all(obj.properties, function(prop) { + return prop instanceof AST_ObjectKeyVal; + }) ? find_stop_unused(obj, level + 2) : obj; + } + if (parent instanceof AST_PropAccess) { + var exp = parent.expression; + if (exp === node) return find_stop_unused(parent, level + 1); + return find_stop_expr(exp, find_stop_unused, node, parent, level); + } + if (parent instanceof AST_Sequence) return find_stop_unused(parent, level + 1); + if (parent instanceof AST_SimpleStatement) return find_stop_unused(parent, level + 1); + if (parent instanceof AST_Spread) return node; + if (parent instanceof AST_Switch) return find_stop_unused(parent, level + 1); + if (parent instanceof AST_Unary) return find_stop_unused(parent, level + 1); + if (parent instanceof AST_VarDef) return check_assignment(parent.name); + if (parent instanceof AST_Yield) return node; + return null; + + function check_assignment(lhs) { + if (may_throw(parent)) return node; + if (lhs !== node && lhs instanceof AST_Destructured) { + return find_stop_expr(lhs, find_stop_unused, node, parent, level); + } + return find_stop_unused(parent, level + 1); + } + } + + function mangleable_var(rhs) { + if (force_single) { + force_single = false; + return; + } + if (remaining < 1) return; + rhs = rhs.tail_node(); + var value = rhs instanceof AST_Assign && rhs.operator == "=" ? rhs.left : rhs; + if (!(value instanceof AST_SymbolRef)) return; + var def = value.definition(); + if (def.undeclared) return; + if (is_arguments(def)) return; + if (value !== rhs) { + if (is_lhs_read_only(value, compressor)) return; + var referenced = def.references.length - def.replaced; + if (referenced < 2) return; + var expr = candidate.clone(); + expr[expr instanceof AST_Assign ? "right" : "value"] = value; + if (candidate.name_index >= 0) { + expr.name_index = candidate.name_index; + expr.arg_index = candidate.arg_index; + } + candidate = expr; + } + return value_def = def; + } + + function remaining_refs(def) { + return def.references.length - def.replaced - (assignments.get(def.name) || 0); + } + + function get_lhs(expr) { + if (expr instanceof AST_Assign) { + var lhs = expr.left; + if (!(lhs instanceof AST_SymbolRef)) return lhs; + var def = lhs.definition(); + if (scope.uses_arguments && is_funarg(def)) return lhs; + if (compressor.exposed(def)) return lhs; + remaining = remaining_refs(def); + if (def.fixed && lhs.fixed) { + var matches = def.references.filter(function(ref) { + return ref.fixed === lhs.fixed; + }).length - 1; + if (matches < remaining) { + remaining = matches; + assign_pos = 0; + verify_ref = true; + } + } + if (expr.operator == "=") mangleable_var(expr.right); + return lhs; + } + if (expr instanceof AST_Binary) return expr.right.left; + if (expr instanceof AST_Unary) return expr.expression; + if (expr instanceof AST_VarDef) { + var lhs = expr.name; + var def = lhs.definition(); + if (def.const_redefs) return; + if (!member(lhs, def.orig)) return; + if (scope.uses_arguments && is_funarg(def)) return; + var declared = def.orig.length - def.eliminated - (declare_only.get(def.name) || 0); + remaining = remaining_refs(def); + if (def.fixed) remaining = Math.min(remaining, def.references.filter(function(ref) { + if (!ref.fixed) return true; + if (!ref.fixed.assigns) return true; + var assign = ref.fixed.assigns[0]; + return assign === lhs || get_rvalue(assign) === expr.value; + }).length); + if (declared > 1 && !(lhs instanceof AST_SymbolFunarg)) { + mangleable_var(expr.value); + return make_node(AST_SymbolRef, lhs); + } + if (mangleable_var(expr.value) || remaining == 1 && !compressor.exposed(def)) { + return make_node(AST_SymbolRef, lhs); + } + return; + } + } + + function get_rvalue(expr) { + if (expr instanceof AST_Assign) return expr.right; + if (expr instanceof AST_Binary) { + var node = expr.clone(); + node.right = expr.right.right; + return node; + } + if (expr instanceof AST_VarDef) return expr.value; + } + + function invariant(expr) { + if (expr instanceof AST_Array) return false; + if (expr instanceof AST_Binary && lazy_op[expr.operator]) { + return invariant(expr.left) && invariant(expr.right); + } + if (expr instanceof AST_Call) return false; + if (expr instanceof AST_Conditional) { + return invariant(expr.consequent) && invariant(expr.alternative); + } + if (expr instanceof AST_Object) return false; + return !expr.has_side_effects(compressor); + } + + function foldable(expr) { + if (expr instanceof AST_Assign && expr.right.single_use) return; + var lhs_ids = Object.create(null); + var marker = new TreeWalker(function(node) { + if (node instanceof AST_SymbolRef) lhs_ids[node.definition().id] = true; + }); + while (expr instanceof AST_Assign && expr.operator == "=") { + expr.left.walk(marker); + expr = expr.right; + } + if (expr instanceof AST_ObjectIdentity) return rhs_exact_match; + if (expr instanceof AST_SymbolRef) { + var value = expr.evaluate(compressor); + if (value === expr) return rhs_exact_match; + return rhs_fuzzy_match(value, rhs_exact_match); + } + if (expr.is_truthy()) return rhs_fuzzy_match(true, return_false); + if (expr.is_constant()) { + var ev = expr.evaluate(compressor); + if (!(ev instanceof AST_Node)) return rhs_fuzzy_match(ev, rhs_exact_match); + } + if (!(lhs instanceof AST_SymbolRef)) return false; + if (!invariant(expr)) return false; + var circular; + expr.walk(new TreeWalker(function(node) { + if (circular) return true; + if (node instanceof AST_SymbolRef && lhs_ids[node.definition().id]) circular = true; + })); + return !circular && rhs_exact_match; + + function rhs_exact_match(node) { + return expr.equals(node); + } + } + + function rhs_fuzzy_match(value, fallback) { + return function(node, tw) { + if (tw.in_boolean_context()) { + if (value && node.is_truthy() && !node.has_side_effects(compressor)) { + return true; + } + if (node.is_constant()) { + var ev = node.evaluate(compressor); + if (!(ev instanceof AST_Node)) return !ev == !value; + } + } + return fallback(node); + }; + } + + function clear_write_only(assign) { + while (assign.write_only) { + assign.write_only = false; + if (!(assign instanceof AST_Assign)) break; + assign = assign.right; + } + } + + function update_symbols(value, node) { + var scope = node.scope || find_scope(scanner) || block_scope; + value.walk(new TreeWalker(function(node) { + if (node instanceof AST_BlockScope) return true; + if (node instanceof AST_Symbol) node.scope = scope; + })); + } + + function may_be_global(node) { + if (node instanceof AST_SymbolRef) { + node = node.fixed_value(); + if (!node) return true; + } + if (node instanceof AST_Assign) return node.operator == "=" && may_be_global(node.right); + return node instanceof AST_PropAccess || node instanceof AST_ObjectIdentity; + } + + function get_lvalues(expr) { + var lvalues = new Dictionary(); + if (expr instanceof AST_VarDef) { + if (!expr.name.definition().fixed) well_defined = false; + lvalues.add(expr.name.name, lhs); + } + var find_arguments = scope.uses_arguments && !compressor.has_directive("use strict"); + var scan_toplevel = scope instanceof AST_Toplevel; + var tw = new TreeWalker(function(node) { + var value; + if (node instanceof AST_SymbolRef) { + value = node.fixed_value(); + if (!value) { + value = node; + var def = node.definition(); + var escaped = node.fixed && node.fixed.escaped || def.escaped; + if (!def.undeclared + && (def.assignments || !escaped || escaped.cross_scope) + && (has_escaped(def, node.scope, node, tw.parent()) || !same_scope(def))) { + well_defined = false; + } + } + } else if (node instanceof AST_ObjectIdentity) { + value = node; + } + if (value) { + lvalues.add(node.name, is_modified(compressor, tw, node, value, 0)); + } else if (node instanceof AST_Lambda) { + for (var level = 0, parent, child = node; parent = tw.parent(level++); child = parent) { + if (parent instanceof AST_Assign) { + if (parent.left === child) break; + if (parent.operator == "=") continue; + if (lazy_op[parent.operator.slice(0, -1)]) continue; + break; + } + if (parent instanceof AST_Binary) { + if (lazy_op[parent.operator]) continue; + break; + } + if (parent instanceof AST_Call) return; + if (parent instanceof AST_Scope) return; + if (parent instanceof AST_Sequence) { + if (parent.tail_node() === child) continue; + break; + } + if (parent instanceof AST_Template) { + if (parent.tag) return; + break; + } + } + node.enclosed.forEach(function(def) { + if (def.scope !== node) enclosed.set(def.name, true); + }); + return true; + } else if (find_arguments && node instanceof AST_Sub) { + scope.each_argname(function(argname) { + if (!compressor.option("reduce_vars") || argname.definition().assignments) { + if (!argname.definition().fixed) well_defined = false; + lvalues.add(argname.name, true); + } + }); + find_arguments = false; + } + if (!scan_toplevel) return; + if (node.TYPE == "Call") { + if (modify_toplevel) return; + var exp = node.expression; + if (exp instanceof AST_PropAccess) return; + if (exp instanceof AST_LambdaExpression && !exp.contains_this()) return; + modify_toplevel = true; + } else if (node instanceof AST_PropAccess && may_be_global(node.expression)) { + if (node === lhs && !(expr instanceof AST_Unary)) { + modify_toplevel = true; + } else { + read_toplevel = true; + } + } + }); + expr.walk(tw); + return lvalues; + } + + function remove_candidate(expr) { + var value = rvalue === rhs_value ? null : make_sequence(rhs_value, rhs_value.expressions.slice(0, -1)); + var index = expr.name_index; + if (index >= 0) { + var args, argname = scope.argnames[index]; + if (argname instanceof AST_DefaultValue) { + scope.argnames[index] = argname = argname.clone(); + argname.value = value || make_node(AST_Number, argname, { value: 0 }); + } else if ((args = compressor.parent().args)[index]) { + scope.argnames[index] = argname.clone(); + args[index] = value || make_node(AST_Number, args[index], { value: 0 }); + } + return; + } + var end = hit_stack.length - 1; + var last = hit_stack[end]; + if (last instanceof AST_VarDef || hit_stack[end - 1].body === last) end--; + var tt = new TreeTransformer(function(node, descend, in_list) { + if (hit) return node; + if (node !== hit_stack[hit_index]) return node; + hit_index++; + if (hit_index <= end) return handle_custom_scan_order(node, tt); + hit = true; + if (node instanceof AST_Definitions) { + declare_only.set(last.name.name, (declare_only.get(last.name.name) || 0) + 1); + if (value_def) value_def.replaced++; + var defns = node.definitions; + var index = defns.indexOf(last); + var defn = last.clone(); + defn.value = null; + if (!value) { + node.definitions[index] = defn; + return node; + } + var body = [ make_node(AST_SimpleStatement, value, { body: value }) ]; + if (index > 0) { + var head = node.clone(); + head.definitions = defns.slice(0, index); + body.unshift(head); + node = node.clone(); + node.definitions = defns.slice(index); + } + body.push(node); + node.definitions[0] = defn; + return in_list ? List.splice(body) : make_node(AST_BlockStatement, node, { body: body }); + } + if (!value) return in_list ? List.skip : null; + return is_statement(node) ? make_node(AST_SimpleStatement, value, { body: value }) : value; + }, function(node, in_list) { + if (node instanceof AST_For) return patch_for_init(node, in_list); + return patch_sequence(node, tt); + }); + abort = false; + hit = false; + hit_index = 0; + if (!(statements[stat_index] = statements[stat_index].transform(tt))) statements.splice(stat_index, 1); + } + + function patch_sequence(node, tt) { + if (node instanceof AST_Sequence) switch (node.expressions.length) { + case 0: return null; + case 1: return maintain_this_binding(tt.parent(), node, node.expressions[0]); + } + } + + function is_lhs_local(lhs) { + var sym = root_expr(lhs); + if (!(sym instanceof AST_SymbolRef)) return false; + if (sym.definition().scope.resolve() !== scope) return false; + if (!in_loop) return true; + if (compound) return false; + if (candidate instanceof AST_Unary) return false; + var lvalue = lvalues.get(sym.name); + return !lvalue || lvalue[0] === lhs; + } + + function value_has_side_effects() { + if (candidate instanceof AST_Unary) return false; + return rvalue.has_side_effects(compressor); + } + + function replace_all_symbols(expr) { + if (expr instanceof AST_Unary) return false; + if (side_effects) return false; + if (value_def) return true; + if (!(lhs instanceof AST_SymbolRef)) return false; + var referenced; + if (expr instanceof AST_VarDef) { + referenced = 1; + } else if (expr.operator == "=") { + referenced = 2; + } else { + return false; + } + var def = lhs.definition(); + if (def.references.length - def.replaced == referenced) return true; + if (!def.fixed) return false; + if (!lhs.fixed) return false; + var assigns = lhs.fixed.assigns; + var matched = 0; + if (!all(def.references, function(ref, index) { + var fixed = ref.fixed; + if (!fixed) return false; + if (fixed.to_binary || fixed.to_prefix) return false; + if (fixed === lhs.fixed) { + matched++; + return true; + } + return assigns && fixed.assigns && assigns[0] !== fixed.assigns[0]; + })) return false; + if (matched != referenced) return false; + verify_ref = true; + return true; + } + + function symbol_in_lvalues(sym, parent) { + var lvalue = lvalues.get(sym.name); + if (!lvalue || all(lvalue, function(lhs) { + return !lhs; + })) return; + if (lvalue[0] !== lhs) return true; + scan_rhs = false; + } + + function may_modify(sym) { + var def = sym.definition(); + if (def.orig.length == 1 && def.orig[0] instanceof AST_SymbolDefun) return false; + if (def.scope.resolve() !== scope) return true; + if (modify_toplevel && compressor.exposed(def)) return true; + return !all(def.references, function(ref) { + return ref.scope.resolve(true) === scope; + }); + } + + function side_effects_external(node, lhs) { + if (node instanceof AST_Assign) return side_effects_external(node.left, true); + if (node instanceof AST_Unary) return side_effects_external(node.expression, true); + if (node instanceof AST_VarDef) return node.value && side_effects_external(node.value); + if (lhs) { + if (node instanceof AST_Dot) return side_effects_external(node.expression, true); + if (node instanceof AST_Sub) return side_effects_external(node.expression, true); + if (node instanceof AST_SymbolRef) return node.definition().scope.resolve() !== scope; + } + return false; + } + } + + function eliminate_spurious_blocks(statements) { + var changed = false, seen_dirs = []; + for (var i = 0; i < statements.length;) { + var stat = statements[i]; + if (stat instanceof AST_BlockStatement) { + if (all(stat.body, safe_to_trim)) { + changed = true; + eliminate_spurious_blocks(stat.body); + [].splice.apply(statements, [i, 1].concat(stat.body)); + i += stat.body.length; + continue; + } + } + if (stat instanceof AST_Directive) { + if (member(stat.value, seen_dirs)) { + changed = true; + statements.splice(i, 1); + continue; + } + seen_dirs.push(stat.value); + } + if (stat instanceof AST_EmptyStatement) { + changed = true; + statements.splice(i, 1); + continue; + } + i++; + } + return changed; + } + + function handle_if_return(statements, compressor) { + var changed = false; + var parent = compressor.parent(); + var self = compressor.self(); + var declare_only, jump, merge_jump; + var in_iife = in_lambda && parent && parent.TYPE == "Call" && parent.expression === self; + var chain_if_returns = in_lambda && compressor.option("conditionals") && compressor.option("sequences"); + var drop_return_void = !(in_try && in_try.bfinally && in_async_generator(scope)); + var multiple_if_returns = has_multiple_if_returns(statements); + for (var i = statements.length; --i >= 0;) { + var stat = statements[i]; + var j = next_index(i); + var next = statements[j]; + + if (in_lambda && declare_only && !next && stat instanceof AST_Return + && drop_return_void && !(self instanceof AST_SwitchBranch)) { + var body = stat.value; + if (!body) { + changed = true; + statements.splice(i, 1); + continue; + } + var tail = body.tail_node(); + if (is_undefined(tail)) { + changed = true; + if (body instanceof AST_UnaryPrefix) { + body = body.expression; + } else if (tail instanceof AST_UnaryPrefix) { + body = body.clone(); + body.expressions[body.expressions.length - 1] = tail.expression; + } + statements[i] = make_node(AST_SimpleStatement, stat, { body: body }); + continue; + } + } + + if (stat instanceof AST_If) { + var ab = aborts(stat.body); + // if (foo()) { bar(); return; } else baz(); moo(); ---> if (foo()) bar(); else { baz(); moo(); } + if (can_merge_flow(ab)) { + if (ab.label) remove(ab.label.thedef.references, ab); + changed = true; + stat = stat.clone(); + stat.body = make_node(AST_BlockStatement, stat, { + body: as_statement_array_with_return(stat.body, ab), + }); + stat.alternative = make_node(AST_BlockStatement, stat, { + body: as_statement_array(stat.alternative).concat(extract_functions(merge_jump, jump)), + }); + adjust_refs(ab.value, merge_jump); + statements[i] = stat; + statements[i] = stat.transform(compressor); + continue; + } + // if (foo()) { bar(); return x; } return y; ---> if (!foo()) return y; bar(); return x; + if (ab && !stat.alternative && next instanceof AST_Jump) { + var cond = stat.condition; + var preference = i + 1 == j && stat.body instanceof AST_BlockStatement; + cond = best_of_expression(cond, cond.negate(compressor), preference); + if (cond !== stat.condition) { + changed = true; + stat = stat.clone(); + stat.condition = cond; + var body = stat.body; + stat.body = make_node(AST_BlockStatement, next, { + body: extract_functions(true, null, j + 1), + }); + statements.splice(i, 1, stat, body); + // proceed further only if `TreeWalker.stack` is in a consistent state + // https://github.com/mishoo/UglifyJS/issues/5595 + // https://github.com/mishoo/UglifyJS/issues/5597 + if (!in_lambda || self instanceof AST_Block && self.body === statements) { + statements[i] = stat.transform(compressor); + } + continue; + } + } + var alt = aborts(stat.alternative); + // if (foo()) bar(); else { baz(); return; } moo(); ---> if (foo()) { bar(); moo(); } else baz(); + if (can_merge_flow(alt)) { + if (alt.label) remove(alt.label.thedef.references, alt); + changed = true; + stat = stat.clone(); + stat.body = make_node(AST_BlockStatement, stat.body, { + body: as_statement_array(stat.body).concat(extract_functions(merge_jump, jump)), + }); + stat.alternative = make_node(AST_BlockStatement, stat.alternative, { + body: as_statement_array_with_return(stat.alternative, alt), + }); + adjust_refs(alt.value, merge_jump); + statements[i] = stat; + statements[i] = stat.transform(compressor); + continue; + } + if (compressor.option("typeofs")) { + if (ab && !alt) { + var stats = make_node(AST_BlockStatement, self, { body: statements.slice(i + 1) }); + mark_locally_defined(stat.condition, null, stats); + } + if (!ab && alt) { + var stats = make_node(AST_BlockStatement, self, { body: statements.slice(i + 1) }); + mark_locally_defined(stat.condition, stats); + } + } + } + + if (stat instanceof AST_If && stat.body instanceof AST_Return) { + var value = stat.body.value; + var in_bool = stat.body.in_bool || next instanceof AST_Return && next.in_bool; + // if (foo()) return x; return y; ---> return foo() ? x : y; + if (!stat.alternative && next instanceof AST_Return + && (drop_return_void || !value == !next.value)) { + changed = true; + stat = stat.clone(); + stat.alternative = make_node(AST_BlockStatement, next, { + body: extract_functions(true, null, j + 1), + }); + statements[i] = stat; + statements[i] = stat.transform(compressor); + continue; + } + // if (foo()) return x; [ return ; ] ---> return foo() ? x : undefined; + // if (foo()) return bar() ? x : void 0; ---> return foo() && bar() ? x : void 0; + // if (foo()) return bar() ? void 0 : x; ---> return !foo() || bar() ? void 0 : x; + if (in_lambda && declare_only && !next && !stat.alternative && (in_bool + || value && multiple_if_returns + || value instanceof AST_Conditional && (is_undefined(value.consequent, compressor) + || is_undefined(value.alternative, compressor)))) { + changed = true; + stat = stat.clone(); + stat.alternative = make_node(AST_Return, stat, { value: null }); + statements[i] = stat; + statements[i] = stat.transform(compressor); + continue; + } + // if (a) return b; if (c) return d; e; ---> return a ? b : c ? d : void e; + // + // if sequences is not enabled, this can lead to an endless loop (issue #866). + // however, with sequences on this helps producing slightly better output for + // the example code. + var prev, prev_stat; + if (chain_if_returns && !stat.alternative + && (!(prev_stat = statements[prev = prev_index(i)]) && in_iife + || prev_stat instanceof AST_If && prev_stat.body instanceof AST_Return) + && (!next ? !declare_only + : next instanceof AST_SimpleStatement && next_index(j) == statements.length)) { + changed = true; + var exprs = []; + stat = stat.clone(); + exprs.push(stat.condition); + stat.condition = make_sequence(stat, exprs); + stat.alternative = make_node(AST_BlockStatement, self, { + body: extract_functions().concat(make_node(AST_Return, self, { value: null })), + }); + statements[i] = stat.transform(compressor); + i = prev + 1; + continue; + } + } + + if (stat instanceof AST_Break || stat instanceof AST_Exit) { + jump = stat; + continue; + } + + if (declare_only && jump && jump === next) eliminate_returns(stat); + } + return changed; + + function has_multiple_if_returns(statements) { + var n = 0; + for (var i = statements.length; --i >= 0;) { + var stat = statements[i]; + if (stat instanceof AST_If && stat.body instanceof AST_Return) { + if (++n > 1) return true; + } + } + return false; + } + + function match_target(target) { + return last_of(compressor, function(node) { + return node === target; + }); + } + + function match_return(ab, exact) { + if (!jump) return false; + if (jump.TYPE != ab.TYPE) return false; + var value = ab.value; + if (!value) return false; + var equals = jump.equals(ab); + if (!equals && value instanceof AST_Sequence) { + value = value.tail_node(); + if (jump.value && jump.value.equals(value)) equals = 2; + } + if (!equals && !exact && jump.value instanceof AST_Sequence) { + if (jump.value.tail_node().equals(value)) equals = 3; + } + return equals; + } + + function can_drop_abort(ab) { + if (ab instanceof AST_Exit) { + if (merge_jump = match_return(ab)) return true; + if (!in_lambda) return false; + if (!(ab instanceof AST_Return)) return false; + var value = ab.value; + if (value && !is_undefined(value.tail_node())) return false; + if (!(self instanceof AST_SwitchBranch)) return true; + if (!jump) return false; + if (jump instanceof AST_Exit && jump.value) return false; + merge_jump = 4; + return true; + } + if (!(ab instanceof AST_LoopControl)) return false; + if (self instanceof AST_SwitchBranch) { + if (jump instanceof AST_Exit) { + if (!in_lambda) return false; + if (jump.value) return false; + merge_jump = true; + } else if (jump) { + if (compressor.loopcontrol_target(jump) !== parent) return false; + merge_jump = true; + } else if (jump === false) { + return false; + } + } + var lct = compressor.loopcontrol_target(ab); + if (ab instanceof AST_Continue) return match_target(loop_body(lct)); + if (lct instanceof AST_IterationStatement) return false; + return match_target(lct); + } + + function can_merge_flow(ab) { + merge_jump = false; + if (!can_drop_abort(ab)) return false; + for (var j = statements.length; --j > i;) { + var stat = statements[j]; + if (stat instanceof AST_DefClass) { + if (stat.name.definition().preinit) return false; + } else if (stat instanceof AST_Const || stat instanceof AST_Let) { + if (!all(stat.definitions, function(defn) { + return !defn.name.match_symbol(function(node) { + return node instanceof AST_SymbolDeclaration && node.definition().preinit; + }); + })) return false; + } + } + return true; + } + + function extract_functions(mode, stop, end) { + var defuns = []; + var lexical = false; + var start = i + 1; + if (!mode) { + end = statements.length; + jump = null; + } else if (stop) { + end = statements.lastIndexOf(stop); + } else { + stop = statements[end]; + if (stop !== jump) jump = false; + } + var tail = statements.splice(start, end - start).filter(function(stat) { + if (stat instanceof AST_LambdaDefinition) { + defuns.push(stat); + return false; + } + if (is_lexical_definition(stat)) lexical = true; + return true; + }); + if (mode === 3) { + tail.push(make_node(AST_SimpleStatement, stop.value, { + body: make_sequence(stop.value, stop.value.expressions.slice(0, -1)), + })); + stop.value = stop.value.tail_node(); + } + [].push.apply(lexical ? tail : statements, defuns); + return tail; + } + + function trim_return(value, mode) { + if (value) switch (mode) { + case 4: + return value; + case 3: + if (!(value instanceof AST_Sequence)) break; + case 2: + return make_sequence(value, value.expressions.slice(0, -1)); + } + } + + function as_statement_array_with_return(node, ab) { + var body = as_statement_array(node); + var block = body, last; + while ((last = block[block.length - 1]) !== ab) { + block = last.body; + } + block.pop(); + var value = ab.value; + if (merge_jump) value = trim_return(value, merge_jump); + if (value) block.push(make_node(AST_SimpleStatement, value, { body: value })); + return body; + } + + function adjust_refs(value, mode) { + if (!mode) return; + if (!value) return; + switch (mode) { + case 4: + return; + case 3: + case 2: + value = value.tail_node(); + } + merge_expression(value, jump.value); + } + + function next_index(i) { + declare_only = true; + for (var j = i; ++j < statements.length;) { + var stat = statements[j]; + if (is_declaration(stat)) continue; + if (stat instanceof AST_Var) { + declare_only = false; + continue; + } + break; + } + return j; + } + + function prev_index(i) { + for (var j = i; --j >= 0;) { + var stat = statements[j]; + if (stat instanceof AST_Var) continue; + if (is_declaration(stat)) continue; + break; + } + return j; + } + + function eliminate_returns(stat, keep_throws, in_block) { + if (stat instanceof AST_Exit) { + var mode = !(keep_throws && stat instanceof AST_Throw) && match_return(stat, true); + if (mode) { + changed = true; + var value = trim_return(stat.value, mode); + if (value) return make_node(AST_SimpleStatement, value, { body: value }); + return in_block ? null : make_node(AST_EmptyStatement, stat); + } + } else if (stat instanceof AST_If) { + stat.body = eliminate_returns(stat.body, keep_throws); + if (stat.alternative) stat.alternative = eliminate_returns(stat.alternative, keep_throws); + } else if (stat instanceof AST_LabeledStatement) { + stat.body = eliminate_returns(stat.body, keep_throws); + } else if (stat instanceof AST_Try) { + if (!stat.bfinally || !jump.value || jump.value.is_constant()) { + if (stat.bcatch) eliminate_returns(stat.bcatch, keep_throws); + var trimmed = eliminate_returns(stat.body.pop(), true, true); + if (trimmed) stat.body.push(trimmed); + } + } else if (stat instanceof AST_Block && !(stat instanceof AST_Scope || stat instanceof AST_Switch)) { + var trimmed = eliminate_returns(stat.body.pop(), keep_throws, true); + if (trimmed) stat.body.push(trimmed); + } + return stat; + } + } + + function eliminate_dead_code(statements, compressor) { + var has_quit; + var self = compressor.self(); + if (self instanceof AST_Catch) { + self = compressor.parent(); + } else if (self instanceof AST_LabeledStatement) { + self = self.body; + } + for (var i = 0, n = 0, len = statements.length; i < len; i++) { + var stat = statements[i]; + if (stat instanceof AST_LoopControl) { + var lct = compressor.loopcontrol_target(stat); + if (loop_body(lct) !== self + || stat instanceof AST_Break && lct instanceof AST_IterationStatement) { + statements[n++] = stat; + } else if (stat.label) { + remove(stat.label.thedef.references, stat); + } + } else { + statements[n++] = stat; + } + if (aborts(stat)) { + has_quit = statements.slice(i + 1); + break; + } + } + statements.length = n; + if (has_quit) has_quit.forEach(function(stat) { + extract_declarations_from_unreachable_code(compressor, stat, statements); + }); + return statements.length != len; + } + + function trim_awaits(statements, compressor) { + if (!in_lambda || in_try && in_try.bfinally) return; + var changed = false; + for (var index = statements.length; --index >= 0;) { + var stat = statements[index]; + if (!(stat instanceof AST_SimpleStatement)) break; + var node = stat.body; + if (!(node instanceof AST_Await)) break; + var exp = node.expression; + if (!needs_enqueuing(compressor, exp)) break; + changed = true; + exp = exp.drop_side_effect_free(compressor, true); + if (exp) { + stat.body = exp; + break; + } + } + statements.length = index + 1; + return changed; + } + + function inline_iife(statements, compressor) { + var changed = false; + var index = statements.length - 1; + if (in_lambda && index >= 0) { + var no_return = in_try && in_try.bfinally && in_async_generator(scope); + var inlined = statements[index].try_inline(compressor, block_scope, no_return); + if (inlined) { + statements[index--] = inlined; + changed = true; + } + } + var loop = in_loop && in_try && in_try.bfinally ? "try" : in_loop; + for (; index >= 0; index--) { + var inlined = statements[index].try_inline(compressor, block_scope, true, loop); + if (!inlined) continue; + statements[index] = inlined; + changed = true; + } + return changed; + } + + function sequencesize(statements, compressor) { + if (statements.length < 2) return; + var seq = [], n = 0; + function push_seq() { + if (!seq.length) return; + var body = make_sequence(seq[0], seq); + statements[n++] = make_node(AST_SimpleStatement, body, { body: body }); + seq = []; + } + for (var i = 0, len = statements.length; i < len; i++) { + var stat = statements[i]; + if (stat instanceof AST_SimpleStatement) { + if (seq.length >= compressor.sequences_limit) push_seq(); + merge_sequence(seq, stat.body); + } else if (is_declaration(stat)) { + statements[n++] = stat; + } else { + push_seq(); + statements[n++] = stat; + } + } + push_seq(); + statements.length = n; + return n != len; + } + + function to_simple_statement(block, decls) { + if (!(block instanceof AST_BlockStatement)) return block; + var stat = null; + for (var i = 0; i < block.body.length; i++) { + var line = block.body[i]; + if (line instanceof AST_Var && declarations_only(line)) { + decls.push(line); + } else if (stat || is_lexical_definition(line)) { + return false; + } else { + stat = line; + } + } + return stat; + } + + function sequencesize_2(statements, compressor) { + var changed = false, n = 0, prev; + for (var i = 0; i < statements.length; i++) { + var stat = statements[i]; + if (prev) { + if (stat instanceof AST_Exit) { + if (stat.value || !in_async_generator(scope)) { + stat.value = cons_seq(stat.value || make_node(AST_Undefined, stat)).optimize(compressor); + } + } else if (stat instanceof AST_For) { + if (!(stat.init instanceof AST_Definitions)) { + var abort = false; + prev.body.walk(new TreeWalker(function(node) { + if (abort || node instanceof AST_Scope) return true; + if (node instanceof AST_Binary && node.operator == "in") { + abort = true; + return true; + } + })); + if (!abort) { + if (stat.init) stat.init = cons_seq(stat.init); + else { + stat.init = prev.body; + n--; + changed = true; + } + } + } + } else if (stat instanceof AST_ForIn) { + if (!is_lexical_definition(stat.init)) stat.object = cons_seq(stat.object); + } else if (stat instanceof AST_If) { + stat.condition = cons_seq(stat.condition); + } else if (stat instanceof AST_Switch) { + stat.expression = cons_seq(stat.expression); + } else if (stat instanceof AST_With) { + stat.expression = cons_seq(stat.expression); + } + } + if (compressor.option("conditionals") && stat instanceof AST_If) { + var decls = []; + var body = to_simple_statement(stat.body, decls); + var alt = to_simple_statement(stat.alternative, decls); + if (body !== false && alt !== false && decls.length > 0) { + var len = decls.length; + decls.push(make_node(AST_If, stat, { + condition: stat.condition, + body: body || make_node(AST_EmptyStatement, stat.body), + alternative: alt, + })); + decls.unshift(n, 1); + [].splice.apply(statements, decls); + i += len; + n += len + 1; + prev = null; + changed = true; + continue; + } + } + statements[n++] = stat; + prev = stat instanceof AST_SimpleStatement ? stat : null; + } + statements.length = n; + return changed; + + function cons_seq(right) { + n--; + changed = true; + var left = prev.body; + return make_sequence(left, [ left, right ]); + } + } + + function extract_exprs(body) { + if (body instanceof AST_Assign) return [ body ]; + if (body instanceof AST_Sequence) return body.expressions.slice(); + } + + function join_assigns(defn, body, keep) { + var exprs = extract_exprs(body); + if (!exprs) return; + keep = keep || 0; + var trimmed = false; + for (var i = exprs.length - keep; --i >= 0;) { + var expr = exprs[i]; + if (!can_trim(expr)) continue; + var tail; + if (expr.left instanceof AST_SymbolRef) { + tail = exprs.slice(i + 1); + } else if (expr.left instanceof AST_PropAccess && can_trim(expr.left.expression)) { + tail = exprs.slice(i + 1); + var flattened = expr.clone(); + expr = expr.left.expression; + flattened.left = flattened.left.clone(); + flattened.left.expression = expr.left.clone(); + tail.unshift(flattened); + } else { + continue; + } + if (tail.length == 0) continue; + if (!trim_assigns(expr.left, expr.right, tail)) continue; + trimmed = true; + exprs = exprs.slice(0, i).concat(expr, tail); + } + if (defn instanceof AST_Definitions) { + for (var i = defn.definitions.length; --i >= 0;) { + var def = defn.definitions[i]; + if (!def.value) continue; + if (trim_assigns(def.name, def.value, exprs)) trimmed = true; + if (merge_conditional_assignments(def, exprs, keep)) trimmed = true; + break; + } + if (defn instanceof AST_Var && join_var_assign(defn.definitions, exprs, keep)) trimmed = true; + } + return trimmed && exprs; + + function can_trim(node) { + return node instanceof AST_Assign && node.operator == "="; + } + } + + function merge_assigns(prev, defn) { + if (!(prev instanceof AST_SimpleStatement)) return; + if (declarations_only(defn)) return; + var exprs = extract_exprs(prev.body); + if (!exprs) return; + var definitions = []; + if (!join_var_assign(definitions, exprs.reverse(), 0)) return; + defn.definitions = definitions.reverse().concat(defn.definitions); + return exprs.reverse(); + } + + function merge_conditional_assignments(var_def, exprs, keep) { + if (!compressor.option("conditionals")) return; + if (var_def.name instanceof AST_Destructured) return; + var trimmed = false; + var def = var_def.name.definition(); + while (exprs.length > keep) { + var cond = to_conditional_assignment(compressor, def, var_def.value, exprs[0]); + if (!cond) break; + var_def.value = cond; + exprs.shift(); + trimmed = true; + } + return trimmed; + } + + function join_var_assign(definitions, exprs, keep) { + var trimmed = false; + while (exprs.length > keep) { + var expr = exprs[0]; + if (!(expr instanceof AST_Assign)) break; + if (expr.operator != "=") break; + var lhs = expr.left; + if (!(lhs instanceof AST_SymbolRef)) break; + if (is_undeclared_ref(lhs)) break; + if (lhs.scope.resolve() !== scope) break; + var def = lhs.definition(); + if (def.scope !== scope) break; + if (def.orig.length > def.eliminated + 1) break; + if (def.orig[0].TYPE != "SymbolVar") break; + var name = make_node(AST_SymbolVar, lhs); + definitions.push(make_node(AST_VarDef, expr, { + name: name, + value: expr.right, + })); + def.orig.push(name); + def.replaced++; + exprs.shift(); + trimmed = true; + } + return trimmed; + } + + function trim_assigns(name, value, exprs) { + var names = new Dictionary(); + names.set(name.name, true); + while (value instanceof AST_Assign && value.operator == "=") { + if (value.left instanceof AST_SymbolRef) names.set(value.left.name, true); + value = value.right; + } + if (!(value instanceof AST_Object)) return; + var trimmed = false; + do { + if (!try_join(exprs[0])) break; + exprs.shift(); + trimmed = true; + } while (exprs.length); + return trimmed; + + function try_join(node) { + if (!(node instanceof AST_Assign)) return; + if (node.operator != "=") return; + if (!(node.left instanceof AST_PropAccess)) return; + var sym = node.left.expression; + if (!(sym instanceof AST_SymbolRef)) return; + if (!names.has(sym.name)) return; + if (!node.right.is_constant_expression(scope)) return; + var prop = node.left.property; + if (prop instanceof AST_Node) { + if (try_join(prop)) prop = node.left.property = prop.right.clone(); + prop = prop.evaluate(compressor); + } + if (prop instanceof AST_Node) return; + prop = "" + prop; + var diff = prop == "__proto__" || compressor.has_directive("use strict") ? function(node) { + var key = node.key; + return typeof key == "string" && key != prop && key != "__proto__"; + } : function(node) { + var key = node.key; + if (node instanceof AST_ObjectGetter || node instanceof AST_ObjectSetter) { + return typeof key == "string" && key != prop; + } + return key !== "__proto__"; + }; + if (!all(value.properties, diff)) return; + value.properties.push(make_node(AST_ObjectKeyVal, node, { + key: prop, + value: node.right, + })); + return true; + } + } + + function join_consecutive_vars(statements) { + var changed = false, defs; + for (var i = 0, j = -1; i < statements.length; i++) { + var stat = statements[i]; + var prev = statements[j]; + if (stat instanceof AST_Definitions) { + if (prev && prev.TYPE == stat.TYPE) { + prev.definitions = prev.definitions.concat(stat.definitions); + changed = true; + } else if (defs && defs.TYPE == stat.TYPE && declarations_only(stat)) { + defs.definitions = defs.definitions.concat(stat.definitions); + changed = true; + } else if (stat instanceof AST_Var) { + var exprs = merge_assigns(prev, stat); + if (exprs) { + if (exprs.length) { + prev.body = make_sequence(prev, exprs); + j++; + } + changed = true; + } else { + j++; + } + statements[j] = defs = stat; + } else { + statements[++j] = stat; + } + continue; + } else if (stat instanceof AST_Exit) { + stat.value = join_assigns_expr(stat.value); + } else if (stat instanceof AST_For) { + var exprs = join_assigns(prev, stat.init); + if (exprs) { + changed = true; + stat.init = exprs.length ? make_sequence(stat.init, exprs) : null; + } else if (prev instanceof AST_Var && (!stat.init || stat.init.TYPE == prev.TYPE)) { + if (stat.init) { + prev.definitions = prev.definitions.concat(stat.init.definitions); + } + stat = stat.clone(); + defs = stat.init = prev; + statements[j] = merge_defns(stat); + changed = true; + continue; + } else if (defs && stat.init && defs.TYPE == stat.init.TYPE && declarations_only(stat.init)) { + defs.definitions = defs.definitions.concat(stat.init.definitions); + stat.init = null; + changed = true; + } else if (stat.init instanceof AST_Var) { + defs = stat.init; + exprs = merge_assigns(prev, stat.init); + if (exprs) { + changed = true; + if (exprs.length == 0) { + statements[j] = merge_defns(stat); + continue; + } + prev.body = make_sequence(prev, exprs); + } + } + } else if (stat instanceof AST_ForEnumeration) { + if (defs && defs.TYPE == stat.init.TYPE) { + var defns = defs.definitions.slice(); + stat.init = stat.init.definitions[0].name.convert_symbol(AST_SymbolRef, function(ref, name) { + defns.push(make_node(AST_VarDef, name, { + name: name, + value: null, + })); + name.definition().references.push(ref); + }); + defs.definitions = defns; + changed = true; + } + stat.object = join_assigns_expr(stat.object); + } else if (stat instanceof AST_If) { + stat.condition = join_assigns_expr(stat.condition); + } else if (stat instanceof AST_SimpleStatement) { + var exprs = join_assigns(prev, stat.body), next; + if (exprs) { + changed = true; + if (!exprs.length) continue; + stat.body = make_sequence(stat.body, exprs); + } else if (prev instanceof AST_Definitions + && (next = statements[i + 1]) + && prev.TYPE == next.TYPE + && (next = next.definitions[0]).value) { + changed = true; + next.value = make_sequence(stat, [ stat.body, next.value ]); + continue; + } + } else if (stat instanceof AST_Switch) { + stat.expression = join_assigns_expr(stat.expression); + } else if (stat instanceof AST_With) { + stat.expression = join_assigns_expr(stat.expression); + } + statements[++j] = defs ? merge_defns(stat) : stat; + } + statements.length = j + 1; + return changed; + + function join_assigns_expr(value) { + var exprs = join_assigns(prev, value, 1); + if (!exprs) return value; + changed = true; + var tail = value.tail_node(); + if (exprs[exprs.length - 1] !== tail) exprs.push(tail.left); + return make_sequence(value, exprs); + } + + function merge_defns(stat) { + return stat.transform(new TreeTransformer(function(node, descend, in_list) { + if (node instanceof AST_Definitions) { + if (defs === node) return node; + if (defs.TYPE != node.TYPE) return node; + var parent = this.parent(); + if (parent instanceof AST_ForEnumeration && parent.init === node) return node; + if (!declarations_only(node)) return node; + defs.definitions = defs.definitions.concat(node.definitions); + changed = true; + if (parent instanceof AST_For && parent.init === node) return null; + return in_list ? List.skip : make_node(AST_EmptyStatement, node); + } + if (node instanceof AST_ExportDeclaration) return node; + if (node instanceof AST_Scope) return node; + if (!is_statement(node)) return node; + })); + } + } + } + + function extract_declarations_from_unreachable_code(compressor, stat, target) { + var block; + var dropped = false; + stat.walk(new TreeWalker(function(node, descend) { + if (node instanceof AST_DefClass) { + node.extends = null; + node.properties = []; + push(node); + return true; + } + if (node instanceof AST_Definitions) { + var defns = []; + if (node.remove_initializers(compressor, defns)) { + AST_Node.warn("Dropping initialization in unreachable code [{start}]", node); + } + if (defns.length > 0) { + node.definitions = defns; + push(node); + } + return true; + } + if (node instanceof AST_LambdaDefinition) { + push(node); + return true; + } + if (node instanceof AST_Scope) return true; + if (node instanceof AST_BlockScope) { + var save = block; + block = []; + descend(); + if (block.required) { + target.push(make_node(AST_BlockStatement, stat, { body: block })); + } else if (block.length) { + [].push.apply(target, block); + } + block = save; + return true; + } + if (!(node instanceof AST_LoopControl)) dropped = true; + })); + if (dropped) AST_Node.warn("Dropping unreachable code [{start}]", stat); + + function push(node) { + if (block) { + block.push(node); + if (!safe_to_trim(node)) block.required = true; + } else { + target.push(node); + } + } + } + + function is_undefined(node, compressor) { + return node == null + || node.is_undefined + || node instanceof AST_Undefined + || node instanceof AST_UnaryPrefix + && node.operator == "void" + && !(compressor && node.expression.has_side_effects(compressor)); + } + + // in_strict_mode() + // return true if scope executes in Strict Mode + (function(def) { + def(AST_Class, return_true); + def(AST_Scope, function(compressor) { + var body = this.body; + for (var i = 0; i < body.length; i++) { + var stat = body[i]; + if (!(stat instanceof AST_Directive)) break; + if (stat.value == "use strict") return true; + } + var parent = this.parent_scope; + if (!parent) return compressor.option("module"); + return parent.resolve(true).in_strict_mode(compressor); + }); + })(function(node, func) { + node.DEFMETHOD("in_strict_mode", func); + }); + + // is_truthy() + // return true if `!!node === true` + (function(def) { + def(AST_Node, return_false); + def(AST_Array, return_true); + def(AST_Assign, function() { + return this.operator == "=" && this.right.is_truthy(); + }); + def(AST_Lambda, return_true); + def(AST_Object, return_true); + def(AST_RegExp, return_true); + def(AST_Sequence, function() { + return this.tail_node().is_truthy(); + }); + def(AST_SymbolRef, function() { + var fixed = this.fixed_value(); + if (!fixed) return false; + this.is_truthy = return_false; + var result = fixed.is_truthy(); + delete this.is_truthy; + return result; + }); + })(function(node, func) { + node.DEFMETHOD("is_truthy", func); + }); + + // is_negative_zero() + // return true if the node may represent -0 + (function(def) { + def(AST_Node, return_true); + def(AST_Array, return_false); + function binary(op, left, right) { + switch (op) { + case "-": + return left.is_negative_zero() + && (!(right instanceof AST_Constant) || right.value == 0); + case "&&": + case "||": + return left.is_negative_zero() || right.is_negative_zero(); + case "*": + case "/": + case "%": + case "**": + return true; + default: + return false; + } + } + def(AST_Assign, function() { + var op = this.operator; + if (op == "=") return this.right.is_negative_zero(); + return binary(op.slice(0, -1), this.left, this.right); + }); + def(AST_Binary, function() { + return binary(this.operator, this.left, this.right); + }); + def(AST_Constant, function() { + return this.value == 0 && 1 / this.value < 0; + }); + def(AST_Lambda, return_false); + def(AST_Object, return_false); + def(AST_RegExp, return_false); + def(AST_Sequence, function() { + return this.tail_node().is_negative_zero(); + }); + def(AST_SymbolRef, function() { + var fixed = this.fixed_value(); + if (!fixed) return true; + this.is_negative_zero = return_true; + var result = fixed.is_negative_zero(); + delete this.is_negative_zero; + return result; + }); + def(AST_UnaryPrefix, function() { + return this.operator == "+" && this.expression.is_negative_zero() + || this.operator == "-"; + }); + })(function(node, func) { + node.DEFMETHOD("is_negative_zero", func); + }); + + // may_throw_on_access() + // returns true if this node may be null, undefined or contain `AST_Accessor` + (function(def) { + AST_Node.DEFMETHOD("may_throw_on_access", function(compressor, force) { + return !compressor.option("pure_getters") || this._dot_throw(compressor, force); + }); + function is_strict(compressor, force) { + return force || /strict/.test(compressor.option("pure_getters")); + } + def(AST_Node, is_strict); + def(AST_Array, return_false); + def(AST_Assign, function(compressor) { + var op = this.operator; + var sym = this.left; + var rhs = this.right; + if (op != "=") { + return lazy_op[op.slice(0, -1)] && (sym._dot_throw(compressor) || rhs._dot_throw(compressor)); + } + if (!rhs._dot_throw(compressor)) return false; + if (!(sym instanceof AST_SymbolRef)) return true; + if (rhs instanceof AST_Binary && rhs.operator == "||" && sym.name == rhs.left.name) { + return rhs.right._dot_throw(compressor); + } + return true; + }); + def(AST_Binary, function(compressor) { + return lazy_op[this.operator] && (this.left._dot_throw(compressor) || this.right._dot_throw(compressor)); + }); + def(AST_Class, function(compressor, force) { + return is_strict(compressor, force) && !all(this.properties, function(prop) { + if (prop.private) return true; + if (!prop.static) return true; + return !(prop instanceof AST_ClassGetter || prop instanceof AST_ClassSetter); + }); + }); + def(AST_Conditional, function(compressor) { + return this.consequent._dot_throw(compressor) || this.alternative._dot_throw(compressor); + }); + def(AST_Constant, return_false); + def(AST_Dot, function(compressor, force) { + if (!is_strict(compressor, force)) return false; + var exp = this.expression; + if (exp instanceof AST_SymbolRef) exp = exp.fixed_value(); + return !(this.property == "prototype" && is_lambda(exp)); + }); + def(AST_Lambda, return_false); + def(AST_Null, return_true); + def(AST_Object, function(compressor, force) { + return is_strict(compressor, force) && !all(this.properties, function(prop) { + if (prop instanceof AST_ObjectGetter || prop instanceof AST_ObjectSetter) return false; + return !(prop.key === "__proto__" && prop.value._dot_throw(compressor, force)); + }); + }); + def(AST_ObjectIdentity, function(compressor, force) { + return is_strict(compressor, force) && !this.scope.resolve().new; + }); + def(AST_Sequence, function(compressor) { + return this.tail_node()._dot_throw(compressor); + }); + def(AST_SymbolRef, function(compressor, force) { + if (this.is_undefined) return true; + if (!is_strict(compressor, force)) return false; + if (is_undeclared_ref(this) && this.is_declared(compressor)) return false; + if (this.is_immutable()) return false; + var def = this.definition(); + if (is_arguments(def) && !def.scope.rest && all(def.scope.argnames, function(argname) { + return argname instanceof AST_SymbolFunarg; + })) return def.scope.uses_arguments > 2; + var fixed = this.fixed_value(true); + if (!fixed) return true; + this._dot_throw = return_true; + if (fixed._dot_throw(compressor)) { + delete this._dot_throw; + return true; + } + this._dot_throw = return_false; + return false; + }); + def(AST_UnaryPrefix, function() { + return this.operator == "void"; + }); + def(AST_UnaryPostfix, return_false); + def(AST_Undefined, return_true); + })(function(node, func) { + node.DEFMETHOD("_dot_throw", func); + }); + + (function(def) { + def(AST_Node, return_false); + def(AST_Array, return_true); + function is_binary_defined(compressor, op, node) { + switch (op) { + case "&&": + return node.left.is_defined(compressor) && node.right.is_defined(compressor); + case "||": + return node.left.is_truthy() || node.right.is_defined(compressor); + case "??": + return node.left.is_defined(compressor) || node.right.is_defined(compressor); + default: + return true; + } + } + def(AST_Assign, function(compressor) { + var op = this.operator; + if (op == "=") return this.right.is_defined(compressor); + return is_binary_defined(compressor, op.slice(0, -1), this); + }); + def(AST_Binary, function(compressor) { + return is_binary_defined(compressor, this.operator, this); + }); + def(AST_Conditional, function(compressor) { + return this.consequent.is_defined(compressor) && this.alternative.is_defined(compressor); + }); + def(AST_Constant, return_true); + def(AST_Hole, return_false); + def(AST_Lambda, return_true); + def(AST_Object, return_true); + def(AST_Sequence, function(compressor) { + return this.tail_node().is_defined(compressor); + }); + def(AST_SymbolRef, function(compressor) { + if (this.is_undefined) return false; + if (is_undeclared_ref(this) && this.is_declared(compressor)) return true; + if (this.is_immutable()) return true; + var fixed = this.fixed_value(); + if (!fixed) return false; + this.is_defined = return_false; + var result = fixed.is_defined(compressor); + delete this.is_defined; + return result; + }); + def(AST_UnaryPrefix, function() { + return this.operator != "void"; + }); + def(AST_UnaryPostfix, return_true); + def(AST_Undefined, return_false); + })(function(node, func) { + node.DEFMETHOD("is_defined", func); + }); + + /* -----[ boolean/negation helpers ]----- */ + + // methods to determine whether an expression has a boolean result type + (function(def) { + def(AST_Node, return_false); + def(AST_Assign, function(compressor) { + return this.operator == "=" && this.right.is_boolean(compressor); + }); + var binary = makePredicate("in instanceof == != === !== < <= >= >"); + def(AST_Binary, function(compressor) { + return binary[this.operator] || lazy_op[this.operator] + && this.left.is_boolean(compressor) + && this.right.is_boolean(compressor); + }); + def(AST_Boolean, return_true); + var fn = makePredicate("every hasOwnProperty isPrototypeOf propertyIsEnumerable some"); + def(AST_Call, function(compressor) { + if (!compressor.option("unsafe")) return false; + var exp = this.expression; + return exp instanceof AST_Dot && (fn[exp.property] + || exp.property == "test" && exp.expression instanceof AST_RegExp); + }); + def(AST_Conditional, function(compressor) { + return this.consequent.is_boolean(compressor) && this.alternative.is_boolean(compressor); + }); + def(AST_New, return_false); + def(AST_Sequence, function(compressor) { + return this.tail_node().is_boolean(compressor); + }); + def(AST_SymbolRef, function(compressor) { + var fixed = this.fixed_value(); + if (!fixed) return false; + this.is_boolean = return_false; + var result = fixed.is_boolean(compressor); + delete this.is_boolean; + return result; + }); + var unary = makePredicate("! delete"); + def(AST_UnaryPrefix, function() { + return unary[this.operator]; + }); + })(function(node, func) { + node.DEFMETHOD("is_boolean", func); + }); + + // methods to determine if an expression has a numeric result type + (function(def) { + def(AST_Node, return_false); + var binary = makePredicate("- * / % ** & | ^ << >> >>>"); + def(AST_Assign, function(compressor) { + return binary[this.operator.slice(0, -1)] + || this.operator == "=" && this.right.is_number(compressor); + }); + def(AST_Binary, function(compressor) { + if (binary[this.operator]) return true; + if (this.operator != "+") return false; + return (this.left.is_boolean(compressor) || this.left.is_number(compressor)) + && (this.right.is_boolean(compressor) || this.right.is_number(compressor)); + }); + var fn = makePredicate([ + "charCodeAt", + "getDate", + "getDay", + "getFullYear", + "getHours", + "getMilliseconds", + "getMinutes", + "getMonth", + "getSeconds", + "getTime", + "getTimezoneOffset", + "getUTCDate", + "getUTCDay", + "getUTCFullYear", + "getUTCHours", + "getUTCMilliseconds", + "getUTCMinutes", + "getUTCMonth", + "getUTCSeconds", + "getYear", + "indexOf", + "lastIndexOf", + "localeCompare", + "push", + "search", + "setDate", + "setFullYear", + "setHours", + "setMilliseconds", + "setMinutes", + "setMonth", + "setSeconds", + "setTime", + "setUTCDate", + "setUTCFullYear", + "setUTCHours", + "setUTCMilliseconds", + "setUTCMinutes", + "setUTCMonth", + "setUTCSeconds", + "setYear", + ]); + def(AST_Call, function(compressor) { + if (!compressor.option("unsafe")) return false; + var exp = this.expression; + return exp instanceof AST_Dot && (fn[exp.property] + || is_undeclared_ref(exp.expression) && exp.expression.name == "Math"); + }); + def(AST_Conditional, function(compressor) { + return this.consequent.is_number(compressor) && this.alternative.is_number(compressor); + }); + def(AST_New, return_false); + def(AST_Number, return_true); + def(AST_Sequence, function(compressor) { + return this.tail_node().is_number(compressor); + }); + def(AST_SymbolRef, function(compressor, keep_unary) { + var fixed = this.fixed_value(); + if (!fixed) return false; + if (keep_unary + && fixed instanceof AST_UnaryPrefix + && fixed.operator == "+" + && fixed.expression.equals(this)) { + return false; + } + this.is_number = return_false; + var result = fixed.is_number(compressor); + delete this.is_number; + return result; + }); + var unary = makePredicate("+ - ~ ++ --"); + def(AST_Unary, function() { + return unary[this.operator]; + }); + })(function(node, func) { + node.DEFMETHOD("is_number", func); + }); + + // methods to determine if an expression has a string result type + (function(def) { + def(AST_Node, return_false); + def(AST_Assign, function(compressor) { + switch (this.operator) { + case "+=": + if (this.left.is_string(compressor)) return true; + case "=": + return this.right.is_string(compressor); + } + }); + def(AST_Binary, function(compressor) { + return this.operator == "+" && + (this.left.is_string(compressor) || this.right.is_string(compressor)); + }); + var fn = makePredicate([ + "charAt", + "substr", + "substring", + "toExponential", + "toFixed", + "toLowerCase", + "toPrecision", + "toString", + "toUpperCase", + "trim", + ]); + def(AST_Call, function(compressor) { + if (!compressor.option("unsafe")) return false; + var exp = this.expression; + return exp instanceof AST_Dot && fn[exp.property]; + }); + def(AST_Conditional, function(compressor) { + return this.consequent.is_string(compressor) && this.alternative.is_string(compressor); + }); + def(AST_Sequence, function(compressor) { + return this.tail_node().is_string(compressor); + }); + def(AST_String, return_true); + def(AST_SymbolRef, function(compressor) { + var fixed = this.fixed_value(); + if (!fixed) return false; + this.is_string = return_false; + var result = fixed.is_string(compressor); + delete this.is_string; + return result; + }); + def(AST_Template, function(compressor) { + return !this.tag || is_raw_tag(compressor, this.tag); + }); + def(AST_UnaryPrefix, function() { + return this.operator == "typeof"; + }); + })(function(node, func) { + node.DEFMETHOD("is_string", func); + }); + + var lazy_op = makePredicate("&& || ??"); + + (function(def) { + function to_node(value, orig) { + if (value instanceof AST_Node) return value.clone(true); + if (Array.isArray(value)) return make_node(AST_Array, orig, { + elements: value.map(function(value) { + return to_node(value, orig); + }) + }); + if (value && typeof value == "object") { + var props = []; + for (var key in value) if (HOP(value, key)) { + props.push(make_node(AST_ObjectKeyVal, orig, { + key: key, + value: to_node(value[key], orig), + })); + } + return make_node(AST_Object, orig, { properties: props }); + } + return make_node_from_constant(value, orig); + } + + function warn(node) { + AST_Node.warn("global_defs {this} redefined [{start}]", node); + } + + AST_Toplevel.DEFMETHOD("resolve_defines", function(compressor) { + if (!compressor.option("global_defs")) return this; + this.figure_out_scope({ ie: compressor.option("ie") }); + return this.transform(new TreeTransformer(function(node) { + var def = node._find_defs(compressor, ""); + if (!def) return; + var level = 0, child = node, parent; + while (parent = this.parent(level++)) { + if (!(parent instanceof AST_PropAccess)) break; + if (parent.expression !== child) break; + child = parent; + } + if (is_lhs(child, parent)) { + warn(node); + return; + } + return def; + })); + }); + def(AST_Node, noop); + def(AST_Dot, function(compressor, suffix) { + return this.expression._find_defs(compressor, "." + this.property + suffix); + }); + def(AST_SymbolDeclaration, function(compressor) { + if (!this.definition().global) return; + if (HOP(compressor.option("global_defs"), this.name)) warn(this); + }); + def(AST_SymbolRef, function(compressor, suffix) { + if (!this.definition().global) return; + var defines = compressor.option("global_defs"); + var name = this.name + suffix; + if (HOP(defines, name)) return to_node(defines[name], this); + }); + })(function(node, func) { + node.DEFMETHOD("_find_defs", func); + }); + + function best_of_expression(ast1, ast2, threshold) { + var delta = ast2.print_to_string().length - ast1.print_to_string().length; + return delta < (threshold || 0) ? ast2 : ast1; + } + + function best_of_statement(ast1, ast2, threshold) { + return best_of_expression(make_node(AST_SimpleStatement, ast1, { + body: ast1, + }), make_node(AST_SimpleStatement, ast2, { + body: ast2, + }), threshold).body; + } + + function best_of(compressor, ast1, ast2, threshold) { + return (first_in_statement(compressor) ? best_of_statement : best_of_expression)(ast1, ast2, threshold); + } + + function convert_to_predicate(obj) { + var map = Object.create(null); + Object.keys(obj).forEach(function(key) { + map[key] = makePredicate(obj[key]); + }); + return map; + } + + function skip_directives(body) { + for (var i = 0; i < body.length; i++) { + var stat = body[i]; + if (!(stat instanceof AST_Directive)) return stat; + } + } + + function arrow_first_statement() { + if (this.value) return make_node(AST_Return, this.value, { value: this.value }); + return skip_directives(this.body); + } + AST_Arrow.DEFMETHOD("first_statement", arrow_first_statement); + AST_AsyncArrow.DEFMETHOD("first_statement", arrow_first_statement); + AST_Lambda.DEFMETHOD("first_statement", function() { + return skip_directives(this.body); + }); + + AST_Lambda.DEFMETHOD("length", function() { + var argnames = this.argnames; + for (var i = 0; i < argnames.length; i++) { + if (argnames[i] instanceof AST_DefaultValue) break; + } + return i; + }); + + function try_evaluate(compressor, node) { + var ev = node.evaluate(compressor); + if (ev === node) return node; + ev = make_node_from_constant(ev, node).optimize(compressor); + return best_of(compressor, node, ev, compressor.eval_threshold); + } + + var object_fns = [ + "constructor", + "toString", + "valueOf", + ]; + var native_fns = convert_to_predicate({ + Array: [ + "indexOf", + "join", + "lastIndexOf", + "slice", + ].concat(object_fns), + Boolean: object_fns, + Function: object_fns, + Number: [ + "toExponential", + "toFixed", + "toPrecision", + ].concat(object_fns), + Object: object_fns, + RegExp: [ + "exec", + "test", + ].concat(object_fns), + String: [ + "charAt", + "charCodeAt", + "concat", + "indexOf", + "italics", + "lastIndexOf", + "match", + "replace", + "search", + "slice", + "split", + "substr", + "substring", + "toLowerCase", + "toUpperCase", + "trim", + ].concat(object_fns), + }); + var static_fns = convert_to_predicate({ + Array: [ + "isArray", + ], + Math: [ + "abs", + "acos", + "asin", + "atan", + "ceil", + "cos", + "exp", + "floor", + "log", + "round", + "sin", + "sqrt", + "tan", + "atan2", + "pow", + "max", + "min", + ], + Number: [ + "isFinite", + "isNaN", + ], + Object: [ + "create", + "getOwnPropertyDescriptor", + "getOwnPropertyNames", + "getPrototypeOf", + "isExtensible", + "isFrozen", + "isSealed", + "keys", + ], + String: [ + "fromCharCode", + "raw", + ], + }); + + function is_static_fn(node) { + if (!(node instanceof AST_Dot)) return false; + var expr = node.expression; + if (!is_undeclared_ref(expr)) return false; + var static_fn = static_fns[expr.name]; + return static_fn && (static_fn[node.property] || expr.name == "Math" && node.property == "random"); + } + + // Accommodate when compress option evaluate=false + // as well as the common constant expressions !0 and -1 + (function(def) { + def(AST_Node, return_false); + def(AST_Constant, return_true); + def(AST_RegExp, return_false); + var unaryPrefix = makePredicate("! ~ - + void"); + def(AST_UnaryPrefix, function() { + return unaryPrefix[this.operator] && this.expression instanceof AST_Constant; + }); + })(function(node, func) { + node.DEFMETHOD("is_constant", func); + }); + + // methods to evaluate a constant expression + (function(def) { + // If the node has been successfully reduced to a constant, + // then its value is returned; otherwise the element itself + // is returned. + // + // They can be distinguished as constant value is never a + // descendant of AST_Node. + // + // When `ignore_side_effects` is `true`, inspect the constant value + // produced without worrying about any side effects caused by said + // expression. + AST_Node.DEFMETHOD("evaluate", function(compressor, ignore_side_effects) { + if (!compressor.option("evaluate")) return this; + var cached = []; + var val = this._eval(compressor, ignore_side_effects, cached, 1); + cached.forEach(function(node) { + delete node._eval; + }); + if (ignore_side_effects) return val; + if (!val || val instanceof RegExp) return val; + if (typeof val == "function" || typeof val == "object") return this; + return val; + }); + var scan_modified = new TreeWalker(function(node) { + if (node instanceof AST_Assign) modified(node.left); + if (node instanceof AST_ForEnumeration) modified(node.init); + if (node instanceof AST_Unary && UNARY_POSTFIX[node.operator]) modified(node.expression); + }); + function modified(node) { + if (node instanceof AST_DestructuredArray) { + node.elements.forEach(modified); + } else if (node instanceof AST_DestructuredObject) { + node.properties.forEach(function(prop) { + modified(prop.value); + }); + } else if (node instanceof AST_PropAccess) { + modified(node.expression); + } else if (node instanceof AST_SymbolRef) { + node.definition().references.forEach(function(ref) { + delete ref._eval; + }); + } + } + def(AST_Statement, function() { + throw new Error(string_template("Cannot evaluate a statement [{start}]", this)); + }); + def(AST_Accessor, return_this); + def(AST_BigInt, return_this); + def(AST_Class, return_this); + def(AST_Node, return_this); + def(AST_Constant, function() { + return this.value; + }); + def(AST_Assign, function(compressor, ignore_side_effects, cached, depth) { + var lhs = this.left; + if (!ignore_side_effects) { + if (!(lhs instanceof AST_SymbolRef)) return this; + if (!HOP(lhs, "_eval")) { + if (!lhs.fixed) return this; + var def = lhs.definition(); + if (!def.fixed) return this; + if (def.undeclared) return this; + if (def.last_ref !== lhs) return this; + if (def.single_use == "m") return this; + if (this.right.has_side_effects(compressor)) return this; + } + } + var op = this.operator; + var node; + if (!HOP(lhs, "_eval") && lhs instanceof AST_SymbolRef && lhs.fixed && lhs.definition().fixed) { + node = lhs; + } else if (op == "=") { + node = this.right; + } else { + node = make_node(AST_Binary, this, { + operator: op.slice(0, -1), + left: lhs, + right: this.right, + }); + } + lhs.walk(scan_modified); + var value = node._eval(compressor, ignore_side_effects, cached, depth); + if (typeof value == "object") return this; + modified(lhs); + return value; + }); + def(AST_Sequence, function(compressor, ignore_side_effects, cached, depth) { + if (!ignore_side_effects) return this; + var exprs = this.expressions; + for (var i = 0, last = exprs.length - 1; i < last; i++) { + exprs[i].walk(scan_modified); + } + var tail = exprs[last]; + var value = tail._eval(compressor, ignore_side_effects, cached, depth); + return value === tail ? this : value; + }); + def(AST_Lambda, function(compressor) { + if (compressor.option("unsafe")) { + var fn = function() {}; + fn.node = this; + fn.toString = function() { + return "function(){}"; + }; + return fn; + } + return this; + }); + def(AST_Array, function(compressor, ignore_side_effects, cached, depth) { + if (compressor.option("unsafe")) { + var elements = []; + for (var i = 0; i < this.elements.length; i++) { + var element = this.elements[i]; + if (element instanceof AST_Hole) return this; + var value = element._eval(compressor, ignore_side_effects, cached, depth); + if (element === value) return this; + elements.push(value); + } + return elements; + } + return this; + }); + def(AST_Object, function(compressor, ignore_side_effects, cached, depth) { + if (compressor.option("unsafe")) { + var val = {}; + for (var i = 0; i < this.properties.length; i++) { + var prop = this.properties[i]; + if (!(prop instanceof AST_ObjectKeyVal)) return this; + var key = prop.key; + if (key instanceof AST_Node) { + key = key._eval(compressor, ignore_side_effects, cached, depth); + if (key === prop.key) return this; + } + switch (key) { + case "__proto__": + case "toString": + case "valueOf": + return this; + } + val[key] = prop.value._eval(compressor, ignore_side_effects, cached, depth); + if (val[key] === prop.value) return this; + } + return val; + } + return this; + }); + var non_converting_unary = makePredicate("! typeof void"); + def(AST_UnaryPrefix, function(compressor, ignore_side_effects, cached, depth) { + var e = this.expression; + var op = this.operator; + // Function would be evaluated to an array and so typeof would + // incorrectly return "object". Hence making is a special case. + if (compressor.option("typeofs") + && op == "typeof" + && (e instanceof AST_Lambda + || e instanceof AST_SymbolRef + && e.fixed_value() instanceof AST_Lambda)) { + return typeof function(){}; + } + var def = e instanceof AST_SymbolRef && e.definition(); + if (!non_converting_unary[op] && !(def && def.fixed)) depth++; + e.walk(scan_modified); + var v = e._eval(compressor, ignore_side_effects, cached, depth); + if (v === e) { + if (ignore_side_effects && op == "void") return; + return this; + } + switch (op) { + case "!": return !v; + case "typeof": + // typeof returns "object" or "function" on different platforms + // so cannot evaluate reliably + if (v instanceof RegExp) return this; + return typeof v; + case "void": return; + case "~": return ~v; + case "-": return -v; + case "+": return +v; + case "++": + case "--": + if (!def) return this; + if (!ignore_side_effects) { + if (def.undeclared) return this; + if (def.last_ref !== e) return this; + } + if (HOP(e, "_eval")) v = +(op[0] + 1) + +v; + modified(e); + return v; + } + return this; + }); + def(AST_UnaryPostfix, function(compressor, ignore_side_effects, cached, depth) { + var e = this.expression; + if (!(e instanceof AST_SymbolRef)) { + if (!ignore_side_effects) return this; + } else if (!HOP(e, "_eval")) { + if (!e.fixed) return this; + if (!ignore_side_effects) { + var def = e.definition(); + if (!def.fixed) return this; + if (def.undeclared) return this; + if (def.last_ref !== e) return this; + } + } + if (!(e instanceof AST_SymbolRef && e.definition().fixed)) depth++; + e.walk(scan_modified); + var v = e._eval(compressor, ignore_side_effects, cached, depth); + if (v === e) return this; + modified(e); + return +v; + }); + var non_converting_binary = makePredicate("&& || === !=="); + def(AST_Binary, function(compressor, ignore_side_effects, cached, depth) { + if (!non_converting_binary[this.operator]) depth++; + var left = this.left._eval(compressor, ignore_side_effects, cached, depth); + if (left === this.left) return this; + if (this.operator == (left ? "||" : "&&")) return left; + var rhs_ignore_side_effects = ignore_side_effects && !(left && typeof left == "object"); + var right = this.right._eval(compressor, rhs_ignore_side_effects, cached, depth); + if (right === this.right) return this; + var result; + switch (this.operator) { + case "&&" : result = left && right; break; + case "||" : result = left || right; break; + case "??" : + result = left == null ? right : left; + break; + case "|" : result = left | right; break; + case "&" : result = left & right; break; + case "^" : result = left ^ right; break; + case "+" : result = left + right; break; + case "-" : result = left - right; break; + case "*" : result = left * right; break; + case "/" : result = left / right; break; + case "%" : result = left % right; break; + case "<<" : result = left << right; break; + case ">>" : result = left >> right; break; + case ">>>": result = left >>> right; break; + case "==" : result = left == right; break; + case "===": result = left === right; break; + case "!=" : result = left != right; break; + case "!==": result = left !== right; break; + case "<" : result = left < right; break; + case "<=" : result = left <= right; break; + case ">" : result = left > right; break; + case ">=" : result = left >= right; break; + case "**": + result = Math.pow(left, right); + break; + case "in": + if (right && typeof right == "object" && HOP(right, left)) { + result = true; + break; + } + default: + return this; + } + if (isNaN(result)) return compressor.find_parent(AST_With) ? this : result; + if (compressor.option("unsafe_math") + && !ignore_side_effects + && result + && typeof result == "number" + && (this.operator == "+" || this.operator == "-")) { + var digits = Math.max(0, decimals(left), decimals(right)); + // 53-bit significand ---> 15.95 decimal places + if (digits < 16) return +result.toFixed(digits); + } + return result; + + function decimals(operand) { + var match = /(\.[0-9]*)?(e[^e]+)?$/.exec(+operand); + return (match[1] || ".").length - 1 - (match[2] || "").slice(1); + } + }); + def(AST_Conditional, function(compressor, ignore_side_effects, cached, depth) { + var condition = this.condition._eval(compressor, ignore_side_effects, cached, depth); + if (condition === this.condition) return this; + var node = condition ? this.consequent : this.alternative; + var value = node._eval(compressor, ignore_side_effects, cached, depth); + return value === node ? this : value; + }); + function verify_escaped(ref, depth) { + var escaped = ref.definition().escaped; + switch (escaped.length) { + case 0: + return true; + case 1: + var found = false; + escaped[0].walk(new TreeWalker(function(node) { + if (found) return true; + if (node === ref) return found = true; + if (node instanceof AST_Scope) return true; + })); + return found; + default: + return depth <= escaped.depth; + } + } + def(AST_SymbolRef, function(compressor, ignore_side_effects, cached, depth) { + var fixed = this.fixed_value(); + if (!fixed) return this; + var value; + if (HOP(fixed, "_eval")) { + value = fixed._eval(); + } else { + this._eval = return_this; + value = fixed._eval(compressor, ignore_side_effects, cached, depth); + delete this._eval; + if (value === fixed) return this; + fixed._eval = function() { + return value; + }; + cached.push(fixed); + } + return value && typeof value == "object" && !verify_escaped(this, depth) ? this : value; + }); + var global_objs = { + Array: Array, + Math: Math, + Number: Number, + Object: Object, + String: String, + }; + var static_values = convert_to_predicate({ + Math: [ + "E", + "LN10", + "LN2", + "LOG2E", + "LOG10E", + "PI", + "SQRT1_2", + "SQRT2", + ], + Number: [ + "MAX_VALUE", + "MIN_VALUE", + "NaN", + "NEGATIVE_INFINITY", + "POSITIVE_INFINITY", + ], + }); + var regexp_props = makePredicate("global ignoreCase multiline source"); + def(AST_PropAccess, function(compressor, ignore_side_effects, cached, depth) { + if (compressor.option("unsafe")) { + var val; + var exp = this.expression; + if (!is_undeclared_ref(exp)) { + val = exp._eval(compressor, ignore_side_effects, cached, depth + 1); + if (val == null || val === exp) return this; + } + var key = this.property; + if (key instanceof AST_Node) { + key = key._eval(compressor, ignore_side_effects, cached, depth); + if (key === this.property) return this; + } + if (val === undefined) { + var static_value = static_values[exp.name]; + if (!static_value || !static_value[key]) return this; + val = global_objs[exp.name]; + } else if (val instanceof RegExp) { + if (!regexp_props[key]) return this; + } else if (typeof val == "object") { + if (!HOP(val, key)) return this; + } else if (typeof val == "function") switch (key) { + case "name": + return val.node.name ? val.node.name.name : ""; + case "length": + return val.node.length(); + default: + return this; + } + return val[key]; + } + return this; + }); + function eval_all(nodes, compressor, ignore_side_effects, cached, depth) { + var values = []; + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var value = node._eval(compressor, ignore_side_effects, cached, depth); + if (node === value) return; + values.push(value); + } + return values; + } + def(AST_Call, function(compressor, ignore_side_effects, cached, depth) { + var exp = this.expression; + var fn = exp instanceof AST_SymbolRef ? exp.fixed_value() : exp; + if (fn instanceof AST_Arrow || fn instanceof AST_Defun || fn instanceof AST_Function) { + if (fn.evaluating) return this; + if (fn.name && fn.name.definition().recursive_refs > 0) return this; + if (this.is_expr_pure(compressor)) return this; + var args = eval_all(this.args, compressor, ignore_side_effects, cached, depth); + if (!all(fn.argnames, function(sym, index) { + if (sym instanceof AST_DefaultValue) { + if (!args) return false; + if (args[index] === undefined) { + var value = sym.value._eval(compressor, ignore_side_effects, cached, depth); + if (value === sym.value) return false; + args[index] = value; + } + sym = sym.name; + } + return !(sym instanceof AST_Destructured); + })) return this; + if (fn.rest instanceof AST_Destructured) return this; + if (!args && !ignore_side_effects) return this; + var stat = fn.first_statement(); + if (!(stat instanceof AST_Return)) { + if (ignore_side_effects) { + fn.walk(scan_modified); + var found = false; + fn.evaluating = true; + walk_body(fn, new TreeWalker(function(node) { + if (found) return true; + if (node instanceof AST_Return) { + if (node.value && node.value._eval(compressor, true, cached, depth) !== undefined) { + found = true; + } + return true; + } + if (node instanceof AST_Scope && node !== fn) return true; + })); + fn.evaluating = false; + if (!found) return; + } + return this; + } + var val = stat.value; + if (!val) return; + var cached_args = []; + if (!args || all(fn.argnames, function(sym, i) { + return assign(sym, args[i]); + }) && !(fn.rest && !assign(fn.rest, args.slice(fn.argnames.length))) || ignore_side_effects) { + if (ignore_side_effects) fn.argnames.forEach(function(sym) { + if (sym instanceof AST_DefaultValue) sym.value.walk(scan_modified); + }); + fn.evaluating = true; + val = val._eval(compressor, ignore_side_effects, cached, depth); + fn.evaluating = false; + } + cached_args.forEach(function(node) { + delete node._eval; + }); + return val === stat.value ? this : val; + } else if (compressor.option("unsafe") && exp instanceof AST_PropAccess) { + var key = exp.property; + if (key instanceof AST_Node) { + key = key._eval(compressor, ignore_side_effects, cached, depth); + if (key === exp.property) return this; + } + var val; + var e = exp.expression; + if (is_undeclared_ref(e)) { + var static_fn = static_fns[e.name]; + if (!static_fn || !static_fn[key]) return this; + val = global_objs[e.name]; + } else { + val = e._eval(compressor, ignore_side_effects, cached, depth + 1); + if (val == null || val === e) return this; + var native_fn = native_fns[val.constructor.name]; + if (!native_fn || !native_fn[key]) return this; + if (val instanceof RegExp && val.global && !(e instanceof AST_RegExp)) return this; + } + var args = eval_all(this.args, compressor, ignore_side_effects, cached, depth); + if (!args) return this; + if (key == "replace" && typeof args[1] == "function") return this; + try { + return val[key].apply(val, args); + } catch (ex) { + AST_Node.warn("Error evaluating {this} [{start}]", this); + } finally { + if (val instanceof RegExp) val.lastIndex = 0; + } + } + return this; + + function assign(sym, arg) { + if (sym instanceof AST_DefaultValue) sym = sym.name; + var def = sym.definition(); + if (def.orig[def.orig.length - 1] !== sym) return false; + var value = arg; + def.references.forEach(function(node) { + node._eval = function() { + return value; + }; + cached_args.push(node); + }); + return true; + } + }); + def(AST_New, return_this); + def(AST_Template, function(compressor, ignore_side_effects, cached, depth) { + if (!compressor.option("templates")) return this; + if (this.tag) { + if (!is_raw_tag(compressor, this.tag)) return this; + decode = function(str) { + return str; + }; + } + var exprs = eval_all(this.expressions, compressor, ignore_side_effects, cached, depth); + if (!exprs) return this; + var malformed = false; + var ret = decode(this.strings[0]); + for (var i = 0; i < exprs.length; i++) { + ret += exprs[i] + decode(this.strings[i + 1]); + } + if (!malformed) return ret; + this._eval = return_this; + return this; + + function decode(str) { + str = decode_template(str); + if (typeof str != "string") malformed = true; + return str; + } + }); + })(function(node, func) { + node.DEFMETHOD("_eval", func); + }); + + // method to negate an expression + (function(def) { + function basic_negation(exp) { + return make_node(AST_UnaryPrefix, exp, { + operator: "!", + expression: exp, + }); + } + function best(orig, alt, first_in_statement) { + var negated = basic_negation(orig); + if (first_in_statement) return best_of_expression(negated, make_node(AST_SimpleStatement, alt, { + body: alt, + })) === negated ? negated : alt; + return best_of_expression(negated, alt); + } + def(AST_Node, function() { + return basic_negation(this); + }); + def(AST_Statement, function() { + throw new Error("Cannot negate a statement"); + }); + def(AST_Binary, function(compressor, first_in_statement) { + var self = this.clone(), op = this.operator; + if (compressor.option("unsafe_comps")) { + switch (op) { + case "<=" : self.operator = ">" ; return self; + case "<" : self.operator = ">=" ; return self; + case ">=" : self.operator = "<" ; return self; + case ">" : self.operator = "<=" ; return self; + } + } + switch (op) { + case "==" : self.operator = "!="; return self; + case "!=" : self.operator = "=="; return self; + case "===": self.operator = "!=="; return self; + case "!==": self.operator = "==="; return self; + case "&&": + self.operator = "||"; + self.left = self.left.negate(compressor, first_in_statement); + self.right = self.right.negate(compressor); + return best(this, self, first_in_statement); + case "||": + self.operator = "&&"; + self.left = self.left.negate(compressor, first_in_statement); + self.right = self.right.negate(compressor); + return best(this, self, first_in_statement); + } + return basic_negation(this); + }); + def(AST_ClassExpression, function() { + return basic_negation(this); + }); + def(AST_Conditional, function(compressor, first_in_statement) { + var self = this.clone(); + self.consequent = self.consequent.negate(compressor); + self.alternative = self.alternative.negate(compressor); + return best(this, self, first_in_statement); + }); + def(AST_LambdaExpression, function() { + return basic_negation(this); + }); + def(AST_Sequence, function(compressor) { + var expressions = this.expressions.slice(); + expressions.push(expressions.pop().negate(compressor)); + return make_sequence(this, expressions); + }); + def(AST_UnaryPrefix, function() { + if (this.operator == "!") + return this.expression; + return basic_negation(this); + }); + })(function(node, func) { + node.DEFMETHOD("negate", function(compressor, first_in_statement) { + return func.call(this, compressor, first_in_statement); + }); + }); + + var global_pure_fns = makePredicate("Boolean decodeURI decodeURIComponent Date encodeURI encodeURIComponent Error escape EvalError isFinite isNaN Number Object parseFloat parseInt RangeError ReferenceError String SyntaxError TypeError unescape URIError"); + var global_pure_constructors = makePredicate("Map Set WeakMap WeakSet"); + AST_Call.DEFMETHOD("is_expr_pure", function(compressor) { + if (compressor.option("unsafe")) { + var expr = this.expression; + if (is_undeclared_ref(expr)) { + if (global_pure_fns[expr.name]) return true; + if (this instanceof AST_New && global_pure_constructors[expr.name]) return true; + } + if (is_static_fn(expr)) return true; + } + return compressor.option("annotations") && this.pure || !compressor.pure_funcs(this); + }); + AST_Template.DEFMETHOD("is_expr_pure", function(compressor) { + var tag = this.tag; + if (!tag) return true; + if (compressor.option("unsafe")) { + if (is_undeclared_ref(tag) && global_pure_fns[tag.name]) return true; + if (tag instanceof AST_Dot && is_undeclared_ref(tag.expression)) { + var static_fn = static_fns[tag.expression.name]; + return static_fn && (static_fn[tag.property] + || tag.expression.name == "Math" && tag.property == "random"); + } + } + return !compressor.pure_funcs(this); + }); + AST_Node.DEFMETHOD("is_call_pure", return_false); + AST_Call.DEFMETHOD("is_call_pure", function(compressor) { + if (!compressor.option("unsafe")) return false; + var dot = this.expression; + if (!(dot instanceof AST_Dot)) return false; + var exp = dot.expression; + var map; + var prop = dot.property; + if (exp instanceof AST_Array) { + map = native_fns.Array; + } else if (exp.is_boolean(compressor)) { + map = native_fns.Boolean; + } else if (exp.is_number(compressor)) { + map = native_fns.Number; + } else if (exp instanceof AST_RegExp) { + map = native_fns.RegExp; + } else if (exp.is_string(compressor)) { + map = native_fns.String; + if (prop == "replace") { + var arg = this.args[1]; + if (arg && !arg.is_string(compressor)) return false; + } + } else if (!dot.may_throw_on_access(compressor)) { + map = native_fns.Object; + } + return map && map[prop]; + }); + + // determine if object spread syntax may cause runtime exception + (function(def) { + def(AST_Node, return_false); + def(AST_Array, return_true); + def(AST_Assign, function() { + switch (this.operator) { + case "=": + return this.right.safe_to_spread(); + case "&&=": + case "||=": + case "??=": + return this.left.safe_to_spread() && this.right.safe_to_spread(); + } + return true; + }); + def(AST_Binary, function() { + return !lazy_op[this.operator] || this.left.safe_to_spread() && this.right.safe_to_spread(); + }); + def(AST_Constant, return_true); + def(AST_Lambda, return_true); + def(AST_Object, function() { + return all(this.properties, function(prop) { + return !(prop instanceof AST_ObjectGetter || prop instanceof AST_Spread); + }); + }); + def(AST_Sequence, function() { + return this.tail_node().safe_to_spread(); + }); + def(AST_SymbolRef, function() { + var fixed = this.fixed_value(); + return fixed && fixed.safe_to_spread(); + }); + def(AST_Unary, return_true); + })(function(node, func) { + node.DEFMETHOD("safe_to_spread", func); + }); + + // determine if expression has side effects + (function(def) { + function any(list, compressor, spread) { + return !all(list, spread ? function(node) { + return node instanceof AST_Spread ? !spread(node, compressor) : !node.has_side_effects(compressor); + } : function(node) { + return !node.has_side_effects(compressor); + }); + } + function array_spread(node, compressor) { + var exp = node.expression; + return !exp.is_string(compressor) || exp.has_side_effects(compressor); + } + def(AST_Node, return_true); + def(AST_Array, function(compressor) { + return any(this.elements, compressor, array_spread); + }); + def(AST_Assign, function(compressor) { + var lhs = this.left; + if (!(lhs instanceof AST_PropAccess)) return true; + var node = lhs.expression; + return !(node instanceof AST_ObjectIdentity) + || !node.scope.resolve().new + || lhs instanceof AST_Sub && lhs.property.has_side_effects(compressor) + || this.right.has_side_effects(compressor); + }); + def(AST_Binary, function(compressor) { + return this.left.has_side_effects(compressor) + || this.right.has_side_effects(compressor) + || !can_drop_op(this.operator, this.right, compressor); + }); + def(AST_Block, function(compressor) { + return any(this.body, compressor); + }); + def(AST_Call, function(compressor) { + if (!this.is_expr_pure(compressor) + && (!this.is_call_pure(compressor) || this.expression.has_side_effects(compressor))) { + return true; + } + return any(this.args, compressor, array_spread); + }); + def(AST_Case, function(compressor) { + return this.expression.has_side_effects(compressor) + || any(this.body, compressor); + }); + def(AST_Class, function(compressor) { + var base = this.extends; + if (base) { + if (base instanceof AST_SymbolRef) base = base.fixed_value(); + if (!safe_for_extends(base)) return true; + } + return any(this.properties, compressor); + }); + def(AST_ClassProperty, function(compressor) { + return this.key instanceof AST_Node && this.key.has_side_effects(compressor) + || this.static && this.value && this.value.has_side_effects(compressor); + }); + def(AST_Conditional, function(compressor) { + return this.condition.has_side_effects(compressor) + || this.consequent.has_side_effects(compressor) + || this.alternative.has_side_effects(compressor); + }); + def(AST_Constant, return_false); + def(AST_Definitions, function(compressor) { + return any(this.definitions, compressor); + }); + def(AST_DestructuredArray, function(compressor) { + return any(this.elements, compressor); + }); + def(AST_DestructuredKeyVal, function(compressor) { + return this.key instanceof AST_Node && this.key.has_side_effects(compressor) + || this.value.has_side_effects(compressor); + }); + def(AST_DestructuredObject, function(compressor) { + return any(this.properties, compressor); + }); + def(AST_Dot, function(compressor) { + return this.expression.may_throw_on_access(compressor) + || this.expression.has_side_effects(compressor); + }); + def(AST_EmptyStatement, return_false); + def(AST_If, function(compressor) { + return this.condition.has_side_effects(compressor) + || this.body && this.body.has_side_effects(compressor) + || this.alternative && this.alternative.has_side_effects(compressor); + }); + def(AST_LabeledStatement, function(compressor) { + return this.body.has_side_effects(compressor); + }); + def(AST_Lambda, return_false); + def(AST_Object, function(compressor) { + return any(this.properties, compressor, function(node, compressor) { + var exp = node.expression; + return !exp.safe_to_spread() || exp.has_side_effects(compressor); + }); + }); + def(AST_ObjectIdentity, return_false); + def(AST_ObjectProperty, function(compressor) { + return this.key instanceof AST_Node && this.key.has_side_effects(compressor) + || this.value.has_side_effects(compressor); + }); + def(AST_Sequence, function(compressor) { + return any(this.expressions, compressor); + }); + def(AST_SimpleStatement, function(compressor) { + return this.body.has_side_effects(compressor); + }); + def(AST_Sub, function(compressor) { + return this.expression.may_throw_on_access(compressor) + || this.expression.has_side_effects(compressor) + || this.property.has_side_effects(compressor); + }); + def(AST_Switch, function(compressor) { + return this.expression.has_side_effects(compressor) + || any(this.body, compressor); + }); + def(AST_SymbolDeclaration, return_false); + def(AST_SymbolRef, function(compressor) { + return !this.is_declared(compressor) || !can_drop_symbol(this, compressor); + }); + def(AST_Template, function(compressor) { + return !this.is_expr_pure(compressor) || any(this.expressions, compressor); + }); + def(AST_Try, function(compressor) { + return any(this.body, compressor) + || this.bcatch && this.bcatch.has_side_effects(compressor) + || this.bfinally && this.bfinally.has_side_effects(compressor); + }); + def(AST_Unary, function(compressor) { + return unary_side_effects[this.operator] + || this.expression.has_side_effects(compressor); + }); + def(AST_VarDef, function() { + return this.value; + }); + })(function(node, func) { + node.DEFMETHOD("has_side_effects", func); + }); + + // determine if expression may throw + (function(def) { + def(AST_Node, return_true); + + def(AST_Constant, return_false); + def(AST_EmptyStatement, return_false); + def(AST_Lambda, return_false); + def(AST_ObjectIdentity, return_false); + def(AST_SymbolDeclaration, return_false); + + function any(list, compressor) { + for (var i = list.length; --i >= 0;) + if (list[i].may_throw(compressor)) + return true; + return false; + } + + function call_may_throw(exp, compressor) { + if (exp.may_throw(compressor)) return true; + if (exp instanceof AST_SymbolRef) exp = exp.fixed_value(); + if (!(exp instanceof AST_Lambda)) return true; + if (any(exp.argnames, compressor)) return true; + if (any(exp.body, compressor)) return true; + return is_arrow(exp) && exp.value && exp.value.may_throw(compressor); + } + + def(AST_Array, function(compressor) { + return any(this.elements, compressor); + }); + def(AST_Assign, function(compressor) { + if (this.right.may_throw(compressor)) return true; + if (!compressor.has_directive("use strict") + && this.operator == "=" + && this.left instanceof AST_SymbolRef) { + return false; + } + return this.left.may_throw(compressor); + }); + def(AST_Await, function(compressor) { + return this.expression.may_throw(compressor); + }); + def(AST_Binary, function(compressor) { + return this.left.may_throw(compressor) + || this.right.may_throw(compressor) + || !can_drop_op(this.operator, this.right, compressor); + }); + def(AST_Block, function(compressor) { + return any(this.body, compressor); + }); + def(AST_Call, function(compressor) { + if (any(this.args, compressor)) return true; + if (this.is_expr_pure(compressor)) return false; + this.may_throw = return_true; + var ret = call_may_throw(this.expression, compressor); + delete this.may_throw; + return ret; + }); + def(AST_Case, function(compressor) { + return this.expression.may_throw(compressor) + || any(this.body, compressor); + }); + def(AST_Conditional, function(compressor) { + return this.condition.may_throw(compressor) + || this.consequent.may_throw(compressor) + || this.alternative.may_throw(compressor); + }); + def(AST_DefaultValue, function(compressor) { + return this.name.may_throw(compressor) + || this.value && this.value.may_throw(compressor); + }); + def(AST_Definitions, function(compressor) { + return any(this.definitions, compressor); + }); + def(AST_Dot, function(compressor) { + return !this.optional && this.expression.may_throw_on_access(compressor) + || this.expression.may_throw(compressor); + }); + def(AST_ForEnumeration, function(compressor) { + if (this.init.may_throw(compressor)) return true; + var obj = this.object; + if (obj.may_throw(compressor)) return true; + obj = obj.tail_node(); + if (!(obj instanceof AST_Array || obj.is_string(compressor))) return true; + return this.body.may_throw(compressor); + }); + def(AST_If, function(compressor) { + return this.condition.may_throw(compressor) + || this.body && this.body.may_throw(compressor) + || this.alternative && this.alternative.may_throw(compressor); + }); + def(AST_LabeledStatement, function(compressor) { + return this.body.may_throw(compressor); + }); + def(AST_Object, function(compressor) { + return any(this.properties, compressor); + }); + def(AST_ObjectProperty, function(compressor) { + return this.value.may_throw(compressor) + || this.key instanceof AST_Node && this.key.may_throw(compressor); + }); + def(AST_Return, function(compressor) { + return this.value && this.value.may_throw(compressor); + }); + def(AST_Sequence, function(compressor) { + return any(this.expressions, compressor); + }); + def(AST_SimpleStatement, function(compressor) { + return this.body.may_throw(compressor); + }); + def(AST_Sub, function(compressor) { + return !this.optional && this.expression.may_throw_on_access(compressor) + || this.expression.may_throw(compressor) + || this.property.may_throw(compressor); + }); + def(AST_Switch, function(compressor) { + return this.expression.may_throw(compressor) + || any(this.body, compressor); + }); + def(AST_SymbolRef, function(compressor) { + return !this.is_declared(compressor) || !can_drop_symbol(this, compressor); + }); + def(AST_Template, function(compressor) { + if (any(this.expressions, compressor)) return true; + if (this.is_expr_pure(compressor)) return false; + if (!this.tag) return false; + this.may_throw = return_true; + var ret = call_may_throw(this.tag, compressor); + delete this.may_throw; + return ret; + }); + def(AST_Try, function(compressor) { + return (this.bcatch ? this.bcatch.may_throw(compressor) : any(this.body, compressor)) + || this.bfinally && this.bfinally.may_throw(compressor); + }); + def(AST_Unary, function(compressor) { + return this.expression.may_throw(compressor) + && !(this.operator == "typeof" && this.expression instanceof AST_SymbolRef); + }); + def(AST_VarDef, function(compressor) { + return this.name.may_throw(compressor) + || this.value && this.value.may_throw(compressor); + }); + })(function(node, func) { + node.DEFMETHOD("may_throw", func); + }); + + // determine if expression is constant + (function(def) { + function all_constant(list, scope) { + for (var i = list.length; --i >= 0;) + if (!list[i].is_constant_expression(scope)) + return false; + return true; + } + def(AST_Node, return_false); + def(AST_Array, function(scope) { + return all_constant(this.elements, scope); + }); + def(AST_Binary, function(scope) { + return this.left.is_constant_expression(scope) + && this.right.is_constant_expression(scope) + && can_drop_op(this.operator, this.right); + }); + def(AST_Class, function(scope) { + var base = this.extends; + if (base && !safe_for_extends(base)) return false; + return all_constant(this.properties, scope); + }); + def(AST_ClassProperty, function(scope) { + return typeof this.key == "string" && (!this.value || this.value.is_constant_expression(scope)); + }); + def(AST_Constant, return_true); + def(AST_Lambda, function(scope) { + var self = this; + var result = true; + var scopes = []; + self.walk(new TreeWalker(function(node, descend) { + if (!result) return true; + if (node instanceof AST_BlockScope) { + if (node === self) return; + scopes.push(node); + descend(); + scopes.pop(); + return true; + } + if (node instanceof AST_SymbolRef) { + if (self.inlined || node.redef || node.in_arg) { + result = false; + return true; + } + if (self.variables.has(node.name)) return true; + var def = node.definition(); + if (member(def.scope, scopes)) return true; + if (scope && !def.redefined()) { + var scope_def = scope.find_variable(node.name); + if (scope_def ? scope_def === def : def.undeclared) { + result = "f"; + return true; + } + } + result = false; + return true; + } + if (node instanceof AST_ObjectIdentity) { + if (is_arrow(self) && all(scopes, function(s) { + return !(s instanceof AST_Scope) || is_arrow(s); + })) result = false; + return true; + } + })); + return result; + }); + def(AST_Object, function(scope) { + return all_constant(this.properties, scope); + }); + def(AST_ObjectProperty, function(scope) { + return typeof this.key == "string" && this.value.is_constant_expression(scope); + }); + def(AST_Unary, function(scope) { + return this.expression.is_constant_expression(scope); + }); + })(function(node, func) { + node.DEFMETHOD("is_constant_expression", func); + }); + + // tell me if a statement aborts + function aborts(thing) { + return thing && thing.aborts(); + } + (function(def) { + def(AST_Statement, return_null); + def(AST_Jump, return_this); + function block_aborts() { + var n = this.body.length; + return n > 0 && aborts(this.body[n - 1]); + } + def(AST_BlockStatement, block_aborts); + def(AST_SwitchBranch, block_aborts); + def(AST_If, function() { + return this.alternative && aborts(this.body) && aborts(this.alternative) && this; + }); + })(function(node, func) { + node.DEFMETHOD("aborts", func); + }); + + /* -----[ optimizers ]----- */ + + var directives = makePredicate(["use asm", "use strict"]); + OPT(AST_Directive, function(self, compressor) { + if (compressor.option("directives") + && (!directives[self.value] || compressor.has_directive(self.value) !== self)) { + return make_node(AST_EmptyStatement, self); + } + return self; + }); + + OPT(AST_Debugger, function(self, compressor) { + if (compressor.option("drop_debugger")) + return make_node(AST_EmptyStatement, self); + return self; + }); + + OPT(AST_LabeledStatement, function(self, compressor) { + if (self.body instanceof AST_If || self.body instanceof AST_Break) { + var body = tighten_body([ self.body ], compressor); + switch (body.length) { + case 0: + self.body = make_node(AST_EmptyStatement, self); + break; + case 1: + self.body = body[0]; + break; + default: + self.body = make_node(AST_BlockStatement, self, { body: body }); + break; + } + } + return compressor.option("unused") && self.label.references.length == 0 ? self.body : self; + }); + + OPT(AST_LoopControl, function(self, compressor) { + if (!compressor.option("dead_code")) return self; + var label = self.label; + if (label) { + var lct = compressor.loopcontrol_target(self); + self.label = null; + if (compressor.loopcontrol_target(self) === lct) { + remove(label.thedef.references, self); + } else { + self.label = label; + } + } + return self; + }); + + OPT(AST_Block, function(self, compressor) { + self.body = tighten_body(self.body, compressor); + return self; + }); + + function trim_block(node, parent, in_list) { + switch (node.body.length) { + case 0: + return in_list ? List.skip : make_node(AST_EmptyStatement, node); + case 1: + var stat = node.body[0]; + if (!safe_to_trim(stat)) return node; + if (parent instanceof AST_IterationStatement && stat instanceof AST_LambdaDefinition) return node; + return stat; + } + return node; + } + + OPT(AST_BlockStatement, function(self, compressor) { + self.body = tighten_body(self.body, compressor); + return trim_block(self, compressor.parent()); + }); + + function drop_rest_farg(fn, compressor) { + if (!compressor.option("rests")) return; + if (fn.uses_arguments) return; + if (!(fn.rest instanceof AST_DestructuredArray)) return; + if (!compressor.drop_fargs(fn, compressor.parent())) return; + fn.argnames = fn.argnames.concat(fn.rest.elements); + fn.rest = fn.rest.rest; + } + + OPT(AST_Lambda, function(self, compressor) { + drop_rest_farg(self, compressor); + self.body = tighten_body(self.body, compressor); + return self; + }); + + function opt_arrow(self, compressor) { + if (!compressor.option("arrows")) return self; + drop_rest_farg(self, compressor); + if (self.value) self.body = [ self.first_statement() ]; + var body = tighten_body(self.body, compressor); + switch (body.length) { + case 1: + var stat = body[0]; + if (stat instanceof AST_Return) { + self.body.length = 0; + self.value = stat.value; + break; + } + default: + self.body = body; + self.value = null; + break; + } + return self; + } + OPT(AST_Arrow, opt_arrow); + OPT(AST_AsyncArrow, opt_arrow); + + OPT(AST_Function, function(self, compressor) { + drop_rest_farg(self, compressor); + self.body = tighten_body(self.body, compressor); + var parent = compressor.parent(); + if (compressor.option("inline")) for (var i = 0; i < self.body.length; i++) { + var stat = self.body[i]; + if (stat instanceof AST_Directive) continue; + if (stat instanceof AST_Return) { + if (i != self.body.length - 1) break; + var call = stat.value; + if (!call || call.TYPE != "Call") break; + if (call.is_expr_pure(compressor)) break; + var exp = call.expression, fn; + if (!(exp instanceof AST_SymbolRef)) { + fn = exp; + } else if (self.name && self.name.definition() === exp.definition()) { + break; + } else { + fn = exp.fixed_value(); + } + if (!(fn instanceof AST_Defun || fn instanceof AST_Function)) break; + if (fn.rest) break; + if (fn.uses_arguments) break; + if (fn === exp) { + if (fn.parent_scope !== self) break; + if (!all(fn.enclosed, function(def) { + return def.scope !== self; + })) break; + } + if ((fn !== exp || fn.name) + && (parent instanceof AST_ClassMethod || parent instanceof AST_ObjectMethod) + && parent.value === compressor.self()) break; + if (fn.contains_this()) break; + var len = fn.argnames.length; + if (len > 0 && compressor.option("inline") < 2) break; + if (len > self.argnames.length) break; + if (!all(self.argnames, function(argname) { + return argname instanceof AST_SymbolFunarg; + })) break; + if (!all(call.args, function(arg) { + return !(arg instanceof AST_Spread); + })) break; + for (var j = 0; j < len; j++) { + var arg = call.args[j]; + if (!(arg instanceof AST_SymbolRef)) break; + if (arg.definition() !== self.argnames[j].definition()) break; + } + if (j < len) break; + for (; j < call.args.length; j++) { + if (call.args[j].has_side_effects(compressor)) break; + } + if (j < call.args.length) break; + if (len < self.argnames.length && !compressor.drop_fargs(self, parent)) { + if (!compressor.drop_fargs(fn, call)) break; + do { + fn.argnames.push(fn.make_var(AST_SymbolFunarg, fn, "argument_" + len)); + } while (++len < self.argnames.length); + } + return exp; + } + break; + } + return self; + }); + + var NO_MERGE = makePredicate("arguments await yield"); + AST_Scope.DEFMETHOD("merge_variables", function(compressor) { + if (!compressor.option("merge_vars")) return; + var in_arg = [], in_try, root, segment = {}, self = this; + var first = [], last = [], index = 0; + var declarations = new Dictionary(); + var references = Object.create(null); + var prev = Object.create(null); + var tw = new TreeWalker(function(node, descend) { + if (node instanceof AST_Assign) { + var lhs = node.left; + var rhs = node.right; + if (lhs instanceof AST_Destructured) { + rhs.walk(tw); + walk_destructured(AST_SymbolRef, mark, lhs); + return true; + } + if (lazy_op[node.operator.slice(0, -1)]) { + lhs.walk(tw); + push(); + rhs.walk(tw); + if (lhs instanceof AST_SymbolRef) mark(lhs); + pop(); + return true; + } + if (lhs instanceof AST_SymbolRef) { + if (node.operator != "=") mark(lhs, true); + rhs.walk(tw); + mark(lhs); + return true; + } + return; + } + if (node instanceof AST_Binary) { + if (!lazy_op[node.operator]) return; + walk_cond(node); + return true; + } + if (node instanceof AST_Break) { + var target = tw.loopcontrol_target(node); + if (!(target instanceof AST_IterationStatement)) insert(target); + return true; + } + if (node instanceof AST_Call) { + var exp = node.expression; + if (exp instanceof AST_LambdaExpression) { + node.args.forEach(function(arg) { + arg.walk(tw); + }); + exp.walk(tw); + } else { + descend(); + mark_expression(exp); + } + return true; + } + if (node instanceof AST_Class) { + if (node.name) node.name.walk(tw); + if (node.extends) node.extends.walk(tw); + node.properties.filter(function(prop) { + if (prop.key instanceof AST_Node) prop.key.walk(tw); + return prop.value; + }).forEach(function(prop) { + if (prop.static) { + prop.value.walk(tw); + } else { + push(); + segment.block = node; + prop.value.walk(tw); + pop(); + } + }); + return true; + } + if (node instanceof AST_Conditional) { + walk_cond(node.condition, node.consequent, node.alternative); + return true; + } + if (node instanceof AST_Continue) { + var target = tw.loopcontrol_target(node); + if (target instanceof AST_Do) insert(target); + return true; + } + if (node instanceof AST_Do) { + push(); + segment.block = node; + segment.loop = true; + var save = segment; + node.body.walk(tw); + if (segment.inserted === node) segment = save; + node.condition.walk(tw); + pop(); + return true; + } + if (node instanceof AST_For) { + if (node.init) node.init.walk(tw); + push(); + segment.block = node; + segment.loop = true; + if (node.condition) node.condition.walk(tw); + node.body.walk(tw); + if (node.step) node.step.walk(tw); + pop(); + return true; + } + if (node instanceof AST_ForEnumeration) { + node.object.walk(tw); + push(); + segment.block = node; + segment.loop = true; + node.init.walk(tw); + node.body.walk(tw); + pop(); + return true; + } + if (node instanceof AST_If) { + walk_cond(node.condition, node.body, node.alternative); + return true; + } + if (node instanceof AST_LabeledStatement) { + push(); + segment.block = node; + var save = segment; + node.body.walk(tw); + if (segment.inserted === node) segment = save; + pop(); + return true; + } + if (node instanceof AST_Scope) { + push(); + segment.block = node; + if (node === self) root = segment; + if (node instanceof AST_Lambda) { + if (node.name) references[node.name.definition().id] = false; + var marker = node.uses_arguments && !tw.has_directive("use strict") ? function(node) { + references[node.definition().id] = false; + } : function(node) { + mark(node); + }; + in_arg.push(node); + node.argnames.forEach(function(argname) { + walk_destructured(AST_SymbolFunarg, marker, argname); + }); + if (node.rest) walk_destructured(AST_SymbolFunarg, marker, node.rest); + in_arg.pop(); + } + walk_lambda(node, tw); + pop(); + return true; + } + if (node instanceof AST_Sub) { + var exp = node.expression; + if (node.optional) { + exp.walk(tw); + push(); + node.property.walk(tw); + pop(); + } else { + descend(); + } + mark_expression(exp); + return true; + } + if (node instanceof AST_Switch) { + node.expression.walk(tw); + var save = segment; + node.body.forEach(function(branch) { + if (branch instanceof AST_Default) return; + branch.expression.walk(tw); + if (save === segment) push(); + }); + segment = save; + node.body.forEach(function(branch) { + push(); + segment.block = node; + var save = segment; + walk_body(branch, tw); + if (segment.inserted === node) segment = save; + pop(); + }); + return true; + } + if (node instanceof AST_SymbolConst || node instanceof AST_SymbolLet) { + references[node.definition().id] = false; + return true; + } + if (node instanceof AST_SymbolRef) { + mark(node, true); + return true; + } + if (node instanceof AST_Try) { + var save_try = in_try; + in_try = node; + walk_body(node, tw); + if (node.bcatch) { + if (node.bcatch.argname) node.bcatch.argname.mark_symbol(function(node) { + if (node instanceof AST_SymbolCatch) { + var def = node.definition(); + references[def.id] = false; + if (def = def.redefined()) references[def.id] = false; + } + }, tw); + if (node.bfinally || (in_try = save_try)) { + walk_body(node.bcatch, tw); + } else { + push(); + walk_body(node.bcatch, tw); + pop(); + } + } + in_try = save_try; + if (node.bfinally) node.bfinally.walk(tw); + return true; + } + if (node instanceof AST_Unary) { + if (!UNARY_POSTFIX[node.operator]) return; + var sym = node.expression; + if (!(sym instanceof AST_SymbolRef)) return; + mark(sym, true); + return true; + } + if (node instanceof AST_VarDef) { + var assigned = node.value; + if (assigned) { + assigned.walk(tw); + } else { + assigned = segment.block instanceof AST_ForEnumeration && segment.block.init === tw.parent(); + } + walk_destructured(AST_SymbolDeclaration, assigned ? function(node) { + if (node instanceof AST_SymbolVar) { + mark(node); + } else { + node.walk(tw); + } + } : function(node) { + if (node instanceof AST_SymbolVar) { + var id = node.definition().id; + var refs = references[id]; + if (refs) { + refs.push(node); + } else if (!(id in references)) { + declarations.add(id, node); + } + } else { + node.walk(tw); + } + }, node.name); + return true; + } + if (node instanceof AST_While) { + push(); + segment.block = node; + segment.loop = true; + descend(); + pop(); + return true; + } + + function mark_expression(exp) { + if (!compressor.option("ie")) return; + var sym = root_expr(exp); + if (sym instanceof AST_SymbolRef) sym.walk(tw); + } + + function walk_cond(condition, consequent, alternative) { + var save = segment; + var segments = [ save, save ]; + if (condition instanceof AST_Binary) switch (condition.operator) { + case "&&": + segments[0] = walk_cond(condition.left, condition.right)[0]; + break; + case "||": + case "??": + segments[1] = walk_cond(condition.left, null, condition.right)[1]; + break; + default: + condition.walk(tw); + break; + } else if (condition instanceof AST_Conditional) { + walk_cond(condition.condition, condition.consequent, condition.alternative); + } else { + condition.walk(tw); + } + segment = segments[0]; + if (consequent) { + push(); + consequent.walk(tw); + } + segments[0] = segment; + segment = segments[1]; + if (alternative) { + push(); + alternative.walk(tw); + } + segments[1] = segment; + segment = save; + return segments; + } + }); + tw.directives = Object.create(compressor.directives); + self.walk(tw); + var changed = false; + var merged = Object.create(null); + while (first.length && last.length) { + var tail = last.shift(); + if (!tail) continue; + var def = tail.definition; + var tail_refs = references[def.id]; + if (!tail_refs) continue; + tail_refs = { end: tail_refs.end }; + while (def.id in merged) def = merged[def.id]; + tail_refs.start = references[def.id].start; + var skipped = []; + do { + var head = first.shift(); + if (tail.index > head.index) continue; + var prev_def = head.definition; + if (!(prev_def.id in prev)) continue; + var head_refs = references[prev_def.id]; + if (!head_refs) continue; + if (head_refs.start.block !== tail_refs.start.block + || !mergeable(head_refs, tail_refs) + || (head_refs.start.loop || !same_scope(def)) && !mergeable(tail_refs, head_refs) + || compressor.option("webkit") && is_funarg(def) !== is_funarg(prev_def) + || prev_def.const_redefs + || !all(head_refs.scopes, function(scope) { + return scope.find_variable(def.name) === def; + })) { + skipped.push(head); + continue; + } + head_refs.forEach(function(sym) { + sym.thedef = def; + sym.name = def.name; + if (sym instanceof AST_SymbolRef) { + def.references.push(sym); + prev_def.replaced++; + } else { + def.orig.push(sym); + prev_def.eliminated++; + } + }); + if (!prev_def.fixed) def.fixed = false; + merged[prev_def.id] = def; + changed = true; + break; + } while (first.length); + if (skipped.length) first = skipped.concat(first); + } + return changed; + + function push() { + segment = Object.create(segment); + } + + function pop() { + segment = Object.getPrototypeOf(segment); + } + + function walk_destructured(symbol_type, mark, lhs) { + var marker = new TreeWalker(function(node) { + if (node instanceof AST_Destructured) return; + if (node instanceof AST_DefaultValue) { + push(); + node.value.walk(tw); + pop(); + node.name.walk(marker); + } else if (node instanceof AST_DestructuredKeyVal) { + if (!(node.key instanceof AST_Node)) { + node.value.walk(marker); + } else if (node.value instanceof AST_PropAccess) { + push(); + segment.block = node; + node.key.walk(tw); + node.value.walk(marker); + pop(); + } else { + node.key.walk(tw); + node.value.walk(marker); + } + } else if (node instanceof symbol_type) { + mark(node); + } else { + node.walk(tw); + } + return true; + }); + lhs.walk(marker); + } + + function mark(sym, read) { + var def = sym.definition(), ldef; + if (read && !all(in_arg, function(fn) { + ldef = fn.variables.get(sym.name); + if (!ldef) return true; + if (!is_funarg(ldef)) return true; + return ldef !== def + && !def.undeclared + && fn.parent_scope.find_variable(sym.name) !== def; + })) return references[def.id] = references[ldef.id] = false; + var seg = segment; + if (in_try) { + push(); + seg = segment; + pop(); + } + if (def.id in references) { + var refs = references[def.id]; + if (!refs) return; + if (refs.start.block !== seg.block) return references[def.id] = false; + push_ref(sym); + refs.end = seg; + if (def.id in prev) { + last[prev[def.id]] = null; + } else if (!read) { + return; + } + } else if ((ldef = self.variables.get(def.name)) !== def) { + if (ldef && root === seg) references[ldef.id] = false; + return references[def.id] = false; + } else if (compressor.exposed(def) || NO_MERGE[sym.name]) { + return references[def.id] = false; + } else { + var refs = declarations.get(def.id) || []; + refs.scopes = []; + push_ref(sym); + references[def.id] = refs; + if (!read) { + refs.start = seg; + return first.push({ + index: index++, + definition: def, + }); + } + if (seg.block !== self) return references[def.id] = false; + refs.start = root; + } + prev[def.id] = last.length; + last.push({ + index: index++, + definition: def, + }); + + function push_ref(sym) { + refs.push(sym); + push_uniq(refs.scopes, sym.scope); + var scope = find_scope(tw); + if (scope !== sym.scope) push_uniq(refs.scopes, scope); + } + } + + function insert(target) { + var stack = []; + while (true) { + if (HOP(segment, "block")) { + var block = segment.block; + if (block instanceof AST_LabeledStatement) block = block.body; + if (block === target) break; + } + stack.push(segment); + pop(); + } + segment.inserted = segment.block; + push(); + while (stack.length) { + var seg = stack.pop(); + push(); + if (HOP(seg, "block")) segment.block = seg.block; + if (HOP(seg, "loop")) segment.loop = seg.loop; + } + } + + function must_visit(base, segment) { + return base === segment || base.isPrototypeOf(segment); + } + + function mergeable(head, tail) { + return must_visit(head.start, head.end) || must_visit(head.start, tail.start); + } + }); + + function fill_holes(orig, elements) { + for (var i = elements.length; --i >= 0;) { + if (!elements[i]) elements[i] = make_node(AST_Hole, orig); + } + } + + function to_class_expr(defcl, drop_name) { + var cl = make_node(AST_ClassExpression, defcl); + if (cl.name) cl.name = drop_name ? null : make_node(AST_SymbolClass, cl.name); + return cl; + } + + function to_func_expr(defun, drop_name) { + var ctor; + switch (defun.CTOR) { + case AST_AsyncDefun: + ctor = AST_AsyncFunction; + break; + case AST_AsyncGeneratorDefun: + ctor = AST_AsyncGeneratorFunction; + break; + case AST_Defun: + ctor = AST_Function; + break; + case AST_GeneratorDefun: + ctor = AST_GeneratorFunction; + break; + } + var fn = make_node(ctor, defun); + fn.name = drop_name ? null : make_node(AST_SymbolLambda, defun.name); + return fn; + } + + AST_Scope.DEFMETHOD("drop_unused", function(compressor) { + if (!compressor.option("unused")) return; + var self = this; + var drop_funcs = !(self instanceof AST_Toplevel) || compressor.toplevel.funcs; + var drop_vars = !(self instanceof AST_Toplevel) || compressor.toplevel.vars; + var assign_as_unused = /keep_assign/.test(compressor.option("unused")) ? return_false : function(node, props) { + var sym, nested = false; + if (node instanceof AST_Assign) { + if (node.write_only || node.operator == "=") sym = extract_reference(node.left, props); + } else if (node instanceof AST_Unary) { + if (node.write_only) sym = extract_reference(node.expression, props); + } + if (!(sym instanceof AST_SymbolRef)) return; + var def = sym.definition(); + if (export_defaults[def.id]) return; + if (compressor.exposed(def)) return; + if (!can_drop_symbol(sym, compressor, nested)) return; + return sym; + + function extract_reference(node, props) { + if (node instanceof AST_PropAccess) { + var expr = node.expression; + if (!expr.may_throw_on_access(compressor, true)) { + nested = true; + if (props && node instanceof AST_Sub) props.unshift(node.property); + return extract_reference(expr, props); + } + } else if (node instanceof AST_Assign && node.operator == "=") { + node.write_only = "p"; + var ref = extract_reference(node.right); + if (!props) return ref; + props.assign = node; + return ref instanceof AST_SymbolRef ? ref : node.left; + } + return node; + } + }; + var assign_in_use = Object.create(null); + var export_defaults = Object.create(null); + var find_variable = function(name) { + find_variable = compose(self, 0, noop); + return find_variable(name); + + function compose(child, level, find) { + var parent = compressor.parent(level); + if (!parent) return find; + var in_arg = parent instanceof AST_Lambda && member(child, parent.argnames); + return compose(parent, level + 1, in_arg ? function(name) { + var def = find(name); + if (def) return def; + def = parent.variables.get(name); + if (def) { + var sym = def.orig[0]; + if (sym instanceof AST_SymbolFunarg || sym instanceof AST_SymbolLambda) return def; + } + } : parent.variables ? function(name) { + return find(name) || parent.variables.get(name); + } : find); + } + }; + var for_ins = Object.create(null); + var in_use = []; + var in_use_ids = Object.create(null); // avoid expensive linear scans of in_use + var lambda_ids = Object.create(null); + var value_read = Object.create(null); + var value_modified = Object.create(null); + var var_defs = Object.create(null); + if (self instanceof AST_Toplevel && compressor.top_retain) { + self.variables.each(function(def) { + if (compressor.top_retain(def) && !(def.id in in_use_ids)) { + AST_Node.info("Retaining variable {name}", def); + in_use_ids[def.id] = true; + in_use.push(def); + } + }); + } + var assignments = new Dictionary(); + var initializations = new Dictionary(); + // pass 1: find out which symbols are directly used in + // this scope (not in nested scopes). + var scope = this; + var tw = new TreeWalker(function(node, descend) { + if (node instanceof AST_Lambda && node.uses_arguments && !tw.has_directive("use strict")) { + node.each_argname(function(argname) { + var def = argname.definition(); + if (!(def.id in in_use_ids)) { + in_use_ids[def.id] = true; + in_use.push(def); + } + }); + } + if (node === self) return; + if (scope === self) { + if (node instanceof AST_DefClass) { + var def = node.name.definition(); + var drop = drop_funcs && !def.exported; + if (!drop && !(def.id in in_use_ids)) { + in_use_ids[def.id] = true; + in_use.push(def); + } + var used = tw.parent() instanceof AST_ExportDefault; + if (used) { + export_defaults[def.id] = true; + } else if (drop && !(def.id in lambda_ids)) { + lambda_ids[def.id] = 1; + } + if (node.extends) node.extends.walk(tw); + var values = []; + node.properties.forEach(function(prop) { + if (prop.key instanceof AST_Node) prop.key.walk(tw); + var value = prop.value; + if (!value) return; + if (is_static_field_or_init(prop)) { + if (!used && value.contains_this()) used = true; + walk_class_prop(value); + } else { + values.push(value); + } + }); + values.forEach(drop && used ? walk_class_prop : function(value) { + initializations.add(def.id, value); + }); + return true; + } + if (node instanceof AST_LambdaDefinition) { + var def = node.name.definition(); + var drop = drop_funcs && !def.exported; + if (!drop && !(def.id in in_use_ids)) { + in_use_ids[def.id] = true; + in_use.push(def); + } + initializations.add(def.id, node); + if (tw.parent() instanceof AST_ExportDefault) { + export_defaults[def.id] = true; + return scan_ref_scoped(node, descend, true); + } + if (drop && !(def.id in lambda_ids)) lambda_ids[def.id] = 1; + return true; + } + if (node instanceof AST_Definitions) { + node.definitions.forEach(function(defn) { + var value = defn.value; + var side_effects = value + && (defn.name instanceof AST_Destructured || value.has_side_effects(compressor)); + var shared = side_effects && value.tail_node().operator == "="; + defn.name.mark_symbol(function(name) { + if (!(name instanceof AST_SymbolDeclaration)) return; + var def = name.definition(); + var_defs[def.id] = (var_defs[def.id] || 0) + 1; + if (node instanceof AST_Var && def.orig[0] instanceof AST_SymbolCatch) { + var redef = def.redefined(); + if (redef) var_defs[redef.id] = (var_defs[redef.id] || 0) + 1; + } + if (!(def.id in in_use_ids) && (!drop_vars || def.exported + || (node instanceof AST_Const ? def.redefined() : def.const_redefs) + || !(node instanceof AST_Var || is_safe_lexical(def)))) { + in_use_ids[def.id] = true; + in_use.push(def); + } + if (value) { + if (!side_effects) { + initializations.add(def.id, value); + } else if (shared) { + verify_safe_usage(def, name, value_modified[def.id]); + } + assignments.add(def.id, defn); + } + unmark_lambda(def); + return true; + }, tw); + if (side_effects) value.walk(tw); + }); + return true; + } + if (node instanceof AST_SymbolFunarg) { + var def = node.definition(); + var_defs[def.id] = (var_defs[def.id] || 0) + 1; + assignments.add(def.id, node); + return true; + } + if (node instanceof AST_SymbolImport) { + var def = node.definition(); + if (!(def.id in in_use_ids) && (!drop_vars || !is_safe_lexical(def))) { + in_use_ids[def.id] = true; + in_use.push(def); + } + return true; + } + } + return scan_ref_scoped(node, descend, true); + + function walk_class_prop(value) { + var save_scope = scope; + scope = node; + value.walk(tw); + scope = save_scope; + } + }); + tw.directives = Object.create(compressor.directives); + self.walk(tw); + var drop_fn_name = compressor.option("keep_fnames") ? return_false : compressor.option("ie") ? function(def) { + return !compressor.exposed(def) && def.references.length == def.replaced; + } : function(def) { + if (!(def.id in in_use_ids)) return true; + if (def.orig.length - def.eliminated < 2) return false; + // function argument will always overshadow its name + if (def.orig[1] instanceof AST_SymbolFunarg) return true; + // retain if referenced within destructured object of argument + return all(def.references, function(ref) { + return !ref.in_arg; + }); + }; + if (compressor.option("ie")) initializations.each(function(init, id) { + if (id in in_use_ids) return; + init.forEach(function(init) { + init.walk(new TreeWalker(function(node) { + if (node instanceof AST_Function && node.name && !drop_fn_name(node.name.definition())) { + node.walk(tw); + return true; + } + if (node instanceof AST_Scope) return true; + })); + }); + }); + // pass 2: for every used symbol we need to walk its + // initialization code to figure out if it uses other + // symbols (that may not be in_use). + tw = new TreeWalker(scan_ref_scoped); + for (var i = 0; i < in_use.length; i++) { + var init = initializations.get(in_use[i].id); + if (init) init.forEach(function(init) { + init.walk(tw); + }); + } + Object.keys(assign_in_use).forEach(function(id) { + var assigns = assign_in_use[id]; + if (!assigns) { + delete assign_in_use[id]; + return; + } + assigns = assigns.reduce(function(in_use, assigns) { + assigns.forEach(function(assign) { + push_uniq(in_use, assign); + }); + return in_use; + }, []); + var in_use = (assignments.get(id) || []).filter(function(node) { + return find_if(node instanceof AST_Unary ? function(assign) { + return assign === node; + } : function(assign) { + if (assign === node) return true; + if (assign instanceof AST_Unary) return false; + return get_rvalue(assign) === get_rvalue(node); + }, assigns); + }); + if (assigns.length == in_use.length) { + assign_in_use[id] = in_use; + } else { + delete assign_in_use[id]; + } + }); + // pass 3: we should drop declarations not in_use + var calls_to_drop_args = []; + var fns_with_marked_args = []; + var trimmer = new TreeTransformer(function(node) { + if (node instanceof AST_DefaultValue) return trim_default(trimmer, node); + if (node instanceof AST_Destructured && node.rest) node.rest = node.rest.transform(trimmer); + if (node instanceof AST_DestructuredArray) { + var trim = !node.rest; + for (var i = node.elements.length; --i >= 0;) { + var element = node.elements[i].transform(trimmer); + if (element) { + node.elements[i] = element; + trim = false; + } else if (trim) { + node.elements.pop(); + } else { + node.elements[i] = make_node(AST_Hole, node.elements[i]); + } + } + return node; + } + if (node instanceof AST_DestructuredObject) { + var properties = []; + node.properties.forEach(function(prop) { + var retain = false; + if (prop.key instanceof AST_Node) { + prop.key = prop.key.transform(tt); + retain = prop.key.has_side_effects(compressor); + } + if ((retain || node.rest) && is_decl(prop.value)) { + prop.value = prop.value.transform(tt); + properties.push(prop); + } else { + var value = prop.value.transform(trimmer); + if (!value && node.rest) { + if (prop.value instanceof AST_DestructuredArray) { + value = make_node(AST_DestructuredArray, prop.value, { elements: [] }); + } else { + value = make_node(AST_DestructuredObject, prop.value, { properties: [] }); + } + } + if (value) { + prop.value = value; + properties.push(prop); + } + } + }); + node.properties = properties; + return node; + } + if (node instanceof AST_SymbolDeclaration) return trim_decl(node); + }); + var tt = new TreeTransformer(function(node, descend, in_list) { + var parent = tt.parent(); + if (drop_vars) { + var props = [], sym = assign_as_unused(node, props); + if (sym) { + var value; + if (can_drop_lhs(sym, node)) { + if (node instanceof AST_Assign) { + value = get_rhs(node); + if (node.write_only === true) value = value.drop_side_effect_free(compressor); + } + if (!value) value = make_node(AST_Number, node, { value: 0 }); + } + if (value) { + if (props.assign) { + var assign = props.assign.drop_side_effect_free(compressor); + if (assign) { + assign.write_only = true; + props.unshift(assign); + } + } + if (!(parent instanceof AST_Sequence) + || parent.tail_node() === node + || value.has_side_effects(compressor)) { + props.push(value); + } + switch (props.length) { + case 0: + return List.skip; + case 1: + return maintain_this_binding(parent, node, props[0].transform(tt)); + default: + return make_sequence(node, props.map(function(prop) { + return prop.transform(tt); + })); + } + } + } else if (node instanceof AST_UnaryPostfix + && node.expression instanceof AST_SymbolRef + && indexOf_assign(node.expression.definition(), node) < 0) { + return make_node(AST_UnaryPrefix, node, { + operator: "+", + expression: node.expression, + }); + } + } + if (node instanceof AST_Binary && node.operator == "instanceof") { + var sym = node.right; + if (!(sym instanceof AST_SymbolRef)) return; + if (sym.definition().id in in_use_ids) return; + var lhs = node.left.drop_side_effect_free(compressor); + var value = make_node(AST_False, node).optimize(compressor); + return lhs ? make_sequence(node, [ lhs, value ]) : value; + } + if (node instanceof AST_Call) { + calls_to_drop_args.push(node); + node.args = node.args.map(function(arg) { + return arg.transform(tt); + }); + node.expression = node.expression.transform(tt); + return node; + } + if (scope !== self) return; + if (drop_funcs && node !== self && node instanceof AST_DefClass) { + var def = node.name.definition(); + if (!(def.id in in_use_ids)) { + log(node.name, "Dropping unused class {name}"); + def.eliminated++; + descend(node, tt); + var trimmed = to_class_expr(node, true); + if (parent instanceof AST_ExportDefault) return trimmed; + trimmed = trimmed.drop_side_effect_free(compressor, true); + if (trimmed) return make_node(AST_SimpleStatement, node, { body: trimmed }); + return in_list ? List.skip : make_node(AST_EmptyStatement, node); + } + } + if (node instanceof AST_ClassExpression && node.name && drop_fn_name(node.name.definition())) { + node.name = null; + } + if (node instanceof AST_Lambda) { + if (drop_funcs && node !== self && node instanceof AST_LambdaDefinition) { + var def = node.name.definition(); + if (!(def.id in in_use_ids)) { + log(node.name, "Dropping unused function {name}"); + def.eliminated++; + if (parent instanceof AST_ExportDefault) { + descend_scope(); + return to_func_expr(node, true); + } + return in_list ? List.skip : make_node(AST_EmptyStatement, node); + } + } + descend_scope(); + if (node instanceof AST_LambdaExpression && node.name && drop_fn_name(node.name.definition())) { + node.name = null; + } + if (!(node instanceof AST_Accessor)) { + var args, spread, trim = compressor.drop_fargs(node, parent); + if (trim && parent instanceof AST_Call && parent.expression === node) { + args = parent.args; + for (spread = 0; spread < args.length; spread++) { + if (args[spread] instanceof AST_Spread) break; + } + } + var argnames = node.argnames; + var rest = node.rest; + var after = false, before = false; + if (rest) { + before = true; + if (!args || spread < argnames.length || rest instanceof AST_SymbolFunarg) { + rest = rest.transform(trimmer); + } else { + var trimmed = trim_destructured(rest, make_node(AST_Array, parent, { + elements: args.slice(argnames.length), + }), trim_decl, !node.uses_arguments, rest); + rest = trimmed.name; + args.length = argnames.length; + if (trimmed.value.elements.length) [].push.apply(args, trimmed.value.elements); + } + if (rest instanceof AST_Destructured && !rest.rest) { + if (rest instanceof AST_DestructuredArray) { + if (rest.elements.length == 0) rest = null; + } else if (rest.properties.length == 0) { + rest = null; + } + } + node.rest = rest; + if (rest) { + trim = false; + after = true; + } + } + var default_length = trim ? -1 : node.length(); + var trim_value = args && !node.uses_arguments && parent !== compressor.parent(); + for (var i = argnames.length; --i >= 0;) { + var sym = argnames[i]; + if (sym instanceof AST_SymbolFunarg) { + var def = sym.definition(); + if (def.id in in_use_ids) { + trim = false; + if (indexOf_assign(def, sym) < 0) sym.unused = null; + } else if (trim) { + log(sym, "Dropping unused function argument {name}"); + argnames.pop(); + def.eliminated++; + sym.unused = true; + } else { + sym.unused = true; + } + } else { + before = true; + var funarg; + if (!args || spread < i) { + funarg = sym.transform(trimmer); + } else { + var trimmed = trim_destructured(sym, args[i], trim_decl, trim_value, sym); + funarg = trimmed.name; + if (trimmed.value) args[i] = trimmed.value; + } + if (funarg) { + trim = false; + argnames[i] = funarg; + if (!after) after = !(funarg instanceof AST_SymbolFunarg); + } else if (trim) { + log_default(sym, "Dropping unused default argument {name}"); + argnames.pop(); + } else if (i > default_length) { + log_default(sym, "Dropping unused default argument assignment {name}"); + if (sym.name instanceof AST_SymbolFunarg) { + sym.name.unused = true; + } else { + after = true; + } + argnames[i] = sym.name; + } else { + log_default(sym, "Dropping unused default argument value {name}"); + argnames[i] = sym = sym.clone(); + sym.value = make_node(AST_Number, sym, { value: 0 }); + after = true; + } + } + } + if (before && !after && node.uses_arguments && !tt.has_directive("use strict")) { + node.rest = make_node(AST_DestructuredArray, node, { elements: [] }); + } + fns_with_marked_args.push(node); + } + return node; + } + if (node instanceof AST_Catch && node.argname instanceof AST_Destructured) { + node.argname.transform(trimmer); + } + if (node instanceof AST_Definitions && !(parent instanceof AST_ForEnumeration && parent.init === node)) { + // place uninitialized names at the start + var body = [], head = [], tail = []; + // for unused names whose initialization has + // side effects, we can cascade the init. code + // into the next one, or next statement. + var side_effects = []; + var duplicated = 0; + var is_var = node instanceof AST_Var; + node.definitions.forEach(function(def) { + if (def.value) def.value = def.value.transform(tt); + var value = def.value; + if (def.name instanceof AST_Destructured) { + var trimmed = trim_destructured(def.name, value, function(node) { + if (!drop_vars) return node; + if (node.definition().id in in_use_ids) return node; + if (is_catch(node)) return node; + if (is_var && !can_drop_symbol(node)) return node; + return null; + }, true); + if (trimmed.name) { + def = make_node(AST_VarDef, def, { + name: trimmed.name, + value: value = trimmed.value, + }); + flush(); + } else if (trimmed.value) { + side_effects.push(trimmed.value); + } + return; + } + var sym = def.name.definition(); + var drop_sym = is_var ? can_drop_symbol(def.name) : is_safe_lexical(sym); + if (!drop_sym || !drop_vars || sym.id in in_use_ids) { + var index; + if (value && ((index = indexOf_assign(sym, def)) < 0 || self_assign(value.tail_node()))) { + def = def.clone(); + value = value.drop_side_effect_free(compressor); + if (value) AST_Node.warn("Side effects in definition of variable {name} [{start}]", def.name); + if (node instanceof AST_Const) { + def.value = value || make_node(AST_Number, def, { value: 0 }); + } else { + def.value = null; + if (value) side_effects.push(value); + } + value = null; + if (index >= 0) assign_in_use[sym.id][index] = def; + } + var old_def, fn; + if (!value && !(node instanceof AST_Let)) { + if (parent instanceof AST_ExportDeclaration) { + flush(); + } else if (drop_sym && var_defs[sym.id] > 1) { + AST_Node.info("Dropping declaration of variable {name} [{start}]", def.name); + var_defs[sym.id]--; + sym.eliminated++; + } else { + head.push(def); + } + } else if (compressor.option("functions") + && !compressor.option("ie") + && drop_sym + && value + && var_defs[sym.id] == 1 + && sym.assignments == 0 + && (fn = value.tail_node()) instanceof AST_LambdaExpression + && !is_arguments(sym) + && !is_arrow(fn) + && assigned_once(fn, sym.references) + && can_declare_defun(fn) + && (old_def = rename_def(fn, def.name.name)) !== false) { + AST_Node.warn("Declaring {name} as function [{start}]", def.name); + var ctor; + switch (fn.CTOR) { + case AST_AsyncFunction: + ctor = AST_AsyncDefun; + break; + case AST_AsyncGeneratorFunction: + ctor = AST_AsyncGeneratorDefun; + break; + case AST_Function: + ctor = AST_Defun; + break; + case AST_GeneratorFunction: + ctor = AST_GeneratorDefun; + break; + } + var defun = make_node(ctor, fn); + defun.name = make_node(AST_SymbolDefun, def.name); + var name_def = def.name.scope.resolve().def_function(defun.name); + if (old_def) old_def.forEach(function(node) { + node.name = name_def.name; + node.thedef = name_def; + node.reference(); + }); + body.push(defun); + if (value !== fn) [].push.apply(side_effects, value.expressions.slice(0, -1)); + } else { + if (drop_sym + && var_defs[sym.id] > 1 + && !(parent instanceof AST_ExportDeclaration) + && sym.orig.indexOf(def.name) > sym.eliminated) { + var_defs[sym.id]--; + duplicated++; + } + flush(); + } + } else if (is_catch(def.name)) { + value = value && value.drop_side_effect_free(compressor); + if (value) side_effects.push(value); + if (var_defs[sym.id] > 1) { + AST_Node.warn("Dropping duplicated declaration of variable {name} [{start}]", def.name); + var_defs[sym.id]--; + sym.eliminated++; + } else { + def.value = null; + head.push(def); + } + } else { + value = value && value.drop_side_effect_free(compressor); + if (value) { + AST_Node.warn("Side effects in initialization of unused variable {name} [{start}]", def.name); + side_effects.push(value); + } else { + log(def.name, "Dropping unused variable {name}"); + } + sym.eliminated++; + } + + function self_assign(ref) { + return ref instanceof AST_SymbolRef && ref.definition() === sym; + } + + function assigned_once(fn, refs) { + if (refs.length == 0) return fn === def.name.fixed_value(); + return all(refs, function(ref) { + return fn === ref.fixed_value(); + }); + } + + function can_declare_defun(fn) { + if (!is_var || compressor.has_directive("use strict") || !(fn instanceof AST_Function)) { + return parent instanceof AST_Scope; + } + return parent instanceof AST_Block + || parent instanceof AST_For && parent.init === node + || parent instanceof AST_If; + } + + function rename_def(fn, name) { + if (!fn.name) return null; + var def = fn.name.definition(); + if (def.orig.length > 1) return null; + if (def.assignments > 0) return false; + if (def.name == name) return def; + if (compressor.option("keep_fnames")) return false; + var forbidden; + switch (name) { + case "await": + forbidden = is_async; + break; + case "yield": + forbidden = is_generator; + break; + } + return all(def.references, function(ref) { + var scope = ref.scope; + if (scope.find_variable(name) !== sym) return false; + if (forbidden) do { + scope = scope.resolve(); + if (forbidden(scope)) return false; + } while (scope !== fn && (scope = scope.parent_scope)); + return true; + }) && def; + } + + function is_catch(node) { + var sym = node.definition(); + return sym.orig[0] instanceof AST_SymbolCatch && sym.scope.resolve() === node.scope.resolve(); + } + + function flush() { + if (side_effects.length > 0) { + if (tail.length == 0) { + body.push(make_node(AST_SimpleStatement, node, { + body: make_sequence(node, side_effects), + })); + } else if (value) { + side_effects.push(value); + def.value = make_sequence(value, side_effects); + } else { + def.value = make_node(AST_UnaryPrefix, def, { + operator: "void", + expression: make_sequence(def, side_effects), + }); + } + side_effects = []; + } + tail.push(def); + } + }); + switch (head.length) { + case 0: + if (tail.length == 0) break; + if (tail.length == duplicated) { + [].unshift.apply(side_effects, tail.map(function(def) { + AST_Node.info("Dropping duplicated definition of variable {name} [{start}]", def.name); + var sym = def.name.definition(); + var ref = make_node(AST_SymbolRef, def.name); + sym.references.push(ref); + var assign = make_node(AST_Assign, def, { + operator: "=", + left: ref, + right: def.value, + }); + var index = indexOf_assign(sym, def); + if (index >= 0) assign_in_use[sym.id][index] = assign; + sym.assignments++; + sym.eliminated++; + return assign; + })); + break; + } + case 1: + if (tail.length == 0) { + var id = head[0].name.definition().id; + if (id in for_ins) { + node.definitions = head; + for_ins[id].init = node; + break; + } + } + default: + var seq; + if (tail.length > 0 && (seq = tail[0].value) instanceof AST_Sequence) { + tail[0].value = seq.tail_node(); + body.push(make_node(AST_SimpleStatement, node, { + body: make_sequence(seq, seq.expressions.slice(0, -1)), + })); + } + node.definitions = head.concat(tail); + body.push(node); + } + if (side_effects.length > 0) { + body.push(make_node(AST_SimpleStatement, node, { body: make_sequence(node, side_effects) })); + } + return insert_statements(body, node, in_list); + } + if (node instanceof AST_Assign) { + descend(node, tt); + if (!(node.left instanceof AST_Destructured)) return node; + var trimmed = trim_destructured(node.left, node.right, function(node) { + return node; + }, node.write_only === true); + if (trimmed.name) return make_node(AST_Assign, node, { + operator: node.operator, + left: trimmed.name, + right: trimmed.value, + }); + if (trimmed.value) return trimmed.value; + if (parent instanceof AST_Sequence && parent.tail_node() !== node) return List.skip; + return make_node(AST_Number, node, { value: 0 }); + } + if (node instanceof AST_LabeledStatement && node.body instanceof AST_For) { + // Certain combination of unused name + side effect leads to invalid AST: + // https://github.com/mishoo/UglifyJS/issues/1830 + // We fix it at this stage by moving the label inwards, back to the `for`. + descend(node, tt); + if (node.body instanceof AST_BlockStatement) { + var block = node.body; + node.body = block.body.pop(); + block.body.push(node); + return in_list ? List.splice(block.body) : block; + } + return node; + } + if (node instanceof AST_Scope) { + descend_scope(); + return node; + } + if (node instanceof AST_SymbolImport) { + if (!compressor.option("imports") || node.definition().id in in_use_ids) return node; + return in_list ? List.skip : null; + } + + function descend_scope() { + var save_scope = scope; + scope = node; + descend(node, tt); + scope = save_scope; + } + }, function(node, in_list) { + if (node instanceof AST_BlockStatement) return trim_block(node, tt.parent(), in_list); + if (node instanceof AST_ExportDeclaration) { + var block = node.body; + if (!(block instanceof AST_BlockStatement)) return; + node.body = block.body.pop(); + block.body.push(node); + return in_list ? List.splice(block.body) : block; + } + if (node instanceof AST_For) return patch_for_init(node, in_list); + if (node instanceof AST_ForIn) { + if (!drop_vars || !compressor.option("loops")) return; + if (!is_empty(node.body)) return; + var sym = get_init_symbol(node); + if (!sym) return; + var def = sym.definition(); + if (def.id in in_use_ids) return; + log(sym, "Dropping unused loop variable {name}"); + if (for_ins[def.id] === node) delete for_ins[def.id]; + var body = []; + var value = node.object.drop_side_effect_free(compressor); + if (value) { + AST_Node.warn("Side effects in object of for-in loop [{start}]", value); + body.push(make_node(AST_SimpleStatement, node, { body: value })); + } + if (node.init instanceof AST_Definitions && def.orig[0] instanceof AST_SymbolCatch) { + body.push(node.init); + } + return insert_statements(body, node, in_list); + } + if (node instanceof AST_Import) { + if (node.properties && node.properties.length == 0) node.properties = null; + return node; + } + if (node instanceof AST_Sequence) { + if (node.expressions.length > 1) return; + return maintain_this_binding(tt.parent(), node, node.expressions[0]); + } + }); + tt.push(compressor.parent()); + tt.directives = Object.create(compressor.directives); + self.transform(tt); + if (self instanceof AST_Lambda + && self.body.length == 1 + && self.body[0] instanceof AST_Directive + && self.body[0].value == "use strict") { + self.body.length = 0; + } + calls_to_drop_args.forEach(function(call) { + drop_unused_call_args(call, compressor, fns_with_marked_args); + }); + + function log(sym, text) { + AST_Node[sym.definition().references.length > 0 ? "info" : "warn"](text + " [{start}]", sym); + } + + function log_default(node, text) { + if (node.name instanceof AST_SymbolFunarg) { + log(node.name, text); + } else { + AST_Node.info(text + " [{start}]", node); + } + } + + function get_rvalue(expr) { + return expr[expr instanceof AST_Assign ? "right" : "value"]; + } + + function insert_statements(body, orig, in_list) { + switch (body.length) { + case 0: + return in_list ? List.skip : make_node(AST_EmptyStatement, orig); + case 1: + return body[0]; + default: + return in_list ? List.splice(body) : make_node(AST_BlockStatement, orig, { body: body }); + } + } + + function track_assigns(def, node) { + if (def.scope.resolve() !== self) return false; + if (!def.fixed || !node.fixed) assign_in_use[def.id] = false; + return assign_in_use[def.id] !== false; + } + + function add_assigns(def, node) { + if (!assign_in_use[def.id]) assign_in_use[def.id] = []; + if (node.fixed.assigns) push_uniq(assign_in_use[def.id], node.fixed.assigns); + } + + function indexOf_assign(def, node) { + var nodes = assign_in_use[def.id]; + return nodes && nodes.indexOf(node); + } + + function unmark_lambda(def) { + if (lambda_ids[def.id] > 1 && !(def.id in in_use_ids)) { + in_use_ids[def.id] = true; + in_use.push(def); + } + lambda_ids[def.id] = 0; + } + + function verify_safe_usage(def, read, modified) { + if (def.id in in_use_ids) return; + if (read && modified) { + in_use_ids[def.id] = read; + in_use.push(def); + } else { + value_read[def.id] = read; + value_modified[def.id] = modified; + } + } + + function can_drop_lhs(sym, node) { + var def = sym.definition(); + var in_use = in_use_ids[def.id]; + if (!in_use) return true; + if (node[node instanceof AST_Assign ? "left" : "expression"] !== sym) return false; + return in_use === sym && def.references.length - def.replaced == 1 || indexOf_assign(def, node) < 0; + } + + function get_rhs(assign) { + var rhs = assign.right; + if (!assign.write_only) return rhs; + if (!(rhs instanceof AST_Binary && lazy_op[rhs.operator])) return rhs; + if (!(rhs.left instanceof AST_SymbolRef)) return rhs; + if (!(assign.left instanceof AST_SymbolRef)) return rhs; + var def = assign.left.definition(); + if (rhs.left.definition() !== def) return rhs; + if (rhs.right.has_side_effects(compressor)) return rhs; + if (track_assigns(def, rhs.left)) add_assigns(def, rhs.left); + return rhs.right; + } + + function get_init_symbol(for_in) { + var init = for_in.init; + if (init instanceof AST_Definitions) { + init = init.definitions[0].name; + return init instanceof AST_SymbolDeclaration && init; + } + while (init instanceof AST_PropAccess) init = init.expression.tail_node(); + if (init instanceof AST_SymbolRef) return init; + } + + function scan_ref_scoped(node, descend, init) { + if (node instanceof AST_Assign && node.left instanceof AST_SymbolRef) { + var def = node.left.definition(); + if (def.scope.resolve() === self) assignments.add(def.id, node); + } + if (node instanceof AST_SymbolRef && node.in_arg) var_defs[node.definition().id] = 0; + if (node instanceof AST_Unary && node.expression instanceof AST_SymbolRef) { + var def = node.expression.definition(); + if (def.scope.resolve() === self) assignments.add(def.id, node); + } + var props = [], sym = assign_as_unused(node, props); + if (sym) { + var node_def = sym.definition(); + if (node_def.scope.resolve() !== self && self.variables.get(sym.name) !== node_def) return; + if (is_arguments(node_def) && !all(self.argnames, function(argname) { + return !argname.match_symbol(function(node) { + if (node instanceof AST_SymbolFunarg) { + var def = node.definition(); + return def.references.length > def.replaced; + } + }, true); + })) return; + if (node.write_only === "p" && node.right.may_throw_on_access(compressor, true)) return; + var assign = props.assign; + if (assign) { + assign.write_only = true; + assign.walk(tw); + } + props.forEach(function(prop) { + prop.walk(tw); + }); + if (node instanceof AST_Assign) { + var right = get_rhs(node), shared = false; + if (init && node.write_only === true && !right.has_side_effects(compressor)) { + initializations.add(node_def.id, right); + } else { + right.walk(tw); + shared = right.tail_node().operator == "="; + } + if (node.left === sym) { + if (!node.write_only || shared) { + verify_safe_usage(node_def, sym, value_modified[node_def.id]); + } + } else { + var fixed = sym.fixed_value(); + if (!fixed || !fixed.is_constant()) { + verify_safe_usage(node_def, value_read[node_def.id], true); + } + } + } + if (track_assigns(node_def, sym) && is_lhs(sym, node) !== sym) add_assigns(node_def, sym); + unmark_lambda(node_def); + return true; + } + if (node instanceof AST_Binary) { + if (node.operator != "instanceof") return; + var sym = node.right; + if (!(sym instanceof AST_SymbolRef)) return; + var id = sym.definition().id; + if (!lambda_ids[id]) return; + node.left.walk(tw); + lambda_ids[id]++; + return true; + } + if (node instanceof AST_ForIn) { + if (node.init instanceof AST_SymbolRef && scope === self) { + var id = node.init.definition().id; + if (!(id in for_ins)) for_ins[id] = node; + } + if (!drop_vars || !compressor.option("loops")) return; + if (!is_empty(node.body)) return; + if (node.init.has_side_effects(compressor)) return; + var sym = get_init_symbol(node); + if (!sym) return; + var def = sym.definition(); + if (def.scope.resolve() !== self) { + var d = find_variable(sym.name); + if (d === def || d && d.redefined() === def) return; + } + node.object.walk(tw); + return true; + } + if (node instanceof AST_SymbolRef) { + var node_def = node.definition(); + if (!(node_def.id in in_use_ids)) { + in_use_ids[node_def.id] = true; + in_use.push(node_def); + } + if (cross_scope(node_def.scope, node.scope)) { + var redef = node_def.redefined(); + if (redef && !(redef.id in in_use_ids)) { + in_use_ids[redef.id] = true; + in_use.push(redef); + } + } + if (track_assigns(node_def, node)) add_assigns(node_def, node); + return true; + } + if (node instanceof AST_Scope) { + var save_scope = scope; + scope = node; + descend(); + scope = save_scope; + return true; + } + } + + function is_decl(node) { + return (node instanceof AST_DefaultValue ? node.name : node) instanceof AST_SymbolDeclaration; + } + + function trim_decl(node) { + if (node.definition().id in in_use_ids) return node; + if (node instanceof AST_SymbolFunarg) node.unused = true; + return null; + } + + function trim_default(trimmer, node) { + node.value = node.value.transform(tt); + var name = node.name.transform(trimmer); + if (!name) { + if (node.name instanceof AST_Destructured) return null; + var value = node.value.drop_side_effect_free(compressor); + if (!value) return null; + log(node.name, "Side effects in default value of unused variable {name}"); + node = node.clone(); + node.name.unused = null; + node.value = value; + } + return node; + } + + function trim_destructured(node, value, process, drop, root) { + var trimmer = new TreeTransformer(function(node) { + if (node instanceof AST_DefaultValue) { + if (!(compressor.option("default_values") && value && value.is_defined(compressor))) { + var save_drop = drop; + drop = false; + var trimmed = trim_default(trimmer, node); + drop = save_drop; + if (!trimmed && drop && value) value = value.drop_side_effect_free(compressor); + return trimmed; + } else if (node === root) { + root = node = node.name; + } else { + node = node.name; + } + } + if (node instanceof AST_DestructuredArray) { + var save_drop = drop; + var save_value = value; + if (value instanceof AST_SymbolRef) { + drop = false; + value = value.fixed_value(); + } + var native, values; + if (value instanceof AST_Array) { + native = true; + values = value.elements; + } else { + native = value && value.is_string(compressor); + values = false; + } + var elements = [], newValues = drop && [], pos = 0; + node.elements.forEach(function(element, index) { + value = values && values[index]; + if (value instanceof AST_Hole) { + value = null; + } else if (value instanceof AST_Spread) { + if (drop) { + newValues.length = pos; + fill_holes(save_value, newValues); + [].push.apply(newValues, values.slice(index)); + save_value.elements = newValues; + } + value = values = false; + } + element = element.transform(trimmer); + if (element) elements[pos] = element; + if (drop && value) newValues[pos] = value; + if (element || value || !drop || !values) pos++; + }); + value = values && make_node(AST_Array, save_value, { + elements: values.slice(node.elements.length), + }); + if (node.rest) { + var was_drop = drop; + drop = false; + node.rest = node.rest.transform(compressor.option("rests") ? trimmer : tt); + drop = was_drop; + if (node.rest) elements.length = pos; + } + if (drop) { + if (value && !node.rest) value = value.drop_side_effect_free(compressor); + if (value instanceof AST_Array) { + value = value.elements; + } else if (value instanceof AST_Sequence) { + value = value.expressions; + } else if (value) { + value = [ value ]; + } + if (value && value.length) { + newValues.length = pos; + [].push.apply(newValues, value); + } + } + value = save_value; + drop = save_drop; + if (values && newValues) { + fill_holes(value, newValues); + value = value.clone(); + value.elements = newValues; + } + if (!native) { + elements.length = node.elements.length; + } else if (!node.rest) switch (elements.length) { + case 0: + if (node === root) break; + if (drop) value = value.drop_side_effect_free(compressor); + return null; + case 1: + if (!drop) break; + if (node === root) break; + var sym = elements[0]; + if (sym.has_side_effects(compressor)) break; + if (value.has_side_effects(compressor) && sym.match_symbol(function(node) { + return node instanceof AST_PropAccess; + })) break; + value = make_node(AST_Sub, node, { + expression: value, + property: make_node(AST_Number, node, { value: 0 }), + }); + return sym; + } + fill_holes(node, elements); + node.elements = elements; + return node; + } + if (node instanceof AST_DestructuredObject) { + var save_drop = drop; + var save_value = value; + if (value instanceof AST_SymbolRef) { + drop = false; + value = value.fixed_value(); + } + var prop_keys, prop_map, values; + if (value instanceof AST_Object) { + prop_keys = []; + prop_map = new Dictionary(); + values = value.properties.map(function(prop, index) { + prop = prop.clone(); + if (prop instanceof AST_Spread) { + prop_map = false; + } else { + var key = prop.key; + if (key instanceof AST_Node) key = key.evaluate(compressor, true); + if (key instanceof AST_Node) { + prop_map = false; + } else if (prop_map && !(prop instanceof AST_ObjectSetter)) { + prop_map.set(key, prop); + } + prop_keys[index] = key; + } + return prop; + }); + } + if (node.rest) { + value = false; + node.rest = node.rest.transform(compressor.option("rests") ? trimmer : tt); + } + var can_drop = new Dictionary(); + var drop_keys = drop && new Dictionary(); + var properties = []; + node.properties.map(function(prop) { + var key = prop.key; + if (key instanceof AST_Node) { + prop.key = key = key.transform(tt); + key = key.evaluate(compressor, true); + } + if (key instanceof AST_Node) { + drop_keys = false; + } else { + can_drop.set(key, !can_drop.has(key)); + } + return key; + }).forEach(function(key, index) { + var prop = node.properties[index], trimmed; + if (key instanceof AST_Node) { + drop = false; + value = false; + trimmed = prop.value.transform(trimmer) || retain_lhs(prop.value); + } else { + drop = drop_keys && can_drop.get(key); + var mapped = prop_map && prop_map.get(key); + if (mapped) { + value = mapped.value; + if (value instanceof AST_Accessor) value = false; + } else { + value = false; + } + trimmed = prop.value.transform(trimmer); + if (!trimmed) { + if (node.rest || retain_key(prop)) trimmed = retain_lhs(prop.value); + if (drop_keys && !drop_keys.has(key)) { + if (mapped) { + drop_keys.set(key, mapped); + if (value === null) { + prop_map.set(key, retain_key(mapped) && make_node(AST_ObjectKeyVal, mapped, { + key: mapped.key, + value: make_node(AST_Number, mapped, { value: 0 }), + })); + } + } else { + drop_keys.set(key, true); + } + } + } else if (drop_keys) { + drop_keys.set(key, false); + } + if (value) mapped.value = value; + } + if (trimmed) { + prop.value = trimmed; + properties.push(prop); + } + }); + value = save_value; + drop = save_drop; + if (drop_keys && prop_keys) { + value = value.clone(); + value.properties = List(values, function(prop, index) { + if (prop instanceof AST_Spread) return prop; + var key = prop_keys[index]; + if (key instanceof AST_Node) return prop; + if (drop_keys.has(key)) { + var mapped = drop_keys.get(key); + if (!mapped) return prop; + if (mapped === prop) return prop_map.get(key) || List.skip; + } else if (node.rest) { + return prop; + } + var trimmed = prop.value.drop_side_effect_free(compressor); + if (trimmed) { + prop.value = trimmed; + return prop; + } + return retain_key(prop) ? make_node(AST_ObjectKeyVal, prop, { + key: prop.key, + value: make_node(AST_Number, prop, { value: 0 }), + }) : List.skip; + }); + } + if (value && !node.rest) switch (properties.length) { + case 0: + if (node === root) break; + if (value.may_throw_on_access(compressor, true)) break; + if (drop) value = value.drop_side_effect_free(compressor); + return null; + case 1: + if (!drop) break; + if (node === root) break; + var prop = properties[0]; + if (prop.key instanceof AST_Node) break; + if (prop.value.has_side_effects(compressor)) break; + if (value.has_side_effects(compressor) && prop.value.match_symbol(function(node) { + return node instanceof AST_PropAccess; + })) break; + value = make_node(AST_Sub, node, { + expression: value, + property: make_node_from_constant(prop.key, prop), + }); + return prop.value; + } + node.properties = properties; + return node; + } + if (node instanceof AST_Hole) { + node = null; + } else { + node = process(node); + } + if (!node && drop && value) value = value.drop_side_effect_free(compressor); + return node; + }); + return { + name: node.transform(trimmer), + value: value, + }; + + function retain_key(prop) { + return prop.key instanceof AST_Node && prop.key.has_side_effects(compressor); + } + + function clear_write_only(node) { + if (node instanceof AST_Assign) { + node.write_only = false; + clear_write_only(node.right); + } else if (node instanceof AST_Binary) { + if (!lazy_op[node.operator]) return; + clear_write_only(node.left); + clear_write_only(node.right); + } else if (node instanceof AST_Conditional) { + clear_write_only(node.consequent); + clear_write_only(node.alternative); + } else if (node instanceof AST_Sequence) { + clear_write_only(node.tail_node()); + } else if (node instanceof AST_Unary) { + node.write_only = false; + } + } + + function retain_lhs(node) { + if (node instanceof AST_DefaultValue) return retain_lhs(node.name); + if (node instanceof AST_Destructured) { + if (value === null) { + value = make_node(AST_Number, node, { value: 0 }); + } else if (value) { + if (value.may_throw_on_access(compressor, true)) { + value = make_node(AST_Array, node, { + elements: value instanceof AST_Sequence ? value.expressions : [ value ], + }); + } else { + clear_write_only(value); + } + } + return make_node(AST_DestructuredObject, node, { properties: [] }); + } + node.unused = null; + return node; + } + } + }); + + AST_Scope.DEFMETHOD("hoist_declarations", function(compressor) { + if (compressor.has_directive("use asm")) return; + var hoist_funs = compressor.option("hoist_funs"); + var hoist_vars = compressor.option("hoist_vars"); + var self = this; + if (hoist_vars) { + // let's count var_decl first, we seem to waste a lot of + // space if we hoist `var` when there's only one. + var var_decl = 0; + self.walk(new TreeWalker(function(node) { + if (var_decl > 1) return true; + if (node instanceof AST_ExportDeclaration) return true; + if (node instanceof AST_Scope && node !== self) return true; + if (node instanceof AST_Var) { + var_decl++; + return true; + } + })); + if (var_decl <= 1) hoist_vars = false; + } + if (!hoist_funs && !hoist_vars) return; + var consts = new Dictionary(); + var dirs = []; + var hoisted = []; + var vars = new Dictionary(); + var tt = new TreeTransformer(function(node, descend, in_list) { + if (node === self) return; + if (node instanceof AST_Directive) { + dirs.push(node); + return in_list ? List.skip : make_node(AST_EmptyStatement, node); + } + if (node instanceof AST_LambdaDefinition) { + if (!hoist_funs) return node; + var p = tt.parent(); + if (p instanceof AST_ExportDeclaration) return node; + if (p instanceof AST_ExportDefault) return node; + if (p !== self && compressor.has_directive("use strict")) return node; + hoisted.push(node); + return in_list ? List.skip : make_node(AST_EmptyStatement, node); + } + if (node instanceof AST_Var) { + if (!hoist_vars) return node; + var p = tt.parent(); + if (p instanceof AST_ExportDeclaration) return node; + if (!all(node.definitions, function(defn) { + var sym = defn.name; + return sym instanceof AST_SymbolVar + && !consts.has(sym.name) + && self.find_variable(sym.name) === sym.definition(); + })) return node; + node.definitions.forEach(function(defn) { + vars.set(defn.name.name, defn); + }); + var seq = node.to_assignments(); + if (p instanceof AST_ForEnumeration && p.init === node) { + if (seq) return seq; + var sym = node.definitions[0].name; + return make_node(AST_SymbolRef, sym); + } + if (p instanceof AST_For && p.init === node) return seq; + if (!seq) return in_list ? List.skip : make_node(AST_EmptyStatement, node); + return make_node(AST_SimpleStatement, node, { body: seq }); + } + if (node instanceof AST_Scope) return node; + if (node instanceof AST_SymbolConst) { + consts.set(node.name, true); + return node; + } + }); + self.transform(tt); + if (vars.size() > 0) { + // collect only vars which don't show up in self's arguments list + var defns = []; + if (self instanceof AST_Lambda) self.each_argname(function(argname) { + if (all(argname.definition().references, function(ref) { + return !ref.in_arg; + })) vars.del(argname.name); + }); + vars.each(function(defn, name) { + defn = defn.clone(); + defn.name = defn.name.clone(); + defn.value = null; + defns.push(defn); + vars.set(name, defn); + defn.name.definition().orig.unshift(defn.name); + }); + if (defns.length > 0) hoisted.push(make_node(AST_Var, self, { definitions: defns })); + } + self.body = dirs.concat(hoisted, self.body); + }); + + function scan_local_returns(fn, transform) { + fn.walk(new TreeWalker(function(node) { + if (node instanceof AST_Return) { + transform(node); + return true; + } + if (node instanceof AST_Scope && node !== fn) return true; + })); + } + + function map_self_returns(fn) { + var map = Object.create(null); + scan_local_returns(fn, function(node) { + var value = node.value; + if (value) value = value.tail_node(); + if (value instanceof AST_SymbolRef) { + var id = value.definition().id; + map[id] = (map[id] || 0) + 1; + } + }); + return map; + } + + function can_trim_returns(def, self_returns, compressor) { + if (compressor.exposed(def)) return false; + switch (def.references.length - def.replaced - (self_returns[def.id] || 0)) { + case def.drop_return: + return "d"; + case def.bool_return: + return true; + } + } + + function process_boolean_returns(fn, compressor) { + scan_local_returns(fn, function(node) { + node.in_bool = true; + var value = node.value; + if (value) { + var ev = fuzzy_eval(compressor, value); + if (!ev) { + value = value.drop_side_effect_free(compressor); + node.value = value ? make_sequence(node.value, [ + value, + make_node(AST_Number, node.value, { value: 0 }), + ]) : null; + } else if (!(ev instanceof AST_Node)) { + value = value.drop_side_effect_free(compressor); + node.value = value ? make_sequence(node.value, [ + value, + make_node(AST_Number, node.value, { value: 1 }), + ]) : make_node(AST_Number, node.value, { value: 1 }); + } + } + }); + } + + AST_Scope.DEFMETHOD("process_returns", noop); + AST_Defun.DEFMETHOD("process_returns", function(compressor) { + if (!compressor.option("booleans")) return; + if (compressor.parent() instanceof AST_ExportDefault) return; + switch (can_trim_returns(this.name.definition(), map_self_returns(this), compressor)) { + case "d": + drop_returns(compressor, this, true); + break; + case true: + process_boolean_returns(this, compressor); + break; + } + }); + AST_Function.DEFMETHOD("process_returns", function(compressor) { + if (!compressor.option("booleans")) return; + var drop = true; + var self_returns = map_self_returns(this); + if (this.name && !can_trim(this.name.definition())) return; + var parent = compressor.parent(); + if (parent instanceof AST_Assign) { + if (parent.operator != "=") return; + var sym = parent.left; + if (!(sym instanceof AST_SymbolRef)) return; + if (!can_trim(sym.definition())) return; + } else if (parent instanceof AST_Call && parent.expression !== this) { + var exp = parent.expression; + if (exp instanceof AST_SymbolRef) exp = exp.fixed_value(); + if (!(exp instanceof AST_Lambda)) return; + if (exp.uses_arguments || exp.pinned()) return; + var args = parent.args, sym; + for (var i = 0; i < args.length; i++) { + var arg = args[i]; + if (arg === this) { + sym = exp.argnames[i]; + if (!sym && exp.rest) return; + break; + } + if (arg instanceof AST_Spread) return; + } + if (sym instanceof AST_DefaultValue) sym = sym.name; + if (sym instanceof AST_SymbolFunarg && !can_trim(sym.definition())) return; + } else if (parent.TYPE == "Call") { + compressor.pop(); + var in_bool = compressor.in_boolean_context(); + compressor.push(this); + switch (in_bool) { + case true: + drop = false; + case "d": + break; + default: + return; + } + } else return; + if (drop) { + drop_returns(compressor, this, true); + } else { + process_boolean_returns(this, compressor); + } + + function can_trim(def) { + switch (can_trim_returns(def, self_returns, compressor)) { + case true: + drop = false; + case "d": + return true; + } + } + }); + + AST_BlockScope.DEFMETHOD("var_names", function() { + var var_names = this._var_names; + if (!var_names) { + this._var_names = var_names = new Dictionary(); + this.enclosed.forEach(function(def) { + var_names.set(def.name, true); + }); + this.variables.each(function(def, name) { + var_names.set(name, true); + }); + } + return var_names; + }); + + AST_Scope.DEFMETHOD("make_var", function(type, orig, prefix) { + var scopes = [ this ]; + if (orig instanceof AST_SymbolDeclaration) orig.definition().references.forEach(function(ref) { + var s = ref.scope; + do { + if (!push_uniq(scopes, s)) return; + s = s.parent_scope; + } while (s && s !== this); + }); + prefix = prefix.replace(/^[^a-z_$]|[^a-z0-9_$]/gi, "_"); + var name = prefix; + for (var i = 0; !all(scopes, function(scope) { + return !scope.var_names().has(name); + }); i++) name = prefix + "$" + i; + var sym = make_node(type, orig, { + name: name, + scope: this, + }); + var def = this.def_variable(sym); + scopes.forEach(function(scope) { + scope.enclosed.push(def); + scope.var_names().set(name, true); + }); + return sym; + }); + + AST_Scope.DEFMETHOD("hoist_properties", function(compressor) { + if (!compressor.option("hoist_props") || compressor.has_directive("use asm")) return; + var self = this; + if (is_arrow(self) && self.value) return; + var top_retain = self instanceof AST_Toplevel && compressor.top_retain || return_false; + var defs_by_id = Object.create(null); + var tt = new TreeTransformer(function(node, descend) { + if (node instanceof AST_Assign) { + if (node.operator != "=") return; + if (!node.write_only) return; + if (!can_hoist(node.left, node.right, 1)) return; + descend(node, tt); + var defs = new Dictionary(); + var assignments = []; + var decls = []; + node.right.properties.forEach(function(prop) { + var decl = make_sym(AST_SymbolVar, node.left, prop.key); + decls.push(make_node(AST_VarDef, node, { + name: decl, + value: null, + })); + var sym = make_node(AST_SymbolRef, node, { + name: decl.name, + scope: self, + thedef: decl.definition(), + }); + sym.reference(); + assignments.push(make_node(AST_Assign, node, { + operator: "=", + left: sym, + right: prop.value, + })); + }); + defs.value = node.right; + defs_by_id[node.left.definition().id] = defs; + self.body.splice(self.body.indexOf(tt.stack[1]) + 1, 0, make_node(AST_Var, node, { + definitions: decls, + })); + return make_sequence(node, assignments); + } + if (node instanceof AST_Scope) { + if (node === self) return; + var parent = tt.parent(); + if (parent.TYPE == "Call" && parent.expression === node) return; + return node; + } + if (node instanceof AST_VarDef) { + if (!can_hoist(node.name, node.value, 0)) return; + descend(node, tt); + var defs = new Dictionary(); + var var_defs = []; + var decl = node.clone(); + decl.value = node.name instanceof AST_SymbolConst ? make_node(AST_Number, node, { value: 0 }) : null; + var_defs.push(decl); + node.value.properties.forEach(function(prop) { + var_defs.push(make_node(AST_VarDef, node, { + name: make_sym(node.name.CTOR, node.name, prop.key), + value: prop.value, + })); + }); + defs.value = node.value; + defs_by_id[node.name.definition().id] = defs; + return List.splice(var_defs); + } + + function make_sym(type, sym, key) { + var new_var = self.make_var(type, sym, sym.name + "_" + key); + defs.set(key, new_var.definition()); + return new_var; + } + }); + self.transform(tt); + self.transform(new TreeTransformer(function(node, descend) { + if (node instanceof AST_PropAccess) { + if (!(node.expression instanceof AST_SymbolRef)) return; + var defs = defs_by_id[node.expression.definition().id]; + if (!defs) return; + if (node.expression.fixed_value() !== defs.value) return; + var def = defs.get(node.get_property()); + var sym = make_node(AST_SymbolRef, node, { + name: def.name, + scope: node.expression.scope, + thedef: def, + }); + sym.reference(); + return sym; + } + if (node instanceof AST_SymbolRef) { + var defs = defs_by_id[node.definition().id]; + if (!defs) return; + if (node.fixed_value() !== defs.value) return; + return make_node(AST_Object, node, { properties: [] }); + } + })); + + function can_hoist(sym, right, count) { + if (!(sym instanceof AST_Symbol)) return; + var def = sym.definition(); + if (def.assignments != count) return; + if (def.references.length - def.replaced == count) return; + if (def.single_use) return; + if (self.find_variable(sym.name) !== def) return; + if (top_retain(def)) return; + if (sym.fixed_value() !== right) return; + var fixed = sym.fixed || def.fixed; + if (fixed.direct_access) return; + if (fixed.escaped && fixed.escaped.depth == 1) return; + return right instanceof AST_Object + && right.properties.length > 0 + && can_drop_symbol(sym, compressor) + && all(right.properties, function(prop) { + return can_hoist_property(prop) && prop.key !== "__proto__"; + }); + } + }); + + function fn_name_unused(fn, compressor) { + if (!fn.name || !compressor.option("ie")) return true; + var def = fn.name.definition(); + if (compressor.exposed(def)) return false; + return all(def.references, function(sym) { + return !(sym instanceof AST_SymbolRef); + }); + } + + function drop_returns(compressor, exp, ignore_name) { + if (!(exp instanceof AST_Lambda)) return; + var arrow = is_arrow(exp); + var async = is_async(exp); + var changed = false; + var drop_body = false; + if (arrow && compressor.option("arrows")) { + if (!exp.value) { + drop_body = true; + } else if (!async || needs_enqueuing(compressor, exp.value)) { + var dropped = exp.value.drop_side_effect_free(compressor); + if (dropped !== exp.value) { + changed = true; + exp.value = dropped; + } + } + } else if (!is_generator(exp)) { + if (!ignore_name && exp.name) { + var def = exp.name.definition(); + drop_body = def.references.length == def.replaced; + } else { + drop_body = true; + } + } + if (drop_body) { + exp.process_expression(false, function(node) { + var value = node.value; + if (value) { + if (async && !needs_enqueuing(compressor, value)) return node; + value = value.drop_side_effect_free(compressor, true); + } + changed = true; + if (!value) return make_node(AST_EmptyStatement, node); + return make_node(AST_SimpleStatement, node, { body: value }); + }); + scan_local_returns(exp, function(node) { + var value = node.value; + if (value) { + if (async && !needs_enqueuing(compressor, value)) return; + var dropped = value.drop_side_effect_free(compressor); + if (dropped !== value) { + changed = true; + if (dropped && async && !needs_enqueuing(compressor, dropped)) { + dropped = dropped.negate(compressor); + } + node.value = dropped; + } + } + }); + } + if (async && compressor.option("awaits")) { + if (drop_body) exp.process_expression("awaits", function(node) { + var body = node.body; + if (body instanceof AST_Await) { + if (needs_enqueuing(compressor, body.expression)) { + changed = true; + body = body.expression.drop_side_effect_free(compressor, true); + if (!body) return make_node(AST_EmptyStatement, node); + node.body = body; + } + } else if (body instanceof AST_Sequence) { + var exprs = body.expressions; + for (var i = exprs.length; --i >= 0;) { + var tail = exprs[i]; + if (!(tail instanceof AST_Await)) break; + var value = tail.expression; + if (!needs_enqueuing(compressor, value)) break; + changed = true; + if (exprs[i] = value.drop_side_effect_free(compressor)) break; + } + switch (i) { + case -1: + return make_node(AST_EmptyStatement, node); + case 0: + node.body = exprs[0]; + break; + default: + exprs.length = i + 1; + break; + } + } + return node; + }); + var abort = !drop_body && exp.name || arrow && exp.value && !needs_enqueuing(compressor, exp.value); + var tw = new TreeWalker(function(node) { + if (abort) return true; + if (tw.parent() === exp && node.may_throw(compressor)) return abort = true; + if (node instanceof AST_Await) return abort = true; + if (node instanceof AST_ForAwaitOf) return abort = true; + if (node instanceof AST_Return) { + if (node.value && !needs_enqueuing(compressor, node.value)) return abort = true; + return; + } + if (node instanceof AST_Scope && node !== exp) return true; + }); + exp.walk(tw); + if (!abort) { + var ctor; + switch (exp.CTOR) { + case AST_AsyncArrow: + ctor = AST_Arrow; + break; + case AST_AsyncFunction: + ctor = AST_Function; + break; + case AST_AsyncGeneratorFunction: + ctor = AST_GeneratorFunction; + break; + } + return make_node(ctor, exp); + } + } + return changed && exp.clone(); + } + + // drop_side_effect_free() + // remove side-effect-free parts which only affects return value + (function(def) { + // Drop side-effect-free elements from an array of expressions. + // Returns an array of expressions with side-effects or null + // if all elements were dropped. Note: original array may be + // returned if nothing changed. + function trim(nodes, compressor, first_in_statement, spread) { + var len = nodes.length; + var ret = [], changed = false; + for (var i = 0; i < len; i++) { + var node = nodes[i]; + var trimmed; + if (spread && node instanceof AST_Spread) { + trimmed = spread(node, compressor, first_in_statement); + } else { + trimmed = node.drop_side_effect_free(compressor, first_in_statement); + } + if (trimmed !== node) changed = true; + if (trimmed) { + ret.push(trimmed); + first_in_statement = false; + } + } + return ret.length ? changed ? ret : nodes : null; + } + function array_spread(node, compressor, first_in_statement) { + var exp = node.expression; + if (!exp.is_string(compressor)) return node; + return exp.drop_side_effect_free(compressor, first_in_statement); + } + function convert_spread(node) { + return node instanceof AST_Spread ? make_node(AST_Array, node, { elements: [ node ] }) : node; + } + def(AST_Node, return_this); + def(AST_Accessor, return_null); + def(AST_Array, function(compressor, first_in_statement) { + var values = trim(this.elements, compressor, first_in_statement, array_spread); + if (!values) return null; + if (values === this.elements && all(values, function(node) { + return node instanceof AST_Spread; + })) return this; + return make_sequence(this, values.map(convert_spread)); + }); + def(AST_Assign, function(compressor) { + var left = this.left; + if (left instanceof AST_PropAccess) { + var expr = left.expression; + if (expr.may_throw_on_access(compressor, true)) return this; + if (compressor.has_directive("use strict") && expr.is_constant()) return this; + } + if (left.has_side_effects(compressor)) return this; + if (lazy_op[this.operator.slice(0, -1)]) return this; + this.write_only = true; + if (!root_expr(left).is_constant_expression(compressor.find_parent(AST_Scope))) return this; + return this.right.drop_side_effect_free(compressor); + }); + def(AST_Await, function(compressor) { + if (!compressor.option("awaits")) return this; + var exp = this.expression; + if (!needs_enqueuing(compressor, exp)) return this; + if (exp instanceof AST_UnaryPrefix && exp.operator == "!") exp = exp.expression; + var dropped = exp.drop_side_effect_free(compressor); + if (dropped === exp) return this; + if (!dropped) { + dropped = make_node(AST_Number, exp, { value: 0 }); + } else if (!needs_enqueuing(compressor, dropped)) { + dropped = dropped.negate(compressor); + } + var node = this.clone(); + node.expression = dropped; + return node; + }); + def(AST_Binary, function(compressor, first_in_statement) { + var left = this.left; + var right = this.right; + var op = this.operator; + if (!can_drop_op(op, right, compressor)) { + var lhs = left.drop_side_effect_free(compressor, first_in_statement); + if (lhs === left) return this; + var node = this.clone(); + node.left = lhs || make_node(AST_Number, left, { value: 0 }); + return node; + } + var rhs = right.drop_side_effect_free(compressor, first_in_statement); + if (!rhs) return left.drop_side_effect_free(compressor, first_in_statement); + if (lazy_op[op] && rhs.has_side_effects(compressor)) { + var node = this; + if (rhs !== right) { + node = node.clone(); + node.right = rhs.drop_side_effect_free(compressor); + } + if (op == "??") return node; + var negated = node.clone(); + negated.operator = op == "&&" ? "||" : "&&"; + negated.left = left.negate(compressor, first_in_statement); + var negated_rhs = negated.right.tail_node(); + if (negated_rhs instanceof AST_Binary && negated.operator == negated_rhs.operator) swap_chain(negated); + var best = first_in_statement ? best_of_statement : best_of_expression; + return op == "&&" ? best(node, negated) : best(negated, node); + } + var lhs = left.drop_side_effect_free(compressor, first_in_statement); + if (!lhs) return rhs; + rhs = rhs.drop_side_effect_free(compressor); + if (!rhs) return lhs; + return make_sequence(this, [ lhs, rhs ]); + }); + function assign_this_only(fn, compressor) { + fn.new = true; + var result = all(fn.body, function(stat) { + return !stat.has_side_effects(compressor); + }) && all(fn.argnames, function(argname) { + return !argname.match_symbol(return_false); + }) && !(fn.rest && fn.rest.match_symbol(return_false)); + fn.new = false; + return result; + } + def(AST_Call, function(compressor, first_in_statement) { + var self = this; + if (self.is_expr_pure(compressor)) { + if (self.pure) AST_Node.warn("Dropping __PURE__ call [{start}]", self); + var args = trim(self.args, compressor, first_in_statement, array_spread); + return args && make_sequence(self, args.map(convert_spread)); + } + var exp = self.expression; + if (self.is_call_pure(compressor)) { + var exprs = self.args.slice(); + exprs.unshift(exp.expression); + exprs = trim(exprs, compressor, first_in_statement, array_spread); + return exprs && make_sequence(self, exprs.map(convert_spread)); + } + if (compressor.option("yields") && is_generator(exp)) { + var call = self.clone(); + call.expression = make_node(AST_Function, exp); + call.expression.body = []; + var opt = call.transform(compressor); + if (opt !== call) return opt.drop_side_effect_free(compressor, first_in_statement); + } + var dropped = drop_returns(compressor, exp); + if (dropped) { + // always shallow clone to ensure stripping of negated IIFEs + self = self.clone(); + self.expression = dropped; + // avoid extraneous traversal + if (exp._squeezed) self.expression._squeezed = true; + } + if (self instanceof AST_New) { + var fn = exp; + if (fn instanceof AST_SymbolRef) fn = fn.fixed_value(); + if (fn instanceof AST_Lambda) { + if (assign_this_only(fn, compressor)) { + var exprs = self.args.slice(); + exprs.unshift(exp); + exprs = trim(exprs, compressor, first_in_statement, array_spread); + return exprs && make_sequence(self, exprs.map(convert_spread)); + } + if (!fn.contains_this()) { + self = make_node(AST_Call, self); + self.expression = self.expression.clone(); + self.args = self.args.slice(); + } + } + } + self.call_only = true; + return self; + }); + def(AST_ClassExpression, function(compressor, first_in_statement) { + var self = this; + var exprs = [], values = [], init = 0; + var props = self.properties; + for (var i = 0; i < props.length; i++) { + var prop = props[i]; + if (prop.key instanceof AST_Node) exprs.push(prop.key); + if (!is_static_field_or_init(prop)) continue; + var value = prop.value; + if (!value.has_side_effects(compressor)) continue; + if (value.contains_this()) return self; + if (prop instanceof AST_ClassInit) { + init++; + values.push(prop); + } else { + values.push(value); + } + } + var base = self.extends; + if (base) { + if (base instanceof AST_SymbolRef) base = base.fixed_value(); + base = !safe_for_extends(base); + if (!base) exprs.unshift(self.extends); + } + exprs = trim(exprs, compressor, first_in_statement); + if (exprs) first_in_statement = false; + values = trim(values, compressor, first_in_statement); + if (!exprs) { + if (!base && !values && !self.name) return null; + exprs = []; + } + if (base || self.name || !compressor.has_directive("use strict")) { + var node = to_class_expr(self); + if (!base) node.extends = null; + node.properties = []; + if (values) { + if (values.length == init) { + if (exprs.length) values.unshift(make_node(AST_ClassField, self, { + key: make_sequence(self, exprs), + value: null, + })); + node.properties = values; + } else node.properties.push(make_node(AST_ClassField, self, { + static: true, + key: exprs.length ? make_sequence(self, exprs) : "c", + value: make_value(), + })); + } else if (exprs.length) node.properties.push(make_node(AST_ClassMethod, self, { + key: make_sequence(self, exprs), + value: make_node(AST_Function, self, { + argnames: [], + body: [], + }).init_vars(node), + })); + return node; + } + if (values) exprs.push(make_node(AST_Call, self, { + expression: make_node(AST_Arrow, self, { + argnames: [], + body: [], + value: make_value(), + }).init_vars(self.parent_scope), + args: [], + })); + return make_sequence(self, exprs); + + function make_value() { + return make_sequence(self, values.map(function(node) { + if (!(node instanceof AST_ClassInit)) return node; + var fn = make_node(AST_Arrow, node.value); + fn.argnames = []; + return make_node(AST_Call, node, { + expression: fn, + args: [], + }); + })); + } + }); + def(AST_Conditional, function(compressor) { + var consequent = this.consequent.drop_side_effect_free(compressor); + var alternative = this.alternative.drop_side_effect_free(compressor); + if (consequent === this.consequent && alternative === this.alternative) return this; + var exprs; + if (compressor.option("ie")) { + exprs = []; + if (consequent instanceof AST_Function) { + exprs.push(consequent); + consequent = null; + } + if (alternative instanceof AST_Function) { + exprs.push(alternative); + alternative = null; + } + } + var node; + if (!consequent) { + node = alternative ? make_node(AST_Binary, this, { + operator: "||", + left: this.condition, + right: alternative, + }) : this.condition.drop_side_effect_free(compressor); + } else if (!alternative) { + node = make_node(AST_Binary, this, { + operator: "&&", + left: this.condition, + right: consequent, + }); + } else { + node = this.clone(); + node.consequent = consequent; + node.alternative = alternative; + } + if (!exprs) return node; + if (node) exprs.push(node); + return exprs.length == 0 ? null : make_sequence(this, exprs); + }); + def(AST_Constant, return_null); + def(AST_Dot, function(compressor, first_in_statement) { + var expr = this.expression; + if (expr.may_throw_on_access(compressor)) return this; + return expr.drop_side_effect_free(compressor, first_in_statement); + }); + def(AST_Function, function(compressor) { + return fn_name_unused(this, compressor) ? null : this; + }); + def(AST_LambdaExpression, return_null); + def(AST_Object, function(compressor, first_in_statement) { + var exprs = []; + this.properties.forEach(function(prop) { + if (prop instanceof AST_Spread) { + exprs.push(prop); + } else { + if (prop.key instanceof AST_Node) exprs.push(prop.key); + exprs.push(prop.value); + } + }); + var values = trim(exprs, compressor, first_in_statement, function(node, compressor, first_in_statement) { + var exp = node.expression; + return exp.safe_to_spread() ? exp.drop_side_effect_free(compressor, first_in_statement) : node; + }); + if (!values) return null; + if (values === exprs && !all(values, function(node) { + return !(node instanceof AST_Spread); + })) return this; + return make_sequence(this, values.map(function(node) { + return node instanceof AST_Spread ? make_node(AST_Object, node, { properties: [ node ] }) : node; + })); + }); + def(AST_ObjectIdentity, return_null); + def(AST_Sequence, function(compressor, first_in_statement) { + var expressions = trim(this.expressions, compressor, first_in_statement); + if (!expressions) return null; + var end = expressions.length - 1; + var last = expressions[end]; + if (compressor.option("awaits") && end > 0 && last instanceof AST_Await && last.expression.is_constant()) { + expressions = expressions.slice(0, -1); + end--; + var expr = expressions[end]; + last.expression = needs_enqueuing(compressor, expr) ? expr : expr.negate(compressor); + expressions[end] = last; + } + var assign, cond, lhs; + if (compressor.option("conditionals") + && end > 0 + && (assign = expressions[end - 1]) instanceof AST_Assign + && assign.operator == "=" + && (lhs = assign.left) instanceof AST_SymbolRef + && (cond = to_conditional_assignment(compressor, lhs.definition(), assign.right, last))) { + assign = assign.clone(); + assign.right = cond; + expressions = expressions.slice(0, -2); + expressions.push(assign.drop_side_effect_free(compressor, first_in_statement)); + } + return expressions === this.expressions ? this : make_sequence(this, expressions); + }); + def(AST_Sub, function(compressor, first_in_statement) { + var expr = this.expression; + if (expr.may_throw_on_access(compressor)) return this; + var prop = this.property; + expr = expr.drop_side_effect_free(compressor, first_in_statement); + if (!expr) return prop.drop_side_effect_free(compressor, first_in_statement); + prop = prop.drop_side_effect_free(compressor); + if (!prop) return expr; + return make_sequence(this, [ expr, prop ]); + }); + def(AST_SymbolRef, function(compressor) { + return this.is_declared(compressor) && can_drop_symbol(this, compressor) ? null : this; + }); + def(AST_Template, function(compressor, first_in_statement) { + var self = this; + if (self.is_expr_pure(compressor)) { + var expressions = self.expressions; + if (expressions.length == 0) return null; + return make_sequence(self, expressions).drop_side_effect_free(compressor, first_in_statement); + } + var tag = self.tag; + var dropped = drop_returns(compressor, tag); + if (dropped) { + // always shallow clone to signal internal changes + self = self.clone(); + self.tag = dropped; + // avoid extraneous traversal + if (tag._squeezed) self.tag._squeezed = true; + } + return self; + }); + def(AST_Unary, function(compressor, first_in_statement) { + var exp = this.expression; + if (unary_side_effects[this.operator]) { + this.write_only = !exp.has_side_effects(compressor); + return this; + } + if (this.operator == "typeof" && exp instanceof AST_SymbolRef && can_drop_symbol(exp, compressor)) { + return null; + } + var node = exp.drop_side_effect_free(compressor, first_in_statement); + if (first_in_statement && node && is_iife_call(node)) { + if (node === exp && this.operator == "!") return this; + return node.negate(compressor, first_in_statement); + } + return node; + }); + })(function(node, func) { + node.DEFMETHOD("drop_side_effect_free", func); + }); + + OPT(AST_SimpleStatement, function(self, compressor) { + if (compressor.option("side_effects")) { + var body = self.body; + var node = body.drop_side_effect_free(compressor, true); + if (!node) { + AST_Node.warn("Dropping side-effect-free statement [{start}]", self); + return make_node(AST_EmptyStatement, self); + } + if (node !== body) { + return make_node(AST_SimpleStatement, self, { body: node }); + } + } + return self; + }); + + OPT(AST_While, function(self, compressor) { + return compressor.option("loops") ? make_node(AST_For, self).optimize(compressor) : self; + }); + + function has_loop_control(loop, parent, type) { + if (!type) type = AST_LoopControl; + var found = false; + var tw = new TreeWalker(function(node) { + if (found || node instanceof AST_Scope) return true; + if (node instanceof type && tw.loopcontrol_target(node) === loop) { + return found = true; + } + }); + if (parent instanceof AST_LabeledStatement) tw.push(parent); + tw.push(loop); + loop.body.walk(tw); + return found; + } + + OPT(AST_Do, function(self, compressor) { + if (!compressor.option("loops")) return self; + var cond = fuzzy_eval(compressor, self.condition); + if (!(cond instanceof AST_Node)) { + if (cond && !has_loop_control(self, compressor.parent(), AST_Continue)) return make_node(AST_For, self, { + body: make_node(AST_BlockStatement, self.body, { + body: [ + self.body, + make_node(AST_SimpleStatement, self.condition, { body: self.condition }), + ], + }), + }).optimize(compressor); + if (!has_loop_control(self, compressor.parent())) return make_node(AST_BlockStatement, self.body, { + body: [ + self.body, + make_node(AST_SimpleStatement, self.condition, { body: self.condition }), + ], + }).optimize(compressor); + } + if (self.body instanceof AST_BlockStatement && !has_loop_control(self, compressor.parent(), AST_Continue)) { + var body = self.body.body; + for (var i = body.length; --i >= 0;) { + var stat = body[i]; + if (stat instanceof AST_If + && !stat.alternative + && stat.body instanceof AST_Break + && compressor.loopcontrol_target(stat.body) === self) { + if (has_block_scope_refs(stat.condition)) break; + self.condition = make_node(AST_Binary, self, { + operator: "&&", + left: stat.condition.negate(compressor), + right: self.condition, + }); + body.splice(i, 1); + } else if (stat instanceof AST_SimpleStatement) { + if (has_block_scope_refs(stat.body)) break; + self.condition = make_sequence(self, [ + stat.body, + self.condition, + ]); + body.splice(i, 1); + } else if (!is_declaration(stat, true)) { + break; + } + } + self.body = trim_block(self.body, compressor.parent()); + } + if (self.body instanceof AST_EmptyStatement) return make_node(AST_For, self).optimize(compressor); + if (self.body instanceof AST_SimpleStatement) return make_node(AST_For, self, { + condition: make_sequence(self.condition, [ + self.body.body, + self.condition, + ]), + body: make_node(AST_EmptyStatement, self), + }).optimize(compressor); + return self; + + function has_block_scope_refs(node) { + var found = false; + node.walk(new TreeWalker(function(node) { + if (found) return true; + if (node instanceof AST_SymbolRef) { + if (!member(node.definition(), self.enclosed)) found = true; + return true; + } + })); + return found; + } + }); + + function if_break_in_loop(self, compressor) { + var first = first_statement(self.body); + if (compressor.option("dead_code") + && (first instanceof AST_Break + || first instanceof AST_Continue && external_target(first) + || first instanceof AST_Exit)) { + var body = []; + if (is_statement(self.init)) { + body.push(self.init); + } else if (self.init) { + body.push(make_node(AST_SimpleStatement, self.init, { body: self.init })); + } + var retain = external_target(first) || first instanceof AST_Exit; + if (self.condition && retain) { + body.push(make_node(AST_If, self, { + condition: self.condition, + body: first, + alternative: null, + })); + } else if (self.condition) { + body.push(make_node(AST_SimpleStatement, self.condition, { body: self.condition })); + } else if (retain) { + body.push(first); + } + extract_declarations_from_unreachable_code(compressor, self.body, body); + return make_node(AST_BlockStatement, self, { body: body }); + } + if (first instanceof AST_If) { + var ab = first_statement(first.body); + if (ab instanceof AST_Break && !external_target(ab)) { + if (self.condition) { + self.condition = make_node(AST_Binary, self.condition, { + left: self.condition, + operator: "&&", + right: first.condition.negate(compressor), + }); + } else { + self.condition = first.condition.negate(compressor); + } + var body = as_statement_array(first.alternative); + extract_declarations_from_unreachable_code(compressor, first.body, body); + return drop_it(body); + } + ab = first_statement(first.alternative); + if (ab instanceof AST_Break && !external_target(ab)) { + if (self.condition) { + self.condition = make_node(AST_Binary, self.condition, { + left: self.condition, + operator: "&&", + right: first.condition, + }); + } else { + self.condition = first.condition; + } + var body = as_statement_array(first.body); + extract_declarations_from_unreachable_code(compressor, first.alternative, body); + return drop_it(body); + } + } + return self; + + function first_statement(body) { + return body instanceof AST_BlockStatement ? body.body[0] : body; + } + + function external_target(node) { + return compressor.loopcontrol_target(node) !== compressor.self(); + } + + function drop_it(rest) { + if (self.body instanceof AST_BlockStatement) { + self.body = self.body.clone(); + self.body.body = rest.concat(self.body.body.slice(1)); + self.body = self.body.transform(compressor); + } else { + self.body = make_node(AST_BlockStatement, self.body, { body: rest }).transform(compressor); + } + return if_break_in_loop(self, compressor); + } + } + + OPT(AST_For, function(self, compressor) { + if (!compressor.option("loops")) return self; + if (compressor.option("side_effects")) { + if (self.init) self.init = self.init.drop_side_effect_free(compressor); + if (self.step) self.step = self.step.drop_side_effect_free(compressor); + } + if (self.condition) { + var cond = fuzzy_eval(compressor, self.condition); + if (!cond) { + if (compressor.option("dead_code")) { + var body = []; + if (is_statement(self.init)) { + body.push(self.init); + } else if (self.init) { + body.push(make_node(AST_SimpleStatement, self.init, { body: self.init })); + } + body.push(make_node(AST_SimpleStatement, self.condition, { body: self.condition })); + extract_declarations_from_unreachable_code(compressor, self.body, body); + return make_node(AST_BlockStatement, self, { body: body }).optimize(compressor); + } + } else if (!(cond instanceof AST_Node)) { + self.body = make_node(AST_BlockStatement, self.body, { + body: [ + make_node(AST_SimpleStatement, self.condition, { body: self.condition }), + self.body, + ], + }); + self.condition = null; + } + } + return if_break_in_loop(self, compressor); + }); + + OPT(AST_ForEnumeration, function(self, compressor) { + if (compressor.option("varify") && is_lexical_definition(self.init)) { + var name = self.init.definitions[0].name; + if ((name instanceof AST_Destructured || name instanceof AST_SymbolLet) + && !name.match_symbol(function(node) { + if (node instanceof AST_SymbolDeclaration) { + var def = node.definition(); + return !same_scope(def) || may_overlap(compressor, def); + } + }, true)) { + self.init = to_var(self.init, self.resolve()); + } + } + return self; + }); + + function mark_locally_defined(condition, consequent, alternative) { + if (condition instanceof AST_Sequence) condition = condition.tail_node(); + if (!(condition instanceof AST_Binary)) return; + if (!(condition.left instanceof AST_String)) { + switch (condition.operator) { + case "&&": + mark_locally_defined(condition.left, consequent); + mark_locally_defined(condition.right, consequent); + break; + case "||": + mark_locally_defined(negate(condition.left), alternative); + mark_locally_defined(negate(condition.right), alternative); + break; + } + return; + } + if (!(condition.right instanceof AST_UnaryPrefix)) return; + if (condition.right.operator != "typeof") return; + var sym = condition.right.expression; + if (!is_undeclared_ref(sym)) return; + var body; + var undef = condition.left.value == "undefined"; + switch (condition.operator) { + case "==": + body = undef ? alternative : consequent; + break; + case "!=": + body = undef ? consequent : alternative; + break; + default: + return; + } + if (!body) return; + var abort = false; + var def = sym.definition(); + var fn; + var refs = []; + var scanned = []; + var tw = new TreeWalker(function(node, descend) { + if (abort) return true; + if (node instanceof AST_Assign) { + var ref = node.left; + if (!(ref instanceof AST_SymbolRef && ref.definition() === def)) return; + node.right.walk(tw); + switch (node.operator) { + case "=": + case "&&=": + abort = true; + } + return true; + } + if (node instanceof AST_Call) { + descend(); + fn = node.expression.tail_node(); + var save; + if (fn instanceof AST_SymbolRef) { + fn = fn.fixed_value(); + save = refs.length; + } + if (!(fn instanceof AST_Lambda)) { + abort = true; + } else if (push_uniq(scanned, fn)) { + fn.walk(tw); + } + if (save >= 0) refs.length = save; + return true; + } + if (node instanceof AST_DWLoop) { + var save = refs.length; + descend(); + if (abort) refs.length = save; + return true; + } + if (node instanceof AST_For) { + if (node.init) node.init.walk(tw); + var save = refs.length; + if (node.condition) node.condition.walk(tw); + node.body.walk(tw); + if (node.step) node.step.walk(tw); + if (abort) refs.length = save; + return true; + } + if (node instanceof AST_ForEnumeration) { + node.object.walk(tw); + var save = refs.length; + node.init.walk(tw); + node.body.walk(tw); + if (abort) refs.length = save; + return true; + } + if (node instanceof AST_Scope) { + if (node === fn) return; + return true; + } + if (node instanceof AST_SymbolRef) { + if (node.definition() === def) refs.push(node); + return true; + } + }); + body.walk(tw); + refs.forEach(function(ref) { + ref.defined = true; + }); + + function negate(node) { + if (!(node instanceof AST_Binary)) return; + switch (node.operator) { + case "==": + node = node.clone(); + node.operator = "!="; + return node; + case "!=": + node = node.clone(); + node.operator = "=="; + return node; + } + } + } + + function fuzzy_eval(compressor, node, nullish) { + if (node.truthy) return true; + if (is_undefined(node)) return undefined; + if (node.falsy && !nullish) return false; + if (node.is_truthy()) return true; + return node.evaluate(compressor, true); + } + + function mark_duplicate_condition(compressor, node) { + var child; + var level = 0; + var negated = false; + var parent = compressor.self(); + if (!is_statement(parent)) while (true) { + child = parent; + parent = compressor.parent(level++); + if (parent instanceof AST_Binary) { + switch (child) { + case parent.left: + if (lazy_op[parent.operator]) continue; + break; + case parent.right: + if (match(parent.left)) switch (parent.operator) { + case "&&": + node[negated ? "falsy" : "truthy"] = true; + break; + case "||": + case "??": + node[negated ? "truthy" : "falsy"] = true; + break; + } + break; + } + } else if (parent instanceof AST_Conditional) { + var cond = parent.condition; + if (cond === child) continue; + if (match(cond)) switch (child) { + case parent.consequent: + node[negated ? "falsy" : "truthy"] = true; + break; + case parent.alternative: + node[negated ? "truthy" : "falsy"] = true; + break; + } + } else if (parent instanceof AST_Exit) { + break; + } else if (parent instanceof AST_If) { + break; + } else if (parent instanceof AST_Sequence) { + if (parent.expressions[0] === child) continue; + } else if (parent instanceof AST_SimpleStatement) { + break; + } + return; + } + while (true) { + child = parent; + parent = compressor.parent(level++); + if (parent instanceof AST_BlockStatement) { + if (parent.body[0] === child) continue; + } else if (parent instanceof AST_If) { + if (match(parent.condition)) switch (child) { + case parent.body: + node[negated ? "falsy" : "truthy"] = true; + break; + case parent.alternative: + node[negated ? "truthy" : "falsy"] = true; + break; + } + } + return; + } + + function match(cond) { + if (node.equals(cond)) return true; + if (!(cond instanceof AST_UnaryPrefix)) return false; + if (cond.operator != "!") return false; + if (!node.equals(cond.expression)) return false; + negated = true; + return true; + } + } + + OPT(AST_If, function(self, compressor) { + if (is_empty(self.alternative)) self.alternative = null; + + if (!compressor.option("conditionals")) return self; + if (compressor.option("booleans") && !self.condition.has_side_effects(compressor)) { + mark_duplicate_condition(compressor, self.condition); + } + // if condition can be statically determined, warn and drop + // one of the blocks. note, statically determined implies + // “has no side effects”; also it doesn't work for cases like + // `x && true`, though it probably should. + if (compressor.option("dead_code")) { + var cond = fuzzy_eval(compressor, self.condition); + if (!cond) { + AST_Node.warn("Condition always false [{start}]", self.condition); + var body = [ + make_node(AST_SimpleStatement, self.condition, { body: self.condition }).transform(compressor), + ]; + extract_declarations_from_unreachable_code(compressor, self.body, body); + if (self.alternative) body.push(self.alternative); + return make_node(AST_BlockStatement, self, { body: body }).optimize(compressor); + } else if (!(cond instanceof AST_Node)) { + AST_Node.warn("Condition always true [{start}]", self.condition); + var body = [ + make_node(AST_SimpleStatement, self.condition, { body: self.condition }).transform(compressor), + self.body, + ]; + if (self.alternative) extract_declarations_from_unreachable_code(compressor, self.alternative, body); + return make_node(AST_BlockStatement, self, { body: body }).optimize(compressor); + } + } + var negated = self.condition.negate(compressor); + var self_condition_length = self.condition.print_to_string().length; + var negated_length = negated.print_to_string().length; + var negated_is_best = negated_length < self_condition_length; + if (self.alternative && negated_is_best) { + negated_is_best = false; // because we already do the switch here. + // no need to swap values of self_condition_length and negated_length + // here because they are only used in an equality comparison later on. + self.condition = negated; + var tmp = self.body; + self.body = self.alternative; + self.alternative = is_empty(tmp) ? null : tmp; + } + var body_defuns = []; + var body_var_defs = []; + var body_refs = []; + var body_exprs = sequencesize(self.body, body_defuns, body_var_defs, body_refs); + var alt_defuns = []; + var alt_var_defs = []; + var alt_refs = []; + var alt_exprs = sequencesize(self.alternative, alt_defuns, alt_var_defs, alt_refs); + if (body_exprs instanceof AST_BlockStatement || alt_exprs instanceof AST_BlockStatement) { + var body = [], var_defs = []; + if (body_exprs) { + [].push.apply(body, body_defuns); + [].push.apply(var_defs, body_var_defs); + if (body_exprs instanceof AST_BlockStatement) { + self.body = body_exprs; + } else if (body_exprs.length == 0) { + self.body = make_node(AST_EmptyStatement, self.body); + } else { + self.body = make_node(AST_SimpleStatement, self.body, { + body: make_sequence(self.body, body_exprs), + }); + } + body_refs.forEach(process_to_assign); + } + if (alt_exprs) { + [].push.apply(body, alt_defuns); + [].push.apply(var_defs, alt_var_defs); + if (alt_exprs instanceof AST_BlockStatement) { + self.alternative = alt_exprs; + } else if (alt_exprs.length == 0) { + self.alternative = null; + } else { + self.alternative = make_node(AST_SimpleStatement, self.alternative, { + body: make_sequence(self.alternative, alt_exprs), + }); + } + alt_refs.forEach(process_to_assign); + } + if (var_defs.length > 0) body.push(make_node(AST_Var, self, { definitions: var_defs })); + if (body.length > 0) { + body.push(self.transform(compressor)); + return make_node(AST_BlockStatement, self, { body: body }).optimize(compressor); + } + } else if (body_exprs && alt_exprs) { + var body = body_defuns.concat(alt_defuns); + if (body_var_defs.length > 0 || alt_var_defs.length > 0) body.push(make_node(AST_Var, self, { + definitions: body_var_defs.concat(alt_var_defs), + })); + if (body_exprs.length == 0) { + body.push(make_node(AST_SimpleStatement, self.condition, { + body: alt_exprs.length > 0 ? make_node(AST_Binary, self, { + operator: "||", + left: self.condition, + right: make_sequence(self.alternative, alt_exprs), + }).transform(compressor) : self.condition.clone(), + }).optimize(compressor)); + } else if (alt_exprs.length == 0) { + if (self_condition_length === negated_length && !negated_is_best + && self.condition instanceof AST_Binary && self.condition.operator == "||") { + // although the code length of self.condition and negated are the same, + // negated does not require additional surrounding parentheses. + // see https://github.com/mishoo/UglifyJS/issues/979 + negated_is_best = true; + } + body.push(make_node(AST_SimpleStatement, self, { + body: make_node(AST_Binary, self, { + operator: negated_is_best ? "||" : "&&", + left: negated_is_best ? negated : self.condition, + right: make_sequence(self.body, body_exprs), + }).transform(compressor), + }).optimize(compressor)); + } else { + body.push(make_node(AST_SimpleStatement, self, { + body: make_node(AST_Conditional, self, { + condition: self.condition, + consequent: make_sequence(self.body, body_exprs), + alternative: make_sequence(self.alternative, alt_exprs), + }), + }).optimize(compressor)); + } + body_refs.forEach(process_to_assign); + alt_refs.forEach(process_to_assign); + return make_node(AST_BlockStatement, self, { body: body }).optimize(compressor); + } + if (is_empty(self.body)) self = make_node(AST_If, self, { + condition: negated, + body: self.alternative, + alternative: null, + }); + if (self.alternative instanceof AST_Exit && self.body.TYPE == self.alternative.TYPE) { + var cons_value = self.body.value; + var alt_value = self.alternative.value; + if (!cons_value && !alt_value) return make_node(AST_BlockStatement, self, { + body: [ + make_node(AST_SimpleStatement, self, { body: self.condition }), + self.body, + ], + }).optimize(compressor); + if (cons_value && alt_value || !keep_return_void()) { + var exit = make_node(self.body.CTOR, self, { + value: make_node(AST_Conditional, self, { + condition: self.condition, + consequent: cons_value || make_node(AST_Undefined, self.body).transform(compressor), + alternative: alt_value || make_node(AST_Undefined, self.alternative).transform(compressor), + }), + }); + if (exit instanceof AST_Return) exit.in_bool = self.body.in_bool || self.alternative.in_bool; + return exit; + } + } + if (self.body instanceof AST_If && !self.body.alternative && !self.alternative) { + self = make_node(AST_If, self, { + condition: make_node(AST_Binary, self.condition, { + operator: "&&", + left: self.condition, + right: self.body.condition, + }), + body: self.body.body, + alternative: null, + }); + } + if (aborts(self.body) && self.alternative) { + var alt = self.alternative; + self.alternative = null; + return make_node(AST_BlockStatement, self, { body: [ self, alt ] }).optimize(compressor); + } + if (aborts(self.alternative)) { + var body = self.body; + self.body = self.alternative; + self.condition = negated_is_best ? negated : self.condition.negate(compressor); + self.alternative = null; + return make_node(AST_BlockStatement, self, { body: [ self, body ] }).optimize(compressor); + } + if (self.alternative) { + var body_stats = as_array(self.body); + var body_index = last_index(body_stats); + var alt_stats = as_array(self.alternative); + var alt_index = last_index(alt_stats); + for (var stats = []; body_index >= 0 && alt_index >= 0;) { + var stat = body_stats[body_index]; + var alt_stat = alt_stats[alt_index]; + if (stat.equals(alt_stat)) { + body_stats.splice(body_index--, 1); + alt_stats.splice(alt_index--, 1); + stats.unshift(merge_expression(stat, alt_stat)); + } else { + if (!(stat instanceof AST_SimpleStatement)) break; + if (!(alt_stat instanceof AST_SimpleStatement)) break; + var expr1 = stat.body.tail_node(); + var expr2 = alt_stat.body.tail_node(); + if (!expr1.equals(expr2)) break; + body_index = pop_expr(body_stats, stat.body, body_index); + alt_index = pop_expr(alt_stats, alt_stat.body, alt_index); + stats.unshift(make_node(AST_SimpleStatement, expr1, { body: merge_expression(expr1, expr2) })); + } + } + if (stats.length > 0) { + self.body = body_stats.length > 0 ? make_node(AST_BlockStatement, self, { + body: body_stats, + }) : make_node(AST_EmptyStatement, self); + self.alternative = alt_stats.length > 0 ? make_node(AST_BlockStatement, self, { + body: alt_stats, + }) : null; + stats.unshift(self); + return make_node(AST_BlockStatement, self, { body: stats }).optimize(compressor); + } + } + if (compressor.option("typeofs")) mark_locally_defined(self.condition, self.body, self.alternative); + return self; + + function as_array(node) { + return node instanceof AST_BlockStatement ? node.body : [ node ]; + } + + function keep_return_void() { + var has_finally = false, level = 0, node = compressor.self(); + do { + if (node instanceof AST_Catch) { + if (compressor.parent(level).bfinally) has_finally = true; + level++; + } else if (node instanceof AST_Finally) { + level++; + } else if (node instanceof AST_Scope) { + return has_finally && in_async_generator(node); + } else if (node instanceof AST_Try) { + if (node.bfinally) has_finally = true; + } + } while (node = compressor.parent(level++)); + } + + function last_index(stats) { + for (var index = stats.length; --index >= 0;) { + if (!is_declaration(stats[index], true)) break; + } + return index; + } + + function pop_expr(stats, body, index) { + if (body instanceof AST_Sequence) { + stats[index] = make_node(AST_SimpleStatement, body, { + body: make_sequence(body, body.expressions.slice(0, -1)), + }); + } else { + stats.splice(index--, 1); + } + return index; + } + + function sequencesize(stat, defuns, var_defs, refs) { + if (stat == null) return []; + if (stat instanceof AST_BlockStatement) { + var exprs = []; + for (var i = 0; i < stat.body.length; i++) { + var line = stat.body[i]; + if (line instanceof AST_EmptyStatement) continue; + if (line instanceof AST_Exit) { + if (i == 0) return; + if (exprs.length > 0) { + line = line.clone(); + exprs.push(line.value || make_node(AST_Undefined, line).transform(compressor)); + line.value = make_sequence(stat, exprs); + } + var block = stat.clone(); + block.body = block.body.slice(i + 1); + block.body.unshift(line); + return block; + } + if (line instanceof AST_LambdaDefinition) { + defuns.push(line); + } else if (line instanceof AST_SimpleStatement) { + if (!compressor.option("sequences") && exprs.length > 0) return; + exprs.push(line.body); + } else if (line instanceof AST_Var) { + if (!compressor.option("sequences") && exprs.length > 0) return; + line.remove_initializers(compressor, var_defs); + line.definitions.forEach(process_var_def); + } else { + return; + } + } + return exprs; + } + if (stat instanceof AST_LambdaDefinition) { + defuns.push(stat); + return []; + } + if (stat instanceof AST_EmptyStatement) return []; + if (stat instanceof AST_SimpleStatement) return [ stat.body ]; + if (stat instanceof AST_Var) { + var exprs = []; + stat.remove_initializers(compressor, var_defs); + stat.definitions.forEach(process_var_def); + return exprs; + } + + function process_var_def(var_def) { + if (!var_def.value) return; + exprs.push(make_node(AST_Assign, var_def, { + operator: "=", + left: var_def.name.convert_symbol(AST_SymbolRef, function(ref) { + refs.push(ref); + }), + right: var_def.value, + })); + } + } + }); + + OPT(AST_Switch, function(self, compressor) { + if (!compressor.option("switches")) return self; + if (!compressor.option("dead_code")) return self; + var body = []; + var branch; + var decl = []; + var default_branch; + var exact_match; + var side_effects = []; + for (var i = 0, len = self.body.length; i < len; i++) { + branch = self.body[i]; + if (branch instanceof AST_Default) { + var prev = body[body.length - 1]; + if (default_branch || is_break(branch.body[0], compressor) && (!prev || aborts(prev))) { + eliminate_branch(branch, prev); + continue; + } else { + default_branch = branch; + } + } else { + var exp = branch.expression; + var equals = make_node(AST_Binary, self, { + operator: "===", + left: self.expression, + right: exp, + }).evaluate(compressor, true); + if (!equals) { + if (exp.has_side_effects(compressor)) side_effects.push(exp); + eliminate_branch(branch, body[body.length - 1]); + continue; + } + if (!(equals instanceof AST_Node)) { + if (default_branch) { + var default_index = body.indexOf(default_branch); + body.splice(default_index, 1); + eliminate_branch(default_branch, body[default_index - 1]); + default_branch = null; + } + if (exp.has_side_effects(compressor)) { + exact_match = branch; + } else { + default_branch = branch = make_node(AST_Default, branch); + } + while (++i < len) eliminate_branch(self.body[i], branch); + } + } + if (i + 1 >= len || aborts(branch)) { + var prev = body[body.length - 1]; + var statements = branch.body; + if (aborts(prev)) switch (prev.body.length - statements.length) { + case 1: + var stat = prev.body[prev.body.length - 1]; + if (!is_break(stat, compressor)) break; + statements = statements.concat(stat); + case 0: + var prev_block = make_node(AST_BlockStatement, prev); + var next_block = make_node(AST_BlockStatement, branch, { body: statements }); + if (prev_block.equals(next_block)) prev.body = []; + } + } + if (side_effects.length) { + if (branch instanceof AST_Default) { + body.push(make_node(AST_Case, self, { expression: make_sequence(self, side_effects), body: [] })); + } else { + side_effects.push(branch.expression); + branch.expression = make_sequence(self, side_effects); + } + side_effects = []; + } + body.push(branch); + } + if (side_effects.length && !exact_match) { + body.push(make_node(AST_Case, self, { expression: make_sequence(self, side_effects), body: [] })); + } + while (branch = body[body.length - 1]) { + var stat = branch.body[branch.body.length - 1]; + if (is_break(stat, compressor)) branch.body.pop(); + if (branch === default_branch) { + if (!has_declarations_only(branch)) break; + } else if (branch.expression.has_side_effects(compressor)) { + break; + } else if (default_branch) { + if (!has_declarations_only(default_branch)) break; + if (body[body.length - 2] !== default_branch) break; + default_branch.body = default_branch.body.concat(branch.body); + branch.body = []; + } else if (!has_declarations_only(branch)) break; + eliminate_branch(branch); + if (body.pop() === default_branch) default_branch = null; + } + if (!branch) { + decl.push(make_node(AST_SimpleStatement, self.expression, { body: self.expression })); + if (side_effects.length) decl.push(make_node(AST_SimpleStatement, self, { + body: make_sequence(self, side_effects), + })); + return make_node(AST_BlockStatement, self, { body: decl }).optimize(compressor); + } + if (branch === default_branch) while (branch = body[body.length - 2]) { + if (branch instanceof AST_Default) break; + if (!has_declarations_only(branch)) break; + var exp = branch.expression; + if (exp.has_side_effects(compressor)) { + var prev = body[body.length - 3]; + if (prev && !aborts(prev)) break; + default_branch.body.unshift(make_node(AST_SimpleStatement, self, { body: exp })); + } + eliminate_branch(branch); + body.splice(-2, 1); + } + body[0].body = decl.concat(body[0].body); + self.body = body; + if (compressor.option("conditionals")) switch (body.length) { + case 1: + if (!no_break(body[0])) break; + var exp = body[0].expression; + var statements = body[0].body.slice(); + if (body[0] !== default_branch && body[0] !== exact_match) return make_node(AST_If, self, { + condition: make_node(AST_Binary, self, { + operator: "===", + left: self.expression, + right: exp, + }), + body: make_node(AST_BlockStatement, self, { body: statements }), + alternative: null, + }).optimize(compressor); + if (exp) statements.unshift(make_node(AST_SimpleStatement, exp, { body: exp })); + statements.unshift(make_node(AST_SimpleStatement, self.expression, { body: self.expression })); + return make_node(AST_BlockStatement, self, { body: statements }).optimize(compressor); + case 2: + if (!member(default_branch, body) || !no_break(body[1])) break; + var statements = body[0].body.slice(); + var exclusive = statements.length && is_break(statements[statements.length - 1], compressor); + if (exclusive) statements.pop(); + if (!all(statements, no_break)) break; + var alternative = body[1].body.length && make_node(AST_BlockStatement, body[1]); + var node = make_node(AST_If, self, { + condition: make_node(AST_Binary, self, body[0] === default_branch ? { + operator: "!==", + left: self.expression, + right: body[1].expression, + } : { + operator: "===", + left: self.expression, + right: body[0].expression, + }), + body: make_node(AST_BlockStatement, body[0], { body: statements }), + alternative: exclusive && alternative || null, + }); + if (!exclusive && alternative) node = make_node(AST_BlockStatement, self, { body: [ node, alternative ] }); + return node.optimize(compressor); + } + return self; + + function is_break(node, tw) { + return node instanceof AST_Break && tw.loopcontrol_target(node) === self; + } + + function no_break(node) { + var found = false; + var tw = new TreeWalker(function(node) { + if (found + || node instanceof AST_Lambda + || node instanceof AST_SimpleStatement) return true; + if (is_break(node, tw)) found = true; + }); + tw.push(self); + node.walk(tw); + return !found; + } + + function eliminate_branch(branch, prev) { + if (prev && !aborts(prev)) { + prev.body = prev.body.concat(branch.body); + } else { + extract_declarations_from_unreachable_code(compressor, branch, decl); + } + } + }); + + OPT(AST_Try, function(self, compressor) { + self.body = tighten_body(self.body, compressor); + if (compressor.option("dead_code")) { + if (has_declarations_only(self) + && !(self.bcatch && self.bcatch.argname && self.bcatch.argname.match_symbol(function(node) { + return node instanceof AST_SymbolCatch && !can_drop_symbol(node); + }, true))) { + var body = []; + if (self.bcatch) { + extract_declarations_from_unreachable_code(compressor, self.bcatch, body); + body.forEach(function(stat) { + if (!(stat instanceof AST_Var)) return; + stat.definitions.forEach(function(var_def) { + var def = var_def.name.definition().redefined(); + if (!def) return; + var_def.name = var_def.name.clone(); + var_def.name.thedef = def; + }); + }); + } + body.unshift(make_node(AST_BlockStatement, self).optimize(compressor)); + if (self.bfinally) { + body.push(make_node(AST_BlockStatement, self.bfinally).optimize(compressor)); + } + return make_node(AST_BlockStatement, self, { body: body }).optimize(compressor); + } + if (self.bfinally && has_declarations_only(self.bfinally)) { + var body = make_node(AST_BlockStatement, self.bfinally).optimize(compressor); + body = self.body.concat(body); + if (!self.bcatch) return make_node(AST_BlockStatement, self, { body: body }).optimize(compressor); + self.body = body; + self.bfinally = null; + } + } + return self; + }); + + function remove_initializers(make_value) { + return function(compressor, defns) { + var dropped = false; + this.definitions.forEach(function(defn) { + if (defn.value) dropped = true; + defn.name.match_symbol(function(node) { + if (node instanceof AST_SymbolDeclaration) defns.push(make_node(AST_VarDef, node, { + name: node, + value: make_value(compressor, node), + })); + }, true); + }); + return dropped; + }; + } + + AST_Const.DEFMETHOD("remove_initializers", remove_initializers(function(compressor, node) { + return make_node(AST_Undefined, node).optimize(compressor); + })); + AST_Let.DEFMETHOD("remove_initializers", remove_initializers(return_null)); + AST_Var.DEFMETHOD("remove_initializers", remove_initializers(return_null)); + + AST_Definitions.DEFMETHOD("to_assignments", function() { + var assignments = this.definitions.reduce(function(a, defn) { + var def = defn.name.definition(); + var value = defn.value; + if (value) { + if (value instanceof AST_Sequence) value = value.clone(); + var name = make_node(AST_SymbolRef, defn.name); + var assign = make_node(AST_Assign, defn, { + operator: "=", + left: name, + right: value, + }); + a.push(assign); + var fixed = function() { + return assign.right; + }; + fixed.assigns = [ assign ]; + fixed.direct_access = def.direct_access; + fixed.escaped = def.escaped; + name.fixed = fixed; + def.references.forEach(function(ref) { + if (!ref.fixed) return; + var assigns = ref.fixed.assigns; + if (!assigns) return; + if (assigns[0] !== defn) return; + if (assigns.length > 1 || ref.fixed.to_binary || ref.fixed.to_prefix) { + assigns[0] = assign; + } else { + ref.fixed = fixed; + if (def.fixed === ref.fixed) def.fixed = fixed; + } + }); + def.references.push(name); + } + def.assignments++; + def.eliminated++; + def.single_use = false; + return a; + }, []); + if (assignments.length == 0) return null; + return make_sequence(this, assignments); + }); + + function is_safe_lexical(def) { + return def.name != "arguments" && def.orig.length < (def.orig[0] instanceof AST_SymbolLambda ? 3 : 2); + } + + function may_overlap(compressor, def) { + if (compressor.exposed(def)) return true; + var scope = def.scope.resolve(); + for (var s = def.scope; s !== scope;) { + s = s.parent_scope; + if (s.var_names().has(def.name)) return true; + } + } + + function to_var(stat, scope) { + return make_node(AST_Var, stat, { + definitions: stat.definitions.map(function(defn) { + return make_node(AST_VarDef, defn, { + name: defn.name.convert_symbol(AST_SymbolVar, function(name, node) { + var def = name.definition(); + def.orig[def.orig.indexOf(node)] = name; + if (def.scope === scope) return; + def.scope = scope; + scope.variables.set(def.name, def); + scope.enclosed.push(def); + scope.var_names().set(def.name, true); + }), + value: defn.value, + }); + }), + }); + } + + function can_varify(compressor, sym) { + var def = sym.definition(); + return (def.fixed || def.fixed === 0) + && is_safe_lexical(def) + && same_scope(def) + && !may_overlap(compressor, def); + } + + function varify(self, compressor) { + return compressor.option("varify") && all(self.definitions, function(defn) { + return !defn.name.match_symbol(function(node) { + if (node instanceof AST_SymbolDeclaration) return !can_varify(compressor, node); + }, true); + }) ? to_var(self, compressor.find_parent(AST_Scope)) : self; + } + + OPT(AST_Const, varify); + OPT(AST_Let, varify); + + function trim_optional_chain(node, compressor) { + if (!compressor.option("optional_chains")) return; + if (node.terminal) do { + var expr = node.expression; + if (node.optional) { + var ev = fuzzy_eval(compressor, expr, true); + if (ev == null) return make_node(AST_UnaryPrefix, node, { + operator: "void", + expression: expr, + }).optimize(compressor); + if (!(ev instanceof AST_Node)) node.optional = false; + } + node = expr; + } while ((node.TYPE == "Call" || node instanceof AST_PropAccess) && !node.terminal); + } + + function lift_sequence_in_expression(node, compressor) { + var exp = node.expression; + if (!(exp instanceof AST_Sequence)) return node; + var x = exp.expressions.slice(); + var e = node.clone(); + e.expression = x.pop(); + x.push(e); + return make_sequence(node, x); + } + + function drop_unused_call_args(call, compressor, fns_with_marked_args) { + var exp = call.expression; + var fn = exp instanceof AST_SymbolRef ? exp.fixed_value() : exp; + if (!(fn instanceof AST_Lambda)) return; + if (fn.uses_arguments) return; + if (fn.pinned()) return; + if (fns_with_marked_args && fns_with_marked_args.indexOf(fn) < 0) return; + var args = call.args; + if (!all(args, function(arg) { + return !(arg instanceof AST_Spread); + })) return; + var argnames = fn.argnames; + var is_iife = fn === exp && !fn.name; + if (fn.rest) { + if (!(is_iife && compressor.option("rests"))) return; + var insert = argnames.length; + args = args.slice(0, insert); + while (args.length < insert) args.push(make_node(AST_Undefined, call).optimize(compressor)); + args.push(make_node(AST_Array, call, { elements: call.args.slice(insert) })); + argnames = argnames.concat(fn.rest); + fn.rest = null; + } else { + args = args.slice(); + argnames = argnames.slice(); + } + var pos = 0, last = 0; + var drop_defaults = is_iife && compressor.option("default_values"); + var drop_fargs = is_iife && compressor.drop_fargs(fn, call) ? function(argname, arg) { + if (!argname) return true; + if (argname instanceof AST_DestructuredArray) { + return argname.elements.length == 0 && !argname.rest && arg instanceof AST_Array; + } + if (argname instanceof AST_DestructuredObject) { + return argname.properties.length == 0 && !argname.rest && arg && !arg.may_throw_on_access(compressor); + } + return argname.unused; + } : return_false; + var side_effects = []; + for (var i = 0; i < args.length; i++) { + var argname = argnames[i]; + if (drop_defaults && argname instanceof AST_DefaultValue && args[i].is_defined(compressor)) { + argnames[i] = argname = argname.name; + } + if (!argname || argname.unused !== undefined) { + var node = args[i].drop_side_effect_free(compressor); + if (drop_fargs(argname)) { + if (argname) argnames.splice(i, 1); + args.splice(i, 1); + if (node) side_effects.push(node); + i--; + continue; + } else if (node) { + side_effects.push(node); + args[pos++] = make_sequence(call, side_effects); + side_effects = []; + } else if (argname) { + if (side_effects.length) { + args[pos++] = make_sequence(call, side_effects); + side_effects = []; + } else { + args[pos++] = make_node(AST_Number, args[i], { value: 0 }); + continue; + } + } + } else if (drop_fargs(argname, args[i])) { + var node = args[i].drop_side_effect_free(compressor); + argnames.splice(i, 1); + args.splice(i, 1); + if (node) side_effects.push(node); + i--; + continue; + } else { + side_effects.push(args[i]); + args[pos++] = make_sequence(call, side_effects); + side_effects = []; + } + last = pos; + } + for (; i < argnames.length; i++) { + if (drop_fargs(argnames[i])) argnames.splice(i--, 1); + } + fn.argnames = argnames; + args.length = last; + call.args = args; + if (!side_effects.length) return; + var arg = make_sequence(call, side_effects); + args.push(args.length < argnames.length ? make_node(AST_UnaryPrefix, call, { + operator: "void", + expression: arg, + }) : arg); + } + + function avoid_await_yield(compressor, parent_scope) { + if (!parent_scope) parent_scope = compressor.find_parent(AST_Scope); + var avoid = []; + if (is_async(parent_scope) || parent_scope instanceof AST_Toplevel && compressor.option("module")) { + avoid.push("await"); + } + if (is_generator(parent_scope)) avoid.push("yield"); + return avoid.length && makePredicate(avoid); + } + + function safe_from_await_yield(fn, avoid) { + if (!avoid) return true; + var safe = true; + var tw = new TreeWalker(function(node) { + if (!safe) return true; + if (node instanceof AST_Scope) { + if (node === fn) return; + if (is_arrow(node)) { + for (var i = 0; safe && i < node.argnames.length; i++) node.argnames[i].walk(tw); + } else if (node instanceof AST_LambdaDefinition && avoid[node.name.name]) { + safe = false; + } + return true; + } + if (node instanceof AST_Symbol && avoid[node.name] && node !== fn.name) safe = false; + }); + fn.walk(tw); + return safe; + } + + function safe_from_strict_mode(fn, compressor) { + return fn.in_strict_mode(compressor) || !compressor.has_directive("use strict"); + } + + OPT(AST_Call, function(self, compressor) { + var exp = self.expression; + var terminated = trim_optional_chain(self, compressor); + if (terminated) return terminated; + if (compressor.option("sequences")) { + if (exp instanceof AST_PropAccess) { + var seq = lift_sequence_in_expression(exp, compressor); + if (seq !== exp) { + var call = self.clone(); + call.expression = seq.expressions.pop(); + seq.expressions.push(call); + return seq.optimize(compressor); + } + } else if (!needs_unbinding(exp.tail_node())) { + var seq = lift_sequence_in_expression(self, compressor); + if (seq !== self) return seq.optimize(compressor); + } + } + if (compressor.option("unused")) drop_unused_call_args(self, compressor); + if (compressor.option("unsafe")) { + if (is_undeclared_ref(exp)) switch (exp.name) { + case "Array": + // Array(n) ---> [ , , ... , ] + if (self.args.length == 1) { + var first = self.args[0]; + if (first instanceof AST_Number) try { + var length = first.value; + if (length > 6) break; + var elements = Array(length); + for (var i = 0; i < length; i++) elements[i] = make_node(AST_Hole, self); + return make_node(AST_Array, self, { elements: elements }); + } catch (ex) { + AST_Node.warn("Invalid array length: {length} [{start}]", { + length: length, + start: self.start, + }); + break; + } + if (!first.is_boolean(compressor) && !first.is_string(compressor)) break; + } + // Array(...) ---> [ ... ] + return make_node(AST_Array, self, { elements: self.args }); + case "Object": + // Object() ---> {} + if (self.args.length == 0) return make_node(AST_Object, self, { properties: [] }); + break; + case "String": + // String() ---> "" + if (self.args.length == 0) return make_node(AST_String, self, { value: "" }); + // String(x) ---> "" + x + if (self.args.length == 1) return make_node(AST_Binary, self, { + operator: "+", + left: make_node(AST_String, self, { value: "" }), + right: self.args[0], + }).optimize(compressor); + break; + case "Number": + // Number() ---> 0 + if (self.args.length == 0) return make_node(AST_Number, self, { value: 0 }); + // Number(x) ---> +("" + x) + if (self.args.length == 1) return make_node(AST_UnaryPrefix, self, { + operator: "+", + expression: make_node(AST_Binary, self, { + operator: "+", + left: make_node(AST_String, self, { value: "" }), + right: self.args[0], + }), + }).optimize(compressor); + break; + case "Boolean": + // Boolean() ---> false + if (self.args.length == 0) return make_node(AST_False, self).optimize(compressor); + // Boolean(x) ---> !!x + if (self.args.length == 1) return make_node(AST_UnaryPrefix, self, { + operator: "!", + expression: make_node(AST_UnaryPrefix, self, { + operator: "!", + expression: self.args[0], + }), + }).optimize(compressor); + break; + case "RegExp": + // attempt to convert RegExp(...) to literal + var params = []; + if (all(self.args, function(arg) { + var value = arg.evaluate(compressor); + params.unshift(value); + return arg !== value; + })) try { + return best_of(compressor, self, make_node(AST_RegExp, self, { + value: RegExp.apply(RegExp, params), + })); + } catch (ex) { + AST_Node.warn("Error converting {this} [{start}]", self); + } + break; + } else if (exp instanceof AST_Dot) switch (exp.property) { + case "toString": + // x.toString() ---> "" + x + var expr = exp.expression; + if (self.args.length == 0 && !(expr.may_throw_on_access(compressor) || expr instanceof AST_Super)) { + return make_node(AST_Binary, self, { + operator: "+", + left: make_node(AST_String, self, { value: "" }), + right: expr, + }).optimize(compressor); + } + break; + case "join": + if (exp.expression instanceof AST_Array && self.args.length < 2) EXIT: { + var separator = self.args[0]; + // [].join() ---> "" + // [].join(x) ---> (x, "") + if (exp.expression.elements.length == 0 && !(separator instanceof AST_Spread)) { + return separator ? make_sequence(self, [ + separator, + make_node(AST_String, self, { value: "" }), + ]).optimize(compressor) : make_node(AST_String, self, { value: "" }); + } + if (separator) { + separator = separator.evaluate(compressor); + if (separator instanceof AST_Node) break EXIT; // not a constant + } + var elements = []; + var consts = []; + for (var i = 0; i < exp.expression.elements.length; i++) { + var el = exp.expression.elements[i]; + var value = el.evaluate(compressor); + if (value !== el) { + consts.push(value); + } else if (el instanceof AST_Spread) { + break EXIT; + } else { + if (consts.length > 0) { + elements.push(make_node(AST_String, self, { value: consts.join(separator) })); + consts.length = 0; + } + elements.push(el); + } + } + if (consts.length > 0) elements.push(make_node(AST_String, self, { + value: consts.join(separator), + })); + // [ x ].join() ---> "" + x + // [ x ].join(".") ---> "" + x + // [ 1, 2, 3 ].join() ---> "1,2,3" + // [ 1, 2, 3 ].join(".") ---> "1.2.3" + if (elements.length == 1) { + if (elements[0].is_string(compressor)) return elements[0]; + return make_node(AST_Binary, elements[0], { + operator: "+", + left: make_node(AST_String, self, { value: "" }), + right: elements[0], + }); + } + // [ 1, 2, a, 3 ].join("") ---> "12" + a + "3" + if (separator == "") { + var first; + if (elements[0].is_string(compressor) || elements[1].is_string(compressor)) { + first = elements.shift(); + } else { + first = make_node(AST_String, self, { value: "" }); + } + return elements.reduce(function(prev, el) { + return make_node(AST_Binary, el, { + operator: "+", + left: prev, + right: el, + }); + }, first).optimize(compressor); + } + // [ x, "foo", "bar", y ].join() ---> [ x, "foo,bar", y ].join() + // [ x, "foo", "bar", y ].join("-") ---> [ x, "foo-bar", y ].join("-") + // need this awkward cloning to not affect original element + // best_of will decide which one to get through. + var node = self.clone(); + node.expression = node.expression.clone(); + node.expression.expression = node.expression.expression.clone(); + node.expression.expression.elements = elements; + return best_of(compressor, self, node); + } + break; + case "charAt": + if (self.args.length < 2) { + var node = make_node(AST_Binary, self, { + operator: "||", + left: make_node(AST_Sub, self, { + expression: exp.expression, + property: self.args.length ? make_node(AST_Binary, self.args[0], { + operator: "|", + left: make_node(AST_Number, self, { value: 0 }), + right: self.args[0], + }) : make_node(AST_Number, self, { value: 0 }), + }).optimize(compressor), + right: make_node(AST_String, self, { value: "" }), + }); + node.is_string = return_true; + return node.optimize(compressor); + } + break; + case "apply": + if (self.args.length == 2 && self.args[1] instanceof AST_Array) { + var args = self.args[1].elements.slice(); + args.unshift(self.args[0]); + return make_node(AST_Call, self, { + expression: make_node(AST_Dot, exp, { + expression: exp.expression, + property: "call", + }), + args: args, + }).optimize(compressor); + } + break; + case "call": + var func = exp.expression; + if (func instanceof AST_SymbolRef) { + func = func.fixed_value(); + } + if (func instanceof AST_Lambda && !func.contains_this()) { + return (self.args.length ? make_sequence(self, [ + self.args[0], + make_node(AST_Call, self, { + expression: exp.expression, + args: self.args.slice(1), + }), + ]) : make_node(AST_Call, self, { + expression: exp.expression, + args: [], + })).optimize(compressor); + } + break; + } else if (compressor.option("side_effects") + && exp instanceof AST_Call + && exp.args.length == 1 + && is_undeclared_ref(exp.expression) + && exp.expression.name == "Object") { + var call = self.clone(); + call.expression = maintain_this_binding(self, exp, exp.args[0]); + return call.optimize(compressor); + } + } + if (compressor.option("unsafe_Function") + && is_undeclared_ref(exp) + && exp.name == "Function") { + // new Function() ---> function(){} + if (self.args.length == 0) return make_node(AST_Function, self, { + argnames: [], + body: [], + }).init_vars(exp.scope); + if (all(self.args, function(x) { + return x instanceof AST_String; + })) { + // quite a corner-case, but we can handle it: + // https://github.com/mishoo/UglifyJS/issues/203 + // if the code argument is a constant, then we can minify it. + try { + var code = "n(function(" + self.args.slice(0, -1).map(function(arg) { + return arg.value; + }).join() + "){" + self.args[self.args.length - 1].value + "})"; + var ast = parse(code); + var mangle = { ie: compressor.option("ie") }; + ast.figure_out_scope(mangle); + var comp = new Compressor(compressor.options); + ast = ast.transform(comp); + ast.figure_out_scope(mangle); + ast.compute_char_frequency(mangle); + ast.mangle_names(mangle); + var fun; + ast.walk(new TreeWalker(function(node) { + if (fun) return true; + if (node instanceof AST_Lambda) { + fun = node; + return true; + } + })); + var code = OutputStream(); + AST_BlockStatement.prototype._codegen.call(fun, code); + self.args = [ + make_node(AST_String, self, { + value: fun.argnames.map(function(arg) { + return arg.print_to_string(); + }).join(), + }), + make_node(AST_String, self.args[self.args.length - 1], { + value: code.get().replace(/^\{|\}$/g, "") + }), + ]; + return self; + } catch (ex) { + if (ex instanceof JS_Parse_Error) { + AST_Node.warn("Error parsing code passed to new Function [{start}]", self.args[self.args.length - 1]); + AST_Node.warn(ex.toString()); + } else { + throw ex; + } + } + } + } + var fn = exp instanceof AST_SymbolRef ? exp.fixed_value() : exp; + var parent = compressor.parent(), current = compressor.self(); + var is_func = fn instanceof AST_Lambda + && (!is_async(fn) || compressor.option("awaits") && parent instanceof AST_Await) + && (!is_generator(fn) || compressor.option("yields") && current instanceof AST_Yield && current.nested); + var stat = is_func && fn.first_statement(); + var has_default = 0, has_destructured = false; + var has_spread = !all(self.args, function(arg) { + return !(arg instanceof AST_Spread); + }); + var can_drop = is_func && all(fn.argnames, function(argname, index) { + if (has_default == 1 && self.args[index] instanceof AST_Spread) has_default = 2; + if (argname instanceof AST_DefaultValue) { + if (!has_default) has_default = 1; + var arg = has_default == 1 && self.args[index]; + if (!is_undefined(arg)) has_default = 2; + if (has_arg_refs(fn, argname.value)) return false; + argname = argname.name; + } + if (argname instanceof AST_Destructured) { + has_destructured = true; + if (has_arg_refs(fn, argname)) return false; + } + return true; + }) && !(fn.rest instanceof AST_Destructured && has_arg_refs(fn, fn.rest)); + var can_inline = can_drop + && compressor.option("inline") + && !self.is_expr_pure(compressor) + && (exp === fn || safe_from_strict_mode(fn, compressor)); + if (can_inline && stat instanceof AST_Return) { + var value = stat.value; + if (exp === fn + && !fn.name + && (!value || value.is_constant_expression()) + && safe_from_await_yield(fn, avoid_await_yield(compressor))) { + return make_sequence(self, convert_args(value)).optimize(compressor); + } + } + if (is_func && !fn.contains_this()) { + var def, value, var_assigned = false; + if (can_inline + && !fn.uses_arguments + && !fn.pinned() + && !(fn.name && fn instanceof AST_LambdaExpression) + && (exp === fn || !recursive_ref(compressor, def = exp.definition(), fn) + && fn.is_constant_expression(find_scope(compressor))) + && (value = can_flatten_body(stat))) { + var replacing = exp === fn || def.single_use && def.references.length - def.replaced == 1; + if (can_substitute_directly()) { + var args = self.args.slice(); + var refs = []; + var retValue = value.clone(true).transform(new TreeTransformer(function(node) { + if (node instanceof AST_SymbolRef) { + var def = node.definition(); + if (fn.variables.get(node.name) !== def) { + refs.push(node); + return node; + } + var index = resolve_index(def); + var arg = args[index]; + if (!arg) return make_node(AST_Undefined, self); + args[index] = null; + var parent = this.parent(); + return parent ? maintain_this_binding(parent, node, arg) : arg; + } + })); + var save_inlined = fn.inlined; + if (exp !== fn) fn.inlined = true; + var exprs = []; + args.forEach(function(arg) { + if (!arg) return; + arg = arg.clone(true); + arg.walk(new TreeWalker(function(node) { + if (node instanceof AST_SymbolRef) refs.push(node); + })); + exprs.push(arg); + }, []); + exprs.push(retValue); + var node = make_sequence(self, exprs).optimize(compressor); + fn.inlined = save_inlined; + node = maintain_this_binding(parent, current, node); + if (replacing || best_of_expression(node, self) === node) { + refs.forEach(function(ref) { + ref.scope = exp === fn ? fn.parent_scope : exp.scope; + ref.reference(); + var def = ref.definition(); + if (replacing) def.replaced++; + def.single_use = false; + }); + return node; + } else if (!node.has_side_effects(compressor)) { + self.drop_side_effect_free = function(compressor, first_in_statement) { + var self = this; + var exprs = self.args.slice(); + exprs.unshift(self.expression); + return make_sequence(self, exprs).drop_side_effect_free(compressor, first_in_statement); + }; + } + } + var arg_used, insert, in_loop, scope; + if (replacing && can_inject_symbols()) { + fn._squeezed = true; + if (exp !== fn) fn.parent_scope = exp.scope; + var node = make_sequence(self, flatten_fn()).optimize(compressor); + return maintain_this_binding(parent, current, node); + } + } + if (compressor.option("side_effects") + && can_drop + && all(fn.body, is_empty) + && (fn === exp ? fn_name_unused(fn, compressor) : !has_default && !has_destructured && !fn.rest) + && !(is_arrow(fn) && fn.value) + && safe_from_await_yield(fn, avoid_await_yield(compressor))) { + return make_sequence(self, convert_args()).optimize(compressor); + } + } + if (compressor.option("drop_console")) { + if (exp instanceof AST_PropAccess) { + var name = exp.expression; + while (name.expression) { + name = name.expression; + } + if (is_undeclared_ref(name) && name.name == "console") { + return make_node(AST_Undefined, self).optimize(compressor); + } + } + } + if (compressor.option("negate_iife") && parent instanceof AST_SimpleStatement && is_iife_call(current)) { + return self.negate(compressor, true); + } + return try_evaluate(compressor, self); + + function make_void_lhs(orig) { + return make_node(AST_Sub, orig, { + expression: make_node(AST_Array, orig, { elements: [] }), + property: make_node(AST_Number, orig, { value: 0 }), + }); + } + + function convert_args(value) { + var args = self.args.slice(); + var destructured = has_default > 1 || has_destructured || fn.rest; + if (destructured || has_spread) args = [ make_node(AST_Array, self, { elements: args }) ]; + if (destructured) { + var tt = new TreeTransformer(function(node, descend) { + if (node instanceof AST_DefaultValue) return make_node(AST_DefaultValue, node, { + name: node.name.transform(tt) || make_void_lhs(node), + value: node.value, + }); + if (node instanceof AST_DestructuredArray) { + var elements = []; + node.elements.forEach(function(node, index) { + node = node.transform(tt); + if (node) elements[index] = node; + }); + fill_holes(node, elements); + return make_node(AST_DestructuredArray, node, { elements: elements }); + } + if (node instanceof AST_DestructuredObject) { + var properties = [], side_effects = []; + node.properties.forEach(function(prop) { + var key = prop.key; + var value = prop.value.transform(tt); + if (value) { + if (side_effects.length) { + if (!(key instanceof AST_Node)) key = make_node_from_constant(key, prop); + side_effects.push(key); + key = make_sequence(node, side_effects); + side_effects = []; + } + properties.push(make_node(AST_DestructuredKeyVal, prop, { + key: key, + value: value, + })); + } else if (key instanceof AST_Node) { + side_effects.push(key); + } + }); + if (side_effects.length) properties.push(make_node(AST_DestructuredKeyVal, node, { + key: make_sequence(node, side_effects), + value: make_void_lhs(node), + })); + return make_node(AST_DestructuredObject, node, { properties: properties }); + } + if (node instanceof AST_SymbolFunarg) return null; + }); + var lhs = []; + fn.argnames.forEach(function(argname, index) { + argname = argname.transform(tt); + if (argname) lhs[index] = argname; + }); + var rest = fn.rest && fn.rest.transform(tt); + if (rest) lhs.length = fn.argnames.length; + fill_holes(fn, lhs); + args[0] = make_node(AST_Assign, self, { + operator: "=", + left: make_node(AST_DestructuredArray, fn, { + elements: lhs, + rest: rest, + }), + right: args[0], + }); + } else fn.argnames.forEach(function(argname) { + if (argname instanceof AST_DefaultValue) args.push(argname.value); + }); + args.push(value || make_node(AST_Undefined, self)); + return args; + } + + function noop_value() { + return self.call_only ? make_node(AST_Number, self, { value: 0 }) : make_node(AST_Undefined, self); + } + + function return_value(stat) { + if (!stat) return noop_value(); + if (stat instanceof AST_Return) return stat.value || noop_value(); + if (stat instanceof AST_SimpleStatement) { + return self.call_only ? stat.body : make_node(AST_UnaryPrefix, stat, { + operator: "void", + expression: stat.body, + }); + } + } + + function can_flatten_body(stat) { + var len = fn.body.length; + if (len < 2) { + stat = return_value(stat); + if (stat) return stat; + } + if (compressor.option("inline") < 3) return false; + stat = null; + for (var i = 0; i < len; i++) { + var line = fn.body[i]; + if (line instanceof AST_Var) { + if (var_assigned) { + if (!stat) continue; + if (!(stat instanceof AST_SimpleStatement)) return false; + if (!declarations_only(line)) stat = null; + } else if (!declarations_only(line)) { + if (stat && !(stat instanceof AST_SimpleStatement)) return false; + stat = null; + var_assigned = true; + } + } else if (line instanceof AST_AsyncDefun + || line instanceof AST_Defun + || line instanceof AST_EmptyStatement) { + continue; + } else if (stat) { + return false; + } else { + stat = line; + } + } + return return_value(stat); + } + + function resolve_index(def) { + for (var i = fn.argnames.length; --i >= 0;) { + if (fn.argnames[i].definition() === def) return i; + } + } + + function can_substitute_directly() { + if (has_default || has_destructured || has_spread || var_assigned || fn.rest) return; + if (compressor.option("inline") < 2 && fn.argnames.length) return; + if (!fn.variables.all(function(def) { + return def.references.length - def.replaced < 2 && def.orig[0] instanceof AST_SymbolFunarg; + })) return; + var scope = compressor.find_parent(AST_Scope); + var abort = false; + var avoid = avoid_await_yield(compressor, scope); + var begin; + var in_order = []; + var side_effects = false; + var tw = new TreeWalker(function(node, descend) { + if (abort) return true; + if (node instanceof AST_Binary && lazy_op[node.operator] + || node instanceof AST_Conditional) { + in_order = null; + return; + } + if (node instanceof AST_Scope) return abort = true; + if (avoid && node instanceof AST_Symbol && avoid[node.name]) return abort = true; + if (node instanceof AST_SymbolRef) { + var def = node.definition(); + if (fn.variables.get(node.name) !== def) { + in_order = null; + return; + } + if (def.init instanceof AST_LambdaDefinition) return abort = true; + if (is_lhs(node, tw.parent())) return abort = true; + var index = resolve_index(def); + if (!(begin < index)) begin = index; + if (!in_order) return; + if (side_effects) { + in_order = null; + } else { + in_order.push(fn.argnames[index]); + } + return; + } + if (side_effects) return; + if (node instanceof AST_Assign && node.left instanceof AST_PropAccess) { + node.left.expression.walk(tw); + if (node.left instanceof AST_Sub) node.left.property.walk(tw); + node.right.walk(tw); + side_effects = true; + return true; + } + if (node.has_side_effects(compressor)) { + descend(); + side_effects = true; + return true; + } + }); + value.walk(tw); + if (abort) return; + var end = self.args.length; + if (in_order && fn.argnames.length >= end) { + end = fn.argnames.length; + while (end-- > begin && fn.argnames[end] === in_order.pop()); + end++; + } + return end <= begin || all(self.args.slice(begin, end), side_effects && !in_order ? function(funarg) { + return funarg.is_constant_expression(scope); + } : function(funarg) { + return !funarg.has_side_effects(compressor); + }); + } + + function var_exists(defined, name) { + return defined.has(name) || identifier_atom[name] || scope.var_names().has(name); + } + + function can_inject_args(defined, safe_to_inject) { + var abort = false; + fn.each_argname(function(arg) { + if (abort) return; + if (arg.unused) return; + if (!safe_to_inject || var_exists(defined, arg.name)) return abort = true; + arg_used.set(arg.name, true); + if (in_loop) in_loop.push(arg.definition()); + }); + return !abort; + } + + function can_inject_vars(defined, safe_to_inject) { + for (var i = 0; i < fn.body.length; i++) { + var stat = fn.body[i]; + if (stat instanceof AST_LambdaDefinition) { + var name = stat.name; + if (!safe_to_inject) return false; + if (arg_used.has(name.name)) return false; + if (var_exists(defined, name.name)) return false; + if (!all(stat.enclosed, function(def) { + return def.scope === scope || def.scope === stat || !defined.has(def.name); + })) return false; + if (in_loop) in_loop.push(name.definition()); + continue; + } + if (!(stat instanceof AST_Var)) continue; + if (!safe_to_inject) return false; + for (var j = stat.definitions.length; --j >= 0;) { + var name = stat.definitions[j].name; + if (var_exists(defined, name.name)) return false; + if (in_loop) in_loop.push(name.definition()); + } + } + return true; + } + + function can_inject_symbols() { + var defined = new Dictionary(); + var level = 0, child; + scope = current; + do { + if (scope.variables) scope.variables.each(function(def) { + defined.set(def.name, true); + }); + child = scope; + scope = compressor.parent(level++); + if (scope instanceof AST_ClassField) { + if (!scope.static) return false; + } else if (scope instanceof AST_DWLoop) { + in_loop = []; + } else if (scope instanceof AST_For) { + if (scope.init === child) continue; + in_loop = []; + } else if (scope instanceof AST_ForEnumeration) { + if (scope.init === child) continue; + if (scope.object === child) continue; + in_loop = []; + } + } while (!(scope instanceof AST_Scope)); + insert = scope.body.indexOf(child) + 1; + if (!insert) return false; + if (!safe_from_await_yield(fn, avoid_await_yield(compressor, scope))) return false; + var safe_to_inject = (exp !== fn || fn.parent_scope.resolve() === scope) && !scope.pinned(); + if (scope instanceof AST_Toplevel) { + if (compressor.toplevel.vars) { + defined.set("arguments", true); + } else { + safe_to_inject = false; + } + } + arg_used = new Dictionary(); + var inline = compressor.option("inline"); + if (!can_inject_args(defined, inline >= 2 && safe_to_inject)) return false; + if (!can_inject_vars(defined, inline >= 3 && safe_to_inject)) return false; + return !in_loop || in_loop.length == 0 || !is_reachable(fn, in_loop); + } + + function append_var(decls, expressions, name, value) { + var def = name.definition(); + if (!scope.var_names().has(name.name)) { + scope.var_names().set(name.name, true); + decls.push(make_node(AST_VarDef, name, { + name: name, + value: null, + })); + } + scope.variables.set(name.name, def); + scope.enclosed.push(def); + if (!value) return; + var sym = make_node(AST_SymbolRef, name); + def.assignments++; + def.references.push(sym); + expressions.push(make_node(AST_Assign, self, { + operator: "=", + left: sym, + right: value, + })); + } + + function flatten_args(decls, expressions) { + var len = fn.argnames.length; + for (var i = self.args.length; --i >= len;) { + expressions.push(self.args[i]); + } + var default_args = []; + for (i = len; --i >= 0;) { + var argname = fn.argnames[i]; + var name; + if (argname instanceof AST_DefaultValue) { + default_args.push(argname); + name = argname.name; + } else { + name = argname; + } + var value = self.args[i]; + if (name.unused || scope.var_names().has(name.name)) { + if (value) expressions.push(value); + } else { + var symbol = make_node(AST_SymbolVar, name); + var def = name.definition(); + def.orig.push(symbol); + def.eliminated++; + if (name.unused !== undefined) { + append_var(decls, expressions, symbol); + if (value) expressions.push(value); + } else { + if (!value && argname === name && (in_loop + || name.name == "arguments" && !is_arrow(fn) && is_arrow(scope))) { + value = make_node(AST_Undefined, self); + } + append_var(decls, expressions, symbol, value); + } + } + } + decls.reverse(); + expressions.reverse(); + for (i = default_args.length; --i >= 0;) { + var node = default_args[i]; + if (node.name.unused !== undefined) { + expressions.push(node.value); + } else { + var sym = make_node(AST_SymbolRef, node.name); + node.name.definition().references.push(sym); + expressions.push(make_node(AST_Assign, node, { + operator: "=", + left: sym, + right: node.value, + })); + } + } + } + + function flatten_destructured(decls, expressions) { + expressions.push(make_node(AST_Assign, self, { + operator: "=", + left: make_node(AST_DestructuredArray, self, { + elements: fn.argnames.map(function(argname) { + if (argname.unused) return make_node(AST_Hole, argname); + return argname.convert_symbol(AST_SymbolRef, process); + }), + rest: fn.rest && fn.rest.convert_symbol(AST_SymbolRef, process), + }), + right: make_node(AST_Array, self, { elements: self.args.slice() }), + })); + + function process(ref, name) { + if (name.unused) return make_void_lhs(name); + var def = name.definition(); + def.assignments++; + def.references.push(ref); + var symbol = make_node(AST_SymbolVar, name); + def.orig.push(symbol); + def.eliminated++; + append_var(decls, expressions, symbol); + } + } + + function flatten_vars(decls, expressions) { + var args = [ insert, 0 ]; + var decl_var = [], expr_fn = [], expr_var = [], expr_loop = [], exprs = []; + fn.body.filter(in_loop ? function(stat) { + if (!(stat instanceof AST_LambdaDefinition)) return true; + var name = make_node(AST_SymbolVar, flatten_var(stat.name)); + var def = name.definition(); + def.fixed = false; + def.orig.push(name); + def.eliminated++; + append_var(decls, expr_fn, name, to_func_expr(stat, true)); + return false; + } : function(stat) { + if (!(stat instanceof AST_LambdaDefinition)) return true; + var def = stat.name.definition(); + scope.functions.set(def.name, def); + scope.variables.set(def.name, def); + scope.enclosed.push(def); + scope.var_names().set(def.name, true); + args.push(stat); + return false; + }).forEach(function(stat) { + if (!(stat instanceof AST_Var)) { + if (stat instanceof AST_SimpleStatement) exprs.push(stat.body); + return; + } + for (var j = 0; j < stat.definitions.length; j++) { + var var_def = stat.definitions[j]; + var name = flatten_var(var_def.name); + var value = var_def.value; + if (value && exprs.length > 0) { + exprs.push(value); + value = make_sequence(var_def, exprs); + exprs = []; + } + append_var(decl_var, expr_var, name, value); + if (!in_loop) continue; + if (arg_used.has(name.name)) continue; + if (name.definition().orig.length == 1 && fn.functions.has(name.name)) continue; + expr_loop.push(init_ref(compressor, name)); + } + }); + [].push.apply(decls, decl_var); + [].push.apply(expressions, expr_loop); + [].push.apply(expressions, expr_fn); + [].push.apply(expressions, expr_var); + return args; + } + + function flatten_fn() { + var decls = []; + var expressions = []; + if (has_default > 1 || has_destructured || has_spread || fn.rest) { + flatten_destructured(decls, expressions); + } else { + flatten_args(decls, expressions); + } + var args = flatten_vars(decls, expressions); + expressions.push(value); + if (decls.length) args.push(make_node(AST_Var, fn, { definitions: decls })); + [].splice.apply(scope.body, args); + fn.enclosed.forEach(function(def) { + if (scope.var_names().has(def.name)) return; + scope.enclosed.push(def); + scope.var_names().set(def.name, true); + }); + return expressions; + } + }); + + OPT(AST_New, function(self, compressor) { + if (compressor.option("unsafe")) { + var exp = self.expression; + if (is_undeclared_ref(exp)) switch (exp.name) { + case "Array": + case "Error": + case "Function": + case "Object": + case "RegExp": + return make_node(AST_Call, self).transform(compressor); + } + } + if (compressor.option("sequences")) { + var seq = lift_sequence_in_expression(self, compressor); + if (seq !== self) return seq.optimize(compressor); + } + if (compressor.option("unused")) drop_unused_call_args(self, compressor); + return self; + }); + + // (a = b, x && a = c) ---> a = x ? c : b + // (a = b, x || a = c) ---> a = x ? b : c + function to_conditional_assignment(compressor, def, value, node) { + if (!(node instanceof AST_Binary)) return; + if (!(node.operator == "&&" || node.operator == "||")) return; + if (!(node.right instanceof AST_Assign)) return; + if (node.right.operator != "=") return; + if (!(node.right.left instanceof AST_SymbolRef)) return; + if (node.right.left.definition() !== def) return; + if (value.has_side_effects(compressor)) return; + if (!safe_from_assignment(node.left)) return; + if (!safe_from_assignment(node.right.right)) return; + def.replaced++; + return node.operator == "&&" ? make_node(AST_Conditional, node, { + condition: node.left, + consequent: node.right.right, + alternative: value, + }) : make_node(AST_Conditional, node, { + condition: node.left, + consequent: value, + alternative: node.right.right, + }); + + function safe_from_assignment(node) { + if (node.has_side_effects(compressor)) return; + var hit = false; + node.walk(new TreeWalker(function(node) { + if (hit) return true; + if (node instanceof AST_SymbolRef && node.definition() === def) return hit = true; + })); + return !hit; + } + } + + OPT(AST_Sequence, function(self, compressor) { + var expressions = filter_for_side_effects(); + var end = expressions.length - 1; + merge_assignments(); + trim_right_for_undefined(); + if (end == 0) { + self = maintain_this_binding(compressor.parent(), compressor.self(), expressions[0]); + if (!(self instanceof AST_Sequence)) self = self.optimize(compressor); + return self; + } + self.expressions = expressions; + return self; + + function filter_for_side_effects() { + if (!compressor.option("side_effects")) return self.expressions; + var expressions = []; + var first = first_in_statement(compressor); + var last = self.expressions.length - 1; + self.expressions.forEach(function(expr, index) { + if (index < last) expr = expr.drop_side_effect_free(compressor, first); + if (expr) { + merge_sequence(expressions, expr); + first = false; + } + }); + return expressions; + } + + function trim_right_for_undefined() { + if (!compressor.option("side_effects")) return; + while (end > 0 && is_undefined(expressions[end], compressor)) end--; + if (end < expressions.length - 1) { + expressions[end] = make_node(AST_UnaryPrefix, self, { + operator: "void", + expression: expressions[end], + }); + expressions.length = end + 1; + } + } + + function is_simple_assign(node) { + return node instanceof AST_Assign + && node.operator == "=" + && node.left instanceof AST_SymbolRef + && node.left.definition(); + } + + function merge_assignments() { + for (var i = 1; i < end; i++) { + var prev = expressions[i - 1]; + var def = is_simple_assign(prev); + if (!def) continue; + var expr = expressions[i]; + if (compressor.option("conditionals")) { + var cond = to_conditional_assignment(compressor, def, prev.right, expr); + if (cond) { + prev.right = cond; + expressions.splice(i--, 1); + end--; + continue; + } + } + if (compressor.option("dead_code") + && is_simple_assign(expr) === def + && expr.right.is_constant_expression(def.scope.resolve())) { + expressions[--i] = prev.right; + } + } + } + }); + + OPT(AST_UnaryPostfix, function(self, compressor) { + if (compressor.option("sequences")) { + var seq = lift_sequence_in_expression(self, compressor); + if (seq !== self) return seq.optimize(compressor); + } + return try_evaluate(compressor, self); + }); + + var SIGN_OPS = makePredicate("+ -"); + var MULTIPLICATIVE_OPS = makePredicate("* / %"); + OPT(AST_UnaryPrefix, function(self, compressor) { + var op = self.operator; + var exp = self.expression; + if (compressor.option("sequences") && can_lift()) { + var seq = lift_sequence_in_expression(self, compressor); + if (seq !== self) return seq.optimize(compressor); + } + switch (op) { + case "+": + if (!compressor.option("evaluate")) break; + if (!exp.is_number(compressor, true)) break; + var parent = compressor.parent(); + if (parent instanceof AST_UnaryPrefix && parent.operator == "delete") break; + return exp; + case "-": + if (exp instanceof AST_Infinity) exp = exp.transform(compressor); + // avoids infinite recursion of numerals + if (exp instanceof AST_Number || exp instanceof AST_Infinity) return self; + break; + case "!": + if (!compressor.option("booleans")) break; + if (exp.is_truthy()) return make_sequence(self, [ exp, make_node(AST_False, self) ]).optimize(compressor); + if (compressor.in_boolean_context()) { + // !!foo ---> foo, if we're in boolean context + if (exp instanceof AST_UnaryPrefix && exp.operator == "!") return exp.expression; + if (exp instanceof AST_Binary) { + var first = first_in_statement(compressor); + self = (first ? best_of_statement : best_of_expression)(self, exp.negate(compressor, first)); + } + } + break; + case "delete": + if (!compressor.option("evaluate")) break; + if (may_not_delete(exp)) break; + return make_sequence(self, [ exp, make_node(AST_True, self) ]).optimize(compressor); + case "typeof": + if (!compressor.option("booleans")) break; + if (!compressor.in_boolean_context()) break; + // typeof always returns a non-empty string, thus always truthy + AST_Node.warn("Boolean expression always true [{start}]", self); + var exprs = [ make_node(AST_True, self) ]; + if (!(exp instanceof AST_SymbolRef && can_drop_symbol(exp, compressor))) exprs.unshift(exp); + return make_sequence(self, exprs).optimize(compressor); + case "void": + if (!compressor.option("side_effects")) break; + exp = exp.drop_side_effect_free(compressor); + if (!exp) return make_node(AST_Undefined, self).optimize(compressor); + self.expression = exp; + return self; + } + if (compressor.option("evaluate") + && exp instanceof AST_Binary + && SIGN_OPS[op] + && MULTIPLICATIVE_OPS[exp.operator] + && (exp.left.is_constant() || !exp.right.has_side_effects(compressor))) { + return make_node(AST_Binary, self, { + operator: exp.operator, + left: make_node(AST_UnaryPrefix, exp.left, { + operator: op, + expression: exp.left, + }), + right: exp.right, + }); + } + return try_evaluate(compressor, self); + + function may_not_delete(node) { + return node instanceof AST_Infinity + || node instanceof AST_NaN + || node instanceof AST_NewTarget + || node instanceof AST_PropAccess + || node instanceof AST_SymbolRef + || node instanceof AST_Undefined; + } + + function can_lift() { + switch (op) { + case "delete": + return !may_not_delete(exp.tail_node()); + case "typeof": + return !is_undeclared_ref(exp.tail_node()); + default: + return true; + } + } + }); + + OPT(AST_Await, function(self, compressor) { + if (!compressor.option("awaits")) return self; + if (compressor.option("sequences")) { + var seq = lift_sequence_in_expression(self, compressor); + if (seq !== self) return seq.optimize(compressor); + } + if (compressor.option("side_effects")) { + var exp = self.expression; + if (exp instanceof AST_Await) return exp.optimize(compressor); + if (exp instanceof AST_UnaryPrefix && exp.expression instanceof AST_Await) return exp.optimize(compressor); + for (var level = 0, node = self, parent; parent = compressor.parent(level++); node = parent) { + if (is_arrow(parent)) { + if (parent.value === node) return exp.optimize(compressor); + } else if (parent instanceof AST_Return) { + var drop = true; + do { + node = parent; + parent = compressor.parent(level++); + if (parent instanceof AST_Try && (parent.bfinally || parent.bcatch) !== node) { + drop = false; + break; + } + } while (parent && !(parent instanceof AST_Scope)); + if (drop) return exp.optimize(compressor); + } else if (parent instanceof AST_Sequence) { + if (parent.tail_node() === node) continue; + } + break; + } + } + return self; + }); + + OPT(AST_Yield, function(self, compressor) { + if (!compressor.option("yields")) return self; + if (compressor.option("sequences")) { + var seq = lift_sequence_in_expression(self, compressor); + if (seq !== self) return seq.optimize(compressor); + } + var exp = self.expression; + if (self.nested && exp.TYPE == "Call") { + var inlined = exp.clone().optimize(compressor); + if (inlined.TYPE != "Call") return inlined; + } + return self; + }); + + AST_Binary.DEFMETHOD("lift_sequences", function(compressor) { + if (this.left instanceof AST_PropAccess) { + if (!(this.left.expression instanceof AST_Sequence)) return this; + var x = this.left.expression.expressions.slice(); + var e = this.clone(); + e.left = e.left.clone(); + e.left.expression = x.pop(); + x.push(e); + return make_sequence(this, x); + } + if (this.left instanceof AST_Sequence) { + var x = this.left.expressions.slice(); + var e = this.clone(); + e.left = x.pop(); + x.push(e); + return make_sequence(this, x); + } + if (this.right instanceof AST_Sequence) { + if (this.left.has_side_effects(compressor)) return this; + var assign = this.operator == "=" && this.left instanceof AST_SymbolRef; + var x = this.right.expressions; + var last = x.length - 1; + for (var i = 0; i < last; i++) { + if (!assign && x[i].has_side_effects(compressor)) break; + } + if (i == last) { + x = x.slice(); + var e = this.clone(); + e.right = x.pop(); + x.push(e); + return make_sequence(this, x); + } + if (i > 0) { + var e = this.clone(); + e.right = make_sequence(this.right, x.slice(i)); + x = x.slice(0, i); + x.push(e); + return make_sequence(this, x); + } + } + return this; + }); + + var indexFns = makePredicate("indexOf lastIndexOf"); + var commutativeOperators = makePredicate("== === != !== * & | ^"); + function is_object(node, plain) { + if (node instanceof AST_Assign) return !plain && node.operator == "=" && is_object(node.right); + if (node instanceof AST_New) return !plain; + if (node instanceof AST_Sequence) return is_object(node.tail_node(), plain); + if (node instanceof AST_SymbolRef) return !plain && is_object(node.fixed_value()); + return node instanceof AST_Array + || node instanceof AST_Class + || node instanceof AST_Lambda + || node instanceof AST_Object; + } + + function can_drop_op(op, rhs, compressor) { + switch (op) { + case "in": + return is_object(rhs) || compressor && compressor.option("unsafe_comps"); + case "instanceof": + if (rhs instanceof AST_SymbolRef) rhs = rhs.fixed_value(); + return is_lambda(rhs) || compressor && compressor.option("unsafe_comps"); + default: + return true; + } + } + + function needs_enqueuing(compressor, node) { + if (node.is_constant()) return true; + if (node instanceof AST_Assign) return node.operator != "=" || needs_enqueuing(compressor, node.right); + if (node instanceof AST_Binary) { + return !lazy_op[node.operator] + || needs_enqueuing(compressor, node.left) && needs_enqueuing(compressor, node.right); + } + if (node instanceof AST_Call) return is_async(node.expression); + if (node instanceof AST_Conditional) { + return needs_enqueuing(compressor, node.consequent) && needs_enqueuing(compressor, node.alternative); + } + if (node instanceof AST_Sequence) return needs_enqueuing(compressor, node.tail_node()); + if (node instanceof AST_SymbolRef) { + var fixed = node.fixed_value(); + return fixed && needs_enqueuing(compressor, fixed); + } + if (node instanceof AST_Template) return !node.tag || is_raw_tag(compressor, node.tag); + if (node instanceof AST_Unary) return true; + } + + function extract_lhs(node, compressor) { + if (node instanceof AST_Assign) return is_lhs_read_only(node.left, compressor) ? node : node.left; + if (node instanceof AST_Sequence) return extract_lhs(node.tail_node(), compressor); + if (node instanceof AST_UnaryPrefix && UNARY_POSTFIX[node.operator]) { + return is_lhs_read_only(node.expression, compressor) ? node : node.expression; + } + return node; + } + + function repeatable(compressor, node) { + if (node instanceof AST_Dot) return repeatable(compressor, node.expression); + if (node instanceof AST_Sub) { + return repeatable(compressor, node.expression) && repeatable(compressor, node.property); + } + if (node instanceof AST_Symbol) return true; + return !node.has_side_effects(compressor); + } + + function swap_chain(self, compressor) { + var rhs = self.right.tail_node(); + if (rhs !== self.right) { + var exprs = self.right.expressions.slice(0, -1); + exprs.push(rhs.left); + rhs = rhs.clone(); + rhs.left = make_sequence(self.right, exprs); + self.right = rhs; + } + self.left = make_node(AST_Binary, self, { + operator: self.operator, + left: self.left, + right: rhs.left, + start: self.left.start, + end: rhs.left.end, + }); + self.right = rhs.right; + if (compressor) { + self.left = self.left.transform(compressor); + } else if (self.operator == rhs.left.operator) { + swap_chain(self.left); + } + } + + OPT(AST_Binary, function(self, compressor) { + if (commutativeOperators[self.operator] + && self.right.is_constant() + && !self.left.is_constant() + && !(self.left instanceof AST_Binary + && PRECEDENCE[self.left.operator] >= PRECEDENCE[self.operator])) { + // if right is a constant, whatever side effects the + // left side might have could not influence the + // result. hence, force switch. + reverse(); + } + if (compressor.option("sequences")) { + var seq = self.lift_sequences(compressor); + if (seq !== self) return seq.optimize(compressor); + } + if (compressor.option("assignments") && lazy_op[self.operator]) { + var lhs = extract_lhs(self.left, compressor); + var right = self.right; + // a || (a = x) ---> a = a || x + // (a = x) && (a = y) ---> a = (a = x) && y + if (lhs instanceof AST_SymbolRef + && right instanceof AST_Assign + && right.operator == "=" + && lhs.equals(right.left)) { + lhs = lhs.clone(); + var assign = make_node(AST_Assign, self, { + operator: "=", + left: lhs, + right: make_node(AST_Binary, self, { + operator: self.operator, + left: self.left, + right: right.right, + }), + }); + if (lhs.fixed) { + lhs.fixed = function() { + return assign.right; + }; + lhs.fixed.assigns = [ assign ]; + } + var def = lhs.definition(); + def.references.push(lhs); + def.replaced++; + return assign.optimize(compressor); + } + } + if (compressor.option("comparisons")) switch (self.operator) { + case "===": + case "!==": + if (is_undefined(self.left, compressor) && self.right.is_defined(compressor)) { + AST_Node.warn("Expression always defined [{start}]", self); + return make_sequence(self, [ + self.right, + make_node(self.operator == "===" ? AST_False : AST_True, self), + ]).optimize(compressor); + } + var is_strict_comparison = true; + if ((self.left.is_string(compressor) && self.right.is_string(compressor)) || + (self.left.is_number(compressor) && self.right.is_number(compressor)) || + (self.left.is_boolean(compressor) && self.right.is_boolean(compressor)) || + repeatable(compressor, self.left) && self.left.equals(self.right)) { + self.operator = self.operator.slice(0, 2); + } + // XXX: intentionally falling down to the next case + case "==": + case "!=": + // void 0 == x ---> null == x + if (!is_strict_comparison && is_undefined(self.left, compressor)) { + self.left = make_node(AST_Null, self.left); + } + // "undefined" == typeof x ---> undefined === x + else if (compressor.option("typeofs") + && self.left instanceof AST_String + && self.left.value == "undefined" + && self.right instanceof AST_UnaryPrefix + && self.right.operator == "typeof") { + var expr = self.right.expression; + if (expr instanceof AST_SymbolRef ? expr.is_declared(compressor) + : !(expr instanceof AST_PropAccess && compressor.option("ie"))) { + self.right = expr; + self.left = make_node(AST_Undefined, self.left).optimize(compressor); + if (self.operator.length == 2) self.operator += "="; + } + } + // obj !== obj ---> false + else if (self.left instanceof AST_SymbolRef + && self.right instanceof AST_SymbolRef + && self.left.definition() === self.right.definition() + && is_object(self.left)) { + return make_node(self.operator[0] == "=" ? AST_True : AST_False, self).optimize(compressor); + } + break; + case "&&": + case "||": + // void 0 !== x && null !== x ---> null != x + // void 0 === x || null === x ---> null == x + var left = self.left; + if (!(left instanceof AST_Binary)) break; + if (left.operator != (self.operator == "&&" ? "!==" : "===")) break; + if (!(self.right instanceof AST_Binary)) break; + if (left.operator != self.right.operator) break; + if (is_undefined(left.left, compressor) && self.right.left instanceof AST_Null + || left.left instanceof AST_Null && is_undefined(self.right.left, compressor)) { + var expr = left.right; + if (expr instanceof AST_Assign && expr.operator == "=") expr = expr.left; + if (expr.has_side_effects(compressor)) break; + if (!expr.equals(self.right.right)) break; + left.operator = left.operator.slice(0, -1); + left.left = make_node(AST_Null, self); + return left; + } + break; + } + var in_bool = false; + var parent = compressor.parent(); + if (compressor.option("booleans")) { + var lhs = extract_lhs(self.left, compressor); + if (lazy_op[self.operator] && !lhs.has_side_effects(compressor)) { + // a || a ---> a + // (a = x) && a --> a = x + if (lhs.equals(self.right)) { + return maintain_this_binding(parent, compressor.self(), self.left).optimize(compressor); + } + mark_duplicate_condition(compressor, lhs); + } + in_bool = compressor.in_boolean_context(); + } + if (in_bool) switch (self.operator) { + case "+": + var ev = self.left.evaluate(compressor, true); + if (ev && typeof ev == "string" || (ev = self.right.evaluate(compressor, true)) && typeof ev == "string") { + AST_Node.warn("+ in boolean context always true [{start}]", self); + var exprs = []; + if (self.left.evaluate(compressor) instanceof AST_Node) exprs.push(self.left); + if (self.right.evaluate(compressor) instanceof AST_Node) exprs.push(self.right); + if (exprs.length < 2) { + exprs.push(make_node(AST_True, self)); + return make_sequence(self, exprs).optimize(compressor); + } + self.truthy = true; + } + break; + case "==": + if (self.left instanceof AST_String && self.left.value == "" && self.right.is_string(compressor)) { + return make_node(AST_UnaryPrefix, self, { + operator: "!", + expression: self.right, + }).optimize(compressor); + } + break; + case "!=": + if (self.left instanceof AST_String && self.left.value == "" && self.right.is_string(compressor)) { + return self.right.optimize(compressor); + } + break; + } + if (compressor.option("comparisons") && self.is_boolean(compressor)) { + if (parent.TYPE != "Binary") { + var negated = make_node(AST_UnaryPrefix, self, { + operator: "!", + expression: self.negate(compressor), + }); + if (best_of(compressor, self, negated) === negated) return negated; + } + switch (self.operator) { + case ">": reverse("<"); break; + case ">=": reverse("<="); break; + } + } + if (compressor.option("conditionals") && lazy_op[self.operator]) { + if (self.left instanceof AST_Binary && self.operator == self.left.operator) { + var before = make_node(AST_Binary, self, { + operator: self.operator, + left: self.left.right, + right: self.right, + }); + var after = before.transform(compressor); + if (before !== after) { + self.left = self.left.left; + self.right = after; + } + } + // x && (y && z) ---> x && y && z + // w || (x, y || z) ---> w || (x, y) || z + var rhs = self.right.tail_node(); + if (rhs instanceof AST_Binary && self.operator == rhs.operator) swap_chain(self, compressor); + } + if (compressor.option("strings") && self.operator == "+") { + // "foo" + 42 + "" ---> "foo" + 42 + if (self.right instanceof AST_String + && self.right.value == "" + && self.left.is_string(compressor)) { + return self.left.optimize(compressor); + } + // "" + ("foo" + 42) ---> "foo" + 42 + if (self.left instanceof AST_String + && self.left.value == "" + && self.right.is_string(compressor)) { + return self.right.optimize(compressor); + } + // "" + 42 + "foo" ---> 42 + "foo" + if (self.left instanceof AST_Binary + && self.left.operator == "+" + && self.left.left instanceof AST_String + && self.left.left.value == "" + && self.right.is_string(compressor) + && (self.left.right.is_constant() || !self.right.has_side_effects(compressor))) { + self.left = self.left.right; + return self.optimize(compressor); + } + // "x" + (y + "z") ---> "x" + y + "z" + // w + (x, "y" + z) ---> w + (x, "y") + z + var rhs = self.right.tail_node(); + if (rhs instanceof AST_Binary + && self.operator == rhs.operator + && (self.left.is_string(compressor) && rhs.is_string(compressor) + || rhs.left.is_string(compressor) + && (self.left.is_constant() || !rhs.right.has_side_effects(compressor)))) { + swap_chain(self, compressor); + } + } + if (compressor.option("evaluate")) { + var associative = true; + switch (self.operator) { + case "&&": + var ll = fuzzy_eval(compressor, self.left); + if (!ll) { + AST_Node.warn("Condition left of && always false [{start}]", self); + return maintain_this_binding(parent, compressor.self(), self.left).optimize(compressor); + } else if (!(ll instanceof AST_Node)) { + AST_Node.warn("Condition left of && always true [{start}]", self); + return make_sequence(self, [ self.left, self.right ]).optimize(compressor); + } + if (!self.right.evaluate(compressor, true)) { + if (in_bool && !(self.right.evaluate(compressor) instanceof AST_Node)) { + AST_Node.warn("Boolean && always false [{start}]", self); + return make_sequence(self, [ self.left, make_node(AST_False, self) ]).optimize(compressor); + } else self.falsy = true; + } else if ((in_bool || parent.operator == "&&" && parent.left === compressor.self()) + && !(self.right.evaluate(compressor) instanceof AST_Node)) { + AST_Node.warn("Dropping side-effect-free && [{start}]", self); + return self.left.optimize(compressor); + } + // (x || false) && y ---> x ? y : false + if (self.left.operator == "||") { + var lr = fuzzy_eval(compressor, self.left.right); + if (!lr) return make_node(AST_Conditional, self, { + condition: self.left.left, + consequent: self.right, + alternative: self.left.right, + }).optimize(compressor); + } + break; + case "??": + var nullish = true; + case "||": + var ll = fuzzy_eval(compressor, self.left, nullish); + if (nullish ? ll == null : !ll) { + AST_Node.warn("Condition left of {operator} always {value} [{start}]", { + operator: self.operator, + value: nullish ? "nullish" : "false", + start: self.start, + }); + return make_sequence(self, [ self.left, self.right ]).optimize(compressor); + } else if (!(ll instanceof AST_Node)) { + AST_Node.warn("Condition left of {operator} always {value} [{start}]", { + operator: self.operator, + value: nullish ? "defined" : "true", + start: self.start, + }); + return maintain_this_binding(parent, compressor.self(), self.left).optimize(compressor); + } + var rr; + if (!nullish && (rr = self.right.evaluate(compressor, true)) && !(rr instanceof AST_Node)) { + if (in_bool && !(self.right.evaluate(compressor) instanceof AST_Node)) { + AST_Node.warn("Boolean || always true [{start}]", self); + return make_sequence(self, [ self.left, make_node(AST_True, self) ]).optimize(compressor); + } else self.truthy = true; + } else if ((in_bool || parent.operator == "||" && parent.left === compressor.self()) + && !self.right.evaluate(compressor)) { + AST_Node.warn("Dropping side-effect-free {operator} [{start}]", self); + return self.left.optimize(compressor); + } + // x && true || y ---> x ? true : y + if (!nullish && self.left.operator == "&&") { + var lr = fuzzy_eval(compressor, self.left.right); + if (lr && !(lr instanceof AST_Node)) return make_node(AST_Conditional, self, { + condition: self.left.left, + consequent: self.left.right, + alternative: self.right, + }).optimize(compressor); + } + break; + case "+": + // "foo" + ("bar" + x) ---> "foobar" + x + if (self.left instanceof AST_Constant + && self.right instanceof AST_Binary + && self.right.operator == "+" + && self.right.left instanceof AST_Constant + && self.right.is_string(compressor)) { + self = make_node(AST_Binary, self, { + operator: "+", + left: make_node(AST_String, self.left, { + value: "" + self.left.value + self.right.left.value, + start: self.left.start, + end: self.right.left.end, + }), + right: self.right.right, + }); + } + // (x + "foo") + "bar" ---> x + "foobar" + if (self.right instanceof AST_Constant + && self.left instanceof AST_Binary + && self.left.operator == "+" + && self.left.right instanceof AST_Constant + && self.left.is_string(compressor)) { + self = make_node(AST_Binary, self, { + operator: "+", + left: self.left.left, + right: make_node(AST_String, self.right, { + value: "" + self.left.right.value + self.right.value, + start: self.left.right.start, + end: self.right.end, + }), + }); + } + // a + -b ---> a - b + if (self.right instanceof AST_UnaryPrefix + && self.right.operator == "-" + && self.left.is_number(compressor)) { + self = make_node(AST_Binary, self, { + operator: "-", + left: self.left, + right: self.right.expression, + }); + break; + } + // -a + b ---> b - a + if (self.left instanceof AST_UnaryPrefix + && self.left.operator == "-" + && reversible() + && self.right.is_number(compressor)) { + self = make_node(AST_Binary, self, { + operator: "-", + left: self.right, + right: self.left.expression, + }); + break; + } + // (a + b) + 3 ---> 3 + (a + b) + if (compressor.option("unsafe_math") + && self.left instanceof AST_Binary + && PRECEDENCE[self.left.operator] == PRECEDENCE[self.operator] + && self.right.is_constant() + && (self.right.is_boolean(compressor) || self.right.is_number(compressor)) + && self.left.is_number(compressor) + && !self.left.right.is_constant() + && (self.left.left.is_boolean(compressor) || self.left.left.is_number(compressor))) { + self = make_node(AST_Binary, self, { + operator: self.left.operator, + left: make_node(AST_Binary, self, { + operator: self.operator, + left: self.right, + right: self.left.left, + }), + right: self.left.right, + }); + break; + } + case "-": + // a - -b ---> a + b + if (self.right instanceof AST_UnaryPrefix + && self.right.operator == "-" + && self.left.is_number(compressor) + && self.right.expression.is_number(compressor)) { + self = make_node(AST_Binary, self, { + operator: "+", + left: self.left, + right: self.right.expression, + }); + break; + } + case "*": + case "/": + associative = compressor.option("unsafe_math"); + // +a - b ---> a - b + // a - +b ---> a - b + if (self.operator != "+") [ "left", "right" ].forEach(function(operand) { + var node = self[operand]; + if (node instanceof AST_UnaryPrefix && node.operator == "+") { + var exp = node.expression; + if (exp.is_boolean(compressor) || exp.is_number(compressor) || exp.is_string(compressor)) { + self[operand] = exp; + } + } + }); + case "&": + case "|": + case "^": + // a + +b ---> +b + a + if (self.operator != "-" + && self.operator != "/" + && (self.left.is_boolean(compressor) || self.left.is_number(compressor)) + && (self.right.is_boolean(compressor) || self.right.is_number(compressor)) + && reversible() + && !(self.left instanceof AST_Binary + && self.left.operator != self.operator + && PRECEDENCE[self.left.operator] >= PRECEDENCE[self.operator])) { + self = best_of(compressor, self, make_node(AST_Binary, self, { + operator: self.operator, + left: self.right, + right: self.left, + }), self.right instanceof AST_Constant && !(self.left instanceof AST_Constant)); + } + if (!associative || !self.is_number(compressor)) break; + // a + (b + c) ---> (a + b) + c + if (self.right instanceof AST_Binary + && self.right.operator != "%" + && PRECEDENCE[self.right.operator] == PRECEDENCE[self.operator] + && self.right.is_number(compressor) + && (self.operator != "+" + || self.right.left.is_boolean(compressor) + || self.right.left.is_number(compressor)) + && (self.operator != "-" || !self.left.is_negative_zero()) + && (self.right.left.is_constant_expression() + || !self.right.right.has_side_effects(compressor)) + && !is_modify_array(self.right.right)) { + self = make_node(AST_Binary, self, { + operator: align(self.operator, self.right.operator), + left: make_node(AST_Binary, self.left, { + operator: self.operator, + left: self.left, + right: self.right.left, + start: self.left.start, + end: self.right.left.end, + }), + right: self.right.right, + }); + if (self.operator == "+" + && !self.right.is_boolean(compressor) + && !self.right.is_number(compressor)) { + self.right = make_node(AST_UnaryPrefix, self.right, { + operator: "+", + expression: self.right, + }); + } + } + // (2 * n) * 3 ---> 6 * n + // (n + 2) + 3 ---> n + 5 + if (self.right instanceof AST_Constant + && self.left instanceof AST_Binary + && self.left.operator != "%" + && PRECEDENCE[self.left.operator] == PRECEDENCE[self.operator] + && self.left.is_number(compressor)) { + if (self.left.left instanceof AST_Constant) { + var lhs = make_binary(self.operator, self.left.left, self.right, { + start: self.left.left.start, + end: self.right.end, + }); + self = make_binary(self.left.operator, try_evaluate(compressor, lhs), self.left.right, self); + } else if (self.left.right instanceof AST_Constant) { + var op = align(self.left.operator, self.operator); + var rhs = try_evaluate(compressor, make_binary(op, self.left.right, self.right, self.left)); + if (rhs.is_constant() + && !(self.left.operator == "-" + && self.right.value != 0 + && +rhs.value == 0 + && self.left.left.is_negative_zero())) { + self = make_binary(self.left.operator, self.left.left, rhs, self); + } + } + } + break; + case "instanceof": + if (is_lambda(self.right)) return make_sequence(self, [ + self, + make_node(AST_False, self), + ]).optimize(compressor); + break; + } + if (!(parent instanceof AST_UnaryPrefix && parent.operator == "delete")) { + if (self.left instanceof AST_Number && !self.right.is_constant()) switch (self.operator) { + // 0 + n ---> n + case "+": + if (self.left.value == 0) { + if (self.right.is_boolean(compressor)) return make_node(AST_UnaryPrefix, self, { + operator: "+", + expression: self.right, + }).optimize(compressor); + if (self.right.is_number(compressor) && !self.right.is_negative_zero()) return self.right; + } + break; + // 1 * n ---> n + case "*": + if (self.left.value == 1) return make_node(AST_UnaryPrefix, self, { + operator: "+", + expression: self.right, + }).optimize(compressor); + break; + } + if (self.right instanceof AST_Number && !self.left.is_constant()) switch (self.operator) { + // n + 0 ---> n + case "+": + if (self.right.value == 0) { + if (self.left.is_boolean(compressor)) return make_node(AST_UnaryPrefix, self, { + operator: "+", + expression: self.left, + }).optimize(compressor); + if (self.left.is_number(compressor) && !self.left.is_negative_zero()) return self.left; + } + break; + // n - 0 ---> n + case "-": + if (self.right.value == 0) return make_node(AST_UnaryPrefix, self, { + operator: "+", + expression: self.left, + }).optimize(compressor); + break; + // n / 1 ---> n + case "/": + if (self.right.value == 1) return make_node(AST_UnaryPrefix, self, { + operator: "+", + expression: self.left, + }).optimize(compressor); + break; + } + } + } + if (compressor.option("typeofs")) switch (self.operator) { + case "&&": + mark_locally_defined(self.left, self.right, null); + break; + case "||": + mark_locally_defined(self.left, null, self.right); + break; + } + if (compressor.option("unsafe")) { + var indexRight = is_indexFn(self.right); + if (in_bool + && indexRight + && (self.operator == "==" || self.operator == "!=") + && self.left instanceof AST_Number + && self.left.value == 0) { + return (self.operator == "==" ? make_node(AST_UnaryPrefix, self, { + operator: "!", + expression: self.right, + }) : self.right).optimize(compressor); + } + var indexLeft = is_indexFn(self.left); + if (compressor.option("comparisons") && is_indexOf_match_pattern()) { + var node = make_node(AST_UnaryPrefix, self, { + operator: "!", + expression: make_node(AST_UnaryPrefix, self, { + operator: "~", + expression: indexLeft ? self.left : self.right, + }), + }); + switch (self.operator) { + case "<": + if (indexLeft) break; + case "<=": + case "!=": + node = make_node(AST_UnaryPrefix, self, { + operator: "!", + expression: node, + }); + break; + } + return node.optimize(compressor); + } + } + return try_evaluate(compressor, self); + + function is_modify_array(node) { + var found = false; + node.walk(new TreeWalker(function(node) { + if (found) return true; + if (node instanceof AST_Assign) { + if (node.left instanceof AST_PropAccess) return found = true; + } else if (node instanceof AST_Unary) { + if (unary_side_effects[node.operator] && node.expression instanceof AST_PropAccess) { + return found = true; + } + } + })); + return found; + } + + function align(ref, op) { + switch (ref) { + case "-": + return op == "+" ? "-" : "+"; + case "/": + return op == "*" ? "/" : "*"; + default: + return op; + } + } + + function make_binary(op, left, right, orig) { + if (op == "+") { + if (!left.is_boolean(compressor) && !left.is_number(compressor)) { + left = make_node(AST_UnaryPrefix, left, { + operator: "+", + expression: left, + }); + } + if (!right.is_boolean(compressor) && !right.is_number(compressor)) { + right = make_node(AST_UnaryPrefix, right, { + operator: "+", + expression: right, + }); + } + } + return make_node(AST_Binary, orig, { + operator: op, + left: left, + right: right, + }); + } + + function is_indexFn(node) { + return node.TYPE == "Call" + && node.expression instanceof AST_Dot + && indexFns[node.expression.property]; + } + + function is_indexOf_match_pattern() { + switch (self.operator) { + case "<=": + // 0 <= array.indexOf(string) ---> !!~array.indexOf(string) + return indexRight && self.left instanceof AST_Number && self.left.value == 0; + case "<": + // array.indexOf(string) < 0 ---> !~array.indexOf(string) + if (indexLeft && self.right instanceof AST_Number && self.right.value == 0) return true; + // -1 < array.indexOf(string) ---> !!~array.indexOf(string) + case "==": + case "!=": + // -1 == array.indexOf(string) ---> !~array.indexOf(string) + // -1 != array.indexOf(string) ---> !!~array.indexOf(string) + if (!indexRight) return false; + return self.left instanceof AST_Number && self.left.value == -1 + || self.left instanceof AST_UnaryPrefix && self.left.operator == "-" + && self.left.expression instanceof AST_Number && self.left.expression.value == 1; + } + } + + function reversible() { + return self.left.is_constant() + || self.right.is_constant() + || !self.left.has_side_effects(compressor) + && !self.right.has_side_effects(compressor); + } + + function reverse(op) { + if (reversible()) { + if (op) self.operator = op; + var tmp = self.left; + self.left = self.right; + self.right = tmp; + } + } + }); + + OPT(AST_SymbolExport, function(self) { + return self; + }); + + function recursive_ref(compressor, def, fn) { + var level = 0, node = compressor.self(); + do { + if (node === fn) return node; + if (is_lambda(node) && node.name && node.name.definition() === def) return node; + } while (node = compressor.parent(level++)); + } + + function same_scope(def) { + var scope = def.scope.resolve(); + return all(def.references, function(ref) { + return scope === ref.scope.resolve(); + }); + } + + OPT(AST_SymbolRef, function(self, compressor) { + if (!compressor.option("ie") + && is_undeclared_ref(self) + // testing against `self.scope.uses_with` is an optimization + && !(self.scope.resolve().uses_with && compressor.find_parent(AST_With))) { + switch (self.name) { + case "undefined": + return make_node(AST_Undefined, self).optimize(compressor); + case "NaN": + return make_node(AST_NaN, self).optimize(compressor); + case "Infinity": + return make_node(AST_Infinity, self).optimize(compressor); + } + } + var parent = compressor.parent(); + if (compressor.option("reduce_vars") && is_lhs(compressor.self(), parent) !== compressor.self()) { + var def = self.definition(); + var fixed = self.fixed_value(); + var single_use = def.single_use && !(parent instanceof AST_Call && parent.is_expr_pure(compressor)); + if (single_use) { + if (is_lambda(fixed)) { + if ((def.scope !== self.scope.resolve(true) || def.in_loop) + && (!compressor.option("reduce_funcs") || def.escaped.depth == 1 || fixed.inlined)) { + single_use = false; + } else if (def.redefined()) { + single_use = false; + } else if (recursive_ref(compressor, def, fixed)) { + single_use = false; + } else if (fixed.name && fixed.name.definition() !== def) { + single_use = false; + } else if (fixed.parent_scope !== self.scope || is_funarg(def)) { + if (!safe_from_strict_mode(fixed, compressor)) { + single_use = false; + } else if ((single_use = fixed.is_constant_expression(self.scope)) == "f") { + var scope = self.scope; + do { + if (scope instanceof AST_LambdaDefinition || scope instanceof AST_LambdaExpression) { + scope.inlined = true; + } + } while (scope = scope.parent_scope); + } + } else if (fixed.name && (fixed.name.name == "await" && is_async(fixed) + || fixed.name.name == "yield" && is_generator(fixed))) { + single_use = false; + } else if (fixed.has_side_effects(compressor)) { + single_use = false; + } else if (compressor.option("ie") && fixed instanceof AST_Class) { + single_use = false; + } + if (single_use) fixed.parent_scope = self.scope; + } else if (!fixed + || def.recursive_refs > 0 + || !fixed.is_constant_expression() + || fixed.drop_side_effect_free(compressor)) { + single_use = false; + } + } + if (single_use) { + def.single_use = false; + fixed._squeezed = true; + fixed.single_use = true; + if (fixed instanceof AST_DefClass) fixed = to_class_expr(fixed); + if (fixed instanceof AST_LambdaDefinition) fixed = to_func_expr(fixed); + if (is_lambda(fixed)) { + var scopes = []; + var scope = self.scope; + do { + scopes.push(scope); + if (scope === def.scope) break; + } while (scope = scope.parent_scope); + fixed.enclosed.forEach(function(def) { + if (fixed.variables.has(def.name)) return; + for (var i = 0; i < scopes.length; i++) { + var scope = scopes[i]; + if (!push_uniq(scope.enclosed, def)) return; + scope.var_names().set(def.name, true); + } + }); + } + var value; + if (def.recursive_refs > 0) { + value = fixed.clone(true); + var defun_def = value.name.definition(); + var lambda_def = value.variables.get(value.name.name); + var name = lambda_def && lambda_def.orig[0]; + var def_fn_name, symbol_type; + if (value instanceof AST_Class) { + def_fn_name = "def_function"; + symbol_type = AST_SymbolClass; + } else { + def_fn_name = "def_variable"; + symbol_type = AST_SymbolLambda; + } + if (!(name instanceof symbol_type)) { + name = make_node(symbol_type, value.name); + name.scope = value; + value.name = name; + lambda_def = value[def_fn_name](name); + lambda_def.recursive_refs = def.recursive_refs; + } + value.walk(new TreeWalker(function(node) { + if (node instanceof AST_SymbolDeclaration) { + if (node !== name) { + var def = node.definition(); + def.orig.push(node); + def.eliminated++; + } + return; + } + if (!(node instanceof AST_SymbolRef)) return; + var def = node.definition(); + if (def === defun_def) { + node.thedef = def = lambda_def; + } else { + def.single_use = false; + var fn = node.fixed_value(); + if (is_lambda(fn) + && fn.name + && fn.name.definition() === def + && def.scope === fn.name.scope + && fixed.variables.get(fn.name.name) === def) { + fn.name = fn.name.clone(); + node.thedef = def = value.variables.get(fn.name.name) || value[def_fn_name](fn.name); + } + } + def.references.push(node); + })); + } else { + if (fixed instanceof AST_Scope) { + compressor.push(fixed); + value = fixed.optimize(compressor); + compressor.pop(); + } else { + value = fixed.optimize(compressor); + } + value = value.transform(new TreeTransformer(function(node, descend) { + if (node instanceof AST_Scope) return node; + node = node.clone(); + descend(node, this); + return node; + })); + } + def.replaced++; + return value; + } + var state; + if (fixed && (state = self.fixed || def.fixed).should_replace !== false) { + var ev, init; + if (fixed instanceof AST_This) { + if (!is_funarg(def) && same_scope(def) && !cross_class(def)) init = fixed; + } else if ((ev = fixed.evaluate(compressor, true)) !== fixed + && typeof ev != "function" + && (ev === null + || typeof ev != "object" + || compressor.option("unsafe_regexp") + && ev instanceof RegExp && !def.cross_loop && same_scope(def))) { + init = make_node_from_constant(ev, fixed); + } + if (init) { + if (state.should_replace === undefined) { + var value_length = init.optimize(compressor).print_to_string().length; + if (!has_symbol_ref(fixed)) { + value_length = Math.min(value_length, fixed.print_to_string().length); + } + var name_length = def.name.length; + if (compressor.option("unused") && !compressor.exposed(def)) { + var refs = def.references.length - def.replaced - def.assignments; + refs = Math.min(refs, def.references.filter(function(ref) { + return ref.fixed === state; + }).length); + name_length += (name_length + 2 + value_length) / Math.max(1, refs); + } + state.should_replace = value_length - Math.floor(name_length) < compressor.eval_threshold; + } + if (state.should_replace) { + var value; + if (has_symbol_ref(fixed)) { + value = init.optimize(compressor); + if (value === init) value = value.clone(true); + } else { + value = best_of_expression(init.optimize(compressor), fixed); + if (value === init || value === fixed) value = value.clone(true); + } + def.replaced++; + return value; + } + } + } + } + return self; + + function cross_class(def) { + var scope = self.scope; + while (scope !== def.scope) { + if (scope instanceof AST_Class) return true; + scope = scope.parent_scope; + } + } + + function has_symbol_ref(value) { + var found; + value.walk(new TreeWalker(function(node) { + if (node instanceof AST_SymbolRef) found = true; + if (found) return true; + })); + return found; + } + }); + + function is_raw_tag(compressor, tag) { + return compressor.option("unsafe") + && tag instanceof AST_Dot + && tag.property == "raw" + && is_undeclared_ref(tag.expression) + && tag.expression.name == "String"; + } + + function decode_template(str) { + var malformed = false; + str = str.replace(/\\(u\{[^{}]*\}?|u[\s\S]{0,4}|x[\s\S]{0,2}|[0-9]+|[\s\S])/g, function(match, seq) { + var ch = decode_escape_sequence(seq); + if (typeof ch == "string") return ch; + malformed = true; + }); + if (!malformed) return str; + } + + OPT(AST_Template, function(self, compressor) { + if (!compressor.option("templates")) return self; + var tag = self.tag; + if (!tag || is_raw_tag(compressor, tag)) { + var exprs = []; + var strs = []; + for (var i = 0, status; i < self.strings.length; i++) { + var str = self.strings[i]; + if (!tag) { + var trimmed = decode_template(str); + if (trimmed) str = escape_literal(trimmed); + } + if (i > 0) { + var node = self.expressions[i - 1]; + var value = should_join(node); + if (value) { + var prev = strs[strs.length - 1]; + var joined = prev + value + str; + var decoded; + if (tag || typeof (decoded = decode_template(joined)) == status) { + strs[strs.length - 1] = decoded ? escape_literal(decoded) : joined; + continue; + } + } + exprs.push(node); + } + strs.push(str); + if (!tag) status = typeof trimmed; + } + if (!tag && strs.length > 1) { + if (strs[strs.length - 1] == "") return make_node(AST_Binary, self, { + operator: "+", + left: make_node(AST_Template, self, { + expressions: exprs.slice(0, -1), + strings: strs.slice(0, -1), + }).transform(compressor), + right: exprs[exprs.length - 1], + }).optimize(compressor); + if (strs[0] == "") { + var left = make_node(AST_Binary, self, { + operator: "+", + left: make_node(AST_String, self, { value: "" }), + right: exprs[0], + }); + for (var i = 1; strs[i] == "" && i < exprs.length; i++) { + left = make_node(AST_Binary, self, { + operator: "+", + left: left, + right: exprs[i], + }); + } + return best_of(compressor, self, make_node(AST_Binary, self, { + operator: "+", + left: left.transform(compressor), + right: make_node(AST_Template, self, { + expressions: exprs.slice(i), + strings: strs.slice(i), + }).transform(compressor), + }).optimize(compressor)); + } + } + self.expressions = exprs; + self.strings = strs; + } + return try_evaluate(compressor, self); + + function escape_literal(str) { + return str.replace(/\r|\\|`|\${/g, function(s) { + return "\\" + (s == "\r" ? "r" : s); + }); + } + + function should_join(node) { + var ev = node.evaluate(compressor); + if (ev === node) return; + if (tag && /\r|\\|`/.test(ev)) return; + ev = escape_literal("" + ev); + if (ev.length > node.print_to_string().length + "${}".length) return; + return ev; + } + }); + + function is_atomic(lhs, self) { + return lhs instanceof AST_SymbolRef || lhs.TYPE === self.TYPE; + } + + OPT(AST_Undefined, function(self, compressor) { + if (compressor.option("unsafe_undefined")) { + var undef = find_scope(compressor).find_variable("undefined"); + if (undef) { + var ref = make_node(AST_SymbolRef, self, { + name: "undefined", + scope: undef.scope, + thedef: undef, + }); + ref.is_undefined = true; + return ref; + } + } + var lhs = is_lhs(compressor.self(), compressor.parent()); + if (lhs && is_atomic(lhs, self)) return self; + return make_node(AST_UnaryPrefix, self, { + operator: "void", + expression: make_node(AST_Number, self, { value: 0 }), + }); + }); + + OPT(AST_Infinity, function(self, compressor) { + var lhs = is_lhs(compressor.self(), compressor.parent()); + if (lhs && is_atomic(lhs, self)) return self; + if (compressor.option("keep_infinity") && !lhs && !find_scope(compressor).find_variable("Infinity")) { + return self; + } + return make_node(AST_Binary, self, { + operator: "/", + left: make_node(AST_Number, self, { value: 1 }), + right: make_node(AST_Number, self, { value: 0 }), + }); + }); + + OPT(AST_NaN, function(self, compressor) { + var lhs = is_lhs(compressor.self(), compressor.parent()); + if (lhs && is_atomic(lhs, self)) return self; + if (!lhs && !find_scope(compressor).find_variable("NaN")) return self; + return make_node(AST_Binary, self, { + operator: "/", + left: make_node(AST_Number, self, { value: 0 }), + right: make_node(AST_Number, self, { value: 0 }), + }); + }); + + function is_reachable(self, defs) { + var reachable = false; + var find_ref = new TreeWalker(function(node) { + if (reachable) return true; + if (node instanceof AST_SymbolRef && member(node.definition(), defs)) return reachable = true; + }); + var scan_scope = new TreeWalker(function(node) { + if (reachable) return true; + if (node instanceof AST_Lambda && node !== self) { + if (!(node.name || is_async(node) || is_generator(node))) { + var parent = scan_scope.parent(); + if (parent instanceof AST_Call && parent.expression === node) return; + } + node.walk(find_ref); + return true; + } + }); + self.walk(scan_scope); + return reachable; + } + + var ASSIGN_OPS = makePredicate("+ - * / % >> << >>> | ^ &"); + var ASSIGN_OPS_COMMUTATIVE = makePredicate("* | ^ &"); + OPT(AST_Assign, function(self, compressor) { + if (compressor.option("dead_code")) { + if (self.left instanceof AST_PropAccess) { + if (self.operator == "=") { + if (self.redundant) { + var exprs = [ self.left.expression ]; + if (self.left instanceof AST_Sub) exprs.push(self.left.property); + exprs.push(self.right); + return make_sequence(self, exprs).optimize(compressor); + } + if (self.left.equals(self.right) && !self.left.has_side_effects(compressor)) { + return self.right; + } + var exp = self.left.expression; + if (exp instanceof AST_Lambda + || !compressor.has_directive("use strict") + && exp instanceof AST_Constant + && !exp.may_throw_on_access(compressor)) { + return self.left instanceof AST_Dot ? self.right : make_sequence(self, [ + self.left.property, + self.right + ]).optimize(compressor); + } + } + } else if (self.left instanceof AST_SymbolRef && can_drop_symbol(self.left, compressor)) { + var parent; + if (self.operator == "=" && self.left.equals(self.right) + && !((parent = compressor.parent()) instanceof AST_UnaryPrefix && parent.operator == "delete")) { + return self.right; + } + if (self.left.is_immutable()) return strip_assignment(); + var def = self.left.definition(); + var scope = def.scope.resolve(); + var local = scope === compressor.find_parent(AST_Lambda); + var level = 0, node; + parent = compressor.self(); + if (!(scope.uses_arguments && is_funarg(def)) || compressor.has_directive("use strict")) do { + node = parent; + parent = compressor.parent(level++); + if (parent instanceof AST_Assign) { + if (parent.left instanceof AST_SymbolRef && parent.left.definition() === def) { + if (in_try(level, parent, !local)) break; + return strip_assignment(def); + } + if (parent.left.match_symbol(function(node) { + if (node instanceof AST_PropAccess) return true; + })) break; + continue; + } + if (parent instanceof AST_Exit) { + if (!local) break; + if (in_try(level, parent)) break; + if (is_reachable(scope, [ def ])) break; + return strip_assignment(def); + } + if (parent instanceof AST_SimpleStatement) { + if (!local) break; + if (is_reachable(scope, [ def ])) break; + var stat; + do { + stat = parent; + parent = compressor.parent(level++); + if (parent === scope && is_last_statement(parent.body, stat)) return strip_assignment(def); + } while (is_tail_block(stat, parent)); + break; + } + if (parent instanceof AST_VarDef) { + if (!(parent.name instanceof AST_SymbolDeclaration)) continue; + if (parent.name.definition() !== def) continue; + if (in_try(level, parent)) break; + return strip_assignment(def); + } + } while (is_tail(node, parent)); + } + } + if (compressor.option("sequences")) { + var seq = self.lift_sequences(compressor); + if (seq !== self) return seq.optimize(compressor); + } + if (compressor.option("assignments")) { + if (self.operator == "=" && self.left instanceof AST_SymbolRef && self.right instanceof AST_Binary) { + // x = expr1 OP expr2 + if (self.right.left instanceof AST_SymbolRef + && self.right.left.name == self.left.name + && ASSIGN_OPS[self.right.operator]) { + // x = x - 2 ---> x -= 2 + return make_compound(self.right.right); + } + if (self.right.right instanceof AST_SymbolRef + && self.right.right.name == self.left.name + && ASSIGN_OPS_COMMUTATIVE[self.right.operator] + && !self.right.left.has_side_effects(compressor)) { + // x = 2 & x ---> x &= 2 + return make_compound(self.right.left); + } + } + if ((self.operator == "-=" || self.operator == "+=" + && (self.left.is_boolean(compressor) || self.left.is_number(compressor))) + && self.right instanceof AST_Number + && self.right.value == 1) { + var op = self.operator.slice(0, -1); + return make_node(AST_UnaryPrefix, self, { + operator: op + op, + expression: self.left, + }); + } + } + return try_evaluate(compressor, self); + + function is_tail(node, parent) { + if (parent instanceof AST_Binary) switch (node) { + case parent.left: + return parent.right.is_constant_expression(scope); + case parent.right: + return true; + default: + return false; + } + if (parent instanceof AST_Conditional) switch (node) { + case parent.condition: + return parent.consequent.is_constant_expression(scope) + && parent.alternative.is_constant_expression(scope); + case parent.consequent: + case parent.alternative: + return true; + default: + return false; + } + if (parent instanceof AST_Sequence) { + var exprs = parent.expressions; + var stop = exprs.indexOf(node); + if (stop < 0) return false; + for (var i = exprs.length; --i > stop;) { + if (!exprs[i].is_constant_expression(scope)) return false; + } + return true; + } + return parent instanceof AST_UnaryPrefix; + } + + function is_tail_block(stat, parent) { + if (parent instanceof AST_BlockStatement) return is_last_statement(parent.body, stat); + if (parent instanceof AST_Catch) return is_last_statement(parent.body, stat); + if (parent instanceof AST_Finally) return is_last_statement(parent.body, stat); + if (parent instanceof AST_If) return parent.body === stat || parent.alternative === stat; + if (parent instanceof AST_Try) return parent.bfinally ? parent.bfinally === stat : parent.bcatch === stat; + } + + function in_try(level, node, sync) { + var right = self.right; + self.right = make_node(AST_Null, right); + var may_throw = node.may_throw(compressor); + self.right = right; + return find_try(compressor, level, node, scope, may_throw, sync); + } + + function make_compound(rhs) { + var fixed = self.left.fixed; + if (fixed) fixed.to_binary = replace_ref(function(node) { + return node.left; + }, fixed); + return make_node(AST_Assign, self, { + operator: self.right.operator + "=", + left: self.left, + right: rhs, + }); + } + + function strip_assignment(def) { + if (def) def.fixed = false; + return (self.operator != "=" ? make_node(AST_Binary, self, { + operator: self.operator.slice(0, -1), + left: self.left, + right: self.right, + }) : maintain_this_binding(compressor.parent(), self, self.right)).optimize(compressor); + } + }); + + OPT(AST_Conditional, function(self, compressor) { + if (compressor.option("sequences") && self.condition instanceof AST_Sequence) { + var expressions = self.condition.expressions.slice(); + var node = self.clone(); + node.condition = expressions.pop(); + expressions.push(node); + return make_sequence(self, expressions).optimize(compressor); + } + if (!compressor.option("conditionals")) return self; + var condition = self.condition; + if (compressor.option("booleans") && !condition.has_side_effects(compressor)) { + mark_duplicate_condition(compressor, condition); + } + condition = fuzzy_eval(compressor, condition); + if (!condition) { + AST_Node.warn("Condition always false [{start}]", self); + return make_sequence(self, [ self.condition, self.alternative ]).optimize(compressor); + } else if (!(condition instanceof AST_Node)) { + AST_Node.warn("Condition always true [{start}]", self); + return make_sequence(self, [ self.condition, self.consequent ]).optimize(compressor); + } + var first = first_in_statement(compressor); + var negated = condition.negate(compressor, first); + if ((first ? best_of_statement : best_of_expression)(condition, negated) === negated) { + self = make_node(AST_Conditional, self, { + condition: negated, + consequent: self.alternative, + alternative: self.consequent, + }); + negated = condition; + condition = self.condition; + } + var consequent = self.consequent; + var alternative = self.alternative; + var cond_lhs = extract_lhs(condition, compressor); + if (repeatable(compressor, cond_lhs)) { + // x ? x : y ---> x || y + if (cond_lhs.equals(consequent)) return make_node(AST_Binary, self, { + operator: "||", + left: condition, + right: alternative, + }).optimize(compressor); + // x ? y : x ---> x && y + if (cond_lhs.equals(alternative)) return make_node(AST_Binary, self, { + operator: "&&", + left: condition, + right: consequent, + }).optimize(compressor); + } + // if (foo) exp = something; else exp = something_else; + // | + // v + // exp = foo ? something : something_else; + var seq_tail = consequent.tail_node(); + if (seq_tail instanceof AST_Assign) { + var is_eq = seq_tail.operator == "="; + var alt_tail = is_eq ? alternative.tail_node() : alternative; + if ((is_eq || consequent === seq_tail) + && alt_tail instanceof AST_Assign + && seq_tail.operator == alt_tail.operator + && seq_tail.left.equals(alt_tail.left) + && (is_eq && seq_tail.left instanceof AST_SymbolRef + || !condition.has_side_effects(compressor) + && can_shift_lhs_of_tail(consequent) + && can_shift_lhs_of_tail(alternative))) { + return make_node(AST_Assign, self, { + operator: seq_tail.operator, + left: seq_tail.left, + right: make_node(AST_Conditional, self, { + condition: condition, + consequent: pop_lhs(consequent), + alternative: pop_lhs(alternative), + }), + }); + } + } + var alt_tail = alternative.tail_node(); + // x ? y : y ---> x, y + // x ? (a, c) : (b, c) ---> x ? a : b, c + if (seq_tail.equals(alt_tail)) return make_sequence(self, consequent.equals(alternative) ? [ + condition, + consequent, + ] : [ + make_node(AST_Conditional, self, { + condition: condition, + consequent: pop_seq(consequent), + alternative: pop_seq(alternative), + }), + alt_tail, + ]).optimize(compressor); + // x ? y.p : z.p ---> (x ? y : z).p + // x ? y(a) : z(a) ---> (x ? y : z)(a) + // x ? y.f(a) : z.f(a) ---> (x ? y : z).f(a) + var combined = combine_tail(consequent, alternative, true); + if (combined) return combined; + // x ? y(a) : y(b) ---> y(x ? a : b) + var arg_index; + if (consequent instanceof AST_Call + && alternative.TYPE == consequent.TYPE + && (arg_index = arg_diff(consequent, alternative)) >= 0 + && consequent.expression.equals(alternative.expression) + && !condition.has_side_effects(compressor) + && !consequent.expression.has_side_effects(compressor)) { + var node = consequent.clone(); + var arg = consequent.args[arg_index]; + node.args[arg_index] = arg instanceof AST_Spread ? make_node(AST_Spread, self, { + expression: make_node(AST_Conditional, self, { + condition: condition, + consequent: arg.expression, + alternative: alternative.args[arg_index].expression, + }), + }) : make_node(AST_Conditional, self, { + condition: condition, + consequent: arg, + alternative: alternative.args[arg_index], + }); + return node; + } + // x ? (y ? a : b) : b ---> x && y ? a : b + if (seq_tail instanceof AST_Conditional + && seq_tail.alternative.equals(alternative)) { + return make_node(AST_Conditional, self, { + condition: make_node(AST_Binary, self, { + left: condition, + operator: "&&", + right: fuse(consequent, seq_tail, "condition"), + }), + consequent: seq_tail.consequent, + alternative: merge_expression(seq_tail.alternative, alternative), + }); + } + // x ? (y ? a : b) : a ---> !x || y ? a : b + if (seq_tail instanceof AST_Conditional + && seq_tail.consequent.equals(alternative)) { + return make_node(AST_Conditional, self, { + condition: make_node(AST_Binary, self, { + left: negated, + operator: "||", + right: fuse(consequent, seq_tail, "condition"), + }), + consequent: merge_expression(seq_tail.consequent, alternative), + alternative: seq_tail.alternative, + }); + } + // x ? a : (y ? a : b) ---> x || y ? a : b + if (alt_tail instanceof AST_Conditional + && consequent.equals(alt_tail.consequent)) { + return make_node(AST_Conditional, self, { + condition: make_node(AST_Binary, self, { + left: condition, + operator: "||", + right: fuse(alternative, alt_tail, "condition"), + }), + consequent: merge_expression(consequent, alt_tail.consequent), + alternative: alt_tail.alternative, + }); + } + // x ? b : (y ? a : b) ---> !x && y ? a : b + if (alt_tail instanceof AST_Conditional + && consequent.equals(alt_tail.alternative)) { + return make_node(AST_Conditional, self, { + condition: make_node(AST_Binary, self, { + left: negated, + operator: "&&", + right: fuse(alternative, alt_tail, "condition"), + }), + consequent: alt_tail.consequent, + alternative: merge_expression(consequent, alt_tail.alternative), + }); + } + // x ? y && a : a ---> (!x || y) && a + if (seq_tail instanceof AST_Binary + && seq_tail.operator == "&&" + && seq_tail.right.equals(alternative)) { + return make_node(AST_Binary, self, { + operator: "&&", + left: make_node(AST_Binary, self, { + operator: "||", + left: negated, + right: fuse(consequent, seq_tail, "left"), + }), + right: merge_expression(seq_tail.right, alternative), + }).optimize(compressor); + } + // x ? y || a : a ---> x && y || a + if (seq_tail instanceof AST_Binary + && seq_tail.operator == "||" + && seq_tail.right.equals(alternative)) { + return make_node(AST_Binary, self, { + operator: "||", + left: make_node(AST_Binary, self, { + operator: "&&", + left: condition, + right: fuse(consequent, seq_tail, "left"), + }), + right: merge_expression(seq_tail.right, alternative), + }).optimize(compressor); + } + // x ? a : y && a ---> (x || y) && a + if (alt_tail instanceof AST_Binary + && alt_tail.operator == "&&" + && alt_tail.right.equals(consequent)) { + return make_node(AST_Binary, self, { + operator: "&&", + left: make_node(AST_Binary, self, { + operator: "||", + left: condition, + right: fuse(alternative, alt_tail, "left"), + }), + right: merge_expression(consequent, alt_tail.right), + }).optimize(compressor); + } + // x ? a : y || a ---> !x && y || a + if (alt_tail instanceof AST_Binary + && alt_tail.operator == "||" + && alt_tail.right.equals(consequent)) { + return make_node(AST_Binary, self, { + operator: "||", + left: make_node(AST_Binary, self, { + operator: "&&", + left: negated, + right: fuse(alternative, alt_tail, "left"), + }), + right: merge_expression(consequent, alt_tail.right), + }).optimize(compressor); + } + var in_bool = compressor.option("booleans") && compressor.in_boolean_context(); + if (is_true(consequent)) { + // c ? true : false ---> !!c + if (is_false(alternative)) return booleanize(condition); + // c ? true : x ---> !!c || x + return make_node(AST_Binary, self, { + operator: "||", + left: booleanize(condition), + right: alternative, + }).optimize(compressor); + } + if (is_false(consequent)) { + // c ? false : true ---> !c + if (is_true(alternative)) return booleanize(condition.negate(compressor)); + // c ? false : x ---> !c && x + return make_node(AST_Binary, self, { + operator: "&&", + left: booleanize(condition.negate(compressor)), + right: alternative, + }).optimize(compressor); + } + // c ? x : true ---> !c || x + if (is_true(alternative)) return make_node(AST_Binary, self, { + operator: "||", + left: booleanize(condition.negate(compressor)), + right: consequent, + }).optimize(compressor); + // c ? x : false ---> !!c && x + if (is_false(alternative)) return make_node(AST_Binary, self, { + operator: "&&", + left: booleanize(condition), + right: consequent, + }).optimize(compressor); + if (compressor.option("typeofs")) mark_locally_defined(condition, consequent, alternative); + return self; + + function booleanize(node) { + if (node.is_boolean(compressor)) return node; + // !!expression + return make_node(AST_UnaryPrefix, node, { + operator: "!", + expression: node.negate(compressor), + }); + } + + // AST_True or !0 + function is_true(node) { + return node instanceof AST_True + || in_bool + && node instanceof AST_Constant + && node.value + || (node instanceof AST_UnaryPrefix + && node.operator == "!" + && node.expression instanceof AST_Constant + && !node.expression.value); + } + // AST_False or !1 or void 0 + function is_false(node) { + return node instanceof AST_False + || in_bool + && (node instanceof AST_Constant + && !node.value + || node instanceof AST_UnaryPrefix + && node.operator == "void" + && !node.expression.has_side_effects(compressor)) + || (node instanceof AST_UnaryPrefix + && node.operator == "!" + && node.expression instanceof AST_Constant + && node.expression.value); + } + + function arg_diff(consequent, alternative) { + var a = consequent.args; + var b = alternative.args; + var len = a.length; + if (len != b.length) return -2; + for (var i = 0; i < len; i++) { + if (!a[i].equals(b[i])) { + if (a[i] instanceof AST_Spread !== b[i] instanceof AST_Spread) return -3; + for (var j = i + 1; j < len; j++) { + if (!a[j].equals(b[j])) return -2; + } + return i; + } + } + return -1; + } + + function fuse(node, tail, prop) { + if (node === tail) return tail[prop]; + var exprs = node.expressions.slice(0, -1); + exprs.push(tail[prop]); + return make_sequence(node, exprs); + } + + function is_tail_equivalent(consequent, alternative) { + if (consequent.TYPE != alternative.TYPE) return; + if (consequent.optional != alternative.optional) return; + if (consequent instanceof AST_Call) { + if (arg_diff(consequent, alternative) != -1) return; + return consequent.TYPE != "Call" + || !(consequent.expression instanceof AST_PropAccess + || alternative.expression instanceof AST_PropAccess) + || is_tail_equivalent(consequent.expression, alternative.expression); + } + if (!(consequent instanceof AST_PropAccess)) return; + var p = consequent.property; + var q = alternative.property; + return (p instanceof AST_Node ? p.equals(q) : p == q) + && !(consequent.expression instanceof AST_Super || alternative.expression instanceof AST_Super); + } + + function combine_tail(consequent, alternative, top) { + var seq_tail = consequent.tail_node(); + var alt_tail = alternative.tail_node(); + if (!is_tail_equivalent(seq_tail, alt_tail)) return !top && make_node(AST_Conditional, self, { + condition: condition, + consequent: consequent, + alternative: alternative, + }); + var node = seq_tail.clone(); + var seq_expr = fuse(consequent, seq_tail, "expression"); + var alt_expr = fuse(alternative, alt_tail, "expression"); + var combined = combine_tail(seq_expr, alt_expr); + if (seq_tail.expression instanceof AST_Sequence) { + combined = maintain_this_binding(seq_tail, seq_tail.expression, combined); + } + node.expression = combined; + return node; + } + + function can_shift_lhs_of_tail(node) { + return node === node.tail_node() || all(node.expressions.slice(0, -1), function(expr) { + return !expr.has_side_effects(compressor); + }); + } + + function pop_lhs(node) { + if (!(node instanceof AST_Sequence)) return node.right; + var exprs = node.expressions.slice(); + exprs.push(exprs.pop().right); + return make_sequence(node, exprs); + } + + function pop_seq(node) { + if (!(node instanceof AST_Sequence)) return make_node(AST_Number, node, { value: 0 }); + return make_sequence(node, node.expressions.slice(0, -1)); + } + }); + + OPT(AST_Boolean, function(self, compressor) { + if (!compressor.option("booleans")) return self; + if (compressor.in_boolean_context()) return make_node(AST_Number, self, { value: +self.value }); + var p = compressor.parent(); + if (p instanceof AST_Binary && (p.operator == "==" || p.operator == "!=")) { + AST_Node.warn("Non-strict equality against boolean: {operator} {value} [{start}]", { + operator: p.operator, + value: self.value, + start: p.start, + }); + return make_node(AST_Number, self, { value: +self.value }); + } + return make_node(AST_UnaryPrefix, self, { + operator: "!", + expression: make_node(AST_Number, self, { value: 1 - self.value }), + }); + }); + + OPT(AST_Spread, function(self, compressor) { + var exp = self.expression; + if (compressor.option("spreads") && exp instanceof AST_Array && !(compressor.parent() instanceof AST_Object)) { + return List.splice(exp.elements.map(function(node) { + return node instanceof AST_Hole ? make_node(AST_Undefined, node).optimize(compressor) : node; + })); + } + return self; + }); + + function safe_to_flatten(value, compressor) { + if (!value) return false; + var parent = compressor.parent(); + if (parent.TYPE != "Call") return true; + if (parent.expression !== compressor.self()) return true; + if (value instanceof AST_SymbolRef) { + value = value.fixed_value(); + if (!value) return false; + } + return value instanceof AST_Lambda && !value.contains_this(); + } + + OPT(AST_Sub, function(self, compressor) { + var expr = self.expression; + var prop = self.property; + var terminated = trim_optional_chain(self, compressor); + if (terminated) return terminated; + if (compressor.option("properties")) { + var key = prop.evaluate(compressor); + if (key !== prop) { + if (typeof key == "string") { + if (key == "undefined") { + key = undefined; + } else { + var value = parseFloat(key); + if (value.toString() == key) { + key = value; + } + } + } + prop = self.property = best_of_expression(prop, make_node_from_constant(key, prop).transform(compressor)); + var property = "" + key; + if (is_identifier_string(property) + && property.length <= prop.print_to_string().length + 1) { + return make_node(AST_Dot, self, { + optional: self.optional, + expression: expr, + property: property, + quoted: true, + }).optimize(compressor); + } + } + } + var parent = compressor.parent(); + var assigned = is_lhs(compressor.self(), parent); + var def, fn, fn_parent, index; + if (compressor.option("arguments") + && expr instanceof AST_SymbolRef + && is_arguments(def = expr.definition()) + && !expr.in_arg + && prop instanceof AST_Number + && Math.floor(index = prop.value) == index + && (fn = def.scope) === find_lambda() + && fn.uses_arguments < (assigned ? 2 : 3)) { + if (parent instanceof AST_UnaryPrefix && parent.operator == "delete") { + if (!def.deleted) def.deleted = []; + def.deleted[index] = true; + } + var argname = fn.argnames[index]; + if (def.deleted && def.deleted[index]) { + argname = null; + } else if (argname) { + var arg_def; + if (!(argname instanceof AST_SymbolFunarg) + || argname.name == "await" + || expr.scope.find_variable(argname.name) !== (arg_def = argname.definition())) { + argname = null; + } else if (compressor.has_directive("use strict") + || fn.name + || fn.rest + || !(fn_parent instanceof AST_Call + && index < fn_parent.args.length + && all(fn_parent.args.slice(0, index + 1), function(arg) { + return !(arg instanceof AST_Spread); + })) + || !all(fn.argnames, function(argname) { + return argname instanceof AST_SymbolFunarg; + })) { + if (has_reassigned() || arg_def.assignments || arg_def.orig.length > 1) argname = null; + } + } else if ((assigned || !has_reassigned()) + && index < fn.argnames.length + 5 + && compressor.drop_fargs(fn, fn_parent) + && !fn.rest) { + while (index >= fn.argnames.length) { + argname = fn.make_var(AST_SymbolFunarg, fn, "argument_" + fn.argnames.length); + fn.argnames.push(argname); + } + } + if (argname && find_if(function(node) { + return node.name === argname.name; + }, fn.argnames) === argname) { + if (assigned) def.reassigned--; + var sym = make_node(AST_SymbolRef, argname); + sym.reference(); + argname.unused = undefined; + return sym; + } + } + if (assigned) return self; + if (compressor.option("sequences") + && parent.TYPE != "Call" + && !(parent instanceof AST_ForEnumeration && parent.init === self)) { + var seq = lift_sequence_in_expression(self, compressor); + if (seq !== self) return seq.optimize(compressor); + } + if (key !== prop) { + var sub = self.flatten_object(property, compressor); + if (sub) { + expr = self.expression = sub.expression; + prop = self.property = sub.property; + } + } + var elements; + if (compressor.option("properties") + && compressor.option("side_effects") + && prop instanceof AST_Number + && expr instanceof AST_Array + && all(elements = expr.elements, function(value) { + return !(value instanceof AST_Spread); + })) { + var index = prop.value; + var retValue = elements[index]; + if (safe_to_flatten(retValue, compressor)) { + var is_hole = retValue instanceof AST_Hole; + var flatten = !is_hole; + var values = []; + for (var i = elements.length; --i > index;) { + var value = elements[i].drop_side_effect_free(compressor); + if (value) { + values.unshift(value); + if (flatten && value.has_side_effects(compressor)) flatten = false; + } + } + if (!flatten) values.unshift(retValue); + while (--i >= 0) { + var value = elements[i].drop_side_effect_free(compressor); + if (value) { + values.unshift(value); + } else if (is_hole) { + values.unshift(make_node(AST_Hole, elements[i])); + } else { + index--; + } + } + if (flatten) { + values.push(retValue); + return make_sequence(self, values).optimize(compressor); + } + return make_node(AST_Sub, self, { + expression: make_node(AST_Array, expr, { elements: values }), + property: make_node(AST_Number, prop, { value: index }), + }); + } + } + return try_evaluate(compressor, self); + + function find_lambda() { + var i = 0, p; + while (p = compressor.parent(i++)) { + if (p instanceof AST_Lambda) { + if (p instanceof AST_Accessor) return; + if (is_arrow(p)) continue; + fn_parent = compressor.parent(i); + return p; + } + } + } + + function has_reassigned() { + return !compressor.option("reduce_vars") || def.reassigned; + } + }); + + AST_LambdaExpression.DEFMETHOD("contains_super", function() { + var result = false; + var self = this; + self.walk(new TreeWalker(function(node) { + if (result) return true; + if (node instanceof AST_Super) return result = true; + if (node !== self && node instanceof AST_Scope && !is_arrow(node)) return true; + })); + return result; + }); + + // contains_this() + // returns false only if context bound by the specified scope (or scope + // containing the specified expression) is not referenced by `this` + (function(def) { + // scope of arrow function cannot bind to any context + def(AST_Arrow, return_false); + def(AST_AsyncArrow, return_false); + def(AST_Node, function() { + var result = false; + var self = this; + self.walk(new TreeWalker(function(node) { + if (result) return true; + if (node instanceof AST_This) return result = true; + if (node !== self && node instanceof AST_Scope && !is_arrow(node)) return true; + })); + return result; + }); + })(function(node, func) { + node.DEFMETHOD("contains_this", func); + }); + + function can_hoist_property(prop) { + return prop instanceof AST_ObjectKeyVal + && typeof prop.key == "string" + && !(prop instanceof AST_ObjectMethod && prop.value.contains_super()); + } + + AST_PropAccess.DEFMETHOD("flatten_object", function(key, compressor) { + if (!compressor.option("properties")) return; + if (key === "__proto__") return; + var self = this; + var expr = self.expression; + if (!(expr instanceof AST_Object)) return; + var props = expr.properties; + for (var i = props.length; --i >= 0;) { + var prop = props[i]; + if (prop.key !== key) continue; + if (!all(props, can_hoist_property)) return; + if (!safe_to_flatten(prop.value, compressor)) return; + var call, scope, values = []; + for (var j = 0; j < props.length; j++) { + var value = props[j].value; + if (props[j] instanceof AST_ObjectMethod) { + var arrow = !(value.uses_arguments || is_generator(value) || value.contains_this()); + if (arrow) { + if (!scope) scope = compressor.find_parent(AST_Scope); + var avoid = avoid_await_yield(compressor, scope); + value.each_argname(function(argname) { + if (avoid[argname.name]) arrow = false; + }); + } + var ctor; + if (arrow) { + ctor = is_async(value) ? AST_AsyncArrow : AST_Arrow; + } else if (i != j + || (call = compressor.parent()) instanceof AST_Call && call.expression === self) { + ctor = value.CTOR; + } else { + return; + } + value = make_node(ctor, value); + } + values.push(value); + } + return make_node(AST_Sub, self, { + expression: make_node(AST_Array, expr, { elements: values }), + property: make_node(AST_Number, self, { value: i }), + }); + } + }); + + OPT(AST_Dot, function(self, compressor) { + if (self.property == "arguments" || self.property == "caller") { + AST_Node.warn("Function.prototype.{property} not supported [{start}]", self); + } + var parent = compressor.parent(); + if (is_lhs(compressor.self(), parent)) return self; + var terminated = trim_optional_chain(self, compressor); + if (terminated) return terminated; + if (compressor.option("sequences") + && parent.TYPE != "Call" + && !(parent instanceof AST_ForEnumeration && parent.init === self)) { + var seq = lift_sequence_in_expression(self, compressor); + if (seq !== self) return seq.optimize(compressor); + } + if (compressor.option("unsafe_proto") + && self.expression instanceof AST_Dot + && self.expression.property == "prototype") { + var exp = self.expression.expression; + if (is_undeclared_ref(exp)) switch (exp.name) { + case "Array": + self.expression = make_node(AST_Array, self.expression, { elements: [] }); + break; + case "Function": + self.expression = make_node(AST_Function, self.expression, { + argnames: [], + body: [], + }).init_vars(exp.scope); + break; + case "Number": + self.expression = make_node(AST_Number, self.expression, { value: 0 }); + break; + case "Object": + self.expression = make_node(AST_Object, self.expression, { properties: [] }); + break; + case "RegExp": + self.expression = make_node(AST_RegExp, self.expression, { value: /t/ }); + break; + case "String": + self.expression = make_node(AST_String, self.expression, { value: "" }); + break; + } + } + var sub = self.flatten_object(self.property, compressor); + if (sub) return sub.optimize(compressor); + return try_evaluate(compressor, self); + }); + + OPT(AST_DestructuredArray, function(self, compressor) { + if (compressor.option("rests") && self.rest instanceof AST_DestructuredArray) { + return make_node(AST_DestructuredArray, self, { + elements: self.elements.concat(self.rest.elements), + rest: self.rest.rest, + }); + } + return self; + }); + + OPT(AST_DestructuredKeyVal, function(self, compressor) { + if (compressor.option("objects")) { + var key = self.key; + if (key instanceof AST_Node) { + key = key.evaluate(compressor); + if (key !== self.key) self.key = "" + key; + } + } + return self; + }); + + OPT(AST_Object, function(self, compressor) { + if (!compressor.option("objects")) return self; + var changed = false; + var found = false; + var generated = false; + var keep_duplicate = compressor.has_directive("use strict"); + var keys = []; + var map = new Dictionary(); + var values = []; + self.properties.forEach(function(prop) { + if (!(prop instanceof AST_Spread)) return process(prop); + found = true; + var exp = prop.expression; + if (compressor.option("spreads") && exp instanceof AST_Object && all(exp.properties, function(prop) { + if (prop instanceof AST_ObjectGetter) return false; + if (prop instanceof AST_Spread) return false; + if (prop.key !== "__proto__") return true; + if (prop instanceof AST_ObjectSetter) return true; + return !prop.value.has_side_effects(compressor); + })) { + changed = true; + exp.properties.forEach(function(prop) { + var key = prop.key; + var setter = prop instanceof AST_ObjectSetter; + if (key === "__proto__") { + if (!setter) return; + key = make_node_from_constant(key, prop); + } + process(setter ? make_node(AST_ObjectKeyVal, prop, { + key: key, + value: make_node(AST_Undefined, prop).optimize(compressor), + }) : prop); + }); + } else { + generated = true; + flush(); + values.push(prop); + } + }); + flush(); + if (!changed) return self; + if (found && generated && values.length == 1) { + var value = values[0]; + if (value instanceof AST_ObjectProperty && value.key instanceof AST_Number) { + value.key = "" + value.key.value; + } + } + return make_node(AST_Object, self, { properties: values }); + + function flush() { + keys.forEach(function(key) { + var props = map.get(key); + switch (props.length) { + case 0: + return; + case 1: + return values.push(props[0]); + } + changed = true; + var tail = keep_duplicate && !generated && props.pop(); + values.push(props.length == 1 ? props[0] : make_node(AST_ObjectKeyVal, self, { + key: props[0].key, + value: make_sequence(self, props.map(function(prop) { + return prop.value; + })), + })); + if (tail) values.push(tail); + props.length = 0; + }); + keys = []; + map = new Dictionary(); + } + + function process(prop) { + var key = prop.key; + if (key instanceof AST_Node) { + found = true; + key = key.evaluate(compressor); + if (key === prop.key || key === "__proto__") { + generated = true; + } else { + key = prop.key = "" + key; + } + } + if (can_hoist_property(prop)) { + if (prop.value.has_side_effects(compressor)) flush(); + keys.push(key); + map.add(key, prop); + } else { + flush(); + values.push(prop); + } + if (found && !generated && typeof key == "string" && RE_POSITIVE_INTEGER.test(key)) { + generated = true; + if (map.has(key)) prop = map.get(key)[0]; + prop.key = make_node(AST_Number, prop, { value: +key }); + } + } + }); + + function flatten_var(name) { + var redef = name.definition().redefined(); + if (redef) { + name = name.clone(); + name.thedef = redef; + } + return name; + } + + function has_arg_refs(fn, node) { + var found = false; + node.walk(new TreeWalker(function(node) { + if (found) return true; + if (node instanceof AST_SymbolRef && fn.variables.get(node.name) === node.definition()) { + return found = true; + } + })); + return found; + } + + function insert_assign(def, assign) { + var visited = []; + def.references.forEach(function(ref) { + var fixed = ref.fixed; + if (!fixed || !push_uniq(visited, fixed)) return; + if (fixed.assigns) { + fixed.assigns.unshift(assign); + } else { + fixed.assigns = [ assign ]; + } + }); + } + + function init_ref(compressor, name) { + var sym = make_node(AST_SymbolRef, name); + var assign = make_node(AST_Assign, name, { + operator: "=", + left: sym, + right: make_node(AST_Undefined, name).transform(compressor), + }); + var def = name.definition(); + if (def.fixed) { + sym.fixed = function() { + return assign.right; + }; + sym.fixed.assigns = [ assign ]; + insert_assign(def, assign); + } + def.assignments++; + def.references.push(sym); + return assign; + } + + (function(def) { + def(AST_Node, noop); + def(AST_Assign, noop); + def(AST_Await, function(compressor, scope, no_return, in_loop) { + if (!compressor.option("awaits")) return; + var self = this; + var inlined = self.expression.try_inline(compressor, scope, no_return, in_loop, true); + if (!inlined) return; + if (!no_return) scan_local_returns(inlined, function(node) { + node.in_bool = false; + var value = node.value; + if (value instanceof AST_Await) return; + node.value = make_node(AST_Await, self, { + expression: value || make_node(AST_Undefined, node).transform(compressor), + }); + }); + return aborts(inlined) ? inlined : make_node(AST_BlockStatement, self, { + body: [ inlined, make_node(AST_SimpleStatement, self, { + body: make_node(AST_Await, self, { expression: make_node(AST_Number, self, { value: 0 })}), + }) ], + }); + }); + def(AST_Binary, function(compressor, scope, no_return, in_loop, in_await) { + if (no_return === undefined) return; + var self = this; + var op = self.operator; + if (!lazy_op[op]) return; + var inlined = self.right.try_inline(compressor, scope, no_return, in_loop, in_await); + if (!inlined) return; + return make_node(AST_If, self, { + condition: make_condition(self.left), + body: inlined, + alternative: no_return ? null : make_node(AST_Return, self, { + value: make_node(AST_Undefined, self).transform(compressor), + }), + }); + + function make_condition(cond) { + switch (op) { + case "&&": + return cond; + case "||": + return cond.negate(compressor); + case "??": + return make_node(AST_Binary, self, { + operator: "==", + left: make_node(AST_Null, self), + right: cond, + }); + } + } + }); + def(AST_BlockStatement, function(compressor, scope, no_return, in_loop) { + if (no_return) return; + if (!this.variables) return; + var body = this.body; + var last = body.length - 1; + if (last < 0) return; + var inlined = body[last].try_inline(compressor, this, no_return, in_loop); + if (!inlined) return; + body[last] = inlined; + return this; + }); + def(AST_Call, function(compressor, scope, no_return, in_loop, in_await) { + if (compressor.option("inline") < 4) return; + var call = this; + if (call.is_expr_pure(compressor)) return; + var fn = call.expression; + if (!(fn instanceof AST_LambdaExpression)) return; + if (fn.name) return; + if (fn.uses_arguments) return; + if (fn.pinned()) return; + if (is_generator(fn)) return; + var arrow = is_arrow(fn); + if (arrow && fn.value) return; + if (fn.body[0] instanceof AST_Directive) return; + if (fn.contains_this()) return; + if (!scope) scope = find_scope(compressor); + var defined = new Dictionary(); + defined.set("NaN", true); + while (!(scope instanceof AST_Scope)) { + scope.variables.each(function(def) { + defined.set(def.name, true); + }); + scope = scope.parent_scope; + } + if (!member(scope, compressor.stack)) return; + if (scope.pinned() && fn.variables.size() > (arrow ? 0 : 1)) return; + if (scope instanceof AST_Toplevel) { + if (fn.variables.size() > (arrow ? 0 : 1)) { + if (!compressor.toplevel.vars) return; + if (fn.functions.size() > 0 && !compressor.toplevel.funcs) return; + } + defined.set("arguments", true); + } + var async = !in_await && is_async(fn); + if (async) { + if (!compressor.option("awaits")) return; + if (!is_async(scope)) return; + if (call.may_throw(compressor)) return; + } + var names = scope.var_names(); + if (in_loop) in_loop = []; + if (!fn.variables.all(function(def, name) { + if (in_loop) in_loop.push(def); + if (!defined.has(name) && !names.has(name)) return true; + return !arrow && name == "arguments" && def.orig.length == 1; + })) return; + if (in_loop && in_loop.length > 0 && is_reachable(fn, in_loop)) return; + var simple_argnames = true; + if (!all(fn.argnames, function(argname) { + var abort = false; + var tw = new TreeWalker(function(node) { + if (abort) return true; + if (node instanceof AST_DefaultValue) { + if (has_arg_refs(fn, node.value)) return abort = true; + node.name.walk(tw); + return true; + } + if (node instanceof AST_DestructuredKeyVal) { + if (node.key instanceof AST_Node && has_arg_refs(fn, node.key)) return abort = true; + node.value.walk(tw); + return true; + } + if (node instanceof AST_SymbolFunarg && !all(node.definition().orig, function(sym) { + return !(sym instanceof AST_SymbolDefun); + })) return abort = true; + }); + argname.walk(tw); + if (abort) return false; + if (!(argname instanceof AST_SymbolFunarg)) simple_argnames = false; + return true; + })) return; + if (fn.rest) { + if (has_arg_refs(fn, fn.rest)) return; + simple_argnames = false; + } + var verify_body; + if (no_return) { + verify_body = function(stat) { + var abort = false; + stat.walk(new TreeWalker(function(node) { + if (abort) return true; + if (async && (node instanceof AST_Await || node instanceof AST_ForAwaitOf) + || node instanceof AST_Return) { + return abort = true; + } + if (node instanceof AST_Scope) return true; + })); + return !abort; + }; + } else if (in_await || is_async(fn) || in_async_generator(scope)) { + verify_body = function(stat) { + var abort = false; + var find_return = new TreeWalker(function(node) { + if (abort) return true; + if (node instanceof AST_Return) return abort = true; + if (node instanceof AST_Scope) return true; + }); + stat.walk(new TreeWalker(function(node) { + if (abort) return true; + if (node instanceof AST_Try) { + if (node.bfinally && all(node.body, function(stat) { + stat.walk(find_return); + return !abort; + }) && node.bcatch) node.bcatch.walk(find_return); + return true; + } + if (node instanceof AST_Scope) return true; + })); + return !abort; + }; + } + if (verify_body && !all(fn.body, verify_body)) return; + if (!safe_from_await_yield(fn, avoid_await_yield(compressor, scope))) return; + fn.functions.each(function(def, name) { + scope.functions.set(name, def); + }); + var body = []; + fn.variables.each(function(def, name) { + if (!arrow && name == "arguments" && def.orig.length == 1) return; + names.set(name, true); + scope.enclosed.push(def); + scope.variables.set(name, def); + def.single_use = false; + if (!in_loop) return; + if (def.references.length == def.replaced) return; + if (def.orig.length == def.eliminated) return; + if (def.orig.length == 1 && fn.functions.has(name)) return; + if (!all(def.orig, function(sym) { + if (sym instanceof AST_SymbolConst) return false; + if (sym instanceof AST_SymbolFunarg) return !sym.unused && def.scope.resolve() !== fn; + if (sym instanceof AST_SymbolLet) return false; + return true; + })) return; + var sym = def.orig[0]; + if (sym instanceof AST_SymbolCatch) return; + body.push(make_node(AST_SimpleStatement, sym, { body: init_ref(compressor, flatten_var(sym)) })); + }); + var defs = Object.create(null), syms = new Dictionary(); + if (simple_argnames && all(call.args, function(arg) { + return !(arg instanceof AST_Spread); + })) { + var values = call.args.slice(); + fn.argnames.forEach(function(argname) { + var value = values.shift(); + if (argname.unused) { + if (value) body.push(make_node(AST_SimpleStatement, call, { body: value })); + return; + } + var defn = make_node(AST_VarDef, call, { + name: argname.convert_symbol(AST_SymbolVar, process), + value: value || make_node(AST_Undefined, call).transform(compressor), + }); + if (argname instanceof AST_SymbolFunarg) insert_assign(argname.definition(), defn); + body.push(make_node(AST_Var, call, { definitions: [ defn ] })); + }); + if (values.length) body.push(make_node(AST_SimpleStatement, call, { + body: make_sequence(call, values), + })); + } else { + body.push(make_node(AST_Var, call, { + definitions: [ make_node(AST_VarDef, call, { + name: make_node(AST_DestructuredArray, call, { + elements: fn.argnames.map(function(argname) { + if (argname.unused) return make_node(AST_Hole, argname); + return argname.convert_symbol(AST_SymbolVar, process); + }), + rest: fn.rest && fn.rest.convert_symbol(AST_SymbolVar, process), + }), + value: make_node(AST_Array, call, { elements: call.args.slice() }), + }) ], + })); + } + syms.each(function(orig, id) { + var def = defs[id]; + [].unshift.apply(def.orig, orig); + def.eliminated += orig.length; + }); + [].push.apply(body, in_loop ? fn.body.filter(function(stat) { + if (!(stat instanceof AST_LambdaDefinition)) return true; + var name = make_node(AST_SymbolVar, flatten_var(stat.name)); + var def = name.definition(); + def.fixed = false; + def.orig.push(name); + def.eliminated++; + body.push(make_node(AST_Var, stat, { + definitions: [ make_node(AST_VarDef, stat, { + name: name, + value: to_func_expr(stat, true), + }) ], + })); + return false; + }) : fn.body); + var inlined = make_node(AST_BlockStatement, call, { body: body }); + if (!no_return) { + if (async) scan_local_returns(inlined, function(node) { + var value = node.value; + if (is_undefined(value)) return; + node.value = make_node(AST_Await, call, { expression: value }); + }); + body.push(make_node(AST_Return, call, { + value: in_async_generator(scope) ? make_node(AST_Undefined, call).transform(compressor) : null, + })); + } + return inlined; + + function process(sym, argname) { + var def = argname.definition(); + defs[def.id] = def; + syms.add(def.id, sym); + } + }); + def(AST_Conditional, function(compressor, scope, no_return, in_loop, in_await) { + var self = this; + var body = self.consequent.try_inline(compressor, scope, no_return, in_loop, in_await); + var alt = self.alternative.try_inline(compressor, scope, no_return, in_loop, in_await); + if (!body && !alt) return; + return make_node(AST_If, self, { + condition: self.condition, + body: body || make_body(self.consequent), + alternative: alt || make_body(self.alternative), + }); + + function make_body(value) { + if (no_return) return make_node(AST_SimpleStatement, value, { body: value }); + return make_node(AST_Return, value, { value: value }); + } + }); + def(AST_For, function(compressor, scope, no_return, in_loop) { + var body = this.body.try_inline(compressor, scope, true, true); + if (body) this.body = body; + var inlined = this.init; + if (inlined) { + inlined = inlined.try_inline(compressor, scope, true, in_loop); + if (inlined) { + this.init = null; + if (inlined instanceof AST_BlockStatement) { + inlined.body.push(this); + return inlined; + } + return make_node(AST_BlockStatement, inlined, { body: [ inlined, this ] }); + } + } + return body && this; + }); + def(AST_ForEnumeration, function(compressor, scope, no_return, in_loop) { + var body = this.body.try_inline(compressor, scope, true, true); + if (body) this.body = body; + var obj = this.object; + if (obj instanceof AST_Sequence) { + var inlined = inline_sequence(compressor, scope, true, in_loop, false, obj, 1); + if (inlined) { + this.object = obj.tail_node(); + inlined.body.push(this); + return inlined; + } + } + return body && this; + }); + def(AST_If, function(compressor, scope, no_return, in_loop) { + var body = this.body.try_inline(compressor, scope, no_return, in_loop); + if (body) this.body = body; + var alt = this.alternative; + if (alt) { + alt = alt.try_inline(compressor, scope, no_return, in_loop); + if (alt) this.alternative = alt; + } + var cond = this.condition; + if (cond instanceof AST_Sequence) { + var inlined = inline_sequence(compressor, scope, true, in_loop, false, cond, 1); + if (inlined) { + this.condition = cond.tail_node(); + inlined.body.push(this); + return inlined; + } + } + return (body || alt) && this; + }); + def(AST_IterationStatement, function(compressor, scope, no_return, in_loop) { + var body = this.body.try_inline(compressor, scope, true, true); + if (!body) return; + this.body = body; + return this; + }); + def(AST_LabeledStatement, function(compressor, scope, no_return, in_loop) { + var body = this.body.try_inline(compressor, scope, no_return, in_loop); + if (!body) return; + if (this.body instanceof AST_IterationStatement && body instanceof AST_BlockStatement) { + var loop = body.body.pop(); + this.body = loop; + body.body.push(this); + return body; + } + this.body = body; + return this; + }); + def(AST_New, noop); + def(AST_Return, function(compressor, scope, no_return, in_loop) { + var value = this.value; + return value && value.try_inline(compressor, scope, undefined, in_loop === "try"); + }); + function inline_sequence(compressor, scope, no_return, in_loop, in_await, node, skip) { + var body = [], exprs = node.expressions, no_ret = no_return; + for (var i = exprs.length - (skip || 0), j = i; --i >= 0; no_ret = true, in_await = false) { + var inlined = exprs[i].try_inline(compressor, scope, no_ret, in_loop, in_await); + if (!inlined) continue; + flush(); + body.push(inlined); + } + if (body.length == 0) return; + flush(); + if (!no_return && body[0] instanceof AST_SimpleStatement) { + body[0] = make_node(AST_Return, node, { value: body[0].body }); + } + return make_node(AST_BlockStatement, node, { body: body.reverse() }); + + function flush() { + if (j > i + 1) body.push(make_node(AST_SimpleStatement, node, { + body: make_sequence(node, exprs.slice(i + 1, j)), + })); + j = i; + } + } + def(AST_Sequence, function(compressor, scope, no_return, in_loop, in_await) { + return inline_sequence(compressor, scope, no_return, in_loop, in_await, this); + }); + def(AST_SimpleStatement, function(compressor, scope, no_return, in_loop) { + var body = this.body; + while (body instanceof AST_UnaryPrefix) { + var op = body.operator; + if (unary_side_effects[op]) break; + if (op == "void") break; + body = body.expression; + } + if (!no_return && !is_undefined(body)) body = make_node(AST_UnaryPrefix, this, { + operator: "void", + expression: body, + }); + return body.try_inline(compressor, scope, no_return || false, in_loop); + }); + def(AST_UnaryPrefix, function(compressor, scope, no_return, in_loop, in_await) { + var self = this; + var op = self.operator; + if (unary_side_effects[op]) return; + if (!no_return && op == "void") no_return = false; + var inlined = self.expression.try_inline(compressor, scope, no_return, in_loop, in_await); + if (!inlined) return; + if (!no_return) scan_local_returns(inlined, function(node) { + node.in_bool = false; + var value = node.value; + if (op == "void" && is_undefined(value)) return; + node.value = make_node(AST_UnaryPrefix, self, { + operator: op, + expression: value || make_node(AST_Undefined, node).transform(compressor), + }); + }); + return inlined; + }); + def(AST_With, function(compressor, scope, no_return, in_loop) { + var body = this.body.try_inline(compressor, scope, no_return, in_loop); + if (body) this.body = body; + var exp = this.expression; + if (exp instanceof AST_Sequence) { + var inlined = inline_sequence(compressor, scope, true, in_loop, false, exp, 1); + if (inlined) { + this.expression = exp.tail_node(); + inlined.body.push(this); + return inlined; + } + } + return body && this; + }); + def(AST_Yield, function(compressor, scope, no_return, in_loop) { + if (!compressor.option("yields")) return; + if (!this.nested) return; + var call = this.expression; + if (call.TYPE != "Call") return; + var fn = call.expression; + switch (fn.CTOR) { + case AST_AsyncGeneratorFunction: + fn = make_node(AST_AsyncFunction, fn); + break; + case AST_GeneratorFunction: + fn = make_node(AST_Function, fn); + break; + default: + return; + } + call = call.clone(); + call.expression = fn; + return call.try_inline(compressor, scope, no_return, in_loop); + }); + })(function(node, func) { + node.DEFMETHOD("try_inline", func); + }); + + OPT(AST_Return, function(self, compressor) { + var value = self.value; + if (value && compressor.option("side_effects") + && is_undefined(value, compressor) + && !in_async_generator(compressor.find_parent(AST_Scope))) { + self.value = null; + } + return self; + }); +})(function(node, optimizer) { + node.DEFMETHOD("optimize", function(compressor) { + var self = this; + if (self._optimized) return self; + if (compressor.has_directive("use asm")) return self; + var opt = optimizer(self, compressor); + opt._optimized = true; + return opt; + }); +}); diff --git a/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/minify.js b/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/minify.js new file mode 100644 index 00000000..c7a1341c --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/minify.js @@ -0,0 +1,276 @@ +"use strict"; + +var to_ascii, to_base64; +if (typeof Buffer == "undefined") { + to_ascii = atob; + to_base64 = btoa; +} else if (typeof Buffer.alloc == "undefined") { + to_ascii = function(b64) { + return new Buffer(b64, "base64").toString(); + }; + to_base64 = function(str) { + return new Buffer(str).toString("base64"); + }; +} else { + to_ascii = function(b64) { + return Buffer.from(b64, "base64").toString(); + }; + to_base64 = function(str) { + return Buffer.from(str).toString("base64"); + }; +} + +function read_source_map(name, toplevel) { + var comments = toplevel.end.comments_after; + for (var i = comments.length; --i >= 0;) { + var comment = comments[i]; + if (comment.type != "comment1") break; + var match = /^# ([^\s=]+)=(\S+)\s*$/.exec(comment.value); + if (!match) break; + if (match[1] == "sourceMappingURL") { + match = /^data:application\/json(;.*?)?;base64,([^,]+)$/.exec(match[2]); + if (!match) break; + return to_ascii(match[2]); + } + } + AST_Node.warn("inline source map not found: {name}", { + name: name, + }); +} + +function parse_source_map(content) { + try { + return JSON.parse(content); + } catch (ex) { + throw new Error("invalid input source map: " + content); + } +} + +function set_shorthand(name, options, keys) { + keys.forEach(function(key) { + if (options[key]) { + if (typeof options[key] != "object") options[key] = {}; + if (!(name in options[key])) options[key][name] = options[name]; + } + }); +} + +function init_cache(cache) { + if (!cache) return; + if (!("props" in cache)) { + cache.props = new Dictionary(); + } else if (!(cache.props instanceof Dictionary)) { + cache.props = Dictionary.fromObject(cache.props); + } +} + +function to_json(cache) { + return { + props: cache.props.toObject() + }; +} + +function minify(files, options) { + try { + options = defaults(options, { + annotations: undefined, + compress: {}, + enclose: false, + expression: false, + ie: false, + ie8: false, + keep_fargs: false, + keep_fnames: false, + mangle: {}, + module: false, + nameCache: null, + output: {}, + parse: {}, + rename: undefined, + sourceMap: false, + timings: false, + toplevel: !!(options && options["module"]), + v8: false, + validate: false, + warnings: false, + webkit: false, + wrap: false, + }, true); + if (options.validate) AST_Node.enable_validation(); + var timings = options.timings && { start: Date.now() }; + if (options.annotations !== undefined) set_shorthand("annotations", options, [ "compress", "output" ]); + if (options.expression) set_shorthand("expression", options, [ "compress", "parse" ]); + if (options.ie8) options.ie = options.ie || options.ie8; + if (options.ie) set_shorthand("ie", options, [ "compress", "mangle", "output", "rename" ]); + if (options.keep_fargs) set_shorthand("keep_fargs", options, [ "compress", "mangle", "rename" ]); + if (options.keep_fnames) set_shorthand("keep_fnames", options, [ "compress", "mangle", "rename" ]); + if (options.module) set_shorthand("module", options, [ "compress", "parse" ]); + if (options.toplevel) set_shorthand("toplevel", options, [ "compress", "mangle", "rename" ]); + if (options.v8) set_shorthand("v8", options, [ "mangle", "output", "rename" ]); + if (options.webkit) set_shorthand("webkit", options, [ "compress", "mangle", "output", "rename" ]); + var quoted_props; + if (options.mangle) { + options.mangle = defaults(options.mangle, { + cache: options.nameCache && (options.nameCache.vars || {}), + eval: false, + ie: false, + keep_fargs: false, + keep_fnames: false, + properties: false, + reserved: [], + toplevel: false, + v8: false, + webkit: false, + }, true); + if (options.mangle.properties) { + if (typeof options.mangle.properties != "object") { + options.mangle.properties = {}; + } + if (options.mangle.properties.keep_quoted) { + quoted_props = options.mangle.properties.reserved; + if (!Array.isArray(quoted_props)) quoted_props = []; + options.mangle.properties.reserved = quoted_props; + } + if (options.nameCache && !("cache" in options.mangle.properties)) { + options.mangle.properties.cache = options.nameCache.props || {}; + } + } + init_cache(options.mangle.cache); + init_cache(options.mangle.properties.cache); + } + if (options.rename === undefined) options.rename = options.compress && options.mangle; + if (options.sourceMap) { + options.sourceMap = defaults(options.sourceMap, { + content: null, + filename: null, + includeSources: false, + names: true, + root: null, + url: null, + }, true); + } + var warnings = []; + if (options.warnings) AST_Node.log_function(function(warning) { + warnings.push(warning); + }, options.warnings == "verbose"); + if (timings) timings.parse = Date.now(); + var toplevel; + options.parse = options.parse || {}; + if (files instanceof AST_Node) { + toplevel = files; + } else { + if (typeof files == "string") files = [ files ]; + options.parse.toplevel = null; + var source_map_content = options.sourceMap && options.sourceMap.content; + if (typeof source_map_content == "string" && source_map_content != "inline") { + source_map_content = parse_source_map(source_map_content); + } + if (source_map_content) options.sourceMap.orig = Object.create(null); + for (var name in files) if (HOP(files, name)) { + options.parse.filename = name; + options.parse.toplevel = toplevel = parse(files[name], options.parse); + if (source_map_content == "inline") { + var inlined_content = read_source_map(name, toplevel); + if (inlined_content) options.sourceMap.orig[name] = parse_source_map(inlined_content); + } else if (source_map_content) { + options.sourceMap.orig[name] = source_map_content; + } + } + } + if (options.parse.expression) toplevel = toplevel.wrap_expression(); + if (quoted_props) reserve_quoted_keys(toplevel, quoted_props); + [ "enclose", "wrap" ].forEach(function(action) { + var option = options[action]; + if (!option) return; + var orig = toplevel.print_to_string().slice(0, -1); + toplevel = toplevel[action](option); + files[toplevel.start.file] = toplevel.print_to_string().replace(orig, ""); + }); + if (options.validate) toplevel.validate_ast(); + if (timings) timings.rename = Date.now(); + if (options.rename) { + toplevel.figure_out_scope(options.rename); + toplevel.expand_names(options.rename); + } + if (timings) timings.compress = Date.now(); + if (options.compress) { + toplevel = new Compressor(options.compress).compress(toplevel); + if (options.validate) toplevel.validate_ast(); + } + if (timings) timings.scope = Date.now(); + if (options.mangle) toplevel.figure_out_scope(options.mangle); + if (timings) timings.mangle = Date.now(); + if (options.mangle) { + toplevel.compute_char_frequency(options.mangle); + toplevel.mangle_names(options.mangle); + } + if (timings) timings.properties = Date.now(); + if (quoted_props) reserve_quoted_keys(toplevel, quoted_props); + if (options.mangle && options.mangle.properties) mangle_properties(toplevel, options.mangle.properties); + if (options.parse.expression) toplevel = toplevel.unwrap_expression(); + if (timings) timings.output = Date.now(); + var result = {}; + var output = defaults(options.output, { + ast: false, + code: true, + }); + if (output.ast) result.ast = toplevel; + if (output.code) { + if (options.sourceMap) { + output.source_map = SourceMap(options.sourceMap); + if (options.sourceMap.includeSources) { + if (files instanceof AST_Toplevel) { + throw new Error("original source content unavailable"); + } else for (var name in files) if (HOP(files, name)) { + output.source_map.setSourceContent(name, files[name]); + } + } + } + delete output.ast; + delete output.code; + var stream = OutputStream(output); + toplevel.print(stream); + result.code = stream.get(); + if (options.sourceMap) { + result.map = output.source_map.toString(); + var url = options.sourceMap.url; + if (url) { + result.code = result.code.replace(/\n\/\/# sourceMappingURL=\S+\s*$/, ""); + if (url == "inline") { + result.code += "\n//# sourceMappingURL=data:application/json;charset=utf-8;base64," + to_base64(result.map); + } else { + result.code += "\n//# sourceMappingURL=" + url; + } + } + } + } + if (options.nameCache && options.mangle) { + if (options.mangle.cache) options.nameCache.vars = to_json(options.mangle.cache); + if (options.mangle.properties && options.mangle.properties.cache) { + options.nameCache.props = to_json(options.mangle.properties.cache); + } + } + if (timings) { + timings.end = Date.now(); + result.timings = { + parse: 1e-3 * (timings.rename - timings.parse), + rename: 1e-3 * (timings.compress - timings.rename), + compress: 1e-3 * (timings.scope - timings.compress), + scope: 1e-3 * (timings.mangle - timings.scope), + mangle: 1e-3 * (timings.properties - timings.mangle), + properties: 1e-3 * (timings.output - timings.properties), + output: 1e-3 * (timings.end - timings.output), + total: 1e-3 * (timings.end - timings.start) + }; + } + if (warnings.length) { + result.warnings = warnings; + } + return result; + } catch (ex) { + return { error: ex }; + } finally { + AST_Node.log_function(); + AST_Node.disable_validation(); + } +} diff --git a/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/mozilla-ast.js b/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/mozilla-ast.js new file mode 100644 index 00000000..3e0534c8 --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/mozilla-ast.js @@ -0,0 +1,1310 @@ +/*********************************************************************** + + A JavaScript tokenizer / parser / beautifier / compressor. + https://github.com/mishoo/UglifyJS + + -------------------------------- (C) --------------------------------- + + Author: Mihai Bazon + + http://mihai.bazon.net/blog + + Distributed under the BSD license: + + Copyright 2012 (c) Mihai Bazon + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + ***********************************************************************/ + +"use strict"; + +(function() { + var MOZ_TO_ME = { + Program: function(M) { + return new AST_Toplevel({ + start: my_start_token(M), + end: my_end_token(M), + body: normalize_directives(M.body.map(from_moz)), + }); + }, + ArrowFunctionExpression: function(M) { + var argnames = [], rest = null; + M.params.forEach(function(param) { + if (param.type == "RestElement") { + rest = from_moz(param.argument); + } else { + argnames.push(from_moz(param)); + } + }); + var fn = new (M.async ? AST_AsyncArrow : AST_Arrow)({ + start: my_start_token(M), + end: my_end_token(M), + argnames: argnames, + rest: rest, + }); + var node = from_moz(M.body); + if (node instanceof AST_BlockStatement) { + fn.body = normalize_directives(node.body); + fn.value = null; + } else { + fn.body = []; + fn.value = node; + } + return fn; + }, + FunctionDeclaration: function(M) { + var ctor; + if (M.async) { + ctor = M.generator ? AST_AsyncGeneratorDefun : AST_AsyncDefun; + } else { + ctor = M.generator ? AST_GeneratorDefun : AST_Defun; + } + var argnames = [], rest = null; + M.params.forEach(function(param) { + if (param.type == "RestElement") { + rest = from_moz(param.argument); + } else { + argnames.push(from_moz(param)); + } + }); + return new ctor({ + start: my_start_token(M), + end: my_end_token(M), + name: from_moz(M.id), + argnames: argnames, + rest: rest, + body: normalize_directives(from_moz(M.body).body), + }); + }, + FunctionExpression: function(M) { + var ctor; + if (M.async) { + ctor = M.generator ? AST_AsyncGeneratorFunction : AST_AsyncFunction; + } else { + ctor = M.generator ? AST_GeneratorFunction : AST_Function; + } + var argnames = [], rest = null; + M.params.forEach(function(param) { + if (param.type == "RestElement") { + rest = from_moz(param.argument); + } else { + argnames.push(from_moz(param)); + } + }); + return new ctor({ + start: my_start_token(M), + end: my_end_token(M), + name: from_moz(M.id), + argnames: argnames, + rest: rest, + body: normalize_directives(from_moz(M.body).body), + }); + }, + ClassDeclaration: function(M) { + return new AST_DefClass({ + start: my_start_token(M), + end: my_end_token(M), + name: from_moz(M.id), + extends: from_moz(M.superClass), + properties: M.body.body.map(from_moz), + }); + }, + ClassExpression: function(M) { + return new AST_ClassExpression({ + start: my_start_token(M), + end: my_end_token(M), + name: from_moz(M.id), + extends: from_moz(M.superClass), + properties: M.body.body.map(from_moz), + }); + }, + MethodDefinition: function(M) { + var key = M.key, internal = false; + if (M.computed) { + key = from_moz(key); + } else if (key.type == "PrivateIdentifier") { + internal = true; + key = "#" + key.name; + } else { + key = read_name(key); + } + var ctor = AST_ClassMethod, value = from_moz(M.value); + switch (M.kind) { + case "get": + ctor = AST_ClassGetter; + value = new AST_Accessor(value); + break; + case "set": + ctor = AST_ClassSetter; + value = new AST_Accessor(value); + break; + } + return new ctor({ + start: my_start_token(M), + end: my_end_token(M), + key: key, + private: internal, + static: M.static, + value: value, + }); + }, + PropertyDefinition: function(M) { + var key = M.key, internal = false; + if (M.computed) { + key = from_moz(key); + } else if (key.type == "PrivateIdentifier") { + internal = true; + key = "#" + key.name; + } else { + key = read_name(key); + } + return new AST_ClassField({ + start: my_start_token(M), + end: my_end_token(M), + key: key, + private: internal, + static: M.static, + value: from_moz(M.value), + }); + }, + StaticBlock: function(M) { + var start = my_start_token(M); + var end = my_end_token(M); + return new AST_ClassInit({ + start: start, + end: end, + value: new AST_ClassInitBlock({ + start: start, + end: end, + body: normalize_directives(M.body.map(from_moz)), + }), + }); + }, + ForOfStatement: function(M) { + return new (M.await ? AST_ForAwaitOf : AST_ForOf)({ + start: my_start_token(M), + end: my_end_token(M), + init: from_moz(M.left), + object: from_moz(M.right), + body: from_moz(M.body), + }); + }, + TryStatement: function(M) { + var handlers = M.handlers || [M.handler]; + if (handlers.length > 1 || M.guardedHandlers && M.guardedHandlers.length) { + throw new Error("Multiple catch clauses are not supported."); + } + return new AST_Try({ + start : my_start_token(M), + end : my_end_token(M), + body : from_moz(M.block).body, + bcatch : from_moz(handlers[0]), + bfinally : M.finalizer ? new AST_Finally(from_moz(M.finalizer)) : null, + }); + }, + Property: function(M) { + var key = M.computed ? from_moz(M.key) : read_name(M.key); + var args = { + start: my_start_token(M), + end: my_end_token(M), + key: key, + value: from_moz(M.value), + }; + if (M.kind == "init") return new (M.method ? AST_ObjectMethod : AST_ObjectKeyVal)(args); + args.value = new AST_Accessor(args.value); + if (M.kind == "get") return new AST_ObjectGetter(args); + if (M.kind == "set") return new AST_ObjectSetter(args); + }, + ArrayExpression: function(M) { + return new AST_Array({ + start: my_start_token(M), + end: my_end_token(M), + elements: M.elements.map(function(elem) { + return elem === null ? new AST_Hole() : from_moz(elem); + }), + }); + }, + ArrayPattern: function(M) { + var elements = [], rest = null; + M.elements.forEach(function(el) { + if (el === null) { + elements.push(new AST_Hole()); + } else if (el.type == "RestElement") { + rest = from_moz(el.argument); + } else { + elements.push(from_moz(el)); + } + }); + return new AST_DestructuredArray({ + start: my_start_token(M), + end: my_end_token(M), + elements: elements, + rest: rest, + }); + }, + ObjectPattern: function(M) { + var props = [], rest = null; + M.properties.forEach(function(prop) { + if (prop.type == "RestElement") { + rest = from_moz(prop.argument); + } else { + props.push(new AST_DestructuredKeyVal(from_moz(prop))); + } + }); + return new AST_DestructuredObject({ + start: my_start_token(M), + end: my_end_token(M), + properties: props, + rest: rest, + }); + }, + MemberExpression: function(M) { + return new (M.computed ? AST_Sub : AST_Dot)({ + start: my_start_token(M), + end: my_end_token(M), + optional: M.optional, + expression: from_moz(M.object), + property: M.computed ? from_moz(M.property) : M.property.name, + }); + }, + MetaProperty: function(M) { + var expr = from_moz(M.meta); + var prop = read_name(M.property); + if (expr.name == "new" && prop == "target") return new AST_NewTarget({ + start: my_start_token(M), + end: my_end_token(M), + name: "new.target", + }); + return new AST_Dot({ + start: my_start_token(M), + end: my_end_token(M), + expression: expr, + property: prop, + }); + }, + SwitchCase: function(M) { + return new (M.test ? AST_Case : AST_Default)({ + start : my_start_token(M), + end : my_end_token(M), + expression : from_moz(M.test), + body : M.consequent.map(from_moz), + }); + }, + ExportAllDeclaration: function(M) { + var start = my_start_token(M); + var end = my_end_token(M); + return new AST_ExportForeign({ + start: start, + end: end, + aliases: [ M.exported ? from_moz_alias(M.exported) : new AST_String({ + start: start, + value: "*", + end: end, + }) ], + keys: [ new AST_String({ + start: start, + value: "*", + end: end, + }) ], + path: from_moz(M.source), + }); + }, + ExportDefaultDeclaration: function(M) { + var decl = from_moz(M.declaration); + if (!decl.name) switch (decl.CTOR) { + case AST_AsyncDefun: + decl = new AST_AsyncFunction(decl); + break; + case AST_AsyncGeneratorDefun: + decl = new AST_AsyncGeneratorFunction(decl); + break; + case AST_DefClass: + decl = new AST_ClassExpression(decl); + break; + case AST_Defun: + decl = new AST_Function(decl); + break; + case AST_GeneratorDefun: + decl = new AST_GeneratorFunction(decl); + break; + } + return new AST_ExportDefault({ + start: my_start_token(M), + end: my_end_token(M), + body: decl, + }); + }, + ExportNamedDeclaration: function(M) { + if (M.declaration) return new AST_ExportDeclaration({ + start: my_start_token(M), + end: my_end_token(M), + body: from_moz(M.declaration), + }); + if (M.source) { + var aliases = [], keys = []; + M.specifiers.forEach(function(prop) { + aliases.push(from_moz_alias(prop.exported)); + keys.push(from_moz_alias(prop.local)); + }); + return new AST_ExportForeign({ + start: my_start_token(M), + end: my_end_token(M), + aliases: aliases, + keys: keys, + path: from_moz(M.source), + }); + } + return new AST_ExportReferences({ + start: my_start_token(M), + end: my_end_token(M), + properties: M.specifiers.map(function(prop) { + var sym = new AST_SymbolExport(from_moz(prop.local)); + sym.alias = from_moz_alias(prop.exported); + return sym; + }), + }); + }, + ImportDeclaration: function(M) { + var start = my_start_token(M); + var end = my_end_token(M); + var all = null, def = null, props = null; + M.specifiers.forEach(function(prop) { + var sym = new AST_SymbolImport(from_moz(prop.local)); + switch (prop.type) { + case "ImportDefaultSpecifier": + def = sym; + def.key = new AST_String({ + start: start, + value: "", + end: end, + }); + break; + case "ImportNamespaceSpecifier": + all = sym; + all.key = new AST_String({ + start: start, + value: "*", + end: end, + }); + break; + default: + sym.key = from_moz_alias(prop.imported); + if (!props) props = []; + props.push(sym); + break; + } + }); + return new AST_Import({ + start: start, + end: end, + all: all, + default: def, + properties: props, + path: from_moz(M.source), + }); + }, + ImportExpression: function(M) { + var start = my_start_token(M); + var arg = from_moz(M.source); + return new AST_Call({ + start: start, + end: my_end_token(M), + expression: new AST_SymbolRef({ + start: start, + end: arg.start, + name: "import", + }), + args: [ arg ], + }); + }, + VariableDeclaration: function(M) { + return new ({ + const: AST_Const, + let: AST_Let, + }[M.kind] || AST_Var)({ + start: my_start_token(M), + end: my_end_token(M), + definitions: M.declarations.map(from_moz), + }); + }, + Literal: function(M) { + var args = { + start: my_start_token(M), + end: my_end_token(M), + }; + if (M.bigint) { + args.value = M.bigint.toLowerCase() + "n"; + return new AST_BigInt(args); + } + var val = M.value; + if (val === null) return new AST_Null(args); + var rx = M.regex; + if (rx && rx.pattern) { + // RegExpLiteral as per ESTree AST spec + args.value = new RegExp(rx.pattern, rx.flags); + args.value.raw_source = rx.pattern; + return new AST_RegExp(args); + } else if (rx) { + // support legacy RegExp + args.value = M.regex && M.raw ? M.raw : val; + return new AST_RegExp(args); + } + switch (typeof val) { + case "string": + args.value = val; + return new AST_String(args); + case "number": + if (isNaN(val)) return new AST_NaN(args); + var negate, node; + if (isFinite(val)) { + negate = 1 / val < 0; + args.value = negate ? -val : val; + node = new AST_Number(args); + } else { + negate = val < 0; + node = new AST_Infinity(args); + } + return negate ? new AST_UnaryPrefix({ + start: args.start, + end: args.end, + operator: "-", + expression: node, + }) : node; + case "boolean": + return new (val ? AST_True : AST_False)(args); + } + }, + TemplateLiteral: function(M) { + return new AST_Template({ + start: my_start_token(M), + end: my_end_token(M), + expressions: M.expressions.map(from_moz), + strings: M.quasis.map(function(el) { + return el.value.raw; + }), + }); + }, + TaggedTemplateExpression: function(M) { + var tmpl = from_moz(M.quasi); + tmpl.start = my_start_token(M); + tmpl.end = my_end_token(M); + tmpl.tag = from_moz(M.tag); + return tmpl; + }, + Identifier: function(M) { + var p, level = FROM_MOZ_STACK.length - 1; + do { + p = FROM_MOZ_STACK[--level]; + } while (p.type == "ArrayPattern" + || p.type == "AssignmentPattern" && p.left === FROM_MOZ_STACK[level + 1] + || p.type == "ObjectPattern" + || p.type == "Property" && p.value === FROM_MOZ_STACK[level + 1] + || p.type == "VariableDeclarator" && p.id === FROM_MOZ_STACK[level + 1]); + var ctor = AST_SymbolRef; + switch (p.type) { + case "ArrowFunctionExpression": + if (p.body !== FROM_MOZ_STACK[level + 1]) ctor = AST_SymbolFunarg; + break; + case "BreakStatement": + case "ContinueStatement": + ctor = AST_LabelRef; + break; + case "CatchClause": + ctor = AST_SymbolCatch; + break; + case "ClassDeclaration": + if (p.id === FROM_MOZ_STACK[level + 1]) ctor = AST_SymbolDefClass; + break; + case "ClassExpression": + if (p.id === FROM_MOZ_STACK[level + 1]) ctor = AST_SymbolClass; + break; + case "FunctionDeclaration": + ctor = p.id === FROM_MOZ_STACK[level + 1] ? AST_SymbolDefun : AST_SymbolFunarg; + break; + case "FunctionExpression": + ctor = p.id === FROM_MOZ_STACK[level + 1] ? AST_SymbolLambda : AST_SymbolFunarg; + break; + case "LabeledStatement": + ctor = AST_Label; + break; + case "VariableDeclaration": + ctor = { + const: AST_SymbolConst, + let: AST_SymbolLet, + }[p.kind] || AST_SymbolVar; + break; + } + return new ctor({ + start: my_start_token(M), + end: my_end_token(M), + name: M.name, + }); + }, + Super: function(M) { + return new AST_Super({ + start: my_start_token(M), + end: my_end_token(M), + name: "super", + }); + }, + ThisExpression: function(M) { + return new AST_This({ + start: my_start_token(M), + end: my_end_token(M), + name: "this", + }); + }, + ParenthesizedExpression: function(M) { + var node = from_moz(M.expression); + if (!node.start.parens) node.start.parens = []; + node.start.parens.push(my_start_token(M)); + if (!node.end.parens) node.end.parens = []; + node.end.parens.push(my_end_token(M)); + return node; + }, + ChainExpression: function(M) { + var node = from_moz(M.expression); + node.terminal = true; + return node; + }, + }; + + MOZ_TO_ME.UpdateExpression = + MOZ_TO_ME.UnaryExpression = function To_Moz_Unary(M) { + var prefix = "prefix" in M ? M.prefix + : M.type == "UnaryExpression" ? true : false; + return new (prefix ? AST_UnaryPrefix : AST_UnaryPostfix)({ + start : my_start_token(M), + end : my_end_token(M), + operator : M.operator, + expression : from_moz(M.argument) + }); + }; + + map("EmptyStatement", AST_EmptyStatement); + map("ExpressionStatement", AST_SimpleStatement, "expression>body"); + map("BlockStatement", AST_BlockStatement, "body@body"); + map("IfStatement", AST_If, "test>condition, consequent>body, alternate>alternative"); + map("LabeledStatement", AST_LabeledStatement, "label>label, body>body"); + map("BreakStatement", AST_Break, "label>label"); + map("ContinueStatement", AST_Continue, "label>label"); + map("WithStatement", AST_With, "object>expression, body>body"); + map("SwitchStatement", AST_Switch, "discriminant>expression, cases@body"); + map("ReturnStatement", AST_Return, "argument>value"); + map("ThrowStatement", AST_Throw, "argument>value"); + map("WhileStatement", AST_While, "test>condition, body>body"); + map("DoWhileStatement", AST_Do, "test>condition, body>body"); + map("ForStatement", AST_For, "init>init, test>condition, update>step, body>body"); + map("ForInStatement", AST_ForIn, "left>init, right>object, body>body"); + map("DebuggerStatement", AST_Debugger); + map("VariableDeclarator", AST_VarDef, "id>name, init>value"); + map("CatchClause", AST_Catch, "param>argname, body%body"); + + map("BinaryExpression", AST_Binary, "operator=operator, left>left, right>right"); + map("LogicalExpression", AST_Binary, "operator=operator, left>left, right>right"); + map("AssignmentExpression", AST_Assign, "operator=operator, left>left, right>right"); + map("AssignmentPattern", AST_DefaultValue, "left>name, right>value"); + map("ConditionalExpression", AST_Conditional, "test>condition, consequent>consequent, alternate>alternative"); + map("NewExpression", AST_New, "callee>expression, arguments@args, pure=pure"); + map("CallExpression", AST_Call, "callee>expression, arguments@args, optional=optional, pure=pure"); + map("SequenceExpression", AST_Sequence, "expressions@expressions"); + map("SpreadElement", AST_Spread, "argument>expression"); + map("ObjectExpression", AST_Object, "properties@properties"); + map("AwaitExpression", AST_Await, "argument>expression"); + map("YieldExpression", AST_Yield, "argument>expression, delegate=nested"); + + def_to_moz(AST_Toplevel, function To_Moz_Program(M) { + return to_moz_scope("Program", M); + }); + + def_to_moz(AST_LambdaDefinition, function To_Moz_FunctionDeclaration(M) { + var params = M.argnames.map(to_moz); + if (M.rest) params.push({ + type: "RestElement", + argument: to_moz(M.rest), + }); + return { + type: "FunctionDeclaration", + id: to_moz(M.name), + async: is_async(M), + generator: is_generator(M), + params: params, + body: to_moz_scope("BlockStatement", M), + }; + }); + + def_to_moz(AST_Lambda, function To_Moz_FunctionExpression(M) { + var params = M.argnames.map(to_moz); + if (M.rest) params.push({ + type: "RestElement", + argument: to_moz(M.rest), + }); + if (is_arrow(M)) return { + type: "ArrowFunctionExpression", + async: is_async(M), + params: params, + body: M.value ? to_moz(M.value) : to_moz_scope("BlockStatement", M), + }; + return { + type: "FunctionExpression", + id: to_moz(M.name), + async: is_async(M), + generator: is_generator(M), + params: params, + body: to_moz_scope("BlockStatement", M), + }; + }); + + def_to_moz(AST_DefClass, function To_Moz_ClassDeclaration(M) { + return { + type: "ClassDeclaration", + id: to_moz(M.name), + superClass: to_moz(M.extends), + body: { + type: "ClassBody", + body: M.properties.map(to_moz), + }, + }; + }); + + def_to_moz(AST_ClassExpression, function To_Moz_ClassExpression(M) { + return { + type: "ClassExpression", + id: to_moz(M.name), + superClass: to_moz(M.extends), + body: { + type: "ClassBody", + body: M.properties.map(to_moz), + }, + }; + }); + + function To_Moz_MethodDefinition(kind) { + return function(M) { + var computed = M.key instanceof AST_Node; + var key = computed ? to_moz(M.key) : M.private ? { + type: "PrivateIdentifier", + name: M.key.slice(1), + } : { + type: "Literal", + value: M.key, + }; + return { + type: "MethodDefinition", + kind: kind, + computed: computed, + key: key, + static: M.static, + value: to_moz(M.value), + }; + }; + } + def_to_moz(AST_ClassGetter, To_Moz_MethodDefinition("get")); + def_to_moz(AST_ClassSetter, To_Moz_MethodDefinition("set")); + def_to_moz(AST_ClassMethod, To_Moz_MethodDefinition("method")); + + def_to_moz(AST_ClassField, function To_Moz_PropertyDefinition(M) { + var computed = M.key instanceof AST_Node; + var key = computed ? to_moz(M.key) : M.private ? { + type: "PrivateIdentifier", + name: M.key.slice(1), + } : { + type: "Literal", + value: M.key, + }; + return { + type: "PropertyDefinition", + computed: computed, + key: key, + static: M.static, + value: to_moz(M.value), + }; + }); + + def_to_moz(AST_ClassInit, function To_Moz_StaticBlock(M) { + return to_moz_scope("StaticBlock", M.value); + }); + + function To_Moz_ForOfStatement(is_await) { + return function(M) { + return { + type: "ForOfStatement", + await: is_await, + left: to_moz(M.init), + right: to_moz(M.object), + body: to_moz(M.body), + }; + }; + } + def_to_moz(AST_ForAwaitOf, To_Moz_ForOfStatement(true)); + def_to_moz(AST_ForOf, To_Moz_ForOfStatement(false)); + + def_to_moz(AST_Directive, function To_Moz_Directive(M) { + return { + type: "ExpressionStatement", + expression: set_moz_loc(M, { + type: "Literal", + value: M.value, + }), + }; + }); + + def_to_moz(AST_SwitchBranch, function To_Moz_SwitchCase(M) { + return { + type: "SwitchCase", + test: to_moz(M.expression), + consequent: M.body.map(to_moz), + }; + }); + + def_to_moz(AST_Try, function To_Moz_TryStatement(M) { + return { + type: "TryStatement", + block: to_moz_block(M), + handler: to_moz(M.bcatch), + guardedHandlers: [], + finalizer: to_moz(M.bfinally), + }; + }); + + def_to_moz(AST_Catch, function To_Moz_CatchClause(M) { + return { + type: "CatchClause", + param: to_moz(M.argname), + guard: null, + body: to_moz_block(M), + }; + }); + + def_to_moz(AST_ExportDeclaration, function To_Moz_ExportNamedDeclaration_declaration(M) { + return { + type: "ExportNamedDeclaration", + declaration: to_moz(M.body), + }; + }); + + def_to_moz(AST_ExportDefault, function To_Moz_ExportDefaultDeclaration(M) { + return { + type: "ExportDefaultDeclaration", + declaration: to_moz(M.body), + }; + }); + + def_to_moz(AST_ExportForeign, function To_Moz_ExportAllDeclaration_ExportNamedDeclaration(M) { + if (M.keys[0].value == "*") return { + type: "ExportAllDeclaration", + exported: M.aliases[0].value == "*" ? null : to_moz_alias(M.aliases[0]), + source: to_moz(M.path), + }; + var specifiers = []; + for (var i = 0; i < M.aliases.length; i++) { + specifiers.push(set_moz_loc({ + start: M.keys[i].start, + end: M.aliases[i].end, + }, { + type: "ExportSpecifier", + local: to_moz_alias(M.keys[i]), + exported: to_moz_alias(M.aliases[i]), + })); + } + return { + type: "ExportNamedDeclaration", + specifiers: specifiers, + source: to_moz(M.path), + }; + }); + + def_to_moz(AST_ExportReferences, function To_Moz_ExportNamedDeclaration_specifiers(M) { + return { + type: "ExportNamedDeclaration", + specifiers: M.properties.map(function(prop) { + return set_moz_loc({ + start: prop.start, + end: prop.alias.end, + }, { + type: "ExportSpecifier", + local: to_moz(prop), + exported: to_moz_alias(prop.alias), + }); + }), + }; + }); + + def_to_moz(AST_Import, function To_Moz_ImportDeclaration(M) { + var specifiers = M.properties ? M.properties.map(function(prop) { + return set_moz_loc({ + start: prop.key.start, + end: prop.end, + }, { + type: "ImportSpecifier", + local: to_moz(prop), + imported: to_moz_alias(prop.key), + }); + }) : []; + if (M.all) specifiers.unshift(set_moz_loc(M.all, { + type: "ImportNamespaceSpecifier", + local: to_moz(M.all), + })); + if (M.default) specifiers.unshift(set_moz_loc(M.default, { + type: "ImportDefaultSpecifier", + local: to_moz(M.default), + })); + return { + type: "ImportDeclaration", + specifiers: specifiers, + source: to_moz(M.path), + }; + }); + + def_to_moz(AST_Definitions, function To_Moz_VariableDeclaration(M) { + return { + type: "VariableDeclaration", + kind: M.TYPE.toLowerCase(), + declarations: M.definitions.map(to_moz), + }; + }); + + def_to_moz(AST_PropAccess, function To_Moz_MemberExpression(M) { + var computed = M instanceof AST_Sub; + var expr = { + type: "MemberExpression", + object: to_moz(M.expression), + computed: computed, + optional: M.optional, + property: computed ? to_moz(M.property) : { + type: "Identifier", + name: M.property, + }, + }; + return M.terminal ? { + type: "ChainExpression", + expression: expr, + } : expr; + }); + + def_to_moz(AST_Unary, function To_Moz_Unary(M) { + return { + type: M.operator == "++" || M.operator == "--" ? "UpdateExpression" : "UnaryExpression", + operator: M.operator, + prefix: M instanceof AST_UnaryPrefix, + argument: to_moz(M.expression) + }; + }); + + def_to_moz(AST_Binary, function To_Moz_BinaryExpression(M) { + return { + type: M.operator == "&&" || M.operator == "||" ? "LogicalExpression" : "BinaryExpression", + left: to_moz(M.left), + operator: M.operator, + right: to_moz(M.right) + }; + }); + + def_to_moz(AST_Array, function To_Moz_ArrayExpression(M) { + return { + type: "ArrayExpression", + elements: M.elements.map(to_moz), + }; + }); + + def_to_moz(AST_DestructuredArray, function To_Moz_ArrayPattern(M) { + var elements = M.elements.map(to_moz); + if (M.rest) elements.push({ + type: "RestElement", + argument: to_moz(M.rest), + }); + return { + type: "ArrayPattern", + elements: elements, + }; + }); + + def_to_moz(AST_DestructuredKeyVal, function To_Moz_Property(M) { + var computed = M.key instanceof AST_Node; + var key = computed ? to_moz(M.key) : { + type: "Literal", + value: M.key, + }; + return { + type: "Property", + kind: "init", + computed: computed, + key: key, + value: to_moz(M.value), + }; + }); + + def_to_moz(AST_DestructuredObject, function To_Moz_ObjectPattern(M) { + var props = M.properties.map(to_moz); + if (M.rest) props.push({ + type: "RestElement", + argument: to_moz(M.rest), + }); + return { + type: "ObjectPattern", + properties: props, + }; + }); + + def_to_moz(AST_ObjectProperty, function To_Moz_Property(M) { + var computed = M.key instanceof AST_Node; + var key = computed ? to_moz(M.key) : { + type: "Literal", + value: M.key, + }; + var kind; + if (M instanceof AST_ObjectKeyVal) { + kind = "init"; + } else if (M instanceof AST_ObjectGetter) { + kind = "get"; + } else if (M instanceof AST_ObjectSetter) { + kind = "set"; + } + return { + type: "Property", + kind: kind, + computed: computed, + method: M instanceof AST_ObjectMethod, + key: key, + value: to_moz(M.value), + }; + }); + + def_to_moz(AST_Symbol, function To_Moz_Identifier(M) { + var def = M.definition(); + return { + type: "Identifier", + name: def && def.mangled_name || M.name, + }; + }); + + def_to_moz(AST_Super, function To_Moz_Super() { + return { type: "Super" }; + }); + + def_to_moz(AST_This, function To_Moz_ThisExpression() { + return { type: "ThisExpression" }; + }); + + def_to_moz(AST_NewTarget, function To_Moz_MetaProperty() { + return { + type: "MetaProperty", + meta: { + type: "Identifier", + name: "new", + }, + property: { + type: "Identifier", + name: "target", + }, + }; + }); + + def_to_moz(AST_RegExp, function To_Moz_RegExpLiteral(M) { + var flags = M.value.toString().match(/\/([gimuy]*)$/)[1]; + var value = "/" + M.value.raw_source + "/" + flags; + return { + type: "Literal", + value: value, + raw: value, + regex: { + pattern: M.value.raw_source, + flags: flags, + }, + }; + }); + + def_to_moz(AST_BigInt, function To_Moz_BigInt(M) { + var value = M.value; + return { + type: "Literal", + bigint: value.slice(0, -1), + raw: value, + }; + }); + + function To_Moz_Literal(M) { + var value = M.value; + if (typeof value === "number" && (value < 0 || (value === 0 && 1 / value < 0))) { + return { + type: "UnaryExpression", + operator: "-", + prefix: true, + argument: { + type: "Literal", + value: -value, + raw: M.start.raw, + }, + }; + } + return { + type: "Literal", + value: value, + raw: M.start.raw, + }; + } + def_to_moz(AST_Boolean, To_Moz_Literal); + def_to_moz(AST_Constant, To_Moz_Literal); + def_to_moz(AST_Null, To_Moz_Literal); + + def_to_moz(AST_Atom, function To_Moz_Atom(M) { + return { + type: "Identifier", + name: String(M.value), + }; + }); + + def_to_moz(AST_Template, function To_Moz_TemplateLiteral_TaggedTemplateExpression(M) { + var last = M.strings.length - 1; + var tmpl = { + type: "TemplateLiteral", + expressions: M.expressions.map(to_moz), + quasis: M.strings.map(function(str, index) { + return { + type: "TemplateElement", + tail: index == last, + value: { raw: str }, + }; + }), + }; + if (!M.tag) return tmpl; + return { + type: "TaggedTemplateExpression", + tag: to_moz(M.tag), + quasi: tmpl, + }; + }); + + AST_Block.DEFMETHOD("to_mozilla_ast", AST_BlockStatement.prototype.to_mozilla_ast); + AST_Hole.DEFMETHOD("to_mozilla_ast", return_null); + AST_Node.DEFMETHOD("to_mozilla_ast", function() { + throw new Error("Cannot convert AST_" + this.TYPE); + }); + + /* -----[ tools ]----- */ + + function normalize_directives(body) { + for (var i = 0; i < body.length; i++) { + var stat = body[i]; + if (!(stat instanceof AST_SimpleStatement)) break; + var node = stat.body; + if (!(node instanceof AST_String)) break; + if (stat.start.pos !== node.start.pos) break; + body[i] = new AST_Directive(node); + } + return body; + } + + function raw_token(moznode) { + if (moznode.type == "Literal") { + return moznode.raw != null ? moznode.raw : moznode.value + ""; + } + } + + function my_start_token(moznode) { + var loc = moznode.loc, start = loc && loc.start; + var range = moznode.range; + return new AST_Token({ + file : loc && loc.source, + line : start && start.line, + col : start && start.column, + pos : range ? range[0] : moznode.start, + endline : start && start.line, + endcol : start && start.column, + endpos : range ? range[0] : moznode.start, + raw : raw_token(moznode), + }); + } + + function my_end_token(moznode) { + var loc = moznode.loc, end = loc && loc.end; + var range = moznode.range; + return new AST_Token({ + file : loc && loc.source, + line : end && end.line, + col : end && end.column, + pos : range ? range[1] : moznode.end, + endline : end && end.line, + endcol : end && end.column, + endpos : range ? range[1] : moznode.end, + raw : raw_token(moznode), + }); + } + + function read_name(M) { + return "" + M[M.type == "Identifier" ? "name" : "value"]; + } + + function map(moztype, mytype, propmap) { + var moz_to_me = [ + "start: my_start_token(M)", + "end: my_end_token(M)", + ]; + var me_to_moz = [ + "type: " + JSON.stringify(moztype), + ]; + + if (propmap) propmap.split(/\s*,\s*/).forEach(function(prop) { + var m = /([a-z0-9$_]+)(=|@|>|%)([a-z0-9$_]+)/i.exec(prop); + if (!m) throw new Error("Can't understand property map: " + prop); + var moz = m[1], how = m[2], my = m[3]; + switch (how) { + case "@": + moz_to_me.push(my + ": M." + moz + ".map(from_moz)"); + me_to_moz.push(moz + ": M." + my + ".map(to_moz)"); + break; + case ">": + moz_to_me.push(my + ": from_moz(M." + moz + ")"); + me_to_moz.push(moz + ": to_moz(M." + my + ")"); + break; + case "=": + moz_to_me.push(my + ": M." + moz); + me_to_moz.push(moz + ": M." + my); + break; + case "%": + moz_to_me.push(my + ": from_moz(M." + moz + ").body"); + me_to_moz.push(moz + ": to_moz_block(M)"); + break; + default: + throw new Error("Can't understand operator in propmap: " + prop); + } + }); + + MOZ_TO_ME[moztype] = new Function("U2", "my_start_token", "my_end_token", "from_moz", [ + "return function From_Moz_" + moztype + "(M) {", + " return new U2.AST_" + mytype.TYPE + "({", + moz_to_me.join(",\n"), + " });", + "};", + ].join("\n"))(exports, my_start_token, my_end_token, from_moz); + def_to_moz(mytype, new Function("to_moz", "to_moz_block", "to_moz_scope", [ + "return function To_Moz_" + moztype + "(M) {", + " return {", + me_to_moz.join(",\n"), + " };", + "};", + ].join("\n"))(to_moz, to_moz_block, to_moz_scope)); + } + + var FROM_MOZ_STACK = null; + + function from_moz(moz) { + FROM_MOZ_STACK.push(moz); + var node = null; + if (moz) { + if (!HOP(MOZ_TO_ME, moz.type)) throw new Error("Unsupported type: " + moz.type); + node = MOZ_TO_ME[moz.type](moz); + } + FROM_MOZ_STACK.pop(); + return node; + } + + function from_moz_alias(moz) { + return new AST_String({ + start: my_start_token(moz), + value: read_name(moz), + end: my_end_token(moz), + }); + } + + AST_Node.from_mozilla_ast = function(node) { + var save_stack = FROM_MOZ_STACK; + FROM_MOZ_STACK = []; + var ast = from_moz(node); + FROM_MOZ_STACK = save_stack; + ast.walk(new TreeWalker(function(node) { + if (node instanceof AST_LabelRef) { + for (var level = 0, parent; parent = this.parent(level); level++) { + if (parent instanceof AST_Scope) break; + if (parent instanceof AST_LabeledStatement && parent.label.name == node.name) { + node.thedef = parent.label; + break; + } + } + if (!node.thedef) { + var s = node.start; + js_error("Undefined label " + node.name, s.file, s.line, s.col, s.pos); + } + } + })); + return ast; + }; + + function set_moz_loc(mynode, moznode) { + var start = mynode.start; + var end = mynode.end; + if (start.pos != null && end.endpos != null) { + moznode.range = [start.pos, end.endpos]; + } + if (start.line) { + moznode.loc = { + start: {line: start.line, column: start.col}, + end: end.endline ? {line: end.endline, column: end.endcol} : null, + }; + if (start.file) { + moznode.loc.source = start.file; + } + } + return moznode; + } + + function def_to_moz(mytype, handler) { + mytype.DEFMETHOD("to_mozilla_ast", function() { + return set_moz_loc(this, handler(this)); + }); + } + + function to_moz(node) { + return node != null ? node.to_mozilla_ast() : null; + } + + function to_moz_alias(alias) { + return is_identifier_string(alias.value) ? set_moz_loc(alias, { + type: "Identifier", + name: alias.value, + }) : to_moz(alias); + } + + function to_moz_block(node) { + return { + type: "BlockStatement", + body: node.body.map(to_moz), + }; + } + + function to_moz_scope(type, node) { + var body = node.body.map(to_moz); + if (node.body[0] instanceof AST_SimpleStatement && node.body[0].body instanceof AST_String) { + body.unshift(to_moz(new AST_EmptyStatement(node.body[0]))); + } + return { + type: type, + body: body, + }; + } +})(); diff --git a/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/output.js b/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/output.js new file mode 100644 index 00000000..7e93d05e --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/output.js @@ -0,0 +1,1956 @@ +/*********************************************************************** + + A JavaScript tokenizer / parser / beautifier / compressor. + https://github.com/mishoo/UglifyJS + + -------------------------------- (C) --------------------------------- + + Author: Mihai Bazon + + http://mihai.bazon.net/blog + + Distributed under the BSD license: + + Copyright 2012 (c) Mihai Bazon + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + ***********************************************************************/ + +"use strict"; + +function is_some_comments(comment) { + // multiline comment + return comment.type == "comment2" && /@preserve|@license|@cc_on/i.test(comment.value); +} + +function OutputStream(options) { + options = defaults(options, { + annotations : false, + ascii_only : false, + beautify : false, + braces : false, + comments : false, + extendscript : false, + galio : false, + ie : false, + indent_level : 4, + indent_start : 0, + inline_script : true, + keep_quoted_props: false, + max_line_len : false, + preamble : null, + preserve_line : false, + quote_keys : false, + quote_style : 0, + semicolons : true, + shebang : true, + source_map : null, + v8 : false, + webkit : false, + width : 80, + wrap_iife : false, + }, true); + + // Convert comment option to RegExp if necessary and set up comments filter + var comment_filter = return_false; // Default case, throw all comments away + if (options.comments) { + var comments = options.comments; + if (typeof options.comments === "string" && /^\/.*\/[a-zA-Z]*$/.test(options.comments)) { + var regex_pos = options.comments.lastIndexOf("/"); + comments = new RegExp( + options.comments.substr(1, regex_pos - 1), + options.comments.substr(regex_pos + 1) + ); + } + if (comments instanceof RegExp) { + comment_filter = function(comment) { + return comment.type != "comment5" && comments.test(comment.value); + }; + } else if (typeof comments === "function") { + comment_filter = function(comment) { + return comment.type != "comment5" && comments(this, comment); + }; + } else if (comments === "some") { + comment_filter = is_some_comments; + } else { // NOTE includes "all" option + comment_filter = return_true; + } + } + + function make_indent(value) { + if (typeof value == "number") return new Array(value + 1).join(" "); + if (!value) return ""; + if (!/^\s*$/.test(value)) throw new Error("unsupported indentation: " + JSON.stringify("" + value)); + return value; + } + + var current_col = 0; + var current_line = 1; + var current_indent = make_indent(options.indent_start); + var full_indent = make_indent(options.indent_level); + var half_indent = full_indent.length + 1 >> 1; + var last; + var line_end = 0; + var line_fixed = true; + var mappings = options.source_map && []; + var mapping_name; + var mapping_token; + var might_need_space; + var might_need_semicolon; + var need_newline_indented = false; + var need_space = false; + var output; + var stack; + var stored = ""; + + function reset() { + last = ""; + might_need_space = false; + might_need_semicolon = false; + stack = []; + var str = output; + output = ""; + return str; + } + + reset(); + var to_utf8 = options.ascii_only ? function(str, identifier) { + if (identifier) str = str.replace(/[\ud800-\udbff][\udc00-\udfff]/g, function(ch) { + return "\\u{" + (ch.charCodeAt(0) - 0xd7c0 << 10 | ch.charCodeAt(1) - 0xdc00).toString(16) + "}"; + }); + return str.replace(/[\u0000-\u001f\u007f-\uffff]/g, function(ch) { + var code = ch.charCodeAt(0).toString(16); + if (code.length <= 2 && !identifier) { + while (code.length < 2) code = "0" + code; + return "\\x" + code; + } else { + while (code.length < 4) code = "0" + code; + return "\\u" + code; + } + }); + } : function(str) { + var s = ""; + for (var i = 0, j = 0; i < str.length; i++) { + var code = str.charCodeAt(i); + if (is_surrogate_pair_head(code)) { + if (is_surrogate_pair_tail(str.charCodeAt(i + 1))) { + i++; + continue; + } + } else if (!is_surrogate_pair_tail(code)) { + continue; + } + s += str.slice(j, i) + "\\u" + code.toString(16); + j = i + 1; + } + return j == 0 ? str : s + str.slice(j); + }; + + function quote_single(str) { + return "'" + str.replace(/\x27/g, "\\'") + "'"; + } + + function quote_double(str) { + return '"' + str.replace(/\x22/g, '\\"') + '"'; + } + + var quote_string = [ + null, + quote_single, + quote_double, + function(str, quote) { + return quote == "'" ? quote_single(str) : quote_double(str); + }, + ][options.quote_style] || function(str, quote, dq, sq) { + return dq > sq ? quote_single(str) : quote_double(str); + }; + + function make_string(str, quote) { + var dq = 0, sq = 0; + str = str.replace(/[\\\b\f\n\r\v\t\x22\x27\u2028\u2029\0\ufeff]/g, function(s, i) { + switch (s) { + case '"': ++dq; return '"'; + case "'": ++sq; return "'"; + case "\\": return "\\\\"; + case "\n": return "\\n"; + case "\r": return "\\r"; + case "\t": return "\\t"; + case "\b": return "\\b"; + case "\f": return "\\f"; + case "\x0B": return options.ie ? "\\x0B" : "\\v"; + case "\u2028": return "\\u2028"; + case "\u2029": return "\\u2029"; + case "\ufeff": return "\\ufeff"; + case "\0": + return /[0-9]/.test(str.charAt(i+1)) ? "\\x00" : "\\0"; + } + return s; + }); + return quote_string(to_utf8(str), quote, dq, sq); + } + + /* -----[ beautification/minification ]----- */ + + var adjust_mappings = mappings ? function(line, col) { + mappings.forEach(function(mapping) { + mapping.line += line; + mapping.col += col; + }); + } : noop; + + var flush_mappings = mappings ? function() { + mappings.forEach(function(mapping) { + options.source_map.add( + mapping.token.file, + mapping.line, mapping.col, + mapping.token.line, mapping.token.col, + !mapping.name && mapping.token.type == "name" ? mapping.token.value : mapping.name + ); + }); + mappings = []; + } : noop; + + function insert_newlines(count) { + stored += output.slice(0, line_end); + output = output.slice(line_end); + var new_col = output.length; + adjust_mappings(count, new_col - current_col); + current_line += count; + current_col = new_col; + while (count--) stored += "\n"; + } + + var fix_line = options.max_line_len ? function(flush) { + if (line_fixed) { + if (current_col > options.max_line_len) { + AST_Node.warn("Output exceeds {max_line_len} characters", options); + } + return; + } + if (current_col > options.max_line_len) { + insert_newlines(1); + line_fixed = true; + } + if (line_fixed || flush) flush_mappings(); + } : noop; + + var require_semicolon = makePredicate("( [ + * / - , ."); + + function require_space(prev, ch, str) { + return is_identifier_char(prev) && (is_identifier_char(ch) || ch == "\\") + || (ch == "/" && ch == prev) + || ((ch == "+" || ch == "-") && ch == last) + || last == "--" && ch == ">" + || last == "!" && str == "--" + || prev == "/" && (str == "in" || str == "instanceof"); + } + + var print = options.beautify + || options.comments + || options.max_line_len + || options.preserve_line + || options.shebang + || !options.semicolons + || options.source_map + || options.width ? function(str) { + var ch = str.charAt(0); + if (need_newline_indented && ch) { + need_newline_indented = false; + if (ch != "\n") { + print("\n"); + indent(); + } + } + if (need_space && ch) { + need_space = false; + if (!/[\s;})]/.test(ch)) { + space(); + } + } + var prev = last.slice(-1); + if (might_need_semicolon) { + might_need_semicolon = false; + if (prev == ":" && ch == "}" || prev != ";" && (!ch || ";}".indexOf(ch) < 0)) { + var need_semicolon = require_semicolon[ch]; + if (need_semicolon || options.semicolons) { + output += ";"; + current_col++; + if (!line_fixed) { + fix_line(); + if (line_fixed && !need_semicolon && output == ";") { + output = ""; + current_col = 0; + } + } + if (line_end == output.length - 1) line_end++; + } else { + fix_line(); + output += "\n"; + current_line++; + current_col = 0; + // reset the semicolon flag, since we didn't print one + // now and might still have to later + if (/^\s+$/.test(str)) might_need_semicolon = true; + } + if (!options.beautify) might_need_space = false; + } + } + + if (might_need_space) { + if (require_space(prev, ch, str)) { + output += " "; + current_col++; + } + if (prev != "<" || str != "!") might_need_space = false; + } + + if (mapping_token) { + mappings.push({ + token: mapping_token, + name: mapping_name, + line: current_line, + col: current_col, + }); + mapping_token = false; + if (line_fixed) flush_mappings(); + } + + output += str; + var a = str.split(/\r?\n/), n = a.length - 1; + current_line += n; + current_col += a[0].length; + if (n > 0) { + fix_line(); + current_col = a[n].length; + } + last = str; + } : function(str) { + var ch = str.charAt(0); + var prev = last.slice(-1); + if (might_need_semicolon) { + might_need_semicolon = false; + if (prev == ":" && ch == "}" || (!ch || ";}".indexOf(ch) < 0) && prev != ";") { + output += ";"; + might_need_space = false; + } + } + if (might_need_space) { + if (require_space(prev, ch, str)) output += " "; + if (prev != "<" || str != "!") might_need_space = false; + } + output += str; + last = str; + }; + + var space = options.beautify ? function() { + print(" "); + } : function() { + might_need_space = true; + }; + + var indent = options.beautify ? function(half) { + if (need_newline_indented) print("\n"); + print(half ? current_indent.slice(0, -half_indent) : current_indent); + } : noop; + + var with_indent = options.beautify ? function(cont) { + var save_indentation = current_indent; + current_indent += full_indent; + cont(); + current_indent = save_indentation; + } : function(cont) { cont() }; + + var may_add_newline = options.max_line_len || options.preserve_line ? function() { + fix_line(); + line_end = output.length; + line_fixed = false; + } : noop; + + var newline = options.beautify ? function() { + print("\n"); + line_end = output.length; + } : may_add_newline; + + var semicolon = options.beautify ? function() { + print(";"); + } : function() { + might_need_semicolon = true; + }; + + function force_semicolon() { + if (might_need_semicolon) print(";"); + print(";"); + } + + function with_block(cont, end) { + print("{"); + newline(); + with_indent(cont); + add_mapping(end); + indent(); + print("}"); + } + + function with_parens(cont) { + print("("); + may_add_newline(); + cont(); + may_add_newline(); + print(")"); + } + + function with_square(cont) { + print("["); + may_add_newline(); + cont(); + may_add_newline(); + print("]"); + } + + function comma() { + may_add_newline(); + print(","); + may_add_newline(); + space(); + } + + function colon() { + print(":"); + space(); + } + + var add_mapping = mappings ? function(token, name) { + mapping_token = token; + mapping_name = name; + } : noop; + + function get() { + if (!line_fixed) fix_line(true); + return stored + output; + } + + function has_nlb() { + return /(^|\n) *$/.test(output); + } + + function pad_comment(token, force) { + if (need_newline_indented) return; + if (token.nlb && (force || !has_nlb())) { + need_newline_indented = true; + } else if (force) { + need_space = true; + } + } + + function print_comment(comment) { + var value = comment.value.replace(/[@#]__PURE__/g, " "); + if (/^\s*$/.test(value) && !/^\s*$/.test(comment.value)) return false; + if (/comment[134]/.test(comment.type)) { + print("//" + value); + need_newline_indented = true; + } else if (comment.type == "comment2") { + print("/*" + value + "*/"); + } + return true; + } + + function should_merge_comments(node, parent) { + if (parent instanceof AST_Binary) return parent.left === node; + if (parent.TYPE == "Call") return parent.expression === node; + if (parent instanceof AST_Conditional) return parent.condition === node; + if (parent instanceof AST_Dot) return parent.expression === node; + if (parent instanceof AST_Exit) return true; + if (parent instanceof AST_Sequence) return parent.expressions[0] === node; + if (parent instanceof AST_Sub) return parent.expression === node; + if (parent instanceof AST_UnaryPostfix) return true; + if (parent instanceof AST_Yield) return true; + } + + function prepend_comments(node) { + var self = this; + var scan; + if (node instanceof AST_Exit) { + scan = node.value; + } else if (node instanceof AST_Yield) { + scan = node.expression; + } + var comments = dump(node); + if (!comments) comments = []; + + if (scan) { + var tw = new TreeWalker(function(node) { + if (!should_merge_comments(node, tw.parent())) return true; + var before = dump(node); + if (before) comments = comments.concat(before); + }); + tw.push(node); + scan.walk(tw); + } + + if (current_line == 1 && current_col == 0) { + if (comments.length > 0 && options.shebang && comments[0].type == "comment5") { + print("#!" + comments.shift().value + "\n"); + indent(); + } + var preamble = options.preamble; + if (preamble) print(preamble.replace(/\r\n?|\u2028|\u2029|(^|\S)\s*$/g, "$1\n")); + } + + comments = comments.filter(comment_filter, node); + var printed = false; + comments.forEach(function(comment, index) { + pad_comment(comment, index); + if (print_comment(comment)) printed = true; + }); + if (printed) pad_comment(node.start, true); + + function dump(node) { + var token = node.start; + if (!token) { + if (!scan) return; + node.start = token = new AST_Token(); + } + var comments = token.comments_before; + if (!comments) { + if (!scan) return; + token.comments_before = comments = []; + } + if (comments._dumped === self) return; + comments._dumped = self; + return comments; + } + } + + function append_comments(node, tail) { + var self = this; + var token = node.end; + if (!token) return; + var comments = token[tail ? "comments_before" : "comments_after"]; + if (!comments || comments._dumped === self) return; + if (!(node instanceof AST_Statement || all(comments, function(c) { + return !/comment[134]/.test(c.type); + }))) return; + comments._dumped = self; + comments.filter(comment_filter, node).forEach(function(comment, index) { + pad_comment(comment, index || !tail); + print_comment(comment); + }); + } + + return { + get : get, + reset : reset, + indent : indent, + should_break : options.beautify && options.width ? function() { + return current_col >= options.width; + } : return_false, + has_parens : function() { return last.slice(-1) == "(" }, + newline : newline, + print : print, + space : space, + comma : comma, + colon : colon, + last : function() { return last }, + semicolon : semicolon, + force_semicolon : force_semicolon, + to_utf8 : to_utf8, + print_name : function(name) { print(to_utf8(name.toString(), true)) }, + print_string : options.inline_script ? function(str, quote) { + str = make_string(str, quote).replace(/<\x2f(script)([>\/\t\n\f\r ])/gi, "<\\/$1$2"); + print(str.replace(/\x3c!--/g, "\\x3c!--").replace(/--\x3e/g, "--\\x3e")); + } : function(str, quote) { + print(make_string(str, quote)); + }, + with_indent : with_indent, + with_block : with_block, + with_parens : with_parens, + with_square : with_square, + add_mapping : add_mapping, + option : function(opt) { return options[opt] }, + prepend_comments: options.comments || options.shebang ? prepend_comments : noop, + append_comments : options.comments ? append_comments : noop, + push_node : function(node) { stack.push(node) }, + pop_node : options.preserve_line ? function() { + var node = stack.pop(); + if (node.start && node.start.line > current_line) { + insert_newlines(node.start.line - current_line); + } + } : function() { + stack.pop(); + }, + parent : function(n) { + return stack[stack.length - 2 - (n || 0)]; + }, + }; +} + +/* -----[ code generators ]----- */ + +(function() { + + /* -----[ utils ]----- */ + + function DEFPRINT(nodetype, generator) { + nodetype.DEFMETHOD("_codegen", generator); + } + + var use_asm = false; + + AST_Node.DEFMETHOD("print", function(stream, force_parens) { + var self = this; + stream.push_node(self); + if (force_parens || self.needs_parens(stream)) { + stream.with_parens(doit); + } else { + doit(); + } + stream.pop_node(); + + function doit() { + stream.prepend_comments(self); + self.add_source_map(stream); + self._codegen(stream); + stream.append_comments(self); + } + }); + var readonly = OutputStream({ + inline_script: false, + shebang: false, + width: false, + }); + AST_Node.DEFMETHOD("print_to_string", function(options) { + if (options) { + var stream = OutputStream(options); + this.print(stream); + return stream.get(); + } + this.print(readonly); + return readonly.reset(); + }); + + /* -----[ PARENTHESES ]----- */ + + function PARENS(nodetype, func) { + nodetype.DEFMETHOD("needs_parens", func); + } + + PARENS(AST_Node, return_false); + + // a function expression needs parens around it when it's provably + // the first token to appear in a statement. + function needs_parens_function(output) { + var p = output.parent(); + if (!output.has_parens() && first_in_statement(output, false, true)) { + // export default function() {} + // export default (function foo() {}); + // export default (function() {})(foo); + // export default (function() {})`foo`; + // export default (function() {}) ? foo : bar; + return this.name || !(p instanceof AST_ExportDefault); + } + if (output.option("webkit") && p instanceof AST_PropAccess && p.expression === this) return true; + if (output.option("wrap_iife") && p instanceof AST_Call && p.expression === this) return true; + } + PARENS(AST_AsyncFunction, needs_parens_function); + PARENS(AST_AsyncGeneratorFunction, needs_parens_function); + PARENS(AST_ClassExpression, needs_parens_function); + PARENS(AST_Function, needs_parens_function); + PARENS(AST_GeneratorFunction, needs_parens_function); + + // same goes for an object literal, because otherwise it would be + // interpreted as a block of code. + function needs_parens_obj(output) { + return !output.has_parens() && first_in_statement(output, true); + } + PARENS(AST_Object, needs_parens_obj); + + function needs_parens_unary(output) { + var p = output.parent(); + // (-x) ** y + if (p instanceof AST_Binary) return p.operator == "**" && p.left === this; + // (await x)(y) + // new (await x) + if (p instanceof AST_Call) return p.expression === this; + // class extends (x++) {} + // class x extends (typeof y) {} + if (p instanceof AST_Class) return true; + // (x++)[y] + // (typeof x).y + // https://github.com/mishoo/UglifyJS/issues/115 + if (p instanceof AST_PropAccess) return p.expression === this; + // (~x)`foo` + if (p instanceof AST_Template) return p.tag === this; + } + PARENS(AST_Await, needs_parens_unary); + PARENS(AST_Unary, needs_parens_unary); + + PARENS(AST_Sequence, function(output) { + var p = output.parent(); + // [ 1, (2, 3), 4 ] ---> [ 1, 3, 4 ] + return p instanceof AST_Array + // () ---> (foo, bar) + || is_arrow(p) && p.value === this + // await (foo, bar) + || p instanceof AST_Await + // 1 + (2, 3) + 4 ---> 8 + || p instanceof AST_Binary + // new (foo, bar) or foo(1, (2, 3), 4) + || p instanceof AST_Call + // class extends (foo, bar) {} + // class foo extends (bar, baz) {} + || p instanceof AST_Class + // class { foo = (bar, baz) } + // class { [(foo, bar)]() {} } + || p instanceof AST_ClassProperty + // (false, true) ? (a = 10, b = 20) : (c = 30) + // ---> 20 (side effect, set a := 10 and b := 20) + || p instanceof AST_Conditional + // [ a = (1, 2) ] = [] ---> a == 2 + || p instanceof AST_DefaultValue + // { [(1, 2)]: foo } = bar + // { 1: (2, foo) } = bar + || p instanceof AST_DestructuredKeyVal + // export default (foo, bar) + || p instanceof AST_ExportDefault + // for (foo of (bar, baz)); + || p instanceof AST_ForOf + // { [(1, 2)]: 3 }[2] ---> 3 + // { foo: (1, 2) }.foo ---> 2 + || p instanceof AST_ObjectProperty + // (1, {foo:2}).foo or (1, {foo:2})["foo"] ---> 2 + || p instanceof AST_PropAccess && p.expression === this + // ...(foo, bar, baz) + || p instanceof AST_Spread + // (foo, bar)`baz` + || p instanceof AST_Template && p.tag === this + // !(foo, bar, baz) + || p instanceof AST_Unary + // var a = (1, 2), b = a + a; ---> b == 4 + || p instanceof AST_VarDef + // yield (foo, bar) + || p instanceof AST_Yield; + }); + + PARENS(AST_Binary, function(output) { + var p = output.parent(); + // await (foo && bar) + if (p instanceof AST_Await) return true; + // this deals with precedence: + // 3 * (2 + 1) + // 3 - (2 - 1) + // (1 ** 2) ** 3 + if (p instanceof AST_Binary) { + var po = p.operator, pp = PRECEDENCE[po]; + var so = this.operator, sp = PRECEDENCE[so]; + return pp > sp + || po == "??" && (so == "&&" || so == "||") + || (pp == sp && this === p[po == "**" ? "left" : "right"]); + } + // (foo && bar)() + if (p instanceof AST_Call) return p.expression === this; + // class extends (foo && bar) {} + // class foo extends (bar || null) {} + if (p instanceof AST_Class) return true; + // (foo && bar)["prop"], (foo && bar).prop + if (p instanceof AST_PropAccess) return p.expression === this; + // (foo && bar)`` + if (p instanceof AST_Template) return p.tag === this; + // typeof (foo && bar) + if (p instanceof AST_Unary) return true; + }); + + function need_chain_parens(node, parent) { + if (!node.terminal) return false; + if (!(parent instanceof AST_Call || parent instanceof AST_PropAccess)) return false; + return parent.expression === node; + } + + PARENS(AST_PropAccess, function(output) { + var node = this; + var p = output.parent(); + // i.e. new (foo().bar) + // + // if there's one call into this subtree, then we need + // parens around it too, otherwise the call will be + // interpreted as passing the arguments to the upper New + // expression. + if (p instanceof AST_New && p.expression === node && root_expr(node).TYPE == "Call") return true; + // (foo?.bar)() + // (foo?.bar).baz + // new (foo?.bar)() + return need_chain_parens(node, p); + }); + + PARENS(AST_Call, function(output) { + var node = this; + var p = output.parent(); + if (p instanceof AST_New) return p.expression === node; + // https://bugs.webkit.org/show_bug.cgi?id=123506 + if (output.option("webkit") + && node.expression instanceof AST_Function + && p instanceof AST_PropAccess + && p.expression === node) { + var g = output.parent(1); + if (g instanceof AST_Assign && g.left === p) return true; + } + // (foo?.())() + // (foo?.()).bar + // new (foo?.())() + return need_chain_parens(node, p); + }); + + PARENS(AST_New, function(output) { + if (need_constructor_parens(this, output)) return false; + var p = output.parent(); + // (new foo)(bar) + if (p instanceof AST_Call) return p.expression === this; + // (new Date).getTime(), (new Date)["getTime"]() + if (p instanceof AST_PropAccess) return true; + // (new foo)`bar` + if (p instanceof AST_Template) return p.tag === this; + }); + + PARENS(AST_Number, function(output) { + if (!output.option("galio")) return false; + // https://github.com/mishoo/UglifyJS/pull/1009 + var p = output.parent(); + return p instanceof AST_PropAccess && p.expression === this && /^0/.test(make_num(this.value)); + }); + + function needs_parens_assign_cond(self, output) { + var p = output.parent(); + // await (a = foo) + if (p instanceof AST_Await) return true; + // 1 + (a = 2) + 3 → 6, side effect setting a = 2 + if (p instanceof AST_Binary) return !(p instanceof AST_Assign); + // (a = func)() —or— new (a = Object)() + if (p instanceof AST_Call) return p.expression === self; + // class extends (a = foo) {} + // class foo extends (bar ? baz : moo) {} + if (p instanceof AST_Class) return true; + // (a = foo) ? bar : baz + if (p instanceof AST_Conditional) return p.condition === self; + // (a = foo)["prop"] —or— (a = foo).prop + if (p instanceof AST_PropAccess) return p.expression === self; + // (a = foo)`bar` + if (p instanceof AST_Template) return p.tag === self; + // !(a = false) → true + if (p instanceof AST_Unary) return true; + } + PARENS(AST_Arrow, function(output) { + return needs_parens_assign_cond(this, output); + }); + PARENS(AST_Assign, function(output) { + if (needs_parens_assign_cond(this, output)) return true; + // v8 parser bug ---> workaround + // f([1], [a] = []) ---> f([1], ([a] = [])) + if (output.option("v8")) return this.left instanceof AST_Destructured; + // ({ p: a } = o); + if (this.left instanceof AST_DestructuredObject) return needs_parens_obj(output); + }); + PARENS(AST_AsyncArrow, function(output) { + return needs_parens_assign_cond(this, output); + }); + PARENS(AST_Conditional, function(output) { + return needs_parens_assign_cond(this, output) + // https://github.com/mishoo/UglifyJS/issues/1144 + || output.option("extendscript") && output.parent() instanceof AST_Conditional; + }); + PARENS(AST_Yield, function(output) { + return needs_parens_assign_cond(this, output); + }); + + /* -----[ PRINTERS ]----- */ + + DEFPRINT(AST_Directive, function(output) { + var quote = this.quote; + var value = this.value; + switch (output.option("quote_style")) { + case 0: + case 2: + if (value.indexOf('"') == -1) quote = '"'; + break; + case 1: + if (value.indexOf("'") == -1) quote = "'"; + break; + } + output.print(quote + value + quote); + output.semicolon(); + }); + DEFPRINT(AST_Debugger, function(output) { + output.print("debugger"); + output.semicolon(); + }); + + /* -----[ statements ]----- */ + + function display_body(body, is_toplevel, output, allow_directives) { + var last = body.length - 1; + var in_directive = allow_directives; + var was_asm = use_asm; + body.forEach(function(stmt, i) { + if (in_directive) { + if (stmt instanceof AST_Directive) { + if (stmt.value == "use asm") use_asm = true; + } else if (!(stmt instanceof AST_EmptyStatement)) { + if (stmt instanceof AST_SimpleStatement && stmt.body instanceof AST_String) { + output.force_semicolon(); + } + in_directive = false; + } + } + if (stmt instanceof AST_EmptyStatement) return; + output.indent(); + stmt.print(output); + if (i == last && is_toplevel) return; + output.newline(); + if (is_toplevel) output.newline(); + }); + use_asm = was_asm; + } + + DEFPRINT(AST_Toplevel, function(output) { + display_body(this.body, true, output, true); + output.print(""); + }); + DEFPRINT(AST_LabeledStatement, function(output) { + this.label.print(output); + output.colon(); + this.body.print(output); + }); + DEFPRINT(AST_SimpleStatement, function(output) { + this.body.print(output); + output.semicolon(); + }); + function print_braced_empty(self, output) { + output.print("{"); + output.with_indent(function() { + output.append_comments(self, true); + }); + output.print("}"); + } + function print_braced(self, output, allow_directives) { + if (self.body.length > 0) { + output.with_block(function() { + display_body(self.body, false, output, allow_directives); + }, self.end); + } else print_braced_empty(self, output); + } + DEFPRINT(AST_BlockStatement, function(output) { + print_braced(this, output); + }); + DEFPRINT(AST_EmptyStatement, function(output) { + output.semicolon(); + }); + DEFPRINT(AST_Do, function(output) { + var self = this; + output.print("do"); + make_block(self.body, output); + output.space(); + output.print("while"); + output.space(); + output.with_parens(function() { + self.condition.print(output); + }); + output.semicolon(); + }); + DEFPRINT(AST_While, function(output) { + var self = this; + output.print("while"); + output.space(); + output.with_parens(function() { + self.condition.print(output); + }); + force_statement(self.body, output); + }); + DEFPRINT(AST_For, function(output) { + var self = this; + output.print("for"); + output.space(); + output.with_parens(function() { + if (self.init) { + if (self.init instanceof AST_Definitions) { + self.init.print(output); + } else { + parenthesize_for_no_in(self.init, output, true); + } + output.print(";"); + output.space(); + } else { + output.print(";"); + } + if (self.condition) { + self.condition.print(output); + output.print(";"); + output.space(); + } else { + output.print(";"); + } + if (self.step) { + self.step.print(output); + } + }); + force_statement(self.body, output); + }); + function print_for_enum(prefix, infix) { + return function(output) { + var self = this; + output.print(prefix); + output.space(); + output.with_parens(function() { + self.init.print(output); + output.space(); + output.print(infix); + output.space(); + self.object.print(output); + }); + force_statement(self.body, output); + }; + } + DEFPRINT(AST_ForAwaitOf, print_for_enum("for await", "of")); + DEFPRINT(AST_ForIn, print_for_enum("for", "in")); + DEFPRINT(AST_ForOf, print_for_enum("for", "of")); + DEFPRINT(AST_With, function(output) { + var self = this; + output.print("with"); + output.space(); + output.with_parens(function() { + self.expression.print(output); + }); + force_statement(self.body, output); + }); + DEFPRINT(AST_ExportDeclaration, function(output) { + output.print("export"); + output.space(); + this.body.print(output); + }); + DEFPRINT(AST_ExportDefault, function(output) { + output.print("export"); + output.space(); + output.print("default"); + output.space(); + var body = this.body; + body.print(output); + if (body instanceof AST_ClassExpression) { + if (!body.name) return; + } + if (body instanceof AST_DefClass) return; + if (body instanceof AST_LambdaDefinition) return; + if (body instanceof AST_LambdaExpression) { + if (!body.name && !is_arrow(body)) return; + } + output.semicolon(); + }); + function print_alias(alias, output) { + var value = alias.value; + if (value == "*" || is_identifier_string(value)) { + output.print_name(value); + } else { + output.print_string(value, alias.quote); + } + } + DEFPRINT(AST_ExportForeign, function(output) { + var self = this; + output.print("export"); + output.space(); + var len = self.keys.length; + if (len == 0) { + print_braced_empty(self, output); + } else if (self.keys[0].value == "*") { + print_entry(0); + } else output.with_block(function() { + output.indent(); + print_entry(0); + for (var i = 1; i < len; i++) { + output.print(","); + output.newline(); + output.indent(); + print_entry(i); + } + output.newline(); + }, self.end); + output.space(); + output.print("from"); + output.space(); + self.path.print(output); + output.semicolon(); + + function print_entry(index) { + var alias = self.aliases[index]; + var key = self.keys[index]; + print_alias(key, output); + if (alias.value != key.value) { + output.space(); + output.print("as"); + output.space(); + print_alias(alias, output); + } + } + }); + DEFPRINT(AST_ExportReferences, function(output) { + var self = this; + output.print("export"); + output.space(); + print_properties(self, output); + output.semicolon(); + }); + DEFPRINT(AST_Import, function(output) { + var self = this; + output.print("import"); + output.space(); + if (self.default) self.default.print(output); + if (self.all) { + if (self.default) output.comma(); + self.all.print(output); + } + if (self.properties) { + if (self.default) output.comma(); + print_properties(self, output); + } + if (self.all || self.default || self.properties) { + output.space(); + output.print("from"); + output.space(); + } + self.path.print(output); + output.semicolon(); + }); + + /* -----[ functions ]----- */ + function print_funargs(self, output) { + output.with_parens(function() { + self.argnames.forEach(function(arg, i) { + if (i) output.comma(); + arg.print(output); + }); + if (self.rest) { + if (self.argnames.length) output.comma(); + output.print("..."); + self.rest.print(output); + } + }); + } + function print_arrow(self, output) { + var argname = self.argnames.length == 1 && !self.rest && self.argnames[0]; + if (argname instanceof AST_SymbolFunarg && argname.name != "yield") { + argname.print(output); + } else { + print_funargs(self, output); + } + output.space(); + output.print("=>"); + output.space(); + if (self.value) { + self.value.print(output); + } else { + print_braced(self, output, true); + } + } + DEFPRINT(AST_Arrow, function(output) { + print_arrow(this, output); + }); + DEFPRINT(AST_AsyncArrow, function(output) { + output.print("async"); + output.space(); + print_arrow(this, output); + }); + function print_lambda(self, output) { + if (self.name) { + output.space(); + self.name.print(output); + } + print_funargs(self, output); + output.space(); + print_braced(self, output, true); + } + DEFPRINT(AST_Lambda, function(output) { + output.print("function"); + print_lambda(this, output); + }); + function print_async(output) { + output.print("async"); + output.space(); + output.print("function"); + print_lambda(this, output); + } + DEFPRINT(AST_AsyncDefun, print_async); + DEFPRINT(AST_AsyncFunction, print_async); + function print_async_generator(output) { + output.print("async"); + output.space(); + output.print("function*"); + print_lambda(this, output); + } + DEFPRINT(AST_AsyncGeneratorDefun, print_async_generator); + DEFPRINT(AST_AsyncGeneratorFunction, print_async_generator); + function print_generator(output) { + output.print("function*"); + print_lambda(this, output); + } + DEFPRINT(AST_GeneratorDefun, print_generator); + DEFPRINT(AST_GeneratorFunction, print_generator); + + /* -----[ classes ]----- */ + DEFPRINT(AST_Class, function(output) { + var self = this; + output.print("class"); + if (self.name) { + output.space(); + self.name.print(output); + } + if (self.extends) { + output.space(); + output.print("extends"); + output.space(); + self.extends.print(output); + } + output.space(); + print_properties(self, output, true); + }); + DEFPRINT(AST_ClassField, function(output) { + var self = this; + if (self.static) { + output.print("static"); + output.space(); + } + print_property_key(self, output); + if (self.value) { + output.space(); + output.print("="); + output.space(); + self.value.print(output); + } + output.semicolon(); + }); + DEFPRINT(AST_ClassGetter, print_accessor("get")); + DEFPRINT(AST_ClassSetter, print_accessor("set")); + function print_method(self, output) { + var fn = self.value; + if (is_async(fn)) { + output.print("async"); + output.space(); + } + if (is_generator(fn)) output.print("*"); + print_property_key(self, output); + print_lambda(self.value, output); + } + DEFPRINT(AST_ClassMethod, function(output) { + var self = this; + if (self.static) { + output.print("static"); + output.space(); + } + print_method(self, output); + }); + DEFPRINT(AST_ClassInit, function(output) { + output.print("static"); + output.space(); + print_braced(this.value, output); + }); + + /* -----[ jumps ]----- */ + function print_jump(kind, prop) { + return function(output) { + output.print(kind); + var target = this[prop]; + if (target) { + output.space(); + target.print(output); + } + output.semicolon(); + }; + } + DEFPRINT(AST_Return, print_jump("return", "value")); + DEFPRINT(AST_Throw, print_jump("throw", "value")); + DEFPRINT(AST_Break, print_jump("break", "label")); + DEFPRINT(AST_Continue, print_jump("continue", "label")); + + /* -----[ if ]----- */ + function make_then(self, output) { + var b = self.body; + if (output.option("braces") && !(b instanceof AST_Const || b instanceof AST_Let) + || output.option("ie") && b instanceof AST_Do) + return make_block(b, output); + // The squeezer replaces "block"-s that contain only a single + // statement with the statement itself; technically, the AST + // is correct, but this can create problems when we output an + // IF having an ELSE clause where the THEN clause ends in an + // IF *without* an ELSE block (then the outer ELSE would refer + // to the inner IF). This function checks for this case and + // adds the block braces if needed. + if (!b) return output.force_semicolon(); + while (true) { + if (b instanceof AST_If) { + if (!b.alternative) { + make_block(self.body, output); + return; + } + b = b.alternative; + } else if (b instanceof AST_StatementWithBody) { + b = b.body; + } else break; + } + force_statement(self.body, output); + } + DEFPRINT(AST_If, function(output) { + var self = this; + output.print("if"); + output.space(); + output.with_parens(function() { + self.condition.print(output); + }); + if (self.alternative) { + make_then(self, output); + output.space(); + output.print("else"); + if (self.alternative instanceof AST_If) { + output.space(); + self.alternative.print(output); + } else { + force_statement(self.alternative, output); + } + } else { + force_statement(self.body, output); + } + }); + + /* -----[ switch ]----- */ + DEFPRINT(AST_Switch, function(output) { + var self = this; + output.print("switch"); + output.space(); + output.with_parens(function() { + self.expression.print(output); + }); + output.space(); + var last = self.body.length - 1; + if (last < 0) print_braced_empty(self, output); + else output.with_block(function() { + self.body.forEach(function(branch, i) { + output.indent(true); + branch.print(output); + if (i < last && branch.body.length > 0) + output.newline(); + }); + }, self.end); + }); + function print_branch_body(self, output) { + output.newline(); + self.body.forEach(function(stmt) { + output.indent(); + stmt.print(output); + output.newline(); + }); + } + DEFPRINT(AST_Default, function(output) { + output.print("default:"); + print_branch_body(this, output); + }); + DEFPRINT(AST_Case, function(output) { + var self = this; + output.print("case"); + output.space(); + self.expression.print(output); + output.print(":"); + print_branch_body(self, output); + }); + + /* -----[ exceptions ]----- */ + DEFPRINT(AST_Try, function(output) { + var self = this; + output.print("try"); + output.space(); + print_braced(self, output); + if (self.bcatch) { + output.space(); + self.bcatch.print(output); + } + if (self.bfinally) { + output.space(); + self.bfinally.print(output); + } + }); + DEFPRINT(AST_Catch, function(output) { + var self = this; + output.print("catch"); + if (self.argname) { + output.space(); + output.with_parens(function() { + self.argname.print(output); + }); + } + output.space(); + print_braced(self, output); + }); + DEFPRINT(AST_Finally, function(output) { + output.print("finally"); + output.space(); + print_braced(this, output); + }); + + function print_definitions(type) { + return function(output) { + var self = this; + output.print(type); + output.space(); + self.definitions.forEach(function(def, i) { + if (i) output.comma(); + def.print(output); + }); + var p = output.parent(); + if (!(p instanceof AST_IterationStatement && p.init === self)) output.semicolon(); + }; + } + DEFPRINT(AST_Const, print_definitions("const")); + DEFPRINT(AST_Let, print_definitions("let")); + DEFPRINT(AST_Var, print_definitions("var")); + + function parenthesize_for_no_in(node, output, no_in) { + var parens = false; + // need to take some precautions here: + // https://github.com/mishoo/UglifyJS/issues/60 + if (no_in) node.walk(new TreeWalker(function(node) { + if (parens) return true; + if (node instanceof AST_Binary && node.operator == "in") return parens = true; + if (node instanceof AST_Scope && !(is_arrow(node) && node.value)) return true; + })); + node.print(output, parens); + } + + DEFPRINT(AST_VarDef, function(output) { + var self = this; + self.name.print(output); + if (self.value) { + output.space(); + output.print("="); + output.space(); + var p = output.parent(1); + var no_in = p instanceof AST_For || p instanceof AST_ForEnumeration; + parenthesize_for_no_in(self.value, output, no_in); + } + }); + + DEFPRINT(AST_DefaultValue, function(output) { + var self = this; + self.name.print(output); + output.space(); + output.print("="); + output.space(); + self.value.print(output); + }); + + /* -----[ other expressions ]----- */ + function print_annotation(self, output) { + if (!output.option("annotations")) return; + if (!self.pure) return; + var level = 0, parent = self, node; + do { + node = parent; + parent = output.parent(level++); + if (parent instanceof AST_Call && parent.expression === node) return; + } while (parent instanceof AST_PropAccess && parent.expression === node); + output.print("/*@__PURE__*/"); + } + function print_call_args(self, output) { + output.with_parens(function() { + self.args.forEach(function(expr, i) { + if (i) output.comma(); + expr.print(output); + }); + output.add_mapping(self.end); + }); + } + DEFPRINT(AST_Call, function(output) { + var self = this; + print_annotation(self, output); + self.expression.print(output); + if (self.optional) output.print("?."); + print_call_args(self, output); + }); + DEFPRINT(AST_New, function(output) { + var self = this; + print_annotation(self, output); + output.print("new"); + output.space(); + self.expression.print(output); + if (need_constructor_parens(self, output)) print_call_args(self, output); + }); + DEFPRINT(AST_Sequence, function(output) { + this.expressions.forEach(function(node, index) { + if (index > 0) { + output.comma(); + if (output.should_break()) { + output.newline(); + output.indent(); + } + } + node.print(output); + }); + }); + DEFPRINT(AST_Dot, function(output) { + var self = this; + var expr = self.expression; + expr.print(output); + var prop = self.property; + if (output.option("ie") && RESERVED_WORDS[prop] || self.quoted && output.option("keep_quoted_props")) { + if (self.optional) output.print("?."); + output.with_square(function() { + output.add_mapping(self.end); + output.print_string(prop); + }); + } else { + if (expr instanceof AST_Number && !/[ex.)]/i.test(output.last())) output.print("."); + output.print(self.optional ? "?." : "."); + // the name after dot would be mapped about here. + output.add_mapping(self.end); + output.print_name(prop); + } + }); + DEFPRINT(AST_Sub, function(output) { + var self = this; + self.expression.print(output); + if (self.optional) output.print("?."); + output.with_square(function() { + self.property.print(output); + }); + }); + DEFPRINT(AST_Spread, function(output) { + output.print("..."); + this.expression.print(output); + }); + DEFPRINT(AST_UnaryPrefix, function(output) { + var op = this.operator; + var exp = this.expression; + output.print(op); + if (/^[a-z]/i.test(op) + || (/[+-]$/.test(op) + && exp instanceof AST_UnaryPrefix + && /^[+-]/.test(exp.operator))) { + output.space(); + } + exp.print(output); + }); + DEFPRINT(AST_UnaryPostfix, function(output) { + var self = this; + self.expression.print(output); + output.add_mapping(self.end); + output.print(self.operator); + }); + DEFPRINT(AST_Binary, function(output) { + var self = this; + self.left.print(output); + output.space(); + output.print(self.operator); + output.space(); + self.right.print(output); + }); + DEFPRINT(AST_Conditional, function(output) { + var self = this; + self.condition.print(output); + output.space(); + output.print("?"); + output.space(); + self.consequent.print(output); + output.space(); + output.colon(); + self.alternative.print(output); + }); + DEFPRINT(AST_Await, function(output) { + output.print("await"); + output.space(); + this.expression.print(output); + }); + DEFPRINT(AST_Yield, function(output) { + output.print(this.nested ? "yield*" : "yield"); + if (this.expression) { + output.space(); + this.expression.print(output); + } + }); + + /* -----[ literals ]----- */ + DEFPRINT(AST_Array, function(output) { + var a = this.elements, len = a.length; + output.with_square(len > 0 ? function() { + output.space(); + a.forEach(function(exp, i) { + if (i) output.comma(); + exp.print(output); + // If the final element is a hole, we need to make sure it + // doesn't look like a trailing comma, by inserting an actual + // trailing comma. + if (i === len - 1 && exp instanceof AST_Hole) + output.comma(); + }); + output.space(); + } : noop); + }); + DEFPRINT(AST_DestructuredArray, function(output) { + var a = this.elements, len = a.length, rest = this.rest; + output.with_square(len || rest ? function() { + output.space(); + a.forEach(function(exp, i) { + if (i) output.comma(); + exp.print(output); + }); + if (rest) { + if (len) output.comma(); + output.print("..."); + rest.print(output); + } else if (a[len - 1] instanceof AST_Hole) { + // If the final element is a hole, we need to make sure it + // doesn't look like a trailing comma, by inserting an actual + // trailing comma. + output.comma(); + } + output.space(); + } : noop); + }); + DEFPRINT(AST_DestructuredKeyVal, function(output) { + var self = this; + var key = print_property_key(self, output); + var value = self.value; + if (key) { + if (value instanceof AST_DefaultValue) { + if (value.name instanceof AST_Symbol && key == get_symbol_name(value.name)) { + output.space(); + output.print("="); + output.space(); + value.value.print(output); + return; + } + } else if (value instanceof AST_Symbol) { + if (key == get_symbol_name(value)) return; + } + } + output.colon(); + value.print(output); + }); + DEFPRINT(AST_DestructuredObject, function(output) { + var self = this; + var props = self.properties, len = props.length, rest = self.rest; + if (len || rest) output.with_block(function() { + props.forEach(function(prop, i) { + if (i) { + output.print(","); + output.newline(); + } + output.indent(); + prop.print(output); + }); + if (rest) { + if (len) { + output.print(","); + output.newline(); + } + output.indent(); + output.print("..."); + rest.print(output); + } + output.newline(); + }, self.end); + else print_braced_empty(self, output); + }); + function print_properties(self, output, no_comma) { + var props = self.properties; + if (props.length > 0) output.with_block(function() { + props.forEach(function(prop, i) { + if (i) { + if (!no_comma) output.print(","); + output.newline(); + } + output.indent(); + prop.print(output); + }); + output.newline(); + }, self.end); + else print_braced_empty(self, output); + } + DEFPRINT(AST_Object, function(output) { + print_properties(this, output); + }); + + function print_property_key(self, output) { + var key = self.key; + if (key instanceof AST_Node) return output.with_square(function() { + key.print(output); + }); + var quote = self.start && self.start.quote; + if (output.option("quote_keys") || quote && output.option("keep_quoted_props")) { + output.print_string(key, quote); + } else if ("" + +key == key && key >= 0) { + output.print(make_num(key)); + } else if (self.private) { + output.print_name(key); + } else if (RESERVED_WORDS[key] ? !output.option("ie") : is_identifier_string(key)) { + output.print_name(key); + return key; + } else { + output.print_string(key, quote); + } + } + DEFPRINT(AST_ObjectKeyVal, function(output) { + var self = this; + print_property_key(self, output); + output.colon(); + self.value.print(output); + }); + DEFPRINT(AST_ObjectMethod, function(output) { + print_method(this, output); + }); + function print_accessor(type) { + return function(output) { + var self = this; + if (self.static) { + output.print("static"); + output.space(); + } + output.print(type); + output.space(); + print_property_key(self, output); + print_lambda(self.value, output); + }; + } + DEFPRINT(AST_ObjectGetter, print_accessor("get")); + DEFPRINT(AST_ObjectSetter, print_accessor("set")); + function get_symbol_name(sym) { + var def = sym.definition(); + return def && def.mangled_name || sym.name; + } + DEFPRINT(AST_Symbol, function(output) { + output.print_name(get_symbol_name(this)); + }); + DEFPRINT(AST_SymbolExport, function(output) { + var self = this; + var name = get_symbol_name(self); + output.print_name(name); + var alias = self.alias; + if (alias.value != name) { + output.space(); + output.print("as"); + output.space(); + print_alias(alias, output); + } + }); + DEFPRINT(AST_SymbolImport, function(output) { + var self = this; + var name = get_symbol_name(self); + var key = self.key; + if (key.value && key.value != name) { + print_alias(key, output); + output.space(); + output.print("as"); + output.space(); + } + output.print_name(name); + }); + DEFPRINT(AST_Hole, noop); + DEFPRINT(AST_Template, function(output) { + var self = this; + if (self.tag) self.tag.print(output); + output.print("`"); + for (var i = 0; i < self.expressions.length; i++) { + output.print(self.strings[i]); + output.print("${"); + self.expressions[i].print(output); + output.print("}"); + } + output.print(self.strings[i]); + output.print("`"); + }); + DEFPRINT(AST_Constant, function(output) { + output.print("" + this.value); + }); + DEFPRINT(AST_String, function(output) { + output.print_string(this.value, this.quote); + }); + DEFPRINT(AST_Number, function(output) { + var start = this.start; + if (use_asm && start && start.raw != null) { + output.print(start.raw); + } else { + output.print(make_num(this.value)); + } + }); + + DEFPRINT(AST_RegExp, function(output) { + var regexp = this.value; + var str = regexp.toString(); + var end = str.lastIndexOf("/"); + if (regexp.raw_source) { + str = "/" + regexp.raw_source + str.slice(end); + } else if (end == 1) { + str = "/(?:)" + str.slice(end); + } else if (str.indexOf("/", 1) < end) { + str = "/" + str.slice(1, end).replace(/\\\\|[^/]?\//g, function(match) { + return match[0] == "\\" ? match : match.slice(0, -1) + "\\/"; + }) + str.slice(end); + } + output.print(output.to_utf8(str).replace(/\\(?:\0(?![0-9])|[^\0])/g, function(match) { + switch (match[1]) { + case "\n": return "\\n"; + case "\r": return "\\r"; + case "\t": return "\t"; + case "\b": return "\b"; + case "\f": return "\f"; + case "\0": return "\0"; + case "\x0B": return "\v"; + case "\u2028": return "\\u2028"; + case "\u2029": return "\\u2029"; + default: return match; + } + }).replace(/[\n\r\u2028\u2029]/g, function(c) { + switch (c) { + case "\n": return "\\n"; + case "\r": return "\\r"; + case "\u2028": return "\\u2028"; + case "\u2029": return "\\u2029"; + } + })); + }); + + function force_statement(stat, output) { + if (output.option("braces") && !(stat instanceof AST_Const || stat instanceof AST_Let)) { + make_block(stat, output); + } else if (stat instanceof AST_EmptyStatement) { + output.force_semicolon(); + } else { + output.space(); + stat.print(output); + } + } + + // self should be AST_New. decide if we want to show parens or not. + function need_constructor_parens(self, output) { + // Always print parentheses with arguments + if (self.args.length > 0) return true; + + return output.option("beautify"); + } + + function best_of(a) { + var best = a[0], len = best.length; + for (var i = 1; i < a.length; ++i) { + if (a[i].length < len) { + best = a[i]; + len = best.length; + } + } + return best; + } + + function make_num(num) { + var str = num.toString(10).replace(/^0\./, ".").replace("e+", "e"); + var candidates = [ str ]; + if (Math.floor(num) === num) { + if (num < 0) { + candidates.push("-0x" + (-num).toString(16).toLowerCase()); + } else { + candidates.push("0x" + num.toString(16).toLowerCase()); + } + } + var match, len, digits; + if (match = /^\.0+/.exec(str)) { + len = match[0].length; + digits = str.slice(len); + candidates.push(digits + "e-" + (digits.length + len - 1)); + } else if (match = /[^0]0+$/.exec(str)) { + len = match[0].length - 1; + candidates.push(str.slice(0, -len) + "e" + len); + } else if (match = /^(\d)\.(\d+)e(-?\d+)$/.exec(str)) { + candidates.push(match[1] + match[2] + "e" + (match[3] - match[2].length)); + } + return best_of(candidates); + } + + function make_block(stmt, output) { + output.space(); + if (stmt instanceof AST_EmptyStatement) { + print_braced_empty(stmt, output); + } else if (stmt instanceof AST_BlockStatement) { + stmt.print(output); + } else output.with_block(function() { + output.indent(); + stmt.print(output); + output.newline(); + }, stmt.end); + } + + /* -----[ source map generators ]----- */ + + function DEFMAP(nodetype, generator) { + nodetype.forEach(function(nodetype) { + nodetype.DEFMETHOD("add_source_map", generator); + }); + } + + DEFMAP([ + // We could easily add info for ALL nodes, but it seems to me that + // would be quite wasteful, hence this noop in the base class. + AST_Node, + // since the label symbol will mark it + AST_LabeledStatement, + ], noop); + + // XXX: I'm not exactly sure if we need it for all of these nodes, + // or if we should add even more. + DEFMAP([ + AST_Array, + AST_Await, + AST_BlockStatement, + AST_Catch, + AST_Constant, + AST_Debugger, + AST_Definitions, + AST_Destructured, + AST_Directive, + AST_Finally, + AST_Jump, + AST_Lambda, + AST_New, + AST_Object, + AST_Spread, + AST_StatementWithBody, + AST_Symbol, + AST_Switch, + AST_SwitchBranch, + AST_Try, + AST_UnaryPrefix, + AST_Yield, + ], function(output) { + output.add_mapping(this.start); + }); + + DEFMAP([ + AST_ClassProperty, + AST_DestructuredKeyVal, + AST_ObjectProperty, + ], function(output) { + if (typeof this.key == "string") output.add_mapping(this.start, this.key); + }); +})(); diff --git a/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/parse.js b/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/parse.js new file mode 100644 index 00000000..8fb7f383 --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/parse.js @@ -0,0 +1,2585 @@ +/*********************************************************************** + + A JavaScript tokenizer / parser / beautifier / compressor. + https://github.com/mishoo/UglifyJS + + -------------------------------- (C) --------------------------------- + + Author: Mihai Bazon + + http://mihai.bazon.net/blog + + Distributed under the BSD license: + + Copyright 2012 (c) Mihai Bazon + Parser based on parse-js (http://marijn.haverbeke.nl/parse-js/). + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + ***********************************************************************/ + +"use strict"; + +var KEYWORDS = "break case catch class const continue debugger default delete do else extends finally for function if in instanceof new return switch throw try typeof var void while with"; +var KEYWORDS_ATOM = "false null true"; +var RESERVED_WORDS = [ + "abstract async await boolean byte char double enum export final float goto implements import int interface let long native package private protected public short static super synchronized this throws transient volatile yield", + KEYWORDS_ATOM, + KEYWORDS, +].join(" "); +var KEYWORDS_BEFORE_EXPRESSION = "return new delete throw else case"; + +KEYWORDS = makePredicate(KEYWORDS); +RESERVED_WORDS = makePredicate(RESERVED_WORDS); +KEYWORDS_BEFORE_EXPRESSION = makePredicate(KEYWORDS_BEFORE_EXPRESSION); +KEYWORDS_ATOM = makePredicate(KEYWORDS_ATOM); + +var RE_BIN_NUMBER = /^0b([01]+)$/i; +var RE_HEX_NUMBER = /^0x([0-9a-f]+)$/i; +var RE_OCT_NUMBER = /^0o?([0-7]+)$/i; + +var OPERATORS = makePredicate([ + "in", + "instanceof", + "typeof", + "new", + "void", + "delete", + "++", + "--", + "+", + "-", + "!", + "~", + "&", + "|", + "^", + "*", + "/", + "%", + "**", + ">>", + "<<", + ">>>", + "<", + ">", + "<=", + ">=", + "==", + "===", + "!=", + "!==", + "?", + "=", + "+=", + "-=", + "/=", + "*=", + "%=", + "**=", + ">>=", + "<<=", + ">>>=", + "&=", + "|=", + "^=", + "&&", + "||", + "??", + "&&=", + "||=", + "??=", +]); + +var NEWLINE_CHARS = "\n\r\u2028\u2029"; +var OPERATOR_CHARS = "+-*&%=<>!?|~^"; +var PUNC_OPENERS = "[{("; +var PUNC_SEPARATORS = ",;:"; +var PUNC_CLOSERS = ")}]"; +var PUNC_AFTER_EXPRESSION = PUNC_SEPARATORS + PUNC_CLOSERS; +var PUNC_BEFORE_EXPRESSION = PUNC_OPENERS + PUNC_SEPARATORS; +var PUNC_CHARS = PUNC_BEFORE_EXPRESSION + "`" + PUNC_CLOSERS; +var WHITESPACE_CHARS = NEWLINE_CHARS + " \u00a0\t\f\u000b\u200b\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\uFEFF"; +var NON_IDENTIFIER_CHARS = makePredicate(characters("./'\"#" + OPERATOR_CHARS + PUNC_CHARS + WHITESPACE_CHARS)); + +NEWLINE_CHARS = makePredicate(characters(NEWLINE_CHARS)); +OPERATOR_CHARS = makePredicate(characters(OPERATOR_CHARS)); +PUNC_AFTER_EXPRESSION = makePredicate(characters(PUNC_AFTER_EXPRESSION)); +PUNC_BEFORE_EXPRESSION = makePredicate(characters(PUNC_BEFORE_EXPRESSION)); +PUNC_CHARS = makePredicate(characters(PUNC_CHARS)); +WHITESPACE_CHARS = makePredicate(characters(WHITESPACE_CHARS)); + +/* -----[ Tokenizer ]----- */ + +function is_surrogate_pair_head(code) { + return code >= 0xd800 && code <= 0xdbff; +} + +function is_surrogate_pair_tail(code) { + return code >= 0xdc00 && code <= 0xdfff; +} + +function is_digit(code) { + return code >= 48 && code <= 57; +} + +function is_identifier_char(ch) { + return !NON_IDENTIFIER_CHARS[ch]; +} + +function is_identifier_string(str) { + return /^[a-z_$][a-z0-9_$]*$/i.test(str); +} + +function decode_escape_sequence(seq) { + switch (seq[0]) { + case "b": return "\b"; + case "f": return "\f"; + case "n": return "\n"; + case "r": return "\r"; + case "t": return "\t"; + case "u": + var code; + if (seq[1] == "{" && seq.slice(-1) == "}") { + code = seq.slice(2, -1); + } else if (seq.length == 5) { + code = seq.slice(1); + } else { + return; + } + var num = parseInt(code, 16); + if (num < 0 || isNaN(num)) return; + if (num < 0x10000) return String.fromCharCode(num); + if (num > 0x10ffff) return; + return String.fromCharCode((num >> 10) + 0xd7c0) + String.fromCharCode((num & 0x03ff) + 0xdc00); + case "v": return "\u000b"; + case "x": + if (seq.length != 3) return; + var num = parseInt(seq.slice(1), 16); + if (num < 0 || isNaN(num)) return; + return String.fromCharCode(num); + case "\r": + case "\n": + return ""; + default: + if (seq == "0") return "\0"; + if (seq[0] >= "0" && seq[0] <= "9") return; + return seq; + } +} + +function parse_js_number(num) { + var match; + if (match = RE_BIN_NUMBER.exec(num)) return parseInt(match[1], 2); + if (match = RE_HEX_NUMBER.exec(num)) return parseInt(match[1], 16); + if (match = RE_OCT_NUMBER.exec(num)) return parseInt(match[1], 8); + var val = parseFloat(num); + if (val == num) return val; +} + +function JS_Parse_Error(message, filename, line, col, pos) { + this.message = message; + this.filename = filename; + this.line = line; + this.col = col; + this.pos = pos; +} +JS_Parse_Error.prototype = Object.create(Error.prototype); +JS_Parse_Error.prototype.constructor = JS_Parse_Error; +JS_Parse_Error.prototype.name = "SyntaxError"; +configure_error_stack(JS_Parse_Error); + +function js_error(message, filename, line, col, pos) { + throw new JS_Parse_Error(message, filename, line, col, pos); +} + +function is_token(token, type, val) { + return token.type == type && (val == null || token.value == val); +} + +var EX_EOF = {}; + +function tokenizer($TEXT, filename, html5_comments, shebang) { + + var S = { + text : $TEXT, + filename : filename, + pos : 0, + tokpos : 0, + line : 1, + tokline : 0, + col : 0, + tokcol : 0, + newline_before : false, + regex_allowed : false, + comments_before : [], + directives : Object.create(null), + read_template : with_eof_error("Unterminated template literal", function(strings) { + var s = ""; + for (;;) { + var ch = read(); + switch (ch) { + case "\\": + ch += read(); + break; + case "`": + strings.push(s); + return; + case "$": + if (peek() == "{") { + next(); + strings.push(s); + S.regex_allowed = true; + return true; + } + } + s += ch; + } + + function read() { + var ch = next(true, true); + return ch == "\r" ? "\n" : ch; + } + }), + }; + var prev_was_dot = false; + + function peek() { + return S.text.charAt(S.pos); + } + + function next(signal_eof, in_string) { + var ch = S.text.charAt(S.pos++); + if (signal_eof && !ch) + throw EX_EOF; + if (NEWLINE_CHARS[ch]) { + S.col = 0; + S.line++; + if (!in_string) S.newline_before = true; + if (ch == "\r" && peek() == "\n") { + // treat `\r\n` as `\n` + S.pos++; + ch = "\n"; + } + } else { + S.col++; + } + return ch; + } + + function forward(i) { + while (i-- > 0) next(); + } + + function looking_at(str) { + return S.text.substr(S.pos, str.length) == str; + } + + function find_eol() { + var text = S.text; + for (var i = S.pos; i < S.text.length; ++i) { + if (NEWLINE_CHARS[text[i]]) return i; + } + return -1; + } + + function find(what, signal_eof) { + var pos = S.text.indexOf(what, S.pos); + if (signal_eof && pos == -1) throw EX_EOF; + return pos; + } + + function start_token() { + S.tokline = S.line; + S.tokcol = S.col; + S.tokpos = S.pos; + } + + function token(type, value, is_comment) { + S.regex_allowed = type == "operator" && !UNARY_POSTFIX[value] + || type == "keyword" && KEYWORDS_BEFORE_EXPRESSION[value] + || type == "punc" && PUNC_BEFORE_EXPRESSION[value]; + if (type == "punc" && value == ".") prev_was_dot = true; + else if (!is_comment) prev_was_dot = false; + var ret = { + type : type, + value : value, + line : S.tokline, + col : S.tokcol, + pos : S.tokpos, + endline : S.line, + endcol : S.col, + endpos : S.pos, + nlb : S.newline_before, + file : filename + }; + if (/^(?:num|string|regexp)$/i.test(type)) { + ret.raw = $TEXT.substring(ret.pos, ret.endpos); + } + if (!is_comment) { + ret.comments_before = S.comments_before; + ret.comments_after = S.comments_before = []; + } + S.newline_before = false; + return new AST_Token(ret); + } + + function skip_whitespace() { + while (WHITESPACE_CHARS[peek()]) + next(); + } + + function read_while(pred) { + var ret = "", ch; + while ((ch = peek()) && pred(ch, ret)) ret += next(); + return ret; + } + + function parse_error(err) { + js_error(err, filename, S.tokline, S.tokcol, S.tokpos); + } + + function is_octal(num) { + return /^0[0-7_]+$/.test(num); + } + + function read_num(prefix) { + var has_e = false, after_e = false, has_x = false, has_dot = prefix == "."; + var num = read_while(function(ch, str) { + switch (ch) { + case "x": case "X": + return has_x ? false : (has_x = true); + case "e": case "E": + return has_x ? true : has_e ? false : (has_e = after_e = true); + case "+": case "-": + return after_e; + case (after_e = false, "."): + return has_dot || has_e || has_x || is_octal(str) ? false : (has_dot = true); + } + return /[_0-9a-dfo]/i.test(ch); + }); + if (prefix) num = prefix + num; + if (is_octal(num)) { + if (next_token.has_directive("use strict")) parse_error("Legacy octal literals are not allowed in strict mode"); + } else { + num = num.replace(has_x ? /([1-9a-f]|.0)_(?=[0-9a-f])/gi : /([1-9]|.0)_(?=[0-9])/gi, "$1"); + } + var valid = parse_js_number(num); + if (isNaN(valid)) parse_error("Invalid syntax: " + num); + if (has_dot || has_e || peek() != "n") return token("num", valid); + return token("bigint", num.toLowerCase() + next()); + } + + function read_escaped_char(in_string) { + var seq = next(true, in_string); + if (seq >= "0" && seq <= "7") return read_octal_escape_sequence(seq); + if (seq == "u") { + var ch = next(true, in_string); + seq += ch; + if (ch != "{") { + seq += next(true, in_string) + next(true, in_string) + next(true, in_string); + } else do { + ch = next(true, in_string); + seq += ch; + } while (ch != "}"); + } else if (seq == "x") { + seq += next(true, in_string) + next(true, in_string); + } + var str = decode_escape_sequence(seq); + if (typeof str != "string") parse_error("Invalid escape sequence: \\" + seq); + return str; + } + + function read_octal_escape_sequence(ch) { + // Read + var p = peek(); + if (p >= "0" && p <= "7") { + ch += next(true); + if (ch[0] <= "3" && (p = peek()) >= "0" && p <= "7") + ch += next(true); + } + + // Parse + if (ch === "0") return "\0"; + if (ch.length > 0 && next_token.has_directive("use strict")) + parse_error("Legacy octal escape sequences are not allowed in strict mode"); + return String.fromCharCode(parseInt(ch, 8)); + } + + var read_string = with_eof_error("Unterminated string constant", function(quote_char) { + var quote = next(), ret = ""; + for (;;) { + var ch = next(true, true); + if (ch == "\\") ch = read_escaped_char(true); + else if (NEWLINE_CHARS[ch]) parse_error("Unterminated string constant"); + else if (ch == quote) break; + ret += ch; + } + var tok = token("string", ret); + tok.quote = quote_char; + return tok; + }); + + function skip_line_comment(type) { + var regex_allowed = S.regex_allowed; + var i = find_eol(), ret; + if (i == -1) { + ret = S.text.substr(S.pos); + S.pos = S.text.length; + } else { + ret = S.text.substring(S.pos, i); + S.pos = i; + } + S.col = S.tokcol + (S.pos - S.tokpos); + S.comments_before.push(token(type, ret, true)); + S.regex_allowed = regex_allowed; + return next_token; + } + + var skip_multiline_comment = with_eof_error("Unterminated multiline comment", function() { + var regex_allowed = S.regex_allowed; + var i = find("*/", true); + var text = S.text.substring(S.pos, i).replace(/\r\n|\r|\u2028|\u2029/g, "\n"); + // update stream position + forward(text.length /* doesn't count \r\n as 2 char while S.pos - i does */ + 2); + S.comments_before.push(token("comment2", text, true)); + S.regex_allowed = regex_allowed; + return next_token; + }); + + function read_name() { + var backslash = false, ch, escaped = false, name = peek() == "#" ? next() : ""; + while (ch = peek()) { + if (!backslash) { + if (ch == "\\") escaped = backslash = true, next(); + else if (is_identifier_char(ch)) name += next(); + else break; + } else { + if (ch != "u") parse_error("Expecting UnicodeEscapeSequence -- uXXXX"); + ch = read_escaped_char(); + if (!is_identifier_char(ch)) parse_error("Unicode char: " + ch.charCodeAt(0) + " is not valid in identifier"); + name += ch; + backslash = false; + } + } + if (KEYWORDS[name] && escaped) { + var hex = name.charCodeAt(0).toString(16).toUpperCase(); + name = "\\u" + "0000".substr(hex.length) + hex + name.slice(1); + } + return name; + } + + var read_regexp = with_eof_error("Unterminated regular expression", function(source) { + var prev_backslash = false, ch, in_class = false; + while ((ch = next(true))) if (NEWLINE_CHARS[ch]) { + parse_error("Unexpected line terminator"); + } else if (prev_backslash) { + source += "\\" + ch; + prev_backslash = false; + } else if (ch == "[") { + in_class = true; + source += ch; + } else if (ch == "]" && in_class) { + in_class = false; + source += ch; + } else if (ch == "/" && !in_class) { + break; + } else if (ch == "\\") { + prev_backslash = true; + } else { + source += ch; + } + var mods = read_name(); + try { + var regexp = new RegExp(source, mods); + regexp.raw_source = source; + return token("regexp", regexp); + } catch (e) { + parse_error(e.message); + } + }); + + function read_operator(prefix) { + function grow(op) { + if (!peek()) return op; + var bigger = op + peek(); + if (OPERATORS[bigger]) { + next(); + return grow(bigger); + } else { + return op; + } + } + return token("operator", grow(prefix || next())); + } + + function handle_slash() { + next(); + switch (peek()) { + case "/": + next(); + return skip_line_comment("comment1"); + case "*": + next(); + return skip_multiline_comment(); + } + return S.regex_allowed ? read_regexp("") : read_operator("/"); + } + + function handle_dot() { + next(); + if (looking_at("..")) return token("operator", "." + next() + next()); + return is_digit(peek().charCodeAt(0)) ? read_num(".") : token("punc", "."); + } + + function read_word() { + var word = read_name(); + if (prev_was_dot) return token("name", word); + return KEYWORDS_ATOM[word] ? token("atom", word) + : !KEYWORDS[word] ? token("name", word) + : OPERATORS[word] ? token("operator", word) + : token("keyword", word); + } + + function with_eof_error(eof_error, cont) { + return function(x) { + try { + return cont(x); + } catch (ex) { + if (ex === EX_EOF) parse_error(eof_error); + else throw ex; + } + }; + } + + function next_token(force_regexp) { + if (force_regexp != null) + return read_regexp(force_regexp); + if (shebang && S.pos == 0 && looking_at("#!")) { + start_token(); + forward(2); + skip_line_comment("comment5"); + } + for (;;) { + skip_whitespace(); + start_token(); + if (html5_comments) { + if (looking_at("") && S.newline_before) { + forward(3); + skip_line_comment("comment4"); + continue; + } + } + var ch = peek(); + if (!ch) return token("eof"); + var code = ch.charCodeAt(0); + switch (code) { + case 34: case 39: return read_string(ch); + case 46: return handle_dot(); + case 47: + var tok = handle_slash(); + if (tok === next_token) continue; + return tok; + } + if (is_digit(code)) return read_num(); + if (PUNC_CHARS[ch]) return token("punc", next()); + if (looking_at("=>")) return token("punc", next() + next()); + if (OPERATOR_CHARS[ch]) return read_operator(); + if (code == 35 || code == 92 || !NON_IDENTIFIER_CHARS[ch]) return read_word(); + break; + } + parse_error("Unexpected character '" + ch + "'"); + } + + next_token.context = function(nc) { + if (nc) S = nc; + return S; + }; + + next_token.add_directive = function(directive) { + S.directives[directive] = true; + } + + next_token.push_directives_stack = function() { + S.directives = Object.create(S.directives); + } + + next_token.pop_directives_stack = function() { + S.directives = Object.getPrototypeOf(S.directives); + } + + next_token.has_directive = function(directive) { + return !!S.directives[directive]; + } + + return next_token; +} + +/* -----[ Parser (constants) ]----- */ + +var UNARY_PREFIX = makePredicate("typeof void delete -- ++ ! ~ - +"); + +var UNARY_POSTFIX = makePredicate("-- ++"); + +var ASSIGNMENT = makePredicate("= += -= /= *= %= **= >>= <<= >>>= &= |= ^= &&= ||= ??="); + +var PRECEDENCE = function(a, ret) { + for (var i = 0; i < a.length;) { + var b = a[i++]; + for (var j = 0; j < b.length; j++) { + ret[b[j]] = i; + } + } + return ret; +}([ + ["??"], + ["||"], + ["&&"], + ["|"], + ["^"], + ["&"], + ["==", "===", "!=", "!=="], + ["<", ">", "<=", ">=", "in", "instanceof"], + [">>", "<<", ">>>"], + ["+", "-"], + ["*", "/", "%"], + ["**"], +], {}); + +var ATOMIC_START_TOKEN = makePredicate("atom bigint num regexp string"); + +/* -----[ Parser ]----- */ + +function parse($TEXT, options) { + options = defaults(options, { + bare_returns : false, + expression : false, + filename : null, + html5_comments : true, + module : false, + shebang : true, + strict : false, + toplevel : null, + }, true); + + var S = { + input : typeof $TEXT == "string" + ? tokenizer($TEXT, options.filename, options.html5_comments, options.shebang) + : $TEXT, + in_async : false, + in_directives : true, + in_funarg : -1, + in_function : 0, + in_generator : false, + in_loop : 0, + labels : [], + peeked : null, + prev : null, + token : null, + }; + + S.token = next(); + + function is(type, value) { + return is_token(S.token, type, value); + } + + function peek() { + return S.peeked || (S.peeked = S.input()); + } + + function next() { + S.prev = S.token; + if (S.peeked) { + S.token = S.peeked; + S.peeked = null; + } else { + S.token = S.input(); + } + S.in_directives = S.in_directives && ( + S.token.type == "string" || is("punc", ";") + ); + return S.token; + } + + function prev() { + return S.prev; + } + + function croak(msg, line, col, pos) { + var ctx = S.input.context(); + js_error(msg, + ctx.filename, + line != null ? line : ctx.tokline, + col != null ? col : ctx.tokcol, + pos != null ? pos : ctx.tokpos); + } + + function token_error(token, msg) { + croak(msg, token.line, token.col); + } + + function token_to_string(type, value) { + return type + (value === undefined ? "" : " «" + value + "»"); + } + + function unexpected(token) { + if (token == null) token = S.token; + token_error(token, "Unexpected token: " + token_to_string(token.type, token.value)); + } + + function expect_token(type, val) { + if (is(type, val)) return next(); + token_error(S.token, "Unexpected token: " + token_to_string(S.token.type, S.token.value) + ", expected: " + token_to_string(type, val)); + } + + function expect(punc) { + return expect_token("punc", punc); + } + + function has_newline_before(token) { + return token.nlb || !all(token.comments_before, function(comment) { + return !comment.nlb; + }); + } + + function can_insert_semicolon() { + return !options.strict + && (is("eof") || is("punc", "}") || has_newline_before(S.token)); + } + + function semicolon(optional) { + if (is("punc", ";")) next(); + else if (!optional && !can_insert_semicolon()) expect(";"); + } + + function parenthesized() { + expect("("); + var exp = expression(); + expect(")"); + return exp; + } + + function embed_tokens(parser) { + return function() { + var start = S.token; + var expr = parser.apply(null, arguments); + var end = prev(); + expr.start = start; + expr.end = end; + return expr; + }; + } + + function handle_regexp() { + if (is("operator", "/") || is("operator", "/=")) { + S.peeked = null; + S.token = S.input(S.token.value.substr(1)); // force regexp + } + } + + var statement = embed_tokens(function(toplevel) { + handle_regexp(); + switch (S.token.type) { + case "string": + var dir = S.in_directives; + var body = expression(); + if (dir) { + if (body instanceof AST_String) { + var value = body.start.raw.slice(1, -1); + S.input.add_directive(value); + body.value = value; + } else { + S.in_directives = dir = false; + } + } + semicolon(); + return dir ? new AST_Directive(body) : new AST_SimpleStatement({ body: body }); + case "num": + case "bigint": + case "regexp": + case "operator": + case "atom": + return simple_statement(); + + case "name": + switch (S.token.value) { + case "async": + if (is_token(peek(), "keyword", "function")) { + next(); + next(); + if (!is("operator", "*")) return function_(AST_AsyncDefun); + next(); + return function_(AST_AsyncGeneratorDefun); + } + break; + case "await": + if (S.in_async) return simple_statement(); + break; + case "export": + if (!toplevel && options.module !== "") unexpected(); + next(); + return export_(); + case "import": + var token = peek(); + if (token.type == "punc" && /^[(.]$/.test(token.value)) break; + if (!toplevel && options.module !== "") unexpected(); + next(); + return import_(); + case "let": + if (is_vardefs()) { + next(); + var node = let_(); + semicolon(); + return node; + } + break; + case "yield": + if (S.in_generator) return simple_statement(); + break; + } + return is_token(peek(), "punc", ":") + ? labeled_statement() + : simple_statement(); + + case "punc": + switch (S.token.value) { + case "{": + return new AST_BlockStatement({ + start : S.token, + body : block_(), + end : prev() + }); + case "[": + case "(": + case "`": + return simple_statement(); + case ";": + S.in_directives = false; + next(); + return new AST_EmptyStatement(); + default: + unexpected(); + } + + case "keyword": + switch (S.token.value) { + case "break": + next(); + return break_cont(AST_Break); + + case "class": + next(); + return class_(AST_DefClass); + + case "const": + next(); + var node = const_(); + semicolon(); + return node; + + case "continue": + next(); + return break_cont(AST_Continue); + + case "debugger": + next(); + semicolon(); + return new AST_Debugger(); + + case "do": + next(); + var body = in_loop(statement); + expect_token("keyword", "while"); + var condition = parenthesized(); + semicolon(true); + return new AST_Do({ + body : body, + condition : condition, + }); + + case "while": + next(); + return new AST_While({ + condition : parenthesized(), + body : in_loop(statement), + }); + + case "for": + next(); + return for_(); + + case "function": + next(); + if (!is("operator", "*")) return function_(AST_Defun); + next(); + return function_(AST_GeneratorDefun); + + case "if": + next(); + return if_(); + + case "return": + if (S.in_function == 0 && !options.bare_returns) + croak("'return' outside of function"); + next(); + var value = null; + if (is("punc", ";")) { + next(); + } else if (!can_insert_semicolon()) { + value = expression(); + semicolon(); + } + return new AST_Return({ value: value }); + + case "switch": + next(); + return new AST_Switch({ + expression : parenthesized(), + body : in_loop(switch_body_), + }); + + case "throw": + next(); + if (has_newline_before(S.token)) + croak("Illegal newline after 'throw'"); + var value = expression(); + semicolon(); + return new AST_Throw({ value: value }); + + case "try": + next(); + return try_(); + + case "var": + next(); + var node = var_(); + semicolon(); + return node; + + case "with": + if (S.input.has_directive("use strict")) { + croak("Strict mode may not include a with statement"); + } + next(); + return new AST_With({ + expression : parenthesized(), + body : statement(), + }); + } + } + unexpected(); + }); + + function labeled_statement() { + var label = as_symbol(AST_Label); + if (!all(S.labels, function(l) { + return l.name != label.name; + })) { + // ECMA-262, 12.12: An ECMAScript program is considered + // syntactically incorrect if it contains a + // LabelledStatement that is enclosed by a + // LabelledStatement with the same Identifier as label. + croak("Label " + label.name + " defined twice"); + } + expect(":"); + S.labels.push(label); + var stat = statement(); + S.labels.pop(); + if (!(stat instanceof AST_IterationStatement)) { + // check for `continue` that refers to this label. + // those should be reported as syntax errors. + // https://github.com/mishoo/UglifyJS/issues/287 + label.references.forEach(function(ref) { + if (ref instanceof AST_Continue) { + token_error(ref.label.start, "Continue label `" + label.name + "` must refer to IterationStatement"); + } + }); + } + return new AST_LabeledStatement({ body: stat, label: label }); + } + + function simple_statement() { + var body = expression(); + semicolon(); + return new AST_SimpleStatement({ body: body }); + } + + function break_cont(type) { + var label = null, ldef; + if (!can_insert_semicolon()) { + label = as_symbol(AST_LabelRef, true); + } + if (label != null) { + ldef = find_if(function(l) { + return l.name == label.name; + }, S.labels); + if (!ldef) token_error(label.start, "Undefined label " + label.name); + label.thedef = ldef; + } else if (S.in_loop == 0) croak(type.TYPE + " not inside a loop or switch"); + semicolon(); + var stat = new type({ label: label }); + if (ldef) ldef.references.push(stat); + return stat; + } + + function has_modifier(name, no_nlb) { + if (!is("name", name)) return; + var token = peek(); + if (!token) return; + if (is_token(token, "operator", "=")) return; + if (token.type == "punc" && /^[(;}]$/.test(token.value)) return; + if (no_nlb && has_newline_before(token)) return; + return next(); + } + + function class_(ctor) { + var was_async = S.in_async; + var was_gen = S.in_generator; + S.input.push_directives_stack(); + S.input.add_directive("use strict"); + var name; + if (ctor === AST_DefClass) { + name = as_symbol(AST_SymbolDefClass); + } else { + name = as_symbol(AST_SymbolClass, true); + } + var parent = null; + if (is("keyword", "extends")) { + next(); + handle_regexp(); + parent = expr_atom(true); + } + expect("{"); + var props = []; + while (!is("punc", "}")) { + if (is("punc", ";")) { + next(); + continue; + } + var start = S.token; + var fixed = !!has_modifier("static"); + var async = has_modifier("async", true); + if (is("operator", "*")) { + next(); + var internal = is("name") && /^#/.test(S.token.value); + var key = as_property_key(); + var gen_start = S.token; + var gen = function_(async ? AST_AsyncGeneratorFunction : AST_GeneratorFunction); + gen.start = gen_start; + gen.end = prev(); + props.push(new AST_ClassMethod({ + start: start, + static: fixed, + private: internal, + key: key, + value: gen, + end: prev(), + })); + continue; + } + if (fixed && is("punc", "{")) { + props.push(new AST_ClassInit({ + start: start, + value: new AST_ClassInitBlock({ + start: start, + body: block_(), + end: prev(), + }), + end: prev(), + })); + continue; + } + var internal = is("name") && /^#/.test(S.token.value); + var key = as_property_key(); + if (is("punc", "(")) { + var func_start = S.token; + var func = function_(async ? AST_AsyncFunction : AST_Function); + func.start = func_start; + func.end = prev(); + props.push(new AST_ClassMethod({ + start: start, + static: fixed, + private: internal, + key: key, + value: func, + end: prev(), + })); + continue; + } + if (async) unexpected(async); + var value = null; + if (is("operator", "=")) { + next(); + S.in_async = false; + S.in_generator = false; + value = maybe_assign(); + S.in_generator = was_gen; + S.in_async = was_async; + } else if (!(is("punc", ";") || is("punc", "}"))) { + var type = null; + switch (key) { + case "get": + type = AST_ClassGetter; + break; + case "set": + type = AST_ClassSetter; + break; + } + if (type) { + props.push(new type({ + start: start, + static: fixed, + private: is("name") && /^#/.test(S.token.value), + key: as_property_key(), + value: create_accessor(), + end: prev(), + })); + continue; + } + } + semicolon(); + props.push(new AST_ClassField({ + start: start, + static: fixed, + private: internal, + key: key, + value: value, + end: prev(), + })); + } + next(); + S.input.pop_directives_stack(); + S.in_generator = was_gen; + S.in_async = was_async; + return new ctor({ + extends: parent, + name: name, + properties: props, + }); + } + + function for_() { + var await_token = is("name", "await") && next(); + expect("("); + var init = null; + if (await_token || !is("punc", ";")) { + init = is("keyword", "const") + ? (next(), const_(true)) + : is("name", "let") && is_vardefs() + ? (next(), let_(true)) + : is("keyword", "var") + ? (next(), var_(true)) + : expression(true); + var ctor; + if (await_token) { + expect_token("name", "of"); + ctor = AST_ForAwaitOf; + } else if (is("operator", "in")) { + next(); + ctor = AST_ForIn; + } else if (is("name", "of")) { + next(); + ctor = AST_ForOf; + } + if (ctor) { + if (init instanceof AST_Definitions) { + if (init.definitions.length > 1) { + token_error(init.start, "Only one variable declaration allowed in for..in/of loop"); + } + if (ctor !== AST_ForIn && init.definitions[0].value) { + token_error(init.definitions[0].value.start, "No initializers allowed in for..of loop"); + } + } else if (!(is_assignable(init) || (init = to_destructured(init)) instanceof AST_Destructured)) { + token_error(init.start, "Invalid left-hand side in for..in/of loop"); + } + return for_enum(ctor, init); + } + } + return regular_for(init); + } + + function regular_for(init) { + expect(";"); + var test = is("punc", ";") ? null : expression(); + expect(";"); + var step = is("punc", ")") ? null : expression(); + expect(")"); + return new AST_For({ + init : init, + condition : test, + step : step, + body : in_loop(statement) + }); + } + + function for_enum(ctor, init) { + handle_regexp(); + var obj = expression(); + expect(")"); + return new ctor({ + init : init, + object : obj, + body : in_loop(statement) + }); + } + + function to_funarg(node) { + if (node instanceof AST_Array) { + var rest = null; + if (node.elements[node.elements.length - 1] instanceof AST_Spread) { + rest = to_funarg(node.elements.pop().expression); + } + return new AST_DestructuredArray({ + start: node.start, + elements: node.elements.map(to_funarg), + rest: rest, + end: node.end, + }); + } + if (node instanceof AST_Assign) return new AST_DefaultValue({ + start: node.start, + name: to_funarg(node.left), + value: node.right, + end: node.end, + }); + if (node instanceof AST_DefaultValue) { + node.name = to_funarg(node.name); + return node; + } + if (node instanceof AST_DestructuredArray) { + node.elements = node.elements.map(to_funarg); + if (node.rest) node.rest = to_funarg(node.rest); + return node; + } + if (node instanceof AST_DestructuredObject) { + node.properties.forEach(function(prop) { + prop.value = to_funarg(prop.value); + }); + if (node.rest) node.rest = to_funarg(node.rest); + return node; + } + if (node instanceof AST_Hole) return node; + if (node instanceof AST_Object) { + var rest = null; + if (node.properties[node.properties.length - 1] instanceof AST_Spread) { + rest = to_funarg(node.properties.pop().expression); + } + return new AST_DestructuredObject({ + start: node.start, + properties: node.properties.map(function(prop) { + if (!(prop instanceof AST_ObjectKeyVal)) token_error(prop.start, "Invalid destructuring assignment"); + return new AST_DestructuredKeyVal({ + start: prop.start, + key: prop.key, + value: to_funarg(prop.value), + end: prop.end, + }); + }), + rest: rest, + end: node.end, + }); + } + if (node instanceof AST_SymbolFunarg) return node; + if (node instanceof AST_SymbolRef) return new AST_SymbolFunarg(node); + if (node instanceof AST_Yield) return new AST_SymbolFunarg({ + start: node.start, + name: "yield", + end: node.end, + }); + token_error(node.start, "Invalid arrow parameter"); + } + + function arrow(exprs, start, async) { + var was_async = S.in_async; + var was_gen = S.in_generator; + S.in_async = async; + S.in_generator = false; + var was_funarg = S.in_funarg; + S.in_funarg = S.in_function; + var argnames = exprs.map(to_funarg); + var rest = exprs.rest || null; + if (rest) rest = to_funarg(rest); + S.in_funarg = was_funarg; + expect("=>"); + var body, value; + var loop = S.in_loop; + var labels = S.labels; + ++S.in_function; + S.input.push_directives_stack(); + S.in_loop = 0; + S.labels = []; + if (is("punc", "{")) { + S.in_directives = true; + body = block_(); + value = null; + } else { + body = []; + handle_regexp(); + value = maybe_assign(); + } + var is_strict = S.input.has_directive("use strict"); + S.input.pop_directives_stack(); + --S.in_function; + S.in_loop = loop; + S.labels = labels; + S.in_generator = was_gen; + S.in_async = was_async; + var node = new (async ? AST_AsyncArrow : AST_Arrow)({ + start: start, + argnames: argnames, + rest: rest, + body: body, + value: value, + end: prev(), + }); + if (is_strict) node.each_argname(strict_verify_symbol); + return node; + } + + var function_ = function(ctor) { + var was_async = S.in_async; + var was_gen = S.in_generator; + var name; + if (/Defun$/.test(ctor.TYPE)) { + name = as_symbol(AST_SymbolDefun); + S.in_async = /^Async/.test(ctor.TYPE); + S.in_generator = /Generator/.test(ctor.TYPE); + } else { + S.in_async = /^Async/.test(ctor.TYPE); + S.in_generator = /Generator/.test(ctor.TYPE); + name = as_symbol(AST_SymbolLambda, true); + } + if (name && ctor !== AST_Accessor && !(name instanceof AST_SymbolDeclaration)) + unexpected(prev()); + expect("("); + var was_funarg = S.in_funarg; + S.in_funarg = S.in_function; + var argnames = expr_list(")", !options.strict, false, function() { + return maybe_default(AST_SymbolFunarg); + }); + S.in_funarg = was_funarg; + var loop = S.in_loop; + var labels = S.labels; + ++S.in_function; + S.in_directives = true; + S.input.push_directives_stack(); + S.in_loop = 0; + S.labels = []; + var body = block_(); + var is_strict = S.input.has_directive("use strict"); + S.input.pop_directives_stack(); + --S.in_function; + S.in_loop = loop; + S.labels = labels; + S.in_generator = was_gen; + S.in_async = was_async; + var node = new ctor({ + name: name, + argnames: argnames, + rest: argnames.rest || null, + body: body, + }); + if (is_strict) { + if (name) strict_verify_symbol(name); + node.each_argname(strict_verify_symbol); + } + return node; + }; + + function if_() { + var cond = parenthesized(), body = statement(), alt = null; + if (is("keyword", "else")) { + next(); + alt = statement(); + } + return new AST_If({ + condition : cond, + body : body, + alternative : alt, + }); + } + + function is_alias() { + return is("name") || is("string") || is_identifier_string(S.token.value); + } + + function make_string(token) { + return new AST_String({ + start: token, + quote: token.quote, + value: token.value, + end: token, + }); + } + + function as_path() { + var path = S.token; + expect_token("string"); + semicolon(); + return make_string(path); + } + + function export_() { + if (is("operator", "*")) { + var key = S.token; + var alias = key; + next(); + if (is("name", "as")) { + next(); + if (!is_alias()) expect_token("name"); + alias = S.token; + next(); + } + expect_token("name", "from"); + return new AST_ExportForeign({ + aliases: [ make_string(alias) ], + keys: [ make_string(key) ], + path: as_path(), + }); + } + if (is("punc", "{")) { + next(); + var aliases = []; + var keys = []; + while (is_alias()) { + var key = S.token; + next(); + keys.push(key); + if (is("name", "as")) { + next(); + if (!is_alias()) expect_token("name"); + aliases.push(S.token); + next(); + } else { + aliases.push(key); + } + if (!is("punc", "}")) expect(","); + } + expect("}"); + if (is("name", "from")) { + next(); + return new AST_ExportForeign({ + aliases: aliases.map(make_string), + keys: keys.map(make_string), + path: as_path(), + }); + } + semicolon(); + return new AST_ExportReferences({ + properties: keys.map(function(token, index) { + if (!is_token(token, "name")) token_error(token, "Name expected"); + var sym = _make_symbol(AST_SymbolExport, token); + sym.alias = make_string(aliases[index]); + return sym; + }), + }); + } + if (is("keyword", "default")) { + next(); + var start = S.token; + var body = export_default_decl(); + if (body) { + body.start = start; + body.end = prev(); + } else { + handle_regexp(); + body = expression(); + semicolon(); + } + return new AST_ExportDefault({ body: body }); + } + return new AST_ExportDeclaration({ body: export_decl() }); + } + + function maybe_named(def, expr) { + if (expr.name) { + expr = new def(expr); + expr.name = new (def === AST_DefClass ? AST_SymbolDefClass : AST_SymbolDefun)(expr.name); + } + return expr; + } + + function export_default_decl() { + if (is("name", "async")) { + if (!is_token(peek(), "keyword", "function")) return; + next(); + next(); + if (!is("operator", "*")) return maybe_named(AST_AsyncDefun, function_(AST_AsyncFunction)); + next(); + return maybe_named(AST_AsyncGeneratorDefun, function_(AST_AsyncGeneratorFunction)); + } else if (is("keyword")) switch (S.token.value) { + case "class": + next(); + return maybe_named(AST_DefClass, class_(AST_ClassExpression)); + case "function": + next(); + if (!is("operator", "*")) return maybe_named(AST_Defun, function_(AST_Function)); + next(); + return maybe_named(AST_GeneratorDefun, function_(AST_GeneratorFunction)); + } + } + + var export_decl = embed_tokens(function() { + if (is("name")) switch (S.token.value) { + case "async": + next(); + expect_token("keyword", "function"); + if (!is("operator", "*")) return function_(AST_AsyncDefun); + next(); + return function_(AST_AsyncGeneratorDefun); + case "let": + next(); + var node = let_(); + semicolon(); + return node; + } else if (is("keyword")) switch (S.token.value) { + case "class": + next(); + return class_(AST_DefClass); + case "const": + next(); + var node = const_(); + semicolon(); + return node; + case "function": + next(); + if (!is("operator", "*")) return function_(AST_Defun); + next(); + return function_(AST_GeneratorDefun); + case "var": + next(); + var node = var_(); + semicolon(); + return node; + } + unexpected(); + }); + + function import_() { + var all = null; + var def = as_symbol(AST_SymbolImport, true); + var props = null; + var cont; + if (def) { + def.key = new AST_String({ + start: def.start, + value: "", + end: def.end, + }); + if (cont = is("punc", ",")) next(); + } else { + cont = !is("string"); + } + if (cont) { + if (is("operator", "*")) { + var key = S.token; + next(); + expect_token("name", "as"); + all = as_symbol(AST_SymbolImport); + all.key = make_string(key); + } else { + expect("{"); + props = []; + while (is_alias()) { + var alias; + if (is_token(peek(), "name", "as")) { + var key = S.token; + next(); + next(); + alias = as_symbol(AST_SymbolImport); + alias.key = make_string(key); + } else { + alias = as_symbol(AST_SymbolImport); + alias.key = new AST_String({ + start: alias.start, + value: alias.name, + end: alias.end, + }); + } + props.push(alias); + if (!is("punc", "}")) expect(","); + } + expect("}"); + } + } + if (all || def || props) expect_token("name", "from"); + return new AST_Import({ + all: all, + default: def, + path: as_path(), + properties: props, + }); + } + + function block_() { + expect("{"); + var a = []; + while (!is("punc", "}")) { + if (is("eof")) expect("}"); + a.push(statement()); + } + next(); + return a; + } + + function switch_body_() { + expect("{"); + var a = [], branch, cur, default_branch, tmp; + while (!is("punc", "}")) { + if (is("eof")) expect("}"); + if (is("keyword", "case")) { + if (branch) branch.end = prev(); + cur = []; + branch = new AST_Case({ + start : (tmp = S.token, next(), tmp), + expression : expression(), + body : cur + }); + a.push(branch); + expect(":"); + } else if (is("keyword", "default")) { + if (branch) branch.end = prev(); + if (default_branch) croak("More than one default clause in switch statement"); + cur = []; + branch = new AST_Default({ + start : (tmp = S.token, next(), expect(":"), tmp), + body : cur + }); + a.push(branch); + default_branch = branch; + } else { + if (!cur) unexpected(); + cur.push(statement()); + } + } + if (branch) branch.end = prev(); + next(); + return a; + } + + function try_() { + var body = block_(), bcatch = null, bfinally = null; + if (is("keyword", "catch")) { + var start = S.token; + next(); + var name = null; + if (is("punc", "(")) { + next(); + name = maybe_destructured(AST_SymbolCatch); + expect(")"); + } + bcatch = new AST_Catch({ + start : start, + argname : name, + body : block_(), + end : prev() + }); + } + if (is("keyword", "finally")) { + var start = S.token; + next(); + bfinally = new AST_Finally({ + start : start, + body : block_(), + end : prev() + }); + } + if (!bcatch && !bfinally) + croak("Missing catch/finally blocks"); + return new AST_Try({ + body : body, + bcatch : bcatch, + bfinally : bfinally + }); + } + + function vardefs(type, no_in) { + var a = []; + for (;;) { + var start = S.token; + var name = maybe_destructured(type); + var value = null; + if (is("operator", "=")) { + next(); + value = maybe_assign(no_in); + } else if (!no_in && (type === AST_SymbolConst || name instanceof AST_Destructured)) { + croak("Missing initializer in declaration"); + } + a.push(new AST_VarDef({ + start : start, + name : name, + value : value, + end : prev() + })); + if (!is("punc", ",")) + break; + next(); + } + return a; + } + + function is_vardefs() { + var token = peek(); + return is_token(token, "name") || is_token(token, "punc", "[") || is_token(token, "punc", "{"); + } + + var const_ = function(no_in) { + return new AST_Const({ + start : prev(), + definitions : vardefs(AST_SymbolConst, no_in), + end : prev() + }); + }; + + var let_ = function(no_in) { + return new AST_Let({ + start : prev(), + definitions : vardefs(AST_SymbolLet, no_in), + end : prev() + }); + }; + + var var_ = function(no_in) { + return new AST_Var({ + start : prev(), + definitions : vardefs(AST_SymbolVar, no_in), + end : prev() + }); + }; + + var new_ = function(allow_calls) { + var start = S.token; + expect_token("operator", "new"); + var call; + if (is("punc", ".") && is_token(peek(), "name", "target")) { + next(); + next(); + call = new AST_NewTarget(); + } else { + var exp = expr_atom(false), args; + if (is("punc", "(")) { + next(); + args = expr_list(")", !options.strict); + } else { + args = []; + } + call = new AST_New({ expression: exp, args: args }); + } + call.start = start; + call.end = prev(); + return subscripts(call, allow_calls); + }; + + function as_atom_node() { + var ret, tok = S.token, value = tok.value; + switch (tok.type) { + case "num": + if (isFinite(value)) { + ret = new AST_Number({ value: value }); + } else { + ret = new AST_Infinity(); + if (value < 0) ret = new AST_UnaryPrefix({ operator: "-", expression: ret }); + } + break; + case "bigint": + ret = new AST_BigInt({ value: value }); + break; + case "string": + ret = new AST_String({ value: value, quote: tok.quote }); + break; + case "regexp": + ret = new AST_RegExp({ value: value }); + break; + case "atom": + switch (value) { + case "false": + ret = new AST_False(); + break; + case "true": + ret = new AST_True(); + break; + case "null": + ret = new AST_Null(); + break; + default: + unexpected(); + } + break; + default: + unexpected(); + } + next(); + ret.start = ret.end = tok; + return ret; + } + + var expr_atom = function(allow_calls) { + if (is("operator", "new")) { + return new_(allow_calls); + } + var start = S.token; + if (is("punc")) { + switch (start.value) { + case "`": + return subscripts(template(null), allow_calls); + case "(": + next(); + if (is("punc", ")")) { + next(); + return arrow([], start); + } + var ex = expression(false, true); + var len = start.comments_before.length; + [].unshift.apply(ex.start.comments_before, start.comments_before); + start.comments_before.length = 0; + start.comments_before = ex.start.comments_before; + start.comments_before_length = len; + if (len == 0 && start.comments_before.length > 0) { + var comment = start.comments_before[0]; + if (!comment.nlb) { + comment.nlb = start.nlb; + start.nlb = false; + } + } + start.comments_after = ex.start.comments_after; + ex.start = start; + expect(")"); + var end = prev(); + end.comments_before = ex.end.comments_before; + end.comments_after.forEach(function(comment) { + ex.end.comments_after.push(comment); + if (comment.nlb) S.token.nlb = true; + }); + end.comments_after.length = 0; + end.comments_after = ex.end.comments_after; + ex.end = end; + if (is("punc", "=>")) return arrow(ex instanceof AST_Sequence ? ex.expressions : [ ex ], start); + return subscripts(ex, allow_calls); + case "[": + return subscripts(array_(), allow_calls); + case "{": + return subscripts(object_(), allow_calls); + } + unexpected(); + } + if (is("keyword")) switch (start.value) { + case "class": + next(); + var clazz = class_(AST_ClassExpression); + clazz.start = start; + clazz.end = prev(); + return subscripts(clazz, allow_calls); + case "function": + next(); + var func; + if (is("operator", "*")) { + next(); + func = function_(AST_GeneratorFunction); + } else { + func = function_(AST_Function); + } + func.start = start; + func.end = prev(); + return subscripts(func, allow_calls); + } + if (is("name")) { + var sym = _make_symbol(AST_SymbolRef, start); + next(); + if (sym.name == "async") { + if (is("keyword", "function")) { + next(); + var func; + if (is("operator", "*")) { + next(); + func = function_(AST_AsyncGeneratorFunction); + } else { + func = function_(AST_AsyncFunction); + } + func.start = start; + func.end = prev(); + return subscripts(func, allow_calls); + } + if (is("name") && is_token(peek(), "punc", "=>")) { + start = S.token; + sym = _make_symbol(AST_SymbolRef, start); + next(); + return arrow([ sym ], start, true); + } + if (is("punc", "(")) { + var call = subscripts(sym, allow_calls); + if (!is("punc", "=>")) return call; + var args = call.args; + if (args[args.length - 1] instanceof AST_Spread) { + args.rest = args.pop().expression; + } + return arrow(args, start, true); + } + } + return is("punc", "=>") ? arrow([ sym ], start) : subscripts(sym, allow_calls); + } + if (ATOMIC_START_TOKEN[S.token.type]) { + return subscripts(as_atom_node(), allow_calls); + } + unexpected(); + }; + + function expr_list(closing, allow_trailing_comma, allow_empty, parser) { + if (!parser) parser = maybe_assign; + var first = true, a = []; + while (!is("punc", closing)) { + if (first) first = false; else expect(","); + if (allow_trailing_comma && is("punc", closing)) break; + if (allow_empty && is("punc", ",")) { + a.push(new AST_Hole({ start: S.token, end: S.token })); + } else if (!is("operator", "...")) { + a.push(parser()); + } else if (parser === maybe_assign) { + a.push(new AST_Spread({ + start: S.token, + expression: (next(), parser()), + end: prev(), + })); + } else { + next(); + a.rest = parser(); + if (a.rest instanceof AST_DefaultValue) token_error(a.rest.start, "Invalid rest parameter"); + break; + } + } + expect(closing); + return a; + } + + var array_ = embed_tokens(function() { + expect("["); + return new AST_Array({ + elements: expr_list("]", !options.strict, true) + }); + }); + + var create_accessor = embed_tokens(function() { + return function_(AST_Accessor); + }); + + var object_ = embed_tokens(function() { + expect("{"); + var first = true, a = []; + while (!is("punc", "}")) { + if (first) first = false; else expect(","); + // allow trailing comma + if (!options.strict && is("punc", "}")) break; + var start = S.token; + if (is("operator", "*")) { + next(); + var key = as_property_key(); + var gen_start = S.token; + var gen = function_(AST_GeneratorFunction); + gen.start = gen_start; + gen.end = prev(); + a.push(new AST_ObjectMethod({ + start: start, + key: key, + value: gen, + end: prev(), + })); + continue; + } + if (is("operator", "...")) { + next(); + a.push(new AST_Spread({ + start: start, + expression: maybe_assign(), + end: prev(), + })); + continue; + } + if (is_token(peek(), "operator", "=")) { + var name = as_symbol(AST_SymbolRef); + next(); + a.push(new AST_ObjectKeyVal({ + start: start, + key: start.value, + value: new AST_Assign({ + start: start, + left: name, + operator: "=", + right: maybe_assign(), + end: prev(), + }), + end: prev(), + })); + continue; + } + if (is_token(peek(), "punc", ",") || is_token(peek(), "punc", "}")) { + a.push(new AST_ObjectKeyVal({ + start: start, + key: start.value, + value: as_symbol(AST_SymbolRef), + end: prev(), + })); + continue; + } + var key = as_property_key(); + if (is("punc", "(")) { + var func_start = S.token; + var func = function_(AST_Function); + func.start = func_start; + func.end = prev(); + a.push(new AST_ObjectMethod({ + start: start, + key: key, + value: func, + end: prev(), + })); + continue; + } + if (is("punc", ":")) { + next(); + a.push(new AST_ObjectKeyVal({ + start: start, + key: key, + value: maybe_assign(), + end: prev(), + })); + continue; + } + if (start.type == "name") switch (key) { + case "async": + var is_gen = is("operator", "*") && next(); + key = as_property_key(); + var func_start = S.token; + var func = function_(is_gen ? AST_AsyncGeneratorFunction : AST_AsyncFunction); + func.start = func_start; + func.end = prev(); + a.push(new AST_ObjectMethod({ + start: start, + key: key, + value: func, + end: prev(), + })); + continue; + case "get": + a.push(new AST_ObjectGetter({ + start: start, + key: as_property_key(), + value: create_accessor(), + end: prev(), + })); + continue; + case "set": + a.push(new AST_ObjectSetter({ + start: start, + key: as_property_key(), + value: create_accessor(), + end: prev(), + })); + continue; + } + unexpected(); + } + next(); + return new AST_Object({ properties: a }); + }); + + function as_property_key() { + var tmp = S.token; + switch (tmp.type) { + case "operator": + if (!KEYWORDS[tmp.value]) unexpected(); + case "num": + case "string": + case "name": + case "keyword": + case "atom": + next(); + return "" + tmp.value; + case "punc": + expect("["); + var key = maybe_assign(); + expect("]"); + return key; + default: + unexpected(); + } + } + + function as_name() { + var name = S.token.value; + expect_token("name"); + return name; + } + + function _make_symbol(type, token) { + var name = token.value; + switch (name) { + case "await": + if (S.in_async) unexpected(token); + break; + case "super": + type = AST_Super; + break; + case "this": + type = AST_This; + break; + case "yield": + if (S.in_generator) unexpected(token); + break; + } + return new type({ + name: "" + name, + start: token, + end: token, + }); + } + + function strict_verify_symbol(sym) { + if (sym.name == "arguments" || sym.name == "eval" || sym.name == "let") + token_error(sym.start, "Unexpected " + sym.name + " in strict mode"); + } + + function as_symbol(type, no_error) { + if (!is("name")) { + if (!no_error) croak("Name expected"); + return null; + } + var sym = _make_symbol(type, S.token); + if (S.input.has_directive("use strict") && sym instanceof AST_SymbolDeclaration) { + strict_verify_symbol(sym); + } + next(); + return sym; + } + + function maybe_destructured(type) { + var start = S.token; + if (is("punc", "[")) { + next(); + var elements = expr_list("]", !options.strict, true, function() { + return maybe_default(type); + }); + return new AST_DestructuredArray({ + start: start, + elements: elements, + rest: elements.rest || null, + end: prev(), + }); + } + if (is("punc", "{")) { + next(); + var first = true, a = [], rest = null; + while (!is("punc", "}")) { + if (first) first = false; else expect(","); + // allow trailing comma + if (!options.strict && is("punc", "}")) break; + var key_start = S.token; + if (is("punc", "[") || is_token(peek(), "punc", ":")) { + var key = as_property_key(); + expect(":"); + a.push(new AST_DestructuredKeyVal({ + start: key_start, + key: key, + value: maybe_default(type), + end: prev(), + })); + continue; + } + if (is("operator", "...")) { + next(); + rest = maybe_destructured(type); + break; + } + var name = as_symbol(type); + if (is("operator", "=")) { + next(); + name = new AST_DefaultValue({ + start: name.start, + name: name, + value: maybe_assign(), + end: prev(), + }); + } + a.push(new AST_DestructuredKeyVal({ + start: key_start, + key: key_start.value, + value: name, + end: prev(), + })); + } + expect("}"); + return new AST_DestructuredObject({ + start: start, + properties: a, + rest: rest, + end: prev(), + }); + } + return as_symbol(type); + } + + function maybe_default(type) { + var start = S.token; + var name = maybe_destructured(type); + if (!is("operator", "=")) return name; + next(); + return new AST_DefaultValue({ + start: start, + name: name, + value: maybe_assign(), + end: prev(), + }); + } + + function template(tag) { + var start = tag ? tag.start : S.token; + var read = S.input.context().read_template; + var strings = []; + var expressions = []; + while (read(strings)) { + next(); + expressions.push(expression()); + if (!is("punc", "}")) unexpected(); + } + next(); + return new AST_Template({ + start: start, + expressions: expressions, + strings: strings, + tag: tag, + end: prev(), + }); + } + + function subscripts(expr, allow_calls) { + var start = expr.start; + var optional = null; + while (true) { + if (is("operator", "?") && is_token(peek(), "punc", ".")) { + next(); + next(); + optional = expr; + } + if (is("punc", "[")) { + next(); + var prop = expression(); + expect("]"); + expr = new AST_Sub({ + start: start, + optional: optional === expr, + expression: expr, + property: prop, + end: prev(), + }); + } else if (allow_calls && is("punc", "(")) { + next(); + expr = new AST_Call({ + start: start, + optional: optional === expr, + expression: expr, + args: expr_list(")", !options.strict), + end: prev(), + }); + } else if (optional === expr || is("punc", ".")) { + if (optional !== expr) next(); + expr = new AST_Dot({ + start: start, + optional: optional === expr, + expression: expr, + property: as_name(), + end: prev(), + }); + } else if (is("punc", "`")) { + if (optional) croak("Invalid template on optional chain"); + expr = template(expr); + } else { + break; + } + } + if (optional) expr.terminal = true; + if (expr instanceof AST_Call && !expr.pure) { + var start = expr.start; + var comments = start.comments_before; + var i = HOP(start, "comments_before_length") ? start.comments_before_length : comments.length; + while (--i >= 0) { + if (/[@#]__PURE__/.test(comments[i].value)) { + expr.pure = true; + break; + } + } + } + return expr; + } + + function maybe_unary(no_in) { + var start = S.token; + if (S.in_async && is("name", "await")) { + if (S.in_funarg === S.in_function) croak("Invalid use of await in function argument"); + S.input.context().regex_allowed = true; + next(); + return new AST_Await({ + start: start, + expression: maybe_unary(no_in), + end: prev(), + }); + } + if (S.in_generator && is("name", "yield")) { + if (S.in_funarg === S.in_function) croak("Invalid use of yield in function argument"); + S.input.context().regex_allowed = true; + next(); + var exp = null; + var nested = false; + if (is("operator", "*")) { + next(); + exp = maybe_assign(no_in); + nested = true; + } else if (is("punc") ? !PUNC_AFTER_EXPRESSION[S.token.value] : !can_insert_semicolon()) { + exp = maybe_assign(no_in); + } + return new AST_Yield({ + start: start, + expression: exp, + nested: nested, + end: prev(), + }); + } + if (is("operator") && UNARY_PREFIX[start.value]) { + next(); + handle_regexp(); + var ex = make_unary(AST_UnaryPrefix, start, maybe_unary(no_in)); + ex.start = start; + ex.end = prev(); + return ex; + } + var val = expr_atom(true); + while (is("operator") && UNARY_POSTFIX[S.token.value] && !has_newline_before(S.token)) { + val = make_unary(AST_UnaryPostfix, S.token, val); + val.start = start; + val.end = S.token; + next(); + } + return val; + } + + function make_unary(ctor, token, expr) { + var op = token.value; + switch (op) { + case "++": + case "--": + if (!is_assignable(expr)) + token_error(token, "Invalid use of " + op + " operator"); + break; + case "delete": + if (expr instanceof AST_SymbolRef && S.input.has_directive("use strict")) + token_error(expr.start, "Calling delete on expression not allowed in strict mode"); + break; + } + return new ctor({ operator: op, expression: expr }); + } + + var expr_op = function(left, min_precision, no_in) { + var op = is("operator") ? S.token.value : null; + if (op == "in" && no_in) op = null; + var precision = op != null ? PRECEDENCE[op] : null; + if (precision != null && precision > min_precision) { + next(); + var right = expr_op(maybe_unary(no_in), op == "**" ? precision - 1 : precision, no_in); + return expr_op(new AST_Binary({ + start : left.start, + left : left, + operator : op, + right : right, + end : right.end, + }), min_precision, no_in); + } + return left; + }; + + function expr_ops(no_in) { + return expr_op(maybe_unary(no_in), 0, no_in); + } + + var maybe_conditional = function(no_in) { + var start = S.token; + var expr = expr_ops(no_in); + if (is("operator", "?")) { + next(); + var yes = maybe_assign(); + expect(":"); + return new AST_Conditional({ + start : start, + condition : expr, + consequent : yes, + alternative : maybe_assign(no_in), + end : prev() + }); + } + return expr; + }; + + function is_assignable(expr) { + return expr instanceof AST_PropAccess && !expr.optional || expr instanceof AST_SymbolRef; + } + + function to_destructured(node) { + if (node instanceof AST_Array) { + var rest = null; + if (node.elements[node.elements.length - 1] instanceof AST_Spread) { + rest = to_destructured(node.elements.pop().expression); + if (!(rest instanceof AST_Destructured || is_assignable(rest))) return node; + } + var elements = node.elements.map(to_destructured); + return all(elements, function(node) { + return node instanceof AST_DefaultValue + || node instanceof AST_Destructured + || node instanceof AST_Hole + || is_assignable(node); + }) ? new AST_DestructuredArray({ + start: node.start, + elements: elements, + rest: rest, + end: node.end, + }) : node; + } + if (node instanceof AST_Assign) { + var name = to_destructured(node.left); + return name instanceof AST_Destructured || is_assignable(name) ? new AST_DefaultValue({ + start: node.start, + name: name, + value: node.right, + end: node.end, + }) : node; + } + if (!(node instanceof AST_Object)) return node; + var rest = null; + if (node.properties[node.properties.length - 1] instanceof AST_Spread) { + rest = to_destructured(node.properties.pop().expression); + if (!(rest instanceof AST_Destructured || is_assignable(rest))) return node; + } + var props = []; + for (var i = 0; i < node.properties.length; i++) { + var prop = node.properties[i]; + if (!(prop instanceof AST_ObjectKeyVal)) return node; + var value = to_destructured(prop.value); + if (!(value instanceof AST_DefaultValue || value instanceof AST_Destructured || is_assignable(value))) { + return node; + } + props.push(new AST_DestructuredKeyVal({ + start: prop.start, + key: prop.key, + value: value, + end: prop.end, + })); + } + return new AST_DestructuredObject({ + start: node.start, + properties: props, + rest: rest, + end: node.end, + }); + } + + function maybe_assign(no_in) { + var start = S.token; + var left = maybe_conditional(no_in), val = S.token.value; + if (is("operator") && ASSIGNMENT[val]) { + if (is_assignable(left) || val == "=" && (left = to_destructured(left)) instanceof AST_Destructured) { + next(); + return new AST_Assign({ + start : start, + left : left, + operator : val, + right : maybe_assign(no_in), + end : prev() + }); + } + croak("Invalid assignment"); + } + return left; + } + + function expression(no_in, maybe_arrow) { + var start = S.token; + var exprs = []; + while (true) { + if (maybe_arrow && is("operator", "...")) { + next(); + exprs.rest = maybe_destructured(AST_SymbolFunarg); + break; + } + exprs.push(maybe_assign(no_in)); + if (!is("punc", ",")) break; + next(); + if (maybe_arrow && is("punc", ")") && is_token(peek(), "punc", "=>")) break; + } + return exprs.length == 1 && !exprs.rest ? exprs[0] : new AST_Sequence({ + start: start, + expressions: exprs, + end: prev(), + }); + } + + function in_loop(cont) { + ++S.in_loop; + var ret = cont(); + --S.in_loop; + return ret; + } + + if (options.expression) { + handle_regexp(); + var exp = expression(); + expect_token("eof"); + return exp; + } + + return function() { + var start = S.token; + var body = []; + if (options.module) { + S.in_async = true; + S.input.add_directive("use strict"); + } + S.input.push_directives_stack(); + while (!is("eof")) + body.push(statement(true)); + S.input.pop_directives_stack(); + var end = prev() || start; + var toplevel = options.toplevel; + if (toplevel) { + toplevel.body = toplevel.body.concat(body); + toplevel.end = end; + } else { + toplevel = new AST_Toplevel({ start: start, body: body, end: end }); + } + return toplevel; + }(); +} diff --git a/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/propmangle.js b/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/propmangle.js new file mode 100644 index 00000000..3e71b68c --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/propmangle.js @@ -0,0 +1,328 @@ +/*********************************************************************** + + A JavaScript tokenizer / parser / beautifier / compressor. + https://github.com/mishoo/UglifyJS + + -------------------------------- (C) --------------------------------- + + Author: Mihai Bazon + + http://mihai.bazon.net/blog + + Distributed under the BSD license: + + Copyright 2012 (c) Mihai Bazon + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + ***********************************************************************/ + +"use strict"; + +function get_builtins() { + var names = new Dictionary(); + // constants + [ + "NaN", + "null", + "true", + "false", + "Infinity", + "-Infinity", + "undefined", + ].forEach(add); + // global functions + [ + "encodeURI", + "encodeURIComponent", + "escape", + "eval", + "decodeURI", + "decodeURIComponent", + "isFinite", + "isNaN", + "parseFloat", + "parseInt", + "unescape", + ].forEach(add); + // global constructors & objects + var global = Function("return this")(); + [ + "Array", + "ArrayBuffer", + "Atomics", + "BigInt", + "Boolean", + "console", + "DataView", + "Date", + "Error", + "Function", + "Int8Array", + "Intl", + "JSON", + "Map", + "Math", + "Number", + "Object", + "Promise", + "Proxy", + "Reflect", + "RegExp", + "Set", + "String", + "Symbol", + "WebAssembly", + ].forEach(function(name) { + add(name); + var ctor = global[name]; + if (!ctor) return; + Object.getOwnPropertyNames(ctor).map(add); + if (typeof ctor != "function") return; + if (ctor.__proto__) Object.getOwnPropertyNames(ctor.__proto__).map(add); + if (ctor.prototype) Object.getOwnPropertyNames(ctor.prototype).map(add); + try { + Object.getOwnPropertyNames(new ctor()).map(add); + } catch (e) { + try { + Object.getOwnPropertyNames(ctor()).map(add); + } catch (e) {} + } + }); + return (get_builtins = function() { + return names.clone(); + })(); + + function add(name) { + names.set(name, true); + } +} + +function reserve_quoted_keys(ast, reserved) { + ast.walk(new TreeWalker(function(node) { + if (node instanceof AST_ClassProperty + || node instanceof AST_DestructuredKeyVal + || node instanceof AST_ObjectProperty) { + if (node.key instanceof AST_Node) { + addStrings(node.key, add); + } else if (node.start && node.start.quote) { + add(node.key); + } + } else if (node instanceof AST_Dot) { + if (node.quoted) add(node.property); + } else if (node instanceof AST_Sub) { + addStrings(node.property, add); + } + })); + + function add(name) { + push_uniq(reserved, name); + } +} + +function addStrings(node, add) { + if (node instanceof AST_Conditional) { + addStrings(node.consequent, add); + addStrings(node.alternative, add); + } else if (node instanceof AST_Sequence) { + addStrings(node.tail_node(), add); + } else if (node instanceof AST_String) { + add(node.value); + } +} + +function mangle_properties(ast, options) { + options = defaults(options, { + builtins: false, + cache: null, + debug: false, + domprops: false, + keep_quoted: false, + regex: null, + reserved: null, + }, true); + + var reserved = options.builtins ? new Dictionary() : get_builtins(); + if (!options.domprops && typeof domprops !== "undefined") domprops.forEach(function(name) { + reserved.set(name, true); + }); + if (Array.isArray(options.reserved)) options.reserved.forEach(function(name) { + reserved.set(name, true); + }); + + var cname = -1; + var cache; + if (options.cache) { + cache = options.cache.props; + cache.each(function(name) { + reserved.set(name, true); + }); + } else { + cache = new Dictionary(); + } + + var regex = options.regex; + + // note debug is either false (disabled), or a string of the debug suffix to use (enabled). + // note debug may be enabled as an empty string, which is falsy. Also treat passing 'true' + // the same as passing an empty string. + var debug = options.debug !== false; + var debug_suffix; + if (debug) debug_suffix = options.debug === true ? "" : options.debug; + + var names_to_mangle = new Dictionary(); + var unmangleable = reserved.clone(); + + // step 1: find candidates to mangle + ast.walk(new TreeWalker(function(node) { + if (node.TYPE == "Call") { + var exp = node.expression; + if (exp instanceof AST_Dot) switch (exp.property) { + case "defineProperty": + case "getOwnPropertyDescriptor": + if (node.args.length < 2) break; + exp = exp.expression; + if (!(exp instanceof AST_SymbolRef)) break; + if (exp.name != "Object") break; + if (!exp.definition().undeclared) break; + addStrings(node.args[1], add); + break; + case "hasOwnProperty": + if (node.args.length < 1) break; + addStrings(node.args[0], add); + break; + } + } else if (node instanceof AST_ClassProperty + || node instanceof AST_DestructuredKeyVal + || node instanceof AST_ObjectProperty) { + if (node.key instanceof AST_Node) { + addStrings(node.key, add); + } else { + add(node.key); + } + } else if (node instanceof AST_Dot) { + if (is_lhs(node, this.parent())) add(node.property); + } else if (node instanceof AST_Sub) { + if (is_lhs(node, this.parent())) addStrings(node.property, add); + } + })); + + // step 2: renaming properties + ast.walk(new TreeWalker(function(node) { + if (node instanceof AST_Binary) { + if (node.operator == "in") mangleStrings(node.left); + } else if (node.TYPE == "Call") { + var exp = node.expression; + if (exp instanceof AST_Dot) switch (exp.property) { + case "defineProperty": + case "getOwnPropertyDescriptor": + if (node.args.length < 2) break; + exp = exp.expression; + if (!(exp instanceof AST_SymbolRef)) break; + if (exp.name != "Object") break; + if (!exp.definition().undeclared) break; + mangleStrings(node.args[1]); + break; + case "hasOwnProperty": + if (node.args.length < 1) break; + mangleStrings(node.args[0]); + break; + } + } else if (node instanceof AST_ClassProperty + || node instanceof AST_DestructuredKeyVal + || node instanceof AST_ObjectProperty) { + if (node.key instanceof AST_Node) { + mangleStrings(node.key); + } else { + node.key = mangle(node.key); + } + } else if (node instanceof AST_Dot) { + node.property = mangle(node.property); + } else if (node instanceof AST_Sub) { + if (!options.keep_quoted) mangleStrings(node.property); + } + })); + + // only function declarations after this line + + function can_mangle(name) { + if (unmangleable.has(name)) return false; + if (/^-?[0-9]+(\.[0-9]+)?(e[+-][0-9]+)?$/.test(name)) return false; + return true; + } + + function should_mangle(name) { + if (reserved.has(name)) { + AST_Node.info("Preserving reserved property {this}", name); + return false; + } + if (regex && !regex.test(name)) { + AST_Node.info("Preserving excluded property {this}", name); + return false; + } + return cache.has(name) || names_to_mangle.has(name); + } + + function add(name) { + if (can_mangle(name)) names_to_mangle.set(name, true); + if (!should_mangle(name)) unmangleable.set(name, true); + } + + function mangle(name) { + if (!should_mangle(name)) return name; + var mangled = cache.get(name); + if (!mangled) { + if (debug) { + // debug mode: use a prefix and suffix to preserve readability, e.g. o.foo ---> o._$foo$NNN_. + var debug_mangled = "_$" + name + "$" + debug_suffix + "_"; + if (can_mangle(debug_mangled)) mangled = debug_mangled; + } + // either debug mode is off, or it is on and we could not use the mangled name + if (!mangled) do { + mangled = base54(++cname); + } while (!can_mangle(mangled)); + if (/^#/.test(name)) mangled = "#" + mangled; + cache.set(name, mangled); + } + AST_Node.info("Mapping property {name} to {mangled}", { + mangled: mangled, + name: name, + }); + return mangled; + } + + function mangleStrings(node) { + if (node instanceof AST_Sequence) { + mangleStrings(node.tail_node()); + } else if (node instanceof AST_String) { + node.value = mangle(node.value); + } else if (node instanceof AST_Conditional) { + mangleStrings(node.consequent); + mangleStrings(node.alternative); + } + } +} diff --git a/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/scope.js b/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/scope.js new file mode 100644 index 00000000..c2108c50 --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/scope.js @@ -0,0 +1,866 @@ +/*********************************************************************** + + A JavaScript tokenizer / parser / beautifier / compressor. + https://github.com/mishoo/UglifyJS + + -------------------------------- (C) --------------------------------- + + Author: Mihai Bazon + + http://mihai.bazon.net/blog + + Distributed under the BSD license: + + Copyright 2012 (c) Mihai Bazon + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + ***********************************************************************/ + +"use strict"; + +function SymbolDef(id, scope, orig, init) { + this._bits = 0; + this.defun = undefined; + this.eliminated = 0; + this.id = id; + this.init = init; + this.mangled_name = null; + this.name = orig.name; + this.orig = [ orig ]; + this.references = []; + this.replaced = 0; + this.safe_ids = undefined; + this.scope = scope; +} + +SymbolDef.prototype = { + forEach: function(fn) { + this.orig.forEach(fn); + this.references.forEach(fn); + }, + mangle: function(options) { + if (this.mangled_name) return; + var cache = this.global && options.cache && options.cache.props; + if (cache && cache.has(this.name)) { + this.mangled_name = cache.get(this.name); + } else if (this.unmangleable(options)) { + names_in_use(this.scope, options).set(this.name, true); + } else { + var def = this.redefined(); + if (def) { + this.mangled_name = def.mangled_name || def.name; + } else { + this.mangled_name = next_mangled_name(this, options); + } + if (cache) cache.set(this.name, this.mangled_name); + } + }, + redefined: function() { + var self = this; + var scope = self.defun; + if (!scope) return; + var name = self.name; + var def = scope.variables.get(name) + || scope instanceof AST_Toplevel && scope.globals.get(name) + || self.orig[0] instanceof AST_SymbolConst && find_if(function(def) { + return def.name == name; + }, scope.enclosed); + if (def && def !== self) return def.redefined() || def; + }, + unmangleable: function(options) { + if (this.exported) return true; + if (this.undeclared) return true; + if (!options.eval && this.scope.pinned()) return true; + if (options.keep_fargs && is_funarg(this)) return true; + if (options.keep_fnames) { + var sym = this.orig[0]; + if (sym instanceof AST_SymbolClass) return true; + if (sym instanceof AST_SymbolDefClass) return true; + if (sym instanceof AST_SymbolDefun) return true; + if (sym instanceof AST_SymbolLambda) return true; + } + if (!options.toplevel && this.global) return true; + return false; + }, +}; + +DEF_BITPROPS(SymbolDef, [ + "const_redefs", + "cross_loop", + "direct_access", + "exported", + "global", + "undeclared", +]); + +function is_funarg(def) { + return def.orig[0] instanceof AST_SymbolFunarg || def.orig[1] instanceof AST_SymbolFunarg; +} + +var unary_side_effects = makePredicate("delete ++ --"); + +function is_lhs(node, parent) { + if (parent instanceof AST_Assign) return parent.left === node && node; + if (parent instanceof AST_DefaultValue) return parent.name === node && node; + if (parent instanceof AST_Destructured) return node; + if (parent instanceof AST_DestructuredKeyVal) return node; + if (parent instanceof AST_ForEnumeration) return parent.init === node && node; + if (parent instanceof AST_Unary) return unary_side_effects[parent.operator] && parent.expression; +} + +AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) { + options = defaults(options, { + cache: null, + ie: false, + }); + + // pass 1: setup scope chaining and handle definitions + var self = this; + var defun = null; + var exported = false; + var next_def_id = 0; + var scope = self.parent_scope = null; + var tw = new TreeWalker(function(node, descend) { + if (node instanceof AST_DefClass) { + var save_exported = exported; + exported = tw.parent() instanceof AST_ExportDeclaration; + node.name.walk(tw); + exported = save_exported; + walk_scope(function() { + if (node.extends) node.extends.walk(tw); + node.properties.forEach(function(prop) { + prop.walk(tw); + }); + }); + return true; + } + if (node instanceof AST_Definitions) { + var save_exported = exported; + exported = tw.parent() instanceof AST_ExportDeclaration; + descend(); + exported = save_exported; + return true; + } + if (node instanceof AST_LambdaDefinition) { + var save_exported = exported; + exported = tw.parent() instanceof AST_ExportDeclaration; + node.name.walk(tw); + exported = save_exported; + walk_scope(function() { + node.argnames.forEach(function(argname) { + argname.walk(tw); + }); + if (node.rest) node.rest.walk(tw); + walk_body(node, tw); + }); + return true; + } + if (node instanceof AST_SwitchBranch) { + node.init_vars(scope); + descend(); + return true; + } + if (node instanceof AST_Try) { + walk_scope(function() { + walk_body(node, tw); + }); + if (node.bcatch) node.bcatch.walk(tw); + if (node.bfinally) node.bfinally.walk(tw); + return true; + } + if (node instanceof AST_With) { + var s = scope; + do { + s = s.resolve(); + if (s.uses_with) break; + s.uses_with = true; + } while (s = s.parent_scope); + walk_scope(descend); + return true; + } + if (node instanceof AST_BlockScope) { + walk_scope(descend); + return true; + } + if (node instanceof AST_Symbol) { + node.scope = scope; + } + if (node instanceof AST_Label) { + node.thedef = node; + node.references = []; + } + if (node instanceof AST_SymbolCatch) { + scope.def_variable(node).defun = defun; + } else if (node instanceof AST_SymbolConst) { + var def = scope.def_variable(node); + def.defun = defun; + if (exported) def.exported = true; + } else if (node instanceof AST_SymbolDefun) { + var def = defun.def_function(node, tw.parent()); + if (exported) def.exported = true; + } else if (node instanceof AST_SymbolFunarg) { + defun.def_variable(node); + } else if (node instanceof AST_SymbolLambda) { + var def = defun.def_function(node, node.name == "arguments" ? undefined : defun); + if (options.ie && node.name != "arguments") def.defun = defun.parent_scope.resolve(); + } else if (node instanceof AST_SymbolLet) { + var def = scope.def_variable(node); + if (exported) def.exported = true; + } else if (node instanceof AST_SymbolVar) { + var def = defun.def_variable(node, node instanceof AST_SymbolImport ? undefined : null); + if (exported) def.exported = true; + } + + function walk_scope(descend) { + node.init_vars(scope); + var save_defun = defun; + var save_scope = scope; + if (node instanceof AST_Scope) defun = node; + scope = node; + descend(); + scope = save_scope; + defun = save_defun; + } + }); + self.make_def = function(orig, init) { + return new SymbolDef(++next_def_id, this, orig, init); + }; + self.walk(tw); + + // pass 2: find back references and eval + self.globals = new Dictionary(); + var in_arg = []; + var tw = new TreeWalker(function(node) { + if (node instanceof AST_Catch) { + if (!(node.argname instanceof AST_Destructured)) return; + in_arg.push(node); + node.argname.walk(tw); + in_arg.pop(); + walk_body(node, tw); + return true; + } + if (node instanceof AST_Lambda) { + in_arg.push(node); + if (node.name) node.name.walk(tw); + node.argnames.forEach(function(argname) { + argname.walk(tw); + }); + if (node.rest) node.rest.walk(tw); + in_arg.pop(); + walk_lambda(node, tw); + return true; + } + if (node instanceof AST_LoopControl) { + if (node.label) node.label.thedef.references.push(node); + return true; + } + if (node instanceof AST_SymbolDeclaration) { + var def = node.definition(); + def.preinit = def.references.length; + if (node instanceof AST_SymbolCatch) { + // ensure mangling works if `catch` reuses a scope variable + var redef = def.redefined(); + if (redef) for (var s = node.scope; s; s = s.parent_scope) { + if (!push_uniq(s.enclosed, redef)) break; + if (s === redef.scope) break; + } + } else if (node instanceof AST_SymbolConst) { + // ensure compression works if `const` reuses a scope variable + var redef = def.redefined(); + if (redef) redef.const_redefs = true; + } else if (def.scope !== node.scope && (node instanceof AST_SymbolDefun + || node instanceof AST_SymbolFunarg + || node instanceof AST_SymbolVar)) { + node.mark_enclosed(options); + var redef = node.scope.find_variable(node.name); + if (node.thedef !== redef) { + node.thedef = redef; + redef.orig.push(node); + node.mark_enclosed(options); + } + } + if (node.name != "arguments") return true; + var parent = node instanceof AST_SymbolVar && tw.parent(); + if (parent instanceof AST_VarDef && !parent.value) return true; + var sym = node.scope.resolve().find_variable("arguments"); + if (sym && is_arguments(sym)) sym.scope.uses_arguments = 3; + return true; + } + if (node instanceof AST_SymbolRef) { + var name = node.name; + var sym = node.scope.find_variable(name); + for (var i = in_arg.length; i > 0 && sym;) { + i = in_arg.lastIndexOf(sym.scope, i - 1); + if (i < 0) break; + var decl = sym.orig[0]; + if (decl instanceof AST_SymbolCatch + || decl instanceof AST_SymbolFunarg + || decl instanceof AST_SymbolLambda) { + node.in_arg = true; + break; + } + sym = sym.scope.parent_scope.find_variable(name); + } + if (!sym) { + sym = self.def_global(node); + } else if (name == "arguments" && is_arguments(sym)) { + var parent = tw.parent(); + if (is_lhs(node, parent)) { + sym.scope.uses_arguments = 3; + } else if (sym.scope.uses_arguments < 2 + && !(parent instanceof AST_PropAccess && parent.expression === node)) { + sym.scope.uses_arguments = 2; + } else if (!sym.scope.uses_arguments) { + sym.scope.uses_arguments = true; + } + } + if (name == "eval") { + var parent = tw.parent(); + if (parent.TYPE == "Call" && parent.expression === node) { + var s = node.scope; + do { + s = s.resolve(); + if (s.uses_eval) break; + s.uses_eval = true; + } while (s = s.parent_scope); + } else if (sym.undeclared) { + self.uses_eval = true; + } + } + if (sym.init instanceof AST_LambdaDefinition && sym.scope !== sym.init.name.scope) { + var scope = node.scope; + do { + if (scope === sym.init.name.scope) break; + } while (scope = scope.parent_scope); + if (!scope) sym.init = undefined; + } + node.thedef = sym; + node.reference(options); + return true; + } + }); + self.walk(tw); + + // pass 3: fix up any scoping issue with IE8 + if (options.ie) self.walk(new TreeWalker(function(node) { + if (node instanceof AST_SymbolCatch) { + var def = node.thedef; + var scope = def.defun; + if (def.name != "arguments" && scope.name instanceof AST_SymbolLambda && scope.name.name == def.name) { + scope = scope.parent_scope.resolve(); + } + redefine(node, scope); + return true; + } + if (node instanceof AST_SymbolLambda) { + var def = node.thedef; + if (!redefine(node, node.scope.parent_scope.resolve())) { + def.defun = undefined; + } else if (typeof node.thedef.init !== "undefined") { + node.thedef.init = false; + } else if (def.init) { + node.thedef.init = def.init; + } + return true; + } + })); + + function is_arguments(sym) { + return sym.orig[0] instanceof AST_SymbolFunarg + && !(sym.orig[1] instanceof AST_SymbolFunarg || sym.orig[2] instanceof AST_SymbolFunarg) + && !is_arrow(sym.scope); + } + + function redefine(node, scope) { + var name = node.name; + var old_def = node.thedef; + if (!all(old_def.orig, function(sym) { + return !(sym instanceof AST_SymbolConst || sym instanceof AST_SymbolLet); + })) return false; + var new_def = scope.find_variable(name); + if (new_def) { + var redef = new_def.redefined(); + if (redef) new_def = redef; + } else { + new_def = self.globals.get(name); + } + if (new_def) { + new_def.orig.push(node); + } else { + new_def = scope.def_variable(node); + } + if (new_def.undeclared) self.variables.set(name, new_def); + if (name == "arguments" && is_arguments(old_def) && node instanceof AST_SymbolLambda) return true; + old_def.defun = new_def.scope; + old_def.forEach(function(node) { + node.redef = old_def; + node.thedef = new_def; + node.reference(options); + }); + return true; + } +}); + +AST_Toplevel.DEFMETHOD("def_global", function(node) { + var globals = this.globals, name = node.name; + if (globals.has(name)) { + return globals.get(name); + } else { + var g = this.make_def(node); + g.undeclared = true; + g.global = true; + globals.set(name, g); + return g; + } +}); + +function init_block_vars(scope, parent) { + scope.enclosed = []; // variables from this or outer scope(s) that are referenced from this or inner scopes + scope.parent_scope = parent; // the parent scope (null if this is the top level) + scope.functions = new Dictionary(); // map name to AST_SymbolDefun (functions defined in this scope) + scope.variables = new Dictionary(); // map name to AST_SymbolVar (variables defined in this scope; includes functions) + if (parent) scope.make_def = parent.make_def; // top-level tracking of SymbolDef instances +} + +function init_scope_vars(scope, parent) { + init_block_vars(scope, parent); + scope.uses_eval = false; // will be set to true if this or nested scope uses the global `eval` + scope.uses_with = false; // will be set to true if this or some nested scope uses the `with` statement +} + +AST_BlockScope.DEFMETHOD("init_vars", function(parent_scope) { + init_block_vars(this, parent_scope); +}); +AST_Scope.DEFMETHOD("init_vars", function(parent_scope) { + init_scope_vars(this, parent_scope); +}); +AST_Arrow.DEFMETHOD("init_vars", function(parent_scope) { + init_scope_vars(this, parent_scope); + return this; +}); +AST_AsyncArrow.DEFMETHOD("init_vars", function(parent_scope) { + init_scope_vars(this, parent_scope); +}); +AST_Lambda.DEFMETHOD("init_vars", function(parent_scope) { + init_scope_vars(this, parent_scope); + this.uses_arguments = false; + this.def_variable(new AST_SymbolFunarg({ + name: "arguments", + scope: this, + start: this.start, + end: this.end, + })); + return this; +}); + +AST_Symbol.DEFMETHOD("mark_enclosed", function(options) { + var def = this.definition(); + for (var s = this.scope; s; s = s.parent_scope) { + if (!push_uniq(s.enclosed, def)) break; + if (!options) { + s._var_names = undefined; + } else { + if (options.keep_fargs && s instanceof AST_Lambda) s.each_argname(function(arg) { + push_uniq(def.scope.enclosed, arg.definition()); + }); + if (options.keep_fnames) s.functions.each(function(d) { + push_uniq(def.scope.enclosed, d); + }); + } + if (s === def.scope) break; + } +}); + +AST_Symbol.DEFMETHOD("reference", function(options) { + this.definition().references.push(this); + this.mark_enclosed(options); +}); + +AST_BlockScope.DEFMETHOD("find_variable", function(name) { + return this.variables.get(name) + || this.parent_scope && this.parent_scope.find_variable(name); +}); + +AST_BlockScope.DEFMETHOD("def_function", function(symbol, init) { + var def = this.def_variable(symbol, init); + if (!def.init || def.init instanceof AST_LambdaDefinition) def.init = init; + this.functions.set(symbol.name, def); + return def; +}); + +AST_BlockScope.DEFMETHOD("def_variable", function(symbol, init) { + var def = this.variables.get(symbol.name); + if (def) { + def.orig.push(symbol); + if (def.init instanceof AST_LambdaExpression) def.init = init; + } else { + def = this.make_def(symbol, init); + this.variables.set(symbol.name, def); + def.global = !this.parent_scope; + } + return symbol.thedef = def; +}); + +function names_in_use(scope, options) { + var names = scope.names_in_use; + if (!names) { + scope.cname = -1; + scope.cname_holes = []; + scope.names_in_use = names = new Dictionary(); + var cache = options.cache && options.cache.props; + scope.enclosed.forEach(function(def) { + if (def.unmangleable(options)) names.set(def.name, true); + if (def.global && cache && cache.has(def.name)) { + names.set(cache.get(def.name), true); + } + }); + } + return names; +} + +function next_mangled_name(def, options) { + var scope = def.scope; + var in_use = names_in_use(scope, options); + var holes = scope.cname_holes; + var names = new Dictionary(); + var scopes = [ scope ]; + def.forEach(function(sym) { + var scope = sym.scope; + do { + if (member(scope, scopes)) break; + names_in_use(scope, options).each(function(marker, name) { + names.set(name, marker); + }); + scopes.push(scope); + } while (scope = scope.parent_scope); + }); + var name; + for (var i = 0; i < holes.length; i++) { + name = base54(holes[i]); + if (names.has(name)) continue; + holes.splice(i, 1); + in_use.set(name, true); + return name; + } + while (true) { + name = base54(++scope.cname); + if (in_use.has(name) || RESERVED_WORDS[name] || options.reserved.has[name]) continue; + if (!names.has(name)) break; + holes.push(scope.cname); + } + in_use.set(name, true); + return name; +} + +AST_Symbol.DEFMETHOD("unmangleable", function(options) { + var def = this.definition(); + return !def || def.unmangleable(options); +}); + +// labels are always mangleable +AST_Label.DEFMETHOD("unmangleable", return_false); + +AST_Symbol.DEFMETHOD("definition", function() { + return this.thedef; +}); + +function _default_mangler_options(options) { + options = defaults(options, { + eval : false, + ie : false, + keep_fargs : false, + keep_fnames : false, + reserved : [], + toplevel : false, + v8 : false, + webkit : false, + }); + if (!Array.isArray(options.reserved)) options.reserved = []; + // Never mangle `arguments` + push_uniq(options.reserved, "arguments"); + options.reserved.has = makePredicate(options.reserved); + return options; +} + +// We only need to mangle declaration nodes. Special logic wired into the code +// generator will display the mangled name if it is present (and for +// `AST_SymbolRef`s it will use the mangled name of the `AST_SymbolDeclaration` +// that it points to). +AST_Toplevel.DEFMETHOD("mangle_names", function(options) { + options = _default_mangler_options(options); + if (options.cache && options.cache.props) { + var mangled_names = names_in_use(this, options); + options.cache.props.each(function(mangled_name) { + mangled_names.set(mangled_name, true); + }); + } + var cutoff = 36; + var lname = -1; + var redefined = []; + var tw = new TreeWalker(function(node, descend) { + var save_nesting; + if (node instanceof AST_BlockScope) { + // `lname` is incremented when we get to the `AST_Label` + if (node instanceof AST_LabeledStatement) save_nesting = lname; + if (options.webkit && node instanceof AST_IterationStatement && node.init instanceof AST_Let) { + node.init.definitions.forEach(function(defn) { + defn.name.match_symbol(function(sym) { + if (!(sym instanceof AST_SymbolLet)) return; + var def = sym.definition(); + var scope = sym.scope.parent_scope; + var redef = scope.def_variable(sym); + sym.thedef = def; + scope.to_mangle.push(redef); + def.redefined = function() { + return redef; + }; + }); + }, true); + } + var to_mangle = node.to_mangle = []; + node.variables.each(function(def) { + if (!defer_redef(def)) to_mangle.push(def); + }); + descend(); + if (options.cache && node instanceof AST_Toplevel) { + node.globals.each(mangle); + } + if (node instanceof AST_Defun && tw.has_directive("use asm")) { + var sym = new AST_SymbolRef(node.name); + sym.scope = node; + sym.reference(options); + } + if (to_mangle.length > cutoff) { + var indices = to_mangle.map(function(def, index) { + return index; + }).sort(function(i, j) { + return to_mangle[j].references.length - to_mangle[i].references.length || i - j; + }); + to_mangle = indices.slice(0, cutoff).sort(function(i, j) { + return i - j; + }).map(function(index) { + return to_mangle[index]; + }).concat(indices.slice(cutoff).sort(function(i, j) { + return i - j; + }).map(function(index) { + return to_mangle[index]; + })); + } + to_mangle.forEach(mangle); + if (node instanceof AST_LabeledStatement && !(options.v8 && in_label(tw))) lname = save_nesting; + return true; + } + if (node instanceof AST_Label) { + var name; + do { + name = base54(++lname); + } while (RESERVED_WORDS[name]); + node.mangled_name = name; + return true; + } + }); + this.walk(tw); + redefined.forEach(mangle); + + function mangle(def) { + if (options.reserved.has[def.name]) return; + def.mangle(options); + } + + function defer_redef(def) { + var sym = def.orig[0]; + var redef = def.redefined(); + if (!redef) { + if (!(sym instanceof AST_SymbolConst)) return false; + var scope = def.scope.resolve(); + if (def.scope === scope) return false; + if (def.scope.parent_scope.find_variable(sym.name)) return false; + redef = scope.def_variable(sym); + scope.to_mangle.push(redef); + } + redefined.push(def); + def.references.forEach(reference); + if (sym instanceof AST_SymbolCatch || sym instanceof AST_SymbolConst) { + reference(sym); + def.redefined = function() { + return redef; + }; + } + return true; + + function reference(sym) { + sym.thedef = redef; + sym.reference(options); + sym.thedef = def; + } + } + + function in_label(tw) { + var level = 0, parent; + while (parent = tw.parent(level++)) { + if (parent instanceof AST_Block) return parent instanceof AST_Toplevel && !options.toplevel; + if (parent instanceof AST_LabeledStatement) return true; + } + } +}); + +AST_Toplevel.DEFMETHOD("find_colliding_names", function(options) { + var cache = options.cache && options.cache.props; + var avoid = Object.create(RESERVED_WORDS); + options.reserved.forEach(to_avoid); + this.globals.each(add_def); + this.walk(new TreeWalker(function(node) { + if (node instanceof AST_BlockScope) node.variables.each(add_def); + })); + return avoid; + + function to_avoid(name) { + avoid[name] = true; + } + + function add_def(def) { + var name = def.name; + if (def.global && cache && cache.has(name)) name = cache.get(name); + else if (!def.unmangleable(options)) return; + to_avoid(name); + } +}); + +AST_Toplevel.DEFMETHOD("expand_names", function(options) { + base54.reset(); + base54.sort(); + options = _default_mangler_options(options); + var avoid = this.find_colliding_names(options); + var cname = 0; + this.globals.each(rename); + this.walk(new TreeWalker(function(node) { + if (node instanceof AST_BlockScope) node.variables.each(rename); + })); + + function next_name() { + var name; + do { + name = base54(cname++); + } while (avoid[name]); + return name; + } + + function rename(def) { + if (def.global && options.cache) return; + if (def.unmangleable(options)) return; + if (options.reserved.has[def.name]) return; + var redef = def.redefined(); + var name = redef ? redef.rename || redef.name : next_name(); + def.rename = name; + def.forEach(function(sym) { + if (sym.definition() === def) sym.name = name; + }); + } +}); + +AST_Node.DEFMETHOD("tail_node", return_this); +AST_Sequence.DEFMETHOD("tail_node", function() { + return this.expressions[this.expressions.length - 1]; +}); + +AST_Toplevel.DEFMETHOD("compute_char_frequency", function(options) { + options = _default_mangler_options(options); + base54.reset(); + var fn = AST_Symbol.prototype.add_source_map; + try { + AST_Symbol.prototype.add_source_map = function() { + if (!this.unmangleable(options)) base54.consider(this.name, -1); + }; + if (options.properties) { + AST_Dot.prototype.add_source_map = function() { + base54.consider(this.property, -1); + }; + AST_Sub.prototype.add_source_map = function() { + skip_string(this.property); + }; + } + base54.consider(this.print_to_string(), 1); + } finally { + AST_Symbol.prototype.add_source_map = fn; + delete AST_Dot.prototype.add_source_map; + delete AST_Sub.prototype.add_source_map; + } + base54.sort(); + + function skip_string(node) { + if (node instanceof AST_String) { + base54.consider(node.value, -1); + } else if (node instanceof AST_Conditional) { + skip_string(node.consequent); + skip_string(node.alternative); + } else if (node instanceof AST_Sequence) { + skip_string(node.tail_node()); + } + } +}); + +var base54 = (function() { + var freq = Object.create(null); + function init(chars) { + var array = []; + for (var i = 0; i < chars.length; i++) { + var ch = chars[i]; + array.push(ch); + freq[ch] = -1e-2 * i; + } + return array; + } + var digits = init("0123456789"); + var leading = init("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_"); + var chars, frequency; + function reset() { + chars = null; + frequency = Object.create(freq); + } + base54.consider = function(str, delta) { + for (var i = str.length; --i >= 0;) { + frequency[str[i]] += delta; + } + }; + function compare(a, b) { + return frequency[b] - frequency[a]; + } + base54.sort = function() { + chars = leading.sort(compare).concat(digits).sort(compare); + }; + base54.reset = reset; + reset(); + function base54(num) { + var ret = leading[num % 54]; + for (num = Math.floor(num / 54); --num >= 0; num >>= 6) { + ret += chars[num & 0x3F]; + } + return ret; + } + return base54; +})(); diff --git a/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/sourcemap.js b/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/sourcemap.js new file mode 100644 index 00000000..a230a44c --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/sourcemap.js @@ -0,0 +1,195 @@ +/*********************************************************************** + + A JavaScript tokenizer / parser / beautifier / compressor. + https://github.com/mishoo/UglifyJS + + -------------------------------- (C) --------------------------------- + + Author: Mihai Bazon + + http://mihai.bazon.net/blog + + Distributed under the BSD license: + + Copyright 2012 (c) Mihai Bazon + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + ***********************************************************************/ + +"use strict"; + +var vlq_char = characters("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"); +var vlq_bits = vlq_char.reduce(function(map, ch, bits) { + map[ch] = bits; + return map; +}, Object.create(null)); + +function vlq_decode(indices, str) { + var value = 0; + var shift = 0; + for (var i = 0, j = 0; i < str.length; i++) { + var bits = vlq_bits[str[i]]; + value += (bits & 31) << shift; + if (bits & 32) { + shift += 5; + } else { + indices[j++] += value & 1 ? 0x80000000 | -(value >> 1) : value >> 1; + value = shift = 0; + } + } + return j; +} + +function vlq_encode(num) { + var result = ""; + num = Math.abs(num) << 1 | num >>> 31; + do { + var bits = num & 31; + if (num >>>= 5) bits |= 32; + result += vlq_char[bits]; + } while (num); + return result; +} + +function create_array_map() { + var map = new Dictionary(); + var array = []; + array.index = function(name) { + var index = map.get(name); + if (!(index >= 0)) { + index = array.length; + array.push(name); + map.set(name, index); + } + return index; + }; + return array; +} + +function SourceMap(options) { + var sources = create_array_map(); + var sources_content = options.includeSources && new Dictionary(); + var names = create_array_map(); + var mappings = ""; + if (options.orig) Object.keys(options.orig).forEach(function(name) { + var map = options.orig[name]; + var indices = [ 0, 0, 1, 0, 0 ]; + options.orig[name] = { + names: map.names, + mappings: map.mappings.split(/;/).map(function(line) { + indices[0] = 0; + return line.split(/,/).map(function(segment) { + return indices.slice(0, vlq_decode(indices, segment)); + }); + }), + sources: map.sources, + }; + if (!sources_content || !map.sourcesContent) return; + for (var i = 0; i < map.sources.length; i++) { + var content = map.sourcesContent[i]; + if (content) sources_content.set(map.sources[i], content); + } + }); + var prev_source; + var generated_line = 1; + var generated_column = 0; + var source_index = 0; + var original_line = 1; + var original_column = 0; + var name_index = 0; + return { + add: options.orig ? function(source, gen_line, gen_col, orig_line, orig_col, name) { + var map = options.orig[source]; + if (map) { + var segments = map.mappings[orig_line - 1]; + if (!segments) return; + var indices; + for (var i = 0; i < segments.length; i++) { + var col = segments[i][0]; + if (orig_col >= col) indices = segments[i]; + if (orig_col <= col) break; + } + if (!indices || indices.length < 4) { + source = null; + } else { + source = map.sources[indices[1]]; + orig_line = indices[2]; + orig_col = indices[3]; + if (indices.length > 4) name = map.names[indices[4]]; + } + } + add(source, gen_line, gen_col, orig_line, orig_col, name); + } : add, + setSourceContent: sources_content ? function(source, content) { + if (!sources_content.has(source)) { + sources_content.set(source, content); + } + } : noop, + toString: function() { + return JSON.stringify({ + version: 3, + file: options.filename || undefined, + sourceRoot: options.root || undefined, + sources: sources, + sourcesContent: sources_content ? sources.map(function(source) { + return sources_content.get(source) || null; + }) : undefined, + names: names, + mappings: mappings, + }); + } + }; + + function add(source, gen_line, gen_col, orig_line, orig_col, name) { + if (prev_source == null && source == null) return; + prev_source = source; + if (generated_line < gen_line) { + generated_column = 0; + do { + mappings += ";"; + } while (++generated_line < gen_line); + } else if (mappings) { + mappings += ","; + } + mappings += vlq_encode(gen_col - generated_column); + generated_column = gen_col; + if (source == null) return; + var src_idx = sources.index(source); + mappings += vlq_encode(src_idx - source_index); + source_index = src_idx; + mappings += vlq_encode(orig_line - original_line); + original_line = orig_line; + mappings += vlq_encode(orig_col - original_column); + original_column = orig_col; + if (options.names && name != null) { + var name_idx = names.index(name); + mappings += vlq_encode(name_idx - name_index); + name_index = name_idx; + } + } +} diff --git a/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/transform.js b/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/transform.js new file mode 100644 index 00000000..dcf90dfa --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/transform.js @@ -0,0 +1,250 @@ +/*********************************************************************** + + A JavaScript tokenizer / parser / beautifier / compressor. + https://github.com/mishoo/UglifyJS + + -------------------------------- (C) --------------------------------- + + Author: Mihai Bazon + + http://mihai.bazon.net/blog + + Distributed under the BSD license: + + Copyright 2012 (c) Mihai Bazon + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + ***********************************************************************/ + +"use strict"; + +function TreeTransformer(before, after) { + TreeWalker.call(this); + this.before = before; + this.after = after; +} +TreeTransformer.prototype = new TreeWalker; + +(function(DEF) { + function do_list(list, tw) { + return List(list, function(node) { + return node.transform(tw, true); + }); + } + + DEF(AST_Node, noop); + DEF(AST_LabeledStatement, function(self, tw) { + self.label = self.label.transform(tw); + self.body = self.body.transform(tw); + }); + DEF(AST_SimpleStatement, function(self, tw) { + self.body = self.body.transform(tw); + }); + DEF(AST_Block, function(self, tw) { + self.body = do_list(self.body, tw); + }); + DEF(AST_Do, function(self, tw) { + self.body = self.body.transform(tw); + self.condition = self.condition.transform(tw); + }); + DEF(AST_While, function(self, tw) { + self.condition = self.condition.transform(tw); + self.body = self.body.transform(tw); + }); + DEF(AST_For, function(self, tw) { + if (self.init) self.init = self.init.transform(tw); + if (self.condition) self.condition = self.condition.transform(tw); + if (self.step) self.step = self.step.transform(tw); + self.body = self.body.transform(tw); + }); + DEF(AST_ForEnumeration, function(self, tw) { + self.init = self.init.transform(tw); + self.object = self.object.transform(tw); + self.body = self.body.transform(tw); + }); + DEF(AST_With, function(self, tw) { + self.expression = self.expression.transform(tw); + self.body = self.body.transform(tw); + }); + DEF(AST_Exit, function(self, tw) { + if (self.value) self.value = self.value.transform(tw); + }); + DEF(AST_LoopControl, function(self, tw) { + if (self.label) self.label = self.label.transform(tw); + }); + DEF(AST_If, function(self, tw) { + self.condition = self.condition.transform(tw); + self.body = self.body.transform(tw); + if (self.alternative) self.alternative = self.alternative.transform(tw); + }); + DEF(AST_Switch, function(self, tw) { + self.expression = self.expression.transform(tw); + self.body = do_list(self.body, tw); + }); + DEF(AST_Case, function(self, tw) { + self.expression = self.expression.transform(tw); + self.body = do_list(self.body, tw); + }); + DEF(AST_Try, function(self, tw) { + self.body = do_list(self.body, tw); + if (self.bcatch) self.bcatch = self.bcatch.transform(tw); + if (self.bfinally) self.bfinally = self.bfinally.transform(tw); + }); + DEF(AST_Catch, function(self, tw) { + if (self.argname) self.argname = self.argname.transform(tw); + self.body = do_list(self.body, tw); + }); + DEF(AST_Definitions, function(self, tw) { + self.definitions = do_list(self.definitions, tw); + }); + DEF(AST_VarDef, function(self, tw) { + self.name = self.name.transform(tw); + if (self.value) self.value = self.value.transform(tw); + }); + DEF(AST_DefaultValue, function(self, tw) { + self.name = self.name.transform(tw); + self.value = self.value.transform(tw); + }); + DEF(AST_Lambda, function(self, tw) { + if (self.name) self.name = self.name.transform(tw); + self.argnames = do_list(self.argnames, tw); + if (self.rest) self.rest = self.rest.transform(tw); + self.body = do_list(self.body, tw); + }); + function transform_arrow(self, tw) { + self.argnames = do_list(self.argnames, tw); + if (self.rest) self.rest = self.rest.transform(tw); + if (self.value) { + self.value = self.value.transform(tw); + } else { + self.body = do_list(self.body, tw); + } + } + DEF(AST_Arrow, transform_arrow); + DEF(AST_AsyncArrow, transform_arrow); + DEF(AST_Class, function(self, tw) { + if (self.name) self.name = self.name.transform(tw); + if (self.extends) self.extends = self.extends.transform(tw); + self.properties = do_list(self.properties, tw); + }); + DEF(AST_ClassProperty, function(self, tw) { + if (self.key instanceof AST_Node) self.key = self.key.transform(tw); + if (self.value) self.value = self.value.transform(tw); + }); + DEF(AST_Call, function(self, tw) { + self.expression = self.expression.transform(tw); + self.args = do_list(self.args, tw); + }); + DEF(AST_Sequence, function(self, tw) { + self.expressions = do_list(self.expressions, tw); + }); + DEF(AST_Await, function(self, tw) { + self.expression = self.expression.transform(tw); + }); + DEF(AST_Yield, function(self, tw) { + if (self.expression) self.expression = self.expression.transform(tw); + }); + DEF(AST_Dot, function(self, tw) { + self.expression = self.expression.transform(tw); + }); + DEF(AST_Sub, function(self, tw) { + self.expression = self.expression.transform(tw); + self.property = self.property.transform(tw); + }); + DEF(AST_Spread, function(self, tw) { + self.expression = self.expression.transform(tw); + }); + DEF(AST_Unary, function(self, tw) { + self.expression = self.expression.transform(tw); + }); + DEF(AST_Binary, function(self, tw) { + self.left = self.left.transform(tw); + self.right = self.right.transform(tw); + }); + DEF(AST_Conditional, function(self, tw) { + self.condition = self.condition.transform(tw); + self.consequent = self.consequent.transform(tw); + self.alternative = self.alternative.transform(tw); + }); + DEF(AST_Array, function(self, tw) { + self.elements = do_list(self.elements, tw); + }); + DEF(AST_DestructuredArray, function(self, tw) { + self.elements = do_list(self.elements, tw); + if (self.rest) self.rest = self.rest.transform(tw); + }); + DEF(AST_DestructuredKeyVal, function(self, tw) { + if (self.key instanceof AST_Node) self.key = self.key.transform(tw); + self.value = self.value.transform(tw); + }); + DEF(AST_DestructuredObject, function(self, tw) { + self.properties = do_list(self.properties, tw); + if (self.rest) self.rest = self.rest.transform(tw); + }); + DEF(AST_Object, function(self, tw) { + self.properties = do_list(self.properties, tw); + }); + DEF(AST_ObjectProperty, function(self, tw) { + if (self.key instanceof AST_Node) self.key = self.key.transform(tw); + self.value = self.value.transform(tw); + }); + DEF(AST_ExportDeclaration, function(self, tw) { + self.body = self.body.transform(tw); + }); + DEF(AST_ExportDefault, function(self, tw) { + self.body = self.body.transform(tw); + }); + DEF(AST_ExportReferences, function(self, tw) { + self.properties = do_list(self.properties, tw); + }); + DEF(AST_Import, function(self, tw) { + if (self.all) self.all = self.all.transform(tw); + if (self.default) self.default = self.default.transform(tw); + if (self.properties) self.properties = do_list(self.properties, tw); + }); + DEF(AST_Template, function(self, tw) { + if (self.tag) self.tag = self.tag.transform(tw); + self.expressions = do_list(self.expressions, tw); + }); +})(function(node, descend) { + node.DEFMETHOD("transform", function(tw, in_list) { + var x, y; + tw.push(this); + if (tw.before) x = tw.before(this, descend, in_list); + if (typeof x === "undefined") { + x = this; + descend(x, tw); + if (tw.after) { + y = tw.after(x, in_list); + if (typeof y !== "undefined") x = y; + } + } + tw.pop(); + return x; + }); +}); diff --git a/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/utils.js b/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/utils.js new file mode 100644 index 00000000..6faaa152 --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/uglify-js/lib/utils.js @@ -0,0 +1,287 @@ +/*********************************************************************** + + A JavaScript tokenizer / parser / beautifier / compressor. + https://github.com/mishoo/UglifyJS + + -------------------------------- (C) --------------------------------- + + Author: Mihai Bazon + + http://mihai.bazon.net/blog + + Distributed under the BSD license: + + Copyright 2012 (c) Mihai Bazon + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + ***********************************************************************/ + +"use strict"; + +function characters(str) { + return str.split(""); +} + +function member(name, array) { + return array.indexOf(name) >= 0; +} + +function find_if(func, array) { + for (var i = array.length; --i >= 0;) if (func(array[i])) return array[i]; +} + +function configure_error_stack(fn) { + Object.defineProperty(fn.prototype, "stack", { + get: function() { + var err = new Error(this.message); + err.name = this.name; + try { + throw err; + } catch (e) { + return e.stack; + } + } + }); +} + +function DefaultsError(msg, defs) { + this.message = msg; + this.defs = defs; +} +DefaultsError.prototype = Object.create(Error.prototype); +DefaultsError.prototype.constructor = DefaultsError; +DefaultsError.prototype.name = "DefaultsError"; +configure_error_stack(DefaultsError); + +function defaults(args, defs, croak) { + if (croak) for (var i in args) { + if (HOP(args, i) && !HOP(defs, i)) throw new DefaultsError("`" + i + "` is not a supported option", defs); + } + for (var i in args) { + if (HOP(args, i)) defs[i] = args[i]; + } + return defs; +} + +function noop() {} +function return_false() { return false; } +function return_true() { return true; } +function return_this() { return this; } +function return_null() { return null; } + +var List = (function() { + function List(a, f) { + var ret = []; + for (var i = 0; i < a.length; i++) { + var val = f(a[i], i); + if (val === skip) continue; + if (val instanceof Splice) { + ret.push.apply(ret, val.v); + } else { + ret.push(val); + } + } + return ret; + } + List.is_op = function(val) { + return val === skip || val instanceof Splice; + }; + List.splice = function(val) { + return new Splice(val); + }; + var skip = List.skip = {}; + function Splice(val) { + this.v = val; + } + return List; +})(); + +function push_uniq(array, el) { + if (array.indexOf(el) < 0) return array.push(el); +} + +function string_template(text, props) { + return text.replace(/\{([^{}]+)\}/g, function(str, p) { + var value = p == "this" ? props : props[p]; + if (value instanceof AST_Node) return value.print_to_string(); + if (value instanceof AST_Token) return value.file + ":" + value.line + "," + value.col; + return value; + }); +} + +function remove(array, el) { + var index = array.indexOf(el); + if (index >= 0) array.splice(index, 1); +} + +function makePredicate(words) { + if (!Array.isArray(words)) words = words.split(" "); + var map = Object.create(null); + words.forEach(function(word) { + map[word] = true; + }); + return map; +} + +function all(array, predicate) { + for (var i = array.length; --i >= 0;) + if (!predicate(array[i], i)) + return false; + return true; +} + +function Dictionary() { + this.values = Object.create(null); +} +Dictionary.prototype = { + set: function(key, val) { + if (key == "__proto__") { + this.proto_value = val; + } else { + this.values[key] = val; + } + return this; + }, + add: function(key, val) { + var list = this.get(key); + if (list) { + list.push(val); + } else { + this.set(key, [ val ]); + } + return this; + }, + get: function(key) { + return key == "__proto__" ? this.proto_value : this.values[key]; + }, + del: function(key) { + if (key == "__proto__") { + delete this.proto_value; + } else { + delete this.values[key]; + } + return this; + }, + has: function(key) { + return key == "__proto__" ? "proto_value" in this : key in this.values; + }, + all: function(predicate) { + for (var i in this.values) + if (!predicate(this.values[i], i)) return false; + if ("proto_value" in this && !predicate(this.proto_value, "__proto__")) return false; + return true; + }, + each: function(f) { + for (var i in this.values) + f(this.values[i], i); + if ("proto_value" in this) f(this.proto_value, "__proto__"); + }, + size: function() { + return Object.keys(this.values).length + ("proto_value" in this); + }, + map: function(f) { + var ret = []; + for (var i in this.values) + ret.push(f(this.values[i], i)); + if ("proto_value" in this) ret.push(f(this.proto_value, "__proto__")); + return ret; + }, + clone: function() { + var ret = new Dictionary(); + this.each(function(value, i) { + ret.set(i, value); + }); + return ret; + }, + toObject: function() { + var obj = {}; + this.each(function(value, i) { + obj["$" + i] = value; + }); + return obj; + }, +}; +Dictionary.fromObject = function(obj) { + var dict = new Dictionary(); + for (var i in obj) + if (HOP(obj, i)) dict.set(i.slice(1), obj[i]); + return dict; +}; + +function HOP(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} + +// return true if the node at the top of the stack (that means the +// innermost node in the current output) is lexically the first in +// a statement. +function first_in_statement(stack, arrow, export_default) { + var node = stack.parent(-1); + for (var i = 0, p; p = stack.parent(i++); node = p) { + if (is_arrow(p)) { + return arrow && p.value === node; + } else if (p instanceof AST_Binary) { + if (p.left === node) continue; + } else if (p.TYPE == "Call") { + if (p.expression === node) continue; + } else if (p instanceof AST_Conditional) { + if (p.condition === node) continue; + } else if (p instanceof AST_ExportDefault) { + return export_default; + } else if (p instanceof AST_PropAccess) { + if (p.expression === node) continue; + } else if (p instanceof AST_Sequence) { + if (p.expressions[0] === node) continue; + } else if (p instanceof AST_SimpleStatement) { + return true; + } else if (p instanceof AST_Template) { + if (p.tag === node) continue; + } else if (p instanceof AST_UnaryPostfix) { + if (p.expression === node) continue; + } + return false; + } +} + +function DEF_BITPROPS(ctor, props) { + if (props.length > 31) throw new Error("Too many properties: " + props.length + "\n" + props.join(", ")); + props.forEach(function(name, pos) { + var mask = 1 << pos; + Object.defineProperty(ctor.prototype, name, { + get: function() { + return !!(this._bits & mask); + }, + set: function(val) { + if (val) + this._bits |= mask; + else + this._bits &= ~mask; + }, + }); + }); +} diff --git a/semag/emulatorjs/data/minify/node_modules/uglify-js/package.json b/semag/emulatorjs/data/minify/node_modules/uglify-js/package.json new file mode 100644 index 00000000..5776de16 --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/uglify-js/package.json @@ -0,0 +1,56 @@ +{ + "name": "uglify-js", + "description": "JavaScript parser, mangler/compressor and beautifier toolkit", + "author": "Mihai Bazon (http://lisperator.net/)", + "license": "BSD-2-Clause", + "version": "3.17.4", + "engines": { + "node": ">=0.8.0" + }, + "maintainers": [ + "Alex Lam ", + "Mihai Bazon (http://lisperator.net/)" + ], + "repository": "mishoo/UglifyJS", + "main": "tools/node.js", + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "files": [ + "bin", + "lib", + "tools", + "LICENSE" + ], + "devDependencies": { + "acorn": "~8.7.1", + "semver": "~6.3.0" + }, + "scripts": { + "test": "node test/compress.js && node test/mocha.js" + }, + "keywords": [ + "cli", + "compress", + "compressor", + "ecma", + "ecmascript", + "es", + "es5", + "javascript", + "js", + "jsmin", + "min", + "minification", + "minifier", + "minify", + "optimize", + "optimizer", + "pack", + "packer", + "parse", + "parser", + "uglifier", + "uglify" + ] +} diff --git a/semag/emulatorjs/data/minify/node_modules/uglify-js/tools/domprops.html b/semag/emulatorjs/data/minify/node_modules/uglify-js/tools/domprops.html new file mode 100644 index 00000000..e217b173 --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/uglify-js/tools/domprops.html @@ -0,0 +1,456 @@ + + + + + + diff --git a/semag/emulatorjs/data/minify/node_modules/uglify-js/tools/domprops.json b/semag/emulatorjs/data/minify/node_modules/uglify-js/tools/domprops.json new file mode 100644 index 00000000..1045429d --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/uglify-js/tools/domprops.json @@ -0,0 +1,8325 @@ +[ + "$&", + "$'", + "$*", + "$+", + "$1", + "$2", + "$3", + "$4", + "$5", + "$6", + "$7", + "$8", + "$9", + "$_", + "$`", + "$input", + "-moz-animation", + "-moz-animation-delay", + "-moz-animation-direction", + "-moz-animation-duration", + "-moz-animation-fill-mode", + "-moz-animation-iteration-count", + "-moz-animation-name", + "-moz-animation-play-state", + "-moz-animation-timing-function", + "-moz-appearance", + "-moz-backface-visibility", + "-moz-binding", + "-moz-border-end", + "-moz-border-end-color", + "-moz-border-end-style", + "-moz-border-end-width", + "-moz-border-image", + "-moz-border-start", + "-moz-border-start-color", + "-moz-border-start-style", + "-moz-border-start-width", + "-moz-box-align", + "-moz-box-direction", + "-moz-box-flex", + "-moz-box-ordinal-group", + "-moz-box-orient", + "-moz-box-pack", + "-moz-box-sizing", + "-moz-column-count", + "-moz-column-fill", + "-moz-column-gap", + "-moz-column-rule", + "-moz-column-rule-color", + "-moz-column-rule-style", + "-moz-column-rule-width", + "-moz-column-width", + "-moz-columns", + "-moz-float-edge", + "-moz-font-feature-settings", + "-moz-font-language-override", + "-moz-force-broken-image-icon", + "-moz-hyphens", + "-moz-image-region", + "-moz-margin-end", + "-moz-margin-start", + "-moz-orient", + "-moz-outline-radius", + "-moz-outline-radius-bottomleft", + "-moz-outline-radius-bottomright", + "-moz-outline-radius-topleft", + "-moz-outline-radius-topright", + "-moz-padding-end", + "-moz-padding-start", + "-moz-perspective", + "-moz-perspective-origin", + "-moz-stack-sizing", + "-moz-tab-size", + "-moz-text-size-adjust", + "-moz-transform", + "-moz-transform-origin", + "-moz-transform-style", + "-moz-transition", + "-moz-transition-delay", + "-moz-transition-duration", + "-moz-transition-property", + "-moz-transition-timing-function", + "-moz-user-focus", + "-moz-user-input", + "-moz-user-modify", + "-moz-user-select", + "-moz-window-dragging", + "-webkit-align-content", + "-webkit-align-items", + "-webkit-align-self", + "-webkit-animation", + "-webkit-animation-delay", + "-webkit-animation-direction", + "-webkit-animation-duration", + "-webkit-animation-fill-mode", + "-webkit-animation-iteration-count", + "-webkit-animation-name", + "-webkit-animation-play-state", + "-webkit-animation-timing-function", + "-webkit-appearance", + "-webkit-backface-visibility", + "-webkit-background-clip", + "-webkit-background-origin", + "-webkit-background-size", + "-webkit-border-bottom-left-radius", + "-webkit-border-bottom-right-radius", + "-webkit-border-image", + "-webkit-border-radius", + "-webkit-border-top-left-radius", + "-webkit-border-top-right-radius", + "-webkit-box-align", + "-webkit-box-direction", + "-webkit-box-flex", + "-webkit-box-ordinal-group", + "-webkit-box-orient", + "-webkit-box-pack", + "-webkit-box-shadow", + "-webkit-box-sizing", + "-webkit-filter", + "-webkit-flex", + "-webkit-flex-basis", + "-webkit-flex-direction", + "-webkit-flex-flow", + "-webkit-flex-grow", + "-webkit-flex-shrink", + "-webkit-flex-wrap", + "-webkit-justify-content", + "-webkit-line-clamp", + "-webkit-mask", + "-webkit-mask-clip", + "-webkit-mask-composite", + "-webkit-mask-image", + "-webkit-mask-origin", + "-webkit-mask-position", + "-webkit-mask-position-x", + "-webkit-mask-position-y", + "-webkit-mask-repeat", + "-webkit-mask-size", + "-webkit-order", + "-webkit-perspective", + "-webkit-perspective-origin", + "-webkit-text-fill-color", + "-webkit-text-size-adjust", + "-webkit-text-stroke", + "-webkit-text-stroke-color", + "-webkit-text-stroke-width", + "-webkit-transform", + "-webkit-transform-origin", + "-webkit-transform-style", + "-webkit-transition", + "-webkit-transition-delay", + "-webkit-transition-duration", + "-webkit-transition-property", + "-webkit-transition-timing-function", + "-webkit-user-select", + "0", + "1", + "10", + "11", + "12", + "13", + "14", + "15", + "16", + "17", + "18", + "19", + "2", + "20", + "21", + "22", + "23", + "24", + "25", + "26", + "27", + "28", + "29", + "3", + "30", + "31", + "32", + "33", + "34", + "35", + "36", + "37", + "38", + "39", + "4", + "40", + "41", + "42", + "43", + "44", + "45", + "46", + "47", + "48", + "49", + "5", + "50", + "51", + "6", + "7", + "8", + "9", + "@@iterator", + "ABORT_ERR", + "ACTIVE", + "ACTIVE_ATTRIBUTES", + "ACTIVE_TEXTURE", + "ACTIVE_UNIFORMS", + "ACTIVE_UNIFORM_BLOCKS", + "ADDITION", + "ALIASED_LINE_WIDTH_RANGE", + "ALIASED_POINT_SIZE_RANGE", + "ALLOW_KEYBOARD_INPUT", + "ALLPASS", + "ALPHA", + "ALPHA_BITS", + "ALREADY_SIGNALED", + "ALT_MASK", + "ALWAYS", + "ANDROID", + "ANGLE_instanced_arrays", + "ANY_SAMPLES_PASSED", + "ANY_SAMPLES_PASSED_CONSERVATIVE", + "ANY_TYPE", + "ANY_UNORDERED_NODE_TYPE", + "APP_UPDATE", + "ARM", + "ARRAY_BUFFER", + "ARRAY_BUFFER_BINDING", + "ATTACHED_SHADERS", + "ATTRIBUTE_NODE", + "AT_TARGET", + "AbortController", + "AbortSignal", + "AbsoluteOrientationSensor", + "AbstractRange", + "Accelerometer", + "ActiveXObject", + "AddSearchProvider", + "AesGcmEncryptResult", + "AggregateError", + "AnalyserNode", + "Animation", + "AnimationEffect", + "AnimationEvent", + "AnimationPlaybackEvent", + "AnimationTimeline", + "AnonXMLHttpRequest", + "AppBannerPromptResult", + "ApplicationCache", + "ApplicationCacheErrorEvent", + "Array", + "ArrayBuffer", + "Atomics", + "Attr", + "Audio", + "AudioBuffer", + "AudioBufferSourceNode", + "AudioContext", + "AudioDestinationNode", + "AudioListener", + "AudioNode", + "AudioParam", + "AudioParamMap", + "AudioProcessingEvent", + "AudioScheduledSourceNode", + "AudioStreamTrack", + "AudioTrack", + "AudioTrackList", + "AudioWorklet", + "AudioWorkletNode", + "AuthenticatorAssertionResponse", + "AuthenticatorAttestationResponse", + "AuthenticatorResponse", + "AutocompleteErrorEvent", + "BACK", + "BAD_BOUNDARYPOINTS_ERR", + "BAD_REQUEST", + "BANDPASS", + "BLEND", + "BLEND_COLOR", + "BLEND_DST_ALPHA", + "BLEND_DST_RGB", + "BLEND_EQUATION", + "BLEND_EQUATION_ALPHA", + "BLEND_EQUATION_RGB", + "BLEND_SRC_ALPHA", + "BLEND_SRC_RGB", + "BLUE_BITS", + "BLUR", + "BOOL", + "BOOLEAN_TYPE", + "BOOL_VEC2", + "BOOL_VEC3", + "BOOL_VEC4", + "BOTH", + "BROWSER_DEFAULT_WEBGL", + "BUBBLING_PHASE", + "BUFFER_SIZE", + "BUFFER_USAGE", + "BYTE", + "BYTES_PER_ELEMENT", + "BackgroundFetchManager", + "BackgroundFetchRecord", + "BackgroundFetchRegistration", + "BarProp", + "BarcodeDetector", + "BaseAudioContext", + "BaseHref", + "BatteryManager", + "BeforeInstallPromptEvent", + "BeforeLoadEvent", + "BeforeUnloadEvent", + "BigInt", + "BigInt64Array", + "BigUint64Array", + "BiquadFilterNode", + "Blob", + "BlobEvent", + "Bluetooth", + "BluetoothCharacteristicProperties", + "BluetoothDevice", + "BluetoothRemoteGATTCharacteristic", + "BluetoothRemoteGATTDescriptor", + "BluetoothRemoteGATTServer", + "BluetoothRemoteGATTService", + "BluetoothUUID", + "BookmarkCollection", + "Boolean", + "BroadcastChannel", + "ByteLengthQueuingStrategy", + "CANNOT_RUN", + "CAPTURING_PHASE", + "CCW", + "CDATASection", + "CDATA_SECTION_NODE", + "CHANGE", + "CHARSET_RULE", + "CHECKING", + "CHROME_UPDATE", + "CLAMP_TO_EDGE", + "CLICK", + "CLOSED", + "CLOSING", + "COLOR", + "COLOR_ATTACHMENT0", + "COLOR_ATTACHMENT1", + "COLOR_ATTACHMENT10", + "COLOR_ATTACHMENT11", + "COLOR_ATTACHMENT12", + "COLOR_ATTACHMENT13", + "COLOR_ATTACHMENT14", + "COLOR_ATTACHMENT15", + "COLOR_ATTACHMENT2", + "COLOR_ATTACHMENT3", + "COLOR_ATTACHMENT4", + "COLOR_ATTACHMENT5", + "COLOR_ATTACHMENT6", + "COLOR_ATTACHMENT7", + "COLOR_ATTACHMENT8", + "COLOR_ATTACHMENT9", + "COLOR_BUFFER_BIT", + "COLOR_CLEAR_VALUE", + "COLOR_WRITEMASK", + "COMMENT_NODE", + "COMPARE_REF_TO_TEXTURE", + "COMPILE_STATUS", + "COMPRESSED_RGBA_S3TC_DXT1_EXT", + "COMPRESSED_RGBA_S3TC_DXT3_EXT", + "COMPRESSED_RGBA_S3TC_DXT5_EXT", + "COMPRESSED_RGB_S3TC_DXT1_EXT", + "COMPRESSED_TEXTURE_FORMATS", + "CONDITION_SATISFIED", + "CONFIGURATION_UNSUPPORTED", + "CONNECTING", + "CONSTANT_ALPHA", + "CONSTANT_COLOR", + "CONSTRAINT_ERR", + "CONTENT", + "CONTEXT_LOST_WEBGL", + "CONTROL_MASK", + "COPY_READ_BUFFER", + "COPY_READ_BUFFER_BINDING", + "COPY_WRITE_BUFFER", + "COPY_WRITE_BUFFER_BINDING", + "COUNTER_STYLE_RULE", + "CROS", + "CSS", + "CSS2Properties", + "CSSAnimation", + "CSSCharsetRule", + "CSSConditionRule", + "CSSCounterStyleRule", + "CSSFontFaceRule", + "CSSFontFeatureValuesRule", + "CSSGroupingRule", + "CSSImageValue", + "CSSImportRule", + "CSSKeyframeRule", + "CSSKeyframesRule", + "CSSKeywordValue", + "CSSMathInvert", + "CSSMathMax", + "CSSMathMin", + "CSSMathNegate", + "CSSMathProduct", + "CSSMathSum", + "CSSMathValue", + "CSSMatrixComponent", + "CSSMediaRule", + "CSSMozDocumentRule", + "CSSNameSpaceRule", + "CSSNamespaceRule", + "CSSNumericArray", + "CSSNumericValue", + "CSSPageRule", + "CSSPerspective", + "CSSPositionValue", + "CSSPrimitiveValue", + "CSSRotate", + "CSSRule", + "CSSRuleList", + "CSSScale", + "CSSSkew", + "CSSSkewX", + "CSSSkewY", + "CSSStyleDeclaration", + "CSSStyleRule", + "CSSStyleSheet", + "CSSStyleValue", + "CSSSupportsRule", + "CSSTransformComponent", + "CSSTransformValue", + "CSSTransition", + "CSSTranslate", + "CSSUnitValue", + "CSSUnknownRule", + "CSSUnparsedValue", + "CSSValue", + "CSSValueList", + "CSSVariableReferenceValue", + "CSSVariablesDeclaration", + "CSSVariablesRule", + "CSSViewportRule", + "CSS_ATTR", + "CSS_CM", + "CSS_COUNTER", + "CSS_CUSTOM", + "CSS_DEG", + "CSS_DIMENSION", + "CSS_EMS", + "CSS_EXS", + "CSS_FILTER_BLUR", + "CSS_FILTER_BRIGHTNESS", + "CSS_FILTER_CONTRAST", + "CSS_FILTER_CUSTOM", + "CSS_FILTER_DROP_SHADOW", + "CSS_FILTER_GRAYSCALE", + "CSS_FILTER_HUE_ROTATE", + "CSS_FILTER_INVERT", + "CSS_FILTER_OPACITY", + "CSS_FILTER_REFERENCE", + "CSS_FILTER_SATURATE", + "CSS_FILTER_SEPIA", + "CSS_GRAD", + "CSS_HZ", + "CSS_IDENT", + "CSS_IN", + "CSS_INHERIT", + "CSS_KHZ", + "CSS_MATRIX", + "CSS_MATRIX3D", + "CSS_MM", + "CSS_MS", + "CSS_NUMBER", + "CSS_PC", + "CSS_PERCENTAGE", + "CSS_PERSPECTIVE", + "CSS_PRIMITIVE_VALUE", + "CSS_PT", + "CSS_PX", + "CSS_RAD", + "CSS_RECT", + "CSS_RGBCOLOR", + "CSS_ROTATE", + "CSS_ROTATE3D", + "CSS_ROTATEX", + "CSS_ROTATEY", + "CSS_ROTATEZ", + "CSS_S", + "CSS_SCALE", + "CSS_SCALE3D", + "CSS_SCALEX", + "CSS_SCALEY", + "CSS_SCALEZ", + "CSS_SKEW", + "CSS_SKEWX", + "CSS_SKEWY", + "CSS_STRING", + "CSS_TRANSLATE", + "CSS_TRANSLATE3D", + "CSS_TRANSLATEX", + "CSS_TRANSLATEY", + "CSS_TRANSLATEZ", + "CSS_UNKNOWN", + "CSS_URI", + "CSS_VALUE_LIST", + "CSS_VH", + "CSS_VMAX", + "CSS_VMIN", + "CSS_VW", + "CULL_FACE", + "CULL_FACE_MODE", + "CURRENT_PROGRAM", + "CURRENT_QUERY", + "CURRENT_VERTEX_ATTRIB", + "CUSTOM", + "CW", + "Cache", + "CacheStorage", + "CanvasCaptureMediaStream", + "CanvasCaptureMediaStreamTrack", + "CanvasGradient", + "CanvasPattern", + "CanvasPixelArray", + "CanvasRenderingContext2D", + "CaretPosition", + "ChannelMergerNode", + "ChannelSplitterNode", + "CharacterData", + "Chrome PDF Plugin", + "Chrome PDF Viewer", + "ClientRect", + "ClientRectList", + "Clipboard", + "ClipboardEvent", + "ClipboardItem", + "CloseEvent", + "Collator", + "CollectGarbage", + "CommandEvent", + "Comment", + "CompileError", + "CompositionEvent", + "CompressionStream", + "Console", + "ConstantSourceNode", + "ControlRangeCollection", + "Controllers", + "ConvolverNode", + "Coordinates", + "CountQueuingStrategy", + "Counter", + "Credential", + "CredentialsContainer", + "Crypto", + "CryptoKey", + "CryptoOperation", + "CustomElementRegistry", + "CustomEvent", + "DATABASE_ERR", + "DATA_CLONE_ERR", + "DATA_ERR", + "DBLCLICK", + "DECR", + "DECR_WRAP", + "DELETE_STATUS", + "DEPTH", + "DEPTH24_STENCIL8", + "DEPTH32F_STENCIL8", + "DEPTH_ATTACHMENT", + "DEPTH_BITS", + "DEPTH_BUFFER_BIT", + "DEPTH_CLEAR_VALUE", + "DEPTH_COMPONENT", + "DEPTH_COMPONENT16", + "DEPTH_COMPONENT24", + "DEPTH_COMPONENT32F", + "DEPTH_FUNC", + "DEPTH_RANGE", + "DEPTH_STENCIL", + "DEPTH_STENCIL_ATTACHMENT", + "DEPTH_TEST", + "DEPTH_WRITEMASK", + "DEVICE_INELIGIBLE", + "DIRECTION_DOWN", + "DIRECTION_LEFT", + "DIRECTION_RIGHT", + "DIRECTION_UP", + "DISABLED", + "DISPATCH_REQUEST_ERR", + "DITHER", + "DOCUMENT_FRAGMENT_NODE", + "DOCUMENT_NODE", + "DOCUMENT_POSITION_CONTAINED_BY", + "DOCUMENT_POSITION_CONTAINS", + "DOCUMENT_POSITION_DISCONNECTED", + "DOCUMENT_POSITION_FOLLOWING", + "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC", + "DOCUMENT_POSITION_PRECEDING", + "DOCUMENT_TYPE_NODE", + "DOMCursor", + "DOMError", + "DOMException", + "DOMImplementation", + "DOMImplementationLS", + "DOMMatrix", + "DOMMatrixReadOnly", + "DOMParser", + "DOMPoint", + "DOMPointReadOnly", + "DOMQuad", + "DOMRect", + "DOMRectList", + "DOMRectReadOnly", + "DOMRequest", + "DOMSTRING_SIZE_ERR", + "DOMSettableTokenList", + "DOMStringList", + "DOMStringMap", + "DOMTokenList", + "DOMTransactionEvent", + "DOM_DELTA_LINE", + "DOM_DELTA_PAGE", + "DOM_DELTA_PIXEL", + "DOM_INPUT_METHOD_DROP", + "DOM_INPUT_METHOD_HANDWRITING", + "DOM_INPUT_METHOD_IME", + "DOM_INPUT_METHOD_KEYBOARD", + "DOM_INPUT_METHOD_MULTIMODAL", + "DOM_INPUT_METHOD_OPTION", + "DOM_INPUT_METHOD_PASTE", + "DOM_INPUT_METHOD_SCRIPT", + "DOM_INPUT_METHOD_UNKNOWN", + "DOM_INPUT_METHOD_VOICE", + "DOM_KEY_LOCATION_JOYSTICK", + "DOM_KEY_LOCATION_LEFT", + "DOM_KEY_LOCATION_MOBILE", + "DOM_KEY_LOCATION_NUMPAD", + "DOM_KEY_LOCATION_RIGHT", + "DOM_KEY_LOCATION_STANDARD", + "DOM_VK_0", + "DOM_VK_1", + "DOM_VK_2", + "DOM_VK_3", + "DOM_VK_4", + "DOM_VK_5", + "DOM_VK_6", + "DOM_VK_7", + "DOM_VK_8", + "DOM_VK_9", + "DOM_VK_A", + "DOM_VK_ACCEPT", + "DOM_VK_ADD", + "DOM_VK_ALT", + "DOM_VK_ALTGR", + "DOM_VK_AMPERSAND", + "DOM_VK_ASTERISK", + "DOM_VK_AT", + "DOM_VK_ATTN", + "DOM_VK_B", + "DOM_VK_BACKSPACE", + "DOM_VK_BACK_QUOTE", + "DOM_VK_BACK_SLASH", + "DOM_VK_BACK_SPACE", + "DOM_VK_C", + "DOM_VK_CANCEL", + "DOM_VK_CAPS_LOCK", + "DOM_VK_CIRCUMFLEX", + "DOM_VK_CLEAR", + "DOM_VK_CLOSE_BRACKET", + "DOM_VK_CLOSE_CURLY_BRACKET", + "DOM_VK_CLOSE_PAREN", + "DOM_VK_COLON", + "DOM_VK_COMMA", + "DOM_VK_CONTEXT_MENU", + "DOM_VK_CONTROL", + "DOM_VK_CONVERT", + "DOM_VK_CRSEL", + "DOM_VK_CTRL", + "DOM_VK_D", + "DOM_VK_DECIMAL", + "DOM_VK_DELETE", + "DOM_VK_DIVIDE", + "DOM_VK_DOLLAR", + "DOM_VK_DOUBLE_QUOTE", + "DOM_VK_DOWN", + "DOM_VK_E", + "DOM_VK_EISU", + "DOM_VK_END", + "DOM_VK_ENTER", + "DOM_VK_EQUALS", + "DOM_VK_EREOF", + "DOM_VK_ESCAPE", + "DOM_VK_EXCLAMATION", + "DOM_VK_EXECUTE", + "DOM_VK_EXSEL", + "DOM_VK_F", + "DOM_VK_F1", + "DOM_VK_F10", + "DOM_VK_F11", + "DOM_VK_F12", + "DOM_VK_F13", + "DOM_VK_F14", + "DOM_VK_F15", + "DOM_VK_F16", + "DOM_VK_F17", + "DOM_VK_F18", + "DOM_VK_F19", + "DOM_VK_F2", + "DOM_VK_F20", + "DOM_VK_F21", + "DOM_VK_F22", + "DOM_VK_F23", + "DOM_VK_F24", + "DOM_VK_F25", + "DOM_VK_F26", + "DOM_VK_F27", + "DOM_VK_F28", + "DOM_VK_F29", + "DOM_VK_F3", + "DOM_VK_F30", + "DOM_VK_F31", + "DOM_VK_F32", + "DOM_VK_F33", + "DOM_VK_F34", + "DOM_VK_F35", + "DOM_VK_F36", + "DOM_VK_F4", + "DOM_VK_F5", + "DOM_VK_F6", + "DOM_VK_F7", + "DOM_VK_F8", + "DOM_VK_F9", + "DOM_VK_FINAL", + "DOM_VK_FRONT", + "DOM_VK_G", + "DOM_VK_GREATER_THAN", + "DOM_VK_H", + "DOM_VK_HANGUL", + "DOM_VK_HANJA", + "DOM_VK_HASH", + "DOM_VK_HELP", + "DOM_VK_HK_TOGGLE", + "DOM_VK_HOME", + "DOM_VK_HYPHEN_MINUS", + "DOM_VK_I", + "DOM_VK_INSERT", + "DOM_VK_J", + "DOM_VK_JUNJA", + "DOM_VK_K", + "DOM_VK_KANA", + "DOM_VK_KANJI", + "DOM_VK_L", + "DOM_VK_LEFT", + "DOM_VK_LEFT_TAB", + "DOM_VK_LESS_THAN", + "DOM_VK_M", + "DOM_VK_META", + "DOM_VK_MODECHANGE", + "DOM_VK_MULTIPLY", + "DOM_VK_N", + "DOM_VK_NONCONVERT", + "DOM_VK_NUMPAD0", + "DOM_VK_NUMPAD1", + "DOM_VK_NUMPAD2", + "DOM_VK_NUMPAD3", + "DOM_VK_NUMPAD4", + "DOM_VK_NUMPAD5", + "DOM_VK_NUMPAD6", + "DOM_VK_NUMPAD7", + "DOM_VK_NUMPAD8", + "DOM_VK_NUMPAD9", + "DOM_VK_NUM_LOCK", + "DOM_VK_O", + "DOM_VK_OEM_1", + "DOM_VK_OEM_102", + "DOM_VK_OEM_2", + "DOM_VK_OEM_3", + "DOM_VK_OEM_4", + "DOM_VK_OEM_5", + "DOM_VK_OEM_6", + "DOM_VK_OEM_7", + "DOM_VK_OEM_8", + "DOM_VK_OEM_COMMA", + "DOM_VK_OEM_MINUS", + "DOM_VK_OEM_PERIOD", + "DOM_VK_OEM_PLUS", + "DOM_VK_OPEN_BRACKET", + "DOM_VK_OPEN_CURLY_BRACKET", + "DOM_VK_OPEN_PAREN", + "DOM_VK_P", + "DOM_VK_PA1", + "DOM_VK_PAGEDOWN", + "DOM_VK_PAGEUP", + "DOM_VK_PAGE_DOWN", + "DOM_VK_PAGE_UP", + "DOM_VK_PAUSE", + "DOM_VK_PERCENT", + "DOM_VK_PERIOD", + "DOM_VK_PIPE", + "DOM_VK_PLAY", + "DOM_VK_PLUS", + "DOM_VK_PRINT", + "DOM_VK_PRINTSCREEN", + "DOM_VK_PROCESSKEY", + "DOM_VK_PROPERITES", + "DOM_VK_Q", + "DOM_VK_QUESTION_MARK", + "DOM_VK_QUOTE", + "DOM_VK_R", + "DOM_VK_REDO", + "DOM_VK_RETURN", + "DOM_VK_RIGHT", + "DOM_VK_S", + "DOM_VK_SCROLL_LOCK", + "DOM_VK_SELECT", + "DOM_VK_SEMICOLON", + "DOM_VK_SEPARATOR", + "DOM_VK_SHIFT", + "DOM_VK_SLASH", + "DOM_VK_SLEEP", + "DOM_VK_SPACE", + "DOM_VK_SUBTRACT", + "DOM_VK_T", + "DOM_VK_TAB", + "DOM_VK_TILDE", + "DOM_VK_U", + "DOM_VK_UNDERSCORE", + "DOM_VK_UNDO", + "DOM_VK_UNICODE", + "DOM_VK_UP", + "DOM_VK_V", + "DOM_VK_VOLUME_DOWN", + "DOM_VK_VOLUME_MUTE", + "DOM_VK_VOLUME_UP", + "DOM_VK_W", + "DOM_VK_WIN", + "DOM_VK_WINDOW", + "DOM_VK_WIN_ICO_00", + "DOM_VK_WIN_ICO_CLEAR", + "DOM_VK_WIN_ICO_HELP", + "DOM_VK_WIN_OEM_ATTN", + "DOM_VK_WIN_OEM_AUTO", + "DOM_VK_WIN_OEM_BACKTAB", + "DOM_VK_WIN_OEM_CLEAR", + "DOM_VK_WIN_OEM_COPY", + "DOM_VK_WIN_OEM_CUSEL", + "DOM_VK_WIN_OEM_ENLW", + "DOM_VK_WIN_OEM_FINISH", + "DOM_VK_WIN_OEM_FJ_JISHO", + "DOM_VK_WIN_OEM_FJ_LOYA", + "DOM_VK_WIN_OEM_FJ_MASSHOU", + "DOM_VK_WIN_OEM_FJ_ROYA", + "DOM_VK_WIN_OEM_FJ_TOUROKU", + "DOM_VK_WIN_OEM_JUMP", + "DOM_VK_WIN_OEM_PA1", + "DOM_VK_WIN_OEM_PA2", + "DOM_VK_WIN_OEM_PA3", + "DOM_VK_WIN_OEM_RESET", + "DOM_VK_WIN_OEM_WSCTRL", + "DOM_VK_X", + "DOM_VK_XF86XK_ADD_FAVORITE", + "DOM_VK_XF86XK_APPLICATION_LEFT", + "DOM_VK_XF86XK_APPLICATION_RIGHT", + "DOM_VK_XF86XK_AUDIO_CYCLE_TRACK", + "DOM_VK_XF86XK_AUDIO_FORWARD", + "DOM_VK_XF86XK_AUDIO_LOWER_VOLUME", + "DOM_VK_XF86XK_AUDIO_MEDIA", + "DOM_VK_XF86XK_AUDIO_MUTE", + "DOM_VK_XF86XK_AUDIO_NEXT", + "DOM_VK_XF86XK_AUDIO_PAUSE", + "DOM_VK_XF86XK_AUDIO_PLAY", + "DOM_VK_XF86XK_AUDIO_PREV", + "DOM_VK_XF86XK_AUDIO_RAISE_VOLUME", + "DOM_VK_XF86XK_AUDIO_RANDOM_PLAY", + "DOM_VK_XF86XK_AUDIO_RECORD", + "DOM_VK_XF86XK_AUDIO_REPEAT", + "DOM_VK_XF86XK_AUDIO_REWIND", + "DOM_VK_XF86XK_AUDIO_STOP", + "DOM_VK_XF86XK_AWAY", + "DOM_VK_XF86XK_BACK", + "DOM_VK_XF86XK_BACK_FORWARD", + "DOM_VK_XF86XK_BATTERY", + "DOM_VK_XF86XK_BLUE", + "DOM_VK_XF86XK_BLUETOOTH", + "DOM_VK_XF86XK_BOOK", + "DOM_VK_XF86XK_BRIGHTNESS_ADJUST", + "DOM_VK_XF86XK_CALCULATOR", + "DOM_VK_XF86XK_CALENDAR", + "DOM_VK_XF86XK_CD", + "DOM_VK_XF86XK_CLOSE", + "DOM_VK_XF86XK_COMMUNITY", + "DOM_VK_XF86XK_CONTRAST_ADJUST", + "DOM_VK_XF86XK_COPY", + "DOM_VK_XF86XK_CUT", + "DOM_VK_XF86XK_CYCLE_ANGLE", + "DOM_VK_XF86XK_DISPLAY", + "DOM_VK_XF86XK_DOCUMENTS", + "DOM_VK_XF86XK_DOS", + "DOM_VK_XF86XK_EJECT", + "DOM_VK_XF86XK_EXCEL", + "DOM_VK_XF86XK_EXPLORER", + "DOM_VK_XF86XK_FAVORITES", + "DOM_VK_XF86XK_FINANCE", + "DOM_VK_XF86XK_FORWARD", + "DOM_VK_XF86XK_FRAME_BACK", + "DOM_VK_XF86XK_FRAME_FORWARD", + "DOM_VK_XF86XK_GAME", + "DOM_VK_XF86XK_GO", + "DOM_VK_XF86XK_GREEN", + "DOM_VK_XF86XK_HIBERNATE", + "DOM_VK_XF86XK_HISTORY", + "DOM_VK_XF86XK_HOME_PAGE", + "DOM_VK_XF86XK_HOT_LINKS", + "DOM_VK_XF86XK_I_TOUCH", + "DOM_VK_XF86XK_KBD_BRIGHTNESS_DOWN", + "DOM_VK_XF86XK_KBD_BRIGHTNESS_UP", + "DOM_VK_XF86XK_KBD_LIGHT_ON_OFF", + "DOM_VK_XF86XK_LAUNCH0", + "DOM_VK_XF86XK_LAUNCH1", + "DOM_VK_XF86XK_LAUNCH2", + "DOM_VK_XF86XK_LAUNCH3", + "DOM_VK_XF86XK_LAUNCH4", + "DOM_VK_XF86XK_LAUNCH5", + "DOM_VK_XF86XK_LAUNCH6", + "DOM_VK_XF86XK_LAUNCH7", + "DOM_VK_XF86XK_LAUNCH8", + "DOM_VK_XF86XK_LAUNCH9", + "DOM_VK_XF86XK_LAUNCH_A", + "DOM_VK_XF86XK_LAUNCH_B", + "DOM_VK_XF86XK_LAUNCH_C", + "DOM_VK_XF86XK_LAUNCH_D", + "DOM_VK_XF86XK_LAUNCH_E", + "DOM_VK_XF86XK_LAUNCH_F", + "DOM_VK_XF86XK_LIGHT_BULB", + "DOM_VK_XF86XK_LOG_OFF", + "DOM_VK_XF86XK_MAIL", + "DOM_VK_XF86XK_MAIL_FORWARD", + "DOM_VK_XF86XK_MARKET", + "DOM_VK_XF86XK_MEETING", + "DOM_VK_XF86XK_MEMO", + "DOM_VK_XF86XK_MENU_KB", + "DOM_VK_XF86XK_MENU_PB", + "DOM_VK_XF86XK_MESSENGER", + "DOM_VK_XF86XK_MON_BRIGHTNESS_DOWN", + "DOM_VK_XF86XK_MON_BRIGHTNESS_UP", + "DOM_VK_XF86XK_MUSIC", + "DOM_VK_XF86XK_MY_COMPUTER", + "DOM_VK_XF86XK_MY_SITES", + "DOM_VK_XF86XK_NEW", + "DOM_VK_XF86XK_NEWS", + "DOM_VK_XF86XK_OFFICE_HOME", + "DOM_VK_XF86XK_OPEN", + "DOM_VK_XF86XK_OPEN_URL", + "DOM_VK_XF86XK_OPTION", + "DOM_VK_XF86XK_PASTE", + "DOM_VK_XF86XK_PHONE", + "DOM_VK_XF86XK_PICTURES", + "DOM_VK_XF86XK_POWER_DOWN", + "DOM_VK_XF86XK_POWER_OFF", + "DOM_VK_XF86XK_RED", + "DOM_VK_XF86XK_REFRESH", + "DOM_VK_XF86XK_RELOAD", + "DOM_VK_XF86XK_REPLY", + "DOM_VK_XF86XK_ROCKER_DOWN", + "DOM_VK_XF86XK_ROCKER_ENTER", + "DOM_VK_XF86XK_ROCKER_UP", + "DOM_VK_XF86XK_ROTATE_WINDOWS", + "DOM_VK_XF86XK_ROTATION_KB", + "DOM_VK_XF86XK_ROTATION_PB", + "DOM_VK_XF86XK_SAVE", + "DOM_VK_XF86XK_SCREEN_SAVER", + "DOM_VK_XF86XK_SCROLL_CLICK", + "DOM_VK_XF86XK_SCROLL_DOWN", + "DOM_VK_XF86XK_SCROLL_UP", + "DOM_VK_XF86XK_SEARCH", + "DOM_VK_XF86XK_SEND", + "DOM_VK_XF86XK_SHOP", + "DOM_VK_XF86XK_SPELL", + "DOM_VK_XF86XK_SPLIT_SCREEN", + "DOM_VK_XF86XK_STANDBY", + "DOM_VK_XF86XK_START", + "DOM_VK_XF86XK_STOP", + "DOM_VK_XF86XK_SUBTITLE", + "DOM_VK_XF86XK_SUPPORT", + "DOM_VK_XF86XK_SUSPEND", + "DOM_VK_XF86XK_TASK_PANE", + "DOM_VK_XF86XK_TERMINAL", + "DOM_VK_XF86XK_TIME", + "DOM_VK_XF86XK_TOOLS", + "DOM_VK_XF86XK_TOP_MENU", + "DOM_VK_XF86XK_TO_DO_LIST", + "DOM_VK_XF86XK_TRAVEL", + "DOM_VK_XF86XK_USER1KB", + "DOM_VK_XF86XK_USER2KB", + "DOM_VK_XF86XK_USER_PB", + "DOM_VK_XF86XK_UWB", + "DOM_VK_XF86XK_VENDOR_HOME", + "DOM_VK_XF86XK_VIDEO", + "DOM_VK_XF86XK_VIEW", + "DOM_VK_XF86XK_WAKE_UP", + "DOM_VK_XF86XK_WEB_CAM", + "DOM_VK_XF86XK_WHEEL_BUTTON", + "DOM_VK_XF86XK_WLAN", + "DOM_VK_XF86XK_WORD", + "DOM_VK_XF86XK_WWW", + "DOM_VK_XF86XK_XFER", + "DOM_VK_XF86XK_YELLOW", + "DOM_VK_XF86XK_ZOOM_IN", + "DOM_VK_XF86XK_ZOOM_OUT", + "DOM_VK_Y", + "DOM_VK_Z", + "DOM_VK_ZOOM", + "DONE", + "DONT_CARE", + "DOWNLOADING", + "DRAGDROP", + "DRAW_BUFFER0", + "DRAW_BUFFER1", + "DRAW_BUFFER10", + "DRAW_BUFFER11", + "DRAW_BUFFER12", + "DRAW_BUFFER13", + "DRAW_BUFFER14", + "DRAW_BUFFER15", + "DRAW_BUFFER2", + "DRAW_BUFFER3", + "DRAW_BUFFER4", + "DRAW_BUFFER5", + "DRAW_BUFFER6", + "DRAW_BUFFER7", + "DRAW_BUFFER8", + "DRAW_BUFFER9", + "DRAW_FRAMEBUFFER", + "DRAW_FRAMEBUFFER_BINDING", + "DST_ALPHA", + "DST_COLOR", + "DYNAMIC_COPY", + "DYNAMIC_DRAW", + "DYNAMIC_READ", + "DataChannel", + "DataCue", + "DataTransfer", + "DataTransferItem", + "DataTransferItemList", + "DataView", + "Database", + "Date", + "DateTimeFormat", + "Debug", + "DecompressionStream", + "Default Browser Helper", + "DelayNode", + "DesktopNotification", + "DesktopNotificationCenter", + "DeviceAcceleration", + "DeviceLightEvent", + "DeviceMotionEvent", + "DeviceMotionEventAcceleration", + "DeviceMotionEventRotationRate", + "DeviceOrientationEvent", + "DeviceProximityEvent", + "DeviceRotationRate", + "DeviceStorage", + "DeviceStorageChangeEvent", + "Directory", + "DisplayNames", + "Document", + "DocumentFragment", + "DocumentTimeline", + "DocumentType", + "DragEvent", + "DynamicsCompressorNode", + "E", + "ELEMENT_ARRAY_BUFFER", + "ELEMENT_ARRAY_BUFFER_BINDING", + "ELEMENT_NODE", + "EMPTY", + "ENCODING_ERR", + "ENDED", + "END_TO_END", + "END_TO_START", + "ENTITY_NODE", + "ENTITY_REFERENCE_NODE", + "EPSILON", + "EQUAL", + "EQUALPOWER", + "ERROR", + "EXPONENTIAL_DISTANCE", + "EXT_texture_filter_anisotropic", + "Element", + "ElementInternals", + "ElementQuery", + "EnterPictureInPictureEvent", + "Entity", + "EntityReference", + "Enumerator", + "Error", + "ErrorEvent", + "EvalError", + "Event", + "EventException", + "EventSource", + "EventTarget", + "External", + "FASTEST", + "FIDOSDK", + "FILTER_ACCEPT", + "FILTER_INTERRUPT", + "FILTER_REJECT", + "FILTER_SKIP", + "FINISHED_STATE", + "FIRST_ORDERED_NODE_TYPE", + "FLOAT", + "FLOAT_32_UNSIGNED_INT_24_8_REV", + "FLOAT_MAT2", + "FLOAT_MAT2x3", + "FLOAT_MAT2x4", + "FLOAT_MAT3", + "FLOAT_MAT3x2", + "FLOAT_MAT3x4", + "FLOAT_MAT4", + "FLOAT_MAT4x2", + "FLOAT_MAT4x3", + "FLOAT_VEC2", + "FLOAT_VEC3", + "FLOAT_VEC4", + "FOCUS", + "FONT_FACE_RULE", + "FONT_FEATURE_VALUES_RULE", + "FRAGMENT_SHADER", + "FRAGMENT_SHADER_DERIVATIVE_HINT", + "FRAGMENT_SHADER_DERIVATIVE_HINT_OES", + "FRAMEBUFFER", + "FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE", + "FRAMEBUFFER_ATTACHMENT_BLUE_SIZE", + "FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING", + "FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE", + "FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE", + "FRAMEBUFFER_ATTACHMENT_GREEN_SIZE", + "FRAMEBUFFER_ATTACHMENT_OBJECT_NAME", + "FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE", + "FRAMEBUFFER_ATTACHMENT_RED_SIZE", + "FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE", + "FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE", + "FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER", + "FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL", + "FRAMEBUFFER_BINDING", + "FRAMEBUFFER_COMPLETE", + "FRAMEBUFFER_DEFAULT", + "FRAMEBUFFER_INCOMPLETE_ATTACHMENT", + "FRAMEBUFFER_INCOMPLETE_DIMENSIONS", + "FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT", + "FRAMEBUFFER_INCOMPLETE_MULTISAMPLE", + "FRAMEBUFFER_UNSUPPORTED", + "FRONT", + "FRONT_AND_BACK", + "FRONT_FACE", + "FUNC_ADD", + "FUNC_REVERSE_SUBTRACT", + "FUNC_SUBTRACT", + "FeaturePolicy", + "FederatedCredential", + "Feed", + "FeedEntry", + "File", + "FileError", + "FileList", + "FileReader", + "FileSystem", + "FileSystemDirectoryEntry", + "FileSystemDirectoryReader", + "FileSystemEntry", + "FileSystemFileEntry", + "FinalizationRegistry", + "FindInPage", + "Float32Array", + "Float64Array", + "FocusEvent", + "FontFace", + "FontFaceSet", + "FontFaceSetLoadEvent", + "FormData", + "FormDataEvent", + "FragmentDirective", + "Function", + "GENERATE_MIPMAP_HINT", + "GEQUAL", + "GREATER", + "GREEN_BITS", + "GainNode", + "Gamepad", + "GamepadButton", + "GamepadEvent", + "GamepadHapticActuator", + "GamepadPose", + "Geolocation", + "GeolocationCoordinates", + "GeolocationPosition", + "GeolocationPositionError", + "GestureEvent", + "Global", + "Gyroscope", + "HALF_FLOAT", + "HAVE_CURRENT_DATA", + "HAVE_ENOUGH_DATA", + "HAVE_FUTURE_DATA", + "HAVE_METADATA", + "HAVE_NOTHING", + "HEADERS_RECEIVED", + "HIDDEN", + "HIERARCHY_REQUEST_ERR", + "HIGHPASS", + "HIGHSHELF", + "HIGH_FLOAT", + "HIGH_INT", + "HORIZONTAL", + "HORIZONTAL_AXIS", + "HRTF", + "HTMLAllCollection", + "HTMLAnchorElement", + "HTMLAppletElement", + "HTMLAreaElement", + "HTMLAreasCollection", + "HTMLAudioElement", + "HTMLBGSoundElement", + "HTMLBRElement", + "HTMLBaseElement", + "HTMLBaseFontElement", + "HTMLBlockElement", + "HTMLBlockquoteElement", + "HTMLBodyElement", + "HTMLButtonElement", + "HTMLCanvasElement", + "HTMLCollection", + "HTMLCommandElement", + "HTMLContentElement", + "HTMLDDElement", + "HTMLDListElement", + "HTMLDTElement", + "HTMLDataElement", + "HTMLDataListElement", + "HTMLDetailsElement", + "HTMLDialogElement", + "HTMLDirectoryElement", + "HTMLDivElement", + "HTMLDocument", + "HTMLElement", + "HTMLEmbedElement", + "HTMLFieldSetElement", + "HTMLFontElement", + "HTMLFormControlsCollection", + "HTMLFormElement", + "HTMLFrameElement", + "HTMLFrameSetElement", + "HTMLHRElement", + "HTMLHeadElement", + "HTMLHeadingElement", + "HTMLHtmlElement", + "HTMLIFrameElement", + "HTMLImageElement", + "HTMLInputElement", + "HTMLIsIndexElement", + "HTMLKeygenElement", + "HTMLLIElement", + "HTMLLabelElement", + "HTMLLegendElement", + "HTMLLinkElement", + "HTMLMapElement", + "HTMLMarqueeElement", + "HTMLMediaElement", + "HTMLMenuElement", + "HTMLMenuItemElement", + "HTMLMetaElement", + "HTMLMeterElement", + "HTMLModElement", + "HTMLNextIdElement", + "HTMLOListElement", + "HTMLObjectElement", + "HTMLOptGroupElement", + "HTMLOptionElement", + "HTMLOptionsCollection", + "HTMLOutputElement", + "HTMLParagraphElement", + "HTMLParamElement", + "HTMLPhraseElement", + "HTMLPictureElement", + "HTMLPreElement", + "HTMLProgressElement", + "HTMLPropertiesCollection", + "HTMLQuoteElement", + "HTMLScriptElement", + "HTMLSelectElement", + "HTMLShadowElement", + "HTMLSlotElement", + "HTMLSourceElement", + "HTMLSpanElement", + "HTMLStyleElement", + "HTMLTableCaptionElement", + "HTMLTableCellElement", + "HTMLTableColElement", + "HTMLTableDataCellElement", + "HTMLTableElement", + "HTMLTableHeaderCellElement", + "HTMLTableRowElement", + "HTMLTableSectionElement", + "HTMLTemplateElement", + "HTMLTextAreaElement", + "HTMLTimeElement", + "HTMLTitleElement", + "HTMLTrackElement", + "HTMLUListElement", + "HTMLUnknownElement", + "HTMLVideoElement", + "HashChangeEvent", + "Headers", + "History", + "Hz", + "ICE_CHECKING", + "ICE_CLOSED", + "ICE_COMPLETED", + "ICE_CONNECTED", + "ICE_FAILED", + "ICE_GATHERING", + "ICE_WAITING", + "IDBCursor", + "IDBCursorWithValue", + "IDBDatabase", + "IDBDatabaseException", + "IDBFactory", + "IDBFileHandle", + "IDBFileRequest", + "IDBIndex", + "IDBKeyRange", + "IDBMutableFile", + "IDBObjectStore", + "IDBOpenDBRequest", + "IDBRequest", + "IDBTransaction", + "IDBVersionChangeEvent", + "IDLE", + "IIRFilterNode", + "IMPLEMENTATION_COLOR_READ_FORMAT", + "IMPLEMENTATION_COLOR_READ_TYPE", + "IMPORT_RULE", + "INCR", + "INCR_WRAP", + "INDEX_SIZE_ERR", + "INSTALL", + "INSTALLED", + "INT", + "INTERLEAVED_ATTRIBS", + "INT_2_10_10_10_REV", + "INT_SAMPLER_2D", + "INT_SAMPLER_2D_ARRAY", + "INT_SAMPLER_3D", + "INT_SAMPLER_CUBE", + "INT_VEC2", + "INT_VEC3", + "INT_VEC4", + "INUSE_ATTRIBUTE_ERR", + "INVALID_ACCESS_ERR", + "INVALID_CHARACTER_ERR", + "INVALID_ENUM", + "INVALID_EXPRESSION_ERR", + "INVALID_FRAMEBUFFER_OPERATION", + "INVALID_INDEX", + "INVALID_MODIFICATION_ERR", + "INVALID_NODE_TYPE_ERR", + "INVALID_OPERATION", + "INVALID_STATE_ERR", + "INVALID_VALUE", + "INVERSE_DISTANCE", + "INVERT", + "IceCandidate", + "IdleDeadline", + "Image", + "ImageBitmap", + "ImageBitmapRenderingContext", + "ImageCapture", + "ImageData", + "Infinity", + "InputDeviceCapabilities", + "InputDeviceInfo", + "InputEvent", + "InputMethodContext", + "InstallState", + "InstallTrigger", + "Instance", + "Int16Array", + "Int32Array", + "Int8Array", + "Intent", + "InternalError", + "IntersectionObserver", + "IntersectionObserverEntry", + "Intl", + "IsSearchProviderInstalled", + "Iterator", + "JSON", + "Java Deployment Toolkit 7.0.250.17", + "Java(TM) Platform SE 7 U25", + "KEEP", + "KEYDOWN", + "KEYFRAMES_RULE", + "KEYFRAME_RULE", + "KEYPRESS", + "KEYUP", + "Key", + "KeyEvent", + "KeyOperation", + "KeyPair", + "Keyboard", + "KeyboardEvent", + "KeyboardLayoutMap", + "KeyframeEffect", + "LENGTHADJUST_SPACING", + "LENGTHADJUST_SPACINGANDGLYPHS", + "LENGTHADJUST_UNKNOWN", + "LEQUAL", + "LESS", + "LINEAR", + "LINEAR_DISTANCE", + "LINEAR_MIPMAP_LINEAR", + "LINEAR_MIPMAP_NEAREST", + "LINES", + "LINE_LOOP", + "LINE_STRIP", + "LINE_WIDTH", + "LINK_STATUS", + "LINUX", + "LIVE", + "LN10", + "LN2", + "LOADED", + "LOADING", + "LOCALE", + "LOG10E", + "LOG2E", + "LOWPASS", + "LOWSHELF", + "LOW_FLOAT", + "LOW_INT", + "LSException", + "LSParserFilter", + "LUMINANCE", + "LUMINANCE_ALPHA", + "LargestContentfulPaint", + "LayoutShift", + "LayoutShiftAttribution", + "LinearAccelerationSensor", + "LinkError", + "ListFormat", + "LocalMediaStream", + "Locale", + "Location", + "Lock", + "LockManager", + "MAC", + "MAX", + "MAX_3D_TEXTURE_SIZE", + "MAX_ARRAY_TEXTURE_LAYERS", + "MAX_CLIENT_WAIT_TIMEOUT_WEBGL", + "MAX_COLOR_ATTACHMENTS", + "MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS", + "MAX_COMBINED_TEXTURE_IMAGE_UNITS", + "MAX_COMBINED_UNIFORM_BLOCKS", + "MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS", + "MAX_CUBE_MAP_TEXTURE_SIZE", + "MAX_DRAW_BUFFERS", + "MAX_ELEMENTS_INDICES", + "MAX_ELEMENTS_VERTICES", + "MAX_ELEMENT_INDEX", + "MAX_FRAGMENT_INPUT_COMPONENTS", + "MAX_FRAGMENT_UNIFORM_BLOCKS", + "MAX_FRAGMENT_UNIFORM_COMPONENTS", + "MAX_FRAGMENT_UNIFORM_VECTORS", + "MAX_PROGRAM_TEXEL_OFFSET", + "MAX_RENDERBUFFER_SIZE", + "MAX_SAFE_INTEGER", + "MAX_SAMPLES", + "MAX_SERVER_WAIT_TIMEOUT", + "MAX_TEXTURE_IMAGE_UNITS", + "MAX_TEXTURE_LOD_BIAS", + "MAX_TEXTURE_MAX_ANISOTROPY_EXT", + "MAX_TEXTURE_SIZE", + "MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS", + "MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS", + "MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS", + "MAX_UNIFORM_BLOCK_SIZE", + "MAX_UNIFORM_BUFFER_BINDINGS", + "MAX_VALUE", + "MAX_VARYING_COMPONENTS", + "MAX_VARYING_VECTORS", + "MAX_VERTEX_ATTRIBS", + "MAX_VERTEX_OUTPUT_COMPONENTS", + "MAX_VERTEX_TEXTURE_IMAGE_UNITS", + "MAX_VERTEX_UNIFORM_BLOCKS", + "MAX_VERTEX_UNIFORM_COMPONENTS", + "MAX_VERTEX_UNIFORM_VECTORS", + "MAX_VIEWPORT_DIMS", + "MEDIA_ERR_ABORTED", + "MEDIA_ERR_DECODE", + "MEDIA_ERR_ENCRYPTED", + "MEDIA_ERR_NETWORK", + "MEDIA_ERR_SRC_NOT_SUPPORTED", + "MEDIA_KEYERR_CLIENT", + "MEDIA_KEYERR_DOMAIN", + "MEDIA_KEYERR_HARDWARECHANGE", + "MEDIA_KEYERR_OUTPUT", + "MEDIA_KEYERR_SERVICE", + "MEDIA_KEYERR_UNKNOWN", + "MEDIA_RULE", + "MEDIUM_FLOAT", + "MEDIUM_INT", + "META_MASK", + "MIDIAccess", + "MIDIConnectionEvent", + "MIDIInput", + "MIDIInputMap", + "MIDIMessageEvent", + "MIDIOutput", + "MIDIOutputMap", + "MIDIPort", + "MIN", + "MIN_PROGRAM_TEXEL_OFFSET", + "MIN_SAFE_INTEGER", + "MIN_VALUE", + "MIRRORED_REPEAT", + "MODE_ASYNCHRONOUS", + "MODE_SYNCHRONOUS", + "MODIFICATION", + "MOUSEDOWN", + "MOUSEDRAG", + "MOUSEMOVE", + "MOUSEOUT", + "MOUSEOVER", + "MOUSEUP", + "MOZ_KEYFRAMES_RULE", + "MOZ_KEYFRAME_RULE", + "MOZ_SOURCE_CURSOR", + "MOZ_SOURCE_ERASER", + "MOZ_SOURCE_KEYBOARD", + "MOZ_SOURCE_MOUSE", + "MOZ_SOURCE_PEN", + "MOZ_SOURCE_TOUCH", + "MOZ_SOURCE_UNKNOWN", + "MSBehaviorUrnsCollection", + "MSBlobBuilder", + "MSCSSMatrix", + "MSCSSProperties", + "MSCSSRuleList", + "MSCompatibleInfo", + "MSCompatibleInfoCollection", + "MSCurrentStyleCSSProperties", + "MSEventObj", + "MSGESTURE_FLAG_BEGIN", + "MSGESTURE_FLAG_CANCEL", + "MSGESTURE_FLAG_END", + "MSGESTURE_FLAG_INERTIA", + "MSGESTURE_FLAG_NONE", + "MSGesture", + "MSGestureEvent", + "MSGraphicsTrust", + "MSInputMethodContext", + "MSManipulationEvent", + "MSMediaKeyError", + "MSMediaKeyMessageEvent", + "MSMediaKeyNeededEvent", + "MSMediaKeySession", + "MSMediaKeys", + "MSMimeTypesCollection", + "MSPOINTER_TYPE_MOUSE", + "MSPOINTER_TYPE_PEN", + "MSPOINTER_TYPE_TOUCH", + "MSPluginsCollection", + "MSPointerEvent", + "MSRangeCollection", + "MSSiteModeEvent", + "MSStream", + "MSStreamReader", + "MSStyleCSSProperties", + "MS_ASYNC_CALLBACK_STATUS_ASSIGN_DELEGATE", + "MS_ASYNC_CALLBACK_STATUS_CANCEL", + "MS_ASYNC_CALLBACK_STATUS_CHOOSEANY", + "MS_ASYNC_CALLBACK_STATUS_ERROR", + "MS_ASYNC_CALLBACK_STATUS_JOIN", + "MS_ASYNC_OP_STATUS_CANCELED", + "MS_ASYNC_OP_STATUS_ERROR", + "MS_ASYNC_OP_STATUS_SUCCESS", + "MS_MANIPULATION_STATE_ACTIVE", + "MS_MANIPULATION_STATE_CANCELLED", + "MS_MANIPULATION_STATE_COMMITTED", + "MS_MANIPULATION_STATE_DRAGGING", + "MS_MANIPULATION_STATE_INERTIA", + "MS_MANIPULATION_STATE_PRESELECT", + "MS_MANIPULATION_STATE_SELECTING", + "MS_MANIPULATION_STATE_STOPPED", + "MS_MEDIA_ERR_ENCRYPTED", + "MS_MEDIA_KEYERR_CLIENT", + "MS_MEDIA_KEYERR_DOMAIN", + "MS_MEDIA_KEYERR_HARDWARECHANGE", + "MS_MEDIA_KEYERR_OUTPUT", + "MS_MEDIA_KEYERR_SERVICE", + "MS_MEDIA_KEYERR_UNKNOWN", + "Map", + "Math", + "MathMLElement", + "MediaCapabilities", + "MediaCapabilitiesInfo", + "MediaController", + "MediaDeviceInfo", + "MediaDevices", + "MediaElementAudioSourceNode", + "MediaEncryptedEvent", + "MediaError", + "MediaKeyError", + "MediaKeyEvent", + "MediaKeyMessageEvent", + "MediaKeyNeededEvent", + "MediaKeySession", + "MediaKeyStatusMap", + "MediaKeySystemAccess", + "MediaKeys", + "MediaList", + "MediaMetadata", + "MediaQueryList", + "MediaQueryListEvent", + "MediaRecorder", + "MediaRecorderErrorEvent", + "MediaSession", + "MediaSettingsRange", + "MediaSource", + "MediaStream", + "MediaStreamAudioDestinationNode", + "MediaStreamAudioSourceNode", + "MediaStreamEvent", + "MediaStreamTrack", + "MediaStreamTrackAudioSourceNode", + "MediaStreamTrackEvent", + "Memory", + "MessageChannel", + "MessageEvent", + "MessagePort", + "Methods", + "Microsoft® DRM", + "MimeType", + "MimeTypeArray", + "Module", + "MouseEvent", + "MouseScrollEvent", + "MouseWheelEvent", + "MozAnimation", + "MozAnimationDelay", + "MozAnimationDirection", + "MozAnimationDuration", + "MozAnimationFillMode", + "MozAnimationIterationCount", + "MozAnimationName", + "MozAnimationPlayState", + "MozAnimationTimingFunction", + "MozAppearance", + "MozBackfaceVisibility", + "MozBinding", + "MozBorderBottomColors", + "MozBorderEnd", + "MozBorderEndColor", + "MozBorderEndStyle", + "MozBorderEndWidth", + "MozBorderImage", + "MozBorderLeftColors", + "MozBorderRightColors", + "MozBorderStart", + "MozBorderStartColor", + "MozBorderStartStyle", + "MozBorderStartWidth", + "MozBorderTopColors", + "MozBoxAlign", + "MozBoxDirection", + "MozBoxFlex", + "MozBoxOrdinalGroup", + "MozBoxOrient", + "MozBoxPack", + "MozBoxSizing", + "MozCSSKeyframeRule", + "MozCSSKeyframesRule", + "MozColumnCount", + "MozColumnFill", + "MozColumnGap", + "MozColumnRule", + "MozColumnRuleColor", + "MozColumnRuleStyle", + "MozColumnRuleWidth", + "MozColumnWidth", + "MozColumns", + "MozContactChangeEvent", + "MozFloatEdge", + "MozFontFeatureSettings", + "MozFontLanguageOverride", + "MozForceBrokenImageIcon", + "MozHyphens", + "MozImageRegion", + "MozMarginEnd", + "MozMarginStart", + "MozMmsEvent", + "MozMmsMessage", + "MozMobileMessageThread", + "MozOSXFontSmoothing", + "MozOrient", + "MozOutlineRadius", + "MozOutlineRadiusBottomleft", + "MozOutlineRadiusBottomright", + "MozOutlineRadiusTopleft", + "MozOutlineRadiusTopright", + "MozPaddingEnd", + "MozPaddingStart", + "MozPerspective", + "MozPerspectiveOrigin", + "MozPowerManager", + "MozSettingsEvent", + "MozSmsEvent", + "MozSmsMessage", + "MozStackSizing", + "MozTabSize", + "MozTextAlignLast", + "MozTextDecorationColor", + "MozTextDecorationLine", + "MozTextDecorationStyle", + "MozTextSizeAdjust", + "MozTransform", + "MozTransformOrigin", + "MozTransformStyle", + "MozTransition", + "MozTransitionDelay", + "MozTransitionDuration", + "MozTransitionProperty", + "MozTransitionTimingFunction", + "MozUserFocus", + "MozUserInput", + "MozUserModify", + "MozUserSelect", + "MozWindowDragging", + "MozWindowShadow", + "MutationEvent", + "MutationObserver", + "MutationRecord", + "NAMESPACE_ERR", + "NAMESPACE_RULE", + "NEAREST", + "NEAREST_MIPMAP_LINEAR", + "NEAREST_MIPMAP_NEAREST", + "NEGATIVE_INFINITY", + "NETWORK_EMPTY", + "NETWORK_ERR", + "NETWORK_IDLE", + "NETWORK_LOADED", + "NETWORK_LOADING", + "NETWORK_NO_SOURCE", + "NEVER", + "NEW", + "NEXT", + "NEXT_NO_DUPLICATE", + "NICEST", + "NODE_AFTER", + "NODE_BEFORE", + "NODE_BEFORE_AND_AFTER", + "NODE_INSIDE", + "NONE", + "NON_TRANSIENT_ERR", + "NOTATION_NODE", + "NOTCH", + "NOTEQUAL", + "NOT_ALLOWED_ERR", + "NOT_FOUND_ERR", + "NOT_INSTALLED", + "NOT_READABLE_ERR", + "NOT_SUPPORTED_ERR", + "NO_DATA_ALLOWED_ERR", + "NO_ERR", + "NO_ERROR", + "NO_MODIFICATION_ALLOWED_ERR", + "NO_UPDATE", + "NUMBER_TYPE", + "NUM_COMPRESSED_TEXTURE_FORMATS", + "NaN", + "NamedNodeMap", + "Native Client", + "NavigationPreloadManager", + "Navigator", + "NearbyLinks", + "NetworkInformation", + "Node", + "NodeFilter", + "NodeIterator", + "NodeList", + "Notation", + "Notification", + "NotifyPaintEvent", + "Number", + "NumberFormat", + "OBJECT_TYPE", + "OBSOLETE", + "OES_element_index_uint", + "OES_standard_derivatives", + "OES_texture_float", + "OES_texture_float_linear", + "OK", + "ONE", + "ONE_MINUS_CONSTANT_ALPHA", + "ONE_MINUS_CONSTANT_COLOR", + "ONE_MINUS_DST_ALPHA", + "ONE_MINUS_DST_COLOR", + "ONE_MINUS_SRC_ALPHA", + "ONE_MINUS_SRC_COLOR", + "OPEN", + "OPENBSD", + "OPENED", + "OPENING", + "ORDERED_NODE_ITERATOR_TYPE", + "ORDERED_NODE_SNAPSHOT_TYPE", + "OS_UPDATE", + "OTHER_ERROR", + "OUT_OF_MEMORY", + "Object", + "OfflineAudioCompletionEvent", + "OfflineAudioContext", + "OfflineResourceList", + "OffscreenCanvas", + "OffscreenCanvasRenderingContext2D", + "OnInstalledReason", + "OnRestartRequiredReason", + "Option", + "OrientationSensor", + "OscillatorNode", + "OverconstrainedError", + "OverconstrainedErrorEvent", + "OverflowEvent", + "PACKAGE", + "PACK_ALIGNMENT", + "PACK_ROW_LENGTH", + "PACK_SKIP_PIXELS", + "PACK_SKIP_ROWS", + "PAGE_RULE", + "PARSE_ERR", + "PATHSEG_ARC_ABS", + "PATHSEG_ARC_REL", + "PATHSEG_CLOSEPATH", + "PATHSEG_CURVETO_CUBIC_ABS", + "PATHSEG_CURVETO_CUBIC_REL", + "PATHSEG_CURVETO_CUBIC_SMOOTH_ABS", + "PATHSEG_CURVETO_CUBIC_SMOOTH_REL", + "PATHSEG_CURVETO_QUADRATIC_ABS", + "PATHSEG_CURVETO_QUADRATIC_REL", + "PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS", + "PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL", + "PATHSEG_LINETO_ABS", + "PATHSEG_LINETO_HORIZONTAL_ABS", + "PATHSEG_LINETO_HORIZONTAL_REL", + "PATHSEG_LINETO_REL", + "PATHSEG_LINETO_VERTICAL_ABS", + "PATHSEG_LINETO_VERTICAL_REL", + "PATHSEG_MOVETO_ABS", + "PATHSEG_MOVETO_REL", + "PATHSEG_UNKNOWN", + "PATH_EXISTS_ERR", + "PEAKING", + "PERIODIC", + "PERMISSION_DENIED", + "PERSISTENT", + "PI", + "PIXEL_PACK_BUFFER", + "PIXEL_PACK_BUFFER_BINDING", + "PIXEL_UNPACK_BUFFER", + "PIXEL_UNPACK_BUFFER_BINDING", + "PLAYING_STATE", + "POINTS", + "POLYGON_OFFSET_FACTOR", + "POLYGON_OFFSET_FILL", + "POLYGON_OFFSET_UNITS", + "POSITION_UNAVAILABLE", + "POSITIVE_INFINITY", + "PREV", + "PREV_NO_DUPLICATE", + "PROCESSING_INSTRUCTION_NODE", + "PageChangeEvent", + "PageTransitionEvent", + "PaintRequest", + "PaintRequestList", + "PannerNode", + "PasswordCredential", + "Path2D", + "PaymentAddress", + "PaymentInstruments", + "PaymentManager", + "PaymentMethodChangeEvent", + "PaymentRequest", + "PaymentRequestUpdateEvent", + "PaymentResponse", + "Performance", + "PerformanceElementTiming", + "PerformanceEntry", + "PerformanceEventTiming", + "PerformanceLongTaskTiming", + "PerformanceMark", + "PerformanceMeasure", + "PerformanceNavigation", + "PerformanceNavigationTiming", + "PerformanceObserver", + "PerformanceObserverEntryList", + "PerformancePaintTiming", + "PerformanceResourceTiming", + "PerformanceServerTiming", + "PerformanceTiming", + "PeriodicSyncManager", + "PeriodicWave", + "PermissionStatus", + "Permissions", + "PhotoCapabilities", + "PictureInPictureWindow", + "PlatformArch", + "PlatformNaclArch", + "PlatformOs", + "Plugin", + "PluginArray", + "PluralRules", + "PointerEvent", + "PopStateEvent", + "PopupBlockedEvent", + "Position", + "PositionError", + "Presentation", + "PresentationAvailability", + "PresentationConnection", + "PresentationConnectionAvailableEvent", + "PresentationConnectionCloseEvent", + "PresentationConnectionList", + "PresentationReceiver", + "PresentationRequest", + "ProcessingInstruction", + "ProgressEvent", + "Promise", + "PromiseRejectionEvent", + "PropertyNodeList", + "Proxy", + "PublicKeyCredential", + "PushManager", + "PushSubscription", + "PushSubscriptionOptions", + "Q", + "QUERY_RESULT", + "QUERY_RESULT_AVAILABLE", + "QUOTA_ERR", + "QUOTA_EXCEEDED_ERR", + "QueryInterface", + "R11F_G11F_B10F", + "R16F", + "R16I", + "R16UI", + "R32F", + "R32I", + "R32UI", + "R8", + "R8I", + "R8UI", + "R8_SNORM", + "RASTERIZER_DISCARD", + "READY_TO_RUN", + "READ_BUFFER", + "READ_FRAMEBUFFER", + "READ_FRAMEBUFFER_BINDING", + "READ_ONLY", + "READ_ONLY_ERR", + "READ_WRITE", + "RED", + "RED_BITS", + "RED_INTEGER", + "REMOVAL", + "RENDERBUFFER", + "RENDERBUFFER_ALPHA_SIZE", + "RENDERBUFFER_BINDING", + "RENDERBUFFER_BLUE_SIZE", + "RENDERBUFFER_DEPTH_SIZE", + "RENDERBUFFER_GREEN_SIZE", + "RENDERBUFFER_HEIGHT", + "RENDERBUFFER_INTERNAL_FORMAT", + "RENDERBUFFER_RED_SIZE", + "RENDERBUFFER_SAMPLES", + "RENDERBUFFER_STENCIL_SIZE", + "RENDERBUFFER_WIDTH", + "RENDERER", + "RENDERING_INTENT_ABSOLUTE_COLORIMETRIC", + "RENDERING_INTENT_AUTO", + "RENDERING_INTENT_PERCEPTUAL", + "RENDERING_INTENT_RELATIVE_COLORIMETRIC", + "RENDERING_INTENT_SATURATION", + "RENDERING_INTENT_UNKNOWN", + "REPEAT", + "REPLACE", + "RG", + "RG16F", + "RG16I", + "RG16UI", + "RG32F", + "RG32I", + "RG32UI", + "RG8", + "RG8I", + "RG8UI", + "RG8_SNORM", + "RGB", + "RGB10_A2", + "RGB10_A2UI", + "RGB16F", + "RGB16I", + "RGB16UI", + "RGB32F", + "RGB32I", + "RGB32UI", + "RGB565", + "RGB5_A1", + "RGB8", + "RGB8I", + "RGB8UI", + "RGB8_SNORM", + "RGB9_E5", + "RGBA", + "RGBA16F", + "RGBA16I", + "RGBA16UI", + "RGBA32F", + "RGBA32I", + "RGBA32UI", + "RGBA4", + "RGBA8", + "RGBA8I", + "RGBA8UI", + "RGBA8_SNORM", + "RGBA_INTEGER", + "RGBColor", + "RGB_INTEGER", + "RG_INTEGER", + "ROTATION_CLOCKWISE", + "ROTATION_COUNTERCLOCKWISE", + "RTCCertificate", + "RTCDTMFSender", + "RTCDTMFToneChangeEvent", + "RTCDataChannel", + "RTCDataChannelEvent", + "RTCDtlsTransport", + "RTCError", + "RTCErrorEvent", + "RTCIceCandidate", + "RTCIceTransport", + "RTCPeerConnection", + "RTCPeerConnectionIceErrorEvent", + "RTCPeerConnectionIceEvent", + "RTCRtpReceiver", + "RTCRtpSender", + "RTCRtpTransceiver", + "RTCSctpTransport", + "RTCSessionDescription", + "RTCStatsReport", + "RTCTrackEvent", + "RUNNING", + "RadioNodeList", + "Range", + "RangeError", + "RangeException", + "ReadableByteStream", + "ReadableStream", + "ReadableStreamDefaultReader", + "RecordErrorEvent", + "Rect", + "ReferenceError", + "Reflect", + "RegExp", + "RelativeOrientationSensor", + "RelativeTimeFormat", + "RemotePlayback", + "ReportingObserver", + "Request", + "RequestUpdateCheckStatus", + "ResizeObserver", + "ResizeObserverEntry", + "ResizeObserverSize", + "Response", + "RunningState", + "RuntimeError", + "SAMPLER_2D", + "SAMPLER_2D_ARRAY", + "SAMPLER_2D_ARRAY_SHADOW", + "SAMPLER_2D_SHADOW", + "SAMPLER_3D", + "SAMPLER_BINDING", + "SAMPLER_CUBE", + "SAMPLER_CUBE_SHADOW", + "SAMPLES", + "SAMPLE_ALPHA_TO_COVERAGE", + "SAMPLE_BUFFERS", + "SAMPLE_COVERAGE", + "SAMPLE_COVERAGE_INVERT", + "SAMPLE_COVERAGE_VALUE", + "SAWTOOTH", + "SCHEDULED_STATE", + "SCISSOR_BOX", + "SCISSOR_TEST", + "SCROLL_PAGE_DOWN", + "SCROLL_PAGE_UP", + "SDP_ANSWER", + "SDP_OFFER", + "SDP_PRANSWER", + "SECURITY_ERR", + "SELECT", + "SEPARATE_ATTRIBS", + "SERIALIZE_ERR", + "SEVERITY_ERROR", + "SEVERITY_FATAL_ERROR", + "SEVERITY_WARNING", + "SHADER_COMPILER", + "SHADER_TYPE", + "SHADING_LANGUAGE_VERSION", + "SHARED_MODULE_UPDATE", + "SHIFT_MASK", + "SHORT", + "SHOWING", + "SHOW_ALL", + "SHOW_ATTRIBUTE", + "SHOW_CDATA_SECTION", + "SHOW_COMMENT", + "SHOW_DOCUMENT", + "SHOW_DOCUMENT_FRAGMENT", + "SHOW_DOCUMENT_TYPE", + "SHOW_ELEMENT", + "SHOW_ENTITY", + "SHOW_ENTITY_REFERENCE", + "SHOW_NOTATION", + "SHOW_PROCESSING_INSTRUCTION", + "SHOW_TEXT", + "SIGNALED", + "SIGNED_NORMALIZED", + "SINE", + "SKIN", + "SOUNDFIELD", + "SQLError", + "SQLException", + "SQLResultSet", + "SQLResultSetRowList", + "SQLTransaction", + "SQRT1_2", + "SQRT2", + "SQUARE", + "SRC_ALPHA", + "SRC_ALPHA_SATURATE", + "SRC_COLOR", + "SRGB", + "SRGB8", + "SRGB8_ALPHA8", + "START_TO_END", + "START_TO_START", + "STATIC_COPY", + "STATIC_DRAW", + "STATIC_READ", + "STENCIL", + "STENCIL_ATTACHMENT", + "STENCIL_BACK_FAIL", + "STENCIL_BACK_FUNC", + "STENCIL_BACK_PASS_DEPTH_FAIL", + "STENCIL_BACK_PASS_DEPTH_PASS", + "STENCIL_BACK_REF", + "STENCIL_BACK_VALUE_MASK", + "STENCIL_BACK_WRITEMASK", + "STENCIL_BITS", + "STENCIL_BUFFER_BIT", + "STENCIL_CLEAR_VALUE", + "STENCIL_FAIL", + "STENCIL_FUNC", + "STENCIL_INDEX", + "STENCIL_INDEX8", + "STENCIL_PASS_DEPTH_FAIL", + "STENCIL_PASS_DEPTH_PASS", + "STENCIL_REF", + "STENCIL_TEST", + "STENCIL_VALUE_MASK", + "STENCIL_WRITEMASK", + "STREAM_COPY", + "STREAM_DRAW", + "STREAM_READ", + "STRING_TYPE", + "STYLE_RULE", + "SUBPIXEL_BITS", + "SUPPORTS_RULE", + "SVGAElement", + "SVGAltGlyphDefElement", + "SVGAltGlyphElement", + "SVGAltGlyphItemElement", + "SVGAngle", + "SVGAnimateColorElement", + "SVGAnimateElement", + "SVGAnimateMotionElement", + "SVGAnimateTransformElement", + "SVGAnimatedAngle", + "SVGAnimatedBoolean", + "SVGAnimatedEnumeration", + "SVGAnimatedInteger", + "SVGAnimatedLength", + "SVGAnimatedLengthList", + "SVGAnimatedNumber", + "SVGAnimatedNumberList", + "SVGAnimatedPreserveAspectRatio", + "SVGAnimatedRect", + "SVGAnimatedString", + "SVGAnimatedTransformList", + "SVGAnimationElement", + "SVGCircleElement", + "SVGClipPathElement", + "SVGColor", + "SVGComponentTransferFunctionElement", + "SVGCursorElement", + "SVGDefsElement", + "SVGDescElement", + "SVGDiscardElement", + "SVGDocument", + "SVGElement", + "SVGElementInstance", + "SVGElementInstanceList", + "SVGEllipseElement", + "SVGException", + "SVGFEBlendElement", + "SVGFEColorMatrixElement", + "SVGFEComponentTransferElement", + "SVGFECompositeElement", + "SVGFEConvolveMatrixElement", + "SVGFEDiffuseLightingElement", + "SVGFEDisplacementMapElement", + "SVGFEDistantLightElement", + "SVGFEDropShadowElement", + "SVGFEFloodElement", + "SVGFEFuncAElement", + "SVGFEFuncBElement", + "SVGFEFuncGElement", + "SVGFEFuncRElement", + "SVGFEGaussianBlurElement", + "SVGFEImageElement", + "SVGFEMergeElement", + "SVGFEMergeNodeElement", + "SVGFEMorphologyElement", + "SVGFEOffsetElement", + "SVGFEPointLightElement", + "SVGFESpecularLightingElement", + "SVGFESpotLightElement", + "SVGFETileElement", + "SVGFETurbulenceElement", + "SVGFilterElement", + "SVGFontElement", + "SVGFontFaceElement", + "SVGFontFaceFormatElement", + "SVGFontFaceNameElement", + "SVGFontFaceSrcElement", + "SVGFontFaceUriElement", + "SVGForeignObjectElement", + "SVGGElement", + "SVGGeometryElement", + "SVGGlyphElement", + "SVGGlyphRefElement", + "SVGGradientElement", + "SVGGraphicsElement", + "SVGHKernElement", + "SVGImageElement", + "SVGLength", + "SVGLengthList", + "SVGLineElement", + "SVGLinearGradientElement", + "SVGMPathElement", + "SVGMarkerElement", + "SVGMaskElement", + "SVGMatrix", + "SVGMetadataElement", + "SVGMissingGlyphElement", + "SVGNumber", + "SVGNumberList", + "SVGPaint", + "SVGPathElement", + "SVGPathSeg", + "SVGPathSegArcAbs", + "SVGPathSegArcRel", + "SVGPathSegClosePath", + "SVGPathSegCurvetoCubicAbs", + "SVGPathSegCurvetoCubicRel", + "SVGPathSegCurvetoCubicSmoothAbs", + "SVGPathSegCurvetoCubicSmoothRel", + "SVGPathSegCurvetoQuadraticAbs", + "SVGPathSegCurvetoQuadraticRel", + "SVGPathSegCurvetoQuadraticSmoothAbs", + "SVGPathSegCurvetoQuadraticSmoothRel", + "SVGPathSegLinetoAbs", + "SVGPathSegLinetoHorizontalAbs", + "SVGPathSegLinetoHorizontalRel", + "SVGPathSegLinetoRel", + "SVGPathSegLinetoVerticalAbs", + "SVGPathSegLinetoVerticalRel", + "SVGPathSegList", + "SVGPathSegMovetoAbs", + "SVGPathSegMovetoRel", + "SVGPatternElement", + "SVGPoint", + "SVGPointList", + "SVGPolygonElement", + "SVGPolylineElement", + "SVGPreserveAspectRatio", + "SVGRadialGradientElement", + "SVGRect", + "SVGRectElement", + "SVGRenderingIntent", + "SVGSVGElement", + "SVGScriptElement", + "SVGSetElement", + "SVGStopElement", + "SVGStringList", + "SVGStyleElement", + "SVGSwitchElement", + "SVGSymbolElement", + "SVGTRefElement", + "SVGTSpanElement", + "SVGTextContentElement", + "SVGTextElement", + "SVGTextPathElement", + "SVGTextPositioningElement", + "SVGTitleElement", + "SVGTransform", + "SVGTransformList", + "SVGUnitTypes", + "SVGUseElement", + "SVGVKernElement", + "SVGViewElement", + "SVGViewSpec", + "SVGZoomAndPan", + "SVGZoomEvent", + "SVG_ANGLETYPE_DEG", + "SVG_ANGLETYPE_GRAD", + "SVG_ANGLETYPE_RAD", + "SVG_ANGLETYPE_UNKNOWN", + "SVG_ANGLETYPE_UNSPECIFIED", + "SVG_CHANNEL_A", + "SVG_CHANNEL_B", + "SVG_CHANNEL_G", + "SVG_CHANNEL_R", + "SVG_CHANNEL_UNKNOWN", + "SVG_COLORTYPE_CURRENTCOLOR", + "SVG_COLORTYPE_RGBCOLOR", + "SVG_COLORTYPE_RGBCOLOR_ICCCOLOR", + "SVG_COLORTYPE_UNKNOWN", + "SVG_EDGEMODE_DUPLICATE", + "SVG_EDGEMODE_NONE", + "SVG_EDGEMODE_UNKNOWN", + "SVG_EDGEMODE_WRAP", + "SVG_FEBLEND_MODE_COLOR", + "SVG_FEBLEND_MODE_COLOR_BURN", + "SVG_FEBLEND_MODE_COLOR_DODGE", + "SVG_FEBLEND_MODE_DARKEN", + "SVG_FEBLEND_MODE_DIFFERENCE", + "SVG_FEBLEND_MODE_EXCLUSION", + "SVG_FEBLEND_MODE_HARD_LIGHT", + "SVG_FEBLEND_MODE_HUE", + "SVG_FEBLEND_MODE_LIGHTEN", + "SVG_FEBLEND_MODE_LUMINOSITY", + "SVG_FEBLEND_MODE_MULTIPLY", + "SVG_FEBLEND_MODE_NORMAL", + "SVG_FEBLEND_MODE_OVERLAY", + "SVG_FEBLEND_MODE_SATURATION", + "SVG_FEBLEND_MODE_SCREEN", + "SVG_FEBLEND_MODE_SOFT_LIGHT", + "SVG_FEBLEND_MODE_UNKNOWN", + "SVG_FECOLORMATRIX_TYPE_HUEROTATE", + "SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA", + "SVG_FECOLORMATRIX_TYPE_MATRIX", + "SVG_FECOLORMATRIX_TYPE_SATURATE", + "SVG_FECOLORMATRIX_TYPE_UNKNOWN", + "SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE", + "SVG_FECOMPONENTTRANSFER_TYPE_GAMMA", + "SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY", + "SVG_FECOMPONENTTRANSFER_TYPE_LINEAR", + "SVG_FECOMPONENTTRANSFER_TYPE_TABLE", + "SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN", + "SVG_FECOMPOSITE_OPERATOR_ARITHMETIC", + "SVG_FECOMPOSITE_OPERATOR_ATOP", + "SVG_FECOMPOSITE_OPERATOR_IN", + "SVG_FECOMPOSITE_OPERATOR_OUT", + "SVG_FECOMPOSITE_OPERATOR_OVER", + "SVG_FECOMPOSITE_OPERATOR_UNKNOWN", + "SVG_FECOMPOSITE_OPERATOR_XOR", + "SVG_INVALID_VALUE_ERR", + "SVG_LENGTHTYPE_CM", + "SVG_LENGTHTYPE_EMS", + "SVG_LENGTHTYPE_EXS", + "SVG_LENGTHTYPE_IN", + "SVG_LENGTHTYPE_MM", + "SVG_LENGTHTYPE_NUMBER", + "SVG_LENGTHTYPE_PC", + "SVG_LENGTHTYPE_PERCENTAGE", + "SVG_LENGTHTYPE_PT", + "SVG_LENGTHTYPE_PX", + "SVG_LENGTHTYPE_UNKNOWN", + "SVG_MARKERUNITS_STROKEWIDTH", + "SVG_MARKERUNITS_UNKNOWN", + "SVG_MARKERUNITS_USERSPACEONUSE", + "SVG_MARKER_ORIENT_ANGLE", + "SVG_MARKER_ORIENT_AUTO", + "SVG_MARKER_ORIENT_UNKNOWN", + "SVG_MASKTYPE_ALPHA", + "SVG_MASKTYPE_LUMINANCE", + "SVG_MATRIX_NOT_INVERTABLE", + "SVG_MEETORSLICE_MEET", + "SVG_MEETORSLICE_SLICE", + "SVG_MEETORSLICE_UNKNOWN", + "SVG_MORPHOLOGY_OPERATOR_DILATE", + "SVG_MORPHOLOGY_OPERATOR_ERODE", + "SVG_MORPHOLOGY_OPERATOR_UNKNOWN", + "SVG_PAINTTYPE_CURRENTCOLOR", + "SVG_PAINTTYPE_NONE", + "SVG_PAINTTYPE_RGBCOLOR", + "SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR", + "SVG_PAINTTYPE_UNKNOWN", + "SVG_PAINTTYPE_URI", + "SVG_PAINTTYPE_URI_CURRENTCOLOR", + "SVG_PAINTTYPE_URI_NONE", + "SVG_PAINTTYPE_URI_RGBCOLOR", + "SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR", + "SVG_PRESERVEASPECTRATIO_NONE", + "SVG_PRESERVEASPECTRATIO_UNKNOWN", + "SVG_PRESERVEASPECTRATIO_XMAXYMAX", + "SVG_PRESERVEASPECTRATIO_XMAXYMID", + "SVG_PRESERVEASPECTRATIO_XMAXYMIN", + "SVG_PRESERVEASPECTRATIO_XMIDYMAX", + "SVG_PRESERVEASPECTRATIO_XMIDYMID", + "SVG_PRESERVEASPECTRATIO_XMIDYMIN", + "SVG_PRESERVEASPECTRATIO_XMINYMAX", + "SVG_PRESERVEASPECTRATIO_XMINYMID", + "SVG_PRESERVEASPECTRATIO_XMINYMIN", + "SVG_SPREADMETHOD_PAD", + "SVG_SPREADMETHOD_REFLECT", + "SVG_SPREADMETHOD_REPEAT", + "SVG_SPREADMETHOD_UNKNOWN", + "SVG_STITCHTYPE_NOSTITCH", + "SVG_STITCHTYPE_STITCH", + "SVG_STITCHTYPE_UNKNOWN", + "SVG_TRANSFORM_MATRIX", + "SVG_TRANSFORM_ROTATE", + "SVG_TRANSFORM_SCALE", + "SVG_TRANSFORM_SKEWX", + "SVG_TRANSFORM_SKEWY", + "SVG_TRANSFORM_TRANSLATE", + "SVG_TRANSFORM_UNKNOWN", + "SVG_TURBULENCE_TYPE_FRACTALNOISE", + "SVG_TURBULENCE_TYPE_TURBULENCE", + "SVG_TURBULENCE_TYPE_UNKNOWN", + "SVG_UNIT_TYPE_OBJECTBOUNDINGBOX", + "SVG_UNIT_TYPE_UNKNOWN", + "SVG_UNIT_TYPE_USERSPACEONUSE", + "SVG_WRONG_TYPE_ERR", + "SVG_ZOOMANDPAN_DISABLE", + "SVG_ZOOMANDPAN_MAGNIFY", + "SVG_ZOOMANDPAN_UNKNOWN", + "SYNC_CONDITION", + "SYNC_FENCE", + "SYNC_FLAGS", + "SYNC_FLUSH_COMMANDS_BIT", + "SYNC_GPU_COMMANDS_COMPLETE", + "SYNC_STATUS", + "SYNTAX_ERR", + "SavedPages", + "Screen", + "ScreenOrientation", + "Script", + "ScriptEngine", + "ScriptEngineBuildVersion", + "ScriptEngineMajorVersion", + "ScriptEngineMinorVersion", + "ScriptProcessorNode", + "ScrollAreaEvent", + "SecurityPolicyViolationEvent", + "Selection", + "Sensor", + "SensorErrorEvent", + "ServiceWorker", + "ServiceWorkerContainer", + "ServiceWorkerMessageEvent", + "ServiceWorkerRegistration", + "SessionDescription", + "Set", + "ShadowRoot", + "SharedArrayBuffer", + "SharedWorker", + "SimpleGestureEvent", + "SourceBuffer", + "SourceBufferList", + "SpeechSynthesis", + "SpeechSynthesisErrorEvent", + "SpeechSynthesisEvent", + "SpeechSynthesisUtterance", + "SpeechSynthesisVoice", + "StaticRange", + "StereoPannerNode", + "StopIteration", + "Storage", + "StorageEvent", + "StorageManager", + "String", + "StyleMedia", + "StylePropertyMap", + "StylePropertyMapReadOnly", + "StyleSheet", + "StyleSheetList", + "StyleSheetPageList", + "SubmitEvent", + "SubtleCrypto", + "Symbol", + "SyncManager", + "SyntaxError", + "TEMPORARY", + "TEXTPATH_METHODTYPE_ALIGN", + "TEXTPATH_METHODTYPE_STRETCH", + "TEXTPATH_METHODTYPE_UNKNOWN", + "TEXTPATH_SPACINGTYPE_AUTO", + "TEXTPATH_SPACINGTYPE_EXACT", + "TEXTPATH_SPACINGTYPE_UNKNOWN", + "TEXTURE", + "TEXTURE0", + "TEXTURE1", + "TEXTURE10", + "TEXTURE11", + "TEXTURE12", + "TEXTURE13", + "TEXTURE14", + "TEXTURE15", + "TEXTURE16", + "TEXTURE17", + "TEXTURE18", + "TEXTURE19", + "TEXTURE2", + "TEXTURE20", + "TEXTURE21", + "TEXTURE22", + "TEXTURE23", + "TEXTURE24", + "TEXTURE25", + "TEXTURE26", + "TEXTURE27", + "TEXTURE28", + "TEXTURE29", + "TEXTURE3", + "TEXTURE30", + "TEXTURE31", + "TEXTURE4", + "TEXTURE5", + "TEXTURE6", + "TEXTURE7", + "TEXTURE8", + "TEXTURE9", + "TEXTURE_2D", + "TEXTURE_2D_ARRAY", + "TEXTURE_3D", + "TEXTURE_BASE_LEVEL", + "TEXTURE_BINDING_2D", + "TEXTURE_BINDING_2D_ARRAY", + "TEXTURE_BINDING_3D", + "TEXTURE_BINDING_CUBE_MAP", + "TEXTURE_COMPARE_FUNC", + "TEXTURE_COMPARE_MODE", + "TEXTURE_CUBE_MAP", + "TEXTURE_CUBE_MAP_NEGATIVE_X", + "TEXTURE_CUBE_MAP_NEGATIVE_Y", + "TEXTURE_CUBE_MAP_NEGATIVE_Z", + "TEXTURE_CUBE_MAP_POSITIVE_X", + "TEXTURE_CUBE_MAP_POSITIVE_Y", + "TEXTURE_CUBE_MAP_POSITIVE_Z", + "TEXTURE_IMMUTABLE_FORMAT", + "TEXTURE_IMMUTABLE_LEVELS", + "TEXTURE_MAG_FILTER", + "TEXTURE_MAX_ANISOTROPY_EXT", + "TEXTURE_MAX_LEVEL", + "TEXTURE_MAX_LOD", + "TEXTURE_MIN_FILTER", + "TEXTURE_MIN_LOD", + "TEXTURE_WRAP_R", + "TEXTURE_WRAP_S", + "TEXTURE_WRAP_T", + "TEXT_NODE", + "THROTTLED", + "TIMEOUT", + "TIMEOUT_ERR", + "TIMEOUT_EXPIRED", + "TIMEOUT_IGNORED", + "TOO_LARGE_ERR", + "TRANSACTION_INACTIVE_ERR", + "TRANSFORM_FEEDBACK", + "TRANSFORM_FEEDBACK_ACTIVE", + "TRANSFORM_FEEDBACK_BINDING", + "TRANSFORM_FEEDBACK_BUFFER", + "TRANSFORM_FEEDBACK_BUFFER_BINDING", + "TRANSFORM_FEEDBACK_BUFFER_MODE", + "TRANSFORM_FEEDBACK_BUFFER_SIZE", + "TRANSFORM_FEEDBACK_BUFFER_START", + "TRANSFORM_FEEDBACK_PAUSED", + "TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN", + "TRANSFORM_FEEDBACK_VARYINGS", + "TRIANGLE", + "TRIANGLES", + "TRIANGLE_FAN", + "TRIANGLE_STRIP", + "TYPE_BACK_FORWARD", + "TYPE_ERR", + "TYPE_MISMATCH_ERR", + "TYPE_NAVIGATE", + "TYPE_RELOAD", + "TYPE_RESERVED", + "Table", + "TaskAttributionTiming", + "Text", + "TextDecoder", + "TextDecoderStream", + "TextEncoder", + "TextEncoderStream", + "TextEvent", + "TextMetrics", + "TextRange", + "TextRangeCollection", + "TextTrack", + "TextTrackCue", + "TextTrackCueList", + "TextTrackList", + "TimeEvent", + "TimeRanges", + "Touch", + "TouchEvent", + "TouchList", + "TrackEvent", + "TransformStream", + "TransitionEvent", + "TreeWalker", + "TrustedHTML", + "TrustedScript", + "TrustedScriptURL", + "TrustedTypePolicy", + "TrustedTypePolicyFactory", + "TypeError", + "U2F", + "UIEvent", + "UNCACHED", + "UNIFORM_ARRAY_STRIDE", + "UNIFORM_BLOCK_ACTIVE_UNIFORMS", + "UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES", + "UNIFORM_BLOCK_BINDING", + "UNIFORM_BLOCK_DATA_SIZE", + "UNIFORM_BLOCK_INDEX", + "UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER", + "UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER", + "UNIFORM_BUFFER", + "UNIFORM_BUFFER_BINDING", + "UNIFORM_BUFFER_OFFSET_ALIGNMENT", + "UNIFORM_BUFFER_SIZE", + "UNIFORM_BUFFER_START", + "UNIFORM_IS_ROW_MAJOR", + "UNIFORM_MATRIX_STRIDE", + "UNIFORM_OFFSET", + "UNIFORM_SIZE", + "UNIFORM_TYPE", + "UNKNOWN_ERR", + "UNKNOWN_RULE", + "UNMASKED_RENDERER_WEBGL", + "UNMASKED_VENDOR_WEBGL", + "UNORDERED_NODE_ITERATOR_TYPE", + "UNORDERED_NODE_SNAPSHOT_TYPE", + "UNPACK_ALIGNMENT", + "UNPACK_COLORSPACE_CONVERSION_WEBGL", + "UNPACK_FLIP_Y_WEBGL", + "UNPACK_IMAGE_HEIGHT", + "UNPACK_PREMULTIPLY_ALPHA_WEBGL", + "UNPACK_ROW_LENGTH", + "UNPACK_SKIP_IMAGES", + "UNPACK_SKIP_PIXELS", + "UNPACK_SKIP_ROWS", + "UNSCHEDULED_STATE", + "UNSENT", + "UNSIGNALED", + "UNSIGNED_BYTE", + "UNSIGNED_INT", + "UNSIGNED_INT_10F_11F_11F_REV", + "UNSIGNED_INT_24_8", + "UNSIGNED_INT_2_10_10_10_REV", + "UNSIGNED_INT_5_9_9_9_REV", + "UNSIGNED_INT_SAMPLER_2D", + "UNSIGNED_INT_SAMPLER_2D_ARRAY", + "UNSIGNED_INT_SAMPLER_3D", + "UNSIGNED_INT_SAMPLER_CUBE", + "UNSIGNED_INT_VEC2", + "UNSIGNED_INT_VEC3", + "UNSIGNED_INT_VEC4", + "UNSIGNED_NORMALIZED", + "UNSIGNED_SHORT", + "UNSIGNED_SHORT_4_4_4_4", + "UNSIGNED_SHORT_5_5_5_1", + "UNSIGNED_SHORT_5_6_5", + "UNSPECIFIED_EVENT_TYPE_ERR", + "UPDATE", + "UPDATEREADY", + "UPDATE_AVAILABLE", + "URIError", + "URL", + "URLSearchParams", + "URLUnencoded", + "URL_MISMATCH_ERR", + "USB", + "USBAlternateInterface", + "USBConfiguration", + "USBConnectionEvent", + "USBDevice", + "USBEndpoint", + "USBInTransferResult", + "USBInterface", + "USBIsochronousInTransferPacket", + "USBIsochronousInTransferResult", + "USBIsochronousOutTransferPacket", + "USBIsochronousOutTransferResult", + "USBOutTransferResult", + "UTC", + "Uint16Array", + "Uint32Array", + "Uint8Array", + "Uint8ClampedArray", + "UserActivation", + "UserMessageHandler", + "UserMessageHandlersNamespace", + "UserProximityEvent", + "VALIDATE_STATUS", + "VALIDATION_ERR", + "VARIABLES_RULE", + "VBArray", + "VENDOR", + "VERSION", + "VERSION_CHANGE", + "VERSION_ERR", + "VERTEX_ARRAY_BINDING", + "VERTEX_ATTRIB_ARRAY_BUFFER_BINDING", + "VERTEX_ATTRIB_ARRAY_DIVISOR", + "VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE", + "VERTEX_ATTRIB_ARRAY_ENABLED", + "VERTEX_ATTRIB_ARRAY_INTEGER", + "VERTEX_ATTRIB_ARRAY_NORMALIZED", + "VERTEX_ATTRIB_ARRAY_POINTER", + "VERTEX_ATTRIB_ARRAY_SIZE", + "VERTEX_ATTRIB_ARRAY_STRIDE", + "VERTEX_ATTRIB_ARRAY_TYPE", + "VERTEX_SHADER", + "VERTICAL", + "VERTICAL_AXIS", + "VER_ERR", + "VIEWPORT", + "VIEWPORT_RULE", + "VRDisplay", + "VRDisplayCapabilities", + "VRDisplayEvent", + "VREyeParameters", + "VRFieldOfView", + "VRFrameData", + "VRPose", + "VRStageParameters", + "VTTCue", + "VTTRegion", + "ValidityState", + "VideoPlaybackQuality", + "VideoStreamTrack", + "VideoTrack", + "VideoTrackList", + "VisualViewport", + "WAIT_FAILED", + "WEBGL_compressed_texture_s3tc", + "WEBGL_debug_renderer_info", + "WEBKIT_FILTER_RULE", + "WEBKIT_FORCE_AT_FORCE_MOUSE_DOWN", + "WEBKIT_FORCE_AT_MOUSE_DOWN", + "WEBKIT_KEYFRAMES_RULE", + "WEBKIT_KEYFRAME_RULE", + "WEBKIT_REGION_RULE", + "WIN", + "WRONG_DOCUMENT_ERR", + "WakeLock", + "WakeLockSentinel", + "WaveShaperNode", + "WeakMap", + "WeakRef", + "WeakSet", + "WebAssembly", + "WebGL2RenderingContext", + "WebGLActiveInfo", + "WebGLBuffer", + "WebGLContextEvent", + "WebGLFramebuffer", + "WebGLObject", + "WebGLProgram", + "WebGLQuery", + "WebGLRenderbuffer", + "WebGLRenderingContext", + "WebGLSampler", + "WebGLShader", + "WebGLShaderPrecisionFormat", + "WebGLSync", + "WebGLTexture", + "WebGLTransformFeedback", + "WebGLUniformLocation", + "WebGLVertexArray", + "WebGLVertexArrayObject", + "WebKit built-in PDF", + "WebKitAnimationEvent", + "WebKitBlobBuilder", + "WebKitCSSFilterRule", + "WebKitCSSFilterValue", + "WebKitCSSKeyframeRule", + "WebKitCSSKeyframesRule", + "WebKitCSSMatrix", + "WebKitCSSRegionRule", + "WebKitCSSTransformValue", + "WebKitDataCue", + "WebKitGamepad", + "WebKitMediaKeyError", + "WebKitMediaKeyMessageEvent", + "WebKitMediaKeyNeededEvent", + "WebKitMediaKeySession", + "WebKitMediaKeys", + "WebKitMediaSource", + "WebKitMutationObserver", + "WebKitNamespace", + "WebKitPlaybackTargetAvailabilityEvent", + "WebKitPoint", + "WebKitShadowRoot", + "WebKitSourceBuffer", + "WebKitSourceBufferList", + "WebKitTransitionEvent", + "WebSocket", + "WebkitAlignContent", + "WebkitAlignItems", + "WebkitAlignSelf", + "WebkitAnimation", + "WebkitAnimationDelay", + "WebkitAnimationDirection", + "WebkitAnimationDuration", + "WebkitAnimationFillMode", + "WebkitAnimationIterationCount", + "WebkitAnimationName", + "WebkitAnimationPlayState", + "WebkitAnimationTimingFunction", + "WebkitAppearance", + "WebkitBackfaceVisibility", + "WebkitBackgroundClip", + "WebkitBackgroundOrigin", + "WebkitBackgroundSize", + "WebkitBorderBottomLeftRadius", + "WebkitBorderBottomRightRadius", + "WebkitBorderImage", + "WebkitBorderRadius", + "WebkitBorderTopLeftRadius", + "WebkitBorderTopRightRadius", + "WebkitBoxAlign", + "WebkitBoxDirection", + "WebkitBoxFlex", + "WebkitBoxOrdinalGroup", + "WebkitBoxOrient", + "WebkitBoxPack", + "WebkitBoxShadow", + "WebkitBoxSizing", + "WebkitFilter", + "WebkitFlex", + "WebkitFlexBasis", + "WebkitFlexDirection", + "WebkitFlexFlow", + "WebkitFlexGrow", + "WebkitFlexShrink", + "WebkitFlexWrap", + "WebkitJustifyContent", + "WebkitLineClamp", + "WebkitMask", + "WebkitMaskClip", + "WebkitMaskComposite", + "WebkitMaskImage", + "WebkitMaskOrigin", + "WebkitMaskPosition", + "WebkitMaskPositionX", + "WebkitMaskPositionY", + "WebkitMaskRepeat", + "WebkitMaskSize", + "WebkitOrder", + "WebkitPerspective", + "WebkitPerspectiveOrigin", + "WebkitTextFillColor", + "WebkitTextSizeAdjust", + "WebkitTextStroke", + "WebkitTextStrokeColor", + "WebkitTextStrokeWidth", + "WebkitTransform", + "WebkitTransformOrigin", + "WebkitTransformStyle", + "WebkitTransition", + "WebkitTransitionDelay", + "WebkitTransitionDuration", + "WebkitTransitionProperty", + "WebkitTransitionTimingFunction", + "WebkitUserSelect", + "WheelEvent", + "Window", + "Windows Media Player Plug-in Dynamic Link Library", + "Windows Presentation Foundation", + "Worker", + "Worklet", + "WritableStream", + "WritableStreamDefaultWriter", + "X86_32", + "X86_64", + "XMLDocument", + "XMLHttpRequest", + "XMLHttpRequestEventTarget", + "XMLHttpRequestException", + "XMLHttpRequestProgressEvent", + "XMLHttpRequestUpload", + "XMLSerializer", + "XMLStylesheetProcessingInstruction", + "XPathEvaluator", + "XPathException", + "XPathExpression", + "XPathNSResolver", + "XPathResult", + "XR", + "XRBoundedReferenceSpace", + "XRDOMOverlayState", + "XRFrame", + "XRHitTestResult", + "XRHitTestSource", + "XRInputSource", + "XRInputSourceArray", + "XRInputSourceEvent", + "XRInputSourcesChangeEvent", + "XRLayer", + "XRPose", + "XRRay", + "XRReferenceSpace", + "XRReferenceSpaceEvent", + "XRRenderState", + "XRRigidTransform", + "XRSession", + "XRSessionEvent", + "XRSpace", + "XRSystem", + "XRTransientInputHitTestResult", + "XRTransientInputHitTestSource", + "XRView", + "XRViewerPose", + "XRViewport", + "XRWebGLLayer", + "XSLTProcessor", + "ZERO", + "_XD0M_", + "_YD0M_", + "__defineGetter__", + "__defineSetter__", + "__lookupGetter__", + "__lookupSetter__", + "__opera", + "__proto__", + "__relevantExtensionKeys", + "_browserjsran", + "a", + "aLink", + "abbr", + "abort", + "aborted", + "abs", + "absolute", + "acceleration", + "accelerationIncludingGravity", + "accelerator", + "accept", + "acceptCharset", + "acceptNode", + "accessKey", + "accessKeyLabel", + "accuracy", + "acos", + "acosh", + "action", + "actionURL", + "actions", + "activated", + "active", + "activeCues", + "activeElement", + "activeSourceBuffers", + "activeSourceCount", + "activeTexture", + "activeVRDisplays", + "actualBoundingBoxAscent", + "actualBoundingBoxDescent", + "actualBoundingBoxLeft", + "actualBoundingBoxRight", + "add", + "addAll", + "addBehavior", + "addCandidate", + "addColorStop", + "addCue", + "addElement", + "addEventListener", + "addFilter", + "addFromString", + "addFromUri", + "addIceCandidate", + "addImport", + "addListener", + "addModule", + "addNamed", + "addPageRule", + "addPath", + "addPointer", + "addRange", + "addRegion", + "addRule", + "addRules", + "addSearchEngine", + "addSourceBuffer", + "addStream", + "addTextTrack", + "addTrack", + "addTransceiver", + "addWakeLockListener", + "added", + "addedNodes", + "additionalName", + "additiveSymbols", + "addons", + "address", + "addressLine", + "adoptNode", + "adoptText", + "adoptedCallback", + "adoptedStyleSheets", + "adr", + "advance", + "after", + "album", + "alert", + "algorithm", + "align", + "align-content", + "align-items", + "align-self", + "alignContent", + "alignItems", + "alignSelf", + "alignmentBaseline", + "alinkColor", + "all", + "allSettled", + "allow", + "allowFullscreen", + "allowPaymentRequest", + "allowTransparency", + "allowedDirections", + "allowedFeatures", + "allowsFeature", + "alpha", + "alphabeticBaseline", + "alt", + "altGraphKey", + "altHtml", + "altKey", + "altLeft", + "alternate", + "alternateSetting", + "alternates", + "altitude", + "altitudeAccuracy", + "amplitude", + "ancestorOrigins", + "anchor", + "anchorNode", + "anchorOffset", + "anchors", + "and", + "angle", + "angularAcceleration", + "angularVelocity", + "animVal", + "animate", + "animatedInstanceRoot", + "animatedNormalizedPathSegList", + "animatedPathSegList", + "animatedPoints", + "animation", + "animation-delay", + "animation-direction", + "animation-duration", + "animation-fill-mode", + "animation-iteration-count", + "animation-name", + "animation-play-state", + "animation-timing-function", + "animationDelay", + "animationDirection", + "animationDuration", + "animationFillMode", + "animationIterationCount", + "animationName", + "animationPlayState", + "animationStartTime", + "animationTimingFunction", + "animationsPaused", + "anniversary", + "antialias", + "any", + "app", + "appCodeName", + "appMinorVersion", + "appName", + "appNotifications", + "appVersion", + "appearance", + "append", + "appendBuffer", + "appendChild", + "appendData", + "appendItem", + "appendMedium", + "appendNamed", + "appendRule", + "appendStream", + "appendWindowEnd", + "appendWindowStart", + "appleTrailingWord", + "applets", + "application/apple-default-browser", + "application/asx", + "application/java-deployment-toolkit", + "application/pdf", + "application/postscript", + "application/x-drm", + "application/x-drm-v2", + "application/x-google-chrome-pdf", + "application/x-java-applet", + "application/x-java-applet;deploy=10.25.2", + "application/x-java-applet;javafx=2.2.25", + "application/x-java-applet;jpi-version=1.7.0_25", + "application/x-java-applet;version=1.1", + "application/x-java-applet;version=1.1.1", + "application/x-java-applet;version=1.1.2", + "application/x-java-applet;version=1.1.3", + "application/x-java-applet;version=1.2", + "application/x-java-applet;version=1.2.1", + "application/x-java-applet;version=1.2.2", + "application/x-java-applet;version=1.3", + "application/x-java-applet;version=1.3.1", + "application/x-java-applet;version=1.4", + "application/x-java-applet;version=1.4.1", + "application/x-java-applet;version=1.4.2", + "application/x-java-applet;version=1.5", + "application/x-java-applet;version=1.6", + "application/x-java-applet;version=1.7", + "application/x-java-bean", + "application/x-java-bean;jpi-version=1.7.0_25", + "application/x-java-bean;version=1.1", + "application/x-java-bean;version=1.1.1", + "application/x-java-bean;version=1.1.2", + "application/x-java-bean;version=1.1.3", + "application/x-java-bean;version=1.2", + "application/x-java-bean;version=1.2.1", + "application/x-java-bean;version=1.2.2", + "application/x-java-bean;version=1.3", + "application/x-java-bean;version=1.3.1", + "application/x-java-bean;version=1.4", + "application/x-java-bean;version=1.4.1", + "application/x-java-bean;version=1.4.2", + "application/x-java-bean;version=1.5", + "application/x-java-bean;version=1.6", + "application/x-java-bean;version=1.7", + "application/x-java-vm", + "application/x-java-vm-npruntime", + "application/x-mplayer2", + "application/x-ms-xbap", + "application/x-nacl", + "application/x-pnacl", + "application/xaml+xml", + "applicationCache", + "applicationServerKey", + "apply", + "applyConstraints", + "applyElement", + "arc", + "arcTo", + "archive", + "areas", + "arguments", + "aria-activedescendant", + "aria-busy", + "aria-checked", + "aria-controls", + "aria-describedby", + "aria-disabled", + "aria-expanded", + "aria-flowto", + "aria-haspopup", + "aria-hidden", + "aria-invalid", + "aria-labelledby", + "aria-level", + "aria-live", + "aria-multiselectable", + "aria-owns", + "aria-posinset", + "aria-pressed", + "aria-readonly", + "aria-relevant", + "aria-required", + "aria-secret", + "aria-selected", + "aria-setsize", + "aria-valuemax", + "aria-valuemin", + "aria-valuenow", + "ariaAtomic", + "ariaAutoComplete", + "ariaBusy", + "ariaChecked", + "ariaColCount", + "ariaColIndex", + "ariaColSpan", + "ariaCurrent", + "ariaDescription", + "ariaDisabled", + "ariaExpanded", + "ariaHasPopup", + "ariaHidden", + "ariaKeyShortcuts", + "ariaLabel", + "ariaLevel", + "ariaLive", + "ariaModal", + "ariaMultiLine", + "ariaMultiSelectable", + "ariaOrientation", + "ariaPlaceholder", + "ariaPosInSet", + "ariaPressed", + "ariaReadOnly", + "ariaRelevant", + "ariaRequired", + "ariaRoleDescription", + "ariaRowCount", + "ariaRowIndex", + "ariaRowSpan", + "ariaSelected", + "ariaSetSize", + "ariaSort", + "ariaValueMax", + "ariaValueMin", + "ariaValueNow", + "ariaValueText", + "arrayBuffer", + "artist", + "artwork", + "as", + "asIntN", + "asUintN", + "asin", + "asinh", + "assert", + "assign", + "assignedElements", + "assignedNodes", + "assignedSlot", + "async", + "asyncIterator", + "atEnd", + "atan", + "atan2", + "atanh", + "atob", + "atomic", + "attachEvent", + "attachInternals", + "attachShader", + "attachShadow", + "attachments", + "attack", + "attestationObject", + "attrChange", + "attrName", + "attributeChangedCallback", + "attributeFilter", + "attributeName", + "attributeNamespace", + "attributeOldValue", + "attributeStyleMap", + "attributes", + "attribution", + "audio/x-ms-wax", + "audio/x-ms-wma", + "audioBitsPerSecond", + "audioTracks", + "audioWorklet", + "authenticatedSignedWrites", + "authenticatorData", + "autoIncrement", + "autobuffer", + "autocapitalize", + "autocomplete", + "autocorrect", + "autofocus", + "automationRate", + "autoplay", + "availHeight", + "availLeft", + "availTop", + "availWidth", + "availability", + "available", + "aversion", + "ax", + "axes", + "axis", + "ay", + "azimuth", + "b", + "back", + "backdropFilter", + "backface-visibility", + "backfaceVisibility", + "background", + "background-attachment", + "background-blend-mode", + "background-clip", + "background-color", + "background-image", + "background-origin", + "background-position", + "background-position-x", + "background-position-y", + "background-repeat", + "background-size", + "backgroundAttachment", + "backgroundBlendMode", + "backgroundClip", + "backgroundColor", + "backgroundFetch", + "backgroundImage", + "backgroundOrigin", + "backgroundPosition", + "backgroundPositionX", + "backgroundPositionY", + "backgroundRepeat", + "backgroundRepeatX", + "backgroundRepeatY", + "backgroundSize", + "badInput", + "badge", + "balance", + "baseFrequencyX", + "baseFrequencyY", + "baseLatency", + "baseLayer", + "baseName", + "baseNode", + "baseOffset", + "baseURI", + "baseVal", + "baselineShift", + "battery", + "bday", + "before", + "beginElement", + "beginElementAt", + "beginPath", + "beginQuery", + "beginTransformFeedback", + "behavior", + "behaviorCookie", + "behaviorPart", + "behaviorUrns", + "beta", + "bezierCurveTo", + "bgColor", + "bgProperties", + "bias", + "big", + "binaryType", + "bind", + "bindAttribLocation", + "bindBuffer", + "bindBufferBase", + "bindBufferRange", + "bindFramebuffer", + "bindRenderbuffer", + "bindSampler", + "bindTexture", + "bindTransformFeedback", + "bindVertexArray", + "blendColor", + "blendEquation", + "blendEquationSeparate", + "blendFunc", + "blendFuncSeparate", + "blink", + "blitFramebuffer", + "blob", + "block-size", + "blockDirection", + "blockSize", + "blockedURI", + "blue", + "bluetooth", + "blur", + "body", + "bodyUsed", + "bold", + "bookmarks", + "booleanValue", + "border", + "border-block", + "border-block-color", + "border-block-end", + "border-block-end-color", + "border-block-end-style", + "border-block-end-width", + "border-block-start", + "border-block-start-color", + "border-block-start-style", + "border-block-start-width", + "border-block-style", + "border-block-width", + "border-bottom", + "border-bottom-color", + "border-bottom-left-radius", + "border-bottom-right-radius", + "border-bottom-style", + "border-bottom-width", + "border-collapse", + "border-color", + "border-end-end-radius", + "border-end-start-radius", + "border-image", + "border-image-outset", + "border-image-repeat", + "border-image-slice", + "border-image-source", + "border-image-width", + "border-inline", + "border-inline-color", + "border-inline-end", + "border-inline-end-color", + "border-inline-end-style", + "border-inline-end-width", + "border-inline-start", + "border-inline-start-color", + "border-inline-start-style", + "border-inline-start-width", + "border-inline-style", + "border-inline-width", + "border-left", + "border-left-color", + "border-left-style", + "border-left-width", + "border-radius", + "border-right", + "border-right-color", + "border-right-style", + "border-right-width", + "border-spacing", + "border-start-end-radius", + "border-start-start-radius", + "border-style", + "border-top", + "border-top-color", + "border-top-left-radius", + "border-top-right-radius", + "border-top-style", + "border-top-width", + "border-width", + "borderBlock", + "borderBlockColor", + "borderBlockEnd", + "borderBlockEndColor", + "borderBlockEndStyle", + "borderBlockEndWidth", + "borderBlockStart", + "borderBlockStartColor", + "borderBlockStartStyle", + "borderBlockStartWidth", + "borderBlockStyle", + "borderBlockWidth", + "borderBottom", + "borderBottomColor", + "borderBottomLeftRadius", + "borderBottomRightRadius", + "borderBottomStyle", + "borderBottomWidth", + "borderBoxSize", + "borderCollapse", + "borderColor", + "borderColorDark", + "borderColorLight", + "borderEndEndRadius", + "borderEndStartRadius", + "borderImage", + "borderImageOutset", + "borderImageRepeat", + "borderImageSlice", + "borderImageSource", + "borderImageWidth", + "borderInline", + "borderInlineColor", + "borderInlineEnd", + "borderInlineEndColor", + "borderInlineEndStyle", + "borderInlineEndWidth", + "borderInlineStart", + "borderInlineStartColor", + "borderInlineStartStyle", + "borderInlineStartWidth", + "borderInlineStyle", + "borderInlineWidth", + "borderLeft", + "borderLeftColor", + "borderLeftStyle", + "borderLeftWidth", + "borderRadius", + "borderRight", + "borderRightColor", + "borderRightStyle", + "borderRightWidth", + "borderSpacing", + "borderStartEndRadius", + "borderStartStartRadius", + "borderStyle", + "borderTop", + "borderTopColor", + "borderTopLeftRadius", + "borderTopRightRadius", + "borderTopStyle", + "borderTopWidth", + "borderWidth", + "bottom", + "bottomMargin", + "bound", + "boundElements", + "boundingClientRect", + "boundingHeight", + "boundingLeft", + "boundingTop", + "boundingWidth", + "bounds", + "boundsGeometry", + "box-decoration-break", + "box-shadow", + "box-sizing", + "boxDecorationBreak", + "boxShadow", + "boxSizing", + "break-after", + "break-before", + "break-inside", + "breakAfter", + "breakBefore", + "breakInside", + "breakType", + "broadcast", + "browserLanguage", + "btoa", + "bubbles", + "buffer", + "bufferData", + "bufferDepth", + "bufferSize", + "bufferSubData", + "buffered", + "bufferedAmount", + "bufferedAmountLowThreshold", + "bufferedRendering", + "buildID", + "buildNumber", + "button", + "buttonID", + "buttons", + "byteLength", + "byteOffset", + "bytesWritten", + "c", + "cache", + "caches", + "calendar", + "call", + "caller", + "canBeFormatted", + "canBeMounted", + "canBeShared", + "canHaveChildren", + "canHaveHTML", + "canInsertDTMF", + "canMakePayment", + "canPlayType", + "canPresent", + "canTrickleIceCandidates", + "cancel", + "cancelAndHoldAtTime", + "cancelAnimationFrame", + "cancelBubble", + "cancelIdleCallback", + "cancelScheduledValues", + "cancelVideoFrameCallback", + "cancelWatchAvailability", + "cancelable", + "candidate", + "canonicalUUID", + "canvas", + "capabilities", + "caption", + "caption-side", + "captionSide", + "capture", + "captureEvents", + "captureStackTrace", + "captureStream", + "caret-color", + "caretBidiLevel", + "caretColor", + "caretPositionFromPoint", + "caretRangeFromPoint", + "caseFirst", + "cast", + "catch", + "category", + "cbrt", + "cd", + "ceil", + "cellIndex", + "cellPadding", + "cellSpacing", + "cells", + "ch", + "chOff", + "chain", + "challenge", + "changeType", + "changeVersion", + "changedTouches", + "channel", + "channelCount", + "channelCountMode", + "channelInterpretation", + "char", + "charAt", + "charCode", + "charCodeAt", + "charIndex", + "charLength", + "characterData", + "characterDataOldValue", + "characterSet", + "characteristic", + "charging", + "chargingTime", + "charset", + "check", + "checkEnclosure", + "checkFramebufferStatus", + "checkInstalled", + "checkIntersection", + "checkValidity", + "checked", + "childElementCount", + "childList", + "childNodes", + "children", + "chrome", + "ciphertext", + "cite", + "city", + "claimInterface", + "claimed", + "classList", + "className", + "classid", + "clear", + "clearAppBadge", + "clearAttributes", + "clearBufferfi", + "clearBufferfv", + "clearBufferiv", + "clearBufferuiv", + "clearColor", + "clearData", + "clearDepth", + "clearHalt", + "clearImmediate", + "clearInterval", + "clearLiveSeekableRange", + "clearMarks", + "clearMeasures", + "clearParameters", + "clearRect", + "clearResourceTimings", + "clearShadow", + "clearStencil", + "clearTimeout", + "clearWatch", + "click", + "clickCount", + "clientDataJSON", + "clientHeight", + "clientInformation", + "clientLeft", + "clientRect", + "clientRects", + "clientTop", + "clientWaitSync", + "clientWidth", + "clientX", + "clientY", + "clip", + "clip-path", + "clip-rule", + "clipBottom", + "clipLeft", + "clipPath", + "clipPathUnits", + "clipRight", + "clipRule", + "clipTop", + "clipboard", + "clipboardData", + "clone", + "cloneContents", + "cloneNode", + "cloneRange", + "close", + "closePath", + "closed", + "closest", + "clz", + "clz32", + "cm", + "cmp", + "code", + "codeBase", + "codePointAt", + "codeType", + "colSpan", + "collapse", + "collapseToEnd", + "collapseToStart", + "collapsed", + "collation", + "collect", + "colno", + "color", + "color-adjust", + "color-interpolation", + "color-interpolation-filters", + "colorAdjust", + "colorDepth", + "colorInterpolation", + "colorInterpolationFilters", + "colorMask", + "colorProfile", + "colorRendering", + "colorScheme", + "colorType", + "cols", + "column", + "column-count", + "column-fill", + "column-gap", + "column-rule", + "column-rule-color", + "column-rule-style", + "column-rule-width", + "column-span", + "column-width", + "columnCount", + "columnFill", + "columnGap", + "columnNumber", + "columnRule", + "columnRuleColor", + "columnRuleStyle", + "columnRuleWidth", + "columnSpan", + "columnWidth", + "columns", + "command", + "commit", + "commitLoadTime", + "commitPreferences", + "commitStyles", + "commonAncestorContainer", + "compact", + "compare", + "compareBoundaryPoints", + "compareDocumentPosition", + "compareEndPoints", + "compareExchange", + "compareNode", + "comparePoint", + "compatMode", + "compatible", + "compile", + "compileShader", + "compileStreaming", + "complete", + "component", + "componentFromPoint", + "composed", + "composedPath", + "composite", + "compositionEndOffset", + "compositionStartOffset", + "compressedTexImage2D", + "compressedTexImage3D", + "compressedTexSubImage2D", + "compressedTexSubImage3D", + "computedStyleMap", + "concat", + "conditionText", + "coneInnerAngle", + "coneOuterAngle", + "coneOuterGain", + "configuration", + "configurationName", + "configurationValue", + "configurations", + "confirm", + "confirmComposition", + "confirmSiteSpecificTrackingException", + "confirmWebWideTrackingException", + "connect", + "connectEnd", + "connectStart", + "connected", + "connectedCallback", + "connection", + "connectionInfo", + "connectionList", + "connectionSpeed", + "connectionState", + "connections", + "console", + "consoleHistory", + "consolidate", + "constraint", + "constrictionActive", + "construct", + "constructor", + "contactID", + "contain", + "containIntrinsicSize", + "containerId", + "containerName", + "containerSrc", + "containerType", + "contains", + "containsNode", + "content", + "contentBoxSize", + "contentDocument", + "contentEditable", + "contentHint", + "contentOverflow", + "contentRect", + "contentScriptType", + "contentStyleType", + "contentType", + "contentWindow", + "context", + "contextMenu", + "contextmenu", + "continue", + "continuePrimaryKey", + "continuous", + "control", + "controlTransferIn", + "controlTransferOut", + "controller", + "controls", + "controlsList", + "convertToBlob", + "convertToSpecifiedUnits", + "cookie", + "cookieEnabled", + "coords", + "copyBufferSubData", + "copyFromChannel", + "copyTexImage2D", + "copyTexSubImage2D", + "copyTexSubImage3D", + "copyToChannel", + "copyWithin", + "correspondingElement", + "correspondingUseElement", + "corruptedVideoFrames", + "cos", + "cosh", + "count", + "countReset", + "counter-increment", + "counter-reset", + "counter-set", + "counterIncrement", + "counterReset", + "counterSet", + "country", + "cpuClass", + "cpuSleepAllowed", + "create", + "createAnalyser", + "createAnswer", + "createAttribute", + "createAttributeNS", + "createBiquadFilter", + "createBuffer", + "createBufferSource", + "createCDATASection", + "createCSSStyleSheet", + "createCaption", + "createChannelMerger", + "createChannelSplitter", + "createComment", + "createConstantSource", + "createContextualFragment", + "createControlRange", + "createConvolver", + "createDTMFSender", + "createDataChannel", + "createDelay", + "createDelayNode", + "createDocument", + "createDocumentFragment", + "createDocumentType", + "createDynamicsCompressor", + "createElement", + "createElementNS", + "createEntityReference", + "createEvent", + "createEventObject", + "createExpression", + "createFramebuffer", + "createFunction", + "createGain", + "createGainNode", + "createHTML", + "createHTMLDocument", + "createIIRFilter", + "createImageBitmap", + "createImageData", + "createIndex", + "createJavaScriptNode", + "createLinearGradient", + "createMediaElementSource", + "createMediaKeys", + "createMediaStreamDestination", + "createMediaStreamSource", + "createMediaStreamTrackSource", + "createMutableFile", + "createNSResolver", + "createNodeIterator", + "createNotification", + "createObjectStore", + "createObjectURL", + "createOffer", + "createOscillator", + "createPanner", + "createPattern", + "createPeriodicWave", + "createPolicy", + "createPopup", + "createProcessingInstruction", + "createProgram", + "createQuery", + "createRadialGradient", + "createRange", + "createRangeCollection", + "createReader", + "createRenderbuffer", + "createSVGAngle", + "createSVGLength", + "createSVGMatrix", + "createSVGNumber", + "createSVGPathSegArcAbs", + "createSVGPathSegArcRel", + "createSVGPathSegClosePath", + "createSVGPathSegCurvetoCubicAbs", + "createSVGPathSegCurvetoCubicRel", + "createSVGPathSegCurvetoCubicSmoothAbs", + "createSVGPathSegCurvetoCubicSmoothRel", + "createSVGPathSegCurvetoQuadraticAbs", + "createSVGPathSegCurvetoQuadraticRel", + "createSVGPathSegCurvetoQuadraticSmoothAbs", + "createSVGPathSegCurvetoQuadraticSmoothRel", + "createSVGPathSegLinetoAbs", + "createSVGPathSegLinetoHorizontalAbs", + "createSVGPathSegLinetoHorizontalRel", + "createSVGPathSegLinetoRel", + "createSVGPathSegLinetoVerticalAbs", + "createSVGPathSegLinetoVerticalRel", + "createSVGPathSegMovetoAbs", + "createSVGPathSegMovetoRel", + "createSVGPoint", + "createSVGRect", + "createSVGTransform", + "createSVGTransformFromMatrix", + "createSampler", + "createScript", + "createScriptProcessor", + "createScriptURL", + "createSession", + "createShader", + "createShadowRoot", + "createStereoPanner", + "createStyleSheet", + "createTBody", + "createTFoot", + "createTHead", + "createTextNode", + "createTextRange", + "createTexture", + "createTouch", + "createTouchList", + "createTransformFeedback", + "createTreeWalker", + "createVertexArray", + "createWaveShaper", + "creationTime", + "credentials", + "crossOrigin", + "crossOriginIsolated", + "crypto", + "csi", + "csp", + "cssFloat", + "cssRules", + "cssText", + "cssValueType", + "ctrlKey", + "ctrlLeft", + "cues", + "cullFace", + "currency", + "currencyDisplay", + "current", + "currentDirection", + "currentLocalDescription", + "currentNode", + "currentPage", + "currentRect", + "currentRemoteDescription", + "currentScale", + "currentScript", + "currentSrc", + "currentState", + "currentStyle", + "currentTarget", + "currentTime", + "currentTranslate", + "currentView", + "cursor", + "curve", + "customElements", + "customError", + "customSections", + "cx", + "cy", + "d", + "data", + "dataFld", + "dataFormatAs", + "dataLoss", + "dataLossMessage", + "dataPageSize", + "dataSrc", + "dataTransfer", + "database", + "databases", + "dataset", + "dateTime", + "day", + "db", + "debug", + "debuggerEnabled", + "declare", + "decode", + "decodeAudioData", + "decodeURI", + "decodeURIComponent", + "decodedBodySize", + "decoding", + "decodingInfo", + "decrypt", + "default", + "defaultCharset", + "defaultChecked", + "defaultMuted", + "defaultPlaybackRate", + "defaultPolicy", + "defaultPrevented", + "defaultRequest", + "defaultSelected", + "defaultStatus", + "defaultURL", + "defaultValue", + "defaultView", + "defaultstatus", + "defer", + "define", + "defineMagicFunction", + "defineMagicVariable", + "defineProperties", + "defineProperty", + "deg", + "delay", + "delayTime", + "delegatesFocus", + "delete", + "deleteBuffer", + "deleteCaption", + "deleteCell", + "deleteContents", + "deleteData", + "deleteDatabase", + "deleteFramebuffer", + "deleteFromDocument", + "deleteIndex", + "deleteMedium", + "deleteObjectStore", + "deleteProgram", + "deleteProperty", + "deleteQuery", + "deleteRenderbuffer", + "deleteRow", + "deleteRule", + "deleteSampler", + "deleteShader", + "deleteSync", + "deleteTFoot", + "deleteTHead", + "deleteTexture", + "deleteTransformFeedback", + "deleteVertexArray", + "deliverChangeRecords", + "delivery", + "deliveryInfo", + "deliveryStatus", + "deliveryTimestamp", + "delta", + "deltaMode", + "deltaX", + "deltaY", + "deltaZ", + "dependentLocality", + "depthFar", + "depthFunc", + "depthMask", + "depthNear", + "depthRange", + "deref", + "deriveBits", + "deriveKey", + "description", + "deselectAll", + "designMode", + "desiredSize", + "destination", + "destinationURL", + "detach", + "detachEvent", + "detachShader", + "detail", + "details", + "detect", + "detune", + "device", + "deviceClass", + "deviceId", + "deviceMemory", + "devicePixelContentBoxSize", + "devicePixelRatio", + "deviceProtocol", + "deviceSessionId", + "deviceSubclass", + "deviceVersionMajor", + "deviceVersionMinor", + "deviceVersionSubminor", + "deviceXDPI", + "deviceYDPI", + "didTimeout", + "diffuseConstant", + "digest", + "dimensions", + "dir", + "dirName", + "dirXml", + "direction", + "dirxml", + "disable", + "disablePictureInPicture", + "disableRemotePlayback", + "disableVertexAttribArray", + "disabled", + "dischargingTime", + "disconnect", + "disconnectedCallback", + "dispatch", + "dispatchEvent", + "dispatchToListener", + "display", + "displayId", + "displayName", + "disposition", + "distanceModel", + "div", + "divisor", + "djsapi", + "djsproxy", + "doImport", + "doNotTrack", + "doScroll", + "doctype", + "document", + "documentElement", + "documentMode", + "documentURI", + "dolphin", + "dolphinGameCenter", + "dolphininfo", + "dolphinmeta", + "domComplete", + "domContentLoadedEventEnd", + "domContentLoadedEventStart", + "domInteractive", + "domLoading", + "domOverlayState", + "domain", + "domainLookupEnd", + "domainLookupStart", + "dominant-baseline", + "dominantBaseline", + "done", + "dopplerFactor", + "dotAll", + "downDegrees", + "downlink", + "download", + "downloadTotal", + "downloaded", + "dpcm", + "dpi", + "dppx", + "dragDrop", + "draggable", + "drawArrays", + "drawArraysInstanced", + "drawArraysInstancedANGLE", + "drawBuffers", + "drawCustomFocusRing", + "drawElements", + "drawElementsInstanced", + "drawElementsInstancedANGLE", + "drawFocusIfNeeded", + "drawImage", + "drawImageFromRect", + "drawRangeElements", + "drawSystemFocusRing", + "drawingBufferHeight", + "drawingBufferWidth", + "dropEffect", + "droppedVideoFrames", + "dropzone", + "dtmf", + "dump", + "duplicate", + "durability", + "duration", + "dvname", + "dvnum", + "dx", + "dy", + "dynsrc", + "e", + "edgeMode", + "effect", + "effectAllowed", + "effectiveDirective", + "effectiveType", + "elapsedTime", + "element", + "elementFromPoint", + "elementTiming", + "elements", + "elementsFromPoint", + "elevation", + "ellipse", + "em", + "emHeightAscent", + "emHeightDescent", + "email", + "embeds", + "emma", + "empty", + "empty-cells", + "emptyCells", + "emptyHTML", + "emptyScript", + "emulatedPosition", + "enable", + "enableBackground", + "enableDelegations", + "enableStyleSheetsForSet", + "enableVertexAttribArray", + "enabled", + "enabledPlugin", + "encode", + "encodeInto", + "encodeURI", + "encodeURIComponent", + "encodedBodySize", + "encoding", + "encodingInfo", + "encrypt", + "enctype", + "end", + "endContainer", + "endElement", + "endElementAt", + "endOfStream", + "endOffset", + "endQuery", + "endTime", + "endTransformFeedback", + "ended", + "endpoint", + "endpointNumber", + "endpoints", + "endsWith", + "enterKeyHint", + "entities", + "entries", + "entryType", + "enumerate", + "enumerateDevices", + "enumerateEditable", + "environmentBlendMode", + "epubCaptionSide", + "epubTextCombine", + "epubTextEmphasis", + "epubTextEmphasisColor", + "epubTextEmphasisStyle", + "epubTextOrientation", + "epubTextTransform", + "epubWordBreak", + "epubWritingMode", + "equals", + "era", + "error", + "errorCode", + "errorDetail", + "errorText", + "escape", + "estimate", + "eval", + "evaluate", + "event", + "eventPhase", + "every", + "ex", + "exception", + "exchange", + "exec", + "execCommand", + "execCommandShowHelp", + "execScript", + "executeSql", + "exitFullscreen", + "exitPictureInPicture", + "exitPointerLock", + "exitPresent", + "exp", + "expand", + "expandEntityReferences", + "expando", + "expansion", + "expiration", + "expirationTime", + "expires", + "expiryDate", + "explicitOriginalTarget", + "expm1", + "exponent", + "exponentialRampToValueAtTime", + "exportKey", + "exports", + "extend", + "extensions", + "extentNode", + "extentOffset", + "external", + "externalResourcesRequired", + "extractContents", + "extractable", + "eye", + "f", + "face", + "factoryReset", + "failureReason", + "fallback", + "family", + "familyName", + "farthestViewportElement", + "fastSeek", + "fatal", + "featurePolicy", + "featureSettings", + "features", + "fenceSync", + "fetch", + "fetchStart", + "fftSize", + "fgColor", + "fieldOfView", + "file", + "fileCreatedDate", + "fileHandle", + "fileModifiedDate", + "fileName", + "fileSize", + "fileUpdatedDate", + "filename", + "files", + "filesystem", + "fill", + "fill-opacity", + "fill-rule", + "fillLightMode", + "fillOpacity", + "fillRect", + "fillRule", + "fillStyle", + "fillText", + "filter", + "filterResX", + "filterResY", + "filterUnits", + "filters", + "finally", + "find", + "findIndex", + "findRule", + "findText", + "finish", + "finishDocumentLoadTime", + "finishLoadTime", + "finished", + "fireEvent", + "firesTouchEvents", + "first", + "firstChild", + "firstElementChild", + "firstPage", + "firstPaintAfterLoadTime", + "firstPaintTime", + "fixed", + "flags", + "flat", + "flatMap", + "flex", + "flex-basis", + "flex-direction", + "flex-flow", + "flex-grow", + "flex-shrink", + "flex-wrap", + "flexBasis", + "flexDirection", + "flexFlow", + "flexGrow", + "flexShrink", + "flexWrap", + "flipX", + "flipY", + "float", + "flood-color", + "flood-opacity", + "floodColor", + "floodOpacity", + "floor", + "flush", + "focus", + "focusNode", + "focusOffset", + "font", + "font-family", + "font-feature-settings", + "font-kerning", + "font-language-override", + "font-size", + "font-size-adjust", + "font-stretch", + "font-style", + "font-synthesis", + "font-variant", + "font-variant-alternates", + "font-variant-caps", + "font-variant-east-asian", + "font-variant-ligatures", + "font-variant-numeric", + "font-variant-position", + "font-weight", + "fontBoundingBoxAscent", + "fontBoundingBoxDescent", + "fontDisplay", + "fontFamily", + "fontFeatureSettings", + "fontKerning", + "fontLanguageOverride", + "fontOpticalSizing", + "fontSize", + "fontSizeAdjust", + "fontSmoothingEnabled", + "fontStretch", + "fontStyle", + "fontSynthesis", + "fontVariant", + "fontVariantAlternates", + "fontVariantCaps", + "fontVariantEastAsian", + "fontVariantLigatures", + "fontVariantNumeric", + "fontVariantPosition", + "fontVariationSettings", + "fontWeight", + "fontcolor", + "fontfaces", + "fonts", + "fontsize", + "for", + "forEach", + "force", + "forceRedraw", + "form", + "formAction", + "formData", + "formEnctype", + "formMethod", + "formNoValidate", + "formTarget", + "format", + "formatRange", + "formatRangeToParts", + "formatToParts", + "forms", + "forward", + "forwardX", + "forwardY", + "forwardZ", + "foundation", + "fr", + "fragmentDirective", + "frame", + "frameBorder", + "frameElement", + "frameSpacing", + "framebuffer", + "framebufferHeight", + "framebufferRenderbuffer", + "framebufferTexture2D", + "framebufferTextureLayer", + "framebufferWidth", + "frames", + "freeSpace", + "freeze", + "frequency", + "frequencyBinCount", + "from", + "fromCharCode", + "fromCodePoint", + "fromElement", + "fromEntries", + "fromFloat32Array", + "fromFloat64Array", + "fromMatrix", + "fromPoint", + "fromQuad", + "fromRect", + "frontFace", + "fround", + "fullPath", + "fullScreen", + "fullscreen", + "fullscreenElement", + "fullscreenEnabled", + "fx", + "fy", + "gain", + "gamepad", + "gamma", + "gap", + "gatheringState", + "gatt", + "genderIdentity", + "generateCertificate", + "generateKey", + "generateMipmap", + "generateRequest", + "geolocation", + "gestureObject", + "get", + "getActiveAttrib", + "getActiveUniform", + "getActiveUniformBlockName", + "getActiveUniformBlockParameter", + "getActiveUniforms", + "getAdditionalLanguages", + "getAdjacentText", + "getAll", + "getAllKeys", + "getAllResponseHeaders", + "getAllowlistForFeature", + "getAnimations", + "getAsFile", + "getAsString", + "getAttachedShaders", + "getAttribLocation", + "getAttribute", + "getAttributeNS", + "getAttributeNames", + "getAttributeNode", + "getAttributeNodeNS", + "getAttributeType", + "getAudioTracks", + "getAvailability", + "getBBox", + "getBattery", + "getBigInt64", + "getBigUint64", + "getBlob", + "getBookmark", + "getBoundingClientRect", + "getBounds", + "getBufferParameter", + "getBufferSubData", + "getByteFrequencyData", + "getByteTimeDomainData", + "getCSSCanvasContext", + "getCTM", + "getCandidateWindowClientRect", + "getCanonicalLocales", + "getCapabilities", + "getChannelData", + "getCharNumAtPosition", + "getCharacteristic", + "getCharacteristics", + "getClientExtensionResults", + "getClientRect", + "getClientRects", + "getCoalescedEvents", + "getCompositionAlternatives", + "getComputedStyle", + "getComputedTextLength", + "getComputedTiming", + "getConfiguration", + "getConstraints", + "getContext", + "getContextAttributes", + "getContributingSources", + "getCount", + "getCounterValue", + "getCueAsHTML", + "getCueById", + "getCurrentPosition", + "getCurrentTime", + "getData", + "getDatabaseNames", + "getDate", + "getDay", + "getDefaultComputedStyle", + "getDescriptor", + "getDescriptors", + "getDestinationInsertionPoints", + "getDetails", + "getDevices", + "getDirectory", + "getDisplayMedia", + "getDistributedNodes", + "getEditable", + "getElementById", + "getElementsByClassName", + "getElementsByName", + "getElementsByTagName", + "getElementsByTagNameNS", + "getEnclosureList", + "getEndPositionOfChar", + "getEntries", + "getEntriesByName", + "getEntriesByType", + "getError", + "getExtension", + "getExtentOfChar", + "getEyeParameters", + "getFeature", + "getFile", + "getFiles", + "getFilesAndDirectories", + "getFingerprints", + "getFloat32", + "getFloat64", + "getFloatFrequencyData", + "getFloatTimeDomainData", + "getFloatValue", + "getFragDataLocation", + "getFrameData", + "getFramebufferAttachmentParameter", + "getFrequencyResponse", + "getFullYear", + "getGamepads", + "getHitTestResults", + "getHitTestResultsForTransientInput", + "getHours", + "getIdentityAssertion", + "getIds", + "getImageData", + "getIndexedParameter", + "getInstalled", + "getInstalledRelatedApps", + "getInt16", + "getInt32", + "getInt8", + "getInternalformatParameter", + "getIntersectionList", + "getIsInstalled", + "getItem", + "getItems", + "getKey", + "getKeyframes", + "getLayers", + "getLayoutMap", + "getLineDash", + "getLocalCandidates", + "getLocalParameters", + "getLocalStreams", + "getLocalizationResource", + "getMarks", + "getMatchedCSSRules", + "getMeasures", + "getMetadata", + "getMilliseconds", + "getMinutes", + "getModifierState", + "getMonth", + "getNamedItem", + "getNamedItemNS", + "getNativeFramebufferScaleFactor", + "getNotifications", + "getNotifier", + "getNumberOfChars", + "getOffsetReferenceSpace", + "getOutputTimestamp", + "getOverrideHistoryNavigationMode", + "getOverrideStyle", + "getOwnPropertyDescriptor", + "getOwnPropertyDescriptors", + "getOwnPropertyNames", + "getOwnPropertySymbols", + "getParameter", + "getParameters", + "getParent", + "getPathSegAtLength", + "getPhotoCapabilities", + "getPhotoSettings", + "getPointAtLength", + "getPose", + "getPredictedEvents", + "getPreference", + "getPreferenceDefault", + "getPresentationAttribute", + "getPreventDefault", + "getPrimaryService", + "getPrimaryServices", + "getProgramInfoLog", + "getProgramParameter", + "getPropertyCSSValue", + "getPropertyPriority", + "getPropertyShorthand", + "getPropertyType", + "getPropertyValue", + "getPrototypeOf", + "getQuery", + "getQueryParameter", + "getRGBColorValue", + "getRandomValues", + "getRangeAt", + "getReader", + "getReceivers", + "getRectValue", + "getRegistration", + "getRegistrations", + "getRemoteCandidates", + "getRemoteCertificates", + "getRemoteParameters", + "getRemoteStreams", + "getRenderbufferParameter", + "getResponseHeader", + "getRevision", + "getRoot", + "getRootNode", + "getRotationOfChar", + "getRules", + "getSVGDocument", + "getSamplerParameter", + "getScreenCTM", + "getSeconds", + "getSelectedCandidatePair", + "getSelection", + "getSelf", + "getSenders", + "getService", + "getSettings", + "getShaderInfoLog", + "getShaderParameter", + "getShaderPrecisionFormat", + "getShaderSource", + "getSimpleDuration", + "getSiteIcons", + "getSources", + "getSpeculativeParserUrls", + "getStartDate", + "getStartPositionOfChar", + "getStartTime", + "getState", + "getStats", + "getStatusForPolicy", + "getStorageUpdates", + "getStreamById", + "getStringValue", + "getSubStringLength", + "getSubscription", + "getSupportedConstraints", + "getSupportedExtensions", + "getSupportedFormats", + "getSyncParameter", + "getSynchronizationSources", + "getTags", + "getTargetRanges", + "getTexParameter", + "getTime", + "getTimezoneOffset", + "getTiming", + "getTotalLength", + "getTrackById", + "getTracks", + "getTransceivers", + "getTransform", + "getTransformFeedbackVarying", + "getTransformToElement", + "getTransports", + "getType", + "getTypeMapping", + "getUTCDate", + "getUTCDay", + "getUTCFullYear", + "getUTCHours", + "getUTCMilliseconds", + "getUTCMinutes", + "getUTCMonth", + "getUTCSeconds", + "getUint16", + "getUint32", + "getUint8", + "getUniform", + "getUniformBlockIndex", + "getUniformIndices", + "getUniformLocation", + "getUserMedia", + "getVRDisplays", + "getValues", + "getVarDate", + "getVariableValue", + "getVertexAttrib", + "getVertexAttribOffset", + "getVideoPlaybackQuality", + "getVideoTracks", + "getViewerPose", + "getViewport", + "getVoices", + "getWakeLockState", + "getWriter", + "getYear", + "givenName", + "global", + "globalAlpha", + "globalCompositeOperation", + "globalThis", + "glyphOrientationHorizontal", + "glyphOrientationVertical", + "glyphRef", + "go", + "grabFrame", + "grad", + "gradientTransform", + "gradientUnits", + "grammars", + "green", + "grid", + "grid-area", + "grid-auto-columns", + "grid-auto-flow", + "grid-auto-rows", + "grid-column", + "grid-column-end", + "grid-column-gap", + "grid-column-start", + "grid-gap", + "grid-row", + "grid-row-end", + "grid-row-gap", + "grid-row-start", + "grid-template", + "grid-template-areas", + "grid-template-columns", + "grid-template-rows", + "gridArea", + "gridAutoColumns", + "gridAutoFlow", + "gridAutoRows", + "gridColumn", + "gridColumnEnd", + "gridColumnGap", + "gridColumnStart", + "gridGap", + "gridRow", + "gridRowEnd", + "gridRowGap", + "gridRowStart", + "gridTemplate", + "gridTemplateAreas", + "gridTemplateColumns", + "gridTemplateRows", + "gripSpace", + "group", + "groupCollapsed", + "groupEnd", + "groupId", + "grow", + "hadRecentInput", + "hand", + "handedness", + "hangingBaseline", + "hangingPunctuation", + "hapticActuators", + "hardwareConcurrency", + "has", + "hasAttribute", + "hasAttributeNS", + "hasAttributes", + "hasBeenActive", + "hasChildNodes", + "hasComposition", + "hasEnrolledInstrument", + "hasExtension", + "hasExternalDisplay", + "hasFeature", + "hasFocus", + "hasInstance", + "hasLayout", + "hasListener", + "hasListeners", + "hasOrientation", + "hasOwnProperty", + "hasPointerCapture", + "hasPosition", + "hasReading", + "hasStorageAccess", + "hash", + "head", + "headers", + "heading", + "height", + "hidden", + "hide", + "hideFocus", + "high", + "highWaterMark", + "hint", + "history", + "honorificPrefix", + "honorificSuffix", + "horizontalOverflow", + "host", + "hostCandidate", + "hostname", + "hour", + "hour12", + "hourCycle", + "href", + "hrefTranslate", + "hreflang", + "hspace", + "html5TagCheckInerface", + "htmlFor", + "htmlText", + "httpEquiv", + "httpRequestStatusCode", + "hwTimestamp", + "hyphens", + "hypot", + "iccId", + "iceConnectionState", + "iceGatheringState", + "iceTransport", + "icon", + "iconURL", + "id", + "identifier", + "identity", + "ideographicBaseline", + "idpLoginUrl", + "ignoreBOM", + "ignoreCase", + "ignoreDepthValues", + "ignoreMutedMedia", + "ignorePunctuation", + "image-orientation", + "image-rendering", + "imageHeight", + "imageOrientation", + "imageRendering", + "imageSizes", + "imageSmoothingEnabled", + "imageSmoothingQuality", + "imageSrcset", + "imageWidth", + "images", + "ime-mode", + "imeMode", + "implementation", + "import", + "importKey", + "importNode", + "importStylesheet", + "imports", + "impp", + "imul", + "in", + "in1", + "in2", + "inBandMetadataTrackDispatchType", + "inRange", + "includes", + "incremental", + "indeterminate", + "index", + "indexNames", + "indexOf", + "indexedDB", + "indicate", + "inertiaDestinationX", + "inertiaDestinationY", + "info", + "init", + "initAnimationEvent", + "initBeforeLoadEvent", + "initClipboardEvent", + "initCloseEvent", + "initCommandEvent", + "initCompositionEvent", + "initCustomEvent", + "initData", + "initDataType", + "initDeviceMotionEvent", + "initDeviceOrientationEvent", + "initDragEvent", + "initErrorEvent", + "initEvent", + "initFocusEvent", + "initGestureEvent", + "initHashChangeEvent", + "initKeyEvent", + "initKeyboardEvent", + "initMSManipulationEvent", + "initMessageEvent", + "initMouseEvent", + "initMouseScrollEvent", + "initMouseWheelEvent", + "initMutationEvent", + "initNSMouseEvent", + "initOverflowEvent", + "initPageEvent", + "initPageTransitionEvent", + "initPointerEvent", + "initPopStateEvent", + "initProgressEvent", + "initScrollAreaEvent", + "initSimpleGestureEvent", + "initStorageEvent", + "initTextEvent", + "initTimeEvent", + "initTouchEvent", + "initTransitionEvent", + "initUIEvent", + "initWebKitAnimationEvent", + "initWebKitTransitionEvent", + "initWebKitWheelEvent", + "initWheelEvent", + "initialTime", + "initialize", + "initiatorType", + "inline-size", + "inlineSize", + "inlineVerticalFieldOfView", + "inner", + "innerHTML", + "innerHeight", + "innerText", + "innerWidth", + "input", + "inputBuffer", + "inputEncoding", + "inputMethod", + "inputMode", + "inputSource", + "inputSources", + "inputType", + "inputs", + "insertAdjacentElement", + "insertAdjacentHTML", + "insertAdjacentText", + "insertBefore", + "insertCell", + "insertDTMF", + "insertData", + "insertId", + "insertItemBefore", + "insertNode", + "insertRow", + "insertRule", + "inset", + "inset-block", + "inset-block-end", + "inset-block-start", + "inset-inline", + "inset-inline-end", + "inset-inline-start", + "insetBlock", + "insetBlockEnd", + "insetBlockStart", + "insetInline", + "insetInlineEnd", + "insetInlineStart", + "install", + "installChrome", + "installPackage", + "installState", + "installing", + "instanceRoot", + "instantiate", + "instantiateStreaming", + "instruments", + "integrity", + "interactionMode", + "intercept", + "interfaceClass", + "interfaceName", + "interfaceNumber", + "interfaceProtocol", + "interfaceSubclass", + "interfaces", + "interimResults", + "internalSubset", + "interpretation", + "intersectionRatio", + "intersectionRect", + "intersectsNode", + "interval", + "invalidIteratorState", + "invalidateFramebuffer", + "invalidateSubFramebuffer", + "inverse", + "invertSelf", + "is", + "is2D", + "isActive", + "isAlternate", + "isArray", + "isBingCurrentSearchDefault", + "isBuffer", + "isCandidateWindowVisible", + "isChar", + "isCollapsed", + "isComposing", + "isConcatSpreadable", + "isConnected", + "isContentEditable", + "isContentHandlerRegistered", + "isContextLost", + "isDefaultNamespace", + "isDirectory", + "isDisabled", + "isEnabled", + "isEqual", + "isEqualNode", + "isExtensible", + "isExternalCTAP2SecurityKeySupported", + "isFile", + "isFinite", + "isFramebuffer", + "isFrozen", + "isGenerator", + "isHTML", + "isHistoryNavigation", + "isId", + "isIdentity", + "isInjected", + "isInstalled", + "isInteger", + "isIntersecting", + "isLockFree", + "isMap", + "isMultiLine", + "isNaN", + "isOpen", + "isPointInFill", + "isPointInPath", + "isPointInRange", + "isPointInStroke", + "isPrefAlternate", + "isPresenting", + "isPrimary", + "isProgram", + "isPropertyImplicit", + "isProtocolHandlerRegistered", + "isPrototypeOf", + "isQuery", + "isRenderbuffer", + "isSafeInteger", + "isSameNode", + "isSampler", + "isScript", + "isScriptURL", + "isSealed", + "isSecureContext", + "isSessionSupported", + "isShader", + "isSupported", + "isSync", + "isTextEdit", + "isTexture", + "isTransformFeedback", + "isTrusted", + "isTypeSupported", + "isTypeSupportedWithFeatures", + "isUserVerifyingPlatformAuthenticatorAvailable", + "isVertexArray", + "isView", + "isVisible", + "isochronousTransferIn", + "isochronousTransferOut", + "isolation", + "italics", + "item", + "itemId", + "itemProp", + "itemRef", + "itemScope", + "itemType", + "itemValue", + "items", + "iterateNext", + "iterator", + "javaEnabled", + "jobTitle", + "join", + "jsHeapSizeLimit", + "json", + "justify-content", + "justify-items", + "justify-self", + "justifyContent", + "justifyItems", + "justifySelf", + "k1", + "k2", + "k3", + "k4", + "kHz", + "keepalive", + "kernelMatrix", + "kernelUnitLengthX", + "kernelUnitLengthY", + "kerning", + "key", + "keyCode", + "keyFor", + "keyIdentifier", + "keyLightEnabled", + "keyLocation", + "keyPath", + "keyStatuses", + "keySystem", + "keyText", + "keyUsage", + "keyboard", + "keys", + "keytype", + "kind", + "knee", + "label", + "labels", + "lang", + "language", + "languages", + "largeArcFlag", + "lastActivePanel", + "lastChild", + "lastElementChild", + "lastEventId", + "lastIndex", + "lastIndexOf", + "lastInputTime", + "lastMatch", + "lastMessageSubject", + "lastMessageType", + "lastModified", + "lastModifiedDate", + "lastPage", + "lastParen", + "lastState", + "lastStyleSheetSet", + "latitude", + "layerX", + "layerY", + "layoutFlow", + "layoutGrid", + "layoutGridChar", + "layoutGridLine", + "layoutGridMode", + "layoutGridType", + "lbound", + "left", + "leftContext", + "leftDegrees", + "leftMargin", + "leftProjectionMatrix", + "leftViewMatrix", + "length", + "lengthAdjust", + "lengthComputable", + "letter-spacing", + "letterSpacing", + "level", + "lighting-color", + "lightingColor", + "limitingConeAngle", + "line", + "line-break", + "line-height", + "lineAlign", + "lineBreak", + "lineCap", + "lineDashOffset", + "lineHeight", + "lineJoin", + "lineNumber", + "lineTo", + "lineWidth", + "linearAcceleration", + "linearRampToValueAtTime", + "linearVelocity", + "lineno", + "lines", + "link", + "linkColor", + "linkProgram", + "links", + "list", + "list-style", + "list-style-image", + "list-style-position", + "list-style-type", + "listStyle", + "listStyleImage", + "listStylePosition", + "listStyleType", + "listener", + "load", + "loadEventEnd", + "loadEventStart", + "loadTime", + "loadTimes", + "loaded", + "loading", + "localDescription", + "localName", + "localService", + "localStorage", + "locale", + "localeCompare", + "location", + "locationbar", + "lock", + "locked", + "lockedFile", + "locks", + "log", + "log10", + "log1p", + "log2", + "logicalXDPI", + "logicalYDPI", + "longDesc", + "longitude", + "lookupNamespaceURI", + "lookupPrefix", + "loop", + "loopEnd", + "loopStart", + "looping", + "low", + "lower", + "lowerBound", + "lowerOpen", + "lowsrc", + "m11", + "m12", + "m13", + "m14", + "m21", + "m22", + "m23", + "m24", + "m31", + "m32", + "m33", + "m34", + "m41", + "m42", + "m43", + "m44", + "makeXRCompatible", + "manifest", + "manufacturer", + "manufacturerName", + "map", + "mapping", + "margin", + "margin-block", + "margin-block-end", + "margin-block-start", + "margin-bottom", + "margin-inline", + "margin-inline-end", + "margin-inline-start", + "margin-left", + "margin-right", + "margin-top", + "marginBlock", + "marginBlockEnd", + "marginBlockStart", + "marginBottom", + "marginHeight", + "marginInline", + "marginInlineEnd", + "marginInlineStart", + "marginLeft", + "marginRight", + "marginTop", + "marginWidth", + "mark", + "markTimeline", + "marker", + "marker-end", + "marker-mid", + "marker-offset", + "marker-start", + "markerEnd", + "markerHeight", + "markerMid", + "markerOffset", + "markerStart", + "markerUnits", + "markerWidth", + "marks", + "mask", + "mask-clip", + "mask-composite", + "mask-image", + "mask-mode", + "mask-origin", + "mask-position", + "mask-position-x", + "mask-position-y", + "mask-repeat", + "mask-size", + "mask-type", + "maskClip", + "maskComposite", + "maskContentUnits", + "maskImage", + "maskMode", + "maskOrigin", + "maskPosition", + "maskPositionX", + "maskPositionY", + "maskRepeat", + "maskSize", + "maskType", + "maskUnits", + "match", + "matchAll", + "matchMedia", + "matchMedium", + "matches", + "matrix", + "matrixTransform", + "max", + "max-block-size", + "max-height", + "max-inline-size", + "max-width", + "maxActions", + "maxAlternatives", + "maxBlockSize", + "maxChannelCount", + "maxChannels", + "maxConnectionsPerServer", + "maxDecibels", + "maxDistance", + "maxHeight", + "maxInlineSize", + "maxLayers", + "maxLength", + "maxMessageSize", + "maxPacketLifeTime", + "maxRetransmits", + "maxTouchPoints", + "maxValue", + "maxWidth", + "maxZoom", + "maximize", + "maximumFractionDigits", + "measure", + "measureText", + "media", + "mediaCapabilities", + "mediaDevices", + "mediaElement", + "mediaGroup", + "mediaKeys", + "mediaSession", + "mediaStream", + "mediaText", + "meetOrSlice", + "memory", + "menubar", + "mergeAttributes", + "message", + "messageClass", + "messageHandlers", + "messageType", + "metaKey", + "metadata", + "method", + "methodDetails", + "methodName", + "mid", + "mimeType", + "mimeTypes", + "min", + "min-block-size", + "min-height", + "min-inline-size", + "min-width", + "minBlockSize", + "minDecibels", + "minHeight", + "minInlineSize", + "minLength", + "minValue", + "minWidth", + "minZoom", + "minimize", + "minimumFractionDigits", + "minimumIntegerDigits", + "minute", + "miterLimit", + "mix-blend-mode", + "mixBlendMode", + "mm", + "mode", + "modify", + "month", + "motion", + "motionOffset", + "motionPath", + "motionRotation", + "mount", + "move", + "moveBy", + "moveEnd", + "moveFirst", + "moveFocusDown", + "moveFocusLeft", + "moveFocusRight", + "moveFocusUp", + "moveNext", + "moveRow", + "moveStart", + "moveTo", + "moveToBookmark", + "moveToElementText", + "moveToPoint", + "movementX", + "movementY", + "mozAdd", + "mozAnimationStartTime", + "mozAnon", + "mozApps", + "mozAudioCaptured", + "mozAudioChannelType", + "mozAutoplayEnabled", + "mozCancelAnimationFrame", + "mozCancelFullScreen", + "mozCancelRequestAnimationFrame", + "mozCaptureStream", + "mozCaptureStreamUntilEnded", + "mozClearDataAt", + "mozContact", + "mozContacts", + "mozCreateFileHandle", + "mozCurrentTransform", + "mozCurrentTransformInverse", + "mozCursor", + "mozDash", + "mozDashOffset", + "mozDecodedFrames", + "mozExitPointerLock", + "mozFillRule", + "mozFragmentEnd", + "mozFrameDelay", + "mozFullScreen", + "mozFullScreenElement", + "mozFullScreenEnabled", + "mozGetAll", + "mozGetAllKeys", + "mozGetAsFile", + "mozGetDataAt", + "mozGetMetadata", + "mozGetUserMedia", + "mozHasAudio", + "mozHasItem", + "mozHidden", + "mozImageSmoothingEnabled", + "mozIndexedDB", + "mozInnerScreenX", + "mozInnerScreenY", + "mozInputSource", + "mozIsTextField", + "mozItem", + "mozItemCount", + "mozItems", + "mozLength", + "mozLockOrientation", + "mozMatchesSelector", + "mozMovementX", + "mozMovementY", + "mozOpaque", + "mozOrientation", + "mozPaintCount", + "mozPaintedFrames", + "mozParsedFrames", + "mozPay", + "mozPointerLockElement", + "mozPresentedFrames", + "mozPreservesPitch", + "mozPressure", + "mozPrintCallback", + "mozRTCIceCandidate", + "mozRTCPeerConnection", + "mozRTCSessionDescription", + "mozRemove", + "mozRequestAnimationFrame", + "mozRequestFullScreen", + "mozRequestPointerLock", + "mozSetDataAt", + "mozSetImageElement", + "mozSourceNode", + "mozSrcObject", + "mozSystem", + "mozTCPSocket", + "mozTextStyle", + "mozTypesAt", + "mozUnlockOrientation", + "mozUserCancelled", + "mozVisibilityState", + "ms", + "msAnimation", + "msAnimationDelay", + "msAnimationDirection", + "msAnimationDuration", + "msAnimationFillMode", + "msAnimationIterationCount", + "msAnimationName", + "msAnimationPlayState", + "msAnimationStartTime", + "msAnimationTimingFunction", + "msBackfaceVisibility", + "msBlockProgression", + "msCSSOMElementFloatMetrics", + "msCaching", + "msCachingEnabled", + "msCancelRequestAnimationFrame", + "msCapsLockWarningOff", + "msClearImmediate", + "msClose", + "msContentZoomChaining", + "msContentZoomFactor", + "msContentZoomLimit", + "msContentZoomLimitMax", + "msContentZoomLimitMin", + "msContentZoomSnap", + "msContentZoomSnapPoints", + "msContentZoomSnapType", + "msContentZooming", + "msConvertURL", + "msCrypto", + "msDoNotTrack", + "msElementsFromPoint", + "msElementsFromRect", + "msExitFullscreen", + "msExtendedCode", + "msFillRule", + "msFirstPaint", + "msFlex", + "msFlexAlign", + "msFlexDirection", + "msFlexFlow", + "msFlexItemAlign", + "msFlexLinePack", + "msFlexNegative", + "msFlexOrder", + "msFlexPack", + "msFlexPositive", + "msFlexPreferredSize", + "msFlexWrap", + "msFlowFrom", + "msFlowInto", + "msFontFeatureSettings", + "msFullscreenElement", + "msFullscreenEnabled", + "msGetInputContext", + "msGetRegionContent", + "msGetUntransformedBounds", + "msGraphicsTrustStatus", + "msGridColumn", + "msGridColumnAlign", + "msGridColumnSpan", + "msGridColumns", + "msGridRow", + "msGridRowAlign", + "msGridRowSpan", + "msGridRows", + "msHidden", + "msHighContrastAdjust", + "msHyphenateLimitChars", + "msHyphenateLimitLines", + "msHyphenateLimitZone", + "msHyphens", + "msImageSmoothingEnabled", + "msImeAlign", + "msIndexedDB", + "msInterpolationMode", + "msIsStaticHTML", + "msKeySystem", + "msKeys", + "msLaunchUri", + "msLockOrientation", + "msManipulationViewsEnabled", + "msMatchMedia", + "msMatchesSelector", + "msMaxTouchPoints", + "msOrientation", + "msOverflowStyle", + "msPerspective", + "msPerspectiveOrigin", + "msPlayToDisabled", + "msPlayToPreferredSourceUri", + "msPlayToPrimary", + "msPointerEnabled", + "msRegionOverflow", + "msReleasePointerCapture", + "msRequestAnimationFrame", + "msRequestFullscreen", + "msSaveBlob", + "msSaveOrOpenBlob", + "msScrollChaining", + "msScrollLimit", + "msScrollLimitXMax", + "msScrollLimitXMin", + "msScrollLimitYMax", + "msScrollLimitYMin", + "msScrollRails", + "msScrollSnapPointsX", + "msScrollSnapPointsY", + "msScrollSnapType", + "msScrollSnapX", + "msScrollSnapY", + "msScrollTranslation", + "msSetImmediate", + "msSetMediaKeys", + "msSetPointerCapture", + "msTextCombineHorizontal", + "msTextSizeAdjust", + "msToBlob", + "msTouchAction", + "msTouchSelect", + "msTraceAsyncCallbackCompleted", + "msTraceAsyncCallbackStarting", + "msTraceAsyncOperationCompleted", + "msTraceAsyncOperationStarting", + "msTransform", + "msTransformOrigin", + "msTransformStyle", + "msTransition", + "msTransitionDelay", + "msTransitionDuration", + "msTransitionProperty", + "msTransitionTimingFunction", + "msUnlockOrientation", + "msUpdateAsyncCallbackRelation", + "msUserSelect", + "msVisibilityState", + "msWrapFlow", + "msWrapMargin", + "msWrapThrough", + "msWriteProfilerMark", + "msZoom", + "msZoomTo", + "mt", + "mul", + "multiEntry", + "multiSelectionObj", + "multiline", + "multiple", + "multiply", + "multiplySelf", + "mutableFile", + "muted", + "n", + "name", + "nameProp", + "namedItem", + "namedRecordset", + "names", + "namespaceURI", + "namespaces", + "naturalHeight", + "naturalWidth", + "navigate", + "navigation", + "navigationMode", + "navigationPreload", + "navigationStart", + "navigationType", + "navigator", + "near", + "nearestViewportElement", + "negative", + "negotiated", + "netscape", + "networkState", + "newScale", + "newTranslate", + "newURL", + "newValue", + "newValueSpecifiedUnits", + "newVersion", + "newhome", + "next", + "nextElementSibling", + "nextHopProtocol", + "nextNode", + "nextPage", + "nextSibling", + "nickname", + "noHref", + "noModule", + "noResize", + "noShade", + "noValidate", + "noWrap", + "node", + "nodeName", + "nodeType", + "nodeValue", + "nonce", + "normalize", + "normalizedPathSegList", + "notationName", + "notations", + "note", + "noteGrainOn", + "noteOff", + "noteOn", + "notify", + "now", + "npnNegotiatedProtocol", + "numOctaves", + "number", + "numberOfChannels", + "numberOfInputs", + "numberOfItems", + "numberOfOutputs", + "numberValue", + "numberingSystem", + "numeric", + "oMatchesSelector", + "object", + "object-fit", + "object-position", + "objectFit", + "objectPosition", + "objectStore", + "objectStoreNames", + "observe", + "observedAttributes", + "of", + "offscreenBuffering", + "offset", + "offset-anchor", + "offset-block-end", + "offset-block-start", + "offset-distance", + "offset-inline-end", + "offset-inline-start", + "offset-path", + "offset-rotate", + "offsetAnchor", + "offsetBlockEnd", + "offsetBlockStart", + "offsetDistance", + "offsetHeight", + "offsetInlineEnd", + "offsetInlineStart", + "offsetLeft", + "offsetNode", + "offsetParent", + "offsetPath", + "offsetRotate", + "offsetTop", + "offsetWidth", + "offsetX", + "offsetY", + "ok", + "oldURL", + "oldValue", + "oldVersion", + "olderShadowRoot", + "onDownloadProgress", + "onInstallStageChanged", + "onLine", + "onabort", + "onabsolutedeviceorientation", + "onactivate", + "onactive", + "onaddsourcebuffer", + "onaddstream", + "onaddtrack", + "onafterprint", + "onafterscriptexecute", + "onafterupdate", + "onanimationcancel", + "onanimationend", + "onanimationiteration", + "onanimationstart", + "onappinstalled", + "onaudioend", + "onaudioprocess", + "onaudiostart", + "onautocomplete", + "onautocompleteerror", + "onauxclick", + "onbeforeactivate", + "onbeforecopy", + "onbeforecut", + "onbeforedeactivate", + "onbeforeeditfocus", + "onbeforeinput", + "onbeforeinstallprompt", + "onbeforeload", + "onbeforepaste", + "onbeforeprint", + "onbeforescriptexecute", + "onbeforeunload", + "onbeforeupdate", + "onbeforexrselect", + "onbegin", + "onblocked", + "onblur", + "onbounce", + "onboundary", + "onbufferedamountlow", + "oncached", + "oncancel", + "oncandidatewindowhide", + "oncandidatewindowshow", + "oncandidatewindowupdate", + "oncanplay", + "oncanplaythrough", + "once", + "oncellchange", + "onchange", + "oncharacteristicvaluechanged", + "onchargingchange", + "onchargingtimechange", + "onchecking", + "onclick", + "onclose", + "onclosing", + "oncompassneedscalibration", + "oncomplete", + "onconnect", + "onconnecting", + "onconnectionavailable", + "onconnectionstatechange", + "oncontactchange", + "oncontextmenu", + "oncontrollerchange", + "oncontrolselect", + "oncopy", + "oncuechange", + "oncut", + "ondataavailable", + "ondatachannel", + "ondatasetchanged", + "ondatasetcomplete", + "ondblclick", + "ondeactivate", + "ondevicechange", + "ondevicelight", + "ondevicemotion", + "ondeviceorientation", + "ondeviceorientationabsolute", + "ondeviceproximity", + "ondischargingtimechange", + "ondisconnect", + "ondisplay", + "ondownloading", + "ondrag", + "ondragend", + "ondragenter", + "ondragexit", + "ondragleave", + "ondragover", + "ondragstart", + "ondrop", + "ondurationchange", + "onemptied", + "onencrypted", + "onend", + "onended", + "onenter", + "onenterpictureinpicture", + "onerror", + "onerrorupdate", + "onexit", + "onfilterchange", + "onfinish", + "onfocus", + "onfocusin", + "onfocusout", + "onformdata", + "onfreeze", + "onfullscreenchange", + "onfullscreenerror", + "ongatheringstatechange", + "ongattserverdisconnected", + "ongesturechange", + "ongestureend", + "ongesturestart", + "ongotpointercapture", + "onhashchange", + "onhelp", + "onicecandidate", + "onicecandidateerror", + "oniceconnectionstatechange", + "onicegatheringstatechange", + "oninactive", + "oninput", + "oninputsourceschange", + "oninvalid", + "onkeydown", + "onkeypress", + "onkeystatuseschange", + "onkeyup", + "onlanguagechange", + "onlayoutcomplete", + "onleavepictureinpicture", + "onlevelchange", + "onload", + "onloadT", + "onloadeddata", + "onloadedmetadata", + "onloadend", + "onloading", + "onloadingdone", + "onloadingerror", + "onloadstart", + "onlosecapture", + "onlostpointercapture", + "only", + "onmark", + "onmessage", + "onmessageerror", + "onmidimessage", + "onmousedown", + "onmouseenter", + "onmouseleave", + "onmousemove", + "onmouseout", + "onmouseover", + "onmouseup", + "onmousewheel", + "onmove", + "onmoveend", + "onmovestart", + "onmozfullscreenchange", + "onmozfullscreenerror", + "onmozorientationchange", + "onmozpointerlockchange", + "onmozpointerlockerror", + "onmscontentzoom", + "onmsfullscreenchange", + "onmsfullscreenerror", + "onmsgesturechange", + "onmsgesturedoubletap", + "onmsgestureend", + "onmsgesturehold", + "onmsgesturestart", + "onmsgesturetap", + "onmsgotpointercapture", + "onmsinertiastart", + "onmslostpointercapture", + "onmsmanipulationstatechanged", + "onmsneedkey", + "onmsorientationchange", + "onmspointercancel", + "onmspointerdown", + "onmspointerenter", + "onmspointerhover", + "onmspointerleave", + "onmspointermove", + "onmspointerout", + "onmspointerover", + "onmspointerup", + "onmssitemodejumplistitemremoved", + "onmsthumbnailclick", + "onmute", + "onnegotiationneeded", + "onnomatch", + "onnoupdate", + "onobsolete", + "onoffline", + "ononline", + "onopen", + "onorientationchange", + "onoverconstrained", + "onpage", + "onpagechange", + "onpagehide", + "onpageshow", + "onpaste", + "onpause", + "onpayerdetailchange", + "onpaymentmethodchange", + "onplay", + "onplaying", + "onpluginstreamstart", + "onpointercancel", + "onpointerdown", + "onpointerenter", + "onpointerleave", + "onpointerlockchange", + "onpointerlockerror", + "onpointermove", + "onpointerout", + "onpointerover", + "onpointerrawupdate", + "onpointerup", + "onpopstate", + "onprocessorerror", + "onprogress", + "onpropertychange", + "onratechange", + "onreading", + "onreadystatechange", + "onrejectionhandled", + "onrelease", + "onremove", + "onremovesourcebuffer", + "onremovestream", + "onremovetrack", + "onrepeat", + "onreset", + "onresize", + "onresizeend", + "onresizestart", + "onresourcetimingbufferfull", + "onresult", + "onresume", + "onrowenter", + "onrowexit", + "onrowsdelete", + "onrowsinserted", + "onscroll", + "onsearch", + "onsecuritypolicyviolation", + "onseeked", + "onseeking", + "onselect", + "onselectedcandidatepairchange", + "onselectend", + "onselectionchange", + "onselectstart", + "onshippingaddresschange", + "onshippingoptionchange", + "onshow", + "onsignalingstatechange", + "onsoundend", + "onsoundstart", + "onsourceclose", + "onsourceclosed", + "onsourceended", + "onsourceopen", + "onspeechend", + "onspeechstart", + "onsqueeze", + "onsqueezeend", + "onsqueezestart", + "onstalled", + "onstart", + "onstatechange", + "onstop", + "onstorage", + "onstoragecommit", + "onsubmit", + "onsuccess", + "onsuspend", + "onterminate", + "ontextinput", + "ontimeout", + "ontimeupdate", + "ontoggle", + "ontonechange", + "ontouchcancel", + "ontouchend", + "ontouchmove", + "ontouchstart", + "ontrack", + "ontransitioncancel", + "ontransitionend", + "ontransitionrun", + "ontransitionstart", + "onunhandledrejection", + "onunload", + "onunmute", + "onupdate", + "onupdateend", + "onupdatefound", + "onupdateready", + "onupdatestart", + "onupgradeneeded", + "onuserproximity", + "onversionchange", + "onvisibilitychange", + "onvoiceschanged", + "onvolumechange", + "onvrdisplayactivate", + "onvrdisplayconnect", + "onvrdisplaydeactivate", + "onvrdisplaydisconnect", + "onvrdisplaypresentchange", + "onwaiting", + "onwaitingforkey", + "onwarning", + "onwebkitanimationend", + "onwebkitanimationiteration", + "onwebkitanimationstart", + "onwebkitcurrentplaybacktargetiswirelesschanged", + "onwebkitfullscreenchange", + "onwebkitfullscreenerror", + "onwebkitkeyadded", + "onwebkitkeyerror", + "onwebkitkeymessage", + "onwebkitmouseforcechanged", + "onwebkitmouseforcedown", + "onwebkitmouseforceup", + "onwebkitmouseforcewillbegin", + "onwebkitneedkey", + "onwebkitorientationchange", + "onwebkitplaybacktargetavailabilitychanged", + "onwebkitpointerlockchange", + "onwebkitpointerlockerror", + "onwebkitresourcetimingbufferfull", + "onwebkittransitionend", + "onwheel", + "onzoom", + "opacity", + "open", + "openCursor", + "openDatabase", + "openKeyCursor", + "opened", + "opener", + "opera", + "operationType", + "operator", + "opr", + "opsProfile", + "optimum", + "options", + "or", + "order", + "orderX", + "orderY", + "ordered", + "org", + "organization", + "orient", + "orientAngle", + "orientType", + "orientation", + "orientationX", + "orientationY", + "orientationZ", + "origin", + "originalPolicy", + "originalTarget", + "orphans", + "oscpu", + "outcome", + "outerHTML", + "outerHeight", + "outerText", + "outerWidth", + "outline", + "outline-color", + "outline-offset", + "outline-style", + "outline-width", + "outlineColor", + "outlineOffset", + "outlineStyle", + "outlineWidth", + "outputBuffer", + "outputLatency", + "outputs", + "overflow", + "overflow-anchor", + "overflow-block", + "overflow-inline", + "overflow-wrap", + "overflow-x", + "overflow-y", + "overflowAnchor", + "overflowBlock", + "overflowInline", + "overflowWrap", + "overflowX", + "overflowY", + "overrideMimeType", + "oversample", + "overscroll-behavior", + "overscroll-behavior-block", + "overscroll-behavior-inline", + "overscroll-behavior-x", + "overscroll-behavior-y", + "overscrollBehavior", + "overscrollBehaviorBlock", + "overscrollBehaviorInline", + "overscrollBehaviorX", + "overscrollBehaviorY", + "ownKeys", + "ownerDocument", + "ownerElement", + "ownerNode", + "ownerRule", + "ownerSVGElement", + "owningElement", + "p1", + "p2", + "p3", + "p4", + "packetSize", + "packets", + "pad", + "padEnd", + "padStart", + "padding", + "padding-block", + "padding-block-end", + "padding-block-start", + "padding-bottom", + "padding-inline", + "padding-inline-end", + "padding-inline-start", + "padding-left", + "padding-right", + "padding-top", + "paddingBlock", + "paddingBlockEnd", + "paddingBlockStart", + "paddingBottom", + "paddingInline", + "paddingInlineEnd", + "paddingInlineStart", + "paddingLeft", + "paddingRight", + "paddingTop", + "page", + "page-break-after", + "page-break-before", + "page-break-inside", + "pageBreakAfter", + "pageBreakBefore", + "pageBreakInside", + "pageCount", + "pageLeft", + "pageT", + "pageTop", + "pageX", + "pageXOffset", + "pageY", + "pageYOffset", + "pages", + "paint-order", + "paintOrder", + "paintRequests", + "paintType", + "paintWorklet", + "palette", + "pan", + "panningModel", + "parameters", + "parent", + "parentElement", + "parentNode", + "parentRule", + "parentStyleSheet", + "parentTextEdit", + "parentWindow", + "parse", + "parseAll", + "parseFloat", + "parseFromString", + "parseInt", + "part", + "participants", + "passive", + "password", + "pasteHTML", + "path", + "pathLength", + "pathSegList", + "pathSegType", + "pathSegTypeAsLetter", + "pathname", + "pattern", + "patternContentUnits", + "patternMismatch", + "patternTransform", + "patternUnits", + "pause", + "pauseAnimations", + "pauseOnExit", + "pauseTransformFeedback", + "paused", + "payerEmail", + "payerName", + "payerPhone", + "paymentManager", + "pc", + "peerIdentity", + "pending", + "pendingLocalDescription", + "pendingRemoteDescription", + "percent", + "performance", + "periodicSync", + "permission", + "permissionState", + "permissions", + "persist", + "persisted", + "personalbar", + "perspective", + "perspective-origin", + "perspectiveOrigin", + "perspectiveOriginX", + "perspectiveOriginY", + "phone", + "phoneticFamilyName", + "phoneticGivenName", + "photo", + "pictureInPictureElement", + "pictureInPictureEnabled", + "pictureInPictureWindow", + "ping", + "pipeThrough", + "pipeTo", + "pitch", + "pixelBottom", + "pixelDepth", + "pixelHeight", + "pixelLeft", + "pixelRight", + "pixelStorei", + "pixelTop", + "pixelUnitToMillimeterX", + "pixelUnitToMillimeterY", + "pixelWidth", + "place-content", + "place-items", + "place-self", + "placeContent", + "placeItems", + "placeSelf", + "placeholder", + "platform", + "platforms", + "play", + "playEffect", + "playState", + "playbackRate", + "playbackState", + "playbackTime", + "played", + "playoutDelayHint", + "playsInline", + "plugins", + "pluginspage", + "pname", + "pointer-events", + "pointerBeforeReferenceNode", + "pointerEnabled", + "pointerEvents", + "pointerId", + "pointerLockElement", + "pointerType", + "points", + "pointsAtX", + "pointsAtY", + "pointsAtZ", + "polygonOffset", + "pop", + "populateMatrix", + "popupWindowFeatures", + "popupWindowName", + "popupWindowURI", + "port", + "port1", + "port2", + "ports", + "posBottom", + "posHeight", + "posLeft", + "posRight", + "posTop", + "posWidth", + "pose", + "position", + "positionAlign", + "positionX", + "positionY", + "positionZ", + "postError", + "postMessage", + "postalCode", + "poster", + "pow", + "powerEfficient", + "powerOff", + "preMultiplySelf", + "precision", + "preferredStyleSheetSet", + "preferredStylesheetSet", + "prefix", + "preload", + "prepend", + "presentation", + "preserveAlpha", + "preserveAspectRatio", + "preserveAspectRatioString", + "pressed", + "pressure", + "prevValue", + "preventDefault", + "preventExtensions", + "preventSilentAccess", + "previousElementSibling", + "previousNode", + "previousPage", + "previousRect", + "previousScale", + "previousSibling", + "previousTranslate", + "primaryKey", + "primitiveType", + "primitiveUnits", + "principals", + "print", + "priority", + "privateKey", + "probablySupportsContext", + "process", + "processIceMessage", + "processingEnd", + "processingStart", + "product", + "productId", + "productName", + "productSub", + "profile", + "profileEnd", + "profiles", + "projectionMatrix", + "promise", + "prompt", + "properties", + "propertyIsEnumerable", + "propertyName", + "protocol", + "protocolLong", + "prototype", + "provider", + "pseudoClass", + "pseudoElement", + "pt", + "publicId", + "publicKey", + "published", + "pulse", + "push", + "pushManager", + "pushNotification", + "pushState", + "put", + "putImageData", + "px", + "quadraticCurveTo", + "qualifier", + "quaternion", + "query", + "queryCommandEnabled", + "queryCommandIndeterm", + "queryCommandState", + "queryCommandSupported", + "queryCommandText", + "queryCommandValue", + "querySelector", + "querySelectorAll", + "queryUsageAndQuota", + "queueMicrotask", + "quote", + "quotes", + "r", + "r1", + "r2", + "race", + "rad", + "radiogroup", + "radiusX", + "radiusY", + "random", + "range", + "rangeCount", + "rangeMax", + "rangeMin", + "rangeOffset", + "rangeOverflow", + "rangeParent", + "rangeUnderflow", + "rate", + "ratio", + "raw", + "rawId", + "read", + "readAsArrayBuffer", + "readAsBinaryString", + "readAsBlob", + "readAsDataURL", + "readAsText", + "readBuffer", + "readEntries", + "readOnly", + "readPixels", + "readReportRequested", + "readText", + "readTransaction", + "readValue", + "readable", + "ready", + "readyState", + "reason", + "reboot", + "receivedAlert", + "receivedTime", + "receiver", + "receivers", + "recipient", + "reconnect", + "record", + "recordEnd", + "recordNumber", + "recordsAvailable", + "recordset", + "rect", + "red", + "redEyeReduction", + "redirect", + "redirectCount", + "redirectEnd", + "redirectStart", + "redirected", + "reduce", + "reduceRight", + "reduction", + "refDistance", + "refX", + "refY", + "referenceNode", + "referenceSpace", + "referrer", + "referrerPolicy", + "refresh", + "region", + "regionAnchorX", + "regionAnchorY", + "regionId", + "regions", + "register", + "registerContentHandler", + "registerElement", + "registerProperty", + "registerProtocolHandler", + "reject", + "rel", + "relList", + "relatedAddress", + "relatedNode", + "relatedPort", + "relatedTarget", + "release", + "releaseCapture", + "releaseEvents", + "releaseInterface", + "releaseLock", + "releasePointerCapture", + "releaseShaderCompiler", + "reliable", + "reliableWrite", + "reload", + "rem", + "remainingSpace", + "remote", + "remoteDescription", + "remove", + "removeAllRanges", + "removeAttribute", + "removeAttributeNS", + "removeAttributeNode", + "removeBehavior", + "removeChild", + "removeCue", + "removeEventListener", + "removeFilter", + "removeImport", + "removeItem", + "removeListener", + "removeNamedItem", + "removeNamedItemNS", + "removeNode", + "removeParameter", + "removeProperty", + "removeRange", + "removeRegion", + "removeRule", + "removeRules", + "removeSiteSpecificTrackingException", + "removeSourceBuffer", + "removeStream", + "removeTrack", + "removeVariable", + "removeWakeLockListener", + "removeWebWideTrackingException", + "removed", + "removedNodes", + "renderHeight", + "renderState", + "renderTime", + "renderWidth", + "renderbufferStorage", + "renderbufferStorageMultisample", + "renderedBuffer", + "renderingMode", + "renotify", + "repeat", + "replace", + "replaceAdjacentText", + "replaceAll", + "replaceChild", + "replaceChildren", + "replaceData", + "replaceId", + "replaceItem", + "replaceNode", + "replaceState", + "replaceSync", + "replaceTrack", + "replaceWholeText", + "replaceWith", + "reportValidity", + "request", + "requestAnimationFrame", + "requestAutocomplete", + "requestData", + "requestDevice", + "requestFrame", + "requestFullscreen", + "requestHitTestSource", + "requestHitTestSourceForTransientInput", + "requestId", + "requestIdleCallback", + "requestMIDIAccess", + "requestMediaKeySystemAccess", + "requestPermission", + "requestPictureInPicture", + "requestPointerLock", + "requestPresent", + "requestQuota", + "requestReferenceSpace", + "requestSession", + "requestStart", + "requestStorageAccess", + "requestSubmit", + "requestTime", + "requestVideoFrameCallback", + "requestedLocale", + "requestingWindow", + "requireInteraction", + "required", + "requiredExtensions", + "requiredFeatures", + "reset", + "resetPose", + "resetTransform", + "resize", + "resizeBy", + "resizeTo", + "resolve", + "resolved", + "resolvedOptions", + "resource-history", + "resourcesFramesExpanded", + "response", + "responseBody", + "responseEnd", + "responseReady", + "responseStart", + "responseText", + "responseType", + "responseURL", + "responseXML", + "restartIce", + "restore", + "result", + "resultIndex", + "resultType", + "results", + "resume", + "resumeTransformFeedback", + "retry", + "returnValue", + "rev", + "reverse", + "reversed", + "revocable", + "revokeObjectURL", + "rgbColor", + "right", + "rightContext", + "rightDegrees", + "rightMargin", + "rightProjectionMatrix", + "rightViewMatrix", + "role", + "rolloffFactor", + "root", + "rootBounds", + "rootElement", + "rootMargin", + "rotate", + "rotateAxisAngle", + "rotateAxisAngleSelf", + "rotateFromVector", + "rotateFromVectorSelf", + "rotateSelf", + "rotation", + "rotationAngle", + "rotationRate", + "round", + "row-gap", + "rowGap", + "rowIndex", + "rowSpan", + "rows", + "rowsAffected", + "rtcpTransport", + "rtt", + "ruby-align", + "ruby-position", + "rubyAlign", + "rubyOverhang", + "rubyPosition", + "rules", + "runningState", + "runtime", + "runtimeStyle", + "rx", + "ry", + "s", + "safari", + "sample", + "sampleCoverage", + "sampleRate", + "samplerParameterf", + "samplerParameteri", + "sandbox", + "save", + "saveData", + "scale", + "scale3d", + "scale3dSelf", + "scaleNonUniform", + "scaleNonUniformSelf", + "scaleSelf", + "scheme", + "scissor", + "scope", + "scopeName", + "scoped", + "screen", + "screenBrightness", + "screenEnabled", + "screenLeft", + "screenPixelToMillimeterX", + "screenPixelToMillimeterY", + "screenTop", + "screenX", + "screenY", + "script", + "scriptURL", + "scripts", + "scroll", + "scroll-behavior", + "scroll-margin", + "scroll-margin-block", + "scroll-margin-block-end", + "scroll-margin-block-start", + "scroll-margin-bottom", + "scroll-margin-inline", + "scroll-margin-inline-end", + "scroll-margin-inline-start", + "scroll-margin-left", + "scroll-margin-right", + "scroll-margin-top", + "scroll-padding", + "scroll-padding-block", + "scroll-padding-block-end", + "scroll-padding-block-start", + "scroll-padding-bottom", + "scroll-padding-inline", + "scroll-padding-inline-end", + "scroll-padding-inline-start", + "scroll-padding-left", + "scroll-padding-right", + "scroll-padding-top", + "scroll-snap-align", + "scroll-snap-coordinate", + "scroll-snap-destination", + "scroll-snap-points-x", + "scroll-snap-points-y", + "scroll-snap-type", + "scroll-snap-type-x", + "scroll-snap-type-y", + "scrollAmount", + "scrollBehavior", + "scrollBy", + "scrollByLines", + "scrollByPages", + "scrollDelay", + "scrollHeight", + "scrollIntoView", + "scrollIntoViewIfNeeded", + "scrollLeft", + "scrollLeftMax", + "scrollMargin", + "scrollMarginBlock", + "scrollMarginBlockEnd", + "scrollMarginBlockStart", + "scrollMarginBottom", + "scrollMarginInline", + "scrollMarginInlineEnd", + "scrollMarginInlineStart", + "scrollMarginLeft", + "scrollMarginRight", + "scrollMarginTop", + "scrollMaxX", + "scrollMaxY", + "scrollPadding", + "scrollPaddingBlock", + "scrollPaddingBlockEnd", + "scrollPaddingBlockStart", + "scrollPaddingBottom", + "scrollPaddingInline", + "scrollPaddingInlineEnd", + "scrollPaddingInlineStart", + "scrollPaddingLeft", + "scrollPaddingRight", + "scrollPaddingTop", + "scrollRestoration", + "scrollSnapAlign", + "scrollSnapCoordinate", + "scrollSnapDestination", + "scrollSnapMargin", + "scrollSnapMarginBottom", + "scrollSnapMarginLeft", + "scrollSnapMarginRight", + "scrollSnapMarginTop", + "scrollSnapPointsX", + "scrollSnapPointsY", + "scrollSnapStop", + "scrollSnapType", + "scrollSnapTypeX", + "scrollSnapTypeY", + "scrollTo", + "scrollTop", + "scrollTopMax", + "scrollWidth", + "scrollX", + "scrollY", + "scrollbar-color", + "scrollbar-width", + "scrollbar3dLightColor", + "scrollbarArrowColor", + "scrollbarBaseColor", + "scrollbarColor", + "scrollbarDarkShadowColor", + "scrollbarFaceColor", + "scrollbarHighlightColor", + "scrollbarShadowColor", + "scrollbarTrackColor", + "scrollbarWidth", + "scrollbars", + "scrolling", + "scrollingElement", + "sctp", + "sctpCauseCode", + "sdp", + "sdpLineNumber", + "sdpMLineIndex", + "sdpMid", + "seal", + "search", + "searchBox", + "searchBoxJavaBridge_", + "searchParams", + "second", + "sectionRowIndex", + "secureConnectionStart", + "security", + "seed", + "seekToNextFrame", + "seekable", + "seeking", + "select", + "selectAllChildren", + "selectAlternateInterface", + "selectConfiguration", + "selectNode", + "selectNodeContents", + "selectNodes", + "selectSingleNode", + "selectSubString", + "selected", + "selectedIndex", + "selectedOption", + "selectedOptions", + "selectedStyleSheetSet", + "selectedStylesheetSet", + "selection", + "selectionDirection", + "selectionEnd", + "selectionStart", + "selector", + "selectorText", + "self", + "send", + "sendAsBinary", + "sendBeacon", + "sendMessage", + "sender", + "sensitivity", + "sentAlert", + "sentTimestamp", + "separator", + "serialNumber", + "serializeToString", + "serverTiming", + "service", + "serviceWorker", + "session", + "sessionId", + "sessionStorage", + "set", + "setActionHandler", + "setActive", + "setAlpha", + "setAppBadge", + "setAttribute", + "setAttributeNS", + "setAttributeNode", + "setAttributeNodeNS", + "setBaseAndExtent", + "setBigInt64", + "setBigUint64", + "setBingCurrentSearchDefault", + "setCapture", + "setCodecPreferences", + "setColor", + "setCompositeOperation", + "setConfiguration", + "setCurrentTime", + "setCustomValidity", + "setData", + "setDate", + "setDirection", + "setDragImage", + "setEnd", + "setEndAfter", + "setEndBefore", + "setEndPoint", + "setFillColor", + "setFilterRes", + "setFloat32", + "setFloat64", + "setFloatValue", + "setFormValue", + "setFullYear", + "setHeaderValue", + "setHours", + "setIdentityProvider", + "setImmediate", + "setInt16", + "setInt32", + "setInt8", + "setInterval", + "setItem", + "setKeyframes", + "setLineCap", + "setLineDash", + "setLineJoin", + "setLineWidth", + "setLiveSeekableRange", + "setLocalDescription", + "setMatrix", + "setMatrixValue", + "setMediaKeys", + "setMilliseconds", + "setMinutes", + "setMiterLimit", + "setMonth", + "setNamedItem", + "setNamedItemNS", + "setNonUserCodeExceptions", + "setOrientToAngle", + "setOrientToAuto", + "setOrientation", + "setOverrideHistoryNavigationMode", + "setPaint", + "setParameter", + "setParameters", + "setPeriodicWave", + "setPointerCapture", + "setPosition", + "setPositionState", + "setPreference", + "setProperty", + "setPrototypeOf", + "setRGBColor", + "setRGBColorICCColor", + "setRadius", + "setRangeText", + "setRemoteDescription", + "setRequestHeader", + "setResizable", + "setResourceTimingBufferSize", + "setRotate", + "setScale", + "setSeconds", + "setSelectionRange", + "setServerCertificate", + "setShadow", + "setSinkId", + "setSkewX", + "setSkewY", + "setStart", + "setStartAfter", + "setStartBefore", + "setStdDeviation", + "setStreams", + "setStringValue", + "setStrokeColor", + "setSuggestResult", + "setTargetAtTime", + "setTargetValueAtTime", + "setTime", + "setTimeout", + "setTransform", + "setTranslate", + "setUTCDate", + "setUTCFullYear", + "setUTCHours", + "setUTCMilliseconds", + "setUTCMinutes", + "setUTCMonth", + "setUTCSeconds", + "setUint16", + "setUint32", + "setUint8", + "setUri", + "setValidity", + "setValueAtTime", + "setValueCurveAtTime", + "setVariable", + "setVelocity", + "setVersion", + "setYear", + "settingName", + "settingValue", + "sex", + "shaderSource", + "shadowBlur", + "shadowColor", + "shadowOffsetX", + "shadowOffsetY", + "shadowRoot", + "shape", + "shape-image-threshold", + "shape-margin", + "shape-outside", + "shape-rendering", + "shapeImageThreshold", + "shapeMargin", + "shapeOutside", + "shapeRendering", + "sheet", + "shift", + "shiftKey", + "shiftLeft", + "shippingAddress", + "shippingOption", + "shippingType", + "show", + "showHelp", + "showModal", + "showModalDialog", + "showModelessDialog", + "showNotification", + "sidebar", + "sign", + "signal", + "signalingState", + "signature", + "silent", + "sin", + "singleNodeValue", + "sinh", + "sinkId", + "sittingToStandingTransform", + "size", + "sizeToContent", + "sizeX", + "sizeZ", + "sizes", + "skewX", + "skewXSelf", + "skewY", + "skewYSelf", + "slice", + "slope", + "slot", + "small", + "smil", + "smooth", + "smoothingTimeConstant", + "snapToLines", + "snapshotItem", + "snapshotLength", + "some", + "sort", + "sortingCode", + "source", + "sourceBuffer", + "sourceBuffers", + "sourceCapabilities", + "sourceFile", + "sourceIndex", + "sourceURL", + "sources", + "spacing", + "span", + "speak", + "speakAs", + "speaking", + "species", + "specified", + "specularConstant", + "specularExponent", + "speechSynthesis", + "speed", + "speedOfSound", + "spellcheck", + "splice", + "split", + "splitText", + "spreadMethod", + "sqrt", + "src", + "srcElement", + "srcFilter", + "srcObject", + "srcUrn", + "srcdoc", + "srclang", + "srcset", + "stack", + "stackTraceLimit", + "stacktrace", + "stageParameters", + "standalone", + "standby", + "start", + "startContainer", + "startE", + "startIce", + "startLoadTime", + "startMessages", + "startNotifications", + "startOffset", + "startRendering", + "startSoftwareUpdate", + "startTime", + "startsWith", + "state", + "status", + "statusCode", + "statusMessage", + "statusText", + "statusbar", + "stdDeviationX", + "stdDeviationY", + "stencilFunc", + "stencilFuncSeparate", + "stencilMask", + "stencilMaskSeparate", + "stencilOp", + "stencilOpSeparate", + "step", + "stepDown", + "stepMismatch", + "stepUp", + "sticky", + "stitchTiles", + "stop", + "stop-color", + "stop-opacity", + "stopColor", + "stopImmediatePropagation", + "stopNotifications", + "stopOpacity", + "stopPropagation", + "stopped", + "storage", + "storageArea", + "storageName", + "storageStatus", + "store", + "storeSiteSpecificTrackingException", + "storeWebWideTrackingException", + "stpVersion", + "stream", + "streams", + "strength", + "stretch", + "strike", + "stringValue", + "stringify", + "stroke", + "stroke-dasharray", + "stroke-dashoffset", + "stroke-linecap", + "stroke-linejoin", + "stroke-miterlimit", + "stroke-opacity", + "stroke-width", + "strokeColor", + "strokeDasharray", + "strokeDashoffset", + "strokeLinecap", + "strokeLinejoin", + "strokeMiterlimit", + "strokeOpacity", + "strokeRect", + "strokeStyle", + "strokeText", + "strokeWidth", + "style", + "styleFloat", + "styleMap", + "styleMedia", + "styleSheet", + "styleSheetSets", + "styleSheets", + "sub", + "subarray", + "subject", + "submit", + "submitFrame", + "submitter", + "subscribe", + "substr", + "substring", + "substringData", + "subtle", + "subtree", + "suffix", + "suffixes", + "summary", + "sup", + "supported", + "supportedContentEncodings", + "supportedEntryTypes", + "supportedLocalesOf", + "supports", + "supportsSession", + "surfaceScale", + "surroundContents", + "suspend", + "suspendRedraw", + "swapCache", + "swapNode", + "sweepFlag", + "symbols", + "sync", + "sysexEnabled", + "system", + "systemCode", + "systemId", + "systemLanguage", + "systemXDPI", + "systemYDPI", + "tBodies", + "tFoot", + "tHead", + "tabIndex", + "tabSize", + "table", + "table-layout", + "tableLayout", + "tableValues", + "tag", + "tagName", + "tagUrn", + "tags", + "taintEnabled", + "takeHeapSnapshot", + "takePhoto", + "takeRecords", + "tan", + "tangentialPressure", + "tanh", + "target", + "targetElement", + "targetRayMode", + "targetRaySpace", + "targetTouches", + "targetX", + "targetY", + "tcpType", + "tee", + "tel", + "terminate", + "test", + "texImage2D", + "texImage3D", + "texParameterf", + "texParameteri", + "texStorage2D", + "texStorage3D", + "texSubImage2D", + "texSubImage3D", + "text", + "text-align", + "text-align-last", + "text-anchor", + "text-combine-upright", + "text-decoration", + "text-decoration-color", + "text-decoration-line", + "text-decoration-skip-ink", + "text-decoration-style", + "text-decoration-thickness", + "text-emphasis", + "text-emphasis-color", + "text-emphasis-position", + "text-emphasis-style", + "text-indent", + "text-justify", + "text-orientation", + "text-overflow", + "text-rendering", + "text-shadow", + "text-transform", + "text-underline-offset", + "text-underline-position", + "text/pdf", + "textAlign", + "textAlignLast", + "textAnchor", + "textAutospace", + "textBaseline", + "textCombineUpright", + "textContent", + "textDecoration", + "textDecorationBlink", + "textDecorationColor", + "textDecorationLine", + "textDecorationLineThrough", + "textDecorationNone", + "textDecorationOverline", + "textDecorationSkipInk", + "textDecorationStyle", + "textDecorationThickness", + "textDecorationUnderline", + "textEmphasis", + "textEmphasisColor", + "textEmphasisPosition", + "textEmphasisStyle", + "textIndent", + "textJustify", + "textJustifyTrim", + "textKashida", + "textKashidaSpace", + "textLength", + "textOrientation", + "textOverflow", + "textRendering", + "textShadow", + "textSizeAdjust", + "textTracks", + "textTransform", + "textUnderlineOffset", + "textUnderlinePosition", + "then", + "threadId", + "threshold", + "thresholds", + "tiltX", + "tiltY", + "time", + "timeEnd", + "timeLog", + "timeOrigin", + "timeRemaining", + "timeStamp", + "timeZone", + "timeZoneName", + "timecode", + "timeline", + "timelineEnd", + "timelineTime", + "timeout", + "timestamp", + "timestampOffset", + "timing", + "title", + "to", + "toArray", + "toBlob", + "toDataURL", + "toDateString", + "toElement", + "toExponential", + "toFixed", + "toFloat32Array", + "toFloat64Array", + "toGMTString", + "toISOString", + "toJSON", + "toLocaleDateString", + "toLocaleFormat", + "toLocaleLowerCase", + "toLocaleString", + "toLocaleTimeString", + "toLocaleUpperCase", + "toLowerCase", + "toMatrix", + "toMethod", + "toPrecision", + "toPrimitive", + "toSdp", + "toSource", + "toStaticHTML", + "toString", + "toStringTag", + "toSum", + "toTimeString", + "toUTCString", + "toUpperCase", + "toggle", + "toggleAttribute", + "toggleLongPressEnabled", + "tone", + "toneBuffer", + "tooLong", + "tooShort", + "toolbar", + "top", + "topMargin", + "total", + "totalFrameDelay", + "totalJSHeapSize", + "totalSize", + "totalVideoFrames", + "touch-action", + "touchAction", + "touched", + "touches", + "trace", + "track", + "trackVisibility", + "tran", + "transaction", + "transactions", + "transceiver", + "transferControlToOffscreen", + "transferFromImageBitmap", + "transferImageBitmap", + "transferIn", + "transferOut", + "transferSize", + "transferToImageBitmap", + "transform", + "transform-box", + "transform-origin", + "transform-style", + "transformBox", + "transformFeedbackVaryings", + "transformOrigin", + "transformOriginX", + "transformOriginY", + "transformOriginZ", + "transformPoint", + "transformString", + "transformStyle", + "transformToDocument", + "transformToFragment", + "transition", + "transition-delay", + "transition-duration", + "transition-property", + "transition-timing-function", + "transitionDelay", + "transitionDuration", + "transitionProperty", + "transitionTimingFunction", + "translate", + "translateSelf", + "translationX", + "translationY", + "transport", + "trim", + "trimEnd", + "trimLeft", + "trimRight", + "trimStart", + "trueSpeed", + "trunc", + "truncate", + "trustedTypes", + "turn", + "twist", + "type", + "typeDetail", + "typeMismatch", + "typeMustMatch", + "types", + "tz", + "u2f", + "ubound", + "undefined", + "unescape", + "uneval", + "unicode", + "unicode-bidi", + "unicodeBidi", + "unicodeRange", + "uniform1f", + "uniform1fv", + "uniform1i", + "uniform1iv", + "uniform1ui", + "uniform1uiv", + "uniform2f", + "uniform2fv", + "uniform2i", + "uniform2iv", + "uniform2ui", + "uniform2uiv", + "uniform3f", + "uniform3fv", + "uniform3i", + "uniform3iv", + "uniform3ui", + "uniform3uiv", + "uniform4f", + "uniform4fv", + "uniform4i", + "uniform4iv", + "uniform4ui", + "uniform4uiv", + "uniformBlockBinding", + "uniformMatrix2fv", + "uniformMatrix2x3fv", + "uniformMatrix2x4fv", + "uniformMatrix3fv", + "uniformMatrix3x2fv", + "uniformMatrix3x4fv", + "uniformMatrix4fv", + "uniformMatrix4x2fv", + "uniformMatrix4x3fv", + "unique", + "uniqueID", + "uniqueNumber", + "unit", + "unitType", + "units", + "unloadEventEnd", + "unloadEventStart", + "unlock", + "unmount", + "unobserve", + "unpause", + "unpauseAnimations", + "unreadCount", + "unregister", + "unregisterContentHandler", + "unregisterProtocolHandler", + "unscopables", + "unselectable", + "unshift", + "unsubscribe", + "unsuspendRedraw", + "unsuspendRedrawAll", + "unwatch", + "unwrapKey", + "upDegrees", + "upX", + "upY", + "upZ", + "update", + "updateCommands", + "updateEnabled", + "updateIce", + "updateInterval", + "updatePlaybackRate", + "updateRenderState", + "updateSettings", + "updateTiming", + "updateViaCache", + "updateWith", + "updated", + "updating", + "upgrade", + "upload", + "uploadTotal", + "uploaded", + "upper", + "upperBound", + "upperOpen", + "uri", + "url", + "urn", + "urns", + "usage", + "usages", + "usb", + "usbVersionMajor", + "usbVersionMinor", + "usbVersionSubminor", + "useCurrentView", + "useGrouping", + "useMap", + "useProgram", + "usedJSHeapSize", + "usedSpace", + "user-select", + "userActivation", + "userAgent", + "userChoice", + "userHandle", + "userHint", + "userLanguage", + "userProfile", + "userSelect", + "userVisibleOnly", + "userZoom", + "username", + "usernameFragment", + "utterance", + "uuid", + "v8BreakIterator", + "v8Parse", + "vAlign", + "vLink", + "valid", + "validate", + "validateProgram", + "validationMessage", + "validity", + "value", + "valueAsDate", + "valueAsNumber", + "valueAsString", + "valueInSpecifiedUnits", + "valueMissing", + "valueOf", + "valueText", + "valueType", + "values", + "variable", + "variant", + "vector-effect", + "vectorEffect", + "velocityAngular", + "velocityExpansion", + "velocityX", + "velocityY", + "vendor", + "vendorId", + "vendorSub", + "verify", + "version", + "vertexAttrib1f", + "vertexAttrib1fv", + "vertexAttrib2f", + "vertexAttrib2fv", + "vertexAttrib3f", + "vertexAttrib3fv", + "vertexAttrib4f", + "vertexAttrib4fv", + "vertexAttribDivisor", + "vertexAttribDivisorANGLE", + "vertexAttribI4i", + "vertexAttribI4iv", + "vertexAttribI4ui", + "vertexAttribI4uiv", + "vertexAttribIPointer", + "vertexAttribPointer", + "vertical", + "vertical-align", + "verticalAlign", + "verticalOverflow", + "vh", + "vibrate", + "vibrationActuator", + "video/x-ms-asf", + "video/x-ms-asf-plugin", + "video/x-ms-wm", + "video/x-ms-wmv", + "video/x-ms-wvx", + "videoBitsPerSecond", + "videoHeight", + "videoTracks", + "videoWidth", + "view", + "viewBox", + "viewBoxString", + "viewTarget", + "viewTargetString", + "viewport", + "viewportAnchorX", + "viewportAnchorY", + "viewportElement", + "views", + "violatedDirective", + "visibility", + "visibilityState", + "visible", + "visualViewport", + "vlinkColor", + "vmax", + "vmin", + "voice", + "voiceURI", + "volume", + "vrml", + "vspace", + "vw", + "w", + "wait", + "waitSync", + "waiting", + "wake", + "wakeLock", + "wand", + "warn", + "wasAlternateProtocolAvailable", + "wasClean", + "wasDiscarded", + "wasFetchedViaSpdy", + "wasNpnNegotiated", + "watch", + "watchAvailability", + "watchPosition", + "webdriver", + "webkitAddKey", + "webkitAlignContent", + "webkitAlignItems", + "webkitAlignSelf", + "webkitAnimation", + "webkitAnimationDelay", + "webkitAnimationDirection", + "webkitAnimationDuration", + "webkitAnimationFillMode", + "webkitAnimationIterationCount", + "webkitAnimationName", + "webkitAnimationPlayState", + "webkitAnimationTimingFunction", + "webkitAppRegion", + "webkitAppearance", + "webkitAspectRatio", + "webkitAudioContext", + "webkitAudioDecodedByteCount", + "webkitAudioPannerNode", + "webkitBackdropFilter", + "webkitBackfaceVisibility", + "webkitBackground", + "webkitBackgroundAttachment", + "webkitBackgroundClip", + "webkitBackgroundColor", + "webkitBackgroundComposite", + "webkitBackgroundImage", + "webkitBackgroundOrigin", + "webkitBackgroundPosition", + "webkitBackgroundPositionX", + "webkitBackgroundPositionY", + "webkitBackgroundRepeat", + "webkitBackgroundSize", + "webkitBackingStorePixelRatio", + "webkitBorderAfter", + "webkitBorderAfterColor", + "webkitBorderAfterStyle", + "webkitBorderAfterWidth", + "webkitBorderBefore", + "webkitBorderBeforeColor", + "webkitBorderBeforeStyle", + "webkitBorderBeforeWidth", + "webkitBorderBottomLeftRadius", + "webkitBorderBottomRightRadius", + "webkitBorderEnd", + "webkitBorderEndColor", + "webkitBorderEndStyle", + "webkitBorderEndWidth", + "webkitBorderFit", + "webkitBorderHorizontalSpacing", + "webkitBorderImage", + "webkitBorderImageOutset", + "webkitBorderImageRepeat", + "webkitBorderImageSlice", + "webkitBorderImageSource", + "webkitBorderImageWidth", + "webkitBorderRadius", + "webkitBorderStart", + "webkitBorderStartColor", + "webkitBorderStartStyle", + "webkitBorderStartWidth", + "webkitBorderTopLeftRadius", + "webkitBorderTopRightRadius", + "webkitBorderVerticalSpacing", + "webkitBoxAlign", + "webkitBoxDecorationBreak", + "webkitBoxDirection", + "webkitBoxFlex", + "webkitBoxFlexGroup", + "webkitBoxLines", + "webkitBoxOrdinalGroup", + "webkitBoxOrient", + "webkitBoxPack", + "webkitBoxReflect", + "webkitBoxShadow", + "webkitBoxSizing", + "webkitCancelAnimationFrame", + "webkitCancelFullScreen", + "webkitCancelKeyRequest", + "webkitCancelRequestAnimationFrame", + "webkitClearResourceTimings", + "webkitClipPath", + "webkitClosedCaptionsVisible", + "webkitColumnAxis", + "webkitColumnBreakAfter", + "webkitColumnBreakBefore", + "webkitColumnBreakInside", + "webkitColumnCount", + "webkitColumnGap", + "webkitColumnProgression", + "webkitColumnRule", + "webkitColumnRuleColor", + "webkitColumnRuleStyle", + "webkitColumnRuleWidth", + "webkitColumnSpan", + "webkitColumnWidth", + "webkitColumns", + "webkitConvertPointFromNodeToPage", + "webkitConvertPointFromPageToNode", + "webkitCreateShadowRoot", + "webkitCurrentFullScreenElement", + "webkitCurrentPlaybackTargetIsWireless", + "webkitCursorVisibility", + "webkitDashboardRegion", + "webkitDecodedFrameCount", + "webkitDirectionInvertedFromDevice", + "webkitDisplayingFullscreen", + "webkitDroppedFrameCount", + "webkitEnterFullScreen", + "webkitEnterFullscreen", + "webkitEntries", + "webkitExitFullScreen", + "webkitExitFullscreen", + "webkitExitPointerLock", + "webkitFilter", + "webkitFlex", + "webkitFlexBasis", + "webkitFlexDirection", + "webkitFlexFlow", + "webkitFlexGrow", + "webkitFlexShrink", + "webkitFlexWrap", + "webkitFontFeatureSettings", + "webkitFontKerning", + "webkitFontSizeDelta", + "webkitFontSmoothing", + "webkitForce", + "webkitFullScreenKeyboardInputAllowed", + "webkitFullscreenElement", + "webkitFullscreenEnabled", + "webkitGenerateKeyRequest", + "webkitGetAsEntry", + "webkitGetDatabaseNames", + "webkitGetEntries", + "webkitGetEntriesByName", + "webkitGetEntriesByType", + "webkitGetFlowByName", + "webkitGetGamepads", + "webkitGetImageDataHD", + "webkitGetNamedFlows", + "webkitGetRegionFlowRanges", + "webkitGetUserMedia", + "webkitHasClosedCaptions", + "webkitHidden", + "webkitHighlight", + "webkitHyphenateCharacter", + "webkitHyphenateLimitAfter", + "webkitHyphenateLimitBefore", + "webkitHyphenateLimitLines", + "webkitHyphens", + "webkitIDBCursor", + "webkitIDBDatabase", + "webkitIDBDatabaseError", + "webkitIDBDatabaseException", + "webkitIDBFactory", + "webkitIDBIndex", + "webkitIDBKeyRange", + "webkitIDBObjectStore", + "webkitIDBRequest", + "webkitIDBTransaction", + "webkitImageSmoothingEnabled", + "webkitIndexedDB", + "webkitInitMessageEvent", + "webkitInitialLetter", + "webkitIsFullScreen", + "webkitJustifyContent", + "webkitKeys", + "webkitLineAlign", + "webkitLineBoxContain", + "webkitLineBreak", + "webkitLineClamp", + "webkitLineDash", + "webkitLineDashOffset", + "webkitLineGrid", + "webkitLineSnap", + "webkitLocale", + "webkitLockOrientation", + "webkitLogicalHeight", + "webkitLogicalWidth", + "webkitMarginAfter", + "webkitMarginAfterCollapse", + "webkitMarginBefore", + "webkitMarginBeforeCollapse", + "webkitMarginBottomCollapse", + "webkitMarginCollapse", + "webkitMarginEnd", + "webkitMarginStart", + "webkitMarginTopCollapse", + "webkitMarquee", + "webkitMarqueeDirection", + "webkitMarqueeIncrement", + "webkitMarqueeRepetition", + "webkitMarqueeSpeed", + "webkitMarqueeStyle", + "webkitMask", + "webkitMaskBoxImage", + "webkitMaskBoxImageOutset", + "webkitMaskBoxImageRepeat", + "webkitMaskBoxImageSlice", + "webkitMaskBoxImageSource", + "webkitMaskBoxImageWidth", + "webkitMaskClip", + "webkitMaskComposite", + "webkitMaskImage", + "webkitMaskOrigin", + "webkitMaskPosition", + "webkitMaskPositionX", + "webkitMaskPositionY", + "webkitMaskRepeat", + "webkitMaskRepeatX", + "webkitMaskRepeatY", + "webkitMaskSize", + "webkitMaskSourceType", + "webkitMatchesSelector", + "webkitMaxLogicalHeight", + "webkitMaxLogicalWidth", + "webkitMediaStream", + "webkitMinLogicalHeight", + "webkitMinLogicalWidth", + "webkitNbspMode", + "webkitNotifications", + "webkitOfflineAudioContext", + "webkitOpacity", + "webkitOrder", + "webkitOrientation", + "webkitPaddingAfter", + "webkitPaddingBefore", + "webkitPaddingEnd", + "webkitPaddingStart", + "webkitPeerConnection00", + "webkitPersistentStorage", + "webkitPerspective", + "webkitPerspectiveOrigin", + "webkitPerspectiveOriginX", + "webkitPerspectiveOriginY", + "webkitPointerLockElement", + "webkitPostMessage", + "webkitPreservesPitch", + "webkitPrintColorAdjust", + "webkitPutImageDataHD", + "webkitRTCPeerConnection", + "webkitRegionOverset", + "webkitRelativePath", + "webkitRequestAnimationFrame", + "webkitRequestFileSystem", + "webkitRequestFullScreen", + "webkitRequestFullscreen", + "webkitRequestPointerLock", + "webkitResolveLocalFileSystemURL", + "webkitRtlOrdering", + "webkitRubyPosition", + "webkitSetMediaKeys", + "webkitSetResourceTimingBufferSize", + "webkitShadowRoot", + "webkitShapeImageThreshold", + "webkitShapeMargin", + "webkitShapeOutside", + "webkitShowPlaybackTargetPicker", + "webkitSlice", + "webkitSpeechGrammar", + "webkitSpeechGrammarList", + "webkitSpeechRecognition", + "webkitSpeechRecognitionError", + "webkitSpeechRecognitionEvent", + "webkitStorageInfo", + "webkitSupportsFullscreen", + "webkitSvgShadow", + "webkitTapHighlightColor", + "webkitTemporaryStorage", + "webkitTextCombine", + "webkitTextDecoration", + "webkitTextDecorationColor", + "webkitTextDecorationLine", + "webkitTextDecorationSkip", + "webkitTextDecorationStyle", + "webkitTextDecorationsInEffect", + "webkitTextEmphasis", + "webkitTextEmphasisColor", + "webkitTextEmphasisPosition", + "webkitTextEmphasisStyle", + "webkitTextFillColor", + "webkitTextOrientation", + "webkitTextSecurity", + "webkitTextSizeAdjust", + "webkitTextStroke", + "webkitTextStrokeColor", + "webkitTextStrokeWidth", + "webkitTextUnderlinePosition", + "webkitTextZoom", + "webkitTransform", + "webkitTransformOrigin", + "webkitTransformOriginX", + "webkitTransformOriginY", + "webkitTransformOriginZ", + "webkitTransformStyle", + "webkitTransition", + "webkitTransitionDelay", + "webkitTransitionDuration", + "webkitTransitionProperty", + "webkitTransitionTimingFunction", + "webkitURL", + "webkitUnlockOrientation", + "webkitUserDrag", + "webkitUserModify", + "webkitUserSelect", + "webkitVideoDecodedByteCount", + "webkitVisibilityState", + "webkitWirelessVideoPlaybackDisabled", + "webkitWritingMode", + "webkitdirectory", + "webkitdropzone", + "webstore", + "weekday", + "weight", + "whatToShow", + "wheelDelta", + "wheelDeltaX", + "wheelDeltaY", + "whenDefined", + "which", + "white-space", + "whiteSpace", + "wholeText", + "widows", + "width", + "will-change", + "willChange", + "willValidate", + "window", + "withCredentials", + "word-break", + "word-spacing", + "word-wrap", + "wordBreak", + "wordSpacing", + "wordWrap", + "workerStart", + "wrap", + "wrapKey", + "writable", + "writableAuxiliaries", + "write", + "writeText", + "writeValue", + "writeWithoutResponse", + "writeln", + "writing-mode", + "writingMode", + "x", + "x1", + "x2", + "xChannelSelector", + "xmlEncoding", + "xmlStandalone", + "xmlVersion", + "xmlbase", + "xmllang", + "xmlspace", + "xor", + "xr", + "y", + "y1", + "y2", + "yChannelSelector", + "yandex", + "year", + "z", + "z-index", + "zIndex", + "zoom", + "zoomAndPan", + "zoomRectScreen" +] diff --git a/semag/emulatorjs/data/minify/node_modules/uglify-js/tools/exports.js b/semag/emulatorjs/data/minify/node_modules/uglify-js/tools/exports.js new file mode 100644 index 00000000..1d2d510e --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/uglify-js/tools/exports.js @@ -0,0 +1,8 @@ +exports["Dictionary"] = Dictionary; +exports["is_statement"] = is_statement; +exports["List"] = List; +exports["minify"] = minify; +exports["parse"] = parse; +exports["push_uniq"] = push_uniq; +exports["TreeTransformer"] = TreeTransformer; +exports["TreeWalker"] = TreeWalker; diff --git a/semag/emulatorjs/data/minify/node_modules/uglify-js/tools/node.js b/semag/emulatorjs/data/minify/node_modules/uglify-js/tools/node.js new file mode 100644 index 00000000..7ca19829 --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/uglify-js/tools/node.js @@ -0,0 +1,110 @@ +var fs = require("fs"); + +exports.FILES = [ + require.resolve("../lib/utils.js"), + require.resolve("../lib/ast.js"), + require.resolve("../lib/transform.js"), + require.resolve("../lib/parse.js"), + require.resolve("../lib/scope.js"), + require.resolve("../lib/compress.js"), + require.resolve("../lib/output.js"), + require.resolve("../lib/sourcemap.js"), + require.resolve("../lib/mozilla-ast.js"), + require.resolve("../lib/propmangle.js"), + require.resolve("../lib/minify.js"), + require.resolve("./exports.js"), +]; + +new Function("domprops", "exports", function() { + var code = exports.FILES.map(function(file) { + return fs.readFileSync(file, "utf8"); + }); + code.push("exports.describe_ast = " + describe_ast.toString()); + return code.join("\n\n"); +}())(require("./domprops.json"), exports); + +function to_comment(value) { + if (typeof value != "string") value = JSON.stringify(value, function(key, value) { + return typeof value == "function" ? "<[ " + value + " ]>" : value; + }, 2); + return "// " + value.replace(/\n/g, "\n// "); +} + +if (+process.env["UGLIFY_BUG_REPORT"]) exports.minify = function(files, options) { + if (typeof options == "undefined") options = "<>"; + var code = [ + "// UGLIFY_BUG_REPORT", + to_comment(options), + ]; + if (typeof files == "string") { + code.push(""); + code.push("//-------------------------------------------------------------") + code.push("// INPUT CODE", files); + } else for (var name in files) { + code.push(""); + code.push("//-------------------------------------------------------------") + code.push(to_comment(name), files[name]); + } + if (options.sourceMap && options.sourceMap.url) { + code.push(""); + code.push("//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9"); + } + var result = { code: code.join("\n") }; + if (options.sourceMap) result.map = '{"version":3,"sources":[],"names":[],"mappings":""}'; + return result; +}; + +function describe_ast() { + var out = OutputStream({ beautify: true }); + doitem(AST_Node); + return out.get() + "\n"; + + function doitem(ctor) { + out.print("AST_" + ctor.TYPE); + var props = ctor.SELF_PROPS.filter(function(prop) { + return !/^\$/.test(prop); + }); + if (props.length > 0) { + out.space(); + out.with_parens(function() { + props.forEach(function(prop, i) { + if (i) out.space(); + out.print(prop); + }); + }); + } + if (ctor.documentation) { + out.space(); + out.print_string(ctor.documentation); + } + if (ctor.SUBCLASSES.length > 0) { + out.space(); + out.with_block(function() { + ctor.SUBCLASSES.sort(function(a, b) { + return a.TYPE < b.TYPE ? -1 : 1; + }).forEach(function(ctor, i) { + out.indent(); + doitem(ctor); + out.newline(); + }); + }); + } + } +} + +function infer_options(options) { + var result = exports.minify("", options); + return result.error && result.error.defs; +} + +exports.default_options = function() { + var defs = infer_options({ 0: 0 }); + Object.keys(defs).forEach(function(component) { + var options = {}; + options[component] = { 0: 0 }; + if (options = infer_options(options)) { + defs[component] = options; + } + }); + return defs; +}; diff --git a/semag/emulatorjs/data/minify/node_modules/uglify-js/tools/tty.js b/semag/emulatorjs/data/minify/node_modules/uglify-js/tools/tty.js new file mode 100644 index 00000000..395c48ec --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/uglify-js/tools/tty.js @@ -0,0 +1,22 @@ +// workaround for tty output truncation on Node.js +try { + // prevent buffer overflow and other asynchronous bugs + process.stdout._handle.setBlocking(true); + process.stderr._handle.setBlocking(true); +} catch (e) { + // ensure output buffers are flushed before process termination + var exit = process.exit; + process.exit = function() { + var args = [].slice.call(arguments); + process.once("uncaughtException", function() { + (function callback() { + if (process.stdout.bufferSize || process.stderr.bufferSize) { + setTimeout(callback, 1); + } else { + exit.apply(process, args); + } + })(); + }); + throw exit; + }; +} diff --git a/semag/emulatorjs/data/minify/node_modules/uglifycss/LICENSE b/semag/emulatorjs/data/minify/node_modules/uglifycss/LICENSE new file mode 100644 index 00000000..fe663ea1 --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/uglifycss/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) Franck Marcia + +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. \ No newline at end of file diff --git a/semag/emulatorjs/data/minify/node_modules/uglifycss/README.md b/semag/emulatorjs/data/minify/node_modules/uglifycss/README.md new file mode 100644 index 00000000..58ebe038 --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/uglifycss/README.md @@ -0,0 +1,75 @@ +UglifyCSS is a port of [YUI Compressor](https://github.com/yui/yuicompressor) to [NodeJS](http://nodejs.org) for its CSS part. Its name is a reference to the awesome [UglifyJS](https://github.com/mishoo/UglifyJS) but UglifyCSS is not a CSS parser. Like YUI CSS Compressor, it applies many regexp replacements. Note that a [port to JavaScript](https://github.com/yui/ycssmin) is also available in the YUI Compressor repository. + +UglifyCSS passes successfully the test suite of YUI compressor CSS. + +Be sure to submit valid CSS to UglifyCSS or you could get weird results. + +### Installation + +For a command line usage: +```sh +$ npm install uglifycss -g +``` + +For API usage: +```sh +$ npm install uglifycss +``` + +From Github: +```sh +$ git clone git://github.com/fmarcia/UglifyCSS.git +``` + +### Command line + +```sh +$ uglifycss [options] [filename] [...] > output +``` + +Options: + +* `--max-line-len n` adds a newline (approx.) every `n` characters; `0` means no newline and is the default value +* `--expand-vars` expands variables; by default, `@variables` blocks are preserved and `var(x)`s are not expanded +* `--ugly-comments` removes newlines within preserved comments; by default, newlines are preserved +* `--cute-comments` preserves newlines within and around preserved comments +* `--convert-urls d` converts relative urls using the `d` directory as location target +* `--debug` prints full error stack on error +* `--output f` puts the result in `f` file + +If no file name is specified, input is read from stdin. + +### API + +2 functions are provided: + +* `processString( content, options )` to process a given string +* `processFiles( [ filename1, ... ], options )` to process the concatenation of given files + +Options are identical to the command line: +* ` maxLineLen` for `--max-line-len n` +* ` expandVars` for `--expand-vars` +* ` uglyComments` for `--ugly-comments` +* ` cuteComments` for `--cute-comments` +* ` convertUrls` for `--convert-urls d` +* ` debug` for `--debug` + +Both functions return uglified css. + +#### Example + +```js +var uglifycss = require('uglifycss'); + +var uglified = uglifycss.processFiles( + [ 'file1', 'file2' ], + { maxLineLen: 500, expandVars: true } +); + +console.log(uglified); +``` + +### License + +UglifyCSS is MIT licensed. + diff --git a/semag/emulatorjs/data/minify/node_modules/uglifycss/index.js b/semag/emulatorjs/data/minify/node_modules/uglifycss/index.js new file mode 100644 index 00000000..45006ccc --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/uglifycss/index.js @@ -0,0 +1,27 @@ +/** + * UglifyCSS + * Port of YUI CSS Compressor to NodeJS + * Author: Franck Marcia - https://github.com/fmarcia + * MIT licenced + */ + +/** + * cssmin.js + * Author: Stoyan Stefanov - http://phpied.com/ + * This is a JavaScript port of the CSS minification tool + * distributed with YUICompressor, itself a port + * of the cssmin utility by Isaac Schlueter - http://foohack.com/ + * Permission is hereby granted to use the JavaScript version under the same + * conditions as the YUICompressor (original YUICompressor note below). + */ + +/** + * YUI Compressor + * http://developer.yahoo.com/yui/compressor/ + * Author: Julien Lecomte - http://www.julienlecomte.net/ + * Copyright (c) 2011 Yahoo! Inc. All rights reserved. + * The copyrights embodied in the content of this file are licensed + * by Yahoo! Inc. under the BSD (revised) open source license. + */ + +module.exports = require('./uglifycss-lib') diff --git a/semag/emulatorjs/data/minify/node_modules/uglifycss/package.json b/semag/emulatorjs/data/minify/node_modules/uglifycss/package.json new file mode 100644 index 00000000..e3ec1b8c --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/uglifycss/package.json @@ -0,0 +1,24 @@ +{ + "author": "Franck Marcia (https://github.com/fmarcia)", + "name": "uglifycss", + "description": "Port of YUI CSS Compressor to NodeJS", + "version": "0.0.29", + "keywords": [ + "css", + "stylesheet", + "uglify", + "minify" + ], + "engines": { "node": ">=6.4.0" }, + "license": "MIT", + "homepage": "https://github.com/fmarcia/uglifycss", + "bugs": "https://github.com/fmarcia/uglifycss/issues", + "repository": { + "type": "git", + "url": "git://github.com/fmarcia/uglifycss.git" + }, + "main": "./index.js", + "bin": { + "uglifycss" : "./uglifycss" + } +} diff --git a/semag/emulatorjs/data/minify/node_modules/uglifycss/uglifycss b/semag/emulatorjs/data/minify/node_modules/uglifycss/uglifycss new file mode 100644 index 00000000..0c339078 --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/uglifycss/uglifycss @@ -0,0 +1,148 @@ +#!/usr/bin/env node + +/** + * UglifyCSS + * Port of YUI CSS Compressor to NodeJS + * Author: Franck Marcia - https://github.com/fmarcia + * MIT licenced + */ + +/** + * cssmin.js + * Author: Stoyan Stefanov - http://phpied.com/ + * This is a JavaScript port of the CSS minification tool + * distributed with YUICompressor, itself a port + * of the cssmin utility by Isaac Schlueter - http://foohack.com/ + * Permission is hereby granted to use the JavaScript version under the same + * conditions as the YUICompressor (original YUICompressor note below). + */ + +/** + * YUI Compressor + * http://developer.yahoo.com/yui/compressor/ + * Author: Julien Lecomte - http://www.julienlecomte.net/ + * Copyright (c) 2011 Yahoo! Inc. All rights reserved. + * The copyrights embodied in the content of this file are licensed + * by Yahoo! Inc. under the BSD (revised) open source license. + */ + +const { defaultOptions, processString, processFiles } = require('./') +const { writeFileSync } = require('fs') + +const UGLIFYCSS_VERSION = '0.0.29' + +// Info namespace +const info = {} + +// Print usage +info.help = _ => { + console.log(` + Usage: uglifycss [options] file1.css [file2.css [...]] > output + options: + --max-line-len n add a newline every n characters + --expand-vars expand variables + --ugly-comments remove newlines within preserved comments + --cute-comments preserve newlines within and around preserved comments + --convert-urls d convert relative urls using the d directory as location target + --debug print full error stack on error + --output f put the result in f file + --help show this help + --version display version number` + .replace(/^\s+/gm, '') + ) +} + +// Print version +info.version = _ => { + console.log(`uglifycss ${UGLIFYCSS_VERSION}`) +} + +// Transform strings like "the-parameter" to "theParameter" +const par2var = param => + param.replace( + /-(.)/g, + (_, ch) => ch === '-' ? '' : ch.toUpperCase() + ) + + +// Parse parameters from command line +const parseArguments = argv => { + + const params = { + options: defaultOptions, + files: [] + } + + const len = argv.length + + for (let i = 2; i < len; i += 1) { + + // get "propertyName" from "--argument-name" + let v = par2var(argv[i]) + + // boolean parameters + if (typeof params.options[v] === 'boolean') { + params.options[v] = true + + // string parameter + } else if (typeof params.options[v] === 'string') { + params.options[v] = argv[i + 1] || '' + i += 1 + + // integer parameter + } else if (typeof params.options[v] !== 'undefined') { + params.options[v] = parseInt(argv[i + 1], 10) + i += 1 + + // help + } else if (argv[i] === '--help') { + return 'help' + + // version + } else if (argv[i] === '--version') { + return 'version' + + // file + } else { + params.files.push(argv[i]) + } + } + + return params +} + +// Entry +{ + // parameters + const params = parseArguments(process.argv) + + // info + if (params === 'help' || params === 'version') { + return info[params]() + } + + // files + if (params.files.length) { + const ugly = processFiles(params.files, params.options) + if (params.options.output) { + return writeFileSync(params.options.output, ugly) + } else { + return console.log(ugly) + } + } + + // no file, no stdin: help + if (process.stdin.isTTY) { + return info.help() + } + + // stdin + if (params.options.convertUrls) { + return console.error('uglifycss: stdin input and --convert-urls are not compatible') + } + let content = '' + process.stdin.on('data', part => content += part) + process.stdin.on('end', _ => + console.log(processString(content, params.options)) + ) +} diff --git a/semag/emulatorjs/data/minify/node_modules/uglifycss/uglifycss-lib.js b/semag/emulatorjs/data/minify/node_modules/uglifycss/uglifycss-lib.js new file mode 100644 index 00000000..19d686ea --- /dev/null +++ b/semag/emulatorjs/data/minify/node_modules/uglifycss/uglifycss-lib.js @@ -0,0 +1,857 @@ +/** + * UglifyCSS + * Port of YUI CSS Compressor to NodeJS + * Author: Franck Marcia - https://github.com/fmarcia + * MIT licenced + */ + +/** + * cssmin.js + * Author: Stoyan Stefanov - http://phpied.com/ + * This is a JavaScript port of the CSS minification tool + * distributed with YUICompressor, itself a port + * of the cssmin utility by Isaac Schlueter - http://foohack.com/ + * Permission is hereby granted to use the JavaScript version under the same + * conditions as the YUICompressor (original YUICompressor note below). + */ + +/** + * YUI Compressor + * http://developer.yahoo.com/yui/compressor/ + * Author: Julien Lecomte - http://www.julienlecomte.net/ + * Copyright (c) 2011 Yahoo! Inc. All rights reserved. + * The copyrights embodied in the content of this file are licensed + * by Yahoo! Inc. under the BSD (revised) open source license. + */ + + +const { readFileSync } = require('fs') +const { sep, resolve } = require('path') + +/** + * @type {string} - Output path separator + */ + +const SEP = '/' + +/** + * @type {string} - System path separator + */ + +const PATH_SEP = sep + +/** + * @type {string} - placeholder prefix + */ + +const ___PRESERVED_TOKEN_ = '___PRESERVED_TOKEN_' + +/** + * @typedef {object} options - UglifyCSS options + * @property {number} [maxLineLen=0] - Maximum line length of uglified CSS + * @property {boolean} [expandVars=false] - Expand variables + * @property {boolean} [uglyComments=false] - Removes newlines within preserved comments + * @property {boolean} [cuteComments=false] - Preserves newlines within and around preserved comments + * @property {string} [convertUrls=''] - Converts relative urls using the given directory as location target + * @property {boolean} [debug=false] - Prints full error stack on error + * @property {string} [output=''] - Output file name + */ + +/** + * @type {options} - UglifyCSS options + */ + +const defaultOptions = { + maxLineLen: 0, + expandVars: false, + uglyComments: false, + cuteComments: false, + convertUrls: '', + debug: false, + output: '' +} + +/** + * convertRelativeUrls converts relative urls and replaces them with tokens + * before we start compressing. It must be called *after* extractDataUrls + * + * @param {string} css - CSS content + * @param {options} options - UglifyCSS Options + * @param {string[]} preservedTokens - Global array of tokens to preserve + * + * @return {string} Processed css + */ + +function convertRelativeUrls(css, options, preservedTokens) { + + const pattern = /(url\s*\()\s*(["']?)/g + const maxIndex = css.length - 1 + const sb = [] + + let appendIndex = 0 + let match + + // Since we need to account for non-base64 data urls, we need to handle + // ' and ) being part of the data string. Hence switching to indexOf, + // to determine whether or not we have matching string terminators and + // handling sb appends directly, instead of using matcher.append* methods. + + while ((match = pattern.exec(css)) !== null) { + + let startIndex = match.index + match[1].length // 'url('.length() + let terminator = match[2] // ', " or empty (not quoted) + + if (terminator.length === 0) { + terminator = ')' + } + + let foundTerminator = false + + let endIndex = pattern.lastIndex - 1 + + while (foundTerminator === false && endIndex + 1 <= maxIndex) { + endIndex = css.indexOf(terminator, endIndex + 1) + + // endIndex == 0 doesn't really apply here + if ((endIndex > 0) && (css.charAt(endIndex - 1) !== '\\')) { + foundTerminator = true + if (')' != terminator) { + endIndex = css.indexOf(')', endIndex) + } + } + } + + // Enough searching, start moving stuff over to the buffer + sb.push(css.substring(appendIndex, match.index)) + + if (foundTerminator) { + + let token = css.substring(startIndex, endIndex).replace(/(^\s*|\s*$)/g, '') + if (token.slice(0, 19) !== ___PRESERVED_TOKEN_) { + + if (terminator === "'" || terminator === '"') { + token = token.slice(1, -1) + } else if (terminator === ')') { + terminator = '' + } + + let url + + if (options.convertUrls && token.charAt(0) !== SEP && token.slice(0, 7) !== 'http://' && token.slice(0, 8) !== 'https://') { + + // build path of detected urls + let target = options.target.slice() + + token = token.split(SEP).join(PATH_SEP) // assuming urls in css use '/' + url = resolve(options.source.join(PATH_SEP), token).split(PATH_SEP) + + let file = url.pop() + + // remove common part of both paths + while (target[0] === url[0]) { + target.shift() + url.shift() + } + + for (let i = 0, l = target.length; i < l; ++i) { + target[i] = '..' + } + url = terminator + [ ...target, ...url, file].join(SEP) + terminator + + } else { + url = terminator + token + terminator + } + + preservedTokens.push(url) + + let preserver = 'url(' + ___PRESERVED_TOKEN_ + (preservedTokens.length - 1) + '___)' + sb.push(preserver) + + } else { + sb.push(`url(${token})`) + } + + appendIndex = endIndex + 1 + + } else { + // No end terminator found, re-add the whole match. Should we throw/warn here? + sb.push(css.substring(match.index, pattern.lastIndex)) + appendIndex = pattern.lastIndex + } + } + + sb.push(css.substring(appendIndex)) + + return sb.join('') +} + +/** + * extractDataUrls replaces all data urls with tokens before we start + * compressing, to avoid performance issues running some of the subsequent + * regexes against large strings chunks. + * + * @param {string} css - CSS content + * @param {string[]} preservedTokens - Global array of tokens to preserve + * + * @return {string} Processed CSS + */ + +function extractDataUrls(css, preservedTokens) { + + // Leave data urls alone to increase parse performance. + const pattern = /url\(\s*(["']?)data\:/g + const maxIndex = css.length - 1 + const sb = [] + + let appendIndex = 0 + let match + + // Since we need to account for non-base64 data urls, we need to handle + // ' and ) being part of the data string. Hence switching to indexOf, + // to determine whether or not we have matching string terminators and + // handling sb appends directly, instead of using matcher.append* methods. + + while ((match = pattern.exec(css)) !== null) { + + let startIndex = match.index + 4 // 'url('.length() + let terminator = match[1] // ', " or empty (not quoted) + + if (terminator.length === 0) { + terminator = ')' + } + + let foundTerminator = false + let endIndex = pattern.lastIndex - 1 + + while (foundTerminator === false && endIndex + 1 <= maxIndex) { + endIndex = css.indexOf(terminator, endIndex + 1) + + // endIndex == 0 doesn't really apply here + if ((endIndex > 0) && (css.charAt(endIndex - 1) !== '\\')) { + foundTerminator = true + if (')' != terminator) { + endIndex = css.indexOf(')', endIndex) + } + } + } + + // Enough searching, start moving stuff over to the buffer + sb.push(css.substring(appendIndex, match.index)) + + if (foundTerminator) { + + let token = css.substring(startIndex, endIndex) + let parts = token.split(',') + if (parts.length > 1 && parts[0].slice(-7) == ';base64') { + token = token.replace(/\s+/g, '') + } else { + token = token.replace(/\n/g, ' ') + token = token.replace(/\s+/g, ' ') + token = token.replace(/(^\s+|\s+$)/g, '') + } + + preservedTokens.push(token) + + let preserver = 'url(' + ___PRESERVED_TOKEN_ + (preservedTokens.length - 1) + '___)' + sb.push(preserver) + + appendIndex = endIndex + 1 + } else { + // No end terminator found, re-add the whole match. Should we throw/warn here? + sb.push(css.substring(match.index, pattern.lastIndex)) + appendIndex = pattern.lastIndex + } + } + + sb.push(css.substring(appendIndex)) + + return sb.join('') +} + +/** + * compressHexColors compresses hex color values of the form #AABBCC to #ABC. + * + * DOES NOT compress CSS ID selectors which match the above pattern (which would + * break things), like #AddressForm { ... } + * + * DOES NOT compress IE filters, which have hex color values (which would break + * things), like chroma(color='#FFFFFF'); + * + * DOES NOT compress invalid hex values, like background-color: #aabbccdd + * + * @param {string} css - CSS content + * + * @return {string} Processed CSS + */ + +function compressHexColors(css) { + + // Look for hex colors inside { ... } (to avoid IDs) and which don't have a =, or a " in front of them (to avoid filters) + + const pattern = /(\=\s*?["']?)?#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])(\}|[^0-9a-f{][^{]*?\})/gi + const sb = [] + + let index = 0 + let match + + while ((match = pattern.exec(css)) !== null) { + + sb.push(css.substring(index, match.index)) + + let isFilter = match[1] + + if (isFilter) { + // Restore, maintain case, otherwise filter will break + sb.push(match[1] + '#' + (match[2] + match[3] + match[4] + match[5] + match[6] + match[7])) + } else { + if (match[2].toLowerCase() == match[3].toLowerCase() && + match[4].toLowerCase() == match[5].toLowerCase() && + match[6].toLowerCase() == match[7].toLowerCase()) { + + // Compress. + sb.push('#' + (match[3] + match[5] + match[7]).toLowerCase()) + } else { + // Non compressible color, restore but lower case. + sb.push('#' + (match[2] + match[3] + match[4] + match[5] + match[6] + match[7]).toLowerCase()) + } + } + + index = pattern.lastIndex = pattern.lastIndex - match[8].length + } + + sb.push(css.substring(index)) + + return sb.join('') +} + +/** keyframes preserves 0 followed by unit in keyframes steps + * + * @param {string} content - CSS content + * @param {string[]} preservedTokens - Global array of tokens to preserve + * + * @return {string} Processed CSS + */ + +function keyframes(content, preservedTokens) { + + const pattern = /@[a-z0-9-_]*keyframes\s+[a-z0-9-_]+\s*{/gi + + let index = 0 + let buffer + + const preserve = (part, i) => { + part = part.replace(/(^\s|\s$)/g, '') + if (part.charAt(0) === '0') { + preservedTokens.push(part) + buffer[i] = ___PRESERVED_TOKEN_ + (preservedTokens.length - 1) + '___' + } + } + + while (true) { + + let level = 0 + buffer = '' + + let startIndex = content.slice(index).search(pattern) + if (startIndex < 0) { + break + } + + index += startIndex + startIndex = index + + let len = content.length + let buffers = [] + + for (; index < len; ++index) { + + let ch = content.charAt(index) + + if (ch === '{') { + + if (level === 0) { + buffers.push(buffer.replace(/(^\s|\s$)/g, '')) + + } else if (level === 1) { + + buffer = buffer.split(',') + + buffer.forEach(preserve) + + buffers.push(buffer.join(',').replace(/(^\s|\s$)/g, '')) + } + + buffer = '' + level += 1 + + } else if (ch === '}') { + + if (level === 2) { + buffers.push('{' + buffer.replace(/(^\s|\s$)/g, '') + '}') + buffer = '' + + } else if (level === 1) { + content = content.slice(0, startIndex) + + buffers.shift() + '{' + + buffers.join('') + + content.slice(index) + break + } + + level -= 1 + } + + if (level < 0) { + break + + } else if (ch !== '{' && ch !== '}') { + buffer += ch + } + } + } + + return content +} + +/** + * collectComments collects all comment blocks and return new content with comment placeholders + * + * @param {string} content - CSS content + * @param {string[]} comments - Global array of extracted comments + * + * @return {string} Processed CSS + */ + +function collectComments(content, comments) { + + const table = [] + + let from = 0 + let end + + while (true) { + + let start = content.indexOf('/*', from) + + if (start > -1) { + + end = content.indexOf('*/', start + 2) + + if (end > -1) { + comments.push(content.slice(start + 2, end)) + table.push(content.slice(from, start)) + table.push('/*___PRESERVE_CANDIDATE_COMMENT_' + (comments.length - 1) + '___*/') + from = end + 2 + + } else { + // unterminated comment + end = -2 + break + } + + } else { + break + } + } + + table.push(content.slice(end + 2)) + + return table.join('') +} + +/** + * processString uglifies a CSS string + * + * @param {string} content - CSS string + * @param {options} options - UglifyCSS options + * + * @return {string} Uglified result + */ + +function processString(content = '', options = defaultOptions) { + + const comments = [] + const preservedTokens = [] + + let pattern + + content = extractDataUrls(content, preservedTokens) + content = convertRelativeUrls(content, options, preservedTokens) + content = collectComments(content, comments) + + // preserve strings so their content doesn't get accidentally minified + pattern = /("([^\\"]|\\.|\\)*")|('([^\\']|\\.|\\)*')/g + content = content.replace(pattern, token => { + const quote = token.substring(0, 1) + token = token.slice(1, -1) + // maybe the string contains a comment-like substring or more? put'em back then + if (token.indexOf('___PRESERVE_CANDIDATE_COMMENT_') >= 0) { + for (let i = 0, len = comments.length; i < len; i += 1) { + token = token.replace('___PRESERVE_CANDIDATE_COMMENT_' + i + '___', comments[i]) + } + } + // minify alpha opacity in filter strings + token = token.replace(/progid:DXImageTransform.Microsoft.Alpha\(Opacity=/gi, 'alpha(opacity=') + preservedTokens.push(token) + return quote + ___PRESERVED_TOKEN_ + (preservedTokens.length - 1) + '___' + quote + }) + + // strings are safe, now wrestle the comments + for (let i = 0, len = comments.length; i < len; i += 1) { + + let token = comments[i] + let placeholder = '___PRESERVE_CANDIDATE_COMMENT_' + i + '___' + + // ! in the first position of the comment means preserve + // so push to the preserved tokens keeping the ! + if (token.charAt(0) === '!') { + if (options.cuteComments) { + preservedTokens.push(token.substring(1).replace(/\r\n/g, '\n')) + } else if (options.uglyComments) { + preservedTokens.push(token.substring(1).replace(/[\r\n]/g, '')) + } else { + preservedTokens.push(token) + } + content = content.replace(placeholder, ___PRESERVED_TOKEN_ + (preservedTokens.length - 1) + '___') + continue + } + + // \ in the last position looks like hack for Mac/IE5 + // shorten that to /*\*/ and the next one to /**/ + if (token.charAt(token.length - 1) === '\\') { + preservedTokens.push('\\') + content = content.replace(placeholder, ___PRESERVED_TOKEN_ + (preservedTokens.length - 1) + '___') + i = i + 1 // attn: advancing the loop + preservedTokens.push('') + content = content.replace( + '___PRESERVE_CANDIDATE_COMMENT_' + i + '___', + ___PRESERVED_TOKEN_ + (preservedTokens.length - 1) + '___' + ) + continue + } + + // keep empty comments after child selectors (IE7 hack) + // e.g. html >/**/ body + if (token.length === 0) { + let startIndex = content.indexOf(placeholder) + if (startIndex > 2) { + if (content.charAt(startIndex - 3) === '>') { + preservedTokens.push('') + content = content.replace(placeholder, ___PRESERVED_TOKEN_ + (preservedTokens.length - 1) + '___') + } + } + } + + // in all other cases kill the comment + content = content.replace(`/*${placeholder}*/`, '') + } + + // parse simple @variables blocks and remove them + if (options.expandVars) { + const vars = {} + pattern = /@variables\s*\{\s*([^\}]+)\s*\}/g + content = content.replace(pattern, (_, f1) => { + pattern = /\s*([a-z0-9\-]+)\s*:\s*([^;\}]+)\s*/gi + f1.replace(pattern, (_, f1, f2) => { + if (f1 && f2) { + vars[f1] = f2 + } + return '' + }) + return '' + }) + + // replace var(x) with the value of x + pattern = /var\s*\(\s*([^\)]+)\s*\)/g + content = content.replace(pattern, (_, f1) => { + return vars[f1] || 'none' + }) + } + + // normalize all whitespace strings to single spaces. Easier to work with that way. + content = content.replace(/\s+/g, ' ') + + // preserve formulas in calc() before removing spaces + pattern = /calc\(([^;}]*)\)/g + content = content.replace(pattern, (_, f1) => { + preservedTokens.push( + 'calc(' + + f1.replace(/(^\s*|\s*$)/g, '') + .replace(/\( /g, '(') + .replace(/ \)/g, ')') + + ')' + ) + return ___PRESERVED_TOKEN_ + (preservedTokens.length - 1) + '___' + }) + + // preserve matrix + pattern = /\s*filter:\s*progid:DXImageTransform.Microsoft.Matrix\(([^\)]+)\);/g + content = content.replace(pattern, (_, f1) => { + preservedTokens.push(f1) + return 'filter:progid:DXImageTransform.Microsoft.Matrix(' + ___PRESERVED_TOKEN_ + (preservedTokens.length - 1) + '___);' + }) + + // remove the spaces before the things that should not have spaces before them. + // but, be careful not to turn 'p :link {...}' into 'p:link{...}' + // swap out any pseudo-class colons with the token, and then swap back. + pattern = /(^|\})(([^\{:])+:)+([^\{]*\{)/g + content = content.replace(pattern, token => token.replace(/:/g, '___PSEUDOCLASSCOLON___')) + + // remove spaces before the things that should not have spaces before them. + content = content.replace(/\s+([!{};:>+\(\)\],])/g, '$1') + + // restore spaces for !important + content = content.replace(/!important/g, ' !important') + + // bring back the colon + content = content.replace(/___PSEUDOCLASSCOLON___/g, ':') + + // preserve 0 followed by a time unit for properties using time units + pattern = /\s*(animation|animation-delay|animation-duration|transition|transition-delay|transition-duration):\s*([^;}]+)/gi + content = content.replace(pattern, (_, f1, f2) => { + + f2 = f2.replace(/(^|\D)0?\.?0(m?s)/gi, (_, g1, g2) => { + preservedTokens.push('0' + g2) + return g1 + ___PRESERVED_TOKEN_ + (preservedTokens.length - 1) + '___' + }) + + return f1 + ':' + f2 + }) + + // preserve unit for flex-basis within flex and flex-basis (ie10 bug) + pattern = /\s*(flex|flex-basis):\s*([^;}]+)/gi + content = content.replace(pattern, (_, f1, f2) => { + let f2b = f2.split(/\s+/) + preservedTokens.push(f2b.pop()) + f2b.push(___PRESERVED_TOKEN_ + (preservedTokens.length - 1) + '___') + f2b = f2b.join(' ') + return `${f1}:${f2b}` + }) + + // preserve 0% in hsl and hsla color definitions + content = content.replace(/(hsla?)\(([^)]+)\)/g, (_, f1, f2) => { + var f0 = [] + f2.split(',').forEach(part => { + part = part.replace(/(^\s+|\s+$)/g, '') + if (part === '0%') { + preservedTokens.push('0%') + f0.push(___PRESERVED_TOKEN_ + (preservedTokens.length - 1) + '___') + } else { + f0.push(part) + } + }) + return f1 + '(' + f0.join(',') + ')' + }) + + // preserve 0 followed by unit in keyframes steps (WIP) + content = keyframes(content, preservedTokens) + + // retain space for special IE6 cases + content = content.replace(/:first-(line|letter)(\{|,)/gi, (_, f1, f2) => ':first-' + f1.toLowerCase() + ' ' + f2) + + // newlines before and after the end of a preserved comment + if (options.cuteComments) { + content = content.replace(/\s*\/\*/g, '___PRESERVED_NEWLINE___/*') + content = content.replace(/\*\/\s*/g, '*/___PRESERVED_NEWLINE___') + // no space after the end of a preserved comment + } else { + content = content.replace(/\*\/\s*/g, '*/') + } + + // If there are multiple @charset directives, push them to the top of the file. + pattern = /^(.*)(@charset)( "[^"]*";)/gi + content = content.replace(pattern, (_, f1, f2, f3) => f2.toLowerCase() + f3 + f1) + + // When all @charset are at the top, remove the second and after (as they are completely ignored). + pattern = /^((\s*)(@charset)( [^;]+;\s*))+/gi + content = content.replace(pattern, (_, __, f2, f3, f4) => f2 + f3.toLowerCase() + f4) + + // lowercase some popular @directives (@charset is done right above) + pattern = /@(font-face|import|(?:-(?:atsc|khtml|moz|ms|o|wap|webkit)-)?keyframe|media|page|namespace)/gi + content = content.replace(pattern, (_, f1) => '@' + f1.toLowerCase()) + + // lowercase some more common pseudo-elements + pattern = /:(active|after|before|checked|disabled|empty|enabled|first-(?:child|of-type)|focus|hover|last-(?:child|of-type)|link|only-(?:child|of-type)|root|:selection|target|visited)/gi + content = content.replace(pattern, (_, f1) => ':' + f1.toLowerCase()) + + // if there is a @charset, then only allow one, and push to the top of the file. + content = content.replace(/^(.*)(@charset \"[^\"]*\";)/g, '$2$1') + content = content.replace(/^(\s*@charset [^;]+;\s*)+/g, '$1') + + // lowercase some more common functions + pattern = /:(lang|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|(?:-(?:atsc|khtml|moz|ms|o|wap|webkit)-)?any)\(/gi + content = content.replace(pattern, (_, f1) => ':' + f1.toLowerCase() + '(') + + // lower case some common function that can be values + // NOTE: rgb() isn't useful as we replace with #hex later, as well as and() is already done for us right after this + pattern = /([:,\( ]\s*)(attr|color-stop|from|rgba|to|url|(?:-(?:atsc|khtml|moz|ms|o|wap|webkit)-)?(?:calc|max|min|(?:repeating-)?(?:linear|radial)-gradient)|-webkit-gradient)/gi + content = content.replace(pattern, (_, f1, f2) => f1 + f2.toLowerCase()) + + // put the space back in some cases, to support stuff like + // @media screen and (-webkit-min-device-pixel-ratio:0){ + content = content.replace(/\band\(/gi, 'and (') + + // remove the spaces after the things that should not have spaces after them. + content = content.replace(/([!{}:;>+\(\[,])\s+/g, '$1') + + // remove unnecessary semicolons + content = content.replace(/;+\}/g, '}') + + // replace 0(px,em,%) with 0. + content = content.replace(/(^|[^.0-9\\])(?:0?\.)?0(?:ex|ch|r?em|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|g?rad|turn|m?s|k?Hz|dpi|dpcm|dppx|%)/gi, '$10') + + // Replace x.0(px,em,%) with x(px,em,%). + content = content.replace(/([0-9])\.0(ex|ch|r?em|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|g?rad|turn|m?s|k?Hz|dpi|dpcm|dppx|%| |;)/gi, '$1$2') + + // replace 0 0 0 0; with 0. + content = content.replace(/:0 0 0 0(;|\})/g, ':0$1') + content = content.replace(/:0 0 0(;|\})/g, ':0$1') + content = content.replace(/:0 0(;|\})/g, ':0$1') + + // replace background-position:0; with background-position:0 0; + // same for transform-origin and box-shadow + pattern = /(background-position|transform-origin|webkit-transform-origin|moz-transform-origin|o-transform-origin|ms-transform-origin|box-shadow):0(;|\})/gi + content = content.replace(pattern, (_, f1, f2) => f1.toLowerCase() + ':0 0' + f2) + + // replace 0.6 to .6, but only when preceded by : or a white-space + content = content.replace(/(:|\s)0+\.(\d+)/g, '$1.$2') + + // shorten colors from rgb(51,102,153) to #336699 + // this makes it more likely that it'll get further compressed in the next step. + pattern = /rgb\s*\(\s*([0-9,\s]+)\s*\)/gi + content = content.replace(pattern, (_, f1) => { + const rgbcolors = f1.split(',') + let hexcolor = '#' + for (let i = 0; i < rgbcolors.length; i += 1) { + let val = parseInt(rgbcolors[i], 10) + if (val < 16) { + hexcolor += '0' + } + if (val > 255) { + val = 255 + } + hexcolor += val.toString(16) + } + return hexcolor + }) + + // Shorten colors from #AABBCC to #ABC. + content = compressHexColors(content) + + // Replace #f00 -> red + content = content.replace(/(:|\s)(#f00)(;|})/g, '$1red$3') + + // Replace other short color keywords + content = content.replace(/(:|\s)(#000080)(;|})/g, '$1navy$3') + content = content.replace(/(:|\s)(#808080)(;|})/g, '$1gray$3') + content = content.replace(/(:|\s)(#808000)(;|})/g, '$1olive$3') + content = content.replace(/(:|\s)(#800080)(;|})/g, '$1purple$3') + content = content.replace(/(:|\s)(#c0c0c0)(;|})/g, '$1silver$3') + content = content.replace(/(:|\s)(#008080)(;|})/g, '$1teal$3') + content = content.replace(/(:|\s)(#ffa500)(;|})/g, '$1orange$3') + content = content.replace(/(:|\s)(#800000)(;|})/g, '$1maroon$3') + + // border: none -> border:0 + pattern = /(border|border-top|border-right|border-bottom|border-left|outline|background):none(;|\})/gi + content = content.replace(pattern, (_, f1, f2) => f1.toLowerCase() + ':0' + f2) + + // shorter opacity IE filter + content = content.replace(/progid:DXImageTransform\.Microsoft\.Alpha\(Opacity=/gi, 'alpha(opacity=') + + // Find a fraction that is used for Opera's -o-device-pixel-ratio query + // Add token to add the '\' back in later + content = content.replace(/\(([\-A-Za-z]+):([0-9]+)\/([0-9]+)\)/g, '($1:$2___QUERY_FRACTION___$3)') + + // remove empty rules. + content = content.replace(/[^\};\{\/]+\{\}/g, '') + + // Add '\' back to fix Opera -o-device-pixel-ratio query + content = content.replace(/___QUERY_FRACTION___/g, '/') + + // some source control tools don't like it when files containing lines longer + // than, say 8000 characters, are checked in. The linebreak option is used in + // that case to split long lines after a specific column. + if (options.maxLineLen > 0) { + const lines = [] + let line = [] + for (let i = 0, len = content.length; i < len; i += 1) { + let ch = content.charAt(i) + line.push(ch) + if (ch === '}' && line.length > options.maxLineLen) { + lines.push(line.join('')) + line = [] + } + } + if (line.length) { + lines.push(line.join('')) + } + + content = lines.join('\n') + } + + // replace multiple semi-colons in a row by a single one + // see SF bug #1980989 + content = content.replace(/;;+/g, ';') + + // trim the final string (for any leading or trailing white spaces) + content = content.replace(/(^\s*|\s*$)/g, '') + + // restore preserved tokens + for (let i = preservedTokens.length - 1; i >= 0; i--) { + content = content.replace(___PRESERVED_TOKEN_ + i + '___', preservedTokens[i], 'g') + } + + // restore preserved newlines + content = content.replace(/___PRESERVED_NEWLINE___/g, '\n') + + // return + return content +} + +/** + * processFiles uglifies a set of CSS files + * + * @param {string[]} filenames - List of filenames + * @param {options} options - UglifyCSS options + * + * @return {string} Uglified result + */ + +function processFiles(filenames = [], options = defaultOptions) { + + if (options.convertUrls) { + options.target = resolve(process.cwd(), options.convertUrls).split(PATH_SEP) + } + + const uglies = [] + + // process files + filenames.forEach(filename => { + try { + const content = readFileSync(filename, 'utf8') + if (content.length) { + if (options.convertUrls) { + options.source = resolve(process.cwd(), filename).split(PATH_SEP) + options.source.pop() + } + uglies.push(processString(content, options)) + } + } catch (e) { + if (options.debug) { + console.error(`uglifycss: unable to process "${filename}"\n${e.stack}`) + } else { + console.error(`uglifycss: unable to process "${filename}"\n\t${e}`) + } + process.exit(1) + } + }) + + // return concat'd results + return uglies.join('') +} + +module.exports = { + defaultOptions, + processString, + processFiles +} diff --git a/semag/emulatorjs/data/minify/package-lock.json b/semag/emulatorjs/data/minify/package-lock.json index 24d99605..c065d554 100644 --- a/semag/emulatorjs/data/minify/package-lock.json +++ b/semag/emulatorjs/data/minify/package-lock.json @@ -1,50 +1,38 @@ -{ - "name": "emulatorjs-minify", - "version": "1.0.1", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "name": "emulatorjs-minify", - "version": "1.0.1", - "dependencies": { - "uglify-js": "^3.17.4", - "uglifycss": "0.0.29" - } - }, - "node_modules/uglify-js": { - "version": "3.17.4", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", - "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", - "bin": { - "uglifyjs": "bin/uglifyjs" - }, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/uglifycss": { - "version": "0.0.29", - "resolved": "https://registry.npmjs.org/uglifycss/-/uglifycss-0.0.29.tgz", - "integrity": "sha512-J2SQ2QLjiknNGbNdScaNZsXgmMGI0kYNrXaDlr4obnPW9ni1jljb1NeEVWAiTgZ8z+EBWP2ozfT9vpy03rjlMQ==", - "bin": { - "uglifycss": "uglifycss" - }, - "engines": { - "node": ">=6.4.0" - } - } - }, - "dependencies": { - "uglify-js": { - "version": "3.17.4", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", - "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==" - }, - "uglifycss": { - "version": "0.0.29", - "resolved": "https://registry.npmjs.org/uglifycss/-/uglifycss-0.0.29.tgz", - "integrity": "sha512-J2SQ2QLjiknNGbNdScaNZsXgmMGI0kYNrXaDlr4obnPW9ni1jljb1NeEVWAiTgZ8z+EBWP2ozfT9vpy03rjlMQ==" - } - } -} +{ + "name": "emulatorjs-minify", + "version": "1.0.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "emulatorjs-minify", + "version": "1.0.1", + "dependencies": { + "uglify-js": "^3.17.4", + "uglifycss": "0.0.29" + } + }, + "node_modules/uglify-js": { + "version": "3.17.4", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", + "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/uglifycss": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/uglifycss/-/uglifycss-0.0.29.tgz", + "integrity": "sha512-J2SQ2QLjiknNGbNdScaNZsXgmMGI0kYNrXaDlr4obnPW9ni1jljb1NeEVWAiTgZ8z+EBWP2ozfT9vpy03rjlMQ==", + "bin": { + "uglifycss": "uglifycss" + }, + "engines": { + "node": ">=6.4.0" + } + } + } +} diff --git a/semag/emulatorjs/data/minify/package.json b/semag/emulatorjs/data/minify/package.json index 2f2b3c4c..d90f7ebe 100644 --- a/semag/emulatorjs/data/minify/package.json +++ b/semag/emulatorjs/data/minify/package.json @@ -1,22 +1,22 @@ -{ - "name": "emulatorjs-minify", - "version": "1.0.1", - "description": "Minify the EmulatorJS javascript files", - "main": "index.js", - "scripts": { - "build": "node index.js" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/EmulatorJS/EmulatorJS.git" - }, - "author": "Ethan O'Brien", - "bugs": { - "url": "https://github.com/EmulatorJS/EmulatorJS/issues" - }, - "homepage": "https://github.com/EmulatorJS/EmulatorJS#readme", - "dependencies": { - "uglify-js": "^3.17.4", - "uglifycss": "0.0.29" - } -} +{ + "name": "emulatorjs-minify", + "version": "1.0.1", + "description": "Minify the EmulatorJS javascript files", + "main": "index.js", + "scripts": { + "build": "node index.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/EmulatorJS/EmulatorJS.git" + }, + "author": "Ethan O'Brien", + "bugs": { + "url": "https://github.com/EmulatorJS/EmulatorJS/issues" + }, + "homepage": "https://github.com/EmulatorJS/EmulatorJS#readme", + "dependencies": { + "uglify-js": "^3.17.4", + "uglifycss": "0.0.29" + } +} diff --git a/semag/emulatorjs/data/shaders.js b/semag/emulatorjs/data/shaders.js index 30e5baf3..c47bbd61 100644 --- a/semag/emulatorjs/data/shaders.js +++ b/semag/emulatorjs/data/shaders.js @@ -1,14 +1,14 @@ -window.EJS_SHADERS = { - "2xScaleHQ.glslp": "shaders = 1\n\nshader0 = \"2xScaleHQ.glsl\"\nfilter_linear0 = false\nscale_type_0 = source\n", - "4xScaleHQ.glslp": "shaders = 1\n\nshader0 = \"4xScaleHQ.glsl\"\nfilter_linear0 = false\nscale_type_0 = source\n", - "crt-easymode.glslp": "shaders = 1\n\nshader0 = crt-easymode.glsl\nfilter_linear0 = false\nscale_type_0 = source\n", - "crt-aperture.glslp": "shaders = 1\n\nshader0 = crt-aperture.glsl\nfilter_linear0 = false\n", - "crt-geom.glslp": "shaders = 1\n\nshader0 = crt-geom.glsl\nfilter_linear0 = false\nscale_type_0 = source\n", - "crt-mattias.glslp": "\nshaders = 1\nshader0 = crt-mattias.glsl\nfilter_linear0 = false\n", - "2xScaleHQ.glsl": "/*\n2xGLSLHqFilter shader\n\nCopyright (C) 2005 guest(r) - guest.r@gmail.com\n\nThis program is free software; you can redistribute it and/or\nmodify it under the terms of the GNU General Public License\nas published by the Free Software Foundation; either version 2\nof the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software\nFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n*/\n\n#if defined(VERTEX)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING out\n#define COMPAT_ATTRIBUTE in\n#define COMPAT_TEXTURE texture\n#else\n#define COMPAT_VARYING varying \n#define COMPAT_ATTRIBUTE attribute \n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nCOMPAT_ATTRIBUTE vec4 VertexCoord;\nCOMPAT_ATTRIBUTE vec4 COLOR;\nCOMPAT_ATTRIBUTE vec4 TexCoord;\nCOMPAT_VARYING vec4 COL0;\nCOMPAT_VARYING vec4 TEX0;\nCOMPAT_VARYING vec4 t1;\nCOMPAT_VARYING vec4 t2;\nCOMPAT_VARYING vec4 t3;\nCOMPAT_VARYING vec4 t4;\n\nvec4 _oPosition1; \nuniform mat4 MVPMatrix;\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\n\n// compatibility #defines\n#define vTexCoord TEX0.xy\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nvoid main()\n{\ngl_Position = MVPMatrix * VertexCoord;\nTEX0.xy = TexCoord.xy;\nfloat x = 0.5 * SourceSize.z;\nfloat y = 0.5 * SourceSize.w;\nvec2 dg1 = vec2( x, y);\nvec2 dg2 = vec2(-x, y);\nvec2 dx = vec2(x, 0.0);\nvec2 dy = vec2(0.0, y);\nt1 = vec4(vTexCoord - dg1, vTexCoord - dy);\nt2 = vec4(vTexCoord - dg2, vTexCoord + dx);\nt3 = vec4(vTexCoord + dg1, vTexCoord + dy);\nt4 = vec4(vTexCoord + dg2, vTexCoord - dx);\n}\n\n#elif defined(FRAGMENT)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING in\n#define COMPAT_TEXTURE texture\nout vec4 FragColor;\n#else\n#define COMPAT_VARYING varying\n#define FragColor gl_FragColor\n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\nuniform sampler2D Texture;\nCOMPAT_VARYING vec4 TEX0;\nCOMPAT_VARYING vec4 t1;\nCOMPAT_VARYING vec4 t2;\nCOMPAT_VARYING vec4 t3;\nCOMPAT_VARYING vec4 t4;\n\n// compatibility #defines\n#define Source Texture\n#define vTexCoord TEX0.xy\n\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nfloat mx = 0.325; // start smoothing wt.\nfloat k = -0.250; // wt. decrease factor\nfloat max_w = 0.25; // max filter weight\nfloat min_w =-0.05; // min filter weight\nfloat lum_add = 0.25; // affects smoothing\nvec3 dt = vec3(1.0);\n\nvoid main()\n{\nvec3 c00 = COMPAT_TEXTURE(Source, t1.xy).xyz; \nvec3 c10 = COMPAT_TEXTURE(Source, t1.zw).xyz; \nvec3 c20 = COMPAT_TEXTURE(Source, t2.xy).xyz; \nvec3 c01 = COMPAT_TEXTURE(Source, t4.zw).xyz; \nvec3 c11 = COMPAT_TEXTURE(Source, vTexCoord).xyz; \nvec3 c21 = COMPAT_TEXTURE(Source, t2.zw).xyz; \nvec3 c02 = COMPAT_TEXTURE(Source, t4.xy).xyz; \nvec3 c12 = COMPAT_TEXTURE(Source, t3.zw).xyz; \nvec3 c22 = COMPAT_TEXTURE(Source, t3.xy).xyz; \n\nfloat md1 = dot(abs(c00 - c22), dt);\nfloat md2 = dot(abs(c02 - c20), dt);\n\nfloat w1 = dot(abs(c22 - c11), dt) * md2;\nfloat w2 = dot(abs(c02 - c11), dt) * md1;\nfloat w3 = dot(abs(c00 - c11), dt) * md2;\nfloat w4 = dot(abs(c20 - c11), dt) * md1;\n\nfloat t1 = w1 + w3;\nfloat t2 = w2 + w4;\nfloat ww = max(t1, t2) + 0.0001;\n\nc11 = (w1 * c00 + w2 * c20 + w3 * c22 + w4 * c02 + ww * c11) / (t1 + t2 + ww);\n\nfloat lc1 = k / (0.12 * dot(c10 + c12 + c11, dt) + lum_add);\nfloat lc2 = k / (0.12 * dot(c01 + c21 + c11, dt) + lum_add);\n\nw1 = clamp(lc1 * dot(abs(c11 - c10), dt) + mx, min_w, max_w);\nw2 = clamp(lc2 * dot(abs(c11 - c21), dt) + mx, min_w, max_w);\nw3 = clamp(lc1 * dot(abs(c11 - c12), dt) + mx, min_w, max_w);\nw4 = clamp(lc2 * dot(abs(c11 - c01), dt) + mx, min_w, max_w);\nFragColor = vec4(w1 * c10 + w2 * c21 + w3 * c12 + w4 * c01 + (1.0 - w1 - w2 - w3 - w4) * c11, 1.0);\n} \n#endif\n", - "4xScaleHQ.glsl": "/*\n4xGLSLHqFilter shader\n\nCopyright (C) 2005 guest(r) - guest.r@gmail.com\n\nThis program is free software; you can redistribute it and/or\nmodify it under the terms of the GNU General Public License\nas published by the Free Software Foundation; either version 2\nof the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software\nFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n*/\n\n#if defined(VERTEX)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING out\n#define COMPAT_ATTRIBUTE in\n#define COMPAT_TEXTURE texture\n#else\n#define COMPAT_VARYING varying \n#define COMPAT_ATTRIBUTE attribute \n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nCOMPAT_ATTRIBUTE vec4 VertexCoord;\nCOMPAT_ATTRIBUTE vec4 COLOR;\nCOMPAT_ATTRIBUTE vec4 TexCoord;\nCOMPAT_VARYING vec4 COL0;\nCOMPAT_VARYING vec4 TEX0;\nCOMPAT_VARYING vec4 t1;\nCOMPAT_VARYING vec4 t2;\nCOMPAT_VARYING vec4 t3;\nCOMPAT_VARYING vec4 t4;\nCOMPAT_VARYING vec4 t5;\nCOMPAT_VARYING vec4 t6;\n\nvec4 _oPosition1; \nuniform mat4 MVPMatrix;\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\n\n// compatibility #defines\n#define vTexCoord TEX0.xy\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nvoid main()\n{\ngl_Position = MVPMatrix * VertexCoord;\nTEX0.xy = TexCoord.xy;\nfloat x = 0.5 * SourceSize.z;\nfloat y = 0.5 * SourceSize.w;\nvec2 dg1 = vec2( x, y);\nvec2 dg2 = vec2(-x, y);\nvec2 sd1 = dg1 * 0.5;\nvec2 sd2 = dg2 * 0.5;\nvec2 ddx = vec2(x, 0.0);\nvec2 ddy = vec2(0.0, y);\nt1 = vec4(vTexCoord - sd1, vTexCoord - ddy);\nt2 = vec4(vTexCoord - sd2, vTexCoord + ddx);\nt3 = vec4(vTexCoord + sd1, vTexCoord + ddy);\nt4 = vec4(vTexCoord + sd2, vTexCoord - ddx);\nt5 = vec4(vTexCoord - dg1, vTexCoord - dg2);\nt6 = vec4(vTexCoord + dg1, vTexCoord + dg2);\n}\n\n#elif defined(FRAGMENT)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING in\n#define COMPAT_TEXTURE texture\nout vec4 FragColor;\n#else\n#define COMPAT_VARYING varying\n#define FragColor gl_FragColor\n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\nuniform sampler2D Texture;\nCOMPAT_VARYING vec4 TEX0;\nCOMPAT_VARYING vec4 t1;\nCOMPAT_VARYING vec4 t2;\nCOMPAT_VARYING vec4 t3;\nCOMPAT_VARYING vec4 t4;\nCOMPAT_VARYING vec4 t5;\nCOMPAT_VARYING vec4 t6;\n\n// compatibility #defines\n#define Source Texture\n#define vTexCoord TEX0.xy\n\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nfloat mx = 1.0; // start smoothing wt.\nfloat k = -1.10; // wt. decrease factor\nfloat max_w = 0.75; // max filter weight\nfloat min_w = 0.03; // min filter weight\nfloat lum_add = 0.33; // affects smoothing\nvec3 dt = vec3(1.0);\n\nvoid main()\n{\nvec3 c = COMPAT_TEXTURE(Source, vTexCoord).xyz;\nvec3 i1 = COMPAT_TEXTURE(Source, t1.xy).xyz; \nvec3 i2 = COMPAT_TEXTURE(Source, t2.xy).xyz; \nvec3 i3 = COMPAT_TEXTURE(Source, t3.xy).xyz; \nvec3 i4 = COMPAT_TEXTURE(Source, t4.xy).xyz; \nvec3 o1 = COMPAT_TEXTURE(Source, t5.xy).xyz; \nvec3 o3 = COMPAT_TEXTURE(Source, t6.xy).xyz; \nvec3 o2 = COMPAT_TEXTURE(Source, t5.zw).xyz;\nvec3 o4 = COMPAT_TEXTURE(Source, t6.zw).xyz;\nvec3 s1 = COMPAT_TEXTURE(Source, t1.zw).xyz; \nvec3 s2 = COMPAT_TEXTURE(Source, t2.zw).xyz; \nvec3 s3 = COMPAT_TEXTURE(Source, t3.zw).xyz; \nvec3 s4 = COMPAT_TEXTURE(Source, t4.zw).xyz; \n\nfloat ko1=dot(abs(o1-c),dt);\nfloat ko2=dot(abs(o2-c),dt);\nfloat ko3=dot(abs(o3-c),dt);\nfloat ko4=dot(abs(o4-c),dt);\n\nfloat k1=min(dot(abs(i1-i3),dt),max(ko1,ko3));\nfloat k2=min(dot(abs(i2-i4),dt),max(ko2,ko4));\n\nfloat w1 = k2; if(ko3= 130\n #define COMPAT_VARYING out\n #define COMPAT_ATTRIBUTE in\n #define COMPAT_TEXTURE texture\n #else\n #define COMPAT_VARYING varying\n #define COMPAT_ATTRIBUTE attribute\n #define COMPAT_TEXTURE texture2D\n #endif\n \n #ifdef GL_ES\n #define COMPAT_PRECISION mediump\n #else\n #define COMPAT_PRECISION\n #endif\n COMPAT_VARYING float _frame_rotation;\n struct input_dummy {\n vec2 _video_size;\n vec2 _texture_size;\n vec2 _output_dummy_size;\n float _frame_count;\n float _frame_direction;\n float _frame_rotation;\n };\n vec4 _oPosition1;\n vec4 _r0005;\n COMPAT_ATTRIBUTE vec4 VertexCoord;\n COMPAT_ATTRIBUTE vec4 TexCoord;\n COMPAT_VARYING vec4 TEX0;\n \n uniform mat4 MVPMatrix;\n uniform int FrameDirection;\n uniform int FrameCount;\n uniform COMPAT_PRECISION vec2 OutputSize;\n uniform COMPAT_PRECISION vec2 TextureSize;\n uniform COMPAT_PRECISION vec2 InputSize;\n void main()\n {\n vec2 _oTex;\n _r0005 = VertexCoord.x*MVPMatrix[0];\n _r0005 = _r0005 + VertexCoord.y*MVPMatrix[1];\n _r0005 = _r0005 + VertexCoord.z*MVPMatrix[2];\n _r0005 = _r0005 + VertexCoord.w*MVPMatrix[3];\n _oPosition1 = _r0005;\n _oTex = TexCoord.xy;\n gl_Position = _r0005;\n TEX0.xy = TexCoord.xy;\n }\n #elif defined(FRAGMENT)\n \n #if __VERSION__ >= 130\n #define COMPAT_VARYING in\n #define COMPAT_TEXTURE texture\n out vec4 FragColor;\n #else\n #define COMPAT_VARYING varying\n #define FragColor gl_FragColor\n #define COMPAT_TEXTURE texture2D\n #endif\n \n #ifdef GL_ES\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n #define COMPAT_PRECISION mediump\n #else\n #define COMPAT_PRECISION\n #endif\n COMPAT_VARYING float _frame_rotation;\n struct input_dummy {\n vec2 _video_size;\n vec2 _texture_size;\n vec2 _output_dummy_size;\n float _frame_count;\n float _frame_direction;\n float _frame_rotation;\n };\n vec4 _ret_0;\n float _TMP30;\n float _TMP29;\n float _TMP28;\n float _TMP13;\n float _TMP32;\n float _TMP11;\n float _TMP10;\n float _TMP31;\n float _TMP9;\n float _TMP8;\n float _TMP15;\n float _TMP14;\n float _TMP33;\n vec4 _TMP34;\n vec4 _TMP27;\n vec4 _TMP25;\n vec4 _TMP23;\n vec4 _TMP21;\n vec4 _TMP26;\n vec4 _TMP24;\n vec4 _TMP22;\n vec4 _TMP20;\n float _TMP4;\n vec4 _TMP3;\n vec4 _TMP2;\n float _TMP19;\n float _TMP18;\n float _TMP17;\n float _TMP16;\n vec4 _TMP1;\n vec2 _TMP0;\n uniform sampler2D Texture;\n input_dummy _IN1;\n float _TMP43;\n float _x_step0044;\n float _curve0044;\n float _a0048;\n float _val0052;\n float _a0052;\n vec4 _TMP57;\n vec4 _x0072;\n vec2 _c0086;\n vec4 _x0088;\n vec4 _x0094;\n vec2 _c0098;\n vec4 _x0100;\n vec2 _c0104;\n vec4 _x0106;\n vec4 _sample_min0110;\n vec4 _sample_max0110;\n vec4 _r0112;\n vec4 _TMP117;\n vec2 _co0124;\n vec2 _c0126;\n vec4 _x0128;\n vec4 _x0134;\n vec2 _c0138;\n vec4 _x0140;\n vec2 _c0144;\n vec4 _x0146;\n vec4 _sample_min0150;\n vec4 _sample_max0150;\n vec4 _r0152;\n vec4 _TMP157;\n float _TMP163;\n float _x_step0164;\n float _curve0164;\n float _a0168;\n float _val0172;\n float _a0172;\n float _TMP183;\n float _TMP189;\n float _x0190;\n float _a0196;\n float _x0198;\n vec2 _x0200;\n float _x0208;\n COMPAT_VARYING vec4 TEX0;\n \n uniform COMPAT_PRECISION vec2 OutputSize;\n uniform COMPAT_PRECISION vec2 TextureSize;\n uniform COMPAT_PRECISION vec2 InputSize;\n void main()\n {\n vec2 _dx1;\n vec2 _dy;\n vec2 _pix_co;\n vec2 _tex_co;\n vec2 _dist;\n vec3 _col2;\n vec3 _col21;\n vec4 _coeffs1;\n float _luma;\n float _bright;\n float _scan_weight;\n vec2 _mod_fac;\n int _dot_no;\n vec3 _mask_weight;\n vec3 _TMP37;\n _dx1 = vec2(1.00000000E+00/TextureSize.x, 0.00000000E+00);\n _dy = vec2(0.00000000E+00, 1.00000000E+00/TextureSize.y);\n _pix_co = TEX0.xy*TextureSize - vec2( 5.00000000E-01, 5.00000000E-01);\n _TMP0 = floor(_pix_co);\n _tex_co = (_TMP0 + vec2( 5.00000000E-01, 5.00000000E-01))/TextureSize;\n _dist = fract(_pix_co);\n _x_step0044 = float((_dist.x >= 5.00000000E-01));\n _a0048 = 2.50000000E-01 - (_dist.x - _x_step0044)*(_dist.x - _x_step0044);\n _TMP33 = inversesqrt(_a0048);\n _TMP14 = 1.00000000E+00/_TMP33;\n _a0052 = 5.00000000E-01 - _dist.x;\n _val0052 = float((_a0052 > 0.00000000E+00));\n _TMP15 = _val0052 - float((_a0052 < 0.00000000E+00));\n _curve0044 = 5.00000000E-01 - _TMP14*_TMP15;\n _TMP43 = _dist.x + 2.50000000E-01*(_curve0044 - _dist.x);\n _coeffs1 = 3.14159274E+00*vec4(1.00000000E+00 + _TMP43, _TMP43, 1.00000000E+00 - _TMP43, 2.00000000E+00 - _TMP43);\n _TMP1 = abs(_coeffs1);\n _TMP57 = max(_TMP1, vec4( 9.99999975E-06, 9.99999975E-06, 9.99999975E-06, 9.99999975E-06));\n _TMP16 = sin(_TMP57.x);\n _TMP17 = sin(_TMP57.y);\n _TMP18 = sin(_TMP57.z);\n _TMP19 = sin(_TMP57.w);\n _TMP2 = vec4(_TMP16, _TMP17, _TMP18, _TMP19);\n _x0072 = _TMP57/2.00000000E+00;\n _TMP16 = sin(_x0072.x);\n _TMP17 = sin(_x0072.y);\n _TMP18 = sin(_x0072.z);\n _TMP19 = sin(_x0072.w);\n _TMP3 = vec4(_TMP16, _TMP17, _TMP18, _TMP19);\n _coeffs1 = ((2.00000000E+00*_TMP2)*_TMP3)/(_TMP57*_TMP57);\n _TMP4 = dot(_coeffs1, vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _coeffs1 = _coeffs1/_TMP4;\n _c0086 = _tex_co - _dx1;\n _TMP20 = COMPAT_TEXTURE(Texture, _c0086);\n _x0088 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP20 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP21 = _TMP20*_x0088;\n _TMP22 = COMPAT_TEXTURE(Texture, _tex_co);\n _x0094 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP22 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP23 = _TMP22*_x0094;\n _c0098 = _tex_co + _dx1;\n _TMP24 = COMPAT_TEXTURE(Texture, _c0098);\n _x0100 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP24 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP25 = _TMP24*_x0100;\n _c0104 = _tex_co + 2.00000000E+00*_dx1;\n _TMP26 = COMPAT_TEXTURE(Texture, _c0104);\n _x0106 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP26 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP27 = _TMP26*_x0106;\n _r0112 = _coeffs1.x*_TMP21;\n _r0112 = _r0112 + _coeffs1.y*_TMP23;\n _r0112 = _r0112 + _coeffs1.z*_TMP25;\n _r0112 = _r0112 + _coeffs1.w*_TMP27;\n _sample_min0110 = min(_TMP23, _TMP25);\n _sample_max0110 = max(_TMP23, _TMP25);\n _TMP34 = min(_sample_max0110, _r0112);\n _TMP117 = max(_sample_min0110, _TMP34);\n _co0124 = _tex_co + _dy;\n _c0126 = _co0124 - _dx1;\n _TMP20 = COMPAT_TEXTURE(Texture, _c0126);\n _x0128 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP20 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP21 = _TMP20*_x0128;\n _TMP22 = COMPAT_TEXTURE(Texture, _co0124);\n _x0134 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP22 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP23 = _TMP22*_x0134;\n _c0138 = _co0124 + _dx1;\n _TMP24 = COMPAT_TEXTURE(Texture, _c0138);\n _x0140 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP24 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP25 = _TMP24*_x0140;\n _c0144 = _co0124 + 2.00000000E+00*_dx1;\n _TMP26 = COMPAT_TEXTURE(Texture, _c0144);\n _x0146 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP26 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP27 = _TMP26*_x0146;\n _r0152 = _coeffs1.x*_TMP21;\n _r0152 = _r0152 + _coeffs1.y*_TMP23;\n _r0152 = _r0152 + _coeffs1.z*_TMP25;\n _r0152 = _r0152 + _coeffs1.w*_TMP27;\n _sample_min0150 = min(_TMP23, _TMP25);\n _sample_max0150 = max(_TMP23, _TMP25);\n _TMP34 = min(_sample_max0150, _r0152);\n _TMP157 = max(_sample_min0150, _TMP34);\n _x_step0164 = float((_dist.y >= 5.00000000E-01));\n _a0168 = 2.50000000E-01 - (_dist.y - _x_step0164)*(_dist.y - _x_step0164);\n _TMP33 = inversesqrt(_a0168);\n _TMP14 = 1.00000000E+00/_TMP33;\n _a0172 = 5.00000000E-01 - _dist.y;\n _val0172 = float((_a0172 > 0.00000000E+00));\n _TMP15 = _val0172 - float((_a0172 < 0.00000000E+00));\n _curve0164 = 5.00000000E-01 - _TMP14*_TMP15;\n _TMP163 = _dist.y + (_curve0164 - _dist.y);\n _col2 = _TMP117.xyz + _TMP163*(_TMP157.xyz - _TMP117.xyz);\n _luma = dot(vec3( 2.12599993E-01, 7.15200007E-01, 7.22000003E-02), _col2);\n _TMP8 = max(_col2.y, _col2.z);\n _TMP9 = max(_col2.x, _TMP8);\n _bright = (_TMP9 + _luma)/2.00000000E+00;\n _TMP31 = min(6.49999976E-01, _bright);\n _TMP183 = max(3.49999994E-01, _TMP31);\n _x0190 = _bright*1.50000000E+00;\n _TMP31 = min(1.50000000E+00, _x0190);\n _TMP189 = max(1.50000000E+00, _TMP31);\n _a0196 = TEX0.y*2.00000000E+00*3.14159274E+00*TextureSize.y;\n _TMP10 = cos(_a0196);\n _x0198 = _TMP10*5.00000000E-01 + 5.00000000E-01;\n _TMP11 = pow(_x0198, _TMP189);\n _scan_weight = 1.00000000E+00 - _TMP11;\n _x0200 = (TEX0.xy*OutputSize*TextureSize)/InputSize;\n _mod_fac = floor(_x0200);\n _x0208 = _mod_fac.x/3.00000000E+00;\n _TMP32 = floor(_x0208);\n _TMP13 = _mod_fac.x - 3.00000000E+00*_TMP32;\n _dot_no = int(_TMP13);\n if (_dot_no == 0) {\n _mask_weight = vec3( 1.00000000E+00, 6.99999988E-01, 6.99999988E-01);\n } else {\n if (_dot_no == 1) {\n _mask_weight = vec3( 6.99999988E-01, 1.00000000E+00, 6.99999988E-01);\n } else {\n _mask_weight = vec3( 6.99999988E-01, 6.99999988E-01, 1.00000000E+00);\n }\n }\n if (InputSize.y >= 4.00000000E+02) {\n _scan_weight = 1.00000000E+00;\n }\n _col21 = _col2.xyz;\n _col2 = _col2*vec3(_scan_weight, _scan_weight, _scan_weight);\n _col2 = _col2 + _TMP183*(_col21 - _col2);\n _col2 = _col2*_mask_weight;\n _TMP28 = pow(_col2.x, 5.55555582E-01);\n _TMP29 = pow(_col2.y, 5.55555582E-01);\n _TMP30 = pow(_col2.z, 5.55555582E-01);\n _col2 = vec3(_TMP28, _TMP29, _TMP30);\n _TMP37 = _col2*1.20000005E+00;\n _ret_0 = vec4(_TMP37.x, _TMP37.y, _TMP37.z, 1.00000000E+00);\n FragColor = _ret_0;\n return;\n }\n #endif\n", - "crt-aperture.glsl": "\n/*\nCRT Shader by EasyMode\nLicense: GPL\n*/\n/*\n#pragma parameter SHARPNESS_IMAGE \"Sharpness Image\" 1.0 1.0 5.0 1.0\n#pragma parameter SHARPNESS_EDGES \"Sharpness Edges\" 3.0 1.0 5.0 1.0\n#pragma parameter GLOW_WIDTH \"Glow Width\" 0.5 0.05 0.65 0.05\n#pragma parameter GLOW_HEIGHT \"Glow Height\" 0.5 0.05 0.65 0.05\n#pragma parameter GLOW_HALATION \"Glow Halation\" 0.1 0.0 1.0 0.01\n#pragma parameter GLOW_DIFFUSION \"Glow Diffusion\" 0.05 0.0 1.0 0.01\n#pragma parameter MASK_COLORS \"Mask Colors\" 2.0 2.0 3.0 1.0\n#pragma parameter MASK_STRENGTH \"Mask Strength\" 0.3 0.0 1.0 0.05\n#pragma parameter MASK_SIZE \"Mask Size\" 1.0 1.0 9.0 1.0\n#pragma parameter SCANLINE_SIZE_MIN \"Scanline Size Min.\" 0.5 0.5 1.5 0.05\n#pragma parameter SCANLINE_SIZE_MAX \"Scanline Size Max.\" 1.5 0.5 1.5 0.05\n#pragma parameter GAMMA_INPUT \"Gamma Input\" 2.4 1.0 5.0 0.1\n#pragma parameter GAMMA_OUTPUT \"Gamma Output\" 2.4 1.0 5.0 0.1\n#pragma parameter BRIGHTNESS \"Brightness\" 1.5 0.0 2.0 0.05\n* */\n\n#define Coord TEX0\n\n#if defined(VERTEX)\n\n#if __VERSION__ >= 130\n#define OUT out\n#define IN in\n#define tex2D texture\n#else\n#define OUT varying \n#define IN attribute \n#define tex2D texture2D\n#endif\n\n#ifdef GL_ES\n#define PRECISION mediump\n#else\n#define PRECISION\n#endif\n\nIN vec4 VertexCoord;\nIN vec4 Color;\nIN vec2 TexCoord;\nOUT vec4 color;\nOUT vec2 Coord;\n\nuniform mat4 MVPMatrix;\nuniform PRECISION int FrameDirection;\nuniform PRECISION int FrameCount;\nuniform PRECISION vec2 OutputSize;\nuniform PRECISION vec2 TextureSize;\nuniform PRECISION vec2 InputSize;\n\nvoid main()\n{\ngl_Position = MVPMatrix * VertexCoord;\ncolor = Color;\nCoord = TexCoord;\n}\n\n#elif defined(FRAGMENT)\n\n#if __VERSION__ >= 130\n#define IN in\n#define tex2D texture\nout vec4 FragColor;\n#else\n#define IN varying\n#define FragColor gl_FragColor\n#define tex2D texture2D\n#endif\n\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define PRECISION mediump\n#else\n#define PRECISION\n#endif\n\nuniform PRECISION int FrameDirection;\nuniform PRECISION int FrameCount;\nuniform PRECISION vec2 OutputSize;\nuniform PRECISION vec2 TextureSize;\nuniform PRECISION vec2 InputSize;\nuniform sampler2D Texture;\nIN vec2 Coord;\n\n#ifdef PARAMETER_UNIFORM\nuniform PRECISION float SHARPNESS_IMAGE;\nuniform PRECISION float SHARPNESS_EDGES;\nuniform PRECISION float GLOW_WIDTH;\nuniform PRECISION float GLOW_HEIGHT;\nuniform PRECISION float GLOW_HALATION;\nuniform PRECISION float GLOW_DIFFUSION;\nuniform PRECISION float MASK_COLORS;\nuniform PRECISION float MASK_STRENGTH;\nuniform PRECISION float MASK_SIZE;\nuniform PRECISION float SCANLINE_SIZE_MIN;\nuniform PRECISION float SCANLINE_SIZE_MAX;\nuniform PRECISION float GAMMA_INPUT;\nuniform PRECISION float GAMMA_OUTPUT;\nuniform PRECISION float BRIGHTNESS;\n#else\n#define SHARPNESS_IMAGE 1.0\n#define SHARPNESS_EDGES 3.0\n#define GLOW_WIDTH 0.5\n#define GLOW_HEIGHT 0.5\n#define GLOW_HALATION 0.1\n#define GLOW_DIFFUSION 0.05\n#define MASK_COLORS 2.0\n#define MASK_STRENGTH 0.3\n#define MASK_SIZE 1.0\n#define SCANLINE_SIZE_MIN 0.5\n#define SCANLINE_SIZE_MAX 1.5\n#define GAMMA_INPUT 2.4\n#define GAMMA_OUTPUT 2.4\n#define BRIGHTNESS 1.5\n#endif\n\n#define FIX(c) max(abs(c), 1e-5)\n#define PI 3.141592653589\n#define saturate(c) clamp(c, 0.0, 1.0)\n#define TEX2D(c) pow(tex2D(tex, c).rgb, vec3(GAMMA_INPUT))\n\nmat3 get_color_matrix(sampler2D tex, vec2 co, vec2 dx)\n{\nreturn mat3(TEX2D(co - dx), TEX2D(co), TEX2D(co + dx));\n}\n\nvec3 blur(mat3 m, float dist, float rad)\n{\nvec3 x = vec3(dist - 1.0, dist, dist + 1.0) / rad;\nvec3 w = exp2(x * x * -1.0);\n\nreturn (m[0] * w.x + m[1] * w.y + m[2] * w.z) / (w.x + w.y + w.z);\n}\n\nvec3 filter_gaussian(sampler2D tex, vec2 co, vec2 tex_size)\n{\nvec2 dx = vec2(1.0 / tex_size.x, 0.0);\nvec2 dy = vec2(0.0, 1.0 / tex_size.y);\nvec2 pix_co = co * tex_size;\nvec2 tex_co = (floor(pix_co) + 0.5) / tex_size;\nvec2 dist = (fract(pix_co) - 0.5) * -1.0;\n\nmat3 line0 = get_color_matrix(tex, tex_co - dy, dx);\nmat3 line1 = get_color_matrix(tex, tex_co, dx);\nmat3 line2 = get_color_matrix(tex, tex_co + dy, dx);\nmat3 column = mat3(blur(line0, dist.x, GLOW_WIDTH),\n blur(line1, dist.x, GLOW_WIDTH),\n blur(line2, dist.x, GLOW_WIDTH));\n\nreturn blur(column, dist.y, GLOW_HEIGHT);\n}\n\nvec3 filter_lanczos(sampler2D tex, vec2 co, vec2 tex_size, float sharp)\n{\ntex_size.x *= sharp;\n\nvec2 dx = vec2(1.0 / tex_size.x, 0.0);\nvec2 pix_co = co * tex_size - vec2(0.5, 0.0);\nvec2 tex_co = (floor(pix_co) + vec2(0.5, 0.0)) / tex_size;\nvec2 dist = fract(pix_co);\nvec4 coef = PI * vec4(dist.x + 1.0, dist.x, dist.x - 1.0, dist.x - 2.0);\n\ncoef = FIX(coef);\ncoef = 2.0 * sin(coef) * sin(coef / 2.0) / (coef * coef);\ncoef /= dot(coef, vec4(1.0));\n\nvec4 col1 = vec4(TEX2D(tex_co), 1.0);\nvec4 col2 = vec4(TEX2D(tex_co + dx), 1.0);\n\nreturn (mat4(col1, col1, col2, col2) * coef).rgb;\n}\n\nvec3 get_scanline_weight(float x, vec3 col)\n{\nvec3 beam = mix(vec3(SCANLINE_SIZE_MIN), vec3(SCANLINE_SIZE_MAX), col);\nvec3 x_mul = 2.0 / beam;\nvec3 x_offset = x_mul * 0.5;\n\nreturn smoothstep(0.0, 1.0, 1.0 - abs(x * x_mul - x_offset)) * x_offset;\n}\n\nvec3 get_mask_weight(float x)\n{\nfloat i = mod(floor(x * OutputSize.x * TextureSize.x / (InputSize.x * MASK_SIZE)), MASK_COLORS);\n\nif (i == 0.0) return mix(vec3(1.0, 0.0, 1.0), vec3(1.0, 0.0, 0.0), MASK_COLORS - 2.0);\nelse if (i == 1.0) return vec3(0.0, 1.0, 0.0);\nelse return vec3(0.0, 0.0, 1.0);\n}\n\nvoid main()\n{\nvec3 col_glow = filter_gaussian(Texture, Coord, TextureSize);\nvec3 col_soft = filter_lanczos(Texture, Coord, TextureSize, SHARPNESS_IMAGE);\nvec3 col_sharp = filter_lanczos(Texture, Coord, TextureSize, SHARPNESS_EDGES);\nvec3 col = sqrt(col_sharp * col_soft);\n\ncol *= get_scanline_weight(fract(Coord.y * TextureSize.y), col_soft);\ncol_glow = saturate(col_glow - col);\ncol += col_glow * col_glow * GLOW_HALATION;\ncol = mix(col, col * get_mask_weight(Coord.x) * MASK_COLORS, MASK_STRENGTH);\ncol += col_glow * GLOW_DIFFUSION;\ncol = pow(col * BRIGHTNESS, vec3(1.0 / GAMMA_OUTPUT));\n\nFragColor = vec4(col, 1.0);\n}\n\n#endif\n", - "crt-geom.glsl": "\n/*\nCRT-interlaced\n\nCopyright (C) 2010-2012 cgwg, Themaister and DOLLS\n\nThis program is free software; you can redistribute it and/or modify it\nunder the terms of the GNU General Public License as published by the Free\nSoftware Foundation; either version 2 of the License, or (at your option)\nany later version.\n\n(cgwg gave their consent to have the original version of this shader\ndistributed under the GPL in this message:\n\nhttp://board.byuu.org/viewtopic.php?p=26075#p26075\n\n\"Feel free to distribute my shaders under the GPL. After all, the\nbarrel distortion code was taken from the Curvature shader, which is\nunder the GPL.\"\n)\nThis shader variant is pre-configured with screen curvature\n*/\n/*\n#pragma parameter CRTgamma \"CRTGeom Target Gamma\" 2.4 0.1 5.0 0.1\n#pragma parameter monitorgamma \"CRTGeom Monitor Gamma\" 2.2 0.1 5.0 0.1\n#pragma parameter d \"CRTGeom Distance\" 1.6 0.1 3.0 0.1\n#pragma parameter CURVATURE \"CRTGeom Curvature Toggle\" 1.0 0.0 1.0 1.0\n#pragma parameter R \"CRTGeom Curvature Radius\" 2.0 0.1 10.0 0.1\n#pragma parameter cornersize \"CRTGeom Corner Size\" 0.03 0.001 1.0 0.005\n#pragma parameter cornersmooth \"CRTGeom Corner Smoothness\" 1000.0 80.0 2000.0 100.0\n#pragma parameter x_tilt \"CRTGeom Horizontal Tilt\" 0.0 -0.5 0.5 0.05\n#pragma parameter y_tilt \"CRTGeom Vertical Tilt\" 0.0 -0.5 0.5 0.05\n#pragma parameter overscan_x \"CRTGeom Horiz. Overscan %\" 100.0 -125.0 125.0 1.0\n#pragma parameter overscan_y \"CRTGeom Vert. Overscan %\" 100.0 -125.0 125.0 1.0\n#pragma parameter DOTMASK \"CRTGeom Dot Mask Toggle\" 0.3 0.0 0.3 0.3\n#pragma parameter SHARPER \"CRTGeom Sharpness\" 1.0 1.0 3.0 1.0\n#pragma parameter scanline_weight \"CRTGeom Scanline Weight\" 0.3 0.1 0.5 0.05\n*/\n\n#ifndef PARAMETER_UNIFORM\n#define CRTgamma 2.4\n#define monitorgamma 2.2\n#define d 1.6\n#define CURVATURE 1.0\n#define R 2.0\n#define cornersize 0.03\n#define cornersmooth 1000.0\n#define x_tilt 0.0\n#define y_tilt 0.0\n#define overscan_x 100.0\n#define overscan_y 100.0\n#define DOTMASK 0.3\n#define SHARPER 1.0\n#define scanline_weight 0.3\n#endif\n\n#if defined(VERTEX)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING out\n#define COMPAT_ATTRIBUTE in\n#define COMPAT_TEXTURE texture\n#else\n#define COMPAT_VARYING varying \n#define COMPAT_ATTRIBUTE attribute \n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nCOMPAT_ATTRIBUTE vec4 VertexCoord;\nCOMPAT_ATTRIBUTE vec4 COLOR;\nCOMPAT_ATTRIBUTE vec4 TexCoord;\nCOMPAT_VARYING vec4 COL0;\nCOMPAT_VARYING vec4 TEX0;\n\nvec4 _oPosition1; \nuniform mat4 MVPMatrix;\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\n\nCOMPAT_VARYING vec2 overscan;\nCOMPAT_VARYING vec2 aspect;\nCOMPAT_VARYING vec3 stretch;\nCOMPAT_VARYING vec2 sinangle;\nCOMPAT_VARYING vec2 cosangle;\nCOMPAT_VARYING vec2 one;\nCOMPAT_VARYING float mod_factor;\nCOMPAT_VARYING vec2 ilfac;\n\n#ifdef PARAMETER_UNIFORM\nuniform COMPAT_PRECISION float CRTgamma;\nuniform COMPAT_PRECISION float monitorgamma;\nuniform COMPAT_PRECISION float d;\nuniform COMPAT_PRECISION float CURVATURE;\nuniform COMPAT_PRECISION float R;\nuniform COMPAT_PRECISION float cornersize;\nuniform COMPAT_PRECISION float cornersmooth;\nuniform COMPAT_PRECISION float x_tilt;\nuniform COMPAT_PRECISION float y_tilt;\nuniform COMPAT_PRECISION float overscan_x;\nuniform COMPAT_PRECISION float overscan_y;\nuniform COMPAT_PRECISION float DOTMASK;\nuniform COMPAT_PRECISION float SHARPER;\nuniform COMPAT_PRECISION float scanline_weight;\n#endif\n\n#define FIX(c) max(abs(c), 1e-5);\n\nfloat intersect(vec2 xy)\n{\nfloat A = dot(xy,xy)+d*d;\nfloat B = 2.0*(R*(dot(xy,sinangle)-d*cosangle.x*cosangle.y)-d*d);\nfloat C = d*d + 2.0*R*d*cosangle.x*cosangle.y;\nreturn (-B-sqrt(B*B-4.0*A*C))/(2.0*A);\n}\n\nvec2 bkwtrans(vec2 xy)\n{\nfloat c = intersect(xy);\nvec2 point = vec2(c)*xy;\npoint -= vec2(-R)*sinangle;\npoint /= vec2(R);\nvec2 tang = sinangle/cosangle;\nvec2 poc = point/cosangle;\nfloat A = dot(tang,tang)+1.0;\nfloat B = -2.0*dot(poc,tang);\nfloat C = dot(poc,poc)-1.0;\nfloat a = (-B+sqrt(B*B-4.0*A*C))/(2.0*A);\nvec2 uv = (point-a*sinangle)/cosangle;\nfloat r = R*acos(a);\nreturn uv*r/sin(r/R);\n}\n\nvec2 fwtrans(vec2 uv)\n{\nfloat r = FIX(sqrt(dot(uv,uv)));\nuv *= sin(r/R)/r;\nfloat x = 1.0-cos(r/R);\nfloat D = d/R + x*cosangle.x*cosangle.y+dot(uv,sinangle);\nreturn d*(uv*cosangle-x*sinangle)/D;\n}\n\nvec3 maxscale()\n{\nvec2 c = bkwtrans(-R * sinangle / (1.0 + R/d*cosangle.x*cosangle.y));\nvec2 a = vec2(0.5,0.5)*aspect;\nvec2 lo = vec2(fwtrans(vec2(-a.x,c.y)).x, fwtrans(vec2(c.x,-a.y)).y)/aspect;\nvec2 hi = vec2(fwtrans(vec2(+a.x,c.y)).x, fwtrans(vec2(c.x,+a.y)).y)/aspect;\nreturn vec3((hi+lo)*aspect*0.5,max(hi.x-lo.x,hi.y-lo.y));\n}\n\nvoid main()\n{\n// START of parameters\n\n// gamma of simulated CRT\n//\tCRTgamma = 1.8;\n// gamma of display monitor (typically 2.2 is correct)\n//\tmonitorgamma = 2.2;\n// overscan (e.g. 1.02 for 2% overscan)\noverscan = vec2(1.00,1.00);\n// aspect ratio\naspect = vec2(1.0, 0.75);\n// lengths are measured in units of (approximately) the width\n// of the monitor simulated distance from viewer to monitor\n//\td = 2.0;\n// radius of curvature\n//\tR = 1.5;\n// tilt angle in radians\n// (behavior might be a bit wrong if both components are\n// nonzero)\nconst vec2 angle = vec2(0.0,0.0);\n// size of curved corners\n//\tcornersize = 0.03;\n// border smoothness parameter\n// decrease if borders are too aliased\n//\tcornersmooth = 1000.0;\n\n// END of parameters\n\nvec4 _oColor;\nvec2 _otexCoord;\ngl_Position = VertexCoord.x * MVPMatrix[0] + VertexCoord.y * MVPMatrix[1] + VertexCoord.z * MVPMatrix[2] + VertexCoord.w * MVPMatrix[3];\n_oPosition1 = gl_Position;\n_oColor = COLOR;\n_otexCoord = TexCoord.xy;\nCOL0 = COLOR;\nTEX0.xy = TexCoord.xy;\n\n// Precalculate a bunch of useful values we'll need in the fragment\n// shader.\nsinangle = sin(vec2(x_tilt, y_tilt)) + vec2(0.001);//sin(vec2(max(abs(x_tilt), 1e-3), max(abs(y_tilt), 1e-3)));\ncosangle = cos(vec2(x_tilt, y_tilt)) + vec2(0.001);//cos(vec2(max(abs(x_tilt), 1e-3), max(abs(y_tilt), 1e-3)));\nstretch = maxscale();\n\nilfac = vec2(1.0,clamp(floor(InputSize.y/200.0), 1.0, 2.0));\n\n// The size of one texel, in texture-coordinates.\nvec2 sharpTextureSize = vec2(SHARPER * TextureSize.x, TextureSize.y);\none = ilfac / sharpTextureSize;\n\n// Resulting X pixel-coordinate of the pixel we're drawing.\nmod_factor = TexCoord.x * TextureSize.x * OutputSize.x / InputSize.x;\n\n}\n\n#elif defined(FRAGMENT)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING in\n#define COMPAT_TEXTURE texture\nout vec4 FragColor;\n#else\n#define COMPAT_VARYING varying\n#define FragColor gl_FragColor\n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nstruct output_dummy {\nvec4 _color;\n};\n\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\nuniform sampler2D Texture;\nCOMPAT_VARYING vec4 TEX0;\n\n// Comment the next line to disable interpolation in linear gamma (and\n// gain speed).\n#define LINEAR_PROCESSING\n\n// Enable screen curvature.\n// #define CURVATURE\n\n// Enable 3x oversampling of the beam profile\n#define OVERSAMPLE\n\n// Use the older, purely gaussian beam profile\n//#define USEGAUSSIAN\n\n// Macros.\n#define FIX(c) max(abs(c), 1e-5);\n#define PI 3.141592653589\n\n#ifdef LINEAR_PROCESSING\n# define TEX2D(c) pow(COMPAT_TEXTURE(Texture, (c)), vec4(CRTgamma))\n#else\n# define TEX2D(c) COMPAT_TEXTURE(Texture, (c))\n#endif\n\nCOMPAT_VARYING vec2 one;\nCOMPAT_VARYING float mod_factor;\nCOMPAT_VARYING vec2 ilfac;\nCOMPAT_VARYING vec2 overscan;\nCOMPAT_VARYING vec2 aspect;\nCOMPAT_VARYING vec3 stretch;\nCOMPAT_VARYING vec2 sinangle;\nCOMPAT_VARYING vec2 cosangle;\n\n#ifdef PARAMETER_UNIFORM\nuniform COMPAT_PRECISION float CRTgamma;\nuniform COMPAT_PRECISION float monitorgamma;\nuniform COMPAT_PRECISION float d;\nuniform COMPAT_PRECISION float CURVATURE;\nuniform COMPAT_PRECISION float R;\nuniform COMPAT_PRECISION float cornersize;\nuniform COMPAT_PRECISION float cornersmooth;\nuniform COMPAT_PRECISION float x_tilt;\nuniform COMPAT_PRECISION float y_tilt;\nuniform COMPAT_PRECISION float overscan_x;\nuniform COMPAT_PRECISION float overscan_y;\nuniform COMPAT_PRECISION float DOTMASK;\nuniform COMPAT_PRECISION float SHARPER;\nuniform COMPAT_PRECISION float scanline_weight;\n#endif\n\nfloat intersect(vec2 xy)\n{\nfloat A = dot(xy,xy)+d*d;\nfloat B = 2.0*(R*(dot(xy,sinangle)-d*cosangle.x*cosangle.y)-d*d);\nfloat C = d*d + 2.0*R*d*cosangle.x*cosangle.y;\nreturn (-B-sqrt(B*B-4.0*A*C))/(2.0*A);\n}\n\nvec2 bkwtrans(vec2 xy)\n{\nfloat c = intersect(xy);\nvec2 point = vec2(c)*xy;\npoint -= vec2(-R)*sinangle;\npoint /= vec2(R);\nvec2 tang = sinangle/cosangle;\nvec2 poc = point/cosangle;\nfloat A = dot(tang,tang)+1.0;\nfloat B = -2.0*dot(poc,tang);\nfloat C = dot(poc,poc)-1.0;\nfloat a = (-B+sqrt(B*B-4.0*A*C))/(2.0*A);\nvec2 uv = (point-a*sinangle)/cosangle;\nfloat r = FIX(R*acos(a));\nreturn uv*r/sin(r/R);\n}\n\nvec2 transform(vec2 coord)\n{\ncoord *= TextureSize / InputSize;\ncoord = (coord-vec2(0.5))*aspect*stretch.z+stretch.xy;\nreturn (bkwtrans(coord)/vec2(overscan_x / 100.0, overscan_y / 100.0)/aspect+vec2(0.5)) * InputSize / TextureSize;\n}\n\nfloat corner(vec2 coord)\n{\ncoord *= TextureSize / InputSize;\ncoord = (coord - vec2(0.5)) * vec2(overscan_x / 100.0, overscan_y / 100.0) + vec2(0.5);\ncoord = min(coord, vec2(1.0)-coord) * aspect;\nvec2 cdist = vec2(cornersize);\ncoord = (cdist - min(coord,cdist));\nfloat dist = sqrt(dot(coord,coord));\nreturn clamp((cdist.x-dist)*cornersmooth,0.0, 1.0);\n}\n\n// Calculate the influence of a scanline on the current pixel.\n//\n// 'distance' is the distance in texture coordinates from the current\n// pixel to the scanline in question.\n// 'color' is the colour of the scanline at the horizontal location of\n// the current pixel.\nvec4 scanlineWeights(float distance, vec4 color)\n{\n// \"wid\" controls the width of the scanline beam, for each RGB\n// channel The \"weights\" lines basically specify the formula\n// that gives you the profile of the beam, i.e. the intensity as\n// a function of distance from the vertical center of the\n// scanline. In this case, it is gaussian if width=2, and\n// becomes nongaussian for larger widths. Ideally this should\n// be normalized so that the integral across the beam is\n// independent of its width. That is, for a narrower beam\n// \"weights\" should have a higher peak at the center of the\n// scanline than for a wider beam.\n#ifdef USEGAUSSIAN\nvec4 wid = 0.3 + 0.1 * pow(color, vec4(3.0));\nvec4 weights = vec4(distance / wid);\nreturn 0.4 * exp(-weights * weights) / wid;\n#else\nvec4 wid = 2.0 + 2.0 * pow(color, vec4(4.0));\nvec4 weights = vec4(distance / scanline_weight);\nreturn 1.4 * exp(-pow(weights * inversesqrt(0.5 * wid), wid)) / (0.6 + 0.2 * wid);\n#endif\n}\n\nvoid main()\n{\n// Here's a helpful diagram to keep in mind while trying to\n// understand the code:\n//\n// | | | | |\n// -------------------------------\n// | | | | |\n// | 01 | 11 | 21 | 31 | <-- current scanline\n// | | @ | | |\n// -------------------------------\n// | | | | |\n// | 02 | 12 | 22 | 32 | <-- next scanline\n// | | | | |\n// -------------------------------\n// | | | | |\n//\n// Each character-cell represents a pixel on the output\n// surface, \"@\" represents the current pixel (always somewhere\n// in the bottom half of the current scan-line, or the top-half\n// of the next scanline). The grid of lines represents the\n// edges of the texels of the underlying texture.\n\n// Texture coordinates of the texel containing the active pixel.\nvec2 xy = (CURVATURE > 0.5) ? transform(TEX0.xy) : TEX0.xy;\n\nfloat cval = corner(xy);\n\n// Of all the pixels that are mapped onto the texel we are\n// currently rendering, which pixel are we currently rendering?\nvec2 ilvec = vec2(0.0,ilfac.y > 1.5 ? mod(float(FrameCount),2.0) : 0.0);\nvec2 ratio_scale = (xy * TextureSize - vec2(0.5) + ilvec)/ilfac;\n#ifdef OVERSAMPLE\nfloat filter_ = InputSize.y/OutputSize.y;//fwidth(ratio_scale.y);\n#endif\nvec2 uv_ratio = fract(ratio_scale);\n\n// Snap to the center of the underlying texel.\nxy = (floor(ratio_scale)*ilfac + vec2(0.5) - ilvec) / TextureSize;\n\n// Calculate Lanczos scaling coefficients describing the effect\n// of various neighbour texels in a scanline on the current\n// pixel.\nvec4 coeffs = PI * vec4(1.0 + uv_ratio.x, uv_ratio.x, 1.0 - uv_ratio.x, 2.0 - uv_ratio.x);\n\n// Prevent division by zero.\ncoeffs = FIX(coeffs);\n\n// Lanczos2 kernel.\ncoeffs = 2.0 * sin(coeffs) * sin(coeffs / 2.0) / (coeffs * coeffs);\n\n// Normalize.\ncoeffs /= dot(coeffs, vec4(1.0));\n\n// Calculate the effective colour of the current and next\n// scanlines at the horizontal location of the current pixel,\n// using the Lanczos coefficients above.\nvec4 col = clamp(mat4(\n TEX2D(xy + vec2(-one.x, 0.0)),\n TEX2D(xy),\n TEX2D(xy + vec2(one.x, 0.0)),\n TEX2D(xy + vec2(2.0 * one.x, 0.0))) * coeffs,\n 0.0, 1.0);\nvec4 col2 = clamp(mat4(\n TEX2D(xy + vec2(-one.x, one.y)),\n TEX2D(xy + vec2(0.0, one.y)),\n TEX2D(xy + one),\n TEX2D(xy + vec2(2.0 * one.x, one.y))) * coeffs,\n 0.0, 1.0);\n\n#ifndef LINEAR_PROCESSING\ncol = pow(col , vec4(CRTgamma));\ncol2 = pow(col2, vec4(CRTgamma));\n#endif\n\n// Calculate the influence of the current and next scanlines on\n// the current pixel.\nvec4 weights = scanlineWeights(uv_ratio.y, col);\nvec4 weights2 = scanlineWeights(1.0 - uv_ratio.y, col2);\n#ifdef OVERSAMPLE\nuv_ratio.y =uv_ratio.y+1.0/3.0*filter_;\nweights = (weights+scanlineWeights(uv_ratio.y, col))/3.0;\nweights2=(weights2+scanlineWeights(abs(1.0-uv_ratio.y), col2))/3.0;\nuv_ratio.y =uv_ratio.y-2.0/3.0*filter_;\nweights=weights+scanlineWeights(abs(uv_ratio.y), col)/3.0;\nweights2=weights2+scanlineWeights(abs(1.0-uv_ratio.y), col2)/3.0;\n#endif\n\nvec3 mul_res = (col * weights + col2 * weights2).rgb * vec3(cval);\n\n// dot-mask emulation:\n// Output pixels are alternately tinted green and magenta.\nvec3 dotMaskWeights = mix(\nvec3(1.0, 1.0 - DOTMASK, 1.0),\nvec3(1.0 - DOTMASK, 1.0, 1.0 - DOTMASK),\nfloor(mod(mod_factor, 2.0))\n);\n\nmul_res *= dotMaskWeights;\n\n// Convert the image gamma for display on our output device.\nmul_res = pow(mul_res, vec3(1.0 / monitorgamma));\n\n// Color the texel.\noutput_dummy _OUT;\n_OUT._color = vec4(mul_res, 1.0);\nFragColor = _OUT._color;\nreturn;\n} \n#endif\n\n", - "crt-mattias.glsl": "\n#pragma parameter CURVATURE \"Curvature\" 0.5 0.0 1.0 0.05\n#pragma parameter SCANSPEED \"Scanline Crawl Speed\" 1.0 0.0 10.0 0.5\n#if defined(VERTEX)\n#if __VERSION__ >= 130\n#define COMPAT_VARYING out\n#define COMPAT_ATTRIBUTE in\n#define COMPAT_TEXTURE texture\n#else\n#define COMPAT_VARYING varying \n#define COMPAT_ATTRIBUTE attribute \n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nCOMPAT_ATTRIBUTE vec4 VertexCoord;\nCOMPAT_ATTRIBUTE vec4 COLOR;\nCOMPAT_ATTRIBUTE vec4 TexCoord;\nCOMPAT_VARYING vec4 COL0;\nCOMPAT_VARYING vec4 TEX0;\n\nvec4 _oPosition1; \nuniform mat4 MVPMatrix;\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\n\n#define vTexCoord TEX0.xy\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nvoid main()\n{\n gl_Position = MVPMatrix * VertexCoord;\n TEX0.xy = TexCoord.xy;\n}\n\n#elif defined(FRAGMENT)\n\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING in\n#define COMPAT_TEXTURE texture\nout COMPAT_PRECISION vec4 FragColor;\n#else\n#define COMPAT_VARYING varying\n#define FragColor gl_FragColor\n#define COMPAT_TEXTURE texture2D\n#endif\n\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\nuniform sampler2D Texture;\nCOMPAT_VARYING vec4 TEX0;\n\n// compatibility #defines\n#define Source Texture\n#define vTexCoord TEX0.xy\n\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\n#ifdef PARAMETER_UNIFORM\nuniform COMPAT_PRECISION float CURVATURE, SCANSPEED;\n#else\n#define CURVATURE 0.5\n#define SCANSPEED 1.0\n#endif\n\n#define iChannel0 Texture\n#define iTime (float(FrameCount) / 60.0)\n#define iResolution OutputSize.xy\n#define fragCoord gl_FragCoord.xy\n\nvec3 sample_( sampler2D tex, vec2 tc )\n{\n vec3 s = pow(COMPAT_TEXTURE(tex,tc).rgb, vec3(2.2));\n return s;\n}\n\nvec3 blur(sampler2D tex, vec2 tc, float offs)\n{\n vec4 xoffs = offs * vec4(-2.0, -1.0, 1.0, 2.0) / (iResolution.x * TextureSize.x / InputSize.x);\n vec4 yoffs = offs * vec4(-2.0, -1.0, 1.0, 2.0) / (iResolution.y * TextureSize.y / InputSize.y);\n tc = tc * InputSize / TextureSize;\n \n vec3 color = vec3(0.0, 0.0, 0.0);\n color += sample_(tex,tc + vec2(xoffs.x, yoffs.x)) * 0.00366;\n color += sample_(tex,tc + vec2(xoffs.y, yoffs.x)) * 0.01465;\n color += sample_(tex,tc + vec2( 0.0, yoffs.x)) * 0.02564;\n color += sample_(tex,tc + vec2(xoffs.z, yoffs.x)) * 0.01465;\n color += sample_(tex,tc + vec2(xoffs.w, yoffs.x)) * 0.00366;\n \n color += sample_(tex,tc + vec2(xoffs.x, yoffs.y)) * 0.01465;\n color += sample_(tex,tc + vec2(xoffs.y, yoffs.y)) * 0.05861;\n color += sample_(tex,tc + vec2( 0.0, yoffs.y)) * 0.09524;\n color += sample_(tex,tc + vec2(xoffs.z, yoffs.y)) * 0.05861;\n color += sample_(tex,tc + vec2(xoffs.w, yoffs.y)) * 0.01465;\n \n color += sample_(tex,tc + vec2(xoffs.x, 0.0)) * 0.02564;\n color += sample_(tex,tc + vec2(xoffs.y, 0.0)) * 0.09524;\n color += sample_(tex,tc + vec2( 0.0, 0.0)) * 0.15018;\n color += sample_(tex,tc + vec2(xoffs.z, 0.0)) * 0.09524;\n color += sample_(tex,tc + vec2(xoffs.w, 0.0)) * 0.02564;\n \n color += sample_(tex,tc + vec2(xoffs.x, yoffs.z)) * 0.01465;\n color += sample_(tex,tc + vec2(xoffs.y, yoffs.z)) * 0.05861;\n color += sample_(tex,tc + vec2( 0.0, yoffs.z)) * 0.09524;\n color += sample_(tex,tc + vec2(xoffs.z, yoffs.z)) * 0.05861;\n color += sample_(tex,tc + vec2(xoffs.w, yoffs.z)) * 0.01465;\n \n color += sample_(tex,tc + vec2(xoffs.x, yoffs.w)) * 0.00366;\n color += sample_(tex,tc + vec2(xoffs.y, yoffs.w)) * 0.01465;\n color += sample_(tex,tc + vec2( 0.0, yoffs.w)) * 0.02564;\n color += sample_(tex,tc + vec2(xoffs.z, yoffs.w)) * 0.01465;\n color += sample_(tex,tc + vec2(xoffs.w, yoffs.w)) * 0.00366;\n\n return color;\n}\n\nfloat rand(vec2 co)\n{\n float a = 12.9898;\n float b = 78.233;\n float c = 43758.5453;\n float dt= dot(co.xy ,vec2(a,b));\n float sn= mod(dt,3.14);\n return fract(sin(sn) * c);\n}\n\nvec2 curve(vec2 uv)\n{\n uv = (uv - 0.5) * 2.0;\n uv *= 1.1;\t\n uv.x *= 1.0 + pow((abs(uv.y) / 5.0), 2.0);\n uv.y *= 1.0 + pow((abs(uv.x) / 4.0), 2.0);\n uv = (uv / 2.0) + 0.5;\n uv = uv *0.92 + 0.04;\n return uv;\n}\n\nvoid main()\n{\n vec2 q = (vTexCoord.xy * TextureSize.xy / InputSize.xy);//fragCoord.xy / iResolution.xy;\n vec2 uv = q;\n uv = mix( uv, curve( uv ), CURVATURE ) * InputSize.xy / TextureSize.xy;\n vec3 col;\n float x = sin(0.1*iTime+uv.y*21.0)*sin(0.23*iTime+uv.y*29.0)*sin(0.3+0.11*iTime+uv.y*31.0)*0.0017;\n float o =2.0*mod(fragCoord.y,2.0)/iResolution.x;\n x+=o;\n uv = uv * TextureSize / InputSize;\n col.r = 1.0*blur(iChannel0,vec2(uv.x+0.0009,uv.y+0.0009),1.2).x+0.005;\n col.g = 1.0*blur(iChannel0,vec2(uv.x+0.000,uv.y-0.0015),1.2).y+0.005;\n col.b = 1.0*blur(iChannel0,vec2(uv.x-0.0015,uv.y+0.000),1.2).z+0.005;\n col.r += 0.2*blur(iChannel0,vec2(uv.x+0.0009,uv.y+0.0009),2.25).x-0.005;\n col.g += 0.2*blur(iChannel0,vec2(uv.x+0.000,uv.y-0.0015),1.75).y-0.005;\n col.b += 0.2*blur(iChannel0,vec2(uv.x-0.0015,uv.y+0.000),1.25).z-0.005;\n float ghs = 0.05;\n col.r += ghs*(1.0-0.299)*blur(iChannel0,0.75*vec2(0.01, -0.027)+vec2(uv.x+0.001,uv.y+0.001),7.0).x;\n col.g += ghs*(1.0-0.587)*blur(iChannel0,0.75*vec2(-0.022, -0.02)+vec2(uv.x+0.000,uv.y-0.002),5.0).y;\n col.b += ghs*(1.0-0.114)*blur(iChannel0,0.75*vec2(-0.02, -0.0)+vec2(uv.x-0.002,uv.y+0.000),3.0).z;\n \n \n\n col = clamp(col*0.4+0.6*col*col*1.0,0.0,1.0);\n float vig = (0.0 + 1.0*16.0*uv.x*uv.y*(1.0-uv.x)*(1.0-uv.y));\n vig = pow(vig,0.3);\n col *= vec3(vig);\n\n col *= vec3(0.95,1.05,0.95);\n col = mix( col, col * col, 0.3) * 3.8;\n\n float scans = clamp( 0.35+0.15*sin(3.5*(iTime * SCANSPEED)+uv.y*iResolution.y*1.5), 0.0, 1.0);\n \n float s = pow(scans,0.9);\n col = col*vec3( s) ;\n\n col *= 1.0+0.0015*sin(300.0*iTime);\n \n col*=1.0-0.15*vec3(clamp((mod(fragCoord.x+o, 2.0)-1.0)*2.0,0.0,1.0));\n col *= vec3( 1.0 ) - 0.25*vec3( rand( uv+0.0001*iTime), rand( uv+0.0001*iTime + 0.3 ), rand( uv+0.0001*iTime+ 0.5 ) );\n col = pow(col, vec3(0.45));\n\n if (uv.x < 0.0 || uv.x > 1.0)\n col *= 0.0;\n if (uv.y < 0.0 || uv.y > 1.0)\n col *= 0.0;\n \n\n float comp = smoothstep( 0.1, 0.9, sin(iTime) );\n\n FragColor = vec4(col,1.0);\n} \n#endif\n" -} +window.EJS_SHADERS = { + "2xScaleHQ.glslp": "shaders = 1\n\nshader0 = \"2xScaleHQ.glsl\"\nfilter_linear0 = false\nscale_type_0 = source\n", + "4xScaleHQ.glslp": "shaders = 1\n\nshader0 = \"4xScaleHQ.glsl\"\nfilter_linear0 = false\nscale_type_0 = source\n", + "crt-easymode.glslp": "shaders = 1\n\nshader0 = crt-easymode.glsl\nfilter_linear0 = false\nscale_type_0 = source\n", + "crt-aperture.glslp": "shaders = 1\n\nshader0 = crt-aperture.glsl\nfilter_linear0 = false\n", + "crt-geom.glslp": "shaders = 1\n\nshader0 = crt-geom.glsl\nfilter_linear0 = false\nscale_type_0 = source\n", + "crt-mattias.glslp": "\nshaders = 1\nshader0 = crt-mattias.glsl\nfilter_linear0 = false\n", + "2xScaleHQ.glsl": "/*\n2xGLSLHqFilter shader\n\nCopyright (C) 2005 guest(r) - guest.r@gmail.com\n\nThis program is free software; you can redistribute it and/or\nmodify it under the terms of the GNU General Public License\nas published by the Free Software Foundation; either version 2\nof the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software\nFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n*/\n\n#if defined(VERTEX)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING out\n#define COMPAT_ATTRIBUTE in\n#define COMPAT_TEXTURE texture\n#else\n#define COMPAT_VARYING varying \n#define COMPAT_ATTRIBUTE attribute \n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nCOMPAT_ATTRIBUTE vec4 VertexCoord;\nCOMPAT_ATTRIBUTE vec4 COLOR;\nCOMPAT_ATTRIBUTE vec4 TexCoord;\nCOMPAT_VARYING vec4 COL0;\nCOMPAT_VARYING vec4 TEX0;\nCOMPAT_VARYING vec4 t1;\nCOMPAT_VARYING vec4 t2;\nCOMPAT_VARYING vec4 t3;\nCOMPAT_VARYING vec4 t4;\n\nvec4 _oPosition1; \nuniform mat4 MVPMatrix;\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\n\n// compatibility #defines\n#define vTexCoord TEX0.xy\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nvoid main()\n{\ngl_Position = MVPMatrix * VertexCoord;\nTEX0.xy = TexCoord.xy;\nfloat x = 0.5 * SourceSize.z;\nfloat y = 0.5 * SourceSize.w;\nvec2 dg1 = vec2( x, y);\nvec2 dg2 = vec2(-x, y);\nvec2 dx = vec2(x, 0.0);\nvec2 dy = vec2(0.0, y);\nt1 = vec4(vTexCoord - dg1, vTexCoord - dy);\nt2 = vec4(vTexCoord - dg2, vTexCoord + dx);\nt3 = vec4(vTexCoord + dg1, vTexCoord + dy);\nt4 = vec4(vTexCoord + dg2, vTexCoord - dx);\n}\n\n#elif defined(FRAGMENT)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING in\n#define COMPAT_TEXTURE texture\nout vec4 FragColor;\n#else\n#define COMPAT_VARYING varying\n#define FragColor gl_FragColor\n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\nuniform sampler2D Texture;\nCOMPAT_VARYING vec4 TEX0;\nCOMPAT_VARYING vec4 t1;\nCOMPAT_VARYING vec4 t2;\nCOMPAT_VARYING vec4 t3;\nCOMPAT_VARYING vec4 t4;\n\n// compatibility #defines\n#define Source Texture\n#define vTexCoord TEX0.xy\n\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nfloat mx = 0.325; // start smoothing wt.\nfloat k = -0.250; // wt. decrease factor\nfloat max_w = 0.25; // max filter weight\nfloat min_w =-0.05; // min filter weight\nfloat lum_add = 0.25; // affects smoothing\nvec3 dt = vec3(1.0);\n\nvoid main()\n{\nvec3 c00 = COMPAT_TEXTURE(Source, t1.xy).xyz; \nvec3 c10 = COMPAT_TEXTURE(Source, t1.zw).xyz; \nvec3 c20 = COMPAT_TEXTURE(Source, t2.xy).xyz; \nvec3 c01 = COMPAT_TEXTURE(Source, t4.zw).xyz; \nvec3 c11 = COMPAT_TEXTURE(Source, vTexCoord).xyz; \nvec3 c21 = COMPAT_TEXTURE(Source, t2.zw).xyz; \nvec3 c02 = COMPAT_TEXTURE(Source, t4.xy).xyz; \nvec3 c12 = COMPAT_TEXTURE(Source, t3.zw).xyz; \nvec3 c22 = COMPAT_TEXTURE(Source, t3.xy).xyz; \n\nfloat md1 = dot(abs(c00 - c22), dt);\nfloat md2 = dot(abs(c02 - c20), dt);\n\nfloat w1 = dot(abs(c22 - c11), dt) * md2;\nfloat w2 = dot(abs(c02 - c11), dt) * md1;\nfloat w3 = dot(abs(c00 - c11), dt) * md2;\nfloat w4 = dot(abs(c20 - c11), dt) * md1;\n\nfloat t1 = w1 + w3;\nfloat t2 = w2 + w4;\nfloat ww = max(t1, t2) + 0.0001;\n\nc11 = (w1 * c00 + w2 * c20 + w3 * c22 + w4 * c02 + ww * c11) / (t1 + t2 + ww);\n\nfloat lc1 = k / (0.12 * dot(c10 + c12 + c11, dt) + lum_add);\nfloat lc2 = k / (0.12 * dot(c01 + c21 + c11, dt) + lum_add);\n\nw1 = clamp(lc1 * dot(abs(c11 - c10), dt) + mx, min_w, max_w);\nw2 = clamp(lc2 * dot(abs(c11 - c21), dt) + mx, min_w, max_w);\nw3 = clamp(lc1 * dot(abs(c11 - c12), dt) + mx, min_w, max_w);\nw4 = clamp(lc2 * dot(abs(c11 - c01), dt) + mx, min_w, max_w);\nFragColor = vec4(w1 * c10 + w2 * c21 + w3 * c12 + w4 * c01 + (1.0 - w1 - w2 - w3 - w4) * c11, 1.0);\n} \n#endif\n", + "4xScaleHQ.glsl": "/*\n4xGLSLHqFilter shader\n\nCopyright (C) 2005 guest(r) - guest.r@gmail.com\n\nThis program is free software; you can redistribute it and/or\nmodify it under the terms of the GNU General Public License\nas published by the Free Software Foundation; either version 2\nof the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software\nFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n*/\n\n#if defined(VERTEX)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING out\n#define COMPAT_ATTRIBUTE in\n#define COMPAT_TEXTURE texture\n#else\n#define COMPAT_VARYING varying \n#define COMPAT_ATTRIBUTE attribute \n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nCOMPAT_ATTRIBUTE vec4 VertexCoord;\nCOMPAT_ATTRIBUTE vec4 COLOR;\nCOMPAT_ATTRIBUTE vec4 TexCoord;\nCOMPAT_VARYING vec4 COL0;\nCOMPAT_VARYING vec4 TEX0;\nCOMPAT_VARYING vec4 t1;\nCOMPAT_VARYING vec4 t2;\nCOMPAT_VARYING vec4 t3;\nCOMPAT_VARYING vec4 t4;\nCOMPAT_VARYING vec4 t5;\nCOMPAT_VARYING vec4 t6;\n\nvec4 _oPosition1; \nuniform mat4 MVPMatrix;\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\n\n// compatibility #defines\n#define vTexCoord TEX0.xy\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nvoid main()\n{\ngl_Position = MVPMatrix * VertexCoord;\nTEX0.xy = TexCoord.xy;\nfloat x = 0.5 * SourceSize.z;\nfloat y = 0.5 * SourceSize.w;\nvec2 dg1 = vec2( x, y);\nvec2 dg2 = vec2(-x, y);\nvec2 sd1 = dg1 * 0.5;\nvec2 sd2 = dg2 * 0.5;\nvec2 ddx = vec2(x, 0.0);\nvec2 ddy = vec2(0.0, y);\nt1 = vec4(vTexCoord - sd1, vTexCoord - ddy);\nt2 = vec4(vTexCoord - sd2, vTexCoord + ddx);\nt3 = vec4(vTexCoord + sd1, vTexCoord + ddy);\nt4 = vec4(vTexCoord + sd2, vTexCoord - ddx);\nt5 = vec4(vTexCoord - dg1, vTexCoord - dg2);\nt6 = vec4(vTexCoord + dg1, vTexCoord + dg2);\n}\n\n#elif defined(FRAGMENT)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING in\n#define COMPAT_TEXTURE texture\nout vec4 FragColor;\n#else\n#define COMPAT_VARYING varying\n#define FragColor gl_FragColor\n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\nuniform sampler2D Texture;\nCOMPAT_VARYING vec4 TEX0;\nCOMPAT_VARYING vec4 t1;\nCOMPAT_VARYING vec4 t2;\nCOMPAT_VARYING vec4 t3;\nCOMPAT_VARYING vec4 t4;\nCOMPAT_VARYING vec4 t5;\nCOMPAT_VARYING vec4 t6;\n\n// compatibility #defines\n#define Source Texture\n#define vTexCoord TEX0.xy\n\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nfloat mx = 1.0; // start smoothing wt.\nfloat k = -1.10; // wt. decrease factor\nfloat max_w = 0.75; // max filter weight\nfloat min_w = 0.03; // min filter weight\nfloat lum_add = 0.33; // affects smoothing\nvec3 dt = vec3(1.0);\n\nvoid main()\n{\nvec3 c = COMPAT_TEXTURE(Source, vTexCoord).xyz;\nvec3 i1 = COMPAT_TEXTURE(Source, t1.xy).xyz; \nvec3 i2 = COMPAT_TEXTURE(Source, t2.xy).xyz; \nvec3 i3 = COMPAT_TEXTURE(Source, t3.xy).xyz; \nvec3 i4 = COMPAT_TEXTURE(Source, t4.xy).xyz; \nvec3 o1 = COMPAT_TEXTURE(Source, t5.xy).xyz; \nvec3 o3 = COMPAT_TEXTURE(Source, t6.xy).xyz; \nvec3 o2 = COMPAT_TEXTURE(Source, t5.zw).xyz;\nvec3 o4 = COMPAT_TEXTURE(Source, t6.zw).xyz;\nvec3 s1 = COMPAT_TEXTURE(Source, t1.zw).xyz; \nvec3 s2 = COMPAT_TEXTURE(Source, t2.zw).xyz; \nvec3 s3 = COMPAT_TEXTURE(Source, t3.zw).xyz; \nvec3 s4 = COMPAT_TEXTURE(Source, t4.zw).xyz; \n\nfloat ko1=dot(abs(o1-c),dt);\nfloat ko2=dot(abs(o2-c),dt);\nfloat ko3=dot(abs(o3-c),dt);\nfloat ko4=dot(abs(o4-c),dt);\n\nfloat k1=min(dot(abs(i1-i3),dt),max(ko1,ko3));\nfloat k2=min(dot(abs(i2-i4),dt),max(ko2,ko4));\n\nfloat w1 = k2; if(ko3= 130\n #define COMPAT_VARYING out\n #define COMPAT_ATTRIBUTE in\n #define COMPAT_TEXTURE texture\n #else\n #define COMPAT_VARYING varying\n #define COMPAT_ATTRIBUTE attribute\n #define COMPAT_TEXTURE texture2D\n #endif\n \n #ifdef GL_ES\n #define COMPAT_PRECISION mediump\n #else\n #define COMPAT_PRECISION\n #endif\n COMPAT_VARYING float _frame_rotation;\n struct input_dummy {\n vec2 _video_size;\n vec2 _texture_size;\n vec2 _output_dummy_size;\n float _frame_count;\n float _frame_direction;\n float _frame_rotation;\n };\n vec4 _oPosition1;\n vec4 _r0005;\n COMPAT_ATTRIBUTE vec4 VertexCoord;\n COMPAT_ATTRIBUTE vec4 TexCoord;\n COMPAT_VARYING vec4 TEX0;\n \n uniform mat4 MVPMatrix;\n uniform int FrameDirection;\n uniform int FrameCount;\n uniform COMPAT_PRECISION vec2 OutputSize;\n uniform COMPAT_PRECISION vec2 TextureSize;\n uniform COMPAT_PRECISION vec2 InputSize;\n void main()\n {\n vec2 _oTex;\n _r0005 = VertexCoord.x*MVPMatrix[0];\n _r0005 = _r0005 + VertexCoord.y*MVPMatrix[1];\n _r0005 = _r0005 + VertexCoord.z*MVPMatrix[2];\n _r0005 = _r0005 + VertexCoord.w*MVPMatrix[3];\n _oPosition1 = _r0005;\n _oTex = TexCoord.xy;\n gl_Position = _r0005;\n TEX0.xy = TexCoord.xy;\n }\n #elif defined(FRAGMENT)\n \n #if __VERSION__ >= 130\n #define COMPAT_VARYING in\n #define COMPAT_TEXTURE texture\n out vec4 FragColor;\n #else\n #define COMPAT_VARYING varying\n #define FragColor gl_FragColor\n #define COMPAT_TEXTURE texture2D\n #endif\n \n #ifdef GL_ES\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n #define COMPAT_PRECISION mediump\n #else\n #define COMPAT_PRECISION\n #endif\n COMPAT_VARYING float _frame_rotation;\n struct input_dummy {\n vec2 _video_size;\n vec2 _texture_size;\n vec2 _output_dummy_size;\n float _frame_count;\n float _frame_direction;\n float _frame_rotation;\n };\n vec4 _ret_0;\n float _TMP30;\n float _TMP29;\n float _TMP28;\n float _TMP13;\n float _TMP32;\n float _TMP11;\n float _TMP10;\n float _TMP31;\n float _TMP9;\n float _TMP8;\n float _TMP15;\n float _TMP14;\n float _TMP33;\n vec4 _TMP34;\n vec4 _TMP27;\n vec4 _TMP25;\n vec4 _TMP23;\n vec4 _TMP21;\n vec4 _TMP26;\n vec4 _TMP24;\n vec4 _TMP22;\n vec4 _TMP20;\n float _TMP4;\n vec4 _TMP3;\n vec4 _TMP2;\n float _TMP19;\n float _TMP18;\n float _TMP17;\n float _TMP16;\n vec4 _TMP1;\n vec2 _TMP0;\n uniform sampler2D Texture;\n input_dummy _IN1;\n float _TMP43;\n float _x_step0044;\n float _curve0044;\n float _a0048;\n float _val0052;\n float _a0052;\n vec4 _TMP57;\n vec4 _x0072;\n vec2 _c0086;\n vec4 _x0088;\n vec4 _x0094;\n vec2 _c0098;\n vec4 _x0100;\n vec2 _c0104;\n vec4 _x0106;\n vec4 _sample_min0110;\n vec4 _sample_max0110;\n vec4 _r0112;\n vec4 _TMP117;\n vec2 _co0124;\n vec2 _c0126;\n vec4 _x0128;\n vec4 _x0134;\n vec2 _c0138;\n vec4 _x0140;\n vec2 _c0144;\n vec4 _x0146;\n vec4 _sample_min0150;\n vec4 _sample_max0150;\n vec4 _r0152;\n vec4 _TMP157;\n float _TMP163;\n float _x_step0164;\n float _curve0164;\n float _a0168;\n float _val0172;\n float _a0172;\n float _TMP183;\n float _TMP189;\n float _x0190;\n float _a0196;\n float _x0198;\n vec2 _x0200;\n float _x0208;\n COMPAT_VARYING vec4 TEX0;\n \n uniform COMPAT_PRECISION vec2 OutputSize;\n uniform COMPAT_PRECISION vec2 TextureSize;\n uniform COMPAT_PRECISION vec2 InputSize;\n void main()\n {\n vec2 _dx1;\n vec2 _dy;\n vec2 _pix_co;\n vec2 _tex_co;\n vec2 _dist;\n vec3 _col2;\n vec3 _col21;\n vec4 _coeffs1;\n float _luma;\n float _bright;\n float _scan_weight;\n vec2 _mod_fac;\n int _dot_no;\n vec3 _mask_weight;\n vec3 _TMP37;\n _dx1 = vec2(1.00000000E+00/TextureSize.x, 0.00000000E+00);\n _dy = vec2(0.00000000E+00, 1.00000000E+00/TextureSize.y);\n _pix_co = TEX0.xy*TextureSize - vec2( 5.00000000E-01, 5.00000000E-01);\n _TMP0 = floor(_pix_co);\n _tex_co = (_TMP0 + vec2( 5.00000000E-01, 5.00000000E-01))/TextureSize;\n _dist = fract(_pix_co);\n _x_step0044 = float((_dist.x >= 5.00000000E-01));\n _a0048 = 2.50000000E-01 - (_dist.x - _x_step0044)*(_dist.x - _x_step0044);\n _TMP33 = inversesqrt(_a0048);\n _TMP14 = 1.00000000E+00/_TMP33;\n _a0052 = 5.00000000E-01 - _dist.x;\n _val0052 = float((_a0052 > 0.00000000E+00));\n _TMP15 = _val0052 - float((_a0052 < 0.00000000E+00));\n _curve0044 = 5.00000000E-01 - _TMP14*_TMP15;\n _TMP43 = _dist.x + 2.50000000E-01*(_curve0044 - _dist.x);\n _coeffs1 = 3.14159274E+00*vec4(1.00000000E+00 + _TMP43, _TMP43, 1.00000000E+00 - _TMP43, 2.00000000E+00 - _TMP43);\n _TMP1 = abs(_coeffs1);\n _TMP57 = max(_TMP1, vec4( 9.99999975E-06, 9.99999975E-06, 9.99999975E-06, 9.99999975E-06));\n _TMP16 = sin(_TMP57.x);\n _TMP17 = sin(_TMP57.y);\n _TMP18 = sin(_TMP57.z);\n _TMP19 = sin(_TMP57.w);\n _TMP2 = vec4(_TMP16, _TMP17, _TMP18, _TMP19);\n _x0072 = _TMP57/2.00000000E+00;\n _TMP16 = sin(_x0072.x);\n _TMP17 = sin(_x0072.y);\n _TMP18 = sin(_x0072.z);\n _TMP19 = sin(_x0072.w);\n _TMP3 = vec4(_TMP16, _TMP17, _TMP18, _TMP19);\n _coeffs1 = ((2.00000000E+00*_TMP2)*_TMP3)/(_TMP57*_TMP57);\n _TMP4 = dot(_coeffs1, vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _coeffs1 = _coeffs1/_TMP4;\n _c0086 = _tex_co - _dx1;\n _TMP20 = COMPAT_TEXTURE(Texture, _c0086);\n _x0088 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP20 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP21 = _TMP20*_x0088;\n _TMP22 = COMPAT_TEXTURE(Texture, _tex_co);\n _x0094 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP22 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP23 = _TMP22*_x0094;\n _c0098 = _tex_co + _dx1;\n _TMP24 = COMPAT_TEXTURE(Texture, _c0098);\n _x0100 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP24 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP25 = _TMP24*_x0100;\n _c0104 = _tex_co + 2.00000000E+00*_dx1;\n _TMP26 = COMPAT_TEXTURE(Texture, _c0104);\n _x0106 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP26 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP27 = _TMP26*_x0106;\n _r0112 = _coeffs1.x*_TMP21;\n _r0112 = _r0112 + _coeffs1.y*_TMP23;\n _r0112 = _r0112 + _coeffs1.z*_TMP25;\n _r0112 = _r0112 + _coeffs1.w*_TMP27;\n _sample_min0110 = min(_TMP23, _TMP25);\n _sample_max0110 = max(_TMP23, _TMP25);\n _TMP34 = min(_sample_max0110, _r0112);\n _TMP117 = max(_sample_min0110, _TMP34);\n _co0124 = _tex_co + _dy;\n _c0126 = _co0124 - _dx1;\n _TMP20 = COMPAT_TEXTURE(Texture, _c0126);\n _x0128 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP20 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP21 = _TMP20*_x0128;\n _TMP22 = COMPAT_TEXTURE(Texture, _co0124);\n _x0134 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP22 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP23 = _TMP22*_x0134;\n _c0138 = _co0124 + _dx1;\n _TMP24 = COMPAT_TEXTURE(Texture, _c0138);\n _x0140 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP24 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP25 = _TMP24*_x0140;\n _c0144 = _co0124 + 2.00000000E+00*_dx1;\n _TMP26 = COMPAT_TEXTURE(Texture, _c0144);\n _x0146 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP26 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP27 = _TMP26*_x0146;\n _r0152 = _coeffs1.x*_TMP21;\n _r0152 = _r0152 + _coeffs1.y*_TMP23;\n _r0152 = _r0152 + _coeffs1.z*_TMP25;\n _r0152 = _r0152 + _coeffs1.w*_TMP27;\n _sample_min0150 = min(_TMP23, _TMP25);\n _sample_max0150 = max(_TMP23, _TMP25);\n _TMP34 = min(_sample_max0150, _r0152);\n _TMP157 = max(_sample_min0150, _TMP34);\n _x_step0164 = float((_dist.y >= 5.00000000E-01));\n _a0168 = 2.50000000E-01 - (_dist.y - _x_step0164)*(_dist.y - _x_step0164);\n _TMP33 = inversesqrt(_a0168);\n _TMP14 = 1.00000000E+00/_TMP33;\n _a0172 = 5.00000000E-01 - _dist.y;\n _val0172 = float((_a0172 > 0.00000000E+00));\n _TMP15 = _val0172 - float((_a0172 < 0.00000000E+00));\n _curve0164 = 5.00000000E-01 - _TMP14*_TMP15;\n _TMP163 = _dist.y + (_curve0164 - _dist.y);\n _col2 = _TMP117.xyz + _TMP163*(_TMP157.xyz - _TMP117.xyz);\n _luma = dot(vec3( 2.12599993E-01, 7.15200007E-01, 7.22000003E-02), _col2);\n _TMP8 = max(_col2.y, _col2.z);\n _TMP9 = max(_col2.x, _TMP8);\n _bright = (_TMP9 + _luma)/2.00000000E+00;\n _TMP31 = min(6.49999976E-01, _bright);\n _TMP183 = max(3.49999994E-01, _TMP31);\n _x0190 = _bright*1.50000000E+00;\n _TMP31 = min(1.50000000E+00, _x0190);\n _TMP189 = max(1.50000000E+00, _TMP31);\n _a0196 = TEX0.y*2.00000000E+00*3.14159274E+00*TextureSize.y;\n _TMP10 = cos(_a0196);\n _x0198 = _TMP10*5.00000000E-01 + 5.00000000E-01;\n _TMP11 = pow(_x0198, _TMP189);\n _scan_weight = 1.00000000E+00 - _TMP11;\n _x0200 = (TEX0.xy*OutputSize*TextureSize)/InputSize;\n _mod_fac = floor(_x0200);\n _x0208 = _mod_fac.x/3.00000000E+00;\n _TMP32 = floor(_x0208);\n _TMP13 = _mod_fac.x - 3.00000000E+00*_TMP32;\n _dot_no = int(_TMP13);\n if (_dot_no == 0) {\n _mask_weight = vec3( 1.00000000E+00, 6.99999988E-01, 6.99999988E-01);\n } else {\n if (_dot_no == 1) {\n _mask_weight = vec3( 6.99999988E-01, 1.00000000E+00, 6.99999988E-01);\n } else {\n _mask_weight = vec3( 6.99999988E-01, 6.99999988E-01, 1.00000000E+00);\n }\n }\n if (InputSize.y >= 4.00000000E+02) {\n _scan_weight = 1.00000000E+00;\n }\n _col21 = _col2.xyz;\n _col2 = _col2*vec3(_scan_weight, _scan_weight, _scan_weight);\n _col2 = _col2 + _TMP183*(_col21 - _col2);\n _col2 = _col2*_mask_weight;\n _TMP28 = pow(_col2.x, 5.55555582E-01);\n _TMP29 = pow(_col2.y, 5.55555582E-01);\n _TMP30 = pow(_col2.z, 5.55555582E-01);\n _col2 = vec3(_TMP28, _TMP29, _TMP30);\n _TMP37 = _col2*1.20000005E+00;\n _ret_0 = vec4(_TMP37.x, _TMP37.y, _TMP37.z, 1.00000000E+00);\n FragColor = _ret_0;\n return;\n }\n #endif\n", + "crt-aperture.glsl": "\n/*\nCRT Shader by EasyMode\nLicense: GPL\n*/\n/*\n#pragma parameter SHARPNESS_IMAGE \"Sharpness Image\" 1.0 1.0 5.0 1.0\n#pragma parameter SHARPNESS_EDGES \"Sharpness Edges\" 3.0 1.0 5.0 1.0\n#pragma parameter GLOW_WIDTH \"Glow Width\" 0.5 0.05 0.65 0.05\n#pragma parameter GLOW_HEIGHT \"Glow Height\" 0.5 0.05 0.65 0.05\n#pragma parameter GLOW_HALATION \"Glow Halation\" 0.1 0.0 1.0 0.01\n#pragma parameter GLOW_DIFFUSION \"Glow Diffusion\" 0.05 0.0 1.0 0.01\n#pragma parameter MASK_COLORS \"Mask Colors\" 2.0 2.0 3.0 1.0\n#pragma parameter MASK_STRENGTH \"Mask Strength\" 0.3 0.0 1.0 0.05\n#pragma parameter MASK_SIZE \"Mask Size\" 1.0 1.0 9.0 1.0\n#pragma parameter SCANLINE_SIZE_MIN \"Scanline Size Min.\" 0.5 0.5 1.5 0.05\n#pragma parameter SCANLINE_SIZE_MAX \"Scanline Size Max.\" 1.5 0.5 1.5 0.05\n#pragma parameter GAMMA_INPUT \"Gamma Input\" 2.4 1.0 5.0 0.1\n#pragma parameter GAMMA_OUTPUT \"Gamma Output\" 2.4 1.0 5.0 0.1\n#pragma parameter BRIGHTNESS \"Brightness\" 1.5 0.0 2.0 0.05\n* */\n\n#define Coord TEX0\n\n#if defined(VERTEX)\n\n#if __VERSION__ >= 130\n#define OUT out\n#define IN in\n#define tex2D texture\n#else\n#define OUT varying \n#define IN attribute \n#define tex2D texture2D\n#endif\n\n#ifdef GL_ES\n#define PRECISION mediump\n#else\n#define PRECISION\n#endif\n\nIN vec4 VertexCoord;\nIN vec4 Color;\nIN vec2 TexCoord;\nOUT vec4 color;\nOUT vec2 Coord;\n\nuniform mat4 MVPMatrix;\nuniform PRECISION int FrameDirection;\nuniform PRECISION int FrameCount;\nuniform PRECISION vec2 OutputSize;\nuniform PRECISION vec2 TextureSize;\nuniform PRECISION vec2 InputSize;\n\nvoid main()\n{\ngl_Position = MVPMatrix * VertexCoord;\ncolor = Color;\nCoord = TexCoord;\n}\n\n#elif defined(FRAGMENT)\n\n#if __VERSION__ >= 130\n#define IN in\n#define tex2D texture\nout vec4 FragColor;\n#else\n#define IN varying\n#define FragColor gl_FragColor\n#define tex2D texture2D\n#endif\n\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define PRECISION mediump\n#else\n#define PRECISION\n#endif\n\nuniform PRECISION int FrameDirection;\nuniform PRECISION int FrameCount;\nuniform PRECISION vec2 OutputSize;\nuniform PRECISION vec2 TextureSize;\nuniform PRECISION vec2 InputSize;\nuniform sampler2D Texture;\nIN vec2 Coord;\n\n#ifdef PARAMETER_UNIFORM\nuniform PRECISION float SHARPNESS_IMAGE;\nuniform PRECISION float SHARPNESS_EDGES;\nuniform PRECISION float GLOW_WIDTH;\nuniform PRECISION float GLOW_HEIGHT;\nuniform PRECISION float GLOW_HALATION;\nuniform PRECISION float GLOW_DIFFUSION;\nuniform PRECISION float MASK_COLORS;\nuniform PRECISION float MASK_STRENGTH;\nuniform PRECISION float MASK_SIZE;\nuniform PRECISION float SCANLINE_SIZE_MIN;\nuniform PRECISION float SCANLINE_SIZE_MAX;\nuniform PRECISION float GAMMA_INPUT;\nuniform PRECISION float GAMMA_OUTPUT;\nuniform PRECISION float BRIGHTNESS;\n#else\n#define SHARPNESS_IMAGE 1.0\n#define SHARPNESS_EDGES 3.0\n#define GLOW_WIDTH 0.5\n#define GLOW_HEIGHT 0.5\n#define GLOW_HALATION 0.1\n#define GLOW_DIFFUSION 0.05\n#define MASK_COLORS 2.0\n#define MASK_STRENGTH 0.3\n#define MASK_SIZE 1.0\n#define SCANLINE_SIZE_MIN 0.5\n#define SCANLINE_SIZE_MAX 1.5\n#define GAMMA_INPUT 2.4\n#define GAMMA_OUTPUT 2.4\n#define BRIGHTNESS 1.5\n#endif\n\n#define FIX(c) max(abs(c), 1e-5)\n#define PI 3.141592653589\n#define saturate(c) clamp(c, 0.0, 1.0)\n#define TEX2D(c) pow(tex2D(tex, c).rgb, vec3(GAMMA_INPUT))\n\nmat3 get_color_matrix(sampler2D tex, vec2 co, vec2 dx)\n{\nreturn mat3(TEX2D(co - dx), TEX2D(co), TEX2D(co + dx));\n}\n\nvec3 blur(mat3 m, float dist, float rad)\n{\nvec3 x = vec3(dist - 1.0, dist, dist + 1.0) / rad;\nvec3 w = exp2(x * x * -1.0);\n\nreturn (m[0] * w.x + m[1] * w.y + m[2] * w.z) / (w.x + w.y + w.z);\n}\n\nvec3 filter_gaussian(sampler2D tex, vec2 co, vec2 tex_size)\n{\nvec2 dx = vec2(1.0 / tex_size.x, 0.0);\nvec2 dy = vec2(0.0, 1.0 / tex_size.y);\nvec2 pix_co = co * tex_size;\nvec2 tex_co = (floor(pix_co) + 0.5) / tex_size;\nvec2 dist = (fract(pix_co) - 0.5) * -1.0;\n\nmat3 line0 = get_color_matrix(tex, tex_co - dy, dx);\nmat3 line1 = get_color_matrix(tex, tex_co, dx);\nmat3 line2 = get_color_matrix(tex, tex_co + dy, dx);\nmat3 column = mat3(blur(line0, dist.x, GLOW_WIDTH),\n blur(line1, dist.x, GLOW_WIDTH),\n blur(line2, dist.x, GLOW_WIDTH));\n\nreturn blur(column, dist.y, GLOW_HEIGHT);\n}\n\nvec3 filter_lanczos(sampler2D tex, vec2 co, vec2 tex_size, float sharp)\n{\ntex_size.x *= sharp;\n\nvec2 dx = vec2(1.0 / tex_size.x, 0.0);\nvec2 pix_co = co * tex_size - vec2(0.5, 0.0);\nvec2 tex_co = (floor(pix_co) + vec2(0.5, 0.0)) / tex_size;\nvec2 dist = fract(pix_co);\nvec4 coef = PI * vec4(dist.x + 1.0, dist.x, dist.x - 1.0, dist.x - 2.0);\n\ncoef = FIX(coef);\ncoef = 2.0 * sin(coef) * sin(coef / 2.0) / (coef * coef);\ncoef /= dot(coef, vec4(1.0));\n\nvec4 col1 = vec4(TEX2D(tex_co), 1.0);\nvec4 col2 = vec4(TEX2D(tex_co + dx), 1.0);\n\nreturn (mat4(col1, col1, col2, col2) * coef).rgb;\n}\n\nvec3 get_scanline_weight(float x, vec3 col)\n{\nvec3 beam = mix(vec3(SCANLINE_SIZE_MIN), vec3(SCANLINE_SIZE_MAX), col);\nvec3 x_mul = 2.0 / beam;\nvec3 x_offset = x_mul * 0.5;\n\nreturn smoothstep(0.0, 1.0, 1.0 - abs(x * x_mul - x_offset)) * x_offset;\n}\n\nvec3 get_mask_weight(float x)\n{\nfloat i = mod(floor(x * OutputSize.x * TextureSize.x / (InputSize.x * MASK_SIZE)), MASK_COLORS);\n\nif (i == 0.0) return mix(vec3(1.0, 0.0, 1.0), vec3(1.0, 0.0, 0.0), MASK_COLORS - 2.0);\nelse if (i == 1.0) return vec3(0.0, 1.0, 0.0);\nelse return vec3(0.0, 0.0, 1.0);\n}\n\nvoid main()\n{\nvec3 col_glow = filter_gaussian(Texture, Coord, TextureSize);\nvec3 col_soft = filter_lanczos(Texture, Coord, TextureSize, SHARPNESS_IMAGE);\nvec3 col_sharp = filter_lanczos(Texture, Coord, TextureSize, SHARPNESS_EDGES);\nvec3 col = sqrt(col_sharp * col_soft);\n\ncol *= get_scanline_weight(fract(Coord.y * TextureSize.y), col_soft);\ncol_glow = saturate(col_glow - col);\ncol += col_glow * col_glow * GLOW_HALATION;\ncol = mix(col, col * get_mask_weight(Coord.x) * MASK_COLORS, MASK_STRENGTH);\ncol += col_glow * GLOW_DIFFUSION;\ncol = pow(col * BRIGHTNESS, vec3(1.0 / GAMMA_OUTPUT));\n\nFragColor = vec4(col, 1.0);\n}\n\n#endif\n", + "crt-geom.glsl": "\n/*\nCRT-interlaced\n\nCopyright (C) 2010-2012 cgwg, Themaister and DOLLS\n\nThis program is free software; you can redistribute it and/or modify it\nunder the terms of the GNU General Public License as published by the Free\nSoftware Foundation; either version 2 of the License, or (at your option)\nany later version.\n\n(cgwg gave their consent to have the original version of this shader\ndistributed under the GPL in this message:\n\nhttp://board.byuu.org/viewtopic.php?p=26075#p26075\n\n\"Feel free to distribute my shaders under the GPL. After all, the\nbarrel distortion code was taken from the Curvature shader, which is\nunder the GPL.\"\n)\nThis shader variant is pre-configured with screen curvature\n*/\n/*\n#pragma parameter CRTgamma \"CRTGeom Target Gamma\" 2.4 0.1 5.0 0.1\n#pragma parameter monitorgamma \"CRTGeom Monitor Gamma\" 2.2 0.1 5.0 0.1\n#pragma parameter d \"CRTGeom Distance\" 1.6 0.1 3.0 0.1\n#pragma parameter CURVATURE \"CRTGeom Curvature Toggle\" 1.0 0.0 1.0 1.0\n#pragma parameter R \"CRTGeom Curvature Radius\" 2.0 0.1 10.0 0.1\n#pragma parameter cornersize \"CRTGeom Corner Size\" 0.03 0.001 1.0 0.005\n#pragma parameter cornersmooth \"CRTGeom Corner Smoothness\" 1000.0 80.0 2000.0 100.0\n#pragma parameter x_tilt \"CRTGeom Horizontal Tilt\" 0.0 -0.5 0.5 0.05\n#pragma parameter y_tilt \"CRTGeom Vertical Tilt\" 0.0 -0.5 0.5 0.05\n#pragma parameter overscan_x \"CRTGeom Horiz. Overscan %\" 100.0 -125.0 125.0 1.0\n#pragma parameter overscan_y \"CRTGeom Vert. Overscan %\" 100.0 -125.0 125.0 1.0\n#pragma parameter DOTMASK \"CRTGeom Dot Mask Toggle\" 0.3 0.0 0.3 0.3\n#pragma parameter SHARPER \"CRTGeom Sharpness\" 1.0 1.0 3.0 1.0\n#pragma parameter scanline_weight \"CRTGeom Scanline Weight\" 0.3 0.1 0.5 0.05\n*/\n\n#ifndef PARAMETER_UNIFORM\n#define CRTgamma 2.4\n#define monitorgamma 2.2\n#define d 1.6\n#define CURVATURE 1.0\n#define R 2.0\n#define cornersize 0.03\n#define cornersmooth 1000.0\n#define x_tilt 0.0\n#define y_tilt 0.0\n#define overscan_x 100.0\n#define overscan_y 100.0\n#define DOTMASK 0.3\n#define SHARPER 1.0\n#define scanline_weight 0.3\n#endif\n\n#if defined(VERTEX)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING out\n#define COMPAT_ATTRIBUTE in\n#define COMPAT_TEXTURE texture\n#else\n#define COMPAT_VARYING varying \n#define COMPAT_ATTRIBUTE attribute \n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nCOMPAT_ATTRIBUTE vec4 VertexCoord;\nCOMPAT_ATTRIBUTE vec4 COLOR;\nCOMPAT_ATTRIBUTE vec4 TexCoord;\nCOMPAT_VARYING vec4 COL0;\nCOMPAT_VARYING vec4 TEX0;\n\nvec4 _oPosition1; \nuniform mat4 MVPMatrix;\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\n\nCOMPAT_VARYING vec2 overscan;\nCOMPAT_VARYING vec2 aspect;\nCOMPAT_VARYING vec3 stretch;\nCOMPAT_VARYING vec2 sinangle;\nCOMPAT_VARYING vec2 cosangle;\nCOMPAT_VARYING vec2 one;\nCOMPAT_VARYING float mod_factor;\nCOMPAT_VARYING vec2 ilfac;\n\n#ifdef PARAMETER_UNIFORM\nuniform COMPAT_PRECISION float CRTgamma;\nuniform COMPAT_PRECISION float monitorgamma;\nuniform COMPAT_PRECISION float d;\nuniform COMPAT_PRECISION float CURVATURE;\nuniform COMPAT_PRECISION float R;\nuniform COMPAT_PRECISION float cornersize;\nuniform COMPAT_PRECISION float cornersmooth;\nuniform COMPAT_PRECISION float x_tilt;\nuniform COMPAT_PRECISION float y_tilt;\nuniform COMPAT_PRECISION float overscan_x;\nuniform COMPAT_PRECISION float overscan_y;\nuniform COMPAT_PRECISION float DOTMASK;\nuniform COMPAT_PRECISION float SHARPER;\nuniform COMPAT_PRECISION float scanline_weight;\n#endif\n\n#define FIX(c) max(abs(c), 1e-5);\n\nfloat intersect(vec2 xy)\n{\nfloat A = dot(xy,xy)+d*d;\nfloat B = 2.0*(R*(dot(xy,sinangle)-d*cosangle.x*cosangle.y)-d*d);\nfloat C = d*d + 2.0*R*d*cosangle.x*cosangle.y;\nreturn (-B-sqrt(B*B-4.0*A*C))/(2.0*A);\n}\n\nvec2 bkwtrans(vec2 xy)\n{\nfloat c = intersect(xy);\nvec2 point = vec2(c)*xy;\npoint -= vec2(-R)*sinangle;\npoint /= vec2(R);\nvec2 tang = sinangle/cosangle;\nvec2 poc = point/cosangle;\nfloat A = dot(tang,tang)+1.0;\nfloat B = -2.0*dot(poc,tang);\nfloat C = dot(poc,poc)-1.0;\nfloat a = (-B+sqrt(B*B-4.0*A*C))/(2.0*A);\nvec2 uv = (point-a*sinangle)/cosangle;\nfloat r = R*acos(a);\nreturn uv*r/sin(r/R);\n}\n\nvec2 fwtrans(vec2 uv)\n{\nfloat r = FIX(sqrt(dot(uv,uv)));\nuv *= sin(r/R)/r;\nfloat x = 1.0-cos(r/R);\nfloat D = d/R + x*cosangle.x*cosangle.y+dot(uv,sinangle);\nreturn d*(uv*cosangle-x*sinangle)/D;\n}\n\nvec3 maxscale()\n{\nvec2 c = bkwtrans(-R * sinangle / (1.0 + R/d*cosangle.x*cosangle.y));\nvec2 a = vec2(0.5,0.5)*aspect;\nvec2 lo = vec2(fwtrans(vec2(-a.x,c.y)).x, fwtrans(vec2(c.x,-a.y)).y)/aspect;\nvec2 hi = vec2(fwtrans(vec2(+a.x,c.y)).x, fwtrans(vec2(c.x,+a.y)).y)/aspect;\nreturn vec3((hi+lo)*aspect*0.5,max(hi.x-lo.x,hi.y-lo.y));\n}\n\nvoid main()\n{\n// START of parameters\n\n// gamma of simulated CRT\n//\tCRTgamma = 1.8;\n// gamma of display monitor (typically 2.2 is correct)\n//\tmonitorgamma = 2.2;\n// overscan (e.g. 1.02 for 2% overscan)\noverscan = vec2(1.00,1.00);\n// aspect ratio\naspect = vec2(1.0, 0.75);\n// lengths are measured in units of (approximately) the width\n// of the monitor simulated distance from viewer to monitor\n//\td = 2.0;\n// radius of curvature\n//\tR = 1.5;\n// tilt angle in radians\n// (behavior might be a bit wrong if both components are\n// nonzero)\nconst vec2 angle = vec2(0.0,0.0);\n// size of curved corners\n//\tcornersize = 0.03;\n// border smoothness parameter\n// decrease if borders are too aliased\n//\tcornersmooth = 1000.0;\n\n// END of parameters\n\nvec4 _oColor;\nvec2 _otexCoord;\ngl_Position = VertexCoord.x * MVPMatrix[0] + VertexCoord.y * MVPMatrix[1] + VertexCoord.z * MVPMatrix[2] + VertexCoord.w * MVPMatrix[3];\n_oPosition1 = gl_Position;\n_oColor = COLOR;\n_otexCoord = TexCoord.xy;\nCOL0 = COLOR;\nTEX0.xy = TexCoord.xy;\n\n// Precalculate a bunch of useful values we'll need in the fragment\n// shader.\nsinangle = sin(vec2(x_tilt, y_tilt)) + vec2(0.001);//sin(vec2(max(abs(x_tilt), 1e-3), max(abs(y_tilt), 1e-3)));\ncosangle = cos(vec2(x_tilt, y_tilt)) + vec2(0.001);//cos(vec2(max(abs(x_tilt), 1e-3), max(abs(y_tilt), 1e-3)));\nstretch = maxscale();\n\nilfac = vec2(1.0,clamp(floor(InputSize.y/200.0), 1.0, 2.0));\n\n// The size of one texel, in texture-coordinates.\nvec2 sharpTextureSize = vec2(SHARPER * TextureSize.x, TextureSize.y);\none = ilfac / sharpTextureSize;\n\n// Resulting X pixel-coordinate of the pixel we're drawing.\nmod_factor = TexCoord.x * TextureSize.x * OutputSize.x / InputSize.x;\n\n}\n\n#elif defined(FRAGMENT)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING in\n#define COMPAT_TEXTURE texture\nout vec4 FragColor;\n#else\n#define COMPAT_VARYING varying\n#define FragColor gl_FragColor\n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nstruct output_dummy {\nvec4 _color;\n};\n\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\nuniform sampler2D Texture;\nCOMPAT_VARYING vec4 TEX0;\n\n// Comment the next line to disable interpolation in linear gamma (and\n// gain speed).\n#define LINEAR_PROCESSING\n\n// Enable screen curvature.\n// #define CURVATURE\n\n// Enable 3x oversampling of the beam profile\n#define OVERSAMPLE\n\n// Use the older, purely gaussian beam profile\n//#define USEGAUSSIAN\n\n// Macros.\n#define FIX(c) max(abs(c), 1e-5);\n#define PI 3.141592653589\n\n#ifdef LINEAR_PROCESSING\n# define TEX2D(c) pow(COMPAT_TEXTURE(Texture, (c)), vec4(CRTgamma))\n#else\n# define TEX2D(c) COMPAT_TEXTURE(Texture, (c))\n#endif\n\nCOMPAT_VARYING vec2 one;\nCOMPAT_VARYING float mod_factor;\nCOMPAT_VARYING vec2 ilfac;\nCOMPAT_VARYING vec2 overscan;\nCOMPAT_VARYING vec2 aspect;\nCOMPAT_VARYING vec3 stretch;\nCOMPAT_VARYING vec2 sinangle;\nCOMPAT_VARYING vec2 cosangle;\n\n#ifdef PARAMETER_UNIFORM\nuniform COMPAT_PRECISION float CRTgamma;\nuniform COMPAT_PRECISION float monitorgamma;\nuniform COMPAT_PRECISION float d;\nuniform COMPAT_PRECISION float CURVATURE;\nuniform COMPAT_PRECISION float R;\nuniform COMPAT_PRECISION float cornersize;\nuniform COMPAT_PRECISION float cornersmooth;\nuniform COMPAT_PRECISION float x_tilt;\nuniform COMPAT_PRECISION float y_tilt;\nuniform COMPAT_PRECISION float overscan_x;\nuniform COMPAT_PRECISION float overscan_y;\nuniform COMPAT_PRECISION float DOTMASK;\nuniform COMPAT_PRECISION float SHARPER;\nuniform COMPAT_PRECISION float scanline_weight;\n#endif\n\nfloat intersect(vec2 xy)\n{\nfloat A = dot(xy,xy)+d*d;\nfloat B = 2.0*(R*(dot(xy,sinangle)-d*cosangle.x*cosangle.y)-d*d);\nfloat C = d*d + 2.0*R*d*cosangle.x*cosangle.y;\nreturn (-B-sqrt(B*B-4.0*A*C))/(2.0*A);\n}\n\nvec2 bkwtrans(vec2 xy)\n{\nfloat c = intersect(xy);\nvec2 point = vec2(c)*xy;\npoint -= vec2(-R)*sinangle;\npoint /= vec2(R);\nvec2 tang = sinangle/cosangle;\nvec2 poc = point/cosangle;\nfloat A = dot(tang,tang)+1.0;\nfloat B = -2.0*dot(poc,tang);\nfloat C = dot(poc,poc)-1.0;\nfloat a = (-B+sqrt(B*B-4.0*A*C))/(2.0*A);\nvec2 uv = (point-a*sinangle)/cosangle;\nfloat r = FIX(R*acos(a));\nreturn uv*r/sin(r/R);\n}\n\nvec2 transform(vec2 coord)\n{\ncoord *= TextureSize / InputSize;\ncoord = (coord-vec2(0.5))*aspect*stretch.z+stretch.xy;\nreturn (bkwtrans(coord)/vec2(overscan_x / 100.0, overscan_y / 100.0)/aspect+vec2(0.5)) * InputSize / TextureSize;\n}\n\nfloat corner(vec2 coord)\n{\ncoord *= TextureSize / InputSize;\ncoord = (coord - vec2(0.5)) * vec2(overscan_x / 100.0, overscan_y / 100.0) + vec2(0.5);\ncoord = min(coord, vec2(1.0)-coord) * aspect;\nvec2 cdist = vec2(cornersize);\ncoord = (cdist - min(coord,cdist));\nfloat dist = sqrt(dot(coord,coord));\nreturn clamp((cdist.x-dist)*cornersmooth,0.0, 1.0);\n}\n\n// Calculate the influence of a scanline on the current pixel.\n//\n// 'distance' is the distance in texture coordinates from the current\n// pixel to the scanline in question.\n// 'color' is the colour of the scanline at the horizontal location of\n// the current pixel.\nvec4 scanlineWeights(float distance, vec4 color)\n{\n// \"wid\" controls the width of the scanline beam, for each RGB\n// channel The \"weights\" lines basically specify the formula\n// that gives you the profile of the beam, i.e. the intensity as\n// a function of distance from the vertical center of the\n// scanline. In this case, it is gaussian if width=2, and\n// becomes nongaussian for larger widths. Ideally this should\n// be normalized so that the integral across the beam is\n// independent of its width. That is, for a narrower beam\n// \"weights\" should have a higher peak at the center of the\n// scanline than for a wider beam.\n#ifdef USEGAUSSIAN\nvec4 wid = 0.3 + 0.1 * pow(color, vec4(3.0));\nvec4 weights = vec4(distance / wid);\nreturn 0.4 * exp(-weights * weights) / wid;\n#else\nvec4 wid = 2.0 + 2.0 * pow(color, vec4(4.0));\nvec4 weights = vec4(distance / scanline_weight);\nreturn 1.4 * exp(-pow(weights * inversesqrt(0.5 * wid), wid)) / (0.6 + 0.2 * wid);\n#endif\n}\n\nvoid main()\n{\n// Here's a helpful diagram to keep in mind while trying to\n// understand the code:\n//\n// | | | | |\n// -------------------------------\n// | | | | |\n// | 01 | 11 | 21 | 31 | <-- current scanline\n// | | @ | | |\n// -------------------------------\n// | | | | |\n// | 02 | 12 | 22 | 32 | <-- next scanline\n// | | | | |\n// -------------------------------\n// | | | | |\n//\n// Each character-cell represents a pixel on the output\n// surface, \"@\" represents the current pixel (always somewhere\n// in the bottom half of the current scan-line, or the top-half\n// of the next scanline). The grid of lines represents the\n// edges of the texels of the underlying texture.\n\n// Texture coordinates of the texel containing the active pixel.\nvec2 xy = (CURVATURE > 0.5) ? transform(TEX0.xy) : TEX0.xy;\n\nfloat cval = corner(xy);\n\n// Of all the pixels that are mapped onto the texel we are\n// currently rendering, which pixel are we currently rendering?\nvec2 ilvec = vec2(0.0,ilfac.y > 1.5 ? mod(float(FrameCount),2.0) : 0.0);\nvec2 ratio_scale = (xy * TextureSize - vec2(0.5) + ilvec)/ilfac;\n#ifdef OVERSAMPLE\nfloat filter_ = InputSize.y/OutputSize.y;//fwidth(ratio_scale.y);\n#endif\nvec2 uv_ratio = fract(ratio_scale);\n\n// Snap to the center of the underlying texel.\nxy = (floor(ratio_scale)*ilfac + vec2(0.5) - ilvec) / TextureSize;\n\n// Calculate Lanczos scaling coefficients describing the effect\n// of various neighbour texels in a scanline on the current\n// pixel.\nvec4 coeffs = PI * vec4(1.0 + uv_ratio.x, uv_ratio.x, 1.0 - uv_ratio.x, 2.0 - uv_ratio.x);\n\n// Prevent division by zero.\ncoeffs = FIX(coeffs);\n\n// Lanczos2 kernel.\ncoeffs = 2.0 * sin(coeffs) * sin(coeffs / 2.0) / (coeffs * coeffs);\n\n// Normalize.\ncoeffs /= dot(coeffs, vec4(1.0));\n\n// Calculate the effective colour of the current and next\n// scanlines at the horizontal location of the current pixel,\n// using the Lanczos coefficients above.\nvec4 col = clamp(mat4(\n TEX2D(xy + vec2(-one.x, 0.0)),\n TEX2D(xy),\n TEX2D(xy + vec2(one.x, 0.0)),\n TEX2D(xy + vec2(2.0 * one.x, 0.0))) * coeffs,\n 0.0, 1.0);\nvec4 col2 = clamp(mat4(\n TEX2D(xy + vec2(-one.x, one.y)),\n TEX2D(xy + vec2(0.0, one.y)),\n TEX2D(xy + one),\n TEX2D(xy + vec2(2.0 * one.x, one.y))) * coeffs,\n 0.0, 1.0);\n\n#ifndef LINEAR_PROCESSING\ncol = pow(col , vec4(CRTgamma));\ncol2 = pow(col2, vec4(CRTgamma));\n#endif\n\n// Calculate the influence of the current and next scanlines on\n// the current pixel.\nvec4 weights = scanlineWeights(uv_ratio.y, col);\nvec4 weights2 = scanlineWeights(1.0 - uv_ratio.y, col2);\n#ifdef OVERSAMPLE\nuv_ratio.y =uv_ratio.y+1.0/3.0*filter_;\nweights = (weights+scanlineWeights(uv_ratio.y, col))/3.0;\nweights2=(weights2+scanlineWeights(abs(1.0-uv_ratio.y), col2))/3.0;\nuv_ratio.y =uv_ratio.y-2.0/3.0*filter_;\nweights=weights+scanlineWeights(abs(uv_ratio.y), col)/3.0;\nweights2=weights2+scanlineWeights(abs(1.0-uv_ratio.y), col2)/3.0;\n#endif\n\nvec3 mul_res = (col * weights + col2 * weights2).rgb * vec3(cval);\n\n// dot-mask emulation:\n// Output pixels are alternately tinted green and magenta.\nvec3 dotMaskWeights = mix(\nvec3(1.0, 1.0 - DOTMASK, 1.0),\nvec3(1.0 - DOTMASK, 1.0, 1.0 - DOTMASK),\nfloor(mod(mod_factor, 2.0))\n);\n\nmul_res *= dotMaskWeights;\n\n// Convert the image gamma for display on our output device.\nmul_res = pow(mul_res, vec3(1.0 / monitorgamma));\n\n// Color the texel.\noutput_dummy _OUT;\n_OUT._color = vec4(mul_res, 1.0);\nFragColor = _OUT._color;\nreturn;\n} \n#endif\n\n", + "crt-mattias.glsl": "\n#pragma parameter CURVATURE \"Curvature\" 0.5 0.0 1.0 0.05\n#pragma parameter SCANSPEED \"Scanline Crawl Speed\" 1.0 0.0 10.0 0.5\n#if defined(VERTEX)\n#if __VERSION__ >= 130\n#define COMPAT_VARYING out\n#define COMPAT_ATTRIBUTE in\n#define COMPAT_TEXTURE texture\n#else\n#define COMPAT_VARYING varying \n#define COMPAT_ATTRIBUTE attribute \n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nCOMPAT_ATTRIBUTE vec4 VertexCoord;\nCOMPAT_ATTRIBUTE vec4 COLOR;\nCOMPAT_ATTRIBUTE vec4 TexCoord;\nCOMPAT_VARYING vec4 COL0;\nCOMPAT_VARYING vec4 TEX0;\n\nvec4 _oPosition1; \nuniform mat4 MVPMatrix;\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\n\n#define vTexCoord TEX0.xy\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nvoid main()\n{\n gl_Position = MVPMatrix * VertexCoord;\n TEX0.xy = TexCoord.xy;\n}\n\n#elif defined(FRAGMENT)\n\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING in\n#define COMPAT_TEXTURE texture\nout COMPAT_PRECISION vec4 FragColor;\n#else\n#define COMPAT_VARYING varying\n#define FragColor gl_FragColor\n#define COMPAT_TEXTURE texture2D\n#endif\n\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\nuniform sampler2D Texture;\nCOMPAT_VARYING vec4 TEX0;\n\n// compatibility #defines\n#define Source Texture\n#define vTexCoord TEX0.xy\n\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\n#ifdef PARAMETER_UNIFORM\nuniform COMPAT_PRECISION float CURVATURE, SCANSPEED;\n#else\n#define CURVATURE 0.5\n#define SCANSPEED 1.0\n#endif\n\n#define iChannel0 Texture\n#define iTime (float(FrameCount) / 60.0)\n#define iResolution OutputSize.xy\n#define fragCoord gl_FragCoord.xy\n\nvec3 sample_( sampler2D tex, vec2 tc )\n{\n vec3 s = pow(COMPAT_TEXTURE(tex,tc).rgb, vec3(2.2));\n return s;\n}\n\nvec3 blur(sampler2D tex, vec2 tc, float offs)\n{\n vec4 xoffs = offs * vec4(-2.0, -1.0, 1.0, 2.0) / (iResolution.x * TextureSize.x / InputSize.x);\n vec4 yoffs = offs * vec4(-2.0, -1.0, 1.0, 2.0) / (iResolution.y * TextureSize.y / InputSize.y);\n tc = tc * InputSize / TextureSize;\n \n vec3 color = vec3(0.0, 0.0, 0.0);\n color += sample_(tex,tc + vec2(xoffs.x, yoffs.x)) * 0.00366;\n color += sample_(tex,tc + vec2(xoffs.y, yoffs.x)) * 0.01465;\n color += sample_(tex,tc + vec2( 0.0, yoffs.x)) * 0.02564;\n color += sample_(tex,tc + vec2(xoffs.z, yoffs.x)) * 0.01465;\n color += sample_(tex,tc + vec2(xoffs.w, yoffs.x)) * 0.00366;\n \n color += sample_(tex,tc + vec2(xoffs.x, yoffs.y)) * 0.01465;\n color += sample_(tex,tc + vec2(xoffs.y, yoffs.y)) * 0.05861;\n color += sample_(tex,tc + vec2( 0.0, yoffs.y)) * 0.09524;\n color += sample_(tex,tc + vec2(xoffs.z, yoffs.y)) * 0.05861;\n color += sample_(tex,tc + vec2(xoffs.w, yoffs.y)) * 0.01465;\n \n color += sample_(tex,tc + vec2(xoffs.x, 0.0)) * 0.02564;\n color += sample_(tex,tc + vec2(xoffs.y, 0.0)) * 0.09524;\n color += sample_(tex,tc + vec2( 0.0, 0.0)) * 0.15018;\n color += sample_(tex,tc + vec2(xoffs.z, 0.0)) * 0.09524;\n color += sample_(tex,tc + vec2(xoffs.w, 0.0)) * 0.02564;\n \n color += sample_(tex,tc + vec2(xoffs.x, yoffs.z)) * 0.01465;\n color += sample_(tex,tc + vec2(xoffs.y, yoffs.z)) * 0.05861;\n color += sample_(tex,tc + vec2( 0.0, yoffs.z)) * 0.09524;\n color += sample_(tex,tc + vec2(xoffs.z, yoffs.z)) * 0.05861;\n color += sample_(tex,tc + vec2(xoffs.w, yoffs.z)) * 0.01465;\n \n color += sample_(tex,tc + vec2(xoffs.x, yoffs.w)) * 0.00366;\n color += sample_(tex,tc + vec2(xoffs.y, yoffs.w)) * 0.01465;\n color += sample_(tex,tc + vec2( 0.0, yoffs.w)) * 0.02564;\n color += sample_(tex,tc + vec2(xoffs.z, yoffs.w)) * 0.01465;\n color += sample_(tex,tc + vec2(xoffs.w, yoffs.w)) * 0.00366;\n\n return color;\n}\n\nfloat rand(vec2 co)\n{\n float a = 12.9898;\n float b = 78.233;\n float c = 43758.5453;\n float dt= dot(co.xy ,vec2(a,b));\n float sn= mod(dt,3.14);\n return fract(sin(sn) * c);\n}\n\nvec2 curve(vec2 uv)\n{\n uv = (uv - 0.5) * 2.0;\n uv *= 1.1;\t\n uv.x *= 1.0 + pow((abs(uv.y) / 5.0), 2.0);\n uv.y *= 1.0 + pow((abs(uv.x) / 4.0), 2.0);\n uv = (uv / 2.0) + 0.5;\n uv = uv *0.92 + 0.04;\n return uv;\n}\n\nvoid main()\n{\n vec2 q = (vTexCoord.xy * TextureSize.xy / InputSize.xy);//fragCoord.xy / iResolution.xy;\n vec2 uv = q;\n uv = mix( uv, curve( uv ), CURVATURE ) * InputSize.xy / TextureSize.xy;\n vec3 col;\n float x = sin(0.1*iTime+uv.y*21.0)*sin(0.23*iTime+uv.y*29.0)*sin(0.3+0.11*iTime+uv.y*31.0)*0.0017;\n float o =2.0*mod(fragCoord.y,2.0)/iResolution.x;\n x+=o;\n uv = uv * TextureSize / InputSize;\n col.r = 1.0*blur(iChannel0,vec2(uv.x+0.0009,uv.y+0.0009),1.2).x+0.005;\n col.g = 1.0*blur(iChannel0,vec2(uv.x+0.000,uv.y-0.0015),1.2).y+0.005;\n col.b = 1.0*blur(iChannel0,vec2(uv.x-0.0015,uv.y+0.000),1.2).z+0.005;\n col.r += 0.2*blur(iChannel0,vec2(uv.x+0.0009,uv.y+0.0009),2.25).x-0.005;\n col.g += 0.2*blur(iChannel0,vec2(uv.x+0.000,uv.y-0.0015),1.75).y-0.005;\n col.b += 0.2*blur(iChannel0,vec2(uv.x-0.0015,uv.y+0.000),1.25).z-0.005;\n float ghs = 0.05;\n col.r += ghs*(1.0-0.299)*blur(iChannel0,0.75*vec2(0.01, -0.027)+vec2(uv.x+0.001,uv.y+0.001),7.0).x;\n col.g += ghs*(1.0-0.587)*blur(iChannel0,0.75*vec2(-0.022, -0.02)+vec2(uv.x+0.000,uv.y-0.002),5.0).y;\n col.b += ghs*(1.0-0.114)*blur(iChannel0,0.75*vec2(-0.02, -0.0)+vec2(uv.x-0.002,uv.y+0.000),3.0).z;\n \n \n\n col = clamp(col*0.4+0.6*col*col*1.0,0.0,1.0);\n float vig = (0.0 + 1.0*16.0*uv.x*uv.y*(1.0-uv.x)*(1.0-uv.y));\n vig = pow(vig,0.3);\n col *= vec3(vig);\n\n col *= vec3(0.95,1.05,0.95);\n col = mix( col, col * col, 0.3) * 3.8;\n\n float scans = clamp( 0.35+0.15*sin(3.5*(iTime * SCANSPEED)+uv.y*iResolution.y*1.5), 0.0, 1.0);\n \n float s = pow(scans,0.9);\n col = col*vec3( s) ;\n\n col *= 1.0+0.0015*sin(300.0*iTime);\n \n col*=1.0-0.15*vec3(clamp((mod(fragCoord.x+o, 2.0)-1.0)*2.0,0.0,1.0));\n col *= vec3( 1.0 ) - 0.25*vec3( rand( uv+0.0001*iTime), rand( uv+0.0001*iTime + 0.3 ), rand( uv+0.0001*iTime+ 0.5 ) );\n col = pow(col, vec3(0.45));\n\n if (uv.x < 0.0 || uv.x > 1.0)\n col *= 0.0;\n if (uv.y < 0.0 || uv.y > 1.0)\n col *= 0.0;\n \n\n float comp = smoothstep( 0.1, 0.9, sin(iTime) );\n\n FragColor = vec4(col,1.0);\n} \n#endif\n" +} diff --git a/semag/emulatorjs/data/socket.io.min.js b/semag/emulatorjs/data/socket.io.min.js index 4bd0ea7a..b2862415 100644 --- a/semag/emulatorjs/data/socket.io.min.js +++ b/semag/emulatorjs/data/socket.io.min.js @@ -1,7 +1,7 @@ -/*! - * Socket.IO v4.7.0 - * (c) 2014-2023 Guillermo Rauch - * Released under the MIT License. - */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).io=e()}(this,(function(){"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}var m=Object.create(null);m.open="0",m.close="1",m.ping="2",m.pong="3",m.message="4",m.upgrade="5",m.noop="6";var k=Object.create(null);Object.keys(m).forEach((function(t){k[m[t]]=t}));var b,w={type:"error",data:"parser error"},_="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),O="function"==typeof ArrayBuffer,A=function(t){return"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer},E=function(t,e,n){var r=t.type,i=t.data;return _&&i instanceof Blob?e?n(i):R(i,n):O&&(i instanceof ArrayBuffer||A(i))?e?n(i):R(new Blob([i]),n):n(m[r]+(i||""))},R=function(t,e){var n=new FileReader;return n.onload=function(){var t=n.result.split(",")[1];e("b"+(t||""))},n.readAsDataURL(t)};function T(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}for(var C="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",B="undefined"==typeof Uint8Array?[]:new Uint8Array(256),S=0;S1?{type:k[n],data:t.substring(1)}:{type:k[n]}:w},P=function(t,e){if(N){var n=function(t){var e,n,r,i,o,s=.75*t.length,a=t.length,c=0;"="===t[t.length-1]&&(s--,"="===t[t.length-2]&&s--);var u=new ArrayBuffer(s),h=new Uint8Array(u);for(e=0;e>4,h[c++]=(15&r)<<4|i>>2,h[c++]=(3&i)<<6|63&o;return u}(t);return j(n,e)}return{base64:!0,data:t}},j=function(t,e){return"blob"===e?t instanceof Blob?t:new Blob([t]):t instanceof ArrayBuffer?t:t.buffer},q=String.fromCharCode(30);function I(t){if(t)return function(t){for(var e in I.prototype)t[e]=I.prototype[e];return t}(t)}I.prototype.on=I.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},I.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},I.prototype.off=I.prototype.removeListener=I.prototype.removeAllListeners=I.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var i=0;i1?e-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:{};return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(e)}},{key:"_hostname",value:function(){var t=this.opts.hostname;return-1===t.indexOf(":")?t:"["+t+"]"}},{key:"_port",value:function(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}},{key:"_query",value:function(t){var e=function(t){var e="";for(var n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}(t);return e.length?"?"+e:""}}]),i}(I),z="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),J={},$=0,Q=0;function X(t){var e="";do{e=z[t%64]+e,t=Math.floor(t/64)}while(t>0);return e}function G(){var t=X(+new Date);return t!==K?($=0,K=t):t+"."+X($++)}for(;Q<64;Q++)J[z[Q]]=Q;var Z=!1;try{Z="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(t){}var tt=Z;function et(t){var e=t.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!e||tt))return new XMLHttpRequest}catch(t){}if(!e)try{return new(D[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(t){}}function nt(){}var rt=null!=new et({xdomain:!1}).responseType,it=function(t){o(s,t);var n=p(s);function s(t){var r;if(e(this,s),(r=n.call(this,t)).polling=!1,"undefined"!=typeof location){var i="https:"===location.protocol,o=location.port;o||(o=i?"443":"80"),r.xd="undefined"!=typeof location&&t.hostname!==location.hostname||o!==t.port}var a=t&&t.forceBase64;return r.supportsBinary=rt&&!a,r.opts.withCredentials&&(r.cookieJar=void 0),r}return r(s,[{key:"name",get:function(){return"polling"}},{key:"doOpen",value:function(){this.poll()}},{key:"pause",value:function(t){var e=this;this.readyState="pausing";var n=function(){e.readyState="paused",t()};if(this.polling||!this.writable){var r=0;this.polling&&(r++,this.once("pollComplete",(function(){--r||n()}))),this.writable||(r++,this.once("drain",(function(){--r||n()})))}else n()}},{key:"poll",value:function(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}},{key:"onData",value:function(t){var e=this;(function(t,e){for(var n=t.split(q),r=[],i=0;i0&&void 0!==arguments[0]?arguments[0]:{};return i(t,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new ot(this.uri(),t)}},{key:"doWrite",value:function(t,e){var n=this,r=this.request({method:"POST",data:t});r.on("success",e),r.on("error",(function(t,e){n.onError("xhr post error",t,e)}))}},{key:"doPoll",value:function(){var t=this,e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(function(e,n){t.onError("xhr poll error",e,n)})),this.pollXhr=e}}]),s}(W),ot=function(t){o(i,t);var n=p(i);function i(t,r){var o;return e(this,i),V(f(o=n.call(this)),r),o.opts=r,o.method=r.method||"GET",o.uri=t,o.data=void 0!==r.data?r.data:null,o.create(),o}return r(i,[{key:"create",value:function(){var t,e=this,n=F(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;var r=this.xhr=new et(n);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders)for(var o in r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0),this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(o)&&r.setRequestHeader(o,this.opts.extraHeaders[o])}catch(t){}if("POST"===this.method)try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{r.setRequestHeader("Accept","*/*")}catch(t){}null===(t=this.opts.cookieJar)||void 0===t||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=function(){var t;3===r.readyState&&(null===(t=e.opts.cookieJar)||void 0===t||t.parseCookies(r)),4===r.readyState&&(200===r.status||1223===r.status?e.onLoad():e.setTimeoutFn((function(){e.onError("number"==typeof r.status?r.status:0)}),0))},r.send(this.data)}catch(t){return void this.setTimeoutFn((function(){e.onError(t)}),0)}"undefined"!=typeof document&&(this.index=i.requestsCount++,i.requests[this.index]=this)}},{key:"onError",value:function(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}},{key:"cleanup",value:function(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=nt,t)try{this.xhr.abort()}catch(t){}"undefined"!=typeof document&&delete i.requests[this.index],this.xhr=null}}},{key:"onLoad",value:function(){var t=this.xhr.responseText;null!==t&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}},{key:"abort",value:function(){this.cleanup()}}]),i}(I);if(ot.requestsCount=0,ot.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",st);else if("function"==typeof addEventListener){addEventListener("onpagehide"in D?"pagehide":"unload",st,!1)}function st(){for(var t in ot.requests)ot.requests.hasOwnProperty(t)&&ot.requests[t].abort()}var at="function"==typeof Promise&&"function"==typeof Promise.resolve?function(t){return Promise.resolve().then(t)}:function(t,e){return e(t,0)},ct=D.WebSocket||D.MozWebSocket,ut="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),ht=function(t){o(i,t);var n=p(i);function i(t){var r;return e(this,i),(r=n.call(this,t)).supportsBinary=!t.forceBase64,r}return r(i,[{key:"name",get:function(){return"websocket"}},{key:"doOpen",value:function(){if(this.check()){var t=this.uri(),e=this.opts.protocols,n=ut?{}:F(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=ut?new ct(t,e,n):e?new ct(t,e):new ct(t)}catch(t){return this.emitReserved("error",t)}this.ws.binaryType=this.socket.binaryType||"arraybuffer",this.addEventListeners()}}},{key:"addEventListeners",value:function(){var t=this;this.ws.onopen=function(){t.opts.autoUnref&&t.ws._socket.unref(),t.onOpen()},this.ws.onclose=function(e){return t.onClose({description:"websocket connection closed",context:e})},this.ws.onmessage=function(e){return t.onData(e.data)},this.ws.onerror=function(e){return t.onError("websocket error",e)}}},{key:"write",value:function(t){var e=this;this.writable=!1;for(var n=function(n){var r=t[n],i=n===t.length-1;E(r,e.supportsBinary,(function(t){try{e.ws.send(t)}catch(t){}i&&at((function(){e.writable=!0,e.emitReserved("drain")}),e.setTimeoutFn)}))},r=0;r54;return x(r?t:L.decode(t),n)}(o,n,"arraybuffer")),n=!1):n=!0,e())}))}();var i=t.query.sid?'0{"sid":"'.concat(t.query.sid,'"}'):"0";t.writer.write((new TextEncoder).encode(i)).then((function(){return t.onOpen()}))}))})))}},{key:"write",value:function(t){var e=this;this.writable=!1;for(var n=function(n){var r=t[n],i=n===t.length-1;!function(t,e){_&&t.data instanceof Blob?t.data.arrayBuffer().then(T).then(e):O&&(t.data instanceof ArrayBuffer||A(t.data))?e(T(t.data)):E(t,!1,(function(t){b||(b=new TextEncoder),e(b.encode(t))}))}(r,(function(t){(function(t,e){return"message"===t.type&&"string"!=typeof t.data&&e[0]>=48&&e[0]<=54})(r,t)&&e.writer.write(Uint8Array.of(54)),e.writer.write(t).then((function(){i&&at((function(){e.writable=!0,e.emitReserved("drain")}),e.setTimeoutFn)}))}))},r=0;r1&&void 0!==arguments[1]?arguments[1]:{};return e(this,a),(r=s.call(this)).writeBuffer=[],n&&"object"===t(n)&&(o=n,n=null),n?(n=yt(n),o.hostname=n.host,o.secure="https"===n.protocol||"wss"===n.protocol,o.port=n.port,n.query&&(o.query=n.query)):o.host&&(o.hostname=yt(o.host).host),V(f(r),o),r.secure=null!=o.secure?o.secure:"undefined"!=typeof location&&"https:"===location.protocol,o.hostname&&!o.port&&(o.port=r.secure?"443":"80"),r.hostname=o.hostname||("undefined"!=typeof location?location.hostname:"localhost"),r.port=o.port||("undefined"!=typeof location&&location.port?location.port:r.secure?"443":"80"),r.transports=o.transports||["polling","websocket","webtransport"],r.writeBuffer=[],r.prevBufferLen=0,r.opts=i({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},o),r.opts.path=r.opts.path.replace(/\/$/,"")+(r.opts.addTrailingSlash?"/":""),"string"==typeof r.opts.query&&(r.opts.query=H(r.opts.query)),r.id=null,r.upgrades=null,r.pingInterval=null,r.pingTimeout=null,r.pingTimeoutTimer=null,"function"==typeof addEventListener&&(r.opts.closeOnBeforeunload&&(r.beforeunloadEventListener=function(){r.transport&&(r.transport.removeAllListeners(),r.transport.close())},addEventListener("beforeunload",r.beforeunloadEventListener,!1)),"localhost"!==r.hostname&&(r.offlineEventListener=function(){r.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",r.offlineEventListener,!1))),r.open(),r}return r(a,[{key:"createTransport",value:function(t){var e=i({},this.opts.query);e.EIO=4,e.transport=t,this.id&&(e.sid=this.id);var n=i({},this.opts.transportOptions[t],this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new lt[t](n)}},{key:"open",value:function(){var t,e=this;if(this.opts.rememberUpgrade&&a.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((function(){e.emitReserved("error","No transports available")}),0);t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(t){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)}},{key:"setTransport",value:function(t){var e=this;this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(function(t){return e.onClose("transport close",t)}))}},{key:"probe",value:function(t){var e=this,n=this.createTransport(t),r=!1;a.priorWebsocketSuccess=!1;var i=function(){r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",(function(t){if(!r)if("pong"===t.type&&"probe"===t.data){if(e.upgrading=!0,e.emitReserved("upgrading",n),!n)return;a.priorWebsocketSuccess="websocket"===n.name,e.transport.pause((function(){r||"closed"!==e.readyState&&(f(),e.setTransport(n),n.send([{type:"upgrade"}]),e.emitReserved("upgrade",n),n=null,e.upgrading=!1,e.flush())}))}else{var i=new Error("probe error");i.transport=n.name,e.emitReserved("upgradeError",i)}})))};function o(){r||(r=!0,f(),n.close(),n=null)}var s=function(t){var r=new Error("probe error: "+t);r.transport=n.name,o(),e.emitReserved("upgradeError",r)};function c(){s("transport closed")}function u(){s("socket closed")}function h(t){n&&t.name!==n.name&&o()}var f=function(){n.removeListener("open",i),n.removeListener("error",s),n.removeListener("close",c),e.off("close",u),e.off("upgrading",h)};n.once("open",i),n.once("error",s),n.once("close",c),this.once("close",u),this.once("upgrading",h),-1!==this.upgrades.indexOf("webtransport")&&"webtransport"!==t?this.setTimeoutFn((function(){r||n.open()}),200):n.open()}},{key:"onOpen",value:function(){if(this.readyState="open",a.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade)for(var t=0,e=this.upgrades.length;t1))return this.writeBuffer;for(var t,e=1,n=0;n=57344?n+=3:(r++,n+=4);return n}(t):Math.ceil(1.33*(t.byteLength||t.size))),n>0&&e>this.maxPayload)return this.writeBuffer.slice(0,n);e+=2}return this.writeBuffer}},{key:"write",value:function(t,e,n){return this.sendPacket("message",t,e,n),this}},{key:"send",value:function(t,e,n){return this.sendPacket("message",t,e,n),this}},{key:"sendPacket",value:function(t,e,n,r){if("function"==typeof e&&(r=e,e=void 0),"function"==typeof n&&(r=n,n=null),"closing"!==this.readyState&&"closed"!==this.readyState){(n=n||{}).compress=!1!==n.compress;var i={type:t,data:e,options:n};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}}},{key:"close",value:function(){var t=this,e=function(){t.onClose("forced close"),t.transport.close()},n=function n(){t.off("upgrade",n),t.off("upgradeError",n),e()},r=function(){t.once("upgrade",n),t.once("upgradeError",n)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(function(){t.upgrading?r():e()})):this.upgrading?r():e()),this}},{key:"onError",value:function(t){a.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}},{key:"onClose",value:function(t,e){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,e),this.writeBuffer=[],this.prevBufferLen=0)}},{key:"filterUpgrades",value:function(t){for(var e=[],n=0,r=t.length;n=0&&e.num1?e-1:0),r=1;r1?n-1:0),i=1;in._opts.retries&&(n._queue.shift(),e&&e(t));else if(n._queue.shift(),e){for(var o=arguments.length,s=new Array(o>1?o-1:0),a=1;a0&&void 0!==arguments[0]&&arguments[0];if(this.connected&&0!==this._queue.length){var e=this._queue[0];e.pending&&!t||(e.pending=!0,e.tryCount++,this.flags=e.flags,this.emit.apply(this,e.args))}}},{key:"packet",value:function(t){t.nsp=this.nsp,this.io._packet(t)}},{key:"onopen",value:function(){var t=this;"function"==typeof this.auth?this.auth((function(e){t._sendConnectPacket(e)})):this._sendConnectPacket(this.auth)}},{key:"_sendConnectPacket",value:function(t){this.packet({type:Tt.CONNECT,data:this._pid?i({pid:this._pid,offset:this._lastOffset},t):t})}},{key:"onerror",value:function(t){this.connected||this.emitReserved("connect_error",t)}},{key:"onclose",value:function(t,e){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,e)}},{key:"onpacket",value:function(t){if(t.nsp===this.nsp)switch(t.type){case Tt.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Tt.EVENT:case Tt.BINARY_EVENT:this.onevent(t);break;case Tt.ACK:case Tt.BINARY_ACK:this.onack(t);break;case Tt.DISCONNECT:this.ondisconnect();break;case Tt.CONNECT_ERROR:this.destroy();var e=new Error(t.data.message);e.data=t.data.data,this.emitReserved("connect_error",e)}}},{key:"onevent",value:function(t){var e=t.data||[];null!=t.id&&e.push(this.ack(t.id)),this.connected?this.emitEvent(e):this.receiveBuffer.push(Object.freeze(e))}},{key:"emitEvent",value:function(t){if(this._anyListeners&&this._anyListeners.length){var e,n=g(this._anyListeners.slice());try{for(n.s();!(e=n.n()).done;){e.value.apply(this,t)}}catch(t){n.e(t)}finally{n.f()}}y(s(a.prototype),"emit",this).apply(this,t),this._pid&&t.length&&"string"==typeof t[t.length-1]&&(this._lastOffset=t[t.length-1])}},{key:"ack",value:function(t){var e=this,n=!1;return function(){if(!n){n=!0;for(var r=arguments.length,i=new Array(r),o=0;o0&&t.jitter<=1?t.jitter:0,this.attempts=0}It.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=0==(1&Math.floor(10*e))?t-n:t+n}return 0|Math.min(t,this.max)},It.prototype.reset=function(){this.attempts=0},It.prototype.setMin=function(t){this.ms=t},It.prototype.setMax=function(t){this.max=t},It.prototype.setJitter=function(t){this.jitter=t};var Dt=function(n){o(s,n);var i=p(s);function s(n,r){var o,a;e(this,s),(o=i.call(this)).nsps={},o.subs=[],n&&"object"===t(n)&&(r=n,n=void 0),(r=r||{}).path=r.path||"/socket.io",o.opts=r,V(f(o),r),o.reconnection(!1!==r.reconnection),o.reconnectionAttempts(r.reconnectionAttempts||1/0),o.reconnectionDelay(r.reconnectionDelay||1e3),o.reconnectionDelayMax(r.reconnectionDelayMax||5e3),o.randomizationFactor(null!==(a=r.randomizationFactor)&&void 0!==a?a:.5),o.backoff=new It({min:o.reconnectionDelay(),max:o.reconnectionDelayMax(),jitter:o.randomizationFactor()}),o.timeout(null==r.timeout?2e4:r.timeout),o._readyState="closed",o.uri=n;var c=r.parser||xt;return o.encoder=new c.Encoder,o.decoder=new c.Decoder,o._autoConnect=!1!==r.autoConnect,o._autoConnect&&o.open(),o}return r(s,[{key:"reconnection",value:function(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}},{key:"reconnectionAttempts",value:function(t){return void 0===t?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}},{key:"reconnectionDelay",value:function(t){var e;return void 0===t?this._reconnectionDelay:(this._reconnectionDelay=t,null===(e=this.backoff)||void 0===e||e.setMin(t),this)}},{key:"randomizationFactor",value:function(t){var e;return void 0===t?this._randomizationFactor:(this._randomizationFactor=t,null===(e=this.backoff)||void 0===e||e.setJitter(t),this)}},{key:"reconnectionDelayMax",value:function(t){var e;return void 0===t?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,null===(e=this.backoff)||void 0===e||e.setMax(t),this)}},{key:"timeout",value:function(t){return arguments.length?(this._timeout=t,this):this._timeout}},{key:"maybeReconnectOnOpen",value:function(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}},{key:"open",value:function(t){var e=this;if(~this._readyState.indexOf("open"))return this;this.engine=new vt(this.uri,this.opts);var n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;var i=Pt(n,"open",(function(){r.onopen(),t&&t()})),o=function(n){e.cleanup(),e._readyState="closed",e.emitReserved("error",n),t?t(n):e.maybeReconnectOnOpen()},s=Pt(n,"error",o);if(!1!==this._timeout){var a=this._timeout,c=this.setTimeoutFn((function(){i(),o(new Error("timeout")),n.close()}),a);this.opts.autoUnref&&c.unref(),this.subs.push((function(){e.clearTimeoutFn(c)}))}return this.subs.push(i),this.subs.push(s),this}},{key:"connect",value:function(t){return this.open(t)}},{key:"onopen",value:function(){this.cleanup(),this._readyState="open",this.emitReserved("open");var t=this.engine;this.subs.push(Pt(t,"ping",this.onping.bind(this)),Pt(t,"data",this.ondata.bind(this)),Pt(t,"error",this.onerror.bind(this)),Pt(t,"close",this.onclose.bind(this)),Pt(this.decoder,"decoded",this.ondecoded.bind(this)))}},{key:"onping",value:function(){this.emitReserved("ping")}},{key:"ondata",value:function(t){try{this.decoder.add(t)}catch(t){this.onclose("parse error",t)}}},{key:"ondecoded",value:function(t){var e=this;at((function(){e.emitReserved("packet",t)}),this.setTimeoutFn)}},{key:"onerror",value:function(t){this.emitReserved("error",t)}},{key:"socket",value:function(t,e){var n=this.nsps[t];return n?this._autoConnect&&!n.active&&n.connect():(n=new qt(this,t,e),this.nsps[t]=n),n}},{key:"_destroy",value:function(t){for(var e=0,n=Object.keys(this.nsps);e=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{var n=this.backoff.duration();this._reconnecting=!0;var r=this.setTimeoutFn((function(){e.skipReconnect||(t.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open((function(n){n?(e._reconnecting=!1,e.reconnect(),t.emitReserved("reconnect_error",n)):e.onreconnect()})))}),n);this.opts.autoUnref&&r.unref(),this.subs.push((function(){t.clearTimeoutFn(r)}))}}},{key:"onreconnect",value:function(){var t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}]),s}(I),Ft={};function Ut(e,n){"object"===t(e)&&(n=e,e=void 0);var r,i=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,r=t;n=n||"undefined"!=typeof location&&location,null==t&&(t=n.protocol+"//"+n.host),"string"==typeof t&&("/"===t.charAt(0)&&(t="/"===t.charAt(1)?n.protocol+t:n.host+t),/^(https?|wss?):\/\//.test(t)||(t=void 0!==n?n.protocol+"//"+t:"https://"+t),r=yt(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";var i=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+e,r.href=r.protocol+"://"+i+(n&&n.port===r.port?"":":"+r.port),r}(e,(n=n||{}).path||"/socket.io"),o=i.source,s=i.id,a=i.path,c=Ft[s]&&a in Ft[s].nsps;return n.forceNew||n["force new connection"]||!1===n.multiplex||c?r=new Dt(o,n):(Ft[s]||(Ft[s]=new Dt(o,n)),r=Ft[s]),i.query&&!n.query&&(n.query=i.queryKey),r.socket(i.path,n)}return i(Ut,{Manager:Dt,Socket:qt,io:Ut,connect:Ut}),Ut})); -//# sourceMappingURL=socket.io.min.js.map +/*! + * Socket.IO v4.7.0 + * (c) 2014-2023 Guillermo Rauch + * Released under the MIT License. + */ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).io=e()}(this,(function(){"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}var m=Object.create(null);m.open="0",m.close="1",m.ping="2",m.pong="3",m.message="4",m.upgrade="5",m.noop="6";var k=Object.create(null);Object.keys(m).forEach((function(t){k[m[t]]=t}));var b,w={type:"error",data:"parser error"},_="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),O="function"==typeof ArrayBuffer,A=function(t){return"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer},E=function(t,e,n){var r=t.type,i=t.data;return _&&i instanceof Blob?e?n(i):R(i,n):O&&(i instanceof ArrayBuffer||A(i))?e?n(i):R(new Blob([i]),n):n(m[r]+(i||""))},R=function(t,e){var n=new FileReader;return n.onload=function(){var t=n.result.split(",")[1];e("b"+(t||""))},n.readAsDataURL(t)};function T(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}for(var C="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",B="undefined"==typeof Uint8Array?[]:new Uint8Array(256),S=0;S1?{type:k[n],data:t.substring(1)}:{type:k[n]}:w},P=function(t,e){if(N){var n=function(t){var e,n,r,i,o,s=.75*t.length,a=t.length,c=0;"="===t[t.length-1]&&(s--,"="===t[t.length-2]&&s--);var u=new ArrayBuffer(s),h=new Uint8Array(u);for(e=0;e>4,h[c++]=(15&r)<<4|i>>2,h[c++]=(3&i)<<6|63&o;return u}(t);return j(n,e)}return{base64:!0,data:t}},j=function(t,e){return"blob"===e?t instanceof Blob?t:new Blob([t]):t instanceof ArrayBuffer?t:t.buffer},q=String.fromCharCode(30);function I(t){if(t)return function(t){for(var e in I.prototype)t[e]=I.prototype[e];return t}(t)}I.prototype.on=I.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},I.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},I.prototype.off=I.prototype.removeListener=I.prototype.removeAllListeners=I.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var i=0;i1?e-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:{};return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(e)}},{key:"_hostname",value:function(){var t=this.opts.hostname;return-1===t.indexOf(":")?t:"["+t+"]"}},{key:"_port",value:function(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}},{key:"_query",value:function(t){var e=function(t){var e="";for(var n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}(t);return e.length?"?"+e:""}}]),i}(I),z="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),J={},$=0,Q=0;function X(t){var e="";do{e=z[t%64]+e,t=Math.floor(t/64)}while(t>0);return e}function G(){var t=X(+new Date);return t!==K?($=0,K=t):t+"."+X($++)}for(;Q<64;Q++)J[z[Q]]=Q;var Z=!1;try{Z="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(t){}var tt=Z;function et(t){var e=t.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!e||tt))return new XMLHttpRequest}catch(t){}if(!e)try{return new(D[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(t){}}function nt(){}var rt=null!=new et({xdomain:!1}).responseType,it=function(t){o(s,t);var n=p(s);function s(t){var r;if(e(this,s),(r=n.call(this,t)).polling=!1,"undefined"!=typeof location){var i="https:"===location.protocol,o=location.port;o||(o=i?"443":"80"),r.xd="undefined"!=typeof location&&t.hostname!==location.hostname||o!==t.port}var a=t&&t.forceBase64;return r.supportsBinary=rt&&!a,r.opts.withCredentials&&(r.cookieJar=void 0),r}return r(s,[{key:"name",get:function(){return"polling"}},{key:"doOpen",value:function(){this.poll()}},{key:"pause",value:function(t){var e=this;this.readyState="pausing";var n=function(){e.readyState="paused",t()};if(this.polling||!this.writable){var r=0;this.polling&&(r++,this.once("pollComplete",(function(){--r||n()}))),this.writable||(r++,this.once("drain",(function(){--r||n()})))}else n()}},{key:"poll",value:function(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}},{key:"onData",value:function(t){var e=this;(function(t,e){for(var n=t.split(q),r=[],i=0;i0&&void 0!==arguments[0]?arguments[0]:{};return i(t,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new ot(this.uri(),t)}},{key:"doWrite",value:function(t,e){var n=this,r=this.request({method:"POST",data:t});r.on("success",e),r.on("error",(function(t,e){n.onError("xhr post error",t,e)}))}},{key:"doPoll",value:function(){var t=this,e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(function(e,n){t.onError("xhr poll error",e,n)})),this.pollXhr=e}}]),s}(W),ot=function(t){o(i,t);var n=p(i);function i(t,r){var o;return e(this,i),V(f(o=n.call(this)),r),o.opts=r,o.method=r.method||"GET",o.uri=t,o.data=void 0!==r.data?r.data:null,o.create(),o}return r(i,[{key:"create",value:function(){var t,e=this,n=F(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;var r=this.xhr=new et(n);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders)for(var o in r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0),this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(o)&&r.setRequestHeader(o,this.opts.extraHeaders[o])}catch(t){}if("POST"===this.method)try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{r.setRequestHeader("Accept","*/*")}catch(t){}null===(t=this.opts.cookieJar)||void 0===t||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=function(){var t;3===r.readyState&&(null===(t=e.opts.cookieJar)||void 0===t||t.parseCookies(r)),4===r.readyState&&(200===r.status||1223===r.status?e.onLoad():e.setTimeoutFn((function(){e.onError("number"==typeof r.status?r.status:0)}),0))},r.send(this.data)}catch(t){return void this.setTimeoutFn((function(){e.onError(t)}),0)}"undefined"!=typeof document&&(this.index=i.requestsCount++,i.requests[this.index]=this)}},{key:"onError",value:function(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}},{key:"cleanup",value:function(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=nt,t)try{this.xhr.abort()}catch(t){}"undefined"!=typeof document&&delete i.requests[this.index],this.xhr=null}}},{key:"onLoad",value:function(){var t=this.xhr.responseText;null!==t&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}},{key:"abort",value:function(){this.cleanup()}}]),i}(I);if(ot.requestsCount=0,ot.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",st);else if("function"==typeof addEventListener){addEventListener("onpagehide"in D?"pagehide":"unload",st,!1)}function st(){for(var t in ot.requests)ot.requests.hasOwnProperty(t)&&ot.requests[t].abort()}var at="function"==typeof Promise&&"function"==typeof Promise.resolve?function(t){return Promise.resolve().then(t)}:function(t,e){return e(t,0)},ct=D.WebSocket||D.MozWebSocket,ut="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),ht=function(t){o(i,t);var n=p(i);function i(t){var r;return e(this,i),(r=n.call(this,t)).supportsBinary=!t.forceBase64,r}return r(i,[{key:"name",get:function(){return"websocket"}},{key:"doOpen",value:function(){if(this.check()){var t=this.uri(),e=this.opts.protocols,n=ut?{}:F(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=ut?new ct(t,e,n):e?new ct(t,e):new ct(t)}catch(t){return this.emitReserved("error",t)}this.ws.binaryType=this.socket.binaryType||"arraybuffer",this.addEventListeners()}}},{key:"addEventListeners",value:function(){var t=this;this.ws.onopen=function(){t.opts.autoUnref&&t.ws._socket.unref(),t.onOpen()},this.ws.onclose=function(e){return t.onClose({description:"websocket connection closed",context:e})},this.ws.onmessage=function(e){return t.onData(e.data)},this.ws.onerror=function(e){return t.onError("websocket error",e)}}},{key:"write",value:function(t){var e=this;this.writable=!1;for(var n=function(n){var r=t[n],i=n===t.length-1;E(r,e.supportsBinary,(function(t){try{e.ws.send(t)}catch(t){}i&&at((function(){e.writable=!0,e.emitReserved("drain")}),e.setTimeoutFn)}))},r=0;r54;return x(r?t:L.decode(t),n)}(o,n,"arraybuffer")),n=!1):n=!0,e())}))}();var i=t.query.sid?'0{"sid":"'.concat(t.query.sid,'"}'):"0";t.writer.write((new TextEncoder).encode(i)).then((function(){return t.onOpen()}))}))})))}},{key:"write",value:function(t){var e=this;this.writable=!1;for(var n=function(n){var r=t[n],i=n===t.length-1;!function(t,e){_&&t.data instanceof Blob?t.data.arrayBuffer().then(T).then(e):O&&(t.data instanceof ArrayBuffer||A(t.data))?e(T(t.data)):E(t,!1,(function(t){b||(b=new TextEncoder),e(b.encode(t))}))}(r,(function(t){(function(t,e){return"message"===t.type&&"string"!=typeof t.data&&e[0]>=48&&e[0]<=54})(r,t)&&e.writer.write(Uint8Array.of(54)),e.writer.write(t).then((function(){i&&at((function(){e.writable=!0,e.emitReserved("drain")}),e.setTimeoutFn)}))}))},r=0;r1&&void 0!==arguments[1]?arguments[1]:{};return e(this,a),(r=s.call(this)).writeBuffer=[],n&&"object"===t(n)&&(o=n,n=null),n?(n=yt(n),o.hostname=n.host,o.secure="https"===n.protocol||"wss"===n.protocol,o.port=n.port,n.query&&(o.query=n.query)):o.host&&(o.hostname=yt(o.host).host),V(f(r),o),r.secure=null!=o.secure?o.secure:"undefined"!=typeof location&&"https:"===location.protocol,o.hostname&&!o.port&&(o.port=r.secure?"443":"80"),r.hostname=o.hostname||("undefined"!=typeof location?location.hostname:"localhost"),r.port=o.port||("undefined"!=typeof location&&location.port?location.port:r.secure?"443":"80"),r.transports=o.transports||["polling","websocket","webtransport"],r.writeBuffer=[],r.prevBufferLen=0,r.opts=i({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},o),r.opts.path=r.opts.path.replace(/\/$/,"")+(r.opts.addTrailingSlash?"/":""),"string"==typeof r.opts.query&&(r.opts.query=H(r.opts.query)),r.id=null,r.upgrades=null,r.pingInterval=null,r.pingTimeout=null,r.pingTimeoutTimer=null,"function"==typeof addEventListener&&(r.opts.closeOnBeforeunload&&(r.beforeunloadEventListener=function(){r.transport&&(r.transport.removeAllListeners(),r.transport.close())},addEventListener("beforeunload",r.beforeunloadEventListener,!1)),"localhost"!==r.hostname&&(r.offlineEventListener=function(){r.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",r.offlineEventListener,!1))),r.open(),r}return r(a,[{key:"createTransport",value:function(t){var e=i({},this.opts.query);e.EIO=4,e.transport=t,this.id&&(e.sid=this.id);var n=i({},this.opts.transportOptions[t],this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new lt[t](n)}},{key:"open",value:function(){var t,e=this;if(this.opts.rememberUpgrade&&a.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((function(){e.emitReserved("error","No transports available")}),0);t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(t){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)}},{key:"setTransport",value:function(t){var e=this;this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(function(t){return e.onClose("transport close",t)}))}},{key:"probe",value:function(t){var e=this,n=this.createTransport(t),r=!1;a.priorWebsocketSuccess=!1;var i=function(){r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",(function(t){if(!r)if("pong"===t.type&&"probe"===t.data){if(e.upgrading=!0,e.emitReserved("upgrading",n),!n)return;a.priorWebsocketSuccess="websocket"===n.name,e.transport.pause((function(){r||"closed"!==e.readyState&&(f(),e.setTransport(n),n.send([{type:"upgrade"}]),e.emitReserved("upgrade",n),n=null,e.upgrading=!1,e.flush())}))}else{var i=new Error("probe error");i.transport=n.name,e.emitReserved("upgradeError",i)}})))};function o(){r||(r=!0,f(),n.close(),n=null)}var s=function(t){var r=new Error("probe error: "+t);r.transport=n.name,o(),e.emitReserved("upgradeError",r)};function c(){s("transport closed")}function u(){s("socket closed")}function h(t){n&&t.name!==n.name&&o()}var f=function(){n.removeListener("open",i),n.removeListener("error",s),n.removeListener("close",c),e.off("close",u),e.off("upgrading",h)};n.once("open",i),n.once("error",s),n.once("close",c),this.once("close",u),this.once("upgrading",h),-1!==this.upgrades.indexOf("webtransport")&&"webtransport"!==t?this.setTimeoutFn((function(){r||n.open()}),200):n.open()}},{key:"onOpen",value:function(){if(this.readyState="open",a.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade)for(var t=0,e=this.upgrades.length;t1))return this.writeBuffer;for(var t,e=1,n=0;n=57344?n+=3:(r++,n+=4);return n}(t):Math.ceil(1.33*(t.byteLength||t.size))),n>0&&e>this.maxPayload)return this.writeBuffer.slice(0,n);e+=2}return this.writeBuffer}},{key:"write",value:function(t,e,n){return this.sendPacket("message",t,e,n),this}},{key:"send",value:function(t,e,n){return this.sendPacket("message",t,e,n),this}},{key:"sendPacket",value:function(t,e,n,r){if("function"==typeof e&&(r=e,e=void 0),"function"==typeof n&&(r=n,n=null),"closing"!==this.readyState&&"closed"!==this.readyState){(n=n||{}).compress=!1!==n.compress;var i={type:t,data:e,options:n};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}}},{key:"close",value:function(){var t=this,e=function(){t.onClose("forced close"),t.transport.close()},n=function n(){t.off("upgrade",n),t.off("upgradeError",n),e()},r=function(){t.once("upgrade",n),t.once("upgradeError",n)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(function(){t.upgrading?r():e()})):this.upgrading?r():e()),this}},{key:"onError",value:function(t){a.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}},{key:"onClose",value:function(t,e){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,e),this.writeBuffer=[],this.prevBufferLen=0)}},{key:"filterUpgrades",value:function(t){for(var e=[],n=0,r=t.length;n=0&&e.num1?e-1:0),r=1;r1?n-1:0),i=1;in._opts.retries&&(n._queue.shift(),e&&e(t));else if(n._queue.shift(),e){for(var o=arguments.length,s=new Array(o>1?o-1:0),a=1;a0&&void 0!==arguments[0]&&arguments[0];if(this.connected&&0!==this._queue.length){var e=this._queue[0];e.pending&&!t||(e.pending=!0,e.tryCount++,this.flags=e.flags,this.emit.apply(this,e.args))}}},{key:"packet",value:function(t){t.nsp=this.nsp,this.io._packet(t)}},{key:"onopen",value:function(){var t=this;"function"==typeof this.auth?this.auth((function(e){t._sendConnectPacket(e)})):this._sendConnectPacket(this.auth)}},{key:"_sendConnectPacket",value:function(t){this.packet({type:Tt.CONNECT,data:this._pid?i({pid:this._pid,offset:this._lastOffset},t):t})}},{key:"onerror",value:function(t){this.connected||this.emitReserved("connect_error",t)}},{key:"onclose",value:function(t,e){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,e)}},{key:"onpacket",value:function(t){if(t.nsp===this.nsp)switch(t.type){case Tt.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Tt.EVENT:case Tt.BINARY_EVENT:this.onevent(t);break;case Tt.ACK:case Tt.BINARY_ACK:this.onack(t);break;case Tt.DISCONNECT:this.ondisconnect();break;case Tt.CONNECT_ERROR:this.destroy();var e=new Error(t.data.message);e.data=t.data.data,this.emitReserved("connect_error",e)}}},{key:"onevent",value:function(t){var e=t.data||[];null!=t.id&&e.push(this.ack(t.id)),this.connected?this.emitEvent(e):this.receiveBuffer.push(Object.freeze(e))}},{key:"emitEvent",value:function(t){if(this._anyListeners&&this._anyListeners.length){var e,n=g(this._anyListeners.slice());try{for(n.s();!(e=n.n()).done;){e.value.apply(this,t)}}catch(t){n.e(t)}finally{n.f()}}y(s(a.prototype),"emit",this).apply(this,t),this._pid&&t.length&&"string"==typeof t[t.length-1]&&(this._lastOffset=t[t.length-1])}},{key:"ack",value:function(t){var e=this,n=!1;return function(){if(!n){n=!0;for(var r=arguments.length,i=new Array(r),o=0;o0&&t.jitter<=1?t.jitter:0,this.attempts=0}It.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=0==(1&Math.floor(10*e))?t-n:t+n}return 0|Math.min(t,this.max)},It.prototype.reset=function(){this.attempts=0},It.prototype.setMin=function(t){this.ms=t},It.prototype.setMax=function(t){this.max=t},It.prototype.setJitter=function(t){this.jitter=t};var Dt=function(n){o(s,n);var i=p(s);function s(n,r){var o,a;e(this,s),(o=i.call(this)).nsps={},o.subs=[],n&&"object"===t(n)&&(r=n,n=void 0),(r=r||{}).path=r.path||"/socket.io",o.opts=r,V(f(o),r),o.reconnection(!1!==r.reconnection),o.reconnectionAttempts(r.reconnectionAttempts||1/0),o.reconnectionDelay(r.reconnectionDelay||1e3),o.reconnectionDelayMax(r.reconnectionDelayMax||5e3),o.randomizationFactor(null!==(a=r.randomizationFactor)&&void 0!==a?a:.5),o.backoff=new It({min:o.reconnectionDelay(),max:o.reconnectionDelayMax(),jitter:o.randomizationFactor()}),o.timeout(null==r.timeout?2e4:r.timeout),o._readyState="closed",o.uri=n;var c=r.parser||xt;return o.encoder=new c.Encoder,o.decoder=new c.Decoder,o._autoConnect=!1!==r.autoConnect,o._autoConnect&&o.open(),o}return r(s,[{key:"reconnection",value:function(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}},{key:"reconnectionAttempts",value:function(t){return void 0===t?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}},{key:"reconnectionDelay",value:function(t){var e;return void 0===t?this._reconnectionDelay:(this._reconnectionDelay=t,null===(e=this.backoff)||void 0===e||e.setMin(t),this)}},{key:"randomizationFactor",value:function(t){var e;return void 0===t?this._randomizationFactor:(this._randomizationFactor=t,null===(e=this.backoff)||void 0===e||e.setJitter(t),this)}},{key:"reconnectionDelayMax",value:function(t){var e;return void 0===t?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,null===(e=this.backoff)||void 0===e||e.setMax(t),this)}},{key:"timeout",value:function(t){return arguments.length?(this._timeout=t,this):this._timeout}},{key:"maybeReconnectOnOpen",value:function(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}},{key:"open",value:function(t){var e=this;if(~this._readyState.indexOf("open"))return this;this.engine=new vt(this.uri,this.opts);var n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;var i=Pt(n,"open",(function(){r.onopen(),t&&t()})),o=function(n){e.cleanup(),e._readyState="closed",e.emitReserved("error",n),t?t(n):e.maybeReconnectOnOpen()},s=Pt(n,"error",o);if(!1!==this._timeout){var a=this._timeout,c=this.setTimeoutFn((function(){i(),o(new Error("timeout")),n.close()}),a);this.opts.autoUnref&&c.unref(),this.subs.push((function(){e.clearTimeoutFn(c)}))}return this.subs.push(i),this.subs.push(s),this}},{key:"connect",value:function(t){return this.open(t)}},{key:"onopen",value:function(){this.cleanup(),this._readyState="open",this.emitReserved("open");var t=this.engine;this.subs.push(Pt(t,"ping",this.onping.bind(this)),Pt(t,"data",this.ondata.bind(this)),Pt(t,"error",this.onerror.bind(this)),Pt(t,"close",this.onclose.bind(this)),Pt(this.decoder,"decoded",this.ondecoded.bind(this)))}},{key:"onping",value:function(){this.emitReserved("ping")}},{key:"ondata",value:function(t){try{this.decoder.add(t)}catch(t){this.onclose("parse error",t)}}},{key:"ondecoded",value:function(t){var e=this;at((function(){e.emitReserved("packet",t)}),this.setTimeoutFn)}},{key:"onerror",value:function(t){this.emitReserved("error",t)}},{key:"socket",value:function(t,e){var n=this.nsps[t];return n?this._autoConnect&&!n.active&&n.connect():(n=new qt(this,t,e),this.nsps[t]=n),n}},{key:"_destroy",value:function(t){for(var e=0,n=Object.keys(this.nsps);e=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{var n=this.backoff.duration();this._reconnecting=!0;var r=this.setTimeoutFn((function(){e.skipReconnect||(t.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open((function(n){n?(e._reconnecting=!1,e.reconnect(),t.emitReserved("reconnect_error",n)):e.onreconnect()})))}),n);this.opts.autoUnref&&r.unref(),this.subs.push((function(){t.clearTimeoutFn(r)}))}}},{key:"onreconnect",value:function(){var t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}]),s}(I),Ft={};function Ut(e,n){"object"===t(e)&&(n=e,e=void 0);var r,i=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,r=t;n=n||"undefined"!=typeof location&&location,null==t&&(t=n.protocol+"//"+n.host),"string"==typeof t&&("/"===t.charAt(0)&&(t="/"===t.charAt(1)?n.protocol+t:n.host+t),/^(https?|wss?):\/\//.test(t)||(t=void 0!==n?n.protocol+"//"+t:"https://"+t),r=yt(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";var i=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+e,r.href=r.protocol+"://"+i+(n&&n.port===r.port?"":":"+r.port),r}(e,(n=n||{}).path||"/socket.io"),o=i.source,s=i.id,a=i.path,c=Ft[s]&&a in Ft[s].nsps;return n.forceNew||n["force new connection"]||!1===n.multiplex||c?r=new Dt(o,n):(Ft[s]||(Ft[s]=new Dt(o,n)),r=Ft[s]),i.query&&!n.query&&(n.query=i.queryKey),r.socket(i.path,n)}return i(Ut,{Manager:Dt,Socket:qt,io:Ut,connect:Ut}),Ut})); +//# sourceMappingURL=socket.io.min.js.map diff --git a/semag/emulatorjs/data/storage.js b/semag/emulatorjs/data/storage.js index b4121c00..9abd0c11 100644 --- a/semag/emulatorjs/data/storage.js +++ b/semag/emulatorjs/data/storage.js @@ -1,104 +1,125 @@ -class EJS_STORAGE { - constructor(dbName, storeName) { - this.dbName = dbName; - this.storeName = storeName; - } - addFileToDB(key, add) { - (async () => { - if (key === "?EJS_KEYS!") return; - let keys = await this.get("?EJS_KEYS!"); - if (!keys) keys = []; - if (add) { - if (!keys.includes(key)) keys.push(key); - } else { - const index = keys.indexOf(key); - if (index !== -1) keys.splice(index, 1); - } - this.put("?EJS_KEYS!", keys); - })(); - } - get(key) { - return new Promise((resolve, reject) => { - if (!window.indexedDB) return resolve(); - let openRequest = indexedDB.open(this.dbName, 1); - openRequest.onerror = () => resolve(); - openRequest.onsuccess = () => { - let db = openRequest.result; - let transaction = db.transaction([this.storeName], "readwrite"); - let objectStore = transaction.objectStore(this.storeName); - let request = objectStore.get(key); - request.onsuccess = (e) => { - resolve(request.result); - }; - request.onerror = () => resolve(); - }; - openRequest.onupgradeneeded = () => { - let db = openRequest.result; - if (! db.objectStoreNames.contains(this.storeName)) { - db.createObjectStore(this.storeName); - }; - }; - }); - } - put(key, data) { - return new Promise((resolve, reject) => { - if (!window.indexedDB) return resolve(); - let openRequest = indexedDB.open(this.dbName, 1); - openRequest.onerror = () => {}; - openRequest.onsuccess = () => { - let db = openRequest.result; - let transaction = db.transaction([this.storeName], "readwrite"); - let objectStore = transaction.objectStore(this.storeName); - let request = objectStore.put(data, key); - request.onerror = () => resolve(); - request.onsuccess = () => { - this.addFileToDB(key, true); - resolve(); - } - }; - openRequest.onupgradeneeded = () => { - let db = openRequest.result; - if (! db.objectStoreNames.contains(this.storeName)) { - db.createObjectStore(this.storeName); - }; - }; - }) - } - remove(key) { - return new Promise((resolve, reject) => { - if (!window.indexedDB) return resolve(); - let openRequest = indexedDB.open(this.dbName, 1); - openRequest.onerror = () => {}; - openRequest.onsuccess = () => { - let db = openRequest.result; - let transaction = db.transaction([this.storeName], "readwrite"); - let objectStore = transaction.objectStore(this.storeName); - let request2 = objectStore.delete(key); - this.addFileToDB(key, false); - request2.onsuccess = () => resolve(); - request2.onerror = () => {}; - }; - openRequest.onupgradeneeded = () => { - let db = openRequest.result; - if (! db.objectStoreNames.contains(this.storeName)) { - db.createObjectStore(this.storeName); - }; - }; - }); - } - getSizes() { - return new Promise(async (resolve, reject) => { - if (!window.indexedDB) resolve({}); - const keys = await this.get("?EJS_KEYS!"); - if (!keys) return resolve({}); - let rv = {}; - for (let i=0; i { + if (key === "?EJS_KEYS!") return; + let keys = await this.get("?EJS_KEYS!"); + if (!keys) keys = []; + if (add) { + if (!keys.includes(key)) keys.push(key); + } else { + const index = keys.indexOf(key); + if (index !== -1) keys.splice(index, 1); + } + this.put("?EJS_KEYS!", keys); + })(); + } + get(key) { + return new Promise((resolve, reject) => { + if (!window.indexedDB) return resolve(); + let openRequest = indexedDB.open(this.dbName, 1); + openRequest.onerror = () => resolve(); + openRequest.onsuccess = () => { + let db = openRequest.result; + let transaction = db.transaction([this.storeName], "readwrite"); + let objectStore = transaction.objectStore(this.storeName); + let request = objectStore.get(key); + request.onsuccess = (e) => { + resolve(request.result); + }; + request.onerror = () => resolve(); + }; + openRequest.onupgradeneeded = () => { + let db = openRequest.result; + if (! db.objectStoreNames.contains(this.storeName)) { + db.createObjectStore(this.storeName); + }; + }; + }); + } + put(key, data) { + return new Promise((resolve, reject) => { + if (!window.indexedDB) return resolve(); + let openRequest = indexedDB.open(this.dbName, 1); + openRequest.onerror = () => {}; + openRequest.onsuccess = () => { + let db = openRequest.result; + let transaction = db.transaction([this.storeName], "readwrite"); + let objectStore = transaction.objectStore(this.storeName); + let request = objectStore.put(data, key); + request.onerror = () => resolve(); + request.onsuccess = () => { + this.addFileToDB(key, true); + resolve(); + } + }; + openRequest.onupgradeneeded = () => { + let db = openRequest.result; + if (! db.objectStoreNames.contains(this.storeName)) { + db.createObjectStore(this.storeName); + }; + }; + }) + } + remove(key) { + return new Promise((resolve, reject) => { + if (!window.indexedDB) return resolve(); + let openRequest = indexedDB.open(this.dbName, 1); + openRequest.onerror = () => {}; + openRequest.onsuccess = () => { + let db = openRequest.result; + let transaction = db.transaction([this.storeName], "readwrite"); + let objectStore = transaction.objectStore(this.storeName); + let request2 = objectStore.delete(key); + this.addFileToDB(key, false); + request2.onsuccess = () => resolve(); + request2.onerror = () => {}; + }; + openRequest.onupgradeneeded = () => { + let db = openRequest.result; + if (! db.objectStoreNames.contains(this.storeName)) { + db.createObjectStore(this.storeName); + }; + }; + }); + } + getSizes() { + return new Promise(async (resolve, reject) => { + if (!window.indexedDB) resolve({}); + const keys = await this.get("?EJS_KEYS!"); + if (!keys) return resolve({}); + let rv = {}; + for (let i=0; i resolve()); + } + get() { + return new Promise(resolve => resolve()); + } + put() { + return new Promise(resolve => resolve()); + } + remove() { + return new Promise(resolve => resolve()); + } + getSizes() { + return new Promise(resolve => resolve({})); + } +} + +window.EJS_STORAGE = EJS_STORAGE; +window.EJS_DUMMYSTORAGE = EJS_DUMMYSTORAGE; diff --git a/semag/emulatorjs/data/version.json b/semag/emulatorjs/data/version.json index 911687e0..33b2b516 100644 --- a/semag/emulatorjs/data/version.json +++ b/semag/emulatorjs/data/version.json @@ -1 +1 @@ -{ "current_version": 40.8 } +{ "current_version": 401.1 } diff --git a/semag/goldeneye/index.html b/semag/goldeneye/index.html index 183a9da5..0b579ad9 100644 --- a/semag/goldeneye/index.html +++ b/semag/goldeneye/index.html @@ -18,8 +18,8 @@ EJS_core = "n64"; EJS_color = "#0064ff"; EJS_startOnLoaded = true; - EJS_pathtodata = "https://cdn.emulatorjs.org/stable/data/"; + EJS_pathtodata = "/semag/emulatorjs/data/"; EJS_gameUrl = "007 - GoldenEye (USA).n64"; - + diff --git a/semag/guiltygear/index.html b/semag/guiltygear/index.html index 1d0e44d9..1ca02d49 100644 --- a/semag/guiltygear/index.html +++ b/semag/guiltygear/index.html @@ -16,10 +16,10 @@ - + diff --git a/semag/majorasmask/index.html b/semag/majorasmask/index.html index 7a613e30..54570f11 100644 --- a/semag/majorasmask/index.html +++ b/semag/majorasmask/index.html @@ -18,8 +18,8 @@ EJS_core = "n64"; EJS_color = "#0064ff"; EJS_startOnLoaded = true; - EJS_pathtodata = "https://cdn.emulatorjs.org/stable/data/"; + EJS_pathtodata = "/semag/emulatorjs/data/"; EJS_gameUrl = "Legend of Zelda, The - Majora's Mask (USA).n64"; - + diff --git a/semag/mariokartds/index.html b/semag/mariokartds/index.html index bcf54974..8409b5c2 100644 --- a/semag/mariokartds/index.html +++ b/semag/mariokartds/index.html @@ -18,8 +18,8 @@ EJS_core = "nds"; EJS_color = "#0064ff"; EJS_startOnLoaded = true; - EJS_pathtodata = "https://cdn.emulatorjs.org/stable/data/"; + EJS_pathtodata = "/semag/emulatorjs/data/"; EJS_gameUrl = "Mario Kart DS (USA) (En,Fr,De,Es,It).nds"; - + diff --git a/semag/marioparty/index.html b/semag/marioparty/index.html index fe67b5ee..092e2699 100644 --- a/semag/marioparty/index.html +++ b/semag/marioparty/index.html @@ -18,8 +18,8 @@ EJS_core = "n64"; EJS_color = "#0064ff"; EJS_startOnLoaded = true; - EJS_pathtodata = "https://cdn.emulatorjs.org/stable/data/"; + EJS_pathtodata = "/semag/emulatorjs/data/"; EJS_gameUrl = "Mario Party (Europe) (En,Fr,De).n64"; - + diff --git a/semag/marioparty2/index.html b/semag/marioparty2/index.html index dcfe1e8b..4b03f47f 100644 --- a/semag/marioparty2/index.html +++ b/semag/marioparty2/index.html @@ -18,8 +18,8 @@ EJS_core = "n64"; EJS_color = "#0064ff"; EJS_startOnLoaded = true; - EJS_pathtodata = "https://cdn.emulatorjs.org/stable/data/"; + EJS_pathtodata = "/semag/emulatorjs/data/"; EJS_gameUrl = "Mario Party 2 (USA).n64"; - + diff --git a/semag/marioparty3/index.html b/semag/marioparty3/index.html index 27c8a9b0..10415aad 100644 --- a/semag/marioparty3/index.html +++ b/semag/marioparty3/index.html @@ -18,8 +18,8 @@ EJS_core = "n64"; EJS_color = "#0064ff"; EJS_startOnLoaded = true; - EJS_pathtodata = "https://cdn.emulatorjs.org/stable/data/"; + EJS_pathtodata = "/semag/emulatorjs/data/"; EJS_gameUrl = "Mario Party 3 (USA).n64"; - + diff --git a/semag/mariopartyds/index.html b/semag/mariopartyds/index.html index efd1489e..ab11bf96 100644 --- a/semag/mariopartyds/index.html +++ b/semag/mariopartyds/index.html @@ -18,8 +18,8 @@ EJS_core = "nds"; EJS_color = "#0064ff"; EJS_startOnLoaded = true; - EJS_pathtodata = "https://cdn.emulatorjs.org/stable/data/"; + EJS_pathtodata = "/semag/emulatorjs/data/"; EJS_gameUrl = "1704 - Mario Party DS (Europe) (En,Fr,De,Es,It).nds"; - + diff --git a/semag/metroidzeromission/index.html b/semag/metroidzeromission/index.html index cbe2c735..ff21ed52 100644 --- a/semag/metroidzeromission/index.html +++ b/semag/metroidzeromission/index.html @@ -16,10 +16,10 @@ - + diff --git a/semag/nintendogs/index.html b/semag/nintendogs/index.html index 67933f4e..fad4a32e 100644 --- a/semag/nintendogs/index.html +++ b/semag/nintendogs/index.html @@ -18,8 +18,8 @@ EJS_core = "nds"; EJS_color = "#0064ff"; EJS_startOnLoaded = true; - EJS_pathtodata = "https://cdn.emulatorjs.org/stable/data/"; + EJS_pathtodata = "/semag/emulatorjs/data/"; EJS_gameUrl = "Nintendogs - Best Friends (USA).nds"; - + diff --git a/semag/ocarinaoftime/index.html b/semag/ocarinaoftime/index.html index f8d535cf..f3633da3 100644 --- a/semag/ocarinaoftime/index.html +++ b/semag/ocarinaoftime/index.html @@ -16,10 +16,10 @@ - + diff --git a/semag/papermario/index.html b/semag/papermario/index.html index 4adae1c4..f3fcb21a 100644 --- a/semag/papermario/index.html +++ b/semag/papermario/index.html @@ -18,8 +18,8 @@ EJS_core = "n64"; EJS_color = "#0064ff"; EJS_startOnLoaded = true; - EJS_pathtodata = "https://cdn.emulatorjs.org/stable/data/"; + EJS_pathtodata = "/semag/emulatorjs/data/"; EJS_gameUrl = "Paper Mario (USA).n64"; - + diff --git a/semag/pokemon/blue/index.html b/semag/pokemon/blue/index.html index e4d7ba1a..5a7e06bd 100644 --- a/semag/pokemon/blue/index.html +++ b/semag/pokemon/blue/index.html @@ -16,10 +16,10 @@ - + diff --git a/semag/pokemon/crystal/index.html b/semag/pokemon/crystal/index.html index 52e86f88..ed92cdd2 100644 --- a/semag/pokemon/crystal/index.html +++ b/semag/pokemon/crystal/index.html @@ -16,10 +16,10 @@ - + diff --git a/semag/pokemon/emerald/index.html b/semag/pokemon/emerald/index.html index 042179f2..c622b06b 100644 --- a/semag/pokemon/emerald/index.html +++ b/semag/pokemon/emerald/index.html @@ -16,10 +16,10 @@ - + diff --git a/semag/pokemon/firered/index.html b/semag/pokemon/firered/index.html index 5a6bfdb6..3f6d5c8c 100644 --- a/semag/pokemon/firered/index.html +++ b/semag/pokemon/firered/index.html @@ -16,10 +16,10 @@ - + diff --git a/semag/pokemon/gold/index.html b/semag/pokemon/gold/index.html index 033a6912..3db74e65 100644 --- a/semag/pokemon/gold/index.html +++ b/semag/pokemon/gold/index.html @@ -16,10 +16,10 @@ - + diff --git a/semag/pokemon/leafgreen/index.html b/semag/pokemon/leafgreen/index.html index 1fd5c5d7..97043456 100644 --- a/semag/pokemon/leafgreen/index.html +++ b/semag/pokemon/leafgreen/index.html @@ -16,10 +16,10 @@ - + diff --git a/semag/pokemon/red/index.html b/semag/pokemon/red/index.html index 6ca81320..15c8fd5e 100644 --- a/semag/pokemon/red/index.html +++ b/semag/pokemon/red/index.html @@ -16,10 +16,10 @@ - + diff --git a/semag/pokemon/ruby/index.html b/semag/pokemon/ruby/index.html index 71f1d025..75d23a7d 100644 --- a/semag/pokemon/ruby/index.html +++ b/semag/pokemon/ruby/index.html @@ -16,10 +16,10 @@ - + diff --git a/semag/pokemon/sapphire/index.html b/semag/pokemon/sapphire/index.html index 3d574ef3..88ebeb6e 100644 --- a/semag/pokemon/sapphire/index.html +++ b/semag/pokemon/sapphire/index.html @@ -16,10 +16,10 @@ - + diff --git a/semag/pokemon/silver/index.html b/semag/pokemon/silver/index.html index 27a0c4ed..daea1d04 100644 --- a/semag/pokemon/silver/index.html +++ b/semag/pokemon/silver/index.html @@ -16,10 +16,10 @@ - + \ No newline at end of file diff --git a/semag/pokemon/yellow/index.html b/semag/pokemon/yellow/index.html index b9d52197..f2885fbc 100644 --- a/semag/pokemon/yellow/index.html +++ b/semag/pokemon/yellow/index.html @@ -16,10 +16,10 @@ - + diff --git a/semag/starfox64/index.html b/semag/starfox64/index.html index ca7bf791..739d193f 100644 --- a/semag/starfox64/index.html +++ b/semag/starfox64/index.html @@ -18,8 +18,8 @@ EJS_core = "n64"; EJS_color = "#0064ff"; EJS_startOnLoaded = true; - EJS_pathtodata = "https://cdn.emulatorjs.org/stable/data/"; + EJS_pathtodata = "/semag/emulatorjs/data/"; EJS_gameUrl = "Star Fox 64 (USA) (Rev A).n64"; - + diff --git a/semag/supermario64ds/index.html b/semag/supermario64ds/index.html index b7f3f746..b758cd02 100644 --- a/semag/supermario64ds/index.html +++ b/semag/supermario64ds/index.html @@ -18,8 +18,8 @@ EJS_core = "nds"; EJS_color = "#0064ff"; EJS_startOnLoaded = true; - EJS_pathtodata = "https://cdn.emulatorjs.org/stable/data/"; + EJS_pathtodata = "/semag/emulatorjs/data/"; EJS_gameUrl = "Super Mario 64 DS (USA) (Rev 1).nds"; - + diff --git a/semag/supersmashbros/index.html b/semag/supersmashbros/index.html index 0e3da013..acac8f00 100644 --- a/semag/supersmashbros/index.html +++ b/semag/supersmashbros/index.html @@ -16,11 +16,11 @@ - + + + Terrifried +
    - - + \ No newline at end of file diff --git a/semag/terrifried/resources/0.png b/semag/terrifried/resources/0.png new file mode 100644 index 00000000..57bc9142 Binary files /dev/null and b/semag/terrifried/resources/0.png differ diff --git a/semag/terrifried/resources/0_small.png b/semag/terrifried/resources/0_small.png new file mode 100644 index 00000000..7905bd10 Binary files /dev/null and b/semag/terrifried/resources/0_small.png differ diff --git a/semag/terrifried/resources/1.png b/semag/terrifried/resources/1.png new file mode 100644 index 00000000..2588949f Binary files /dev/null and b/semag/terrifried/resources/1.png differ diff --git a/semag/terrifried/resources/1_small.png b/semag/terrifried/resources/1_small.png new file mode 100644 index 00000000..ed5ac95a Binary files /dev/null and b/semag/terrifried/resources/1_small.png differ diff --git a/semag/terrifried/resources/2.png b/semag/terrifried/resources/2.png new file mode 100644 index 00000000..2800aa7d Binary files /dev/null and b/semag/terrifried/resources/2.png differ diff --git a/semag/terrifried/resources/2_small.png b/semag/terrifried/resources/2_small.png new file mode 100644 index 00000000..64636bf8 Binary files /dev/null and b/semag/terrifried/resources/2_small.png differ diff --git a/semag/terrifried/resources/3.png b/semag/terrifried/resources/3.png new file mode 100644 index 00000000..dd5114be Binary files /dev/null and b/semag/terrifried/resources/3.png differ diff --git a/semag/terrifried/resources/3_small.png b/semag/terrifried/resources/3_small.png new file mode 100644 index 00000000..988bbeca Binary files /dev/null and b/semag/terrifried/resources/3_small.png differ diff --git a/semag/terrifried/resources/4.png b/semag/terrifried/resources/4.png new file mode 100644 index 00000000..d2e80ca4 Binary files /dev/null and b/semag/terrifried/resources/4.png differ diff --git a/semag/terrifried/resources/4_small.png b/semag/terrifried/resources/4_small.png new file mode 100644 index 00000000..cf5aff72 Binary files /dev/null and b/semag/terrifried/resources/4_small.png differ diff --git a/semag/terrifried/resources/5.png b/semag/terrifried/resources/5.png new file mode 100644 index 00000000..b47be19b Binary files /dev/null and b/semag/terrifried/resources/5.png differ diff --git a/semag/terrifried/resources/5_small.png b/semag/terrifried/resources/5_small.png new file mode 100644 index 00000000..8aa527c8 Binary files /dev/null and b/semag/terrifried/resources/5_small.png differ diff --git a/semag/terrifried/resources/6.png b/semag/terrifried/resources/6.png new file mode 100644 index 00000000..f086ea2f Binary files /dev/null and b/semag/terrifried/resources/6.png differ diff --git a/semag/terrifried/resources/6_small.png b/semag/terrifried/resources/6_small.png new file mode 100644 index 00000000..ebc46592 Binary files /dev/null and b/semag/terrifried/resources/6_small.png differ diff --git a/semag/terrifried/resources/7.png b/semag/terrifried/resources/7.png new file mode 100644 index 00000000..29a6fecc Binary files /dev/null and b/semag/terrifried/resources/7.png differ diff --git a/semag/terrifried/resources/7_small.png b/semag/terrifried/resources/7_small.png new file mode 100644 index 00000000..a8b4b19c Binary files /dev/null and b/semag/terrifried/resources/7_small.png differ diff --git a/semag/terrifried/resources/8.png b/semag/terrifried/resources/8.png new file mode 100644 index 00000000..d787b666 Binary files /dev/null and b/semag/terrifried/resources/8.png differ diff --git a/semag/terrifried/resources/8_small.png b/semag/terrifried/resources/8_small.png new file mode 100644 index 00000000..bee10e31 Binary files /dev/null and b/semag/terrifried/resources/8_small.png differ diff --git a/semag/terrifried/resources/9.png b/semag/terrifried/resources/9.png new file mode 100644 index 00000000..5583ed41 Binary files /dev/null and b/semag/terrifried/resources/9.png differ diff --git a/semag/terrifried/resources/9_small.png b/semag/terrifried/resources/9_small.png new file mode 100644 index 00000000..e6ab23a4 Binary files /dev/null and b/semag/terrifried/resources/9_small.png differ diff --git a/semag/terrifried/resources/besttext.png b/semag/terrifried/resources/besttext.png new file mode 100644 index 00000000..803ac5c7 Binary files /dev/null and b/semag/terrifried/resources/besttext.png differ diff --git a/semag/terrifried/resources/buttonprompttext.png b/semag/terrifried/resources/buttonprompttext.png new file mode 100644 index 00000000..24be46c6 Binary files /dev/null and b/semag/terrifried/resources/buttonprompttext.png differ diff --git a/semag/terrifried/resources/click.mp3 b/semag/terrifried/resources/click.mp3 new file mode 100644 index 00000000..0e9f485a Binary files /dev/null and b/semag/terrifried/resources/click.mp3 differ diff --git a/semag/terrifried/resources/click.ogg b/semag/terrifried/resources/click.ogg new file mode 100644 index 00000000..90e89f2e Binary files /dev/null and b/semag/terrifried/resources/click.ogg differ diff --git a/semag/terrifried/resources/coin.mp3 b/semag/terrifried/resources/coin.mp3 new file mode 100644 index 00000000..c9edb3df Binary files /dev/null and b/semag/terrifried/resources/coin.mp3 differ diff --git a/semag/terrifried/resources/coin.ogg b/semag/terrifried/resources/coin.ogg new file mode 100644 index 00000000..bbf448a7 Binary files /dev/null and b/semag/terrifried/resources/coin.ogg differ diff --git a/semag/terrifried/resources/coin.png b/semag/terrifried/resources/coin.png new file mode 100644 index 00000000..2ac238eb Binary files /dev/null and b/semag/terrifried/resources/coin.png differ diff --git a/semag/terrifried/resources/die.mp3 b/semag/terrifried/resources/die.mp3 new file mode 100644 index 00000000..ad8a96f4 Binary files /dev/null and b/semag/terrifried/resources/die.mp3 differ diff --git a/semag/terrifried/resources/die.ogg b/semag/terrifried/resources/die.ogg new file mode 100644 index 00000000..c6138976 Binary files /dev/null and b/semag/terrifried/resources/die.ogg differ diff --git a/semag/terrifried/resources/egg.png b/semag/terrifried/resources/egg.png new file mode 100644 index 00000000..5d23d9df Binary files /dev/null and b/semag/terrifried/resources/egg.png differ diff --git a/semag/terrifried/resources/font.otf b/semag/terrifried/resources/font.otf new file mode 100644 index 00000000..5fc07060 Binary files /dev/null and b/semag/terrifried/resources/font.otf differ diff --git a/semag/terrifried/resources/launch.mp3 b/semag/terrifried/resources/launch.mp3 new file mode 100644 index 00000000..4ed4fd15 Binary files /dev/null and b/semag/terrifried/resources/launch.mp3 differ diff --git a/semag/terrifried/resources/launch.ogg b/semag/terrifried/resources/launch.ogg new file mode 100644 index 00000000..141da2fe Binary files /dev/null and b/semag/terrifried/resources/launch.ogg differ diff --git a/semag/terrifried/resources/lava.png b/semag/terrifried/resources/lava.png new file mode 100644 index 00000000..df19afd2 Binary files /dev/null and b/semag/terrifried/resources/lava.png differ diff --git a/semag/terrifried/resources/logo.png b/semag/terrifried/resources/logo.png new file mode 100644 index 00000000..4c60c388 Binary files /dev/null and b/semag/terrifried/resources/logo.png differ diff --git a/semag/terrifried/resources/platform.png b/semag/terrifried/resources/platform.png new file mode 100644 index 00000000..9a62d109 Binary files /dev/null and b/semag/terrifried/resources/platform.png differ diff --git a/semag/terrifried/resources/polymarstext.png b/semag/terrifried/resources/polymarstext.png new file mode 100644 index 00000000..3121b9e4 Binary files /dev/null and b/semag/terrifried/resources/polymarstext.png differ diff --git a/semag/terrifried/resources/scorebox.png b/semag/terrifried/resources/scorebox.png new file mode 100644 index 00000000..556eeae6 Binary files /dev/null and b/semag/terrifried/resources/scorebox.png differ diff --git a/semag/terrifried/resources/select.mp3 b/semag/terrifried/resources/select.mp3 new file mode 100644 index 00000000..c724726d Binary files /dev/null and b/semag/terrifried/resources/select.mp3 differ diff --git a/semag/terrifried/resources/select.ogg b/semag/terrifried/resources/select.ogg new file mode 100644 index 00000000..d1ec6f9f Binary files /dev/null and b/semag/terrifried/resources/select.ogg differ diff --git a/semag/terrifried/resources/splash.mp3 b/semag/terrifried/resources/splash.mp3 new file mode 100644 index 00000000..0a99f74d Binary files /dev/null and b/semag/terrifried/resources/splash.mp3 differ diff --git a/semag/terrifried/resources/splash.ogg b/semag/terrifried/resources/splash.ogg new file mode 100644 index 00000000..1212447d Binary files /dev/null and b/semag/terrifried/resources/splash.ogg differ diff --git a/semag/terrifried/resources/splash_egg.png b/semag/terrifried/resources/splash_egg.png new file mode 100644 index 00000000..2de15579 Binary files /dev/null and b/semag/terrifried/resources/splash_egg.png differ diff --git a/semag/terrifried/terrifried.iso b/semag/terrifried/terrifried.iso new file mode 100644 index 00000000..49a040ca Binary files /dev/null and b/semag/terrifried/terrifried.iso differ diff --git a/semag/terrifried/terrifriedds.7z b/semag/terrifried/terrifriedds.7z new file mode 100644 index 00000000..5596b1a1 Binary files /dev/null and b/semag/terrifried/terrifriedds.7z differ