diff --git a/gen/apple2-JWHRVLUW.js b/gen/apple2-R2IZZYTU.js similarity index 99% rename from gen/apple2-JWHRVLUW.js rename to gen/apple2-R2IZZYTU.js index 4a5917ef..88ea0844 100644 --- a/gen/apple2-JWHRVLUW.js +++ b/gen/apple2-R2IZZYTU.js @@ -1,4 +1,4 @@ -import{a as r0}from"./chunk-SAEVCPQX.js";import{B as e0,I as t0,q as x0,t as a0,y as z}from"./chunk-ORITJQOD.js";import{J as G,O as b,g as W,k as V,l as X,r as $,t as A}from"./chunk-QR47OPYG.js";import"./chunk-5XVCUSSZ.js";var E=2051,l0=E,O=E,u0=O-l0,N=class extends x0{constructor(){super();this.cpuFrequency=1022727;this.sampleRate=this.cpuFrequency;this.cpuCyclesPerLine=65;this.cpuCyclesPerFrame=this.cpuCyclesPerLine*262;this.canvasWidth=280;this.numVisibleScanlines=192;this.numTotalScanlines=262;this.defaultROMSize=48896-2051;this.ram=new Uint8Array(77824);this.cpu=new a0;this.grdirty=new Array(49152>>7);this.grparams={dirty:this.grdirty,grswitch:P,mem:this.ram};this.kbdlatch=0;this.soundstate=0;this.auxRAMselected=!1;this.auxRAMbank=1;this.writeinhibit=!0;this.bank2rdoffset=0;this.bank2wroffset=0;this.slots=new Array(8);this.fakeDrive={readROM:x=>{var a=this.cpu.getPC();if(a>=50688&&a<50944)switch(x){case 0:return 0;case 1:return E&255;case 2:return E>>8&255;default:return 0}else switch(x){case 0:return this.rom&&(console.log(`Loading program into Apple ][ RAM at $${O.toString(16)}`),this.ram.set(this.rom.slice(u0),O)),76;case 1:return 32;case 3:return 0;case 5:return 3;case 7:return 60;default:return 0}},readConst:x=>0,read:x=>this.floatbus(),write:(x,a)=>{}};this.loadBIOS(new V().decode(X(atob(g0)))),this.connectCPUMemoryBus(this),this.bios[54170-(65536-this.bios.length)]=96}saveState(){return{c:this.cpu.saveState(),ram:this.ram.slice(),kbdlatch:this.kbdlatch,soundstate:this.soundstate,grswitch:this.grparams.grswitch,auxRAMselected:this.auxRAMselected,auxRAMbank:this.auxRAMbank,writeinhibit:this.writeinhibit,slots:this.slots.map(x=>x&&x.saveState&&x.saveState()),inputs:null}}loadState(x){this.cpu.loadState(x.c),this.ram.set(x.ram),this.kbdlatch=x.kbdlatch,this.soundstate=x.soundstate,this.grparams.grswitch=x.grswitch,this.auxRAMselected=x.auxRAMselected,this.auxRAMbank=x.auxRAMbank,this.writeinhibit=x.writeinhibit,this.setupLanguageCardConstants();for(var a=0;a>8!=198);x++);for(var x=0;x<2e6&&(this.cpu.advanceClock(),!(this.cpu.getPC()>>8<198));x++);}readConst(x){if(x<49152)return this.ram[x];if(x>=53248)return this.auxRAMselected?x>=57344?this.ram[x]:this.ram[x+this.bank2rdoffset]:this.bios[x-(65536-this.bios.length)];if(x>=49408&&x<51200){var a=x>>8&7;return(this.slots[a]&&this.slots[a].readConst(x&255))|0}else return 0}read(x){if(x&=65535,x<49152||x>=53248)return this.readConst(x);if(x<49408){var a=x>>4&15;switch(a){case 0:return this.kbdlatch;case 1:this.kbdlatch&=127;break;case 3:this.soundstate=this.soundstate^1;break;case 5:(x&15)<8&&((x&1)!=0?this.grparams.grswitch|=1<<(x>>1&7):this.grparams.grswitch&=~(1<<(x>>1&7)));break;case 6:switch(x&7){case 1:case 2:case 3:return this.floatbus()&127;case 4:case 5:return this.floatbus()|128;default:return this.floatbus()}case 7:if(x==49264)return this.floatbus()|128;case 8:return this.doLanguageCardIO(x);case 9:case 10:case 11:case 12:case 13:case 14:case 15:return(this.slots[a-8]&&this.slots[a-8].read(x&15))|0}}else if(x>=49408&&x<51200){var a=x>>8&7;return(this.slots[a]&&this.slots[a].readROM(x&255))|0}return this.floatbus()}write(x,a){if(x&=65535,a&=255,x<49152)this.ram[x]=a,this.grdirty[x>>7]=1;else if(x<49280)this.read(x);else if(x<49408){var r=x>>4&15;this.slots[r-8]&&this.slots[r-8].write(x&15,a)}else x>=53248&&!this.writeinhibit&&(x>=57344?this.ram[x]=a:this.ram[x+this.bank2wroffset]=a)}floatbus(){var x=this.frameCycles,a=Math.floor(x/65),r=Math.floor(x%65),d=this.ap2disp.getAddressForScanline(a);return this.readConst(d+r)}connectVideo(x){super.connectVideo(x),this.ap2disp=this.pixels&&new d0(this.pixels,this.grparams)}startScanline(){}drawScanline(){}advanceFrame(x){var a=super.advanceFrame(x);return this.ap2disp&&this.ap2disp.updateScreen(),a}advanceCPU(){return this.audio.feedSample(this.soundstate,1),super.advanceCPU()}setKeyInput(x,a,r){if(r&b.KeyDown){switch(a=0,x){case 16:case 17:case 18:break;case 8:if(a=8,r&b.Shift){this.cpu.reset();return}break;case 13:a=13;break;case 27:a=27;break;case 37:a=8;break;case 39:a=21;break;case 38:a=11;break;case 40:a=10;break;case 48:r&b.Shift&&(a=41);break;case 49:r&b.Shift&&(a=33);break;case 50:r&b.Shift&&(a=64);break;case 51:r&b.Shift&&(a=35);break;case 52:r&b.Shift&&(a=36);break;case 53:r&b.Shift&&(a=37);break;case 54:r&b.Shift&&(a=94);break;case 55:r&b.Shift&&(a=38);break;case 56:r&b.Shift&&(a=42);break;case 57:r&b.Shift&&(a=40);break;case 61:a=r&b.Shift?43:61;break;case 173:a=r&b.Shift?95:45;break;case 59:a=r&b.Shift?58:59;break;case 188:a=r&b.Shift?60:44;break;case 190:a=r&b.Shift?62:46;break;case 191:a=r&b.Shift?63:47;break;case 222:a=r&b.Shift?34:39;break;default:a=x,a>=97&&a<=122&&(a-=32),a>=65&&a<65+26&&r&b.Ctrl&&(a-=64)}a&&(this.kbdlatch=(a|128)&255)}}doLanguageCardIO(x){switch(x&15){case 0:case 4:this.auxRAMselected=!0,this.auxRAMbank=2,this.writeinhibit=!0;break;case 1:case 5:this.auxRAMselected=!1,this.auxRAMbank=2,this.writeinhibit=!1;break;case 2:case 6:case 10:case 14:this.auxRAMselected=!1,this.writeinhibit=!0;break;case 3:case 7:this.auxRAMselected=!0,this.auxRAMbank=2,this.writeinhibit=!1;break;case 8:case 12:this.auxRAMselected=!0,this.auxRAMbank=1,this.writeinhibit=!0;break;case 9:case 13:this.auxRAMselected=!1,this.auxRAMbank=1,this.writeinhibit=!1;break;case 11:case 15:this.auxRAMselected=!0,this.auxRAMbank=1,this.writeinhibit=!1;break}return this.setupLanguageCardConstants(),this.floatbus()}setupLanguageCardConstants(){this.auxRAMbank==2?this.bank2rdoffset=-4096:this.bank2rdoffset=12288,this.auxRAMbank==2?this.bank2wroffset=-4096:this.bank2wroffset=12288}getDebugCategories(){return["CPU","Stack","I/O","Disk"]}getDebugInfo(x,a){switch(x){case"I/O":return"AUX RAM Bank: "+a.auxRAMbank+` +import{a as r0}from"./chunk-ODZVP52Q.js";import{B as e0,I as t0,q as x0,t as a0,y as z}from"./chunk-TV4YGKI4.js";import{J as G,O as b,g as W,k as V,l as X,r as $,t as A}from"./chunk-Z5CU44VP.js";import"./chunk-5XVCUSSZ.js";var E=2051,l0=E,O=E,u0=O-l0,N=class extends x0{constructor(){super();this.cpuFrequency=1022727;this.sampleRate=this.cpuFrequency;this.cpuCyclesPerLine=65;this.cpuCyclesPerFrame=this.cpuCyclesPerLine*262;this.canvasWidth=280;this.numVisibleScanlines=192;this.numTotalScanlines=262;this.defaultROMSize=48896-2051;this.ram=new Uint8Array(77824);this.cpu=new a0;this.grdirty=new Array(49152>>7);this.grparams={dirty:this.grdirty,grswitch:P,mem:this.ram};this.kbdlatch=0;this.soundstate=0;this.auxRAMselected=!1;this.auxRAMbank=1;this.writeinhibit=!0;this.bank2rdoffset=0;this.bank2wroffset=0;this.slots=new Array(8);this.fakeDrive={readROM:x=>{var a=this.cpu.getPC();if(a>=50688&&a<50944)switch(x){case 0:return 0;case 1:return E&255;case 2:return E>>8&255;default:return 0}else switch(x){case 0:return this.rom&&(console.log(`Loading program into Apple ][ RAM at $${O.toString(16)}`),this.ram.set(this.rom.slice(u0),O)),76;case 1:return 32;case 3:return 0;case 5:return 3;case 7:return 60;default:return 0}},readConst:x=>0,read:x=>this.floatbus(),write:(x,a)=>{}};this.loadBIOS(new V().decode(X(atob(g0)))),this.connectCPUMemoryBus(this),this.bios[54170-(65536-this.bios.length)]=96}saveState(){return{c:this.cpu.saveState(),ram:this.ram.slice(),kbdlatch:this.kbdlatch,soundstate:this.soundstate,grswitch:this.grparams.grswitch,auxRAMselected:this.auxRAMselected,auxRAMbank:this.auxRAMbank,writeinhibit:this.writeinhibit,slots:this.slots.map(x=>x&&x.saveState&&x.saveState()),inputs:null}}loadState(x){this.cpu.loadState(x.c),this.ram.set(x.ram),this.kbdlatch=x.kbdlatch,this.soundstate=x.soundstate,this.grparams.grswitch=x.grswitch,this.auxRAMselected=x.auxRAMselected,this.auxRAMbank=x.auxRAMbank,this.writeinhibit=x.writeinhibit,this.setupLanguageCardConstants();for(var a=0;a>8!=198);x++);for(var x=0;x<2e6&&(this.cpu.advanceClock(),!(this.cpu.getPC()>>8<198));x++);}readConst(x){if(x<49152)return this.ram[x];if(x>=53248)return this.auxRAMselected?x>=57344?this.ram[x]:this.ram[x+this.bank2rdoffset]:this.bios[x-(65536-this.bios.length)];if(x>=49408&&x<51200){var a=x>>8&7;return(this.slots[a]&&this.slots[a].readConst(x&255))|0}else return 0}read(x){if(x&=65535,x<49152||x>=53248)return this.readConst(x);if(x<49408){var a=x>>4&15;switch(a){case 0:return this.kbdlatch;case 1:this.kbdlatch&=127;break;case 3:this.soundstate=this.soundstate^1;break;case 5:(x&15)<8&&((x&1)!=0?this.grparams.grswitch|=1<<(x>>1&7):this.grparams.grswitch&=~(1<<(x>>1&7)));break;case 6:switch(x&7){case 1:case 2:case 3:return this.floatbus()&127;case 4:case 5:return this.floatbus()|128;default:return this.floatbus()}case 7:if(x==49264)return this.floatbus()|128;case 8:return this.doLanguageCardIO(x);case 9:case 10:case 11:case 12:case 13:case 14:case 15:return(this.slots[a-8]&&this.slots[a-8].read(x&15))|0}}else if(x>=49408&&x<51200){var a=x>>8&7;return(this.slots[a]&&this.slots[a].readROM(x&255))|0}return this.floatbus()}write(x,a){if(x&=65535,a&=255,x<49152)this.ram[x]=a,this.grdirty[x>>7]=1;else if(x<49280)this.read(x);else if(x<49408){var r=x>>4&15;this.slots[r-8]&&this.slots[r-8].write(x&15,a)}else x>=53248&&!this.writeinhibit&&(x>=57344?this.ram[x]=a:this.ram[x+this.bank2wroffset]=a)}floatbus(){var x=this.frameCycles,a=Math.floor(x/65),r=Math.floor(x%65),d=this.ap2disp.getAddressForScanline(a);return this.readConst(d+r)}connectVideo(x){super.connectVideo(x),this.ap2disp=this.pixels&&new d0(this.pixels,this.grparams)}startScanline(){}drawScanline(){}advanceFrame(x){var a=super.advanceFrame(x);return this.ap2disp&&this.ap2disp.updateScreen(),a}advanceCPU(){return this.audio.feedSample(this.soundstate,1),super.advanceCPU()}setKeyInput(x,a,r){if(r&b.KeyDown){switch(a=0,x){case 16:case 17:case 18:break;case 8:if(a=8,r&b.Shift){this.cpu.reset();return}break;case 13:a=13;break;case 27:a=27;break;case 37:a=8;break;case 39:a=21;break;case 38:a=11;break;case 40:a=10;break;case 48:r&b.Shift&&(a=41);break;case 49:r&b.Shift&&(a=33);break;case 50:r&b.Shift&&(a=64);break;case 51:r&b.Shift&&(a=35);break;case 52:r&b.Shift&&(a=36);break;case 53:r&b.Shift&&(a=37);break;case 54:r&b.Shift&&(a=94);break;case 55:r&b.Shift&&(a=38);break;case 56:r&b.Shift&&(a=42);break;case 57:r&b.Shift&&(a=40);break;case 61:a=r&b.Shift?43:61;break;case 173:a=r&b.Shift?95:45;break;case 59:a=r&b.Shift?58:59;break;case 188:a=r&b.Shift?60:44;break;case 190:a=r&b.Shift?62:46;break;case 191:a=r&b.Shift?63:47;break;case 222:a=r&b.Shift?34:39;break;default:a=x,a>=97&&a<=122&&(a-=32),a>=65&&a<65+26&&r&b.Ctrl&&(a-=64)}a&&(this.kbdlatch=(a|128)&255)}}doLanguageCardIO(x){switch(x&15){case 0:case 4:this.auxRAMselected=!0,this.auxRAMbank=2,this.writeinhibit=!0;break;case 1:case 5:this.auxRAMselected=!1,this.auxRAMbank=2,this.writeinhibit=!1;break;case 2:case 6:case 10:case 14:this.auxRAMselected=!1,this.writeinhibit=!0;break;case 3:case 7:this.auxRAMselected=!0,this.auxRAMbank=2,this.writeinhibit=!1;break;case 8:case 12:this.auxRAMselected=!0,this.auxRAMbank=1,this.writeinhibit=!0;break;case 9:case 13:this.auxRAMselected=!1,this.auxRAMbank=1,this.writeinhibit=!1;break;case 11:case 15:this.auxRAMselected=!0,this.auxRAMbank=1,this.writeinhibit=!1;break}return this.setupLanguageCardConstants(),this.floatbus()}setupLanguageCardConstants(){this.auxRAMbank==2?this.bank2rdoffset=-4096:this.bank2rdoffset=12288,this.auxRAMbank==2?this.bank2wroffset=-4096:this.bank2wroffset=12288}getDebugCategories(){return["CPU","Stack","I/O","Disk"]}getDebugInfo(x,a){switch(x){case"I/O":return"AUX RAM Bank: "+a.auxRAMbank+` AUX RAM Select: `+a.auxRAMselected+` AUX RAM Write: `+!a.writeinhibit+` @@ -10,4 +10,4 @@ Mode: `+(this.read_mode?"READ":"WRITE")+` Motor: `+this.motor+` Data: `+(this.track_data?W(this.track_data[this.track_index]):"-")+` `}read_latch(){return this.track_index=(this.track_index+1)%H,this.track_data?this.track_data[this.track_index]&255:this.emu.floatbus()|128}write_latch(x){this.track_index=(this.track_index+1)%H,this.track_data!=null&&(this.track_data[this.track_index]=x)}readROM(x){return s0[x]}readConst(x){return s0[x]}read(x){return this.doIO(x,0)}write(x,a){this.doIO(x,a)}doIO(x,a){switch(x&15){case 1:case 3:case 5:case 7:var r,d,e;e=this.track,r=x>>1&3,r==(e-1&3)?e>0&&e--:r==(e+1&3)&&e>1],console.log("track",e/2)):this.track_data=null,this.track=e;break;case 8:this.motor=!1;break;case 9:this.motor=!0;break;case 10:break;case 11:break;case 15:this.read_mode=!1;case 12:if(this.read_mode)return this.read_latch();break;case 14:this.read_mode=!0;case 13:return a>=0&&!this.read_mode&&!this.write_protect&&this.write_latch(a),this.write_protect?128:0}return this.emu.floatbus()}},T=[150,151,154,155,157,158,159,166,167,171,172,173,174,175,178,179,180,181,182,183,185,186,187,188,189,190,191,203,205,206,207,211,214,215,217,218,219,220,221,222,223,229,230,231,233,234,235,236,237,238,239,242,243,244,245,246,247,249,250,251,252,253,254,255],S0=[0,7,14,6,13,5,12,4,11,3,10,2,9,1,8,15];function B0(i,x,a,r,d,e,n){var c,p,S,l,k=new Uint8Array(258);for(l=0,c=0;c<14;c++)e[n++]=255;for(e[n++]=213,e[n++]=170,e[n++]=150,e[n++]=i>>1|170,e[n++]=i|170,p=i,e[n++]=x>>1|170,e[n++]=x|170,p^=x,e[n++]=a>>1|170,e[n++]=a|170,p^=a,e[n++]=p>>1|170,e[n++]=p|170,e[n++]=222,e[n++]=170,e[n++]=235,c=0;c<6;c++)e[n++]=255;for(e[n++]=213,e[n++]=170,e[n++]=173,c=0;c<256;c++)k[c]=r[c+d]&255;for(k[256]=0,k[257]=0,S=0,c=0;c<86;c++)l=(k[c]&1)<<1,l|=(k[c]&2)>>1,l|=(k[c+86]&1)<<3,l|=(k[c+86]&2)<<1,l|=(k[c+172]&1)<<5,l|=(k[c+172]&2)<<3,e[n++]=T[l^S],S=l;for(c=0;c<256;c++)l=k[c]>>2,e[n++]=T[l^S],S=l;e[n++]=T[l],e[n++]=222,e[n++]=170,e[n++]=235}function p0(i,x,a){for(var r=new Uint8Array(H),d=0,e=0;e<16;e++)B0(i,x,e,a,S0[e]<<8,r,d),d+=C0;for(;dx.endsWith(".lnk")?"merlin32":z(x)}newMachine(){return new N}getPresets(){return n0}getDefaultExtension(){return".c"}readAddress(x){return this.machine.readConst(x)}getROMExtension(x){return x&&x.length==35*16*256?".dsk":".bin"}};G["apple2.mame"]=f0;G.apple2=o0; -//# sourceMappingURL=apple2-JWHRVLUW.js.map +//# sourceMappingURL=apple2-R2IZZYTU.js.map diff --git a/gen/apple2-JWHRVLUW.js.map b/gen/apple2-R2IZZYTU.js.map similarity index 100% rename from gen/apple2-JWHRVLUW.js.map rename to gen/apple2-R2IZZYTU.js.map diff --git a/gen/arm32-MPS3F7DU.js b/gen/arm32-4273FZME.js similarity index 99% rename from gen/arm32-MPS3F7DU.js rename to gen/arm32-4273FZME.js index c1a44553..4260953a 100644 --- a/gen/arm32-MPS3F7DU.js +++ b/gen/arm32-4273FZME.js @@ -1,7 +1,7 @@ -import{H as j,q}from"./chunk-ORITJQOD.js";import{$ as L,D as J,J as Y,S as y,V as S,W as z,Y as X,a as N,g as E}from"./chunk-QR47OPYG.js";import"./chunk-5XVCUSSZ.js";var g;(function(o){o[o.MODE_ARM=0]="MODE_ARM",o[o.MODE_THUMB=1]="MODE_THUMB",o[o.MODE_USER=16]="MODE_USER",o[o.MODE_FIQ=17]="MODE_FIQ",o[o.MODE_IRQ=18]="MODE_IRQ",o[o.MODE_SUPERVISOR=19]="MODE_SUPERVISOR",o[o.MODE_ABORT=23]="MODE_ABORT",o[o.MODE_UNDEFINED=27]="MODE_UNDEFINED",o[o.MODE_SYSTEM=31]="MODE_SYSTEM"})(g||(g={}));var u;(function(t){t[t.SP=13]="SP",t[t.LR=14]="LR",t[t.PC=15]="PC"})(u||(u={}));var b;(function(l){l[l.BANK_NONE=0]="BANK_NONE",l[l.BANK_FIQ=1]="BANK_FIQ",l[l.BANK_IRQ=2]="BANK_IRQ",l[l.BANK_SUPERVISOR=3]="BANK_SUPERVISOR",l[l.BANK_ABORT=4]="BANK_ABORT",l[l.BANK_UNDEFINED=5]="BANK_UNDEFINED",l[l.WORD_SIZE_ARM=4]="WORD_SIZE_ARM",l[l.WORD_SIZE_THUMB=2]="WORD_SIZE_THUMB",l[l.BASE_RESET=0]="BASE_RESET",l[l.BASE_UNDEF=4]="BASE_UNDEF",l[l.BASE_SWI=8]="BASE_SWI",l[l.BASE_PABT=12]="BASE_PABT",l[l.BASE_DABT=16]="BASE_DABT",l[l.BASE_IRQ=24]="BASE_IRQ",l[l.BASE_FIQ=28]="BASE_FIQ"})(b||(b={}));var $=4026531840,rr=223,or=32;function F(s){this.cpu=s,this.addressingMode23Immediate=[function(e,i,t){var r=s.gprs,a=function(){var c=r[e];return(!t||t())&&(r[e]-=i),c};return a.writesPC=e==15,a},null,null,null,function(e,i,t){var r=s.gprs,a=function(){var c=r[e];return(!t||t())&&(r[e]+=i),c};return a.writesPC=e==15,a},null,null,null,function(e,i,t){var r=s.gprs,a=function(){return r[e]-i};return a.writesPC=!1,a},function(e,i,t){var r=s.gprs,a=function(){var c=r[e]-i;return(!t||t())&&(r[e]=c),c};return a.writesPC=e==15,a},null,null,function(e,i,t){var r=s.gprs,a=function(){return r[e]+i};return a.writesPC=!1,a},function(e,i,t){var r=s.gprs,a=function(){var c=r[e]+i;return(!t||t())&&(r[e]=c),c};return a.writesPC=e==15,a},null,null],this.addressingMode23Register=[function(e,i,t){var r=s.gprs,a=function(){var c=r[e];return(!t||t())&&(r[e]-=r[i]),c};return a.writesPC=e==15,a},null,null,null,function(e,i,t){var r=s.gprs,a=function(){var c=r[e];return(!t||t())&&(r[e]+=r[i]),c};return a.writesPC=e==15,a},null,null,null,function(e,i,t){var r=s.gprs,a=function(){return r[e]-r[i]};return a.writesPC=!1,a},function(e,i,t){var r=s.gprs,a=function(){var c=r[e]-r[i];return(!t||t())&&(r[e]=c),c};return a.writesPC=e==15,a},null,null,function(e,i,t){var r=s.gprs,a=function(){var c=r[e]+r[i];return c};return a.writesPC=!1,a},function(e,i,t){var r=s.gprs,a=function(){var c=r[e]+r[i];return(!t||t())&&(r[e]=c),c};return a.writesPC=e==15,a},null,null],this.addressingMode2RegisterShifted=[function(e,i,t){var r=s.gprs,a=function(){var c=r[e];return(!t||t())&&(i(),r[e]-=s.shifterOperand),c};return a.writesPC=e==15,a},null,null,null,function(e,i,t){var r=s.gprs,a=function(){var c=r[e];return(!t||t())&&(i(),r[e]+=s.shifterOperand),c};return a.writesPC=e==15,a},null,null,null,function(e,i,t){var r=s.gprs,a=function(){return i(),r[e]-s.shifterOperand};return a.writesPC=!1,a},function(e,i,t){var r=s.gprs,a=function(){i();var c=r[e]-s.shifterOperand;return(!t||t())&&(r[e]=c),c};return a.writesPC=e==15,a},null,null,function(e,i,t){var r=s.gprs,a=function(){return i(),r[e]+s.shifterOperand};return a.writesPC=!1,a},function(e,i,t){var r=s.gprs,a=function(){i();var c=r[e]+s.shifterOperand;return(!t||t())&&(r[e]=c),c};return a.writesPC=e==15,a},null,null]}F.prototype.constructAddressingMode1ASR=function(s,e){var i=this.cpu,t=i.gprs;return function(){++i.cycles;var r=t[s];s==15&&(r+=4),r&=255;var a=t[e];e==15&&(a+=4),r==0?(i.shifterOperand=a,i.shifterCarryOut=i.cpsrC):r<32?(i.shifterOperand=a>>r,i.shifterCarryOut=a&1<>31?(i.shifterOperand=4294967295,i.shifterCarryOut=2147483648):(i.shifterOperand=0,i.shifterCarryOut=0)}};F.prototype.constructAddressingMode1Immediate=function(s){var e=this.cpu;return function(){e.shifterOperand=s,e.shifterCarryOut=e.cpsrC}};F.prototype.constructAddressingMode1ImmediateRotate=function(s,e){var i=this.cpu;return function(){i.shifterOperand=s>>>e|s<<32-e,i.shifterCarryOut=i.shifterOperand>>31}};F.prototype.constructAddressingMode1LSL=function(s,e){var i=this.cpu,t=i.gprs;return function(){++i.cycles;var r=t[s];s==15&&(r+=4),r&=255;var a=t[e];e==15&&(a+=4),r==0?(i.shifterOperand=a,i.shifterCarryOut=i.cpsrC):r<32?(i.shifterOperand=a<>>r,i.shifterCarryOut=a&1<>31):(i.shifterOperand=0,i.shifterCarryOut=0)}};F.prototype.constructAddressingMode1ROR=function(s,e){var i=this.cpu,t=i.gprs;return function(){++i.cycles;var r=t[s];s==15&&(r+=4),r&=255;var a=t[e];e==15&&(a+=4);var c=r&31;r==0?(i.shifterOperand=a,i.shifterCarryOut=i.cpsrC):c?(i.shifterOperand=t[e]>>>c|t[e]<<32-c,i.shifterCarryOut=a&1<>31)}};F.prototype.constructAddressingMode23Immediate=function(s,e,i){var t=(s&983040)>>16;return this.addressingMode23Immediate[(s&27262976)>>21](t,e,i)};F.prototype.constructAddressingMode23Register=function(s,e,i){var t=(s&983040)>>16;return this.addressingMode23Register[(s&27262976)>>21](t,e,i)};F.prototype.constructAddressingMode2RegisterShifted=function(s,e,i){var t=(s&983040)>>16;return this.addressingMode2RegisterShifted[(s&27262976)>>21](t,e,i)};F.prototype.constructAddressingMode4=function(s,e){var i=this.cpu,t=i.gprs;return function(){var r=t[e]+s;return r}};F.prototype.constructAddressingMode4Writeback=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(c){var p=a[i]+s;return c&&t&&r.mmu.store32(a[i]+s-4,a[i]),a[i]+=e,p}};F.prototype.constructADC=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){i();var c=(r.shifterOperand>>>0)+(r.cpsrC?1:0);a[s]=(a[e]>>>0)+c}}};F.prototype.constructADCS=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){i();var c=(r.shifterOperand>>>0)+(r.cpsrC?1:0),p=(a[e]>>>0)+c;s==15&&r.hasSPSR()?r.unpackCPSR(r.spsr):(r.cpsrN=p>>31,r.cpsrZ=!(p&4294967295),r.cpsrC=p>4294967295,r.cpsrV=a[e]>>31==c>>31&&a[e]>>31!=p>>31&&c>>31!=p>>31),a[s]=p}}};F.prototype.constructADD=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=(a[e]>>>0)+(r.shifterOperand>>>0))}};F.prototype.constructADDS=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){i();var c=(a[e]>>>0)+(r.shifterOperand>>>0);s==15&&r.hasSPSR()?r.unpackCPSR(r.spsr):(r.cpsrN=c>>31,r.cpsrZ=!(c&4294967295),r.cpsrC=c>4294967295,r.cpsrV=a[e]>>31==r.shifterOperand>>31&&a[e]>>31!=c>>31&&r.shifterOperand>>31!=c>>31),a[s]=c}}};F.prototype.constructAND=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=a[e]&r.shifterOperand)}};F.prototype.constructANDS=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=a[e]&r.shifterOperand,s==15&&r.hasSPSR()?r.unpackCPSR(r.spsr):(r.cpsrN=a[s]>>31,r.cpsrZ=!(a[s]&4294967295),r.cpsrC=r.shifterCarryOut))}};F.prototype.constructB=function(s,e){var i=this.cpu,t=i.gprs;return function(){if(e&&!e()){i.mmu.waitPrefetch32(t[15]);return}i.mmu.waitPrefetch32(t[15]),t[15]+=s}};F.prototype.constructBIC=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=a[e]&~r.shifterOperand)}};F.prototype.constructBICS=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=a[e]&~r.shifterOperand,s==15&&r.hasSPSR()?r.unpackCPSR(r.spsr):(r.cpsrN=a[s]>>31,r.cpsrZ=!(a[s]&4294967295),r.cpsrC=r.shifterCarryOut))}};F.prototype.constructBL=function(s,e){var i=this.cpu,t=i.gprs;return function(){if(e&&!e()){i.mmu.waitPrefetch32(t[15]);return}i.mmu.waitPrefetch32(t[15]),t[14]=t[15]-4,t[15]+=s}};F.prototype.constructBX=function(s,e){var i=this.cpu,t=i.gprs;return function(){if(e&&!e()){i.mmu.waitPrefetch32(t[15]);return}i.mmu.waitPrefetch32(t[15]),i.switchExecMode(t[s]&1),t[15]=t[s]&4294967294}};F.prototype.constructCMN=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){i();var c=(a[e]>>>0)+(r.shifterOperand>>>0);r.cpsrN=c>>31,r.cpsrZ=!(c&4294967295),r.cpsrC=c>4294967295,r.cpsrV=a[e]>>31==r.shifterOperand>>31&&a[e]>>31!=c>>31&&r.shifterOperand>>31!=c>>31}}};F.prototype.constructCMP=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){i();var c=a[e]-r.shifterOperand;r.cpsrN=c>>31,r.cpsrZ=!(c&4294967295),r.cpsrC=a[e]>>>0>=r.shifterOperand>>>0,r.cpsrV=a[e]>>31!=r.shifterOperand>>31&&a[e]>>31!=c>>31}}};F.prototype.constructEOR=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=a[e]^r.shifterOperand)}};F.prototype.constructEORS=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=a[e]^r.shifterOperand,s==15&&r.hasSPSR()?r.unpackCPSR(r.spsr):(r.cpsrN=a[s]>>31,r.cpsrZ=!(a[s]&4294967295),r.cpsrC=r.shifterCarryOut))}};F.prototype.constructLDM=function(s,e,i){var t=this.cpu,r=t.gprs,a=t.mmu;return function(){if(a.waitPrefetch32(r[15]),!(i&&!i())){var c=e(!1),p=0,n,o;for(n=s,o=0;n;n>>=1,++o)n&1&&(r[o]=a.load32(c&4294967292),c+=4,++p);a.waitMulti32(c,p),++t.cycles}}};F.prototype.constructLDMS=function(s,e,i){var t=this.cpu,r=t.gprs,a=t.mmu;return function(){if(a.waitPrefetch32(r[15]),!(i&&!i())){var c=e(!1),p=0,n=t.mode;t.switchMode(31);var o,v;for(o=s,v=0;o;o>>=1,++v)o&1&&(r[v]=a.load32(c&4294967292),c+=4,++p);t.switchMode(n),a.waitMulti32(c,p),++t.cycles}}};F.prototype.constructLDR=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){if(t.mmu.waitPrefetch32(r[15]),!(i&&!i())){var a=e();r[s]=t.mmu.load32(a),t.mmu.wait32(a),++t.cycles}}};F.prototype.constructLDRB=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){if(t.mmu.waitPrefetch32(r[15]),!(i&&!i())){var a=e();r[s]=t.mmu.loadU8(a),t.mmu.wait(a),++t.cycles}}};F.prototype.constructLDRH=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){if(t.mmu.waitPrefetch32(r[15]),!(i&&!i())){var a=e();r[s]=t.mmu.loadU16(a),t.mmu.wait(a),++t.cycles}}};F.prototype.constructLDRSB=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){if(t.mmu.waitPrefetch32(r[15]),!(i&&!i())){var a=e();r[s]=t.mmu.load8(a),t.mmu.wait(a),++t.cycles}}};F.prototype.constructLDRSH=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){if(t.mmu.waitPrefetch32(r[15]),!(i&&!i())){var a=e();r[s]=t.mmu.load16(a),t.mmu.wait(a),++t.cycles}}};F.prototype.constructMLA=function(s,e,i,t,r){var a=this.cpu,c=a.gprs;return function(){if(a.mmu.waitPrefetch32(c[15]),!(r&&!r()))if(++a.cycles,a.mmu.waitMul(i),c[t]&4294901760&&c[i]&4294901760){var p=(c[t]&4294901760)*c[i]&4294967295,n=(c[t]&65535)*c[i]&4294967295;c[s]=p+n+c[e]&4294967295}else c[s]=c[t]*c[i]+c[e]}};F.prototype.constructMLAS=function(s,e,i,t,r){var a=this.cpu,c=a.gprs;return function(){if(a.mmu.waitPrefetch32(c[15]),!(r&&!r())){if(++a.cycles,a.mmu.waitMul(i),c[t]&4294901760&&c[i]&4294901760){var p=(c[t]&4294901760)*c[i]&4294967295,n=(c[t]&65535)*c[i]&4294967295;c[s]=p+n+c[e]&4294967295}else c[s]=c[t]*c[i]+c[e];a.cpsrN=c[s]>>31,a.cpsrZ=!(c[s]&4294967295)}}};F.prototype.constructMOV=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=r.shifterOperand)}};F.prototype.constructMOVS=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=r.shifterOperand,s==15&&r.hasSPSR()?r.unpackCPSR(r.spsr):(r.cpsrN=a[s]>>31,r.cpsrZ=!(a[s]&4294967295),r.cpsrC=r.shifterCarryOut))}};F.prototype.constructMRS=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){t.mmu.waitPrefetch32(r[15]),!(i&&!i())&&(e?r[s]=t.spsr:r[s]=t.packCPSR())}};F.prototype.constructMSR=function(s,e,i,t,r){var a=this.cpu,c=a.gprs,p=i&65536,n=i&524288;return function(){if(a.mmu.waitPrefetch32(c[15]),!(r&&!r())){var o;i&33554432?o=t:o=c[s];var v=(p?255:0)|(n?4278190080:0);e?(v&=$|rr|or,a.spsr=a.spsr&~v|o&v):(v&$&&(a.cpsrN=o>>31,a.cpsrZ=o&1073741824,a.cpsrC=o&536870912,a.cpsrV=o&268435456),a.mode!=16&&v&rr&&(a.switchMode(o&15|16),a.cpsrI=o&128,a.cpsrF=o&64))}}};F.prototype.constructMUL=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t()))if(r.mmu.waitMul(a[e]),a[i]&4294901760&&a[e]&4294901760){var c=(a[i]&4294901760)*a[e]|0,p=(a[i]&65535)*a[e]|0;a[s]=c+p}else a[s]=a[i]*a[e]}};F.prototype.constructMULS=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){if(r.mmu.waitMul(a[e]),a[i]&4294901760&&a[e]&4294901760){var c=(a[i]&4294901760)*a[e]|0,p=(a[i]&65535)*a[e]|0;a[s]=c+p}else a[s]=a[i]*a[e];r.cpsrN=a[s]>>31,r.cpsrZ=!(a[s]&4294967295)}}};F.prototype.constructMVN=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=~r.shifterOperand)}};F.prototype.constructMVNS=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=~r.shifterOperand,s==15&&r.hasSPSR()?r.unpackCPSR(r.spsr):(r.cpsrN=a[s]>>31,r.cpsrZ=!(a[s]&4294967295),r.cpsrC=r.shifterCarryOut))}};F.prototype.constructORR=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=a[e]|r.shifterOperand)}};F.prototype.constructORRS=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=a[e]|r.shifterOperand,s==15&&r.hasSPSR()?r.unpackCPSR(r.spsr):(r.cpsrN=a[s]>>31,r.cpsrZ=!(a[s]&4294967295),r.cpsrC=r.shifterCarryOut))}};F.prototype.constructRSB=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=r.shifterOperand-a[e])}};F.prototype.constructRSBS=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){i();var c=r.shifterOperand-a[e];s==15&&r.hasSPSR()?r.unpackCPSR(r.spsr):(r.cpsrN=c>>31,r.cpsrZ=!(c&4294967295),r.cpsrC=r.shifterOperand>>>0>=a[e]>>>0,r.cpsrV=r.shifterOperand>>31!=a[e]>>31&&r.shifterOperand>>31!=c>>31),a[s]=c}}};F.prototype.constructRSC=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){i();var c=(a[e]>>>0)+(r.cpsrC?0:1);a[s]=(r.shifterOperand>>>0)-c}}};F.prototype.constructRSCS=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){i();var c=(a[e]>>>0)+(r.cpsrC?0:1),p=(r.shifterOperand>>>0)-c;s==15&&r.hasSPSR()?r.unpackCPSR(r.spsr):(r.cpsrN=p>>31,r.cpsrZ=!(p&4294967295),r.cpsrC=r.shifterOperand>>>0>=p>>>0,r.cpsrV=r.shifterOperand>>31!=c>>31&&r.shifterOperand>>31!=p>>31),a[s]=p}}};F.prototype.constructSBC=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){i();var c=(r.shifterOperand>>>0)+(r.cpsrC?0:1);a[s]=(a[e]>>>0)-c}}};F.prototype.constructSBCS=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){i();var c=(r.shifterOperand>>>0)+(r.cpsrC?0:1),p=(a[e]>>>0)-c;s==15&&r.hasSPSR()?r.unpackCPSR(r.spsr):(r.cpsrN=p>>31,r.cpsrZ=!(p&4294967295),r.cpsrC=a[e]>>>0>=p>>>0,r.cpsrV=a[e]>>31!=c>>31&&a[e]>>31!=p>>31),a[s]=p}}};F.prototype.constructSMLAL=function(s,e,i,t,r){var a=this.cpu,c=1/4294967296,p=a.gprs;return function(){if(a.mmu.waitPrefetch32(p[15]),!(r&&!r())){a.cycles+=2,a.mmu.waitMul(i);var n=(p[t]&4294901760)*p[i],o=(p[t]&65535)*p[i],v=(p[e]>>>0)+n+o;p[e]=v,p[s]+=Math.floor(v*c)}}};F.prototype.constructSMLALS=function(s,e,i,t,r){var a=this.cpu,c=1/4294967296,p=a.gprs;return function(){if(a.mmu.waitPrefetch32(p[15]),!(r&&!r())){a.cycles+=2,a.mmu.waitMul(i);var n=(p[t]&4294901760)*p[i],o=(p[t]&65535)*p[i],v=(p[e]>>>0)+n+o;p[e]=v,p[s]+=Math.floor(v*c),a.cpsrN=p[s]>>31,a.cpsrZ=!(p[s]&4294967295||p[e]&4294967295)}}};F.prototype.constructSMULL=function(s,e,i,t,r){var a=this.cpu,c=1/4294967296,p=a.gprs;return function(){if(a.mmu.waitPrefetch32(p[15]),!(r&&!r())){++a.cycles,a.mmu.waitMul(p[i]);var n=((p[t]&4294901760)>>0)*(p[i]>>0),o=((p[t]&65535)>>0)*(p[i]>>0);p[e]=(n&4294967295)+(o&4294967295)&4294967295,p[s]=Math.floor(n*c+o*c)}}};F.prototype.constructSMULLS=function(s,e,i,t,r){var a=this.cpu,c=1/4294967296,p=a.gprs;return function(){if(a.mmu.waitPrefetch32(p[15]),!(r&&!r())){++a.cycles,a.mmu.waitMul(p[i]);var n=((p[t]&4294901760)>>0)*(p[i]>>0),o=((p[t]&65535)>>0)*(p[i]>>0);p[e]=(n&4294967295)+(o&4294967295)&4294967295,p[s]=Math.floor(n*c+o*c),a.cpsrN=p[s]>>31,a.cpsrZ=!(p[s]&4294967295||p[e]&4294967295)}}};F.prototype.constructSTM=function(s,e,i){var t=this.cpu,r=t.gprs,a=t.mmu;return function(){if(i&&!i()){a.waitPrefetch32(r[15]);return}a.wait32(r[15]);var c=e(!0),p=0,n,o;for(n=s,o=0;n;n>>=1,++o)n&1&&(a.store32(c,r[o]),c+=4,++p);a.waitMulti32(c,p)}};F.prototype.constructSTMS=function(s,e,i){var t=this.cpu,r=t.gprs,a=t.mmu;return function(){if(i&&!i()){a.waitPrefetch32(r[15]);return}a.wait32(r[15]);var c=t.mode,p=e(!0),n=0,o,v;for(t.switchMode(31),o=s,v=0;o;o>>=1,++v)o&1&&(a.store32(p,r[v]),p+=4,++n);t.switchMode(c),a.waitMulti32(p,n)}};F.prototype.constructSTR=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){if(i&&!i()){t.mmu.waitPrefetch32(r[15]);return}var a=e();t.mmu.store32(a,r[s]),t.mmu.wait32(a),t.mmu.wait32(r[15])}};F.prototype.constructSTRB=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){if(i&&!i()){t.mmu.waitPrefetch32(r[15]);return}var a=e();t.mmu.store8(a,r[s]),t.mmu.wait(a),t.mmu.wait32(r[15])}};F.prototype.constructSTRH=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){if(i&&!i()){t.mmu.waitPrefetch32(r[15]);return}var a=e();t.mmu.store16(a,r[s]),t.mmu.wait(a),t.mmu.wait32(r[15])}};F.prototype.constructSUB=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=a[e]-r.shifterOperand)}};F.prototype.constructSUBS=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){i();var c=a[e]-r.shifterOperand;s==15&&r.hasSPSR()?r.unpackCPSR(r.spsr):(r.cpsrN=c>>31,r.cpsrZ=!(c&4294967295),r.cpsrC=a[e]>>>0>=r.shifterOperand>>>0,r.cpsrV=a[e]>>31!=r.shifterOperand>>31&&a[e]>>31!=c>>31),a[s]=c}}};F.prototype.constructSWI=function(s,e){var i=this.cpu,t=i.gprs;return function(){if(e&&!e()){i.mmu.waitPrefetch32(t[15]);return}i.irq.swi32(s),i.mmu.waitPrefetch32(t[15])}};F.prototype.constructSWP=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){r.mmu.wait32(a[e]),r.mmu.wait32(a[e]);var c=r.mmu.load32(a[e]);r.mmu.store32(a[e],a[i]),a[s]=c,++r.cycles}}};F.prototype.constructSWPB=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){r.mmu.wait(a[e]),r.mmu.wait(a[e]);var c=r.mmu.loadU8(a[e]);r.mmu.store8(a[e],a[i]),a[s]=c,++r.cycles}}};F.prototype.constructTEQ=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){i();var c=a[e]^r.shifterOperand;r.cpsrN=c>>31,r.cpsrZ=!(c&4294967295),r.cpsrC=r.shifterCarryOut}}};F.prototype.constructTST=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){i();var c=a[e]&r.shifterOperand;r.cpsrN=c>>31,r.cpsrZ=!(c&4294967295),r.cpsrC=r.shifterCarryOut}}};F.prototype.constructUMLAL=function(s,e,i,t,r){var a=this.cpu,c=1/4294967296,p=a.gprs;return function(){if(a.mmu.waitPrefetch32(p[15]),!(r&&!r())){a.cycles+=2,a.mmu.waitMul(i);var n=((p[t]&4294901760)>>>0)*(p[i]>>>0),o=(p[t]&65535)*(p[i]>>>0),v=(p[e]>>>0)+n+o;p[e]=v,p[s]+=v*c}}};F.prototype.constructUMLALS=function(s,e,i,t,r){var a=this.cpu,c=1/4294967296,p=a.gprs;return function(){if(a.mmu.waitPrefetch32(p[15]),!(r&&!r())){a.cycles+=2,a.mmu.waitMul(i);var n=((p[t]&4294901760)>>>0)*(p[i]>>>0),o=(p[t]&65535)*(p[i]>>>0),v=(p[e]>>>0)+n+o;p[e]=v,p[s]+=v*c,a.cpsrN=p[s]>>31,a.cpsrZ=!(p[s]&4294967295||p[e]&4294967295)}}};F.prototype.constructUMULL=function(s,e,i,t,r){var a=this.cpu,c=1/4294967296,p=a.gprs;return function(){if(a.mmu.waitPrefetch32(p[15]),!(r&&!r())){++a.cycles,a.mmu.waitMul(p[i]);var n=((p[t]&4294901760)>>>0)*(p[i]>>>0),o=((p[t]&65535)>>>0)*(p[i]>>>0);p[e]=(n&4294967295)+(o&4294967295)&4294967295,p[s]=n*c+o*c>>>0}}};F.prototype.constructUMULLS=function(s,e,i,t,r){var a=this.cpu,c=1/4294967296,p=a.gprs;return function(){if(a.mmu.waitPrefetch32(p[15]),!(r&&!r())){++a.cycles,a.mmu.waitMul(p[i]);var n=((p[t]&4294901760)>>>0)*(p[i]>>>0),o=((p[t]&65535)>>>0)*(p[i]>>>0);p[e]=(n&4294967295)+(o&4294967295)&4294967295,p[s]=n*c+o*c>>>0,a.cpsrN=p[s]>>31,a.cpsrZ=!(p[s]&4294967295||p[e]&4294967295)}}};function m(s){this.cpu=s}m.prototype.constructADC=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=(t[e]>>>0)+(i.cpsrC?1:0),a=t[s],c=(a>>>0)+r,p=a>>31,n=c>>31,o=r>>31;i.cpsrN=n,i.cpsrZ=!(c&4294967295),i.cpsrC=c>4294967295,i.cpsrV=p==o&&p!=n&&o!=n,t[s]=c}};m.prototype.constructADD1=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){t.mmu.waitPrefetch(r[15]);var a=(r[e]>>>0)+i;t.cpsrN=a>>31,t.cpsrZ=!(a&4294967295),t.cpsrC=a>4294967295,t.cpsrV=!(r[e]>>31)&&(r[e]>>31^a)>>31&&a>>31,r[s]=a}};m.prototype.constructADD2=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=(t[s]>>>0)+e;i.cpsrN=r>>31,i.cpsrZ=!(r&4294967295),i.cpsrC=r>4294967295,i.cpsrV=!(t[s]>>31)&&(t[s]^r)>>31&&(e^r)>>31,t[s]=r}};m.prototype.constructADD3=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){t.mmu.waitPrefetch(r[15]);var a=(r[e]>>>0)+(r[i]>>>0);t.cpsrN=a>>31,t.cpsrZ=!(a&4294967295),t.cpsrC=a>4294967295,t.cpsrV=!((r[e]^r[i])>>31)&&(r[e]^a)>>31&&(r[i]^a)>>31,r[s]=a}};m.prototype.constructADD4=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]),t[s]+=t[e]}};m.prototype.constructADD5=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]),t[s]=(t[15]&4294967292)+e}};m.prototype.constructADD6=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]),t[s]=t[13]+e}};m.prototype.constructADD7=function(s){var e=this.cpu,i=e.gprs;return function(){e.mmu.waitPrefetch(i[15]),i[13]+=s}};m.prototype.constructAND=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]),t[s]=t[s]&t[e],i.cpsrN=t[s]>>31,i.cpsrZ=!(t[s]&4294967295)}};m.prototype.constructASR1=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){t.mmu.waitPrefetch(r[15]),i==0?(t.cpsrC=r[e]>>31,t.cpsrC?r[s]=4294967295:r[s]=0):(t.cpsrC=r[e]&1<>i),t.cpsrN=r[s]>>31,t.cpsrZ=!(r[s]&4294967295)}};m.prototype.constructASR2=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=t[e]&255;r&&(r<32?(i.cpsrC=t[s]&1<>=r):(i.cpsrC=t[s]>>31,i.cpsrC?t[s]=4294967295:t[s]=0)),i.cpsrN=t[s]>>31,i.cpsrZ=!(t[s]&4294967295)}};m.prototype.constructB1=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]),e()&&(t[15]+=s)}};m.prototype.constructB2=function(s){var e=this.cpu,i=e.gprs;return function(){e.mmu.waitPrefetch(i[15]),i[15]+=s}};m.prototype.constructBIC=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]),t[s]=t[s]&~t[e],i.cpsrN=t[s]>>31,i.cpsrZ=!(t[s]&4294967295)}};m.prototype.constructBL1=function(s){var e=this.cpu,i=e.gprs;return function(){e.mmu.waitPrefetch(i[15]),i[14]=i[15]+s}};m.prototype.constructBL2=function(s){var e=this.cpu,i=e.gprs;return function(){e.mmu.waitPrefetch(i[15]);var t=i[15];i[15]=i[14]+(s<<1),i[14]=t-1}};m.prototype.constructBX=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]),i.switchExecMode(t[e]&1);var r=0;e==15&&(r=t[e]&2),t[15]=t[e]&4294967294-r}};m.prototype.constructCMN=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=(t[s]>>>0)+(t[e]>>>0);i.cpsrN=r>>31,i.cpsrZ=!(r&4294967295),i.cpsrC=r>4294967295,i.cpsrV=t[s]>>31==t[e]>>31&&t[s]>>31!=r>>31&&t[e]>>31!=r>>31}};m.prototype.constructCMP1=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=t[s]-e;i.cpsrN=r>>31,i.cpsrZ=!(r&4294967295),i.cpsrC=t[s]>>>0>=e,i.cpsrV=t[s]>>31&&(t[s]^r)>>31}};m.prototype.constructCMP2=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=t[s],a=t[e],c=r-a,p=c>>31,n=r>>31;i.cpsrN=p,i.cpsrZ=!(c&4294967295),i.cpsrC=r>>>0>=a>>>0,i.cpsrV=n!=a>>31&&n!=p}};m.prototype.constructCMP3=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=t[s]-t[e];i.cpsrN=r>>31,i.cpsrZ=!(r&4294967295),i.cpsrC=t[s]>>>0>=t[e]>>>0,i.cpsrV=(t[s]^t[e])>>31&&(t[s]^r)>>31}};m.prototype.constructEOR=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]),t[s]=t[s]^t[e],i.cpsrN=t[s]>>31,i.cpsrZ=!(t[s]&4294967295)}};m.prototype.constructLDMIA=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=t[s],a=0,c,p;for(c=1,p=0;p<8;c<<=1,++p)e&c&&(t[p]=i.mmu.load32(r),r+=4,++a);i.mmu.waitMulti32(r,a),1<>31,t.cpsrZ=!(r[s]&4294967295)}};m.prototype.constructLSL2=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=t[e]&255;r&&(r<32?(i.cpsrC=t[s]&1<<32-r,t[s]<<=r):(r>32?i.cpsrC=0:i.cpsrC=t[s]&1,t[s]=0)),i.cpsrN=t[s]>>31,i.cpsrZ=!(t[s]&4294967295)}};m.prototype.constructLSR1=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){t.mmu.waitPrefetch(r[15]),i==0?(t.cpsrC=r[e]>>31,r[s]=0):(t.cpsrC=r[e]&1<>>i),t.cpsrN=0,t.cpsrZ=!(r[s]&4294967295)}};m.prototype.constructLSR2=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=t[e]&255;r&&(r<32?(i.cpsrC=t[s]&1<>>=r):(r>32?i.cpsrC=0:i.cpsrC=t[s]>>31,t[s]=0)),i.cpsrN=t[s]>>31,i.cpsrZ=!(t[s]&4294967295)}};m.prototype.constructMOV1=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]),t[s]=e,i.cpsrN=e>>31,i.cpsrZ=!(e&4294967295)}};m.prototype.constructMOV2=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){t.mmu.waitPrefetch(r[15]);var a=r[e];t.cpsrN=a>>31,t.cpsrZ=!(a&4294967295),t.cpsrC=0,t.cpsrV=0,r[s]=a}};m.prototype.constructMOV3=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]),t[s]=t[e]}};m.prototype.constructMUL=function(s,e){var i=this.cpu,t=i.gprs;return function(){if(i.mmu.waitPrefetch(t[15]),i.mmu.waitMul(t[e]),t[e]&4294901760&&t[s]&4294901760){var r=(t[s]&4294901760)*t[e]&4294967295,a=(t[s]&65535)*t[e]&4294967295;t[s]=r+a&4294967295}else t[s]*=t[e];i.cpsrN=t[s]>>31,i.cpsrZ=!(t[s]&4294967295)}};m.prototype.constructMVN=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]),t[s]=~t[e],i.cpsrN=t[s]>>31,i.cpsrZ=!(t[s]&4294967295)}};m.prototype.constructNEG=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=-t[e];i.cpsrN=r>>31,i.cpsrZ=!(r&4294967295),i.cpsrC=0>=r>>>0,i.cpsrV=t[e]>>31&&r>>31,t[s]=r}};m.prototype.constructORR=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]),t[s]=t[s]|t[e],i.cpsrN=t[s]>>31,i.cpsrZ=!(t[s]&4294967295)}};m.prototype.constructPOP=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]),++i.cycles;var r=t[13],a=0,c,p;for(c=1,p=0;p<8;c<<=1,++p)s&c&&(i.mmu.waitSeq32(r),t[p]=i.mmu.load32(r),r+=4,++a);e&&(t[15]=i.mmu.load32(r)&4294967294,r+=4,++a),i.mmu.waitMulti32(r,a),t[13]=r}};m.prototype.constructPUSH=function(s,e){var i=this.cpu,t=i.gprs;return function(){var r=t[13]-4,a=0;i.mmu.waitPrefetch(t[15]),e&&(i.mmu.store32(r,t[14]),r-=4,++a);var c,p;for(c=128,p=7;c;c>>=1,--p)if(s&c){i.mmu.store32(r,t[p]),r-=4,++a;break}for(c>>=1,--p;c;c>>=1,--p)s&c&&(i.mmu.store32(r,t[p]),r-=4,++a);i.mmu.waitMulti32(r,a),t[13]=r+4}};m.prototype.constructROR=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=t[e]&255;if(r){var a=r&31;a>0?(i.cpsrC=t[s]&1<>>a|t[s]<<32-a):i.cpsrC=t[s]>>31}i.cpsrN=t[s]>>31,i.cpsrZ=!(t[s]&4294967295)}};m.prototype.constructSBC=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=(t[e]>>>0)+(i.cpsrC?0:1),a=(t[s]>>>0)-r;i.cpsrN=a>>31,i.cpsrZ=!(a&4294967295),i.cpsrC=t[s]>>>0>=a>>>0,i.cpsrV=(t[s]^r)>>31&&(t[s]^a)>>31,t[s]=a}};m.prototype.constructSTMIA=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.wait(t[15]);var r=t[s],a=0,c,p;for(c=1,p=0;p<8;c<<=1,++p)if(e&c){i.mmu.store32(r,t[p]),r+=4,++a;break}for(c<<=1,++p;p<8;c<<=1,++p)e&c&&(i.mmu.store32(r,t[p]),r+=4,++a);i.mmu.waitMulti32(r,a),t[s]=r}};m.prototype.constructSTR1=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){var a=r[e]+i;t.mmu.store32(a,r[s]),t.mmu.wait(r[15]),t.mmu.wait32(a)}};m.prototype.constructSTR2=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){t.mmu.store32(r[e]+r[i],r[s]),t.mmu.wait(r[15]),t.mmu.wait32(r[e]+r[i])}};m.prototype.constructSTR3=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.store32(t[13]+e,t[s]),i.mmu.wait(t[15]),i.mmu.wait32(t[13]+e)}};m.prototype.constructSTRB1=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){var a=r[e]+i;t.mmu.store8(a,r[s]),t.mmu.wait(r[15]),t.mmu.wait(a)}};m.prototype.constructSTRB2=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){t.mmu.store8(r[e]+r[i],r[s]),t.mmu.wait(r[15]),t.mmu.wait(r[e]+r[i])}};m.prototype.constructSTRH1=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){var a=r[e]+i;t.mmu.store16(a,r[s]),t.mmu.wait(r[15]),t.mmu.wait(a)}};m.prototype.constructSTRH2=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){t.mmu.store16(r[e]+r[i],r[s]),t.mmu.wait(r[15]),t.mmu.wait(r[e]+r[i])}};m.prototype.constructSUB1=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){t.mmu.waitPrefetch(r[15]);var a=r[e]-i;t.cpsrN=a>>31,t.cpsrZ=!(a&4294967295),t.cpsrC=r[e]>>>0>=i,t.cpsrV=r[e]>>31&&(r[e]^a)>>31,r[s]=a}};m.prototype.constructSUB2=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=t[s]-e;i.cpsrN=r>>31,i.cpsrZ=!(r&4294967295),i.cpsrC=t[s]>>>0>=e,i.cpsrV=t[s]>>31&&(t[s]^r)>>31,t[s]=r}};m.prototype.constructSUB3=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){t.mmu.waitPrefetch(r[15]);var a=r[e]-r[i];t.cpsrN=a>>31,t.cpsrZ=!(a&4294967295),t.cpsrC=r[e]>>>0>=r[i]>>>0,t.cpsrV=r[e]>>31!=r[i]>>31&&r[e]>>31!=a>>31,r[s]=a}};m.prototype.constructSWI=function(s){var e=this.cpu,i=e.gprs;return function(){e.irq.swi(s),e.mmu.waitPrefetch(i[15])}};m.prototype.constructTST=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=t[s]&t[e];i.cpsrN=r>>31,i.cpsrZ=!(r&4294967295)}};function R(){this.SP=13,this.LR=14,this.PC=15,this.MODE_ARM=0,this.MODE_THUMB=1,this.MODE_USER=16,this.MODE_FIQ=17,this.MODE_IRQ=18,this.MODE_SUPERVISOR=19,this.MODE_ABORT=23,this.MODE_UNDEFINED=27,this.MODE_SYSTEM=31,this.BANK_NONE=0,this.BANK_FIQ=1,this.BANK_IRQ=2,this.BANK_SUPERVISOR=3,this.BANK_ABORT=4,this.BANK_UNDEFINED=5,this.WORD_SIZE_ARM=4,this.WORD_SIZE_THUMB=2,this.BASE_RESET=0,this.BASE_UNDEF=4,this.BASE_SWI=8,this.BASE_PABT=12,this.BASE_DABT=16,this.BASE_IRQ=24,this.BASE_FIQ=28,this.armCompiler=new F(this),this.thumbCompiler=new m(this),this.generateConds(),this.gprs=new Int32Array(16)}R.prototype.resetCPU=function(s){for(var e=0;e<15;++e)this.gprs[e]=0;this.gprs[15]=s+4,this.loadInstruction=this.loadInstructionArm,this.execMode=0,this.instructionWidth=4,this.mode=31,this.cpsrI=!1,this.cpsrF=!1,this.cpsrV=!1,this.cpsrC=!1,this.cpsrZ=!1,this.cpsrN=!1,this.bankedRegisters=[new Int32Array(7),new Int32Array(7),new Int32Array(2),new Int32Array(2),new Int32Array(2),new Int32Array(2)],this.spsr=0,this.bankedSPSRs=new Int32Array(6),this.cycles=0,this.shifterOperand=0,this.shifterCarryOut=0,this.page=null,this.pageId=0,this.pageRegion=-1,this.instruction=null,this.irq.clear();var i=this.gprs,t=this.mmu;this.step=function(){var r=this.instruction||(this.instruction=this.loadInstruction(i[15]-this.instructionWidth));if(i[15]+=this.instructionWidth,this.conditionPassed=!0,r(),!r.writesPC)this.instruction!=null&&((r.next==null||r.next.page.invalid)&&(r.next=this.loadInstruction(i[15]-this.instructionWidth)),this.instruction=r.next);else if(this.conditionPassed){var a=i[15]&=4294967294;this.execMode==0?(t.wait32(a),t.waitPrefetch32(a)):(t.wait(a),t.waitPrefetch(a)),i[15]+=this.instructionWidth,r.fixedJump?this.instruction!=null&&((r.next==null||r.next.page.invalid)&&(r.next=this.loadInstruction(i[15]-this.instructionWidth)),this.instruction=r.next):this.instruction=null}else this.instruction=null;this.irq.updateTimers()}};R.prototype.freeze=function(){return{PC:this.gprs[15]-this.instructionWidth,SP:this.gprs[13],gprs:[this.gprs[0],this.gprs[1],this.gprs[2],this.gprs[3],this.gprs[4],this.gprs[5],this.gprs[6],this.gprs[7],this.gprs[8],this.gprs[9],this.gprs[10],this.gprs[11],this.gprs[12],this.gprs[13],this.gprs[14],this.gprs[15]],mode:this.mode,cpsrI:this.cpsrI,cpsrF:this.cpsrF,cpsrV:this.cpsrV,cpsrC:this.cpsrC,cpsrZ:this.cpsrZ,cpsrN:this.cpsrN,bankedRegisters:[[this.bankedRegisters[0][0],this.bankedRegisters[0][1],this.bankedRegisters[0][2],this.bankedRegisters[0][3],this.bankedRegisters[0][4],this.bankedRegisters[0][5],this.bankedRegisters[0][6]],[this.bankedRegisters[1][0],this.bankedRegisters[1][1],this.bankedRegisters[1][2],this.bankedRegisters[1][3],this.bankedRegisters[1][4],this.bankedRegisters[1][5],this.bankedRegisters[1][6]],[this.bankedRegisters[2][0],this.bankedRegisters[2][1]],[this.bankedRegisters[3][0],this.bankedRegisters[3][1]],[this.bankedRegisters[4][0],this.bankedRegisters[4][1]],[this.bankedRegisters[5][0],this.bankedRegisters[5][1]]],spsr:this.spsr,bankedSPSRs:[this.bankedSPSRs[0],this.bankedSPSRs[1],this.bankedSPSRs[2],this.bankedSPSRs[3],this.bankedSPSRs[4],this.bankedSPSRs[5]],cycles:this.cycles,instructionWidth:this.instructionWidth}};R.prototype.defrost=function(s){this.instruction=null,this.page=null,this.pageId=0,this.pageRegion=-1,this.gprs[0]=s.gprs[0],this.gprs[1]=s.gprs[1],this.gprs[2]=s.gprs[2],this.gprs[3]=s.gprs[3],this.gprs[4]=s.gprs[4],this.gprs[5]=s.gprs[5],this.gprs[6]=s.gprs[6],this.gprs[7]=s.gprs[7],this.gprs[8]=s.gprs[8],this.gprs[9]=s.gprs[9],this.gprs[10]=s.gprs[10],this.gprs[11]=s.gprs[11],this.gprs[12]=s.gprs[12],this.gprs[13]=s.gprs[13],this.gprs[14]=s.gprs[14],this.gprs[15]=s.gprs[15],this.mode=s.mode,this.cpsrI=s.cpsrI,this.cpsrF=s.cpsrF,this.cpsrV=s.cpsrV,this.cpsrC=s.cpsrC,this.cpsrZ=s.cpsrZ,this.cpsrN=s.cpsrN,this.bankedRegisters[0][0]=s.bankedRegisters[0][0],this.bankedRegisters[0][1]=s.bankedRegisters[0][1],this.bankedRegisters[0][2]=s.bankedRegisters[0][2],this.bankedRegisters[0][3]=s.bankedRegisters[0][3],this.bankedRegisters[0][4]=s.bankedRegisters[0][4],this.bankedRegisters[0][5]=s.bankedRegisters[0][5],this.bankedRegisters[0][6]=s.bankedRegisters[0][6],this.bankedRegisters[1][0]=s.bankedRegisters[1][0],this.bankedRegisters[1][1]=s.bankedRegisters[1][1],this.bankedRegisters[1][2]=s.bankedRegisters[1][2],this.bankedRegisters[1][3]=s.bankedRegisters[1][3],this.bankedRegisters[1][4]=s.bankedRegisters[1][4],this.bankedRegisters[1][5]=s.bankedRegisters[1][5],this.bankedRegisters[1][6]=s.bankedRegisters[1][6],this.bankedRegisters[2][0]=s.bankedRegisters[2][0],this.bankedRegisters[2][1]=s.bankedRegisters[2][1],this.bankedRegisters[3][0]=s.bankedRegisters[3][0],this.bankedRegisters[3][1]=s.bankedRegisters[3][1],this.bankedRegisters[4][0]=s.bankedRegisters[4][0],this.bankedRegisters[4][1]=s.bankedRegisters[4][1],this.bankedRegisters[5][0]=s.bankedRegisters[5][0],this.bankedRegisters[5][1]=s.bankedRegisters[5][1],this.spsr=s.spsr,this.bankedSPSRs[0]=s.bankedSPSRs[0],this.bankedSPSRs[1]=s.bankedSPSRs[1],this.bankedSPSRs[2]=s.bankedSPSRs[2],this.bankedSPSRs[3]=s.bankedSPSRs[3],this.bankedSPSRs[4]=s.bankedSPSRs[4],this.bankedSPSRs[5]=s.bankedSPSRs[5],this.cycles=s.cycles,this.instructionWidth=s.instructionWidth,this.loadInstruction=s.instructionWidth==2?this.loadInstructionThumb:this.loadInstructionArm,this.execMode=s.instructionWidth==2?1:0};R.prototype.fetchPage=function(s){var e=this.mmu,i=s>>>e.BASE_OFFSET,t=e.addressToPage(i,s&e.OFFSET_MASK);if(i==this.pageRegion){if(t==this.pageId&&!this.page.invalid)return;this.pageId=t}else this.pageMask=e.memory[i].PAGE_MASK,this.pageRegion=i,this.pageId=t;this.page=e.accessPage(i,t)};R.prototype.loadInstructionArm=function(s){var e=null;this.fetchPage(s);var i=(s&this.pageMask)>>2;if(e=this.page.arm[i],e)return e;var t=this.mmu.load32(s)>>>0;return e=this.compileArm(t),e.next=null,e.page=this.page,e.address=s,e.opcode=t,this.page.arm[i]=e,e};R.prototype.loadInstructionThumb=function(s){var e=null;this.fetchPage(s);var i=(s&this.pageMask)>>1;if(e=this.page.thumb[i],e)return e;var t=this.mmu.load16(s);return e=this.compileThumb(t),e.next=null,e.page=this.page,e.address=s,e.opcode=t,this.page.thumb[i]=e,e};R.prototype.selectBank=function(s){switch(s){case 16:case 31:return 0;case 17:return 1;case 18:return 2;case 19:return 3;case 23:return 4;case 27:return 5;default:throw new y("Invalid user mode "+s+" passed to selectBank")}};R.prototype.switchExecMode=function(s){this.execMode!=s&&(this.execMode=s,s==0?(this.instructionWidth=4,this.loadInstruction=this.loadInstructionArm):(this.instructionWidth=2,this.loadInstruction=this.loadInstructionThumb))};R.prototype.switchMode=function(s){if(s!=this.mode){if(s!=16||s!=31){var e=this.selectBank(s),i=this.selectBank(this.mode);if(e!=i){if(s==17||this.mode==17){var t=i==1?1:0,r=e==1?1:0;this.bankedRegisters[t][2]=this.gprs[8],this.bankedRegisters[t][3]=this.gprs[9],this.bankedRegisters[t][4]=this.gprs[10],this.bankedRegisters[t][5]=this.gprs[11],this.bankedRegisters[t][6]=this.gprs[12],this.gprs[8]=this.bankedRegisters[r][2],this.gprs[9]=this.bankedRegisters[r][3],this.gprs[10]=this.bankedRegisters[r][4],this.gprs[11]=this.bankedRegisters[r][5],this.gprs[12]=this.bankedRegisters[r][6]}this.bankedRegisters[i][0]=this.gprs[13],this.bankedRegisters[i][1]=this.gprs[14],this.gprs[13]=this.bankedRegisters[e][0],this.gprs[14]=this.bankedRegisters[e][1],this.bankedSPSRs[i]=this.spsr,this.spsr=this.bankedSPSRs[e]}}this.mode=s}};R.prototype.packCPSR=function(){return this.mode|this.execMode<<5|this.cpsrF<<6|this.cpsrI<<7|this.cpsrN<<31|this.cpsrZ<<30|this.cpsrC<<29|this.cpsrV<<28};R.prototype.unpackCPSR=function(s){this.switchMode(s&31),this.switchExecMode(!!(s&32)),this.cpsrF=s&64,this.cpsrI=s&128,this.cpsrN=s&2147483648,this.cpsrZ=s&1073741824,this.cpsrC=s&536870912,this.cpsrV=s&268435456,this.irq.testIRQ()};R.prototype.hasSPSR=function(){return this.mode!=31&&this.mode!=16};R.prototype.raiseIRQ=function(){if(!this.cpsrI){var s=this.packCPSR(),e=this.instructionWidth;this.switchMode(18),this.spsr=s,this.gprs[14]=this.gprs[15]-e+4,this.gprs[15]=this.BASE_IRQ+4,this.instruction=null,this.switchExecMode(0),this.cpsrI=!0}};R.prototype.raiseTrap=function(){var s=this.packCPSR(),e=this.instructionWidth;this.switchMode(19),this.spsr=s,this.gprs[14]=this.gprs[15]-e,this.gprs[15]=this.BASE_SWI+4,this.instruction=null,this.switchExecMode(0),this.cpsrI=!0};R.prototype.badOp=function(s){var e=function(){throw new y("Illegal instruction: 0x"+s.toString(16))};return e.writesPC=!0,e.fixedJump=!1,e};R.prototype.generateConds=function(){var s=this;this.conds=[function(){return s.conditionPassed=s.cpsrZ},function(){return s.conditionPassed=!s.cpsrZ},function(){return s.conditionPassed=s.cpsrC},function(){return s.conditionPassed=!s.cpsrC},function(){return s.conditionPassed=s.cpsrN},function(){return s.conditionPassed=!s.cpsrN},function(){return s.conditionPassed=s.cpsrV},function(){return s.conditionPassed=!s.cpsrV},function(){return s.conditionPassed=s.cpsrC&&!s.cpsrZ},function(){return s.conditionPassed=!s.cpsrC||s.cpsrZ},function(){return s.conditionPassed=!s.cpsrN==!s.cpsrV},function(){return s.conditionPassed=!s.cpsrN!=!s.cpsrV},function(){return s.conditionPassed=!s.cpsrZ&&!s.cpsrN==!s.cpsrV},function(){return s.conditionPassed=s.cpsrZ||!s.cpsrN!=!s.cpsrV},null,null]};R.prototype.barrelShiftImmediate=function(s,e,i){var t=this,r=this.gprs,a=this.badOp;switch(s){case 0:e?a=function(){t.shifterOperand=r[i]<>>e,t.shifterCarryOut=r[i]&1<>e,t.shifterCarryOut=r[i]&1<>>e|r[i]<<32-e,t.shifterCarryOut=r[i]&1<>>1,t.shifterCarryOut=r[i]&1};break}return a};R.prototype.compileArm=function(s){var e=this.badOp(s),i=s&234881024,t=this,r=this.gprs,a=this.conds[(s&4026531840)>>>28];if((s&268435440)==19922704){var c=s&15;e=this.armCompiler.constructBX(c,a),e.writesPC=!0,e.fixedJump=!1}else if(!(s&201326592)&&(i==33554432||(s&144)!=144)){var p=s&31457280,n=s&1048576,o=!1;if((p&25165824)==16777216&&!n){var v=s&4194304;if((s&11595776)==2158592){var c=s&15,x=s&255,w=(s&3840)>>7;x=x>>>w|x<<32-w,e=this.armCompiler.constructMSR(c,v,s,x,a),e.writesPC=!1}else if((s&12517376)==983040){var h=(s&61440)>>12;e=this.armCompiler.constructMRS(h,v,a),e.writesPC=h==15}}else{var f=(s&983040)>>16,h=(s&61440)>>12,l=s&96,c=s&15,C=function(){throw new y("BUG: invalid barrel shifter")};if(s&33554432){var x=s&255,V=(s&3840)>>7;V?C=this.armCompiler.constructAddressingMode1ImmediateRotate(x,V):C=this.armCompiler.constructAddressingMode1Immediate(x)}else if(s&16){var P=(s&3840)>>8;switch(o=!0,l){case 0:C=this.armCompiler.constructAddressingMode1LSL(P,c);break;case 32:C=this.armCompiler.constructAddressingMode1LSR(P,c);break;case 64:C=this.armCompiler.constructAddressingMode1ASR(P,c);break;case 96:C=this.armCompiler.constructAddressingMode1ROR(P,c);break}}else{var x=(s&3968)>>7;C=this.barrelShiftImmediate(l,x,c)}switch(p){case 0:n?e=this.armCompiler.constructANDS(h,f,C,a):e=this.armCompiler.constructAND(h,f,C,a);break;case 2097152:n?e=this.armCompiler.constructEORS(h,f,C,a):e=this.armCompiler.constructEOR(h,f,C,a);break;case 4194304:n?e=this.armCompiler.constructSUBS(h,f,C,a):e=this.armCompiler.constructSUB(h,f,C,a);break;case 6291456:n?e=this.armCompiler.constructRSBS(h,f,C,a):e=this.armCompiler.constructRSB(h,f,C,a);break;case 8388608:n?e=this.armCompiler.constructADDS(h,f,C,a):e=this.armCompiler.constructADD(h,f,C,a);break;case 10485760:n?e=this.armCompiler.constructADCS(h,f,C,a):e=this.armCompiler.constructADC(h,f,C,a);break;case 12582912:n?e=this.armCompiler.constructSBCS(h,f,C,a):e=this.armCompiler.constructSBC(h,f,C,a);break;case 14680064:n?e=this.armCompiler.constructRSCS(h,f,C,a):e=this.armCompiler.constructRSC(h,f,C,a);break;case 16777216:e=this.armCompiler.constructTST(h,f,C,a);break;case 18874368:e=this.armCompiler.constructTEQ(h,f,C,a);break;case 20971520:e=this.armCompiler.constructCMP(h,f,C,a);break;case 23068672:e=this.armCompiler.constructCMN(h,f,C,a);break;case 25165824:n?e=this.armCompiler.constructORRS(h,f,C,a):e=this.armCompiler.constructORR(h,f,C,a);break;case 27262976:n?e=this.armCompiler.constructMOVS(h,f,C,a):e=this.armCompiler.constructMOV(h,f,C,a);break;case 29360128:n?e=this.armCompiler.constructBICS(h,f,C,a):e=this.armCompiler.constructBIC(h,f,C,a);break;case 31457280:n?e=this.armCompiler.constructMVNS(h,f,C,a):e=this.armCompiler.constructMVN(h,f,C,a);break}e.writesPC=h==15}}else if((s&263196656)==16777360){var c=s&15,h=s>>12&15,f=s>>16&15;s&4194304?e=this.armCompiler.constructSWPB(h,f,c,a):e=this.armCompiler.constructSWP(h,f,c,a),e.writesPC=h==15}else switch(i){case 0:if((s&16777456)==144){var h=(s&983040)>>16,f=(s&61440)>>12,P=(s&3840)>>8,c=s&15;switch(s&15728640){case 0:e=this.armCompiler.constructMUL(h,P,c,a);break;case 1048576:e=this.armCompiler.constructMULS(h,P,c,a);break;case 2097152:e=this.armCompiler.constructMLA(h,f,P,c,a);break;case 3145728:e=this.armCompiler.constructMLAS(h,f,P,c,a);break;case 8388608:e=this.armCompiler.constructUMULL(h,f,P,c,a);break;case 9437184:e=this.armCompiler.constructUMULLS(h,f,P,c,a);break;case 10485760:e=this.armCompiler.constructUMLAL(h,f,P,c,a);break;case 11534336:e=this.armCompiler.constructUMLALS(h,f,P,c,a);break;case 12582912:e=this.armCompiler.constructSMULL(h,f,P,c,a);break;case 13631488:e=this.armCompiler.constructSMULLS(h,f,P,c,a);break;case 14680064:e=this.armCompiler.constructSMLAL(h,f,P,c,a);break;case 15728640:e=this.armCompiler.constructSMLALS(h,f,P,c,a);break}e.writesPC=h==15}else{var T=s&1048576,h=(s&61440)>>12,cr=(s&3840)>>4,ur=c=s&15,H=s&32,n=s&64,k=s&2097152,i=s&4194304,d;if(i){var x=ur|cr;d=this.armCompiler.constructAddressingMode23Immediate(s,x,a)}else d=this.armCompiler.constructAddressingMode23Register(s,c,a);d.writesPC=!!k&&f==15,(s&144)==144&&(T?H?n?e=this.armCompiler.constructLDRSH(h,d,a):e=this.armCompiler.constructLDRH(h,d,a):n&&(e=this.armCompiler.constructLDRSB(h,d,a)):!n&&H&&(e=this.armCompiler.constructSTRH(h,d,a))),e.writesPC=h==15||d.writesPC}break;case 67108864:case 100663296:var h=(s&61440)>>12,T=s&1048576,W=s&4194304,i=s&33554432,d=function(){throw new y("Unimplemented memory access: 0x"+s.toString(16))};if(~s&16777216&&(s&=4292870143),i){var c=s&15,l=s&96,K=(s&3968)>>7;l||K?(C=this.barrelShiftImmediate(l,K,c),d=this.armCompiler.constructAddressingMode2RegisterShifted(s,C,a)):d=this.armCompiler.constructAddressingMode23Register(s,c,a)}else{var M=s&4095;d=this.armCompiler.constructAddressingMode23Immediate(s,M,a)}T?W?e=this.armCompiler.constructLDRB(h,d,a):e=this.armCompiler.constructLDR(h,d,a):W?e=this.armCompiler.constructSTRB(h,d,a):e=this.armCompiler.constructSTR(h,d,a),e.writesPC=T&&(h==15||d.writesPC);break;case 134217728:var T=s&1048576,k=s&2097152,Q=s&4194304,pr=s&8388608,G=s&16777216,P=s&65535,f=(s&983040)>>16,d,x=0,M=0,B=!1;if(pr){G&&(x=4);for(var A=1,i=0;i<16;A<<=1,++i)P&A&&(k&&i==f&&!M&&(P&=~A,x+=4,B=!0),M+=4)}else{G||(x=4);for(var A=1,i=0;i<16;A<<=1,++i)P&A&&(k&&i==f&&!M&&(P&=~A,x+=4,B=!0),x-=4,M-=4)}k?d=this.armCompiler.constructAddressingMode4Writeback(x,M,f,B):d=this.armCompiler.constructAddressingMode4(x,f),T?(Q?e=this.armCompiler.constructLDMS(P,d,a):e=this.armCompiler.constructLDM(P,d,a),e.writesPC=!!(P&1<<15)):(Q?e=this.armCompiler.constructSTMS(P,d,a):e=this.armCompiler.constructSTM(P,d,a),e.writesPC=!1);break;case 167772160:var x=s&16777215;x&8388608&&(x|=4278190080),x<<=2;var nr=s&16777216;nr?e=this.armCompiler.constructBL(x,a):e=this.armCompiler.constructB(x,a),e.writesPC=!0,e.fixedJump=!0;break;case 201326592:break;case 234881024:if((s&251658240)==251658240){var x=s&16777215;e=this.armCompiler.constructSWI(x,a),e.writesPC=!1}break;default:throw new y("Bad opcode: 0x"+s.toString(16))}return e.execMode=0,e.fixedJump=e.fixedJump||!1,e};R.prototype.compileThumb=function(s){var e=this.badOp(s&65535),i=this,t=this.gprs;if((s&64512)==16384){var r=(s&56)>>3,a=s&7;switch(s&960){case 0:e=this.thumbCompiler.constructAND(a,r);break;case 64:e=this.thumbCompiler.constructEOR(a,r);break;case 128:e=this.thumbCompiler.constructLSL2(a,r);break;case 192:e=this.thumbCompiler.constructLSR2(a,r);break;case 256:e=this.thumbCompiler.constructASR2(a,r);break;case 320:e=this.thumbCompiler.constructADC(a,r);break;case 384:e=this.thumbCompiler.constructSBC(a,r);break;case 448:e=this.thumbCompiler.constructROR(a,r);break;case 512:e=this.thumbCompiler.constructTST(a,r);break;case 576:e=this.thumbCompiler.constructNEG(a,r);break;case 640:e=this.thumbCompiler.constructCMP2(a,r);break;case 704:e=this.thumbCompiler.constructCMN(a,r);break;case 768:e=this.thumbCompiler.constructORR(a,r);break;case 832:e=this.thumbCompiler.constructMUL(a,r);break;case 896:e=this.thumbCompiler.constructBIC(a,r);break;case 960:e=this.thumbCompiler.constructMVN(a,r);break}e.writesPC=!1}else if((s&64512)==17408){var r=(s&120)>>3,c=s&7,p=s&128,a=c|p>>4;switch(s&768){case 0:e=this.thumbCompiler.constructADD4(a,r),e.writesPC=a==15;break;case 256:e=this.thumbCompiler.constructCMP3(a,r),e.writesPC=!1;break;case 512:e=this.thumbCompiler.constructMOV3(a,r),e.writesPC=a==15;break;case 768:e=this.thumbCompiler.constructBX(a,r),e.writesPC=!0,e.fixedJump=!1;break}}else if((s&63488)==6144){var r=(s&448)>>6,c=(s&56)>>3,a=s&7;switch(s&1536){case 0:e=this.thumbCompiler.constructADD3(a,c,r);break;case 512:e=this.thumbCompiler.constructSUB3(a,c,r);break;case 1024:var n=(s&448)>>6;n?e=this.thumbCompiler.constructADD1(a,c,n):e=this.thumbCompiler.constructMOV2(a,c,r);break;case 1536:var n=(s&448)>>6;e=this.thumbCompiler.constructSUB1(a,c,n);break}e.writesPC=!1}else if(s&57344)if((s&57344)==8192){var n=s&255,c=(s&1792)>>8;switch(s&6144){case 0:e=this.thumbCompiler.constructMOV1(c,n);break;case 2048:e=this.thumbCompiler.constructCMP1(c,n);break;case 4096:e=this.thumbCompiler.constructADD2(c,n);break;case 6144:e=this.thumbCompiler.constructSUB2(c,n);break}e.writesPC=!1}else if((s&63488)==18432){var a=(s&1792)>>8,n=(s&255)<<2;e=this.thumbCompiler.constructLDR3(a,n),e.writesPC=!1}else if((s&61440)==20480){var a=s&7,c=(s&56)>>3,r=(s&448)>>6,o=s&3584;switch(o){case 0:e=this.thumbCompiler.constructSTR2(a,c,r);break;case 512:e=this.thumbCompiler.constructSTRH2(a,c,r);break;case 1024:e=this.thumbCompiler.constructSTRB2(a,c,r);break;case 1536:e=this.thumbCompiler.constructLDRSB(a,c,r);break;case 2048:e=this.thumbCompiler.constructLDR2(a,c,r);break;case 2560:e=this.thumbCompiler.constructLDRH2(a,c,r);break;case 3072:e=this.thumbCompiler.constructLDRB2(a,c,r);break;case 3584:e=this.thumbCompiler.constructLDRSH(a,c,r);break}e.writesPC=!1}else if((s&57344)==24576){var a=s&7,c=(s&56)>>3,n=(s&1984)>>4,v=s&4096;v&&(n>>=2);var x=s&2048;x?v?e=this.thumbCompiler.constructLDRB1(a,c,n):e=this.thumbCompiler.constructLDR1(a,c,n):v?e=this.thumbCompiler.constructSTRB1(a,c,n):e=this.thumbCompiler.constructSTR1(a,c,n),e.writesPC=!1}else if((s&62976)==46080){var w=!!(s&256),h=s&255;s&2048?(e=this.thumbCompiler.constructPOP(h,w),e.writesPC=w,e.fixedJump=!1):(e=this.thumbCompiler.constructPUSH(h,w),e.writesPC=!1)}else if(s&32768)switch(s&28672){case 0:var a=s&7,c=(s&56)>>3,n=(s&1984)>>5;s&2048?e=this.thumbCompiler.constructLDRH1(a,c,n):e=this.thumbCompiler.constructSTRH1(a,c,n),e.writesPC=!1;break;case 4096:var a=(s&1792)>>8,n=(s&255)<<2,x=s&2048;x?e=this.thumbCompiler.constructLDR4(a,n):e=this.thumbCompiler.constructSTR3(a,n),e.writesPC=!1;break;case 8192:var a=(s&1792)>>8,n=(s&255)<<2;s&2048?e=this.thumbCompiler.constructADD6(a,n):e=this.thumbCompiler.constructADD5(a,n),e.writesPC=!1;break;case 12288:if(!(s&3840)){var v=s&128,n=(s&127)<<2;v&&(n=-n),e=this.thumbCompiler.constructADD7(n),e.writesPC=!1}break;case 16384:var c=(s&1792)>>8,h=s&255;s&2048?e=this.thumbCompiler.constructLDMIA(c,h):e=this.thumbCompiler.constructSTMIA(c,h),e.writesPC=!1;break;case 20480:var f=(s&3840)>>8,n=s&255;if(f==15)e=this.thumbCompiler.constructSWI(n),e.writesPC=!1;else{s&128&&(n|=4294967040),n<<=1;var l=this.conds[f];e=this.thumbCompiler.constructB1(n,l),e.writesPC=!0,e.fixedJump=!0}break;case 24576:case 28672:var n=s&2047,C=s&6144;switch(C){case 0:n&1024&&(n|=4294965248),n<<=1,e=this.thumbCompiler.constructB2(n),e.writesPC=!0,e.fixedJump=!0;break;case 2048:break;case 4096:n&1024&&(n|=4294966272),n<<=12,e=this.thumbCompiler.constructBL1(n),e.writesPC=!1;break;case 6144:e=this.thumbCompiler.constructBL2(n),e.writesPC=!0,e.fixedJump=!1;break}break;default:throw new y("Undefined instruction: 0x"+s.toString(16))}else throw new y("Bad opcode: 0x"+s.toString(16));else{var a=s&7,r=(s&56)>>3,n=(s&1984)>>6;switch(s&6144){case 0:e=this.thumbCompiler.constructLSL1(a,r,n);break;case 2048:e=this.thumbCompiler.constructLSR1(a,r,n);break;case 4096:e=this.thumbCompiler.constructASR1(a,r,n);break;case 6144:break}e.writesPC=!1}return e.execMode=1,e.fixedJump=e.fixedJump||!1,e};var U=class{constructor(){this.BASE_OFFSET=24;this.OFFSET_MASK=16777215;this.core=new R,this.core.irq=this,this.core.mmu=this,this.resetMemory()}resetMemory(){this.memory=[];for(var e=0;e<256;e++){var i=10,t=524288;this.memory[e]={PAGE_MASK:(2<0?e:1}getPC(){return this.core.gprs[15]-this.core.instructionWidth}getSP(){return this.core.gprs[13]}isStable(){return!0}connectMemoryBus(e){this.bus=e}reset(){this.resetMemory(),this.core.resetCPU(0)}saveState(){return this.core.freeze()}loadState(e){this.core.defrost(e)}load8(e){return this.bus.read(e)<<24>>24}loadU8(e){return this.bus.read(e)&255}load16(e){return this.loadU16(e)<<16>>16}loadU16(e){return this.bus.read(e)|this.bus.read(e+1)<<8}load32(e){var i=this.bus.read(e)|this.bus.read(e+1)<<8|this.bus.read(e+2)<<16|this.bus.read(e+3)<<24;return i}store8(e,i){this.bus.write(e,i&255)}store16(e,i){this.bus.write(e,i&255),this.bus.write(e+1,i>>8&255)}store32(e,i){this.bus.write(e,i&255),this.bus.write(e+1,i>>8&255),this.bus.write(e+2,i>>16&255),this.bus.write(e+3,i>>24&255)}wait(e){++this.core.cycles}wait32(e){++this.core.cycles}waitSeq32(e){++this.core.cycles}waitMul(e){(e&4294967040)==4294967040||!(e&4294967040)?this.core.cycles+=1:(e&4294901760)==4294901760||!(e&4294901760)?this.core.cycles+=2:(e&4278190080)==4278190080||!(e&4278190080)?this.core.cycles+=3:this.core.cycles+=4}waitMulti32(e,i){this.core.cycles+=2}waitPrefetch(e){++this.core.cycles}waitPrefetch32(e){++this.core.cycles}addressToPage(e,i){return i>>this.memory[e].ICACHE_PAGE_BITS}accessPage(e,i){var t=this.memory[e],r=t.icache[i];return(!r||r.invalid)&&(r={thumb:new Array(1<>16)}clear(){}updateTimers(){}testIRQ(){}isThumb(){return this.core.instructionWidth==2}};var Fr=X([[S.A,0,1],[S.B,0,2],[S.GP_A,0,1],[S.GP_B,0,2],[S.SELECT,0,4],[S.START,0,8],[S.RIGHT,0,16],[S.LEFT,0,32],[S.UP,0,64],[S.DOWN,0,128]]),er=0,tr=524288,I=33554432,D=524288,O=67108864,_=256,hr=1e6,sr=4e6,Z=class extends q{constructor(){super();this.cpuFrequency=sr;this.canvasWidth=160;this.numTotalScanlines=256;this.numVisibleScanlines=128;this.cpuCyclesPerLine=Math.floor(sr/(256*60));this.defaultROMSize=512*1024;this.sampleRate=1;this.cpu=new U;this.ram=new Uint8Array(96*1024);this.ram16=new Uint16Array(this.ram.buffer);this.vidbase=0;this.brightness=255;this.read=L([[er,er+tr-1,tr-1,e=>this.rom?this.rom[e]:0],[I,I+D-1,D-1,e=>this.ram[e]],[O,O+_-1,_-1,(e,i)=>this.readIO(e)],[0,(1<<31)-1,0,(e,i)=>{throw new y(`Address read out of bounds: 0x${E(e)}`)}]]);this.write=L([[I,I+D-1,D-1,(e,i)=>{this.ram[e]=i}],[O,O+_-1,_-1,(e,i)=>{this.writeIO(e,i)}]]);this.connectCPUMemoryBus(this),this.handler=z(this.inputs,Fr)}connectVideo(e){super.connectVideo(e),this.pixels32=e,this.pixels8=new Uint8Array(e.buffer)}connectSerialIO(e){this.serial=e}reset(){super.reset(),this.serialOut=[],this.serialIn=[]}readIO(e){switch(e){case 0:return this.inputs[0];case 64:return(this.serial.byteAvailable()?128:0)|(this.serial.clearToSend()?64:0);case 68:let i=this.serialIn.shift();return i!=null?(this.serialOut.push(i),i.value):0;default:return 0}}writeIO(e,i){switch(e){case 0:break;case 72:this.serialOut.length>1&1048575,t=this.brightness<<24,r=0;r>5&31)<<11|(a>>10&31)<<19}}getDebugCategories(){return["CPU","Stack"]}getDebugInfo(e,i){switch(e){case"CPU":var t="",r=i.c;let c={2:"Thumb",4:"ARM"},p={15:"PC",14:"LR",13:"SP",12:"IP",11:"FP",9:"SB"};for(var a=0;a<16;a++)t+=N(p[a]||"",3)+N("r"+a,5)+" "+E(r.gprs[a],8)+` +import{H as j,q}from"./chunk-TV4YGKI4.js";import{$ as L,D as J,J as Y,S as y,V as S,W as z,Y as X,a as N,g as E}from"./chunk-Z5CU44VP.js";import"./chunk-5XVCUSSZ.js";var g;(function(o){o[o.MODE_ARM=0]="MODE_ARM",o[o.MODE_THUMB=1]="MODE_THUMB",o[o.MODE_USER=16]="MODE_USER",o[o.MODE_FIQ=17]="MODE_FIQ",o[o.MODE_IRQ=18]="MODE_IRQ",o[o.MODE_SUPERVISOR=19]="MODE_SUPERVISOR",o[o.MODE_ABORT=23]="MODE_ABORT",o[o.MODE_UNDEFINED=27]="MODE_UNDEFINED",o[o.MODE_SYSTEM=31]="MODE_SYSTEM"})(g||(g={}));var u;(function(t){t[t.SP=13]="SP",t[t.LR=14]="LR",t[t.PC=15]="PC"})(u||(u={}));var b;(function(l){l[l.BANK_NONE=0]="BANK_NONE",l[l.BANK_FIQ=1]="BANK_FIQ",l[l.BANK_IRQ=2]="BANK_IRQ",l[l.BANK_SUPERVISOR=3]="BANK_SUPERVISOR",l[l.BANK_ABORT=4]="BANK_ABORT",l[l.BANK_UNDEFINED=5]="BANK_UNDEFINED",l[l.WORD_SIZE_ARM=4]="WORD_SIZE_ARM",l[l.WORD_SIZE_THUMB=2]="WORD_SIZE_THUMB",l[l.BASE_RESET=0]="BASE_RESET",l[l.BASE_UNDEF=4]="BASE_UNDEF",l[l.BASE_SWI=8]="BASE_SWI",l[l.BASE_PABT=12]="BASE_PABT",l[l.BASE_DABT=16]="BASE_DABT",l[l.BASE_IRQ=24]="BASE_IRQ",l[l.BASE_FIQ=28]="BASE_FIQ"})(b||(b={}));var $=4026531840,rr=223,or=32;function F(s){this.cpu=s,this.addressingMode23Immediate=[function(e,i,t){var r=s.gprs,a=function(){var c=r[e];return(!t||t())&&(r[e]-=i),c};return a.writesPC=e==15,a},null,null,null,function(e,i,t){var r=s.gprs,a=function(){var c=r[e];return(!t||t())&&(r[e]+=i),c};return a.writesPC=e==15,a},null,null,null,function(e,i,t){var r=s.gprs,a=function(){return r[e]-i};return a.writesPC=!1,a},function(e,i,t){var r=s.gprs,a=function(){var c=r[e]-i;return(!t||t())&&(r[e]=c),c};return a.writesPC=e==15,a},null,null,function(e,i,t){var r=s.gprs,a=function(){return r[e]+i};return a.writesPC=!1,a},function(e,i,t){var r=s.gprs,a=function(){var c=r[e]+i;return(!t||t())&&(r[e]=c),c};return a.writesPC=e==15,a},null,null],this.addressingMode23Register=[function(e,i,t){var r=s.gprs,a=function(){var c=r[e];return(!t||t())&&(r[e]-=r[i]),c};return a.writesPC=e==15,a},null,null,null,function(e,i,t){var r=s.gprs,a=function(){var c=r[e];return(!t||t())&&(r[e]+=r[i]),c};return a.writesPC=e==15,a},null,null,null,function(e,i,t){var r=s.gprs,a=function(){return r[e]-r[i]};return a.writesPC=!1,a},function(e,i,t){var r=s.gprs,a=function(){var c=r[e]-r[i];return(!t||t())&&(r[e]=c),c};return a.writesPC=e==15,a},null,null,function(e,i,t){var r=s.gprs,a=function(){var c=r[e]+r[i];return c};return a.writesPC=!1,a},function(e,i,t){var r=s.gprs,a=function(){var c=r[e]+r[i];return(!t||t())&&(r[e]=c),c};return a.writesPC=e==15,a},null,null],this.addressingMode2RegisterShifted=[function(e,i,t){var r=s.gprs,a=function(){var c=r[e];return(!t||t())&&(i(),r[e]-=s.shifterOperand),c};return a.writesPC=e==15,a},null,null,null,function(e,i,t){var r=s.gprs,a=function(){var c=r[e];return(!t||t())&&(i(),r[e]+=s.shifterOperand),c};return a.writesPC=e==15,a},null,null,null,function(e,i,t){var r=s.gprs,a=function(){return i(),r[e]-s.shifterOperand};return a.writesPC=!1,a},function(e,i,t){var r=s.gprs,a=function(){i();var c=r[e]-s.shifterOperand;return(!t||t())&&(r[e]=c),c};return a.writesPC=e==15,a},null,null,function(e,i,t){var r=s.gprs,a=function(){return i(),r[e]+s.shifterOperand};return a.writesPC=!1,a},function(e,i,t){var r=s.gprs,a=function(){i();var c=r[e]+s.shifterOperand;return(!t||t())&&(r[e]=c),c};return a.writesPC=e==15,a},null,null]}F.prototype.constructAddressingMode1ASR=function(s,e){var i=this.cpu,t=i.gprs;return function(){++i.cycles;var r=t[s];s==15&&(r+=4),r&=255;var a=t[e];e==15&&(a+=4),r==0?(i.shifterOperand=a,i.shifterCarryOut=i.cpsrC):r<32?(i.shifterOperand=a>>r,i.shifterCarryOut=a&1<>31?(i.shifterOperand=4294967295,i.shifterCarryOut=2147483648):(i.shifterOperand=0,i.shifterCarryOut=0)}};F.prototype.constructAddressingMode1Immediate=function(s){var e=this.cpu;return function(){e.shifterOperand=s,e.shifterCarryOut=e.cpsrC}};F.prototype.constructAddressingMode1ImmediateRotate=function(s,e){var i=this.cpu;return function(){i.shifterOperand=s>>>e|s<<32-e,i.shifterCarryOut=i.shifterOperand>>31}};F.prototype.constructAddressingMode1LSL=function(s,e){var i=this.cpu,t=i.gprs;return function(){++i.cycles;var r=t[s];s==15&&(r+=4),r&=255;var a=t[e];e==15&&(a+=4),r==0?(i.shifterOperand=a,i.shifterCarryOut=i.cpsrC):r<32?(i.shifterOperand=a<>>r,i.shifterCarryOut=a&1<>31):(i.shifterOperand=0,i.shifterCarryOut=0)}};F.prototype.constructAddressingMode1ROR=function(s,e){var i=this.cpu,t=i.gprs;return function(){++i.cycles;var r=t[s];s==15&&(r+=4),r&=255;var a=t[e];e==15&&(a+=4);var c=r&31;r==0?(i.shifterOperand=a,i.shifterCarryOut=i.cpsrC):c?(i.shifterOperand=t[e]>>>c|t[e]<<32-c,i.shifterCarryOut=a&1<>31)}};F.prototype.constructAddressingMode23Immediate=function(s,e,i){var t=(s&983040)>>16;return this.addressingMode23Immediate[(s&27262976)>>21](t,e,i)};F.prototype.constructAddressingMode23Register=function(s,e,i){var t=(s&983040)>>16;return this.addressingMode23Register[(s&27262976)>>21](t,e,i)};F.prototype.constructAddressingMode2RegisterShifted=function(s,e,i){var t=(s&983040)>>16;return this.addressingMode2RegisterShifted[(s&27262976)>>21](t,e,i)};F.prototype.constructAddressingMode4=function(s,e){var i=this.cpu,t=i.gprs;return function(){var r=t[e]+s;return r}};F.prototype.constructAddressingMode4Writeback=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(c){var p=a[i]+s;return c&&t&&r.mmu.store32(a[i]+s-4,a[i]),a[i]+=e,p}};F.prototype.constructADC=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){i();var c=(r.shifterOperand>>>0)+(r.cpsrC?1:0);a[s]=(a[e]>>>0)+c}}};F.prototype.constructADCS=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){i();var c=(r.shifterOperand>>>0)+(r.cpsrC?1:0),p=(a[e]>>>0)+c;s==15&&r.hasSPSR()?r.unpackCPSR(r.spsr):(r.cpsrN=p>>31,r.cpsrZ=!(p&4294967295),r.cpsrC=p>4294967295,r.cpsrV=a[e]>>31==c>>31&&a[e]>>31!=p>>31&&c>>31!=p>>31),a[s]=p}}};F.prototype.constructADD=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=(a[e]>>>0)+(r.shifterOperand>>>0))}};F.prototype.constructADDS=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){i();var c=(a[e]>>>0)+(r.shifterOperand>>>0);s==15&&r.hasSPSR()?r.unpackCPSR(r.spsr):(r.cpsrN=c>>31,r.cpsrZ=!(c&4294967295),r.cpsrC=c>4294967295,r.cpsrV=a[e]>>31==r.shifterOperand>>31&&a[e]>>31!=c>>31&&r.shifterOperand>>31!=c>>31),a[s]=c}}};F.prototype.constructAND=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=a[e]&r.shifterOperand)}};F.prototype.constructANDS=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=a[e]&r.shifterOperand,s==15&&r.hasSPSR()?r.unpackCPSR(r.spsr):(r.cpsrN=a[s]>>31,r.cpsrZ=!(a[s]&4294967295),r.cpsrC=r.shifterCarryOut))}};F.prototype.constructB=function(s,e){var i=this.cpu,t=i.gprs;return function(){if(e&&!e()){i.mmu.waitPrefetch32(t[15]);return}i.mmu.waitPrefetch32(t[15]),t[15]+=s}};F.prototype.constructBIC=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=a[e]&~r.shifterOperand)}};F.prototype.constructBICS=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=a[e]&~r.shifterOperand,s==15&&r.hasSPSR()?r.unpackCPSR(r.spsr):(r.cpsrN=a[s]>>31,r.cpsrZ=!(a[s]&4294967295),r.cpsrC=r.shifterCarryOut))}};F.prototype.constructBL=function(s,e){var i=this.cpu,t=i.gprs;return function(){if(e&&!e()){i.mmu.waitPrefetch32(t[15]);return}i.mmu.waitPrefetch32(t[15]),t[14]=t[15]-4,t[15]+=s}};F.prototype.constructBX=function(s,e){var i=this.cpu,t=i.gprs;return function(){if(e&&!e()){i.mmu.waitPrefetch32(t[15]);return}i.mmu.waitPrefetch32(t[15]),i.switchExecMode(t[s]&1),t[15]=t[s]&4294967294}};F.prototype.constructCMN=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){i();var c=(a[e]>>>0)+(r.shifterOperand>>>0);r.cpsrN=c>>31,r.cpsrZ=!(c&4294967295),r.cpsrC=c>4294967295,r.cpsrV=a[e]>>31==r.shifterOperand>>31&&a[e]>>31!=c>>31&&r.shifterOperand>>31!=c>>31}}};F.prototype.constructCMP=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){i();var c=a[e]-r.shifterOperand;r.cpsrN=c>>31,r.cpsrZ=!(c&4294967295),r.cpsrC=a[e]>>>0>=r.shifterOperand>>>0,r.cpsrV=a[e]>>31!=r.shifterOperand>>31&&a[e]>>31!=c>>31}}};F.prototype.constructEOR=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=a[e]^r.shifterOperand)}};F.prototype.constructEORS=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=a[e]^r.shifterOperand,s==15&&r.hasSPSR()?r.unpackCPSR(r.spsr):(r.cpsrN=a[s]>>31,r.cpsrZ=!(a[s]&4294967295),r.cpsrC=r.shifterCarryOut))}};F.prototype.constructLDM=function(s,e,i){var t=this.cpu,r=t.gprs,a=t.mmu;return function(){if(a.waitPrefetch32(r[15]),!(i&&!i())){var c=e(!1),p=0,n,o;for(n=s,o=0;n;n>>=1,++o)n&1&&(r[o]=a.load32(c&4294967292),c+=4,++p);a.waitMulti32(c,p),++t.cycles}}};F.prototype.constructLDMS=function(s,e,i){var t=this.cpu,r=t.gprs,a=t.mmu;return function(){if(a.waitPrefetch32(r[15]),!(i&&!i())){var c=e(!1),p=0,n=t.mode;t.switchMode(31);var o,v;for(o=s,v=0;o;o>>=1,++v)o&1&&(r[v]=a.load32(c&4294967292),c+=4,++p);t.switchMode(n),a.waitMulti32(c,p),++t.cycles}}};F.prototype.constructLDR=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){if(t.mmu.waitPrefetch32(r[15]),!(i&&!i())){var a=e();r[s]=t.mmu.load32(a),t.mmu.wait32(a),++t.cycles}}};F.prototype.constructLDRB=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){if(t.mmu.waitPrefetch32(r[15]),!(i&&!i())){var a=e();r[s]=t.mmu.loadU8(a),t.mmu.wait(a),++t.cycles}}};F.prototype.constructLDRH=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){if(t.mmu.waitPrefetch32(r[15]),!(i&&!i())){var a=e();r[s]=t.mmu.loadU16(a),t.mmu.wait(a),++t.cycles}}};F.prototype.constructLDRSB=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){if(t.mmu.waitPrefetch32(r[15]),!(i&&!i())){var a=e();r[s]=t.mmu.load8(a),t.mmu.wait(a),++t.cycles}}};F.prototype.constructLDRSH=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){if(t.mmu.waitPrefetch32(r[15]),!(i&&!i())){var a=e();r[s]=t.mmu.load16(a),t.mmu.wait(a),++t.cycles}}};F.prototype.constructMLA=function(s,e,i,t,r){var a=this.cpu,c=a.gprs;return function(){if(a.mmu.waitPrefetch32(c[15]),!(r&&!r()))if(++a.cycles,a.mmu.waitMul(i),c[t]&4294901760&&c[i]&4294901760){var p=(c[t]&4294901760)*c[i]&4294967295,n=(c[t]&65535)*c[i]&4294967295;c[s]=p+n+c[e]&4294967295}else c[s]=c[t]*c[i]+c[e]}};F.prototype.constructMLAS=function(s,e,i,t,r){var a=this.cpu,c=a.gprs;return function(){if(a.mmu.waitPrefetch32(c[15]),!(r&&!r())){if(++a.cycles,a.mmu.waitMul(i),c[t]&4294901760&&c[i]&4294901760){var p=(c[t]&4294901760)*c[i]&4294967295,n=(c[t]&65535)*c[i]&4294967295;c[s]=p+n+c[e]&4294967295}else c[s]=c[t]*c[i]+c[e];a.cpsrN=c[s]>>31,a.cpsrZ=!(c[s]&4294967295)}}};F.prototype.constructMOV=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=r.shifterOperand)}};F.prototype.constructMOVS=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=r.shifterOperand,s==15&&r.hasSPSR()?r.unpackCPSR(r.spsr):(r.cpsrN=a[s]>>31,r.cpsrZ=!(a[s]&4294967295),r.cpsrC=r.shifterCarryOut))}};F.prototype.constructMRS=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){t.mmu.waitPrefetch32(r[15]),!(i&&!i())&&(e?r[s]=t.spsr:r[s]=t.packCPSR())}};F.prototype.constructMSR=function(s,e,i,t,r){var a=this.cpu,c=a.gprs,p=i&65536,n=i&524288;return function(){if(a.mmu.waitPrefetch32(c[15]),!(r&&!r())){var o;i&33554432?o=t:o=c[s];var v=(p?255:0)|(n?4278190080:0);e?(v&=$|rr|or,a.spsr=a.spsr&~v|o&v):(v&$&&(a.cpsrN=o>>31,a.cpsrZ=o&1073741824,a.cpsrC=o&536870912,a.cpsrV=o&268435456),a.mode!=16&&v&rr&&(a.switchMode(o&15|16),a.cpsrI=o&128,a.cpsrF=o&64))}}};F.prototype.constructMUL=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t()))if(r.mmu.waitMul(a[e]),a[i]&4294901760&&a[e]&4294901760){var c=(a[i]&4294901760)*a[e]|0,p=(a[i]&65535)*a[e]|0;a[s]=c+p}else a[s]=a[i]*a[e]}};F.prototype.constructMULS=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){if(r.mmu.waitMul(a[e]),a[i]&4294901760&&a[e]&4294901760){var c=(a[i]&4294901760)*a[e]|0,p=(a[i]&65535)*a[e]|0;a[s]=c+p}else a[s]=a[i]*a[e];r.cpsrN=a[s]>>31,r.cpsrZ=!(a[s]&4294967295)}}};F.prototype.constructMVN=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=~r.shifterOperand)}};F.prototype.constructMVNS=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=~r.shifterOperand,s==15&&r.hasSPSR()?r.unpackCPSR(r.spsr):(r.cpsrN=a[s]>>31,r.cpsrZ=!(a[s]&4294967295),r.cpsrC=r.shifterCarryOut))}};F.prototype.constructORR=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=a[e]|r.shifterOperand)}};F.prototype.constructORRS=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=a[e]|r.shifterOperand,s==15&&r.hasSPSR()?r.unpackCPSR(r.spsr):(r.cpsrN=a[s]>>31,r.cpsrZ=!(a[s]&4294967295),r.cpsrC=r.shifterCarryOut))}};F.prototype.constructRSB=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=r.shifterOperand-a[e])}};F.prototype.constructRSBS=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){i();var c=r.shifterOperand-a[e];s==15&&r.hasSPSR()?r.unpackCPSR(r.spsr):(r.cpsrN=c>>31,r.cpsrZ=!(c&4294967295),r.cpsrC=r.shifterOperand>>>0>=a[e]>>>0,r.cpsrV=r.shifterOperand>>31!=a[e]>>31&&r.shifterOperand>>31!=c>>31),a[s]=c}}};F.prototype.constructRSC=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){i();var c=(a[e]>>>0)+(r.cpsrC?0:1);a[s]=(r.shifterOperand>>>0)-c}}};F.prototype.constructRSCS=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){i();var c=(a[e]>>>0)+(r.cpsrC?0:1),p=(r.shifterOperand>>>0)-c;s==15&&r.hasSPSR()?r.unpackCPSR(r.spsr):(r.cpsrN=p>>31,r.cpsrZ=!(p&4294967295),r.cpsrC=r.shifterOperand>>>0>=p>>>0,r.cpsrV=r.shifterOperand>>31!=c>>31&&r.shifterOperand>>31!=p>>31),a[s]=p}}};F.prototype.constructSBC=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){i();var c=(r.shifterOperand>>>0)+(r.cpsrC?0:1);a[s]=(a[e]>>>0)-c}}};F.prototype.constructSBCS=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){i();var c=(r.shifterOperand>>>0)+(r.cpsrC?0:1),p=(a[e]>>>0)-c;s==15&&r.hasSPSR()?r.unpackCPSR(r.spsr):(r.cpsrN=p>>31,r.cpsrZ=!(p&4294967295),r.cpsrC=a[e]>>>0>=p>>>0,r.cpsrV=a[e]>>31!=c>>31&&a[e]>>31!=p>>31),a[s]=p}}};F.prototype.constructSMLAL=function(s,e,i,t,r){var a=this.cpu,c=1/4294967296,p=a.gprs;return function(){if(a.mmu.waitPrefetch32(p[15]),!(r&&!r())){a.cycles+=2,a.mmu.waitMul(i);var n=(p[t]&4294901760)*p[i],o=(p[t]&65535)*p[i],v=(p[e]>>>0)+n+o;p[e]=v,p[s]+=Math.floor(v*c)}}};F.prototype.constructSMLALS=function(s,e,i,t,r){var a=this.cpu,c=1/4294967296,p=a.gprs;return function(){if(a.mmu.waitPrefetch32(p[15]),!(r&&!r())){a.cycles+=2,a.mmu.waitMul(i);var n=(p[t]&4294901760)*p[i],o=(p[t]&65535)*p[i],v=(p[e]>>>0)+n+o;p[e]=v,p[s]+=Math.floor(v*c),a.cpsrN=p[s]>>31,a.cpsrZ=!(p[s]&4294967295||p[e]&4294967295)}}};F.prototype.constructSMULL=function(s,e,i,t,r){var a=this.cpu,c=1/4294967296,p=a.gprs;return function(){if(a.mmu.waitPrefetch32(p[15]),!(r&&!r())){++a.cycles,a.mmu.waitMul(p[i]);var n=((p[t]&4294901760)>>0)*(p[i]>>0),o=((p[t]&65535)>>0)*(p[i]>>0);p[e]=(n&4294967295)+(o&4294967295)&4294967295,p[s]=Math.floor(n*c+o*c)}}};F.prototype.constructSMULLS=function(s,e,i,t,r){var a=this.cpu,c=1/4294967296,p=a.gprs;return function(){if(a.mmu.waitPrefetch32(p[15]),!(r&&!r())){++a.cycles,a.mmu.waitMul(p[i]);var n=((p[t]&4294901760)>>0)*(p[i]>>0),o=((p[t]&65535)>>0)*(p[i]>>0);p[e]=(n&4294967295)+(o&4294967295)&4294967295,p[s]=Math.floor(n*c+o*c),a.cpsrN=p[s]>>31,a.cpsrZ=!(p[s]&4294967295||p[e]&4294967295)}}};F.prototype.constructSTM=function(s,e,i){var t=this.cpu,r=t.gprs,a=t.mmu;return function(){if(i&&!i()){a.waitPrefetch32(r[15]);return}a.wait32(r[15]);var c=e(!0),p=0,n,o;for(n=s,o=0;n;n>>=1,++o)n&1&&(a.store32(c,r[o]),c+=4,++p);a.waitMulti32(c,p)}};F.prototype.constructSTMS=function(s,e,i){var t=this.cpu,r=t.gprs,a=t.mmu;return function(){if(i&&!i()){a.waitPrefetch32(r[15]);return}a.wait32(r[15]);var c=t.mode,p=e(!0),n=0,o,v;for(t.switchMode(31),o=s,v=0;o;o>>=1,++v)o&1&&(a.store32(p,r[v]),p+=4,++n);t.switchMode(c),a.waitMulti32(p,n)}};F.prototype.constructSTR=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){if(i&&!i()){t.mmu.waitPrefetch32(r[15]);return}var a=e();t.mmu.store32(a,r[s]),t.mmu.wait32(a),t.mmu.wait32(r[15])}};F.prototype.constructSTRB=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){if(i&&!i()){t.mmu.waitPrefetch32(r[15]);return}var a=e();t.mmu.store8(a,r[s]),t.mmu.wait(a),t.mmu.wait32(r[15])}};F.prototype.constructSTRH=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){if(i&&!i()){t.mmu.waitPrefetch32(r[15]);return}var a=e();t.mmu.store16(a,r[s]),t.mmu.wait(a),t.mmu.wait32(r[15])}};F.prototype.constructSUB=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){r.mmu.waitPrefetch32(a[15]),!(t&&!t())&&(i(),a[s]=a[e]-r.shifterOperand)}};F.prototype.constructSUBS=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){i();var c=a[e]-r.shifterOperand;s==15&&r.hasSPSR()?r.unpackCPSR(r.spsr):(r.cpsrN=c>>31,r.cpsrZ=!(c&4294967295),r.cpsrC=a[e]>>>0>=r.shifterOperand>>>0,r.cpsrV=a[e]>>31!=r.shifterOperand>>31&&a[e]>>31!=c>>31),a[s]=c}}};F.prototype.constructSWI=function(s,e){var i=this.cpu,t=i.gprs;return function(){if(e&&!e()){i.mmu.waitPrefetch32(t[15]);return}i.irq.swi32(s),i.mmu.waitPrefetch32(t[15])}};F.prototype.constructSWP=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){r.mmu.wait32(a[e]),r.mmu.wait32(a[e]);var c=r.mmu.load32(a[e]);r.mmu.store32(a[e],a[i]),a[s]=c,++r.cycles}}};F.prototype.constructSWPB=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){r.mmu.wait(a[e]),r.mmu.wait(a[e]);var c=r.mmu.loadU8(a[e]);r.mmu.store8(a[e],a[i]),a[s]=c,++r.cycles}}};F.prototype.constructTEQ=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){i();var c=a[e]^r.shifterOperand;r.cpsrN=c>>31,r.cpsrZ=!(c&4294967295),r.cpsrC=r.shifterCarryOut}}};F.prototype.constructTST=function(s,e,i,t){var r=this.cpu,a=r.gprs;return function(){if(r.mmu.waitPrefetch32(a[15]),!(t&&!t())){i();var c=a[e]&r.shifterOperand;r.cpsrN=c>>31,r.cpsrZ=!(c&4294967295),r.cpsrC=r.shifterCarryOut}}};F.prototype.constructUMLAL=function(s,e,i,t,r){var a=this.cpu,c=1/4294967296,p=a.gprs;return function(){if(a.mmu.waitPrefetch32(p[15]),!(r&&!r())){a.cycles+=2,a.mmu.waitMul(i);var n=((p[t]&4294901760)>>>0)*(p[i]>>>0),o=(p[t]&65535)*(p[i]>>>0),v=(p[e]>>>0)+n+o;p[e]=v,p[s]+=v*c}}};F.prototype.constructUMLALS=function(s,e,i,t,r){var a=this.cpu,c=1/4294967296,p=a.gprs;return function(){if(a.mmu.waitPrefetch32(p[15]),!(r&&!r())){a.cycles+=2,a.mmu.waitMul(i);var n=((p[t]&4294901760)>>>0)*(p[i]>>>0),o=(p[t]&65535)*(p[i]>>>0),v=(p[e]>>>0)+n+o;p[e]=v,p[s]+=v*c,a.cpsrN=p[s]>>31,a.cpsrZ=!(p[s]&4294967295||p[e]&4294967295)}}};F.prototype.constructUMULL=function(s,e,i,t,r){var a=this.cpu,c=1/4294967296,p=a.gprs;return function(){if(a.mmu.waitPrefetch32(p[15]),!(r&&!r())){++a.cycles,a.mmu.waitMul(p[i]);var n=((p[t]&4294901760)>>>0)*(p[i]>>>0),o=((p[t]&65535)>>>0)*(p[i]>>>0);p[e]=(n&4294967295)+(o&4294967295)&4294967295,p[s]=n*c+o*c>>>0}}};F.prototype.constructUMULLS=function(s,e,i,t,r){var a=this.cpu,c=1/4294967296,p=a.gprs;return function(){if(a.mmu.waitPrefetch32(p[15]),!(r&&!r())){++a.cycles,a.mmu.waitMul(p[i]);var n=((p[t]&4294901760)>>>0)*(p[i]>>>0),o=((p[t]&65535)>>>0)*(p[i]>>>0);p[e]=(n&4294967295)+(o&4294967295)&4294967295,p[s]=n*c+o*c>>>0,a.cpsrN=p[s]>>31,a.cpsrZ=!(p[s]&4294967295||p[e]&4294967295)}}};function m(s){this.cpu=s}m.prototype.constructADC=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=(t[e]>>>0)+(i.cpsrC?1:0),a=t[s],c=(a>>>0)+r,p=a>>31,n=c>>31,o=r>>31;i.cpsrN=n,i.cpsrZ=!(c&4294967295),i.cpsrC=c>4294967295,i.cpsrV=p==o&&p!=n&&o!=n,t[s]=c}};m.prototype.constructADD1=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){t.mmu.waitPrefetch(r[15]);var a=(r[e]>>>0)+i;t.cpsrN=a>>31,t.cpsrZ=!(a&4294967295),t.cpsrC=a>4294967295,t.cpsrV=!(r[e]>>31)&&(r[e]>>31^a)>>31&&a>>31,r[s]=a}};m.prototype.constructADD2=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=(t[s]>>>0)+e;i.cpsrN=r>>31,i.cpsrZ=!(r&4294967295),i.cpsrC=r>4294967295,i.cpsrV=!(t[s]>>31)&&(t[s]^r)>>31&&(e^r)>>31,t[s]=r}};m.prototype.constructADD3=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){t.mmu.waitPrefetch(r[15]);var a=(r[e]>>>0)+(r[i]>>>0);t.cpsrN=a>>31,t.cpsrZ=!(a&4294967295),t.cpsrC=a>4294967295,t.cpsrV=!((r[e]^r[i])>>31)&&(r[e]^a)>>31&&(r[i]^a)>>31,r[s]=a}};m.prototype.constructADD4=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]),t[s]+=t[e]}};m.prototype.constructADD5=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]),t[s]=(t[15]&4294967292)+e}};m.prototype.constructADD6=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]),t[s]=t[13]+e}};m.prototype.constructADD7=function(s){var e=this.cpu,i=e.gprs;return function(){e.mmu.waitPrefetch(i[15]),i[13]+=s}};m.prototype.constructAND=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]),t[s]=t[s]&t[e],i.cpsrN=t[s]>>31,i.cpsrZ=!(t[s]&4294967295)}};m.prototype.constructASR1=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){t.mmu.waitPrefetch(r[15]),i==0?(t.cpsrC=r[e]>>31,t.cpsrC?r[s]=4294967295:r[s]=0):(t.cpsrC=r[e]&1<>i),t.cpsrN=r[s]>>31,t.cpsrZ=!(r[s]&4294967295)}};m.prototype.constructASR2=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=t[e]&255;r&&(r<32?(i.cpsrC=t[s]&1<>=r):(i.cpsrC=t[s]>>31,i.cpsrC?t[s]=4294967295:t[s]=0)),i.cpsrN=t[s]>>31,i.cpsrZ=!(t[s]&4294967295)}};m.prototype.constructB1=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]),e()&&(t[15]+=s)}};m.prototype.constructB2=function(s){var e=this.cpu,i=e.gprs;return function(){e.mmu.waitPrefetch(i[15]),i[15]+=s}};m.prototype.constructBIC=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]),t[s]=t[s]&~t[e],i.cpsrN=t[s]>>31,i.cpsrZ=!(t[s]&4294967295)}};m.prototype.constructBL1=function(s){var e=this.cpu,i=e.gprs;return function(){e.mmu.waitPrefetch(i[15]),i[14]=i[15]+s}};m.prototype.constructBL2=function(s){var e=this.cpu,i=e.gprs;return function(){e.mmu.waitPrefetch(i[15]);var t=i[15];i[15]=i[14]+(s<<1),i[14]=t-1}};m.prototype.constructBX=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]),i.switchExecMode(t[e]&1);var r=0;e==15&&(r=t[e]&2),t[15]=t[e]&4294967294-r}};m.prototype.constructCMN=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=(t[s]>>>0)+(t[e]>>>0);i.cpsrN=r>>31,i.cpsrZ=!(r&4294967295),i.cpsrC=r>4294967295,i.cpsrV=t[s]>>31==t[e]>>31&&t[s]>>31!=r>>31&&t[e]>>31!=r>>31}};m.prototype.constructCMP1=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=t[s]-e;i.cpsrN=r>>31,i.cpsrZ=!(r&4294967295),i.cpsrC=t[s]>>>0>=e,i.cpsrV=t[s]>>31&&(t[s]^r)>>31}};m.prototype.constructCMP2=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=t[s],a=t[e],c=r-a,p=c>>31,n=r>>31;i.cpsrN=p,i.cpsrZ=!(c&4294967295),i.cpsrC=r>>>0>=a>>>0,i.cpsrV=n!=a>>31&&n!=p}};m.prototype.constructCMP3=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=t[s]-t[e];i.cpsrN=r>>31,i.cpsrZ=!(r&4294967295),i.cpsrC=t[s]>>>0>=t[e]>>>0,i.cpsrV=(t[s]^t[e])>>31&&(t[s]^r)>>31}};m.prototype.constructEOR=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]),t[s]=t[s]^t[e],i.cpsrN=t[s]>>31,i.cpsrZ=!(t[s]&4294967295)}};m.prototype.constructLDMIA=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=t[s],a=0,c,p;for(c=1,p=0;p<8;c<<=1,++p)e&c&&(t[p]=i.mmu.load32(r),r+=4,++a);i.mmu.waitMulti32(r,a),1<>31,t.cpsrZ=!(r[s]&4294967295)}};m.prototype.constructLSL2=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=t[e]&255;r&&(r<32?(i.cpsrC=t[s]&1<<32-r,t[s]<<=r):(r>32?i.cpsrC=0:i.cpsrC=t[s]&1,t[s]=0)),i.cpsrN=t[s]>>31,i.cpsrZ=!(t[s]&4294967295)}};m.prototype.constructLSR1=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){t.mmu.waitPrefetch(r[15]),i==0?(t.cpsrC=r[e]>>31,r[s]=0):(t.cpsrC=r[e]&1<>>i),t.cpsrN=0,t.cpsrZ=!(r[s]&4294967295)}};m.prototype.constructLSR2=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=t[e]&255;r&&(r<32?(i.cpsrC=t[s]&1<>>=r):(r>32?i.cpsrC=0:i.cpsrC=t[s]>>31,t[s]=0)),i.cpsrN=t[s]>>31,i.cpsrZ=!(t[s]&4294967295)}};m.prototype.constructMOV1=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]),t[s]=e,i.cpsrN=e>>31,i.cpsrZ=!(e&4294967295)}};m.prototype.constructMOV2=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){t.mmu.waitPrefetch(r[15]);var a=r[e];t.cpsrN=a>>31,t.cpsrZ=!(a&4294967295),t.cpsrC=0,t.cpsrV=0,r[s]=a}};m.prototype.constructMOV3=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]),t[s]=t[e]}};m.prototype.constructMUL=function(s,e){var i=this.cpu,t=i.gprs;return function(){if(i.mmu.waitPrefetch(t[15]),i.mmu.waitMul(t[e]),t[e]&4294901760&&t[s]&4294901760){var r=(t[s]&4294901760)*t[e]&4294967295,a=(t[s]&65535)*t[e]&4294967295;t[s]=r+a&4294967295}else t[s]*=t[e];i.cpsrN=t[s]>>31,i.cpsrZ=!(t[s]&4294967295)}};m.prototype.constructMVN=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]),t[s]=~t[e],i.cpsrN=t[s]>>31,i.cpsrZ=!(t[s]&4294967295)}};m.prototype.constructNEG=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=-t[e];i.cpsrN=r>>31,i.cpsrZ=!(r&4294967295),i.cpsrC=0>=r>>>0,i.cpsrV=t[e]>>31&&r>>31,t[s]=r}};m.prototype.constructORR=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]),t[s]=t[s]|t[e],i.cpsrN=t[s]>>31,i.cpsrZ=!(t[s]&4294967295)}};m.prototype.constructPOP=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]),++i.cycles;var r=t[13],a=0,c,p;for(c=1,p=0;p<8;c<<=1,++p)s&c&&(i.mmu.waitSeq32(r),t[p]=i.mmu.load32(r),r+=4,++a);e&&(t[15]=i.mmu.load32(r)&4294967294,r+=4,++a),i.mmu.waitMulti32(r,a),t[13]=r}};m.prototype.constructPUSH=function(s,e){var i=this.cpu,t=i.gprs;return function(){var r=t[13]-4,a=0;i.mmu.waitPrefetch(t[15]),e&&(i.mmu.store32(r,t[14]),r-=4,++a);var c,p;for(c=128,p=7;c;c>>=1,--p)if(s&c){i.mmu.store32(r,t[p]),r-=4,++a;break}for(c>>=1,--p;c;c>>=1,--p)s&c&&(i.mmu.store32(r,t[p]),r-=4,++a);i.mmu.waitMulti32(r,a),t[13]=r+4}};m.prototype.constructROR=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=t[e]&255;if(r){var a=r&31;a>0?(i.cpsrC=t[s]&1<>>a|t[s]<<32-a):i.cpsrC=t[s]>>31}i.cpsrN=t[s]>>31,i.cpsrZ=!(t[s]&4294967295)}};m.prototype.constructSBC=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=(t[e]>>>0)+(i.cpsrC?0:1),a=(t[s]>>>0)-r;i.cpsrN=a>>31,i.cpsrZ=!(a&4294967295),i.cpsrC=t[s]>>>0>=a>>>0,i.cpsrV=(t[s]^r)>>31&&(t[s]^a)>>31,t[s]=a}};m.prototype.constructSTMIA=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.wait(t[15]);var r=t[s],a=0,c,p;for(c=1,p=0;p<8;c<<=1,++p)if(e&c){i.mmu.store32(r,t[p]),r+=4,++a;break}for(c<<=1,++p;p<8;c<<=1,++p)e&c&&(i.mmu.store32(r,t[p]),r+=4,++a);i.mmu.waitMulti32(r,a),t[s]=r}};m.prototype.constructSTR1=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){var a=r[e]+i;t.mmu.store32(a,r[s]),t.mmu.wait(r[15]),t.mmu.wait32(a)}};m.prototype.constructSTR2=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){t.mmu.store32(r[e]+r[i],r[s]),t.mmu.wait(r[15]),t.mmu.wait32(r[e]+r[i])}};m.prototype.constructSTR3=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.store32(t[13]+e,t[s]),i.mmu.wait(t[15]),i.mmu.wait32(t[13]+e)}};m.prototype.constructSTRB1=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){var a=r[e]+i;t.mmu.store8(a,r[s]),t.mmu.wait(r[15]),t.mmu.wait(a)}};m.prototype.constructSTRB2=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){t.mmu.store8(r[e]+r[i],r[s]),t.mmu.wait(r[15]),t.mmu.wait(r[e]+r[i])}};m.prototype.constructSTRH1=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){var a=r[e]+i;t.mmu.store16(a,r[s]),t.mmu.wait(r[15]),t.mmu.wait(a)}};m.prototype.constructSTRH2=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){t.mmu.store16(r[e]+r[i],r[s]),t.mmu.wait(r[15]),t.mmu.wait(r[e]+r[i])}};m.prototype.constructSUB1=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){t.mmu.waitPrefetch(r[15]);var a=r[e]-i;t.cpsrN=a>>31,t.cpsrZ=!(a&4294967295),t.cpsrC=r[e]>>>0>=i,t.cpsrV=r[e]>>31&&(r[e]^a)>>31,r[s]=a}};m.prototype.constructSUB2=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=t[s]-e;i.cpsrN=r>>31,i.cpsrZ=!(r&4294967295),i.cpsrC=t[s]>>>0>=e,i.cpsrV=t[s]>>31&&(t[s]^r)>>31,t[s]=r}};m.prototype.constructSUB3=function(s,e,i){var t=this.cpu,r=t.gprs;return function(){t.mmu.waitPrefetch(r[15]);var a=r[e]-r[i];t.cpsrN=a>>31,t.cpsrZ=!(a&4294967295),t.cpsrC=r[e]>>>0>=r[i]>>>0,t.cpsrV=r[e]>>31!=r[i]>>31&&r[e]>>31!=a>>31,r[s]=a}};m.prototype.constructSWI=function(s){var e=this.cpu,i=e.gprs;return function(){e.irq.swi(s),e.mmu.waitPrefetch(i[15])}};m.prototype.constructTST=function(s,e){var i=this.cpu,t=i.gprs;return function(){i.mmu.waitPrefetch(t[15]);var r=t[s]&t[e];i.cpsrN=r>>31,i.cpsrZ=!(r&4294967295)}};function R(){this.SP=13,this.LR=14,this.PC=15,this.MODE_ARM=0,this.MODE_THUMB=1,this.MODE_USER=16,this.MODE_FIQ=17,this.MODE_IRQ=18,this.MODE_SUPERVISOR=19,this.MODE_ABORT=23,this.MODE_UNDEFINED=27,this.MODE_SYSTEM=31,this.BANK_NONE=0,this.BANK_FIQ=1,this.BANK_IRQ=2,this.BANK_SUPERVISOR=3,this.BANK_ABORT=4,this.BANK_UNDEFINED=5,this.WORD_SIZE_ARM=4,this.WORD_SIZE_THUMB=2,this.BASE_RESET=0,this.BASE_UNDEF=4,this.BASE_SWI=8,this.BASE_PABT=12,this.BASE_DABT=16,this.BASE_IRQ=24,this.BASE_FIQ=28,this.armCompiler=new F(this),this.thumbCompiler=new m(this),this.generateConds(),this.gprs=new Int32Array(16)}R.prototype.resetCPU=function(s){for(var e=0;e<15;++e)this.gprs[e]=0;this.gprs[15]=s+4,this.loadInstruction=this.loadInstructionArm,this.execMode=0,this.instructionWidth=4,this.mode=31,this.cpsrI=!1,this.cpsrF=!1,this.cpsrV=!1,this.cpsrC=!1,this.cpsrZ=!1,this.cpsrN=!1,this.bankedRegisters=[new Int32Array(7),new Int32Array(7),new Int32Array(2),new Int32Array(2),new Int32Array(2),new Int32Array(2)],this.spsr=0,this.bankedSPSRs=new Int32Array(6),this.cycles=0,this.shifterOperand=0,this.shifterCarryOut=0,this.page=null,this.pageId=0,this.pageRegion=-1,this.instruction=null,this.irq.clear();var i=this.gprs,t=this.mmu;this.step=function(){var r=this.instruction||(this.instruction=this.loadInstruction(i[15]-this.instructionWidth));if(i[15]+=this.instructionWidth,this.conditionPassed=!0,r(),!r.writesPC)this.instruction!=null&&((r.next==null||r.next.page.invalid)&&(r.next=this.loadInstruction(i[15]-this.instructionWidth)),this.instruction=r.next);else if(this.conditionPassed){var a=i[15]&=4294967294;this.execMode==0?(t.wait32(a),t.waitPrefetch32(a)):(t.wait(a),t.waitPrefetch(a)),i[15]+=this.instructionWidth,r.fixedJump?this.instruction!=null&&((r.next==null||r.next.page.invalid)&&(r.next=this.loadInstruction(i[15]-this.instructionWidth)),this.instruction=r.next):this.instruction=null}else this.instruction=null;this.irq.updateTimers()}};R.prototype.freeze=function(){return{PC:this.gprs[15]-this.instructionWidth,SP:this.gprs[13],gprs:[this.gprs[0],this.gprs[1],this.gprs[2],this.gprs[3],this.gprs[4],this.gprs[5],this.gprs[6],this.gprs[7],this.gprs[8],this.gprs[9],this.gprs[10],this.gprs[11],this.gprs[12],this.gprs[13],this.gprs[14],this.gprs[15]],mode:this.mode,cpsrI:this.cpsrI,cpsrF:this.cpsrF,cpsrV:this.cpsrV,cpsrC:this.cpsrC,cpsrZ:this.cpsrZ,cpsrN:this.cpsrN,bankedRegisters:[[this.bankedRegisters[0][0],this.bankedRegisters[0][1],this.bankedRegisters[0][2],this.bankedRegisters[0][3],this.bankedRegisters[0][4],this.bankedRegisters[0][5],this.bankedRegisters[0][6]],[this.bankedRegisters[1][0],this.bankedRegisters[1][1],this.bankedRegisters[1][2],this.bankedRegisters[1][3],this.bankedRegisters[1][4],this.bankedRegisters[1][5],this.bankedRegisters[1][6]],[this.bankedRegisters[2][0],this.bankedRegisters[2][1]],[this.bankedRegisters[3][0],this.bankedRegisters[3][1]],[this.bankedRegisters[4][0],this.bankedRegisters[4][1]],[this.bankedRegisters[5][0],this.bankedRegisters[5][1]]],spsr:this.spsr,bankedSPSRs:[this.bankedSPSRs[0],this.bankedSPSRs[1],this.bankedSPSRs[2],this.bankedSPSRs[3],this.bankedSPSRs[4],this.bankedSPSRs[5]],cycles:this.cycles,instructionWidth:this.instructionWidth}};R.prototype.defrost=function(s){this.instruction=null,this.page=null,this.pageId=0,this.pageRegion=-1,this.gprs[0]=s.gprs[0],this.gprs[1]=s.gprs[1],this.gprs[2]=s.gprs[2],this.gprs[3]=s.gprs[3],this.gprs[4]=s.gprs[4],this.gprs[5]=s.gprs[5],this.gprs[6]=s.gprs[6],this.gprs[7]=s.gprs[7],this.gprs[8]=s.gprs[8],this.gprs[9]=s.gprs[9],this.gprs[10]=s.gprs[10],this.gprs[11]=s.gprs[11],this.gprs[12]=s.gprs[12],this.gprs[13]=s.gprs[13],this.gprs[14]=s.gprs[14],this.gprs[15]=s.gprs[15],this.mode=s.mode,this.cpsrI=s.cpsrI,this.cpsrF=s.cpsrF,this.cpsrV=s.cpsrV,this.cpsrC=s.cpsrC,this.cpsrZ=s.cpsrZ,this.cpsrN=s.cpsrN,this.bankedRegisters[0][0]=s.bankedRegisters[0][0],this.bankedRegisters[0][1]=s.bankedRegisters[0][1],this.bankedRegisters[0][2]=s.bankedRegisters[0][2],this.bankedRegisters[0][3]=s.bankedRegisters[0][3],this.bankedRegisters[0][4]=s.bankedRegisters[0][4],this.bankedRegisters[0][5]=s.bankedRegisters[0][5],this.bankedRegisters[0][6]=s.bankedRegisters[0][6],this.bankedRegisters[1][0]=s.bankedRegisters[1][0],this.bankedRegisters[1][1]=s.bankedRegisters[1][1],this.bankedRegisters[1][2]=s.bankedRegisters[1][2],this.bankedRegisters[1][3]=s.bankedRegisters[1][3],this.bankedRegisters[1][4]=s.bankedRegisters[1][4],this.bankedRegisters[1][5]=s.bankedRegisters[1][5],this.bankedRegisters[1][6]=s.bankedRegisters[1][6],this.bankedRegisters[2][0]=s.bankedRegisters[2][0],this.bankedRegisters[2][1]=s.bankedRegisters[2][1],this.bankedRegisters[3][0]=s.bankedRegisters[3][0],this.bankedRegisters[3][1]=s.bankedRegisters[3][1],this.bankedRegisters[4][0]=s.bankedRegisters[4][0],this.bankedRegisters[4][1]=s.bankedRegisters[4][1],this.bankedRegisters[5][0]=s.bankedRegisters[5][0],this.bankedRegisters[5][1]=s.bankedRegisters[5][1],this.spsr=s.spsr,this.bankedSPSRs[0]=s.bankedSPSRs[0],this.bankedSPSRs[1]=s.bankedSPSRs[1],this.bankedSPSRs[2]=s.bankedSPSRs[2],this.bankedSPSRs[3]=s.bankedSPSRs[3],this.bankedSPSRs[4]=s.bankedSPSRs[4],this.bankedSPSRs[5]=s.bankedSPSRs[5],this.cycles=s.cycles,this.instructionWidth=s.instructionWidth,this.loadInstruction=s.instructionWidth==2?this.loadInstructionThumb:this.loadInstructionArm,this.execMode=s.instructionWidth==2?1:0};R.prototype.fetchPage=function(s){var e=this.mmu,i=s>>>e.BASE_OFFSET,t=e.addressToPage(i,s&e.OFFSET_MASK);if(i==this.pageRegion){if(t==this.pageId&&!this.page.invalid)return;this.pageId=t}else this.pageMask=e.memory[i].PAGE_MASK,this.pageRegion=i,this.pageId=t;this.page=e.accessPage(i,t)};R.prototype.loadInstructionArm=function(s){var e=null;this.fetchPage(s);var i=(s&this.pageMask)>>2;if(e=this.page.arm[i],e)return e;var t=this.mmu.load32(s)>>>0;return e=this.compileArm(t),e.next=null,e.page=this.page,e.address=s,e.opcode=t,this.page.arm[i]=e,e};R.prototype.loadInstructionThumb=function(s){var e=null;this.fetchPage(s);var i=(s&this.pageMask)>>1;if(e=this.page.thumb[i],e)return e;var t=this.mmu.load16(s);return e=this.compileThumb(t),e.next=null,e.page=this.page,e.address=s,e.opcode=t,this.page.thumb[i]=e,e};R.prototype.selectBank=function(s){switch(s){case 16:case 31:return 0;case 17:return 1;case 18:return 2;case 19:return 3;case 23:return 4;case 27:return 5;default:throw new y("Invalid user mode "+s+" passed to selectBank")}};R.prototype.switchExecMode=function(s){this.execMode!=s&&(this.execMode=s,s==0?(this.instructionWidth=4,this.loadInstruction=this.loadInstructionArm):(this.instructionWidth=2,this.loadInstruction=this.loadInstructionThumb))};R.prototype.switchMode=function(s){if(s!=this.mode){if(s!=16||s!=31){var e=this.selectBank(s),i=this.selectBank(this.mode);if(e!=i){if(s==17||this.mode==17){var t=i==1?1:0,r=e==1?1:0;this.bankedRegisters[t][2]=this.gprs[8],this.bankedRegisters[t][3]=this.gprs[9],this.bankedRegisters[t][4]=this.gprs[10],this.bankedRegisters[t][5]=this.gprs[11],this.bankedRegisters[t][6]=this.gprs[12],this.gprs[8]=this.bankedRegisters[r][2],this.gprs[9]=this.bankedRegisters[r][3],this.gprs[10]=this.bankedRegisters[r][4],this.gprs[11]=this.bankedRegisters[r][5],this.gprs[12]=this.bankedRegisters[r][6]}this.bankedRegisters[i][0]=this.gprs[13],this.bankedRegisters[i][1]=this.gprs[14],this.gprs[13]=this.bankedRegisters[e][0],this.gprs[14]=this.bankedRegisters[e][1],this.bankedSPSRs[i]=this.spsr,this.spsr=this.bankedSPSRs[e]}}this.mode=s}};R.prototype.packCPSR=function(){return this.mode|this.execMode<<5|this.cpsrF<<6|this.cpsrI<<7|this.cpsrN<<31|this.cpsrZ<<30|this.cpsrC<<29|this.cpsrV<<28};R.prototype.unpackCPSR=function(s){this.switchMode(s&31),this.switchExecMode(!!(s&32)),this.cpsrF=s&64,this.cpsrI=s&128,this.cpsrN=s&2147483648,this.cpsrZ=s&1073741824,this.cpsrC=s&536870912,this.cpsrV=s&268435456,this.irq.testIRQ()};R.prototype.hasSPSR=function(){return this.mode!=31&&this.mode!=16};R.prototype.raiseIRQ=function(){if(!this.cpsrI){var s=this.packCPSR(),e=this.instructionWidth;this.switchMode(18),this.spsr=s,this.gprs[14]=this.gprs[15]-e+4,this.gprs[15]=this.BASE_IRQ+4,this.instruction=null,this.switchExecMode(0),this.cpsrI=!0}};R.prototype.raiseTrap=function(){var s=this.packCPSR(),e=this.instructionWidth;this.switchMode(19),this.spsr=s,this.gprs[14]=this.gprs[15]-e,this.gprs[15]=this.BASE_SWI+4,this.instruction=null,this.switchExecMode(0),this.cpsrI=!0};R.prototype.badOp=function(s){var e=function(){throw new y("Illegal instruction: 0x"+s.toString(16))};return e.writesPC=!0,e.fixedJump=!1,e};R.prototype.generateConds=function(){var s=this;this.conds=[function(){return s.conditionPassed=s.cpsrZ},function(){return s.conditionPassed=!s.cpsrZ},function(){return s.conditionPassed=s.cpsrC},function(){return s.conditionPassed=!s.cpsrC},function(){return s.conditionPassed=s.cpsrN},function(){return s.conditionPassed=!s.cpsrN},function(){return s.conditionPassed=s.cpsrV},function(){return s.conditionPassed=!s.cpsrV},function(){return s.conditionPassed=s.cpsrC&&!s.cpsrZ},function(){return s.conditionPassed=!s.cpsrC||s.cpsrZ},function(){return s.conditionPassed=!s.cpsrN==!s.cpsrV},function(){return s.conditionPassed=!s.cpsrN!=!s.cpsrV},function(){return s.conditionPassed=!s.cpsrZ&&!s.cpsrN==!s.cpsrV},function(){return s.conditionPassed=s.cpsrZ||!s.cpsrN!=!s.cpsrV},null,null]};R.prototype.barrelShiftImmediate=function(s,e,i){var t=this,r=this.gprs,a=this.badOp;switch(s){case 0:e?a=function(){t.shifterOperand=r[i]<>>e,t.shifterCarryOut=r[i]&1<>e,t.shifterCarryOut=r[i]&1<>>e|r[i]<<32-e,t.shifterCarryOut=r[i]&1<>>1,t.shifterCarryOut=r[i]&1};break}return a};R.prototype.compileArm=function(s){var e=this.badOp(s),i=s&234881024,t=this,r=this.gprs,a=this.conds[(s&4026531840)>>>28];if((s&268435440)==19922704){var c=s&15;e=this.armCompiler.constructBX(c,a),e.writesPC=!0,e.fixedJump=!1}else if(!(s&201326592)&&(i==33554432||(s&144)!=144)){var p=s&31457280,n=s&1048576,o=!1;if((p&25165824)==16777216&&!n){var v=s&4194304;if((s&11595776)==2158592){var c=s&15,x=s&255,w=(s&3840)>>7;x=x>>>w|x<<32-w,e=this.armCompiler.constructMSR(c,v,s,x,a),e.writesPC=!1}else if((s&12517376)==983040){var h=(s&61440)>>12;e=this.armCompiler.constructMRS(h,v,a),e.writesPC=h==15}}else{var f=(s&983040)>>16,h=(s&61440)>>12,l=s&96,c=s&15,C=function(){throw new y("BUG: invalid barrel shifter")};if(s&33554432){var x=s&255,V=(s&3840)>>7;V?C=this.armCompiler.constructAddressingMode1ImmediateRotate(x,V):C=this.armCompiler.constructAddressingMode1Immediate(x)}else if(s&16){var P=(s&3840)>>8;switch(o=!0,l){case 0:C=this.armCompiler.constructAddressingMode1LSL(P,c);break;case 32:C=this.armCompiler.constructAddressingMode1LSR(P,c);break;case 64:C=this.armCompiler.constructAddressingMode1ASR(P,c);break;case 96:C=this.armCompiler.constructAddressingMode1ROR(P,c);break}}else{var x=(s&3968)>>7;C=this.barrelShiftImmediate(l,x,c)}switch(p){case 0:n?e=this.armCompiler.constructANDS(h,f,C,a):e=this.armCompiler.constructAND(h,f,C,a);break;case 2097152:n?e=this.armCompiler.constructEORS(h,f,C,a):e=this.armCompiler.constructEOR(h,f,C,a);break;case 4194304:n?e=this.armCompiler.constructSUBS(h,f,C,a):e=this.armCompiler.constructSUB(h,f,C,a);break;case 6291456:n?e=this.armCompiler.constructRSBS(h,f,C,a):e=this.armCompiler.constructRSB(h,f,C,a);break;case 8388608:n?e=this.armCompiler.constructADDS(h,f,C,a):e=this.armCompiler.constructADD(h,f,C,a);break;case 10485760:n?e=this.armCompiler.constructADCS(h,f,C,a):e=this.armCompiler.constructADC(h,f,C,a);break;case 12582912:n?e=this.armCompiler.constructSBCS(h,f,C,a):e=this.armCompiler.constructSBC(h,f,C,a);break;case 14680064:n?e=this.armCompiler.constructRSCS(h,f,C,a):e=this.armCompiler.constructRSC(h,f,C,a);break;case 16777216:e=this.armCompiler.constructTST(h,f,C,a);break;case 18874368:e=this.armCompiler.constructTEQ(h,f,C,a);break;case 20971520:e=this.armCompiler.constructCMP(h,f,C,a);break;case 23068672:e=this.armCompiler.constructCMN(h,f,C,a);break;case 25165824:n?e=this.armCompiler.constructORRS(h,f,C,a):e=this.armCompiler.constructORR(h,f,C,a);break;case 27262976:n?e=this.armCompiler.constructMOVS(h,f,C,a):e=this.armCompiler.constructMOV(h,f,C,a);break;case 29360128:n?e=this.armCompiler.constructBICS(h,f,C,a):e=this.armCompiler.constructBIC(h,f,C,a);break;case 31457280:n?e=this.armCompiler.constructMVNS(h,f,C,a):e=this.armCompiler.constructMVN(h,f,C,a);break}e.writesPC=h==15}}else if((s&263196656)==16777360){var c=s&15,h=s>>12&15,f=s>>16&15;s&4194304?e=this.armCompiler.constructSWPB(h,f,c,a):e=this.armCompiler.constructSWP(h,f,c,a),e.writesPC=h==15}else switch(i){case 0:if((s&16777456)==144){var h=(s&983040)>>16,f=(s&61440)>>12,P=(s&3840)>>8,c=s&15;switch(s&15728640){case 0:e=this.armCompiler.constructMUL(h,P,c,a);break;case 1048576:e=this.armCompiler.constructMULS(h,P,c,a);break;case 2097152:e=this.armCompiler.constructMLA(h,f,P,c,a);break;case 3145728:e=this.armCompiler.constructMLAS(h,f,P,c,a);break;case 8388608:e=this.armCompiler.constructUMULL(h,f,P,c,a);break;case 9437184:e=this.armCompiler.constructUMULLS(h,f,P,c,a);break;case 10485760:e=this.armCompiler.constructUMLAL(h,f,P,c,a);break;case 11534336:e=this.armCompiler.constructUMLALS(h,f,P,c,a);break;case 12582912:e=this.armCompiler.constructSMULL(h,f,P,c,a);break;case 13631488:e=this.armCompiler.constructSMULLS(h,f,P,c,a);break;case 14680064:e=this.armCompiler.constructSMLAL(h,f,P,c,a);break;case 15728640:e=this.armCompiler.constructSMLALS(h,f,P,c,a);break}e.writesPC=h==15}else{var T=s&1048576,h=(s&61440)>>12,cr=(s&3840)>>4,ur=c=s&15,H=s&32,n=s&64,k=s&2097152,i=s&4194304,d;if(i){var x=ur|cr;d=this.armCompiler.constructAddressingMode23Immediate(s,x,a)}else d=this.armCompiler.constructAddressingMode23Register(s,c,a);d.writesPC=!!k&&f==15,(s&144)==144&&(T?H?n?e=this.armCompiler.constructLDRSH(h,d,a):e=this.armCompiler.constructLDRH(h,d,a):n&&(e=this.armCompiler.constructLDRSB(h,d,a)):!n&&H&&(e=this.armCompiler.constructSTRH(h,d,a))),e.writesPC=h==15||d.writesPC}break;case 67108864:case 100663296:var h=(s&61440)>>12,T=s&1048576,W=s&4194304,i=s&33554432,d=function(){throw new y("Unimplemented memory access: 0x"+s.toString(16))};if(~s&16777216&&(s&=4292870143),i){var c=s&15,l=s&96,K=(s&3968)>>7;l||K?(C=this.barrelShiftImmediate(l,K,c),d=this.armCompiler.constructAddressingMode2RegisterShifted(s,C,a)):d=this.armCompiler.constructAddressingMode23Register(s,c,a)}else{var M=s&4095;d=this.armCompiler.constructAddressingMode23Immediate(s,M,a)}T?W?e=this.armCompiler.constructLDRB(h,d,a):e=this.armCompiler.constructLDR(h,d,a):W?e=this.armCompiler.constructSTRB(h,d,a):e=this.armCompiler.constructSTR(h,d,a),e.writesPC=T&&(h==15||d.writesPC);break;case 134217728:var T=s&1048576,k=s&2097152,Q=s&4194304,pr=s&8388608,G=s&16777216,P=s&65535,f=(s&983040)>>16,d,x=0,M=0,B=!1;if(pr){G&&(x=4);for(var A=1,i=0;i<16;A<<=1,++i)P&A&&(k&&i==f&&!M&&(P&=~A,x+=4,B=!0),M+=4)}else{G||(x=4);for(var A=1,i=0;i<16;A<<=1,++i)P&A&&(k&&i==f&&!M&&(P&=~A,x+=4,B=!0),x-=4,M-=4)}k?d=this.armCompiler.constructAddressingMode4Writeback(x,M,f,B):d=this.armCompiler.constructAddressingMode4(x,f),T?(Q?e=this.armCompiler.constructLDMS(P,d,a):e=this.armCompiler.constructLDM(P,d,a),e.writesPC=!!(P&1<<15)):(Q?e=this.armCompiler.constructSTMS(P,d,a):e=this.armCompiler.constructSTM(P,d,a),e.writesPC=!1);break;case 167772160:var x=s&16777215;x&8388608&&(x|=4278190080),x<<=2;var nr=s&16777216;nr?e=this.armCompiler.constructBL(x,a):e=this.armCompiler.constructB(x,a),e.writesPC=!0,e.fixedJump=!0;break;case 201326592:break;case 234881024:if((s&251658240)==251658240){var x=s&16777215;e=this.armCompiler.constructSWI(x,a),e.writesPC=!1}break;default:throw new y("Bad opcode: 0x"+s.toString(16))}return e.execMode=0,e.fixedJump=e.fixedJump||!1,e};R.prototype.compileThumb=function(s){var e=this.badOp(s&65535),i=this,t=this.gprs;if((s&64512)==16384){var r=(s&56)>>3,a=s&7;switch(s&960){case 0:e=this.thumbCompiler.constructAND(a,r);break;case 64:e=this.thumbCompiler.constructEOR(a,r);break;case 128:e=this.thumbCompiler.constructLSL2(a,r);break;case 192:e=this.thumbCompiler.constructLSR2(a,r);break;case 256:e=this.thumbCompiler.constructASR2(a,r);break;case 320:e=this.thumbCompiler.constructADC(a,r);break;case 384:e=this.thumbCompiler.constructSBC(a,r);break;case 448:e=this.thumbCompiler.constructROR(a,r);break;case 512:e=this.thumbCompiler.constructTST(a,r);break;case 576:e=this.thumbCompiler.constructNEG(a,r);break;case 640:e=this.thumbCompiler.constructCMP2(a,r);break;case 704:e=this.thumbCompiler.constructCMN(a,r);break;case 768:e=this.thumbCompiler.constructORR(a,r);break;case 832:e=this.thumbCompiler.constructMUL(a,r);break;case 896:e=this.thumbCompiler.constructBIC(a,r);break;case 960:e=this.thumbCompiler.constructMVN(a,r);break}e.writesPC=!1}else if((s&64512)==17408){var r=(s&120)>>3,c=s&7,p=s&128,a=c|p>>4;switch(s&768){case 0:e=this.thumbCompiler.constructADD4(a,r),e.writesPC=a==15;break;case 256:e=this.thumbCompiler.constructCMP3(a,r),e.writesPC=!1;break;case 512:e=this.thumbCompiler.constructMOV3(a,r),e.writesPC=a==15;break;case 768:e=this.thumbCompiler.constructBX(a,r),e.writesPC=!0,e.fixedJump=!1;break}}else if((s&63488)==6144){var r=(s&448)>>6,c=(s&56)>>3,a=s&7;switch(s&1536){case 0:e=this.thumbCompiler.constructADD3(a,c,r);break;case 512:e=this.thumbCompiler.constructSUB3(a,c,r);break;case 1024:var n=(s&448)>>6;n?e=this.thumbCompiler.constructADD1(a,c,n):e=this.thumbCompiler.constructMOV2(a,c,r);break;case 1536:var n=(s&448)>>6;e=this.thumbCompiler.constructSUB1(a,c,n);break}e.writesPC=!1}else if(s&57344)if((s&57344)==8192){var n=s&255,c=(s&1792)>>8;switch(s&6144){case 0:e=this.thumbCompiler.constructMOV1(c,n);break;case 2048:e=this.thumbCompiler.constructCMP1(c,n);break;case 4096:e=this.thumbCompiler.constructADD2(c,n);break;case 6144:e=this.thumbCompiler.constructSUB2(c,n);break}e.writesPC=!1}else if((s&63488)==18432){var a=(s&1792)>>8,n=(s&255)<<2;e=this.thumbCompiler.constructLDR3(a,n),e.writesPC=!1}else if((s&61440)==20480){var a=s&7,c=(s&56)>>3,r=(s&448)>>6,o=s&3584;switch(o){case 0:e=this.thumbCompiler.constructSTR2(a,c,r);break;case 512:e=this.thumbCompiler.constructSTRH2(a,c,r);break;case 1024:e=this.thumbCompiler.constructSTRB2(a,c,r);break;case 1536:e=this.thumbCompiler.constructLDRSB(a,c,r);break;case 2048:e=this.thumbCompiler.constructLDR2(a,c,r);break;case 2560:e=this.thumbCompiler.constructLDRH2(a,c,r);break;case 3072:e=this.thumbCompiler.constructLDRB2(a,c,r);break;case 3584:e=this.thumbCompiler.constructLDRSH(a,c,r);break}e.writesPC=!1}else if((s&57344)==24576){var a=s&7,c=(s&56)>>3,n=(s&1984)>>4,v=s&4096;v&&(n>>=2);var x=s&2048;x?v?e=this.thumbCompiler.constructLDRB1(a,c,n):e=this.thumbCompiler.constructLDR1(a,c,n):v?e=this.thumbCompiler.constructSTRB1(a,c,n):e=this.thumbCompiler.constructSTR1(a,c,n),e.writesPC=!1}else if((s&62976)==46080){var w=!!(s&256),h=s&255;s&2048?(e=this.thumbCompiler.constructPOP(h,w),e.writesPC=w,e.fixedJump=!1):(e=this.thumbCompiler.constructPUSH(h,w),e.writesPC=!1)}else if(s&32768)switch(s&28672){case 0:var a=s&7,c=(s&56)>>3,n=(s&1984)>>5;s&2048?e=this.thumbCompiler.constructLDRH1(a,c,n):e=this.thumbCompiler.constructSTRH1(a,c,n),e.writesPC=!1;break;case 4096:var a=(s&1792)>>8,n=(s&255)<<2,x=s&2048;x?e=this.thumbCompiler.constructLDR4(a,n):e=this.thumbCompiler.constructSTR3(a,n),e.writesPC=!1;break;case 8192:var a=(s&1792)>>8,n=(s&255)<<2;s&2048?e=this.thumbCompiler.constructADD6(a,n):e=this.thumbCompiler.constructADD5(a,n),e.writesPC=!1;break;case 12288:if(!(s&3840)){var v=s&128,n=(s&127)<<2;v&&(n=-n),e=this.thumbCompiler.constructADD7(n),e.writesPC=!1}break;case 16384:var c=(s&1792)>>8,h=s&255;s&2048?e=this.thumbCompiler.constructLDMIA(c,h):e=this.thumbCompiler.constructSTMIA(c,h),e.writesPC=!1;break;case 20480:var f=(s&3840)>>8,n=s&255;if(f==15)e=this.thumbCompiler.constructSWI(n),e.writesPC=!1;else{s&128&&(n|=4294967040),n<<=1;var l=this.conds[f];e=this.thumbCompiler.constructB1(n,l),e.writesPC=!0,e.fixedJump=!0}break;case 24576:case 28672:var n=s&2047,C=s&6144;switch(C){case 0:n&1024&&(n|=4294965248),n<<=1,e=this.thumbCompiler.constructB2(n),e.writesPC=!0,e.fixedJump=!0;break;case 2048:break;case 4096:n&1024&&(n|=4294966272),n<<=12,e=this.thumbCompiler.constructBL1(n),e.writesPC=!1;break;case 6144:e=this.thumbCompiler.constructBL2(n),e.writesPC=!0,e.fixedJump=!1;break}break;default:throw new y("Undefined instruction: 0x"+s.toString(16))}else throw new y("Bad opcode: 0x"+s.toString(16));else{var a=s&7,r=(s&56)>>3,n=(s&1984)>>6;switch(s&6144){case 0:e=this.thumbCompiler.constructLSL1(a,r,n);break;case 2048:e=this.thumbCompiler.constructLSR1(a,r,n);break;case 4096:e=this.thumbCompiler.constructASR1(a,r,n);break;case 6144:break}e.writesPC=!1}return e.execMode=1,e.fixedJump=e.fixedJump||!1,e};var U=class{constructor(){this.BASE_OFFSET=24;this.OFFSET_MASK=16777215;this.core=new R,this.core.irq=this,this.core.mmu=this,this.resetMemory()}resetMemory(){this.memory=[];for(var e=0;e<256;e++){var i=10,t=524288;this.memory[e]={PAGE_MASK:(2<0?e:1}getPC(){return this.core.gprs[15]-this.core.instructionWidth}getSP(){return this.core.gprs[13]}isStable(){return!0}connectMemoryBus(e){this.bus=e}reset(){this.resetMemory(),this.core.resetCPU(0)}saveState(){return this.core.freeze()}loadState(e){this.core.defrost(e)}load8(e){return this.bus.read(e)<<24>>24}loadU8(e){return this.bus.read(e)&255}load16(e){return this.loadU16(e)<<16>>16}loadU16(e){return this.bus.read(e)|this.bus.read(e+1)<<8}load32(e){var i=this.bus.read(e)|this.bus.read(e+1)<<8|this.bus.read(e+2)<<16|this.bus.read(e+3)<<24;return i}store8(e,i){this.bus.write(e,i&255)}store16(e,i){this.bus.write(e,i&255),this.bus.write(e+1,i>>8&255)}store32(e,i){this.bus.write(e,i&255),this.bus.write(e+1,i>>8&255),this.bus.write(e+2,i>>16&255),this.bus.write(e+3,i>>24&255)}wait(e){++this.core.cycles}wait32(e){++this.core.cycles}waitSeq32(e){++this.core.cycles}waitMul(e){(e&4294967040)==4294967040||!(e&4294967040)?this.core.cycles+=1:(e&4294901760)==4294901760||!(e&4294901760)?this.core.cycles+=2:(e&4278190080)==4278190080||!(e&4278190080)?this.core.cycles+=3:this.core.cycles+=4}waitMulti32(e,i){this.core.cycles+=2}waitPrefetch(e){++this.core.cycles}waitPrefetch32(e){++this.core.cycles}addressToPage(e,i){return i>>this.memory[e].ICACHE_PAGE_BITS}accessPage(e,i){var t=this.memory[e],r=t.icache[i];return(!r||r.invalid)&&(r={thumb:new Array(1<>16)}clear(){}updateTimers(){}testIRQ(){}isThumb(){return this.core.instructionWidth==2}};var Fr=X([[S.A,0,1],[S.B,0,2],[S.GP_A,0,1],[S.GP_B,0,2],[S.SELECT,0,4],[S.START,0,8],[S.RIGHT,0,16],[S.LEFT,0,32],[S.UP,0,64],[S.DOWN,0,128]]),er=0,tr=524288,I=33554432,D=524288,O=67108864,_=256,hr=1e6,sr=4e6,Z=class extends q{constructor(){super();this.cpuFrequency=sr;this.canvasWidth=160;this.numTotalScanlines=256;this.numVisibleScanlines=128;this.cpuCyclesPerLine=Math.floor(sr/(256*60));this.defaultROMSize=512*1024;this.sampleRate=1;this.cpu=new U;this.ram=new Uint8Array(96*1024);this.ram16=new Uint16Array(this.ram.buffer);this.vidbase=0;this.brightness=255;this.read=L([[er,er+tr-1,tr-1,e=>this.rom?this.rom[e]:0],[I,I+D-1,D-1,e=>this.ram[e]],[O,O+_-1,_-1,(e,i)=>this.readIO(e)],[0,(1<<31)-1,0,(e,i)=>{throw new y(`Address read out of bounds: 0x${E(e)}`)}]]);this.write=L([[I,I+D-1,D-1,(e,i)=>{this.ram[e]=i}],[O,O+_-1,_-1,(e,i)=>{this.writeIO(e,i)}]]);this.connectCPUMemoryBus(this),this.handler=z(this.inputs,Fr)}connectVideo(e){super.connectVideo(e),this.pixels32=e,this.pixels8=new Uint8Array(e.buffer)}connectSerialIO(e){this.serial=e}reset(){super.reset(),this.serialOut=[],this.serialIn=[]}readIO(e){switch(e){case 0:return this.inputs[0];case 64:return(this.serial.byteAvailable()?128:0)|(this.serial.clearToSend()?64:0);case 68:let i=this.serialIn.shift();return i!=null?(this.serialOut.push(i),i.value):0;default:return 0}}writeIO(e,i){switch(e){case 0:break;case 72:this.serialOut.length>1&1048575,t=this.brightness<<24,r=0;r>5&31)<<11|(a>>10&31)<<19}}getDebugCategories(){return["CPU","Stack"]}getDebugInfo(e,i){switch(e){case"CPU":var t="",r=i.c;let c={2:"Thumb",4:"ARM"},p={15:"PC",14:"LR",13:"SP",12:"IP",11:"FP",9:"SB"};for(var a=0;a<16;a++)t+=N(p[a]||"",3)+N("r"+a,5)+" "+E(r.gprs[a],8)+` `;return t+="Flags ",t+=r.cpsrN?" N":" -",t+=r.cpsrV?" V":" -",t+=r.cpsrF?" F":" -",t+=r.cpsrZ?" Z":" -",t+=r.cpsrC?" C":" -",t+=r.cpsrI?" I":" -",t+=` `,t+="MODE "+c[r.instructionWidth]+" "+mr[r.mode]+` `,t+="SPSR "+E(r.spsr,8)+` `,t+="cycl "+r.cycles+` `,t}}saveState(){var e=super.saveState();return e.serial={sin:this.serialIn.slice(0),sout:this.serialOut.slice(0)},e}loadState(e){super.loadState(e),this.serialIn=e.serial.sin,this.serialOut=e.serial.sout}},mr={16:"USER",17:"FIQ",18:"IRQ",19:"SUPERVISOR",23:"ABORT",27:"UNDEFINED",31:"SYSTEM"};var fr=[{id:"vidfill.vasm",name:"Video Memory Fill"}];var Wr=512*1024;var Kr=512*1024;var ir=class extends j{getToolForFilename(e){return e.endsWith(".vasm")?"vasmarm":e.endsWith(".armips")?"armips":"vasmarm"}getPresets(){return fr}getDefaultExtension(){return".vasm"}},ar=class extends ir{constructor(){super(...arguments);this.getMemoryMap=function(){return{main:[{name:"ROM",start:0,size:524288,type:"rom"},{name:"RAM",start:33554432,size:524288,type:"ram"},{name:"I/O",start:67108864,size:256,type:"io"}]}}}async start(){super.start(),console.log("Loading Capstone"),await J("./lib/capstone-arm.min.js"),this.capstone_arm=new cs.Capstone(cs.ARCH_ARM,cs.MODE_ARM),this.capstone_thumb=new cs.Capstone(cs.ARCH_ARM,cs.MODE_THUMB)}newMachine(){return new Z}readAddress(e){return this.machine.read(e)}disassemble(e,i){for(var t=this.machine.cpu.isThumb(),r=t?this.capstone_thumb:this.capstone_arm,a=[],c=0;c<4;c++)a[c]=i(e+c);var p=r.disasm(a,e,4),n=p&&p[0];return n?{nbytes:n.size,line:n.mnemonic+" "+n.op_str,isaddr:n.address>0}:{nbytes:4,line:"???",isaddr:!1}}};Y.arm32=ar;export{ir as BaseARMMachinePlatform}; -//# sourceMappingURL=arm32-MPS3F7DU.js.map +//# sourceMappingURL=arm32-4273FZME.js.map diff --git a/gen/arm32-MPS3F7DU.js.map b/gen/arm32-4273FZME.js.map similarity index 100% rename from gen/arm32-MPS3F7DU.js.map rename to gen/arm32-4273FZME.js.map diff --git a/gen/astrocade-HUIFNTYM.js b/gen/astrocade-AWD25MF7.js similarity index 98% rename from gen/astrocade-HUIFNTYM.js rename to gen/astrocade-AWD25MF7.js index 9a2d2f96..3d224181 100644 --- a/gen/astrocade-HUIFNTYM.js +++ b/gen/astrocade-AWD25MF7.js @@ -1,4 +1,4 @@ -import{J as d0,c as t0,d as r0,e as i0,k as s0,q as n0}from"./chunk-ORITJQOD.js";import{$ as S,J as y,V as A,W as F0,Y as A0,_ as Z,g as o,k as $,l as x0,s as e0}from"./chunk-QR47OPYG.js";import"./chunk-5XVCUSSZ.js";var C0=A0([[A.UP,16,1],[A.DOWN,16,2],[A.LEFT,16,4],[A.RIGHT,16,8],[A.A,16,16],[A.P2_UP,17,1],[A.P2_DOWN,17,2],[A.P2_LEFT,17,4],[A.P2_RIGHT,17,8],[A.P2_A,17,16],[A.VK_P,20,1],[A.VK_SLASH,20,2],[A.VK_X,20,4],[A.VK_MINUS,20,8],[A.VK_COMMA,20,16],[A.VK_EQUALS,20,32],[A.VK_O,21,1],[A.VK_L,21,2],[A.VK_9,21,4],[A.VK_6,21,8],[A.VK_3,21,16],[A.VK_PERIOD,21,32],[A.VK_I,22,1],[A.VK_K,22,2],[A.VK_8,22,4],[A.VK_5,22,8],[A.VK_2,22,16],[A.VK_0,22,32],[A.VK_U,23,1],[A.VK_J,23,2],[A.VK_7,23,4],[A.VK_4,23,8],[A.VK_1,23,16],[A.VK_BACK_SLASH,23,32]]),a0=2,m0=function(d){var F,r,B,C,b,O,L,U;let V=d?320:160,N=d?204:102,z=V>>2,h0=256,u0=4293848814,Y0=4278190080;var I=new Uint8Array(32),a=0,m=0,c=!1,l=0,D=0,E=0,Q=0,h=0,u=N,P=new Uint32Array(8),G=new Uint8Array(8),k=0,K=new Uint8Array(d?262:131),b0=!1,g=new Uint8Array(4),X=0,Y=0,j=0;function R(x,e){r[x]=e,j++,K[(x&4095)/z|0]=1}function g0(x,e){for(var s=x*4+3,f=0;f<4;f++){var w=x%z>=(D&63)?0:4;L[s--]=P[w+(e&3)],e>>=2}}function _(x){for(var e=x*V/4,s=0;s>=4);for(var f=0;f<4;f++){var w=e&1?m>>2&3:m&3;s|=w<>=1}e=s,c=!c}if(a&4){if(X&4){var n=2*(~X&3);e=(g[3]>>n&3)<<6|(g[2]>>n&3)<<4|(g[1]>>n&3)<<2|(g[0]>>n&3)<<0}else g[X&3]=e;X++}else{var n=(a&3)<<1,s=e>>n|l;l=e<<8-n&255,e=s}if(a&64&&(e=(e&3)<<6|(e&12)<<2|(e&48)>>2|(e&192)>>6),a&48){var t=r[x],i=0;t&192&&e&192&&(i|=1),t&48&&e&48&&(i|=2),t&12&&e&12&&(i|=4),t&3&&e&3&&(i|=8),a&16&&(e|=t),a&32&&(e^=t),Y=Y&240|i|i<<4}R(x,e)}function W(x,e){G[x&7]=e&255,P[x&7]=J[e&255],H()}function X0(){var x=D>>6}function H(){k=N}this.drawScanline=x=>{x==Q&&E&8&&(F.retryInterrupts=!(E&4),this.probe&&this.probe.logInterrupt(h),F.interrupt(h)),x0?(K[x]=0,_(x),k--):K[x]&&(K[x]=0,_(x))},this.init=(x,e,s,f,w)=>{F=e,r=s,I=f,U=w,O=Z(new $().decode(x0(atob(l0))),8192),d?B={read:S([[16384,32767,16383,function(t){return r[t]}],[53248,57343,4095,function(t){return r[t+16384]}],[0,45055,65535,function(t){return b?b[t]:0}]]),write:S([[16384,32767,16383,R],[53248,57343,4095,function(t,i){R(t+16384,i)}],[0,16383,16383,q]])}:B={read:S([[0,8191,8191,function(t){return O[t]}],[8192,16383,8191,function(t){return b?b[t]:0}],[16384,20479,4095,function(t){return j++,r[t]}]]),write:S([[16384,20479,4095,R],[0,16383,4095,q]])},C={read:function(t){t&=31;var i;switch(t){case 8:i=Y,Y=0;break;default:i=I[t];break}return i},write:function(t,i){switch(t&=31,i&=255,t){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:W(t,i);break;case 9:D=i,X0(),H();break;case 10:u=d?i:i>>1,H();break;case 11:var p=F.saveState();W((p.BC>>8)-1,B.read(p.HL));break;case 12:a=i,l=0,X=0,c=!1;break;case 13:h=i;break;case 14:E=i;break;case 15:Q=d?i:i>>1;break;case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:U.setACRegister(t,i);break;case 24:var p=F.saveState();U.setACRegister((p.BC>>8)-1,B.read(p.HL));break;case 25:m=i;break;default:console.log("IO write",o(t,4),o(i,2));break}}},x.connectCPUMemoryBus(B),x.connectCPUIOBus(C),this.membus=B,this.iobus=C;for(var n=0;n<8;n++)W(n,n)},this.resetWaitStates=function(x){var e=x{F.loadState(x.c),r.set(x.ram),P.set(x.palette),G.set(x.palinds),a=x.magicop,m=x.xpand,c=x.xplower,l=x.shift2,D=x.horcb,E=x.inmod,Q=x.inlin,h=x.infbk,u=x.verbl,X=x.rotcount,g.set(x.rotdata),Y=x.intst,I.set(x.inputs),H()},this.saveState=()=>({c:F.saveState(),ram:r.slice(0),inputs:I.slice(0),palette:P.slice(0),palinds:G.slice(0),magicop:a,xpand:m,xplower:c,shift2:l,horcb:D,inmod:E,inlin:Q,infbk:h,verbl:u,rotcount:X,rotdata:g.slice(0),intst:Y}),this.reset=()=>{a=m=E=Q=h=l=D=0,u=N,c=!1},this.toLongString=x=>{var e="";e+=` +import{J as d0,c as t0,d as r0,e as i0,k as s0,q as n0}from"./chunk-TV4YGKI4.js";import{$ as S,J as y,V as A,W as F0,Y as A0,_ as Z,g as o,k as $,l as x0,s as e0}from"./chunk-Z5CU44VP.js";import"./chunk-5XVCUSSZ.js";var C0=A0([[A.UP,16,1],[A.DOWN,16,2],[A.LEFT,16,4],[A.RIGHT,16,8],[A.A,16,16],[A.P2_UP,17,1],[A.P2_DOWN,17,2],[A.P2_LEFT,17,4],[A.P2_RIGHT,17,8],[A.P2_A,17,16],[A.VK_P,20,1],[A.VK_SLASH,20,2],[A.VK_X,20,4],[A.VK_MINUS,20,8],[A.VK_COMMA,20,16],[A.VK_EQUALS,20,32],[A.VK_O,21,1],[A.VK_L,21,2],[A.VK_9,21,4],[A.VK_6,21,8],[A.VK_3,21,16],[A.VK_PERIOD,21,32],[A.VK_I,22,1],[A.VK_K,22,2],[A.VK_8,22,4],[A.VK_5,22,8],[A.VK_2,22,16],[A.VK_0,22,32],[A.VK_U,23,1],[A.VK_J,23,2],[A.VK_7,23,4],[A.VK_4,23,8],[A.VK_1,23,16],[A.VK_BACK_SLASH,23,32]]),a0=2,m0=function(d){var F,r,B,C,b,O,L,U;let V=d?320:160,N=d?204:102,z=V>>2,h0=256,u0=4293848814,Y0=4278190080;var I=new Uint8Array(32),a=0,m=0,c=!1,l=0,D=0,E=0,Q=0,h=0,u=N,P=new Uint32Array(8),G=new Uint8Array(8),k=0,K=new Uint8Array(d?262:131),b0=!1,g=new Uint8Array(4),X=0,Y=0,j=0;function R(x,e){r[x]=e,j++,K[(x&4095)/z|0]=1}function g0(x,e){for(var s=x*4+3,f=0;f<4;f++){var w=x%z>=(D&63)?0:4;L[s--]=P[w+(e&3)],e>>=2}}function _(x){for(var e=x*V/4,s=0;s>=4);for(var f=0;f<4;f++){var w=e&1?m>>2&3:m&3;s|=w<>=1}e=s,c=!c}if(a&4){if(X&4){var n=2*(~X&3);e=(g[3]>>n&3)<<6|(g[2]>>n&3)<<4|(g[1]>>n&3)<<2|(g[0]>>n&3)<<0}else g[X&3]=e;X++}else{var n=(a&3)<<1,s=e>>n|l;l=e<<8-n&255,e=s}if(a&64&&(e=(e&3)<<6|(e&12)<<2|(e&48)>>2|(e&192)>>6),a&48){var t=r[x],i=0;t&192&&e&192&&(i|=1),t&48&&e&48&&(i|=2),t&12&&e&12&&(i|=4),t&3&&e&3&&(i|=8),a&16&&(e|=t),a&32&&(e^=t),Y=Y&240|i|i<<4}R(x,e)}function W(x,e){G[x&7]=e&255,P[x&7]=J[e&255],H()}function X0(){var x=D>>6}function H(){k=N}this.drawScanline=x=>{x==Q&&E&8&&(F.retryInterrupts=!(E&4),this.probe&&this.probe.logInterrupt(h),F.interrupt(h)),x0?(K[x]=0,_(x),k--):K[x]&&(K[x]=0,_(x))},this.init=(x,e,s,f,w)=>{F=e,r=s,I=f,U=w,O=Z(new $().decode(x0(atob(l0))),8192),d?B={read:S([[16384,32767,16383,function(t){return r[t]}],[53248,57343,4095,function(t){return r[t+16384]}],[0,45055,65535,function(t){return b?b[t]:0}]]),write:S([[16384,32767,16383,R],[53248,57343,4095,function(t,i){R(t+16384,i)}],[0,16383,16383,q]])}:B={read:S([[0,8191,8191,function(t){return O[t]}],[8192,16383,8191,function(t){return b?b[t]:0}],[16384,20479,4095,function(t){return j++,r[t]}]]),write:S([[16384,20479,4095,R],[0,16383,4095,q]])},C={read:function(t){t&=31;var i;switch(t){case 8:i=Y,Y=0;break;default:i=I[t];break}return i},write:function(t,i){switch(t&=31,i&=255,t){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:W(t,i);break;case 9:D=i,X0(),H();break;case 10:u=d?i:i>>1,H();break;case 11:var p=F.saveState();W((p.BC>>8)-1,B.read(p.HL));break;case 12:a=i,l=0,X=0,c=!1;break;case 13:h=i;break;case 14:E=i;break;case 15:Q=d?i:i>>1;break;case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:U.setACRegister(t,i);break;case 24:var p=F.saveState();U.setACRegister((p.BC>>8)-1,B.read(p.HL));break;case 25:m=i;break;default:console.log("IO write",o(t,4),o(i,2));break}}},x.connectCPUMemoryBus(B),x.connectCPUIOBus(C),this.membus=B,this.iobus=C;for(var n=0;n<8;n++)W(n,n)},this.resetWaitStates=function(x){var e=x{F.loadState(x.c),r.set(x.ram),P.set(x.palette),G.set(x.palinds),a=x.magicop,m=x.xpand,c=x.xplower,l=x.shift2,D=x.horcb,E=x.inmod,Q=x.inlin,h=x.infbk,u=x.verbl,X=x.rotcount,g.set(x.rotdata),Y=x.intst,I.set(x.inputs),H()},this.saveState=()=>({c:F.saveState(),ram:r.slice(0),inputs:I.slice(0),palette:P.slice(0),palinds:G.slice(0),magicop:a,xpand:m,xplower:c,shift2:l,horcb:D,inmod:E,inlin:Q,infbk:h,verbl:u,rotcount:X,rotdata:g.slice(0),intst:Y}),this.reset=()=>{a=m=E=Q=h=l=D=0,u=N,c=!1},this.toLongString=x=>{var e="";e+=` INLIN: `+x.inlin,e+=` VERBL: `+x.verbl,e+=` MAGICOP: $`+o(x.magicop),e+=` @@ -11,4 +11,4 @@ XPLOWER: `+x.xplower,e+=` INTST: $`+o(x.intst),e+=` Palette: `;for(var s=0;s<8;s++)e+=o(G[s]);return e+=` `,e},this.connectVideo=function(x){L=x},this.loadROM=function(x){b=x},this.loadBIOS=function(x){O=x},this.getVisiblePixelWords=function(){return u*V}},T=class extends n0{constructor(F){super();this.cpuFrequency=1789e3;this.numTotalScanlines=262;this.sampleRate=60*262*a0;this.cpu=new t0,this.psg=new o0(new r0),this.audioadapter=new s0(this.psg.psg,a0,this.sampleRate),this.handler=F0(this.inputs,C0),this.defaultROMSize=F?45056:8192,this.ram=new Uint8Array(F?20480:4096),this.numVisibleScanlines=F?204:102,this.canvasWidth=F?320:160,this.cpuCyclesPerLine=this.cpuFrequency/(60*this.numVisibleScanlines*1.286)|0,this.m=new m0(F),this.m.init(this,this.cpu,this.ram,this.inputs,this.psg)}read(F){return this.m.membus.read(F)}write(F,r){this.m.membus.write(F,r)}connectVideo(F){super.connectVideo(F),this.frontbuffer=F,this.backbuffer=new Uint32Array(F.length),this.m.connectVideo(this.backbuffer)}preFrame(){this.m.resetWaitStates(0)}postFrame(){var F=this.m.getVisiblePixelWords();this.frontbuffer.set(this.backbuffer.slice(0,F),0),this.frontbuffer.fill(0,F)}setPaddleInput(F,r){switch(F){case 0:this.inputs[28]=r&255;break;case 1:this.inputs[29]=r&255;break}}startScanline(){this.audio&&this.audioadapter.generate(this.audio)}drawScanline(){var F=this.scanline;this.m.drawScanline(F)}advanceCPU(){var F=super.advanceCPU(),r=this.m.resetWaitStates(this.scanline);return r&&(F+=r,this.probe.logClocks(r)),F}loadROM(F){super.loadROM(F),this.m.loadROM(this.rom),this.reset()}loadBIOS(F){this.m.loadBIOS(Z(F,8192)),this.reset()}reset(){super.reset(),this.m.reset()}loadState(F){this.m.loadState(F)}saveState(){return this.m.saveState()}getDebugCategories(){return["CPU","Stack","Astro"]}getDebugInfo(F,r){switch(F){case"Astro":return this.m.toLongString(r)}}},o0=class extends i0{setACRegister(F,r){switch(F&=7,r&=255,F){case 0:this.psg.setClock(1789e3*16/(r+1)),this.psg.writeRegisterAY(7,7^255);break;case 1:case 2:case 3:var B=(F-1)*2,C=r*2+1;this.psg.writeRegisterAY(B,C&255),this.psg.writeRegisterAY(B+1,C>>8&255);break;case 5:this.psg.writeRegisterAY(10,r&15);break;case 6:this.psg.writeRegisterAY(8,r&15),this.psg.writeRegisterAY(9,r>>4&15);break}}};var J=[0,2368548,4737096,7171437,9539985,11974326,14342874,16777215,2425019,4784352,7213567,9582079,12016383,14384895,16753663,16762879,4784304,7143637,9568761,11937279,14306047,16740095,16749311,16758783,6946975,9306307,11731175,14096639,16465151,16736767,16745983,16755199,8847495,11206827,13631696,15994612,16724735,16733951,16743423,16752639,10420330,12779662,15138995,16713687,16723195,16732415,16741631,16751103,11534409,13959277,16318610,16713142,16722394,16731647,16741119,16750335,12255269,14680137,16711790,16713362,16722615,16732123,16741375,16750847,12517376,14876708,16711752,16714605,16724113,16733366,16742874,16752127,12255232,14680064,16711715,16716871,16726380,16735632,16745141,16754393,11534336,13959168,16318464,16720164,16729416,16738924,16748177,16757685,10420224,12779520,15141888,16723971,16733479,16742731,16752240,16761492,8847360,11206656,13639168,16007680,16738058,16747310,16756563,16766071,6946816,9309440,11743488,14112256,16480768,16752151,16761659,16770911,4784128,7151872,9585920,11954688,14323200,16757509,16766761,16776270,2429184,4797696,7232e3,9600512,12034816,14403328,16771870,16777027,9472,2377984,4746496,7180800,9549312,11983616,14352155,16777023,14080,23296,2326528,4695040,7129344,9497856,11927326,14286659,18176,27648,36864,2405376,4774144,7142661,9568041,11927374,21760,30976,40192,246272,2614784,4980503,7405371,9764703,24320,33536,43008,52224,716810,3079982,5504851,7864183,25856,35328,44544,53763,63271,1572683,3932016,6291348,26624,35840,45312,54564,63816,393068,2752401,5177269,26112,35584,44835,54343,63596,65424,2031541,4456409,24832,34084,43592,52845,62353,65462,1834970,4194302,22565,31817,41326,50578,60087,65499,2031615,4456447,19273,28781,38034,47542,56794,393215,2752511,5177343,15466,24718,34227,43479,52987,1569535,3932159,6291455,10887,20395,29648,38900,703743,3072255,5505023,7864319,6047,15299,24807,230655,2599167,4967935,7401983,9764863,688,10197,19449,2388223,4756735,7125503,9559551,11927551,187,5088,2308095,4676607,7110911,9479423,11913727,14282239];for(M=0;M<256;M++)B0=J[M],J[M]=e0(B0)|4278190080;var B0,M;var l0="TFpHAAAgAAAAFHUyA4UHAUpdY2XzIQAgfv5Vyg0AwwAgMc5PzR4JIQUgfiNmb+kAZRrl9cXV3eX95SEAADnlzc4H4f3h3eHRwfHhyUztacnd5d1jEd053X4Gyw8mAN1+BN2OBSdvyxTd4ckBCwjts8kAQ15cJVJTOy83ODkqNDU2LTEyMysmMC49XRtuZR9lH2UeZQjD4ALD4QIgCAgBB2IToAQGAQU+FT9lAfv1xdXl/eUB1U8KPAIB1mWj12Wj2GWi/SHrT/00AP1+ANY8ICL9NgAAIexPNP0h40/9ywD+/SHtXQgWBCHuTzQ61E+3KBL9IepPYw23KAX9NQAYA82VCf3hXUIt7U1dRikOXUIktyhG3csERig5EdVPaSYAGX63KC4+1YFfPk/OAFch1U8GAAl+3YYFErcgF0H1HgHxBBgCyyMQ/P0h+l0CVrP9dwBjNz4MGLTd4cllASEP/+XNhwLxycnB4eXFEQYAGUY+//UzxTNjjV0GcvXdTgTdRgUhDAAJ4+HlXiNWGm8+ApUwCcXFzc4H8cEY6xNL4eVxI3Ld+V0CTl0DQgoAGU4jZmnDqhxdEj1pYGNZXiNW4eVzI3JdBEvWCChdB0ntXQRCXWgkXgTdVmNzGU1E610FM3sCA3oCYx5dB1j1XQge3XX+3XT/3W7+3Wb/TiNG3csGbigi1f3h/SP9IwpvAzMzxf11AF0FCP0j4eVuwcUDYwpjIE4oC/0hBAD9GQoDXSMkBlZjSQVdCQleY0kGXQkJZmNJB10JCXZjSQldCQl+KB79IQpjSV0GdP0hC2MH4eVeXQJxcwBdBKJxI3BdA/DRwcXVxf3h/VYH1TPFzaYD8TPJAaYEeO1H7V77PsjTDz6m0w0+CNMOzeICw+MCGAJjaGlgEQUAGX7TCmMBB2NBCWMBCWNBDl0siXIAXSdNXSOIYx8EXSNI1f3hYwQGY4RpYAEJAAlu/eXBJgDV5cXNqxwhBgA5XQKUIetPTjrrT5Eo+l0olV0k0AcACV5TFXJ7tygHxc0UBV0ivV0olV0kk2tiAQQACU4jRl0ic24K/WYL5f3h610FbNX95cXN1l0HYV0nzztdFjRdJN1jR34H3Xf9HgDdVv3dNf16tyglXSRIVt00/iAD3TT/CmfFe/Uz5TPVM81WAPEzwVx9AgMY0V0jZF0HX/0h70/9RgD9XgH9VgIOAPE+BcsgyxPLEj0g9/1+AKn9dwD9fgGo/XcB/X4Cq/13Av1+A6r9dwP1/U4C/UYDEQAA8cs4yxldGyP9TgD9RgH9XgL9VgNdAlghyxBdBFr1XRovXSVXCQAJTUQKtyAGYyQCGBtfFgAhAADF5dUq8U/lKu9P5c0lHfFlAcF9XWoMY/RdQ3QJ/V4A/VYBXQVAbyYAGV1Cf3QBfl0bKAFpYMVdQgPBbiYAKV0FKgNlAV1xeF0loF0jiAbdd/9rYgEKXSOp3W7/yz0mYwMhCQAZ3cv/RigJeQdlAeYPGAN55g93M11PIGNhTURdAkJeByF4ABYAGV0Dnl1F4GMVfjLUT12EPH79Ic5P/XcAI379dwFpYCNl4SHQXQcJIepPNgDJIdRlol1JSX4E3Xf+3X4F3Xf/3X7+xgxv3X7/zgBn5U4jRuFZUBNzI3IK3Xf9T8s53cv9figbKvtdok9eBgBdIqr9Kv1P/Qn9bgD9ZgEYFQYAaWApCRFeCBlNRCMjXmlgfiNmb2MuRigR5Xv1M91O/t1G/11kvOFdBgWqHF1DcgEDADYDADcDgEYDgIADAIIDgHgEEIsEAO0CCJAH4MgHAKgEVMgEgNcEXqsPXoEDoC8cxvAbxj0Z3oEDZUEmgQOWgQOegQOGZaG8F06bF47mF2MHRmVDqGMoawcAaAsGPw6AyQ6AgQMAY6KYYyUfBRCBAw6BA4AmB4hloeoGwLoGwEMFYzQAfQWWY6JlVOQFQGOBwF0DQ44h8v85+SHOTwYZr3cjdyMQ+SEAAOXNiwTxPsDTCj4p0wldgptKBAD7aAvxIQ4AOfnJKs5PTl0jqTQAIAP9NAFpyV0jpl0FBipjAyECAP05/X4Ad8ljBk5lYSsi0E9pye1L0E8Kxv8Cb11IZ81SCd11/33WgNJRCt1+/zLqTyHUT07LQSgIxWMTwX3TF8tJXQcEFMtRKA4qzk9+0xO3KAU600/TFctZKAxdCoTLYSgNY5oStyAEee4QT8tpXQ0ZcV0FGRFjmUBPy3ldDxkIOtJP5g9HGAIGAMthKAdjRvAYAj4AsNMWw2QL3X7/1ogwH10Csn7/BgDGkE94zv9BDgAmAH2xb3ywZ81SAF0GHiAnT3nWCNJkC10DuVkGAD4Xk18+AJhXYySzb3yyZ2MQAMEMGNpjJubwT9aQKB15/qAoJf6wKDD+wChC/tAoYv7gKHHW8MpXC8NkC2M+/SHUT/11XQVaxmFHxTPNZAkzXQYU0mNUY4LTY0IYZs2LCX23KAxdIqsjRu1Dzk8YUyHOT37GAncjfs4Ad81+CRhCXQJ1D09jT4FjzhgvYwvW4SAo0xU+ANMWYzV+MupPXSYdEv00ARgNYxFjlV1jj11q9SHr/zn53TbwAN0272Vh8l2C2jnddfnddPrdbvndZvrbEHfdfvnGAd139d1++s4A3Xf23W713Wb22xFjkQLdd/ddBRH43W733Wb42xJjkQPdd/NdBRH03W7z3Wb02xN33TbxAGMV3Ybxb2OUZ37dd/vdfvHG5N13/D4Azk/dd/3dbvzdZv3dfvuWKDpjE4fGFd138F0THH7drvvLZygD3TRjGF0MTe/dNPFjLNYEOJAR5E9dBMMBBADtsGPD2xR3XQW+FWMBXQOuFmMBXQOeF3ddg6X8XYOl/d1+/F2Dsf3dd/8OXQK0gV9dA11XGke3KC1dxO0jZQF+I2aBb3xdAnWgErcoFEEEGm+3KAoEZQF9yz8SGPHdcPIMedYEOL3dfvK3KB5KAwKTfgDdlvIoEmMK/XcAZaFdAq828BMYKWNcICNdBRy3KBn9ywB+KAZjFBEYBGWhEl0ipWMVNgBdBcYcXQbGHV0Gxh5dBsYfdw5dBR4GAAlGEd9KAwK6XniTKAl5xhxdIlFw710DkNtdIjpdAuH63Xf/Yx9dBNJdIyv9Id5dBIAzZaHdd+8GB93L734oHnjGCWM59Q5KBALqIRD8XQUhXeJPGGNcJgUY1UoFAv5dHDVj4V0LNd1+8NYSOAUh7E82/91+/MYJT91+/c4AR2MQAmNIB10HCO8CSgsAUyH5XULPXeS+CgAJSgoClF4jVjMzXcbM3Xf70dUab911/X3WwDBG3X795j9dI/P73Zb8IC7h5SNjJ2PwcyNyY1fAKAr+QCgG1oAoCRgWxc03A/EYD8XNRmXBCBMTEzMz1RiwXQuCSggAQ+vFXeKfBxLFzT8O8UoMAz1+BA8PXQRxTgXLOcs53V4GFgBrYikpGSkpKREAQBndXvwWSgcDW34E5gNfIacPYwpG3X78kSAEPgEYAa/dd/23XUJFBV0HFn4vX3ijR10F73gvV3uiX3jdpgezY8p33X79tyAw3V7+3Vb/E91G/AR4kTAH3X4HEhMY9BpPXQNBxqdvPg/OAGdGeaBPeC9jNLESXQPW/z8PA10nZF3CjV0F3wVdImT43XT53W743Wb5fl2CFXH+3XD/3XH83XD93XH63XD73XH13XD2XQca9N138t028wBdRLsRBwAZTgYA4eUJ3X73BgCVeJziGBDugPJVEF0Erl0ir05dZPcRBF0C+W763Wb7SgMCyHiDV3n1M2Mv9TPVM8UzzesO8fHdNPcYlV1ME9ddAqddYtrsXWPa7d1u7N1m7REFABlOI0ZdI3Jjym4mAHuVX3qcV91+7MZKBAC27V2Cxl1FQGMXxeXVzZAc8fHBCd115d105gEAAN1eCF0osgndTgddIsdZXSO08N108d1+B+YDy99P3X4J5jCx3XfkY0HAY4cPR3m3ygQTIQVdonj03XT13X70xgBf3X71zsDdc9rdd9tjHgdjN/XdNtkB8TwYBN3L2SY9IPljYAFdQ631XQKX/WMf5oDdd+djEN13+mMOXaNbYwT4Y4RjKPxdor1dgsr3edbAXUc2791w7t1+5d136t1+5t1369022EoFBR3dftiW0kQTPgjTDD4M0xndftpdAmno3X7bXQJp6d1u6t1m607dNOogA900691u2t1m23HdbujdZulx3X7ntyhF3W703Wb1ft1312N1A10i6mP1891O2t1G2wMDXaXKAt1u8t1m83dj/d1+12MCXQJAY4J+77fKohJdDERdYvvbXWP72sYGX2OEV11EDF2ijRICY1AFXQkcBF0HHF1Cd2PbXQV7A91e2t1W2xMT3W723Wb3Y1JdE37u0xkOAHndltkwT91+5NMMHgB7Y0UjXQSRXWOObvDdZvFwZcQjcCNdJPUcGNfdbtkmACk+KJVfPgBdQlHwg13E1Irdd/EMGKvdNNjDjxF40xndTuXdRuYeXSV4VnuSMCoKVwNdA2ZdBE1yZcQjciM2ACN9xiVjP3xdIkjxHBjLXUS3I25dRShH9V2jWyUQ/F1jAEoFCWEgZQFloVBQY4ZI/EhIZWEgeIBwCPAgAEgQIECQAGCQYKCokGhgYGMhYyNAZQIgQGNxIEAAqHD4cKhjf/hdAkBlAWBjDQAA8F0FVwBgYAAIYz6AAHCIiKiIiHAgYGNwcHCICDBAgPhlwXAIiHAQMFCQ+BAQ+ICAY0ZwiIDwYyL4iBBjo2MDZUFlYXhjFAAAYGUhZQFlwSBAXQJRQCAQAAD4ZSEAYwJdAmNwCAgwIABjMLiokIBjcPiIiIjwZURwiICAgIhwYwNjTPiAgPCAgPhlxIBjFLBdA2RjqXBdA9hwCGUBY02QoMCgkGN1ZQH4iNioY7nIqKiYY+ZloV0CV2O+iKiokGhjRpCQYzFdA8r4XQNFIGOhXQNaiIhQY4ao2GODUGPKZQH4XSMl+HBdI11wAF0C1ggAcBBlAnAgcKhdJKVA+EBlwiAgqHAgACAQ+BBjBmO+Yw0A+GVhZQNAQABAAKCgYwJg8PBgAEDg4EAAkF0iyMCw4NBjPV0kxCAAQF0iv0DgQGMiZaFdJLsAAOBj/ABjFUAA4KCgoODAQEBjPCDggGWBYCBjC+AgY0Ug4GWBoGMMY1egY0JjEeBjMkBjd2AgACBdAqXgZSEAQCBAAGM0AEDwkBDQ8GBjJQDAYyYAYICA4ADAoKDAAODAYwJlgYBjDGMRoGNb4EBAYxsgY0fAwKAAgGNl4OBjUaCgZYNjB6DggGWC8GWBYxvggGBjDEBAXQL3Y77AgACgYysAoEBjKqBjEgDgIF0CTUBAYABAQCAgAGAgXQKPXSIkZQLwgF0E/2M0XQLTYwKA4EoHCbNd459KEwIP3V4G3VYHGkcTeLcgE2MRxgRKBwCPCALDWxd41iAwJCEGAk1E1d1mCt1uCeXdVggeINXFzVoQ8fHx0WMfhd13CBi9eNZkMCNdBxx+CPUzxTNjMOVdDSCVeNaAOJBKBgJzfiNmb+X94V0NL/1dDS3DuhZKEQCPxf3h/V4GaWAjZQFWY0VmBUoFCa3dbgbdZgflxc2SFiEHSgwKFkoHCrxKBAwM1cXNYBfxSgsAyWWhOetdCFp+CRJrYiM2AGOiXeyESgMAM10iT/tdI0/83W773Wb8XeLRfl3ComPGBWOG+l0FBgZjhvhdBQYHY4b35j9dw8v35kDdd/+3KAshDQLddf3ddP4YCSEGXQUDXSOl9N1+/koDBMNjHgQegBgCHgDdc/NjcoBdwo1dBE1KAwuwRt1e9hYAe8b/3Xf9es5lof7dbv3dZv7dy/5+KAJrYsssyx0JXQVSXvZLHXm3KGhj2n7LQygJSgQJZk8YEGWBY88rY+V5tyAKSgMD/AQOEBgESgMFaysZBgAJTnndhvNH1d1m+N1u+uXdfvldIr9dxEtdKMT5hd13+RiSXSM9MDEyMzQ1Njc4OSorLC0uLyBdR6Mh510iT0oLChPoSgYLrOljQU4Ea2JdIuxKBQvSCXnmA7Xdd+dKBg3fXSIKcvRYSgoCewAZ3XXu3XTv3X7nXSJc+3lKBAKp8N1++7coBz4n3ZbwGAPdfvDdd+1jWwhjk+5dYyfvXWInNusA3X7r3Zbp0usbYxnTDN1+7V0igDb2YxDwt8r5Gt1+80oDBkNKAwChNuwA3W7oJgAp3X7sXSJyNv9jH/6V3X7/nOInGu6A8l8bSgQE4X7dd+rdNPcgA900+F0DhFzdfvXdlv7dd/Hdfvbdnv9dIs5+/N2G8V1CSH793Y7yXUND+d1m+t1+6nfdfvFdItpjE/JdItxjDGMk+V0GJPpdCyQYUl0CVIb+Y5b23Y5dCijxXQYo8t1u8d1m8mNo3TT5XQKQXRtM3TTsZUHDChpKAwBK6DBt3XH53Tb6AN1e891W9BNKBAW9Rl0D0iFdA9L5b10D0Ppn3X78hWME/YxnXSSncBgfY1mGY9mO+md93Yb8b3zdjv1dBhkMGJzdfvdKAweP+F1iAk7sXQZlXQJXLl0EV10mMV0Dw10lMV0E1fJdB9U2ABgsXQRkXSYDXQPNXRXfNgBjEsYoXUME/UoEApo068PbGV2LAkoGEKIKSgYQ50oDD+gJGm8TSgMPsgddBwRKAxC2xc09XQ03O0oXBeVKAxBTCUoDBnX9Yzvdfv2V/XcASgMQWF0PDkoHBeLFzfAbXQNZ8cHR1cX1r2+wBhAgBAYIeSnLERcwARkQ98npSgwNON1OCN1GCWlgC3y1KAfdfgYSExjy3W4E3WYFSg4F413IPGPxXWKX/t1dYpT/XQo9E10EhX5KBg9JEhMY5uHlXQvuAWWBfgsHOEDdywgm3csJFt3LCmVhCxZdAl6WCF0CXp4JXQJYngpdAlieCzASYxY+Yx4eYyZlYQgeGAQESBi6XRYoOCRdBRJ3BF0FFXddA6hjGHcGY9vddwddDkxBDXi3IKxdBfVd4xRKCAJvZR9lH2UfZR9lG2UB";var D0=[{id:"01-helloworlds.asm",name:"Hello World (ASM)"},{id:"02-telephone.asm",name:"Telephone (ASM)"},{id:"03-horcbpal.asm",name:"Paddle Demo (ASM)"},{id:"hello.c",name:"Hello Graphics"},{id:"lines.c",name:"Lines"},{id:"sprites.c",name:"Sprites"},{id:"vsync.c",name:"Sprites w/ VSYNC"},{id:"fastsprites.c",name:"Fast Sprites"},{id:"music.c",name:"Music"},{id:"rotate.c",name:"Rotate Op"},{id:"rainbow.c",name:"Rainbow"},{id:"cosmic.c",name:"Cosmic Impalas Game"},{id:"racing.c",name:"Pseudo 3-D Racing Game"}],E0=[{id:"bios.c",name:"BIOS"}],v=class extends d0{constructor(){super(...arguments);this.getMemoryMap=function(){return{main:[{name:"BIOS",start:0,size:8192,type:"rom"},{name:"Screen RAM",start:16384,size:4096,type:"ram"},{name:"BIOS Variables",start:20430,size:20480-20430,type:"ram"}]}}}newMachine(){return new T(!1)}getPresets(){return D0}getDefaultExtension(){return".c"}readAddress(F){return this.machine.read(F)}showHelp(){return"https://8bitworkshop.com/docs/platforms/astrocade/"}},f0=class extends v{getPresets(){return E0}loadROM(F,r){this.machine.loadBIOS(r)}},c0=class extends v{constructor(){super(...arguments);this.getMemoryMap=function(){return{main:[{name:"Magic RAM",start:0,size:16384,type:"ram"},{name:"Screen RAM",start:16384,size:16384,type:"ram"}]}}}newMachine(){return new T(!0)}};y.astrocade=v;y["astrocade-bios"]=f0;y["astrocade-arcade"]=c0; -//# sourceMappingURL=astrocade-HUIFNTYM.js.map +//# sourceMappingURL=astrocade-AWD25MF7.js.map diff --git a/gen/astrocade-HUIFNTYM.js.map b/gen/astrocade-AWD25MF7.js.map similarity index 100% rename from gen/astrocade-HUIFNTYM.js.map rename to gen/astrocade-AWD25MF7.js.map diff --git a/gen/atari7800-2QCJVJGV.js b/gen/atari7800-JGIKGDSP.js similarity index 98% rename from gen/atari7800-2QCJVJGV.js rename to gen/atari7800-JGIKGDSP.js index 4749f9f6..1da5275b 100644 --- a/gen/atari7800-2QCJVJGV.js +++ b/gen/atari7800-JGIKGDSP.js @@ -1,7 +1,7 @@ -import{I as $,h as H,k as z,p as K,t as Y}from"./chunk-ORITJQOD.js";import{$ as T,J as U,U as L,V as o,W as E,Y as N,_ as W,da as F,g as p}from"./chunk-QR47OPYG.js";import"./chunk-5XVCUSSZ.js";var g=0,B=2,C=8,Q=N([[o.A,C+0,128],[o.B,C+1,128],[o.GP_A,C+0,128],[o.GP_B,C+1,128],[o.SELECT,B,-2],[o.START,B,-1],[o.UP,g,-16],[o.DOWN,g,-32],[o.LEFT,g,-64],[o.RIGHT,g,-128],[o.P2_A,C+2,128],[o.P2_B,C+3,128],[o.P2_UP,g,-1],[o.P2_DOWN,g,-2],[o.P2_LEFT,g,-4],[o.P2_RIGHT,g,-8]]);var D=263,j=258-16,v=451,Z=28,tt=16,et=24,V=2,G=D*60*V,R=class{constructor(){this.regs=new Uint8Array(32)}reset(){this.regs.fill(0)}read(t){return this.regs[t]|0}write(t,e){this.regs[t]=e}saveState(){return{regs:this.regs.slice(0)}}loadState(t){for(let e=0;e<32;e++)this.write(e,t.regs[e])}static stateToLongString(t){let e="";return e+=L(t.regs,0,32),e}},_=class{constructor(){this.cycles=0;this.regs=new Uint8Array(32);this.offset=-1;this.dll=0;this.dlstart=0;this.dli=!1;this.h16=!1;this.h8=!1;this.writemode=0;this.indirect=!1;this.pixels=new Uint8Array(320);this.WSYNC=0}reset(){this.regs.fill(0)}read(t){return this.regs[t]|0}write(t,e){this.regs[t]=e,t==4&&this.WSYNC++}saveState(){return{regs:this.regs.slice(0),offset:this.offset,dll:this.dll,dlstart:this.dlstart,dli:this.dli,h16:this.h16,h8:this.h8,indirect:this.indirect,writemode:this.writemode}}loadState(t){for(let e=0;e<32;e++)this.write(e,t.regs[e]|0);this.offset=t.offset|0,this.dll=t.dll|0,this.dlstart=t.dlstart|0,this.dli=!!t.dli,this.h16=!!t.h16,this.h8=!!t.h8,this.indirect=!!t.indirect,this.writemode=t.writemode|0}isDMAEnabled(){return(this.regs[28]&96)==64}getDLLStart(){return(this.regs[12]<<8)+this.regs[16]}getCharBaseAddress(){return(this.regs[20]<<8)+this.offset}setVBLANK(t){t?(this.regs[8]|=128,this.offset=-1,this.dll=this.getDLLStart(),this.dli=this.bus&&(this.bus.read(this.dll)&128)!=0):this.regs[8]&=~128}readDLLEntry(t){if(this.dll>=16384)return;let e=t.read(this.dll);this.offset=e&15,this.h16=(e&64)!=0,this.h8=(e&32)!=0,this.dlstart=(t.read(this.dll+1)<<8)+t.read(this.dll+2),this.dll=this.dll+3&65535,this.dli=(t.read(this.dll)&128)!=0}isHoley(t){return this.indirect?!1:!!(t&32768&&(this.h16&&t&4096||this.h8&&t&2048))}readDMA(t){return this.isHoley(t)?0:(this.cycles+=3,this.bus.read(t))}doDMA(t){this.bus=t,this.cycles=0;let e=this.pixels;if(e.fill(this.regs[0]),this.isDMAEnabled()){this.cycles+=this.offset==0?et:tt,this.offset<0&&this.readDLLEntry(t);let c=this.dlstart&65280,a=this.dlstart&255;do{let u=t.read(c+(a+0&511)),s=t.read(c+(a+1&511));if(s==0||c>=16384)break;let y=t.read(c+(a+2&511)),b=t.read(c+(a+3&511)),d=!1;if((s&31)==0){var i=b>>5,f=32-(b&31),r=t.read(c+(a+4&511));d=(s&32)!=0,a+=5,this.cycles+=10,this.writemode=s&128}else{var r=b,i=s>>5,f=32-(s&31);a+=4,this.cycles+=8}this.indirect=d;let m=u+((y+(d?0:this.offset)&255)<<8);r*=2;let S=this.regs[28],M=(S&3)+(this.writemode?4:0),A=(S&4)!=0,I=d&&(S&16)!=0;I&&(f*=2);for(var x=0;x>1):m+x);if(d){let w=(this.regs[20]+this.offset<<8)+h;I&&x&1&&(w++,this.cycles-=3),h=this.readDMA(w)}switch(M){case 0:for(let n=0;n<4;n++){let l=h>>6&3;(l||A)&&(e[r]=e[r+1]=this.regs[(i<<2)+l]),h<<=2,r=r+2&511}break;case 3:for(let n=0;n<8;n++){let l=(h&128)>>6;(l||A)&&(e[r]=this.regs[(i<<2)+l]),h<<=1,r=r+1&511}break;case 4:for(let n=0;n<2;n++){let l=(h>>6&3)+(h&12);(l&3||A)&&(e[r]=e[r+1]=e[r+2]=e[r+3]=this.regs[((i&4)<<2)+l]),h<<=2,r=r+2&511}break;case 6:for(let n=0;n<4;n++){let l=(h&128)>>6|(h&8)>>3;(l||A)&&(e[r]=this.regs[(i<<2)+l]),h<<=1,r=r+1&511}break;case 2:for(let n=0;n<8;n++){let l=(h&128)>>6;l+=n&1?i&1:i>>1&1,(l||A)&&(e[r]=this.regs[(i<<2)+l]),h<<=1,r=r+1&511}break;case 7:let w=h;for(let n=0;n<4;n++){n==2&&(w<<=2);let l=(h&128)>>6,J=i&4|w>>2&3;(l||A)&&(e[r]=this.regs[(J<<2)+l]),h<<=1,r=r+1&511}break}}}while(this.cycles=16384)return;let e=t.read(this.dll);this.offset=e&15,this.h16=(e&64)!=0,this.h8=(e&32)!=0,this.dlstart=(t.read(this.dll+1)<<8)+t.read(this.dll+2),this.dll=this.dll+3&65535,this.dli=(t.read(this.dll)&128)!=0}isHoley(t){return this.indirect?!1:!!(t&32768&&(this.h16&&t&4096||this.h8&&t&2048))}readDMA(t){return this.isHoley(t)?0:(this.cycles+=3,this.bus.read(t))}doDMA(t){this.bus=t,this.cycles=0;let e=this.pixels;if(e.fill(this.regs[0]),this.isDMAEnabled()){this.cycles+=this.offset==0?et:tt,this.offset<0&&this.readDLLEntry(t);let c=this.dlstart&65280,a=this.dlstart&255;do{let u=t.read(c+(a+0&511)),s=t.read(c+(a+1&511));if(s==0||c>=16384)break;let y=t.read(c+(a+2&511)),b=t.read(c+(a+3&511)),d=!1;if((s&31)==0){var i=b>>5,f=32-(b&31),r=t.read(c+(a+4&511));d=(s&32)!=0,a+=5,this.cycles+=10,this.writemode=s&128}else{var r=b,i=s>>5,f=32-(s&31);a+=4,this.cycles+=8}this.indirect=d;let m=u+((y+(d?0:this.offset)&255)<<8);r*=2;let S=this.regs[28],M=(S&3)+(this.writemode?4:0),A=(S&4)!=0,I=d&&(S&16)!=0;I&&(f*=2);for(var x=0;x>1):m+x);if(d){let w=(this.regs[20]+this.offset<<8)+h;I&&x&1&&(w++,this.cycles-=3),h=this.readDMA(w)}switch(M){case 0:for(let n=0;n<4;n++){let l=h>>6&3;(l||A)&&(e[r]=e[r+1]=this.regs[(i<<2)+l]),h<<=2,r=r+2&511}break;case 3:for(let n=0;n<8;n++){let l=(h&128)>>6;(l||A)&&(e[r]=this.regs[(i<<2)+l]),h<<=1,r=r+1&511}break;case 4:for(let n=0;n<2;n++){let l=(h>>6&3)+(h&12);(l&3||A)&&(e[r]=e[r+1]=e[r+2]=e[r+3]=this.regs[((i&4)<<2)+l]),h<<=2,r=r+2&511}break;case 6:for(let n=0;n<4;n++){let l=(h&128)>>6|(h&8)>>3;(l||A)&&(e[r]=this.regs[(i<<2)+l]),h<<=1,r=r+1&511}break;case 2:for(let n=0;n<8;n++){let l=(h&128)>>6;l+=n&1?i&1:i>>1&1,(l||A)&&(e[r]=this.regs[(i<<2)+l]),h<<=1,r=r+1&511}break;case 7:let w=h;for(let n=0;n<4;n++){n==2&&(w<<=2);let l=(h&128)>>6,J=i&4|w>>2&3;(l||A)&&(e[r]=this.regs[(J<<2)+l]),h<<=1,r=r+1&511}break}}}while(this.cycles(this.xtracyc++,this.readInput(t))],[0,31,31,t=>(this.xtracyc++,this.tia.read(t))],[32,63,31,t=>this.maria.read(t)],[64,255,255,t=>this.ram[t+2048]],[256,319,255,t=>this.read(t)],[320,511,511,t=>this.ram[t+2048]],[640,767,127,t=>(this.xtracyc++,this.readPIA(t))],[6144,10239,65535,t=>this.ram[t-6144]],[10240,16383,2047,t=>this.read(t|8192)],[16384,65535,65535,t=>this.rom?this.rom[t-16384]:0],[0,65535,65535,t=>this.probe&&this.probe.logIllegal(t)]]),this.write=T([[21,26,31,(t,e)=>{this.xtracyc++,this.pokey1.setTIARegister(t,e)}],[0,31,31,(t,e)=>{this.xtracyc++,this.tia.write(t,e)}],[32,63,31,(t,e)=>{this.maria.write(t,e)}],[64,255,255,(t,e)=>{this.ram[t+2048]=e}],[256,319,255,(t,e)=>{this.write(t,e)}],[320,511,511,(t,e)=>{this.ram[t+2048]=e}],[640,767,127,(t,e)=>{this.xtracyc++,this.writePIA(t,e)}],[6144,10239,65535,(t,e)=>{this.ram[t-6144]=e}],[10240,16383,2047,(t,e)=>{this.write(t|8192,e)}],[49151,49151,65535,(t,e)=>{}],[0,65535,65535,(t,e)=>{this.probe&&this.probe.logIllegal(t)}]]),this.connectCPUMemoryBus(this),this.dmaBus=this.probeDMABus(this),this.handler=E(this.inputs,Q),this.pokey1=new H,this.audioadapter=new z(this.pokey1,V,G)}readConst(t){let e=this.probe;this.probe=null;let i=this.read(t);return this.probe=e,i}readInput(t){switch(t){case 12:return~this.inputs[8]&128;case 13:return~this.inputs[9]&128;default:return this.inputs[t]|0}}readPIA(t){switch(t){case 0:case 2:return this.inputs[t];case 1:case 3:return this.regs6532[t];case 4:return this.getPIATimerValue();default:return 0}}writePIA(t,e){switch(t){case 0:case 1:case 2:case 3:this.regs6532[t]=e;return;case 20:this.setPIATimer(e,0);return;case 21:this.setPIATimer(e,3);return;case 22:this.setPIATimer(e,6);return;case 23:this.setPIATimer(e,10);return;case 24:this.setPIATimer(e,6);return}}setPIATimer(t,e){this.piatimer=t+1<0?t>>this.timerinterval:t&255}advanceCPU(){var t=super.advanceCPU();return this.tickPIATimer(t),this.xtracyc&&(t+=this.xtracyc,this.tickClocks(this.xtracyc),this.xtracyc=0),t}tickClocks(t){this.probe.logClocks(t),this.tickPIATimer(t)}tickPIATimer(t){this.piatimer=Math.max(-256,this.piatimer-t)}advanceFrame(t){var e=this.pixels,i=0,f,r=0,x=0,c=0;this.probe.logNewFrame();for(var a=0;a>2),r+=y,e){let m=(this.maria.regs[28]&128)!=0?15:255;for(var s=0;s<320;s++)e[i++]=X[this.maria.pixels[s]&m]}}for((u||a==D-1)&&this.maria.doInterrupt()&&(this.probe.logInterrupt(0),this.cpu.NMI());r>2),r=v;break}if(t&&t()){t=null,a=999;break}r+=this.advanceCPU()<<2,c++}this.audio&&this.audioadapter.generate(this.audio),r-=v,x+=r,this.probe.logNewScanline()}return this.lastFrameCycles=x,c}getRasterX(){return this.lastFrameCycles%v}getRasterY(){return this.scanline}loadROM(t){t.length==49280&&(t=t.slice(128)),this.rom=W(t,this.defaultROMSize,!0)}reset(){super.reset(),this.tia.reset(),this.maria.reset(),this.inputs.fill(0),this.inputs[g]=255,this.inputs[B]=1+2+8,this.setPIATimer(0,0)}readAddress(t){return this.read(t)|0}loadState(t){this.cpu.loadState(t.c),this.ram.set(t.ram),this.tia.loadState(t.tia),this.maria.loadState(t.maria),this.regs6532.set(t.regs6532),this.piatimer=t.pia.timer,this.timerinterval=t.pia.interval,this.loadControlsState(t)}saveState(){return{c:this.cpu.saveState(),ram:this.ram.slice(0),tia:this.tia.saveState(),maria:this.maria.saveState(),regs6532:this.regs6532.slice(0),inputs:this.inputs.slice(0),pia:{timer:this.piatimer,interval:this.timerinterval}}}loadControlsState(t){this.inputs.set(t.inputs)}saveControlsState(){return{inputs:this.inputs.slice(0)}}getDebugCategories(){return["CPU","Stack","TIA","MARIA"]}getDebugInfo(t,e){switch(t){case"TIA":return R.stateToLongString(e.tia);case"MARIA":return _.stateToLongString(e.maria)+` Scanline: `+this.scanline}}getDebugDisplayLists(){let t={},e=this.maria.getDLLStart(),i=0;for(;i<240;){let f=this.readConst(e),r=f&15,x=(f&64)!=0,c=(f&32)!=0,a=(this.readConst(e+1)<<8)+this.readConst(e+2);e=e+3&65535;let u=(this.readConst(e)&128)!=0,s="DL $"+p(a,4)+" "+i+"-"+(i+r);x&&(s+=" H16"),c&&(s+=" H8"),u&&(s+=" DLI"),t[s]={$$:this._readDebugDisplayList(a)},i+=r+1}return t}_readDebugDisplayList(t){return()=>this.readDebugDisplayList(t)}readDebugDisplayList(t){let e=[],i=t&65280,f=t&255;do{let a=this.maria.regs[28],u=this.readConst(i+(f+0&511)),s=this.readConst(i+(f+1&511));if(s==0)break;let y=this.readConst(i+(f+2&511)),b=this.readConst(i+(f+3&511)),d=!1,m="",S,M=(a&3)+(s&128?4:0);if((s&31)==0){var r=b>>5,x=32-(b&31),c=this.readConst(i+(f+4&511));d=(s&32)!=0,S=s&128,f+=5}else{var c=b,r=s>>5,x=32-(s&31);f+=4}m+="X="+c+" W="+x+" P="+r,S&&(m+=" WM=1"),d&&(m+=" CHR=$"+p(this.maria.regs[20]+this.maria.offset&255)+"xx");let A=u+((y+(d?0:this.maria.offset)&255)<<8);m=" $"+p(A,4)+" "+m,m=["160A","?","320D","320A","160B","?","320B","320C"][M]+" "+m,e.push(m)}while(f<512);return e}},X=new Uint32Array(256);for(P=0;P<256;P++)X[P]=F(P);var P;var rt=[{id:"sprites.dasm",name:"Sprites (ASM)"},{id:"wsync.c",name:"WSYNC"},{id:"sprites.c",name:"Double Buffering"},{id:"scroll.c",name:"Scrolling"}],q=class extends ${constructor(){super(...arguments);this.getMemoryMap=function(){return{main:[{name:"TIA",start:0,size:32,type:"io"},{name:"MARIA",start:32,size:32,type:"io"},{name:"RAM (6166 Block 0)",start:64,size:192,type:"ram"},{name:"RAM (6166 Block 1)",start:320,size:192,type:"ram"},{name:"PIA",start:640,size:24,type:"io"},{name:"RAM",start:6144,size:4096,type:"ram"},{name:"Cartridge ROM",start:16384,size:49152,type:"rom"}]}}}newMachine(){return new O}getPresets(){return rt}getDefaultExtension(){return".c"}readAddress(t){return this.machine.readConst(t)}getROMExtension(){return".a78"}getDebugTree(){let t=super.getDebugTree();return t.display_list=this.machine.getDebugDisplayLists(),t}};U.atari7800=q; -//# sourceMappingURL=atari7800-2QCJVJGV.js.map +//# sourceMappingURL=atari7800-JGIKGDSP.js.map diff --git a/gen/atari7800-2QCJVJGV.js.map b/gen/atari7800-JGIKGDSP.js.map similarity index 100% rename from gen/atari7800-2QCJVJGV.js.map rename to gen/atari7800-JGIKGDSP.js.map diff --git a/gen/atari8-EAMKUGUW.js b/gen/atari8-ZLDZZWPC.js similarity index 99% rename from gen/atari8-EAMKUGUW.js rename to gen/atari8-ZLDZZWPC.js index d4a4d944..3b4c4be6 100644 --- a/gen/atari8-EAMKUGUW.js +++ b/gen/atari8-ZLDZZWPC.js @@ -1,4 +1,4 @@ -import{a as xt}from"./chunk-SAEVCPQX.js";import{B as ft,I as dt,g as nt,k as ht,q as ot,t as ct,y as lt}from"./chunk-ORITJQOD.js";import{$ as C,J as I,O as T,U as y,V as i,W as it,Y as rt,a as v,da as at,g as f,q as _}from"./chunk-QR47OPYG.js";import"./chunk-5XVCUSSZ.js";var Ut=[0,25,17,9],Yt=[0,25+64,17+80,9+96],E=0,Bt=1,j=2,z=3,Ht=4,Qt=5,jt=7,zt=9,L=10,Gt=11,Xt=12,qt=13,ut=14,Wt=15,K=15;var Zt=17-4,$t=110-4,Jt=105,G=[0,0,8,10,8,16,8,16,8,4,4,2,1,2,1,1],te=[0,0,2,2,2,2,4,4,8,4,4,4,4,2,2,2],ee=[0,0,0,0,0,1,0,1,0,0,2,1,0,0,0,0],mt=[0,0,1,1,2,2,2,2,8,4,4,2,2,2,2,1],V=class{constructor(t,e){this.regs=new Uint8Array(16);this.dma_enabled=!1;this.dliop=0;this.mode=0;this.jmp=!1;this.lms=!1;this.dlarg_lo=0;this.dlarg_hi=0;this.period=0;this.scanaddr=0;this.startaddr=0;this.pfbyte=0;this.ch=0;this.linesleft=0;this.yofs=0;this.isfirstline=!1;this.v=0;this.h=0;this.linebuf=new Uint8Array(48);this.dmaclock=0;this.dmaidx=0;this.output=0;this.dramrefresh=!1;this.in_vscroll=0;this.read=t,this.nmi=e}reset(){this.regs.fill(0),this.regs[ut]=0,this.regs[K]=127,this.regs[Xt]=0,this.regs[qt]=255,this.setReg(E,0),this.h=this.v=0,this.startaddr=this.scanaddr=0,this.dmaclock=0}saveState(){return _(0,{},this)}loadState(t){_(0,this,t),this.setReg(E,t.regs[E])}static stateToLongString(t){let e="";return e+="H: "+v(t.h,3)+" V: "+v(t.v,3)+` +import{a as xt}from"./chunk-ODZVP52Q.js";import{B as ft,I as dt,g as nt,k as ht,q as ot,t as ct,y as lt}from"./chunk-TV4YGKI4.js";import{$ as C,J as I,O as T,U as y,V as i,W as it,Y as rt,a as v,da as at,g as f,q as _}from"./chunk-Z5CU44VP.js";import"./chunk-5XVCUSSZ.js";var Ut=[0,25,17,9],Yt=[0,25+64,17+80,9+96],E=0,Bt=1,j=2,z=3,Ht=4,Qt=5,jt=7,zt=9,L=10,Gt=11,Xt=12,qt=13,ut=14,Wt=15,K=15;var Zt=17-4,$t=110-4,Jt=105,G=[0,0,8,10,8,16,8,16,8,4,4,2,1,2,1,1],te=[0,0,2,2,2,2,4,4,8,4,4,4,4,2,2,2],ee=[0,0,0,0,0,1,0,1,0,0,2,1,0,0,0,0],mt=[0,0,1,1,2,2,2,2,8,4,4,2,2,2,2,1],V=class{constructor(t,e){this.regs=new Uint8Array(16);this.dma_enabled=!1;this.dliop=0;this.mode=0;this.jmp=!1;this.lms=!1;this.dlarg_lo=0;this.dlarg_hi=0;this.period=0;this.scanaddr=0;this.startaddr=0;this.pfbyte=0;this.ch=0;this.linesleft=0;this.yofs=0;this.isfirstline=!1;this.v=0;this.h=0;this.linebuf=new Uint8Array(48);this.dmaclock=0;this.dmaidx=0;this.output=0;this.dramrefresh=!1;this.in_vscroll=0;this.read=t,this.nmi=e}reset(){this.regs.fill(0),this.regs[ut]=0,this.regs[K]=127,this.regs[Xt]=0,this.regs[qt]=255,this.setReg(E,0),this.h=this.v=0,this.startaddr=this.scanaddr=0,this.dmaclock=0}saveState(){return _(0,{},this)}loadState(t){_(0,this,t),this.setReg(E,t.regs[E])}static stateToLongString(t){let e="";return e+="H: "+v(t.h,3)+" V: "+v(t.v,3)+` `,e+="DLIOp: "+f(t.dliop,2)+" Lines: "+t.yofs+"/"+t.linesleft,e+=" DMA "+(t.dma_enabled?"ON ":"off"),t.dma_enabled&&(e+=" idx "+t.dmaidx+" clk "+f(t.dmaclock)),e+=` `,e+="Addr: "+f(t.scanaddr,4)+` `,e+=y(t.regs,0,16).replace("$00","Regs"),e}setReg(t,e){switch(t){case L:this.regs[L]=255;return;case Wt:this.regs[K]=31;return}this.regs[t]=e}readReg(t){switch(t){case K:return this.regs[t];case Gt:return this.v>>1;default:return 255}}processDLIEntry(){if(this.mode==0)this.linesleft=(this.dliop>>4&7)+1,this.dmaclock=0;else{this.linesleft=G[this.mode],this.period=te[this.mode],this.jmp?(this.regs[j]=this.dlarg_lo,this.regs[z]=this.dlarg_hi,this.mode=this.period=0,this.dliop&64&&(this.linesleft=1,this.dma_enabled=!1),this.dmaclock=0):this.lms&&(this.scanaddr=this.dlarg_lo+(this.dlarg_hi<<8)),this.startaddr=this.scanaddr;let t=this.regs[E]&3,e=this.dliop&16?(this.regs[Ht]&15)>>1:0;this.dliop&16&&t<3&&t++,this.left=Ut[t]+e,this.right=Yt[t]+e;let s=this.regs[Qt]&15;this.dliop&32^this.in_vscroll&&(this.in_vscroll?this.linesleft=s+1:(this.linesleft-=s,this.yofs+=s),this.linesleft&=15,this.in_vscroll^=32)}}nextLine(){this.linesleft>0&&(this.linesleft--,this.yofs++,this.isfirstline=!1,this.mode>=8&&this.linesleft&&(this.scanaddr=this.startaddr))}triggerNMI(t){this.regs[K]=t|31,this.regs[ut]&t&&this.nmi()}getDlistAddr(){return this.regs[j]+(this.regs[z]<<8)}nextInsn(){let t=this.getDlistAddr(),e=this.read(t);return t=t+1&1023|t&~1023,this.regs[j]=t&255,this.regs[z]=t>>8,e}nextScreen(){let t=this.read(this.scanaddr);return this.incScanAddr(),t}incScanAddr(){this.scanaddr=this.scanaddr+1&4095|this.scanaddr&~4095}dlDMAEnabled(){return this.regs[E]&32}isVisibleScanline(){return this.v>=8&&this.v<248}isPlayfieldDMAEnabled(){return this.dma_enabled&&!this.linesleft}isPlayerDMAEnabled(){return this.regs[E]&8}isMissileDMAEnabled(){return this.regs[E]&12}isWSYNC(){return this.regs[L]!=0}clockPulse(){let t=this.isWSYNC();if(!this.isVisibleScanline())this.doVBlank();else{switch(this.h){case 0:this.isMissileDMAEnabled()&&(this.doPlayerMissileDMA(3),t=!0);break;case 1:if(this.isPlayfieldDMAEnabled()){let e=this.nextInsn();this.jmp=(e&~64)==1,this.lms=(e&64)!=0&&(e&15)!=0,this.mode=e&15,this.dliop=e,this.yofs=0,this.isfirstline=!0,t=!0}break;case 2:case 3:case 4:case 5:this.isPlayerDMAEnabled()&&(this.doPlayerMissileDMA(this.h+2),t=!0);break;case 6:case 7:this.isPlayfieldDMAEnabled()&&this.isfirstline&&(this.jmp||this.lms)&&(this.h==6&&(this.dlarg_lo=this.nextInsn()),this.h==7&&(this.dlarg_hi=this.nextInsn()),t=!0);break;case 8:this.isfirstline&&this.processDLIEntry(),this.dliop&128&&this.linesleft==1&&this.triggerNMI(128);break;case 9:break;case 111:this.dma_enabled&&this.nextLine(),++this.v;break}if(this.output=0,this.mode>=2&&this.period){let e=this.h<=Jt;this.dmaclock=this.dmaclock<<1&511,this.dmaclock&1<=8&&this.incScanAddr(),t=e),this.output=this.h>=this.left+3&&this.h<=this.right+2?4:0}}return(this.h$t)&&(this.output=2),this.incHorizCounter(),!t&&this.dramrefresh&&(this.read(0),this.dramrefresh=!1,t=!0),t}incHorizCounter(){switch(this.h){case 25:case 25+4*1:case 25+4*2:case 25+4*3:case 25+4*4:case 25+4*5:case 25+4*6:case 25+4*7:case 25+4*8:this.dramrefresh=!0;break;case 102:this.regs[L]=0;break;case 113:this.h=0;return}++this.h}doVBlank(){this.linesleft=this.mode=this.period=0,this.h==111&&this.v++,this.v==248&&this.h==0&&this.triggerNMI(64),this.v==262&&this.h==112&&(this.v=0),this.v==7&&this.h==113&&(this.dma_enabled=this.dlDMAEnabled()!=0),this.output=2,this.dmaclock=0}doPlayerMissileDMA(t){let e=this.regs[E]&16,s=this.regs[jt]<<8;e?(s&=63488,s|=t<<8,s|=this.v&255):(s&=64512,s|=t<<7,s|=this.v>>1),this.read(s)}readBitmapData(){let t=this.mode;if(t<8){let e=this.ch,s=this.yofs>>ee[this.mode],a=s&7,n=this.regs[zt];(t&14)==6?(e&=63,n&=254):(e&=127,n&=252);let h=(e<<3)+(n<<8);if((t&14)==2){let o=this.regs[Bt],l=t==3&&(e&96)==96;o&4?this.pfbyte=this.read(h+(a^7)):this.pfbyte=this.read(h+a),l&&s<2&&(this.pfbyte=0),!l&&s>7&&(this.pfbyte=0),this.ch&128&&(o&1&&(this.pfbyte=0),o&2&&(this.pfbyte^=255))}else this.pfbyte=this.read(h+a)}else this.pfbyte=this.nextScreen()}shiftout(){if(this.output==4)switch(this.mode){case 2:case 3:case 15:{let t=this.pfbyte>>7&1;return this.pfbyte<<=1,t?8:6}case 6:case 7:{let t=this.pfbyte>>7&1;return this.pfbyte<<=1,t?(this.ch>>6)+4:0}case 9:case 11:case 12:{let t=this.pfbyte>>7&1;return this.pfbyte<<=1,t?4:0}case 4:case 5:{let t=this.pfbyte>>6&3;return this.pfbyte<<=2,this.ch&128?[0,4,5,7][t]:[0,4,5,6][t]}case 8:case 10:case 13:case 14:{let t=this.pfbyte>>6&3;return this.pfbyte<<=2,[0,4,5,6][t]}}return this.output}};var se=0;var ie=8,re=12,gt=13,pt=17,A=18,g=22,ae=23,ne=24,he=25,S=26,w=27,oe=28,bt=29,ce=30,le=31,fe=0,de=4,xe=8,N=12,_t=16,X=31,At=-9,F=[0,1,2,3,7,7,7,7,8,8,8,8,4,5,6,7,0,1,2,3,7,7,7,7,8,8,8,8,4,5,6,7,0,1,6,7,5,5,5,5,8,8,8,8,2,3,4,5,0,1,6,7,5,5,5,5,8,8,8,8,2,3,4,5,4,5,6,7,3,3,3,3,8,8,8,8,0,1,2,3,4,5,6,7,3,3,3,3,8,8,8,8,0,1,2,3,4,5,6,7,3,3,3,3,8,8,8,8,0,1,2,3,4,5,6,7,3,3,3,3,8,8,8,8,0,1,2,3,2,3,4,5,7,7,7,7,8,8,8,8,0,1,6,7,2,3,4,5,7,7,7,7,8,8,8,8,0,1,6,7,2,3,4,5,7,7,7,7,8,8,8,8,0,1,6,7,2,3,4,5,7,7,7,7,8,8,8,8,0,1,6,7,2,3,4,5,7,7,7,7,8,8,8,8,0,1,6,7,2,3,4,5,7,7,7,7,8,8,8,8,0,1,6,7,2,3,4,5,7,7,7,7,8,8,8,8,0,1,6,7,2,3,4,5,7,7,7,7,8,8,8,8,0,1,6,7],ue=[A+0,A+1,A+2,A+3,g+0,g+1,g+2,g+3,S,S,S,S,g+0,g+1,g+2,g+3],U=class{constructor(){this.regs=new Uint8Array(32);this.readregs=new Uint8Array(32);this.shiftregs=new Uint32Array(8);this.count=0;this.an=0;this.rgb=0;this.pmcol=0;this.gtiacol=0;this.gtiacol2=0;this.hbias=At;this.pmDebugMask=-1}reset(){this.regs.fill(0),this.readregs.fill(0),this.readregs[20]=15,this.readregs.fill(15,21),this.count=0}saveState(){return _(0,{},this)}loadState(t){_(0,this,t)}setReg(t,e){switch(t){case A:case A+1:case A+2:case A+3:case g:case g+1:case g+2:case g+3:case S:e&=254;break;case ce:this.readregs.fill(0,0,16);return}this.regs[t]=e}readReg(t){switch(t){case X:return this.readregs[t]&~this.regs[le]}return this.readregs[t]}sync(){this.count=0}setBias(t){this.hbias=At+t}updateGfx(t,e,s){switch(t){case 0:this.regs[bt]&1&&(this.regs[pt]=s);break;case 2:case 3:case 4:case 5:this.regs[bt]&2&&(!(e&1)||!(this.regs[oe]&1<>6){case 0:switch(this.an){case 0:return S;case 4:case 5:case 6:case 7:return g+this.an-4;case 8:return this.regs[ne]&240|this.regs[ae]&15|256}break;case 1:return this.regs[S]&240|this.gtiacol&15|256;case 2:return ue[this.gtiacol];case 3:return this.regs[S]&15|this.gtiacol<<4|256}return 256}anySpriteActive(){return this.shiftregs[0]||this.shiftregs[1]||this.shiftregs[2]||this.shiftregs[3]||this.shiftregs[4]||this.shiftregs[5]||this.shiftregs[6]||this.shiftregs[7]}processPlayerMissile(){if(!this.anySpriteActive()){this.evalTrigger(0),this.evalTrigger(1),this.evalTrigger(2),this.evalTrigger(3),this.evalTrigger(4),this.evalTrigger(5),this.evalTrigger(6),this.evalTrigger(7),this.pmcol=-1;return}if(this.an==2){this.shiftObject(0),this.shiftObject(1),this.shiftObject(2),this.shiftObject(3),this.shiftObject(4),this.shiftObject(5),this.shiftObject(6),this.shiftObject(7),this.pmcol=-1;return}let t=(this.regs[w]&15)<<4,e=F[(this.an&7)+8+t],s=this.an-4,a=-1,n=0;for(let h=0;h<4;h++)if(this.shiftObject(h)){s>=0&&(this.readregs[de+h]|=1<=0&&(this.readregs[fe+h]|=1<=0?this.getObjectColor(a):-1}shiftObject(t){let e=(this.shiftregs[t]&2147483648)!=0;return this.shiftregs[t]<<=1,this.evalTrigger(t),e}getObjectColor(t){return this.regs[w]&16&&t>=4?this.regs[he]:this.regs[A+(t&3)]}evalTrigger(t){this.regs[se+t]+this.hbias==this.count&&this.triggerObject(t)}triggerObject(t){let e,s;if(!!(this.pmDebugMask&1<>a&3,s=(this.regs[pt]>>a&3)<<6}e&1?s=yt(s):s<<=8,e==3?s=yt(s):s<<=16,this.shiftregs[t]|=s}}clockPulse1(){this.processPlayerMissile(),this.clockPulse2(),this.count++}clockPulse2(){var t;if(this.pmcol>=0)t=this.pmcol;else{let e=this.getPlayfieldColor();t=e&256?e&255:this.regs[e]}this.rgb=Et[t],this.gtiacol2=this.gtiacol2<<1|this.an>>3}clockPulse4(){this.gtiacol=this.gtiacol2&15}static stateToLongString(t){let e="";return e+=`X: ${v(t.count,3)} ANTIC: ${f(t.an,1)} PM: ${f(t.pmcol,3)} @@ -7,4 +7,4 @@ import{a as xt}from"./chunk-SAEVCPQX.js";import{B as ft,I as dt,g as nt,k as ht, `,e+=y(t.readregs,0,32),e}};function yt(r){return r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,r|r<<1}var Et=new Uint32Array(256);for(k=0;k<256;k++)Et[k]=at(k);var k;var c=0;var me=2;var St=4;var Ot=6;var p=8,ge=9,pe=10,be=11,_e=13,q=14,R=15;var Ae=8,ye=9,Ee=10,Se=13,P=14,Y=15;var Rt=128,It=64,Oe=32,Tt=16,Pt=8;var Re=1,Dt=28,Ie=114;var Mt=511,vt=131071,u=0,m=1,b=2,d=3,O=114,Te=15;var Pe=8;var W,B;function De(){W=new Uint8Array(511),B=new Uint8Array(16385);let r=511;for(let t=0;t<511;t++)r=(((r>>5^r)&1)<<8)+(r>>1),W[t]=r;r=131071;for(let t=0;t<16385;t++)r=(((r>>5^r)&255)<<9)+(r>>8),B[t]=r>>1}var H=class{constructor(t,e){this.irq=t;this.antic_xpos=e;this.regs=new Uint8Array(16);this.readregs=new Uint8Array(16);this.divnirq=new Uint32Array(4);this.divnmax=new Uint32Array(4);this.pot_inputs=new Uint8Array(8);this.basemult=0;this.pot_scanline=0;this.random_scanline_counter=0;this.kbcode=0;this.DELAYED_SERIN_IRQ=0;this.DELAYED_SEROUT_IRQ=0;this.DELAYED_XMTDONE_IRQ=0;this.init()}saveState(){return _(0,{},this)}loadState(t){_(0,this,t)}init(){this.readregs.fill(255),this.readregs[Y]=239,this.basemult=Dt,this.pot_inputs.fill(128),De()}read(t){let e=this.readregs[t];switch(t&=15,t){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:return e=this.pot_inputs[t],e>3;s&=7,e=(B[a]>>s)+(B[a+1]<<8-s)}}break}return e&255}write(t,e){switch(t&=15,this.regs[t]=e,t){case p:e&Re?this.basemult=Ie:this.basemult=Dt,this.update_counter(1<=3?(this.readregs[P]|=8,this.DELAYED_XMTDONE_IRQ=2*this.DELAYED_SEROUT_IRQ-2):(this.DELAYED_SEROUT_IRQ=0,this.DELAYED_XMTDONE_IRQ=0));break;case ge:this.divnirq[u]=this.divnmax[u],this.divnirq[m]=this.divnmax[m],this.divnirq[b]=this.divnmax[b],this.divnirq[d]=this.divnmax[d];break;case R:e&4&&(this.pot_scanline=228),(e&3)==0&&(this.DELAYED_SERIN_IRQ=0,this.DELAYED_SEROUT_IRQ=0,this.DELAYED_XMTDONE_IRQ=0);break}this.snd_update(t)}update_counter(t){t&1<0&&--this.DELAYED_SERIN_IRQ==0&&(this.readregs[Se]=this.SIO_GetByte(),this.generateIRQ(32)),this.DELAYED_SEROUT_IRQ>0&&--this.DELAYED_SEROUT_IRQ==0&&this.generateIRQ(16),this.DELAYED_XMTDONE_IRQ>0&&--this.DELAYED_XMTDONE_IRQ==0&&this.generateIRQ(8),this.advanceIRQTimer(u,1),this.advanceIRQTimer(m,2),this.advanceIRQTimer(d,4))}advanceIRQTimer(t,e){(this.divnirq[t]-=O)<0&&(this.divnirq[t]+=this.divnmax[t],this.generateIRQ(e))}generateIRQ(t){this.regs[q]&t&&(this.irq(),this.readregs[P]&=~t)}static stateToLongString(t){let e="";return e+=`Write Registers: `,e+=y(t.regs,0,16),e+=`Read Registers: `,e+=y(t.readregs,0,16),e}CASSETTE_IOLineStatus(){return 0}siocheck(){return((this.regs[c+b]==40||this.regs[c+b]==16||this.regs[c+b]==8||this.regs[c+b]==10)&&this.regs[c+d]==0||(this.regs[R]&120)==40)&&(this.regs[p]&40)==40}SIO_PutByte(t){console.log("SIO put byte",t)}SIO_GetByte(){return 0}};var Me=[i.VK_L,i.VK_J,i.VK_SEMICOLON,i.VK_F4,i.VK_F5,i.VK_K,i.VK_BACK_SLASH,i.VK_TILDE,i.VK_O,null,i.VK_P,i.VK_U,i.VK_ENTER,i.VK_I,i.VK_MINUS2,i.VK_EQUALS2,i.VK_V,i.VK_F7,i.VK_C,i.VK_F6,i.VK_F4,i.VK_B,i.VK_X,i.VK_Z,i.VK_4,null,i.VK_3,i.VK_6,i.VK_ESCAPE,i.VK_5,i.VK_2,i.VK_1,i.VK_COMMA,i.VK_SPACE,i.VK_PERIOD,i.VK_N,null,i.VK_M,i.VK_SLASH,null,i.VK_R,null,i.VK_E,i.VK_Y,i.VK_TAB,i.VK_T,i.VK_W,i.VK_Q,i.VK_9,null,i.VK_0,i.VK_7,i.VK_BACK_SPACE,i.VK_8,null,null,i.VK_F,i.VK_H,i.VK_D,null,i.VK_CAPS_LOCK,i.VK_G,i.VK_S,i.VK_A],ve=rt([[i.UP,0,1],[i.DOWN,0,2],[i.LEFT,0,4],[i.RIGHT,0,8],[{c:16,n:"Shift",plyr:0,button:0},2,1],[i.VK_F1,3,1],[i.VK_F2,3,2],[i.VK_F3,3,4]]),Q=class extends ot{constructor(){super();this.cpuFrequency=1789773;this.numTotalScanlines=262;this.cpuCyclesPerLine=114;this.canvasWidth=336;this.numVisibleScanlines=224;this.aspectRatio=this.canvasWidth/this.numVisibleScanlines*.857;this.firstVisibleScanline=16;this.firstVisibleClock=(44-6)*2;this.defaultROMSize=32768;this.overscan=!0;this.audioOversample=2;this.sampleRate=this.numTotalScanlines*60*this.audioOversample;this.run_address=-1;this.inputs=new Uint8Array(4);this.linergb=new Uint32Array(this.canvasWidth);this.lastdmabyte=0;this.keycode=0;this.cart_80=!1;this.cart_a0=!1;this.xexdata=null;this.keyboard_active=!0;this.d500=new Uint8Array(256);this.cpu=new ct,this.ram=new Uint8Array(65536),this.bios=new Uint8Array(10240),this.bus=this.newBus(),this.connectCPUMemoryBus(this.bus),this.antic=new V(this.readDMA.bind(this),this.antic_nmi.bind(this)),this.gtia=new U,this.irq_pokey=new H(this.pokey_irq.bind(this),()=>this.antic.h),this.audio_pokey=nt(1),this.audioadapter=new ht(this.audio_pokey.pokey1,this.audioOversample,this.sampleRate),this.handler=it(this.inputs,ve,this.getKeyboardFunction(),!0)}newBus(){return{read:C([[0,32767,65535,t=>this.ram[t]],[32768,40959,65535,t=>this.cart_80?this.rom[t-32768]:this.ram[t]],[40960,49151,65535,t=>this.cart_a0?this.rom[t-32768]:this.ram[t]],[53248,53503,31,t=>this.gtia.readReg(t)],[53760,54015,15,t=>this.readPokey(t)],[54016,54271,15,t=>this.readPIA(t)],[54272,54527,15,t=>this.antic.readReg(t)],[54528,54783,255,t=>this.d500[t]],[55296,65535,65535,t=>this.bios[t-55296]]]),write:C([[0,49146,65535,(t,e)=>{this.ram[t]=e}],[49147,49151,65535,(t,e)=>{this.ram[t]=e,this.initCartA()}],[53248,53503,31,(t,e)=>{this.gtia.setReg(t,e)}],[53760,54015,15,(t,e)=>{this.writePokey(t,e)}],[54272,54527,15,(t,e)=>{this.antic.setReg(t,e)}],[54528,54783,255,(t,e)=>{this.writeMapper(t,e)}]])}}loadBIOS(t){this.bios.set(t)}reset(){super.reset(),this.antic.reset(),this.gtia.reset(),this.keycode=0}read(t){return this.bus.read(t)}readDMA(t){let e=this.bus.read(t);return this.probe.logDMARead(t,e),this.lastdmabyte=e,e}readConst(t){return t<53248||t>=54528?this.bus.read(t):255}write(t,e){this.bus.write(t,e)}readPokey(t){switch(t&15){case 9:return this.keycode&255;case 15:return~this.keycode>>6&4|~this.keycode>>3&8|18;default:return this.irq_pokey.read(t)}}readPIA(t){if(t==0||t==1)return~this.inputs[t]}writePokey(t,e){this.audio_pokey.pokey1.setRegister(t,e),this.irq_pokey.write(t,e)}startScanline(){this.gtia.sync();for(let t=0;t<4;t++)this.gtia.readregs[_t+t]=~this.inputs[2]>>t&1;this.gtia.readregs[X]=~this.inputs[3]&7,this.audio&&this.audioadapter.generate(this.audio),this.irq_pokey.advanceScanline()}drawScanline(){let t=this.antic.v-this.firstVisibleScanline;t>=0&&t{this.gtia.clockPulse1(),this.linergb[t++]=this.gtia.rgb},s=()=>{this.gtia.clockPulse2(),this.linergb[t++]=this.gtia.rgb};this.gtia.clockPulse4(),this.antic.dliop&16&&this.antic.regs[4]&1?(t+=2,this.gtia.setBias(-1)):this.gtia.setBias(0);let a=mt[this.antic.mode],n=this.antic.h&1;return(a<8||n)&&(this.gtia.an=this.antic.shiftout()),e(),a==1&&(this.gtia.an=this.antic.shiftout()),s(),a<=2&&(this.gtia.an=this.antic.shiftout()),e(),a==1&&(this.gtia.an=this.antic.shiftout()),s(),1}loadState(t){this.loadControlsState(t),this.cpu.loadState(t.c),this.ram.set(t.ram),this.antic.loadState(t.antic),this.gtia.loadState(t.gtia),this.irq_pokey.loadState(t.pokey),this.lastdmabyte=t.lastdmabyte,this.cart_80=t.cart_80,this.cart_a0=t.cart_a0}saveState(){return{c:this.cpu.saveState(),ram:this.ram.slice(0),antic:this.antic.saveState(),gtia:this.gtia.saveState(),pokey:this.irq_pokey.saveState(),inputs:this.inputs.slice(0),lastdmabyte:this.lastdmabyte,keycode:this.keycode,cart_80:this.cart_80,cart_a0:this.cart_a0}}loadControlsState(t){this.inputs.set(t.inputs),this.keycode=t.keycode}saveControlsState(){return{inputs:this.inputs.slice(0),keycode:this.keycode}}getRasterScanline(){return this.antic.v}getRasterLineClock(){return this.antic.h}getDebugCategories(){return["CPU","Stack","ANTIC","GTIA","POKEY"]}getDebugInfo(t,e){switch(t){case"ANTIC":return V.stateToLongString(e.antic);case"GTIA":return U.stateToLongString(e.gtia);case"POKEY":return H.stateToLongString(e.pokey)}}getKeyboardFunction(){return(t,e,s,a)=>{if(!this.keyboard_active)return!1;if(a&(T.KeyDown|T.KeyUp)){var n=Me;if(e==i.VK_F9.c)return this.irq_pokey.generateIRQ(128),!0;for(var h=0;h>8}if(e>t.length)throw new Error("Bad .XEX file format")}n>=0&&(s[a++]=169,s[a++]=160,s[a++]=141,s[a++]=255,s[a++]=213,s[a++]=76,s[a++]=n&255,s[a++]=n>>8,this.ram[10]=0,this.ram[11]=213,this.run_address=54528)}initCartA(){this.cpu.getPC()==61823&&this.xexdata&&this.loadXEX(this.xexdata)}setPaddleInput(t,e){this.irq_pokey.pot_inputs[t]=255-e}getDebugDisplayList(){let t=this.antic.getDlistAddr(),e=()=>{let n=this.read(t);return t=t+1&1023|t&~1023,n},s=[],a=0;for(let n=0;n<256&&a<240;n++){let h=t,o=e(),l=o&15,x="",D=!1,M;if(l==0)M=(o>>4&7)+1,x+=" blank="+M;else{M=G[l],x+=" mode="+f(l),x+=" lines="+M,D=(o&~64)==1;let st=(o&64)!=0&&(o&15)!=0;if(o&16&&(x+=" HSCROL"),o&32&&(x+=" VSCROL"),o&128&&(x+=" DLI"),D&&o&64?x+=" JVB":D?x+=" JMP":st&&(x+=" LMS"),D||st){let Nt=e(),Ft=e();x+=" $"+f(Ft)+""+f(Nt)}}if(s.push("$"+f(h)+" y="+a+" "+x),D)break;a+=M}return s}},Z=class extends Q{newBus(){return{read:C([[0,16383,65535,t=>this.ram[t]],[16384,49151,65535,t=>this.rom?this.rom[t-16384]:0],[49152,53247,31,t=>this.gtia.readReg(t)],[54272,54527,15,t=>this.antic.readReg(t)],[59392,61439,15,t=>this.readPokey(t)],[63488,65535,2047,t=>this.bios[t]]]),write:C([[0,16383,65535,(t,e)=>{this.ram[t]=e}],[49152,53247,31,(t,e)=>{this.gtia.setReg(t,e)}],[54272,54527,15,(t,e)=>{this.antic.setReg(t,e)}],[59392,61439,15,(t,e)=>{this.writePokey(t,e)}]])}}};var $=[{id:"hello.dasm",name:"Hello World (ASM)"},{id:"hellopm.dasm",name:"Hello Sprites (ASM)"},{id:"helloconio.c",name:"Text Mode (C)"},{id:"siegegame.c",name:"Siege Game (C)"},{id:"hellodlist.c",name:"Display List (C)"}],Ct=$.concat([{id:"testmusic.c",name:"POKEY Music (C)"},{id:"sieve.bas",name:"Benchmark (FastBasic)"},{id:"pmtest.bas",name:"Sprites Test (FastBasic)"},{id:"dli.bas",name:"DLI Test (FastBasic)"},{id:"joyas.bas",name:"Match-3 Game (FastBasic)"}]),kt={main:[{name:"RAM",start:0,size:49152,type:"ram"},{name:"Left Cartridge ROM",start:40960,size:8192,type:"rom"},{name:"GTIA",start:53248,size:32,type:"io"},{name:"POKEY",start:53760,size:16,type:"io"},{name:"PIA",start:54016,size:4,type:"io"},{name:"ANTIC",start:54272,size:16,type:"io"},{name:"Cartridge Control Line",start:54784,size:256,type:"io"},{name:"ROM",start:55296,size:2048,type:"rom"},{name:"Character Set",start:57344,size:1024,type:"rom"},{name:"ROM",start:58368,size:7168,type:"rom"}]};function Lt(r){return r.endsWith(".bas")||r.endsWith(".fb")||r.endsWith(".fbi")?"fastbasic":lt(r)}var J=class extends dt{constructor(){super(...arguments);this.getToolForFilename=Lt;this.showHelp=wt;this.getROMExtension=Ce;this.biosPath="res/altirra/kernel.rom"}newMachine(){return new Q}getPresets(){return Ct}getDefaultExtension(){return".c"}readAddress(t){return this.machine.readConst(t)}getMemoryMap(){return kt}async start(){let t=await this.loadKernel();await super.start(),this.machine.loadBIOS(t)}async loadKernel(){var t=await fetch(this.biosPath);if(t.status==200||t.size){var e=await t.arrayBuffer();return new Uint8Array(e)}else throw new Error("could not load BIOS file")}getDebugTree(){let t=super.getDebugTree();return t.display_list=this.machine.getDebugDisplayList(),t}},Kt=class extends J{constructor(){super(...arguments);this.biosPath="res/altirra/superkernel.rom"}getPresets(){return $}newMachine(){return new Z}},tt=class extends xt{constructor(){super(...arguments);this.getToolForFilename=Lt;this.getOpcodeMetadata=ft;this.showHelp=wt}getPresets(){return $}getDefaultExtension(){return".asm"}},et=class extends tt{constructor(){super(...arguments);this.getMemoryMap=function(){return kt}}getPresets(){return Ct}loadROM(t,e){this.started?(this.loadROMFile(e),this.loadRegion(":cartleft:cart:rom",e)):this.startModule(this.mainElement,{jsfile:"mame8bitws.js",biosfile:"a800xl.zip",cfgfile:"a800xl.cfg",driver:"a800xl",width:336*2,height:225*2,romfn:"/emulator/cart.rom",romdata:new Uint8Array(e),romsize:8192,preInit:function(s){}})}start(){}},Vt=class extends tt{constructor(){super(...arguments);this.getMemoryMap=function(){return{main:[{name:"RAM",start:0,size:16384,type:"ram"},{name:"Cartridge ROM",start:16384,size:32768,type:"rom"},{name:"GTIA",start:49152,size:32,type:"io"},{name:"ANTIC",start:54272,size:16,type:"io"},{name:"POKEY",start:59392,size:16,type:"io"},{name:"ATARI Character Set",start:63488,size:1024,type:"rom"},{name:"ROM",start:64512,size:1024,type:"rom"}]}}}loadROM(t,e){this.started?(this.loadROMFile(e),this.loadRegion(":cartleft:cart:rom",e)):this.startModule(this.mainElement,{jsfile:"mame8bitws.js",biosfile:"a5200/5200.rom",cfgfile:"a5200.cfg",driver:"a5200",width:336*2,height:225*2,romfn:"/emulator/cart.rom",romdata:new Uint8Array(e),romsize:32768,preInit:function(s){}})}start(){}};function Ce(r){return r==null?".bin":r[0]==255&&r[1]==255?".xex":".rom"}function wt(){return"https://8bitworkshop.com/docs/platforms/atari8/"}I["atari8-800.xlmame"]=et;I["atari8-800xl.mame"]=et;I["atari8-5200.mame"]=Vt;I["atari8-800"]=J;I["atari8-5200"]=Kt; -//# sourceMappingURL=atari8-EAMKUGUW.js.map +//# sourceMappingURL=atari8-ZLDZZWPC.js.map diff --git a/gen/atari8-EAMKUGUW.js.map b/gen/atari8-ZLDZZWPC.js.map similarity index 100% rename from gen/atari8-EAMKUGUW.js.map rename to gen/atari8-ZLDZZWPC.js.map diff --git a/gen/basic-TGRXB2BN.js b/gen/basic-VJABD6JG.js similarity index 98% rename from gen/basic-TGRXB2BN.js rename to gen/basic-VJABD6JG.js index aa21d42f..24d0792b 100644 --- a/gen/basic-TGRXB2BN.js +++ b/gen/basic-VJABD6JG.js @@ -1,4 +1,4 @@ -import{b as v}from"./chunk-3XE5YOCV.js";import{a as d,o as S}from"./chunk-NPUJICKW.js";import"./chunk-SXEVG2WS.js";import"./chunk-5SHCNQ2O.js";import"./chunk-LA7REXDT.js";import"./chunk-ORITJQOD.js";import{A as c,J as b,S as g,T as f,a as p}from"./chunk-QR47OPYG.js";import"./chunk-5XVCUSSZ.js";function O(o){return o.value!=null}function E(o){return o.name!=null}function N(o){return o.op!=null&&o.left!=null&&o.right!=null}function I(o){return o.op!=null&&o.expr!=null}var y=class{randomize(){this.seed(Math.random()*2147483647,Math.random()*2147483647,Math.random()*2147483647,Math.random()*2147483647)}constructor(){(()=>{var r,e,i,n;this.seed=function(s,a,u,h){r=s,e=a,i=u,n=h},this.seedfloat=function(s){this.seed(s,s*4294,s*429496,s*4294967296),this.next(),this.next(),this.next()},this.next=function(){r>>>=0,e>>>=0,i>>>=0,n>>>=0;var s=r+e|0;return r=e^e>>>9,e=i+(i<<3)|0,i=i<<21|i>>>11,n=n+1|0,s=s+n|0,i=i+s|0,(s>>>0)/4294967296}})(),this.seedfloat(-1)}},L=1024*1024,l=class{constructor(){this.margin=80;this.running=!1;this.exited=!0;this.trace=!1}load(t){let r=null,e=0;if(this.pc2label!=null){let s=this.curpc;for(;s>0&&(r=this.pc2label.get(s))==null;)s--;e=this.curpc-s,console.log("oldpc=",this.curpc,"restart @ label",r,"+",e)}this.program=t,this.opts=t.opts,this.opts.maxArrayElements||(this.opts.maxArrayElements=L),this.allstmts=t.stmts,this.label2pc=t.labels,this.label2dataptr={},this.pc2label=new Map,this.datums=[],this.subroutines={},this.builtins=this.getBuiltinFunctions();for(var i in t.labels){var n=t.labels[i];this.pc2label.set(n,i)}return this.allstmts.forEach((s,a)=>{this.curpc=a+1,this.compileStatement(s),s.command=="DATA"&&(this.label2dataptr[s.$loc.label]=this.datums.length,s.datums.forEach(u=>{this.curpc=s.$loc.offset,this.datums.push(u)}))}),this.label2pc[r]!=null?(this.curpc=this.label2pc[r]+e,!0):(this.curpc=0,!1)}reset(){this.curpc=0,this.dataptr=0,this.clearVars(),this.returnStack=[],this.column=0,this.running=!0,this.exited=!1}clearVars(){this.globals=this.vars={},this.arrays={},this.defs={},this.forLoops={},this.forLoopStack=[],this.whileLoops=[],this.rng=new y,this.opts&&this.opts.staticArrays&&this.allstmts.filter(t=>t.command=="DIM").forEach(t=>{t.args.forEach(r=>this.compileJS(this._DIM(r))())})}saveState(){return $.extend(!0,{},this)}loadState(t){$.extend(!0,this,t)}getBuiltinFunctions(){var t=this.program&&this.opts.validFunctions;t||(t=Object.getOwnPropertyNames(l.prototype).filter(i=>/^[A-Z]{3,}[$]?$/.test(i)));var r={};for(var e of t)this.supportsFunction(e)&&(r[e]=this[e].bind(this));return r}supportsFunction(t){return typeof this[t]=="function"}runtimeError(t){throw this.curpc--,new g(t,this.getCurrentSourceLocation())}dialectError(t){this.runtimeError(`I can't ${t} in this dialect of BASIC.`)}getLineForPC(t){var r=this.allstmts[t];return r&&r.$loc&&r.$loc.line}getLabelForPC(t){var r=this.allstmts[t];return r&&r.$loc&&r.$loc.label}getCurrentSourceLocation(){var t=this.getStatement();return t&&t.$loc}getCurrentLabel(){var t=this.getCurrentSourceLocation();return t&&t.label}getStatement(){return this.allstmts[this.curpc]}step(){if(!this.running)return!1;var t=this.getStatement();return t?(this.trace&&console.log(this.curpc,t,this.vars,Object.keys(this.arrays)),this.curpc++,this.executeStatement(t),this.running):(this.running=!1,this.exited=!0,!1)}compileStatement(t){if(t.$run==null)try{var r=this["do__"+t.command];r==null&&this.runtimeError(`I don't know how to "${t.command}".`);var e=r.bind(this)(t);this.trace&&console.log(e),t.$run=this.compileJS(e)}catch(i){throw e&&console.log(e),i}}compileJS(t){return new Function(t).bind(this)}executeStatement(t){this.compileStatement(t),t.$run()}skipToEOL(){do this.curpc++;while(this.curpc=0?this.curpc=r:this.runtimeError(`I tried to go to the label "${t}" but couldn't find it.`)}newLocalScope(){this.vars=Object.create(this.vars)}popLocalScope(){this.vars!==this.globals&&(this.vars=Object.getPrototypeOf(this.vars))}gosubLabel(t){this.returnStack.length>32767&&this.runtimeError("I did too many GOSUBs without a RETURN."),this.returnStack.push(this.curpc),this.gotoLabel(t)}returnFromGosub(){this.returnStack.length==0&&this.runtimeError("I tried to RETURN, but there wasn't a corresponding GOSUB.");var t=this.returnStack.pop();this.curpc=t,this.popLocalScope()}popReturnStack(){this.returnStack.length==0&&this.runtimeError("I tried to POP, but there wasn't a corresponding GOSUB."),this.returnStack.pop()}valueToString(t,r){var e;if(typeof t=="number"){var i=this.float2str(t,this.opts.printZoneLength-4);return r?i.startsWith("-")?`${i} `:` ${i} `:i}else if(t==` +import{b as v}from"./chunk-3XE5YOCV.js";import{a as d,o as S}from"./chunk-6LSEFRMB.js";import"./chunk-SXEVG2WS.js";import"./chunk-5SHCNQ2O.js";import"./chunk-QHCN4ZOY.js";import"./chunk-TV4YGKI4.js";import{A as c,J as b,S as g,T as f,a as p}from"./chunk-Z5CU44VP.js";import"./chunk-5XVCUSSZ.js";function O(o){return o.value!=null}function E(o){return o.name!=null}function N(o){return o.op!=null&&o.left!=null&&o.right!=null}function I(o){return o.op!=null&&o.expr!=null}var y=class{randomize(){this.seed(Math.random()*2147483647,Math.random()*2147483647,Math.random()*2147483647,Math.random()*2147483647)}constructor(){(()=>{var r,e,i,n;this.seed=function(s,a,u,h){r=s,e=a,i=u,n=h},this.seedfloat=function(s){this.seed(s,s*4294,s*429496,s*4294967296),this.next(),this.next(),this.next()},this.next=function(){r>>>=0,e>>>=0,i>>>=0,n>>>=0;var s=r+e|0;return r=e^e>>>9,e=i+(i<<3)|0,i=i<<21|i>>>11,n=n+1|0,s=s+n|0,i=i+s|0,(s>>>0)/4294967296}})(),this.seedfloat(-1)}},L=1024*1024,l=class{constructor(){this.margin=80;this.running=!1;this.exited=!0;this.trace=!1}load(t){let r=null,e=0;if(this.pc2label!=null){let s=this.curpc;for(;s>0&&(r=this.pc2label.get(s))==null;)s--;e=this.curpc-s,console.log("oldpc=",this.curpc,"restart @ label",r,"+",e)}this.program=t,this.opts=t.opts,this.opts.maxArrayElements||(this.opts.maxArrayElements=L),this.allstmts=t.stmts,this.label2pc=t.labels,this.label2dataptr={},this.pc2label=new Map,this.datums=[],this.subroutines={},this.builtins=this.getBuiltinFunctions();for(var i in t.labels){var n=t.labels[i];this.pc2label.set(n,i)}return this.allstmts.forEach((s,a)=>{this.curpc=a+1,this.compileStatement(s),s.command=="DATA"&&(this.label2dataptr[s.$loc.label]=this.datums.length,s.datums.forEach(u=>{this.curpc=s.$loc.offset,this.datums.push(u)}))}),this.label2pc[r]!=null?(this.curpc=this.label2pc[r]+e,!0):(this.curpc=0,!1)}reset(){this.curpc=0,this.dataptr=0,this.clearVars(),this.returnStack=[],this.column=0,this.running=!0,this.exited=!1}clearVars(){this.globals=this.vars={},this.arrays={},this.defs={},this.forLoops={},this.forLoopStack=[],this.whileLoops=[],this.rng=new y,this.opts&&this.opts.staticArrays&&this.allstmts.filter(t=>t.command=="DIM").forEach(t=>{t.args.forEach(r=>this.compileJS(this._DIM(r))())})}saveState(){return $.extend(!0,{},this)}loadState(t){$.extend(!0,this,t)}getBuiltinFunctions(){var t=this.program&&this.opts.validFunctions;t||(t=Object.getOwnPropertyNames(l.prototype).filter(i=>/^[A-Z]{3,}[$]?$/.test(i)));var r={};for(var e of t)this.supportsFunction(e)&&(r[e]=this[e].bind(this));return r}supportsFunction(t){return typeof this[t]=="function"}runtimeError(t){throw this.curpc--,new g(t,this.getCurrentSourceLocation())}dialectError(t){this.runtimeError(`I can't ${t} in this dialect of BASIC.`)}getLineForPC(t){var r=this.allstmts[t];return r&&r.$loc&&r.$loc.line}getLabelForPC(t){var r=this.allstmts[t];return r&&r.$loc&&r.$loc.label}getCurrentSourceLocation(){var t=this.getStatement();return t&&t.$loc}getCurrentLabel(){var t=this.getCurrentSourceLocation();return t&&t.label}getStatement(){return this.allstmts[this.curpc]}step(){if(!this.running)return!1;var t=this.getStatement();return t?(this.trace&&console.log(this.curpc,t,this.vars,Object.keys(this.arrays)),this.curpc++,this.executeStatement(t),this.running):(this.running=!1,this.exited=!0,!1)}compileStatement(t){if(t.$run==null)try{var r=this["do__"+t.command];r==null&&this.runtimeError(`I don't know how to "${t.command}".`);var e=r.bind(this)(t);this.trace&&console.log(e),t.$run=this.compileJS(e)}catch(i){throw e&&console.log(e),i}}compileJS(t){return new Function(t).bind(this)}executeStatement(t){this.compileStatement(t),t.$run()}skipToEOL(){do this.curpc++;while(this.curpc=0?this.curpc=r:this.runtimeError(`I tried to go to the label "${t}" but couldn't find it.`)}newLocalScope(){this.vars=Object.create(this.vars)}popLocalScope(){this.vars!==this.globals&&(this.vars=Object.getPrototypeOf(this.vars))}gosubLabel(t){this.returnStack.length>32767&&this.runtimeError("I did too many GOSUBs without a RETURN."),this.returnStack.push(this.curpc),this.gotoLabel(t)}returnFromGosub(){this.returnStack.length==0&&this.runtimeError("I tried to RETURN, but there wasn't a corresponding GOSUB.");var t=this.returnStack.pop();this.curpc=t,this.popLocalScope()}popReturnStack(){this.returnStack.length==0&&this.runtimeError("I tried to POP, but there wasn't a corresponding GOSUB."),this.returnStack.pop()}valueToString(t,r){var e;if(typeof t=="number"){var i=this.float2str(t,this.opts.printZoneLength-4);return r?i.startsWith("-")?`${i} `:` ${i} `:i}else if(t==` `)this.column=0,e=t;else if(t==" "){var n=this.opts.printZoneLength,s=Math.floor(this.column/n),a=(s+1)*this.opts.printZoneLength;a+n>this.margin?(this.column=0,e=` `):e=this.TAB(a)}else e=`${t}`;return e}float2str(t,r){var e=t.toString().toUpperCase();if(r>0){for(var i=r;e.length>r;)e=t.toPrecision(i--);e.startsWith("0.")?e=e.substr(1):e.startsWith("-0.")&&(e="-"+e.substr(2))}return e}printExpr(t){var r=this.valueToString(t,this.opts.numericPadding);this.column+=r.length,this.print(r)}print(t){console.log(t)}async input(t,r){return{line:"",vals:[]}}resume(){}expr2js(t,r){if(r||(r={}),O(t))return JSON.stringify(t.value);if(E(t)){if(!t.args&&r.locals&&r.locals.indexOf(t.name)>=0)return t.name;{r.isconst&&this.runtimeError("I expected a constant value here.");var e="",i=JSON.stringify(t.name);let u=t.args?t.args.map(h=>this.expr2js(h,r)).join(", "):[];return t.name.startsWith("FN")?e+=`this.getDef(${i})(${u})`:this.builtins[t.name]?(this.checkFuncArgs(t,this.builtins[t.name]),e+=`this.builtins.${t.name}(${u})`):t.args?this.opts.arraysContainChars&&t.name.endsWith("$")?e+=`this.getStringSlice(this.vars.${t.name}, ${u})`:e+=`this.arrayGet(${i}, ${u})`:e+=`this.vars.${t.name}`,r.novalid?e:`this.checkValue(${e}, ${i})`}}else if(N(t)){var n=this.expr2js(t.left,r),s=this.expr2js(t.right,r);return`this.${t.op}(${n}, ${s})`}else if(I(t)){var a=this.expr2js(t.expr,r);return`this.${t.op}(${a})`}}assign2js(t,r){r||(r={});var e="";return(t.name.startsWith("FN")||this.builtins[t.name])&&this.runtimeError("I can't call a function here."),t.args?this.opts.arraysContainChars&&t.name.endsWith("$")?this.runtimeError("I can't set array slices via this command yet."):e+=this.array2js(t,r):e=`this.globals.${t.name}`,e}array2js(t,r){var e=JSON.stringify(t.name),i=t.args||[];return this.expr2js(t,{novalid:!0})+`;this.getArray(${e}, ${i.length})`+i.map(n=>"[this.ROUND("+this.expr2js(n,r)+")]").join("")}checkFuncArgs(t,r){var e=t.args?t.args.length:0;t.name=="RND"&&e==0||t.name=="MID$"&&e==2||t.name=="INSTR"&&e==2||r.length!=e&&this.runtimeError(`I expected ${r.length} arguments for the ${t.name} function, but I got ${e}.`)}startForLoop(t,r,e,i,n){var s=this.curpc-1,a=this.pc2label.get(s);i||(i=1),this.vars[t]=r,this.trace&&console.log(`FOR ${t} = ${r} TO ${e} STEP ${i}`);var u=()=>i>=0?this.vars[t]>e:this.vars[t]h==t)),this.forLoopStack.push(t),this.forLoops[t]={$next:h=>{h&&t!=h&&this.runtimeError(`I executed NEXT "${h}", but the last FOR was for "${t}".`),this.vars[t]+=i;var m=u();m?(this.forLoopStack.pop(),delete this.forLoops[t]):this.curpc=(a!=null&&this.label2pc[a]||s)+1,this.trace&&console.log(`NEXT ${t}: ${this.vars[t]} TO ${e} STEP ${i} DONE=${m}`)}}}nextForLoop(t){var r=this.forLoops[t||this.opts.optionalNextVar&&this.forLoopStack[this.forLoopStack.length-1]];r||this.runtimeError("I couldn't find a matching FOR for this NEXT."),r.$next(t)}whileLoop(t){t?this.whileLoops.push(this.curpc-1):this.skipToAfterWend()}nextWhileLoop(){var t=this.whileLoops.pop();t==null?this.runtimeError("I couldn't find a matching WHILE for this WEND."):this.curpc=t}assign(t,r,e){return e&&t.endsWith("$")?this.checkValue(this.convert(t,r),t):t.endsWith("$")?this.convertToString(r,t):this.convertToNumber(r,t)}convert(t,r){return t.endsWith("$")?r==null?"":r.toString():typeof r=="number"?r:parseFloat(r+"")}convertToString(t,r){if(typeof t!="string")this.runtimeError(`I can't convert ${t} to a string.`);else return t}convertToNumber(t,r){if(typeof t!="number")this.runtimeError(`I can't convert ${t} to a number.`);else return this.checkNum(t)}dimArray(t,...r){if(r=r.map(Math.round),this.arrays[t]!=null){if(this.opts.staticArrays)return;this.runtimeError(`I already dimensioned this array (${t}) earlier.`)}var e=this.getTotalArrayLength(r);e>this.opts.maxArrayElements&&this.runtimeError("I can't create an array with this many elements.");var i=t.endsWith("$"),n=i?Array:Float64Array;if(r.length==1)this.arrays[t]=new n(r[0]+1);else if(r.length==2){this.arrays[t]=new Array(r[0]+1);for(var s=0;s=i.length&&this.runtimeError(`I tried to lookup ${t}(${r}) but it exceeded the dimensions of the array.`),i=i[r[n]]}return c(i)&&this.runtimeError(`I tried to lookup ${t}(${r}) but used too few dimensions.`),i}modifyStringSlice(t,r,e,i){return t=t||"",this.checkString(t),this.checkString(r),i||(i=e),e=this.ROUND(e),i=this.ROUND(i),e<1&&this.dialectError("accept a string slice index less than 1"),ir.length)&&this.runtimeError(`I needed a number between 1 and ${r.length}, but I got ${t}.`),t<1||t>r.length?0:t}onGotoLabel(t,...r){t=this.checkOnGoto(t,r),t&&this.gotoLabel(r[t-1])}onGosubLabel(t,...r){t=this.checkOnGoto(t,r),t&&this.gosubLabel(r[t-1])}nextDatum(){return this.dataptr>=this.datums.length&&this.runtimeError("I tried to READ, but ran out of data."),this.datums[this.dataptr++].value}do__PRINT(t){var r="";for(var e of t.args){var i=this.expr2js(e),n=i.name;r+=`this.printExpr(this.checkValue(${i}, ${JSON.stringify(n)}));`}return r}preInput(){this.running=!1,this.curpc--}postInput(t){t&&this.curpc++,this.running=!0,this.resume()}do__INPUT(t){var r=t.prompt!=null?this.expr2js(t.prompt):'""',e=t.elapsed!=null?this.assign2js(t.elapsed):"let ___",i="";return t.args.forEach((n,s)=>{var a=this.assign2js(n);i+=` var value = this.convert(${JSON.stringify(n.name)}, response.vals[${s}]); @@ -34,4 +34,4 @@ import{b as v}from"./chunk-3XE5YOCV.js";import{a as d,o as S}from"./chunk-NPUJIC `),this.tty.addtext("*** END OF PROGRAM ***",1),this.tty.showPrintHead(!1)}loadROM(t,r){var e=this.runtime.exited;this.program=r;var i=this.runtime.load(r);this.tty.uppercaseOnly=!0,d.input=this.program.opts.uppercaseOnly?n=>n.toUpperCase():null,(!this.hotReload||e||!i)&&this.reset()}getROMExtension(){return".json"}reset(){this.tty.clear(),this.runtime.reset(),this.clock=0,this.transcript=[]}pause(){this.timer.stop()}resume(){this.isBlocked()||(this.animcount=0,this.timer.start())}isBlocked(){return this.tty.waitingfor!=null||this.runtime.exited}isRunning(){return this.timer.isRunning()}getDefaultExtension(){return".bas"}getToolForFilename(){return"basic"}getPresets(){return T}getPC(){return this.runtime.curpc}getSP(){return 4096-this.runtime.returnStack.length}isStable(){return!0}getCPUState(){return{PC:this.getPC(),SP:this.getSP()}}saveState(){return{c:this.getCPUState(),rt:this.runtime.saveState()}}loadState(t){this.runtime.loadState(t)}getDebugTree(){return{CurrentLine:this.runtime.getCurrentLabel(),Variables:this.runtime.vars,Arrays:this.runtime.arrays,Functions:this.runtime.defs,ForLoops:this.runtime.forLoops,WhileLoops:this.runtime.whileLoops,ReturnStack:this.runtime.returnStack,NextDatum:this.runtime.datums[this.runtime.dataptr],Clock:this.clock,Options:this.runtime.opts,Internals:this.runtime}}inspect(t){let r=this.runtime.vars[t];if(r!=null)return`${t} = ${r}`}showHelp(){return"https://8bitworkshop.com/docs/platforms/basic/"}getDebugCategories(){return["Variables"]}getDebugInfo(t,r){switch(t){case"Variables":return this.varsToLongString()}}varsToLongString(){var t="",r=Object.keys(this.runtime.vars);r.sort();for(var e of r){var i=this.runtime.vars[e],n=JSON.stringify(i);n.length>24&&(n=`${n.substr(0,24)}...(${n.length})`),t+=p(e,3)+" = "+n+` `}return t}setupDebug(t){this.onBreakpointHit=t}clearDebug(){this.onBreakpointHit=null,this.debugTrap=null}checkDebugTrap(){return this.debugTrap&&this.debugTrap()?(this.pause(),this.break(),!0):!1}break(){this.onBreakpointHit&&this.onBreakpointHit(this.saveState())}step(){var t=this.clock;this.debugTrap=()=>this.clock>t,this.resume()}stepOver(){var t=this.runtime.getStatement();if(t&&(t.command=="GOSUB"||t.command=="ONGOSUB")){var r=this.getPC()+1;this.runEval(()=>this.getPC()==r)}else this.step()}runUntilReturn(){var t=this.getSP();this.runEval(()=>this.getSP()>t)}runEval(t){this.debugTrap=()=>t(this.getCPUState()),this.resume()}restartAtPC(t){return t=Math.round(t),t>=0&&t{(function(l){if(typeof Is=="object"&&typeof da!="undefined")da.exports=l();else if(typeof define=="function"&&define.amd)define([],l);else{var t;typeof window!="undefined"?t=window:typeof global!="undefined"?t=global:typeof self!="undefined"?t=self:t=this,t.localforage=l()}})(function(){var l,t,i;return function a(u,d,m){function y(W,fe){if(!d[W]){if(!u[W]){var z=typeof si=="function"&&si;if(!fe&&z)return z(W,!0);if(b)return b(W,!0);var U=new Error("Cannot find module '"+W+"'");throw U.code="MODULE_NOT_FOUND",U}var q=d[W]={exports:{}};u[W][0].call(q.exports,function(de){var K=u[W][1][de];return y(K||de)},q,q.exports,a,u,d,m)}return d[W].exports}for(var b=typeof si=="function"&&si,L=0;L=43)}}).catch(function(){return!1})}function _e(p){return typeof Ce=="boolean"?z.resolve(Ce):oe(p).then(function(S){return Ce=S,Ce})}function He(p){var S=be[p.name],v={};v.promise=new z(function(C,k){v.resolve=C,v.reject=k}),S.deferredOperations.push(v),S.dbReady?S.dbReady=S.dbReady.then(function(){return v.promise}):S.dbReady=v.promise}function Me(p){var S=be[p.name],v=S.deferredOperations.pop();if(v)return v.resolve(),v.promise}function tt(p,S){var v=be[p.name],C=v.deferredOperations.pop();if(C)return C.reject(S),C.promise}function Qe(p,S){return new z(function(v,C){if(be[p.name]=be[p.name]||ir(),p.db)if(S)He(p),p.db.close();else return v(p.db);var k=[p.name];S&&k.push(p.version);var _=L.open.apply(L,k);S&&(_.onupgradeneeded=function(N){var j=_.result;try{j.createObjectStore(p.storeName),N.oldVersion<=1&&j.createObjectStore(xe)}catch(V){if(V.name==="ConstraintError")console.warn('The database "'+p.name+'" has been upgraded from version '+N.oldVersion+" to version "+N.newVersion+', but the storage "'+p.storeName+'" already exists.');else throw V}}),_.onerror=function(N){N.preventDefault(),C(_.error)},_.onsuccess=function(){var N=_.result;N.onversionchange=function(j){j.target.close()},v(N),Me(p)}})}function mt(p){return Qe(p,!1)}function rr(p){return Qe(p,!0)}function wr(p,S){if(!p.db)return!0;var v=!p.db.objectStoreNames.contains(p.storeName),C=p.versionp.db.version;if(C&&(p.version!==S&&console.warn('The database "'+p.name+`" can't be downgraded from version `+p.db.version+" to version "+p.version+"."),p.version=p.db.version),k||v){if(v){var _=p.db.version+1;_>p.version&&(p.version=_)}return!0}return!1}function Ir(p){return new z(function(S,v){var C=new FileReader;C.onerror=v,C.onloadend=function(k){var _=btoa(k.target.result||"");S({__local_forage_encoded_blob:!0,data:_,type:p.type})},C.readAsBinaryString(p)})}function Yt(p){var S=ae(atob(p.data));return fe([S],{type:p.type})}function Mr(p){return p&&p.__local_forage_encoded_blob}function vt(p){var S=this,v=S._initReady().then(function(){var C=be[S._dbInfo.name];if(C&&C.dbReady)return C.dbReady});return q(v,p,p),v}function An(p){He(p);for(var S=be[p.name],v=S.forages,C=0;C0&&(!p.db||_.name==="InvalidStateError"||_.name==="NotFoundError"))return z.resolve().then(function(){if(!p.db||_.name==="NotFoundError"&&!p.db.objectStoreNames.contains(p.storeName)&&p.version<=p.db.version)return p.db&&(p.version=p.db.version+1),rr(p)}).then(function(){return An(p).then(function(){Je(p,S,v,C-1)})}).catch(v);v(_)}}function ir(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Pi(p){var S=this,v={db:null};if(p)for(var C in p)v[C]=p[C];var k=be[v.name];k||(k=ir(),be[v.name]=k),k.forages.push(S),S._initReady||(S._initReady=S.ready,S.ready=vt);var _=[];function N(){return z.resolve()}for(var j=0;j>4,Y[k++]=(N&15)<<4|j>>2,Y[k++]=(j&3)<<6|V&63;return G}function Ke(p){var S=new Uint8Array(p),v="",C;for(C=0;C>2],v+=$e[(S[C]&3)<<4|S[C+1]>>4],v+=$e[(S[C+1]&15)<<2|S[C+2]>>6],v+=$e[S[C+2]&63];return S.length%3==2?v=v.substring(0,v.length-1)+"=":S.length%3==1&&(v=v.substring(0,v.length-2)+"=="),v}function Ze(p,S){var v="";if(p&&(v=Wr.call(p)),p&&(v==="[object ArrayBuffer]"||p.buffer&&Wr.call(p.buffer)==="[object ArrayBuffer]")){var C,k=Sr;p instanceof ArrayBuffer?(C=p,k+=Tr):(C=p.buffer,v==="[object Int8Array]"?k+=yt:v==="[object Uint8Array]"?k+=At:v==="[object Uint8ClampedArray]"?k+=Nt:v==="[object Int16Array]"?k+=Fi:v==="[object Uint16Array]"?k+=Or:v==="[object Int32Array]"?k+=sr:v==="[object Uint32Array]"?k+=$r:v==="[object Float32Array]"?k+=Di:v==="[object Float64Array]"?k+=Ot:S(new Error("Failed to get type for BinaryArray"))),S(k+Ke(C))}else if(v==="[object Blob]"){var _=new FileReader;_.onload=function(){var N=In+p.type+"~"+Ke(this.result);S(Sr+Mt+N)},_.readAsArrayBuffer(p)}else try{S(JSON.stringify(p))}catch(N){console.error("Couldn't convert value into a JSON string: ",p),S(null,N)}}function Br(p){if(p.substring(0,_r)!==Sr)return JSON.parse(p);var S=p.substring(Xt),v=p.substring(_r,Xt),C;if(v===Mt&&Ai.test(S)){var k=S.match(Ai);C=k[1],S=S.substring(k[0].length)}var _=jr(S);switch(v){case Tr:return _;case Mt:return fe([_],{type:C});case yt:return new Int8Array(_);case At:return new Uint8Array(_);case Nt:return new Uint8ClampedArray(_);case Fi:return new Int16Array(_);case Or:return new Uint16Array(_);case sr:return new Int32Array(_);case $r:return new Uint32Array(_);case Di:return new Float32Array(_);case Ot:return new Float64Array(_);default:throw new Error("Unkown type: "+v)}}var Hr={serialize:Ze,deserialize:Br,stringToBuffer:jr,bufferToString:Ke};function Ur(p,S,v,C){p.executeSql("CREATE TABLE IF NOT EXISTS "+S.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],v,C)}function Li(p){var S=this,v={db:null};if(p)for(var C in p)v[C]=typeof p[C]!="string"?p[C].toString():p[C];var k=new z(function(_,N){try{v.db=openDatabase(v.name,String(v.version),v.description,v.size)}catch(j){return N(j)}v.db.transaction(function(j){Ur(j,v,function(){S._dbInfo=v,_()},function(V,G){N(G)})},N)});return v.serializer=Hr,k}function rt(p,S,v,C,k,_){p.executeSql(v,C,k,function(N,j){j.code===j.SYNTAX_ERR?N.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[S.storeName],function(V,G){G.rows.length?_(V,j):Ur(V,S,function(){V.executeSql(v,C,k,_)},_)},_):_(N,j)},_)}function Qt(p,S){var v=this;p=de(p);var C=new z(function(k,_){v.ready().then(function(){var N=v._dbInfo;N.db.transaction(function(j){rt(j,N,"SELECT * FROM "+N.storeName+" WHERE key = ? LIMIT 1",[p],function(V,G){var Y=G.rows.length?G.rows.item(0).value:null;Y&&(Y=N.serializer.deserialize(Y)),k(Y)},function(V,G){_(G)})})}).catch(_)});return U(C,S),C}function Mn(p,S){var v=this,C=new z(function(k,_){v.ready().then(function(){var N=v._dbInfo;N.db.transaction(function(j){rt(j,N,"SELECT * FROM "+N.storeName,[],function(V,G){for(var Y=G.rows,Z=Y.length,ye=0;ye0){N(Ri.apply(k,[p,V,v,C-1]));return}j(ye)}})})}).catch(j)});return U(_,v),_}function zr(p,S,v){return Ri.apply(this,[p,S,v,1])}function Cr(p,S){var v=this;p=de(p);var C=new z(function(k,_){v.ready().then(function(){var N=v._dbInfo;N.db.transaction(function(j){rt(j,N,"DELETE FROM "+N.storeName+" WHERE key = ?",[p],function(){k()},function(V,G){_(G)})})}).catch(_)});return U(C,S),C}function Nn(p){var S=this,v=new z(function(C,k){S.ready().then(function(){var _=S._dbInfo;_.db.transaction(function(N){rt(N,_,"DELETE FROM "+_.storeName,[],function(){C()},function(j,V){k(V)})})}).catch(k)});return U(v,p),v}function On(p){var S=this,v=new z(function(C,k){S.ready().then(function(){var _=S._dbInfo;_.db.transaction(function(N){rt(N,_,"SELECT COUNT(key) as c FROM "+_.storeName,[],function(j,V){var G=V.rows.item(0).c;C(G)},function(j,V){k(V)})})}).catch(k)});return U(v,p),v}function $n(p,S){var v=this,C=new z(function(k,_){v.ready().then(function(){var N=v._dbInfo;N.db.transaction(function(j){rt(j,N,"SELECT key FROM "+N.storeName+" WHERE id = ? LIMIT 1",[p+1],function(V,G){var Y=G.rows.length?G.rows.item(0).key:null;k(Y)},function(V,G){_(G)})})}).catch(_)});return U(C,S),C}function Ii(p){var S=this,v=new z(function(C,k){S.ready().then(function(){var _=S._dbInfo;_.db.transaction(function(N){rt(N,_,"SELECT key FROM "+_.storeName,[],function(j,V){for(var G=[],Y=0;Y '__WebKitDatabaseInfoTable__'",[],function(k,_){for(var N=[],j=0;j<_.rows.length;j++)N.push(_.rows.item(j).name);S({db:p,storeNames:N})},function(k,_){v(_)})},function(C){v(C)})})}function jn(p,S){S=K.apply(this,arguments);var v=this.config();p=typeof p!="function"&&p||{},p.name||(p.name=p.name||v.name,p.storeName=p.storeName||v.storeName);var C=this,k;return p.name?k=new z(function(_){var N;p.name===v.name?N=C._dbInfo.db:N=openDatabase(p.name,"","",0),p.storeName?_({db:N,storeNames:[p.storeName]}):_(Wn(N))}).then(function(_){return new z(function(N,j){_.db.transaction(function(V){function G(ke){return new z(function(Pe,We){V.executeSql("DROP TABLE IF EXISTS "+ke,[],function(){Pe()},function(Le,it){We(it)})})}for(var Y=[],Z=0,ye=_.storeNames.length;Z0}function Vr(p){var S=this,v={};if(p)for(var C in p)v[C]=p[C];return v.keyPrefix=$t(p,S._defaultConfig),qr()?(S._dbInfo=v,v.serializer=Hr,z.resolve()):z.reject()}function kr(p){var S=this,v=S.ready().then(function(){for(var C=S._dbInfo.keyPrefix,k=localStorage.length-1;k>=0;k--){var _=localStorage.key(k);_.indexOf(C)===0&&localStorage.removeItem(_)}});return U(v,p),v}function Oi(p,S){var v=this;p=de(p);var C=v.ready().then(function(){var k=v._dbInfo,_=localStorage.getItem(k.keyPrefix+p);return _&&(_=k.serializer.deserialize(_)),_});return U(C,S),C}function Hn(p,S){var v=this,C=v.ready().then(function(){for(var k=v._dbInfo,_=k.keyPrefix,N=_.length,j=localStorage.length,V=1,G=0;G=0;N--){var j=localStorage.key(N);j.indexOf(_)===0&&localStorage.removeItem(j)}}):k=z.reject("Invalid arguments"),U(k,S),k}var Hi={_driver:"localStorageWrapper",_initStorage:Vr,_support:Bn(),iterate:Hn,getItem:Oi,setItem:ji,removeItem:Wi,clear:kr,length:or,key:$i,keys:Un,dropInstance:Bi},zn=function(S,v){return S===v||typeof S=="number"&&typeof v=="number"&&isNaN(S)&&isNaN(v)},Gr=function(S,v){for(var C=S.length,k=0;k{(function(l,t){"use strict";typeof ln=="object"&&typeof ln.exports=="object"?ln.exports=l.document?t(l,!0):function(i){if(!i.document)throw new Error("jQuery requires a window with a document");return t(i)}:t(l)})(typeof window!="undefined"?window:$s,function(l,t){"use strict";var i=[],a=Object.getPrototypeOf,u=i.slice,d=i.flat?function(e){return i.flat.call(e)}:function(e){return i.concat.apply([],e)},m=i.push,y=i.indexOf,b={},L=b.toString,W=b.hasOwnProperty,fe=W.toString,z=fe.call(Object),U={},q=function(r){return typeof r=="function"&&typeof r.nodeType!="number"&&typeof r.item!="function"},de=function(r){return r!=null&&r===r.window},K=l.document,xe={type:!0,src:!0,nonce:!0,noModule:!0};function Ce(e,r,n){n=n||K;var s,c,f=n.createElement("script");if(f.text=e,r)for(s in xe)c=r[s]||r.getAttribute&&r.getAttribute(s),c&&f.setAttribute(s,c);n.head.appendChild(f).parentNode.removeChild(f)}function be(e){return e==null?e+"":typeof e=="object"||typeof e=="function"?b[L.call(e)]||"object":typeof e}var Se="3.6.3",o=function(e,r){return new o.fn.init(e,r)};o.fn=o.prototype={jquery:Se,constructor:o,length:0,toArray:function(){return u.call(this)},get:function(e){return e==null?u.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var r=o.merge(this.constructor(),e);return r.prevObject=this,r},each:function(e){return o.each(this,e)},map:function(e){return this.pushStack(o.map(this,function(r,n){return e.call(r,n,r)}))},slice:function(){return this.pushStack(u.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(o.grep(this,function(e,r){return(r+1)%2}))},odd:function(){return this.pushStack(o.grep(this,function(e,r){return r%2}))},eq:function(e){var r=this.length,n=+e+(e<0?r:0);return this.pushStack(n>=0&&n0&&r-1 in e}var ae=function(e){var r,n,s,c,f,h,E,x,F,R,B,D,I,ne,ve,re,ze,Ue,ct,Fe="sizzle"+1*new Date,me=e.document,st=0,Te=0,je=Xi(),ri=Xi(),Vi=Xi(),ft=Xi(),cr=function(g,w){return g===w&&(B=!0),0},fr={}.hasOwnProperty,ot=[],Kt=ot.pop,xt=ot.push,Zt=ot.push,ds=ot.slice,dr=function(g,w){for(var T=0,M=g.length;T+~]|"+Ae+")"+Ae+"*"),Ho=new RegExp(Ae+"|>"),Uo=new RegExp(Kn),zo=new RegExp("^"+hr+"$"),Yi={ID:new RegExp("^#("+hr+")"),CLASS:new RegExp("^\\.("+hr+")"),TAG:new RegExp("^("+hr+"|[*])"),ATTR:new RegExp("^"+hs),PSEUDO:new RegExp("^"+Kn),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+Ae+"*(even|odd|(([+-]|)(\\d*)n|)"+Ae+"*(?:([+-]|)"+Ae+"*(\\d+)|))"+Ae+"*\\)|)","i"),bool:new RegExp("^(?:"+Jn+")$","i"),needsContext:new RegExp("^"+Ae+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+Ae+"*((?:-\\d)?\\d*)"+Ae+"*\\)|)(?=[^-]|$)","i")},qo=/HTML$/i,Vo=/^(?:input|select|textarea|button)$/i,Go=/^h\d$/i,ii=/^[^{]+\{\s*\[native \w/,Yo=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Zn=/[+~]/,Bt=new RegExp("\\\\[\\da-fA-F]{1,6}"+Ae+"?|\\\\([^\\r\\n\\f])","g"),Ht=function(g,w){var T="0x"+g.slice(1)-65536;return w||(T<0?String.fromCharCode(T+65536):String.fromCharCode(T>>10|55296,T&1023|56320))},gs=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ms=function(g,w){return w?g==="\0"?"\uFFFD":g.slice(0,-1)+"\\"+g.charCodeAt(g.length-1).toString(16)+" ":"\\"+g},vs=function(){D()},Xo=Ji(function(g){return g.disabled===!0&&g.nodeName.toLowerCase()==="fieldset"},{dir:"parentNode",next:"legend"});try{Zt.apply(ot=ds.call(me.childNodes),me.childNodes),ot[me.childNodes.length].nodeType}catch(g){Zt={apply:ot.length?function(w,T){xt.apply(w,ds.call(T))}:function(w,T){for(var M=w.length,P=0;w[M++]=T[P++];);w.length=M-1}}}function Re(g,w,T,M){var P,O,H,Q,J,ue,se,he=w&&w.ownerDocument,we=w?w.nodeType:9;if(T=T||[],typeof g!="string"||!g||we!==1&&we!==9&&we!==11)return T;if(!M&&(D(w),w=w||I,ve)){if(we!==11&&(J=Yo.exec(g)))if(P=J[1]){if(we===9)if(H=w.getElementById(P)){if(H.id===P)return T.push(H),T}else return T;else if(he&&(H=he.getElementById(P))&&ct(w,H)&&H.id===P)return T.push(H),T}else{if(J[2])return Zt.apply(T,w.getElementsByTagName(g)),T;if((P=J[3])&&n.getElementsByClassName&&w.getElementsByClassName)return Zt.apply(T,w.getElementsByClassName(P)),T}if(n.qsa&&!ft[g+" "]&&(!re||!re.test(g))&&(we!==1||w.nodeName.toLowerCase()!=="object")){if(se=g,he=w,we===1&&(Ho.test(g)||ps.test(g))){for(he=Zn.test(g)&&ta(w.parentNode)||w,(he!==w||!n.scope)&&((Q=w.getAttribute("id"))?Q=Q.replace(gs,ms):w.setAttribute("id",Q=Fe)),ue=h(g),O=ue.length;O--;)ue[O]=(Q?"#"+Q:":scope")+" "+Qi(ue[O]);se=ue.join(",")}try{if(n.cssSupportsSelector&&!CSS.supports("selector(:is("+se+"))"))throw new Error;return Zt.apply(T,he.querySelectorAll(se)),T}catch(Ie){ft(g,!0)}finally{Q===Fe&&w.removeAttribute("id")}}}return x(g.replace(Gi,"$1"),w,T,M)}function Xi(){var g=[];function w(T,M){return g.push(T+" ")>s.cacheLength&&delete w[g.shift()],w[T+" "]=M}return w}function Tt(g){return g[Fe]=!0,g}function wt(g){var w=I.createElement("fieldset");try{return!!g(w)}catch(T){return!1}finally{w.parentNode&&w.parentNode.removeChild(w),w=null}}function ea(g,w){for(var T=g.split("|"),M=T.length;M--;)s.attrHandle[T[M]]=w}function bs(g,w){var T=w&&g,M=T&&g.nodeType===1&&w.nodeType===1&&g.sourceIndex-w.sourceIndex;if(M)return M;if(T){for(;T=T.nextSibling;)if(T===w)return-1}return g?1:-1}function Qo(g){return function(w){var T=w.nodeName.toLowerCase();return T==="input"&&w.type===g}}function Jo(g){return function(w){var T=w.nodeName.toLowerCase();return(T==="input"||T==="button")&&w.type===g}}function ys(g){return function(w){return"form"in w?w.parentNode&&w.disabled===!1?"label"in w?"label"in w.parentNode?w.parentNode.disabled===g:w.disabled===g:w.isDisabled===g||w.isDisabled!==!g&&Xo(w)===g:w.disabled===g:"label"in w?w.disabled===g:!1}}function pr(g){return Tt(function(w){return w=+w,Tt(function(T,M){for(var P,O=g([],T.length,w),H=O.length;H--;)T[P=O[H]]&&(T[P]=!(M[P]=T[P]))})})}function ta(g){return g&&typeof g.getElementsByTagName!="undefined"&&g}n=Re.support={},f=Re.isXML=function(g){var w=g&&g.namespaceURI,T=g&&(g.ownerDocument||g).documentElement;return!qo.test(w||T&&T.nodeName||"HTML")},D=Re.setDocument=function(g){var w,T,M=g?g.ownerDocument||g:me;return M==I||M.nodeType!==9||!M.documentElement||(I=M,ne=I.documentElement,ve=!f(I),me!=I&&(T=I.defaultView)&&T.top!==T&&(T.addEventListener?T.addEventListener("unload",vs,!1):T.attachEvent&&T.attachEvent("onunload",vs)),n.scope=wt(function(P){return ne.appendChild(P).appendChild(I.createElement("div")),typeof P.querySelectorAll!="undefined"&&!P.querySelectorAll(":scope fieldset div").length}),n.cssSupportsSelector=wt(function(){return CSS.supports("selector(*)")&&I.querySelectorAll(":is(:jqfake)")&&!CSS.supports("selector(:is(*,:jqfake))")}),n.attributes=wt(function(P){return P.className="i",!P.getAttribute("className")}),n.getElementsByTagName=wt(function(P){return P.appendChild(I.createComment("")),!P.getElementsByTagName("*").length}),n.getElementsByClassName=ii.test(I.getElementsByClassName),n.getById=wt(function(P){return ne.appendChild(P).id=Fe,!I.getElementsByName||!I.getElementsByName(Fe).length}),n.getById?(s.filter.ID=function(P){var O=P.replace(Bt,Ht);return function(H){return H.getAttribute("id")===O}},s.find.ID=function(P,O){if(typeof O.getElementById!="undefined"&&ve){var H=O.getElementById(P);return H?[H]:[]}}):(s.filter.ID=function(P){var O=P.replace(Bt,Ht);return function(H){var Q=typeof H.getAttributeNode!="undefined"&&H.getAttributeNode("id");return Q&&Q.value===O}},s.find.ID=function(P,O){if(typeof O.getElementById!="undefined"&&ve){var H,Q,J,ue=O.getElementById(P);if(ue){if(H=ue.getAttributeNode("id"),H&&H.value===P)return[ue];for(J=O.getElementsByName(P),Q=0;ue=J[Q++];)if(H=ue.getAttributeNode("id"),H&&H.value===P)return[ue]}return[]}}),s.find.TAG=n.getElementsByTagName?function(P,O){if(typeof O.getElementsByTagName!="undefined")return O.getElementsByTagName(P);if(n.qsa)return O.querySelectorAll(P)}:function(P,O){var H,Q=[],J=0,ue=O.getElementsByTagName(P);if(P==="*"){for(;H=ue[J++];)H.nodeType===1&&Q.push(H);return Q}return ue},s.find.CLASS=n.getElementsByClassName&&function(P,O){if(typeof O.getElementsByClassName!="undefined"&&ve)return O.getElementsByClassName(P)},ze=[],re=[],(n.qsa=ii.test(I.querySelectorAll))&&(wt(function(P){var O;ne.appendChild(P).innerHTML="",P.querySelectorAll("[msallowcapture^='']").length&&re.push("[*^$]="+Ae+`*(?:''|"")`),P.querySelectorAll("[selected]").length||re.push("\\["+Ae+"*(?:value|"+Jn+")"),P.querySelectorAll("[id~="+Fe+"-]").length||re.push("~="),O=I.createElement("input"),O.setAttribute("name",""),P.appendChild(O),P.querySelectorAll("[name='']").length||re.push("\\["+Ae+"*name"+Ae+"*="+Ae+`*(?:''|"")`),P.querySelectorAll(":checked").length||re.push(":checked"),P.querySelectorAll("a#"+Fe+"+*").length||re.push(".#.+[+~]"),P.querySelectorAll("\\\f"),re.push("[\\r\\n\\f]")}),wt(function(P){P.innerHTML="";var O=I.createElement("input");O.setAttribute("type","hidden"),P.appendChild(O).setAttribute("name","D"),P.querySelectorAll("[name=d]").length&&re.push("name"+Ae+"*[*^$|!~]?="),P.querySelectorAll(":enabled").length!==2&&re.push(":enabled",":disabled"),ne.appendChild(P).disabled=!0,P.querySelectorAll(":disabled").length!==2&&re.push(":enabled",":disabled"),P.querySelectorAll("*,:x"),re.push(",.*:")})),(n.matchesSelector=ii.test(Ue=ne.matches||ne.webkitMatchesSelector||ne.mozMatchesSelector||ne.oMatchesSelector||ne.msMatchesSelector))&&wt(function(P){n.disconnectedMatch=Ue.call(P,"*"),Ue.call(P,"[s!='']:x"),ze.push("!=",Kn)}),n.cssSupportsSelector||re.push(":has"),re=re.length&&new RegExp(re.join("|")),ze=ze.length&&new RegExp(ze.join("|")),w=ii.test(ne.compareDocumentPosition),ct=w||ii.test(ne.contains)?function(P,O){var H=P.nodeType===9&&P.documentElement||P,Q=O&&O.parentNode;return P===Q||!!(Q&&Q.nodeType===1&&(H.contains?H.contains(Q):P.compareDocumentPosition&&P.compareDocumentPosition(Q)&16))}:function(P,O){if(O){for(;O=O.parentNode;)if(O===P)return!0}return!1},cr=w?function(P,O){if(P===O)return B=!0,0;var H=!P.compareDocumentPosition-!O.compareDocumentPosition;return H||(H=(P.ownerDocument||P)==(O.ownerDocument||O)?P.compareDocumentPosition(O):1,H&1||!n.sortDetached&&O.compareDocumentPosition(P)===H?P==I||P.ownerDocument==me&&ct(me,P)?-1:O==I||O.ownerDocument==me&&ct(me,O)?1:R?dr(R,P)-dr(R,O):0:H&4?-1:1)}:function(P,O){if(P===O)return B=!0,0;var H,Q=0,J=P.parentNode,ue=O.parentNode,se=[P],he=[O];if(!J||!ue)return P==I?-1:O==I?1:J?-1:ue?1:R?dr(R,P)-dr(R,O):0;if(J===ue)return bs(P,O);for(H=P;H=H.parentNode;)se.unshift(H);for(H=O;H=H.parentNode;)he.unshift(H);for(;se[Q]===he[Q];)Q++;return Q?bs(se[Q],he[Q]):se[Q]==me?-1:he[Q]==me?1:0}),I},Re.matches=function(g,w){return Re(g,null,null,w)},Re.matchesSelector=function(g,w){if(D(g),n.matchesSelector&&ve&&!ft[w+" "]&&(!ze||!ze.test(w))&&(!re||!re.test(w)))try{var T=Ue.call(g,w);if(T||n.disconnectedMatch||g.document&&g.document.nodeType!==11)return T}catch(M){ft(w,!0)}return Re(w,I,null,[g]).length>0},Re.contains=function(g,w){return(g.ownerDocument||g)!=I&&D(g),ct(g,w)},Re.attr=function(g,w){(g.ownerDocument||g)!=I&&D(g);var T=s.attrHandle[w.toLowerCase()],M=T&&fr.call(s.attrHandle,w.toLowerCase())?T(g,w,!ve):void 0;return M!==void 0?M:n.attributes||!ve?g.getAttribute(w):(M=g.getAttributeNode(w))&&M.specified?M.value:null},Re.escape=function(g){return(g+"").replace(gs,ms)},Re.error=function(g){throw new Error("Syntax error, unrecognized expression: "+g)},Re.uniqueSort=function(g){var w,T=[],M=0,P=0;if(B=!n.detectDuplicates,R=!n.sortStable&&g.slice(0),g.sort(cr),B){for(;w=g[P++];)w===g[P]&&(M=T.push(P));for(;M--;)g.splice(T[M],1)}return R=null,g},c=Re.getText=function(g){var w,T="",M=0,P=g.nodeType;if(P){if(P===1||P===9||P===11){if(typeof g.textContent=="string")return g.textContent;for(g=g.firstChild;g;g=g.nextSibling)T+=c(g)}else if(P===3||P===4)return g.nodeValue}else for(;w=g[M++];)T+=c(w);return T},s=Re.selectors={cacheLength:50,createPseudo:Tt,match:Yi,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(g){return g[1]=g[1].replace(Bt,Ht),g[3]=(g[3]||g[4]||g[5]||"").replace(Bt,Ht),g[2]==="~="&&(g[3]=" "+g[3]+" "),g.slice(0,4)},CHILD:function(g){return g[1]=g[1].toLowerCase(),g[1].slice(0,3)==="nth"?(g[3]||Re.error(g[0]),g[4]=+(g[4]?g[5]+(g[6]||1):2*(g[3]==="even"||g[3]==="odd")),g[5]=+(g[7]+g[8]||g[3]==="odd")):g[3]&&Re.error(g[0]),g},PSEUDO:function(g){var w,T=!g[6]&&g[2];return Yi.CHILD.test(g[0])?null:(g[3]?g[2]=g[4]||g[5]||"":T&&Uo.test(T)&&(w=h(T,!0))&&(w=T.indexOf(")",T.length-w)-T.length)&&(g[0]=g[0].slice(0,w),g[2]=T.slice(0,w)),g.slice(0,3))}},filter:{TAG:function(g){var w=g.replace(Bt,Ht).toLowerCase();return g==="*"?function(){return!0}:function(T){return T.nodeName&&T.nodeName.toLowerCase()===w}},CLASS:function(g){var w=je[g+" "];return w||(w=new RegExp("(^|"+Ae+")"+g+"("+Ae+"|$)"))&&je(g,function(T){return w.test(typeof T.className=="string"&&T.className||typeof T.getAttribute!="undefined"&&T.getAttribute("class")||"")})},ATTR:function(g,w,T){return function(M){var P=Re.attr(M,g);return P==null?w==="!=":w?(P+="",w==="="?P===T:w==="!="?P!==T:w==="^="?T&&P.indexOf(T)===0:w==="*="?T&&P.indexOf(T)>-1:w==="$="?T&&P.slice(-T.length)===T:w==="~="?(" "+P.replace(jo," ")+" ").indexOf(T)>-1:w==="|="?P===T||P.slice(0,T.length+1)===T+"-":!1):!0}},CHILD:function(g,w,T,M,P){var O=g.slice(0,3)!=="nth",H=g.slice(-4)!=="last",Q=w==="of-type";return M===1&&P===0?function(J){return!!J.parentNode}:function(J,ue,se){var he,we,Ie,ce,qe,et,dt=O!==H?"nextSibling":"previousSibling",Ne=J.parentNode,ni=Q&&J.nodeName.toLowerCase(),ai=!se&&!Q,ht=!1;if(Ne){if(O){for(;dt;){for(ce=J;ce=ce[dt];)if(Q?ce.nodeName.toLowerCase()===ni:ce.nodeType===1)return!1;et=dt=g==="only"&&!et&&"nextSibling"}return!0}if(et=[H?Ne.firstChild:Ne.lastChild],H&&ai){for(ce=Ne,Ie=ce[Fe]||(ce[Fe]={}),we=Ie[ce.uniqueID]||(Ie[ce.uniqueID]={}),he=we[g]||[],qe=he[0]===st&&he[1],ht=qe&&he[2],ce=qe&&Ne.childNodes[qe];ce=++qe&&ce&&ce[dt]||(ht=qe=0)||et.pop();)if(ce.nodeType===1&&++ht&&ce===J){we[g]=[st,qe,ht];break}}else if(ai&&(ce=J,Ie=ce[Fe]||(ce[Fe]={}),we=Ie[ce.uniqueID]||(Ie[ce.uniqueID]={}),he=we[g]||[],qe=he[0]===st&&he[1],ht=qe),ht===!1)for(;(ce=++qe&&ce&&ce[dt]||(ht=qe=0)||et.pop())&&!((Q?ce.nodeName.toLowerCase()===ni:ce.nodeType===1)&&++ht&&(ai&&(Ie=ce[Fe]||(ce[Fe]={}),we=Ie[ce.uniqueID]||(Ie[ce.uniqueID]={}),we[g]=[st,ht]),ce===J)););return ht-=P,ht===M||ht%M==0&&ht/M>=0}}},PSEUDO:function(g,w){var T,M=s.pseudos[g]||s.setFilters[g.toLowerCase()]||Re.error("unsupported pseudo: "+g);return M[Fe]?M(w):M.length>1?(T=[g,g,"",w],s.setFilters.hasOwnProperty(g.toLowerCase())?Tt(function(P,O){for(var H,Q=M(P,w),J=Q.length;J--;)H=dr(P,Q[J]),P[H]=!(O[H]=Q[J])}):function(P){return M(P,0,T)}):M}},pseudos:{not:Tt(function(g){var w=[],T=[],M=E(g.replace(Gi,"$1"));return M[Fe]?Tt(function(P,O,H,Q){for(var J,ue=M(P,null,Q,[]),se=P.length;se--;)(J=ue[se])&&(P[se]=!(O[se]=J))}):function(P,O,H){return w[0]=P,M(w,null,H,T),w[0]=null,!T.pop()}}),has:Tt(function(g){return function(w){return Re(g,w).length>0}}),contains:Tt(function(g){return g=g.replace(Bt,Ht),function(w){return(w.textContent||c(w)).indexOf(g)>-1}}),lang:Tt(function(g){return zo.test(g||"")||Re.error("unsupported lang: "+g),g=g.replace(Bt,Ht).toLowerCase(),function(w){var T;do if(T=ve?w.lang:w.getAttribute("xml:lang")||w.getAttribute("lang"))return T=T.toLowerCase(),T===g||T.indexOf(g+"-")===0;while((w=w.parentNode)&&w.nodeType===1);return!1}}),target:function(g){var w=e.location&&e.location.hash;return w&&w.slice(1)===g.id},root:function(g){return g===ne},focus:function(g){return g===I.activeElement&&(!I.hasFocus||I.hasFocus())&&!!(g.type||g.href||~g.tabIndex)},enabled:ys(!1),disabled:ys(!0),checked:function(g){var w=g.nodeName.toLowerCase();return w==="input"&&!!g.checked||w==="option"&&!!g.selected},selected:function(g){return g.parentNode&&g.parentNode.selectedIndex,g.selected===!0},empty:function(g){for(g=g.firstChild;g;g=g.nextSibling)if(g.nodeType<6)return!1;return!0},parent:function(g){return!s.pseudos.empty(g)},header:function(g){return Go.test(g.nodeName)},input:function(g){return Vo.test(g.nodeName)},button:function(g){var w=g.nodeName.toLowerCase();return w==="input"&&g.type==="button"||w==="button"},text:function(g){var w;return g.nodeName.toLowerCase()==="input"&&g.type==="text"&&((w=g.getAttribute("type"))==null||w.toLowerCase()==="text")},first:pr(function(){return[0]}),last:pr(function(g,w){return[w-1]}),eq:pr(function(g,w,T){return[T<0?T+w:T]}),even:pr(function(g,w){for(var T=0;Tw?w:T;--M>=0;)g.push(M);return g}),gt:pr(function(g,w,T){for(var M=T<0?T+w:T;++M1?function(w,T,M){for(var P=g.length;P--;)if(!g[P](w,T,M))return!1;return!0}:g[0]}function Ko(g,w,T){for(var M=0,P=w.length;M-1&&(H[se]=!(Q[se]=we))}}else Ne=Ki(Ne===Q?Ne.splice(qe,Ne.length):Ne),P?P(null,Q,Ne,ue):Zt.apply(Q,Ne)})}function na(g){for(var w,T,M,P=g.length,O=s.relative[g[0].type],H=O||s.relative[" "],Q=O?1:0,J=Ji(function(he){return he===w},H,!0),ue=Ji(function(he){return dr(w,he)>-1},H,!0),se=[function(he,we,Ie){var ce=!O&&(Ie||we!==F)||((w=we).nodeType?J(he,we,Ie):ue(he,we,Ie));return w=null,ce}];Q1&&ra(se),Q>1&&Qi(g.slice(0,Q-1).concat({value:g[Q-2].type===" "?"*":""})).replace(Gi,"$1"),T,Q0,M=g.length>0,P=function(O,H,Q,J,ue){var se,he,we,Ie=0,ce="0",qe=O&&[],et=[],dt=F,Ne=O||M&&s.find.TAG("*",ue),ni=st+=dt==null?1:Math.random()||.1,ai=Ne.length;for(ue&&(F=H==I||H||ue);ce!==ai&&(se=Ne[ce])!=null;ce++){if(M&&se){for(he=0,!H&&se.ownerDocument!=I&&(D(se),Q=!ve);we=g[he++];)if(we(se,H||I,Q)){J.push(se);break}ue&&(st=ni)}T&&((se=!we&&se)&&Ie--,O&&qe.push(se))}if(Ie+=ce,T&&ce!==Ie){for(he=0;we=w[he++];)we(qe,et,H,Q);if(O){if(Ie>0)for(;ce--;)qe[ce]||et[ce]||(et[ce]=Kt.call(J));et=Ki(et)}Zt.apply(J,et),ue&&!O&&et.length>0&&Ie+w.length>1&&Re.uniqueSort(J)}return ue&&(st=ni,F=dt),qe};return T?Tt(P):P}return E=Re.compile=function(g,w){var T,M=[],P=[],O=Vi[g+" "];if(!O){for(w||(w=h(g)),T=w.length;T--;)O=na(w[T]),O[Fe]?M.push(O):P.push(O);O=Vi(g,Zo(P,M)),O.selector=g}return O},x=Re.select=function(g,w,T,M){var P,O,H,Q,J,ue=typeof g=="function"&&g,se=!M&&h(g=ue.selector||g);if(T=T||[],se.length===1){if(O=se[0]=se[0].slice(0),O.length>2&&(H=O[0]).type==="ID"&&w.nodeType===9&&ve&&s.relative[O[1].type]){if(w=(s.find.ID(H.matches[0].replace(Bt,Ht),w)||[])[0],w)ue&&(w=w.parentNode);else return T;g=g.slice(O.shift().value.length)}for(P=Yi.needsContext.test(g)?0:O.length;P--&&(H=O[P],!s.relative[Q=H.type]);)if((J=s.find[Q])&&(M=J(H.matches[0].replace(Bt,Ht),Zn.test(O[0].type)&&ta(w.parentNode)||w))){if(O.splice(P,1),g=M.length&&Qi(O),!g)return Zt.apply(T,M),T;break}}return(ue||E(g,se))(M,w,!ve,T,!w||Zn.test(g)&&ta(w.parentNode)||w),T},n.sortStable=Fe.split("").sort(cr).join("")===Fe,n.detectDuplicates=!!B,D(),n.sortDetached=wt(function(g){return g.compareDocumentPosition(I.createElement("fieldset"))&1}),wt(function(g){return g.innerHTML="",g.firstChild.getAttribute("href")==="#"})||ea("type|href|height|width",function(g,w,T){if(!T)return g.getAttribute(w,w.toLowerCase()==="type"?1:2)}),(!n.attributes||!wt(function(g){return g.innerHTML="",g.firstChild.setAttribute("value",""),g.firstChild.getAttribute("value")===""}))&&ea("value",function(g,w,T){if(!T&&g.nodeName.toLowerCase()==="input")return g.defaultValue}),wt(function(g){return g.getAttribute("disabled")==null})||ea(Jn,function(g,w,T){var M;if(!T)return g[w]===!0?w.toLowerCase():(M=g.getAttributeNode(w))&&M.specified?M.value:null}),Re}(l);o.find=ae,o.expr=ae.selectors,o.expr[":"]=o.expr.pseudos,o.uniqueSort=o.unique=ae.uniqueSort,o.text=ae.getText,o.isXMLDoc=ae.isXML,o.contains=ae.contains,o.escapeSelector=ae.escape;var oe=function(e,r,n){for(var s=[],c=n!==void 0;(e=e[r])&&e.nodeType!==9;)if(e.nodeType===1){if(c&&o(e).is(n))break;s.push(e)}return s},_e=function(e,r){for(var n=[];e;e=e.nextSibling)e.nodeType===1&&e!==r&&n.push(e);return n},He=o.expr.match.needsContext;function Me(e,r){return e.nodeName&&e.nodeName.toLowerCase()===r.toLowerCase()}var tt=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function Qe(e,r,n){return q(r)?o.grep(e,function(s,c){return!!r.call(s,c,s)!==n}):r.nodeType?o.grep(e,function(s){return s===r!==n}):typeof r!="string"?o.grep(e,function(s){return y.call(r,s)>-1!==n}):o.filter(r,e,n)}o.filter=function(e,r,n){var s=r[0];return n&&(e=":not("+e+")"),r.length===1&&s.nodeType===1?o.find.matchesSelector(s,e)?[s]:[]:o.find.matches(e,o.grep(r,function(c){return c.nodeType===1}))},o.fn.extend({find:function(e){var r,n,s=this.length,c=this;if(typeof e!="string")return this.pushStack(o(e).filter(function(){for(r=0;r1?o.uniqueSort(n):n},filter:function(e){return this.pushStack(Qe(this,e||[],!1))},not:function(e){return this.pushStack(Qe(this,e||[],!0))},is:function(e){return!!Qe(this,typeof e=="string"&&He.test(e)?o(e):e||[],!1).length}});var mt,rr=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,wr=o.fn.init=function(e,r,n){var s,c;if(!e)return this;if(n=n||mt,typeof e=="string")if(e[0]==="<"&&e[e.length-1]===">"&&e.length>=3?s=[null,e,null]:s=rr.exec(e),s&&(s[1]||!r))if(s[1]){if(r=r instanceof o?r[0]:r,o.merge(this,o.parseHTML(s[1],r&&r.nodeType?r.ownerDocument||r:K,!0)),tt.test(s[1])&&o.isPlainObject(r))for(s in r)q(this[s])?this[s](r[s]):this.attr(s,r[s]);return this}else return c=K.getElementById(s[2]),c&&(this[0]=c,this.length=1),this;else return!r||r.jquery?(r||n).find(e):this.constructor(r).find(e);else{if(e.nodeType)return this[0]=e,this.length=1,this;if(q(e))return n.ready!==void 0?n.ready(e):e(o)}return o.makeArray(e,this)};wr.prototype=o.fn,mt=o(K);var Ir=/^(?:parents|prev(?:Until|All))/,Yt={children:!0,contents:!0,next:!0,prev:!0};o.fn.extend({has:function(e){var r=o(e,this),n=r.length;return this.filter(function(){for(var s=0;s-1:n.nodeType===1&&o.find.matchesSelector(n,e))){f.push(n);break}}return this.pushStack(f.length>1?o.uniqueSort(f):f)},index:function(e){return e?typeof e=="string"?y.call(o(e),this[0]):y.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,r){return this.pushStack(o.uniqueSort(o.merge(this.get(),o(e,r))))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}});function Mr(e,r){for(;(e=e[r])&&e.nodeType!==1;);return e}o.each({parent:function(e){var r=e.parentNode;return r&&r.nodeType!==11?r:null},parents:function(e){return oe(e,"parentNode")},parentsUntil:function(e,r,n){return oe(e,"parentNode",n)},next:function(e){return Mr(e,"nextSibling")},prev:function(e){return Mr(e,"previousSibling")},nextAll:function(e){return oe(e,"nextSibling")},prevAll:function(e){return oe(e,"previousSibling")},nextUntil:function(e,r,n){return oe(e,"nextSibling",n)},prevUntil:function(e,r,n){return oe(e,"previousSibling",n)},siblings:function(e){return _e((e.parentNode||{}).firstChild,e)},children:function(e){return _e(e.firstChild)},contents:function(e){return e.contentDocument!=null&&a(e.contentDocument)?e.contentDocument:(Me(e,"template")&&(e=e.content||e),o.merge([],e.childNodes))}},function(e,r){o.fn[e]=function(n,s){var c=o.map(this,r,n);return e.slice(-5)!=="Until"&&(s=n),s&&typeof s=="string"&&(c=o.filter(s,c)),this.length>1&&(Yt[e]||o.uniqueSort(c),Ir.test(e)&&c.reverse()),this.pushStack(c)}});var vt=/[^\x20\t\r\n\f]+/g;function An(e){var r={};return o.each(e.match(vt)||[],function(n,s){r[s]=!0}),r}o.Callbacks=function(e){e=typeof e=="string"?An(e):o.extend({},e);var r,n,s,c,f=[],h=[],E=-1,x=function(){for(c=c||e.once,s=r=!0;h.length;E=-1)for(n=h.shift();++E-1;)f.splice(D,1),D<=E&&E--}),this},has:function(R){return R?o.inArray(R,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return c=h=[],f=n="",this},disabled:function(){return!f},lock:function(){return c=h=[],!n&&!r&&(f=n=""),this},locked:function(){return!!c},fireWith:function(R,B){return c||(B=B||[],B=[R,B.slice?B.slice():B],h.push(B),r||x()),this},fire:function(){return F.fireWith(this,arguments),this},fired:function(){return!!s}};return F};function Je(e){return e}function ir(e){throw e}function Pi(e,r,n,s){var c;try{e&&q(c=e.promise)?c.call(e).done(r).fail(n):e&&q(c=e.then)?c.call(e,r,n):r.apply(void 0,[e].slice(s))}catch(f){n.apply(void 0,[f])}}o.extend({Deferred:function(e){var r=[["notify","progress",o.Callbacks("memory"),o.Callbacks("memory"),2],["resolve","done",o.Callbacks("once memory"),o.Callbacks("once memory"),0,"resolved"],["reject","fail",o.Callbacks("once memory"),o.Callbacks("once memory"),1,"rejected"]],n="pending",s={state:function(){return n},always:function(){return c.done(arguments).fail(arguments),this},catch:function(f){return s.then(null,f)},pipe:function(){var f=arguments;return o.Deferred(function(h){o.each(r,function(E,x){var F=q(f[x[4]])&&f[x[4]];c[x[1]](function(){var R=F&&F.apply(this,arguments);R&&q(R.promise)?R.promise().progress(h.notify).done(h.resolve).fail(h.reject):h[x[0]+"With"](this,F?[R]:arguments)})}),f=null}).promise()},then:function(f,h,E){var x=0;function F(R,B,D,I){return function(){var ne=this,ve=arguments,re=function(){var Ue,ct;if(!(R=x&&(D!==ir&&(ne=void 0,ve=[Ue]),B.rejectWith(ne,ve))}};R?ze():(o.Deferred.getStackHook&&(ze.stackTrace=o.Deferred.getStackHook()),l.setTimeout(ze))}}return o.Deferred(function(R){r[0][3].add(F(0,R,q(E)?E:Je,R.notifyWith)),r[1][3].add(F(0,R,q(f)?f:Je)),r[2][3].add(F(0,R,q(h)?h:ir))}).promise()},promise:function(f){return f!=null?o.extend(f,s):s}},c={};return o.each(r,function(f,h){var E=h[2],x=h[5];s[h[1]]=E.add,x&&E.add(function(){n=x},r[3-f][2].disable,r[3-f][3].disable,r[0][2].lock,r[0][3].lock),E.add(h[3].fire),c[h[0]]=function(){return c[h[0]+"With"](this===c?void 0:this,arguments),this},c[h[0]+"With"]=E.fireWith}),s.promise(c),e&&e.call(c,c),c},when:function(e){var r=arguments.length,n=r,s=Array(n),c=u.call(arguments),f=o.Deferred(),h=function(E){return function(x){s[E]=this,c[E]=arguments.length>1?u.call(arguments):x,--r||f.resolveWith(s,c)}};if(r<=1&&(Pi(e,f.done(h(n)).resolve,f.reject,!r),f.state()==="pending"||q(c[n]&&c[n].then)))return f.then();for(;n--;)Pi(c[n],h(n),f.reject);return f.promise()}});var Fn=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;o.Deferred.exceptionHook=function(e,r){l.console&&l.console.warn&&e&&Fn.test(e.name)&&l.console.warn("jQuery.Deferred exception: "+e.message,e.stack,r)},o.readyException=function(e){l.setTimeout(function(){throw e})};var Nr=o.Deferred();o.fn.ready=function(e){return Nr.then(e).catch(function(r){o.readyException(r)}),this},o.extend({isReady:!1,readyWait:1,ready:function(e){(e===!0?--o.readyWait:o.isReady)||(o.isReady=!0,!(e!==!0&&--o.readyWait>0)&&Nr.resolveWith(K,[o]))}}),o.ready.then=Nr.then;function Er(){K.removeEventListener("DOMContentLoaded",Er),l.removeEventListener("load",Er),o.ready()}K.readyState==="complete"||K.readyState!=="loading"&&!K.documentElement.doScroll?l.setTimeout(o.ready):(K.addEventListener("DOMContentLoaded",Er),l.addEventListener("load",Er));var _t=function(e,r,n,s,c,f,h){var E=0,x=e.length,F=n==null;if(be(n)==="object"){c=!0;for(E in n)_t(e,r,E,n[E],!0,f,h)}else if(s!==void 0&&(c=!0,q(s)||(h=!0),F&&(h?(r.call(e,s),r=null):(F=r,r=function(R,B,D){return F.call(o(R),D)})),r))for(;E1,null,!0)},removeData:function(e){return this.each(function(){$e.remove(this,e)})}}),o.extend({queue:function(e,r,n){var s;if(e)return r=(r||"fx")+"queue",s=le.get(e,r),n&&(!s||Array.isArray(n)?s=le.access(e,r,o.makeArray(n)):s.push(n)),s||[]},dequeue:function(e,r){r=r||"fx";var n=o.queue(e,r),s=n.length,c=n.shift(),f=o._queueHooks(e,r),h=function(){o.dequeue(e,r)};c==="inprogress"&&(c=n.shift(),s--),c&&(r==="fx"&&n.unshift("inprogress"),delete f.stop,c.call(e,h,f)),!s&&f&&f.empty.fire()},_queueHooks:function(e,r){var n=r+"queueHooks";return le.get(e,n)||le.access(e,n,{empty:o.Callbacks("once memory").add(function(){le.remove(e,[r+"queue",n])})})}}),o.fn.extend({queue:function(e,r){var n=2;return typeof e!="string"&&(r=e,e="fx",n--),arguments.length\x20\t\r\n\f]*)/i,jr=/^$|^module$|\/(?:java|ecma)script/i;(function(){var e=K.createDocumentFragment(),r=e.appendChild(K.createElement("div")),n=K.createElement("input");n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),r.appendChild(n),U.checkClone=r.cloneNode(!0).cloneNode(!0).lastChild.checked,r.innerHTML="",U.noCloneChecked=!!r.cloneNode(!0).lastChild.defaultValue,r.innerHTML="",U.option=!!r.lastChild})();var Ke={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};Ke.tbody=Ke.tfoot=Ke.colgroup=Ke.caption=Ke.thead,Ke.th=Ke.td,U.option||(Ke.optgroup=Ke.option=[1,""]);function Ze(e,r){var n;return typeof e.getElementsByTagName!="undefined"?n=e.getElementsByTagName(r||"*"):typeof e.querySelectorAll!="undefined"?n=e.querySelectorAll(r||"*"):n=[],r===void 0||r&&Me(e,r)?o.merge([e],n):n}function Br(e,r){for(var n=0,s=e.length;n-1){c&&c.push(f);continue}if(F=Nt(f),h=Ze(B.appendChild(f),"script"),F&&Br(h),n)for(R=0;f=h[R++];)jr.test(f.type||"")&&n.push(f)}return B}var Li=/^([^.]*)(?:\.(.+)|)/;function rt(){return!0}function Qt(){return!1}function Mn(e,r){return e===Ri()==(r==="focus")}function Ri(){try{return K.activeElement}catch(e){}}function zr(e,r,n,s,c,f){var h,E;if(typeof r=="object"){typeof n!="string"&&(s=s||n,n=void 0);for(E in r)zr(e,E,n,s,r[E],f);return e}if(s==null&&c==null?(c=n,s=n=void 0):c==null&&(typeof n=="string"?(c=s,s=void 0):(c=s,s=n,n=void 0)),c===!1)c=Qt;else if(!c)return e;return f===1&&(h=c,c=function(x){return o().off(x),h.apply(this,arguments)},c.guid=h.guid||(h.guid=o.guid++)),e.each(function(){o.event.add(this,r,c,s,n)})}o.event={global:{},add:function(e,r,n,s,c){var f,h,E,x,F,R,B,D,I,ne,ve,re=le.get(e);if(!!nr(e))for(n.handler&&(f=n,n=f.handler,c=f.selector),c&&o.find.matchesSelector(At,c),n.guid||(n.guid=o.guid++),(x=re.events)||(x=re.events=Object.create(null)),(h=re.handle)||(h=re.handle=function(ze){return typeof o!="undefined"&&o.event.triggered!==ze.type?o.event.dispatch.apply(e,arguments):void 0}),r=(r||"").match(vt)||[""],F=r.length;F--;)E=Li.exec(r[F])||[],I=ve=E[1],ne=(E[2]||"").split(".").sort(),!!I&&(B=o.event.special[I]||{},I=(c?B.delegateType:B.bindType)||I,B=o.event.special[I]||{},R=o.extend({type:I,origType:ve,data:s,handler:n,guid:n.guid,selector:c,needsContext:c&&o.expr.match.needsContext.test(c),namespace:ne.join(".")},f),(D=x[I])||(D=x[I]=[],D.delegateCount=0,(!B.setup||B.setup.call(e,s,ne,h)===!1)&&e.addEventListener&&e.addEventListener(I,h)),B.add&&(B.add.call(e,R),R.handler.guid||(R.handler.guid=n.guid)),c?D.splice(D.delegateCount++,0,R):D.push(R),o.event.global[I]=!0)},remove:function(e,r,n,s,c){var f,h,E,x,F,R,B,D,I,ne,ve,re=le.hasData(e)&&le.get(e);if(!(!re||!(x=re.events))){for(r=(r||"").match(vt)||[""],F=r.length;F--;){if(E=Li.exec(r[F])||[],I=ve=E[1],ne=(E[2]||"").split(".").sort(),!I){for(I in x)o.event.remove(e,I+r[F],n,s,!0);continue}for(B=o.event.special[I]||{},I=(s?B.delegateType:B.bindType)||I,D=x[I]||[],E=E[2]&&new RegExp("(^|\\.)"+ne.join("\\.(?:.*\\.|)")+"(\\.|$)"),h=f=D.length;f--;)R=D[f],(c||ve===R.origType)&&(!n||n.guid===R.guid)&&(!E||E.test(R.namespace))&&(!s||s===R.selector||s==="**"&&R.selector)&&(D.splice(f,1),R.selector&&D.delegateCount--,B.remove&&B.remove.call(e,R));h&&!D.length&&((!B.teardown||B.teardown.call(e,ne,re.handle)===!1)&&o.removeEvent(e,I,re.handle),delete x[I])}o.isEmptyObject(x)&&le.remove(e,"handle events")}},dispatch:function(e){var r,n,s,c,f,h,E=new Array(arguments.length),x=o.event.fix(e),F=(le.get(this,"events")||Object.create(null))[x.type]||[],R=o.event.special[x.type]||{};for(E[0]=x,r=1;r=1)){for(;F!==this;F=F.parentNode||this)if(F.nodeType===1&&!(e.type==="click"&&F.disabled===!0)){for(f=[],h={},n=0;n-1:o.find(c,this,null,[F]).length),h[c]&&f.push(s);f.length&&E.push({elem:F,handlers:f})}}return F=this,x\s*$/g;function Ii(e,r){return Me(e,"table")&&Me(r.nodeType!==11?r:r.firstChild,"tr")&&o(e).children("tbody")[0]||e}function Wn(e){return e.type=(e.getAttribute("type")!==null)+"/"+e.type,e}function jn(e){return(e.type||"").slice(0,5)==="true/"?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Mi(e,r){var n,s,c,f,h,E,x;if(r.nodeType===1){if(le.hasData(e)&&(f=le.get(e),x=f.events,x)){le.remove(r,"handle events");for(c in x)for(n=0,s=x[c].length;n1&&typeof I=="string"&&!U.checkClone&&On.test(I))return e.each(function(ve){var re=e.eq(ve);ne&&(r[0]=I.call(this,ve,re.html())),$t(re,r,n,s)});if(B&&(c=Ur(r,e[0].ownerDocument,!1,e,s),f=c.firstChild,c.childNodes.length===1&&(c=f),f||s)){for(h=o.map(Ze(c,"script"),Wn),E=h.length;R0&&Br(h,!x&&Ze(e,"script")),E},cleanData:function(e){for(var r,n,s,c=o.event.special,f=0;(n=e[f])!==void 0;f++)if(nr(n)){if(r=n[le.expando]){if(r.events)for(s in r.events)c[s]?o.event.remove(n,s):o.removeEvent(n,s,r.handle);n[le.expando]=void 0}n[$e.expando]&&(n[$e.expando]=void 0)}}}),o.fn.extend({detach:function(e){return Ni(this,e,!0)},remove:function(e){return Ni(this,e)},text:function(e){return _t(this,function(r){return r===void 0?o.text(this):this.empty().each(function(){(this.nodeType===1||this.nodeType===11||this.nodeType===9)&&(this.textContent=r)})},null,e,arguments.length)},append:function(){return $t(this,arguments,function(e){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var r=Ii(this,e);r.appendChild(e)}})},prepend:function(){return $t(this,arguments,function(e){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var r=Ii(this,e);r.insertBefore(e,r.firstChild)}})},before:function(){return $t(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return $t(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,r=0;(e=this[r])!=null;r++)e.nodeType===1&&(o.cleanData(Ze(e,!1)),e.textContent="");return this},clone:function(e,r){return e=e==null?!1:e,r=r==null?e:r,this.map(function(){return o.clone(this,e,r)})},html:function(e){return _t(this,function(r){var n=this[0]||{},s=0,c=this.length;if(r===void 0&&n.nodeType===1)return n.innerHTML;if(typeof r=="string"&&!Nn.test(r)&&!Ke[(Wr.exec(r)||["",""])[1].toLowerCase()]){r=o.htmlPrefilter(r);try{for(;s=0&&(x+=Math.max(0,Math.ceil(e["offset"+r[0].toUpperCase()+r.slice(1)]-f-x-E-.5))||0),x}function ur(e,r,n){var s=kr(e),c=!U.boxSizingReliable()||n,f=c&&o.css(e,"boxSizing",!1,s)==="border-box",h=f,E=or(e,r,s),x="offset"+r[0].toUpperCase()+r.slice(1);if(qr.test(E)){if(!n)return E;E="auto"}return(!U.boxSizingReliable()&&f||!U.reliableTrDimensions()&&Me(e,"tr")||E==="auto"||!parseFloat(E)&&o.css(e,"display",!1,s)==="inline")&&e.getClientRects().length&&(f=o.css(e,"boxSizing",!1,s)==="border-box",h=x in e,h&&(E=e[x])),E=parseFloat(E)||0,E+Xr(e,r,n||(f?"border":"content"),h,s,E)+"px"}o.extend({cssHooks:{opacity:{get:function(e,r){if(r){var n=or(e,"opacity");return n===""?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,r,n,s){if(!(!e||e.nodeType===3||e.nodeType===8||!e.style)){var c,f,h,E=bt(r),x=Vr.test(r),F=e.style;if(x||(r=Gr(E)),h=o.cssHooks[r]||o.cssHooks[E],n!==void 0){if(f=typeof n,f==="string"&&(c=Mt.exec(n))&&c[1]&&(n=Or(e,r,c),f="number"),n==null||n!==n)return;f==="number"&&!x&&(n+=c&&c[3]||(o.cssNumber[E]?"":"px")),!U.clearCloneStyle&&n===""&&r.indexOf("background")===0&&(F[r]="inherit"),(!h||!("set"in h)||(n=h.set(e,n,s))!==void 0)&&(x?F.setProperty(r,n):F[r]=n)}else return h&&"get"in h&&(c=h.get(e,!1,s))!==void 0?c:F[r]}},css:function(e,r,n,s){var c,f,h,E=bt(r),x=Vr.test(r);return x||(r=Gr(E)),h=o.cssHooks[r]||o.cssHooks[E],h&&"get"in h&&(c=h.get(e,!0,n)),c===void 0&&(c=or(e,r,s)),c==="normal"&&r in Yr&&(c=Yr[r]),n===""||n?(f=parseFloat(c),n===!0||isFinite(f)?f||0:c):c}}),o.each(["height","width"],function(e,r){o.cssHooks[r]={get:function(n,s,c){if(s)return Ui.test(o.css(n,"display"))&&(!n.getClientRects().length||!n.getBoundingClientRect().width)?Oi(n,lr,function(){return ur(n,r,c)}):ur(n,r,c)},set:function(n,s,c){var f,h=kr(n),E=!U.scrollboxSize()&&h.position==="absolute",x=E||c,F=x&&o.css(n,"boxSizing",!1,h)==="border-box",R=c?Xr(n,r,c,F,h):0;return F&&E&&(R-=Math.ceil(n["offset"+r[0].toUpperCase()+r.slice(1)]-parseFloat(h[r])-Xr(n,r,"border",!1,h)-.5)),R&&(f=Mt.exec(s))&&(f[3]||"px")!=="px"&&(n.style[r]=s,s=o.css(n,r)),Wt(n,s,R)}}}),o.cssHooks.marginLeft=Wi(U.reliableMarginLeft,function(e,r){if(r)return(parseFloat(or(e,"marginLeft"))||e.getBoundingClientRect().left-Oi(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),o.each({margin:"",padding:"",border:"Width"},function(e,r){o.cssHooks[e+r]={expand:function(n){for(var s=0,c={},f=typeof n=="string"?n.split(" "):[n];s<4;s++)c[e+yt[s]+r]=f[s]||f[s-2]||f[0];return c}},e!=="margin"&&(o.cssHooks[e+r].set=Wt)}),o.fn.extend({css:function(e,r){return _t(this,function(n,s,c){var f,h,E={},x=0;if(Array.isArray(s)){for(f=kr(n),h=s.length;x1)}});function Ge(e,r,n,s,c){return new Ge.prototype.init(e,r,n,s,c)}o.Tween=Ge,Ge.prototype={constructor:Ge,init:function(e,r,n,s,c,f){this.elem=e,this.prop=n,this.easing=c||o.easing._default,this.options=r,this.start=this.now=this.cur(),this.end=s,this.unit=f||(o.cssNumber[n]?"":"px")},cur:function(){var e=Ge.propHooks[this.prop];return e&&e.get?e.get(this):Ge.propHooks._default.get(this)},run:function(e){var r,n=Ge.propHooks[this.prop];return this.options.duration?this.pos=r=o.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=r=e,this.now=(this.end-this.start)*r+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Ge.propHooks._default.set(this),this}},Ge.prototype.init.prototype=Ge.prototype,Ge.propHooks={_default:{get:function(e){var r;return e.elem.nodeType!==1||e.elem[e.prop]!=null&&e.elem.style[e.prop]==null?e.elem[e.prop]:(r=o.css(e.elem,e.prop,""),!r||r==="auto"?0:r)},set:function(e){o.fx.step[e.prop]?o.fx.step[e.prop](e):e.elem.nodeType===1&&(o.cssHooks[e.prop]||e.elem.style[Gr(e.prop)]!=null)?o.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Ge.propHooks.scrollTop=Ge.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},o.easing={linear:function(e){return e},swing:function(e){return .5-Math.cos(e*Math.PI)/2},_default:"swing"},o.fx=Ge.prototype.init,o.fx.step={};var Jt,Pr,Qr=/^(?:toggle|show|hide)$/,qn=/queueHooks$/;function Jr(){Pr&&(K.hidden===!1&&l.requestAnimationFrame?l.requestAnimationFrame(Jr):l.setTimeout(Jr,o.fx.interval),o.fx.tick())}function p(){return l.setTimeout(function(){Jt=void 0}),Jt=Date.now()}function S(e,r){var n,s=0,c={height:e};for(r=r?1:0;s<4;s+=2-r)n=yt[s],c["margin"+n]=c["padding"+n]=e;return r&&(c.opacity=c.width=e),c}function v(e,r,n){for(var s,c=(_.tweeners[r]||[]).concat(_.tweeners["*"]),f=0,h=c.length;f1)},removeAttr:function(e){return this.each(function(){o.removeAttr(this,e)})}}),o.extend({attr:function(e,r,n){var s,c,f=e.nodeType;if(!(f===3||f===8||f===2)){if(typeof e.getAttribute=="undefined")return o.prop(e,r,n);if((f!==1||!o.isXMLDoc(e))&&(c=o.attrHooks[r.toLowerCase()]||(o.expr.match.bool.test(r)?N:void 0)),n!==void 0){if(n===null){o.removeAttr(e,r);return}return c&&"set"in c&&(s=c.set(e,n,r))!==void 0?s:(e.setAttribute(r,n+""),n)}return c&&"get"in c&&(s=c.get(e,r))!==null?s:(s=o.find.attr(e,r),s==null?void 0:s)}},attrHooks:{type:{set:function(e,r){if(!U.radioValue&&r==="radio"&&Me(e,"input")){var n=e.value;return e.setAttribute("type",r),n&&(e.value=n),r}}}},removeAttr:function(e,r){var n,s=0,c=r&&r.match(vt);if(c&&e.nodeType===1)for(;n=c[s++];)e.removeAttribute(n)}}),N={set:function(e,r,n){return r===!1?o.removeAttr(e,n):e.setAttribute(n,n),n}},o.each(o.expr.match.bool.source.match(/\w+/g),function(e,r){var n=j[r]||o.find.attr;j[r]=function(s,c,f){var h,E,x=c.toLowerCase();return f||(E=j[x],j[x]=h,h=n(s,c,f)!=null?x:null,j[x]=E),h}});var V=/^(?:input|select|textarea|button)$/i,G=/^(?:a|area)$/i;o.fn.extend({prop:function(e,r){return _t(this,o.prop,e,r,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[o.propFix[e]||e]})}}),o.extend({prop:function(e,r,n){var s,c,f=e.nodeType;if(!(f===3||f===8||f===2))return(f!==1||!o.isXMLDoc(e))&&(r=o.propFix[r]||r,c=o.propHooks[r]),n!==void 0?c&&"set"in c&&(s=c.set(e,n,r))!==void 0?s:e[r]=n:c&&"get"in c&&(s=c.get(e,r))!==null?s:e[r]},propHooks:{tabIndex:{get:function(e){var r=o.find.attr(e,"tabindex");return r?parseInt(r,10):V.test(e.nodeName)||G.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),U.optSelected||(o.propHooks.selected={get:function(e){var r=e.parentNode;return r&&r.parentNode&&r.parentNode.selectedIndex,null},set:function(e){var r=e.parentNode;r&&(r.selectedIndex,r.parentNode&&r.parentNode.selectedIndex)}}),o.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){o.propFix[this.toLowerCase()]=this});function Y(e){var r=e.match(vt)||[];return r.join(" ")}function Z(e){return e.getAttribute&&e.getAttribute("class")||""}function ye(e){return Array.isArray(e)?e:typeof e=="string"?e.match(vt)||[]:[]}o.fn.extend({addClass:function(e){var r,n,s,c,f,h;return q(e)?this.each(function(E){o(this).addClass(e.call(this,E,Z(this)))}):(r=ye(e),r.length?this.each(function(){if(s=Z(this),n=this.nodeType===1&&" "+Y(s)+" ",n){for(f=0;f-1;)n=n.replace(" "+c+" "," ");h=Y(n),s!==h&&this.setAttribute("class",h)}}):this):this.attr("class","")},toggleClass:function(e,r){var n,s,c,f,h=typeof e,E=h==="string"||Array.isArray(e);return q(e)?this.each(function(x){o(this).toggleClass(e.call(this,x,Z(this),r),r)}):typeof r=="boolean"&&E?r?this.addClass(e):this.removeClass(e):(n=ye(e),this.each(function(){if(E)for(f=o(this),c=0;c-1)return!0;return!1}});var ke=/\r/g;o.fn.extend({val:function(e){var r,n,s,c=this[0];return arguments.length?(s=q(e),this.each(function(f){var h;this.nodeType===1&&(s?h=e.call(this,f,o(this).val()):h=e,h==null?h="":typeof h=="number"?h+="":Array.isArray(h)&&(h=o.map(h,function(E){return E==null?"":E+""})),r=o.valHooks[this.type]||o.valHooks[this.nodeName.toLowerCase()],(!r||!("set"in r)||r.set(this,h,"value")===void 0)&&(this.value=h))})):c?(r=o.valHooks[c.type]||o.valHooks[c.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(c,"value"))!==void 0?n:(n=c.value,typeof n=="string"?n.replace(ke,""):n==null?"":n)):void 0}}),o.extend({valHooks:{option:{get:function(e){var r=o.find.attr(e,"value");return r!=null?r:Y(o.text(e))}},select:{get:function(e){var r,n,s,c=e.options,f=e.selectedIndex,h=e.type==="select-one",E=h?null:[],x=h?f+1:c.length;for(f<0?s=x:s=h?f:0;s-1)&&(n=!0);return n||(e.selectedIndex=-1),f}}}}),o.each(["radio","checkbox"],function(){o.valHooks[this]={set:function(e,r){if(Array.isArray(r))return e.checked=o.inArray(o(e).val(),r)>-1}},U.checkOn||(o.valHooks[this].get=function(e){return e.getAttribute("value")===null?"on":e.value})}),U.focusin="onfocusin"in l;var Pe=/^(?:focusinfocus|focusoutblur)$/,We=function(e){e.stopPropagation()};o.extend(o.event,{trigger:function(e,r,n,s){var c,f,h,E,x,F,R,B,D=[n||K],I=W.call(e,"type")?e.type:e,ne=W.call(e,"namespace")?e.namespace.split("."):[];if(f=B=h=n=n||K,!(n.nodeType===3||n.nodeType===8)&&!Pe.test(I+o.event.triggered)&&(I.indexOf(".")>-1&&(ne=I.split("."),I=ne.shift(),ne.sort()),x=I.indexOf(":")<0&&"on"+I,e=e[o.expando]?e:new o.Event(I,typeof e=="object"&&e),e.isTrigger=s?2:3,e.namespace=ne.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+ne.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),r=r==null?[e]:o.makeArray(r,[e]),R=o.event.special[I]||{},!(!s&&R.trigger&&R.trigger.apply(n,r)===!1))){if(!s&&!R.noBubble&&!de(n)){for(E=R.delegateType||I,Pe.test(E+I)||(f=f.parentNode);f;f=f.parentNode)D.push(f),h=f;h===(n.ownerDocument||K)&&D.push(h.defaultView||h.parentWindow||l)}for(c=0;(f=D[c++])&&!e.isPropagationStopped();)B=f,e.type=c>1?E:R.bindType||I,F=(le.get(f,"events")||Object.create(null))[e.type]&&le.get(f,"handle"),F&&F.apply(f,r),F=x&&f[x],F&&F.apply&&nr(f)&&(e.result=F.apply(f,r),e.result===!1&&e.preventDefault());return e.type=I,!s&&!e.isDefaultPrevented()&&(!R._default||R._default.apply(D.pop(),r)===!1)&&nr(n)&&x&&q(n[I])&&!de(n)&&(h=n[x],h&&(n[x]=null),o.event.triggered=I,e.isPropagationStopped()&&B.addEventListener(I,We),n[I](),e.isPropagationStopped()&&B.removeEventListener(I,We),o.event.triggered=void 0,h&&(n[x]=h)),e.result}},simulate:function(e,r,n){var s=o.extend(new o.Event,n,{type:e,isSimulated:!0});o.event.trigger(s,null,r)}}),o.fn.extend({trigger:function(e,r){return this.each(function(){o.event.trigger(e,r,this)})},triggerHandler:function(e,r){var n=this[0];if(n)return o.event.trigger(e,r,n,!0)}}),U.focusin||o.each({focus:"focusin",blur:"focusout"},function(e,r){var n=function(s){o.event.simulate(r,s.target,o.event.fix(s))};o.event.special[r]={setup:function(){var s=this.ownerDocument||this.document||this,c=le.access(s,r);c||s.addEventListener(e,n,!0),le.access(s,r,(c||0)+1)},teardown:function(){var s=this.ownerDocument||this.document||this,c=le.access(s,r)-1;c?le.access(s,r,c):(s.removeEventListener(e,n,!0),le.remove(s,r))}}});var Le=l.location,it={guid:Date.now()},jt=/\?/;o.parseXML=function(e){var r,n;if(!e||typeof e!="string")return null;try{r=new l.DOMParser().parseFromString(e,"text/xml")}catch(s){}return n=r&&r.getElementsByTagName("parsererror")[0],(!r||n)&&o.error("Invalid XML: "+(n?o.map(n.childNodes,function(s){return s.textContent}).join(` +import{a as sn,b as el,c as tl}from"./chunk-SXEVG2WS.js";import{a as Ds}from"./chunk-5SHCNQ2O.js";import{a as Ls,b as Rs,c as rl}from"./chunk-QHCN4ZOY.js";import{D as ca,J as fa,l as te,u as As,v as Fs}from"./chunk-TV4YGKI4.js";import{D as Dt,E as oa,F as Fr,I as Cs,J as la,S as ua,U as ks,a as Ft,aa as an,b as oi,ba as Ps,ca as li,d as Et,e as sa,f as pt,g as De,j as Es,l as Zi,m as en,n as tn,o as gr,p as Ss,s as rn,v as _s,w as Ts,x as nn,y as gt,z as Ar}from"./chunk-Z5CU44VP.js";import{b as si,c as ws,e as aa}from"./chunk-5XVCUSSZ.js";var ha=ws((Is,da)=>{(function(l){if(typeof Is=="object"&&typeof da!="undefined")da.exports=l();else if(typeof define=="function"&&define.amd)define([],l);else{var t;typeof window!="undefined"?t=window:typeof global!="undefined"?t=global:typeof self!="undefined"?t=self:t=this,t.localforage=l()}})(function(){var l,t,i;return function a(u,d,m){function y(W,fe){if(!d[W]){if(!u[W]){var z=typeof si=="function"&&si;if(!fe&&z)return z(W,!0);if(b)return b(W,!0);var U=new Error("Cannot find module '"+W+"'");throw U.code="MODULE_NOT_FOUND",U}var q=d[W]={exports:{}};u[W][0].call(q.exports,function(de){var K=u[W][1][de];return y(K||de)},q,q.exports,a,u,d,m)}return d[W].exports}for(var b=typeof si=="function"&&si,D=0;D=43)}}).catch(function(){return!1})}function _e(p){return typeof Ce=="boolean"?z.resolve(Ce):oe(p).then(function(S){return Ce=S,Ce})}function He(p){var S=be[p.name],v={};v.promise=new z(function(C,k){v.resolve=C,v.reject=k}),S.deferredOperations.push(v),S.dbReady?S.dbReady=S.dbReady.then(function(){return v.promise}):S.dbReady=v.promise}function Me(p){var S=be[p.name],v=S.deferredOperations.pop();if(v)return v.resolve(),v.promise}function tt(p,S){var v=be[p.name],C=v.deferredOperations.pop();if(C)return C.reject(S),C.promise}function Qe(p,S){return new z(function(v,C){if(be[p.name]=be[p.name]||ir(),p.db)if(S)He(p),p.db.close();else return v(p.db);var k=[p.name];S&&k.push(p.version);var _=D.open.apply(D,k);S&&(_.onupgradeneeded=function(N){var j=_.result;try{j.createObjectStore(p.storeName),N.oldVersion<=1&&j.createObjectStore(xe)}catch(V){if(V.name==="ConstraintError")console.warn('The database "'+p.name+'" has been upgraded from version '+N.oldVersion+" to version "+N.newVersion+', but the storage "'+p.storeName+'" already exists.');else throw V}}),_.onerror=function(N){N.preventDefault(),C(_.error)},_.onsuccess=function(){var N=_.result;N.onversionchange=function(j){j.target.close()},v(N),Me(p)}})}function mt(p){return Qe(p,!1)}function rr(p){return Qe(p,!0)}function wr(p,S){if(!p.db)return!0;var v=!p.db.objectStoreNames.contains(p.storeName),C=p.versionp.db.version;if(C&&(p.version!==S&&console.warn('The database "'+p.name+`" can't be downgraded from version `+p.db.version+" to version "+p.version+"."),p.version=p.db.version),k||v){if(v){var _=p.db.version+1;_>p.version&&(p.version=_)}return!0}return!1}function Ir(p){return new z(function(S,v){var C=new FileReader;C.onerror=v,C.onloadend=function(k){var _=btoa(k.target.result||"");S({__local_forage_encoded_blob:!0,data:_,type:p.type})},C.readAsBinaryString(p)})}function Yt(p){var S=ae(atob(p.data));return fe([S],{type:p.type})}function Mr(p){return p&&p.__local_forage_encoded_blob}function vt(p){var S=this,v=S._initReady().then(function(){var C=be[S._dbInfo.name];if(C&&C.dbReady)return C.dbReady});return q(v,p,p),v}function An(p){He(p);for(var S=be[p.name],v=S.forages,C=0;C0&&(!p.db||_.name==="InvalidStateError"||_.name==="NotFoundError"))return z.resolve().then(function(){if(!p.db||_.name==="NotFoundError"&&!p.db.objectStoreNames.contains(p.storeName)&&p.version<=p.db.version)return p.db&&(p.version=p.db.version+1),rr(p)}).then(function(){return An(p).then(function(){Je(p,S,v,C-1)})}).catch(v);v(_)}}function ir(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Pi(p){var S=this,v={db:null};if(p)for(var C in p)v[C]=p[C];var k=be[v.name];k||(k=ir(),be[v.name]=k),k.forages.push(S),S._initReady||(S._initReady=S.ready,S.ready=vt);var _=[];function N(){return z.resolve()}for(var j=0;j>4,Y[k++]=(N&15)<<4|j>>2,Y[k++]=(j&3)<<6|V&63;return G}function Ke(p){var S=new Uint8Array(p),v="",C;for(C=0;C>2],v+=$e[(S[C]&3)<<4|S[C+1]>>4],v+=$e[(S[C+1]&15)<<2|S[C+2]>>6],v+=$e[S[C+2]&63];return S.length%3==2?v=v.substring(0,v.length-1)+"=":S.length%3==1&&(v=v.substring(0,v.length-2)+"=="),v}function Ze(p,S){var v="";if(p&&(v=Wr.call(p)),p&&(v==="[object ArrayBuffer]"||p.buffer&&Wr.call(p.buffer)==="[object ArrayBuffer]")){var C,k=Sr;p instanceof ArrayBuffer?(C=p,k+=Tr):(C=p.buffer,v==="[object Int8Array]"?k+=yt:v==="[object Uint8Array]"?k+=At:v==="[object Uint8ClampedArray]"?k+=Nt:v==="[object Int16Array]"?k+=Fi:v==="[object Uint16Array]"?k+=Or:v==="[object Int32Array]"?k+=sr:v==="[object Uint32Array]"?k+=$r:v==="[object Float32Array]"?k+=Di:v==="[object Float64Array]"?k+=Ot:S(new Error("Failed to get type for BinaryArray"))),S(k+Ke(C))}else if(v==="[object Blob]"){var _=new FileReader;_.onload=function(){var N=In+p.type+"~"+Ke(this.result);S(Sr+Mt+N)},_.readAsArrayBuffer(p)}else try{S(JSON.stringify(p))}catch(N){console.error("Couldn't convert value into a JSON string: ",p),S(null,N)}}function Br(p){if(p.substring(0,_r)!==Sr)return JSON.parse(p);var S=p.substring(Xt),v=p.substring(_r,Xt),C;if(v===Mt&&Ai.test(S)){var k=S.match(Ai);C=k[1],S=S.substring(k[0].length)}var _=jr(S);switch(v){case Tr:return _;case Mt:return fe([_],{type:C});case yt:return new Int8Array(_);case At:return new Uint8Array(_);case Nt:return new Uint8ClampedArray(_);case Fi:return new Int16Array(_);case Or:return new Uint16Array(_);case sr:return new Int32Array(_);case $r:return new Uint32Array(_);case Di:return new Float32Array(_);case Ot:return new Float64Array(_);default:throw new Error("Unkown type: "+v)}}var Hr={serialize:Ze,deserialize:Br,stringToBuffer:jr,bufferToString:Ke};function Ur(p,S,v,C){p.executeSql("CREATE TABLE IF NOT EXISTS "+S.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],v,C)}function Li(p){var S=this,v={db:null};if(p)for(var C in p)v[C]=typeof p[C]!="string"?p[C].toString():p[C];var k=new z(function(_,N){try{v.db=openDatabase(v.name,String(v.version),v.description,v.size)}catch(j){return N(j)}v.db.transaction(function(j){Ur(j,v,function(){S._dbInfo=v,_()},function(V,G){N(G)})},N)});return v.serializer=Hr,k}function rt(p,S,v,C,k,_){p.executeSql(v,C,k,function(N,j){j.code===j.SYNTAX_ERR?N.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[S.storeName],function(V,G){G.rows.length?_(V,j):Ur(V,S,function(){V.executeSql(v,C,k,_)},_)},_):_(N,j)},_)}function Qt(p,S){var v=this;p=de(p);var C=new z(function(k,_){v.ready().then(function(){var N=v._dbInfo;N.db.transaction(function(j){rt(j,N,"SELECT * FROM "+N.storeName+" WHERE key = ? LIMIT 1",[p],function(V,G){var Y=G.rows.length?G.rows.item(0).value:null;Y&&(Y=N.serializer.deserialize(Y)),k(Y)},function(V,G){_(G)})})}).catch(_)});return U(C,S),C}function Mn(p,S){var v=this,C=new z(function(k,_){v.ready().then(function(){var N=v._dbInfo;N.db.transaction(function(j){rt(j,N,"SELECT * FROM "+N.storeName,[],function(V,G){for(var Y=G.rows,Z=Y.length,ye=0;ye0){N(Ri.apply(k,[p,V,v,C-1]));return}j(ye)}})})}).catch(j)});return U(_,v),_}function zr(p,S,v){return Ri.apply(this,[p,S,v,1])}function Cr(p,S){var v=this;p=de(p);var C=new z(function(k,_){v.ready().then(function(){var N=v._dbInfo;N.db.transaction(function(j){rt(j,N,"DELETE FROM "+N.storeName+" WHERE key = ?",[p],function(){k()},function(V,G){_(G)})})}).catch(_)});return U(C,S),C}function Nn(p){var S=this,v=new z(function(C,k){S.ready().then(function(){var _=S._dbInfo;_.db.transaction(function(N){rt(N,_,"DELETE FROM "+_.storeName,[],function(){C()},function(j,V){k(V)})})}).catch(k)});return U(v,p),v}function On(p){var S=this,v=new z(function(C,k){S.ready().then(function(){var _=S._dbInfo;_.db.transaction(function(N){rt(N,_,"SELECT COUNT(key) as c FROM "+_.storeName,[],function(j,V){var G=V.rows.item(0).c;C(G)},function(j,V){k(V)})})}).catch(k)});return U(v,p),v}function $n(p,S){var v=this,C=new z(function(k,_){v.ready().then(function(){var N=v._dbInfo;N.db.transaction(function(j){rt(j,N,"SELECT key FROM "+N.storeName+" WHERE id = ? LIMIT 1",[p+1],function(V,G){var Y=G.rows.length?G.rows.item(0).key:null;k(Y)},function(V,G){_(G)})})}).catch(_)});return U(C,S),C}function Ii(p){var S=this,v=new z(function(C,k){S.ready().then(function(){var _=S._dbInfo;_.db.transaction(function(N){rt(N,_,"SELECT key FROM "+_.storeName,[],function(j,V){for(var G=[],Y=0;Y '__WebKitDatabaseInfoTable__'",[],function(k,_){for(var N=[],j=0;j<_.rows.length;j++)N.push(_.rows.item(j).name);S({db:p,storeNames:N})},function(k,_){v(_)})},function(C){v(C)})})}function jn(p,S){S=K.apply(this,arguments);var v=this.config();p=typeof p!="function"&&p||{},p.name||(p.name=p.name||v.name,p.storeName=p.storeName||v.storeName);var C=this,k;return p.name?k=new z(function(_){var N;p.name===v.name?N=C._dbInfo.db:N=openDatabase(p.name,"","",0),p.storeName?_({db:N,storeNames:[p.storeName]}):_(Wn(N))}).then(function(_){return new z(function(N,j){_.db.transaction(function(V){function G(ke){return new z(function(Pe,We){V.executeSql("DROP TABLE IF EXISTS "+ke,[],function(){Pe()},function(Le,it){We(it)})})}for(var Y=[],Z=0,ye=_.storeNames.length;Z0}function Vr(p){var S=this,v={};if(p)for(var C in p)v[C]=p[C];return v.keyPrefix=$t(p,S._defaultConfig),qr()?(S._dbInfo=v,v.serializer=Hr,z.resolve()):z.reject()}function kr(p){var S=this,v=S.ready().then(function(){for(var C=S._dbInfo.keyPrefix,k=localStorage.length-1;k>=0;k--){var _=localStorage.key(k);_.indexOf(C)===0&&localStorage.removeItem(_)}});return U(v,p),v}function Oi(p,S){var v=this;p=de(p);var C=v.ready().then(function(){var k=v._dbInfo,_=localStorage.getItem(k.keyPrefix+p);return _&&(_=k.serializer.deserialize(_)),_});return U(C,S),C}function Hn(p,S){var v=this,C=v.ready().then(function(){for(var k=v._dbInfo,_=k.keyPrefix,N=_.length,j=localStorage.length,V=1,G=0;G=0;N--){var j=localStorage.key(N);j.indexOf(_)===0&&localStorage.removeItem(j)}}):k=z.reject("Invalid arguments"),U(k,S),k}var Hi={_driver:"localStorageWrapper",_initStorage:Vr,_support:Bn(),iterate:Hn,getItem:Oi,setItem:ji,removeItem:Wi,clear:kr,length:or,key:$i,keys:Un,dropInstance:Bi},zn=function(S,v){return S===v||typeof S=="number"&&typeof v=="number"&&isNaN(S)&&isNaN(v)},Gr=function(S,v){for(var C=S.length,k=0;k{(function(l,t){"use strict";typeof ln=="object"&&typeof ln.exports=="object"?ln.exports=l.document?t(l,!0):function(i){if(!i.document)throw new Error("jQuery requires a window with a document");return t(i)}:t(l)})(typeof window!="undefined"?window:$s,function(l,t){"use strict";var i=[],a=Object.getPrototypeOf,u=i.slice,d=i.flat?function(e){return i.flat.call(e)}:function(e){return i.concat.apply([],e)},m=i.push,y=i.indexOf,b={},D=b.toString,W=b.hasOwnProperty,fe=W.toString,z=fe.call(Object),U={},q=function(r){return typeof r=="function"&&typeof r.nodeType!="number"&&typeof r.item!="function"},de=function(r){return r!=null&&r===r.window},K=l.document,xe={type:!0,src:!0,nonce:!0,noModule:!0};function Ce(e,r,n){n=n||K;var s,c,f=n.createElement("script");if(f.text=e,r)for(s in xe)c=r[s]||r.getAttribute&&r.getAttribute(s),c&&f.setAttribute(s,c);n.head.appendChild(f).parentNode.removeChild(f)}function be(e){return e==null?e+"":typeof e=="object"||typeof e=="function"?b[D.call(e)]||"object":typeof e}var Se="3.6.3",o=function(e,r){return new o.fn.init(e,r)};o.fn=o.prototype={jquery:Se,constructor:o,length:0,toArray:function(){return u.call(this)},get:function(e){return e==null?u.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var r=o.merge(this.constructor(),e);return r.prevObject=this,r},each:function(e){return o.each(this,e)},map:function(e){return this.pushStack(o.map(this,function(r,n){return e.call(r,n,r)}))},slice:function(){return this.pushStack(u.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(o.grep(this,function(e,r){return(r+1)%2}))},odd:function(){return this.pushStack(o.grep(this,function(e,r){return r%2}))},eq:function(e){var r=this.length,n=+e+(e<0?r:0);return this.pushStack(n>=0&&n0&&r-1 in e}var ae=function(e){var r,n,s,c,f,h,E,x,F,R,B,L,I,ne,ve,re,ze,Ue,ct,Fe="sizzle"+1*new Date,me=e.document,ot=0,Te=0,je=Xi(),ri=Xi(),Vi=Xi(),ft=Xi(),cr=function(g,w){return g===w&&(B=!0),0},fr={}.hasOwnProperty,lt=[],Kt=lt.pop,xt=lt.push,Zt=lt.push,ds=lt.slice,dr=function(g,w){for(var T=0,M=g.length;T+~]|"+Ae+")"+Ae+"*"),Ho=new RegExp(Ae+"|>"),Uo=new RegExp(Kn),zo=new RegExp("^"+hr+"$"),Yi={ID:new RegExp("^#("+hr+")"),CLASS:new RegExp("^\\.("+hr+")"),TAG:new RegExp("^("+hr+"|[*])"),ATTR:new RegExp("^"+hs),PSEUDO:new RegExp("^"+Kn),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+Ae+"*(even|odd|(([+-]|)(\\d*)n|)"+Ae+"*(?:([+-]|)"+Ae+"*(\\d+)|))"+Ae+"*\\)|)","i"),bool:new RegExp("^(?:"+Jn+")$","i"),needsContext:new RegExp("^"+Ae+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+Ae+"*((?:-\\d)?\\d*)"+Ae+"*\\)|)(?=[^-]|$)","i")},qo=/HTML$/i,Vo=/^(?:input|select|textarea|button)$/i,Go=/^h\d$/i,ii=/^[^{]+\{\s*\[native \w/,Yo=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Zn=/[+~]/,Bt=new RegExp("\\\\[\\da-fA-F]{1,6}"+Ae+"?|\\\\([^\\r\\n\\f])","g"),Ht=function(g,w){var T="0x"+g.slice(1)-65536;return w||(T<0?String.fromCharCode(T+65536):String.fromCharCode(T>>10|55296,T&1023|56320))},gs=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ms=function(g,w){return w?g==="\0"?"\uFFFD":g.slice(0,-1)+"\\"+g.charCodeAt(g.length-1).toString(16)+" ":"\\"+g},vs=function(){L()},Xo=Ji(function(g){return g.disabled===!0&&g.nodeName.toLowerCase()==="fieldset"},{dir:"parentNode",next:"legend"});try{Zt.apply(lt=ds.call(me.childNodes),me.childNodes),lt[me.childNodes.length].nodeType}catch(g){Zt={apply:lt.length?function(w,T){xt.apply(w,ds.call(T))}:function(w,T){for(var M=w.length,P=0;w[M++]=T[P++];);w.length=M-1}}}function Re(g,w,T,M){var P,O,H,Q,J,ue,se,he=w&&w.ownerDocument,we=w?w.nodeType:9;if(T=T||[],typeof g!="string"||!g||we!==1&&we!==9&&we!==11)return T;if(!M&&(L(w),w=w||I,ve)){if(we!==11&&(J=Yo.exec(g)))if(P=J[1]){if(we===9)if(H=w.getElementById(P)){if(H.id===P)return T.push(H),T}else return T;else if(he&&(H=he.getElementById(P))&&ct(w,H)&&H.id===P)return T.push(H),T}else{if(J[2])return Zt.apply(T,w.getElementsByTagName(g)),T;if((P=J[3])&&n.getElementsByClassName&&w.getElementsByClassName)return Zt.apply(T,w.getElementsByClassName(P)),T}if(n.qsa&&!ft[g+" "]&&(!re||!re.test(g))&&(we!==1||w.nodeName.toLowerCase()!=="object")){if(se=g,he=w,we===1&&(Ho.test(g)||ps.test(g))){for(he=Zn.test(g)&&ta(w.parentNode)||w,(he!==w||!n.scope)&&((Q=w.getAttribute("id"))?Q=Q.replace(gs,ms):w.setAttribute("id",Q=Fe)),ue=h(g),O=ue.length;O--;)ue[O]=(Q?"#"+Q:":scope")+" "+Qi(ue[O]);se=ue.join(",")}try{if(n.cssSupportsSelector&&!CSS.supports("selector(:is("+se+"))"))throw new Error;return Zt.apply(T,he.querySelectorAll(se)),T}catch(Ie){ft(g,!0)}finally{Q===Fe&&w.removeAttribute("id")}}}return x(g.replace(Gi,"$1"),w,T,M)}function Xi(){var g=[];function w(T,M){return g.push(T+" ")>s.cacheLength&&delete w[g.shift()],w[T+" "]=M}return w}function Tt(g){return g[Fe]=!0,g}function wt(g){var w=I.createElement("fieldset");try{return!!g(w)}catch(T){return!1}finally{w.parentNode&&w.parentNode.removeChild(w),w=null}}function ea(g,w){for(var T=g.split("|"),M=T.length;M--;)s.attrHandle[T[M]]=w}function bs(g,w){var T=w&&g,M=T&&g.nodeType===1&&w.nodeType===1&&g.sourceIndex-w.sourceIndex;if(M)return M;if(T){for(;T=T.nextSibling;)if(T===w)return-1}return g?1:-1}function Qo(g){return function(w){var T=w.nodeName.toLowerCase();return T==="input"&&w.type===g}}function Jo(g){return function(w){var T=w.nodeName.toLowerCase();return(T==="input"||T==="button")&&w.type===g}}function ys(g){return function(w){return"form"in w?w.parentNode&&w.disabled===!1?"label"in w?"label"in w.parentNode?w.parentNode.disabled===g:w.disabled===g:w.isDisabled===g||w.isDisabled!==!g&&Xo(w)===g:w.disabled===g:"label"in w?w.disabled===g:!1}}function pr(g){return Tt(function(w){return w=+w,Tt(function(T,M){for(var P,O=g([],T.length,w),H=O.length;H--;)T[P=O[H]]&&(T[P]=!(M[P]=T[P]))})})}function ta(g){return g&&typeof g.getElementsByTagName!="undefined"&&g}n=Re.support={},f=Re.isXML=function(g){var w=g&&g.namespaceURI,T=g&&(g.ownerDocument||g).documentElement;return!qo.test(w||T&&T.nodeName||"HTML")},L=Re.setDocument=function(g){var w,T,M=g?g.ownerDocument||g:me;return M==I||M.nodeType!==9||!M.documentElement||(I=M,ne=I.documentElement,ve=!f(I),me!=I&&(T=I.defaultView)&&T.top!==T&&(T.addEventListener?T.addEventListener("unload",vs,!1):T.attachEvent&&T.attachEvent("onunload",vs)),n.scope=wt(function(P){return ne.appendChild(P).appendChild(I.createElement("div")),typeof P.querySelectorAll!="undefined"&&!P.querySelectorAll(":scope fieldset div").length}),n.cssSupportsSelector=wt(function(){return CSS.supports("selector(*)")&&I.querySelectorAll(":is(:jqfake)")&&!CSS.supports("selector(:is(*,:jqfake))")}),n.attributes=wt(function(P){return P.className="i",!P.getAttribute("className")}),n.getElementsByTagName=wt(function(P){return P.appendChild(I.createComment("")),!P.getElementsByTagName("*").length}),n.getElementsByClassName=ii.test(I.getElementsByClassName),n.getById=wt(function(P){return ne.appendChild(P).id=Fe,!I.getElementsByName||!I.getElementsByName(Fe).length}),n.getById?(s.filter.ID=function(P){var O=P.replace(Bt,Ht);return function(H){return H.getAttribute("id")===O}},s.find.ID=function(P,O){if(typeof O.getElementById!="undefined"&&ve){var H=O.getElementById(P);return H?[H]:[]}}):(s.filter.ID=function(P){var O=P.replace(Bt,Ht);return function(H){var Q=typeof H.getAttributeNode!="undefined"&&H.getAttributeNode("id");return Q&&Q.value===O}},s.find.ID=function(P,O){if(typeof O.getElementById!="undefined"&&ve){var H,Q,J,ue=O.getElementById(P);if(ue){if(H=ue.getAttributeNode("id"),H&&H.value===P)return[ue];for(J=O.getElementsByName(P),Q=0;ue=J[Q++];)if(H=ue.getAttributeNode("id"),H&&H.value===P)return[ue]}return[]}}),s.find.TAG=n.getElementsByTagName?function(P,O){if(typeof O.getElementsByTagName!="undefined")return O.getElementsByTagName(P);if(n.qsa)return O.querySelectorAll(P)}:function(P,O){var H,Q=[],J=0,ue=O.getElementsByTagName(P);if(P==="*"){for(;H=ue[J++];)H.nodeType===1&&Q.push(H);return Q}return ue},s.find.CLASS=n.getElementsByClassName&&function(P,O){if(typeof O.getElementsByClassName!="undefined"&&ve)return O.getElementsByClassName(P)},ze=[],re=[],(n.qsa=ii.test(I.querySelectorAll))&&(wt(function(P){var O;ne.appendChild(P).innerHTML="",P.querySelectorAll("[msallowcapture^='']").length&&re.push("[*^$]="+Ae+`*(?:''|"")`),P.querySelectorAll("[selected]").length||re.push("\\["+Ae+"*(?:value|"+Jn+")"),P.querySelectorAll("[id~="+Fe+"-]").length||re.push("~="),O=I.createElement("input"),O.setAttribute("name",""),P.appendChild(O),P.querySelectorAll("[name='']").length||re.push("\\["+Ae+"*name"+Ae+"*="+Ae+`*(?:''|"")`),P.querySelectorAll(":checked").length||re.push(":checked"),P.querySelectorAll("a#"+Fe+"+*").length||re.push(".#.+[+~]"),P.querySelectorAll("\\\f"),re.push("[\\r\\n\\f]")}),wt(function(P){P.innerHTML="";var O=I.createElement("input");O.setAttribute("type","hidden"),P.appendChild(O).setAttribute("name","D"),P.querySelectorAll("[name=d]").length&&re.push("name"+Ae+"*[*^$|!~]?="),P.querySelectorAll(":enabled").length!==2&&re.push(":enabled",":disabled"),ne.appendChild(P).disabled=!0,P.querySelectorAll(":disabled").length!==2&&re.push(":enabled",":disabled"),P.querySelectorAll("*,:x"),re.push(",.*:")})),(n.matchesSelector=ii.test(Ue=ne.matches||ne.webkitMatchesSelector||ne.mozMatchesSelector||ne.oMatchesSelector||ne.msMatchesSelector))&&wt(function(P){n.disconnectedMatch=Ue.call(P,"*"),Ue.call(P,"[s!='']:x"),ze.push("!=",Kn)}),n.cssSupportsSelector||re.push(":has"),re=re.length&&new RegExp(re.join("|")),ze=ze.length&&new RegExp(ze.join("|")),w=ii.test(ne.compareDocumentPosition),ct=w||ii.test(ne.contains)?function(P,O){var H=P.nodeType===9&&P.documentElement||P,Q=O&&O.parentNode;return P===Q||!!(Q&&Q.nodeType===1&&(H.contains?H.contains(Q):P.compareDocumentPosition&&P.compareDocumentPosition(Q)&16))}:function(P,O){if(O){for(;O=O.parentNode;)if(O===P)return!0}return!1},cr=w?function(P,O){if(P===O)return B=!0,0;var H=!P.compareDocumentPosition-!O.compareDocumentPosition;return H||(H=(P.ownerDocument||P)==(O.ownerDocument||O)?P.compareDocumentPosition(O):1,H&1||!n.sortDetached&&O.compareDocumentPosition(P)===H?P==I||P.ownerDocument==me&&ct(me,P)?-1:O==I||O.ownerDocument==me&&ct(me,O)?1:R?dr(R,P)-dr(R,O):0:H&4?-1:1)}:function(P,O){if(P===O)return B=!0,0;var H,Q=0,J=P.parentNode,ue=O.parentNode,se=[P],he=[O];if(!J||!ue)return P==I?-1:O==I?1:J?-1:ue?1:R?dr(R,P)-dr(R,O):0;if(J===ue)return bs(P,O);for(H=P;H=H.parentNode;)se.unshift(H);for(H=O;H=H.parentNode;)he.unshift(H);for(;se[Q]===he[Q];)Q++;return Q?bs(se[Q],he[Q]):se[Q]==me?-1:he[Q]==me?1:0}),I},Re.matches=function(g,w){return Re(g,null,null,w)},Re.matchesSelector=function(g,w){if(L(g),n.matchesSelector&&ve&&!ft[w+" "]&&(!ze||!ze.test(w))&&(!re||!re.test(w)))try{var T=Ue.call(g,w);if(T||n.disconnectedMatch||g.document&&g.document.nodeType!==11)return T}catch(M){ft(w,!0)}return Re(w,I,null,[g]).length>0},Re.contains=function(g,w){return(g.ownerDocument||g)!=I&&L(g),ct(g,w)},Re.attr=function(g,w){(g.ownerDocument||g)!=I&&L(g);var T=s.attrHandle[w.toLowerCase()],M=T&&fr.call(s.attrHandle,w.toLowerCase())?T(g,w,!ve):void 0;return M!==void 0?M:n.attributes||!ve?g.getAttribute(w):(M=g.getAttributeNode(w))&&M.specified?M.value:null},Re.escape=function(g){return(g+"").replace(gs,ms)},Re.error=function(g){throw new Error("Syntax error, unrecognized expression: "+g)},Re.uniqueSort=function(g){var w,T=[],M=0,P=0;if(B=!n.detectDuplicates,R=!n.sortStable&&g.slice(0),g.sort(cr),B){for(;w=g[P++];)w===g[P]&&(M=T.push(P));for(;M--;)g.splice(T[M],1)}return R=null,g},c=Re.getText=function(g){var w,T="",M=0,P=g.nodeType;if(P){if(P===1||P===9||P===11){if(typeof g.textContent=="string")return g.textContent;for(g=g.firstChild;g;g=g.nextSibling)T+=c(g)}else if(P===3||P===4)return g.nodeValue}else for(;w=g[M++];)T+=c(w);return T},s=Re.selectors={cacheLength:50,createPseudo:Tt,match:Yi,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(g){return g[1]=g[1].replace(Bt,Ht),g[3]=(g[3]||g[4]||g[5]||"").replace(Bt,Ht),g[2]==="~="&&(g[3]=" "+g[3]+" "),g.slice(0,4)},CHILD:function(g){return g[1]=g[1].toLowerCase(),g[1].slice(0,3)==="nth"?(g[3]||Re.error(g[0]),g[4]=+(g[4]?g[5]+(g[6]||1):2*(g[3]==="even"||g[3]==="odd")),g[5]=+(g[7]+g[8]||g[3]==="odd")):g[3]&&Re.error(g[0]),g},PSEUDO:function(g){var w,T=!g[6]&&g[2];return Yi.CHILD.test(g[0])?null:(g[3]?g[2]=g[4]||g[5]||"":T&&Uo.test(T)&&(w=h(T,!0))&&(w=T.indexOf(")",T.length-w)-T.length)&&(g[0]=g[0].slice(0,w),g[2]=T.slice(0,w)),g.slice(0,3))}},filter:{TAG:function(g){var w=g.replace(Bt,Ht).toLowerCase();return g==="*"?function(){return!0}:function(T){return T.nodeName&&T.nodeName.toLowerCase()===w}},CLASS:function(g){var w=je[g+" "];return w||(w=new RegExp("(^|"+Ae+")"+g+"("+Ae+"|$)"))&&je(g,function(T){return w.test(typeof T.className=="string"&&T.className||typeof T.getAttribute!="undefined"&&T.getAttribute("class")||"")})},ATTR:function(g,w,T){return function(M){var P=Re.attr(M,g);return P==null?w==="!=":w?(P+="",w==="="?P===T:w==="!="?P!==T:w==="^="?T&&P.indexOf(T)===0:w==="*="?T&&P.indexOf(T)>-1:w==="$="?T&&P.slice(-T.length)===T:w==="~="?(" "+P.replace(jo," ")+" ").indexOf(T)>-1:w==="|="?P===T||P.slice(0,T.length+1)===T+"-":!1):!0}},CHILD:function(g,w,T,M,P){var O=g.slice(0,3)!=="nth",H=g.slice(-4)!=="last",Q=w==="of-type";return M===1&&P===0?function(J){return!!J.parentNode}:function(J,ue,se){var he,we,Ie,ce,qe,et,dt=O!==H?"nextSibling":"previousSibling",Ne=J.parentNode,ni=Q&&J.nodeName.toLowerCase(),ai=!se&&!Q,ht=!1;if(Ne){if(O){for(;dt;){for(ce=J;ce=ce[dt];)if(Q?ce.nodeName.toLowerCase()===ni:ce.nodeType===1)return!1;et=dt=g==="only"&&!et&&"nextSibling"}return!0}if(et=[H?Ne.firstChild:Ne.lastChild],H&&ai){for(ce=Ne,Ie=ce[Fe]||(ce[Fe]={}),we=Ie[ce.uniqueID]||(Ie[ce.uniqueID]={}),he=we[g]||[],qe=he[0]===ot&&he[1],ht=qe&&he[2],ce=qe&&Ne.childNodes[qe];ce=++qe&&ce&&ce[dt]||(ht=qe=0)||et.pop();)if(ce.nodeType===1&&++ht&&ce===J){we[g]=[ot,qe,ht];break}}else if(ai&&(ce=J,Ie=ce[Fe]||(ce[Fe]={}),we=Ie[ce.uniqueID]||(Ie[ce.uniqueID]={}),he=we[g]||[],qe=he[0]===ot&&he[1],ht=qe),ht===!1)for(;(ce=++qe&&ce&&ce[dt]||(ht=qe=0)||et.pop())&&!((Q?ce.nodeName.toLowerCase()===ni:ce.nodeType===1)&&++ht&&(ai&&(Ie=ce[Fe]||(ce[Fe]={}),we=Ie[ce.uniqueID]||(Ie[ce.uniqueID]={}),we[g]=[ot,ht]),ce===J)););return ht-=P,ht===M||ht%M==0&&ht/M>=0}}},PSEUDO:function(g,w){var T,M=s.pseudos[g]||s.setFilters[g.toLowerCase()]||Re.error("unsupported pseudo: "+g);return M[Fe]?M(w):M.length>1?(T=[g,g,"",w],s.setFilters.hasOwnProperty(g.toLowerCase())?Tt(function(P,O){for(var H,Q=M(P,w),J=Q.length;J--;)H=dr(P,Q[J]),P[H]=!(O[H]=Q[J])}):function(P){return M(P,0,T)}):M}},pseudos:{not:Tt(function(g){var w=[],T=[],M=E(g.replace(Gi,"$1"));return M[Fe]?Tt(function(P,O,H,Q){for(var J,ue=M(P,null,Q,[]),se=P.length;se--;)(J=ue[se])&&(P[se]=!(O[se]=J))}):function(P,O,H){return w[0]=P,M(w,null,H,T),w[0]=null,!T.pop()}}),has:Tt(function(g){return function(w){return Re(g,w).length>0}}),contains:Tt(function(g){return g=g.replace(Bt,Ht),function(w){return(w.textContent||c(w)).indexOf(g)>-1}}),lang:Tt(function(g){return zo.test(g||"")||Re.error("unsupported lang: "+g),g=g.replace(Bt,Ht).toLowerCase(),function(w){var T;do if(T=ve?w.lang:w.getAttribute("xml:lang")||w.getAttribute("lang"))return T=T.toLowerCase(),T===g||T.indexOf(g+"-")===0;while((w=w.parentNode)&&w.nodeType===1);return!1}}),target:function(g){var w=e.location&&e.location.hash;return w&&w.slice(1)===g.id},root:function(g){return g===ne},focus:function(g){return g===I.activeElement&&(!I.hasFocus||I.hasFocus())&&!!(g.type||g.href||~g.tabIndex)},enabled:ys(!1),disabled:ys(!0),checked:function(g){var w=g.nodeName.toLowerCase();return w==="input"&&!!g.checked||w==="option"&&!!g.selected},selected:function(g){return g.parentNode&&g.parentNode.selectedIndex,g.selected===!0},empty:function(g){for(g=g.firstChild;g;g=g.nextSibling)if(g.nodeType<6)return!1;return!0},parent:function(g){return!s.pseudos.empty(g)},header:function(g){return Go.test(g.nodeName)},input:function(g){return Vo.test(g.nodeName)},button:function(g){var w=g.nodeName.toLowerCase();return w==="input"&&g.type==="button"||w==="button"},text:function(g){var w;return g.nodeName.toLowerCase()==="input"&&g.type==="text"&&((w=g.getAttribute("type"))==null||w.toLowerCase()==="text")},first:pr(function(){return[0]}),last:pr(function(g,w){return[w-1]}),eq:pr(function(g,w,T){return[T<0?T+w:T]}),even:pr(function(g,w){for(var T=0;Tw?w:T;--M>=0;)g.push(M);return g}),gt:pr(function(g,w,T){for(var M=T<0?T+w:T;++M1?function(w,T,M){for(var P=g.length;P--;)if(!g[P](w,T,M))return!1;return!0}:g[0]}function Ko(g,w,T){for(var M=0,P=w.length;M-1&&(H[se]=!(Q[se]=we))}}else Ne=Ki(Ne===Q?Ne.splice(qe,Ne.length):Ne),P?P(null,Q,Ne,ue):Zt.apply(Q,Ne)})}function na(g){for(var w,T,M,P=g.length,O=s.relative[g[0].type],H=O||s.relative[" "],Q=O?1:0,J=Ji(function(he){return he===w},H,!0),ue=Ji(function(he){return dr(w,he)>-1},H,!0),se=[function(he,we,Ie){var ce=!O&&(Ie||we!==F)||((w=we).nodeType?J(he,we,Ie):ue(he,we,Ie));return w=null,ce}];Q1&&ra(se),Q>1&&Qi(g.slice(0,Q-1).concat({value:g[Q-2].type===" "?"*":""})).replace(Gi,"$1"),T,Q0,M=g.length>0,P=function(O,H,Q,J,ue){var se,he,we,Ie=0,ce="0",qe=O&&[],et=[],dt=F,Ne=O||M&&s.find.TAG("*",ue),ni=ot+=dt==null?1:Math.random()||.1,ai=Ne.length;for(ue&&(F=H==I||H||ue);ce!==ai&&(se=Ne[ce])!=null;ce++){if(M&&se){for(he=0,!H&&se.ownerDocument!=I&&(L(se),Q=!ve);we=g[he++];)if(we(se,H||I,Q)){J.push(se);break}ue&&(ot=ni)}T&&((se=!we&&se)&&Ie--,O&&qe.push(se))}if(Ie+=ce,T&&ce!==Ie){for(he=0;we=w[he++];)we(qe,et,H,Q);if(O){if(Ie>0)for(;ce--;)qe[ce]||et[ce]||(et[ce]=Kt.call(J));et=Ki(et)}Zt.apply(J,et),ue&&!O&&et.length>0&&Ie+w.length>1&&Re.uniqueSort(J)}return ue&&(ot=ni,F=dt),qe};return T?Tt(P):P}return E=Re.compile=function(g,w){var T,M=[],P=[],O=Vi[g+" "];if(!O){for(w||(w=h(g)),T=w.length;T--;)O=na(w[T]),O[Fe]?M.push(O):P.push(O);O=Vi(g,Zo(P,M)),O.selector=g}return O},x=Re.select=function(g,w,T,M){var P,O,H,Q,J,ue=typeof g=="function"&&g,se=!M&&h(g=ue.selector||g);if(T=T||[],se.length===1){if(O=se[0]=se[0].slice(0),O.length>2&&(H=O[0]).type==="ID"&&w.nodeType===9&&ve&&s.relative[O[1].type]){if(w=(s.find.ID(H.matches[0].replace(Bt,Ht),w)||[])[0],w)ue&&(w=w.parentNode);else return T;g=g.slice(O.shift().value.length)}for(P=Yi.needsContext.test(g)?0:O.length;P--&&(H=O[P],!s.relative[Q=H.type]);)if((J=s.find[Q])&&(M=J(H.matches[0].replace(Bt,Ht),Zn.test(O[0].type)&&ta(w.parentNode)||w))){if(O.splice(P,1),g=M.length&&Qi(O),!g)return Zt.apply(T,M),T;break}}return(ue||E(g,se))(M,w,!ve,T,!w||Zn.test(g)&&ta(w.parentNode)||w),T},n.sortStable=Fe.split("").sort(cr).join("")===Fe,n.detectDuplicates=!!B,L(),n.sortDetached=wt(function(g){return g.compareDocumentPosition(I.createElement("fieldset"))&1}),wt(function(g){return g.innerHTML="",g.firstChild.getAttribute("href")==="#"})||ea("type|href|height|width",function(g,w,T){if(!T)return g.getAttribute(w,w.toLowerCase()==="type"?1:2)}),(!n.attributes||!wt(function(g){return g.innerHTML="",g.firstChild.setAttribute("value",""),g.firstChild.getAttribute("value")===""}))&&ea("value",function(g,w,T){if(!T&&g.nodeName.toLowerCase()==="input")return g.defaultValue}),wt(function(g){return g.getAttribute("disabled")==null})||ea(Jn,function(g,w,T){var M;if(!T)return g[w]===!0?w.toLowerCase():(M=g.getAttributeNode(w))&&M.specified?M.value:null}),Re}(l);o.find=ae,o.expr=ae.selectors,o.expr[":"]=o.expr.pseudos,o.uniqueSort=o.unique=ae.uniqueSort,o.text=ae.getText,o.isXMLDoc=ae.isXML,o.contains=ae.contains,o.escapeSelector=ae.escape;var oe=function(e,r,n){for(var s=[],c=n!==void 0;(e=e[r])&&e.nodeType!==9;)if(e.nodeType===1){if(c&&o(e).is(n))break;s.push(e)}return s},_e=function(e,r){for(var n=[];e;e=e.nextSibling)e.nodeType===1&&e!==r&&n.push(e);return n},He=o.expr.match.needsContext;function Me(e,r){return e.nodeName&&e.nodeName.toLowerCase()===r.toLowerCase()}var tt=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function Qe(e,r,n){return q(r)?o.grep(e,function(s,c){return!!r.call(s,c,s)!==n}):r.nodeType?o.grep(e,function(s){return s===r!==n}):typeof r!="string"?o.grep(e,function(s){return y.call(r,s)>-1!==n}):o.filter(r,e,n)}o.filter=function(e,r,n){var s=r[0];return n&&(e=":not("+e+")"),r.length===1&&s.nodeType===1?o.find.matchesSelector(s,e)?[s]:[]:o.find.matches(e,o.grep(r,function(c){return c.nodeType===1}))},o.fn.extend({find:function(e){var r,n,s=this.length,c=this;if(typeof e!="string")return this.pushStack(o(e).filter(function(){for(r=0;r1?o.uniqueSort(n):n},filter:function(e){return this.pushStack(Qe(this,e||[],!1))},not:function(e){return this.pushStack(Qe(this,e||[],!0))},is:function(e){return!!Qe(this,typeof e=="string"&&He.test(e)?o(e):e||[],!1).length}});var mt,rr=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,wr=o.fn.init=function(e,r,n){var s,c;if(!e)return this;if(n=n||mt,typeof e=="string")if(e[0]==="<"&&e[e.length-1]===">"&&e.length>=3?s=[null,e,null]:s=rr.exec(e),s&&(s[1]||!r))if(s[1]){if(r=r instanceof o?r[0]:r,o.merge(this,o.parseHTML(s[1],r&&r.nodeType?r.ownerDocument||r:K,!0)),tt.test(s[1])&&o.isPlainObject(r))for(s in r)q(this[s])?this[s](r[s]):this.attr(s,r[s]);return this}else return c=K.getElementById(s[2]),c&&(this[0]=c,this.length=1),this;else return!r||r.jquery?(r||n).find(e):this.constructor(r).find(e);else{if(e.nodeType)return this[0]=e,this.length=1,this;if(q(e))return n.ready!==void 0?n.ready(e):e(o)}return o.makeArray(e,this)};wr.prototype=o.fn,mt=o(K);var Ir=/^(?:parents|prev(?:Until|All))/,Yt={children:!0,contents:!0,next:!0,prev:!0};o.fn.extend({has:function(e){var r=o(e,this),n=r.length;return this.filter(function(){for(var s=0;s-1:n.nodeType===1&&o.find.matchesSelector(n,e))){f.push(n);break}}return this.pushStack(f.length>1?o.uniqueSort(f):f)},index:function(e){return e?typeof e=="string"?y.call(o(e),this[0]):y.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,r){return this.pushStack(o.uniqueSort(o.merge(this.get(),o(e,r))))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}});function Mr(e,r){for(;(e=e[r])&&e.nodeType!==1;);return e}o.each({parent:function(e){var r=e.parentNode;return r&&r.nodeType!==11?r:null},parents:function(e){return oe(e,"parentNode")},parentsUntil:function(e,r,n){return oe(e,"parentNode",n)},next:function(e){return Mr(e,"nextSibling")},prev:function(e){return Mr(e,"previousSibling")},nextAll:function(e){return oe(e,"nextSibling")},prevAll:function(e){return oe(e,"previousSibling")},nextUntil:function(e,r,n){return oe(e,"nextSibling",n)},prevUntil:function(e,r,n){return oe(e,"previousSibling",n)},siblings:function(e){return _e((e.parentNode||{}).firstChild,e)},children:function(e){return _e(e.firstChild)},contents:function(e){return e.contentDocument!=null&&a(e.contentDocument)?e.contentDocument:(Me(e,"template")&&(e=e.content||e),o.merge([],e.childNodes))}},function(e,r){o.fn[e]=function(n,s){var c=o.map(this,r,n);return e.slice(-5)!=="Until"&&(s=n),s&&typeof s=="string"&&(c=o.filter(s,c)),this.length>1&&(Yt[e]||o.uniqueSort(c),Ir.test(e)&&c.reverse()),this.pushStack(c)}});var vt=/[^\x20\t\r\n\f]+/g;function An(e){var r={};return o.each(e.match(vt)||[],function(n,s){r[s]=!0}),r}o.Callbacks=function(e){e=typeof e=="string"?An(e):o.extend({},e);var r,n,s,c,f=[],h=[],E=-1,x=function(){for(c=c||e.once,s=r=!0;h.length;E=-1)for(n=h.shift();++E-1;)f.splice(L,1),L<=E&&E--}),this},has:function(R){return R?o.inArray(R,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return c=h=[],f=n="",this},disabled:function(){return!f},lock:function(){return c=h=[],!n&&!r&&(f=n=""),this},locked:function(){return!!c},fireWith:function(R,B){return c||(B=B||[],B=[R,B.slice?B.slice():B],h.push(B),r||x()),this},fire:function(){return F.fireWith(this,arguments),this},fired:function(){return!!s}};return F};function Je(e){return e}function ir(e){throw e}function Pi(e,r,n,s){var c;try{e&&q(c=e.promise)?c.call(e).done(r).fail(n):e&&q(c=e.then)?c.call(e,r,n):r.apply(void 0,[e].slice(s))}catch(f){n.apply(void 0,[f])}}o.extend({Deferred:function(e){var r=[["notify","progress",o.Callbacks("memory"),o.Callbacks("memory"),2],["resolve","done",o.Callbacks("once memory"),o.Callbacks("once memory"),0,"resolved"],["reject","fail",o.Callbacks("once memory"),o.Callbacks("once memory"),1,"rejected"]],n="pending",s={state:function(){return n},always:function(){return c.done(arguments).fail(arguments),this},catch:function(f){return s.then(null,f)},pipe:function(){var f=arguments;return o.Deferred(function(h){o.each(r,function(E,x){var F=q(f[x[4]])&&f[x[4]];c[x[1]](function(){var R=F&&F.apply(this,arguments);R&&q(R.promise)?R.promise().progress(h.notify).done(h.resolve).fail(h.reject):h[x[0]+"With"](this,F?[R]:arguments)})}),f=null}).promise()},then:function(f,h,E){var x=0;function F(R,B,L,I){return function(){var ne=this,ve=arguments,re=function(){var Ue,ct;if(!(R=x&&(L!==ir&&(ne=void 0,ve=[Ue]),B.rejectWith(ne,ve))}};R?ze():(o.Deferred.getStackHook&&(ze.stackTrace=o.Deferred.getStackHook()),l.setTimeout(ze))}}return o.Deferred(function(R){r[0][3].add(F(0,R,q(E)?E:Je,R.notifyWith)),r[1][3].add(F(0,R,q(f)?f:Je)),r[2][3].add(F(0,R,q(h)?h:ir))}).promise()},promise:function(f){return f!=null?o.extend(f,s):s}},c={};return o.each(r,function(f,h){var E=h[2],x=h[5];s[h[1]]=E.add,x&&E.add(function(){n=x},r[3-f][2].disable,r[3-f][3].disable,r[0][2].lock,r[0][3].lock),E.add(h[3].fire),c[h[0]]=function(){return c[h[0]+"With"](this===c?void 0:this,arguments),this},c[h[0]+"With"]=E.fireWith}),s.promise(c),e&&e.call(c,c),c},when:function(e){var r=arguments.length,n=r,s=Array(n),c=u.call(arguments),f=o.Deferred(),h=function(E){return function(x){s[E]=this,c[E]=arguments.length>1?u.call(arguments):x,--r||f.resolveWith(s,c)}};if(r<=1&&(Pi(e,f.done(h(n)).resolve,f.reject,!r),f.state()==="pending"||q(c[n]&&c[n].then)))return f.then();for(;n--;)Pi(c[n],h(n),f.reject);return f.promise()}});var Fn=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;o.Deferred.exceptionHook=function(e,r){l.console&&l.console.warn&&e&&Fn.test(e.name)&&l.console.warn("jQuery.Deferred exception: "+e.message,e.stack,r)},o.readyException=function(e){l.setTimeout(function(){throw e})};var Nr=o.Deferred();o.fn.ready=function(e){return Nr.then(e).catch(function(r){o.readyException(r)}),this},o.extend({isReady:!1,readyWait:1,ready:function(e){(e===!0?--o.readyWait:o.isReady)||(o.isReady=!0,!(e!==!0&&--o.readyWait>0)&&Nr.resolveWith(K,[o]))}}),o.ready.then=Nr.then;function Er(){K.removeEventListener("DOMContentLoaded",Er),l.removeEventListener("load",Er),o.ready()}K.readyState==="complete"||K.readyState!=="loading"&&!K.documentElement.doScroll?l.setTimeout(o.ready):(K.addEventListener("DOMContentLoaded",Er),l.addEventListener("load",Er));var _t=function(e,r,n,s,c,f,h){var E=0,x=e.length,F=n==null;if(be(n)==="object"){c=!0;for(E in n)_t(e,r,E,n[E],!0,f,h)}else if(s!==void 0&&(c=!0,q(s)||(h=!0),F&&(h?(r.call(e,s),r=null):(F=r,r=function(R,B,L){return F.call(o(R),L)})),r))for(;E1,null,!0)},removeData:function(e){return this.each(function(){$e.remove(this,e)})}}),o.extend({queue:function(e,r,n){var s;if(e)return r=(r||"fx")+"queue",s=le.get(e,r),n&&(!s||Array.isArray(n)?s=le.access(e,r,o.makeArray(n)):s.push(n)),s||[]},dequeue:function(e,r){r=r||"fx";var n=o.queue(e,r),s=n.length,c=n.shift(),f=o._queueHooks(e,r),h=function(){o.dequeue(e,r)};c==="inprogress"&&(c=n.shift(),s--),c&&(r==="fx"&&n.unshift("inprogress"),delete f.stop,c.call(e,h,f)),!s&&f&&f.empty.fire()},_queueHooks:function(e,r){var n=r+"queueHooks";return le.get(e,n)||le.access(e,n,{empty:o.Callbacks("once memory").add(function(){le.remove(e,[r+"queue",n])})})}}),o.fn.extend({queue:function(e,r){var n=2;return typeof e!="string"&&(r=e,e="fx",n--),arguments.length\x20\t\r\n\f]*)/i,jr=/^$|^module$|\/(?:java|ecma)script/i;(function(){var e=K.createDocumentFragment(),r=e.appendChild(K.createElement("div")),n=K.createElement("input");n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),r.appendChild(n),U.checkClone=r.cloneNode(!0).cloneNode(!0).lastChild.checked,r.innerHTML="",U.noCloneChecked=!!r.cloneNode(!0).lastChild.defaultValue,r.innerHTML="",U.option=!!r.lastChild})();var Ke={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};Ke.tbody=Ke.tfoot=Ke.colgroup=Ke.caption=Ke.thead,Ke.th=Ke.td,U.option||(Ke.optgroup=Ke.option=[1,""]);function Ze(e,r){var n;return typeof e.getElementsByTagName!="undefined"?n=e.getElementsByTagName(r||"*"):typeof e.querySelectorAll!="undefined"?n=e.querySelectorAll(r||"*"):n=[],r===void 0||r&&Me(e,r)?o.merge([e],n):n}function Br(e,r){for(var n=0,s=e.length;n-1){c&&c.push(f);continue}if(F=Nt(f),h=Ze(B.appendChild(f),"script"),F&&Br(h),n)for(R=0;f=h[R++];)jr.test(f.type||"")&&n.push(f)}return B}var Li=/^([^.]*)(?:\.(.+)|)/;function rt(){return!0}function Qt(){return!1}function Mn(e,r){return e===Ri()==(r==="focus")}function Ri(){try{return K.activeElement}catch(e){}}function zr(e,r,n,s,c,f){var h,E;if(typeof r=="object"){typeof n!="string"&&(s=s||n,n=void 0);for(E in r)zr(e,E,n,s,r[E],f);return e}if(s==null&&c==null?(c=n,s=n=void 0):c==null&&(typeof n=="string"?(c=s,s=void 0):(c=s,s=n,n=void 0)),c===!1)c=Qt;else if(!c)return e;return f===1&&(h=c,c=function(x){return o().off(x),h.apply(this,arguments)},c.guid=h.guid||(h.guid=o.guid++)),e.each(function(){o.event.add(this,r,c,s,n)})}o.event={global:{},add:function(e,r,n,s,c){var f,h,E,x,F,R,B,L,I,ne,ve,re=le.get(e);if(!!nr(e))for(n.handler&&(f=n,n=f.handler,c=f.selector),c&&o.find.matchesSelector(At,c),n.guid||(n.guid=o.guid++),(x=re.events)||(x=re.events=Object.create(null)),(h=re.handle)||(h=re.handle=function(ze){return typeof o!="undefined"&&o.event.triggered!==ze.type?o.event.dispatch.apply(e,arguments):void 0}),r=(r||"").match(vt)||[""],F=r.length;F--;)E=Li.exec(r[F])||[],I=ve=E[1],ne=(E[2]||"").split(".").sort(),!!I&&(B=o.event.special[I]||{},I=(c?B.delegateType:B.bindType)||I,B=o.event.special[I]||{},R=o.extend({type:I,origType:ve,data:s,handler:n,guid:n.guid,selector:c,needsContext:c&&o.expr.match.needsContext.test(c),namespace:ne.join(".")},f),(L=x[I])||(L=x[I]=[],L.delegateCount=0,(!B.setup||B.setup.call(e,s,ne,h)===!1)&&e.addEventListener&&e.addEventListener(I,h)),B.add&&(B.add.call(e,R),R.handler.guid||(R.handler.guid=n.guid)),c?L.splice(L.delegateCount++,0,R):L.push(R),o.event.global[I]=!0)},remove:function(e,r,n,s,c){var f,h,E,x,F,R,B,L,I,ne,ve,re=le.hasData(e)&&le.get(e);if(!(!re||!(x=re.events))){for(r=(r||"").match(vt)||[""],F=r.length;F--;){if(E=Li.exec(r[F])||[],I=ve=E[1],ne=(E[2]||"").split(".").sort(),!I){for(I in x)o.event.remove(e,I+r[F],n,s,!0);continue}for(B=o.event.special[I]||{},I=(s?B.delegateType:B.bindType)||I,L=x[I]||[],E=E[2]&&new RegExp("(^|\\.)"+ne.join("\\.(?:.*\\.|)")+"(\\.|$)"),h=f=L.length;f--;)R=L[f],(c||ve===R.origType)&&(!n||n.guid===R.guid)&&(!E||E.test(R.namespace))&&(!s||s===R.selector||s==="**"&&R.selector)&&(L.splice(f,1),R.selector&&L.delegateCount--,B.remove&&B.remove.call(e,R));h&&!L.length&&((!B.teardown||B.teardown.call(e,ne,re.handle)===!1)&&o.removeEvent(e,I,re.handle),delete x[I])}o.isEmptyObject(x)&&le.remove(e,"handle events")}},dispatch:function(e){var r,n,s,c,f,h,E=new Array(arguments.length),x=o.event.fix(e),F=(le.get(this,"events")||Object.create(null))[x.type]||[],R=o.event.special[x.type]||{};for(E[0]=x,r=1;r=1)){for(;F!==this;F=F.parentNode||this)if(F.nodeType===1&&!(e.type==="click"&&F.disabled===!0)){for(f=[],h={},n=0;n-1:o.find(c,this,null,[F]).length),h[c]&&f.push(s);f.length&&E.push({elem:F,handlers:f})}}return F=this,x\s*$/g;function Ii(e,r){return Me(e,"table")&&Me(r.nodeType!==11?r:r.firstChild,"tr")&&o(e).children("tbody")[0]||e}function Wn(e){return e.type=(e.getAttribute("type")!==null)+"/"+e.type,e}function jn(e){return(e.type||"").slice(0,5)==="true/"?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Mi(e,r){var n,s,c,f,h,E,x;if(r.nodeType===1){if(le.hasData(e)&&(f=le.get(e),x=f.events,x)){le.remove(r,"handle events");for(c in x)for(n=0,s=x[c].length;n1&&typeof I=="string"&&!U.checkClone&&On.test(I))return e.each(function(ve){var re=e.eq(ve);ne&&(r[0]=I.call(this,ve,re.html())),$t(re,r,n,s)});if(B&&(c=Ur(r,e[0].ownerDocument,!1,e,s),f=c.firstChild,c.childNodes.length===1&&(c=f),f||s)){for(h=o.map(Ze(c,"script"),Wn),E=h.length;R0&&Br(h,!x&&Ze(e,"script")),E},cleanData:function(e){for(var r,n,s,c=o.event.special,f=0;(n=e[f])!==void 0;f++)if(nr(n)){if(r=n[le.expando]){if(r.events)for(s in r.events)c[s]?o.event.remove(n,s):o.removeEvent(n,s,r.handle);n[le.expando]=void 0}n[$e.expando]&&(n[$e.expando]=void 0)}}}),o.fn.extend({detach:function(e){return Ni(this,e,!0)},remove:function(e){return Ni(this,e)},text:function(e){return _t(this,function(r){return r===void 0?o.text(this):this.empty().each(function(){(this.nodeType===1||this.nodeType===11||this.nodeType===9)&&(this.textContent=r)})},null,e,arguments.length)},append:function(){return $t(this,arguments,function(e){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var r=Ii(this,e);r.appendChild(e)}})},prepend:function(){return $t(this,arguments,function(e){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var r=Ii(this,e);r.insertBefore(e,r.firstChild)}})},before:function(){return $t(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return $t(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,r=0;(e=this[r])!=null;r++)e.nodeType===1&&(o.cleanData(Ze(e,!1)),e.textContent="");return this},clone:function(e,r){return e=e==null?!1:e,r=r==null?e:r,this.map(function(){return o.clone(this,e,r)})},html:function(e){return _t(this,function(r){var n=this[0]||{},s=0,c=this.length;if(r===void 0&&n.nodeType===1)return n.innerHTML;if(typeof r=="string"&&!Nn.test(r)&&!Ke[(Wr.exec(r)||["",""])[1].toLowerCase()]){r=o.htmlPrefilter(r);try{for(;s=0&&(x+=Math.max(0,Math.ceil(e["offset"+r[0].toUpperCase()+r.slice(1)]-f-x-E-.5))||0),x}function ur(e,r,n){var s=kr(e),c=!U.boxSizingReliable()||n,f=c&&o.css(e,"boxSizing",!1,s)==="border-box",h=f,E=or(e,r,s),x="offset"+r[0].toUpperCase()+r.slice(1);if(qr.test(E)){if(!n)return E;E="auto"}return(!U.boxSizingReliable()&&f||!U.reliableTrDimensions()&&Me(e,"tr")||E==="auto"||!parseFloat(E)&&o.css(e,"display",!1,s)==="inline")&&e.getClientRects().length&&(f=o.css(e,"boxSizing",!1,s)==="border-box",h=x in e,h&&(E=e[x])),E=parseFloat(E)||0,E+Xr(e,r,n||(f?"border":"content"),h,s,E)+"px"}o.extend({cssHooks:{opacity:{get:function(e,r){if(r){var n=or(e,"opacity");return n===""?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,r,n,s){if(!(!e||e.nodeType===3||e.nodeType===8||!e.style)){var c,f,h,E=bt(r),x=Vr.test(r),F=e.style;if(x||(r=Gr(E)),h=o.cssHooks[r]||o.cssHooks[E],n!==void 0){if(f=typeof n,f==="string"&&(c=Mt.exec(n))&&c[1]&&(n=Or(e,r,c),f="number"),n==null||n!==n)return;f==="number"&&!x&&(n+=c&&c[3]||(o.cssNumber[E]?"":"px")),!U.clearCloneStyle&&n===""&&r.indexOf("background")===0&&(F[r]="inherit"),(!h||!("set"in h)||(n=h.set(e,n,s))!==void 0)&&(x?F.setProperty(r,n):F[r]=n)}else return h&&"get"in h&&(c=h.get(e,!1,s))!==void 0?c:F[r]}},css:function(e,r,n,s){var c,f,h,E=bt(r),x=Vr.test(r);return x||(r=Gr(E)),h=o.cssHooks[r]||o.cssHooks[E],h&&"get"in h&&(c=h.get(e,!0,n)),c===void 0&&(c=or(e,r,s)),c==="normal"&&r in Yr&&(c=Yr[r]),n===""||n?(f=parseFloat(c),n===!0||isFinite(f)?f||0:c):c}}),o.each(["height","width"],function(e,r){o.cssHooks[r]={get:function(n,s,c){if(s)return Ui.test(o.css(n,"display"))&&(!n.getClientRects().length||!n.getBoundingClientRect().width)?Oi(n,lr,function(){return ur(n,r,c)}):ur(n,r,c)},set:function(n,s,c){var f,h=kr(n),E=!U.scrollboxSize()&&h.position==="absolute",x=E||c,F=x&&o.css(n,"boxSizing",!1,h)==="border-box",R=c?Xr(n,r,c,F,h):0;return F&&E&&(R-=Math.ceil(n["offset"+r[0].toUpperCase()+r.slice(1)]-parseFloat(h[r])-Xr(n,r,"border",!1,h)-.5)),R&&(f=Mt.exec(s))&&(f[3]||"px")!=="px"&&(n.style[r]=s,s=o.css(n,r)),Wt(n,s,R)}}}),o.cssHooks.marginLeft=Wi(U.reliableMarginLeft,function(e,r){if(r)return(parseFloat(or(e,"marginLeft"))||e.getBoundingClientRect().left-Oi(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),o.each({margin:"",padding:"",border:"Width"},function(e,r){o.cssHooks[e+r]={expand:function(n){for(var s=0,c={},f=typeof n=="string"?n.split(" "):[n];s<4;s++)c[e+yt[s]+r]=f[s]||f[s-2]||f[0];return c}},e!=="margin"&&(o.cssHooks[e+r].set=Wt)}),o.fn.extend({css:function(e,r){return _t(this,function(n,s,c){var f,h,E={},x=0;if(Array.isArray(s)){for(f=kr(n),h=s.length;x1)}});function Ge(e,r,n,s,c){return new Ge.prototype.init(e,r,n,s,c)}o.Tween=Ge,Ge.prototype={constructor:Ge,init:function(e,r,n,s,c,f){this.elem=e,this.prop=n,this.easing=c||o.easing._default,this.options=r,this.start=this.now=this.cur(),this.end=s,this.unit=f||(o.cssNumber[n]?"":"px")},cur:function(){var e=Ge.propHooks[this.prop];return e&&e.get?e.get(this):Ge.propHooks._default.get(this)},run:function(e){var r,n=Ge.propHooks[this.prop];return this.options.duration?this.pos=r=o.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=r=e,this.now=(this.end-this.start)*r+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Ge.propHooks._default.set(this),this}},Ge.prototype.init.prototype=Ge.prototype,Ge.propHooks={_default:{get:function(e){var r;return e.elem.nodeType!==1||e.elem[e.prop]!=null&&e.elem.style[e.prop]==null?e.elem[e.prop]:(r=o.css(e.elem,e.prop,""),!r||r==="auto"?0:r)},set:function(e){o.fx.step[e.prop]?o.fx.step[e.prop](e):e.elem.nodeType===1&&(o.cssHooks[e.prop]||e.elem.style[Gr(e.prop)]!=null)?o.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Ge.propHooks.scrollTop=Ge.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},o.easing={linear:function(e){return e},swing:function(e){return .5-Math.cos(e*Math.PI)/2},_default:"swing"},o.fx=Ge.prototype.init,o.fx.step={};var Jt,Pr,Qr=/^(?:toggle|show|hide)$/,qn=/queueHooks$/;function Jr(){Pr&&(K.hidden===!1&&l.requestAnimationFrame?l.requestAnimationFrame(Jr):l.setTimeout(Jr,o.fx.interval),o.fx.tick())}function p(){return l.setTimeout(function(){Jt=void 0}),Jt=Date.now()}function S(e,r){var n,s=0,c={height:e};for(r=r?1:0;s<4;s+=2-r)n=yt[s],c["margin"+n]=c["padding"+n]=e;return r&&(c.opacity=c.width=e),c}function v(e,r,n){for(var s,c=(_.tweeners[r]||[]).concat(_.tweeners["*"]),f=0,h=c.length;f1)},removeAttr:function(e){return this.each(function(){o.removeAttr(this,e)})}}),o.extend({attr:function(e,r,n){var s,c,f=e.nodeType;if(!(f===3||f===8||f===2)){if(typeof e.getAttribute=="undefined")return o.prop(e,r,n);if((f!==1||!o.isXMLDoc(e))&&(c=o.attrHooks[r.toLowerCase()]||(o.expr.match.bool.test(r)?N:void 0)),n!==void 0){if(n===null){o.removeAttr(e,r);return}return c&&"set"in c&&(s=c.set(e,n,r))!==void 0?s:(e.setAttribute(r,n+""),n)}return c&&"get"in c&&(s=c.get(e,r))!==null?s:(s=o.find.attr(e,r),s==null?void 0:s)}},attrHooks:{type:{set:function(e,r){if(!U.radioValue&&r==="radio"&&Me(e,"input")){var n=e.value;return e.setAttribute("type",r),n&&(e.value=n),r}}}},removeAttr:function(e,r){var n,s=0,c=r&&r.match(vt);if(c&&e.nodeType===1)for(;n=c[s++];)e.removeAttribute(n)}}),N={set:function(e,r,n){return r===!1?o.removeAttr(e,n):e.setAttribute(n,n),n}},o.each(o.expr.match.bool.source.match(/\w+/g),function(e,r){var n=j[r]||o.find.attr;j[r]=function(s,c,f){var h,E,x=c.toLowerCase();return f||(E=j[x],j[x]=h,h=n(s,c,f)!=null?x:null,j[x]=E),h}});var V=/^(?:input|select|textarea|button)$/i,G=/^(?:a|area)$/i;o.fn.extend({prop:function(e,r){return _t(this,o.prop,e,r,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[o.propFix[e]||e]})}}),o.extend({prop:function(e,r,n){var s,c,f=e.nodeType;if(!(f===3||f===8||f===2))return(f!==1||!o.isXMLDoc(e))&&(r=o.propFix[r]||r,c=o.propHooks[r]),n!==void 0?c&&"set"in c&&(s=c.set(e,n,r))!==void 0?s:e[r]=n:c&&"get"in c&&(s=c.get(e,r))!==null?s:e[r]},propHooks:{tabIndex:{get:function(e){var r=o.find.attr(e,"tabindex");return r?parseInt(r,10):V.test(e.nodeName)||G.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),U.optSelected||(o.propHooks.selected={get:function(e){var r=e.parentNode;return r&&r.parentNode&&r.parentNode.selectedIndex,null},set:function(e){var r=e.parentNode;r&&(r.selectedIndex,r.parentNode&&r.parentNode.selectedIndex)}}),o.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){o.propFix[this.toLowerCase()]=this});function Y(e){var r=e.match(vt)||[];return r.join(" ")}function Z(e){return e.getAttribute&&e.getAttribute("class")||""}function ye(e){return Array.isArray(e)?e:typeof e=="string"?e.match(vt)||[]:[]}o.fn.extend({addClass:function(e){var r,n,s,c,f,h;return q(e)?this.each(function(E){o(this).addClass(e.call(this,E,Z(this)))}):(r=ye(e),r.length?this.each(function(){if(s=Z(this),n=this.nodeType===1&&" "+Y(s)+" ",n){for(f=0;f-1;)n=n.replace(" "+c+" "," ");h=Y(n),s!==h&&this.setAttribute("class",h)}}):this):this.attr("class","")},toggleClass:function(e,r){var n,s,c,f,h=typeof e,E=h==="string"||Array.isArray(e);return q(e)?this.each(function(x){o(this).toggleClass(e.call(this,x,Z(this),r),r)}):typeof r=="boolean"&&E?r?this.addClass(e):this.removeClass(e):(n=ye(e),this.each(function(){if(E)for(f=o(this),c=0;c-1)return!0;return!1}});var ke=/\r/g;o.fn.extend({val:function(e){var r,n,s,c=this[0];return arguments.length?(s=q(e),this.each(function(f){var h;this.nodeType===1&&(s?h=e.call(this,f,o(this).val()):h=e,h==null?h="":typeof h=="number"?h+="":Array.isArray(h)&&(h=o.map(h,function(E){return E==null?"":E+""})),r=o.valHooks[this.type]||o.valHooks[this.nodeName.toLowerCase()],(!r||!("set"in r)||r.set(this,h,"value")===void 0)&&(this.value=h))})):c?(r=o.valHooks[c.type]||o.valHooks[c.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(c,"value"))!==void 0?n:(n=c.value,typeof n=="string"?n.replace(ke,""):n==null?"":n)):void 0}}),o.extend({valHooks:{option:{get:function(e){var r=o.find.attr(e,"value");return r!=null?r:Y(o.text(e))}},select:{get:function(e){var r,n,s,c=e.options,f=e.selectedIndex,h=e.type==="select-one",E=h?null:[],x=h?f+1:c.length;for(f<0?s=x:s=h?f:0;s-1)&&(n=!0);return n||(e.selectedIndex=-1),f}}}}),o.each(["radio","checkbox"],function(){o.valHooks[this]={set:function(e,r){if(Array.isArray(r))return e.checked=o.inArray(o(e).val(),r)>-1}},U.checkOn||(o.valHooks[this].get=function(e){return e.getAttribute("value")===null?"on":e.value})}),U.focusin="onfocusin"in l;var Pe=/^(?:focusinfocus|focusoutblur)$/,We=function(e){e.stopPropagation()};o.extend(o.event,{trigger:function(e,r,n,s){var c,f,h,E,x,F,R,B,L=[n||K],I=W.call(e,"type")?e.type:e,ne=W.call(e,"namespace")?e.namespace.split("."):[];if(f=B=h=n=n||K,!(n.nodeType===3||n.nodeType===8)&&!Pe.test(I+o.event.triggered)&&(I.indexOf(".")>-1&&(ne=I.split("."),I=ne.shift(),ne.sort()),x=I.indexOf(":")<0&&"on"+I,e=e[o.expando]?e:new o.Event(I,typeof e=="object"&&e),e.isTrigger=s?2:3,e.namespace=ne.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+ne.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),r=r==null?[e]:o.makeArray(r,[e]),R=o.event.special[I]||{},!(!s&&R.trigger&&R.trigger.apply(n,r)===!1))){if(!s&&!R.noBubble&&!de(n)){for(E=R.delegateType||I,Pe.test(E+I)||(f=f.parentNode);f;f=f.parentNode)L.push(f),h=f;h===(n.ownerDocument||K)&&L.push(h.defaultView||h.parentWindow||l)}for(c=0;(f=L[c++])&&!e.isPropagationStopped();)B=f,e.type=c>1?E:R.bindType||I,F=(le.get(f,"events")||Object.create(null))[e.type]&&le.get(f,"handle"),F&&F.apply(f,r),F=x&&f[x],F&&F.apply&&nr(f)&&(e.result=F.apply(f,r),e.result===!1&&e.preventDefault());return e.type=I,!s&&!e.isDefaultPrevented()&&(!R._default||R._default.apply(L.pop(),r)===!1)&&nr(n)&&x&&q(n[I])&&!de(n)&&(h=n[x],h&&(n[x]=null),o.event.triggered=I,e.isPropagationStopped()&&B.addEventListener(I,We),n[I](),e.isPropagationStopped()&&B.removeEventListener(I,We),o.event.triggered=void 0,h&&(n[x]=h)),e.result}},simulate:function(e,r,n){var s=o.extend(new o.Event,n,{type:e,isSimulated:!0});o.event.trigger(s,null,r)}}),o.fn.extend({trigger:function(e,r){return this.each(function(){o.event.trigger(e,r,this)})},triggerHandler:function(e,r){var n=this[0];if(n)return o.event.trigger(e,r,n,!0)}}),U.focusin||o.each({focus:"focusin",blur:"focusout"},function(e,r){var n=function(s){o.event.simulate(r,s.target,o.event.fix(s))};o.event.special[r]={setup:function(){var s=this.ownerDocument||this.document||this,c=le.access(s,r);c||s.addEventListener(e,n,!0),le.access(s,r,(c||0)+1)},teardown:function(){var s=this.ownerDocument||this.document||this,c=le.access(s,r)-1;c?le.access(s,r,c):(s.removeEventListener(e,n,!0),le.remove(s,r))}}});var Le=l.location,it={guid:Date.now()},jt=/\?/;o.parseXML=function(e){var r,n;if(!e||typeof e!="string")return null;try{r=new l.DOMParser().parseFromString(e,"text/xml")}catch(s){}return n=r&&r.getElementsByTagName("parsererror")[0],(!r||n)&&o.error("Invalid XML: "+(n?o.map(n.childNodes,function(s){return s.textContent}).join(` `):e)),r};var Kr=/\[\]$/,zi=/\r?\n/g,Zr=/^(?:submit|button|image|reset|file)$/i,ss=/^(?:input|select|textarea|keygen)/i;function ei(e,r,n,s){var c;if(Array.isArray(r))o.each(r,function(f,h){n||Kr.test(e)?s(e,h):ei(e+"["+(typeof h=="object"&&h!=null?f:"")+"]",h,n,s)});else if(!n&&be(r)==="object")for(c in r)ei(e+"["+c+"]",r[c],n,s);else s(e,r)}o.param=function(e,r){var n,s=[],c=function(f,h){var E=q(h)?h():h;s[s.length]=encodeURIComponent(f)+"="+encodeURIComponent(E==null?"":E)};if(e==null)return"";if(Array.isArray(e)||e.jquery&&!o.isPlainObject(e))o.each(e,function(){c(this.name,this.value)});else for(n in e)ei(n,e[n],r,c);return s.join("&")},o.fn.extend({serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=o.prop(this,"elements");return e?o.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!o(this).is(":disabled")&&ss.test(this.nodeName)&&!Zr.test(e)&&(this.checked||!Xt.test(e))}).map(function(e,r){var n=o(this).val();return n==null?null:Array.isArray(n)?o.map(n,function(s){return{name:r.name,value:s.replace(zi,`\r `)}}):{name:r.name,value:n.replace(zi,`\r -`)}}).get()}});var Vn=/%20/g,qi=/#.*$/,Ao=/([?&])_=[^&]*/,Fo=/^(.*?):[ \t]*([^\r\n]*)$/mg,Do=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Lo=/^(?:GET|HEAD)$/,Ro=/^\/\//,os={},Gn={},ls="*/".concat("*"),Yn=K.createElement("a");Yn.href=Le.href;function us(e){return function(r,n){typeof r!="string"&&(n=r,r="*");var s,c=0,f=r.toLowerCase().match(vt)||[];if(q(n))for(;s=f[c++];)s[0]==="+"?(s=s.slice(1)||"*",(e[s]=e[s]||[]).unshift(n)):(e[s]=e[s]||[]).push(n)}}function cs(e,r,n,s){var c={},f=e===Gn;function h(E){var x;return c[E]=!0,o.each(e[E]||[],function(F,R){var B=R(r,n,s);if(typeof B=="string"&&!f&&!c[B])return r.dataTypes.unshift(B),h(B),!1;if(f)return!(x=B)}),x}return h(r.dataTypes[0])||!c["*"]&&h("*")}function Xn(e,r){var n,s,c=o.ajaxSettings.flatOptions||{};for(n in r)r[n]!==void 0&&((c[n]?e:s||(s={}))[n]=r[n]);return s&&o.extend(!0,e,s),e}function Io(e,r,n){for(var s,c,f,h,E=e.contents,x=e.dataTypes;x[0]==="*";)x.shift(),s===void 0&&(s=e.mimeType||r.getResponseHeader("Content-Type"));if(s){for(c in E)if(E[c]&&E[c].test(s)){x.unshift(c);break}}if(x[0]in n)f=x[0];else{for(c in n){if(!x[0]||e.converters[c+" "+x[0]]){f=c;break}h||(h=c)}f=f||h}if(f)return f!==x[0]&&x.unshift(f),n[f]}function Mo(e,r,n,s){var c,f,h,E,x,F={},R=e.dataTypes.slice();if(R[1])for(h in e.converters)F[h.toLowerCase()]=e.converters[h];for(f=R.shift();f;)if(e.responseFields[f]&&(n[e.responseFields[f]]=r),!x&&s&&e.dataFilter&&(r=e.dataFilter(r,e.dataType)),x=f,f=R.shift(),f){if(f==="*")f=x;else if(x!=="*"&&x!==f){if(h=F[x+" "+f]||F["* "+f],!h){for(c in F)if(E=c.split(" "),E[1]===f&&(h=F[x+" "+E[0]]||F["* "+E[0]],h)){h===!0?h=F[c]:F[c]!==!0&&(f=E[0],R.unshift(E[1]));break}}if(h!==!0)if(h&&e.throws)r=h(r);else try{r=h(r)}catch(B){return{state:"parsererror",error:h?B:"No conversion from "+x+" to "+f}}}}return{state:"success",data:r}}o.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Le.href,type:"GET",isLocal:Do.test(Le.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":ls,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":o.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,r){return r?Xn(Xn(e,o.ajaxSettings),r):Xn(o.ajaxSettings,e)},ajaxPrefilter:us(os),ajaxTransport:us(Gn),ajax:function(e,r){typeof e=="object"&&(r=e,e=void 0),r=r||{};var n,s,c,f,h,E,x,F,R,B,D=o.ajaxSetup({},r),I=D.context||D,ne=D.context&&(I.nodeType||I.jquery)?o(I):o.event,ve=o.Deferred(),re=o.Callbacks("once memory"),ze=D.statusCode||{},Ue={},ct={},Fe="canceled",me={readyState:0,getResponseHeader:function(Te){var je;if(x){if(!f)for(f={};je=Fo.exec(c);)f[je[1].toLowerCase()+" "]=(f[je[1].toLowerCase()+" "]||[]).concat(je[2]);je=f[Te.toLowerCase()+" "]}return je==null?null:je.join(", ")},getAllResponseHeaders:function(){return x?c:null},setRequestHeader:function(Te,je){return x==null&&(Te=ct[Te.toLowerCase()]=ct[Te.toLowerCase()]||Te,Ue[Te]=je),this},overrideMimeType:function(Te){return x==null&&(D.mimeType=Te),this},statusCode:function(Te){var je;if(Te)if(x)me.always(Te[me.status]);else for(je in Te)ze[je]=[ze[je],Te[je]];return this},abort:function(Te){var je=Te||Fe;return n&&n.abort(je),st(0,je),this}};if(ve.promise(me),D.url=((e||D.url||Le.href)+"").replace(Ro,Le.protocol+"//"),D.type=r.method||r.type||D.method||D.type,D.dataTypes=(D.dataType||"*").toLowerCase().match(vt)||[""],D.crossDomain==null){E=K.createElement("a");try{E.href=D.url,E.href=E.href,D.crossDomain=Yn.protocol+"//"+Yn.host!=E.protocol+"//"+E.host}catch(Te){D.crossDomain=!0}}if(D.data&&D.processData&&typeof D.data!="string"&&(D.data=o.param(D.data,D.traditional)),cs(os,D,r,me),x)return me;F=o.event&&D.global,F&&o.active++==0&&o.event.trigger("ajaxStart"),D.type=D.type.toUpperCase(),D.hasContent=!Lo.test(D.type),s=D.url.replace(qi,""),D.hasContent?D.data&&D.processData&&(D.contentType||"").indexOf("application/x-www-form-urlencoded")===0&&(D.data=D.data.replace(Vn,"+")):(B=D.url.slice(s.length),D.data&&(D.processData||typeof D.data=="string")&&(s+=(jt.test(s)?"&":"?")+D.data,delete D.data),D.cache===!1&&(s=s.replace(Ao,"$1"),B=(jt.test(s)?"&":"?")+"_="+it.guid+++B),D.url=s+B),D.ifModified&&(o.lastModified[s]&&me.setRequestHeader("If-Modified-Since",o.lastModified[s]),o.etag[s]&&me.setRequestHeader("If-None-Match",o.etag[s])),(D.data&&D.hasContent&&D.contentType!==!1||r.contentType)&&me.setRequestHeader("Content-Type",D.contentType),me.setRequestHeader("Accept",D.dataTypes[0]&&D.accepts[D.dataTypes[0]]?D.accepts[D.dataTypes[0]]+(D.dataTypes[0]!=="*"?", "+ls+"; q=0.01":""):D.accepts["*"]);for(R in D.headers)me.setRequestHeader(R,D.headers[R]);if(D.beforeSend&&(D.beforeSend.call(I,me,D)===!1||x))return me.abort();if(Fe="abort",re.add(D.complete),me.done(D.success),me.fail(D.error),n=cs(Gn,D,r,me),!n)st(-1,"No Transport");else{if(me.readyState=1,F&&ne.trigger("ajaxSend",[me,D]),x)return me;D.async&&D.timeout>0&&(h=l.setTimeout(function(){me.abort("timeout")},D.timeout));try{x=!1,n.send(Ue,st)}catch(Te){if(x)throw Te;st(-1,Te)}}function st(Te,je,ri,Vi){var ft,cr,fr,ot,Kt,xt=je;x||(x=!0,h&&l.clearTimeout(h),n=void 0,c=Vi||"",me.readyState=Te>0?4:0,ft=Te>=200&&Te<300||Te===304,ri&&(ot=Io(D,me,ri)),!ft&&o.inArray("script",D.dataTypes)>-1&&o.inArray("json",D.dataTypes)<0&&(D.converters["text script"]=function(){}),ot=Mo(D,ot,me,ft),ft?(D.ifModified&&(Kt=me.getResponseHeader("Last-Modified"),Kt&&(o.lastModified[s]=Kt),Kt=me.getResponseHeader("etag"),Kt&&(o.etag[s]=Kt)),Te===204||D.type==="HEAD"?xt="nocontent":Te===304?xt="notmodified":(xt=ot.state,cr=ot.data,fr=ot.error,ft=!fr)):(fr=xt,(Te||!xt)&&(xt="error",Te<0&&(Te=0))),me.status=Te,me.statusText=(je||xt)+"",ft?ve.resolveWith(I,[cr,xt,me]):ve.rejectWith(I,[me,xt,fr]),me.statusCode(ze),ze=void 0,F&&ne.trigger(ft?"ajaxSuccess":"ajaxError",[me,D,ft?cr:fr]),re.fireWith(I,[me,xt]),F&&(ne.trigger("ajaxComplete",[me,D]),--o.active||o.event.trigger("ajaxStop")))}return me},getJSON:function(e,r,n){return o.get(e,r,n,"json")},getScript:function(e,r){return o.get(e,void 0,r,"script")}}),o.each(["get","post"],function(e,r){o[r]=function(n,s,c,f){return q(s)&&(f=f||c,c=s,s=void 0),o.ajax(o.extend({url:n,type:r,dataType:f,data:s,success:c},o.isPlainObject(n)&&n))}}),o.ajaxPrefilter(function(e){var r;for(r in e.headers)r.toLowerCase()==="content-type"&&(e.contentType=e.headers[r]||"")}),o._evalUrl=function(e,r,n){return o.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(s){o.globalEval(s,r,n)}})},o.fn.extend({wrapAll:function(e){var r;return this[0]&&(q(e)&&(e=e.call(this[0])),r=o(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&r.insertBefore(this[0]),r.map(function(){for(var n=this;n.firstElementChild;)n=n.firstElementChild;return n}).append(this)),this},wrapInner:function(e){return q(e)?this.each(function(r){o(this).wrapInner(e.call(this,r))}):this.each(function(){var r=o(this),n=r.contents();n.length?n.wrapAll(e):r.append(e)})},wrap:function(e){var r=q(e);return this.each(function(n){o(this).wrapAll(r?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){o(this).replaceWith(this.childNodes)}),this}}),o.expr.pseudos.hidden=function(e){return!o.expr.pseudos.visible(e)},o.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},o.ajaxSettings.xhr=function(){try{return new l.XMLHttpRequest}catch(e){}};var No={0:200,1223:204},ti=o.ajaxSettings.xhr();U.cors=!!ti&&"withCredentials"in ti,U.ajax=ti=!!ti,o.ajaxTransport(function(e){var r,n;if(U.cors||ti&&!e.crossDomain)return{send:function(s,c){var f,h=e.xhr();if(h.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(f in e.xhrFields)h[f]=e.xhrFields[f];e.mimeType&&h.overrideMimeType&&h.overrideMimeType(e.mimeType),!e.crossDomain&&!s["X-Requested-With"]&&(s["X-Requested-With"]="XMLHttpRequest");for(f in s)h.setRequestHeader(f,s[f]);r=function(E){return function(){r&&(r=n=h.onload=h.onerror=h.onabort=h.ontimeout=h.onreadystatechange=null,E==="abort"?h.abort():E==="error"?typeof h.status!="number"?c(0,"error"):c(h.status,h.statusText):c(No[h.status]||h.status,h.statusText,(h.responseType||"text")!=="text"||typeof h.responseText!="string"?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=r(),n=h.onerror=h.ontimeout=r("error"),h.onabort!==void 0?h.onabort=n:h.onreadystatechange=function(){h.readyState===4&&l.setTimeout(function(){r&&n()})},r=r("abort");try{h.send(e.hasContent&&e.data||null)}catch(E){if(r)throw E}},abort:function(){r&&r()}}}),o.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),o.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return o.globalEval(e),e}}}),o.ajaxPrefilter("script",function(e){e.cache===void 0&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),o.ajaxTransport("script",function(e){if(e.crossDomain||e.scriptAttrs){var r,n;return{send:function(s,c){r=o("