The open source repository for the action RPG game in development by Sig Productions titled 'Adventures in Lestoria'!
https://forums.lestoria.net
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
206 KiB
1 lines
206 KiB
var Module=typeof Module!="undefined"?Module:{};if(!Module.expectedDataFileDownloads){Module.expectedDataFileDownloads=0}Module.expectedDataFileDownloads++;(function(){if(Module["ENVIRONMENT_IS_PTHREAD"]||Module["$ww"])return;var loadPackage=function(metadata){var PACKAGE_PATH="";if(typeof window==="object"){PACKAGE_PATH=window["encodeURIComponent"](window.location.pathname.toString().substring(0,window.location.pathname.toString().lastIndexOf("/"))+"/")}else if(typeof process==="undefined"&&typeof location!=="undefined"){PACKAGE_PATH=encodeURIComponent(location.pathname.toString().substring(0,location.pathname.toString().lastIndexOf("/"))+"/")}var PACKAGE_NAME="Adventures in Lestoria.data";var REMOTE_PACKAGE_BASE="Adventures in Lestoria.data";if(typeof Module["locateFilePackage"]==="function"&&!Module["locateFile"]){Module["locateFile"]=Module["locateFilePackage"];err("warning: you defined Module.locateFilePackage, that has been renamed to Module.locateFile (using your locateFilePackage for now)")}var REMOTE_PACKAGE_NAME=Module["locateFile"]?Module["locateFile"](REMOTE_PACKAGE_BASE,""):REMOTE_PACKAGE_BASE;var REMOTE_PACKAGE_SIZE=metadata["remote_package_size"];function fetchRemotePackage(packageName,packageSize,callback,errback){if(typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string"){require("fs").readFile(packageName,function(err,contents){if(err){errback(err)}else{callback(contents.buffer)}});return}var xhr=new XMLHttpRequest;xhr.open("GET",packageName,true);xhr.responseType="arraybuffer";xhr.onprogress=function(event){var url=packageName;var size=packageSize;if(event.total)size=event.total;if(event.loaded){if(!xhr.addedTotal){xhr.addedTotal=true;if(!Module.dataFileDownloads)Module.dataFileDownloads={};Module.dataFileDownloads[url]={loaded:event.loaded,total:size}}else{Module.dataFileDownloads[url].loaded=event.loaded}var total=0;var loaded=0;var num=0;for(var download in Module.dataFileDownloads){var data=Module.dataFileDownloads[download];total+=data.total;loaded+=data.loaded;num++}total=Math.ceil(total*Module.expectedDataFileDownloads/num);if(Module["setStatus"])Module["setStatus"](`Downloading data... (${loaded}/${total})`)}else if(!Module.dataFileDownloads){if(Module["setStatus"])Module["setStatus"]("Downloading data...")}};xhr.onerror=function(event){throw new Error("NetworkError for: "+packageName)};xhr.onload=function(event){if(xhr.status==200||xhr.status==304||xhr.status==206||xhr.status==0&&xhr.response){var packageData=xhr.response;callback(packageData)}else{throw new Error(xhr.statusText+" : "+xhr.responseURL)}};xhr.send(null)}function handleError(error){console.error("package error:",error)}var fetchedCallback=null;var fetched=Module["getPreloadedPackage"]?Module["getPreloadedPackage"](REMOTE_PACKAGE_NAME,REMOTE_PACKAGE_SIZE):null;if(!fetched)fetchRemotePackage(REMOTE_PACKAGE_NAME,REMOTE_PACKAGE_SIZE,function(data){if(fetchedCallback){fetchedCallback(data);fetchedCallback=null}else{fetched=data}},handleError);function runWithFS(){function assert(check,msg){if(!check)throw msg+(new Error).stack}Module["FS_createPath"]("/","assets",true,true);Module["FS_createPath"]("/assets","Ability Icons",true,true);Module["FS_createPath"]("/assets","Campaigns",true,true);Module["FS_createPath"]("/assets","backgrounds",true,true);Module["FS_createPath"]("/assets","characters",true,true);Module["FS_createPath"]("/assets","config",true,true);Module["FS_createPath"]("/assets/config","audio",true,true);Module["FS_createPath"]("/assets/config","classes",true,true);Module["FS_createPath"]("/assets/config","gfx",true,true);Module["FS_createPath"]("/assets/config","items",true,true);Module["FS_createPath"]("/assets/config","shops",true,true);Module["FS_createPath"]("/assets/config","story",true,true);Module["FS_createPath"]("/assets","items",true,true);Module["FS_createPath"]("/assets","maps",true,true);Module["FS_createPath"]("/assets","menus",true,true);Module["FS_createPath"]("/assets","monsters",true,true);Module["FS_createPath"]("/assets","music",true,true);Module["FS_createPath"]("/assets/music","loop1",true,true);Module["FS_createPath"]("/assets/music","loop2",true,true);Module["FS_createPath"]("/assets","sounds",true,true);Module["FS_createPath"]("/assets","themes",true,true);function DataRequest(start,end,audio){this.start=start;this.end=end;this.audio=audio}DataRequest.prototype={requests:{},open:function(mode,name){this.name=name;this.requests[name]=this;Module["addRunDependency"](`fp ${this.name}`)},send:function(){},onload:function(){var byteArray=this.byteArray.subarray(this.start,this.end);this.finish(byteArray)},finish:function(byteArray){var that=this;Module["FS_createDataFile"](this.name,null,byteArray,true,true,true);Module["removeRunDependency"](`fp ${that.name}`);this.requests[this.name]=null}};var files=metadata["files"];for(var i=0;i<files.length;++i){new DataRequest(files[i]["start"],files[i]["end"],files[i]["audio"]||0).open("GET",files[i]["filename"])}function processPackageData(arrayBuffer){assert(arrayBuffer,"Loading data file failed.");assert(arrayBuffer.constructor.name===ArrayBuffer.name,"bad input to processPackageData");var byteArray=new Uint8Array(arrayBuffer);DataRequest.prototype.byteArray=byteArray;var files=metadata["files"];for(var i=0;i<files.length;++i){DataRequest.prototype.requests[files[i].filename].onload()}Module["removeRunDependency"]("datafile_Adventures in Lestoria.data")}Module["addRunDependency"]("datafile_Adventures in Lestoria.data");if(!Module.preloadResults)Module.preloadResults={};Module.preloadResults[PACKAGE_NAME]={fromCache:false};if(fetched){processPackageData(fetched);fetched=null}else{fetchedCallback=processPackageData}}if(Module["calledRun"]){runWithFS()}else{if(!Module["preRun"])Module["preRun"]=[];Module["preRun"].push(runWithFS)}};loadPackage({"files":[{"filename":"/assets/Ability Icons/backstep.png","start":0,"end":4493},{"filename":"/assets/Ability Icons/battlecry.png","start":4493,"end":9260},{"filename":"/assets/Ability Icons/block.png","start":9260,"end":14001},{"filename":"/assets/Ability Icons/chargedshot.png","start":14001,"end":18624},{"filename":"/assets/Ability Icons/firebolt.png","start":18624,"end":23216},{"filename":"/assets/Ability Icons/groundslam.png","start":23216,"end":27775},{"filename":"/assets/Ability Icons/lightningbolt.png","start":27775,"end":32311},{"filename":"/assets/Ability Icons/meteor.png","start":32311,"end":36914},{"filename":"/assets/Ability Icons/multishot.png","start":36914,"end":41393},{"filename":"/assets/Ability Icons/rapidfire.png","start":41393,"end":45805},{"filename":"/assets/Ability Icons/sonicslash.png","start":45805,"end":50365},{"filename":"/assets/Ability Icons/teleport.png","start":50365,"end":54894},{"filename":"/assets/AiL_3_4.png","start":54894,"end":81459},{"filename":"/assets/AiL_512.ico","start":81459,"end":104122},{"filename":"/assets/AiL_512.png","start":104122,"end":129919},{"filename":"/assets/Campaigns/1_1.tmx","start":129919,"end":592886},{"filename":"/assets/Campaigns/1_1_test.tmx","start":592886,"end":671847},{"filename":"/assets/Campaigns/1_1_test2.tmx","start":671847,"end":872945},{"filename":"/assets/Campaigns/1_1_v2.tmx","start":872945,"end":1403251},{"filename":"/assets/Campaigns/1_2.tmx","start":1403251,"end":1671091},{"filename":"/assets/Campaigns/1_3.tmx","start":1671091,"end":1960094},{"filename":"/assets/Campaigns/1_4.tmx","start":1960094,"end":2161803},{"filename":"/assets/Campaigns/1_5.tmx","start":2161803,"end":2640139},{"filename":"/assets/Campaigns/1_6.tmx","start":2640139,"end":2968399},{"filename":"/assets/Campaigns/1_7.tmx","start":2968399,"end":3293888},{"filename":"/assets/Campaigns/1_8.tmx","start":3293888,"end":3541837},{"filename":"/assets/Campaigns/Boss_1.tmx","start":3541837,"end":3577823},{"filename":"/assets/Campaigns/Boss_1_v2.tmx","start":3577823,"end":3626070},{"filename":"/assets/Campaigns/Hub.tmx","start":3626070,"end":3763836},{"filename":"/assets/Campaigns/World_Map.png","start":3763836,"end":3870957},{"filename":"/assets/Campaigns/World_Map.tmx","start":3870957,"end":4269920},{"filename":"/assets/Habbo.ttf","start":4269920,"end":4280228},{"filename":"/assets/RetroMenu.png","start":4280228,"end":4282374},{"filename":"/assets/Unknown.ttf","start":4282374,"end":4296010},{"filename":"/assets/aiming_line.png","start":4296010,"end":4296601},{"filename":"/assets/aiming_target.png","start":4296601,"end":4308817},{"filename":"/assets/arrow.png","start":4308817,"end":4309487},{"filename":"/assets/backgrounds/cave.png","start":4309487,"end":4322349},{"filename":"/assets/backgrounds/cave_dark.png","start":4322349,"end":4324204},{"filename":"/assets/backgrounds/forest_backdrop.png","start":4324204,"end":4375005},{"filename":"/assets/backgrounds/rest.png","start":4375005,"end":4380507},{"filename":"/assets/backgrounds/sea.png","start":4380507,"end":4382047},{"filename":"/assets/battlecry_effect.png","start":4382047,"end":4385098},{"filename":"/assets/block.png","start":4385098,"end":4385766},{"filename":"/assets/c30010.png","start":4385766,"end":4492745},{"filename":"/assets/c64esque.ttf","start":4492745,"end":4527729},{"filename":"/assets/chain_lightning.png","start":4527729,"end":4528300},{"filename":"/assets/characters/Greg.png","start":4528300,"end":4532890},{"filename":"/assets/characters/Player_F.png","start":4532890,"end":4537484},{"filename":"/assets/characters/Player_M.png","start":4537484,"end":4542075},{"filename":"/assets/characters/Red Stone.png","start":4542075,"end":4543079},{"filename":"/assets/characters/Sherman.png","start":4543079,"end":4547667},{"filename":"/assets/charged_shot_arrow.png","start":4547667,"end":4555866},{"filename":"/assets/circle.png","start":4555866,"end":4556408},{"filename":"/assets/circle_outline.png","start":4556408,"end":4556945},{"filename":"/assets/config/MonsterStrategies.txt","start":4556945,"end":4562489},{"filename":"/assets/config/Monsters.txt","start":4562489,"end":4571273},{"filename":"/assets/config/Player.txt","start":4571273,"end":4574746},{"filename":"/assets/config/audio/audio.txt","start":4574746,"end":4574828},{"filename":"/assets/config/audio/bgm.txt","start":4574828,"end":4576815},{"filename":"/assets/config/audio/environmentalaudio.txt","start":4576815,"end":4577107},{"filename":"/assets/config/audio/events.txt","start":4577107,"end":4581814},{"filename":"/assets/config/classes/Ranger.txt","start":4581814,"end":4586324},{"filename":"/assets/config/classes/Thief.txt","start":4586324,"end":4588623},{"filename":"/assets/config/classes/Trapper.txt","start":4588623,"end":4590926},{"filename":"/assets/config/classes/Warrior.txt","start":4590926,"end":4595508},{"filename":"/assets/config/classes/Witch.txt","start":4595508,"end":4597807},{"filename":"/assets/config/classes/Wizard.txt","start":4597807,"end":4606665},{"filename":"/assets/config/configuration.txt","start":4606665,"end":4610441},{"filename":"/assets/config/gfx/backdrops.txt","start":4610441,"end":4610577},{"filename":"/assets/config/gfx/gfx.txt","start":4610577,"end":4613319},{"filename":"/assets/config/gfx/themes.txt","start":4613319,"end":4615211},{"filename":"/assets/config/items/Accessories.txt","start":4615211,"end":4615750},{"filename":"/assets/config/items/Equipment.txt","start":4615750,"end":4642045},{"filename":"/assets/config/items/ItemCategory.txt","start":4642045,"end":4642673},{"filename":"/assets/config/items/ItemDatabase.txt","start":4642673,"end":4646459},{"filename":"/assets/config/items/ItemScript.txt","start":4646459,"end":4647779},{"filename":"/assets/config/items/ItemSets.txt","start":4647779,"end":4649662},{"filename":"/assets/config/items/ItemStats.txt","start":4649662,"end":4650773},{"filename":"/assets/config/items/Weapons.txt","start":4650773,"end":4670873},{"filename":"/assets/config/items/items.txt","start":4670873,"end":4671989},{"filename":"/assets/config/levels.txt","start":4671989,"end":4672366},{"filename":"/assets/config/shops/Chapter 1 Merchants.txt","start":4672366,"end":4673421},{"filename":"/assets/config/shops/Chapter 2 Merchants.txt","start":4673421,"end":4673453},{"filename":"/assets/config/shops/Chapter 3 Merchants.txt","start":4673453,"end":4673485},{"filename":"/assets/config/shops/Chapter 4 Merchants.txt","start":4673485,"end":4673517},{"filename":"/assets/config/shops/Chapter 5 Merchants.txt","start":4673517,"end":4673549},{"filename":"/assets/config/shops/Chapter 6 Merchants.txt","start":4673549,"end":4673581},{"filename":"/assets/config/story/Chapter 1.txt","start":4673581,"end":4682226},{"filename":"/assets/config/story/Chapter 2.txt","start":4682226,"end":4682226},{"filename":"/assets/config/story/Chapter 3.txt","start":4682226,"end":4682226},{"filename":"/assets/config/story/Chapter 4.txt","start":4682226,"end":4682226},{"filename":"/assets/config/story/Chapter 5.txt","start":4682226,"end":4682226},{"filename":"/assets/config/story/Chapter 6.txt","start":4682226,"end":4682226},{"filename":"/assets/currency_coin.png","start":4682226,"end":4682995},{"filename":"/assets/discordAPI.txt","start":4682995,"end":4683079},{"filename":"/assets/energy_bolt.png","start":4683079,"end":4683815},{"filename":"/assets/energy_particle.png","start":4683815,"end":4684379},{"filename":"/assets/finishring.png","start":4684379,"end":4707624},{"filename":"/assets/finishring_green.png","start":4707624,"end":4730791},{"filename":"/assets/fire_ring0.png","start":4730791,"end":4731418},{"filename":"/assets/fire_ring1.png","start":4731418,"end":4732124},{"filename":"/assets/fire_ring2.png","start":4732124,"end":4732807},{"filename":"/assets/fire_ring3.png","start":4732807,"end":4733488},{"filename":"/assets/fire_ring4.png","start":4733488,"end":4734160},{"filename":"/assets/glomzy-05-1x.png","start":4734160,"end":4734371},{"filename":"/assets/ground-slam-attack-back.png","start":4734371,"end":4745133},{"filename":"/assets/ground-slam-attack-front.png","start":4745133,"end":4755525},{"filename":"/assets/heart.ico","start":4755525,"end":4862296},{"filename":"/assets/heart.png","start":4862296,"end":4862985},{"filename":"/assets/heart_512.png","start":4862985,"end":4869312},{"filename":"/assets/items/Bandages.png","start":4869312,"end":4870254},{"filename":"/assets/items/Bear Blood.png","start":4870254,"end":4874785},{"filename":"/assets/items/Bear Claw.png","start":4874785,"end":4875428},{"filename":"/assets/items/Berries.png","start":4875428,"end":4876253},{"filename":"/assets/items/Blue Slime Remains.png","start":4876253,"end":4876935},{"filename":"/assets/items/Bone Armor.png","start":4876935,"end":4881655},{"filename":"/assets/items/Bone Bow.png","start":4881655,"end":4882474},{"filename":"/assets/items/Bone Gloves.png","start":4882474,"end":4891398},{"filename":"/assets/items/Bone Helmet.png","start":4891398,"end":4898892},{"filename":"/assets/items/Bone Pants.png","start":4898892,"end":4906043},{"filename":"/assets/items/Bone Shoes.png","start":4906043,"end":4915276},{"filename":"/assets/items/Bone Staff.png","start":4915276,"end":4924590},{"filename":"/assets/items/Bone Sword.png","start":4924590,"end":4925395},{"filename":"/assets/items/Copper Armor.png","start":4925395,"end":4930326},{"filename":"/assets/items/Copper Gloves.png","start":4930326,"end":4939146},{"filename":"/assets/items/Copper Helmet.png","start":4939146,"end":4946817},{"filename":"/assets/items/Copper Pants.png","start":4946817,"end":4954550},{"filename":"/assets/items/Copper Shoes.png","start":4954550,"end":4963314},{"filename":"/assets/items/Dummy Item 1.png","start":4963314,"end":4963935},{"filename":"/assets/items/Dummy Item 10.png","start":4963935,"end":4964604},{"filename":"/assets/items/Dummy Item 11.png","start":4964604,"end":4965230},{"filename":"/assets/items/Dummy Item 12.png","start":4965230,"end":4965913},{"filename":"/assets/items/Dummy Item 13.png","start":4965913,"end":4966594},{"filename":"/assets/items/Dummy Item 14.png","start":4966594,"end":4967260},{"filename":"/assets/items/Dummy Item 15.png","start":4967260,"end":4967931},{"filename":"/assets/items/Dummy Item 16.png","start":4967931,"end":4968622},{"filename":"/assets/items/Dummy Item 17.png","start":4968622,"end":4969279},{"filename":"/assets/items/Dummy Item 18.png","start":4969279,"end":4969974},{"filename":"/assets/items/Dummy Item 19.png","start":4969974,"end":4970658},{"filename":"/assets/items/Dummy Item 2.png","start":4970658,"end":4971315},{"filename":"/assets/items/Dummy Item 20.png","start":4971315,"end":4972014},{"filename":"/assets/items/Dummy Item 3.png","start":4972014,"end":4972665},{"filename":"/assets/items/Dummy Item 4.png","start":4972665,"end":4973307},{"filename":"/assets/items/Dummy Item 5.png","start":4973307,"end":4973956},{"filename":"/assets/items/Dummy Item 6.png","start":4973956,"end":4974629},{"filename":"/assets/items/Dummy Item 7.png","start":4974629,"end":4975266},{"filename":"/assets/items/Dummy Item 8.png","start":4975266,"end":4975934},{"filename":"/assets/items/Dummy Item 9.png","start":4975934,"end":4976605},{"filename":"/assets/items/Elixir of Bear Strength.png","start":4976605,"end":4985681},{"filename":"/assets/items/Flower Petals.png","start":4985681,"end":4986418},{"filename":"/assets/items/Frog Skin.png","start":4986418,"end":4990853},{"filename":"/assets/items/Green Gemstone.png","start":4990853,"end":4991731},{"filename":"/assets/items/Green Slime Remains.png","start":4991731,"end":4992408},{"filename":"/assets/items/High-Quality Logs.png","start":4992408,"end":5003885},{"filename":"/assets/items/Large Health Potion.png","start":5003885,"end":5012298},{"filename":"/assets/items/Large Mana Potion.png","start":5012298,"end":5020717},{"filename":"/assets/items/Laser Sword.png","start":5020717,"end":5021510},{"filename":"/assets/items/Leather Armor.png","start":5021510,"end":5025989},{"filename":"/assets/items/Leather Gloves.png","start":5025989,"end":5026735},{"filename":"/assets/items/Leather Helmet.png","start":5026735,"end":5027402},{"filename":"/assets/items/Leather Pants.png","start":5027402,"end":5028112},{"filename":"/assets/items/Leather Shoes.png","start":5028112,"end":5028826},{"filename":"/assets/items/Logs.png","start":5028826,"end":5029685},{"filename":"/assets/items/Medium Health Potion.png","start":5029685,"end":5030506},{"filename":"/assets/items/Medium Mana Potion.png","start":5030506,"end":5038816},{"filename":"/assets/items/Minor Health Potion.png","start":5038816,"end":5039605},{"filename":"/assets/items/Minor Mana Potion.png","start":5039605,"end":5040403},{"filename":"/assets/items/Minor Recovery Potion.png","start":5040403,"end":5048096},{"filename":"/assets/items/Pile of Coins.png","start":5048096,"end":5048941},{"filename":"/assets/items/Plasma Bow.png","start":5048941,"end":5049778},{"filename":"/assets/items/Red Slime Remains.png","start":5049778,"end":5050465},{"filename":"/assets/items/Ring of the Bear.png","start":5050465,"end":5051273},{"filename":"/assets/items/Ring of the Slime King.png","start":5051273,"end":5052104},{"filename":"/assets/items/Ring.png","start":5052104,"end":5052834},{"filename":"/assets/items/Shell Armor.png","start":5052834,"end":5057540},{"filename":"/assets/items/Shell Bow.png","start":5057540,"end":5058388},{"filename":"/assets/items/Shell Gloves.png","start":5058388,"end":5066843},{"filename":"/assets/items/Shell Helmet.png","start":5066843,"end":5074560},{"filename":"/assets/items/Shell Pants.png","start":5074560,"end":5082018},{"filename":"/assets/items/Shell Shoes.png","start":5082018,"end":5091514},{"filename":"/assets/items/Shell Staff.png","start":5091514,"end":5100325},{"filename":"/assets/items/Shell Sword.png","start":5100325,"end":5101129},{"filename":"/assets/items/Steel Bow.png","start":5101129,"end":5101927},{"filename":"/assets/items/Steel Staff.png","start":5101927,"end":5102703},{"filename":"/assets/items/Steel Sword.png","start":5102703,"end":5103501},{"filename":"/assets/items/Unknown Staff.png","start":5103501,"end":5112975},{"filename":"/assets/items/Wolf Skin.png","start":5112975,"end":5113844},{"filename":"/assets/items/Wooden Bow.png","start":5113844,"end":5114703},{"filename":"/assets/items/Wooden Staff.png","start":5114703,"end":5115581},{"filename":"/assets/items/Wooden Sword.png","start":5115581,"end":5116373},{"filename":"/assets/items/Yellow Slime Remains.png","start":5116373,"end":5117074},{"filename":"/assets/kiwami64-v1-1x.png","start":5117074,"end":5117429},{"filename":"/assets/knight_full.png","start":5117429,"end":5123704},{"filename":"/assets/knight_full2.png","start":5123704,"end":5129941},{"filename":"/assets/knight_full3.png","start":5129941,"end":5136392},{"filename":"/assets/knight_full_render1.png","start":5136392,"end":5143263},{"filename":"/assets/laser.png","start":5143263,"end":5143845},{"filename":"/assets/lightning_bolt.png","start":5143845,"end":5153958},{"filename":"/assets/lightning_bolt_part1.png","start":5153958,"end":5154505},{"filename":"/assets/lightning_bolt_part2.png","start":5154505,"end":5155047},{"filename":"/assets/lightning_bolt_part3.png","start":5155047,"end":5155584},{"filename":"/assets/lightning_bolt_part4.png","start":5155584,"end":5156123},{"filename":"/assets/lightning_splash_effect.png","start":5156123,"end":5166648},{"filename":"/assets/mana.png","start":5166648,"end":5167345},{"filename":"/assets/maps/24x24_Waterfall.tsx","start":5167345,"end":5171253},{"filename":"/assets/maps/Decorations_c1_No_Shadow24x24.tsx","start":5171253,"end":5230751},{"filename":"/assets/maps/End_of_Map.tmx","start":5230751,"end":5253868},{"filename":"/assets/maps/End_of_Map.tsx","start":5253868,"end":5295939},{"filename":"/assets/maps/Forge_No_Shadow_24x24.tsx","start":5295939,"end":5297721},{"filename":"/assets/maps/Minifantasy_TinyOverworldAllProps.tsx","start":5297721,"end":5298017},{"filename":"/assets/maps/Minifantasy_TinyOverworldAllTiles.tsx","start":5298017,"end":5298330},{"filename":"/assets/maps/Minifantasy_TinyOverworldConstructions.tsx","start":5298330,"end":5298637},{"filename":"/assets/maps/No_Shadow_Campfire_24x24.tsx","start":5298637,"end":5301859},{"filename":"/assets/maps/Stage_Plate.png","start":5301859,"end":5302969},{"filename":"/assets/maps/Stage_Plate.tsx","start":5302969,"end":5303201},{"filename":"/assets/maps/Tile_Presets.tmx","start":5303201,"end":5540790},{"filename":"/assets/maps/Tilesheet_No_Shadow24x24.tsx","start":5540790,"end":5671857},{"filename":"/assets/maps/grid_Props_No_Shadow_24x24.tsx","start":5671857,"end":5672152},{"filename":"/assets/menus/Character_Info.png","start":5672152,"end":5698043},{"filename":"/assets/meteor.png","start":5698043,"end":5712071},{"filename":"/assets/meteor.xcf","start":5712071,"end":5753129},{"filename":"/assets/money.png","start":5753129,"end":5753939},{"filename":"/assets/monsters/Bear.png","start":5753939,"end":5767789},{"filename":"/assets/monsters/Blue Slime.png","start":5767789,"end":5773923},{"filename":"/assets/monsters/Flower Turret.png","start":5773923,"end":5784776},{"filename":"/assets/monsters/Flower Turret.xcf","start":5784776,"end":5802857},{"filename":"/assets/monsters/Frog.png","start":5802857,"end":5809316},{"filename":"/assets/monsters/Green Slime.png","start":5809316,"end":5815579},{"filename":"/assets/monsters/Red Slime.png","start":5815579,"end":5821996},{"filename":"/assets/monsters/Slime King.png","start":5821996,"end":5841865},{"filename":"/assets/monsters/Slime King.xcf","start":5841865,"end":5861614},{"filename":"/assets/monsters/Wolf.png","start":5861614,"end":5867579},{"filename":"/assets/monsters/Yellow Slime.png","start":5867579,"end":5873991},{"filename":"/assets/music/foresty1_1_bass.ogg","start":5873991,"end":7624507,"audio":1},{"filename":"/assets/music/foresty1_1_crash.ogg","start":7624507,"end":9055487,"audio":1},{"filename":"/assets/music/foresty1_1_drums.ogg","start":9055487,"end":11005026,"audio":1},{"filename":"/assets/music/foresty1_1_flute.ogg","start":11005026,"end":13992462,"audio":1},{"filename":"/assets/music/foresty1_1_piano 1.ogg","start":13992462,"end":16585932,"audio":1},{"filename":"/assets/music/foresty1_1_piano 2.ogg","start":16585932,"end":18514304,"audio":1},{"filename":"/assets/music/foresty1_1_pizzicato.ogg","start":18514304,"end":18858012,"audio":1},{"filename":"/assets/music/foresty1_1_staccato.ogg","start":18858012,"end":20668004,"audio":1},{"filename":"/assets/music/foresty1_1_strings.ogg","start":20668004,"end":24376514,"audio":1},{"filename":"/assets/music/foresty1_1_xtra perc.ogg","start":24376514,"end":24988435,"audio":1},{"filename":"/assets/music/foresty_boss.ogg","start":24988435,"end":27374571,"audio":1},{"filename":"/assets/music/loop1/foresty1_1_loop1_bass.ogg","start":27374571,"end":27820846,"audio":1},{"filename":"/assets/music/loop1/foresty1_1_loop1_drums.ogg","start":27820846,"end":28428512,"audio":1},{"filename":"/assets/music/loop1/foresty1_1_loop1_flute.ogg","start":28428512,"end":29376723,"audio":1},{"filename":"/assets/music/loop1/foresty1_1_loop1_piano 1.ogg","start":29376723,"end":29866202,"audio":1},{"filename":"/assets/music/loop1/foresty1_1_loop1_piano 2.ogg","start":29866202,"end":30223390,"audio":1},{"filename":"/assets/music/loop1/foresty1_1_loop1_strings.ogg","start":30223390,"end":31142926,"audio":1},{"filename":"/assets/music/loop1/foresty1_1_loop1_xtra perc.ogg","start":31142926,"end":31578136,"audio":1},{"filename":"/assets/music/loop2/foresty1_1_loop2_bass.ogg","start":31578136,"end":31824128,"audio":1},{"filename":"/assets/music/loop2/foresty1_1_loop2_drums.ogg","start":31824128,"end":32163862,"audio":1},{"filename":"/assets/music/loop2/foresty1_1_loop2_piano 1.ogg","start":32163862,"end":32407154,"audio":1},{"filename":"/assets/music/loop2/foresty1_1_loop2_piano 2.ogg","start":32407154,"end":32581148,"audio":1},{"filename":"/assets/music/loop2/foresty1_1_loop2_staccato.ogg","start":32581148,"end":33036258,"audio":1},{"filename":"/assets/music/loop2/foresty1_1_loop2_strings.ogg","start":33036258,"end":33508110,"audio":1},{"filename":"/assets/music/overworld.ogg","start":33508110,"end":35295928,"audio":1},{"filename":"/assets/nico-Ranger_512.png","start":35295928,"end":35299316},{"filename":"/assets/nico-Thief_512.png","start":35299316,"end":35302315},{"filename":"/assets/nico-Trapper_512.png","start":35302315,"end":35305314},{"filename":"/assets/nico-Warrior_512.png","start":35305314,"end":35308313},{"filename":"/assets/nico-Witch_512.png","start":35308313,"end":35311312},{"filename":"/assets/nico-Wizard_512.png","start":35311312,"end":35318181},{"filename":"/assets/nico-ranger.png","start":35318181,"end":35337460},{"filename":"/assets/nico-ranger.xcf","start":35337460,"end":35352741},{"filename":"/assets/nico-ranger2.xcf","start":35352741,"end":35377038},{"filename":"/assets/nico-warrior.png","start":35377038,"end":35398524},{"filename":"/assets/nico-warrior.xcf","start":35398524,"end":35431261},{"filename":"/assets/nico-wizard.png","start":35431261,"end":35449519},{"filename":"/assets/nico-wizard.xcf","start":35449519,"end":35478928},{"filename":"/assets/palette.css","start":35478928,"end":35481412},{"filename":"/assets/palette.txt","start":35481412,"end":35481923},{"filename":"/assets/pixel.png","start":35481923,"end":35482469},{"filename":"/assets/propertytypes.xml","start":35482469,"end":35483716},{"filename":"/assets/range_indicator.png","start":35483716,"end":35492751},{"filename":"/assets/skill_overlay_icon.png","start":35492751,"end":35493578},{"filename":"/assets/skill_overlay_icon_overlay.png","start":35493578,"end":35501364},{"filename":"/assets/slime.png","start":35501364,"end":35514785},{"filename":"/assets/sonicslash.png","start":35514785,"end":35516107},{"filename":"/assets/sounds/bear_slam.ogg","start":35516107,"end":35523879,"audio":1},{"filename":"/assets/sounds/birds1.ogg","start":35523879,"end":35571023,"audio":1},{"filename":"/assets/sounds/birds2.ogg","start":35571023,"end":35601835,"audio":1},{"filename":"/assets/sounds/birds3.ogg","start":35601835,"end":35625977,"audio":1},{"filename":"/assets/sounds/birds4.ogg","start":35625977,"end":35668729,"audio":1},{"filename":"/assets/sounds/consume_item.ogg","start":35668729,"end":35703600,"audio":1},{"filename":"/assets/sounds/consume_potion.ogg","start":35703600,"end":35734271,"audio":1},{"filename":"/assets/sounds/equip.ogg","start":35734271,"end":35753024,"audio":1},{"filename":"/assets/sounds/equip2.ogg","start":35753024,"end":35771192,"audio":1},{"filename":"/assets/sounds/equip_ring.ogg","start":35771192,"end":35779324,"audio":1},{"filename":"/assets/sounds/footsteps.ogg","start":35779324,"end":35787574,"audio":1},{"filename":"/assets/sounds/footsteps_wet.ogg","start":35787574,"end":35795653,"audio":1},{"filename":"/assets/sounds/item_buy.ogg","start":35795653,"end":35809230,"audio":1},{"filename":"/assets/sounds/item_collect.ogg","start":35809230,"end":35822492,"audio":1},{"filename":"/assets/sounds/item_craft.ogg","start":35822492,"end":35859350,"audio":1},{"filename":"/assets/sounds/item_enhance.ogg","start":35859350,"end":35876162,"audio":1},{"filename":"/assets/sounds/item_sell.ogg","start":35876162,"end":35888888,"audio":1},{"filename":"/assets/sounds/monster_hurt.ogg","start":35888888,"end":35905777,"audio":1},{"filename":"/assets/sounds/player_hit1.ogg","start":35905777,"end":35915518,"audio":1},{"filename":"/assets/sounds/player_hit2.ogg","start":35915518,"end":35929032,"audio":1},{"filename":"/assets/sounds/ranger_auto1.ogg","start":35929032,"end":35945961,"audio":1},{"filename":"/assets/sounds/ranger_auto2.ogg","start":35945961,"end":35965665,"audio":1},{"filename":"/assets/sounds/ranger_backstep.ogg","start":35965665,"end":35979323,"audio":1},{"filename":"/assets/sounds/ranger_charged_shot.ogg","start":35979323,"end":35990321,"audio":1},{"filename":"/assets/sounds/ranger_multishot.ogg","start":35990321,"end":36032067,"audio":1},{"filename":"/assets/sounds/ranger_rapid_fire.ogg","start":36032067,"end":36044336,"audio":1},{"filename":"/assets/sounds/sfx100v2_loop_water_01.ogg","start":36044336,"end":36124297,"audio":1},{"filename":"/assets/sounds/slime_dead.ogg","start":36124297,"end":36143412,"audio":1},{"filename":"/assets/sounds/slime_dead2.ogg","start":36143412,"end":36172025,"audio":1},{"filename":"/assets/sounds/slime_king_landing.ogg","start":36172025,"end":36195229,"audio":1},{"filename":"/assets/sounds/slime_king_shoot.ogg","start":36195229,"end":36230931,"audio":1},{"filename":"/assets/sounds/slime_shoot.ogg","start":36230931,"end":36252477,"audio":1},{"filename":"/assets/sounds/slime_shoot2.ogg","start":36252477,"end":36266121,"audio":1},{"filename":"/assets/sounds/slime_walk.ogg","start":36266121,"end":36290228,"audio":1},{"filename":"/assets/sounds/slime_walk2.ogg","start":36290228,"end":36317552,"audio":1},{"filename":"/assets/sounds/slime_walk3.ogg","start":36317552,"end":36331196,"audio":1},{"filename":"/assets/sounds/spell_cast.ogg","start":36331196,"end":36355684,"audio":1},{"filename":"/assets/sounds/warrior_auto1.ogg","start":36355684,"end":36362475,"audio":1},{"filename":"/assets/sounds/warrior_battlecry.ogg","start":36362475,"end":36374674,"audio":1},{"filename":"/assets/sounds/warrior_blockhit1.ogg","start":36374674,"end":36383126,"audio":1},{"filename":"/assets/sounds/warrior_blockhit2.ogg","start":36383126,"end":36402977,"audio":1},{"filename":"/assets/sounds/warrior_groundslam.ogg","start":36402977,"end":36416954,"audio":1},{"filename":"/assets/sounds/warrior_sonicslash.ogg","start":36416954,"end":36444512,"audio":1},{"filename":"/assets/sounds/wizard_auto1.ogg","start":36444512,"end":36483994,"audio":1},{"filename":"/assets/sounds/wizard_auto2.ogg","start":36483994,"end":36517109,"audio":1},{"filename":"/assets/sounds/wizard_firebolt.ogg","start":36517109,"end":36570183,"audio":1},{"filename":"/assets/sounds/wizard_firebolt_hit.ogg","start":36570183,"end":36581672,"audio":1},{"filename":"/assets/sounds/wizard_lightningbolt.ogg","start":36581672,"end":36590751,"audio":1},{"filename":"/assets/sounds/wizard_meteor.ogg","start":36590751,"end":36636414,"audio":1},{"filename":"/assets/sounds/wizard_meteor_lingering.ogg","start":36636414,"end":36676018,"audio":1},{"filename":"/assets/sounds/wizard_teleport.ogg","start":36676018,"end":36680895,"audio":1},{"filename":"/assets/splash_effect.png","start":36680895,"end":36681970},{"filename":"/assets/square_skill_overlay_icon.png","start":36681970,"end":36686472},{"filename":"/assets/square_skill_overlay_icon_empty.png","start":36686472,"end":36691118},{"filename":"/assets/themes/9patch.png","start":36691118,"end":36691736},{"filename":"/assets/themes/9patch_2.png","start":36691736,"end":36696168},{"filename":"/assets/themes/9patch_3.png","start":36696168,"end":36701105},{"filename":"/assets/themes/9patch_4.png","start":36701105,"end":36706042},{"filename":"/assets/themes/testback.png","start":36706042,"end":36947678},{"filename":"/assets/themes/testtiledback.png","start":36947678,"end":36948298},{"filename":"/assets/title_back.png","start":36948298,"end":36953353},{"filename":"/assets/title_full.png","start":36953353,"end":36962200},{"filename":"/assets/title_icon.ico","start":36962200,"end":36966486},{"filename":"/assets/title_icon.png","start":36966486,"end":36980947},{"filename":"/assets/title_icon.xcf","start":36980947,"end":37062115},{"filename":"/assets/title_icon_32.png","start":37062115,"end":37063519},{"filename":"/assets/title_transparent.png","start":37063519,"end":37081105},{"filename":"/assets/title_transparent.xcf","start":37081105,"end":37182550},{"filename":"/assets/tongue.png","start":37182550,"end":37186730},{"filename":"/assets/tongue_end.png","start":37186730,"end":37190944},{"filename":"/assets/unknown_full_render.png","start":37190944,"end":37192118},{"filename":"/assets/wizard_full.png","start":37192118,"end":37196826},{"filename":"/assets/wizard_full_render.png","start":37196826,"end":37201522},{"filename":"/assets/wizard_full_render.xcf","start":37201522,"end":37221071}],"remote_package_size":37221071})})();var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("fs");var nodePath=require("path");if(ENVIRONMENT_IS_WORKER){scriptDirectory=nodePath.dirname(scriptDirectory)+"/"}else{scriptDirectory=__dirname+"/"}read_=(filename,binary)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);return fs.readFileSync(filename,binary?undefined:"utf8")};readBinary=filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}return ret};readAsync=(filename,onload,onerror,binary=true)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);fs.readFile(filename,binary?undefined:"utf8",(err,data)=>{if(err)onerror(err);else onload(binary?data.buffer:data)})};if(!Module["thisProgram"]&&process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);if(typeof module!="undefined"){module["exports"]=Module}process.on("uncaughtException",ex=>{if(ex!=="unwind"&&!(ex instanceof ExitStatus)&&!(ex.context instanceof ExitStatus)){throw ex}});quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow};Module["inspect"]=()=>"[Emscripten Module object]"}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.error.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];if(typeof WebAssembly!="object"){abort("no native wasm support detected")}function intArrayFromBase64(s){if(typeof ENVIRONMENT_IS_NODE!="undefined"&&ENVIRONMENT_IS_NODE){var buf=Buffer.from(s,"base64");return new Uint8Array(buf.buffer,buf.byteOffset,buf.length)}var decoded=atob(s);var bytes=new Uint8Array(decoded.length);for(var i=0;i<decoded.length;++i){bytes[i]=decoded.charCodeAt(i)}return bytes}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(text)}}var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=HEAP8=new Int8Array(b);Module["HEAP16"]=HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAPU16"]=HEAPU16=new Uint16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);Module["HEAPF64"]=HEAPF64=new Float64Array(b)}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATEXIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;if(!Module["noFSInit"]&&!FS.init.initialized)FS.init();FS.ignorePermissions=false;TTY.init();callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function getUniqueRunDependency(id){return id}function addRunDependency(id){runDependencies++;Module["monitorRunDependencies"]?.(runDependencies)}function removeRunDependency(id){runDependencies--;Module["monitorRunDependencies"]?.(runDependencies);if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){Module["onAbort"]?.(what);what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);throw e}var dataURIPrefix="data:application/octet-stream;base64,";var isDataURI=filename=>filename.startsWith(dataURIPrefix);var isFileURI=filename=>filename.startsWith("file://");var wasmBinaryFile;wasmBinaryFile="Adventures in Lestoria.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}function getBinaryPromise(binaryFile){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"&&!isFileURI(binaryFile)){return fetch(binaryFile,{credentials:"same-origin"}).then(response=>{if(!response["ok"]){throw"failed to load wasm binary file at '"+binaryFile+"'"}return response["arrayBuffer"]()}).catch(()=>getBinarySync(binaryFile))}else if(readAsync){return new Promise((resolve,reject)=>{readAsync(binaryFile,response=>resolve(new Uint8Array(response)),reject)})}}return Promise.resolve().then(()=>getBinarySync(binaryFile))}function instantiateArrayBuffer(binaryFile,imports,receiver){return getBinaryPromise(binaryFile).then(binary=>WebAssembly.instantiate(binary,imports)).then(instance=>instance).then(receiver,reason=>{err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)})}function instantiateAsync(binary,binaryFile,imports,callback){if(!binary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(binaryFile)&&!isFileURI(binaryFile)&&!ENVIRONMENT_IS_NODE&&typeof fetch=="function"){return fetch(binaryFile,{credentials:"same-origin"}).then(response=>{var result=WebAssembly.instantiateStreaming(response,imports);return result.then(callback,function(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(binaryFile,imports,callback)})})}return instantiateArrayBuffer(binaryFile,imports,callback)}function createWasm(){var info={"env":wasmImports,"wasi_snapshot_preview1":wasmImports};function receiveInstance(instance,module){wasmExports=instance.exports;wasmExports=applySignatureConversions(wasmExports);wasmMemory=wasmExports["memory"];updateMemoryViews();wasmTable=wasmExports["__indirect_function_table"];addOnInit(wasmExports["__wasm_call_ctors"]);removeRunDependency("wasm-instantiate");return wasmExports}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}if(Module["instantiateWasm"]){try{return Module["instantiateWasm"](info,receiveInstance)}catch(e){err(`Module.instantiateWasm callback failed with error: ${e}`);return false}}instantiateAsync(wasmBinary,wasmBinaryFile,info,receiveInstantiationResult);return{}}var tempDouble;var tempI64;var ASM_CONSTS={392596:()=>{if(requestResp&&requestResp!==""){var newPtr=stringToNewUTF8(requestResp);requestResp="";return newPtr}return 0},392719:($0,$1,$2,$3,$4)=>{if(typeof window==="undefined"||(window.AudioContext||window.webkitAudioContext)===undefined){return 0}if(typeof window.miniaudio==="undefined"){window.miniaudio={referenceCount:0};window.miniaudio.device_type={};window.miniaudio.device_type.playback=$0;window.miniaudio.device_type.capture=$1;window.miniaudio.device_type.duplex=$2;window.miniaudio.device_state={};window.miniaudio.device_state.stopped=$3;window.miniaudio.device_state.started=$4;miniaudio.devices=[];miniaudio.track_device=function(device){for(var iDevice=0;iDevice<miniaudio.devices.length;++iDevice){if(miniaudio.devices[iDevice]==null){miniaudio.devices[iDevice]=device;return iDevice}}miniaudio.devices.push(device);return miniaudio.devices.length-1};miniaudio.untrack_device_by_index=function(deviceIndex){miniaudio.devices[deviceIndex]=null;while(miniaudio.devices.length>0){if(miniaudio.devices[miniaudio.devices.length-1]==null){miniaudio.devices.pop()}else{break}}};miniaudio.untrack_device=function(device){for(var iDevice=0;iDevice<miniaudio.devices.length;++iDevice){if(miniaudio.devices[iDevice]==device){return miniaudio.untrack_device_by_index(iDevice)}}};miniaudio.get_device_by_index=function(deviceIndex){return miniaudio.devices[deviceIndex]};miniaudio.unlock_event_types=function(){return["touchstart","touchend","click"]}();miniaudio.unlock=function(){for(var i=0;i<miniaudio.devices.length;++i){var device=miniaudio.devices[i];if(device!=null&&device.webaudio!=null&&device.state===2){device.webaudio.resume()}}miniaudio.unlock_event_types.map(function(event_type){document.removeEventListener(event_type,miniaudio.unlock,true)})};miniaudio.unlock_event_types.map(function(event_type){document.addEventListener(event_type,miniaudio.unlock,true)})}window.miniaudio.referenceCount+=1;return 1},394709:()=>{if(typeof window.miniaudio!=="undefined"){window.miniaudio.referenceCount-=1;if(window.miniaudio.referenceCount===0){delete window.miniaudio}}},394873:()=>navigator.mediaDevices!==undefined&&navigator.mediaDevices.getUserMedia!==undefined,394977:()=>{try{var temp=new(window.AudioContext||window.webkitAudioContext);var sampleRate=temp.sampleRate;temp.close();return sampleRate}catch(e){return 0}},395148:($0,$1,$2,$3,$4,$5)=>{var deviceType=$0;var channels=$1;var sampleRate=$2;var bufferSize=$3;var pIntermediaryBuffer=$4;var pDevice=$5;if(typeof window.miniaudio==="undefined"){return-1}var device={};var audioContextOptions={};if(deviceType==window.miniaudio.device_type.playback){audioContextOptions.sampleRate=sampleRate}device.webaudio=new(window.AudioContext||window.webkitAudioContext)(audioContextOptions);device.webaudio.suspend();device.state=window.miniaudio.device_state.stopped;var channelCountIn=0;var channelCountOut=channels;if(deviceType!=window.miniaudio.device_type.playback){channelCountIn=channels}device.scriptNode=device.webaudio.createScriptProcessor(bufferSize,channelCountIn,channelCountOut);device.scriptNode.onaudioprocess=function(e){if(device.intermediaryBufferView==null||device.intermediaryBufferView.length==0){device.intermediaryBufferView=new Float32Array(Module.HEAPF32.buffer,pIntermediaryBuffer,bufferSize*channels)}if(deviceType==miniaudio.device_type.capture||deviceType==miniaudio.device_type.duplex){for(var iChannel=0;iChannel<channels;iChannel+=1){var inputBuffer=e.inputBuffer.getChannelData(iChannel);var intermediaryBuffer=device.intermediaryBufferView;for(var iFrame=0;iFrame<bufferSize;iFrame+=1){intermediaryBuffer[iFrame*channels+iChannel]=inputBuffer[iFrame]}}_ma_device_process_pcm_frames_capture__webaudio(pDevice,bufferSize,pIntermediaryBuffer)}if(deviceType==miniaudio.device_type.playback||deviceType==miniaudio.device_type.duplex){_ma_device_process_pcm_frames_playback__webaudio(pDevice,bufferSize,pIntermediaryBuffer);for(var iChannel=0;iChannel<e.outputBuffer.numberOfChannels;++iChannel){var outputBuffer=e.outputBuffer.getChannelData(iChannel);var intermediaryBuffer=device.intermediaryBufferView;for(var iFrame=0;iFrame<bufferSize;iFrame+=1){outputBuffer[iFrame]=intermediaryBuffer[iFrame*channels+iChannel]}}}else{for(var iChannel=0;iChannel<e.outputBuffer.numberOfChannels;++iChannel){e.outputBuffer.getChannelData(iChannel).fill(0)}}};if(deviceType==miniaudio.device_type.capture||deviceType==miniaudio.device_type.duplex){navigator.mediaDevices.getUserMedia({audio:true,video:false}).then(function(stream){device.streamNode=device.webaudio.createMediaStreamSource(stream);device.streamNode.connect(device.scriptNode);device.scriptNode.connect(device.webaudio.destination)}).catch(function(error){console.log("Failed to get user media: "+error)})}if(deviceType==miniaudio.device_type.playback){device.scriptNode.connect(device.webaudio.destination)}return miniaudio.track_device(device)},397931:$0=>miniaudio.get_device_by_index($0).webaudio.sampleRate,397997:$0=>{var device=miniaudio.get_device_by_index($0);if(device.scriptNode!==undefined){device.scriptNode.onaudioprocess=function(e){};device.scriptNode.disconnect();device.scriptNode=undefined}if(device.streamNode!==undefined){device.streamNode.disconnect();device.streamNode=undefined}device.webaudio.close();device.webaudio=undefined},398362:$0=>{miniaudio.untrack_device_by_index($0)},398405:$0=>{var device=miniaudio.get_device_by_index($0);device.webaudio.resume();device.state=miniaudio.device_state.started},398530:$0=>{var device=miniaudio.get_device_by_index($0);device.webaudio.suspend();device.state=miniaudio.device_state.stopped},398656:()=>{window.onunload=Module._olc_OnPageUnload},398700:($0,$1)=>{requestResp="";Module.olc_AspectRatio=$0/$1;Module.olc_AssumeDefaultShells=document.querySelectorAll(".emscripten").length>=3?true:false;oncontextmenu=function(e){return false};var olc_ResizeHandler=function(){let isFullscreen=document.fullscreenElement!=null;let width=isFullscreen?window.innerWidth:Module.canvas.parentNode.clientWidth;let height=isFullscreen?window.innerHeight:Module.canvas.parentNode.clientHeight;let viewWidth=width;let viewHeight=width/Module.olc_AspectRatio;if(viewHeight>height){viewWidth=height*Module.olc_AspectRatio;viewHeight=height}viewWidth=parseInt(viewWidth);viewHeight=parseInt(viewHeight);setTimeout(function(){if(Module.olc_AssumeDefaultShells)Module.canvas.parentNode.setAttribute("style","width: 100%; height: 70vh; margin-left: auto; margin-right: auto;");Module.canvas.setAttribute("width",viewWidth);Module.canvas.setAttribute("height",viewHeight);Module.canvas.setAttribute("style",`width: ${viewWidth}px; height: ${viewHeight}px;`);Module._olc_PGE_UpdateWindowSize(viewWidth,viewHeight);Module.canvas.focus()},200)};var olc_Init=function(){if(Module.olc_AspectRatio===undefined){setTimeout(function(){Module.olc_Init()},50);return}let resizeObserver=new ResizeObserver(function(entries){Module.olc_ResizeHandler()}).observe(Module.canvas.parentNode);let mutationObserver=new MutationObserver(function(mutationsList,observer){setTimeout(function(){Module.olc_ResizeHandler()},200)}).observe(Module.canvas.parentNode,{attributes:false,childList:true,subtree:false});window.addEventListener("fullscreenchange",function(e){setTimeout(function(){Module.olc_ResizeHandler()},200)})};Module.olc_ResizeHandler=Module.olc_ResizeHandler!=undefined?Module.olc_ResizeHandler:olc_ResizeHandler;Module.olc_Init=Module.olc_Init!=undefined?Module.olc_Init:olc_Init;Module.olc_Init()},400689:()=>window.scrollX,400713:()=>window.scrollY,400737:()=>window.scrollX,400761:()=>window.scrollY,400785:()=>window.scrollX,400809:()=>window.scrollY,400833:()=>Module.canvas.getBoundingClientRect().left,400885:()=>Module.canvas.getBoundingClientRect().top,400936:()=>Module.canvas.getBoundingClientRect().left,400988:()=>Module.canvas.getBoundingClientRect().top,401039:($0,$1)=>{requestResp="";fetch(UTF8ToString($0),{headers:{"Content-Type":"application/json"},method:"POST",body:UTF8ToString($1)}).then(resp=>{if(resp.ok){return resp.text()}else{throw new Error(resp.text())}}).then(data=>{requestResp=data}).catch(err=>{requestResp="ERR"})}};var _emscripten_set_main_loop_timing=(mode,value)=>{Browser.mainLoop.timingMode=mode;Browser.mainLoop.timingValue=value;if(!Browser.mainLoop.func){return 1}if(!Browser.mainLoop.running){Browser.mainLoop.running=true}if(mode==0){Browser.mainLoop.scheduler=function Browser_mainLoop_scheduler_setTimeout(){var timeUntilNextTick=Math.max(0,Browser.mainLoop.tickStartTime+value-_emscripten_get_now())|0;setTimeout(Browser.mainLoop.runner,timeUntilNextTick)};Browser.mainLoop.method="timeout"}else if(mode==1){Browser.mainLoop.scheduler=function Browser_mainLoop_scheduler_rAF(){Browser.requestAnimationFrame(Browser.mainLoop.runner)};Browser.mainLoop.method="rAF"}else if(mode==2){if(typeof Browser.setImmediate=="undefined"){if(typeof setImmediate=="undefined"){var setImmediates=[];var emscriptenMainLoopMessageId="setimmediate";var Browser_setImmediate_messageHandler=event=>{if(event.data===emscriptenMainLoopMessageId||event.data.target===emscriptenMainLoopMessageId){event.stopPropagation();setImmediates.shift()()}};addEventListener("message",Browser_setImmediate_messageHandler,true);Browser.setImmediate=function Browser_emulated_setImmediate(func){setImmediates.push(func);if(ENVIRONMENT_IS_WORKER){if(Module["setImmediates"]===undefined)Module["setImmediates"]=[];Module["setImmediates"].push(func);postMessage({target:emscriptenMainLoopMessageId})}else postMessage(emscriptenMainLoopMessageId,"*")}}else{Browser.setImmediate=setImmediate}}Browser.mainLoop.scheduler=function Browser_mainLoop_scheduler_setImmediate(){Browser.setImmediate(Browser.mainLoop.runner)};Browser.mainLoop.method="immediate"}return 0};var _emscripten_get_now;_emscripten_get_now=()=>performance.now();var setMainLoop=(browserIterationFunc,fps,simulateInfiniteLoop,arg,noSetTiming)=>{assert(!Browser.mainLoop.func,"emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.");Browser.mainLoop.func=browserIterationFunc;Browser.mainLoop.arg=arg;var thisMainLoopId=Browser.mainLoop.currentlyRunningMainloop;function checkIsRunning(){if(thisMainLoopId<Browser.mainLoop.currentlyRunningMainloop){return false}return true}Browser.mainLoop.running=false;Browser.mainLoop.runner=function Browser_mainLoop_runner(){if(ABORT)return;if(Browser.mainLoop.queue.length>0){var start=Date.now();var blocker=Browser.mainLoop.queue.shift();blocker.func(blocker.arg);if(Browser.mainLoop.remainingBlockers){var remaining=Browser.mainLoop.remainingBlockers;var next=remaining%1==0?remaining-1:Math.floor(remaining);if(blocker.counted){Browser.mainLoop.remainingBlockers=next}else{next=next+.5;Browser.mainLoop.remainingBlockers=(8*remaining+next)/9}}Browser.mainLoop.updateStatus();if(!checkIsRunning())return;setTimeout(Browser.mainLoop.runner,0);return}if(!checkIsRunning())return;Browser.mainLoop.currentFrameNumber=Browser.mainLoop.currentFrameNumber+1|0;if(Browser.mainLoop.timingMode==1&&Browser.mainLoop.timingValue>1&&Browser.mainLoop.currentFrameNumber%Browser.mainLoop.timingValue!=0){Browser.mainLoop.scheduler();return}else if(Browser.mainLoop.timingMode==0){Browser.mainLoop.tickStartTime=_emscripten_get_now()}Browser.mainLoop.runIter(browserIterationFunc);if(!checkIsRunning())return;if(typeof SDL=="object")SDL.audio?.queueNewAudioData?.();Browser.mainLoop.scheduler()};if(!noSetTiming){if(fps&&fps>0){_emscripten_set_main_loop_timing(0,1e3/fps)}else{_emscripten_set_main_loop_timing(1,1)}Browser.mainLoop.scheduler()}if(simulateInfiniteLoop){throw"unwind"}};var handleException=e=>{if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS}quit_(1,e)};function ExitStatus(status){this.name="ExitStatus";this.message=`Program terminated with exit(${status})`;this.status=status}var runtimeKeepaliveCounter=0;var keepRuntimeAlive=()=>noExitRuntime||runtimeKeepaliveCounter>0;var PATH={isAbs:path=>path.charAt(0)==="/",splitPath:filename=>{var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1)},normalizeArray:(parts,allowAboveRoot)=>{var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up;up--){parts.unshift("..")}}return parts},normalize:path=>{var isAbsolute=PATH.isAbs(path),trailingSlash=path.substr(-1)==="/";path=PATH.normalizeArray(path.split("/").filter(p=>!!p),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path},dirname:path=>{var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir},basename:path=>{if(path==="/")return"/";path=PATH.normalize(path);path=path.replace(/\/$/,"");var lastSlash=path.lastIndexOf("/");if(lastSlash===-1)return path;return path.substr(lastSlash+1)},join:function(){var paths=Array.prototype.slice.call(arguments);return PATH.normalize(paths.join("/"))},join2:(l,r)=>PATH.normalize(l+"/"+r)};var initRandomFill=()=>{if(typeof crypto=="object"&&typeof crypto["getRandomValues"]=="function"){return view=>crypto.getRandomValues(view)}else if(ENVIRONMENT_IS_NODE){try{var crypto_module=require("crypto");var randomFillSync=crypto_module["randomFillSync"];if(randomFillSync){return view=>crypto_module["randomFillSync"](view)}var randomBytes=crypto_module["randomBytes"];return view=>(view.set(randomBytes(view.byteLength)),view)}catch(e){}}abort("initRandomDevice")};var randomFill=view=>(randomFill=initRandomFill())(view);var PATH_FS={resolve:function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:FS.cwd();if(typeof path!="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){return""}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=PATH.isAbs(path)}resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter(p=>!!p),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."},relative:(from,to)=>{from=PATH_FS.resolve(from).substr(1);to=PATH_FS.resolve(to).substr(1);function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=="")break}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break}}var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push("..")}outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join("/")}};var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):undefined;var UTF8ArrayToString=(heapOrArray,idx,maxBytesToRead)=>{idx>>>=0;var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str};var FS_stdin_getChar_buffer=[];var lengthBytesUTF8=str=>{var len=0;for(var i=0;i<str.length;++i){var c=str.charCodeAt(i);if(c<=127){len++}else if(c<=2047){len+=2}else if(c>=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{outIdx>>>=0;if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.charCodeAt(i);if(u>=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++>>>0]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++>>>0]=192|u>>6;heap[outIdx++>>>0]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++>>>0]=224|u>>12;heap[outIdx++>>>0]=128|u>>6&63;heap[outIdx++>>>0]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++>>>0]=240|u>>18;heap[outIdx++>>>0]=128|u>>12&63;heap[outIdx++>>>0]=128|u>>6&63;heap[outIdx++>>>0]=128|u&63}}heap[outIdx>>>0]=0;return outIdx-startIdx};function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}var FS_stdin_getChar=()=>{if(!FS_stdin_getChar_buffer.length){var result=null;if(ENVIRONMENT_IS_NODE){var BUFSIZE=256;var buf=Buffer.alloc(BUFSIZE);var bytesRead=0;var fd=process.stdin.fd;try{bytesRead=fs.readSync(fd,buf)}catch(e){if(e.toString().includes("EOF"))bytesRead=0;else throw e}if(bytesRead>0){result=buf.slice(0,bytesRead).toString("utf-8")}else{result=null}}else if(typeof window!="undefined"&&typeof window.prompt=="function"){result=window.prompt("Input: ");if(result!==null){result+="\n"}}else if(typeof readline=="function"){result=readline();if(result!==null){result+="\n"}}if(!result){return null}FS_stdin_getChar_buffer=intArrayFromString(result,true)}return FS_stdin_getChar_buffer.shift()};var TTY={ttys:[],init(){},shutdown(){},register(dev,ops){TTY.ttys[dev]={input:[],output:[],ops:ops};FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43)}stream.tty=tty;stream.seekable=false},close(stream){stream.tty.ops.fsync(stream.tty)},fsync(stream){stream.tty.ops.fsync(stream.tty)},read(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.get_char){throw new FS.ErrnoError(60)}var bytesRead=0;for(var i=0;i<length;i++){var result;try{result=stream.tty.ops.get_char(stream.tty)}catch(e){throw new FS.ErrnoError(29)}if(result===undefined&&bytesRead===0){throw new FS.ErrnoError(6)}if(result===null||result===undefined)break;bytesRead++;buffer[offset+i]=result}if(bytesRead){stream.node.timestamp=Date.now()}return bytesRead},write(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.put_char){throw new FS.ErrnoError(60)}try{for(var i=0;i<length;i++){stream.tty.ops.put_char(stream.tty,buffer[offset+i])}}catch(e){throw new FS.ErrnoError(29)}if(length){stream.node.timestamp=Date.now()}return i}},default_tty_ops:{get_char(tty){return FS_stdin_getChar()},put_char(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync(tty){if(tty.output&&tty.output.length>0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}},ioctl_tcgets(tty){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(tty,optional_actions,data){return 0},ioctl_tiocgwinsz(tty){return[24,80]}},default_tty1_ops:{put_char(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};var mmapAlloc=size=>{abort()};var MEMFS={ops_table:null,mount(mount){return MEMFS.createNode(null,"/",16384|511,0)},createNode(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}MEMFS.ops_table||={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,allocate:MEMFS.stream_ops.allocate,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}};var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.timestamp=Date.now();if(parent){parent.contents[name]=node;parent.timestamp=node.timestamp}return node},getFileDataAsTypedArray(node){if(!node.contents)return new Uint8Array(0);if(node.contents.subarray)return node.contents.subarray(0,node.usedBytes);return new Uint8Array(node.contents)},expandFileStorage(node,newCapacity){var prevCapacity=node.contents?node.contents.length:0;if(prevCapacity>=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity<CAPACITY_DOUBLING_MAX?2:1.125)>>>0);if(prevCapacity!=0)newCapacity=Math.max(newCapacity,256);var oldContents=node.contents;node.contents=new Uint8Array(newCapacity);if(node.usedBytes>0)node.contents.set(oldContents.subarray(0,node.usedBytes),0)},resizeFileStorage(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0}else{var oldContents=node.contents;node.contents=new Uint8Array(newSize);if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)))}node.usedBytes=newSize}},node_ops:{getattr(node){var attr={};attr.dev=FS.isChrdev(node.mode)?node.id:1;attr.ino=node.id;attr.mode=node.mode;attr.nlink=1;attr.uid=0;attr.gid=0;attr.rdev=node.rdev;if(FS.isDir(node.mode)){attr.size=4096}else if(FS.isFile(node.mode)){attr.size=node.usedBytes}else if(FS.isLink(node.mode)){attr.size=node.link.length}else{attr.size=0}attr.atime=new Date(node.timestamp);attr.mtime=new Date(node.timestamp);attr.ctime=new Date(node.timestamp);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr(node,attr){if(attr.mode!==undefined){node.mode=attr.mode}if(attr.timestamp!==undefined){node.timestamp=attr.timestamp}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup(parent,name){throw FS.genericErrors[44]},mknod(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename(old_node,new_dir,new_name){if(FS.isDir(old_node.mode)){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}}delete old_node.parent.contents[old_node.name];old_node.parent.timestamp=Date.now();old_node.name=new_name;new_dir.contents[new_name]=old_node;new_dir.timestamp=old_node.parent.timestamp;old_node.parent=new_dir},unlink(parent,name){delete parent.contents[name];parent.timestamp=Date.now()},rmdir(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.timestamp=Date.now()},readdir(node){var entries=[".",".."];for(var key of Object.keys(node.contents)){entries.push(key)}return entries},symlink(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i<size;i++)buffer[offset+i]=contents[position+i]}return size},write(stream,buffer,offset,length,position,canOwn){if(buffer.buffer===HEAP8.buffer){canOwn=false}if(!length)return 0;var node=stream.node;node.timestamp=Date.now();if(buffer.subarray&&(!node.contents||node.contents.subarray)){if(canOwn){node.contents=buffer.subarray(offset,offset+length);node.usedBytes=length;return length}else if(node.usedBytes===0&&position===0){node.contents=buffer.slice(offset,offset+length);node.usedBytes=length;return length}else if(position+length<=node.usedBytes){node.contents.set(buffer.subarray(offset,offset+length),position);return length}}MEMFS.expandFileStorage(node,position+length);if(node.contents.subarray&&buffer.subarray){node.contents.set(buffer.subarray(offset,offset+length),position)}else{for(var i=0;i<length;i++){node.contents[position+i]=buffer[offset+i]}}node.usedBytes=Math.max(node.usedBytes,position+length);return length},llseek(stream,offset,whence){var position=offset;if(whence===1){position+=stream.position}else if(whence===2){if(FS.isFile(stream.node.mode)){position+=stream.node.usedBytes}}if(position<0){throw new FS.ErrnoError(28)}return position},allocate(stream,offset,length){MEMFS.expandFileStorage(stream.node,offset+length);stream.node.usedBytes=Math.max(stream.node.usedBytes,offset+length)},mmap(stream,length,position,prot,flags){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}var ptr;var allocated;var contents=stream.node.contents;if(!(flags&2)&&contents.buffer===HEAP8.buffer){allocated=false;ptr=contents.byteOffset}else{if(position>0||position+length<contents.length){if(contents.subarray){contents=contents.subarray(position,position+length)}else{contents=Array.prototype.slice.call(contents,position,position+length)}}allocated=true;ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}HEAP8.set(contents,ptr>>>0)}return{ptr:ptr,allocated:allocated}},msync(stream,buffer,offset,length,mmapFlags){MEMFS.stream_ops.write(stream,buffer,0,length,offset,false);return 0}}};var asyncLoad=(url,onload,onerror,noRunDep)=>{var dep=!noRunDep?getUniqueRunDependency(`al ${url}`):"";readAsync(url,arrayBuffer=>{assert(arrayBuffer,`Loading data file "${url}" failed (no arrayBuffer).`);onload(new Uint8Array(arrayBuffer));if(dep)removeRunDependency(dep)},event=>{if(onerror){onerror()}else{throw`Loading data file "${url}" failed.`}});if(dep)addRunDependency(dep)};var FS_createDataFile=(parent,name,fileData,canRead,canWrite,canOwn)=>{FS.createDataFile(parent,name,fileData,canRead,canWrite,canOwn)};var preloadPlugins=Module["preloadPlugins"]||[];var FS_handledByPreloadPlugin=(byteArray,fullname,finish,onerror)=>{if(typeof Browser!="undefined")Browser.init();var handled=false;preloadPlugins.forEach(plugin=>{if(handled)return;if(plugin["canHandle"](fullname)){plugin["handle"](byteArray,fullname,finish,onerror);handled=true}});return handled};var FS_createPreloadedFile=(parent,name,url,canRead,canWrite,onload,onerror,dontCreateFile,canOwn,preFinish)=>{var fullname=name?PATH_FS.resolve(PATH.join2(parent,name)):parent;var dep=getUniqueRunDependency(`cp ${fullname}`);function processData(byteArray){function finish(byteArray){preFinish?.();if(!dontCreateFile){FS_createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}onload?.();removeRunDependency(dep)}if(FS_handledByPreloadPlugin(byteArray,fullname,finish,()=>{onerror?.();removeRunDependency(dep)})){return}finish(byteArray)}addRunDependency(dep);if(typeof url=="string"){asyncLoad(url,byteArray=>processData(byteArray),onerror)}else{processData(url)}};var FS_modeStringToFlags=str=>{var flagModes={"r":0,"r+":2,"w":512|64|1,"w+":512|64|2,"a":1024|64|1,"a+":1024|64|2};var flags=flagModes[str];if(typeof flags=="undefined"){throw new Error(`Unknown file open mode: ${str}`)}return flags};var FS_getMode=(canRead,canWrite)=>{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode};var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(path,opts={}){path=PATH_FS.resolve(path);if(!path)return{path:"",node:null};var defaults={follow_mount:true,recurse_count:0};opts=Object.assign(defaults,opts);if(opts.recurse_count>8){throw new FS.ErrnoError(32)}var parts=path.split("/").filter(p=>!!p);var current=FS.root;var current_path="/";for(var i=0;i<parts.length;i++){var islast=i===parts.length-1;if(islast&&opts.parent){break}current=FS.lookupNode(current,parts[i]);current_path=PATH.join2(current_path,parts[i]);if(FS.isMountpoint(current)){if(!islast||islast&&opts.follow_mount){current=current.mounted.root}}if(!islast||opts.follow){var count=0;while(FS.isLink(current.mode)){var link=FS.readlink(current_path);current_path=PATH_FS.resolve(PATH.dirname(current_path),link);var lookup=FS.lookupPath(current_path,{recurse_count:opts.recurse_count+1});current=lookup.node;if(count++>40){throw new FS.ErrnoError(32)}}}}return{path:current_path,node:current}},getPath(node){var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?`${mount}/${path}`:mount+path}path=path?`${node.name}/${path}`:node.name;node=node.parent}},hashName(parentid,name){var hash=0;for(var i=0;i<name.length;i++){hash=(hash<<5)-hash+name.charCodeAt(i)|0}return(parentid+hash>>>0)%FS.nameTable.length},hashAddNode(node){var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node},hashRemoveNode(node){var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}},lookupNode(parent,name){var errCode=FS.mayLookup(parent);if(errCode){throw new FS.ErrnoError(errCode,parent)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node}}return FS.lookup(parent,name)},createNode(parent,name,mode,rdev){var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node},destroyNode(node){FS.hashRemoveNode(node)},isRoot(node){return node===node.parent},isMountpoint(node){return!!node.mounted},isFile(mode){return(mode&61440)===32768},isDir(mode){return(mode&61440)===16384},isLink(mode){return(mode&61440)===40960},isChrdev(mode){return(mode&61440)===8192},isBlkdev(mode){return(mode&61440)===24576},isFIFO(mode){return(mode&61440)===4096},isSocket(mode){return(mode&49152)===49152},flagsToPermissionString(flag){var perms=["r","w","rw"][flag&3];if(flag&512){perms+="w"}return perms},nodePermissions(node,perms){if(FS.ignorePermissions){return 0}if(perms.includes("r")&&!(node.mode&292)){return 2}else if(perms.includes("w")&&!(node.mode&146)){return 2}else if(perms.includes("x")&&!(node.mode&73)){return 2}return 0},mayLookup(dir){var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate(dir,name){try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete(dir,name,isdir){var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else{if(FS.isDir(node.mode)){return 31}}return 0},mayOpen(node,flags){if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd(){for(var fd=0;fd<=FS.MAX_OPEN_FDS;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStreamChecked(fd){var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}return stream},getStream:fd=>FS.streams[fd],createStream(stream,fd=-1){if(!FS.FSStream){FS.FSStream=function(){this.shared={}};FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get(){return this.node},set(val){this.node=val}},isRead:{get(){return(this.flags&2097155)!==1}},isWrite:{get(){return(this.flags&2097155)!==0}},isAppend:{get(){return this.flags&1024}},flags:{get(){return this.shared.flags},set(val){this.shared.flags=val}},position:{get(){return this.shared.position},set(val){this.shared.position=val}}})}stream=Object.assign(new FS.FSStream,stream);if(fd==-1){fd=FS.nextfd()}stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream(fd){FS.streams[fd]=null},chrdev_stream_ops:{open(stream){var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;stream.stream_ops.open?.(stream)},llseek(){throw new FS.ErrnoError(70)}},major:dev=>dev>>8,minor:dev=>dev&255,makedev:(ma,mi)=>ma<<8|mi,registerDevice(dev,ops){FS.devices[dev]={stream_ops:ops}},getDevice:dev=>FS.devices[dev],getMounts(mount){var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push.apply(check,m.mounts)}return mounts},syncfs(populate,callback){if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err(`warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`)}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(mount=>{if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount(type,opts,mountpoint){var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}}var mount={type:type,opts:opts,mountpoint:mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot},unmount(mountpoint){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(28)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach(hash=>{var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.includes(current.mount)){FS.destroyNode(current)}current=next}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);node.mount.mounts.splice(idx,1)},lookup(parent,name){return parent.node_ops.lookup(parent,name)},mknod(path,mode,dev){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name==="."||name===".."){throw new FS.ErrnoError(28)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},create(path,mode){mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir(path,mode){mode=mode!==undefined?mode:511;mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)},mkdirTree(path,mode){var dirs=path.split("/");var d="";for(var i=0;i<dirs.length;++i){if(!dirs[i])continue;d+="/"+dirs[i];try{FS.mkdir(d,mode)}catch(e){if(e.errno!=20)throw e}}},mkdev(path,mode,dev){if(typeof dev=="undefined"){dev=mode;mode=438}mode|=8192;return FS.mknod(path,mode,dev)},symlink(oldpath,newpath){if(!PATH_FS.resolve(oldpath)){throw new FS.ErrnoError(44)}var lookup=FS.lookupPath(newpath,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var newname=PATH.basename(newpath);var errCode=FS.mayCreate(parent,newname);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.symlink){throw new FS.ErrnoError(63)}return parent.node_ops.symlink(parent,newname,oldpath)},rename(old_path,new_path){var old_dirname=PATH.dirname(old_path);var new_dirname=PATH.dirname(new_path);var old_name=PATH.basename(old_path);var new_name=PATH.basename(new_path);var lookup,old_dir,new_dir;lookup=FS.lookupPath(old_path,{parent:true});old_dir=lookup.node;lookup=FS.lookupPath(new_path,{parent:true});new_dir=lookup.node;if(!old_dir||!new_dir)throw new FS.ErrnoError(44);if(old_dir.mount!==new_dir.mount){throw new FS.ErrnoError(75)}var old_node=FS.lookupNode(old_dir,old_name);var relative=PATH_FS.relative(old_path,new_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(28)}relative=PATH_FS.relative(new_path,old_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(55)}var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(old_node===new_node){return}var isdir=FS.isDir(old_node.mode);var errCode=FS.mayDelete(old_dir,old_name,isdir);if(errCode){throw new FS.ErrnoError(errCode)}errCode=new_node?FS.mayDelete(new_dir,new_name,isdir):FS.mayCreate(new_dir,new_name);if(errCode){throw new FS.ErrnoError(errCode)}if(!old_dir.node_ops.rename){throw new FS.ErrnoError(63)}if(FS.isMountpoint(old_node)||new_node&&FS.isMountpoint(new_node)){throw new FS.ErrnoError(10)}if(new_dir!==old_dir){errCode=FS.nodePermissions(old_dir,"w");if(errCode){throw new FS.ErrnoError(errCode)}}FS.hashRemoveNode(old_node);try{old_dir.node_ops.rename(old_node,new_dir,new_name)}catch(e){throw e}finally{FS.hashAddNode(old_node)}},rmdir(path){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,true);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.rmdir){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.rmdir(parent,name);FS.destroyNode(node)},readdir(path){var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;if(!node.node_ops.readdir){throw new FS.ErrnoError(54)}return node.node_ops.readdir(node)},unlink(path){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,false);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.unlink){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.unlink(parent,name);FS.destroyNode(node)},readlink(path){var lookup=FS.lookupPath(path);var link=lookup.node;if(!link){throw new FS.ErrnoError(44)}if(!link.node_ops.readlink){throw new FS.ErrnoError(28)}return PATH_FS.resolve(FS.getPath(link.parent),link.node_ops.readlink(link))},stat(path,dontFollow){var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;if(!node){throw new FS.ErrnoError(44)}if(!node.node_ops.getattr){throw new FS.ErrnoError(63)}return node.node_ops.getattr(node)},lstat(path){return FS.stat(path,true)},chmod(path,mode,dontFollow){var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{mode:mode&4095|node.mode&~4095,timestamp:Date.now()})},lchmod(path,mode){FS.chmod(path,mode,true)},fchmod(fd,mode){var stream=FS.getStreamChecked(fd);FS.chmod(stream.node,mode)},chown(path,uid,gid,dontFollow){var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{timestamp:Date.now()})},lchown(path,uid,gid){FS.chown(path,uid,gid,true)},fchown(fd,uid,gid){var stream=FS.getStreamChecked(fd);FS.chown(stream.node,uid,gid)},truncate(path,len){if(len<0){throw new FS.ErrnoError(28)}var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:true});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}if(FS.isDir(node.mode)){throw new FS.ErrnoError(31)}if(!FS.isFile(node.mode)){throw new FS.ErrnoError(28)}var errCode=FS.nodePermissions(node,"w");if(errCode){throw new FS.ErrnoError(errCode)}node.node_ops.setattr(node,{size:len,timestamp:Date.now()})},ftruncate(fd,len){var stream=FS.getStreamChecked(fd);if((stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.truncate(stream.node,len)},utime(path,atime,mtime){var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;node.node_ops.setattr(node,{timestamp:Math.max(atime,mtime)})},open(path,flags,mode){if(path===""){throw new FS.ErrnoError(44)}flags=typeof flags=="string"?FS_modeStringToFlags(flags):flags;mode=typeof mode=="undefined"?438:mode;if(flags&64){mode=mode&4095|32768}else{mode=0}var node;if(typeof path=="object"){node=path}else{path=PATH.normalize(path);try{var lookup=FS.lookupPath(path,{follow:!(flags&131072)});node=lookup.node}catch(e){}}var created=false;if(flags&64){if(node){if(flags&128){throw new FS.ErrnoError(20)}}else{node=FS.mknod(path,mode,0);created=true}}if(!node){throw new FS.ErrnoError(44)}if(FS.isChrdev(node.mode)){flags&=~512}if(flags&65536&&!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}if(!created){var errCode=FS.mayOpen(node,flags);if(errCode){throw new FS.ErrnoError(errCode)}}if(flags&512&&!created){FS.truncate(node,0)}flags&=~(128|512|131072);var stream=FS.createStream({node:node,path:FS.getPath(node),flags:flags,seekable:true,position:0,stream_ops:node.stream_ops,ungotten:[],error:false});if(stream.stream_ops.open){stream.stream_ops.open(stream)}if(Module["logReadFiles"]&&!(flags&1)){if(!FS.readFiles)FS.readFiles={};if(!(path in FS.readFiles)){FS.readFiles[path]=1}}return stream},close(stream){if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed(stream){return stream.fd===null},llseek(stream,offset,whence){if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70)}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position},read(stream,buffer,offset,length,position){if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.read){throw new FS.ErrnoError(28)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write(stream,buffer,offset,length,position,canOwn){if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.write){throw new FS.ErrnoError(28)}if(stream.seekable&&stream.flags&1024){FS.llseek(stream,0,2)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesWritten=stream.stream_ops.write(stream,buffer,offset,length,position,canOwn);if(!seeking)stream.position+=bytesWritten;return bytesWritten},allocate(stream,offset,length){if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(offset<0||length<=0){throw new FS.ErrnoError(28)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(!FS.isFile(stream.node.mode)&&!FS.isDir(stream.node.mode)){throw new FS.ErrnoError(43)}if(!stream.stream_ops.allocate){throw new FS.ErrnoError(138)}stream.stream_ops.allocate(stream,offset,length)},mmap(stream,length,position,prot,flags){if((prot&2)!==0&&(flags&2)===0&&(stream.flags&2097155)!==2){throw new FS.ErrnoError(2)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(2)}if(!stream.stream_ops.mmap){throw new FS.ErrnoError(43)}return stream.stream_ops.mmap(stream,length,position,prot,flags)},msync(stream,buffer,offset,length,mmapFlags){if(!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},munmap:stream=>0,ioctl(stream,cmd,arg){if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile(path,opts={}){opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error(`Invalid encoding type "${opts.encoding}"`)}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret=UTF8ArrayToString(buf,0)}else if(opts.encoding==="binary"){ret=buf}FS.close(stream);return ret},writeFile(path,data,opts={}){opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,undefined,opts.canOwn)}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn)}else{throw new Error("Unsupported data type")}FS.close(stream)},cwd:()=>FS.currentPath,chdir(path){var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories(){FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices(){FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length});FS.mkdev("/dev/null",FS.makedev(1,3));TTY.register(FS.makedev(5,0),TTY.default_tty_ops);TTY.register(FS.makedev(6,0),TTY.default_tty1_ops);FS.mkdev("/dev/tty",FS.makedev(5,0));FS.mkdev("/dev/tty1",FS.makedev(6,0));var randomBuffer=new Uint8Array(1024),randomLeft=0;var randomByte=()=>{if(randomLeft===0){randomLeft=randomFill(randomBuffer).byteLength}return randomBuffer[--randomLeft]};FS.createDevice("/dev","random",randomByte);FS.createDevice("/dev","urandom",randomByte);FS.mkdir("/dev/shm");FS.mkdir("/dev/shm/tmp")},createSpecialDirectories(){FS.mkdir("/proc");var proc_self=FS.mkdir("/proc/self");FS.mkdir("/proc/self/fd");FS.mount({mount(){var node=FS.createNode(proc_self,"fd",16384|511,73);node.node_ops={lookup(parent,name){var fd=+name;var stream=FS.getStreamChecked(fd);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path}};ret.parent=ret;return ret}};return node}},{},"/proc/self/fd")},createStandardStreams(){if(Module["stdin"]){FS.createDevice("/dev","stdin",Module["stdin"])}else{FS.symlink("/dev/tty","/dev/stdin")}if(Module["stdout"]){FS.createDevice("/dev","stdout",null,Module["stdout"])}else{FS.symlink("/dev/tty","/dev/stdout")}if(Module["stderr"]){FS.createDevice("/dev","stderr",null,Module["stderr"])}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1)},ensureErrnoError(){if(FS.ErrnoError)return;FS.ErrnoError=function ErrnoError(errno,node){this.name="ErrnoError";this.node=node;this.setErrno=function(errno){this.errno=errno};this.setErrno(errno);this.message="FS error"};FS.ErrnoError.prototype=new Error;FS.ErrnoError.prototype.constructor=FS.ErrnoError;[44].forEach(code=>{FS.genericErrors[code]=new FS.ErrnoError(code);FS.genericErrors[code].stack="<generic error, no stack>"})},staticInit(){FS.ensureErrnoError();FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={"MEMFS":MEMFS}},init(input,output,error){FS.init.initialized=true;FS.ensureErrnoError();Module["stdin"]=input||Module["stdin"];Module["stdout"]=output||Module["stdout"];Module["stderr"]=error||Module["stderr"];FS.createStandardStreams()},quit(){FS.init.initialized=false;for(var i=0;i<FS.streams.length;i++){var stream=FS.streams[i];if(!stream){continue}FS.close(stream)}},findObject(path,dontResolveLastLink){var ret=FS.analyzePath(path,dontResolveLastLink);if(!ret.exists){return null}return ret.object},analyzePath(path,dontResolveLastLink){try{var lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});path=lookup.path}catch(e){}var ret={isRoot:false,exists:false,error:0,name:null,path:null,object:null,parentExists:false,parentPath:null,parentObject:null};try{var lookup=FS.lookupPath(path,{parent:true});ret.parentExists=true;ret.parentPath=lookup.path;ret.parentObject=lookup.node;ret.name=PATH.basename(path);lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});ret.exists=true;ret.path=lookup.path;ret.object=lookup.node;ret.name=lookup.node.name;ret.isRoot=lookup.path==="/"}catch(e){ret.error=e.errno}return ret},createPath(parent,path,canRead,canWrite){parent=typeof parent=="string"?parent:FS.getPath(parent);var parts=path.split("/").reverse();while(parts.length){var part=parts.pop();if(!part)continue;var current=PATH.join2(parent,part);try{FS.mkdir(current)}catch(e){}parent=current}return current},createFile(parent,name,properties,canRead,canWrite){var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS_getMode(canRead,canWrite);return FS.create(path,mode)},createDataFile(parent,name,data,canRead,canWrite,canOwn){var path=name;if(parent){parent=typeof parent=="string"?parent:FS.getPath(parent);path=name?PATH.join2(parent,name):parent}var mode=FS_getMode(canRead,canWrite);var node=FS.create(path,mode);if(data){if(typeof data=="string"){var arr=new Array(data.length);for(var i=0,len=data.length;i<len;++i)arr[i]=data.charCodeAt(i);data=arr}FS.chmod(node,mode|146);var stream=FS.open(node,577);FS.write(stream,data,0,data.length,0,canOwn);FS.close(stream);FS.chmod(node,mode)}},createDevice(parent,name,input,output){var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS_getMode(!!input,!!output);if(!FS.createDevice.major)FS.createDevice.major=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open(stream){stream.seekable=false},close(stream){if(output?.buffer?.length){output(10)}},read(stream,buffer,offset,length,pos){var bytesRead=0;for(var i=0;i<length;i++){var result;try{result=input()}catch(e){throw new FS.ErrnoError(29)}if(result===undefined&&bytesRead===0){throw new FS.ErrnoError(6)}if(result===null||result===undefined)break;bytesRead++;buffer[offset+i]=result}if(bytesRead){stream.node.timestamp=Date.now()}return bytesRead},write(stream,buffer,offset,length,pos){for(var i=0;i<length;i++){try{output(buffer[offset+i])}catch(e){throw new FS.ErrnoError(29)}}if(length){stream.node.timestamp=Date.now()}return i}});return FS.mkdev(path,mode,dev)},forceLoadFile(obj){if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!="undefined"){throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.")}else if(read_){try{obj.contents=intArrayFromString(read_(obj.url),true);obj.usedBytes=obj.contents.length}catch(e){throw new FS.ErrnoError(29)}}else{throw new Error("Cannot load without read() or XMLHttpRequest.")}},createLazyFile(parent,name,url,canRead,canWrite){function LazyUint8Array(){this.lengthKnown=false;this.chunks=[]}LazyUint8Array.prototype.get=function LazyUint8Array_get(idx){if(idx>this.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_cacheLength(){var xhr=new XMLHttpRequest;xhr.open("HEAD",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);var datalength=Number(xhr.getResponseHeader("Content-length"));var header;var hasByteServing=(header=xhr.getResponseHeader("Accept-Ranges"))&&header==="bytes";var usesGzip=(header=xhr.getResponseHeader("Content-Encoding"))&&header==="gzip";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=(from,to)=>{if(from>to)throw new Error("invalid range ("+from+", "+to+") or no bytes requested!");if(to>datalength-1)throw new Error("only "+datalength+" bytes available! programmer error!");var xhr=new XMLHttpRequest;xhr.open("GET",url,false);if(datalength!==chunkSize)xhr.setRequestHeader("Range","bytes="+from+"-"+to);xhr.responseType="arraybuffer";if(xhr.overrideMimeType){xhr.overrideMimeType("text/plain; charset=x-user-defined")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}return intArrayFromString(xhr.responseText||"",true)};var lazyArray=this;lazyArray.setDataGetter(chunkNum=>{var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]=="undefined"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]=="undefined")throw new Error("doXHR failed!");return lazyArray.chunks[chunkNum]});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;out("LazyFiles on gzip forces download of the whole file when length is accessed")}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true};if(typeof XMLHttpRequest!="undefined"){if(!ENVIRONMENT_IS_WORKER)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var lazyArray=new LazyUint8Array;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url:url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}});var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach(key=>{var fn=node.stream_ops[key];stream_ops[key]=function forceLoadLazyFile(){FS.forceLoadFile(node);return fn.apply(null,arguments)}});function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i<size;i++){buffer[offset+i]=contents[position+i]}}else{for(var i=0;i<size;i++){buffer[offset+i]=contents.get(position+i)}}return size}stream_ops.read=(stream,buffer,offset,length,position)=>{FS.forceLoadFile(node);return writeChunks(stream,buffer,offset,length,position)};stream_ops.mmap=(stream,length,position,prot,flags)=>{FS.forceLoadFile(node);var ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}writeChunks(stream,HEAP8,ptr,length,position);return{ptr:ptr,allocated:true}};node.stream_ops=stream_ops;return node}};var UTF8ToString=(ptr,maxBytesToRead)=>{ptr>>>=0;return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""};var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt(dirfd,path,allowEmpty){if(PATH.isAbs(path)){return path}var dir;if(dirfd===-100){dir=FS.cwd()}else{var dirstream=SYSCALLS.getStreamFromFD(dirfd);dir=dirstream.path}if(path.length==0){if(!allowEmpty){throw new FS.ErrnoError(44)}return dir}return PATH.join2(dir,path)},doStat(func,path,buf){try{var stat=func(path)}catch(e){if(e&&e.node&&PATH.normalize(path)!==PATH.normalize(FS.getPath(e.node))){return-54}throw e}HEAP32[buf>>>2>>>0]=stat.dev;HEAP32[buf+4>>>2>>>0]=stat.mode;HEAPU32[buf+8>>>2>>>0]=stat.nlink;HEAP32[buf+12>>>2>>>0]=stat.uid;HEAP32[buf+16>>>2>>>0]=stat.gid;HEAP32[buf+20>>>2>>>0]=stat.rdev;tempI64=[stat.size>>>0,(tempDouble=stat.size,+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+24>>>2>>>0]=tempI64[0],HEAP32[buf+28>>>2>>>0]=tempI64[1];HEAP32[buf+32>>>2>>>0]=4096;HEAP32[buf+36>>>2>>>0]=stat.blocks;var atime=stat.atime.getTime();var mtime=stat.mtime.getTime();var ctime=stat.ctime.getTime();tempI64=[Math.floor(atime/1e3)>>>0,(tempDouble=Math.floor(atime/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+40>>>2>>>0]=tempI64[0],HEAP32[buf+44>>>2>>>0]=tempI64[1];HEAPU32[buf+48>>>2>>>0]=atime%1e3*1e3;tempI64=[Math.floor(mtime/1e3)>>>0,(tempDouble=Math.floor(mtime/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+56>>>2>>>0]=tempI64[0],HEAP32[buf+60>>>2>>>0]=tempI64[1];HEAPU32[buf+64>>>2>>>0]=mtime%1e3*1e3;tempI64=[Math.floor(ctime/1e3)>>>0,(tempDouble=Math.floor(ctime/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+72>>>2>>>0]=tempI64[0],HEAP32[buf+76>>>2>>>0]=tempI64[1];HEAPU32[buf+80>>>2>>>0]=ctime%1e3*1e3;tempI64=[stat.ino>>>0,(tempDouble=stat.ino,+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+88>>>2>>>0]=tempI64[0],HEAP32[buf+92>>>2>>>0]=tempI64[1];return 0},doMsync(addr,stream,len,flags,offset){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}if(flags&2){return 0}var buffer=HEAPU8.slice(addr,addr+len);FS.msync(stream,buffer,offset,len,flags)},varargs:undefined,get(){var ret=HEAP32[+SYSCALLS.varargs>>>2>>>0];SYSCALLS.varargs+=4;return ret},getp(){return SYSCALLS.get()},getStr(ptr){var ret=UTF8ToString(ptr);return ret},getStreamFromFD(fd){var stream=FS.getStreamChecked(fd);return stream}};var _proc_exit=code=>{EXITSTATUS=code;if(!keepRuntimeAlive()){Module["onExit"]?.(code);ABORT=true}quit_(code,new ExitStatus(code))};var exitJS=(status,implicit)=>{EXITSTATUS=status;_proc_exit(status)};var _exit=exitJS;var maybeExit=()=>{if(!keepRuntimeAlive()){try{_exit(EXITSTATUS)}catch(e){handleException(e)}}};var callUserCallback=func=>{if(ABORT){return}try{func();maybeExit()}catch(e){handleException(e)}};var safeSetTimeout=(func,timeout)=>setTimeout(()=>{callUserCallback(func)},timeout);var warnOnce=text=>{warnOnce.shown||={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;if(ENVIRONMENT_IS_NODE)text="warning: "+text;err(text)}};var Browser={mainLoop:{running:false,scheduler:null,method:"",currentlyRunningMainloop:0,func:null,arg:0,timingMode:0,timingValue:0,currentFrameNumber:0,queue:[],pause(){Browser.mainLoop.scheduler=null;Browser.mainLoop.currentlyRunningMainloop++},resume(){Browser.mainLoop.currentlyRunningMainloop++;var timingMode=Browser.mainLoop.timingMode;var timingValue=Browser.mainLoop.timingValue;var func=Browser.mainLoop.func;Browser.mainLoop.func=null;setMainLoop(func,0,false,Browser.mainLoop.arg,true);_emscripten_set_main_loop_timing(timingMode,timingValue);Browser.mainLoop.scheduler()},updateStatus(){if(Module["setStatus"]){var message=Module["statusMessage"]||"Please wait...";var remaining=Browser.mainLoop.remainingBlockers;var expected=Browser.mainLoop.expectedBlockers;if(remaining){if(remaining<expected){Module["setStatus"](message+" ("+(expected-remaining)+"/"+expected+")")}else{Module["setStatus"](message)}}else{Module["setStatus"]("")}}},runIter(func){if(ABORT)return;if(Module["preMainLoop"]){var preRet=Module["preMainLoop"]();if(preRet===false){return}}callUserCallback(func);Module["postMainLoop"]?.()}},isFullscreen:false,pointerLock:false,moduleContextCreatedCallbacks:[],workers:[],init(){if(Browser.initted)return;Browser.initted=true;var imagePlugin={};imagePlugin["canHandle"]=function imagePlugin_canHandle(name){return!Module.noImageDecoding&&/\.(jpg|jpeg|png|bmp)$/i.test(name)};imagePlugin["handle"]=function imagePlugin_handle(byteArray,name,onload,onerror){var b=new Blob([byteArray],{type:Browser.getMimetype(name)});if(b.size!==byteArray.length){b=new Blob([new Uint8Array(byteArray).buffer],{type:Browser.getMimetype(name)})}var url=URL.createObjectURL(b);var img=new Image;img.onload=()=>{assert(img.complete,`Image ${name} could not be decoded`);var canvas=document.createElement("canvas");canvas.width=img.width;canvas.height=img.height;var ctx=canvas.getContext("2d");ctx.drawImage(img,0,0);preloadedImages[name]=canvas;URL.revokeObjectURL(url);onload?.(byteArray)};img.onerror=event=>{err(`Image ${url} could not be decoded`);onerror?.()};img.src=url};preloadPlugins.push(imagePlugin);var audioPlugin={};audioPlugin["canHandle"]=function audioPlugin_canHandle(name){return!Module.noAudioDecoding&&name.substr(-4)in{".ogg":1,".wav":1,".mp3":1}};audioPlugin["handle"]=function audioPlugin_handle(byteArray,name,onload,onerror){var done=false;function finish(audio){if(done)return;done=true;preloadedAudios[name]=audio;onload?.(byteArray)}var b=new Blob([byteArray],{type:Browser.getMimetype(name)});var url=URL.createObjectURL(b);var audio=new Audio;audio.addEventListener("canplaythrough",()=>finish(audio),false);audio.onerror=function audio_onerror(event){if(done)return;err(`warning: browser could not fully decode audio ${name}, trying slower base64 approach`);function encode64(data){var BASE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var PAD="=";var ret="";var leftchar=0;var leftbits=0;for(var i=0;i<data.length;i++){leftchar=leftchar<<8|data[i];leftbits+=8;while(leftbits>=6){var curr=leftchar>>leftbits-6&63;leftbits-=6;ret+=BASE[curr]}}if(leftbits==2){ret+=BASE[(leftchar&3)<<4];ret+=PAD+PAD}else if(leftbits==4){ret+=BASE[(leftchar&15)<<2];ret+=PAD}return ret}audio.src="data:audio/x-"+name.substr(-3)+";base64,"+encode64(byteArray);finish(audio)};audio.src=url;safeSetTimeout(()=>{finish(audio)},1e4)};preloadPlugins.push(audioPlugin);function pointerLockChange(){Browser.pointerLock=document["pointerLockElement"]===Module["canvas"]||document["mozPointerLockElement"]===Module["canvas"]||document["webkitPointerLockElement"]===Module["canvas"]||document["msPointerLockElement"]===Module["canvas"]}var canvas=Module["canvas"];if(canvas){canvas.requestPointerLock=canvas["requestPointerLock"]||canvas["mozRequestPointerLock"]||canvas["webkitRequestPointerLock"]||canvas["msRequestPointerLock"]||(()=>{});canvas.exitPointerLock=document["exitPointerLock"]||document["mozExitPointerLock"]||document["webkitExitPointerLock"]||document["msExitPointerLock"]||(()=>{});canvas.exitPointerLock=canvas.exitPointerLock.bind(document);document.addEventListener("pointerlockchange",pointerLockChange,false);document.addEventListener("mozpointerlockchange",pointerLockChange,false);document.addEventListener("webkitpointerlockchange",pointerLockChange,false);document.addEventListener("mspointerlockchange",pointerLockChange,false);if(Module["elementPointerLock"]){canvas.addEventListener("click",ev=>{if(!Browser.pointerLock&&Module["canvas"].requestPointerLock){Module["canvas"].requestPointerLock();ev.preventDefault()}},false)}}},createContext(canvas,useWebGL,setInModule,webGLContextAttributes){if(useWebGL&&Module.ctx&&canvas==Module.canvas)return Module.ctx;var ctx;var contextHandle;if(useWebGL){var contextAttributes={antialias:false,alpha:false,majorVersion:2};if(webGLContextAttributes){for(var attribute in webGLContextAttributes){contextAttributes[attribute]=webGLContextAttributes[attribute]}}if(typeof GL!="undefined"){contextHandle=GL.createContext(canvas,contextAttributes);if(contextHandle){ctx=GL.getContext(contextHandle).GLctx}}}else{ctx=canvas.getContext("2d")}if(!ctx)return null;if(setInModule){if(!useWebGL)assert(typeof GLctx=="undefined","cannot set in module if GLctx is used, but we are a non-GL context that would replace it");Module.ctx=ctx;if(useWebGL)GL.makeContextCurrent(contextHandle);Module.useWebGL=useWebGL;Browser.moduleContextCreatedCallbacks.forEach(callback=>callback());Browser.init()}return ctx},destroyContext(canvas,useWebGL,setInModule){},fullscreenHandlersInstalled:false,lockPointer:undefined,resizeCanvas:undefined,requestFullscreen(lockPointer,resizeCanvas){Browser.lockPointer=lockPointer;Browser.resizeCanvas=resizeCanvas;if(typeof Browser.lockPointer=="undefined")Browser.lockPointer=true;if(typeof Browser.resizeCanvas=="undefined")Browser.resizeCanvas=false;var canvas=Module["canvas"];function fullscreenChange(){Browser.isFullscreen=false;var canvasContainer=canvas.parentNode;if((document["fullscreenElement"]||document["mozFullScreenElement"]||document["msFullscreenElement"]||document["webkitFullscreenElement"]||document["webkitCurrentFullScreenElement"])===canvasContainer){canvas.exitFullscreen=Browser.exitFullscreen;if(Browser.lockPointer)canvas.requestPointerLock();Browser.isFullscreen=true;if(Browser.resizeCanvas){Browser.setFullscreenCanvasSize()}else{Browser.updateCanvasDimensions(canvas)}}else{canvasContainer.parentNode.insertBefore(canvas,canvasContainer);canvasContainer.parentNode.removeChild(canvasContainer);if(Browser.resizeCanvas){Browser.setWindowedCanvasSize()}else{Browser.updateCanvasDimensions(canvas)}}Module["onFullScreen"]?.(Browser.isFullscreen);Module["onFullscreen"]?.(Browser.isFullscreen)}if(!Browser.fullscreenHandlersInstalled){Browser.fullscreenHandlersInstalled=true;document.addEventListener("fullscreenchange",fullscreenChange,false);document.addEventListener("mozfullscreenchange",fullscreenChange,false);document.addEventListener("webkitfullscreenchange",fullscreenChange,false);document.addEventListener("MSFullscreenChange",fullscreenChange,false)}var canvasContainer=document.createElement("div");canvas.parentNode.insertBefore(canvasContainer,canvas);canvasContainer.appendChild(canvas);canvasContainer.requestFullscreen=canvasContainer["requestFullscreen"]||canvasContainer["mozRequestFullScreen"]||canvasContainer["msRequestFullscreen"]||(canvasContainer["webkitRequestFullscreen"]?()=>canvasContainer["webkitRequestFullscreen"](Element["ALLOW_KEYBOARD_INPUT"]):null)||(canvasContainer["webkitRequestFullScreen"]?()=>canvasContainer["webkitRequestFullScreen"](Element["ALLOW_KEYBOARD_INPUT"]):null);canvasContainer.requestFullscreen()},exitFullscreen(){if(!Browser.isFullscreen){return false}var CFS=document["exitFullscreen"]||document["cancelFullScreen"]||document["mozCancelFullScreen"]||document["msExitFullscreen"]||document["webkitCancelFullScreen"]||(()=>{});CFS.apply(document,[]);return true},nextRAF:0,fakeRequestAnimationFrame(func){var now=Date.now();if(Browser.nextRAF===0){Browser.nextRAF=now+1e3/60}else{while(now+2>=Browser.nextRAF){Browser.nextRAF+=1e3/60}}var delay=Math.max(Browser.nextRAF-now,0);setTimeout(func,delay)},requestAnimationFrame(func){if(typeof requestAnimationFrame=="function"){requestAnimationFrame(func);return}var RAF=Browser.fakeRequestAnimationFrame;RAF(func)},safeSetTimeout(func,timeout){return safeSetTimeout(func,timeout)},safeRequestAnimationFrame(func){return Browser.requestAnimationFrame(()=>{callUserCallback(func)})},getMimetype(name){return{"jpg":"image/jpeg","jpeg":"image/jpeg","png":"image/png","bmp":"image/bmp","ogg":"audio/ogg","wav":"audio/wav","mp3":"audio/mpeg"}[name.substr(name.lastIndexOf(".")+1)]},getUserMedia(func){window.getUserMedia||=navigator["getUserMedia"]||navigator["mozGetUserMedia"];window.getUserMedia(func)},getMovementX(event){return event["movementX"]||event["mozMovementX"]||event["webkitMovementX"]||0},getMovementY(event){return event["movementY"]||event["mozMovementY"]||event["webkitMovementY"]||0},getMouseWheelDelta(event){var delta=0;switch(event.type){case"DOMMouseScroll":delta=event.detail/3;break;case"mousewheel":delta=event.wheelDelta/120;break;case"wheel":delta=event.deltaY;switch(event.deltaMode){case 0:delta/=100;break;case 1:delta/=3;break;case 2:delta*=80;break;default:throw"unrecognized mouse wheel delta mode: "+event.deltaMode}break;default:throw"unrecognized mouse wheel event: "+event.type}return delta},mouseX:0,mouseY:0,mouseMovementX:0,mouseMovementY:0,touches:{},lastTouches:{},calculateMouseCoords(pageX,pageY){var rect=Module["canvas"].getBoundingClientRect();var cw=Module["canvas"].width;var ch=Module["canvas"].height;var scrollX=typeof window.scrollX!="undefined"?window.scrollX:window.pageXOffset;var scrollY=typeof window.scrollY!="undefined"?window.scrollY:window.pageYOffset;var adjustedX=pageX-(scrollX+rect.left);var adjustedY=pageY-(scrollY+rect.top);adjustedX=adjustedX*(cw/rect.width);adjustedY=adjustedY*(ch/rect.height);return{x:adjustedX,y:adjustedY}},setMouseCoords(pageX,pageY){const{x:x,y:y}=Browser.calculateMouseCoords(pageX,pageY);Browser.mouseMovementX=x-Browser.mouseX;Browser.mouseMovementY=y-Browser.mouseY;Browser.mouseX=x;Browser.mouseY=y},calculateMouseEvent(event){if(Browser.pointerLock){if(event.type!="mousemove"&&"mozMovementX"in event){Browser.mouseMovementX=Browser.mouseMovementY=0}else{Browser.mouseMovementX=Browser.getMovementX(event);Browser.mouseMovementY=Browser.getMovementY(event)}if(typeof SDL!="undefined"){Browser.mouseX=SDL.mouseX+Browser.mouseMovementX;Browser.mouseY=SDL.mouseY+Browser.mouseMovementY}else{Browser.mouseX+=Browser.mouseMovementX;Browser.mouseY+=Browser.mouseMovementY}}else{if(event.type==="touchstart"||event.type==="touchend"||event.type==="touchmove"){var touch=event.touch;if(touch===undefined){return}var coords=Browser.calculateMouseCoords(touch.pageX,touch.pageY);if(event.type==="touchstart"){Browser.lastTouches[touch.identifier]=coords;Browser.touches[touch.identifier]=coords}else if(event.type==="touchend"||event.type==="touchmove"){var last=Browser.touches[touch.identifier];last||=coords;Browser.lastTouches[touch.identifier]=last;Browser.touches[touch.identifier]=coords}return}Browser.setMouseCoords(event.pageX,event.pageY)}},resizeListeners:[],updateResizeListeners(){var canvas=Module["canvas"];Browser.resizeListeners.forEach(listener=>listener(canvas.width,canvas.height))},setCanvasSize(width,height,noUpdates){var canvas=Module["canvas"];Browser.updateCanvasDimensions(canvas,width,height);if(!noUpdates)Browser.updateResizeListeners()},windowedWidth:0,windowedHeight:0,setFullscreenCanvasSize(){if(typeof SDL!="undefined"){var flags=HEAPU32[SDL.screen>>>2>>>0];flags=flags|8388608;HEAP32[SDL.screen>>>2>>>0]=flags}Browser.updateCanvasDimensions(Module["canvas"]);Browser.updateResizeListeners()},setWindowedCanvasSize(){if(typeof SDL!="undefined"){var flags=HEAPU32[SDL.screen>>>2>>>0];flags=flags&~8388608;HEAP32[SDL.screen>>>2>>>0]=flags}Browser.updateCanvasDimensions(Module["canvas"]);Browser.updateResizeListeners()},updateCanvasDimensions(canvas,wNative,hNative){if(wNative&&hNative){canvas.widthNative=wNative;canvas.heightNative=hNative}else{wNative=canvas.widthNative;hNative=canvas.heightNative}var w=wNative;var h=hNative;if(Module["forcedAspectRatio"]&&Module["forcedAspectRatio"]>0){if(w/h<Module["forcedAspectRatio"]){w=Math.round(h*Module["forcedAspectRatio"])}else{h=Math.round(w/Module["forcedAspectRatio"])}}if((document["fullscreenElement"]||document["mozFullScreenElement"]||document["msFullscreenElement"]||document["webkitFullscreenElement"]||document["webkitCurrentFullScreenElement"])===canvas.parentNode&&typeof screen!="undefined"){var factor=Math.min(screen.width/w,screen.height/h);w=Math.round(w*factor);h=Math.round(h*factor)}if(Browser.resizeCanvas){if(canvas.width!=w)canvas.width=w;if(canvas.height!=h)canvas.height=h;if(typeof canvas.style!="undefined"){canvas.style.removeProperty("width");canvas.style.removeProperty("height")}}else{if(canvas.width!=wNative)canvas.width=wNative;if(canvas.height!=hNative)canvas.height=hNative;if(typeof canvas.style!="undefined"){if(w!=wNative||h!=hNative){canvas.style.setProperty("width",w+"px","important");canvas.style.setProperty("height",h+"px","important")}else{canvas.style.removeProperty("width");canvas.style.removeProperty("height")}}}}};var listenOnce=(object,event,func)=>{object.addEventListener(event,func,{"once":true})};var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var dynCallLegacy=(sig,ptr,args)=>{var f=Module["dynCall_"+sig];return args&&args.length?f.apply(null,[ptr].concat(args)):f.call(null,ptr)};var wasmTableMirror=[];var wasmTable;var getWasmTableEntry=funcPtr=>{var func=wasmTableMirror[funcPtr];if(!func){if(funcPtr>=wasmTableMirror.length)wasmTableMirror.length=funcPtr+1;wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func};var noExitRuntime=Module["noExitRuntime"]||true;var convertI32PairToI53Checked=(lo,hi)=>hi+2097152>>>0<4194305-!!lo?(lo>>>0)+hi*4294967296:NaN;function ___assert_fail(condition,filename,line,func){condition>>>=0;filename>>>=0;func>>>=0;abort(`Assertion failed: ${UTF8ToString(condition)}, at: `+[filename?UTF8ToString(filename):"unknown filename",line,func?UTF8ToString(func):"unknown function"])}function ExceptionInfo(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24;this.set_type=function(type){HEAPU32[this.ptr+4>>>2>>>0]=type};this.get_type=function(){return HEAPU32[this.ptr+4>>>2>>>0]};this.set_destructor=function(destructor){HEAPU32[this.ptr+8>>>2>>>0]=destructor};this.get_destructor=function(){return HEAPU32[this.ptr+8>>>2>>>0]};this.set_caught=function(caught){caught=caught?1:0;HEAP8[this.ptr+12>>>0>>>0]=caught};this.get_caught=function(){return HEAP8[this.ptr+12>>>0>>>0]!=0};this.set_rethrown=function(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13>>>0>>>0]=rethrown};this.get_rethrown=function(){return HEAP8[this.ptr+13>>>0>>>0]!=0};this.init=function(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor)};this.set_adjusted_ptr=function(adjustedPtr){HEAPU32[this.ptr+16>>>2>>>0]=adjustedPtr};this.get_adjusted_ptr=function(){return HEAPU32[this.ptr+16>>>2>>>0]};this.get_exception_ptr=function(){var isPointer=___cxa_is_pointer_type(this.get_type());if(isPointer){return HEAPU32[this.excPtr>>>2>>>0]}var adjusted=this.get_adjusted_ptr();if(adjusted!==0)return adjusted;return this.excPtr}}var exceptionLast=0;var uncaughtExceptionCount=0;function ___cxa_throw(ptr,type,destructor){ptr>>>=0;type>>>=0;destructor>>>=0;var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;uncaughtExceptionCount++;throw exceptionLast}var setErrNo=value=>{HEAP32[___errno_location()>>>2>>>0]=value;return value};function ___syscall_fcntl64(fd,cmd,varargs){varargs>>>=0;SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=SYSCALLS.get();if(arg<0){return-28}while(FS.streams[arg]){arg++}var newStream;newStream=FS.createStream(stream,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=SYSCALLS.get();stream.flags|=arg;return 0}case 5:{var arg=SYSCALLS.getp();var offset=0;HEAP16[arg+offset>>>1>>>0]=2;return 0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:setErrNo(28);return-1;default:{return-28}}}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_fstat64(fd,buf){buf>>>=0;try{var stream=SYSCALLS.getStreamFromFD(fd);return SYSCALLS.doStat(FS.stat,stream.path,buf)}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_ioctl(fd,op,varargs){varargs>>>=0;SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(op){case 21509:{if(!stream.tty)return-59;return 0}case 21505:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tcgets){var termios=stream.tty.ops.ioctl_tcgets(stream);var argp=SYSCALLS.getp();HEAP32[argp>>>2>>>0]=termios.c_iflag||0;HEAP32[argp+4>>>2>>>0]=termios.c_oflag||0;HEAP32[argp+8>>>2>>>0]=termios.c_cflag||0;HEAP32[argp+12>>>2>>>0]=termios.c_lflag||0;for(var i=0;i<32;i++){HEAP8[argp+i+17>>>0>>>0]=termios.c_cc[i]||0}return 0}return 0}case 21510:case 21511:case 21512:{if(!stream.tty)return-59;return 0}case 21506:case 21507:case 21508:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tcsets){var argp=SYSCALLS.getp();var c_iflag=HEAP32[argp>>>2>>>0];var c_oflag=HEAP32[argp+4>>>2>>>0];var c_cflag=HEAP32[argp+8>>>2>>>0];var c_lflag=HEAP32[argp+12>>>2>>>0];var c_cc=[];for(var i=0;i<32;i++){c_cc.push(HEAP8[argp+i+17>>>0>>>0])}return stream.tty.ops.ioctl_tcsets(stream.tty,op,{c_iflag:c_iflag,c_oflag:c_oflag,c_cflag:c_cflag,c_lflag:c_lflag,c_cc:c_cc})}return 0}case 21519:{if(!stream.tty)return-59;var argp=SYSCALLS.getp();HEAP32[argp>>>2>>>0]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21531:{var argp=SYSCALLS.getp();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tiocgwinsz){var winsize=stream.tty.ops.ioctl_tiocgwinsz(stream.tty);var argp=SYSCALLS.getp();HEAP16[argp>>>1>>>0]=winsize[0];HEAP16[argp+2>>>1>>>0]=winsize[1]}return 0}case 21524:{if(!stream.tty)return-59;return 0}case 21515:{if(!stream.tty)return-59;return 0}default:return-28}}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_lstat64(path,buf){path>>>=0;buf>>>=0;try{path=SYSCALLS.getStr(path);return SYSCALLS.doStat(FS.lstat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_mkdirat(dirfd,path,mode){path>>>=0;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);path=PATH.normalize(path);if(path[path.length-1]==="/")path=path.substr(0,path.length-1);FS.mkdir(path,mode,0);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_newfstatat(dirfd,path,buf,flags){path>>>=0;buf>>>=0;try{path=SYSCALLS.getStr(path);var nofollow=flags&256;var allowEmpty=flags&4096;flags=flags&~6400;path=SYSCALLS.calculateAt(dirfd,path,allowEmpty);return SYSCALLS.doStat(nofollow?FS.lstat:FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_openat(dirfd,path,flags,varargs){path>>>=0;varargs>>>=0;SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?SYSCALLS.get():0;return FS.open(path,flags,mode).fd}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_stat64(path,buf){path>>>=0;buf>>>=0;try{path=SYSCALLS.getStr(path);return SYSCALLS.doStat(FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var nowIsMonotonic=1;var __emscripten_get_now_is_monotonic=()=>nowIsMonotonic;var __emscripten_throw_longjmp=()=>{throw Infinity};var _abort=()=>{abort("")};var EGL={errorCode:12288,defaultDisplayInitialized:false,currentContext:0,currentReadSurface:0,currentDrawSurface:0,contextAttributes:{alpha:false,depth:false,stencil:false,antialias:false},stringCache:{},setErrorCode(code){EGL.errorCode=code},chooseConfig(display,attribList,config,config_size,numConfigs){if(display!=62e3){EGL.setErrorCode(12296);return 0}if(attribList){for(;;){var param=HEAP32[attribList>>>2>>>0];if(param==12321){var alphaSize=HEAP32[attribList+4>>>2>>>0];EGL.contextAttributes.alpha=alphaSize>0}else if(param==12325){var depthSize=HEAP32[attribList+4>>>2>>>0];EGL.contextAttributes.depth=depthSize>0}else if(param==12326){var stencilSize=HEAP32[attribList+4>>>2>>>0];EGL.contextAttributes.stencil=stencilSize>0}else if(param==12337){var samples=HEAP32[attribList+4>>>2>>>0];EGL.contextAttributes.antialias=samples>0}else if(param==12338){var samples=HEAP32[attribList+4>>>2>>>0];EGL.contextAttributes.antialias=samples==1}else if(param==12544){var requestedPriority=HEAP32[attribList+4>>>2>>>0];EGL.contextAttributes.lowLatency=requestedPriority!=12547}else if(param==12344){break}attribList+=8}}if((!config||!config_size)&&!numConfigs){EGL.setErrorCode(12300);return 0}if(numConfigs){HEAP32[numConfigs>>>2>>>0]=1}if(config&&config_size>0){HEAPU32[config>>>2>>>0]=62002}EGL.setErrorCode(12288);return 1}};function _eglChooseConfig(display,attrib_list,configs,config_size,numConfigs){display>>>=0;attrib_list>>>=0;configs>>>=0;numConfigs>>>=0;return EGL.chooseConfig(display,attrib_list,configs,config_size,numConfigs)}var webgl_enable_WEBGL_draw_instanced_base_vertex_base_instance=ctx=>!!(ctx.dibvbi=ctx.getExtension("WEBGL_draw_instanced_base_vertex_base_instance"));var webgl_enable_WEBGL_multi_draw_instanced_base_vertex_base_instance=ctx=>!!(ctx.mdibvbi=ctx.getExtension("WEBGL_multi_draw_instanced_base_vertex_base_instance"));var webgl_enable_WEBGL_multi_draw=ctx=>!!(ctx.multiDrawWebgl=ctx.getExtension("WEBGL_multi_draw"));var GL={counter:1,buffers:[],programs:[],framebuffers:[],renderbuffers:[],textures:[],shaders:[],vaos:[],contexts:[],offscreenCanvases:{},queries:[],samplers:[],transformFeedbacks:[],syncs:[],stringCache:{},stringiCache:{},unpackAlignment:4,recordError:function recordError(errorCode){if(!GL.lastError){GL.lastError=errorCode}},getNewId:table=>{var ret=GL.counter++;for(var i=table.length;i<ret;i++){table[i]=null}return ret},getSource:(shader,count,string,length)=>{var source="";for(var i=0;i<count;++i){var len=length?HEAP32[length+i*4>>>2>>>0]:-1;source+=UTF8ToString(HEAP32[string+i*4>>>2>>>0],len<0?undefined:len)}return source},createContext:(canvas,webGLContextAttributes)=>{if(!canvas.getContextSafariWebGL2Fixed){canvas.getContextSafariWebGL2Fixed=canvas.getContext;function fixedGetContext(ver,attrs){var gl=canvas.getContextSafariWebGL2Fixed(ver,attrs);return ver=="webgl"==gl instanceof WebGLRenderingContext?gl:null}canvas.getContext=fixedGetContext}var ctx=canvas.getContext("webgl2",webGLContextAttributes);if(!ctx)return 0;var handle=GL.registerContext(ctx,webGLContextAttributes);var _allSupportedExtensions=ctx.getSupportedExtensions;var supportedExtensionsForGetProcAddress=["EXT_color_buffer_float","EXT_disjoint_timer_query_webgl2","EXT_texture_norm16","WEBGL_clip_cull_distance","EXT_color_buffer_half_float","EXT_float_blend","EXT_texture_compression_bptc","EXT_texture_compression_rgtc","EXT_texture_filter_anisotropic","KHR_parallel_shader_compile","OES_texture_float_linear","WEBGL_compressed_texture_s3tc","WEBGL_compressed_texture_s3tc_srgb","WEBGL_debug_renderer_info","WEBGL_debug_shaders","WEBGL_lose_context","WEBGL_multi_draw"];ctx.getSupportedExtensions=function(){return(_allSupportedExtensions.apply(this)||[]).filter(ext=>supportedExtensionsForGetProcAddress.includes(ext))};return handle},registerContext:(ctx,webGLContextAttributes)=>{var handle=GL.getNewId(GL.contexts);var context={handle:handle,attributes:webGLContextAttributes,version:webGLContextAttributes.majorVersion,GLctx:ctx};if(ctx.canvas)ctx.canvas.GLctxObject=context;GL.contexts[handle]=context;if(typeof webGLContextAttributes.enableExtensionsByDefault=="undefined"||webGLContextAttributes.enableExtensionsByDefault){GL.initExtensions(context)}return handle},makeContextCurrent:contextHandle=>{GL.currentContext=GL.contexts[contextHandle];Module.ctx=GLctx=GL.currentContext?.GLctx;return!(contextHandle&&!GLctx)},getContext:contextHandle=>GL.contexts[contextHandle],deleteContext:contextHandle=>{if(GL.currentContext===GL.contexts[contextHandle]){GL.currentContext=null}if(typeof JSEvents=="object"){JSEvents.removeAllHandlersOnTarget(GL.contexts[contextHandle].GLctx.canvas)}if(GL.contexts[contextHandle]&&GL.contexts[contextHandle].GLctx.canvas){GL.contexts[contextHandle].GLctx.canvas.GLctxObject=undefined}GL.contexts[contextHandle]=null},initExtensions:context=>{context||=GL.currentContext;if(context.initExtensionsDone)return;context.initExtensionsDone=true;var GLctx=context.GLctx;webgl_enable_WEBGL_draw_instanced_base_vertex_base_instance(GLctx);webgl_enable_WEBGL_multi_draw_instanced_base_vertex_base_instance(GLctx);if(context.version>=2){GLctx.disjointTimerQueryExt=GLctx.getExtension("EXT_disjoint_timer_query_webgl2")}if(context.version<2||!GLctx.disjointTimerQueryExt){GLctx.disjointTimerQueryExt=GLctx.getExtension("EXT_disjoint_timer_query")}webgl_enable_WEBGL_multi_draw(GLctx);var exts=GLctx.getSupportedExtensions()||[];exts.forEach(ext=>{if(!ext.includes("lose_context")&&!ext.includes("debug")){GLctx.getExtension(ext)}})},getExtensions(){var exts=GLctx.getSupportedExtensions()||[];exts=exts.concat(exts.map(e=>"GL_"+e));return exts}};function _eglCreateContext(display,config,hmm,contextAttribs){display>>>=0;config>>>=0;hmm>>>=0;contextAttribs>>>=0;if(display!=62e3){EGL.setErrorCode(12296);return 0}var glesContextVersion=1;for(;;){var param=HEAP32[contextAttribs>>>2>>>0];if(param==12440){glesContextVersion=HEAP32[contextAttribs+4>>>2>>>0]}else if(param==12344){break}else{EGL.setErrorCode(12292);return 0}contextAttribs+=8}if(glesContextVersion<2||glesContextVersion>3){EGL.setErrorCode(12293);return 0}EGL.contextAttributes.majorVersion=glesContextVersion-1;EGL.contextAttributes.minorVersion=0;EGL.context=GL.createContext(Module["canvas"],EGL.contextAttributes);if(EGL.context!=0){EGL.setErrorCode(12288);GL.makeContextCurrent(EGL.context);Module.useWebGL=true;Browser.moduleContextCreatedCallbacks.forEach(function(callback){callback()});GL.makeContextCurrent(null);return 62004}else{EGL.setErrorCode(12297);return 0}}function _eglCreateWindowSurface(display,config,win,attrib_list){display>>>=0;config>>>=0;attrib_list>>>=0;if(display!=62e3){EGL.setErrorCode(12296);return 0}if(config!=62002){EGL.setErrorCode(12293);return 0}EGL.setErrorCode(12288);return 62006}function _eglDestroyContext(display,context){display>>>=0;context>>>=0;if(display!=62e3){EGL.setErrorCode(12296);return 0}if(context!=62004){EGL.setErrorCode(12294);return 0}GL.deleteContext(EGL.context);EGL.setErrorCode(12288);if(EGL.currentContext==context){EGL.currentContext=0}return 1}function _eglDestroySurface(display,surface){display>>>=0;surface>>>=0;if(display!=62e3){EGL.setErrorCode(12296);return 0}if(surface!=62006){EGL.setErrorCode(12301);return 1}if(EGL.currentReadSurface==surface){EGL.currentReadSurface=0}if(EGL.currentDrawSurface==surface){EGL.currentDrawSurface=0}EGL.setErrorCode(12288);return 1}function _eglGetDisplay(nativeDisplayType){nativeDisplayType>>>=0;EGL.setErrorCode(12288);if(nativeDisplayType!=0&&nativeDisplayType!=1){return 0}return 62e3}function _eglInitialize(display,majorVersion,minorVersion){display>>>=0;majorVersion>>>=0;minorVersion>>>=0;if(display!=62e3){EGL.setErrorCode(12296);return 0}if(majorVersion){HEAP32[majorVersion>>>2>>>0]=1}if(minorVersion){HEAP32[minorVersion>>>2>>>0]=4}EGL.defaultDisplayInitialized=true;EGL.setErrorCode(12288);return 1}function _eglMakeCurrent(display,draw,read,context){display>>>=0;draw>>>=0;read>>>=0;context>>>=0;if(display!=62e3){EGL.setErrorCode(12296);return 0}if(context!=0&&context!=62004){EGL.setErrorCode(12294);return 0}if(read!=0&&read!=62006||draw!=0&&draw!=62006){EGL.setErrorCode(12301);return 0}GL.makeContextCurrent(context?EGL.context:null);EGL.currentContext=context;EGL.currentDrawSurface=draw;EGL.currentReadSurface=read;EGL.setErrorCode(12288);return 1}function _eglSwapBuffers(dpy,surface){dpy>>>=0;surface>>>=0;if(Browser.doSwapBuffers)Browser.doSwapBuffers();if(!EGL.defaultDisplayInitialized){EGL.setErrorCode(12289)}else if(!Module.ctx){EGL.setErrorCode(12290)}else if(Module.ctx.isContextLost()){EGL.setErrorCode(12302)}else{EGL.setErrorCode(12288);return 1}return 0}function _eglSwapInterval(display,interval){display>>>=0;if(display!=62e3){EGL.setErrorCode(12296);return 0}if(interval==0)_emscripten_set_main_loop_timing(0,0);else _emscripten_set_main_loop_timing(1,interval);EGL.setErrorCode(12288);return 1}function _eglTerminate(display){display>>>=0;if(display!=62e3){EGL.setErrorCode(12296);return 0}EGL.currentContext=0;EGL.currentReadSurface=0;EGL.currentDrawSurface=0;EGL.defaultDisplayInitialized=false;EGL.setErrorCode(12288);return 1}var readEmAsmArgsArray=[];var readEmAsmArgs=(sigPtr,buf)=>{readEmAsmArgsArray.length=0;var ch;while(ch=HEAPU8[sigPtr++>>>0]){var wide=ch!=105;wide&=ch!=112;buf+=wide&&buf%8?4:0;readEmAsmArgsArray.push(ch==112?HEAPU32[buf>>>2>>>0]:ch==105?HEAP32[buf>>>2>>>0]:HEAPF64[buf>>>3>>>0]);buf+=wide?8:4}return readEmAsmArgsArray};var runEmAsmFunction=(code,sigPtr,argbuf)=>{var args=readEmAsmArgs(sigPtr,argbuf);return ASM_CONSTS[code].apply(null,args)};function _emscripten_asm_const_int(code,sigPtr,argbuf){code>>>=0;sigPtr>>>=0;argbuf>>>=0;return runEmAsmFunction(code,sigPtr,argbuf)}function _emscripten_asm_const_ptr(code,sigPtr,argbuf){code>>>=0;sigPtr>>>=0;argbuf>>>=0;return runEmAsmFunction(code,sigPtr,argbuf)}var _emscripten_cancel_main_loop=()=>{Browser.mainLoop.pause();Browser.mainLoop.func=null};var _emscripten_date_now=()=>Date.now();var JSEvents={inEventHandler:0,removeAllEventListeners(){for(var i=JSEvents.eventHandlers.length-1;i>=0;--i){JSEvents._removeHandler(i)}JSEvents.eventHandlers=[];JSEvents.deferredCalls=[]},registerRemoveEventListeners(){if(!JSEvents.removeEventListenersRegistered){__ATEXIT__.push(JSEvents.removeAllEventListeners);JSEvents.removeEventListenersRegistered=true}},deferredCalls:[],deferCall(targetFunction,precedence,argsList){function arraysHaveEqualContent(arrA,arrB){if(arrA.length!=arrB.length)return false;for(var i in arrA){if(arrA[i]!=arrB[i])return false}return true}for(var i in JSEvents.deferredCalls){var call=JSEvents.deferredCalls[i];if(call.targetFunction==targetFunction&&arraysHaveEqualContent(call.argsList,argsList)){return}}JSEvents.deferredCalls.push({targetFunction:targetFunction,precedence:precedence,argsList:argsList});JSEvents.deferredCalls.sort((x,y)=>x.precedence<y.precedence)},removeDeferredCalls(targetFunction){for(var i=0;i<JSEvents.deferredCalls.length;++i){if(JSEvents.deferredCalls[i].targetFunction==targetFunction){JSEvents.deferredCalls.splice(i,1);--i}}},canPerformEventHandlerRequests(){if(navigator.userActivation){return navigator.userActivation.isActive}return JSEvents.inEventHandler&&JSEvents.currentEventHandler.allowsDeferredCalls},runDeferredCalls(){if(!JSEvents.canPerformEventHandlerRequests()){return}for(var i=0;i<JSEvents.deferredCalls.length;++i){var call=JSEvents.deferredCalls[i];JSEvents.deferredCalls.splice(i,1);--i;call.targetFunction.apply(null,call.argsList)}},eventHandlers:[],removeAllHandlersOnTarget:(target,eventTypeString)=>{for(var i=0;i<JSEvents.eventHandlers.length;++i){if(JSEvents.eventHandlers[i].target==target&&(!eventTypeString||eventTypeString==JSEvents.eventHandlers[i].eventTypeString)){JSEvents._removeHandler(i--)}}},_removeHandler(i){var h=JSEvents.eventHandlers[i];h.target.removeEventListener(h.eventTypeString,h.eventListenerFunc,h.useCapture);JSEvents.eventHandlers.splice(i,1)},registerOrRemoveHandler(eventHandler){if(!eventHandler.target){return-4}var jsEventHandler=function jsEventHandler(event){++JSEvents.inEventHandler;JSEvents.currentEventHandler=eventHandler;JSEvents.runDeferredCalls();eventHandler.handlerFunc(event);JSEvents.runDeferredCalls();--JSEvents.inEventHandler};if(eventHandler.callbackfunc){eventHandler.eventListenerFunc=jsEventHandler;eventHandler.target.addEventListener(eventHandler.eventTypeString,jsEventHandler,eventHandler.useCapture);JSEvents.eventHandlers.push(eventHandler);JSEvents.registerRemoveEventListeners()}else{for(var i=0;i<JSEvents.eventHandlers.length;++i){if(JSEvents.eventHandlers[i].target==eventHandler.target&&JSEvents.eventHandlers[i].eventTypeString==eventHandler.eventTypeString){JSEvents._removeHandler(i--)}}}return 0},getNodeNameForTarget(target){if(!target)return"";if(target==window)return"#window";if(target==screen)return"#screen";return target?.nodeName||""},fullscreenEnabled(){return document.fullscreenEnabled||document.webkitFullscreenEnabled}};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);var fillGamepadEventData=(eventStruct,e)=>{HEAPF64[eventStruct>>>3>>>0]=e.timestamp;for(var i=0;i<e.axes.length;++i){HEAPF64[eventStruct+i*8+16>>>3>>>0]=e.axes[i]}for(var i=0;i<e.buttons.length;++i){if(typeof e.buttons[i]=="object"){HEAPF64[eventStruct+i*8+528>>>3>>>0]=e.buttons[i].value}else{HEAPF64[eventStruct+i*8+528>>>3>>>0]=e.buttons[i]}}for(var i=0;i<e.buttons.length;++i){if(typeof e.buttons[i]=="object"){HEAP32[eventStruct+i*4+1040>>>2>>>0]=e.buttons[i].pressed}else{HEAP32[eventStruct+i*4+1040>>>2>>>0]=e.buttons[i]==1}}HEAP32[eventStruct+1296>>>2>>>0]=e.connected;HEAP32[eventStruct+1300>>>2>>>0]=e.index;HEAP32[eventStruct+8>>>2>>>0]=e.axes.length;HEAP32[eventStruct+12>>>2>>>0]=e.buttons.length;stringToUTF8(e.id,eventStruct+1304,64);stringToUTF8(e.mapping,eventStruct+1368,64)};function _emscripten_get_gamepad_status(index,gamepadState){gamepadState>>>=0;if(index<0||index>=JSEvents.lastGamepadState.length)return-5;if(!JSEvents.lastGamepadState[index])return-7;fillGamepadEventData(gamepadState,JSEvents.lastGamepadState[index]);return 0}function _emscripten_memcpy_js(dest,src,num){dest>>>=0;src>>>=0;num>>>=0;return HEAPU8.copyWithin(dest>>>0,src>>>0,src+num>>>0)}var getHeapMax=()=>4294901760;var growMemory=size=>{var b=wasmMemory.buffer;var pages=(size-b.byteLength+65535)/65536;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};function _emscripten_resize_heap(requestedSize){requestedSize>>>=0;var oldSize=HEAPU8.length;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}var alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false}var disableGamepadApiIfItThrows=()=>{try{navigator.getGamepads()}catch(e){navigator.getGamepads=null;return 1}};var _emscripten_sample_gamepad_data=()=>{if(!navigator.getGamepads||disableGamepadApiIfItThrows())return-1;return(JSEvents.lastGamepadState=navigator.getGamepads())?0:-1};var maybeCStringToJsString=cString=>cString>2?UTF8ToString(cString):cString;var specialHTMLTargets=[0,typeof document!="undefined"?document:0,typeof window!="undefined"?window:0];var findEventTarget=target=>{target=maybeCStringToJsString(target);var domElement=specialHTMLTargets[target]||(typeof document!="undefined"?document.querySelector(target):undefined);return domElement};var registerFocusEventCallback=(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread)=>{if(!JSEvents.focusEvent)JSEvents.focusEvent=_malloc(256);var focusEventHandlerFunc=(e=event)=>{var nodeName=JSEvents.getNodeNameForTarget(e.target);var id=e.target.id?e.target.id:"";var focusEvent=JSEvents.focusEvent;stringToUTF8(nodeName,focusEvent+0,128);stringToUTF8(id,focusEvent+128,128);if(getWasmTableEntry(callbackfunc)(eventTypeId,focusEvent,userData))e.preventDefault()};var eventHandler={target:findEventTarget(target),eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:focusEventHandlerFunc,useCapture:useCapture};return JSEvents.registerOrRemoveHandler(eventHandler)};function _emscripten_set_blur_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){target>>>=0;userData>>>=0;callbackfunc>>>=0;targetThread>>>=0;return registerFocusEventCallback(target,userData,useCapture,callbackfunc,12,"blur",targetThread)}var findCanvasEventTarget=target=>findEventTarget(target);function _emscripten_set_canvas_element_size(target,width,height){target>>>=0;var canvas=findCanvasEventTarget(target);if(!canvas)return-4;canvas.width=width;canvas.height=height;return 0}function _emscripten_set_focus_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){target>>>=0;userData>>>=0;callbackfunc>>>=0;targetThread>>>=0;return registerFocusEventCallback(target,userData,useCapture,callbackfunc,13,"focus",targetThread)}var registerGamepadEventCallback=(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread)=>{if(!JSEvents.gamepadEvent)JSEvents.gamepadEvent=_malloc(1432);var gamepadEventHandlerFunc=(e=event)=>{var gamepadEvent=JSEvents.gamepadEvent;fillGamepadEventData(gamepadEvent,e["gamepad"]);if(getWasmTableEntry(callbackfunc)(eventTypeId,gamepadEvent,userData))e.preventDefault()};var eventHandler={target:findEventTarget(target),allowsDeferredCalls:true,eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:gamepadEventHandlerFunc,useCapture:useCapture};return JSEvents.registerOrRemoveHandler(eventHandler)};function _emscripten_set_gamepadconnected_callback_on_thread(userData,useCapture,callbackfunc,targetThread){userData>>>=0;callbackfunc>>>=0;targetThread>>>=0;if(!navigator.getGamepads||disableGamepadApiIfItThrows())return-1;return registerGamepadEventCallback(2,userData,useCapture,callbackfunc,26,"gamepadconnected",targetThread)}function _emscripten_set_gamepaddisconnected_callback_on_thread(userData,useCapture,callbackfunc,targetThread){userData>>>=0;callbackfunc>>>=0;targetThread>>>=0;if(!navigator.getGamepads||disableGamepadApiIfItThrows())return-1;return registerGamepadEventCallback(2,userData,useCapture,callbackfunc,27,"gamepaddisconnected",targetThread)}var registerKeyEventCallback=(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread)=>{if(!JSEvents.keyEvent)JSEvents.keyEvent=_malloc(176);var keyEventHandlerFunc=e=>{var keyEventData=JSEvents.keyEvent;HEAPF64[keyEventData>>>3>>>0]=e.timeStamp;var idx=keyEventData>>>2;HEAP32[idx+2>>>0]=e.location;HEAP32[idx+3>>>0]=e.ctrlKey;HEAP32[idx+4>>>0]=e.shiftKey;HEAP32[idx+5>>>0]=e.altKey;HEAP32[idx+6>>>0]=e.metaKey;HEAP32[idx+7>>>0]=e.repeat;HEAP32[idx+8>>>0]=e.charCode;HEAP32[idx+9>>>0]=e.keyCode;HEAP32[idx+10>>>0]=e.which;stringToUTF8(e.key||"",keyEventData+44,32);stringToUTF8(e.code||"",keyEventData+76,32);stringToUTF8(e.char||"",keyEventData+108,32);stringToUTF8(e.locale||"",keyEventData+140,32);if(getWasmTableEntry(callbackfunc)(eventTypeId,keyEventData,userData))e.preventDefault()};var eventHandler={target:findEventTarget(target),eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:keyEventHandlerFunc,useCapture:useCapture};return JSEvents.registerOrRemoveHandler(eventHandler)};function _emscripten_set_keydown_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){target>>>=0;userData>>>=0;callbackfunc>>>=0;targetThread>>>=0;return registerKeyEventCallback(target,userData,useCapture,callbackfunc,2,"keydown",targetThread)}function _emscripten_set_keyup_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){target>>>=0;userData>>>=0;callbackfunc>>>=0;targetThread>>>=0;return registerKeyEventCallback(target,userData,useCapture,callbackfunc,3,"keyup",targetThread)}function _emscripten_set_main_loop(func,fps,simulateInfiniteLoop){func>>>=0;var browserIterationFunc=getWasmTableEntry(func);setMainLoop(browserIterationFunc,fps,simulateInfiniteLoop)}var getBoundingClientRect=e=>specialHTMLTargets.indexOf(e)<0?e.getBoundingClientRect():{"left":0,"top":0};var fillMouseEventData=(eventStruct,e,target)=>{HEAPF64[eventStruct>>>3>>>0]=e.timeStamp;var idx=eventStruct>>>2;HEAP32[idx+2>>>0]=e.screenX;HEAP32[idx+3>>>0]=e.screenY;HEAP32[idx+4>>>0]=e.clientX;HEAP32[idx+5>>>0]=e.clientY;HEAP32[idx+6>>>0]=e.ctrlKey;HEAP32[idx+7>>>0]=e.shiftKey;HEAP32[idx+8>>>0]=e.altKey;HEAP32[idx+9>>>0]=e.metaKey;HEAP16[idx*2+20>>>0]=e.button;HEAP16[idx*2+21>>>0]=e.buttons;HEAP32[idx+11>>>0]=e["movementX"];HEAP32[idx+12>>>0]=e["movementY"];var rect=getBoundingClientRect(target);HEAP32[idx+13>>>0]=e.clientX-rect.left;HEAP32[idx+14>>>0]=e.clientY-rect.top};var registerMouseEventCallback=(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread)=>{if(!JSEvents.mouseEvent)JSEvents.mouseEvent=_malloc(72);target=findEventTarget(target);var mouseEventHandlerFunc=(e=event)=>{fillMouseEventData(JSEvents.mouseEvent,e,target);if(getWasmTableEntry(callbackfunc)(eventTypeId,JSEvents.mouseEvent,userData))e.preventDefault()};var eventHandler={target:target,allowsDeferredCalls:eventTypeString!="mousemove"&&eventTypeString!="mouseenter"&&eventTypeString!="mouseleave",eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:mouseEventHandlerFunc,useCapture:useCapture};return JSEvents.registerOrRemoveHandler(eventHandler)};function _emscripten_set_mousedown_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){target>>>=0;userData>>>=0;callbackfunc>>>=0;targetThread>>>=0;return registerMouseEventCallback(target,userData,useCapture,callbackfunc,5,"mousedown",targetThread)}function _emscripten_set_mousemove_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){target>>>=0;userData>>>=0;callbackfunc>>>=0;targetThread>>>=0;return registerMouseEventCallback(target,userData,useCapture,callbackfunc,8,"mousemove",targetThread)}function _emscripten_set_mouseup_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){target>>>=0;userData>>>=0;callbackfunc>>>=0;targetThread>>>=0;return registerMouseEventCallback(target,userData,useCapture,callbackfunc,6,"mouseup",targetThread)}var registerTouchEventCallback=(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread)=>{if(!JSEvents.touchEvent)JSEvents.touchEvent=_malloc(1696);target=findEventTarget(target);var touchEventHandlerFunc=e=>{var t,touches={},et=e.touches;for(var i=0;i<et.length;++i){t=et[i];t.isChanged=t.onTarget=0;touches[t.identifier]=t}for(var i=0;i<e.changedTouches.length;++i){t=e.changedTouches[i];t.isChanged=1;touches[t.identifier]=t}for(var i=0;i<e.targetTouches.length;++i){touches[e.targetTouches[i].identifier].onTarget=1}var touchEvent=JSEvents.touchEvent;HEAPF64[touchEvent>>>3>>>0]=e.timeStamp;var idx=touchEvent>>>2;HEAP32[idx+3>>>0]=e.ctrlKey;HEAP32[idx+4>>>0]=e.shiftKey;HEAP32[idx+5>>>0]=e.altKey;HEAP32[idx+6>>>0]=e.metaKey;idx+=7;var targetRect=getBoundingClientRect(target);var numTouches=0;for(var i in touches){t=touches[i];HEAP32[idx+0>>>0]=t.identifier;HEAP32[idx+1>>>0]=t.screenX;HEAP32[idx+2>>>0]=t.screenY;HEAP32[idx+3>>>0]=t.clientX;HEAP32[idx+4>>>0]=t.clientY;HEAP32[idx+5>>>0]=t.pageX;HEAP32[idx+6>>>0]=t.pageY;HEAP32[idx+7>>>0]=t.isChanged;HEAP32[idx+8>>>0]=t.onTarget;HEAP32[idx+9>>>0]=t.clientX-targetRect.left;HEAP32[idx+10>>>0]=t.clientY-targetRect.top;idx+=13;if(++numTouches>31){break}}HEAP32[touchEvent+8>>>2>>>0]=numTouches;if(getWasmTableEntry(callbackfunc)(eventTypeId,touchEvent,userData))e.preventDefault()};var eventHandler={target:target,allowsDeferredCalls:eventTypeString=="touchstart"||eventTypeString=="touchend",eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:touchEventHandlerFunc,useCapture:useCapture};return JSEvents.registerOrRemoveHandler(eventHandler)};function _emscripten_set_touchend_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){target>>>=0;userData>>>=0;callbackfunc>>>=0;targetThread>>>=0;return registerTouchEventCallback(target,userData,useCapture,callbackfunc,23,"touchend",targetThread)}function _emscripten_set_touchmove_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){target>>>=0;userData>>>=0;callbackfunc>>>=0;targetThread>>>=0;return registerTouchEventCallback(target,userData,useCapture,callbackfunc,24,"touchmove",targetThread)}function _emscripten_set_touchstart_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){target>>>=0;userData>>>=0;callbackfunc>>>=0;targetThread>>>=0;return registerTouchEventCallback(target,userData,useCapture,callbackfunc,22,"touchstart",targetThread)}var registerWheelEventCallback=(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread)=>{if(!JSEvents.wheelEvent)JSEvents.wheelEvent=_malloc(104);var wheelHandlerFunc=(e=event)=>{var wheelEvent=JSEvents.wheelEvent;fillMouseEventData(wheelEvent,e,target);HEAPF64[wheelEvent+72>>>3>>>0]=e["deltaX"];HEAPF64[wheelEvent+80>>>3>>>0]=e["deltaY"];HEAPF64[wheelEvent+88>>>3>>>0]=e["deltaZ"];HEAP32[wheelEvent+96>>>2>>>0]=e["deltaMode"];if(getWasmTableEntry(callbackfunc)(eventTypeId,wheelEvent,userData))e.preventDefault()};var eventHandler={target:target,allowsDeferredCalls:true,eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:wheelHandlerFunc,useCapture:useCapture};return JSEvents.registerOrRemoveHandler(eventHandler)};function _emscripten_set_wheel_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){target>>>=0;userData>>>=0;callbackfunc>>>=0;targetThread>>>=0;target=findEventTarget(target);if(!target)return-4;if(typeof target.onwheel!="undefined"){return registerWheelEventCallback(target,userData,useCapture,callbackfunc,9,"wheel",targetThread)}else{return-1}}function _emscripten_set_window_title(title){title>>>=0;return document.title=UTF8ToString(title)}var ENV={};var getExecutableName=()=>thisProgram||"./this.program";var getEnvStrings=()=>{if(!getEnvStrings.strings){var lang=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8";var env={"USER":"web_user","LOGNAME":"web_user","PATH":"/","PWD":"/","HOME":"/home/web_user","LANG":lang,"_":getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(`${x}=${env[x]}`)}getEnvStrings.strings=strings}return getEnvStrings.strings};var stringToAscii=(str,buffer)=>{for(var i=0;i<str.length;++i){HEAP8[buffer++>>>0>>>0]=str.charCodeAt(i)}HEAP8[buffer>>>0>>>0]=0};var _environ_get=function(__environ,environ_buf){__environ>>>=0;environ_buf>>>=0;var bufSize=0;getEnvStrings().forEach((string,i)=>{var ptr=environ_buf+bufSize;HEAPU32[__environ+i*4>>>2>>>0]=ptr;stringToAscii(string,ptr);bufSize+=string.length+1});return 0};var _environ_sizes_get=function(penviron_count,penviron_buf_size){penviron_count>>>=0;penviron_buf_size>>>=0;var strings=getEnvStrings();HEAPU32[penviron_count>>>2>>>0]=strings.length;var bufSize=0;strings.forEach(string=>bufSize+=string.length+1);HEAPU32[penviron_buf_size>>>2>>>0]=bufSize;return 0};function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var doReadv=(stream,iov,iovcnt,offset)=>{var ret=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>>2>>>0];var len=HEAPU32[iov+4>>>2>>>0];iov+=8;var curr=FS.read(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr<len)break;if(typeof offset!=="undefined"){offset+=curr}}return ret};function _fd_read(fd,iov,iovcnt,pnum){iov>>>=0;iovcnt>>>=0;pnum>>>=0;try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doReadv(stream,iov,iovcnt);HEAPU32[pnum>>>2>>>0]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){var offset=convertI32PairToI53Checked(offset_low,offset_high);newOffset>>>=0;try{if(isNaN(offset))return 61;var stream=SYSCALLS.getStreamFromFD(fd);FS.llseek(stream,offset,whence);tempI64=[stream.position>>>0,(tempDouble=stream.position,+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[newOffset>>>2>>>0]=tempI64[0],HEAP32[newOffset+4>>>2>>>0]=tempI64[1];if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var doWritev=(stream,iov,iovcnt,offset)=>{var ret=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>>2>>>0];var len=HEAPU32[iov+4>>>2>>>0];iov+=8;var curr=FS.write(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(typeof offset!=="undefined"){offset+=curr}}return ret};function _fd_write(fd,iov,iovcnt,pnum){iov>>>=0;iovcnt>>>=0;pnum>>>=0;try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doWritev(stream,iov,iovcnt);HEAPU32[pnum>>>2>>>0]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}function _getentropy(buffer,size){buffer>>>=0;size>>>=0;randomFill(HEAPU8.subarray(buffer>>>0,buffer+size>>>0));return 0}var _glAttachShader=(program,shader)=>{GLctx.attachShader(GL.programs[program],GL.shaders[shader])};var _glBindBuffer=(target,buffer)=>{if(target==35051){GLctx.currentPixelPackBufferBinding=buffer}else if(target==35052){GLctx.currentPixelUnpackBufferBinding=buffer}GLctx.bindBuffer(target,GL.buffers[buffer])};var _glBindTexture=(target,texture)=>{GLctx.bindTexture(target,GL.textures[texture])};var _glBindVertexArray=vao=>{GLctx.bindVertexArray(GL.vaos[vao])};var _glBindVertexArrayOES=_glBindVertexArray;function _glBlendFunc(x0,x1){GLctx.blendFunc(x0,x1)}function _glBufferData(target,size,data,usage){size>>>=0;data>>>=0;if(true){if(data&&size){GLctx.bufferData(target,HEAPU8,usage,data,size)}else{GLctx.bufferData(target,size,usage)}}else{GLctx.bufferData(target,data?HEAPU8.subarray(data>>>0,data+size>>>0):size,usage)}}function _glClear(x0){GLctx.clear(x0)}function _glClearColor(x0,x1,x2,x3){GLctx.clearColor(x0,x1,x2,x3)}var _glCompileShader=shader=>{GLctx.compileShader(GL.shaders[shader])};var _glCreateProgram=()=>{var id=GL.getNewId(GL.programs);var program=GLctx.createProgram();program.name=id;program.maxUniformLength=program.maxAttributeLength=program.maxUniformBlockNameLength=0;program.uniformIdCounter=1;GL.programs[id]=program;return id};var _glCreateShader=shaderType=>{var id=GL.getNewId(GL.shaders);GL.shaders[id]=GLctx.createShader(shaderType);return id};var _glDeleteProgram=id=>{if(!id)return;var program=GL.programs[id];if(!program){GL.recordError(1281);return}GLctx.deleteProgram(program);program.name=0;GL.programs[id]=null};var _glDeleteShader=id=>{if(!id)return;var shader=GL.shaders[id];if(!shader){GL.recordError(1281);return}GLctx.deleteShader(shader);GL.shaders[id]=null};function _glDeleteTextures(n,textures){textures>>>=0;for(var i=0;i<n;i++){var id=HEAP32[textures+i*4>>>2>>>0];var texture=GL.textures[id];if(!texture)continue;GLctx.deleteTexture(texture);texture.name=0;GL.textures[id]=null}}var _glDrawArrays=(mode,first,count)=>{GLctx.drawArrays(mode,first,count)};function _glEnable(x0){GLctx.enable(x0)}var _glEnableVertexAttribArray=index=>{GLctx.enableVertexAttribArray(index)};var __glGenObject=(n,buffers,createFunction,objectTable)=>{for(var i=0;i<n;i++){var buffer=GLctx[createFunction]();var id=buffer&&GL.getNewId(objectTable);if(buffer){buffer.name=id;objectTable[id]=buffer}else{GL.recordError(1282)}HEAP32[buffers+i*4>>>2>>>0]=id}};function _glGenBuffers(n,buffers){buffers>>>=0;__glGenObject(n,buffers,"createBuffer",GL.buffers)}function _glGenTextures(n,textures){textures>>>=0;__glGenObject(n,textures,"createTexture",GL.textures)}function _glGenVertexArrays(n,arrays){arrays>>>=0;__glGenObject(n,arrays,"createVertexArray",GL.vaos)}var _glGenVertexArraysOES=_glGenVertexArrays;function _glGetShaderInfoLog(shader,maxLength,length,infoLog){length>>>=0;infoLog>>>=0;var log=GLctx.getShaderInfoLog(GL.shaders[shader]);if(log===null)log="(unknown error)";var numBytesWrittenExclNull=maxLength>0&&infoLog?stringToUTF8(log,infoLog,maxLength):0;if(length)HEAP32[length>>>2>>>0]=numBytesWrittenExclNull}var _glLinkProgram=program=>{program=GL.programs[program];GLctx.linkProgram(program);program.uniformLocsById=0;program.uniformSizeAndIdsByName={}};var computeUnpackAlignedImageSize=(width,height,sizePerPixel,alignment)=>{function roundedToNextMultipleOf(x,y){return x+y-1&-y}var plainRowSize=width*sizePerPixel;var alignedRowSize=roundedToNextMultipleOf(plainRowSize,alignment);return height*alignedRowSize};var colorChannelsInGlTextureFormat=format=>{var colorChannels={5:3,6:4,8:2,29502:3,29504:4,26917:2,26918:2,29846:3,29847:4};return colorChannels[format-6402]||1};var heapObjectForWebGLType=type=>{type-=5120;if(type==0)return HEAP8;if(type==1)return HEAPU8;if(type==2)return HEAP16;if(type==4)return HEAP32;if(type==6)return HEAPF32;if(type==5||type==28922||type==28520||type==30779||type==30782)return HEAPU32;return HEAPU16};var heapAccessShiftForWebGLHeap=heap=>31-Math.clz32(heap.BYTES_PER_ELEMENT);var emscriptenWebGLGetTexPixelData=(type,format,width,height,pixels,internalFormat)=>{var heap=heapObjectForWebGLType(type);var shift=heapAccessShiftForWebGLHeap(heap);var byteSize=1<<shift;var sizePerPixel=colorChannelsInGlTextureFormat(format)*byteSize;var bytes=computeUnpackAlignedImageSize(width,height,sizePerPixel,GL.unpackAlignment);return heap.subarray(pixels>>>shift,pixels+bytes>>>shift)};function _glReadPixels(x,y,width,height,format,type,pixels){pixels>>>=0;if(true){if(GLctx.currentPixelPackBufferBinding){GLctx.readPixels(x,y,width,height,format,type,pixels)}else{var heap=heapObjectForWebGLType(type);GLctx.readPixels(x,y,width,height,format,type,heap,pixels>>heapAccessShiftForWebGLHeap(heap))}return}var pixelData=emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,format);if(!pixelData){GL.recordError(1280);return}GLctx.readPixels(x,y,width,height,format,type,pixelData)}function _glShaderSource(shader,count,string,length){string>>>=0;length>>>=0;var source=GL.getSource(shader,count,string,length);GLctx.shaderSource(GL.shaders[shader],source)}function _glTexImage2D(target,level,internalFormat,width,height,border,format,type,pixels){pixels>>>=0;if(true){if(GLctx.currentPixelUnpackBufferBinding){GLctx.texImage2D(target,level,internalFormat,width,height,border,format,type,pixels)}else if(pixels){var heap=heapObjectForWebGLType(type);GLctx.texImage2D(target,level,internalFormat,width,height,border,format,type,heap,pixels>>heapAccessShiftForWebGLHeap(heap))}else{GLctx.texImage2D(target,level,internalFormat,width,height,border,format,type,null)}return}GLctx.texImage2D(target,level,internalFormat,width,height,border,format,type,pixels?emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,internalFormat):null)}function _glTexParameteri(x0,x1,x2){GLctx.texParameteri(x0,x1,x2)}var _glUseProgram=program=>{program=GL.programs[program];GLctx.useProgram(program);GLctx.currentProgram=program};function _glVertexAttribPointer(index,size,type,normalized,stride,ptr){ptr>>>=0;GLctx.vertexAttribPointer(index,size,type,!!normalized,stride,ptr)}function _glViewport(x0,x1,x2,x3){GLctx.viewport(x0,x1,x2,x3)}var isLeapYear=year=>year%4===0&&(year%100!==0||year%400===0);var arraySum=(array,index)=>{var sum=0;for(var i=0;i<=index;sum+=array[i++]){}return sum};var MONTH_DAYS_LEAP=[31,29,31,30,31,30,31,31,30,31,30,31];var MONTH_DAYS_REGULAR=[31,28,31,30,31,30,31,31,30,31,30,31];var addDays=(date,days)=>{var newDate=new Date(date.getTime());while(days>0){var leap=isLeapYear(newDate.getFullYear());var currentMonth=newDate.getMonth();var daysInCurrentMonth=(leap?MONTH_DAYS_LEAP:MONTH_DAYS_REGULAR)[currentMonth];if(days>daysInCurrentMonth-newDate.getDate()){days-=daysInCurrentMonth-newDate.getDate()+1;newDate.setDate(1);if(currentMonth<11){newDate.setMonth(currentMonth+1)}else{newDate.setMonth(0);newDate.setFullYear(newDate.getFullYear()+1)}}else{newDate.setDate(newDate.getDate()+days);return newDate}}return newDate};var writeArrayToMemory=(array,buffer)=>{HEAP8.set(array,buffer>>>0)};function _strftime(s,maxsize,format,tm){s>>>=0;maxsize>>>=0;format>>>=0;tm>>>=0;var tm_zone=HEAPU32[tm+40>>>2>>>0];var date={tm_sec:HEAP32[tm>>>2>>>0],tm_min:HEAP32[tm+4>>>2>>>0],tm_hour:HEAP32[tm+8>>>2>>>0],tm_mday:HEAP32[tm+12>>>2>>>0],tm_mon:HEAP32[tm+16>>>2>>>0],tm_year:HEAP32[tm+20>>>2>>>0],tm_wday:HEAP32[tm+24>>>2>>>0],tm_yday:HEAP32[tm+28>>>2>>>0],tm_isdst:HEAP32[tm+32>>>2>>>0],tm_gmtoff:HEAP32[tm+36>>>2>>>0],tm_zone:tm_zone?UTF8ToString(tm_zone):""};var pattern=UTF8ToString(format);var EXPANSION_RULES_1={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var rule in EXPANSION_RULES_1){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_1[rule])}var WEEKDAYS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];function leadingSomething(value,digits,character){var str=typeof value=="number"?value.toString():value||"";while(str.length<digits){str=character[0]+str}return str}function leadingNulls(value,digits){return leadingSomething(value,digits,"0")}function compareByDay(date1,date2){function sgn(value){return value<0?-1:value>0?1:0}var compare;if((compare=sgn(date1.getFullYear()-date2.getFullYear()))===0){if((compare=sgn(date1.getMonth()-date2.getMonth()))===0){compare=sgn(date1.getDate()-date2.getDate())}}return compare}function getFirstWeekStartDate(janFourth){switch(janFourth.getDay()){case 0:return new Date(janFourth.getFullYear()-1,11,29);case 1:return janFourth;case 2:return new Date(janFourth.getFullYear(),0,3);case 3:return new Date(janFourth.getFullYear(),0,2);case 4:return new Date(janFourth.getFullYear(),0,1);case 5:return new Date(janFourth.getFullYear()-1,11,31);case 6:return new Date(janFourth.getFullYear()-1,11,30)}}function getWeekBasedYear(date){var thisDate=addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);var janFourthThisYear=new Date(thisDate.getFullYear(),0,4);var janFourthNextYear=new Date(thisDate.getFullYear()+1,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);if(compareByDay(firstWeekStartThisYear,thisDate)<=0){if(compareByDay(firstWeekStartNextYear,thisDate)<=0){return thisDate.getFullYear()+1}return thisDate.getFullYear()}return thisDate.getFullYear()-1}var EXPANSION_RULES_2={"%a":date=>WEEKDAYS[date.tm_wday].substring(0,3),"%A":date=>WEEKDAYS[date.tm_wday],"%b":date=>MONTHS[date.tm_mon].substring(0,3),"%B":date=>MONTHS[date.tm_mon],"%C":date=>{var year=date.tm_year+1900;return leadingNulls(year/100|0,2)},"%d":date=>leadingNulls(date.tm_mday,2),"%e":date=>leadingSomething(date.tm_mday,2," "),"%g":date=>getWeekBasedYear(date).toString().substring(2),"%G":date=>getWeekBasedYear(date),"%H":date=>leadingNulls(date.tm_hour,2),"%I":date=>{var twelveHour=date.tm_hour;if(twelveHour==0)twelveHour=12;else if(twelveHour>12)twelveHour-=12;return leadingNulls(twelveHour,2)},"%j":date=>leadingNulls(date.tm_mday+arraySum(isLeapYear(date.tm_year+1900)?MONTH_DAYS_LEAP:MONTH_DAYS_REGULAR,date.tm_mon-1),3),"%m":date=>leadingNulls(date.tm_mon+1,2),"%M":date=>leadingNulls(date.tm_min,2),"%n":()=>"\n","%p":date=>{if(date.tm_hour>=0&&date.tm_hour<12){return"AM"}return"PM"},"%S":date=>leadingNulls(date.tm_sec,2),"%t":()=>"\t","%u":date=>date.tm_wday||7,"%U":date=>{var days=date.tm_yday+7-date.tm_wday;return leadingNulls(Math.floor(days/7),2)},"%V":date=>{var val=Math.floor((date.tm_yday+7-(date.tm_wday+6)%7)/7);if((date.tm_wday+371-date.tm_yday-2)%7<=2){val++}if(!val){val=52;var dec31=(date.tm_wday+7-date.tm_yday-1)%7;if(dec31==4||dec31==5&&isLeapYear(date.tm_year%400-1)){val++}}else if(val==53){var jan1=(date.tm_wday+371-date.tm_yday)%7;if(jan1!=4&&(jan1!=3||!isLeapYear(date.tm_year)))val=1}return leadingNulls(val,2)},"%w":date=>date.tm_wday,"%W":date=>{var days=date.tm_yday+7-(date.tm_wday+6)%7;return leadingNulls(Math.floor(days/7),2)},"%y":date=>(date.tm_year+1900).toString().substring(2),"%Y":date=>date.tm_year+1900,"%z":date=>{var off=date.tm_gmtoff;var ahead=off>=0;off=Math.abs(off)/60;off=off/60*100+off%60;return(ahead?"+":"-")+String("0000"+off).slice(-4)},"%Z":date=>date.tm_zone,"%%":()=>"%"};pattern=pattern.replace(/%%/g,"\0\0");for(var rule in EXPANSION_RULES_2){if(pattern.includes(rule)){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_2[rule](date))}}pattern=pattern.replace(/\0\0/g,"%");var bytes=intArrayFromString(pattern,false);if(bytes.length>maxsize){return 0}writeArrayToMemory(bytes,s);return bytes.length-1}function _strftime_l(s,maxsize,format,tm,loc){s>>>=0;maxsize>>>=0;format>>>=0;tm>>>=0;loc>>>=0;return _strftime(s,maxsize,format,tm)}var stringToNewUTF8=str=>{var size=lengthBytesUTF8(str)+1;var ret=_malloc(size);if(ret)stringToUTF8(str,ret,size);return ret};Module["requestFullscreen"]=Browser.requestFullscreen;Module["requestAnimationFrame"]=Browser.requestAnimationFrame;Module["setCanvasSize"]=Browser.setCanvasSize;Module["pauseMainLoop"]=Browser.mainLoop.pause;Module["resumeMainLoop"]=Browser.mainLoop.resume;Module["getUserMedia"]=Browser.getUserMedia;Module["createContext"]=Browser.createContext;var preloadedImages={};var preloadedAudios={};var FSNode=function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev};var readMode=292|73;var writeMode=146;Object.defineProperties(FSNode.prototype,{read:{get:function(){return(this.mode&readMode)===readMode},set:function(val){val?this.mode|=readMode:this.mode&=~readMode}},write:{get:function(){return(this.mode&writeMode)===writeMode},set:function(val){val?this.mode|=writeMode:this.mode&=~writeMode}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}});FS.FSNode=FSNode;FS.createPreloadedFile=FS_createPreloadedFile;FS.staticInit();Module["FS_createPath"]=FS.createPath;Module["FS_createDataFile"]=FS.createDataFile;Module["FS_createPreloadedFile"]=FS.createPreloadedFile;Module["FS_unlink"]=FS.unlink;Module["FS_createLazyFile"]=FS.createLazyFile;Module["FS_createDevice"]=FS.createDevice;var GLctx;var wasmImports={__assert_fail:___assert_fail,__cxa_throw:___cxa_throw,__syscall_fcntl64:___syscall_fcntl64,__syscall_fstat64:___syscall_fstat64,__syscall_ioctl:___syscall_ioctl,__syscall_lstat64:___syscall_lstat64,__syscall_mkdirat:___syscall_mkdirat,__syscall_newfstatat:___syscall_newfstatat,__syscall_openat:___syscall_openat,__syscall_stat64:___syscall_stat64,_emscripten_get_now_is_monotonic:__emscripten_get_now_is_monotonic,_emscripten_throw_longjmp:__emscripten_throw_longjmp,abort:_abort,eglChooseConfig:_eglChooseConfig,eglCreateContext:_eglCreateContext,eglCreateWindowSurface:_eglCreateWindowSurface,eglDestroyContext:_eglDestroyContext,eglDestroySurface:_eglDestroySurface,eglGetDisplay:_eglGetDisplay,eglInitialize:_eglInitialize,eglMakeCurrent:_eglMakeCurrent,eglSwapBuffers:_eglSwapBuffers,eglSwapInterval:_eglSwapInterval,eglTerminate:_eglTerminate,emscripten_asm_const_int:_emscripten_asm_const_int,emscripten_asm_const_ptr:_emscripten_asm_const_ptr,emscripten_cancel_main_loop:_emscripten_cancel_main_loop,emscripten_date_now:_emscripten_date_now,emscripten_get_gamepad_status:_emscripten_get_gamepad_status,emscripten_get_now:_emscripten_get_now,emscripten_memcpy_js:_emscripten_memcpy_js,emscripten_resize_heap:_emscripten_resize_heap,emscripten_sample_gamepad_data:_emscripten_sample_gamepad_data,emscripten_set_blur_callback_on_thread:_emscripten_set_blur_callback_on_thread,emscripten_set_canvas_element_size:_emscripten_set_canvas_element_size,emscripten_set_focus_callback_on_thread:_emscripten_set_focus_callback_on_thread,emscripten_set_gamepadconnected_callback_on_thread:_emscripten_set_gamepadconnected_callback_on_thread,emscripten_set_gamepaddisconnected_callback_on_thread:_emscripten_set_gamepaddisconnected_callback_on_thread,emscripten_set_keydown_callback_on_thread:_emscripten_set_keydown_callback_on_thread,emscripten_set_keyup_callback_on_thread:_emscripten_set_keyup_callback_on_thread,emscripten_set_main_loop:_emscripten_set_main_loop,emscripten_set_mousedown_callback_on_thread:_emscripten_set_mousedown_callback_on_thread,emscripten_set_mousemove_callback_on_thread:_emscripten_set_mousemove_callback_on_thread,emscripten_set_mouseup_callback_on_thread:_emscripten_set_mouseup_callback_on_thread,emscripten_set_touchend_callback_on_thread:_emscripten_set_touchend_callback_on_thread,emscripten_set_touchmove_callback_on_thread:_emscripten_set_touchmove_callback_on_thread,emscripten_set_touchstart_callback_on_thread:_emscripten_set_touchstart_callback_on_thread,emscripten_set_wheel_callback_on_thread:_emscripten_set_wheel_callback_on_thread,emscripten_set_window_title:_emscripten_set_window_title,environ_get:_environ_get,environ_sizes_get:_environ_sizes_get,fd_close:_fd_close,fd_read:_fd_read,fd_seek:_fd_seek,fd_write:_fd_write,getentropy:_getentropy,glAttachShader:_glAttachShader,glBindBuffer:_glBindBuffer,glBindTexture:_glBindTexture,glBindVertexArrayOES:_glBindVertexArrayOES,glBlendFunc:_glBlendFunc,glBufferData:_glBufferData,glClear:_glClear,glClearColor:_glClearColor,glCompileShader:_glCompileShader,glCreateProgram:_glCreateProgram,glCreateShader:_glCreateShader,glDeleteProgram:_glDeleteProgram,glDeleteShader:_glDeleteShader,glDeleteTextures:_glDeleteTextures,glDrawArrays:_glDrawArrays,glEnable:_glEnable,glEnableVertexAttribArray:_glEnableVertexAttribArray,glGenBuffers:_glGenBuffers,glGenTextures:_glGenTextures,glGenVertexArraysOES:_glGenVertexArraysOES,glGetShaderInfoLog:_glGetShaderInfoLog,glLinkProgram:_glLinkProgram,glReadPixels:_glReadPixels,glShaderSource:_glShaderSource,glTexImage2D:_glTexImage2D,glTexParameteri:_glTexParameteri,glUseProgram:_glUseProgram,glVertexAttribPointer:_glVertexAttribPointer,glViewport:_glViewport,invoke_ii:invoke_ii,invoke_iii:invoke_iii,invoke_iiii:invoke_iiii,invoke_iiiii:invoke_iiiii,invoke_vi:invoke_vi,invoke_vii:invoke_vii,invoke_viii:invoke_viii,invoke_viiii:invoke_viiii,invoke_viiiiii:invoke_viiiiii,strftime_l:_strftime_l};var wasmExports=createWasm();var ___wasm_call_ctors=()=>(___wasm_call_ctors=wasmExports["__wasm_call_ctors"])();var _free=a0=>(_free=wasmExports["free"])(a0);var _malloc=a0=>(_malloc=wasmExports["malloc"])(a0);var _main=Module["_main"]=(a0,a1)=>(_main=Module["_main"]=wasmExports["main"])(a0,a1);var _olc_OnPageUnload=Module["_olc_OnPageUnload"]=()=>(_olc_OnPageUnload=Module["_olc_OnPageUnload"]=wasmExports["olc_OnPageUnload"])();var _olc_PGE_UpdateWindowSize=Module["_olc_PGE_UpdateWindowSize"]=(a0,a1)=>(_olc_PGE_UpdateWindowSize=Module["_olc_PGE_UpdateWindowSize"]=wasmExports["olc_PGE_UpdateWindowSize"])(a0,a1);var ___errno_location=()=>(___errno_location=wasmExports["__errno_location"])();var _ma_malloc_emscripten=Module["_ma_malloc_emscripten"]=(a0,a1)=>(_ma_malloc_emscripten=Module["_ma_malloc_emscripten"]=wasmExports["ma_malloc_emscripten"])(a0,a1);var _ma_free_emscripten=Module["_ma_free_emscripten"]=(a0,a1)=>(_ma_free_emscripten=Module["_ma_free_emscripten"]=wasmExports["ma_free_emscripten"])(a0,a1);var _ma_device_process_pcm_frames_capture__webaudio=Module["_ma_device_process_pcm_frames_capture__webaudio"]=(a0,a1,a2)=>(_ma_device_process_pcm_frames_capture__webaudio=Module["_ma_device_process_pcm_frames_capture__webaudio"]=wasmExports["ma_device_process_pcm_frames_capture__webaudio"])(a0,a1,a2);var _ma_device_process_pcm_frames_playback__webaudio=Module["_ma_device_process_pcm_frames_playback__webaudio"]=(a0,a1,a2)=>(_ma_device_process_pcm_frames_playback__webaudio=Module["_ma_device_process_pcm_frames_playback__webaudio"]=wasmExports["ma_device_process_pcm_frames_playback__webaudio"])(a0,a1,a2);var setTempRet0=a0=>(setTempRet0=wasmExports["setTempRet0"])(a0);var _setThrew=(a0,a1)=>(_setThrew=wasmExports["setThrew"])(a0,a1);var stackSave=()=>(stackSave=wasmExports["stackSave"])();var stackRestore=a0=>(stackRestore=wasmExports["stackRestore"])(a0);var stackAlloc=a0=>(stackAlloc=wasmExports["stackAlloc"])(a0);var ___cxa_is_pointer_type=a0=>(___cxa_is_pointer_type=wasmExports["__cxa_is_pointer_type"])(a0);var dynCall_iiji=Module["dynCall_iiji"]=(a0,a1,a2,a3,a4)=>(dynCall_iiji=Module["dynCall_iiji"]=wasmExports["dynCall_iiji"])(a0,a1,a2,a3,a4);var dynCall_iiiji=Module["dynCall_iiiji"]=(a0,a1,a2,a3,a4,a5)=>(dynCall_iiiji=Module["dynCall_iiiji"]=wasmExports["dynCall_iiiji"])(a0,a1,a2,a3,a4,a5);var dynCall_viijii=Module["dynCall_viijii"]=(a0,a1,a2,a3,a4,a5,a6)=>(dynCall_viijii=Module["dynCall_viijii"]=wasmExports["dynCall_viijii"])(a0,a1,a2,a3,a4,a5,a6);var dynCall_iij=Module["dynCall_iij"]=(a0,a1,a2,a3)=>(dynCall_iij=Module["dynCall_iij"]=wasmExports["dynCall_iij"])(a0,a1,a2,a3);var dynCall_jii=Module["dynCall_jii"]=(a0,a1,a2)=>(dynCall_jii=Module["dynCall_jii"]=wasmExports["dynCall_jii"])(a0,a1,a2);var dynCall_jiji=Module["dynCall_jiji"]=(a0,a1,a2,a3,a4)=>(dynCall_jiji=Module["dynCall_jiji"]=wasmExports["dynCall_jiji"])(a0,a1,a2,a3,a4);var dynCall_iiiiij=Module["dynCall_iiiiij"]=(a0,a1,a2,a3,a4,a5,a6)=>(dynCall_iiiiij=Module["dynCall_iiiiij"]=wasmExports["dynCall_iiiiij"])(a0,a1,a2,a3,a4,a5,a6);var dynCall_iiiiijj=Module["dynCall_iiiiijj"]=(a0,a1,a2,a3,a4,a5,a6,a7,a8)=>(dynCall_iiiiijj=Module["dynCall_iiiiijj"]=wasmExports["dynCall_iiiiijj"])(a0,a1,a2,a3,a4,a5,a6,a7,a8);var dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=(a0,a1,a2,a3,a4,a5,a6,a7,a8,a9)=>(dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=wasmExports["dynCall_iiiiiijj"])(a0,a1,a2,a3,a4,a5,a6,a7,a8,a9);function invoke_iiiii(index,a1,a2,a3,a4){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_ii(index,a1){var sp=stackSave();try{return getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_iiii(index,a1,a2,a3){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_iii(index,a1,a2){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_vii(index,a1,a2){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_vi(index,a1){var sp=stackSave();try{getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viiiiii(index,a1,a2,a3,a4,a5,a6){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viii(index,a1,a2,a3){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function invoke_viiii(index,a1,a2,a3,a4){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4)}catch(e){stackRestore(sp);if(e!==e+0)throw e;_setThrew(1,0)}}function applySignatureConversions(wasmExports){wasmExports=Object.assign({},wasmExports);var makeWrapper_pp=f=>a0=>f(a0)>>>0;var makeWrapper_p=f=>()=>f()>>>0;wasmExports["malloc"]=makeWrapper_pp(wasmExports["malloc"]);wasmExports["__errno_location"]=makeWrapper_p(wasmExports["__errno_location"]);wasmExports["stackSave"]=makeWrapper_p(wasmExports["stackSave"]);wasmExports["stackAlloc"]=makeWrapper_pp(wasmExports["stackAlloc"]);return wasmExports}if(ENVIRONMENT_IS_WORKER){function WebGLBuffer(id){this.what="buffer";this.id=id}function WebGLProgram(id){this.what="program";this.id=id;this.shaders=[];this.attributes={};this.attributeVec=[];this.nextAttributes={};this.nextAttributeVec=[]}function WebGLFramebuffer(id){this.what="frameBuffer";this.id=id}function WebGLRenderbuffer(id){this.what="renderBuffer";this.id=id}function WebGLTexture(id){this.what="texture";this.id=id;this.binding=0}function WebGLWorker(){this.DEPTH_BUFFER_BIT=256;this.STENCIL_BUFFER_BIT=1024;this.COLOR_BUFFER_BIT=16384;this.POINTS=0;this.LINES=1;this.LINE_LOOP=2;this.LINE_STRIP=3;this.TRIANGLES=4;this.TRIANGLE_STRIP=5;this.TRIANGLE_FAN=6;this.ZERO=0;this.ONE=1;this.SRC_COLOR=768;this.ONE_MINUS_SRC_COLOR=769;this.SRC_ALPHA=770;this.ONE_MINUS_SRC_ALPHA=771;this.DST_ALPHA=772;this.ONE_MINUS_DST_ALPHA=773;this.DST_COLOR=774;this.ONE_MINUS_DST_COLOR=775;this.SRC_ALPHA_SATURATE=776;this.FUNC_ADD=32774;this.BLEND_EQUATION=32777;this.BLEND_EQUATION_RGB=32777;this.BLEND_EQUATION_ALPHA=34877;this.FUNC_SUBTRACT=32778;this.FUNC_REVERSE_SUBTRACT=32779;this.BLEND_DST_RGB=32968;this.BLEND_SRC_RGB=32969;this.BLEND_DST_ALPHA=32970;this.BLEND_SRC_ALPHA=32971;this.CONSTANT_COLOR=32769;this.ONE_MINUS_CONSTANT_COLOR=32770;this.CONSTANT_ALPHA=32771;this.ONE_MINUS_CONSTANT_ALPHA=32772;this.BLEND_COLOR=32773;this.ARRAY_BUFFER=34962;this.ELEMENT_ARRAY_BUFFER=34963;this.ARRAY_BUFFER_BINDING=34964;this.ELEMENT_ARRAY_BUFFER_BINDING=34965;this.STREAM_DRAW=35040;this.STATIC_DRAW=35044;this.DYNAMIC_DRAW=35048;this.BUFFER_SIZE=34660;this.BUFFER_USAGE=34661;this.CURRENT_VERTEX_ATTRIB=34342;this.FRONT=1028;this.BACK=1029;this.FRONT_AND_BACK=1032;this.CULL_FACE=2884;this.BLEND=3042;this.DITHER=3024;this.STENCIL_TEST=2960;this.DEPTH_TEST=2929;this.SCISSOR_TEST=3089;this.POLYGON_OFFSET_FILL=32823;this.SAMPLE_ALPHA_TO_COVERAGE=32926;this.SAMPLE_COVERAGE=32928;this.NO_ERROR=0;this.INVALID_ENUM=1280;this.INVALID_VALUE=1281;this.INVALID_OPERATION=1282;this.OUT_OF_MEMORY=1285;this.CW=2304;this.CCW=2305;this.LINE_WIDTH=2849;this.ALIASED_POINT_SIZE_RANGE=33901;this.ALIASED_LINE_WIDTH_RANGE=33902;this.CULL_FACE_MODE=2885;this.FRONT_FACE=2886;this.DEPTH_RANGE=2928;this.DEPTH_WRITEMASK=2930;this.DEPTH_CLEAR_VALUE=2931;this.DEPTH_FUNC=2932;this.STENCIL_CLEAR_VALUE=2961;this.STENCIL_FUNC=2962;this.STENCIL_FAIL=2964;this.STENCIL_PASS_DEPTH_FAIL=2965;this.STENCIL_PASS_DEPTH_PASS=2966;this.STENCIL_REF=2967;this.STENCIL_VALUE_MASK=2963;this.STENCIL_WRITEMASK=2968;this.STENCIL_BACK_FUNC=34816;this.STENCIL_BACK_FAIL=34817;this.STENCIL_BACK_PASS_DEPTH_FAIL=34818;this.STENCIL_BACK_PASS_DEPTH_PASS=34819;this.STENCIL_BACK_REF=36003;this.STENCIL_BACK_VALUE_MASK=36004;this.STENCIL_BACK_WRITEMASK=36005;this.VIEWPORT=2978;this.SCISSOR_BOX=3088;this.COLOR_CLEAR_VALUE=3106;this.COLOR_WRITEMASK=3107;this.UNPACK_ALIGNMENT=3317;this.PACK_ALIGNMENT=3333;this.MAX_TEXTURE_SIZE=3379;this.MAX_VIEWPORT_DIMS=3386;this.SUBPIXEL_BITS=3408;this.RED_BITS=3410;this.GREEN_BITS=3411;this.BLUE_BITS=3412;this.ALPHA_BITS=3413;this.DEPTH_BITS=3414;this.STENCIL_BITS=3415;this.POLYGON_OFFSET_UNITS=10752;this.POLYGON_OFFSET_FACTOR=32824;this.TEXTURE_BINDING_2D=32873;this.SAMPLE_BUFFERS=32936;this.SAMPLES=32937;this.SAMPLE_COVERAGE_VALUE=32938;this.SAMPLE_COVERAGE_INVERT=32939;this.COMPRESSED_TEXTURE_FORMATS=34467;this.DONT_CARE=4352;this.FASTEST=4353;this.NICEST=4354;this.GENERATE_MIPMAP_HINT=33170;this.BYTE=5120;this.UNSIGNED_BYTE=5121;this.SHORT=5122;this.UNSIGNED_SHORT=5123;this.INT=5124;this.UNSIGNED_INT=5125;this.FLOAT=5126;this.DEPTH_COMPONENT=6402;this.ALPHA=6406;this.RGB=6407;this.RGBA=6408;this.LUMINANCE=6409;this.LUMINANCE_ALPHA=6410;this.UNSIGNED_SHORT_4_4_4_4=32819;this.UNSIGNED_SHORT_5_5_5_1=32820;this.UNSIGNED_SHORT_5_6_5=33635;this.FRAGMENT_SHADER=35632;this.VERTEX_SHADER=35633;this.MAX_VERTEX_ATTRIBS=34921;this.MAX_VERTEX_UNIFORM_VECTORS=36347;this.MAX_VARYING_VECTORS=36348;this.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661;this.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660;this.MAX_TEXTURE_IMAGE_UNITS=34930;this.MAX_FRAGMENT_UNIFORM_VECTORS=36349;this.SHADER_TYPE=35663;this.DELETE_STATUS=35712;this.LINK_STATUS=35714;this.VALIDATE_STATUS=35715;this.ATTACHED_SHADERS=35717;this.ACTIVE_UNIFORMS=35718;this.ACTIVE_ATTRIBUTES=35721;this.SHADING_LANGUAGE_VERSION=35724;this.CURRENT_PROGRAM=35725;this.NEVER=512;this.LESS=513;this.EQUAL=514;this.LEQUAL=515;this.GREATER=516;this.NOTEQUAL=517;this.GEQUAL=518;this.ALWAYS=519;this.KEEP=7680;this.REPLACE=7681;this.INCR=7682;this.DECR=7683;this.INVERT=5386;this.INCR_WRAP=34055;this.DECR_WRAP=34056;this.VENDOR=7936;this.RENDERER=7937;this.VERSION=7938;this.NEAREST=9728;this.LINEAR=9729;this.NEAREST_MIPMAP_NEAREST=9984;this.LINEAR_MIPMAP_NEAREST=9985;this.NEAREST_MIPMAP_LINEAR=9986;this.LINEAR_MIPMAP_LINEAR=9987;this.TEXTURE_MAG_FILTER=10240;this.TEXTURE_MIN_FILTER=10241;this.TEXTURE_WRAP_S=10242;this.TEXTURE_WRAP_T=10243;this.TEXTURE_2D=3553;this.TEXTURE=5890;this.TEXTURE_CUBE_MAP=34067;this.TEXTURE_BINDING_CUBE_MAP=34068;this.TEXTURE_CUBE_MAP_POSITIVE_X=34069;this.TEXTURE_CUBE_MAP_NEGATIVE_X=34070;this.TEXTURE_CUBE_MAP_POSITIVE_Y=34071;this.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072;this.TEXTURE_CUBE_MAP_POSITIVE_Z=34073;this.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074;this.MAX_CUBE_MAP_TEXTURE_SIZE=34076;this.TEXTURE0=33984;this.TEXTURE1=33985;this.TEXTURE2=33986;this.TEXTURE3=33987;this.TEXTURE4=33988;this.TEXTURE5=33989;this.TEXTURE6=33990;this.TEXTURE7=33991;this.TEXTURE8=33992;this.TEXTURE9=33993;this.TEXTURE10=33994;this.TEXTURE11=33995;this.TEXTURE12=33996;this.TEXTURE13=33997;this.TEXTURE14=33998;this.TEXTURE15=33999;this.TEXTURE16=34e3;this.TEXTURE17=34001;this.TEXTURE18=34002;this.TEXTURE19=34003;this.TEXTURE20=34004;this.TEXTURE21=34005;this.TEXTURE22=34006;this.TEXTURE23=34007;this.TEXTURE24=34008;this.TEXTURE25=34009;this.TEXTURE26=34010;this.TEXTURE27=34011;this.TEXTURE28=34012;this.TEXTURE29=34013;this.TEXTURE30=34014;this.TEXTURE31=34015;this.ACTIVE_TEXTURE=34016;this.REPEAT=10497;this.CLAMP_TO_EDGE=33071;this.MIRRORED_REPEAT=33648;this.FLOAT_VEC2=35664;this.FLOAT_VEC3=35665;this.FLOAT_VEC4=35666;this.INT_VEC2=35667;this.INT_VEC3=35668;this.INT_VEC4=35669;this.BOOL=35670;this.BOOL_VEC2=35671;this.BOOL_VEC3=35672;this.BOOL_VEC4=35673;this.FLOAT_MAT2=35674;this.FLOAT_MAT3=35675;this.FLOAT_MAT4=35676;this.SAMPLER_2D=35678;this.SAMPLER_3D=35679;this.SAMPLER_CUBE=35680;this.VERTEX_ATTRIB_ARRAY_ENABLED=34338;this.VERTEX_ATTRIB_ARRAY_SIZE=34339;this.VERTEX_ATTRIB_ARRAY_STRIDE=34340;this.VERTEX_ATTRIB_ARRAY_TYPE=34341;this.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922;this.VERTEX_ATTRIB_ARRAY_POINTER=34373;this.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975;this.IMPLEMENTATION_COLOR_READ_TYPE=35738;this.IMPLEMENTATION_COLOR_READ_FORMAT=35739;this.COMPILE_STATUS=35713;this.LOW_FLOAT=36336;this.MEDIUM_FLOAT=36337;this.HIGH_FLOAT=36338;this.LOW_INT=36339;this.MEDIUM_INT=36340;this.HIGH_INT=36341;this.FRAMEBUFFER=36160;this.RENDERBUFFER=36161;this.RGBA4=32854;this.RGB5_A1=32855;this.RGB565=36194;this.DEPTH_COMPONENT16=33189;this.STENCIL_INDEX=6401;this.STENCIL_INDEX8=36168;this.DEPTH_STENCIL=34041;this.RENDERBUFFER_WIDTH=36162;this.RENDERBUFFER_HEIGHT=36163;this.RENDERBUFFER_INTERNAL_FORMAT=36164;this.RENDERBUFFER_RED_SIZE=36176;this.RENDERBUFFER_GREEN_SIZE=36177;this.RENDERBUFFER_BLUE_SIZE=36178;this.RENDERBUFFER_ALPHA_SIZE=36179;this.RENDERBUFFER_DEPTH_SIZE=36180;this.RENDERBUFFER_STENCIL_SIZE=36181;this.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048;this.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049;this.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050;this.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051;this.COLOR_ATTACHMENT0=36064;this.DEPTH_ATTACHMENT=36096;this.STENCIL_ATTACHMENT=36128;this.DEPTH_STENCIL_ATTACHMENT=33306;this.NONE=0;this.FRAMEBUFFER_COMPLETE=36053;this.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054;this.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055;this.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057;this.FRAMEBUFFER_UNSUPPORTED=36061;this.ACTIVE_TEXTURE=34016;this.FRAMEBUFFER_BINDING=36006;this.RENDERBUFFER_BINDING=36007;this.MAX_RENDERBUFFER_SIZE=34024;this.INVALID_FRAMEBUFFER_OPERATION=1286;this.UNPACK_FLIP_Y_WEBGL=37440;this.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441;this.CONTEXT_LOST_WEBGL=37442;this.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443;this.BROWSER_DEFAULT_WEBGL=37444;var commandBuffer=[];var nextId=1;var bindings={texture2D:null,arrayBuffer:null,elementArrayBuffer:null,program:null,framebuffer:null,activeTexture:this.TEXTURE0,generateMipmapHint:this.DONT_CARE,blendSrcRGB:this.ONE,blendSrcAlpha:this.ONE,blendDstRGB:this.ZERO,blendDstAlpha:this.ZERO,blendEquationRGB:this.FUNC_ADD,blendEquationAlpha:this.FUNC_ADD,enabledState:{}};var stateDisabledByDefault=[this.BLEND,this.CULL_FACE,this.DEPTH_TEST,this.DITHER,this.POLYGON_OFFSET_FILL,this.SAMPLE_ALPHA_TO_COVERAGE,this.SAMPLE_COVERAGE,this.SCISSOR_TEST,this.STENCIL_TEST];for(var i in stateDisabledByDefault){bindings.enabledState[stateDisabledByDefault[i]]=false}var that=this;this.onmessage=function(msg){switch(msg.op){case"setPrefetched":{WebGLWorker.prototype.prefetchedParameters=msg.parameters;WebGLWorker.prototype.prefetchedExtensions=msg.extensions;WebGLWorker.prototype.prefetchedPrecisions=msg.precisions;removeRunDependency("gl-prefetch");break}default:throw"weird gl onmessage "+JSON.stringify(msg)}};function revname(name){for(var x in that)if(that[x]===name)return x;return null}this.getParameter=function(name){assert(name);if(name in this.prefetchedParameters)return this.prefetchedParameters[name];switch(name){case this.TEXTURE_BINDING_2D:{return bindings.texture2D}case this.ARRAY_BUFFER_BINDING:{return bindings.arrayBuffer}case this.ELEMENT_ARRAY_BUFFER_BINDING:{return bindings.elementArrayBuffer}case this.CURRENT_PROGRAM:{return bindings.program}case this.FRAMEBUFFER_BINDING:{return bindings.framebuffer}case this.ACTIVE_TEXTURE:{return bindings.activeTexture}case this.GENERATE_MIPMAP_HINT:{return bindings.generateMipmapHint}case this.BLEND_SRC_RGB:{return bindings.blendSrcRGB}case this.BLEND_SRC_ALPHA:{return bindings.blendSrcAlpha}case this.BLEND_DST_RGB:{return bindings.blendDstRGB}case this.BLEND_DST_ALPHA:{return bindings.blendDstAlpha}case this.BLEND_EQUATION_RGB:{return bindings.blendEquationRGB}case this.BLEND_EQUATION_ALPHA:{return bindings.blendEquationAlpha}default:{if(bindings.enabledState[name]!==undefined)return bindings.enabledState[name];throw"TODO: get parameter "+name+" : "+revname(name)}}};this.getExtension=function(name){var i=this.prefetchedExtensions.indexOf(name);if(i<0)return null;commandBuffer.push(1,name);switch(name){case"EXT_texture_filter_anisotropic":{return{TEXTURE_MAX_ANISOTROPY_EXT:34046,MAX_TEXTURE_MAX_ANISOTROPY_EXT:34047}}case"WEBGL_draw_buffers":{return{COLOR_ATTACHMENT0_WEBGL:36064,COLOR_ATTACHMENT1_WEBGL:36065,COLOR_ATTACHMENT2_WEBGL:36066,COLOR_ATTACHMENT3_WEBGL:36067,COLOR_ATTACHMENT4_WEBGL:36068,COLOR_ATTACHMENT5_WEBGL:36069,COLOR_ATTACHMENT6_WEBGL:36070,COLOR_ATTACHMENT7_WEBGL:36071,COLOR_ATTACHMENT8_WEBGL:36072,COLOR_ATTACHMENT9_WEBGL:36073,COLOR_ATTACHMENT10_WEBGL:36074,COLOR_ATTACHMENT11_WEBGL:36075,COLOR_ATTACHMENT12_WEBGL:36076,COLOR_ATTACHMENT13_WEBGL:36077,COLOR_ATTACHMENT14_WEBGL:36078,COLOR_ATTACHMENT15_WEBGL:36079,DRAW_BUFFER0_WEBGL:34853,DRAW_BUFFER1_WEBGL:34854,DRAW_BUFFER2_WEBGL:34855,DRAW_BUFFER3_WEBGL:34856,DRAW_BUFFER4_WEBGL:34857,DRAW_BUFFER5_WEBGL:34858,DRAW_BUFFER6_WEBGL:34859,DRAW_BUFFER7_WEBGL:34860,DRAW_BUFFER8_WEBGL:34861,DRAW_BUFFER9_WEBGL:34862,DRAW_BUFFER10_WEBGL:34863,DRAW_BUFFER11_WEBGL:34864,DRAW_BUFFER12_WEBGL:34865,DRAW_BUFFER13_WEBGL:34866,DRAW_BUFFER14_WEBGL:34867,DRAW_BUFFER15_WEBGL:34868,MAX_COLOR_ATTACHMENTS_WEBGL:36063,MAX_DRAW_BUFFERS_WEBGL:34852,drawBuffersWEBGL:function(buffers){that.drawBuffersWEBGL(buffers)}}}case"OES_standard_derivatives":{return{FRAGMENT_SHADER_DERIVATIVE_HINT_OES:35723}}}return true};this.getSupportedExtensions=function(){return this.prefetchedExtensions};this.getShaderPrecisionFormat=function(shaderType,precisionType){return this.prefetchedPrecisions[shaderType][precisionType]};this.enable=function(cap){commandBuffer.push(2,cap);bindings.enabledState[cap]=true};this.isEnabled=function(cap){return bindings.enabledState[cap]};this.disable=function(cap){commandBuffer.push(3,cap);bindings.enabledState[cap]=false};this.clear=function(mask){commandBuffer.push(4,mask)};this.clearColor=function(r,g,b,a){commandBuffer.push(5,r,g,b,a)};this.createShader=function(type){var id=nextId++;commandBuffer.push(6,type,id);return{id:id,what:"shader",type:type}};this.deleteShader=function(shader){if(!shader)return;commandBuffer.push(7,shader.id)};this.shaderSource=function(shader,source){shader.source=source;commandBuffer.push(8,shader.id,source)};this.compileShader=function(shader){commandBuffer.push(9,shader.id)};this.getShaderInfoLog=function(shader){return""};this.createProgram=function(){var id=nextId++;commandBuffer.push(10,id);return new WebGLProgram(id)};this.deleteProgram=function(program){if(!program)return;commandBuffer.push(11,program.id)};this.attachShader=function(program,shader){program.shaders.push(shader);commandBuffer.push(12,program.id,shader.id)};this.bindAttribLocation=function(program,index,name){program.nextAttributes[name]={what:"attribute",name:name,size:-1,location:index,type:"?"};program.nextAttributeVec[index]=name;commandBuffer.push(13,program.id,index,name)};this.getAttribLocation=function(program,name){if(name in program.attributes)return program.attributes[name].location;return-1};this.linkProgram=function(program){function getTypeId(text){switch(text){case"bool":return that.BOOL;case"int":return that.INT;case"uint":return that.UNSIGNED_INT;case"float":return that.FLOAT;case"vec2":return that.FLOAT_VEC2;case"vec3":return that.FLOAT_VEC3;case"vec4":return that.FLOAT_VEC4;case"ivec2":return that.INT_VEC2;case"ivec3":return that.INT_VEC3;case"ivec4":return that.INT_VEC4;case"bvec2":return that.BOOL_VEC2;case"bvec3":return that.BOOL_VEC3;case"bvec4":return that.BOOL_VEC4;case"mat2":return that.FLOAT_MAT2;case"mat3":return that.FLOAT_MAT3;case"mat4":return that.FLOAT_MAT4;case"sampler2D":return that.SAMPLER_2D;case"sampler3D":return that.SAMPLER_3D;case"samplerCube":return that.SAMPLER_CUBE;default:throw"not yet recognized type text: "+text}}function parseElementType(shader,type,obj,vec){var source=shader.source;source=source.replace(/\n/g,"|\n");var newItems=source.match(new RegExp(type+"\\s+\\w+\\s+[\\w,\\s[\\]]+;","g"));if(!newItems)return;newItems.forEach(function(item){var m=new RegExp(type+"\\s+(\\w+)\\s+([\\w,\\s[\\]]+);").exec(item);assert(m);m[2].split(",").map(function(name){name=name.trim();return name.search(/\s/)>=0?"":name}).filter(function(name){return!!name}).forEach(function(name){var size=1;var open=name.indexOf("[");var fullname=name;if(open>=0){var close=name.indexOf("]");size=parseInt(name.substring(open+1,close));name=name.substr(0,open);fullname=name+"[0]"}if(!obj[name]){obj[name]={what:type,name:fullname,size:size,location:-1,type:getTypeId(m[1])};vec?.push(name)}})})}program.uniforms={};program.uniformVec=[];program.attributes=program.nextAttributes;program.attributeVec=program.nextAttributeVec;program.nextAttributes={};program.nextAttributeVec=[];var existingAttributes={};program.shaders.forEach(function(shader){parseElementType(shader,"uniform",program.uniforms,program.uniformVec);parseElementType(shader,"attribute",existingAttributes,null)});for(var attr in existingAttributes){if(!(attr in program.attributes)){var index=program.attributeVec.length;program.attributes[attr]={what:"attribute",name:attr,size:-1,location:index,type:"?"};program.attributeVec[index]=attr;commandBuffer.push(13,program.id,index,attr)}program.attributes[attr].size=existingAttributes[attr].size;program.attributes[attr].type=existingAttributes[attr].type}commandBuffer.push(14,program.id)};this.getProgramParameter=function(program,name){switch(name){case this.ACTIVE_UNIFORMS:return program.uniformVec.length;case this.ACTIVE_ATTRIBUTES:return program.attributeVec.length;case this.LINK_STATUS:{commandBuffer.push(15,program.id,name);return true}default:throw"bad getProgramParameter "+revname(name)}};this.getActiveAttrib=function(program,index){var name=program.attributeVec[index];if(!name)return null;return program.attributes[name]};this.getActiveUniform=function(program,index){var name=program.uniformVec[index];if(!name)return null;return program.uniforms[name]};this.getUniformLocation=function(program,name){var fullname=name;var index=-1;var open=name.indexOf("[");if(open>=0){var close=name.indexOf("]");index=parseInt(name.substring(open+1,close));name=name.substr(0,open)}if(!(name in program.uniforms))return null;var id=nextId++;commandBuffer.push(16,program.id,fullname,id);return{what:"location",uniform:program.uniforms[name],id:id,index:index}};this.getProgramInfoLog=function(shader){return""};this.useProgram=function(program){commandBuffer.push(17,program?program.id:0);bindings.program=program};this.uniform1i=function(location,data){if(!location)return;commandBuffer.push(18,location.id,data)};this.uniform1f=function(location,data){if(!location)return;commandBuffer.push(19,location.id,data)};this.uniform3fv=function(location,data){if(!location)return;commandBuffer.push(20,location.id,new Float32Array(data))};this.uniform4f=function(location,x,y,z,w){if(!location)return;commandBuffer.push(21,location.id,new Float32Array([x,y,z,w]))};this.uniform4fv=function(location,data){if(!location)return;commandBuffer.push(21,location.id,new Float32Array(data))};this.uniformMatrix4fv=function(location,transpose,data){if(!location)return;commandBuffer.push(22,location.id,transpose,new Float32Array(data))};this.vertexAttrib4fv=function(index,values){commandBuffer.push(23,index,new Float32Array(values))};this.createBuffer=function(){var id=nextId++;commandBuffer.push(24,id);return new WebGLBuffer(id)};this.deleteBuffer=function(buffer){if(!buffer)return;commandBuffer.push(25,buffer.id)};this.bindBuffer=function(target,buffer){commandBuffer.push(26,target,buffer?buffer.id:0);switch(target){case this.ARRAY_BUFFER_BINDING:{bindings.arrayBuffer=buffer;break}case this.ELEMENT_ARRAY_BUFFER_BINDING:{bindings.elementArrayBuffer=buffer;break}}};function duplicate(something){if(!something||typeof something=="number")return something;if(something.slice)return something.slice(0);return new something.constructor(something)}this.bufferData=function(target,something,usage){commandBuffer.push(27,target,duplicate(something),usage)};this.bufferSubData=function(target,offset,something){commandBuffer.push(28,target,offset,duplicate(something))};this.viewport=function(x,y,w,h){commandBuffer.push(29,x,y,w,h)};this.vertexAttribPointer=function(index,size,type,normalized,stride,offset){commandBuffer.push(30,index,size,type,normalized,stride,offset)};this.enableVertexAttribArray=function(index){commandBuffer.push(31,index)};this.disableVertexAttribArray=function(index){commandBuffer.push(32,index)};this.drawArrays=function(mode,first,count){commandBuffer.push(33,mode,first,count)};this.drawElements=function(mode,count,type,offset){commandBuffer.push(34,mode,count,type,offset)};this.getError=function(){commandBuffer.push(35);return this.NO_ERROR};this.createTexture=function(){var id=nextId++;commandBuffer.push(36,id);return new WebGLTexture(id)};this.deleteTexture=function(texture){if(!texture)return;commandBuffer.push(37,texture.id);texture.id=0};this.isTexture=function(texture){return texture&&texture.what==="texture"&&texture.id>0&&texture.binding};this.bindTexture=function(target,texture){switch(target){case that.TEXTURE_2D:{bindings.texture2D=texture;break}}if(texture)texture.binding=target;commandBuffer.push(38,target,texture?texture.id:0)};this.texParameteri=function(target,pname,param){commandBuffer.push(39,target,pname,param)};this.texImage2D=function(target,level,internalformat,width,height,border,format,type,pixels){if(pixels===undefined){format=width;type=height;pixels=border;assert(pixels instanceof Image);assert(internalformat===format&&format===this.RGBA);assert(type===this.UNSIGNED_BYTE);var data=pixels.data;width=data.width;height=data.height;border=0;pixels=new Uint8Array(data.data)}commandBuffer.push(40,target,level,internalformat,width,height,border,format,type,duplicate(pixels))};this.compressedTexImage2D=function(target,level,internalformat,width,height,border,pixels){commandBuffer.push(41,target,level,internalformat,width,height,border,duplicate(pixels))};this.activeTexture=function(texture){commandBuffer.push(42,texture);bindings.activeTexture=texture};this.getShaderParameter=function(shader,pname){switch(pname){case this.SHADER_TYPE:return shader.type;case this.COMPILE_STATUS:{commandBuffer.push(43,shader.id,pname);return true}default:throw"unsupported getShaderParameter "+pname}};this.clearDepth=function(depth){commandBuffer.push(44,depth)};this.depthFunc=function(depth){commandBuffer.push(45,depth)};this.frontFace=function(depth){commandBuffer.push(46,depth)};this.cullFace=function(depth){commandBuffer.push(47,depth)};this.readPixels=function(depth){abort("readPixels is impossible, we are async GL")};this.pixelStorei=function(pname,param){commandBuffer.push(48,pname,param)};this.depthMask=function(flag){commandBuffer.push(49,flag)};this.depthRange=function(near,far){commandBuffer.push(50,near,far)};this.blendFunc=function(sfactor,dfactor){commandBuffer.push(51,sfactor,dfactor);bindings.blendSrcRGB=bindings.blendSrcAlpha=sfactor;bindings.blendDstRGB=bindings.blendDstAlpha=dfactor};this.scissor=function(x,y,width,height){commandBuffer.push(52,x,y,width,height)};this.colorMask=function(red,green,blue,alpha){commandBuffer.push(53,red,green,blue,alpha)};this.lineWidth=function(width){commandBuffer.push(54,width)};this.createFramebuffer=function(){var id=nextId++;commandBuffer.push(55,id);return new WebGLFramebuffer(id)};this.deleteFramebuffer=function(framebuffer){if(!framebuffer)return;commandBuffer.push(56,framebuffer.id)};this.bindFramebuffer=function(target,framebuffer){commandBuffer.push(57,target,framebuffer?framebuffer.id:0);bindings.framebuffer=framebuffer};this.framebufferTexture2D=function(target,attachment,textarget,texture,level){commandBuffer.push(58,target,attachment,textarget,texture?texture.id:0,level)};this.checkFramebufferStatus=function(target){return this.FRAMEBUFFER_COMPLETE};this.createRenderbuffer=function(){var id=nextId++;commandBuffer.push(59,id);return new WebGLRenderbuffer(id)};this.deleteRenderbuffer=function(renderbuffer){if(!renderbuffer)return;commandBuffer.push(60,renderbuffer.id)};this.bindRenderbuffer=function(target,renderbuffer){commandBuffer.push(61,target,renderbuffer?renderbuffer.id:0)};this.renderbufferStorage=function(target,internalformat,width,height){commandBuffer.push(62,target,internalformat,width,height)};this.framebufferRenderbuffer=function(target,attachment,renderbuffertarget,renderbuffer){commandBuffer.push(63,target,attachment,renderbuffertarget,renderbuffer?renderbuffer.id:0)};this.debugPrint=function(text){commandBuffer.push(64,text)};this.hint=function(target,mode){commandBuffer.push(65,target,mode);if(target==this.GENERATE_MIPMAP_HINT)bindings.generateMipmapHint=mode};this.blendEquation=function(mode){commandBuffer.push(66,mode);bindings.blendEquationRGB=bindings.blendEquationAlpha=mode};this.generateMipmap=function(target){commandBuffer.push(67,target)};this.uniformMatrix3fv=function(location,transpose,data){if(!location)return;commandBuffer.push(68,location.id,transpose,new Float32Array(data))};this.stencilMask=function(mask){commandBuffer.push(69,mask)};this.clearStencil=function(s){commandBuffer.push(70,s)};this.texSubImage2D=function(target,level,xoffset,yoffset,width,height,format,type,pixels){if(pixels===undefined){var formatTemp=format;format=width;type=height;pixels=formatTemp;assert(pixels instanceof Image);assert(format===this.RGBA);assert(type===this.UNSIGNED_BYTE);var data=pixels.data;width=data.width;height=data.height;pixels=new Uint8Array(data.data)}commandBuffer.push(71,target,level,xoffset,yoffset,width,height,format,type,duplicate(pixels))};this.uniform3f=function(location,x,y,z){if(!location)return;commandBuffer.push(72,location.id,x,y,z)};this.blendFuncSeparate=function(srcRGB,dstRGB,srcAlpha,dstAlpha){commandBuffer.push(73,srcRGB,dstRGB,srcAlpha,dstAlpha);bindings.blendSrcRGB=srcRGB;bindings.blendSrcAlpha=srcAlpha;bindings.blendDstRGB=dstRGB;bindings.blendDstAlpha=dstAlpha};this.uniform2fv=function(location,data){if(!location)return;commandBuffer.push(74,location.id,new Float32Array(data))};this.texParameterf=function(target,pname,param){commandBuffer.push(75,target,pname,param)};this.isContextLost=function(){commandBuffer.push(76);return false};this.isProgram=function(program){return program&&program.what==="program"};this.blendEquationSeparate=function(rgb,alpha){commandBuffer.push(77,rgb,alpha);bindings.blendEquationRGB=rgb;bindings.blendEquationAlpha=alpha};this.stencilFuncSeparate=function(face,func,ref,mask){commandBuffer.push(78,face,func,ref,mask)};this.stencilOpSeparate=function(face,fail,zfail,zpass){commandBuffer.push(79,face,fail,zfail,zpass)};this.drawBuffersWEBGL=function(buffers){commandBuffer.push(80,buffers)};this.uniform1iv=function(location,data){if(!location)return;commandBuffer.push(81,location.id,new Int32Array(data))};this.uniform1fv=function(location,data){if(!location)return;commandBuffer.push(82,location.id,new Float32Array(data))};var theoreticalTracker=new FPSTracker("server (theoretical)");var throttledTracker=new FPSTracker("server (client-throttled)");function preRAF(){if(Math.abs(frameId-clientFrameId)>=4){return false}}var postRAFed=false;function postRAF(){if(commandBuffer.length>0){postMessage({target:"gl",op:"render",commandBuffer:commandBuffer});commandBuffer=[]}postRAFed=true}assert(!Browser.doSwapBuffers);Browser.doSwapBuffers=postRAF;var trueRAF=window.requestAnimationFrame;window.requestAnimationFrame=function(func){trueRAF(function(){if(preRAF()===false){window.requestAnimationFrame(func);return}postRAFed=false;func();if(!postRAFed){postRAF()}})}}WebGLWorker.prototype.prefetchedParameters={};WebGLWorker.prototype.prefetchedExtensions={};WebGLWorker.prototype.prefetchedPrecisions={};if(!ENVIRONMENT_IS_NODE){function FPSTracker(text){var last=0;var mean=0;var counter=0;this.tick=()=>{var now=Date.now();if(last>0){var diff=now-last;mean=.99*mean+.01*diff;if(counter++===60){counter=0;dump(text+" fps: "+(1e3/mean).toFixed(2)+"\n")}}last=now}}function Element(){throw"TODO: Element"}function PropertyBag(){this.addProperty=()=>{};this.removeProperty=()=>{};this.setProperty=()=>{}}var IndexedObjects={nextId:1,cache:{},add(object){object.id=this.nextId++;this.cache[object.id]=object}};function EventListener(){this.listeners={};this.addEventListener=function addEventListener(event,func){this.listeners[event]||=[];this.listeners[event].push(func)};this.removeEventListener=function(event,func){var list=this.listeners[event];if(!list)return;var me=list.indexOf(func);if(me<0)return;list.splice(me,1)};this.fireEvent=function(event){event.preventDefault=()=>{};if(event.type in this.listeners){this.listeners[event.type].forEach(listener=>listener(event))}}}function Image(){IndexedObjects.add(this);EventListener.call(this);var src="";Object.defineProperty(this,"src",{set:value=>{src=value;assert(this.id);postMessage({target:"Image",method:"src",src:src,id:this.id})},get:()=>src})}Image.prototype.onload=()=>{};Image.prototype.onerror=()=>{};var window=this;var windowExtra=new EventListener;for(var x in windowExtra)window[x]=windowExtra[x];window.close=()=>{postMessage({target:"window",method:"close"})};window.alert=text=>{err(`alert forever: ${text}`);while(1){}};window.scrollX=window.scrollY=0;window.WebGLRenderingContext=WebGLWorker;window.requestAnimationFrame=function(){var nextRAF=0;return function(func){var now=Date.now();if(nextRAF===0){nextRAF=now+1e3/60}else{while(now+2>=nextRAF){nextRAF+=1e3/60}}var delay=Math.max(nextRAF-now,0);setTimeout(func,delay)}}();var webGLWorker=new WebGLWorker;var document=new EventListener;document.createElement=what=>{switch(what){case"canvas":{var canvas=new EventListener;canvas.ensureData=()=>{if(!canvas.data||canvas.data.width!==canvas.width||canvas.data.height!==canvas.height){canvas.data={width:canvas.width,height:canvas.height,data:new Uint8Array(canvas.width*canvas.height*4)};if(canvas===Module["canvas"]){postMessage({target:"canvas",op:"resize",width:canvas.width,height:canvas.height})}}};canvas.getContext=(type,attributes)=>{if(canvas===Module["canvas"]){postMessage({target:"canvas",op:"getContext",type:type,attributes:attributes})}if(type==="2d"){return{getImageData:(x,y,w,h)=>{assert(x==0&&y==0&&w==canvas.width&&h==canvas.height);canvas.ensureData();return{width:canvas.data.width,height:canvas.data.height,data:new Uint8Array(canvas.data.data)}},putImageData:(image,x,y)=>{canvas.ensureData();assert(x==0&&y==0&&image.width==canvas.width&&image.height==canvas.height);canvas.data.data.set(image.data);if(canvas===Module["canvas"]){postMessage({target:"canvas",op:"render",image:canvas.data})}},drawImage:(image,x,y,w,h,ox,oy,ow,oh)=>{assert(!x&&!y&&!ox&&!oy);assert(w===ow&&h===oh);assert(canvas.width===w||w===undefined);assert(canvas.height===h||h===undefined);assert(image.width===canvas.width&&image.height===canvas.height);canvas.ensureData();canvas.data.data.set(image.data.data);if(canvas===Module["canvas"]){postMessage({target:"canvas",op:"render",image:canvas.data})}}}}else{return webGLWorker}};canvas.boundingClientRect={};canvas.getBoundingClientRect=()=>({width:canvas.boundingClientRect.width,height:canvas.boundingClientRect.height,top:canvas.boundingClientRect.top,left:canvas.boundingClientRect.left,bottom:canvas.boundingClientRect.bottom,right:canvas.boundingClientRect.right});canvas.style=new PropertyBag;canvas.exitPointerLock=()=>{};canvas.width_||=0;canvas.height_||=0;Object.defineProperty(canvas,"width",{set:value=>{canvas.width_=value;if(canvas===Module["canvas"]){postMessage({target:"canvas",op:"resize",width:canvas.width_,height:canvas.height_})}},get:()=>canvas.width_});Object.defineProperty(canvas,"height",{set:value=>{canvas.height_=value;if(canvas===Module["canvas"]){postMessage({target:"canvas",op:"resize",width:canvas.width_,height:canvas.height_})}},get:()=>canvas.height_});var style={parentCanvas:canvas,removeProperty:()=>{},setProperty:()=>{}};Object.defineProperty(style,"cursor",{set:value=>{if(!style.cursor_||style.cursor_!==value){style.cursor_=value;if(style.parentCanvas===Module["canvas"]){postMessage({target:"canvas",op:"setObjectProperty",object:"style",property:"cursor",value:style.cursor_})}}},get:()=>style.cursor});canvas.style=style;return canvas}default:{throw"document.createElement "+what}}};document.getElementById=id=>{if(id==="canvas"||id==="application-canvas"){return Module.canvas}throw"document.getElementById failed on "+id};document.querySelector=id=>{if(id==="#canvas"||id==="#application-canvas"||id==="canvas"||id==="application-canvas"){return Module.canvas}throw"document.querySelector failed on "+id};document.documentElement={};document.styleSheets=[{cssRules:[],insertRule(rule,i){this.cssRules.splice(i,0,rule)}}];document.URL="http://worker.not.yet.ready.wait.for.window.onload?fake";function Audio(){warnOnce("faking Audio elements, no actual sound will play")}Audio.prototype=new EventListener;Object.defineProperty(Audio.prototype,"src",{set(value){if(value[0]==="d")return;this.onerror()}});Audio.prototype.play=()=>{};Audio.prototype.pause=()=>{};Audio.prototype.cloneNode=()=>new Audio;var screen={width:0,height:0};Module.canvas=document.createElement("canvas");Module.setStatus=()=>{};out=x=>{postMessage({target:"stdout",content:x})};err=x=>{postMessage({target:"stderr",content:x})};var frameId=0;var clientFrameId=0;var postMainLoop=Module["postMainLoop"];Module["postMainLoop"]=()=>{postMainLoop?.();postMessage({target:"tick",id:frameId++});commandBuffer=[]};addRunDependency("gl-prefetch");addRunDependency("worker-init")}var messageBuffer=null;var messageResenderTimeout=null;var calledMain=false;Module["postRun"]||=[];if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];Module["postRun"].push(()=>{calledMain=true});function messageResender(){if(calledMain){assert(messageBuffer&&messageBuffer.length>0);messageResenderTimeout=null;messageBuffer.forEach(message=>onmessage(message));messageBuffer=null}else{messageResenderTimeout=setTimeout(messageResender,100)}}function onMessageFromMainEmscriptenThread(message){if(!calledMain&&!message.data.preMain){if(!messageBuffer){messageBuffer=[];messageResenderTimeout=setTimeout(messageResender,100)}messageBuffer.push(message);return}if(calledMain&&messageResenderTimeout){clearTimeout(messageResenderTimeout);messageResender()}switch(message.data.target){case"document":{document.fireEvent(message.data.event);break}case"window":{window.fireEvent(message.data.event);break}case"canvas":{if(message.data.event){Module.canvas.fireEvent(message.data.event)}else if(message.data.boundingClientRect){Module.canvas.boundingClientRect=message.data.boundingClientRect}else throw"ey?";break}case"gl":{webGLWorker.onmessage(message.data);break}case"tock":{clientFrameId=message.data.id;break}case"Image":{var img=IndexedObjects.cache[message.data.id];switch(message.data.method){case"onload":{img.width=message.data.width;img.height=message.data.height;img.data={width:img.width,height:img.height,data:message.data.data};img.complete=true;img.onload();break}case"onerror":{img.onerror({srcElement:img});break}}break}case"IDBStore":{assert(message.data.method==="response");assert(IDBStore.pending);IDBStore.pending(message.data);break}case"worker-init":{Module.canvas=document.createElement("canvas");screen.width=Module.canvas.width_=message.data.width;screen.height=Module.canvas.height_=message.data.height;Module.canvas.boundingClientRect=message.data.boundingClientRect;if(ENVIRONMENT_IS_NODE)document.URL=message.data.URL;window.fireEvent({type:"load"});removeRunDependency("worker-init");break}case"custom":{if(Module["onCustomMessage"]){Module["onCustomMessage"](message)}else{throw"Custom message received but worker Module.onCustomMessage not implemented."}break}case"setimmediate":{if(Module["setImmediates"])Module["setImmediates"].shift()();break}default:throw"wha? "+message.data.target}}onmessage=onMessageFromMainEmscriptenThread;if(typeof specialHTMLTargets!="undefined"){specialHTMLTargets=[0,document,window]}}Module["addRunDependency"]=addRunDependency;Module["removeRunDependency"]=removeRunDependency;Module["FS_createPath"]=FS.createPath;Module["FS_createLazyFile"]=FS.createLazyFile;Module["FS_createDevice"]=FS.createDevice;Module["stringToNewUTF8"]=stringToNewUTF8;Module["FS_createPreloadedFile"]=FS.createPreloadedFile;Module["FS_createDataFile"]=FS.createDataFile;Module["FS_unlink"]=FS.unlink;var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function callMain(){var entryFunction=_main;var argc=0;var argv=0;try{var ret=entryFunction(argc,argv);exitJS(ret,true);return ret}catch(e){return handleException(e)}}function run(){if(runDependencies>0){return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();if(shouldRunNow)callMain();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}var shouldRunNow=true;if(Module["noInitialRun"])shouldRunNow=false;run();
|
|
|