@screeps/renderer 1.5.18 → 1.5.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/renderer.js CHANGED
@@ -184,5 +184,5 @@ var ne="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nunifor
184
184
  * pixi-filters is licensed under the MIT License.
185
185
  * http://www.opensource.org/licenses/mit-license
186
186
  */
187
- var le="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",ce="varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float radius;\nuniform float angle;\nuniform vec2 offset;\nuniform vec4 filterArea;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 twist(vec2 coord)\n{\n coord -= offset;\n\n float dist = length(coord);\n\n if (dist < radius)\n {\n float ratioDist = (radius - dist) / radius;\n float angleMod = ratioDist * ratioDist * angle;\n float s = sin(angleMod);\n float c = cos(angleMod);\n coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);\n }\n\n coord += offset;\n\n return coord;\n}\n\nvoid main(void)\n{\n\n vec2 coord = mapCoord(vTextureCoord);\n\n coord = twist(coord);\n\n coord = unmapCoord(coord);\n\n gl_FragColor = texture2D(uSampler, coord );\n\n}\n",he=function(t){function e(e,r,n){void 0===e&&(e=200),void 0===r&&(r=4),void 0===n&&(n=20),t.call(this,le,ce),this.radius=e,this.angle=r,this.padding=n}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={offset:{},radius:{},angle:{}};return r.offset.get=function(){return this.uniforms.offset},r.offset.set=function(t){this.uniforms.offset=t},r.radius.get=function(){return this.uniforms.radius},r.radius.set=function(t){this.uniforms.radius=t},r.angle.get=function(){return this.uniforms.angle},r.angle.set=function(t){this.uniforms.angle=t},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.TwistFilter=he;var fe=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};function de(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,r){return function n(i,o){try{var a=e[i](o),s=a.value}catch(t){return void r(t)}if(!a.done)return Promise.resolve(s).then(function(t){n("next",t)},function(t){n("throw",t)});t(s)}("next")})}}const{TextureCache:pe}=i.utils,_e=100,ve=3e3,ge=100,ye={};class me{constructor(t){const{logger:e,world:r}=t;this.logger=e,this.world=r,this.delivering=!1,this.loadedResources={},this.queue=[],this.maxSvgSize=Math.round(ve/ge)*ge}load(t={},e=[]){return new Promise((e,r)=>{try{Object.keys(t).forEach(e=>i.loader.add(e,t[e])),i.loader.load((t,r)=>{Object.assign(this.loadedResources,r),e()})}catch(t){r(t)}}).then(()=>Promise.all(e.map(t=>{const e=this.loadedResources[t];return e||this.logger.error("Cannot create scaled textures for",t),e.texture._resourceName=e.name,new Promise((t,r)=>{if(ye[e.name])t();else{const n=new XMLHttpRequest;n.onload=(()=>{if(n.readyState!==n.DONE||200!==n.status)throw new Error("Failed to load SVG using XHR.");ye[e.name]=n.response,t()}),n.onerror=r,n.open("GET",e.url,!0),n.send()}}).then(()=>{const t=[];for(let r=_e;r<=this.maxSvgSize;r+=ge){let n=pe[e.name+r];if(!n){const t=new i.BaseTexture;t.sourceScale=r/this.world.options.VIEW_BOX,t.imageUrl=e.url,t.source=e.data,t._loadSvgSourceUsingString(ye[e.name]),n=new i.Texture(t),i.Texture.addToCache(n,e.name+r)}e.scaledSvgTextures=e.scaledSvgTextures||{},e.scaledSvgTextures[r]=n,t.push(new Promise(t=>lt.onTextureLoaded(n,t)))}return Promise.all(t)})}))).then(()=>this.loadedResources)}getResource(t,...e){var r=this;return de(function*(){const{logger:n}=r;return r.delivering?new Promise(function(i,o){n.debug(`Put resource to queue resource ${t}`),r.queue.push({resource:{name:t,otherParams:fe({},e)},resolve:i,reject:o})}):(n.debug(`Getting resource ${t}`),r.loadedResources[t]||r._loadResource.apply(r,[t].concat(e)))})()}getCachedResource(t){return this.loadedResources[t]}release(){this.loadedResources={},i.loader.reset()}_loadResource(t,e=t){var r=this;return de(function*(){const{logger:n}=r;r.delivering=!0;try{const o={loadType:2};return i.loader.add(t,e,o),n.debug(`Delivering resource ${t}`),(yield r.load())[t]}finally{i.loader.reset(),r.delivering=!1,r._loadRest()}})()}_loadRest(){var t=this;return de(function*(){const{logger:e}=t,r=t.queue.shift();if(r){const{resource:{name:n},resolve:i,reject:o}=r,a=function(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}(r.resource.otherParams,[]);try{e.debug(`Taking the next resource ${n}`),i(yield t.getResource.apply(t,[n].concat(function(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)}(a))))}catch(t){e.warn(`Something wrong loading resource ${n}`,t),o(t)}yield t._loadRest()}else e.debug("No resource in queue. Idling")})()}}var Ee=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};const{BlurFilter:xe}=i.filters;var be=(t,e,r=[])=>{const{rootContainer:n,logger:i,id:o="object",payload:{id:a=o,parentId:s,addToParent:u=!0,Class:l=e,constructorParams:c=r,width:h,height:f,scale:d,shouldCreate:p=!0,pivot:_,anchor:v,blur:g}={},scope:y}=t,m=function(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}(t.payload,["id","parentId","addToParent","Class","constructorParams","width","height","scale","shouldCreate","pivot","anchor","blur"]),E=y[a];if(E&&(E.destroy(),delete y[a]),!lt.parseExpression(p,t))return;const x=s?y[s]:n;if(!x)return void i.warn("No parent available with id",s);const b=new(Function.prototype.bind.apply(l,[null].concat(function(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)}(c)))),T=d?Ee({},d):{x:1,y:1},R=_?Ee({},_):{},O=v?Ee({},v):{};if(void 0!==h&&(b._parsedWidth=lt.parseExpression(h,t),T.x=b._parsedWidth/b.width,void 0===f&&(T.y=T.x,b._parsedHeight=b._parsedWidth)),void 0!==f&&(b._parsedHeight=lt.parseExpression(f,t),T.y=b._parsedHeight/b.height,void 0===h&&(T.x=T.y,b._parsedWidth=b._parsedHeight)),void 0!==R.x?R.x=lt.parseExpression(R.x,t)/T.x:void 0===O.x&&(O.x=.5),void 0!==R.y?R.y=lt.parseExpression(R.y,t)/T.y:void 0===O.y&&(O.y=.5),Object.assign(b,lt.parseExpression(m,t)),Object.assign(b.scale,lt.parseExpression(T,t)),b.anchor&&Object.assign(b.anchor,lt.parseExpression(O,t)),Object.assign(b.pivot,lt.parseExpression(R,t)),void 0!==g){const e=new xe(lt.parseExpression(g,t));e.blendMode=b.blendMode,b.filters=[e]}u&&x.addChild(b),y[a]=b;const S=b.destroy.bind(b);return b.destroy=(()=>{y[a]=void 0,S()}),b},Te=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};function Re(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}var Oe=t=>{const{logger:e,payload:{drawings:r=[]}={}}=t,n=Re(t.payload,["drawings"]),o=Re(t,["logger","payload"]),a=be(Object.assign(t,Te({logger:e,payload:n},o)),i.Graphics);return a&&r.forEach(({method:r,params:n=[]})=>{const i=lt.parseExpressions(n,t),o=a[r];o||e.warn("Cannot resolve drawing method",r),o.call.apply(o,[a].concat(function(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)}(i)))}),a},Se=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};function we(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}var Ce=t=>{const{payload:{color:e,radius:r=25,stroke:n=0,strokeWidth:i}={}}=t,o=we(t.payload,["color","radius","stroke","strokeWidth"]),a=we(t,["payload"]),s=Oe(Se({payload:o},a));return s&&(i&&s.lineStyle(i,n,1),(e||0===e)&&s.beginFill(e),s.drawCircle(0,0,lt.parseExpression(r,t)),(e||0===e)&&s.endFill()),s},Ae=t=>be(t,i.Container);const Ie=(t,e,r,n)=>{let i=Math.atan2(n-e,r-t)+Math.PI/2;return i>Math.PI?i-=2*Math.PI:i<-Math.PI&&(i+=2*Math.PI),i},Pe=({x:t,y:e},{CELL_SIZE:r})=>({x:r*t,y:r*e});const{BlurFilter:Me}=i.filters,De=.6,Le=16770355,Ue=16724787,Ne=16777011,Fe=2941736,je=13385022,ke=3962311,Be=12164347,He=16777215,Xe=16770355;function We(t,e,r){return t+(e-t)*r}function Ge(t,e,r,n,i,o,a){if(n.x===i.x&&n.y===i.y)return;const{ATTACK_PENETRATION:s}=a,{x:u,y:l}=Pe(i,a),{x:c,y:h}=Pe(n,a);e.x=c,e.y=h;const f=u-c,d=l-h,p=0!==f?f/Math.abs(f)*s:0,_=0!==d?d/Math.abs(d)*s:0;r.mainContainer&&t.push({action:new L(Ie(e.x,e.y,u,l),Math.max(o/5,.4)),target:r.mainContainer}),t.push({action:new N([new M(p,_,1*o/4),new M(-p,-_,3*o/4)]),target:e})}function Ye(t,e,r,n,i=0){const o=new N([new d(i),new h(1,(r-i)/4),new h(0,3*(r-i)/4)]);return t.coverSprite.children[0].tint=e,t.coverSprite.children[1].tint=e,n&&t.coverSprite.position.copy(n),{action:o,target:t.coverSprite}}function ze(t,e,r,n=0){const i=new N([new d(n),new h(.5,(r-n)/4),new h(0,3*(r-n)/4)]);return t.childCoverSprite.tint=e,{action:i,target:t.childCoverSprite}}function Ve(t,e,r,n,o,a,s,u=12,l,c=De){const h=c*o,d=new i.Graphics;d.x=r.x,d.y=r.y;const{x:p,y:_}=Pe(n,a),v=p-d.x,g=_-d.y;return l&&(d.filters=[new Me(l)],d.alpha=.7),e.app.renderer instanceof i.WebGLRenderer&&(d.blendMode=i.BLEND_MODES.ADD),d.parentLayer=e.layers.effects,t.addChild(d),{action:new f(function(t,e,r,n,i,o,a){return(s,u,l)=>{const c=u-l;if(c<=0)return void s.destroy(!0);let h=c/(1e3*t);s.clear(),s.lineStyle(e,r,1),h<.5?(h*=2,s.moveTo(n,i),s.lineTo(We(n,o,h),We(i,a,h))):(h=2*(h-.5),s.moveTo(n+(o-n)*h,i+(a-i)*h),s.lineTo(o,a))}}(h,u,s,v,g,0,0),h),target:d}}function Ke(t,e,r,n,i,o,a,s,u,l,c){t.push(Ve(e,r,n,i,o,a,s,u,void 0,c)),t.push(Ve(e,r,n,i,o,a,s,u,l,c))}const qe=-Math.PI/2,Ze=2*Math.PI/50/2,$e=50,Je=18,Qe={move:{color:11188165,order:0,backSide:!0},work:{color:16639348,order:1},carry:{color:6710886,order:6},attack:{color:16199233,order:2},ranged_attack:{color:8366053,order:3},heal:{color:5689182,order:4},claim:{color:12164347,order:5}};function tr(t,e,r,n,o,a){const s=new i.Graphics;return s.lineStyle(Je,t,1),s.arc(0,0,$e-Je/2,qe+e,qe+r,a),s.tint=t,n.addChild(s),o.push(s),s}function er(t){return Array.isArray(t)?t:Object.keys(t).sort().map(e=>t[e])}var rr=r(1),nr=r.n(rr);const ir={[nr.a.PWR_DISRUPT_SOURCE]:"disrupt-source",[nr.a.PWR_DISRUPT_SPAWN]:"disrupt-spawn",[nr.a.PWR_DISRUPT_TERMINAL]:"disrupt-terminal",[nr.a.PWR_DISRUPT_TOWER]:"disrupt-tower",[nr.a.PWR_REGEN_MINERAL]:"regen-mineral",[nr.a.PWR_REGEN_SOURCE]:"regen-source",[nr.a.PWR_GENERATE_OPS]:"generate-ops",[nr.a.PWR_OPERATE_EXTENSION]:"operate-extension",[nr.a.PWR_OPERATE_LAB]:"operate-lab",[nr.a.PWR_OPERATE_OBSERVER]:"operate-observer",[nr.a.PWR_OPERATE_SPAWN]:"operate-spawn",[nr.a.PWR_OPERATE_STORAGE]:"operate-storage",[nr.a.PWR_OPERATE_TERMINAL]:"operate-terminal",[nr.a.PWR_OPERATE_TOWER]:"operate-tower",[nr.a.PWR_SHIELD]:"shield",[nr.a.PWR_FORTIFY]:"fortify",[nr.a.PWR_OPERATE_CONTROLLER]:"operate-controller",[nr.a.PWR_OPERATE_POWER]:"operate-power",[nr.a.PWR_BERSERK]:"berserk",[nr.a.PWR_DEFEND]:"defend",[nr.a.PWR_DISABLE]:"disable",[nr.a.PWR_ENCOURAGE]:"encourage",[nr.a.PWR_EXHAUST]:"exhaust",[nr.a.PWR_RENEW]:"renew",[nr.a.PWR_SIGHT]:"sight",[nr.a.PWR_SUMMON]:"summon",[nr.a.PWR_DEMOLISH]:"demolish",[nr.a.PWR_HARVEST_ENERGY]:"harvest-energy",[nr.a.PWR_HARVEST_MINERAL]:"harvest-mineral",[nr.a.PWR_KILL]:"kill",[nr.a.PWR_MASS_REPAIR]:"mass-repair",[nr.a.PWR_PUNCH]:"punch",[nr.a.PWR_REFLECT]:"reflect",[nr.a.PWR_REINFORCE]:"reinforce",[nr.a.PWR_REMOTE_TRANSFER]:"remote-transfer",[nr.a.PWR_SNIPE]:"snipe"};var or=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};const ar={creepEnergy:{color:16770413,radius:20},energy:{color:16770413,radius:30},power:{color:15998771,radius:45}},sr={color:16777215,radius:45};function ur(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function lr(t){let e=Number(t).toString(16);return e.length<2&&(e=`0${e}`),e}function cr(t,e,r){let n,i,o;if(0===e)n=r,i=r,o=r;else{const a=r<.5?r*(1+e):r+(e-r*e),s=2*r-a;n=ur(s,a,t+1/3),i=ur(s,a,t),o=ur(s,a,t-1/3)}return[Math.round(255*n),Math.round(255*i),Math.round(255*o)]}function hr(t,e){let r=t;"string"==typeof t&&(r=parseInt(t.substr(1),16));const[n,i,o]=function(t,e,r){t/=255,e/=255,r/=255;const n=Math.max(t,e,r),i=Math.min(t,e,r);let o,a;const s=(n+i)/2;if(n===i)o=0,a=0;else{const u=n-i;switch(a=s>.5?u/(2-n-i):u/(n+i),n){case t:o=(e-r)/u+(e<r?6:0);break;case e:o=(r-t)/u+2;break;case r:o=(t-e)/u+4}o/=6}return[o,a,s]}(r>>16,r>>8&255,255&r),[a,s,u]=cr(n,i,o*e);return"string"==typeof t?`#${lr(a)}${lr(s)}${lr(u)}`:u+(s<<8)+(a<<16)}function fr(t,e){let r=t;"string"==typeof t&&(r=parseInt(t.substr(1),16));let[n,i,o]=[r>>16,r>>8&255,255&r];return n=Math.round(n*e),i=Math.round(i*e),o=Math.round(o*e),"string"==typeof t?`#${lr(n)}${lr(i)}${lr(o)}`:o+(i<<8)+(n<<16)}const dr=Math.sin(Math.PI/4);var pr=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};function _r(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}var vr=t=>{const{world:e,logger:r,payload:{text:n="?",style:o}={}}=t,a=_r(t.payload,["text","style"]),s=_r(t,["world","logger","payload"]),u=lt.parseExpression(n,t),l=lt.parseExpression(o,t),{app:{stage:c}}=e,h=be(pr({world:e,logger:r,payload:a},s),i.Text,[u,l]);return lt.addTickerHandler(h,()=>{h.scale.x=1/c.scale.x,h.scale.y=1/c.scale.y,h.style.fontSize=l.fontSize*c.scale.x,h.style.strokeThickness=(l.strokeThickness||0)*c.scale.x}),lt.addTickerHandler(h,()=>lt.alignPositionToPixels(h,c)),h};var gr=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};var yr=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};function mr(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}var Er=t=>{const{logger:e,rootContainer:r,scope:n,world:o,objectMetadata:{texture:s},payload:{parentId:u,texture:l=s}={},stage:{resourceManager:c}}=t,h=mr(t.payload,["parentId","texture"]),f=mr(t,["logger","rootContainer","scope","world","objectMetadata","payload","stage"]);if(!l)return void e.warn("texture is not provided");let d;const p=lt.parseExpression(l,t);if(a.a.isString(p))d=c.getCachedResource(p);else if(!(d=l))return void e.warn("Cannot find resource",l);if(d){const t=be(yr({logger:e,payload:yr({},h,{parentId:u}),rootContainer:r,scope:n},f),i.Sprite,[d.texture]);return lt.setSvgResizeHandler(o,t,d),t}{const t=Ae(yr({logger:e,payload:{parentId:u},rootContainer:r,scope:n},f));return c.getResource(l).then(n=>{const a=be(yr({logger:e,payload:yr({},h,{addToParent:!1}),rootContainer:r,scope:{}},f),i.Sprite,[n.texture]);lt.setSvgResizeHandler(o,a,n),a.zIndex=-1e3,t.addChild(a)}),t}},xr=r(93),br=r.n(xr);const Tr=50;var Rr=(t,e,r,n=!1)=>{const i={},o={};let a,s="";if(0===t.length)return{md5:"",result:!1};for(let t=0;t<Tr;t+=1)i[t]=new Array(Tr),o[t]={};if(t.forEach(t=>{t.forEach(t=>{null!==t.x&&null!==t.y?(e(t)&&(i[t.x][t.y]=t,a=!0),o[t.x][t.y]=!1):console.error("null coordinates in object",t)})}),!a)return{md5:"",result:!1};const u=br()(JSON.stringify(i,(t,e)=>{if(""===t||Array.isArray(e)&&"effects"!==t||"object"==typeof e&&"effects"!==t||"x"===t||"y"===t||"type"===t)return e}));if(u===r)return{md5:u,result:null};function l(t,e){t>0&&e>0&&!i[t-1][e]?s+="a 50 50 0 0 0 -50 -50 h 50 ":s+="v -50 "}function c(t,e){e>0&&t>0&&!i[t][e-1]?s+="v -50 a 50 50 0 0 0 50 50 ":s+="h 50 "}function h(t,e){0===t||i[t-1][e]||0===e||i[t][e-1]?s+="v -50 h 50 ":s+="a 50 50 0 0 1 50 -50 "}function f(t,e){e>0&&t<Tr-1&&!i[t][e-1]?s+="a 50 50 0 0 0 50 -50 v 50 ":s+="h 50 "}function d(t,e){t<Tr-1&&e>0&&!i[t+1][e]?s+="h 50 a 50 50 0 0 0 -50 50 ":s+="v 50 "}function p(t,e){t===Tr-1||i[t+1][e]||0===e||i[t][e-1]?s+="h 50 v 50 ":s+="a 50 50 0 0 1 50 50 "}function _(t,e){t===Tr-1||i[t+1][e]||e===Tr-1||i[t][e+1]||i[t+1][e+1]&&(i[t+1][e]||n)?s+="v 50 h -50 ":s+="a 50 50 0 0 1 -50 50 "}function v(t,e){0===t||i[t-1][e]||e===Tr-1||i[t][e+1]||i[t-1][e+1]&&(i[t-1][e]||n)?s+="h -50 v -50 ":s+="a 50 50 0 0 1 -50 -50 "}function g(t,e,r){o[t][e]?s+=r?"v 100 ":"h -100 ":(r?(0===t||0===e||i[t-1][e-1]&&(n||i[t-1][e]||i[t][e-1])?c(t,e):s+="h 50 ",t<Tr-1&&i[t+1][e]?(t===Tr-1||0===e||i[t+1][e-1]&&(n||i[t+1][e]||i[t][e-1])?f(t,e):s+="h 50 ",g(t+1,e,1),s+="h -100 "):(t===Tr-1||0===e||i[t+1][e-1]&&(n||i[t+1][e]||i[t][e-1])?(f(t,e),d(t,e)):p(t,e),_(t,e),s+="h -50 ")):(t===Tr-1||0===e||i[t+1][e-1]&&(n||i[t+1][e]||i[t][e-1])?d(t,e):s+="v 50 ",e<Tr-1&&i[t][e+1]?(s+="v 50 ",g(t,e+1,0),s+="v -50 "):(_(t,e),v(t,e)),0===t||0===e||i[t-1][e-1]?l(t,e):s+="v -50 "),t<Tr&&e<Tr&&(o[t][e]=!0))}for(let t=0;t<Tr;t+=1)for(let e=0;e<Tr;e+=1)if(i[t][e]&&!o[t][e]){s+=`M ${100*t} ${100*e+50} `,o[t][e]=!0;let r=0;do{r+=1}while(t+r<Tr&&i[t+r][e]);let a=0;do{a+=1}while(e+a<Tr&&i[t][e+a]);a<r?(0===t||0===e||i[t-1][e-1]&&(n||i[t-1][e]||i[t][e-1])?(l(t,e),c(t,e)):h(t,e),t<Tr-1&&i[t+1][e]?(t===Tr-1||0===e||i[t+1][e-1]&&(n||i[t+1][e]||i[t][e-1])?f(t,e):s+="h 50 ",g(t+1,e,1),s+="h -50 "):(t===Tr-1||0===e||i[t+1][e-1]&&(n||i[t+1][e]||i[t][e-1])?(f(t,e),d(t,e)):p(t,e),_(t,e)),v(t,e)):(0===t||0===e||i[t-1][e-1]&&(n||i[t-1][e]||i[t][e-1])?(l(t,e),c(t,e)):h(t,e),t===Tr-1||0===e||i[t+1][e-1]&&(n||i[t+1][e]||i[t][e-1])?(f(t,e),d(t,e)):p(t,e),e<Tr-1&&i[t][e+1]?(s+="v 50 ",g(t,e+1,0),s+="v -50 "):(_(t,e),v(t,e))),s+="Z "}return{md5:u,result:s}};const{TilingSprite:Or}=i.extras,{BlurFilter:Sr}=i.filters;function wr(t,{size:{width:e,height:r},VIEW_BOX:n},o){const a={viewBox:`0 0 ${n} ${n}`,"shape-rendering":"optimizeSpeed"},s=Object.entries(a).map(([t,e])=>`${t}="${encodeURIComponent(e)}"`).join(" "),u=Object.entries(o).map(([t,e])=>`${t}="${encodeURIComponent(e)}"`).join(" "),l=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${r}" ${s} data-timestamp="${Date.now()}"><path ${u} d="${t}" /></svg>`,c=i.Sprite.fromImage(`data:image/svg+xml;charset=utf8,${l}`);return c._generatedSvgTexture=!0,c}function Cr(t,e,r){lt.addTickerHandler(t,n=>{t.tilePosition.x+=n*e,t.tilePosition.y+=n*r})}var Ar=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};function Ir(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}const Pr={radius:37,color:2236962},Mr={texture:null};const Dr={slow:[[.3,5],[1,5]],fast:[[.3,1],[1,1]],blink:[[.8,2],[1,.1],[.6,4],[1,.1],[.7,1],[1,.1]],neon:[[1,1],[.95,.07],[1,.07],[1,.07],[.9,.07],[1,.07],[.7,.07],[1,.07],[1,.1],[.9,.07],[1,.07],[1,1],[.95,.07],[1,.07],[1,.07],[.9,.07],[1,.07]],flash:[[1,.1],[0,1.5],[0,2]]};var Lr={circle:Ce,container:Ae,creepActions:t=>{const{logger:e,stage:r,rootContainer:n,scope:o,tickDuration:a,state:s,prevState:u,world:l,payload:{parentId:c}={},world:{options:h}}=t,{actionLog:{attacked:f=null,attack:d=null,build:p=null,harvest:_=null,heal:v=null,healed:g=null,power:y=null,rangedAttack:m=null,rangedHeal:E=null,repair:x=null,reserveController:b=null,runReaction:T=null,reverseReaction:R=null,transferEnergy:O=null,upgradeController:S=null}={}}=s,w=c?o[c]:n;if(!w)return void e.warn("No parent available with id",c);if(!u)return;o.coverSprite||function(t,e,r,n){const o=new i.Container;o.position.copy(e.position),o.alpha=0,e.parent.addChild(o),r.coverSprite=o,e.on("removed",()=>o.destroy());const a=new i.Sprite(t.cover.texture);a.anchor.x=.5,a.anchor.y=.5,a.alpha=.3,a.parentLayer=n.layers.effects,o.addChild(a);const s=new i.Sprite(t.flare2.texture);s.blendMode=i.BLEND_MODES.ADD,s.width=300,s.height=300,s.anchor.x=.5,s.anchor.y=.5,s.alpha=.05,s.parentLayer=n.layers.effects,o.addChild(s);const u=new i.Sprite(t.glow.texture);u.anchor.x=.5,u.anchor.y=.5,u.x=0,u.y=0,u.width=500,u.height=500,u.alpha=.5,u.parentLayer=n.layers.lighting,o.addChild(u)}(r.resources,n,o,l),o.childCoverSprite||function(t,e,r,n){const o=new i.Sprite(t.cover.texture);o.anchor.x=.5,o.anchor.y=.5,o.alpha=0,o.parentLayer=n.layers.effects,o.blendMode=i.BLEND_MODES.ADD,e.addChild(o),r.childCoverSprite=o}(r.resources,w,o,l);const C=[],A=u&&(s.x!==u.x||s.y!==u.y);if(d&&("tower"===s.type?Ke(C,r,l,n,d,a,h,ke,18,5):A||Ge(C,n,o,s,d,a,h)),_&&(A||Ge(C,n,o,s,_,a,h),C.push(Ye(o,Le,.9*a,Pe(_,h)))),b&&("invaderCore"===s.type?Ke(C,r,l,n,b,a,h,Be,18,5):A||Ge(C,n,o,s,b,a,h),C.push(Ye(o,Be,.9*a,Pe(b,h),"invaderCore"===s.type?.3*a:0))),v&&("tower"===s.type?Ke(C,r,l,n,v,a,h,Fe,18,5):A||Ge(C,n,o,s,v,a,h)),f&&g?C.push(ze(o,Ne,.9*a)):g?C.push(ze(o,Fe,.9*a)):f&&C.push(ze(o,Ue,.9*a)),m&&Ke(C,r,l,n,m,a,h,ke,12,5),O&&Ke(C,r,l,n,O,a,h,Xe,18,5),E&&Ke(C,r,l,n,E,a,h,Fe,12,5),y&&Ke(C,r,l,n,y,a,h,je,12,5,.3),p&&(Ke(C,r,l,n,p,a,h,Le,"invaderCore"===s.type?18:12,5),C.push(Ye(o,Le,.9*a,Pe(p,h),.3*a))),S&&(Ke(C,r,l,n,S,a,h,Le,"invaderCore"===s.type?18:12,5),C.push(Ye(o,Le,.9*a,Pe(S,h),.3*a))),x&&(Ke(C,r,l,n,x,a,h,Le,"tower"===s.type?18:12,5),C.push(Ye(o,Le,.9*a,Pe(x,h),.3*a))),T){const{x1:t,y1:e,x2:n,y2:i}=T;Ke(C,r,l,Pe({x:t,y:e},h),s,a,h,He,12,2),Ke(C,r,l,Pe({x:n,y:i},h),s,a,h,He,12,2)}if(R){const{x1:t,y1:e,x2:i,y2:o}=R;Ke(C,r,l,n,{x:t,y:e},a,h,He,12,2),Ke(C,r,l,n,{x:i,y:o},a,h,He,12,2)}!function(t,e){t.forEach(({target:t,action:r})=>e.runAction(t,r))}(C,r.actionManager)},creepBuildBody:({logger:t,rootContainer:e,scope:r,stage:n,state:o,payload:{parentId:a}={}})=>{const{resources:s}=n,u=a?r[a]:e;if(!u)return void t.warn("No parent available with id",a);r.bodySprites?r.bodySprites.forEach(t=>u.removeChild(t)):r.bodySprites=[];const{body:l}=o,c=er(l).filter(({type:t,hits:e})=>"tough"!==t&&"carry"!==t&&e>0),h=Object.values(c.reduce((t,{type:e,hits:r})=>{const n=t[e];return n?n.hits+=r:t[e]={type:e,hits:r},t},{}));h.sort((t,e)=>t.hits<e.hits?-1:t.hits>e.hits?1:0);let f=0,d=Math.PI;h.forEach(e=>{const n=Qe[e.type];if(n){const{backSide:t,color:i}=n,o=t?d:f,a=Ze*(e.hits/100);tr(i,o,o+a,u,r.bodySprites,!1),tr(i,-o,-(o+a),u,r.bodySprites,!0),t?d+=a:f+=a}else t.warn(`Unsupported type ${e.type}`)}),er(l).filter(({type:t,hits:e})=>"tough"===t&&e>0).length>0&&function(t,e,r){const n=new i.Sprite(t.tough.texture);n.width=120,n.height=120,n.anchor.x=.5,n.anchor.y=.5,e.addChild(n),r.push(n)}(s,u,r.bodySprites)},disappear:({stage:t,rootContainer:e,tickDuration:r,callback:n})=>{const{actionManager:i}=t,o=new N([new P(r/2),new f(()=>{n()})]);i.runAction(e,o)},draw:Oe,moveTo:({firstRun:t,state:e,payload:{targetKey:r,shouldRotate:n=!1}={},rootContainer:i,stage:o,prevState:a,scope:s,tickDuration:u,world:{options:l}})=>{const{actionManager:c}=o,{x:h,y:f}=Pe(e,l),d=r?s[r]:i;if(!t){const t=[];a&&n&&t.push(new L(Ie(d.x,d.y,h,f),u/5));const e=new F(t);s.moveToAction&&c.cancelAction(s.moveToAction),s.moveToAction=c.runAction(d,e)}},object:be,powerInfluence:t=>{const{logger:e,stage:r,rootContainer:n,scope:o,tickDuration:a,state:s,prevState:u,world:l,payload:{parentId:c}={},world:{options:f}}=t,{actionLog:{power:p}={}}=s;if(!(c?o[c]:n))return void e.warn("No parent available with id",c);if(!u)return;const _=[];if(p){const t=ir[p.id];t||console.log("No texture key provided for power id",p.id);const e=r.resources[t];e||console.log("No texture provided for key ",t);const o=function(t,e,r,n){const o=new i.Container;o.position.copy(e.position),e.parent.addChild(o),e.on("removed",()=>o.destroy());const a=new i.Sprite(t.texture);return a.anchor.x=.5,a.anchor.y=.5,a.width=300,a.height=300,a.parentLayer=n.layers.effects,o.addChild(a),o}(e,n,0,l);_.push(function(t,e,r,n=0){const i=(e-n)/4,o=new N([new F([new U(.5,.5,0),new h(0,0)]),new d(n),new F([new U(1,1,i),new h(1,i)]),new h(0,i)]);return r&&t.position.copy(r),{action:o,target:t}}(o,.9*a,Pe({x:p.x,y:p.y},f),.3))}!function(t,e){t.forEach(({target:t,action:r})=>e.runAction(t,r))}(_,r.actionManager)},resourceCircle:t=>{const{state:{resourceType:e="creepEnergy",resourceType:r="energy",[r]:n,[`${r}Capacity`]:i=1250}={},prevState:{[r]:o}={},payload:{radius:a}={}}=t,s=function(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}(t,["state","prevState","payload"]);if(o!==n){const{[e]:{color:r,radius:o}=sr}=ar,u=(lt.parseExpression(a,t)||o)*Math.min(1,0!==i?n/i:0);return Ce(or({payload:{color:r,radius:u}},s))}},road:t=>{const{rootContainer:e,id:r,scope:n,stateExtra:o,world:{app:a,layers:{terrain:s},options:{CELL_SIZE:u,lighting:l="normal"},decorations:c},state:{x:h,y:f}={},stateExtra:{objects:d}}=t,p=n[r],_=p?p.knownNodes:{mm:!1,zm:!1,pm:!1,mz:!1},v={mm:!1,zm:!1,pm:!1,mz:!1};let{roads:g}=o;g||(g=function(t){const e=[];t.forEach(t=>{const{type:r,x:n,y:i}=t;"road"===r&&(e[n]||(e[n]=[]),e[n][i]=t)}),e.push([]);for(let t=0;t<e.length;t+=1)e[t]||(e[t]=[]);return e}(d),o.roads=g),v.mm=Boolean(g[h-1][f-1]),v.zm=Boolean(g[h][f-1]),v.pm=Boolean(g[h+1][f-1]),v.mz=Boolean(g[h-1][f]);const y=c.find(t=>["landscape","floorLandscape"].includes(t.decoration.type));if(!p||Object.entries(v).some(([t,e])=>e!==_[t])||p.decorationFloorLandscape!==y){const t=0,o=.15*u,c=o*dr,h=u,f=h,d=new i.Graphics;d.parentLayer=s,d.zIndex=1,a.renderer instanceof i.WebGLRenderer?("disabled"===l&&(d.tint=10526880),"low"===l&&(d.tint=12632256)):d.tint=10526880;const _=y?hr(parseInt(y.roadsColor.substring(1),16),y.roadsBrightness):11184810;return d.clear(),d.beginFill(_),d.drawCircle(t,t,o),d.endFill(),v.mm&&(d.beginFill(_),d.moveTo(t+c,t-c),d.lineTo(t-c,t+c),d.lineTo(t-c-f,t+c-f),d.lineTo(t+c-f,t-c-f),d.lineTo(t+c,t-c),d.endFill()),v.zm&&(d.beginFill(_),d.moveTo(t+o,t),d.lineTo(t-o,t),d.lineTo(t-o,t-h),d.lineTo(t+o,t-h),d.lineTo(t+o,t),d.endFill()),v.pm&&(d.beginFill(_),d.moveTo(t-c,t-c),d.lineTo(t+c,t+c),d.lineTo(t+c+f,t+c-f),d.lineTo(t-c+f,t-c-f),d.lineTo(t-c,t-c),d.endFill()),v.mz&&(d.beginFill(_),d.moveTo(t,t+o),d.lineTo(t,t-o),d.lineTo(t-h,t-o),d.lineTo(t-h,t+o),d.lineTo(t,t+o),d.endFill()),p&&p.destroy(!0),d.knownNodes=v,d.decorationFloorLandscape=y,n[r]=d,e.addChild(d),d}},runAction:{config:{isOwner:!1},run:t=>{const{rootContainer:e,scope:r,payload:{id:n}={}}=t;return n?r[n]:e}},say:t=>{const{payload:{say:e},world:{app:{stage:r}},scope:n}=t,o=lt.parseExpression(e,t),a=o.isPublic?14518408:13421772,s={align:"center",fill:"#111",fontFamily:"Roboto, sans-serif",fontSize:60},u=be(t,i.Container);n.sayContainer=u;const l=i.TextMetrics.measureText(o.message,new i.TextStyle(s)).width+60,c=new i.Graphics;c.lineStyle(8,0),c.beginFill(a),c.drawRoundedRect(-l/2,-170,l,100,30),c.drawPolygon([new i.Point(30,-74),new i.Point(0,-44),new i.Point(-30,-74)]),c.endFill(),u.addChild(c);const h=Object.assign({},t,{id:"sayText",payload:{parentId:"sayContainer",text:o.message,style:s,x:0,y:-120,anchor:{x:.5,y:.5}}});return vr(h),lt.addTickerHandler(u,()=>lt.alignPositionToPixels(u,r)),u},setBadgeUrls:({state:t,world:{options:{BADGE_URL:e}}})=>{const{users:r}=t;r&&Object.entries(r).forEach(([,t])=>{const{username:r}=t;t.badgeUrl=e.replace("%1",encodeURIComponent(r))})},siteProgress:t=>{const{rootContainer:e,scope:r,payload:n}=t,i=function(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}(t,["rootContainer","scope","payload"]),o=lt.parseExpression(n.progress,t);if(o!==r.oldProgress){r.oldProgress=o;const a=Oe(gr({rootContainer:e,scope:r},i)),s=lt.parseExpression(n.progressTotal,t),u=lt.parseExpression(n.color,t),l=lt.parseExpression(n.radius,t),c=lt.parseExpression(n.lineWidth,t);if(a.rotation=-Math.PI/2,a.beginFill(0,0),a.lineStyle(c,u,1),a.drawCircle(0,0,l+c/2),o>0&&s>0){const t=2*Math.PI*(Math.min(o,s)/s);a.beginFill(u),a.moveTo(0,0),a.lineStyle(1,u,1);const e=function(t,e){return{x:Math.cos(t)*e,y:Math.sin(t)*e}}(0,l);a.lineTo(e.x,e.y),a.arc(0,0,l,0,t),a.lineTo(0,0),a.endFill()}return a}},sprite:Er,terrain:t=>{const{world:{app:e,stage:r,decorations:n,layers:{terrain:o,lighting:a,effects:s},options:{size:u}},state:{gameData:{player:l,swampTexture:c="animated"},objects:h,users:f={},setTerrain:d},world:{options:{CELL_SIZE:p,RENDER_SIZE:_=u,VIEW_BOX:v,HALF_CELL_SIZE:g=p/2,lighting:y="normal"}}}=t,m=_.width/v;function E(t,e){return r.addChild(t),t.parentLayer=o,t.x=-p/2,t.y=-p/2,t.width=v,t.height=v,Object.assign(t,e),t}r.terrainObjects||(r.terrainObjects={},r.terrainObjects.wallMask=new i.Sprite(i.Texture.EMPTY),Object.assign(r.terrainObjects.wallMask,{x:-50,y:-50,width:5e3,height:5e3,renderable:!1}),r.addChild(r.terrainObjects.wallMask));const{terrainObjects:x}=r,b=n.find(t=>["landscape","wallLandscape"].includes(t.decoration.type)),T=n.find(t=>["landscape","floorLandscape"].includes(t.decoration.type));let{previousSwamps:R}=x;R||(R=[],x.previousSwamps=R),d&&(R=h.filter(({type:t})=>"swamp"===t),x.previousSwamps=R),T!==x.decorationFloorLandscape&&(x.previousSwampsMd5=null);const{result:O,md5:S}=Rr(d?[R]:[h,R],({type:t})=>"swamp"===t,x.previousSwampsMd5);if(x.previousSwampsMd5=S,O){let{swampObjects:t}=x;if(t?t.forEach(t=>t.destroy(t._generatedSvgTexture)):(t=[],x.swampObjects=t),e.renderer instanceof i.WebGLRenderer){let e;e="disabled"===y?8421504:"low"===y?10526880:16777215;let n="disabled"!==c?"#4a501e":"#465c03";T&&(n=T.swampColor);let o="disabled"!==c?"#4a501e":"#3b4019";T&&(o=T.swampStrokeColor),t[0]=E(wr(O,{size:_,VIEW_BOX:v},{fill:n,stroke:o,"stroke-width":T?T.swampStrokeWidth:50,"paint-order":"stroke"}),{alpha:.4,tint:e}),"disabled"!==c&&(t[1]=E(wr(O,{size:_,VIEW_BOX:v},{fill:"#fff"}),{alpha:.25}),t[2]=E(wr(O,{size:_,VIEW_BOX:v},{fill:"#fff"}),{alpha:.25}),t[3]=E(new Or(r.resources.noise2.texture,v,v),{alpha:"normal"===y?.3:.15,blendMode:i.BLEND_MODES.ADD,mask:t[1],tileScale:new i.Point(10,10),tint:6749952}),t[4]=E(new Or(r.resources.noise2.texture,v,v),{alpha:"normal"===y?.3:.15,blendMode:i.BLEND_MODES.ADD,tileScale:new i.Point(14,14),mask:t[2],tint:6749952}),"animated"===c&&(Cr(t[3],1.5,1.5),Cr(t[4],-1.35,-1.35)))}else t[0]=E(wr(O,{size:_,VIEW_BOX:v},{fill:T?T.swampColor:"#292b18",stroke:T?T.swampStrokeColor:"#252715","stroke-width":T?T.swampStrokeWidth:50,"paint-order":"stroke"}))}let{rampartsObjects:w}=x;w?Object.entries(w).forEach(([,t])=>{t.came=!1}):(w={},x.rampartsObjects=w),Object.keys(f).forEach(t=>{const{[t]:e={md5:"",sprite:null}}=w,{md5:r,result:n}=Rr([h],({type:e,isPublic:r,user:n})=>"rampart"===e&&!r&&n===t,e.md5,!0);e.md5=r,n?(e.sprite&&e.sprite.destroy(e.sprite._generatedSvgTexture),e.sprite=E(wr(n,{size:_,VIEW_BOX:v},l===t?{fill:"#105010",stroke:"#44ff44","stroke-width":25,"paint-order":"stroke"}:{fill:"#501010",stroke:"#ff4444","stroke-width":25,"paint-order":"stroke"}),{alpha:.4,blendMode:i.BLEND_MODES.ADD,parentLayer:s})):!1===n&&e.sprite&&(e.sprite.destroy(e.sprite._generatedSvgTexture),e.sprite=null),e.came=!0,w[t]=e}),Object.entries(w).forEach(([t,e])=>{e.came||(e.sprite&&e.sprite.destroy(e.sprite._generatedSvgTexture),delete w[t])});let{previousWalls:C}=x;C||(C=[],x.previousWalls=C),d&&(C=h.filter(({type:t})=>"wall"===t),x.previousWalls=C);const A=d?[C]:[h,C];b!==x.decorationWallLandscape&&(x.previousWallsMd5=null);const{md5:I,result:P}=Rr(A,({type:t})=>"wall"===t||"constructedWall"===t,x.previousWallsMd5);if(x.previousWallsMd5=I,P){let{wallObjects:t}=x;const n=t||[];if(t=[],x.wallObjects=t,e.renderer instanceof i.WebGLRenderer){t[0]=i.RenderTexture.create(_.width,_.height),t[1]=E(new i.Sprite(i.Texture.WHITE),{zIndex:2,visible:!1});let o="disabled"===y?"#181818":"#111",s="#000";b&&(o=hr(b.backgroundColor,b.backgroundBrightness),s=hr(b.strokeColor,b.strokeBrightness),"disabled"===y&&(o=fr(o,.5),s=fr(s,.3)));const u=wr(P,{size:_,VIEW_BOX:v},{fill:o,stroke:s,"stroke-width":b?b.strokeWidth:10,"paint-order":"stroke"});lt.onTextureLoaded(u.texture,()=>{e.renderer.render(u,t[0]),u.destroy(!0)});const l=wr(P,{size:_,VIEW_BOX:v},{fill:"#fff"});x.wallMask.texture!==i.Texture.EMPTY&&x.wallMask.texture.destroy(!0),x.wallMask.texture=l.texture,lt.onTextureLoaded(l.texture,()=>{if("disabled"!==y){const n=new Or(r.resources.noise1.texture,v,v);Object.assign(n,{alpha:.2,blendMode:i.BLEND_MODES.ADD,tileScale:new i.Point(8*m,8*m),mask:l}),e.renderer.render(n,t[0],!1),n.destroy()}l.destroy(),lt.enableTextureMipmap(e.renderer,t[0].baseTexture),[t[1].texture]=t,t[1].visible=!0,n[1]&&n[1].destroy(!0)}),t[2]=i.RenderTexture.create(_.width,_.height),t[3]=E(new i.Sprite(i.Texture.WHITE),{parentLayer:a,_overrideBlendMode:!0,blendMode:i.BLEND_MODES.MULTIPLY,visible:!1});const c=wr(P,{size:_,VIEW_BOX:v},{fill:"#000"});lt.onTextureLoaded(c.texture,()=>{c.filters=[new Sr(.006*_.width)],e.renderer.render(c,t[2]),c.destroy(!0),lt.enableTextureMipmap(e.renderer,t[2].baseTexture),[,,t[3].texture]=t,t[3].visible=!0,n[3]&&n[3].destroy(!0)}),t[4]=E(wr(P,{size:_,VIEW_BOX:v},{fill:"#808080",stroke:b?function(t,e,r){const[n,i,o]=cr(t,e,r);return`#${lr(n)}${lr(i)}${lr(o)}`}(0,0,b.strokeLighting):"#000000","stroke-width":b?b.strokeWidth:10,"paint-order":"stroke"}),{parentLayer:a,visible:!1}),lt.onTextureLoaded(t[4].texture,()=>{t[4].visible=!0,n[4]&&n[4].destroy(!0)})}else t[0]=E(wr(P,{size:_,VIEW_BOX:v},{fill:"#111",stroke:"#000","stroke-width":10,"paint-order":"stroke"}),{zIndex:2,visible:!1}),lt.onTextureLoaded(t[0].texture,()=>{t[0].visible=!0,n[0]&&n[0].destroy()})}if(!x.previousFloor||T!==x.decorationFloorLandscape){const t=x.previousFloor;x.previousFloor={};const n=new i.Graphics;let a,s=5592405;if("disabled"!==y&&e.renderer instanceof PIXI.WebGLRenderer||(s=2105376),"low"===y&&(s=3487029),T&&(s=hr(s=parseInt(T.floorBackgroundColor.substring(1),16),T.floorBackgroundBrightness),"low"===y&&(s=fr(s,.65)),"disabled"===y&&(s=fr(s,.5))),n.beginFill(s),n.drawRect(-g,-g,v,v),n.endFill(),o.addChild(n),x.previousFloor.background=n,T){T.decoration.tileScale?((a=Or.fromImage(T.decoration.floorForegroundUrl,50*p,50*p)).texture.baseTexture.mipmap=!1,a.tileScale.x=T.decoration.tileScale,a.tileScale.y=T.decoration.tileScale):a=i.Sprite.fromImage(T.decoration.floorForegroundUrl);let t=hr(parseInt(T.floorForegroundColor.substr(1),16),T.floorForegroundBrightness);"low"===y&&(t=fr(t,.65)),"disabled"===y&&(t=fr(t,.5)),Object.assign(a,{x:-.5*p,y:-.5*p,width:50*p,height:50*p,alpha:T.floorForegroundAlpha,tint:t})}else{(a=new Or(r.resources.ground.texture,v,v)).x=-g,a.y=-g,a.tileScale.x=3,a.tileScale.y=3,a.alpha="normal"===y?.3:"low"===y?.1:.2;const t=new Or(r.resources["ground-mask"].texture,v,v);t.x=-g,t.y=-g,t.tileScale.x=7,t.tileScale.y=7,t.blendMode=i.BLEND_MODES.MULTIPLY,t.alpha="normal"===y?.15:"low"===y?.05:.1,x.previousFloor.ground2=t,o.addChild(t)}o.addChild(a),x.previousFloor.ground=a,t&&(t.background.destroy(),t.ground.destroy(),t.ground2&&t.ground2.destroy())}x.decorationFloorLandscape=T,x.decorationWallLandscape=b},text:vr,userBadge:t=>{const{payload:{parentId:e,radius:r=Pr.radius,color:n=Pr.color}={},scope:i,scope:{[e]:o},state:{user:a},stateExtra:{users:s={}},state:u,stateExtra:l}=t,c=Ir(t.payload,["parentId","radius","color"]),h=Ir(t,["payload","scope","scope","state","stateExtra","state","stateExtra"]),f=a&&s[a]&&s[a].badgeUrl;if(f){const t=Ar({},Mr,{width:2*r,texture:f,parentId:e},c);return Er(Ar({payload:t,scope:{[e]:o}},h))}return Ce(Ar({payload:{radius:r,color:n,parentId:e},scope:i},h))},creepDecoration:t=>{const{logger:e,stage:{actionManager:r},rootContainer:n,id:o="object",scope:a,state:s,payload:{parentId:u,id:l=o}={},world:{decorations:c=[],layers:f}}=t,d=u?a[u]:n;d?(a[l]&&(a[l].forEach(t=>t.destroy()),delete a[l]),a[l]=[],c.forEach(t=>{if("creep"!==t.decoration.type||s.user!==`${t.user}`||s.spawning)return;const e=t.nameFilter.split(/!SEP!/).some(t=>s.name.includes(t));if(!t.exclude&&!e||t.exclude&&e)return;const o=new i.Container;if(a[l].push(o),t.syncRotate?d.addChild(o):n.addChildAt(o,0),t.decoration.graphics.forEach(e=>{const r=i.Sprite.fromImage(e.url);Object.assign(r,{width:t.width,height:t.height,anchor:{x:.5,y:.5},parentLayer:"below"===t.position?f.objects:f.effects,zIndex:1}),void 0!==t[e.alpha]&&(r.alpha=t[e.alpha]),t[e.color]&&(r.tint=hr(parseInt(t[e.color].substring(1),16),t.brightness)),t.flip&&(r.scale.y*=-1),o.addChild(r)}),t.lighting&&t.decoration.graphics.forEach(e=>{const r=i.Sprite.fromImage(e.url);Object.assign(r,{width:t.width,height:t.height,anchor:{x:.5,y:.5},parentLayer:f.lighting}),void 0!==t[e.alpha]&&(r.alpha=t[e.alpha]),t.flip&&(r.scale.y*=-1),o.addChild(r)}),t.animation){const e=new D(new N(Dr[t.animation].map(t=>new F([new h(t[0],t[1])]))));r.runAction(o,e)}})):e.warn("No parent available with id",u)},objectDecoration:t=>{const{logger:e,stage:{actionManager:r},rootContainer:n,id:o="object",scope:a,state:s,payload:{parentId:u,id:l=o}={},world:{decorations:c=[],layers:f}}=t;(u?a[u]:n)?(a[l]&&(a[l].forEach(t=>t.destroy()),delete a[l]),a[l]=[],c.forEach(t=>{if("object"!==t.decoration.type||s.user!==`${t.user}`||t.decoration.objectType!==s.type)return;const e=new i.Container;if(a[l].push(e),n.addChildAt(e,0),t.decoration.graphics.forEach(r=>{const n=i.Sprite.fromImage(r.url);Object.assign(n,{width:t.width,height:t.height,anchor:{x:.5,y:.5},parentLayer:f.objects,zIndex:1}),void 0!==t[r.alpha]&&(n.alpha=t[r.alpha]),t[r.color]&&(n.tint=hr(parseInt(t[r.color].substring(1),16),t.brightness)),e.addChild(n)}),t.lighting&&t.decoration.graphics.forEach(r=>{const n=i.Sprite.fromImage(r.url);Object.assign(n,{width:t.width,height:t.height,anchor:{x:.5,y:.5},parentLayer:f.lighting}),void 0!==t[r.alpha]&&(n.alpha=t[r.alpha]),e.addChild(n)}),t.animation){const n=new D(new N(Dr[t.animation].map(t=>new F([new h(t[0],t[1])]))));r.runAction(e,n)}})):e.warn("No parent available with id",u)}},Ur=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};class Nr{constructor(t,e,r){if(this.state=void 0,this.calcs={},this.rootContainer={},this.id=t,this.objectMetadata=e,this.world=r,this.rootContainer=r.createData(e),this.rootContainer.zIndex=e.zIndex||0,e.processors){let t=0;e.processors.forEach(e=>{e.id=e.id||`id#${Math.floor(1e5*Math.random())}`,e.zIndex=e.zIndex||t,t+=1})}e.actions&&e.actions.forEach(t=>{t.id=t.id||`id#${Math.floor(1e5*Math.random())}`}),this.scope={actions:{},processors:{}}}remove(t){const{world:e,rootContainer:r,scope:n,objectMetadata:i}=this,{disappearProcessor:o}=i;if(o){const a={objectMetadata:i,rootContainer:r,scope:n,tickDuration:t,callback:()=>this._destroy()};e.runProcessor(o,a)}else this._destroy()}_destroy(){const{world:t,rootContainer:e,scope:r,objectMetadata:n}=this;n.processors.forEach(t=>{const n={objectMetadata:t,rootContainer:e,scope:r};this.destructProcessor(r,t,n)}),this.world.cancelActionsForObj(e),t.destroyData(e)}applyState(t,e,r){const{state:n,calcs:i,world:o,rootContainer:a,scope:s,objectMetadata:u,world:{options:{logger:l}}}=this,c=!n,h=Ur({},i),f={calcs:h,firstRun:c,objectMetadata:u,prevCalcs:i,prevState:n,world:o,rootContainer:a,scope:s,state:t,stateExtra:r,tickDuration:e};c&&u.data&&Object.entries(u.data).forEach(([t,e])=>{this.rootContainer[t]=lt.parseExpression(e,f)}),u.calculations&&u.calculations.forEach(e=>{const r=this.propsChanged(e,f);if(this.shouldRun(e,f,{firstRun:c,propsChanged:r})){const{path:r=null,id:i="customField",func:o}=e,a=null===r?t:X(t,r),s=null===r?n:X(n,r),u=Ur({},f,{state:a,prevState:s,payload:e.payload});h[i]=lt.parseExpression(o,u),l.debug("Calculation",i,"set to",h[i])}}),u.actions&&u.actions.map(t=>{if(!t.targetId||s[t.targetId]){const e=t.targetId?s[t.targetId]:void 0,r=s.actions[t.id],{animations:n}=r||{},i=!r,o=this.propsChanged(t,f),a=this.shouldRun(t,f,{propsChanged:o,firstRun:i}),u=this.onceAllow(t,{propsChanged:o,firstRun:i}),l=!a&&this.shouldDestruct(t,f,{propsChanged:o,firstRun:i});a&&u?(n&&this.world.finishActions(n),s.actions[t.id]={animations:this.world.runActions(t.actions,f,e)}):l&&(n&&this.world.finishActions(n),delete s.actions[t.id])}return[]}),u.processors.forEach(e=>{const r=!s.processors[e.id],i=this.propsChanged(e,f),a=this.shouldRun(e,f,{propsChanged:i,firstRun:r}),u=!a&&this.shouldDestruct(e,f,{propsChanged:i,firstRun:r});if(a||u){const{layer:l,path:c=null,zIndex:h}=e,d=null===c?t:X(t,c),p=null===c?n:X(n,c),_=Ur({},f,{state:d,prevState:p},e),v=this.onceAllow(e,{propsChanged:i,firstRun:r});if(a&&v){const t=o.runProcessor(e,_);let r;t?(t.zIndex=h,l&&(t.parentLayer=this.world.layers[l]),r={actions:this.world.runActions(e.actions,_,t),obj:t}):r={},s.processors[e.id]=r}else u&&this.destructProcessor(s,e,_)}}),(t.temp||t.tempRemove)&&(this.rootContainer.alpha=.3),this.calcs=h,this.state=t}propsChanged(t,e){const{props:r="*"}=t,{prevState:n,state:i,prevCalcs:o,calcs:s}=e;return!n||("*"===r||!!r.find(t=>!a.a.isEqual(n[t],i[t]))||!!r.find(t=>!a.a.isEqual(o[t],s[t])))}shouldRun(t,e,{propsChanged:r}){const{shouldRun:n,when:i=n}=t,{prevState:o,state:a}=e;return!(i&&!lt.parseExpression(i,e))&&(!o||!a||r)}onceAllow(t,{firstRun:e}){const{once:r=!1}=t;return!r||e}shouldDestruct(t,e,{propsChanged:r}){const{shouldRun:n,until:i,when:o=n}=t;return r&&(!i&&o||i&&lt.parseExpression(i,e))}destructProcessor(t,e,r){const n=t.processors[e.id];if(n){const{actions:i,obj:o}=n;i&&this.world.finishActions(i),this.world.destructProcessor(e,r,o),delete t.processors[e.id]}else this.world.destructProcessor(e,r,null)}get rendererCounter(){return this.world.countObjects(this.rootContainer)}}var Fr=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};function jr(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,r){return function n(i,o){try{var a=e[i](o),s=a.value}catch(t){return void r(t)}if(!a.done)return Promise.resolve(s).then(function(t){n("next",t)},function(t){n("throw",t)});t(s)}("next")})}}function kr(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)}const{Layer:Br,Stage:Hr}=i.display;class Xr{constructor(t){this.gameObjects={},this.decorations=[],this.options=t;const{app:e,actionManager:r,logger:n,metadata:o={},resourceMap:a,CELL_SIZE:s,VIEW_BOX:u}=this.options;this.metadata=o;const{objects:l={}}=this.metadata,{_all:{actions:c=[],calculations:h=[],processors:f=[],data:d={}}={}}=l,p=function(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}(l,["_all"]);if(Object.entries(p).forEach(([,t])=>{if(t){const{actions:e=[],calculations:r=[],data:n=[],processors:i=[]}=t;t.actions=[].concat(kr(c),kr(e)),t.data=Fr({},d,n),t.calculations=[].concat(kr(h),kr(r)),t.processors=[].concat(kr(f),kr(i))}}),e.stage=new Hr,e.stage.pivot.x=-s/2,e.stage.pivot.y=-s/2,this.app=e,this.stage=e.stage,this.stage.actionManager=r,this.resourceMap=a,this.resourceManager=new me({logger:n,world:this}),this.stage.resourceManager=this.resourceManager,this.layers={},this.defaultLayerId=null,this.unmaskedRendererInfo=null,this.app.renderer instanceof i.WebGLRenderer){const{gl:t}=this.app.renderer.state,e=t.getExtension("WEBGL_debug_renderer_info");this.unmaskedRendererInfo=e&&t.getParameter(e.UNMASKED_RENDERER_WEBGL)}const _=new i.Graphics;_.drawRect(-s/2,-s/2,u,u),e.stage.addChild(_),e.stage.mask=_}init(){var t=this;return jr(function*(){const{stage:e}=t;e.resources=yield t.resourceManager.load(t.resourceMap,t.options.rescaleResources),t.metadata.layers.forEach((()=>{var r=jr(function*({id:r,isDefault:n=!1,afterCreate:i=function(){}}){const o=new Br;if(o.group.enableSort=!0,e.addChild(o),t.layers[r]=o,n){if(t.defaultLayerId)throw new Error("defaultLayer is already specified");t.defaultLayerId=r}yield i(o,{app:t.app,resourceManager:t.resourceManager,world:t})});return function(t){return r.apply(this,arguments)}})())})()}applyState(t,e=0,r=!0){const{gameObjects:n,metadata:{objects:i,preprocessors:o},options:{gameData:a={},logger:s,objectFilter:u}}=this,{objects:l}=t;if(t.gameData=a,this.runStatePreprocessor(o.map(t=>Lr[t]),{state:t,world:this}),!r)return;const c={};(u?u(l):l).forEach(t=>{const{type:e,room:r,x:o,y:a,_id:u=`${r}:${e}:${o}:${a}`}=t;let l=n[u];if(!l){const t=i[e];t?(l=new Nr(u,t,this),n[u]=l,s.debug(`Created new game object with ID ${u}`)):void 0===t&&s.warn(`Unsupported object type: ${e}`)}c[u]=t}),Object.values(n).forEach(i=>{const{id:o}=i,a=c[o];if(a)return s.debug(`Applying state to game object ${a.type} with ID ${o}`),i.applyState(a,e,t);r&&(i.remove(e),delete n[o],s.debug(`Remove game object with ID ${o}`))})}removeAllObjects(){Object.values(this.gameObjects).forEach(t=>{t.remove(0),delete this.gameObjects[t.id]})}runStatePreprocessor(t=[],e){t.forEach(t=>t(e))}release(){this.resourceManager.release()}get metrics(){let t=0,e=0;Object.values(this.gameObjects).forEach(r=>{t+=1,e+=r.rendererCounter});const r={size:this.app.renderer.width,maxSvgSize:this.resourceManager.maxSvgSize};return this.app.renderer instanceof i.WebGLRenderer?Object.assign(r,{WebGL:"enabled",GPU:this.unmaskedRendererInfo}):Object.assign(r,{WebGL:"disabled"}),{gameObjectCounter:t,rendererCounter:e,devicePixelRatio:window.devicePixelRatio,stageSize:this.app.stage.scale.x*this.options.VIEW_BOX,renderer:r}}getWorldPosition(){const{gameObjects:t}=this,e=Object.values(t);if(0===e.length)return{x:0,y:0};const{x:r,y:n}=e[0].state;return{x:r,y:n}}createData({layer:t=this.defaultLayerId}){const e=new i.Container;return e.parentLayer=this.layers[t],this.stage.addChild(e),e}destroyData(t){t.destroy()}runProcessor(t,e){const{name:r,type:n=r}=t,i=Lr[n].run||Lr[n];if(!i)throw new Error(`No processor found for ${n}`);const{logger:o}=this.options;return o.debug("run processor",n),i(Fr({stage:this.stage,logger:o},e))}destructProcessor(t,e,r){const{name:n,type:i=n}=t,{destruct:o,config:{isOwner:a=!0}={}}=Lr[i];if(o){const{logger:t}=this.options;return t.debug("run destruct",i),o(Fr({stage:this.stage,logger:t},e))}r&&a&&(this.cancelActionsForObj(r),r.destroy())}runActions(t=[],e,r=e.rootContainer){const{stage:{actionManager:n}}=this;return t.map(t=>lt.createAction(t,Fr({},e,{target:r}))).map(t=>n.runAction(r,t))}cancelActions(t){const{stage:{actionManager:e}}=this;t.forEach(t=>{e.cancelAction(t)})}cancelActionsForObj(t){const{stage:{actionManager:e}}=this;e.cancelActionForContainer(t);const{children:r}=t;r&&Array.isArray(r)&&r.forEach(t=>this.cancelActionsForObj(t))}finishActions(t){const{stage:{actionManager:e}}=this;t.forEach(t=>{e.finishAction(t)})}countObjects(t){let e=1;return t.children.forEach(t=>{e+=this.countObjects(t)}),e}}var Wr=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};const{Application:Gr,utils:Yr}=i,zr=500;class Vr{static compileMetadata(t){t.isCompiled||(Object.values(t.objects).forEach(t=>{t.calculations&&t.calculations.forEach(t=>{if(a.a.isUndefined(t.func))throw new Error(`Calculation ${t.id} does not have a func specified`);a.a.isFunction(t.func)||(t.func=lt.compileExpression(t.func))}),t.processors&&t.processors.forEach(t=>{t.shouldRun&&!a.a.isFunction(t.shouldRun)&&(t.shouldRun=lt.compileExpression(t.shouldRun)),t.until&&!a.a.isFunction(t.until)&&(t.until=lt.compileExpression(t.until)),t.when&&!a.a.isFunction(t.when)&&(t.when=lt.compileExpression(t.when))}),t.data&&Object.entries(t.data).forEach(([e,r])=>{t.data[e]=lt.compileExpression(r)})}),t.isCompiled=!0)}constructor(t){this.released=!0,this.animate=this.animate.bind(this),this.animateChecker=this.animateChecker.bind(this),this.options=t,t.countMetrics&&(this.metrics={fps:0}),this.__ts=Date.now()}init(t){var e=this;return function(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,r){return function n(i,o){try{var a=e[i](o),s=a.value}catch(t){return void r(t)}if(!a.done)return Promise.resolve(s).then(function(t){n("next",t)},function(t){n("throw",t)});t(s)}("next")})}}(function*(){const{autoStart:r=!0,backgroundColor:n,size:{width:i,height:o}={width:800,height:800},worldConfigs:a,resourceMap:s,rescaleResources:l,useDefaultLogger:c=!1,logger:h=(c?console:new Proxy({},{get:function(){return function(){}}})),objectFilter:f}=e.options;e.released||e.release();const d=new Gr(i,o,{antialias:!0,transparent:!n,forceCanvas:a.forceCanvas});e.app=d,n&&(d.renderer.backgroundColor=n),e.actionManager=new u,e.world=new Xr(Wr({actionManager:e.actionManager,app:d,logger:h,objectFilter:f,rescaleResources:l,resourceMap:s,size:{width:i,height:o}},a)),e.resize(),e.released=!1,yield e.world.init(),t.appendChild(d.view),r&&e.start()})()}release(){this.released||(clearTimeout(this.animateCheckerTimer),this.world.release(),Yr.destroyTextureCache(),this.app.destroy(),this.released=!0)}start(){const{options:{countMetrics:t}}=this;t&&(this.lastLoopTime=new Date),this.lastAnimationRun=Date.now(),this.animateChecker(),this.app.ticker.add(this.animate)}animateChecker(){Date.now()-this.lastAnimationRun>zr&&this.animate(),this.animateCheckerTimer=setTimeout(this.animateChecker,zr)}applyState(t,e){return this.world.applyState(t,e)}get zoomLevel(){const{app:{stage:t}={}}=this;return t.scale.x}set zoomLevel(t){const{app:{stage:e,renderer:r}={}}=this;if(t=.02*Math.round(t/.02),e){const n=e.scale.x;e.scale.x=t,e.scale.y=t,t!==n&&r.emit("_resized")}}pan(t,e){this.app.stage.position.x+=t,this.app.stage.position.y+=e}zoomTo(t,e,r){const n=this.zoomLevel;this.zoomLevel=t;const i=(e-this.app.stage.position.x)*(1-this.zoomLevel/n),o=(r-this.app.stage.position.y)*(1-this.zoomLevel/n);this.pan(i,o)}setTerrain(t){return this.world.applyState({objects:t,setTerrain:!0},0,!1)}resize(t){const{app:{renderer:e}={}}=this;e&&t&&e.resize(t.width,t.height)}animate(){this.lastAnimationRun=Date.now(),this.actionManager.update();const{options:{countMetrics:t,onGameLoop:e}}=this;if(t){const t=new Date,e=1e3/(t-this.lastLoopTime);this.metrics.fps=Math.round(.95*this.metrics.fps+.05*e),this.lastLoopTime=t,Object.assign(this.metrics,this.world.metrics)}e&&e()}erase(){this.world.removeAllObjects()}setDecorations(t){!function(t,e){const{world:r,world:{options:{CELL_SIZE:n,lighting:o="normal"},stage:{actionManager:a}}}=e;r.app.renderer instanceof i.WebGLRenderer&&(r.decorations=t,r.decorationsContainer&&r.decorationsContainer.destroy({children:!0,texture:!0,baseTexture:!1}),r.decorationsContainer=new i.Container,r.stage.addChild(r.decorationsContainer),t.forEach(t=>{if("wallGraffiti"===t.decoration.type&&t.decoration.graphics.forEach(e=>{if(e.visible&&!t[e.visible])return;function o(){let o;if(t.decoration.tiling?((o=i.TilingSprite.fromImage(e.url,t.width*n,t.height*n)).texture.baseTexture.mipmap=!1,o.tileScale.x=t.tileScale,o.tileScale.y=t.tileScale):o=i.Sprite.fromImage(e.url),Object.assign(o,{anchor:{x:.5,y:.5},x:Math.floor((t.x+-.5+t.width/2)*n),y:Math.floor((t.y+-.5+t.height/2)*n),width:t.width*n,height:t.height*n,mask:r.stage.terrainObjects.wallMask,zIndex:2}),t.flip&&(o.scale.x*=-1),t.rotation&&(o.rotation=t.rotation),t.animation){const e=new D(new N(Dr[t.animation].map(t=>new F([new h(t[0],t[1])]))));a.runAction(o,e)}return o}const s=new i.Container;r.decorationsContainer.addChild(s),s.alpha=t.alpha;const u=o();if(u.parentLayer=r.layers.wallGraffiti,e.color&&(u.tint=hr(parseInt(t[e.color].substr(1),16),t.brightness)),s.addChild(u),t.lighting){const t=o();t.parentLayer=r.layers.lighting,s.addChild(t)}}),["landscape","wallLandscape"].includes(t.decoration.type)){let e=hr(parseInt(t.foregroundColor.substr(1),16),t.foregroundBrightness);"disabled"===o&&(e=fr(e,.6));const a=i.Sprite.fromImage(t.decoration.foregroundUrl);Object.assign(a,{x:-.5*n,y:-.5*n,width:50*n,height:50*n,parentLayer:r.layers.wallGraffiti,alpha:t.foregroundAlpha,tint:e,mask:r.stage.terrainObjects.wallMask,zIndex:1}),r.decorationsContainer.addChild(a)}}))}(t,{world:this.world})}static isWebGLSupported(){return Yr.isWebGLSupported()}}r.d(e,"GameRenderer",function(){return Kr}),r.d(e,"PIXI",function(){return qr}),window&&(window.GameRenderer=Vr);const Kr=Vr,qr=i;e.default=Kr}])});
187
+ var le="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",ce="varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float radius;\nuniform float angle;\nuniform vec2 offset;\nuniform vec4 filterArea;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 twist(vec2 coord)\n{\n coord -= offset;\n\n float dist = length(coord);\n\n if (dist < radius)\n {\n float ratioDist = (radius - dist) / radius;\n float angleMod = ratioDist * ratioDist * angle;\n float s = sin(angleMod);\n float c = cos(angleMod);\n coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);\n }\n\n coord += offset;\n\n return coord;\n}\n\nvoid main(void)\n{\n\n vec2 coord = mapCoord(vTextureCoord);\n\n coord = twist(coord);\n\n coord = unmapCoord(coord);\n\n gl_FragColor = texture2D(uSampler, coord );\n\n}\n",he=function(t){function e(e,r,n){void 0===e&&(e=200),void 0===r&&(r=4),void 0===n&&(n=20),t.call(this,le,ce),this.radius=e,this.angle=r,this.padding=n}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={offset:{},radius:{},angle:{}};return r.offset.get=function(){return this.uniforms.offset},r.offset.set=function(t){this.uniforms.offset=t},r.radius.get=function(){return this.uniforms.radius},r.radius.set=function(t){this.uniforms.radius=t},r.angle.get=function(){return this.uniforms.angle},r.angle.set=function(t){this.uniforms.angle=t},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.TwistFilter=he;var fe=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};function de(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,r){return function n(i,o){try{var a=e[i](o),s=a.value}catch(t){return void r(t)}if(!a.done)return Promise.resolve(s).then(function(t){n("next",t)},function(t){n("throw",t)});t(s)}("next")})}}const{TextureCache:pe}=i.utils,_e=100,ve=3e3,ge=100,ye={};class me{constructor(t){const{logger:e,world:r}=t;this.logger=e,this.world=r,this.delivering=!1,this.loadedResources={},this.queue=[],this.maxSvgSize=Math.round(ve/ge)*ge}load(t={},e=[]){return new Promise((e,r)=>{try{Object.keys(t).forEach(e=>i.loader.add(e,t[e])),i.loader.load((t,r)=>{Object.assign(this.loadedResources,r),e()})}catch(t){r(t)}}).then(()=>Promise.all(e.map(t=>{const e=this.loadedResources[t];return e||this.logger.error("Cannot create scaled textures for",t),e.texture._resourceName=e.name,new Promise((t,r)=>{if(ye[e.name])t();else{const n=new XMLHttpRequest;n.onload=(()=>{if(n.readyState!==n.DONE||200!==n.status)throw new Error("Failed to load SVG using XHR.");ye[e.name]=n.response,t()}),n.onerror=r,n.open("GET",e.url,!0),n.send()}}).then(()=>{const t=[];for(let r=_e;r<=this.maxSvgSize;r+=ge){let n=pe[e.name+r];if(!n){const t=new i.BaseTexture;t.sourceScale=r/this.world.options.VIEW_BOX,t.imageUrl=e.url,t.source=e.data,t._loadSvgSourceUsingString(ye[e.name]),n=new i.Texture(t),i.Texture.addToCache(n,e.name+r)}e.scaledSvgTextures=e.scaledSvgTextures||{},e.scaledSvgTextures[r]=n,t.push(new Promise(t=>lt.onTextureLoaded(n,t)))}return Promise.all(t)})}))).then(()=>this.loadedResources)}getResource(t,...e){var r=this;return de(function*(){const{logger:n}=r;return r.delivering?new Promise(function(i,o){n.debug(`Put resource to queue resource ${t}`),r.queue.push({resource:{name:t,otherParams:fe({},e)},resolve:i,reject:o})}):(n.debug(`Getting resource ${t}`),r.loadedResources[t]||r._loadResource.apply(r,[t].concat(e)))})()}getCachedResource(t){return this.loadedResources[t]}release(){this.loadedResources={},i.loader.reset()}_loadResource(t,e=t){var r=this;return de(function*(){const{logger:n}=r;r.delivering=!0;try{const o={loadType:2};return i.loader.add(t,e,o),n.debug(`Delivering resource ${t}`),(yield r.load())[t]}finally{i.loader.reset(),r.delivering=!1,r._loadRest()}})()}_loadRest(){var t=this;return de(function*(){const{logger:e}=t,r=t.queue.shift();if(r){const{resource:{name:n},resolve:i,reject:o}=r,a=function(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}(r.resource.otherParams,[]);try{e.debug(`Taking the next resource ${n}`),i(yield t.getResource.apply(t,[n].concat(function(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)}(a))))}catch(t){e.warn(`Something wrong loading resource ${n}`,t),o(t)}yield t._loadRest()}else e.debug("No resource in queue. Idling")})()}}var Ee=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};const{BlurFilter:xe}=i.filters;var be=(t,e,r=[])=>{const{rootContainer:n,logger:i,id:o="object",payload:{id:a=o,parentId:s,addToParent:u=!0,Class:l=e,constructorParams:c=r,width:h,height:f,scale:d,shouldCreate:p=!0,pivot:_,anchor:v,blur:g}={},scope:y}=t,m=function(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}(t.payload,["id","parentId","addToParent","Class","constructorParams","width","height","scale","shouldCreate","pivot","anchor","blur"]),E=y[a];if(E&&(E.destroy(),delete y[a]),!lt.parseExpression(p,t))return;const x=s?y[s]:n;if(!x)return void i.warn("No parent available with id",s);const b=new(Function.prototype.bind.apply(l,[null].concat(function(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)}(c)))),T=d?Ee({},d):{x:1,y:1},R=_?Ee({},_):{},O=v?Ee({},v):{};if(void 0!==h&&(b._parsedWidth=lt.parseExpression(h,t),T.x=b._parsedWidth/b.width,void 0===f&&(T.y=T.x,b._parsedHeight=b._parsedWidth)),void 0!==f&&(b._parsedHeight=lt.parseExpression(f,t),T.y=b._parsedHeight/b.height,void 0===h&&(T.x=T.y,b._parsedWidth=b._parsedHeight)),void 0!==R.x?R.x=lt.parseExpression(R.x,t)/T.x:void 0===O.x&&(O.x=.5),void 0!==R.y?R.y=lt.parseExpression(R.y,t)/T.y:void 0===O.y&&(O.y=.5),Object.assign(b,lt.parseExpression(m,t)),Object.assign(b.scale,lt.parseExpression(T,t)),b.anchor&&Object.assign(b.anchor,lt.parseExpression(O,t)),Object.assign(b.pivot,lt.parseExpression(R,t)),void 0!==g){const e=new xe(lt.parseExpression(g,t));e.blendMode=b.blendMode,b.filters=[e]}u&&x.addChild(b),y[a]=b;const S=b.destroy.bind(b);return b.destroy=(()=>{y[a]=void 0,S()}),b},Te=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};function Re(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}var Oe=t=>{const{logger:e,payload:{drawings:r=[]}={}}=t,n=Re(t.payload,["drawings"]),o=Re(t,["logger","payload"]),a=be(Object.assign(t,Te({logger:e,payload:n},o)),i.Graphics);return a&&r.forEach(({method:r,params:n=[]})=>{const i=lt.parseExpressions(n,t),o=a[r];o||e.warn("Cannot resolve drawing method",r),o.call.apply(o,[a].concat(function(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)}(i)))}),a},Se=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};function we(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}var Ce=t=>{const{payload:{color:e,radius:r=25,stroke:n=0,strokeWidth:i}={}}=t,o=we(t.payload,["color","radius","stroke","strokeWidth"]),a=we(t,["payload"]),s=Oe(Se({payload:o},a));return s&&(i&&s.lineStyle(i,n,1),(e||0===e)&&s.beginFill(e),s.drawCircle(0,0,lt.parseExpression(r,t)),(e||0===e)&&s.endFill()),s},Ae=t=>be(t,i.Container);const Ie=(t,e,r,n)=>{let i=Math.atan2(n-e,r-t)+Math.PI/2;return i>Math.PI?i-=2*Math.PI:i<-Math.PI&&(i+=2*Math.PI),i},Pe=({x:t,y:e},{CELL_SIZE:r})=>({x:r*t,y:r*e});const{BlurFilter:Me}=i.filters,De=.6,Le=16770355,Ue=16724787,Ne=16777011,Fe=2941736,je=13385022,ke=3962311,Be=12164347,He=16777215,Xe=16770355;function We(t,e,r){return t+(e-t)*r}function Ge(t,e,r,n,i,o,a){if(n.x===i.x&&n.y===i.y)return;const{ATTACK_PENETRATION:s}=a,{x:u,y:l}=Pe(i,a),{x:c,y:h}=Pe(n,a);e.x=c,e.y=h;const f=u-c,d=l-h,p=0!==f?f/Math.abs(f)*s:0,_=0!==d?d/Math.abs(d)*s:0;r.mainContainer&&t.push({action:new L(Ie(e.x,e.y,u,l),Math.max(o/5,.4)),target:r.mainContainer}),t.push({action:new N([new M(p,_,1*o/4),new M(-p,-_,3*o/4)]),target:e})}function Ye(t,e,r,n,i=0){const o=new N([new d(i),new h(1,(r-i)/4),new h(0,3*(r-i)/4)]);return t.coverSprite.children[0].tint=e,t.coverSprite.children[1].tint=e,n&&t.coverSprite.position.copy(n),{action:o,target:t.coverSprite}}function ze(t,e,r,n=0){const i=new N([new d(n),new h(.5,(r-n)/4),new h(0,3*(r-n)/4)]);return t.childCoverSprite.tint=e,{action:i,target:t.childCoverSprite}}function Ve(t,e,r,n,o,a,s,u=12,l,c=De){const h=c*o,d=new i.Graphics;d.x=r.x,d.y=r.y;const{x:p,y:_}=Pe(n,a),v=p-d.x,g=_-d.y;return l&&(d.filters=[new Me(l)],d.alpha=.7),e.app.renderer instanceof i.WebGLRenderer&&(d.blendMode=i.BLEND_MODES.ADD),d.parentLayer=e.layers.effects,t.addChild(d),{action:new f(function(t,e,r,n,i,o,a){return(s,u,l)=>{const c=u-l;if(c<=0)return void s.destroy(!0);let h=c/(1e3*t);s.clear(),s.lineStyle(e,r,1),h<.5?(h*=2,s.moveTo(n,i),s.lineTo(We(n,o,h),We(i,a,h))):(h=2*(h-.5),s.moveTo(n+(o-n)*h,i+(a-i)*h),s.lineTo(o,a))}}(h,u,s,v,g,0,0),h),target:d}}function Ke(t,e,r,n,i,o,a,s,u,l,c){t.push(Ve(e,r,n,i,o,a,s,u,void 0,c)),t.push(Ve(e,r,n,i,o,a,s,u,l,c))}const qe=-Math.PI/2,Ze=2*Math.PI/50/2,$e=50,Je=18,Qe={move:{color:11188165,order:0,backSide:!0},work:{color:16639348,order:1},carry:{color:6710886,order:6},attack:{color:16199233,order:2},ranged_attack:{color:8366053,order:3},heal:{color:5689182,order:4},claim:{color:12164347,order:5}};function tr(t,e,r,n,o,a){const s=new i.Graphics;return s.lineStyle(Je,t,1),s.arc(0,0,$e-Je/2,qe+e,qe+r,a),s.tint=t,n.addChild(s),o.push(s),s}function er(t){return Array.isArray(t)?t:Object.keys(t).sort().map(e=>t[e])}var rr=r(1),nr=r.n(rr);const ir={[nr.a.PWR_DISRUPT_SOURCE]:"disrupt-source",[nr.a.PWR_DISRUPT_SPAWN]:"disrupt-spawn",[nr.a.PWR_DISRUPT_TERMINAL]:"disrupt-terminal",[nr.a.PWR_DISRUPT_TOWER]:"disrupt-tower",[nr.a.PWR_REGEN_MINERAL]:"regen-mineral",[nr.a.PWR_REGEN_SOURCE]:"regen-source",[nr.a.PWR_GENERATE_OPS]:"generate-ops",[nr.a.PWR_OPERATE_EXTENSION]:"operate-extension",[nr.a.PWR_OPERATE_LAB]:"operate-lab",[nr.a.PWR_OPERATE_OBSERVER]:"operate-observer",[nr.a.PWR_OPERATE_SPAWN]:"operate-spawn",[nr.a.PWR_OPERATE_STORAGE]:"operate-storage",[nr.a.PWR_OPERATE_TERMINAL]:"operate-terminal",[nr.a.PWR_OPERATE_TOWER]:"operate-tower",[nr.a.PWR_SHIELD]:"shield",[nr.a.PWR_FORTIFY]:"fortify",[nr.a.PWR_OPERATE_CONTROLLER]:"operate-controller",[nr.a.PWR_OPERATE_POWER]:"operate-power",[nr.a.PWR_BERSERK]:"berserk",[nr.a.PWR_DEFEND]:"defend",[nr.a.PWR_DISABLE]:"disable",[nr.a.PWR_ENCOURAGE]:"encourage",[nr.a.PWR_EXHAUST]:"exhaust",[nr.a.PWR_RENEW]:"renew",[nr.a.PWR_SIGHT]:"sight",[nr.a.PWR_SUMMON]:"summon",[nr.a.PWR_DEMOLISH]:"demolish",[nr.a.PWR_HARVEST_ENERGY]:"harvest-energy",[nr.a.PWR_HARVEST_MINERAL]:"harvest-mineral",[nr.a.PWR_KILL]:"kill",[nr.a.PWR_MASS_REPAIR]:"mass-repair",[nr.a.PWR_PUNCH]:"punch",[nr.a.PWR_REFLECT]:"reflect",[nr.a.PWR_REINFORCE]:"reinforce",[nr.a.PWR_REMOTE_TRANSFER]:"remote-transfer",[nr.a.PWR_SNIPE]:"snipe"};var or=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};const ar={creepEnergy:{color:16770413,radius:20},energy:{color:16770413,radius:30},power:{color:15998771,radius:45}},sr={color:16777215,radius:45};function ur(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function lr(t){let e=Number(t).toString(16);return e.length<2&&(e=`0${e}`),e}function cr(t,e,r){let n,i,o;if(0===e)n=r,i=r,o=r;else{const a=r<.5?r*(1+e):r+(e-r*e),s=2*r-a;n=ur(s,a,t+1/3),i=ur(s,a,t),o=ur(s,a,t-1/3)}return[Math.round(255*n),Math.round(255*i),Math.round(255*o)]}function hr(t,e){let r=t;"string"==typeof t&&(r=parseInt(t.substr(1),16));const[n,i,o]=function(t,e,r){t/=255,e/=255,r/=255;const n=Math.max(t,e,r),i=Math.min(t,e,r);let o,a;const s=(n+i)/2;if(n===i)o=0,a=0;else{const u=n-i;switch(a=s>.5?u/(2-n-i):u/(n+i),n){case t:o=(e-r)/u+(e<r?6:0);break;case e:o=(r-t)/u+2;break;case r:o=(t-e)/u+4}o/=6}return[o,a,s]}(r>>16,r>>8&255,255&r),[a,s,u]=cr(n,i,o*e);return"string"==typeof t?`#${lr(a)}${lr(s)}${lr(u)}`:u+(s<<8)+(a<<16)}function fr(t,e){let r=t;"string"==typeof t&&(r=parseInt(t.substr(1),16));let[n,i,o]=[r>>16,r>>8&255,255&r];return n=Math.round(n*e),i=Math.round(i*e),o=Math.round(o*e),"string"==typeof t?`#${lr(n)}${lr(i)}${lr(o)}`:o+(i<<8)+(n<<16)}const dr=Math.sin(Math.PI/4);var pr=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};function _r(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}var vr=t=>{const{world:e,logger:r,payload:{text:n="?",style:o}={}}=t,a=_r(t.payload,["text","style"]),s=_r(t,["world","logger","payload"]),u=lt.parseExpression(n,t),l=lt.parseExpression(o,t),{app:{stage:c}}=e,h=be(pr({world:e,logger:r,payload:a},s),i.Text,[u,l]);return lt.addTickerHandler(h,()=>{h.scale.x=1/c.scale.x,h.scale.y=1/c.scale.y,h.style.fontSize=l.fontSize*c.scale.x,h.style.strokeThickness=(l.strokeThickness||0)*c.scale.x}),lt.addTickerHandler(h,()=>lt.alignPositionToPixels(h,c)),h};var gr=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};var yr=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};function mr(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}var Er=t=>{const{logger:e,rootContainer:r,scope:n,world:o,objectMetadata:{texture:s},payload:{parentId:u,texture:l=s}={},stage:{resourceManager:c}}=t,h=mr(t.payload,["parentId","texture"]),f=mr(t,["logger","rootContainer","scope","world","objectMetadata","payload","stage"]);if(!l)return void e.warn("texture is not provided");let d;const p=lt.parseExpression(l,t);if(a.a.isString(p))d=c.getCachedResource(p);else if(!(d=l))return void e.warn("Cannot find resource",l);if(d){const t=be(yr({logger:e,payload:yr({},h,{parentId:u}),rootContainer:r,scope:n},f),i.Sprite,[d.texture]);return lt.setSvgResizeHandler(o,t,d),t}{const t=Ae(yr({logger:e,payload:{parentId:u},rootContainer:r,scope:n},f));return c.getResource(l).then(n=>{const a=be(yr({logger:e,payload:yr({},h,{addToParent:!1}),rootContainer:r,scope:{}},f),i.Sprite,[n.texture]);lt.setSvgResizeHandler(o,a,n),a.zIndex=-1e3,t.addChild(a)}),t}},xr=r(93),br=r.n(xr);const Tr=50;var Rr=(t,e,r,n=!1)=>{const i={},o={};let a,s="";if(0===t.length)return{md5:"",result:!1};for(let t=0;t<Tr;t+=1)i[t]=new Array(Tr),o[t]={};if(t.forEach(t=>{t.forEach(t=>{null!==t.x&&null!==t.y?(e(t)&&(i[t.x][t.y]=t,a=!0),o[t.x][t.y]=!1):console.error("null coordinates in object",t)})}),!a)return{md5:"",result:!1};const u=br()(JSON.stringify(i,(t,e)=>{if(""===t||Array.isArray(e)&&"effects"!==t||"object"==typeof e&&"effects"!==t||"x"===t||"y"===t||"type"===t)return e}));if(u===r)return{md5:u,result:null};function l(t,e){t>0&&e>0&&!i[t-1][e]?s+="a 50 50 0 0 0 -50 -50 h 50 ":s+="v -50 "}function c(t,e){e>0&&t>0&&!i[t][e-1]?s+="v -50 a 50 50 0 0 0 50 50 ":s+="h 50 "}function h(t,e){0===t||i[t-1][e]||0===e||i[t][e-1]?s+="v -50 h 50 ":s+="a 50 50 0 0 1 50 -50 "}function f(t,e){e>0&&t<Tr-1&&!i[t][e-1]?s+="a 50 50 0 0 0 50 -50 v 50 ":s+="h 50 "}function d(t,e){t<Tr-1&&e>0&&!i[t+1][e]?s+="h 50 a 50 50 0 0 0 -50 50 ":s+="v 50 "}function p(t,e){t===Tr-1||i[t+1][e]||0===e||i[t][e-1]?s+="h 50 v 50 ":s+="a 50 50 0 0 1 50 50 "}function _(t,e){t===Tr-1||i[t+1][e]||e===Tr-1||i[t][e+1]||i[t+1][e+1]&&(i[t+1][e]||n)?s+="v 50 h -50 ":s+="a 50 50 0 0 1 -50 50 "}function v(t,e){0===t||i[t-1][e]||e===Tr-1||i[t][e+1]||i[t-1][e+1]&&(i[t-1][e]||n)?s+="h -50 v -50 ":s+="a 50 50 0 0 1 -50 -50 "}function g(t,e,r){o[t][e]?s+=r?"v 100 ":"h -100 ":(r?(0===t||0===e||i[t-1][e-1]&&(n||i[t-1][e]||i[t][e-1])?c(t,e):s+="h 50 ",t<Tr-1&&i[t+1][e]?(t===Tr-1||0===e||i[t+1][e-1]&&(n||i[t+1][e]||i[t][e-1])?f(t,e):s+="h 50 ",g(t+1,e,1),s+="h -100 "):(t===Tr-1||0===e||i[t+1][e-1]&&(n||i[t+1][e]||i[t][e-1])?(f(t,e),d(t,e)):p(t,e),_(t,e),s+="h -50 ")):(t===Tr-1||0===e||i[t+1][e-1]&&(n||i[t+1][e]||i[t][e-1])?d(t,e):s+="v 50 ",e<Tr-1&&i[t][e+1]?(s+="v 50 ",g(t,e+1,0),s+="v -50 "):(_(t,e),v(t,e)),0===t||0===e||i[t-1][e-1]?l(t,e):s+="v -50 "),t<Tr&&e<Tr&&(o[t][e]=!0))}for(let t=0;t<Tr;t+=1)for(let e=0;e<Tr;e+=1)if(i[t][e]&&!o[t][e]){s+=`M ${100*t} ${100*e+50} `,o[t][e]=!0;let r=0;do{r+=1}while(t+r<Tr&&i[t+r][e]);let a=0;do{a+=1}while(e+a<Tr&&i[t][e+a]);a<r?(0===t||0===e||i[t-1][e-1]&&(n||i[t-1][e]||i[t][e-1])?(l(t,e),c(t,e)):h(t,e),t<Tr-1&&i[t+1][e]?(t===Tr-1||0===e||i[t+1][e-1]&&(n||i[t+1][e]||i[t][e-1])?f(t,e):s+="h 50 ",g(t+1,e,1),s+="h -50 "):(t===Tr-1||0===e||i[t+1][e-1]&&(n||i[t+1][e]||i[t][e-1])?(f(t,e),d(t,e)):p(t,e),_(t,e)),v(t,e)):(0===t||0===e||i[t-1][e-1]&&(n||i[t-1][e]||i[t][e-1])?(l(t,e),c(t,e)):h(t,e),t===Tr-1||0===e||i[t+1][e-1]&&(n||i[t+1][e]||i[t][e-1])?(f(t,e),d(t,e)):p(t,e),e<Tr-1&&i[t][e+1]?(s+="v 50 ",g(t,e+1,0),s+="v -50 "):(_(t,e),v(t,e))),s+="Z "}return{md5:u,result:s}};const{TilingSprite:Or}=i.extras,{BlurFilter:Sr}=i.filters;function wr(t,{size:{width:e,height:r},VIEW_BOX:n},o){const a={viewBox:`0 0 ${n} ${n}`,"shape-rendering":"optimizeSpeed"},s=Object.entries(a).map(([t,e])=>`${t}="${encodeURIComponent(e)}"`).join(" "),u=Object.entries(o).map(([t,e])=>`${t}="${encodeURIComponent(e)}"`).join(" "),l=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${r}" ${s} data-timestamp="${Date.now()}"><path ${u} d="${t}" /></svg>`,c=i.Sprite.fromImage(`data:image/svg+xml;charset=utf8,${l}`);return c._generatedSvgTexture=!0,c}function Cr(t,e,r){lt.addTickerHandler(t,n=>{t.tilePosition.x+=n*e,t.tilePosition.y+=n*r})}var Ar=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};function Ir(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}const Pr={radius:37,color:2236962},Mr={texture:null};const Dr={slow:[[.3,5],[1,5]],fast:[[.3,1],[1,1]],blink:[[.8,2],[1,.1],[.6,4],[1,.1],[.7,1],[1,.1]],neon:[[1,1],[.95,.07],[1,.07],[1,.07],[.9,.07],[1,.07],[.7,.07],[1,.07],[1,.1],[.9,.07],[1,.07],[1,1],[.95,.07],[1,.07],[1,.07],[.9,.07],[1,.07]],flash:[[1,.1],[0,1.5],[0,2]]};var Lr={circle:Ce,container:Ae,creepActions:t=>{const{logger:e,stage:r,rootContainer:n,scope:o,tickDuration:a,state:s,prevState:u,world:l,payload:{parentId:c}={},world:{options:h}}=t,{actionLog:{attacked:f=null,attack:d=null,build:p=null,harvest:_=null,heal:v=null,healed:g=null,power:y=null,rangedAttack:m=null,rangedHeal:E=null,repair:x=null,reserveController:b=null,runReaction:T=null,reverseReaction:R=null,transferEnergy:O=null,upgradeController:S=null}={}}=s,w=c?o[c]:n;if(!w)return void e.warn("No parent available with id",c);if(!u)return;o.coverSprite||function(t,e,r,n){const o=new i.Container;o.position.copy(e.position),o.alpha=0,e.parent.addChild(o),r.coverSprite=o,e.on("removed",()=>o.destroy());const a=new i.Sprite(t.cover.texture);a.anchor.x=.5,a.anchor.y=.5,a.alpha=.3,a.parentLayer=n.layers.effects,o.addChild(a);const s=new i.Sprite(t.flare2.texture);s.blendMode=i.BLEND_MODES.ADD,s.width=300,s.height=300,s.anchor.x=.5,s.anchor.y=.5,s.alpha=.05,s.parentLayer=n.layers.effects,o.addChild(s);const u=new i.Sprite(t.glow.texture);u.anchor.x=.5,u.anchor.y=.5,u.x=0,u.y=0,u.width=500,u.height=500,u.alpha=.5,u.parentLayer=n.layers.lighting,o.addChild(u)}(r.resources,n,o,l),o.childCoverSprite||function(t,e,r,n){const o=new i.Sprite(t.cover.texture);o.anchor.x=.5,o.anchor.y=.5,o.alpha=0,o.parentLayer=n.layers.effects,o.blendMode=i.BLEND_MODES.ADD,e.addChild(o),r.childCoverSprite=o}(r.resources,w,o,l);const C=[],A=u&&(s.x!==u.x||s.y!==u.y);if(d&&("tower"===s.type?Ke(C,r,l,n,d,a,h,ke,18,5):A||Ge(C,n,o,s,d,a,h)),_&&(A||Ge(C,n,o,s,_,a,h),C.push(Ye(o,Le,.9*a,Pe(_,h)))),b&&("invaderCore"===s.type?Ke(C,r,l,n,b,a,h,Be,18,5):A||Ge(C,n,o,s,b,a,h),C.push(Ye(o,Be,.9*a,Pe(b,h),"invaderCore"===s.type?.3*a:0))),v&&("tower"===s.type?Ke(C,r,l,n,v,a,h,Fe,18,5):A||Ge(C,n,o,s,v,a,h)),f&&g?C.push(ze(o,Ne,.9*a)):g?C.push(ze(o,Fe,.9*a)):f&&C.push(ze(o,Ue,.9*a)),m&&Ke(C,r,l,n,m,a,h,ke,12,5),O&&Ke(C,r,l,n,O,a,h,Xe,18,5),E&&Ke(C,r,l,n,E,a,h,Fe,12,5),y&&Ke(C,r,l,n,y,a,h,je,12,5,.3),p&&(Ke(C,r,l,n,p,a,h,Le,"invaderCore"===s.type?18:12,5),C.push(Ye(o,Le,.9*a,Pe(p,h),.3*a))),S&&(Ke(C,r,l,n,S,a,h,Le,"invaderCore"===s.type?18:12,5),C.push(Ye(o,Le,.9*a,Pe(S,h),.3*a))),x&&(Ke(C,r,l,n,x,a,h,Le,"tower"===s.type?18:12,5),C.push(Ye(o,Le,.9*a,Pe(x,h),.3*a))),T){const{x1:t,y1:e,x2:n,y2:i}=T;Ke(C,r,l,Pe({x:t,y:e},h),s,a,h,He,12,2),Ke(C,r,l,Pe({x:n,y:i},h),s,a,h,He,12,2)}if(R){const{x1:t,y1:e,x2:i,y2:o}=R;Ke(C,r,l,n,{x:t,y:e},a,h,He,12,2),Ke(C,r,l,n,{x:i,y:o},a,h,He,12,2)}!function(t,e){t.forEach(({target:t,action:r})=>e.runAction(t,r))}(C,r.actionManager)},creepBuildBody:({logger:t,rootContainer:e,scope:r,stage:n,state:o,payload:{parentId:a}={}})=>{const{resources:s}=n,u=a?r[a]:e;if(!u)return void t.warn("No parent available with id",a);r.bodySprites?r.bodySprites.forEach(t=>u.removeChild(t)):r.bodySprites=[];const{body:l}=o,c=er(l).filter(({type:t,hits:e})=>"tough"!==t&&"carry"!==t&&e>0),h=Object.values(c.reduce((t,{type:e,hits:r})=>{const n=t[e];return n?n.hits+=r:t[e]={type:e,hits:r},t},{}));h.sort((t,e)=>t.hits<e.hits?-1:t.hits>e.hits?1:0);let f=0,d=Math.PI;h.forEach(e=>{const n=Qe[e.type];if(n){const{backSide:t,color:i}=n,o=t?d:f,a=Ze*(e.hits/100);tr(i,o,o+a,u,r.bodySprites,!1),tr(i,-o,-(o+a),u,r.bodySprites,!0),t?d+=a:f+=a}else t.warn(`Unsupported type ${e.type}`)}),er(l).filter(({type:t,hits:e})=>"tough"===t&&e>0).length>0&&function(t,e,r){const n=new i.Sprite(t.tough.texture);n.width=120,n.height=120,n.anchor.x=.5,n.anchor.y=.5,e.addChild(n),r.push(n)}(s,u,r.bodySprites)},disappear:({stage:t,rootContainer:e,tickDuration:r,callback:n})=>{const{actionManager:i}=t,o=new N([new P(r/2),new f(()=>{n()})]);i.runAction(e,o)},draw:Oe,moveTo:({firstRun:t,state:e,payload:{targetKey:r,shouldRotate:n=!1}={},rootContainer:i,stage:o,prevState:a,scope:s,tickDuration:u,world:{options:l}})=>{const{actionManager:c}=o,{x:h,y:f}=Pe(e,l),d=r?s[r]:i;if(!t){const t=[];a&&n&&t.push(new L(Ie(d.x,d.y,h,f),u/5));const e=new F(t);s.moveToAction&&c.cancelAction(s.moveToAction),s.moveToAction=c.runAction(d,e)}},object:be,powerInfluence:t=>{const{logger:e,stage:r,rootContainer:n,scope:o,tickDuration:a,state:s,prevState:u,world:l,payload:{parentId:c}={},world:{options:f}}=t,{actionLog:{power:p}={}}=s;if(!(c?o[c]:n))return void e.warn("No parent available with id",c);if(!u)return;const _=[];if(p){const t=ir[p.id];t||console.log("No texture key provided for power id",p.id);const e=r.resources[t];e||console.log("No texture provided for key ",t);const o=function(t,e,r,n){const o=new i.Container;o.position.copy(e.position),e.parent.addChild(o),e.on("removed",()=>o.destroy());const a=new i.Sprite(t.texture);return a.anchor.x=.5,a.anchor.y=.5,a.width=300,a.height=300,a.parentLayer=n.layers.effects,o.addChild(a),o}(e,n,0,l);_.push(function(t,e,r,n=0){const i=(e-n)/4,o=new N([new F([new U(.5,.5,0),new h(0,0)]),new d(n),new F([new U(1,1,i),new h(1,i)]),new h(0,i)]);return r&&t.position.copy(r),{action:o,target:t}}(o,.9*a,Pe({x:p.x,y:p.y},f),.3))}!function(t,e){t.forEach(({target:t,action:r})=>e.runAction(t,r))}(_,r.actionManager)},resourceCircle:t=>{const{state:{resourceType:e="creepEnergy",resourceType:r="energy",[r]:n,[`${r}Capacity`]:i=1250}={},prevState:{[r]:o}={},payload:{radius:a}={}}=t,s=function(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}(t,["state","prevState","payload"]);if(o!==n){const{[e]:{color:r,radius:o}=sr}=ar,u=(lt.parseExpression(a,t)||o)*Math.min(1,0!==i?n/i:0);return Ce(or({payload:{color:r,radius:u}},s))}},road:t=>{const{rootContainer:e,id:r,scope:n,stateExtra:o,world:{app:a,layers:{terrain:s},options:{CELL_SIZE:u,lighting:l="normal"},decorations:c},state:{x:h,y:f}={},stateExtra:{objects:d}}=t,p=n[r],_=p?p.knownNodes:{mm:!1,zm:!1,pm:!1,mz:!1},v={mm:!1,zm:!1,pm:!1,mz:!1};let{roads:g}=o;g||(g=function(t){const e=[];t.forEach(t=>{const{type:r,x:n,y:i}=t;"road"===r&&(e[n]||(e[n]=[]),e[n][i]=t)}),e.push([]);for(let t=0;t<e.length;t+=1)e[t]||(e[t]=[]);return e}(d),o.roads=g),v.mm=Boolean(g[h-1][f-1]),v.zm=Boolean(g[h][f-1]),v.pm=Boolean(g[h+1][f-1]),v.mz=Boolean(g[h-1][f]);const y=c.find(t=>["landscape","floorLandscape"].includes(t.decoration.type));if(!p||Object.entries(v).some(([t,e])=>e!==_[t])||p.decorationFloorLandscape!==y){const t=0,o=.15*u,c=o*dr,h=u,f=h,d=new i.Graphics;d.parentLayer=s,d.zIndex=1,a.renderer instanceof i.WebGLRenderer?("disabled"===l&&(d.tint=10526880),"low"===l&&(d.tint=12632256)):d.tint=10526880;const _=y?hr(parseInt(y.roadsColor.substring(1),16),y.roadsBrightness):11184810;return d.clear(),d.beginFill(_),d.drawCircle(t,t,o),d.endFill(),v.mm&&(d.beginFill(_),d.moveTo(t+c,t-c),d.lineTo(t-c,t+c),d.lineTo(t-c-f,t+c-f),d.lineTo(t+c-f,t-c-f),d.lineTo(t+c,t-c),d.endFill()),v.zm&&(d.beginFill(_),d.moveTo(t+o,t),d.lineTo(t-o,t),d.lineTo(t-o,t-h),d.lineTo(t+o,t-h),d.lineTo(t+o,t),d.endFill()),v.pm&&(d.beginFill(_),d.moveTo(t-c,t-c),d.lineTo(t+c,t+c),d.lineTo(t+c+f,t+c-f),d.lineTo(t-c+f,t-c-f),d.lineTo(t-c,t-c),d.endFill()),v.mz&&(d.beginFill(_),d.moveTo(t,t+o),d.lineTo(t,t-o),d.lineTo(t-h,t-o),d.lineTo(t-h,t+o),d.lineTo(t,t+o),d.endFill()),p&&p.destroy(!0),d.knownNodes=v,d.decorationFloorLandscape=y,n[r]=d,e.addChild(d),d}},runAction:{config:{isOwner:!1},run:t=>{const{rootContainer:e,scope:r,payload:{id:n}={}}=t;return n?r[n]:e}},say:t=>{const{payload:{say:e},world:{app:{stage:r}},scope:n}=t,o=lt.parseExpression(e,t),a=o.isPublic?14518408:13421772,s={align:"center",fill:"#111",fontFamily:"Roboto, sans-serif",fontSize:60},u=be(t,i.Container);n.sayContainer=u;const l=i.TextMetrics.measureText(o.message,new i.TextStyle(s)).width+60,c=new i.Graphics;c.lineStyle(8,0),c.beginFill(a),c.drawRoundedRect(-l/2,-170,l,100,30),c.drawPolygon([new i.Point(30,-74),new i.Point(0,-44),new i.Point(-30,-74)]),c.endFill(),u.addChild(c);const h=Object.assign({},t,{id:"sayText",payload:{parentId:"sayContainer",text:o.message,style:s,x:0,y:-120,anchor:{x:.5,y:.5}}});return vr(h),lt.addTickerHandler(u,()=>lt.alignPositionToPixels(u,r)),u},setBadgeUrls:({state:t,world:{options:{BADGE_URL:e}}})=>{const{users:r}=t;r&&Object.entries(r).forEach(([,t])=>{const{username:r}=t;t.badgeUrl=e.replace("%1",encodeURIComponent(r))})},siteProgress:t=>{const{rootContainer:e,scope:r,payload:n}=t,i=function(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}(t,["rootContainer","scope","payload"]),o=lt.parseExpression(n.progress,t);if(o!==r.oldProgress){r.oldProgress=o;const a=Oe(gr({rootContainer:e,scope:r},i)),s=lt.parseExpression(n.progressTotal,t),u=lt.parseExpression(n.color,t),l=lt.parseExpression(n.radius,t),c=lt.parseExpression(n.lineWidth,t);if(a.rotation=-Math.PI/2,a.beginFill(0,0),a.lineStyle(c,u,1),a.drawCircle(0,0,l+c/2),o>0&&s>0){const t=2*Math.PI*(Math.min(o,s)/s);a.beginFill(u),a.moveTo(0,0),a.lineStyle(1,u,1);const e=function(t,e){return{x:Math.cos(t)*e,y:Math.sin(t)*e}}(0,l);a.lineTo(e.x,e.y),a.arc(0,0,l,0,t),a.lineTo(0,0),a.endFill()}return a}},sprite:Er,terrain:t=>{const{world:{app:e,stage:r,decorations:n,layers:{terrain:o,lighting:a,effects:s},options:{size:u}},state:{gameData:{player:l,swampTexture:c="animated"},objects:h,users:f={},setTerrain:d},world:{options:{CELL_SIZE:p,RENDER_SIZE:_=u,VIEW_BOX:v,HALF_CELL_SIZE:g=p/2,lighting:y="normal"}}}=t,m=_.width/v;function E(t,e){return r.addChild(t),t.parentLayer=o,t.x=-p/2,t.y=-p/2,t.width=v,t.height=v,Object.assign(t,e),t}r.terrainObjects||(r.terrainObjects={},r.terrainObjects.wallMask=new i.Sprite(i.Texture.EMPTY),Object.assign(r.terrainObjects.wallMask,{x:-50,y:-50,width:5e3,height:5e3,renderable:!1}),r.addChild(r.terrainObjects.wallMask));const{terrainObjects:x}=r,b=n.find(t=>["landscape","wallLandscape"].includes(t.decoration.type)),T=n.find(t=>["landscape","floorLandscape"].includes(t.decoration.type));let{previousSwamps:R}=x;R||(R=[],x.previousSwamps=R),d&&(R=h.filter(({type:t})=>"swamp"===t),x.previousSwamps=R),T!==x.decorationFloorLandscape&&(x.previousSwampsMd5=null);const{result:O,md5:S}=Rr(d?[R]:[h,R],({type:t})=>"swamp"===t,x.previousSwampsMd5);if(x.previousSwampsMd5=S,O){let{swampObjects:t}=x;if(t?t.forEach(t=>t.destroy(t._generatedSvgTexture)):(t=[],x.swampObjects=t),e.renderer instanceof i.WebGLRenderer){let e;e="disabled"===y?8421504:"low"===y?10526880:16777215;let n="disabled"!==c?"#4a501e":"#465c03";T&&(n=T.swampColor);let o="disabled"!==c?"#4a501e":"#3b4019";T&&(o=T.swampStrokeColor),t[0]=E(wr(O,{size:_,VIEW_BOX:v},{fill:n,stroke:o,"stroke-width":T?T.swampStrokeWidth:50,"paint-order":"stroke"}),{alpha:.4,tint:e}),"disabled"!==c&&(t[1]=E(wr(O,{size:_,VIEW_BOX:v},{fill:"#fff"}),{alpha:.25}),t[2]=E(wr(O,{size:_,VIEW_BOX:v},{fill:"#fff"}),{alpha:.25}),t[3]=E(new Or(r.resources.noise2.texture,v,v),{alpha:"normal"===y?.3:.15,blendMode:i.BLEND_MODES.ADD,mask:t[1],tileScale:new i.Point(10,10),tint:6749952}),t[4]=E(new Or(r.resources.noise2.texture,v,v),{alpha:"normal"===y?.3:.15,blendMode:i.BLEND_MODES.ADD,tileScale:new i.Point(14,14),mask:t[2],tint:6749952}),"animated"===c&&(Cr(t[3],1.5,1.5),Cr(t[4],-1.35,-1.35)))}else t[0]=E(wr(O,{size:_,VIEW_BOX:v},{fill:T?T.swampColor:"#292b18",stroke:T?T.swampStrokeColor:"#252715","stroke-width":T?T.swampStrokeWidth:50,"paint-order":"stroke"}))}let{rampartsObjects:w}=x;w?Object.entries(w).forEach(([,t])=>{t.came=!1}):(w={},x.rampartsObjects=w),Object.keys(f).forEach(t=>{const{[t]:e={md5:"",sprite:null}}=w,{md5:r,result:n}=Rr([h],({type:e,isPublic:r,user:n})=>"rampart"===e&&!r&&n===t,e.md5,!0);e.md5=r,n?(e.sprite&&e.sprite.destroy(e.sprite._generatedSvgTexture),e.sprite=E(wr(n,{size:_,VIEW_BOX:v},l===t?{fill:"#105010",stroke:"#44ff44","stroke-width":25,"paint-order":"stroke"}:{fill:"#501010",stroke:"#ff4444","stroke-width":25,"paint-order":"stroke"}),{alpha:.4,blendMode:i.BLEND_MODES.ADD,parentLayer:s})):!1===n&&e.sprite&&(e.sprite.destroy(e.sprite._generatedSvgTexture),e.sprite=null),e.came=!0,w[t]=e}),Object.entries(w).forEach(([t,e])=>{e.came||(e.sprite&&e.sprite.destroy(e.sprite._generatedSvgTexture),delete w[t])});let{previousWalls:C}=x;C||(C=[],x.previousWalls=C),d&&(C=h.filter(({type:t})=>"wall"===t),x.previousWalls=C);const A=d?[C]:[h,C];b!==x.decorationWallLandscape&&(x.previousWallsMd5=null);const{md5:I,result:P}=Rr(A,({type:t})=>"wall"===t||"constructedWall"===t,x.previousWallsMd5);if(x.previousWallsMd5=I,P){let{wallObjects:t}=x;const n=t||[];if(t=[],x.wallObjects=t,e.renderer instanceof i.WebGLRenderer){t[0]=i.RenderTexture.create(_.width,_.height),t[1]=E(new i.Sprite(i.Texture.WHITE),{zIndex:2,visible:!1});let o="disabled"===y?"#181818":"#111",s="#000";b&&(o=hr(b.backgroundColor,b.backgroundBrightness),s=hr(b.strokeColor,b.strokeBrightness),"disabled"===y&&(o=fr(o,.5),s=fr(s,.3)));const u=wr(P,{size:_,VIEW_BOX:v},{fill:o,stroke:s,"stroke-width":b?b.strokeWidth:10,"paint-order":"stroke"});lt.onTextureLoaded(u.texture,()=>{e.renderer.render(u,t[0]),u.destroy(!0)});const l=wr(P,{size:_,VIEW_BOX:v},{fill:"#fff"});x.wallMask.texture!==i.Texture.EMPTY&&x.wallMask.texture.destroy(!0),x.wallMask.texture=l.texture,lt.onTextureLoaded(l.texture,()=>{if("disabled"!==y){const n=new Or(r.resources.noise1.texture,v,v);Object.assign(n,{alpha:.2,blendMode:i.BLEND_MODES.ADD,tileScale:new i.Point(8*m,8*m),mask:l}),e.renderer.render(n,t[0],!1),n.destroy()}l.destroy(),lt.enableTextureMipmap(e.renderer,t[0].baseTexture),[t[1].texture]=t,t[1].visible=!0,n[1]&&n[1].destroy(!0)}),t[2]=i.RenderTexture.create(_.width,_.height),t[3]=E(new i.Sprite(i.Texture.WHITE),{parentLayer:a,_overrideBlendMode:!0,blendMode:i.BLEND_MODES.MULTIPLY,visible:!1});const c=wr(P,{size:_,VIEW_BOX:v},{fill:"#000"});lt.onTextureLoaded(c.texture,()=>{c.filters=[new Sr(.006*_.width)],e.renderer.render(c,t[2]),c.destroy(!0),lt.enableTextureMipmap(e.renderer,t[2].baseTexture),[,,t[3].texture]=t,t[3].visible=!0,n[3]&&n[3].destroy(!0)}),t[4]=E(wr(P,{size:_,VIEW_BOX:v},{fill:"#808080",stroke:b?function(t,e,r){const[n,i,o]=cr(t,e,r);return`#${lr(n)}${lr(i)}${lr(o)}`}(0,0,b.strokeLighting):"#000000","stroke-width":b?b.strokeWidth:10,"paint-order":"stroke"}),{parentLayer:a,visible:!1}),lt.onTextureLoaded(t[4].texture,()=>{t[4].visible=!0,n[4]&&n[4].destroy(!0)})}else t[0]=E(wr(P,{size:_,VIEW_BOX:v},{fill:"#111",stroke:"#000","stroke-width":10,"paint-order":"stroke"}),{zIndex:2,visible:!1}),lt.onTextureLoaded(t[0].texture,()=>{t[0].visible=!0,n[0]&&n[0].destroy()})}if(!x.previousFloor||T!==x.decorationFloorLandscape){const t=x.previousFloor;x.previousFloor={};const n=new i.Graphics;let a,s=5592405;if("disabled"!==y&&e.renderer instanceof PIXI.WebGLRenderer||(s=2105376),"low"===y&&(s=3487029),T&&(s=hr(s=parseInt(T.floorBackgroundColor.substring(1),16),T.floorBackgroundBrightness),"low"===y&&(s=fr(s,.65)),"disabled"===y&&(s=fr(s,.5))),n.beginFill(s),n.drawRect(-g,-g,v,v),n.endFill(),o.addChild(n),x.previousFloor.background=n,T){T.decoration.tileScale?((a=Or.fromImage(T.decoration.floorForegroundUrl,50*p,50*p)).texture.baseTexture.mipmap=!1,a.tileScale.x=T.decoration.tileScale,a.tileScale.y=T.decoration.tileScale):a=i.Sprite.fromImage(T.decoration.floorForegroundUrl);let t=hr(parseInt(T.floorForegroundColor.substr(1),16),T.floorForegroundBrightness);"low"===y&&(t=fr(t,.65)),"disabled"===y&&(t=fr(t,.5)),Object.assign(a,{x:-.5*p,y:-.5*p,width:50*p,height:50*p,alpha:T.floorForegroundAlpha,tint:t})}else{(a=new Or(r.resources.ground.texture,v,v)).x=-g,a.y=-g,a.tileScale.x=3,a.tileScale.y=3,a.alpha="normal"===y?.3:"low"===y?.1:.2;const t=new Or(r.resources["ground-mask"].texture,v,v);t.x=-g,t.y=-g,t.tileScale.x=7,t.tileScale.y=7,t.blendMode=i.BLEND_MODES.MULTIPLY,t.alpha="normal"===y?.15:"low"===y?.05:.1,x.previousFloor.ground2=t,o.addChild(t)}o.addChild(a),x.previousFloor.ground=a,t&&(t.background.destroy(),t.ground.destroy(),t.ground2&&t.ground2.destroy())}x.decorationFloorLandscape=T,x.decorationWallLandscape=b},text:vr,userBadge:t=>{const{payload:{parentId:e,radius:r=Pr.radius,color:n=Pr.color}={},scope:i,scope:{[e]:o},state:{user:a},stateExtra:{users:s={}},state:u,stateExtra:l}=t,c=Ir(t.payload,["parentId","radius","color"]),h=Ir(t,["payload","scope","scope","state","stateExtra","state","stateExtra"]),f=a&&s[a]&&s[a].badgeUrl;if(f){const t=Ar({},Mr,{width:2*r,texture:f,parentId:e},c);return Er(Ar({payload:t,scope:{[e]:o}},h))}return Ce(Ar({payload:{radius:r,color:n,parentId:e},scope:i},h))},creepDecoration:t=>{const{logger:e,stage:{actionManager:r},rootContainer:n,id:o="object",scope:a,state:s,payload:{parentId:u,id:l=o}={},world:{decorations:c=[],layers:f}}=t,d=u?a[u]:n;d?(a[l]&&(a[l].forEach(t=>t.destroy()),delete a[l]),a[l]=[],c.forEach(t=>{if("creep"!==t.decoration.type||s.user!==`${t.user}`||s.spawning)return;const e=t.nameFilter.split(/!SEP!/).some(t=>s.name.includes(t));if(!t.exclude&&!e||t.exclude&&e)return;const o=new i.Container;if(a[l].push(o),t.syncRotate?d.addChild(o):n.addChildAt(o,0),t.decoration.graphics.forEach(e=>{const r=i.Sprite.fromImage(e.url);Object.assign(r,{width:t.width,height:t.height,anchor:{x:.5,y:.5},parentLayer:"below"===t.position?f.objects:f.effects,zIndex:1}),void 0!==t[e.alpha]&&(r.alpha=t[e.alpha]),t[e.color]&&(r.tint=hr(parseInt(t[e.color].substring(1),16),t.brightness)),t.flip&&(r.scale.y*=-1),o.addChild(r)}),t.lighting&&t.decoration.graphics.forEach(e=>{const r=i.Sprite.fromImage(e.url);Object.assign(r,{width:t.width,height:t.height,anchor:{x:.5,y:.5},parentLayer:f.lighting}),void 0!==t[e.alpha]&&(r.alpha=t[e.alpha]),t.flip&&(r.scale.y*=-1),o.addChild(r)}),t.animation){const e=new D(new N(Dr[t.animation].map(t=>new F([new h(t[0],t[1])]))));r.runAction(o,e)}})):e.warn("No parent available with id",u)},objectDecoration:t=>{const{logger:e,stage:{actionManager:r},rootContainer:n,id:o="object",scope:a,state:s,payload:{parentId:u,id:l=o}={},world:{decorations:c=[],layers:f}}=t;(u?a[u]:n)?(a[l]&&(a[l].forEach(t=>t.destroy()),delete a[l]),a[l]=[],c.forEach(t=>{if("object"!==t.decoration.type||t.decoration.objectType!==s.type||t.user&&s.user!==`${t.user}`)return;const e=new i.Container;if(a[l].push(e),n.addChildAt(e,0),t.decoration.graphics.forEach(r=>{const n=i.Sprite.fromImage(r.url);Object.assign(n,{width:t.width,height:t.height,anchor:{x:.5,y:.5},parentLayer:f.objects,zIndex:1}),void 0!==t[r.alpha]&&(n.alpha=t[r.alpha]),t[r.color]&&(n.tint=hr(parseInt(t[r.color].substring(1),16),t.brightness)),e.addChild(n)}),t.lighting&&t.decoration.graphics.forEach(r=>{const n=i.Sprite.fromImage(r.url);Object.assign(n,{width:t.width,height:t.height,anchor:{x:.5,y:.5},parentLayer:f.lighting}),void 0!==t[r.alpha]&&(n.alpha=t[r.alpha]),e.addChild(n)}),t.animation){const n=new D(new N(Dr[t.animation].map(t=>new F([new h(t[0],t[1])]))));r.runAction(e,n)}})):e.warn("No parent available with id",u)}},Ur=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};class Nr{constructor(t,e,r){if(this.state=void 0,this.calcs={},this.rootContainer={},this.id=t,this.objectMetadata=e,this.world=r,this.rootContainer=r.createData(e),this.rootContainer.zIndex=e.zIndex||0,e.processors){let t=0;e.processors.forEach(e=>{e.id=e.id||`id#${Math.floor(1e5*Math.random())}`,e.zIndex=e.zIndex||t,t+=1})}e.actions&&e.actions.forEach(t=>{t.id=t.id||`id#${Math.floor(1e5*Math.random())}`}),this.scope={actions:{},processors:{}}}remove(t){const{world:e,rootContainer:r,scope:n,objectMetadata:i}=this,{disappearProcessor:o}=i;if(o){const a={objectMetadata:i,rootContainer:r,scope:n,tickDuration:t,callback:()=>this._destroy()};e.runProcessor(o,a)}else this._destroy()}_destroy(){const{world:t,rootContainer:e,scope:r,objectMetadata:n}=this;n.processors.forEach(t=>{const n={objectMetadata:t,rootContainer:e,scope:r};this.destructProcessor(r,t,n)}),this.world.cancelActionsForObj(e),t.destroyData(e)}applyState(t,e,r){const{state:n,calcs:i,world:o,rootContainer:a,scope:s,objectMetadata:u,world:{options:{logger:l}}}=this,c=!n,h=Ur({},i),f={calcs:h,firstRun:c,objectMetadata:u,prevCalcs:i,prevState:n,world:o,rootContainer:a,scope:s,state:t,stateExtra:r,tickDuration:e};c&&u.data&&Object.entries(u.data).forEach(([t,e])=>{this.rootContainer[t]=lt.parseExpression(e,f)}),u.calculations&&u.calculations.forEach(e=>{const r=this.propsChanged(e,f);if(this.shouldRun(e,f,{firstRun:c,propsChanged:r})){const{path:r=null,id:i="customField",func:o}=e,a=null===r?t:X(t,r),s=null===r?n:X(n,r),u=Ur({},f,{state:a,prevState:s,payload:e.payload});h[i]=lt.parseExpression(o,u),l.debug("Calculation",i,"set to",h[i])}}),u.actions&&u.actions.map(t=>{if(!t.targetId||s[t.targetId]){const e=t.targetId?s[t.targetId]:void 0,r=s.actions[t.id],{animations:n}=r||{},i=!r,o=this.propsChanged(t,f),a=this.shouldRun(t,f,{propsChanged:o,firstRun:i}),u=this.onceAllow(t,{propsChanged:o,firstRun:i}),l=!a&&this.shouldDestruct(t,f,{propsChanged:o,firstRun:i});a&&u?(n&&this.world.finishActions(n),s.actions[t.id]={animations:this.world.runActions(t.actions,f,e)}):l&&(n&&this.world.finishActions(n),delete s.actions[t.id])}return[]}),u.processors.forEach(e=>{const r=!s.processors[e.id],i=this.propsChanged(e,f),a=this.shouldRun(e,f,{propsChanged:i,firstRun:r}),u=!a&&this.shouldDestruct(e,f,{propsChanged:i,firstRun:r});if(a||u){const{layer:l,path:c=null,zIndex:h}=e,d=null===c?t:X(t,c),p=null===c?n:X(n,c),_=Ur({},f,{state:d,prevState:p},e),v=this.onceAllow(e,{propsChanged:i,firstRun:r});if(a&&v){const t=o.runProcessor(e,_);let r;t?(t.zIndex=h,l&&(t.parentLayer=this.world.layers[l]),r={actions:this.world.runActions(e.actions,_,t),obj:t}):r={},s.processors[e.id]=r}else u&&this.destructProcessor(s,e,_)}}),(t.temp||t.tempRemove)&&(this.rootContainer.alpha=.3),this.calcs=h,this.state=t}propsChanged(t,e){const{props:r="*"}=t,{prevState:n,state:i,prevCalcs:o,calcs:s}=e;return!n||("*"===r||!!r.find(t=>!a.a.isEqual(n[t],i[t]))||!!r.find(t=>!a.a.isEqual(o[t],s[t])))}shouldRun(t,e,{propsChanged:r}){const{shouldRun:n,when:i=n}=t,{prevState:o,state:a}=e;return!(i&&!lt.parseExpression(i,e))&&(!o||!a||r)}onceAllow(t,{firstRun:e}){const{once:r=!1}=t;return!r||e}shouldDestruct(t,e,{propsChanged:r}){const{shouldRun:n,until:i,when:o=n}=t;return r&&(!i&&o||i&&lt.parseExpression(i,e))}destructProcessor(t,e,r){const n=t.processors[e.id];if(n){const{actions:i,obj:o}=n;i&&this.world.finishActions(i),this.world.destructProcessor(e,r,o),delete t.processors[e.id]}else this.world.destructProcessor(e,r,null)}get rendererCounter(){return this.world.countObjects(this.rootContainer)}}var Fr=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};function jr(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,r){return function n(i,o){try{var a=e[i](o),s=a.value}catch(t){return void r(t)}if(!a.done)return Promise.resolve(s).then(function(t){n("next",t)},function(t){n("throw",t)});t(s)}("next")})}}function kr(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)}const{Layer:Br,Stage:Hr}=i.display;class Xr{constructor(t){this.gameObjects={},this.decorations=[],this.options=t;const{app:e,actionManager:r,logger:n,metadata:o={},resourceMap:a,CELL_SIZE:s,VIEW_BOX:u}=this.options;this.metadata=o;const{objects:l={}}=this.metadata,{_all:{actions:c=[],calculations:h=[],processors:f=[],data:d={}}={}}=l,p=function(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}(l,["_all"]);if(Object.entries(p).forEach(([,t])=>{if(t){const{actions:e=[],calculations:r=[],data:n=[],processors:i=[]}=t;t.actions=[].concat(kr(c),kr(e)),t.data=Fr({},d,n),t.calculations=[].concat(kr(h),kr(r)),t.processors=[].concat(kr(f),kr(i))}}),e.stage=new Hr,e.stage.pivot.x=-s/2,e.stage.pivot.y=-s/2,this.app=e,this.stage=e.stage,this.stage.actionManager=r,this.resourceMap=a,this.resourceManager=new me({logger:n,world:this}),this.stage.resourceManager=this.resourceManager,this.layers={},this.defaultLayerId=null,this.unmaskedRendererInfo=null,this.app.renderer instanceof i.WebGLRenderer){const{gl:t}=this.app.renderer.state,e=t.getExtension("WEBGL_debug_renderer_info");this.unmaskedRendererInfo=e&&t.getParameter(e.UNMASKED_RENDERER_WEBGL)}const _=new i.Graphics;_.drawRect(-s/2,-s/2,u,u),e.stage.addChild(_),e.stage.mask=_}init(){var t=this;return jr(function*(){const{stage:e}=t;e.resources=yield t.resourceManager.load(t.resourceMap,t.options.rescaleResources),t.metadata.layers.forEach((()=>{var r=jr(function*({id:r,isDefault:n=!1,afterCreate:i=function(){}}){const o=new Br;if(o.group.enableSort=!0,e.addChild(o),t.layers[r]=o,n){if(t.defaultLayerId)throw new Error("defaultLayer is already specified");t.defaultLayerId=r}yield i(o,{app:t.app,resourceManager:t.resourceManager,world:t})});return function(t){return r.apply(this,arguments)}})())})()}applyState(t,e=0,r=!0){const{gameObjects:n,metadata:{objects:i,preprocessors:o},options:{gameData:a={},logger:s,objectFilter:u}}=this,{objects:l}=t;if(t.gameData=a,this.runStatePreprocessor(o.map(t=>Lr[t]),{state:t,world:this}),!r)return;const c={};(u?u(l):l).forEach(t=>{const{type:e,room:r,x:o,y:a,_id:u=`${r}:${e}:${o}:${a}`}=t;let l=n[u];if(!l){const t=i[e];t?(l=new Nr(u,t,this),n[u]=l,s.debug(`Created new game object with ID ${u}`)):void 0===t&&s.warn(`Unsupported object type: ${e}`)}c[u]=t}),Object.values(n).forEach(i=>{const{id:o}=i,a=c[o];if(a)return s.debug(`Applying state to game object ${a.type} with ID ${o}`),i.applyState(a,e,t);r&&(i.remove(e),delete n[o],s.debug(`Remove game object with ID ${o}`))})}removeAllObjects(){Object.values(this.gameObjects).forEach(t=>{t.remove(0),delete this.gameObjects[t.id]})}runStatePreprocessor(t=[],e){t.forEach(t=>t(e))}release(){this.resourceManager.release()}get metrics(){let t=0,e=0;Object.values(this.gameObjects).forEach(r=>{t+=1,e+=r.rendererCounter});const r={size:this.app.renderer.width,maxSvgSize:this.resourceManager.maxSvgSize};return this.app.renderer instanceof i.WebGLRenderer?Object.assign(r,{WebGL:"enabled",GPU:this.unmaskedRendererInfo}):Object.assign(r,{WebGL:"disabled"}),{gameObjectCounter:t,rendererCounter:e,devicePixelRatio:window.devicePixelRatio,stageSize:this.app.stage.scale.x*this.options.VIEW_BOX,renderer:r}}getWorldPosition(){const{gameObjects:t}=this,e=Object.values(t);if(0===e.length)return{x:0,y:0};const{x:r,y:n}=e[0].state;return{x:r,y:n}}createData({layer:t=this.defaultLayerId}){const e=new i.Container;return e.parentLayer=this.layers[t],this.stage.addChild(e),e}destroyData(t){t.destroy()}runProcessor(t,e){const{name:r,type:n=r}=t,i=Lr[n].run||Lr[n];if(!i)throw new Error(`No processor found for ${n}`);const{logger:o}=this.options;return o.debug("run processor",n),i(Fr({stage:this.stage,logger:o},e))}destructProcessor(t,e,r){const{name:n,type:i=n}=t,{destruct:o,config:{isOwner:a=!0}={}}=Lr[i];if(o){const{logger:t}=this.options;return t.debug("run destruct",i),o(Fr({stage:this.stage,logger:t},e))}r&&a&&(this.cancelActionsForObj(r),r.destroy())}runActions(t=[],e,r=e.rootContainer){const{stage:{actionManager:n}}=this;return t.map(t=>lt.createAction(t,Fr({},e,{target:r}))).map(t=>n.runAction(r,t))}cancelActions(t){const{stage:{actionManager:e}}=this;t.forEach(t=>{e.cancelAction(t)})}cancelActionsForObj(t){const{stage:{actionManager:e}}=this;e.cancelActionForContainer(t);const{children:r}=t;r&&Array.isArray(r)&&r.forEach(t=>this.cancelActionsForObj(t))}finishActions(t){const{stage:{actionManager:e}}=this;t.forEach(t=>{e.finishAction(t)})}countObjects(t){let e=1;return t.children.forEach(t=>{e+=this.countObjects(t)}),e}}var Wr=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};const{Application:Gr,utils:Yr}=i,zr=500;class Vr{static compileMetadata(t){t.isCompiled||(Object.values(t.objects).forEach(t=>{t.calculations&&t.calculations.forEach(t=>{if(a.a.isUndefined(t.func))throw new Error(`Calculation ${t.id} does not have a func specified`);a.a.isFunction(t.func)||(t.func=lt.compileExpression(t.func))}),t.processors&&t.processors.forEach(t=>{t.shouldRun&&!a.a.isFunction(t.shouldRun)&&(t.shouldRun=lt.compileExpression(t.shouldRun)),t.until&&!a.a.isFunction(t.until)&&(t.until=lt.compileExpression(t.until)),t.when&&!a.a.isFunction(t.when)&&(t.when=lt.compileExpression(t.when))}),t.data&&Object.entries(t.data).forEach(([e,r])=>{t.data[e]=lt.compileExpression(r)})}),t.isCompiled=!0)}constructor(t){this.released=!0,this.animate=this.animate.bind(this),this.animateChecker=this.animateChecker.bind(this),this.options=t,t.countMetrics&&(this.metrics={fps:0}),this.__ts=Date.now()}init(t){var e=this;return function(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,r){return function n(i,o){try{var a=e[i](o),s=a.value}catch(t){return void r(t)}if(!a.done)return Promise.resolve(s).then(function(t){n("next",t)},function(t){n("throw",t)});t(s)}("next")})}}(function*(){const{autoStart:r=!0,backgroundColor:n,size:{width:i,height:o}={width:800,height:800},worldConfigs:a,resourceMap:s,rescaleResources:l,useDefaultLogger:c=!1,logger:h=(c?console:new Proxy({},{get:function(){return function(){}}})),objectFilter:f}=e.options;e.released||e.release();const d=new Gr(i,o,{antialias:!0,transparent:!n,forceCanvas:a.forceCanvas});e.app=d,n&&(d.renderer.backgroundColor=n),e.actionManager=new u,e.world=new Xr(Wr({actionManager:e.actionManager,app:d,logger:h,objectFilter:f,rescaleResources:l,resourceMap:s,size:{width:i,height:o}},a)),e.resize(),e.released=!1,yield e.world.init(),t.appendChild(d.view),r&&e.start()})()}release(){this.released||(clearTimeout(this.animateCheckerTimer),this.world.release(),Yr.destroyTextureCache(),this.app.destroy(),this.released=!0)}start(){const{options:{countMetrics:t}}=this;t&&(this.lastLoopTime=new Date),this.lastAnimationRun=Date.now(),this.animateChecker(),this.app.ticker.add(this.animate)}animateChecker(){Date.now()-this.lastAnimationRun>zr&&this.animate(),this.animateCheckerTimer=setTimeout(this.animateChecker,zr)}applyState(t,e){return this.world.applyState(t,e)}get zoomLevel(){const{app:{stage:t}={}}=this;return t.scale.x}set zoomLevel(t){const{app:{stage:e,renderer:r}={}}=this;if(t=.02*Math.round(t/.02),e){const n=e.scale.x;e.scale.x=t,e.scale.y=t,t!==n&&r.emit("_resized")}}pan(t,e){this.app.stage.position.x+=t,this.app.stage.position.y+=e}zoomTo(t,e,r){const n=this.zoomLevel;this.zoomLevel=t;const i=(e-this.app.stage.position.x)*(1-this.zoomLevel/n),o=(r-this.app.stage.position.y)*(1-this.zoomLevel/n);this.pan(i,o)}setTerrain(t){return this.world.applyState({objects:t,setTerrain:!0},0,!1)}resize(t){const{app:{renderer:e}={}}=this;e&&t&&e.resize(t.width,t.height)}animate(){this.lastAnimationRun=Date.now(),this.actionManager.update();const{options:{countMetrics:t,onGameLoop:e}}=this;if(t){const t=new Date,e=1e3/(t-this.lastLoopTime);this.metrics.fps=Math.round(.95*this.metrics.fps+.05*e),this.lastLoopTime=t,Object.assign(this.metrics,this.world.metrics)}e&&e()}erase(){this.world.removeAllObjects()}setDecorations(t){!function(t,e){const{world:r,world:{options:{CELL_SIZE:n,lighting:o="normal"},stage:{actionManager:a}}}=e;r.app.renderer instanceof i.WebGLRenderer&&(r.decorations=t,r.decorationsContainer&&r.decorationsContainer.destroy({children:!0,texture:!0,baseTexture:!1}),r.decorationsContainer=new i.Container,r.stage.addChild(r.decorationsContainer),t.forEach(t=>{if("wallGraffiti"===t.decoration.type&&t.decoration.graphics.forEach(e=>{if(e.visible&&!t[e.visible])return;function o(){let o;if(t.decoration.tiling?((o=i.TilingSprite.fromImage(e.url,t.width*n,t.height*n)).texture.baseTexture.mipmap=!1,o.tileScale.x=t.tileScale,o.tileScale.y=t.tileScale):o=i.Sprite.fromImage(e.url),Object.assign(o,{anchor:{x:.5,y:.5},x:Math.floor((t.x+-.5+t.width/2)*n),y:Math.floor((t.y+-.5+t.height/2)*n),width:t.width*n,height:t.height*n,mask:r.stage.terrainObjects.wallMask,zIndex:2}),t.flip&&(o.scale.x*=-1),t.rotation&&(o.rotation=t.rotation),t.animation){const e=new D(new N(Dr[t.animation].map(t=>new F([new h(t[0],t[1])]))));a.runAction(o,e)}return o}const s=new i.Container;r.decorationsContainer.addChild(s),s.alpha=t.alpha;const u=o();if(u.parentLayer=r.layers.wallGraffiti,e.color&&(u.tint=hr(parseInt(t[e.color].substr(1),16),t.brightness)),s.addChild(u),t.lighting){const t=o();t.parentLayer=r.layers.lighting,s.addChild(t)}}),["landscape","wallLandscape"].includes(t.decoration.type)){let e=hr(parseInt(t.foregroundColor.substr(1),16),t.foregroundBrightness);"disabled"===o&&(e=fr(e,.6));const a=i.Sprite.fromImage(t.decoration.foregroundUrl);Object.assign(a,{x:-.5*n,y:-.5*n,width:50*n,height:50*n,parentLayer:r.layers.wallGraffiti,alpha:t.foregroundAlpha,tint:e,mask:r.stage.terrainObjects.wallMask,zIndex:1}),r.decorationsContainer.addChild(a)}}))}(t,{world:this.world})}static isWebGLSupported(){return Yr.isWebGLSupported()}}r.d(e,"GameRenderer",function(){return Kr}),r.d(e,"PIXI",function(){return qr}),window&&(window.GameRenderer=Vr);const Kr=Vr,qr=i;e.default=Kr}])});
188
188
  //# sourceMappingURL=renderer.js.map