import{c as x}from"./chunk-S56QHLVT.js";import{J as Q,d as U,e as r}from"./chunk-ULPRULB6.js";import{J as T,O as t,W as A,Z as H,l as E,m as O}from"./chunk-RXF2JDJ3.js";import"./chunk-WAARL7ET.js";var n=H([[A.UP,0,1],[A.DOWN,0,2],[A.LEFT,0,4],[A.RIGHT,0,8],[A.A,0,16],[A.B,0,32],[A.P2_UP,1,1],[A.P2_DOWN,1,2],[A.P2_LEFT,1,4],[A.P2_RIGHT,1,8],[A.P2_A,1,16],[A.P2_B,1,32],[A.ANYKEY,2,0]]),o=0;var w=16,a=[A.VK_7,A.VK_6,A.VK_5,A.VK_4,A.VK_3,A.VK_2,A.VK_1,A.VK_0,A.VK_SEMICOLON,A.VK_CLOSE_BRACKET,A.VK_OPEN_BRACKET,A.VK_BACK_SLASH,A.VK_EQUALS,A.VK_MINUS,A.VK_9,A.VK_8,A.VK_B,A.VK_A,null,A.VK_SLASH,A.VK_PERIOD,A.VK_COMMA,A.VK_ACUTE,A.VK_QUOTE,A.VK_J,A.VK_I,A.VK_H,A.VK_G,A.VK_F,A.VK_E,A.VK_D,A.VK_C,A.VK_R,A.VK_Q,A.VK_P,A.VK_O,A.VK_N,A.VK_M,A.VK_L,A.VK_K,A.VK_Z,A.VK_Y,A.VK_X,A.VK_W,A.VK_V,A.VK_U,A.VK_T,A.VK_S,A.VK_F3,A.VK_F2,A.VK_F1,null,A.VK_CAPS_LOCK,null,A.VK_CONTROL,A.VK_SHIFT,A.VK_ENTER,null,A.VK_BACK_SPACE,null,A.VK_TAB,A.VK_ESCAPE,A.VK_F5,A.VK_F4,A.VK_RIGHT,A.VK_DOWN,A.VK_UP,A.VK_LEFT,A.VK_DELETE,A.VK_INSERT,A.VK_HOME,A.VK_SPACE,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],i=class extends x{constructor(){super();this.numVisibleScanlines=240;this.defaultROMSize=32768;this.ram=new Uint8Array(65536);this.slotmask=0;this.ppi_c=0;this.read=s=>{let e=s>>14<<1,D=this.slotmask>>e&3,g=this.slots[D];return g?g.read(s):0};this.write=(s,e)=>{let D=s>>14<<1,g=this.slotmask>>D&3,B=this.slots[g];B&&B.write(s,e)};this.init(this,this.newIOBus(),new r(new U)),this.bios=new E().decode(O(atob(l))),this.bios[3541]=0,this.bios[3542]=0,this.bios[3543]=0,this.slots=[{read:s=>this.bios[s]|0,write:(s,e)=>{}},{read:s=>this.rom[s-16384]|0,write:(s,e)=>{}},{read:s=>this.rom[s-16384]|0,write:(s,e)=>{}},{read:s=>this.ram[s]|0,write:(s,e)=>{this.ram[s]=e}}]}loadBIOS(s){this.bios=s}getKeyboardMap(){return n}getKeyboardFunction(){return(s,e,D,g)=>{for(var B=a,M=0;M>3,f=7-(M&7);g&t.KeyDown?this.inputs[w+R]|=1<{switch(s&=255,s){case 152:return this.vdp.readData();case 153:return this.vdp.readStatus();case 162:return this.psg.currentRegister()==14?~this.inputs[o]:this.psg.readData();case 168:return this.slotmask;case 169:return~this.inputs[w+(this.ppi_c&15)];case 170:return this.ppi_c}return 0},write:(s,e)=>{switch(s&=255,e&=255,s){case 152:this.vdp.writeData(e);break;case 153:this.vdp.writeAddress(e);break;case 168:this.slotmask=e;break;case 170:this.ppi_c=e;break;case 171:let D=e>>1&7;this.ppi_c=this.ppi_c&~(1<