function ne(e,t){for(e+="";e.length0?e.substr(0,t):e}function V(e,t){return t||(t=2),t==8?V(e>>16&65535,4)+V(e&65535,4):D(e,t,16)}function le(e,t){return t||(t=8),D(e,t,2)}function D(e,t,r){try{for(var i=e.toString(r).toUpperCase();i.length=0)for(;n'+c+""),a+=c,n++,s++}for(;s>6)+3,E=(v&63)+8):(K=i[v&31],E=(v>>5)+1),b=0;b=192&&n<224)n=(n&31)<<6|e[i++]&63;else if(n=(n&15)<<12|(e[i]&63)<<6|e[i+1]&63,i+=2,n==65279)continue;t+=String.fromCharCode(n)}return t}function pe(e,t){var r=0;if(e){e=e.toUpperCase();let a=[".CHR",".BIN",".DAT",".PAL",".NAM",".RLE",".LZ4",".NSF"];for(var i of a)e.endsWith(i)&&r++}for(var n=0;n<(t?t.length:0);){let a=t[n++];if((a&128)==0){if(a<9||a>=14&&a<26||a==127){r++;break}}else{var s=0;for((a&224)==192?s=1:(a&240)==224?s=2:(a&248)==240?s=3:(a<160||a==255)&&r++;s--;)if(n>=t.length||(t[n++]&192)!=128){r++;break}}}return r>0}function me(e,t,r){for(var i=r||9,n=t.length,s=e._malloc(n+1),a=0;a0&&(i+=" "),i+=e&s?t[n]:"-"}return i}function xe(e){return(e&255)<<16|e>>16&255|e&65280}function P(e,t,r){return e&255|(t&255)<<8|(r&255)<<16|4278190080}function A(e,t,r){return rt?t:r}function de(e){return e.replace(/\W+/g,"_")}function ye(e){for(var t=0,r=e[t++],i=[],n=r;t{var i=document.createElement("script");i.onload=t,i.onerror=r,i.src=e,document.getElementsByTagName("head")[0].appendChild(i)})}function Le(e){e.startsWith("?")&&(e=e.substr(1));var t=e.split("&");if(!t||t.length==0)return{};for(var r={},i=0;i1&&rs;){let a=n,o=s;if((n&1)==0&&(o=s*2,a=n/2),n%3==0&&(o=s*3,a=n/3),n%5==0&&(o=s*5,a=n/5),athis.maxSize&&(console.log("cache reset",this),this.reset())}reset(){this.cache=new Map,this.size=0}};function d(e){var t=e&&e.w+"px"||"100%",r=e&&e.h+"px"||"100%",i=this.itemHeight=e.itemHeight;this.items=e.items,this.generatorFn=e.generatorFn,this.totalRows=e.totalRows||e.items&&e.items.length;var n=d.createScroller(i*this.totalRows);this.container=d.createContainer(t,r),this.container.appendChild(n);var s=Math.ceil(e.h/i);this.cachedItemsLen=s*3,this._renderChunk(this.container,0);var a=this,o,c=s*i,l=0;this.rmNodeInterval=setInterval(function(){if(Date.now()-l>100)for(var m=document.querySelectorAll('[data-rm="1"]'),p=0,x=m.length;pc){var x=Math.floor(p/i)-s;a._renderChunk(a.container,x<0?0:x),o=p}l=Date.now(),m.preventDefault&&m.preventDefault()}this.container.addEventListener("scroll",h)}d.prototype.createRow=function(e){var t;if(this.generatorFn)t=this.generatorFn(e);else if(this.items)if(typeof this.items[e]=="string"){var r=document.createTextNode(this.items[e]);t=document.createElement("div"),t.style.height=this.itemHeight+"px",t.appendChild(r)}else t=this.items[e];return t.classList.add("vrow"),t.setAttribute("data-index",""+e),t.style.position="absolute",t.style.top=e*this.itemHeight+"px",t};d.prototype._renderChunk=function(e,t){var r=t+this.cachedItemsLen;r>this.totalRows&&(r=this.totalRows);for(var i=document.createDocumentFragment(),n=t;n>17,e^=e<<5,(w=e)&255}function Re(){return w}function Fe(e){w=e}function W(e,t,r,i){var n=e.createElement("canvas");return n.width=r,n.height=i,n.classList.add("emuvideo"),n.tabIndex=-1,t.appendChild(n),n}var u;(function(o){o[o.KeyDown=1]="KeyDown",o[o.Shift=2]="Shift",o[o.Ctrl=4]="Ctrl",o[o.Alt=8]="Alt",o[o.Meta=16]="Meta",o[o.KeyUp=64]="KeyUp",o[o.KeyPress=128]="KeyPress"})(u||(u={}));function Y(e,t){e.onkeydown=r=>{let i=R(r);t(r.which,r.keyCode,1|i),i||r.preventDefault()},e.onkeyup=r=>{t(r.which,r.keyCode,64|R(r))}}var U=class{constructor(t,r,i,n){this.paddle_x=255;this.paddle_y=255;this.mainElement=t,this.width=r,this.height=i,this.options=n}setRotate(t){var r=this.canvas;t?(r.style.transform="rotate("+t+"deg)",r.width{var i=ee(t,r),n=Math.floor(i.x*255/this.canvas.width),s=Math.floor(i.y*255/this.canvas.height);this.paddle_x=A(0,255,n),this.paddle_y=A(0,255,s)})}},Z=class extends U{constructor(){super(...arguments);this.persistenceAlpha=.5;this.jitter=1;this.gamma=.8;this.COLORS=["#111111","#1111ff","#11ff11","#11ffff","#ff1111","#ff11ff","#ffff11","#ffffff"]}create(){super.create(),this.sx=this.width/1024,this.sy=this.height/1024}clear(){var t=this.ctx;t.globalCompositeOperation="source-over",t.globalAlpha=this.persistenceAlpha,t.fillStyle="#000000",t.fillRect(0,0,this.width,this.height),t.globalAlpha=1,t.globalCompositeOperation="lighter"}drawLine(t,r,i,n,s,a){var o=this.ctx,c=this.sx,l=this.sy;if(s>0){var h=Math.pow(s/255,this.gamma);o.globalAlpha=h,o.lineWidth=3,o.beginPath();var m=this.jitter*(Math.random()-.5),p=this.jitter*(Math.random()-.5);t+=m,i+=m,r+=p,n+=p,o.moveTo(t*c,this.height-r*l),t==i&&r==n?o.lineTo(i*c+1,this.height-n*l):o.lineTo(i*c,this.height-n*l),o.strokeStyle=this.COLORS[a&7],o.stroke()}}},N=class{constructor(t){this.mem=new Uint8Array(new ArrayBuffer(t))}},C=class extends Error{constructor(t,r){super(t);this.$loc=r,Object.setPrototypeOf(this,C.prototype)}},z=!1,q=class{constructor(t,r){this.running=!1;this.pulsing=!1;this.nextts=0;this.useReqAnimFrame=z&&typeof window.requestAnimationFrame=="function";this.frameRate=t,this.intervalMsec=1e3/t,this.callback=r}scheduleFrame(t){var r=i=>{try{this.nextFrame(this.useReqAnimFrame?i:Date.now())}catch(n){throw this.running=!1,this.pulsing=!1,n}};this.useReqAnimFrame?window.requestAnimationFrame(r):setTimeout(r,t)}nextFrame(t){t>this.nextts&&(this.running&&this.callback(),this.nframes==0&&(this.startts=t),this.nframes++==300&&console.log("Avg framerate: "+this.nframes*1e3/(t-this.startts)+" fps")),this.nextts+=this.intervalMsec,t-this.nextts>1e3&&(this.nextts=t),this.running?this.scheduleFrame(this.nextts-t):this.pulsing=!1}isRunning(){return this.running}start(){this.running||(this.running=!0,this.nextts=0,this.nframes=0,this.pulsing||(this.scheduleFrame(0),this.pulsing=!0))}stop(){this.running=!1}};function Oe(e,t,r){for(var i="",n=e.BYTES_PER_ELEMENT||1,s=Math.ceil(16/n),a=e instanceof Float32Array||e instanceof Float64Array,o=0;o{if(!t){r(null,n,s,a);return}var o=t[n];if(o||(o=t[0]),r&&(o||i)&&r(o,n,s,a),o){var c=o.mask;c<0&&(c=-c,a&(1|64)&&(a^=1|64)),a&1?e[o.index]|=c:a&64&&(e[o.index]&=~c)}}}function Ie(e,t,r,i,n){var s=Q(t,r,i,n);return e.setKeyboardEvents(s),new F(s)}function He(e){for(var t=new Map,r=0;r{console.log("Gamepad connected:",r),this.active=typeof navigator.getGamepads=="function"}),window.addEventListener("gamepaddisconnected",r=>{console.log("Gamepad disconnected:",r)})}poll(){if(!!this.active)for(var t=navigator.getGamepads(),r=0;rt)throw Error("Data too long, "+e.length+" > "+t);var i=new N(t);return r?i.mem.set(e,t-e.length):i.mem.set(e),i.mem}function j(e,t){var r=this;function i(){var n="";t&&t.gmask&&(n+="a&="+t.gmask+";");for(var s=0;s="+o+" && a<="+c+"){",l&&(n+="a&="+l+";"),n+="return this.__fn"+s+`(a,v)&0xff;} `}return n+="return 0;",new Function("a","v",n)}return i().bind(r)}function Ge(e,t){return new j(e,t)}function ee(e,t){var r=e.getBoundingClientRect(),i=e.width/r.width,n=e.height/r.height;return{x:(t.clientX-r.left)*i,y:(t.clientY-r.top)*n}}function te(){return $("#booksMenuButton").first().height()}var re=class{constructor(t){var r=document.createElement("div");r.setAttribute("class","memdump"),t.appendChild(r),this.maindiv=r}create(t,r,i){this.getLineAt=i,this.memorylist=new d({w:$(t).width(),h:$(t).height(),itemHeight:te(),totalRows:r,generatorFn:n=>{var s=i(n),a=document.createElement("div");return a.appendChild(document.createTextNode(s.text)),s.clas!=null&&(a.className=s.clas),a}}),$(this.maindiv).append(this.memorylist.container)}refresh(){this.memorylist&&$(this.maindiv).find("[data-index]").each((t,r)=>{var i=r,n=parseInt(i.getAttribute("data-index")),s=i.innerText,a=this.getLineAt(n),o=a.text;if(s!=o&&(i.innerText=o,a.clas!=null&&!i.classList.contains(a.clas))){var c=Array.from(i.classList);c.forEach(l=>i.classList.remove(l)),i.classList.add("vrow"),i.classList.add(a.clas)}})}};function ke(e){let t=.9,r=1.1,i=60,n=e>>4&15,s=e&15,a=n?i:0;n&&(s+=1);let o=((n-1)*25-25)*(2*Math.PI/360),c=256*r*Math.pow(s/16,t),l=a*Math.cos(o),h=a*Math.sin(o);var m=c+.956*l+.621*h,p=c-.272*l-.647*h,x=c-1.107*l+1.704*h;return P(A(0,255,m),A(0,255,p),A(0,255,x))}export{ne as a,ie as b,ae as c,se as d,oe as e,ce as f,V as g,le as h,ue as i,fe as j,he as k,O as l,I as m,H as n,pe as o,me as p,ge as q,ve as r,xe as s,P as t,A as u,de as v,ye as w,_e as x,B as y,be as z,Ae as A,Ke as B,Ee as C,Ve as D,Le as E,we as F,Me as G,X as H,d as I,Ue as J,Ne as K,Re as L,Fe as M,W as N,u as O,U as P,Z as Q,N as R,C as S,q as T,Oe as U,f as V,Q as W,Ie as X,He as Y,F as Z,Be as _,Ge as $,ee as aa,te as ba,re as ca,ke as da}; //# sourceMappingURL=chunk-G5LGIVML.js.map