(()=>{"use strict";constt=newclass{constructor(){this.states=newMap}get(t){returnthis.states.get(t)}set(t,e){returnthis.states.set(t,e)}};classe{constructor(){this.inventory=[],this.currentRoom="start",this.context=null}addItem(t){this.inventory.push(t)}removeItem(t){this.inventory=this.inventory.filter((e=>e!=t))}getInventory(){returnthis.inventory.map((t=>this.context.getItem(t)))}}classi{speak(t){}stop(){}setOptions(t){}}classsextendsi{constructor(t={}){super(),this.timeout=100,this.timeout=t.timeout||100,this.init()}init(){this.container=document.createElement("div"),this.container.setAttribute("aria-live","polite"),this.speechDisplay=document.createElement("div"),this.speechDisplay.setAttribute("aria-live","polite"),this.container.append(this.speechDisplay),document.body.appendChild(this.container),document.body.insertBefore(this.container,document.body.firstChild)}speak(t){this.clearDisplay();conste=document.createTextNode(t),i=document.createElement("p");i.appendChild(e),this.speechDisplay.appendChild(i),setTimeout(this.clearDisplay.bind(this),this.timeout)}stop(){this.clearDisplay()}clearDisplay(){this.speechDisplay.innerHTML=""}}classnextendsi{}classo{constructor(t=function(t="aria"){return"webtts"===t?n:s}()){this.output=t}speak(t){this.output.speak(t)}stop(){this.output.stop()}}classa{constructor(){this.tts=newo(news),this.history=document.getElementById("output-area")}say(t){conste=document.createElement("p");e.appendChild(document.createTextNode(t)),this.history.appendChild(e)}}classr{constructor(t,e){this.handler=t,this.output=e,this.echoInput=!0,this.inputField=document.getElementById("input-area"),this.init()}setEcho(t){this.echoInput=t}init(){this.inputField.addEventListener("keydown",(t=>{if(13==t.which){constt=this.inputField.value;this.inputField.value="",this.echoInput&&this.output.say(`> ${t}`),this.handler.doCommand(t)}}))}}consth=[[["look","l"],function(t,e){if(1==t.length)e.examineRoom();else{consti=e.getRoom(e.player.currentRoom).getItems();lets=null;for(leteofi)if(e.name.includes(t[1])){s=e;break}s?(e.output.say(s.name),e.output.say(s.description)):e.output.say(`I could not find a ${t[1]}`)}}],[["use","interact"],asyncfunction(t,e){consti=e.getRoom(e.player.currentRoom).getItems();lets=null;for(leteofi)if(e.name.includes(t[1])){s=e;break}s?awaits.onUse():e.output.say(`I could not find a ${t[1]}`)}],[["take","get"],function(t,e){consti=e.getRoom(e.player.currentRoom),s=i.getItems();letn=null;for(leteofs)if(e.name.includes(t[1])){n=e;break}n?n.takeable?(i.removeItem(n.id),e.player.addItem(n.id),e.print(`You take ${n.name}`),n.onTake()):e.print(`You can't take ${n.name}`):e.print(`You can't find any ${t[1]}`)}],[["drop","put"],function(t,e){consti=e.getRoom(e.player.currentRoom),s=e.player.getInventory();letn=null;for(leteofs)if(e.name.includes(t[1])){n=e;break}n?(e.player.removeItem(n.id),i.addItem(n.id),e.print(`You set ${n.name} down on the floor.`),n.onDrop()):e.print(`You're not carrying a ${t[1]}`)}],["echo",function(t,e){"on"!=t[1]&&"off"!=t[1]?e.print("Usage: echo <on/off>"):(e.setInputEcho("on"==t[1]),e.print(`Command echo is now ${t[1]}`))}]],c=[["n","north"],["ne","northeast"],["e","east"],["se","southeast"],["s","south"],["sw","southwest"],["w","west"],["nw","northwest"],["u","up"],["d","down"]];classl{constructor(t,e){this.context=t,this.commands=e||newMap,this.enabled=!0,this.addDefaultCommands()}doCommand(t){if(!this.enabled)returnvoidthis.context.print("You can't seem to do anything at the moment.");conste=this.context.getRoom(this.context.player.currentRoom),i=t.split(" ");this.commands.get(i[0])&&this.commands.get(i[0])(i,this.context);consts=this.matchDirection(i[0]);e.getExit(s)&&this.context.move(e.getExit(s))}addCommand(t,e){Array.isArray(t)?t.forEach((t=>this.commands.set(t,e))):this.commands.set(t,e)}addCommands(t){t.forEach((t=>{this.addCommand(t[0],t[1])}))}addDefaultCommands(){this.addCommands(h)}matchDirection(t){for(leteofc)if(e[0]==t)returne[1]}}classu{constructor(){this.id="room",this.title="A room",this.descri