1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-18 03:05:35 +00:00
8bitworkshop/gen/chunk-LKR3N7UH.js

7 lines
19 KiB
JavaScript

function ne(e,t){for(e+="";e.length<t;)e=" "+e;return e}function ie(e,t){for(e+="";e.length<t;)e+=" ";return e}function ae(e){return e&=255,e<128?e:-(256-e)}function se(e){var t=e.split("/");return t[t.length-1]}function oe(e){return e.substring(0,e.lastIndexOf("/"))}function ce(e){var t=e.lastIndexOf(".");return t>0?e.substr(0,t):e}function V(e,t){return t||(t=2),t==8?V(e>>16&65535,4)+V(e&65535,4):P(e,t,16)}function le(e,t){return t||(t=8),P(e,t,2)}function P(e,t,r){try{for(var i=e.toString(r).toUpperCase();i.length<t;)i="0"+i;return i}catch(n){return e+""}}function ue(e){var t={};if(e)for(var r in e)t[e[r]]=r;return t}function fe(e,t){for(var r=e.split(/(\S+\s+)/).filter(function(l){return l}),i=t.split(/(\S+\s+)/).filter(function(l){return l}),n=0,s=0,a="";n<r.length&&s<i.length;){var o=r[n],c=i[s];if(c&&c.indexOf(`
`)>=0)for(;n<e.length&&r[n].indexOf(`
`)<0;)n++;o!=c&&(c='<span class="hilite">'+c+"</span>"),a+=c,n++,s++}for(;s<i.length;)a+=i[s++];return a}function he(){var e=16,t=0,r=1,i=[2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,35,48,72,128],n=null,s=function(a){for(var o=1,c=0,l=e;l<a.length;)o=o+(a[l]&255)&65535,c=c+o&65535,l++;return c<<16|o};this.decode=function(a){if(n=null,a.length<e||a[0]!=76||a[1]!=90||a[2]!=71)return null;var o=a[6]|a[5]<<8|a[4]<<16|a[3]<<24,c=(a[11]&255)<<24|(a[12]&255)<<16|(a[13]&255)<<8|a[14]&255;if(s(a)!=c)return null;var l=new Array,h=a[15]&255;if(h==r)for(var m=a[16]&255,p=a[17]&255,x=a[18]&255,S=a[19]&255,g,v,L,D,K,E,y=0,b=e+4,T=a.length;b<=T;)if(g=a[b++]&255,g!=m&&g!=p&&g!=x&&g!=S)l[y++]=g;else if(v=a[b++]&255,v!=0)for(g==m?(K=i[v&31],L=a[b++]&255,D=a[b++]&255,E=((v&224)<<11|L<<8|D)+2056):g==p?(K=i[v&31],L=a[b++]&255,E=((v&224)<<3|L)+8):g==x?(K=(v>>6)+3,E=(v&63)+8):(K=i[v&31],E=(v>>5)+1),_=0;_<K;_++)l[y]=l[y-E],y++;else l[y++]=g;else if(h==t)for(var y=0,T=a.length,_=e;_<T;_++)l[y++]=a[_]&255;else return null;return l.length<o?null:(n=l.slice(0,o),n)},this.getByteArray=function(){return n},this.getStringLatin1=function(){return I(n)},this.getStringUTF8=function(){return H(n)}}function O(e){for(var t=new Uint8Array(e.length),r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function I(e){var t="";if(e!=null){for(var r=new Array,i=0;i<256;++i)r[i]=String.fromCharCode(i);for(var n=e.length,i=0;i<n;i++)t+=r[e[i]]}return t}function H(e){for(var t="",r=new Array,i=0;i<128;++i)r[i]=String.fromCharCode(i);for(var n,s=e.length,i=0;i<s;)if(n=e[i++],n<128)t+=r[n];else{if(n>=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;a<n;a++)e.setValue(s+a,t[a],"i8");var o=e._LZG_MaxEncodedSize(n),c=e._malloc(o+1),l=e.ccall("compress_lzg","number",["number","number","number","number","number"],[i,s,n,o,c]);e._free(s);for(var h=new Uint8Array(l),a=0;a<l;a++)h[a]=e.getValue(c+a,"i8");return e._free(c),h}function ge(e,t,r){for(var i in r){var n=r[i],s=typeof n;n===null||s=="undefined"?t[i]=n:s=="function"||(s=="object"?n.slice&&(t[i]=n.slice()):t[i]=n)}return t}function ve(e,t,r){for(var i="",n=0;n<t.length;n++)if(t[n]){var s=1<<(r?t.length-1-n:n);n>0&&(i+=" "),i+=e&s?t[n]:"-"}return i}function xe(e){return(e&255)<<16|e>>16&255|e&65280}function U(e,t,r){return e&255|(t&255)<<8|(r&255)<<16|4278190080}function A(e,t,r){return r<e?e:r>t?t:r}function de(e){return e.replace(/\W+/g,"_")}function ye(e){for(var t=0,r=e[t++],i=[],n=r;t<e.length;){var s=e[t++];if(s==r){for(var a=e[t++],o=0;o<a;o++)i.push(n);if(a==0)break}else n=s,i.push(n)}return new Uint8Array(i)}function be(e,t,r){var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType=r,i.onload=function(n){if(i.status==200){var s=i.response;s instanceof ArrayBuffer&&(s=new Uint8Array(s)),t(s)}else if(i.status==404)t(null);else throw Error("Error "+i.status+" loading "+e)},i.onerror=function(n){t(null)},i.ontimeout=function(n){throw Error("Timeout loading "+e)},i.send(null)}function B(e){return e.split(".")[0]}function G(e){return e.split("-")[0]}function _e(e){return G(B(e))}function Ae(e){return e!=null&&(Array.isArray(e)||k(e))}function k(e){return e!=null&&e.BYTES_PER_ELEMENT}function Ke(e){return typeof e=="string"?O(e):e}function Ee(e){return e<32?String.fromCharCode(e+9216):String.fromCharCode(e)}function Ve(e){return new Promise((t,r)=>{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;i<t.length;++i){var n=t[i].split("=",2);n.length==1?r[n[0]]="":r[n[0]]=decodeURIComponent(n[1].replace(/\+/g," "))}return r}function we(e){return!e||e=="false"||e=="0"?!1:e=="true"||e=="1"?!0:!!e}function Te(e,t,r,i){let n=e,s=1;for(r>1&&r<n&&(n=Math.ceil(e/r),s=r);n>s;){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),a<t||a<o*i)break;n=a,s=o}return{a:n,b:s}}var X=class{constructor(){this.maxSize=8e6;this.reset()}get(t){return this.cache.get(t)}put(t,r){this.cache.set(t,r),this.size+=r.length,this.size>this.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;p<x;p++)try{a.container.removeChild(m[p])}catch(S){}},300);function h(m){var p=m.target.scrollTop;if(!o||Math.abs(p-o)>c){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<r;n++)i.appendChild(this.createRow(n));for(var s=1,a=e.childNodes.length;s<a;s++)e.childNodes[s].style.display="none",e.childNodes[s].setAttribute("data-rm","1");e.appendChild(i)};d.createContainer=function(e,t){var r=document.createElement("div");return r.classList.add("vlist"),r.style.width=e,r.style.height=t,r.style.overflow="auto",r.style.position="relative",r.style.padding="0",r.style.border="1px solid black",r};d.createScroller=function(e){var t=document.createElement("div");return t.style.opacity="0",t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.width="1px",t.style.height=e+"px",t};d.prototype.scrollToItem=function(e){this.container.scrollTop=this.itemHeight*e};var Ue={},w=1;function Ne(){let e=w;return e^=e<<13,e^=e>>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=>{t(r.which,0,1|C(r)),(r.ctrlKey||r.which==8||r.which==9||r.which==27||r.which==191||r.which==191||r.which==222)&&r.preventDefault()},e.onkeyup=r=>{t(r.which,0,64|C(r))},e.onkeypress=r=>{t(r.which,r.charCode,128|C(r))}}var N=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<r.height&&(r.style.paddingLeft=r.style.paddingRight="10%")):(r.style.transform=null,r.style.paddingLeft=r.style.paddingRight=null)}create(t){var r;this.canvas=r=W(t||document,this.mainElement,this.width,this.height),this.vcanvas=$(r),this.options&&this.options.rotate&&this.setRotate(this.options.rotate),this.options&&this.options.overscan&&this.vcanvas.css("padding","0px"),this.options&&this.options.aspect&&(console.log(this.options),this.vcanvas.css("aspect-ratio",this.options.aspect+"")),this.ctx=r.getContext("2d"),this.imageData=this.ctx.createImageData(this.width,this.height),this.datau32=new Uint32Array(this.imageData.data.buffer)}setKeyboardEvents(t){Y(this.canvas,t)}getFrameData(){return this.datau32}getContext(){return this.ctx}updateFrame(t,r,i,n,s,a){s&&a?this.ctx.putImageData(this.imageData,t,r,i,n,s,a):this.ctx.putImageData(this.imageData,0,0)}clearRect(t,r,i,n){var s=this.ctx;s.fillStyle="#000000",s.fillRect(t,r,i,n)}setupMouseEvents(t){t||(t=this.canvas),$(t).mousemove(r=>{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 N{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()}}},R=class{constructor(t){this.mem=new Uint8Array(new ArrayBuffer(t))}},M=class extends Error{constructor(t,r){super(t);this.$loc=r,Object.setPrototypeOf(this,M.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<r;o+=s){i+="$"+V(o+t)+":";for(var c=0;c<s;c++)o+c<e.length&&(c==s/2&&(i+=" "),a?i+=" "+e[o+c].toPrecision(n*2):i+=" "+V(e[o+c],n*2));i+=`
`}return i}var f={ANYKEY:{c:0,n:"?"},UP:{c:38,n:"Up",plyr:0,yaxis:-1},DOWN:{c:40,n:"Down",plyr:0,yaxis:1},LEFT:{c:37,n:"Left",plyr:0,xaxis:-1},RIGHT:{c:39,n:"Right",plyr:0,xaxis:1},A:{c:32,n:"Space",plyr:0,button:0},B:{c:16,n:"Shift",plyr:0,button:1},GP_A:{c:88,n:"X",plyr:0,button:0},GP_B:{c:90,n:"Z",plyr:0,button:1},GP_C:{c:86,n:"V",plyr:0,button:2},GP_D:{c:67,n:"C",plyr:0,button:3},SELECT:{c:220,n:"\\",plyr:0,button:8},START:{c:13,n:"Enter",plyr:0,button:9},OPTION:{c:9,n:"Tab",plyr:0,button:10},P2_UP:{c:87,n:"W",plyr:1,yaxis:-1},P2_DOWN:{c:83,n:"S",plyr:1,yaxis:1},P2_LEFT:{c:65,n:"A",plyr:1,xaxis:-1},P2_RIGHT:{c:68,n:"D",plyr:1,xaxis:1},P2_A:{c:84,n:"T",plyr:1,button:0},P2_B:{c:82,n:"R",plyr:1,button:1},P2_GP_A:{c:69,n:"E",plyr:1,button:0},P2_GP_B:{c:82,n:"R",plyr:1,button:1},P2_GP_C:{c:84,n:"T",plyr:1,button:2},P2_GP_D:{c:89,n:"Y",plyr:1,button:3},P2_SELECT:{c:70,n:"F",plyr:1,button:8},P2_START:{c:71,n:"G",plyr:1,button:9},VK_ESCAPE:{c:27,n:"Esc"},VK_F1:{c:112,n:"F1"},VK_F2:{c:113,n:"F2"},VK_F3:{c:114,n:"F3"},VK_F4:{c:115,n:"F4"},VK_F5:{c:116,n:"F5"},VK_F6:{c:117,n:"F6"},VK_F7:{c:118,n:"F7"},VK_F8:{c:119,n:"F8"},VK_F9:{c:120,n:"F9"},VK_F10:{c:121,n:"F10"},VK_F11:{c:122,n:"F11"},VK_F12:{c:123,n:"F12"},VK_SCROLL_LOCK:{c:145,n:"ScrLck"},VK_PAUSE:{c:19,n:"Pause"},VK_QUOTE:{c:222,n:"'"},VK_1:{c:49,n:"1"},VK_2:{c:50,n:"2"},VK_3:{c:51,n:"3"},VK_4:{c:52,n:"4"},VK_5:{c:53,n:"5"},VK_6:{c:54,n:"6"},VK_7:{c:55,n:"7"},VK_8:{c:56,n:"8"},VK_9:{c:57,n:"9"},VK_0:{c:48,n:"0"},VK_MINUS:{c:189,n:"-"},VK_MINUS2:{c:173,n:"-"},VK_EQUALS:{c:187,n:"="},VK_EQUALS2:{c:61,n:"="},VK_BACK_SPACE:{c:8,n:"Bkspc"},VK_TAB:{c:9,n:"Tab"},VK_Q:{c:81,n:"Q"},VK_W:{c:87,n:"W"},VK_E:{c:69,n:"E"},VK_R:{c:82,n:"R"},VK_T:{c:84,n:"T"},VK_Y:{c:89,n:"Y"},VK_U:{c:85,n:"U"},VK_I:{c:73,n:"I"},VK_O:{c:79,n:"O"},VK_P:{c:80,n:"P"},VK_ACUTE:{c:219,n:"\xB4"},VK_OPEN_BRACKET:{c:219,n:"["},VK_CLOSE_BRACKET:{c:221,n:"]"},VK_CAPS_LOCK:{c:20,n:"CpsLck"},VK_A:{c:65,n:"A"},VK_S:{c:83,n:"S"},VK_D:{c:68,n:"D"},VK_F:{c:70,n:"F"},VK_G:{c:71,n:"G"},VK_H:{c:72,n:"H"},VK_J:{c:74,n:"J"},VK_K:{c:75,n:"K"},VK_L:{c:76,n:"L"},VK_CEDILLA:{c:186,n:"\xC7"},VK_TILDE:{c:222,n:"~"},VK_ENTER:{c:13,n:"Enter"},VK_SHIFT:{c:16,n:"Shift"},VK_BACK_SLASH:{c:220,n:"\\"},VK_Z:{c:90,n:"Z"},VK_X:{c:88,n:"X"},VK_C:{c:67,n:"C"},VK_V:{c:86,n:"V"},VK_B:{c:66,n:"B"},VK_N:{c:78,n:"N"},VK_M:{c:77,n:"M"},VK_COMMA:{c:188,n:"] ="},VK_PERIOD:{c:190,n:"."},VK_SEMICOLON:{c:59,n:";"},VK_SLASH:{c:191,n:"/"},VK_CONTROL:{c:17,n:"Ctrl"},VK_ALT:{c:18,n:"Alt"},VK_SPACE:{c:32,n:"Space"},VK_INSERT:{c:45,n:"Ins"},VK_DELETE:{c:46,n:"Del"},VK_HOME:{c:36,n:"Home"},VK_END:{c:35,n:"End"},VK_PAGE_UP:{c:33,n:"PgUp"},VK_PAGE_DOWN:{c:34,n:"PgDown"},VK_UP:{c:38,n:"Up"},VK_DOWN:{c:40,n:"Down"},VK_LEFT:{c:37,n:"Left"},VK_RIGHT:{c:39,n:"Right"},VK_NUM_LOCK:{c:144,n:"Num"},VK_DIVIDE:{c:111,n:"Num /"},VK_MULTIPLY:{c:106,n:"Num *"},VK_SUBTRACT:{c:109,n:"Num -"},VK_ADD:{c:107,n:"Num +"},VK_DECIMAL:{c:194,n:"Num ."},VK_NUMPAD0:{c:96,n:"Num 0"},VK_NUMPAD1:{c:97,n:"Num 1"},VK_NUMPAD2:{c:98,n:"Num 2"},VK_NUMPAD3:{c:99,n:"Num 3"},VK_NUMPAD4:{c:100,n:"Num 4"},VK_NUMPAD5:{c:101,n:"Num 5"},VK_NUMPAD6:{c:102,n:"Num 6"},VK_NUMPAD7:{c:103,n:"Num 7"},VK_NUMPAD8:{c:104,n:"Num 8"},VK_NUMPAD9:{c:105,n:"Num 9"},VK_NUMPAD_CENTER:{c:12,n:"Num Cntr"}};function C(e){return(e.shiftKey?2:0)|(e.ctrlKey?4:0)|(e.altKey?8:0)|(e.metaKey?16:0)}function Q(e,t,r,i){return(n,s,a)=>{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<e.length;r++){var i=e[r],n={index:i[1],mask:i[2],def:i[0]};t[i[0].c]=n}return t}var J=[f.UP,f.DOWN,f.LEFT,f.RIGHT,f.A,f.B,f.SELECT,f.START,f.P2_UP,f.P2_DOWN,f.P2_LEFT,f.P2_RIGHT,f.P2_A,f.P2_B,f.P2_SELECT,f.P2_START],F=class{constructor(t){this.active=!1;this.state=new Int8Array(32);this.lastState=new Int8Array(32);this.AXIS0=24;this.handler=t,window.addEventListener("gamepadconnected",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;r<t.length;r++){var i=t[r];if(i){for(var n=0;n<i.axes.length;n++){var s=n+this.AXIS0;this.state[s]=Math.round(i.axes[n]),this.state[s]!=this.lastState[s]&&this.handleStateChange(r,s)}for(var n=0;n<i.buttons.length;n++)this.state[n]=i.buttons[n].pressed?1:0,this.state[n]!=this.lastState[n]&&this.handleStateChange(r,n);this.lastState.set(this.state)}}}handleStateChange(t,r){var i=r-this.AXIS0;for(var n of J)if(n&&n.plyr==t){var s=n.c,a=this.state[r],o=this.lastState[r];if(r==n.button||i==0&&n.xaxis==a||i==1&&n.yaxis==a){a!=0?this.handler(s,0,1):this.handler(s,0,64);break}else if(a==0&&i==0&&n.xaxis==o||i==1&&n.yaxis==o){this.handler(s,0,64);break}}}};function Be(e,t,r){if(e.length>t)throw Error("Data too long, "+e.length+" > "+t);var i=new R(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<e.length;s++){var a=e[s],o=a[0]|0,c=a[1]|0,l=a[2]|0,h=a[3];r["__fn"+s]=h,n+="if (a>="+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 U(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,U as t,A as u,de as v,ye as w,be as x,B as y,_e as z,Ae as A,Ke as B,Ee as C,Ve as D,Le as E,we as F,Te 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,N as P,Z as Q,R,M 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-LKR3N7UH.js.map