var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(g,n,q){g!=Array.prototype&&g!=Object.prototype&&(g[n]=q.value)};$jscomp.getGlobal=function(g){return"undefined"!=typeof window&&window===g?g:"undefined"!=typeof global&&null!=global?global:g};$jscomp.global=$jscomp.getGlobal(this); $jscomp.polyfill=function(g,n,q,t){if(n){q=$jscomp.global;g=g.split(".");for(t=0;tq&&(q=Math.max(0,n+q));if(null==t||t>n)t=n;t=Number(t);0>t&&(t=Math.max(0,n+t));for(q=Number(q||0);qg||1342177279>>=1)n+=n;return t}},"es6","es3");$jscomp.stringPadding=function(g,n){g=void 0!==g?String(g):" ";return 0b?b:d}function t(d){return d.charAt(0).toUpperCase()+d.substring(1)}function v(d){for(var c=arguments.length,b=Array(1c;c++)b[c+1]+=16*b[c],b.splice(c,1);else b=(c=d.match(/rgb\(([0-9, ]+)\)/i))? c[1].split(/\s*,\s*/).map(function(a){return parseInt(a)}):[0,0,0];M[d]=b}return b.slice()}function W(d){for(var c=arguments.length,b=Array(1c;c++)for(a=0;ae;e++)a[e]=Math.round(a[e]+b*(c[e]-d[e]));return a}function Y(d,c,b){void 0===b&&(b=.5);d=N(d);c=N(c);for(var a=0;3>a;a++)d[a]+=b*(c[a]-d[a]);return Z(d)}function N(d){var c=d[0]/255,b=d[1]/255; d=d[2]/255;var a=Math.max(c,b,d),e=Math.min(c,b,d),f=0,l=(a+e)/2;if(a==e)e=0;else{var k=a-e;e=.5b&&(b+=1);1b?c:b<2/3?d+(c-d)*(2/3-b)*6:d}function Z(d){var c=d[2];if(0==d[1])return c=Math.round(255*c),[c,c,c];var b=d[1];b=.5>c?c*(1+b):c+b-c*b;var a=2*c-b;c=O(a,b,d[0]+1/3);var e=O(a,b,d[0]);d=O(a,b,d[0]-1/3);return[Math.round(255* c),Math.round(255*e),Math.round(255*d)]}function ka(d,c,b){var a=d.createShader(d.VERTEX_SHADER);d.shaderSource(a,c);d.compileShader(a);if(!d.getShaderParameter(a,d.COMPILE_STATUS))throw Error(d.getShaderInfoLog(a)||"");c=d.createShader(d.FRAGMENT_SHADER);d.shaderSource(c,b);d.compileShader(c);if(!d.getShaderParameter(c,d.COMPILE_STATUS))throw Error(d.getShaderInfoLog(c)||"");b=d.createProgram();d.attachShader(b,a);d.attachShader(b,c);d.linkProgram(b);if(!d.getProgramParameter(b,d.LINK_STATUS))throw Error(d.getProgramInfoLog(b)|| "");return b}function la(d){var c=new Float32Array([0,0,1,0,0,1,1,1]),b=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,b);d.bufferData(d.ARRAY_BUFFER,c,d.STATIC_DRAW);d.enableVertexAttribArray(0);d.vertexAttribPointer(0,2,d.FLOAT,!1,0,0)}function J(d){if(!(d in P)){if("transparent"==d)var c=[0,0,0,0];else if(-1b;b++)c[b]/=255}else c=E(d).map(function(a){return a/255}),c.push(1);P[d]=c}return P[d]}function Q(d){d=E(d);return 36* Math.floor(.0234375*d[0])+6*Math.floor(.0234375*d[1])+1*Math.floor(.0234375*d[2])+16}function R(d,c){var b=[],a=0;d.replace(ma,function(e,l,k,h){var f=d.substring(a,h);f.length&&b.push({type:0,value:f});b.push({type:"c"==l?2:3,value:k.trim()});a=h+e.length;return""});var e=d.substring(a);e.length&&b.push({type:0,value:e});return na(b,c)}function na(d,c){c||(c=Infinity);for(var b=0,a=0,e=-1;bc){for(l=-1;;){var k=f.value.indexOf(" ",l+1);if(-1==k)break;if(a+k>c)break;l=k}-1!=l?f.value=K(d,b,l,!0):-1!=e?(b=d[e],f=b.value.lastIndexOf(" "),b.value=K(d,e,f,!0),b=e):f.value=K(d,b,c-a,!1)}else a+=f.value.length,-1!=f.value.indexOf(" ")&&(e=b);b++}else d.splice(b,1)}}d.push({type:1});c=null;for(a= 0;ab?1/b:b;this._s0=2.3283064365386963E-10*(b>>>0);b=69069*b+1>>>0;this._s1=2.3283064365386963E-10*b;this._s2=2.3283064365386963E-10*(69069*b+1>>>0);this._c=1;return this};c.getUniform=function(){var b=2091639*this._s0+2.3283064365386963E-10*this._c;this._s0=this._s1;this._s1=this._s2;this._c=b|0;return this._s2=b-this._c};c.getUniformInt=function(b,a){var e=Math.max(b,a);b=Math.min(b,a);return Math.floor(this.getUniform()* (e-b+1))+b};c.getNormal=function(b,a){void 0===b&&(b=0);void 0===a&&(a=1);do{var e=2*this.getUniform()-1;var f=2*this.getUniform()-1;f=e*e+f*f}while(1a||0>e||a>=f.width||e>=f.height?[-1,-1]:this._normalizedEventToPosition(a,e)};return c}(G);v.map={s:"toString"};var oa=Object.freeze({mod:n,clamp:q,capitalize:t,format:v}),ca=function(d){function c(){var a=d.call(this)||this; a._spacingX=0;a._spacingY=0;a._hexSize=0;return a}_inheritsLoose(c,d);var b=c.prototype;b.draw=function(a,e){var f=a[2],b=a[3],k=a[4];a=[(a[0]+1)*this._spacingX,a[1]*this._spacingY+this._hexSize];this._options.transpose&&a.reverse();e&&(this._ctx.fillStyle=k,this._fill(a[0],a[1]));if(f)for(this._ctx.fillStyle=b,e=[].concat(f),f=0;fb;b++)for(e=0;eb;b++){for(e=0;ec;c++){for(a=0;ab;b++)d[b]+=c instanceof Array?Math.round(r.getNormal(0,c[b])):c;return d},rgb2hsl:N,hsl2rgb:Z,toRGB:function(d){return"rgb("+d.map(function(c){return q(c,0,255)}).join(",")+")"},toHex:function(d){return"#"+d.map(function(c){return q(c,0,255).toString(16).padStart(2,"0")}).join("")}}),fa=function(d){function c(){var a=d.call(this)||this;a._uniforms={};try{a._gl=a._initWebGL()}catch(e){alert(e.message)}return a}_inheritsLoose(c,d);c.isSupported=function(){return!!document.createElement("canvas").getContext("webgl2", {preserveDrawingBuffer:!0})};var b=c.prototype;b.schedule=function(a){requestAnimationFrame(a)};b.getContainer=function(){return this._gl.canvas};b.setOptions=function(a){var e=this;d.prototype.setOptions.call(this,a);this._updateSize();var f=this._options.tileSet;f&&"complete"in f&&!f.complete?f.addEventListener("load",function(){return e._updateTexture(f)}):this._updateTexture(f)};b.draw=function(a,e){var f=this._gl,b=this._options,k=a[0],h=a[1],c=a[2],d=a[3];a=a[4];f.scissor(k*b.tileWidth,f.canvas.height- (h+1)*b.tileHeight,b.tileWidth,b.tileHeight);e&&(b.tileColorize?f.clearColor(0,0,0,0):f.clearColor.apply(f,J(a)),f.clear(f.COLOR_BUFFER_BIT));if(c)for(e=[].concat(c),c=[].concat(a),d=[].concat(d),f.uniform2fv(this._uniforms.targetPosRel,[k,h]),k=0;ka||0>e||a>=f.width||e>=f.height?[-1,-1]:this._normalizedEventToPosition(a,e)};b._initWebGL=function(){var a=this,e=document.createElement("canvas").getContext("webgl2",{preserveDrawingBuffer:!0});window.gl=e;var f=ka(e,qa,ra);e.useProgram(f);la(e);sa.forEach(function(b){return a._uniforms[b]=e.getUniformLocation(f,b)});this._program=f;e.enable(e.BLEND);e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA); e.enable(e.SCISSOR_TEST);return e};b._normalizedEventToPosition=function(a,e){return[Math.floor(a/this._options.tileWidth),Math.floor(e/this._options.tileHeight)]};b._updateSize=function(){var a=this._gl,e=this._options,f=[e.width*e.tileWidth,e.height*e.tileHeight];a.canvas.width=f[0];a.canvas.height=f[1];a.viewport(0,0,f[0],f[1]);a.uniform2fv(this._uniforms.tileSize,[e.tileWidth,e.tileHeight]);a.uniform2fv(this._uniforms.targetSize,f)};b._updateTexture=function(a){var e=this._gl,f=e.createTexture(); e.bindTexture(e.TEXTURE_2D,f);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT);e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,0);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,a)};return c}(G),sa="targetPosRel tilesetPosAbs tileSize targetSize colorize bg tint".split(" "),qa="#version 300 es\n\nin vec2 tilePosRel;\nout vec2 tilesetPosPx;\n\nuniform vec2 tilesetPosAbs;\nuniform vec2 tileSize;\nuniform vec2 targetSize;\nuniform vec2 targetPosRel;\n\nvoid main() {\n\tvec2 targetPosPx = (targetPosRel + tilePosRel) * tileSize;\n\tvec2 targetPosNdc = ((targetPosPx / targetSize)-0.5)*2.0;\n\ttargetPosNdc.y *= -1.0;\n\n\tgl_Position = vec4(targetPosNdc, 0.0, 1.0);\n\ttilesetPosPx = tilesetPosAbs + tilePosRel * tileSize;\n}", ra="#version 300 es\nprecision highp float;\n\nin vec2 tilesetPosPx;\nout vec4 fragColor;\nuniform sampler2D image;\nuniform bool colorize;\nuniform vec4 bg;\nuniform vec4 tint;\n\nvoid main() {\n\tfragColor = vec4(0, 0, 0, 1);\n\n\tvec4 texel = texelFetch(image, ivec2(tilesetPosPx), 0);\n\n\tif (colorize) {\n\t\ttexel.rgb = tint.a * tint.rgb + (1.0-tint.a) * texel.rgb;\n\t\tfragColor.rgb = texel.a*texel.rgb + (1.0-texel.a)*bg.rgb;\n\t\tfragColor.a = texel.a + (1.0-texel.a)*bg.a;\n\t} else {\n\t\tfragColor = texel;\n\t}\n}", P={},ha=function(d){function c(){var a=d.call(this)||this;a._offset=[0,0];a._cursor=[-1,-1];a._lastColor="";return a}_inheritsLoose(c,d);var b=c.prototype;b.schedule=function(a){setTimeout(a,1E3/60)};b.setOptions=function(a){d.prototype.setOptions.call(this,a);var e=[a.width,a.height];this._offset=this.computeSize().map(function(a,b){return Math.floor((a-e[b])/2)})};b.clear=function(){process.stdout.write("\u001b[0;48;5;"+Q(this._options.bg)+"m\u001b[2J")};b.draw=function(a,e){var f=a[2],b=a[3],k= a[4],h=this._offset[0]+a[0],c=this._offset[1]+a[1];a=this.computeSize();if(!(0>h||h>=a[0]||0>c||c>=a[1])){if(h!==this._cursor[0]||c!==this._cursor[1])process.stdout.write("\u001b["+(c+1)+";"+(h+1)+"H"),this._cursor[0]=h,this._cursor[1]=c;e&&(f||(f=" "));f&&(e="\u001b[0;38;5;"+Q(b)+";48;5;"+Q(k)+"m",e!==this._lastColor&&(process.stdout.write(e),this._lastColor=e),"\t"!=f&&(f=[].concat(f),process.stdout.write(f[0])),this._cursor[0]++,this._cursor[0]>=a[0]&&(this._cursor[0]=0,this._cursor[1]++))}};b.computeFontSize= function(){throw Error("Terminal backend has no notion of font size");};b.eventToPosition=function(a,e){return[a,e]};b.computeSize=function(){return[process.stdout.columns,process.stdout.rows]};return c}(G),ma=/%([bc]){([^}]*)}/g;G=Object.freeze({TYPE_TEXT:0,TYPE_NEWLINE:1,TYPE_FG:2,TYPE_BG:3,measure:function(d,c){var b={width:0,height:1};d=R(d,c);for(var a=c=0;a>8,17===u||46<=u&&159>=u||172<=u&&215>=u||43360<=g&&43391>=g)){this.draw(c+0,e,q,k,l);this.draw(c+1,e,"\t",k,l);c+=2;continue}u=65280g||65500g||65518this._options.order?b=b.slice(-this._options.order):b.length=a.length)break;var l=a[f++]}else{f=a.next();if(f.done)break;l=f.value}this.lessThan(this.heap[l],this.heap[b])&&(b=l)}return b};c.updateUp=function(b){if(0!=b){var a=this.parentNode(b);this.existNode(a)&&this.lessThan(this.heap[b],this.heap[a])&&(this.swap(b,a),this.updateUp(a))}};c.updateDown=function(b){var a=this.leftChildNode(b),e=this.rightChildNode(b);this.existNode(a)&&(a=this.minNode([b, a,e]),a!=b&&(this.swap(b,a),this.updateDown(a)))};c.debugPrint=function(){console.log(this.heap)};return d}(),ja=function(){function d(){this._time=0;this._events=new ia}var c=d.prototype;c.getTime=function(){return this._time};c.clear=function(){this._events=new ia;return this};c.add=function(b,a){this._events.push(b,a)};c.get=function(){if(!this._events.len())return null;var b=this._events.pop(),a=b.key;b=b.value;0a)return e=this._visibleCoords(0,e,b,l),a=this._visibleCoords(360+a,360,b,l),e||a;for(var f=0;fe[0])return a=this._checkVisibility(a,[a[1],a[1]],b,c),e=this._checkVisibility([0,1],e,b,c),(a+e)/2;for(var f=0,l=!1;fd&&f%2&&(g=!1);if(!g)return 0;l=d-f+1;if(l%2)f%2?(d=c[f],d=(e[0]*d[1]-d[0]*e[1])/(d[1]*e[1]),b&& c.splice(f,l,e)):(d=c[d],d=(d[0]*a[1]-a[0]*d[1])/(a[1]*d[1]),b&&c.splice(f,l,a));else if(f%2)p=c[f],d=c[d],d=(d[0]*p[1]-p[0]*d[1])/(p[1]*d[1]),b&&c.splice(f,l);else return b&&c.splice(f,l,a,e),1;return d/((e[0]*a[1]-a[0]*e[1])/(a[1]*e[1]))};return c}(x);var B=[[-1,0,0,1],[0,-1,1,0],[0,-1,-1,0],[-1,0,0,-1],[1,0,0,-1],[0,1,-1,0],[0,1,1,0],[1,0,0,1]];x=function(d){function c(){return d.apply(this,arguments)||this}_inheritsLoose(c,d);var b=c.prototype;b.compute=function(a,e,b,c){c(a,e,0,1);for(var f= 0;f=f;){f+=1;var n=a+f*m+l*p,r=e+f*g+l*y,q=(f-.5)/(l+.5),t=(f+.5)/(l-.5);if(!(t>c)){if(qthis._options.timeLimit)return null;this._map=this._fillMap(1);this._dug=0;this._rooms=[];this._unconnected=[];this._generateRooms();if(!(2>this._rooms.length)&&this._generateCorridors())break}if(a)for(b=0;bthis._options.roomDugPercentage)break}while(f)};b._generateRoom=function(){for(var a=0;a=m&&d[e]<=g){c=d.slice();m=0;switch(h){case 0:m=b.getTop()-1;break;case 1:m=b.getRight()+1;break;case 2:m=b.getBottom()+1;break;case 3:m=b.getLeft()-1}c[(e+1)%2]=m;this._digLine([d,c])}else if(d[e]g+1){c=d[e]-c[e];m=0;switch(h){case 0:case 1:m=0>c?3:1; break;case 2:case 3:m=0>c?1:3}c=this._placeInWall(b,(h+m)%4);if(!c)return!1;h=[0,0];h[e]=d[e];e=(e+1)%2;h[e]=c[e];this._digLine([d,h,c])}else{m=(e+1)%2;c=this._placeInWall(b,h);if(!c)return!1;h=Math.round((c[m]+d[m])/2);g=[0,0];var n=[0,0];g[e]=d[e];g[m]=h;n[e]=c[e];n[m]=h;this._digLine([d,g,n,c])}a.addDoor(d[0],d[1]);b.addDoor(c[0],c[1]);e=this._unconnected.indexOf(a);-1!=e&&(this._unconnected.splice(e,1),this._connected.push(a));e=this._unconnected.indexOf(b);-1!=e&&(this._unconnected.splice(e, 1),this._connected.push(b));return!0};b._placeInWall=function(a,b){var e=[0,0],c=[0,0],d=0;switch(b){case 0:c=[1,0];e=[a.getLeft(),a.getTop()-1];d=a.getRight()-a.getLeft()+1;break;case 1:c=[0,1];e=[a.getRight()+1,a.getTop()];d=a.getBottom()-a.getTop()+1;break;case 2:c=[1,0];e=[a.getLeft(),a.getBottom()+1];d=a.getRight()-a.getLeft()+1;break;case 3:c=[0,1],e=[a.getLeft()-1,a.getTop()],d=a.getBottom()-a.getTop()+1}a=[];b=-2;for(var h=0;ha||0>b||a>=this._width||b>=this._height?!1:1==this._map[a][b]};b._canBeDugCallback=function(a,b){return 1>a||1>b||a+ 1>=this._width||b+1>=this._height?!1:1==this._map[a][b]};return c}(F);var D=function(d){function c(a,b,f){void 0===f&&(f={});a=d.call(this,a,b)||this;a._options={born:[5,6,7,8],survive:[4,5,6,7,8],topology:8};a.setOptions(f);a._dirs=w[a._options.topology];a._map=a._fillMap(0);return a}_inheritsLoose(c,d);var b=c.prototype;b.randomize=function(a){for(var b=0;bh||h>=this._width||0>d||d>=this._height||(e+=1==this._map[h][d]?1:0)}return e};b.connect=function(a,b,f){b||(b=0);var e=[],c={},d=1,m=[0,0];6==this._options.topology&&(d=2,m=[0,1]);for(var g=0;gp&&!(h.lengthd);p++);return[e,c]};b._getClosest=function(a,b){var e=null,c=null,d;for(d in b){var h=b[d],g=(h[0]-a[0])*(h[0]-a[0])+(h[1]-a[1])*(h[1]-a[1]);if(null==c||gl[1]&&(e--,g=1);k=kl[0]?k-g:l[1]%2?k-g:k+g;this._map[k][e]=d;g=[k,e];var n=this._pointKey(g);f[n]=g;delete c[n]}h&&h(b,a)};b._freeSpace=function(a,b,f){return 0<= a&&athis._options.timeLimit)break;var d=this._findWall();if(!d)break;var h=d.split(",");d=parseInt(h[0]);h=parseInt(h[1]);var g=this._getDiggingDirection(d,h);if(g){var p=0;do if(p++,this._tryFeature(d,h,g[0],g[1])){this._removeSurroundingWalls(d,h);this._removeSurroundingWalls(d-g[0],h-g[1]);break}while(pa||0>b||a>=this._width||b>=this._height?!1:1==this._map[a][b]};b._canBeDugCallback=function(a,b){return 1>a||1>b||a+1>=this._width||b+1>=this._height?!1:1==this._map[a][b]};b._priorityWallCallback=function(a,b){this._walls[a+","+b]=2};b._firstRoom=function(){var a= L.createRandomCenter(Math.floor(this._width/2),Math.floor(this._height/2),this._options);this._rooms.push(a);a.create(this._digCallback)};b._findWall=function(){var a=[],b=[],f;for(f in this._walls)2==this._walls[f]?b.push(f):a.push(f);a=b.length?b:a;if(!a.length)return null;a=r.getItem(a.sort());delete this._walls[a];return a};b._tryFeature=function(a,b,f,c){var e=r.getWeightedValue(this._features);a=xa[e].createRandomAt(a,b,f,c,this._options);if(!a.isValid(this._isWallCallback,this._canBeDugCallback))return!1; a.create(this._digCallback);a instanceof L&&this._rooms.push(a);a instanceof V&&(a.createPriorityWalls(this._priorityWallCallback),this._corridors.push(a));return!0};b._removeSurroundingWalls=function(a,b){for(var e=w[4],c=0;c=a||0>=b||a>=this._width-1||b>=this._height-1)return null;for(var e=null,c=w[4],d=0;dq;q++){var u=m+2*h[q][0];var t=p+2*h[q][1];if(this._isFree(d,u,t,b,c)){d[u][t]=0;d[m+h[q][0]][p+h[q][1]]=0;m=u;p=t;n=!1;g++;break}}}while(!n)}}while(g+1b;b++)a[b][0]=0,a[b][1]=0;switch(Math.floor(4*r.getUniform())){case 0:a[0][0]=-1;a[1][0]=1;a[2][1]=-1;a[3][1]=1;break;case 1:a[3][0]=-1;a[2][0]=1;a[1][1]=-1;a[0][1]=1;break;case 2:a[2][0]=-1;a[3][0]=1;a[0][1]=-1;a[1][1]=1;break;case 3:a[1][0]=-1,a[0][0]=1,a[3][1]=-1,a[2][1]=1}};b._isFree=function(a,b,c,d,g){return 1>b||1>c||b>=d||c>=g?!1:a[b][c]};return c}(x);x=function(d){function c(a,b,c){a=d.call(this,a,b)||this;a.map=[];a.rooms=[];a.connectedCells=[];c=Object.assign({cellWidth:3, cellHeight:3},c);c.hasOwnProperty("roomWidth")||(c.roomWidth=a._calculateRoomSize(a._width,c.cellWidth));c.hasOwnProperty("roomHeight")||(c.roomHeight=a._calculateRoomSize(a._height,c.cellHeight));a._options=c;return a}_inheritsLoose(c,d);var b=c.prototype;b.create=function(a){this.map=this._fillMap(1);this.rooms=[];this.connectedCells=[];this._initRooms();this._connectRooms();this._connectUnconnectedRooms();this._createRandomRoomConnections();this._createRooms();this._createCorridors();if(a)for(var b= 0;ba&&(a=2);2>e&&(e=2);return[a,e]};b._initRooms=function(){for(var a=0;ah||h>=this._options.cellWidth||0>g||g>=this._options.cellHeight)){var m=this.rooms[a][b];if(0q||q>=a||0>n||n>=b)){d=this.rooms[q][n];g=!0;if(0==d.connections.length)break;for(q=0;qt-(v.y+v.height);)t++;if(0u-(v.x+v.width);)u++;v=Math.round(r.getUniformInt(0,g-m)/2);for(var A=Math.round(r.getUniformInt(0,h-p)/2);u+v+m>=a;)v?v--:m--;for(;t+A+p>=b;)A?A--:p--;u+=v;t+=A;this.rooms[w][x].x=u;this.rooms[w][x].y=t;this.rooms[w][x].width=m;this.rooms[w][x].height=p;for(v=u;vc.cellx?(g=2,h=4):d.cellxc.celly?(g=3,h=1):(g=1,h=3),this._drawCorridor(this._getWallPosition(c,g),this._getWallPosition(d,h))}};return c}(x); z={Arena:z,Uniform:C,Cellular:D,Digger:F,EllerMaze:ya,DividedMaze:za,IceyMaze:Aa,Rogue:x};var Ba=.5*(Math.sqrt(3)-1),I=(3-Math.sqrt(3))/6;x={Simplex:function(d){function c(b){void 0===b&&(b=256);var a=d.call(this)||this;a._gradients=[[0,-1],[1,-1],[1,0],[1,1],[0,1],[-1,1],[-1,0],[-1,-1]];for(var c=[],f=0;fv){var w=1;var x=0}else w=0,x=1;t=p-w+I;var z=v-x+I;a=p-1+2*I;b=v-1+2*I;q=n(q,g);g=n(r,g);var A=.5-p*p-v*v;0<=A&&(A*=A,r=d[q+c[g]],k=this._gradients[r],k=A*A*(k[0]*p+k[1]*v));p=.5-t*t-z*z;0<=p&&(p*=p,r=d[q+w+c[g+x]],h=this._gradients[r],h=p*p*(h[0]*t+h[1]*z));p=.5-a*a-b*b;0<=p&&(p*=p,r=d[q+1+c[g+1]],c=this._gradients[r],m=p*p*(c[0]*a+c[1]*b)); return 70*(k+h+m)};return c}(function(){})};D=function(){function d(c,b,a,e){void 0===e&&(e={});this._toX=c;this._toY=b;this._passableCallback=a;this._options=Object.assign({topology:8},e);this._dirs=w[this._options.topology];8==this._options.topology&&(this._dirs=[this._dirs[0],this._dirs[2],this._dirs[4],this._dirs[6],this._dirs[1],this._dirs[3],this._dirs[5],this._dirs[7]])}d.prototype._getNeighbors=function(c,b){for(var a=[],e=0;en;n++){var q=Math.round(g[n]*k);h[n]=q;m+=q}m>this._options.emissionThreshold&&(c[d]=h)}}return c};c._emitLightFromCell=function(b,a,c,d){var e=b+","+a;b=e in this._fovCache?this._fovCache[e]:this._updateFOV(b,a);for(var f in b){a=b[f];f in d?e=d[f]:(e=[0,0,0],d[f]=e);for(var g=0;3>g;g++)e[g]+=Math.round(c[g]*a)}return this};c._updateFOV=function(b,a){var c={};this._fovCache[b+","+a]=c;var d=this._options.range;this._fov.compute(b,a,d,function(a,b,e,f){e=f*(1-e/d);0!=e&& (c[a+","+b]=e)}.bind(this));return c};return d}();g.Util=oa;g.Color=pa;g.Text=G;g.RNG=r;g.Display=va;g.StringGenerator=wa;g.EventQueue=ja;g.Scheduler=U;g.FOV=H;g.Map=z;g.Noise=x;g.Path=C;g.Engine=D;g.Lighting=F;g.DEFAULT_WIDTH=80;g.DEFAULT_HEIGHT=25;g.DIRS=w;g.KEYS={VK_CANCEL:3,VK_HELP:6,VK_BACK_SPACE:8,VK_TAB:9,VK_CLEAR:12,VK_RETURN:13,VK_ENTER:14,VK_SHIFT:16,VK_CONTROL:17,VK_ALT:18,VK_PAUSE:19,VK_CAPS_LOCK:20,VK_ESCAPE:27,VK_SPACE:32,VK_PAGE_UP:33,VK_PAGE_DOWN:34,VK_END:35,VK_HOME:36,VK_LEFT:37, VK_UP:38,VK_RIGHT:39,VK_DOWN:40,VK_PRINTSCREEN:44,VK_INSERT:45,VK_DELETE:46,VK_0:48,VK_1:49,VK_2:50,VK_3:51,VK_4:52,VK_5:53,VK_6:54,VK_7:55,VK_8:56,VK_9:57,VK_COLON:58,VK_SEMICOLON:59,VK_LESS_THAN:60,VK_EQUALS:61,VK_GREATER_THAN:62,VK_QUESTION_MARK:63,VK_AT:64,VK_A:65,VK_B:66,VK_C:67,VK_D:68,VK_E:69,VK_F:70,VK_G:71,VK_H:72,VK_I:73,VK_J:74,VK_K:75,VK_L:76,VK_M:77,VK_N:78,VK_O:79,VK_P:80,VK_Q:81,VK_R:82,VK_S:83,VK_T:84,VK_U:85,VK_V:86,VK_W:87,VK_X:88,VK_Y:89,VK_Z:90,VK_CONTEXT_MENU:93,VK_NUMPAD0:96, VK_NUMPAD1:97,VK_NUMPAD2:98,VK_NUMPAD3:99,VK_NUMPAD4:100,VK_NUMPAD5:101,VK_NUMPAD6:102,VK_NUMPAD7:103,VK_NUMPAD8:104,VK_NUMPAD9:105,VK_MULTIPLY:106,VK_ADD:107,VK_SEPARATOR:108,VK_SUBTRACT:109,VK_DECIMAL:110,VK_DIVIDE:111,VK_F1:112,VK_F2:113,VK_F3:114,VK_F4:115,VK_F5:116,VK_F6:117,VK_F7:118,VK_F8:119,VK_F9:120,VK_F10:121,VK_F11:122,VK_F12:123,VK_F13:124,VK_F14:125,VK_F15:126,VK_F16:127,VK_F17:128,VK_F18:129,VK_F19:130,VK_F20:131,VK_F21:132,VK_F22:133,VK_F23:134,VK_F24:135,VK_NUM_LOCK:144,VK_SCROLL_LOCK:145, VK_CIRCUMFLEX:160,VK_EXCLAMATION:161,VK_DOUBLE_QUOTE:162,VK_HASH:163,VK_DOLLAR:164,VK_PERCENT:165,VK_AMPERSAND:166,VK_UNDERSCORE:167,VK_OPEN_PAREN:168,VK_CLOSE_PAREN:169,VK_ASTERISK:170,VK_PLUS:171,VK_PIPE:172,VK_HYPHEN_MINUS:173,VK_OPEN_CURLY_BRACKET:174,VK_CLOSE_CURLY_BRACKET:175,VK_TILDE:176,VK_COMMA:188,VK_PERIOD:190,VK_SLASH:191,VK_BACK_QUOTE:192,VK_OPEN_BRACKET:219,VK_BACK_SLASH:220,VK_CLOSE_BRACKET:221,VK_QUOTE:222,VK_META:224,VK_ALTGR:225,VK_WIN:91,VK_KANA:21,VK_HANGUL:21,VK_EISU:22,VK_JUNJA:23, VK_FINAL:24,VK_HANJA:25,VK_KANJI:25,VK_CONVERT:28,VK_NONCONVERT:29,VK_ACCEPT:30,VK_MODECHANGE:31,VK_SELECT:41,VK_PRINT:42,VK_EXECUTE:43,VK_SLEEP:95};Object.defineProperty(g,"__esModule",{value:!0})});