@screeps/renderer 1.5.15 → 1.5.18

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
@@ -41,7 +41,7 @@ object-assign
41
41
  * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
42
42
  * @license MIT
43
43
  */
44
- t.exports=function(t){return null!=t&&(r(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&r(t.slice(0,0))}(t)||!!t._isBuffer)}},function(t,e,r){"use strict";r.r(e);var n={};r.r(n),r.d(n,"add",function(){return B}),r.d(n,"and",function(){return H}),r.d(n,"calc",function(){return W}),r.d(n,"div",function(){return G}),r.d(n,"gt",function(){return Y}),r.d(n,"gte",function(){return z}),r.d(n,"if",function(){return V}),r.d(n,"lt",function(){return K}),r.d(n,"lte",function(){return q}),r.d(n,"max",function(){return Z}),r.d(n,"min",function(){return $}),r.d(n,"mul",function(){return J}),r.d(n,"not",function(){return Q}),r.d(n,"or",function(){return tt}),r.d(n,"processorParam",function(){return et}),r.d(n,"random",function(){return rt}),r.d(n,"rel",function(){return nt}),r.d(n,"state",function(){return it}),r.d(n,"sub",function(){return ot}),r.d(n,"concat",function(){return at});var i=r(0),o=r(8),a=r.n(o);class s extends i.utils.EventEmitter{constructor(t,e){super(),this._id=`_${i.utils.uid()}`,this.container=t,this.action=e,this._started=!1,this._ended=!1,this._active=!1}update(t){this._started||(this.emit("start",t),this._started=!0,this._active=!0);try{this._ended=this.action.update(this.container,t)}catch(t){console.error("Exception while animation:",t),this._ended=!0}this._ended&&this._active&&(this.emit("end",t),this._active=!1)}isEnded(){return this._ended}}class u{constructor(){this.actions={},this._actionsToDelete=[],this._last=0}update(t){let e;this._removeActions(),e=t||0===t?1e3*t:this._getDeltaMs(),Object.values(this.actions).forEach(({actionHandle:t})=>{t.update(e),t.isEnded()&&this._actionsToDelete.push(t)}),this._removeActions()}runAction(t,e){const r=new s(t,e);return this.actions[r._id]={actionHandle:r,container:t},r}cancelAction(t){this._actionsToDelete.push(t)}finishAction(t){this.actions[t._id]&&!this._actionsToDelete.includes(t)&&(t.action.finish(t.container),this._actionsToDelete.push(t))}cancelActionForContainer(t){Object.values(this.actions).forEach(({actionHandle:e,container:r})=>{t===r&&this._actionsToDelete.push(e)})}_remove(t){delete this.actions[t._id]}_removeActions(){if(this._actionsToDelete.length){for(let t=0;t<this._actionsToDelete.length;t+=1)this._remove(this._actionsToDelete[t]);this._actionsToDelete.length=0}}_getDeltaMs(){0===this._last&&(this._last=Date.now());const t=Date.now(),e=t-this._last;return this._last=t,e}}class l{reset(){}update(){throw new Error("Override me!")}finish(){this.reset()}}class c extends l{constructor(t){super(),this.time=1e3*t}reset(){this.restTime=this.time}update(t,e){return this.restTime-=e,this.restTime<=0&&(this.finish(t),!0)}}class h extends c{constructor(t,e){super(e),this.alpha=t,this.reset()}update(t,e){const{alpha:r}=t;return t.alpha+=(this.alpha-r)/this.restTime*e,super.update(t,e)}finish(t){t.alpha=this.alpha,super.finish(t)}}class f extends c{constructor(t,e=0){super(e),this.func=t||(()=>{}),this.reset()}update(t,e){return this.func(t,this.restTime,e),super.update(t,e)}}class d extends c{constructor(t){super(t),this.reset()}}const p=t=>e=>Math.pow(e,t),_=t=>e=>1-Math.abs(Math.pow(e-1,t)),v=t=>e=>e<.5?p(t)(2*e)/2:_(t)(2*e-1)/2+.5,g=v(1),y=p(2),m=_(2),E=v(2),x=p(3),b=_(3),T=v(3),R=p(4),O=_(4),S=v(4),w=p(5),C=_(5),A=v(5);class I extends l{constructor(t,e=m){if(super(),this.time=t.time,this.action=t,"string"!=typeof e)this.easeType=e;else if(this.easeType=I.TYPE[e],!this.easeType)throw new Error(`Wrong easeType ${e}`);this.reset()}reset(){this.originialTimePassed=0,this.timePassed=0,this.action.reset(),super.reset()}update(t,e){this.originialTimePassed+=e;const r=this.originialTimePassed<=this.time?Math.max(this.time*this.easeType(this.originialTimePassed/this.time)-this.timePassed,0):e;this.timePassed+=r;const n=this.action.update(t,r);return n&&this.finish(t),n}finish(t){this.action.finish(t),super.finish(t)}}I.TYPE={LINEAR:g,EASE_IN_QUAD:y,EASE_OUT_QUAD:m,EASE_IN_OUT_QUAD:E,EASE_IN_CUBIC:x,EASE_OUT_CUBIC:b,EASE_IN_OUT_CUBIC:T,EASE_IN_QUART:R,EASE_OUT_QUART:O,EASE_IN_OUT_QUART:S,EASE_IN_QUINT:w,EASE_OUT_QUINT:C,EASE_IN_OUT_QUINT:A};class P extends c{constructor(t){super(t),this.alpha=0,this.reset()}update(t,e){const{alpha:r}=t;return t.alpha+=(this.alpha-r)/this.restTime*e,super.update(t,e)}finish(t){t.alpha=this.alpha}}class M extends c{constructor(t,e,r){super(r),this.x=t,this.y=e,this.reset()}reset(){super.reset(),this.tx=null,this.ty=null}update(t,e){const r=t.position;null!==this.tx&&null!==this.ty||(this.tx=r.x+this.x,this.ty=r.y+this.y);const n=(this.tx-r.x)/this.restTime*e,i=(this.ty-r.y)/this.restTime*e;return t.x+=n,t.y+=i,super.update(t,e)}finish(t){t.x=this.tx,t.y=this.ty,super.finish(t)}}class D extends l{constructor(t,e){super(),this.action=t,this.count=e,this.reset()}reset(){this._count=this.count,this._count||(this._count=1/0)}update(t,e){return this.action.update(t,e)&&(this.action.reset(),this._count-=1),this._count<=0&&(this.finish(t),!0)}}class L extends c{constructor(t,e){super(e),this.rotation=t,this.reset()}update(t,e){const{rotation:r}=t;for(;this.rotation-r>Math.PI;)this.rotation-=2*Math.PI;for(;this.rotation-r<-Math.PI;)this.rotation+=2*Math.PI;return t.rotation+=(this.rotation-r)/this.restTime*e,super.update(t,e)}finish(t){t.rotation=this.rotation,super.finish(t)}}class U extends c{constructor(t,e,r){super(r),this.x=t,this.y=e,this.reset()}update(t,e){const{scale:r}=t,n=(this.x-r.x)/this.restTime*e,i=(this.y-r.y)/this.restTime*e;return t.scale.x+=n,t.scale.y+=i,super.update(t,e)}finish(t){t.scale.x=this.x,t.scale.y=this.y,super.finish(t)}}class N extends l{constructor(t){super(),this.actions=t,this.reset()}reset(){this._index=0}update(t,e){if(this._index>=this.actions.length)return!0;const r=this.actions[this._index];return r.update(t,e)&&(r.reset(),this._index+=1),!1}}class F extends l{constructor(t){super(),this.actions=t,this.reset()}reset(){this.actionsToRun=[].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)}(this.actions))}update(t,e){return this.actionsToRun=this.actionsToRun.filter(r=>{return!r.update(t,e)||(r.reset(),!1)}),0===this.actionsToRun.length&&(this.finish(t),!0)}}class j extends c{constructor(t,e){super(e),this.tint=t,this.reset()}update(t,e){return t.tint=this._interpolateColor(t.tint,this.tint,e),super.update(t,e)}finish(t){t.tint=this.tint,super.finish(t)}_interpolateColor(t,e,r){const n=j._getRGB(t),i=j._getRGB(e),o={};return o.r=n.r+(i.r-n.r)/this.restTime*r,o.g=n.g+(i.g-n.g)/this.restTime*r,o.b=n.b+(i.b-n.b)/this.restTime*r,j._packRGB(o)}static _getRGB(t){return{r:t>>>16,g:(65280&t)>>>8,b:255&t}}static _packRGB({r:t,g:e,b:r}){return t<<16|e<<8|r}}var k={ActionManager:u,AlphaBy:class extends c{constructor(t,e){super(e),this.alpha=t,this.reset()}reset(){super.reset(),this.talpha=null}update(t,e){const{alpha:r}=t;return null===this.talpha&&(this.talpha=r+this.alpha),t.alpha+=(this.talpha-r)/this.restTime*e,super.update(t,e)}finish(t){t.alpha=this.talpha,super.finish(t)}},AlphaTo:h,Blink:class extends c{constructor(t,e){super(e),this.count=t,this.reset()}reset(){this._count=2*this.count,this._gap=this.time/this._count,super.reset()}update(t,e){return this.restTime<=0?(t.visible=!t.visible,this.restTime=this._gap,this._count-=1):this.restTime-=e,this._count<=0&&(this.finish(t),!0)}},CallFunc:f,DelayTime:d,Ease:I,FadeIn:class extends c{constructor(t){super(t),this.alpha=1,this.reset()}update(t,e){const{alpha:r}=t;return t.alpha+=(this.alpha-r)/this.restTime*e,super.update(t,e)}finish(t){t.alpha=this.alpha}},FadeOut:P,FilterTo:class extends c{constructor(t,e,r,n){super(n),this.filterIdx=t,this.propName=e,this.propValue=r,this.reset()}update(t,e){const r=t.filters[this.filterIdx][this.propName];return t.filters[this.filterIdx][this.propName]+=(this.propValue-r)/this.restTime*e,super.update(t,e)}finish(t){t.filters[this.filterIdx][this.propName]=this.propValue,super.finish(t)}},MoveBy:M,MoveTo:class extends c{constructor(t,e,r){super(r),this.x=t,this.y=e,this.reset()}update(t,e){const r=t.position,n=(this.x-r.x)/this.restTime*e,i=(this.y-r.y)/this.restTime*e;return t.x+=n,t.y+=i,super.update(t,e)}finish(t){t.x=this.x,t.y=this.y,super.finish(t)}},PivotBy:class extends c{constructor(t,e,r){super(r),this.x=t,this.y=e,this.reset()}reset(){super.reset(),this.tx=null,this.ty=null}update(t,e){const{pivot:r}=t;null!==this.tx&&null!==this.ty||(this.tx=r.x+this.x,this.ty=r.y+this.y);const n=(this.tx-r.x)/this.restTime*e,i=(this.ty-r.y)/this.restTime*e;return t.pivot.x+=n,t.pivot.y+=i,super.update(t,e)}finish(t){t.pivot.x=this.tx,t.pivot.y=this.ty,super.finish(t)}},PivotTo:class extends c{constructor(t,e,r){super(r),this.x=t,this.y=e,this.reset()}update(t,e){const{pivot:r}=t,n=(this.x-r.x)/this.restTime*e,i=(this.y-r.y)/this.restTime*e;return t.pivot.x+=n,t.pivot.y+=i,super.update(t,e)}finish(t){t.pivot.x=this.x,t.pivot.y=this.y,super.finish(t)}},Repeat:D,RotateBy:class extends c{constructor(t,e){super(e),this.rotation=t,this.reset()}reset(){super.reset(),this.trotation=null}update(t,e){const{rotation:r}=t;return null===this.trotation&&(this.trotation=r+this.rotation),t.rotation+=(this.trotation-r)/this.restTime*e,super.update(t,e)}finish(t){t.rotation=this.trotation,super.finish(t)}},RotateTo:L,ScaleBy:class extends c{constructor(t,e,r){super(r),this.x=t,this.y=e,this.reset()}reset(){super.reset(),this.tx=null,this.ty=null}update(t,e){const{scale:r}=t;null!==this.tx&&null!==this.ty||(this.tx=r.x+this.x,this.ty=r.y+this.y);const n=(this.tx-r.x)/this.restTime*e,i=(this.ty-r.y)/this.restTime*e;return t.scale.x+=n,t.scale.y+=i,super.update(t,e)}finish(t){t.scale.x=this.tx,t.scale.y=this.ty,super.finish(t)}},ScaleTo:U,Sequence:N,SkewBy:class extends c{constructor(t,e,r){super(r),this.x=t,this.y=e,this.reset()}reset(){super.reset(),this.tx=null,this.ty=null}update(t,e){const{skew:r}=t;null!==this.tx&&null!==this.ty||(this.tx=r.x+this.x,this.ty=r.y+this.y);const n=(this.tx-r.x)/this.restTime*e,i=(this.ty-r.y)/this.restTime*e;return t.skew.x+=n,t.skew.y+=i,super.update(t,e)}finish(t){t.skew.x=this.tx,t.skew.y=this.ty,super.finish(t)}},SkewTo:class extends c{constructor(t,e,r){super(r),this.x=t,this.y=e,this.reset()}update(t,e){const{skew:r}=t,n=(this.x-r.x)/this.restTime*e,i=(this.y-r.y)/this.restTime*e;return t.skew.x+=n,t.skew.y+=i,super.update(t,e)}finish(t){t.skew.x=this.x,t.skew.y=this.y,super.finish(t)}},Spawn:F,TintBy:class extends c{constructor(t,e){super(e),this.tint=t,this.reset()}reset(){super.reset(),this.ttint=null}update(t,e){const{tint:r}=t;return null===this.ttint&&(this.ttint=r+this.tint),t.tint+=(this.ttint-r)/this.restTime*e,super.update(t,e)}finish(t){t.tint=this.ttint,super.finish(t)}},TintTo:j},B=t=>{let e=0;return t.forEach(t=>{e+=t}),e},H=t=>t.every(t=>t),X=function(t,e){if(!t||"^"===e)return t;const r=(e=(e=e.replace(/\[(\w+)]/g,".$1")).replace(/^\./,"")).split(".");for(;r.length&&t;){const e=r.shift();if(!(e in t))return;t=t[e]}return t},W=(t,{default:e,koef:r=1},n)=>{let i=X(n.calcs,t);return void 0===i&&(i=e),"number"==typeof i?r*i:i},G=([t,e])=>t/e,Y=([t,e])=>t>e,z=([t,e])=>t>=e,V=(t,{then:e=!0,else:r=!1})=>t?e:r,K=([t,e])=>t<e,q=([t,e])=>t<=e;var Z=t=>Math.max.apply(Math,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)}(t));var $=t=>Math.min.apply(Math,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)}(t)),J=t=>{let e=1;return t.forEach(t=>{e*=t}),e},Q=t=>!t,tt=t=>t.some(t=>t),et=(t,{default:e,koef:r=1},n)=>{let i=X(n,t);return void 0===i&&(i=e),"number"==typeof i?r*i:i},rt=t=>Math.random()*t,nt=(t,{default:e,koef:r=1},n)=>{let i=X(n.target||n.renderData,t);return void 0===i&&(i=e),"number"==typeof i?r*i:i},it=(t,{default:e,koef:r=1},n)=>{let i=X(n.state,t);return void 0===i&&(i=e),"number"==typeof i?r*i:i},ot=([t,...e])=>{let r=t;return e.forEach(t=>{r-=t}),r},at=t=>{let e="";return t.forEach(t=>{e+=t}),e};function st(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 ut={createAction({action:t,params:e},r){const n=k[t],i=this.parseExpressions(e,r);return new(Function.prototype.bind.apply(n,[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)}(i))))},parseExpressions(t,e){return t.map(t=>this.parseExpression(t,e))},parseExpression(t,e){if("function"==typeof t)return t(e);if(null===t||void 0===t)return t;if(Array.isArray(t))return this.parseExpressions(t,e);{const r=Object.keys(n).find(e=>Object.keys(t).includes(`$${e}`));if(r){const{[`$${r}`]:i}=t,o=st(t,[`$${r}`]);return n[r](this.parseExpression(i,e),this.parseExpression(o,e),e)}return t.action?this.createAction(t,e):"object"==typeof t?this.parseObjectValues(t,e):t}},parseObjectValues(t,e){const r={};return Object.entries(t).map(([t,r])=>[t,this.parseExpression(r,e)]).forEach(([t,e])=>{r[t]=e}),r},compileExpressions(t){const e=t.map(t=>this.compileExpression(t));return t=>e.map(e=>e(t))},compileExpression(t){if(null===t||void 0===t)return()=>t;if(Array.isArray(t))return this.compileExpressions(t);{const e=Object.keys(n).find(e=>Object.keys(t).includes(`$${e}`));if(e){const{[`$${e}`]:r}=t,i=st(t,[`$${e}`]);return function(t,e,r){return n=>t(e(n),r(n),n)}(n[e],this.compileExpression(r),this.compileExpression(i))}return"object"==typeof t?this.compileObjectValues(t):()=>t}},compileObjectValues(t){const e=Object.entries(t).map(([t,e])=>[t,this.compileExpression(e)]),r={};return t=>(e.forEach(([e,n])=>{r[e]="function"==typeof n?n(t):n}),r)},addTickerHandler(t,e){function r(t){try{e(t)}catch(t){i.ticker.shared.remove(r)}}i.ticker.shared.add(r),t.on("removed",()=>i.ticker.shared.remove(r))},alignPositionToPixels(t,e){t._position||(t._position=new i.Point(t.x,t.y)),t.position.copy(t._position);const r=t.getBounds();t.x+=(Math.round(r.x)-r.x)/e.scale.x,t.y+=(Math.round(r.y)-r.y)/e.scale.y},onTextureLoaded(t,e){t.baseTexture.hasLoaded?e():t.baseTexture.once("loaded",e)},enableTextureMipmap(t,e){t.bindTexture(e,!1,0);const r=e._glTextures[t.CONTEXT_UID];r.enableMipmap(),r.enableLinearScaling()},setSvgResizeHandler(t,e,r){if(r.scaledSvgTextures){const n=()=>{const n=t.app.stage.scale.x*t.options.VIEW_BOX;let i=r.scaledSvgTextures[n];if(!i){const t=Object.keys(r.scaledSvgTextures);i=r.scaledSvgTextures[t[t.length-1]]}this.onTextureLoaded(i,()=>{try{e.texture=i,e._parsedWidth&&e._parsedHeight&&(e.scale.x=e._parsedWidth/i.width,e.scale.y=e._parsedHeight/i.height)}catch(t){}})};t.app.renderer.on("_resized",n),e.on("removed",()=>t.app.renderer.off("_resized",n)),n()}}};r(195);
44
+ t.exports=function(t){return null!=t&&(r(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&r(t.slice(0,0))}(t)||!!t._isBuffer)}},function(t,e,r){"use strict";r.r(e);var n={};r.r(n),r.d(n,"add",function(){return B}),r.d(n,"and",function(){return H}),r.d(n,"calc",function(){return W}),r.d(n,"div",function(){return G}),r.d(n,"eq",function(){return Y}),r.d(n,"gt",function(){return z}),r.d(n,"gte",function(){return V}),r.d(n,"if",function(){return K}),r.d(n,"lt",function(){return q}),r.d(n,"lte",function(){return Z}),r.d(n,"max",function(){return $}),r.d(n,"min",function(){return J}),r.d(n,"mul",function(){return Q}),r.d(n,"not",function(){return tt}),r.d(n,"or",function(){return et}),r.d(n,"processorParam",function(){return rt}),r.d(n,"random",function(){return nt}),r.d(n,"rel",function(){return it}),r.d(n,"state",function(){return ot}),r.d(n,"sub",function(){return at}),r.d(n,"concat",function(){return st});var i=r(0),o=r(8),a=r.n(o);class s extends i.utils.EventEmitter{constructor(t,e){super(),this._id=`_${i.utils.uid()}`,this.container=t,this.action=e,this._started=!1,this._ended=!1,this._active=!1}update(t){this._started||(this.emit("start",t),this._started=!0,this._active=!0);try{this._ended=this.action.update(this.container,t)}catch(t){console.error("Exception while animation:",t),this._ended=!0}this._ended&&this._active&&(this.emit("end",t),this._active=!1)}isEnded(){return this._ended}}class u{constructor(){this.actions={},this._actionsToDelete=[],this._last=0}update(t){let e;this._removeActions(),e=t||0===t?1e3*t:this._getDeltaMs(),Object.values(this.actions).forEach(({actionHandle:t})=>{t.update(e),t.isEnded()&&this._actionsToDelete.push(t)}),this._removeActions()}runAction(t,e){const r=new s(t,e);return this.actions[r._id]={actionHandle:r,container:t},r}cancelAction(t){this._actionsToDelete.push(t)}finishAction(t){this.actions[t._id]&&!this._actionsToDelete.includes(t)&&(t.action.finish(t.container),this._actionsToDelete.push(t))}cancelActionForContainer(t){Object.values(this.actions).forEach(({actionHandle:e,container:r})=>{t===r&&this._actionsToDelete.push(e)})}_remove(t){delete this.actions[t._id]}_removeActions(){if(this._actionsToDelete.length){for(let t=0;t<this._actionsToDelete.length;t+=1)this._remove(this._actionsToDelete[t]);this._actionsToDelete.length=0}}_getDeltaMs(){0===this._last&&(this._last=Date.now());const t=Date.now(),e=t-this._last;return this._last=t,e}}class l{reset(){}update(){throw new Error("Override me!")}finish(){this.reset()}}class c extends l{constructor(t){super(),this.time=1e3*t}reset(){this.restTime=this.time}update(t,e){return this.restTime-=e,this.restTime<=0&&(this.finish(t),!0)}}class h extends c{constructor(t,e){super(e),this.alpha=t,this.reset()}update(t,e){const{alpha:r}=t;return t.alpha+=(this.alpha-r)/this.restTime*e,super.update(t,e)}finish(t){t.alpha=this.alpha,super.finish(t)}}class f extends c{constructor(t,e=0){super(e),this.func=t||(()=>{}),this.reset()}update(t,e){return this.func(t,this.restTime,e),super.update(t,e)}}class d extends c{constructor(t){super(t),this.reset()}}const p=t=>e=>Math.pow(e,t),_=t=>e=>1-Math.abs(Math.pow(e-1,t)),v=t=>e=>e<.5?p(t)(2*e)/2:_(t)(2*e-1)/2+.5,g=v(1),y=p(2),m=_(2),E=v(2),x=p(3),b=_(3),T=v(3),R=p(4),O=_(4),S=v(4),w=p(5),C=_(5),A=v(5);class I extends l{constructor(t,e=m){if(super(),this.time=t.time,this.action=t,"string"!=typeof e)this.easeType=e;else if(this.easeType=I.TYPE[e],!this.easeType)throw new Error(`Wrong easeType ${e}`);this.reset()}reset(){this.originialTimePassed=0,this.timePassed=0,this.action.reset(),super.reset()}update(t,e){this.originialTimePassed+=e;const r=this.originialTimePassed<=this.time?Math.max(this.time*this.easeType(this.originialTimePassed/this.time)-this.timePassed,0):e;this.timePassed+=r;const n=this.action.update(t,r);return n&&this.finish(t),n}finish(t){this.action.finish(t),super.finish(t)}}I.TYPE={LINEAR:g,EASE_IN_QUAD:y,EASE_OUT_QUAD:m,EASE_IN_OUT_QUAD:E,EASE_IN_CUBIC:x,EASE_OUT_CUBIC:b,EASE_IN_OUT_CUBIC:T,EASE_IN_QUART:R,EASE_OUT_QUART:O,EASE_IN_OUT_QUART:S,EASE_IN_QUINT:w,EASE_OUT_QUINT:C,EASE_IN_OUT_QUINT:A};class P extends c{constructor(t){super(t),this.alpha=0,this.reset()}update(t,e){const{alpha:r}=t;return t.alpha+=(this.alpha-r)/this.restTime*e,super.update(t,e)}finish(t){t.alpha=this.alpha}}class M extends c{constructor(t,e,r){super(r),this.x=t,this.y=e,this.reset()}reset(){super.reset(),this.tx=null,this.ty=null}update(t,e){const r=t.position;null!==this.tx&&null!==this.ty||(this.tx=r.x+this.x,this.ty=r.y+this.y);const n=(this.tx-r.x)/this.restTime*e,i=(this.ty-r.y)/this.restTime*e;return t.x+=n,t.y+=i,super.update(t,e)}finish(t){t.x=this.tx,t.y=this.ty,super.finish(t)}}class D extends l{constructor(t,e){super(),this.action=t,this.count=e,this.reset()}reset(){this._count=this.count,this._count||(this._count=1/0)}update(t,e){return this.action.update(t,e)&&(this.action.reset(),this._count-=1),this._count<=0&&(this.finish(t),!0)}}class L extends c{constructor(t,e){super(e),this.rotation=t,this.reset()}update(t,e){const{rotation:r}=t;for(;this.rotation-r>Math.PI;)this.rotation-=2*Math.PI;for(;this.rotation-r<-Math.PI;)this.rotation+=2*Math.PI;return t.rotation+=(this.rotation-r)/this.restTime*e,super.update(t,e)}finish(t){t.rotation=this.rotation,super.finish(t)}}class U extends c{constructor(t,e,r){super(r),this.x=t,this.y=e,this.reset()}update(t,e){const{scale:r}=t,n=(this.x-r.x)/this.restTime*e,i=(this.y-r.y)/this.restTime*e;return t.scale.x+=n,t.scale.y+=i,super.update(t,e)}finish(t){t.scale.x=this.x,t.scale.y=this.y,super.finish(t)}}class N extends l{constructor(t){super(),this.actions=t,this.reset()}reset(){this._index=0}update(t,e){if(this._index>=this.actions.length)return!0;const r=this.actions[this._index];return r.update(t,e)&&(r.reset(),this._index+=1),!1}}class F extends l{constructor(t){super(),this.actions=t,this.reset()}reset(){this.actionsToRun=[].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)}(this.actions))}update(t,e){return this.actionsToRun=this.actionsToRun.filter(r=>{return!r.update(t,e)||(r.reset(),!1)}),0===this.actionsToRun.length&&(this.finish(t),!0)}}class j extends c{constructor(t,e){super(e),this.tint=t,this.reset()}update(t,e){return t.tint=this._interpolateColor(t.tint,this.tint,e),super.update(t,e)}finish(t){t.tint=this.tint,super.finish(t)}_interpolateColor(t,e,r){const n=j._getRGB(t),i=j._getRGB(e),o={};return o.r=n.r+(i.r-n.r)/this.restTime*r,o.g=n.g+(i.g-n.g)/this.restTime*r,o.b=n.b+(i.b-n.b)/this.restTime*r,j._packRGB(o)}static _getRGB(t){return{r:t>>>16,g:(65280&t)>>>8,b:255&t}}static _packRGB({r:t,g:e,b:r}){return t<<16|e<<8|r}}var k={ActionManager:u,AlphaBy:class extends c{constructor(t,e){super(e),this.alpha=t,this.reset()}reset(){super.reset(),this.talpha=null}update(t,e){const{alpha:r}=t;return null===this.talpha&&(this.talpha=r+this.alpha),t.alpha+=(this.talpha-r)/this.restTime*e,super.update(t,e)}finish(t){t.alpha=this.talpha,super.finish(t)}},AlphaTo:h,Blink:class extends c{constructor(t,e){super(e),this.count=t,this.reset()}reset(){this._count=2*this.count,this._gap=this.time/this._count,super.reset()}update(t,e){return this.restTime<=0?(t.visible=!t.visible,this.restTime=this._gap,this._count-=1):this.restTime-=e,this._count<=0&&(this.finish(t),!0)}},CallFunc:f,DelayTime:d,Ease:I,FadeIn:class extends c{constructor(t){super(t),this.alpha=1,this.reset()}update(t,e){const{alpha:r}=t;return t.alpha+=(this.alpha-r)/this.restTime*e,super.update(t,e)}finish(t){t.alpha=this.alpha}},FadeOut:P,FilterTo:class extends c{constructor(t,e,r,n){super(n),this.filterIdx=t,this.propName=e,this.propValue=r,this.reset()}update(t,e){const r=t.filters[this.filterIdx][this.propName];return t.filters[this.filterIdx][this.propName]+=(this.propValue-r)/this.restTime*e,super.update(t,e)}finish(t){t.filters[this.filterIdx][this.propName]=this.propValue,super.finish(t)}},MoveBy:M,MoveTo:class extends c{constructor(t,e,r){super(r),this.x=t,this.y=e,this.reset()}update(t,e){const r=t.position,n=(this.x-r.x)/this.restTime*e,i=(this.y-r.y)/this.restTime*e;return t.x+=n,t.y+=i,super.update(t,e)}finish(t){t.x=this.x,t.y=this.y,super.finish(t)}},PivotBy:class extends c{constructor(t,e,r){super(r),this.x=t,this.y=e,this.reset()}reset(){super.reset(),this.tx=null,this.ty=null}update(t,e){const{pivot:r}=t;null!==this.tx&&null!==this.ty||(this.tx=r.x+this.x,this.ty=r.y+this.y);const n=(this.tx-r.x)/this.restTime*e,i=(this.ty-r.y)/this.restTime*e;return t.pivot.x+=n,t.pivot.y+=i,super.update(t,e)}finish(t){t.pivot.x=this.tx,t.pivot.y=this.ty,super.finish(t)}},PivotTo:class extends c{constructor(t,e,r){super(r),this.x=t,this.y=e,this.reset()}update(t,e){const{pivot:r}=t,n=(this.x-r.x)/this.restTime*e,i=(this.y-r.y)/this.restTime*e;return t.pivot.x+=n,t.pivot.y+=i,super.update(t,e)}finish(t){t.pivot.x=this.x,t.pivot.y=this.y,super.finish(t)}},Repeat:D,RotateBy:class extends c{constructor(t,e){super(e),this.rotation=t,this.reset()}reset(){super.reset(),this.trotation=null}update(t,e){const{rotation:r}=t;return null===this.trotation&&(this.trotation=r+this.rotation),t.rotation+=(this.trotation-r)/this.restTime*e,super.update(t,e)}finish(t){t.rotation=this.trotation,super.finish(t)}},RotateTo:L,ScaleBy:class extends c{constructor(t,e,r){super(r),this.x=t,this.y=e,this.reset()}reset(){super.reset(),this.tx=null,this.ty=null}update(t,e){const{scale:r}=t;null!==this.tx&&null!==this.ty||(this.tx=r.x+this.x,this.ty=r.y+this.y);const n=(this.tx-r.x)/this.restTime*e,i=(this.ty-r.y)/this.restTime*e;return t.scale.x+=n,t.scale.y+=i,super.update(t,e)}finish(t){t.scale.x=this.tx,t.scale.y=this.ty,super.finish(t)}},ScaleTo:U,Sequence:N,SkewBy:class extends c{constructor(t,e,r){super(r),this.x=t,this.y=e,this.reset()}reset(){super.reset(),this.tx=null,this.ty=null}update(t,e){const{skew:r}=t;null!==this.tx&&null!==this.ty||(this.tx=r.x+this.x,this.ty=r.y+this.y);const n=(this.tx-r.x)/this.restTime*e,i=(this.ty-r.y)/this.restTime*e;return t.skew.x+=n,t.skew.y+=i,super.update(t,e)}finish(t){t.skew.x=this.tx,t.skew.y=this.ty,super.finish(t)}},SkewTo:class extends c{constructor(t,e,r){super(r),this.x=t,this.y=e,this.reset()}update(t,e){const{skew:r}=t,n=(this.x-r.x)/this.restTime*e,i=(this.y-r.y)/this.restTime*e;return t.skew.x+=n,t.skew.y+=i,super.update(t,e)}finish(t){t.skew.x=this.x,t.skew.y=this.y,super.finish(t)}},Spawn:F,TintBy:class extends c{constructor(t,e){super(e),this.tint=t,this.reset()}reset(){super.reset(),this.ttint=null}update(t,e){const{tint:r}=t;return null===this.ttint&&(this.ttint=r+this.tint),t.tint+=(this.ttint-r)/this.restTime*e,super.update(t,e)}finish(t){t.tint=this.ttint,super.finish(t)}},TintTo:j},B=t=>{let e=0;return t.forEach(t=>{e+=t}),e},H=t=>t.every(t=>t),X=function(t,e){if(!t||"^"===e)return t;const r=(e=(e=e.replace(/\[(\w+)]/g,".$1")).replace(/^\./,"")).split(".");for(;r.length&&t;){const e=r.shift();if(!(e in t))return;t=t[e]}return t},W=(t,{default:e,koef:r=1},n)=>{let i=X(n.calcs,t);return void 0===i&&(i=e),"number"==typeof i?r*i:i},G=([t,e])=>t/e,Y=([t,e])=>t==e,z=([t,e])=>t>e,V=([t,e])=>t>=e,K=(t,{then:e=!0,else:r=!1})=>t?e:r,q=([t,e])=>t<e,Z=([t,e])=>t<=e;var $=t=>Math.max.apply(Math,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)}(t));var J=t=>Math.min.apply(Math,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)}(t)),Q=t=>{let e=1;return t.forEach(t=>{e*=t}),e},tt=t=>!t,et=t=>t.some(t=>t),rt=(t,{default:e,koef:r=1},n)=>{let i=X(n,t);return void 0===i&&(i=e),"number"==typeof i?r*i:i},nt=t=>Math.random()*t,it=(t,{default:e,koef:r=1},n)=>{let i=X(n.target||n.renderData,t);return void 0===i&&(i=e),"number"==typeof i?r*i:i},ot=(t,{default:e,koef:r=1},n)=>{let i=X(n.state,t);return void 0===i&&(i=e),"number"==typeof i?r*i:i},at=([t,...e])=>{let r=t;return e.forEach(t=>{r-=t}),r},st=t=>{let e="";return t.forEach(t=>{e+=t}),e};function ut(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 lt={createAction({action:t,params:e},r){const n=k[t],i=this.parseExpressions(e,r);return new(Function.prototype.bind.apply(n,[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)}(i))))},parseExpressions(t,e){return t.map(t=>this.parseExpression(t,e))},parseExpression(t,e){if("function"==typeof t)return t(e);if(null===t||void 0===t)return t;if(Array.isArray(t))return this.parseExpressions(t,e);{const r=Object.keys(n).find(e=>Object.keys(t).includes(`$${e}`));if(r){const{[`$${r}`]:i}=t,o=ut(t,[`$${r}`]);return n[r](this.parseExpression(i,e),this.parseExpression(o,e),e)}return t.action?this.createAction(t,e):"object"==typeof t?this.parseObjectValues(t,e):t}},parseObjectValues(t,e){const r={};return Object.entries(t).map(([t,r])=>[t,this.parseExpression(r,e)]).forEach(([t,e])=>{r[t]=e}),r},compileExpressions(t){const e=t.map(t=>this.compileExpression(t));return t=>e.map(e=>e(t))},compileExpression(t){if(null===t||void 0===t)return()=>t;if(Array.isArray(t))return this.compileExpressions(t);{const e=Object.keys(n).find(e=>Object.keys(t).includes(`$${e}`));if(e){const{[`$${e}`]:r}=t,i=ut(t,[`$${e}`]);return function(t,e,r){return n=>t(e(n),r(n),n)}(n[e],this.compileExpression(r),this.compileExpression(i))}return"object"==typeof t?this.compileObjectValues(t):()=>t}},compileObjectValues(t){const e=Object.entries(t).map(([t,e])=>[t,this.compileExpression(e)]),r={};return t=>(e.forEach(([e,n])=>{r[e]="function"==typeof n?n(t):n}),r)},addTickerHandler(t,e){function r(t){try{e(t)}catch(t){i.ticker.shared.remove(r)}}i.ticker.shared.add(r),t.on("removed",()=>i.ticker.shared.remove(r))},alignPositionToPixels(t,e){t._position||(t._position=new i.Point(t.x,t.y)),t.position.copy(t._position);const r=t.getBounds();t.x+=(Math.round(r.x)-r.x)/e.scale.x,t.y+=(Math.round(r.y)-r.y)/e.scale.y},onTextureLoaded(t,e){t.baseTexture.hasLoaded?e():t.baseTexture.once("loaded",e)},enableTextureMipmap(t,e){t.bindTexture(e,!1,0);const r=e._glTextures[t.CONTEXT_UID];r.enableMipmap(),r.enableLinearScaling()},setSvgResizeHandler(t,e,r){if(r.scaledSvgTextures){const n=()=>{const n=t.app.stage.scale.x*t.options.VIEW_BOX;let i=r.scaledSvgTextures[n];if(!i){const t=Object.keys(r.scaledSvgTextures);i=r.scaledSvgTextures[t[t.length-1]]}this.onTextureLoaded(i,()=>{try{e.texture=i,e._parsedWidth&&e._parsedHeight&&(e.scale.x=e._parsedWidth/i.width,e.scale.y=e._parsedHeight/i.height)}catch(t){}})};t.app.renderer.on("_resized",n),e.on("removed",()=>t.app.renderer.off("_resized",n)),n()}}};r(195);
45
45
  /*!
46
46
  * pixi-filters - v2.0.1
47
47
  * Compiled Tue, 12 Sep 2017 17:14:10 UTC
@@ -56,7 +56,7 @@ if("undefined"==typeof PIXI||void 0===PIXI.filters)throw"PixiJS is required";
56
56
  *
57
57
  * pixi-filters is licensed under the MIT License.
58
58
  * http://www.opensource.org/licenses/mit-license
59
- */var lt="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}",ct="varying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform float pixelSize;\nuniform sampler2D uSampler;\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 pixelate(vec2 coord, vec2 size)\n{\n return floor( coord / size ) * size;\n}\n\nvec2 getMod(vec2 coord, vec2 size)\n{\n return mod( coord , size) / size;\n}\n\nfloat character(float n, vec2 p)\n{\n p = floor(p*vec2(4.0, -4.0) + 2.5);\n if (clamp(p.x, 0.0, 4.0) == p.x && clamp(p.y, 0.0, 4.0) == p.y)\n {\n if (int(mod(n/exp2(p.x + 5.0*p.y), 2.0)) == 1) return 1.0;\n }\n return 0.0;\n}\n\nvoid main()\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n // get the rounded color..\n vec2 pixCoord = pixelate(coord, vec2(pixelSize));\n pixCoord = unmapCoord(pixCoord);\n\n vec4 color = texture2D(uSampler, pixCoord);\n\n // determine the character to use\n float gray = (color.r + color.g + color.b) / 3.0;\n\n float n = 65536.0; // .\n if (gray > 0.2) n = 65600.0; // :\n if (gray > 0.3) n = 332772.0; // *\n if (gray > 0.4) n = 15255086.0; // o\n if (gray > 0.5) n = 23385164.0; // &\n if (gray > 0.6) n = 15252014.0; // 8\n if (gray > 0.7) n = 13199452.0; // @\n if (gray > 0.8) n = 11512810.0; // #\n\n // get the mod..\n vec2 modd = getMod(coord, vec2(pixelSize));\n\n gl_FragColor = color * character( n, vec2(-1.0) + modd * 2.0);\n\n}",ht=function(t){function e(e){void 0===e&&(e=8),t.call(this,lt,ct),this.size=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={size:{}};return r.size.get=function(){return this.uniforms.pixelSize},r.size.set=function(t){this.uniforms.pixelSize=t},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.AsciiFilter=ht;
59
+ */var ct="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}",ht="varying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform float pixelSize;\nuniform sampler2D uSampler;\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 pixelate(vec2 coord, vec2 size)\n{\n return floor( coord / size ) * size;\n}\n\nvec2 getMod(vec2 coord, vec2 size)\n{\n return mod( coord , size) / size;\n}\n\nfloat character(float n, vec2 p)\n{\n p = floor(p*vec2(4.0, -4.0) + 2.5);\n if (clamp(p.x, 0.0, 4.0) == p.x && clamp(p.y, 0.0, 4.0) == p.y)\n {\n if (int(mod(n/exp2(p.x + 5.0*p.y), 2.0)) == 1) return 1.0;\n }\n return 0.0;\n}\n\nvoid main()\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n // get the rounded color..\n vec2 pixCoord = pixelate(coord, vec2(pixelSize));\n pixCoord = unmapCoord(pixCoord);\n\n vec4 color = texture2D(uSampler, pixCoord);\n\n // determine the character to use\n float gray = (color.r + color.g + color.b) / 3.0;\n\n float n = 65536.0; // .\n if (gray > 0.2) n = 65600.0; // :\n if (gray > 0.3) n = 332772.0; // *\n if (gray > 0.4) n = 15255086.0; // o\n if (gray > 0.5) n = 23385164.0; // &\n if (gray > 0.6) n = 15252014.0; // 8\n if (gray > 0.7) n = 13199452.0; // @\n if (gray > 0.8) n = 11512810.0; // #\n\n // get the mod..\n vec2 modd = getMod(coord, vec2(pixelSize));\n\n gl_FragColor = color * character( n, vec2(-1.0) + modd * 2.0);\n\n}",ft=function(t){function e(e){void 0===e&&(e=8),t.call(this,ct,ht),this.size=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={size:{}};return r.size.get=function(){return this.uniforms.pixelSize},r.size.set=function(t){this.uniforms.pixelSize=t},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.AsciiFilter=ft;
60
60
  /*!
61
61
  * @pixi/filter-bloom - v2.0.1
62
62
  * Compiled Tue, 12 Sep 2017 17:13:54 UTC
@@ -64,7 +64,7 @@ if("undefined"==typeof PIXI||void 0===PIXI.filters)throw"PixiJS is required";
64
64
  * pixi-filters is licensed under the MIT License.
65
65
  * http://www.opensource.org/licenses/mit-license
66
66
  */
67
- var ft=PIXI.filters,dt=ft.BlurXFilter,pt=ft.BlurYFilter,_t=ft.VoidFilter,vt=function(t){function e(e){void 0===e&&(e=2),t.call(this),this.blurXFilter=new dt,this.blurYFilter=new pt,this.blurYFilter.blendMode=PIXI.BLEND_MODES.SCREEN,this.defaultFilter=new _t,"number"==typeof e?this.blur=e:e instanceof PIXI.Point&&(this.blurX=e.x,this.blurY=e.y)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={blur:{},blurX:{},blurY:{}};return e.prototype.apply=function(t,e,r){var n=t.getRenderTarget(!0);this.defaultFilter.apply(t,e,r),this.blurXFilter.apply(t,e,n),this.blurYFilter.apply(t,n,r),t.returnRenderTarget(n)},r.blur.get=function(){return this.blurXFilter.blur},r.blur.set=function(t){this.blurXFilter.blur=this.blurYFilter.blur=t},r.blurX.get=function(){return this.blurXFilter.blur},r.blurX.set=function(t){this.blurXFilter.blur=t},r.blurY.get=function(){return this.blurYFilter.blur},r.blurY.set=function(t){this.blurYFilter.blur=t},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.BloomFilter=vt;
67
+ var dt=PIXI.filters,pt=dt.BlurXFilter,_t=dt.BlurYFilter,vt=dt.VoidFilter,gt=function(t){function e(e){void 0===e&&(e=2),t.call(this),this.blurXFilter=new pt,this.blurYFilter=new _t,this.blurYFilter.blendMode=PIXI.BLEND_MODES.SCREEN,this.defaultFilter=new vt,"number"==typeof e?this.blur=e:e instanceof PIXI.Point&&(this.blurX=e.x,this.blurY=e.y)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={blur:{},blurX:{},blurY:{}};return e.prototype.apply=function(t,e,r){var n=t.getRenderTarget(!0);this.defaultFilter.apply(t,e,r),this.blurXFilter.apply(t,e,n),this.blurYFilter.apply(t,n,r),t.returnRenderTarget(n)},r.blur.get=function(){return this.blurXFilter.blur},r.blur.set=function(t){this.blurXFilter.blur=this.blurYFilter.blur=t},r.blurX.get=function(){return this.blurXFilter.blur},r.blurX.set=function(t){this.blurXFilter.blur=t},r.blurY.get=function(){return this.blurYFilter.blur},r.blurY.set=function(t){this.blurYFilter.blur=t},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.BloomFilter=gt;
68
68
  /*!
69
69
  * @pixi/filter-bulge-pinch - v2.0.1
70
70
  * Compiled Tue, 12 Sep 2017 17:13:54 UTC
@@ -72,7 +72,7 @@ var ft=PIXI.filters,dt=ft.BlurXFilter,pt=ft.BlurYFilter,_t=ft.VoidFilter,vt=func
72
72
  * pixi-filters is licensed under the MIT License.
73
73
  * http://www.opensource.org/licenses/mit-license
74
74
  */
75
- var gt="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n",yt="uniform float radius;\nuniform float strength;\nuniform vec2 center;\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nvoid main()\n{\n vec2 coord = vTextureCoord * filterArea.xy;\n coord -= center * dimensions.xy;\n float distance = length(coord);\n if (distance < radius) {\n float percent = distance / radius;\n if (strength > 0.0) {\n coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75);\n } else {\n coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent);\n }\n }\n coord += center * dimensions.xy;\n coord /= filterArea.xy;\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n gl_FragColor = texture2D(uSampler, clampedCoord);\n if (coord != clampedCoord) {\n gl_FragColor *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n}\n",mt=function(t){function e(e,r,n){t.call(this,gt,yt),this.center=e||[.5,.5],this.radius=r||100,this.strength=n||1}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={radius:{},strength:{},center:{}};return e.prototype.apply=function(t,e,r){this.uniforms.dimensions[0]=e.sourceFrame.width,this.uniforms.dimensions[1]=e.sourceFrame.height,t.applyFilter(this,e,r)},r.radius.get=function(){return this.uniforms.radius},r.radius.set=function(t){this.uniforms.radius=t},r.strength.get=function(){return this.uniforms.strength},r.strength.set=function(t){this.uniforms.strength=t},r.center.get=function(){return this.uniforms.center},r.center.set=function(t){this.uniforms.center=t},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.BulgePinchFilter=mt;
75
+ var yt="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n",mt="uniform float radius;\nuniform float strength;\nuniform vec2 center;\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nvoid main()\n{\n vec2 coord = vTextureCoord * filterArea.xy;\n coord -= center * dimensions.xy;\n float distance = length(coord);\n if (distance < radius) {\n float percent = distance / radius;\n if (strength > 0.0) {\n coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75);\n } else {\n coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent);\n }\n }\n coord += center * dimensions.xy;\n coord /= filterArea.xy;\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n gl_FragColor = texture2D(uSampler, clampedCoord);\n if (coord != clampedCoord) {\n gl_FragColor *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n}\n",Et=function(t){function e(e,r,n){t.call(this,yt,mt),this.center=e||[.5,.5],this.radius=r||100,this.strength=n||1}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={radius:{},strength:{},center:{}};return e.prototype.apply=function(t,e,r){this.uniforms.dimensions[0]=e.sourceFrame.width,this.uniforms.dimensions[1]=e.sourceFrame.height,t.applyFilter(this,e,r)},r.radius.get=function(){return this.uniforms.radius},r.radius.set=function(t){this.uniforms.radius=t},r.strength.get=function(){return this.uniforms.strength},r.strength.set=function(t){this.uniforms.strength=t},r.center.get=function(){return this.uniforms.center},r.center.set=function(t){this.uniforms.center=t},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.BulgePinchFilter=Et;
76
76
  /*!
77
77
  * @pixi/filter-color-replace - v2.0.1
78
78
  * Compiled Tue, 12 Sep 2017 17:13:54 UTC
@@ -80,7 +80,7 @@ var gt="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nunifor
80
80
  * pixi-filters is licensed under the MIT License.
81
81
  * http://www.opensource.org/licenses/mit-license
82
82
  */
83
- var Et="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n",xt="varying vec2 vTextureCoord;\nuniform sampler2D texture;\nuniform vec3 originalColor;\nuniform vec3 newColor;\nuniform float epsilon;\nvoid main(void) {\n vec4 currentColor = texture2D(texture, vTextureCoord);\n vec3 colorDiff = originalColor - (currentColor.rgb / max(currentColor.a, 0.0000000001));\n float colorDistance = length(colorDiff);\n float doReplace = step(colorDistance, epsilon);\n gl_FragColor = vec4(mix(currentColor.rgb, (newColor + colorDiff) * currentColor.a, doReplace), currentColor.a);\n}\n",bt=function(t){function e(e,r,n){void 0===e&&(e=16711680),void 0===r&&(r=0),void 0===n&&(n=.4),t.call(this,Et,xt),this.originalColor=e,this.newColor=r,this.epsilon=n}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={originalColor:{},newColor:{},epsilon:{}};return r.originalColor.set=function(t){var e=this.uniforms.originalColor;"number"==typeof t?(PIXI.utils.hex2rgb(t,e),this._originalColor=t):(e[0]=t[0],e[1]=t[1],e[2]=t[2],this._originalColor=PIXI.utils.rgb2hex(e))},r.originalColor.get=function(){return this._originalColor},r.newColor.set=function(t){var e=this.uniforms.newColor;"number"==typeof t?(PIXI.utils.hex2rgb(t,e),this._newColor=t):(e[0]=t[0],e[1]=t[1],e[2]=t[2],this._newColor=PIXI.utils.rgb2hex(e))},r.newColor.get=function(){return this._newColor},r.epsilon.set=function(t){this.uniforms.epsilon=t},r.epsilon.get=function(){return this.uniforms.epsilon},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.ColorReplaceFilter=bt;
83
+ var xt="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n",bt="varying vec2 vTextureCoord;\nuniform sampler2D texture;\nuniform vec3 originalColor;\nuniform vec3 newColor;\nuniform float epsilon;\nvoid main(void) {\n vec4 currentColor = texture2D(texture, vTextureCoord);\n vec3 colorDiff = originalColor - (currentColor.rgb / max(currentColor.a, 0.0000000001));\n float colorDistance = length(colorDiff);\n float doReplace = step(colorDistance, epsilon);\n gl_FragColor = vec4(mix(currentColor.rgb, (newColor + colorDiff) * currentColor.a, doReplace), currentColor.a);\n}\n",Tt=function(t){function e(e,r,n){void 0===e&&(e=16711680),void 0===r&&(r=0),void 0===n&&(n=.4),t.call(this,xt,bt),this.originalColor=e,this.newColor=r,this.epsilon=n}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={originalColor:{},newColor:{},epsilon:{}};return r.originalColor.set=function(t){var e=this.uniforms.originalColor;"number"==typeof t?(PIXI.utils.hex2rgb(t,e),this._originalColor=t):(e[0]=t[0],e[1]=t[1],e[2]=t[2],this._originalColor=PIXI.utils.rgb2hex(e))},r.originalColor.get=function(){return this._originalColor},r.newColor.set=function(t){var e=this.uniforms.newColor;"number"==typeof t?(PIXI.utils.hex2rgb(t,e),this._newColor=t):(e[0]=t[0],e[1]=t[1],e[2]=t[2],this._newColor=PIXI.utils.rgb2hex(e))},r.newColor.get=function(){return this._newColor},r.epsilon.set=function(t){this.uniforms.epsilon=t},r.epsilon.get=function(){return this.uniforms.epsilon},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.ColorReplaceFilter=Tt;
84
84
  /*!
85
85
  * @pixi/filter-convolution - v2.0.1
86
86
  * Compiled Tue, 12 Sep 2017 17:13:57 UTC
@@ -88,7 +88,7 @@ var Et="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nunifor
88
88
  * pixi-filters is licensed under the MIT License.
89
89
  * http://www.opensource.org/licenses/mit-license
90
90
  */
91
- var Tt="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}",Rt="precision mediump float;\n\nvarying mediump vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec2 texelSize;\nuniform float matrix[9];\n\nvoid main(void)\n{\n vec4 c11 = texture2D(uSampler, vTextureCoord - texelSize); // top left\n vec4 c12 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - texelSize.y)); // top center\n vec4 c13 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y - texelSize.y)); // top right\n\n vec4 c21 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y)); // mid left\n vec4 c22 = texture2D(uSampler, vTextureCoord); // mid center\n vec4 c23 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y)); // mid right\n\n vec4 c31 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y + texelSize.y)); // bottom left\n vec4 c32 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + texelSize.y)); // bottom center\n vec4 c33 = texture2D(uSampler, vTextureCoord + texelSize); // bottom right\n\n gl_FragColor =\n c11 * matrix[0] + c12 * matrix[1] + c13 * matrix[2] +\n c21 * matrix[3] + c22 * matrix[4] + c23 * matrix[5] +\n c31 * matrix[6] + c32 * matrix[7] + c33 * matrix[8];\n\n gl_FragColor.a = c22.a;\n}\n",Ot=function(t){function e(e,r,n){t.call(this,Tt,Rt),this.matrix=e,this.width=r,this.height=n}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={matrix:{},width:{},height:{}};return r.matrix.get=function(){return this.uniforms.matrix},r.matrix.set=function(t){this.uniforms.matrix=new Float32Array(t)},r.width.get=function(){return 1/this.uniforms.texelSize[0]},r.width.set=function(t){this.uniforms.texelSize[0]=1/t},r.height.get=function(){return 1/this.uniforms.texelSize[1]},r.height.set=function(t){this.uniforms.texelSize[1]=1/t},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.ConvolutionFilter=Ot;
91
+ var Rt="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}",Ot="precision mediump float;\n\nvarying mediump vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec2 texelSize;\nuniform float matrix[9];\n\nvoid main(void)\n{\n vec4 c11 = texture2D(uSampler, vTextureCoord - texelSize); // top left\n vec4 c12 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - texelSize.y)); // top center\n vec4 c13 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y - texelSize.y)); // top right\n\n vec4 c21 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y)); // mid left\n vec4 c22 = texture2D(uSampler, vTextureCoord); // mid center\n vec4 c23 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y)); // mid right\n\n vec4 c31 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y + texelSize.y)); // bottom left\n vec4 c32 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + texelSize.y)); // bottom center\n vec4 c33 = texture2D(uSampler, vTextureCoord + texelSize); // bottom right\n\n gl_FragColor =\n c11 * matrix[0] + c12 * matrix[1] + c13 * matrix[2] +\n c21 * matrix[3] + c22 * matrix[4] + c23 * matrix[5] +\n c31 * matrix[6] + c32 * matrix[7] + c33 * matrix[8];\n\n gl_FragColor.a = c22.a;\n}\n",St=function(t){function e(e,r,n){t.call(this,Rt,Ot),this.matrix=e,this.width=r,this.height=n}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={matrix:{},width:{},height:{}};return r.matrix.get=function(){return this.uniforms.matrix},r.matrix.set=function(t){this.uniforms.matrix=new Float32Array(t)},r.width.get=function(){return 1/this.uniforms.texelSize[0]},r.width.set=function(t){this.uniforms.texelSize[0]=1/t},r.height.get=function(){return 1/this.uniforms.texelSize[1]},r.height.set=function(t){this.uniforms.texelSize[1]=1/t},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.ConvolutionFilter=St;
92
92
  /*!
93
93
  * @pixi/filter-cross-hatch - v2.0.1
94
94
  * Compiled Tue, 12 Sep 2017 17:13:57 UTC
@@ -96,7 +96,7 @@ var Tt="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nunifor
96
96
  * pixi-filters is licensed under the MIT License.
97
97
  * http://www.opensource.org/licenses/mit-license
98
98
  */
99
- var St="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}",wt="precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n float lum = length(texture2D(uSampler, vTextureCoord.xy).rgb);\n\n gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);\n\n if (lum < 1.00)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.75)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.50)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.3)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n}\n",Ct=function(t){function e(){t.call(this,St,wt)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(PIXI.Filter);PIXI.filters.CrossHatchFilter=Ct;
99
+ var wt="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}",Ct="precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n float lum = length(texture2D(uSampler, vTextureCoord.xy).rgb);\n\n gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);\n\n if (lum < 1.00)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.75)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.50)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.3)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n}\n",At=function(t){function e(){t.call(this,wt,Ct)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(PIXI.Filter);PIXI.filters.CrossHatchFilter=At;
100
100
  /*!
101
101
  * @pixi/filter-dot - v2.0.1
102
102
  * Compiled Tue, 12 Sep 2017 17:13:57 UTC
@@ -104,7 +104,7 @@ var St="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nunifor
104
104
  * pixi-filters is licensed under the MIT License.
105
105
  * http://www.opensource.org/licenses/mit-license
106
106
  */
107
- var At="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}",It="precision mediump float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform vec4 filterArea;\nuniform sampler2D uSampler;\n\nuniform float angle;\nuniform float scale;\n\nfloat pattern()\n{\n float s = sin(angle), c = cos(angle);\n vec2 tex = vTextureCoord * filterArea.xy;\n vec2 point = vec2(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float average = (color.r + color.g + color.b) / 3.0;\n gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);\n}\n",Pt=function(t){function e(e,r){void 0===e&&(e=1),void 0===r&&(r=5),t.call(this,At,It),this.scale=e,this.angle=r}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={scale:{},angle:{}};return r.scale.get=function(){return this.uniforms.scale},r.scale.set=function(t){this.uniforms.scale=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.DotFilter=Pt;
107
+ var It="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}",Pt="precision mediump float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform vec4 filterArea;\nuniform sampler2D uSampler;\n\nuniform float angle;\nuniform float scale;\n\nfloat pattern()\n{\n float s = sin(angle), c = cos(angle);\n vec2 tex = vTextureCoord * filterArea.xy;\n vec2 point = vec2(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float average = (color.r + color.g + color.b) / 3.0;\n gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);\n}\n",Mt=function(t){function e(e,r){void 0===e&&(e=1),void 0===r&&(r=5),t.call(this,It,Pt),this.scale=e,this.angle=r}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={scale:{},angle:{}};return r.scale.get=function(){return this.uniforms.scale},r.scale.set=function(t){this.uniforms.scale=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.DotFilter=Mt;
108
108
  /*!
109
109
  * @pixi/filter-drop-shadow - v2.0.1
110
110
  * Compiled Tue, 12 Sep 2017 17:13:57 UTC
@@ -112,7 +112,7 @@ var At="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nunifor
112
112
  * pixi-filters is licensed under the MIT License.
113
113
  * http://www.opensource.org/licenses/mit-license
114
114
  */
115
- var Mt="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}",Dt="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float alpha;\nuniform vec3 color;\nvoid main(void){\n vec4 sample = texture2D(uSampler, vTextureCoord);\n\n // Un-premultiply alpha before applying the color\n if (sample.a > 0.0) {\n sample.rgb /= sample.a;\n }\n\n // Premultiply alpha again\n sample.rgb = color.rgb * sample.a;\n\n // alpha user alpha\n sample *= alpha;\n\n gl_FragColor = sample;\n}",Lt=function(t){function e(e,r,n,i,o){void 0===e&&(e=45),void 0===r&&(r=5),void 0===n&&(n=2),void 0===i&&(i=0),void 0===o&&(o=.5),t.call(this),this.tintFilter=new PIXI.Filter(Mt,Dt),this.blurFilter=new PIXI.filters.BlurFilter,this.blurFilter.blur=n,this.rotation=e,this.padding=r,this.distance=r,this.alpha=o,this.color=i}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={distance:{},rotation:{},blur:{},alpha:{},color:{}};return e.prototype.apply=function(e,r,n){var i=e.getRenderTarget();i.transform=new PIXI.Matrix,i.transform.translate(this.distance*Math.cos(this.angle),this.distance*Math.sin(this.angle)),this.tintFilter.apply(e,r,i,!0),this.blurFilter.apply(e,i,n),t.prototype.apply.call(this,e,r,n),i.transform=null,e.returnRenderTarget(i)},e.prototype.updatePadding=function(){this.padding=this.distance+2*this.blur},r.distance.get=function(){return this._distance},r.distance.set=function(t){this._distance=t,this.updatePadding()},r.rotation.get=function(){return this.angle/PIXI.DEG_TO_RAD},r.rotation.set=function(t){this.angle=t*PIXI.DEG_TO_RAD},r.blur.get=function(){return this.blurFilter.blur},r.blur.set=function(t){this.blurFilter.blur=t,this.updatePadding()},r.alpha.get=function(){return this.tintFilter.uniforms.alpha},r.alpha.set=function(t){this.tintFilter.uniforms.alpha=t},r.color.get=function(){return PIXI.utils.rgb2hex(this.tintFilter.uniforms.color)},r.color.set=function(t){PIXI.utils.hex2rgb(t,this.tintFilter.uniforms.color)},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.DropShadowFilter=Lt;
115
+ var Dt="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}",Lt="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float alpha;\nuniform vec3 color;\nvoid main(void){\n vec4 sample = texture2D(uSampler, vTextureCoord);\n\n // Un-premultiply alpha before applying the color\n if (sample.a > 0.0) {\n sample.rgb /= sample.a;\n }\n\n // Premultiply alpha again\n sample.rgb = color.rgb * sample.a;\n\n // alpha user alpha\n sample *= alpha;\n\n gl_FragColor = sample;\n}",Ut=function(t){function e(e,r,n,i,o){void 0===e&&(e=45),void 0===r&&(r=5),void 0===n&&(n=2),void 0===i&&(i=0),void 0===o&&(o=.5),t.call(this),this.tintFilter=new PIXI.Filter(Dt,Lt),this.blurFilter=new PIXI.filters.BlurFilter,this.blurFilter.blur=n,this.rotation=e,this.padding=r,this.distance=r,this.alpha=o,this.color=i}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={distance:{},rotation:{},blur:{},alpha:{},color:{}};return e.prototype.apply=function(e,r,n){var i=e.getRenderTarget();i.transform=new PIXI.Matrix,i.transform.translate(this.distance*Math.cos(this.angle),this.distance*Math.sin(this.angle)),this.tintFilter.apply(e,r,i,!0),this.blurFilter.apply(e,i,n),t.prototype.apply.call(this,e,r,n),i.transform=null,e.returnRenderTarget(i)},e.prototype.updatePadding=function(){this.padding=this.distance+2*this.blur},r.distance.get=function(){return this._distance},r.distance.set=function(t){this._distance=t,this.updatePadding()},r.rotation.get=function(){return this.angle/PIXI.DEG_TO_RAD},r.rotation.set=function(t){this.angle=t*PIXI.DEG_TO_RAD},r.blur.get=function(){return this.blurFilter.blur},r.blur.set=function(t){this.blurFilter.blur=t,this.updatePadding()},r.alpha.get=function(){return this.tintFilter.uniforms.alpha},r.alpha.set=function(t){this.tintFilter.uniforms.alpha=t},r.color.get=function(){return PIXI.utils.rgb2hex(this.tintFilter.uniforms.color)},r.color.set=function(t){PIXI.utils.hex2rgb(t,this.tintFilter.uniforms.color)},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.DropShadowFilter=Ut;
116
116
  /*!
117
117
  * @pixi/filter-emboss - v2.0.1
118
118
  * Compiled Tue, 12 Sep 2017 17:14:01 UTC
@@ -120,7 +120,7 @@ var Mt="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nunifor
120
120
  * pixi-filters is licensed under the MIT License.
121
121
  * http://www.opensource.org/licenses/mit-license
122
122
  */
123
- var Ut="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}",Nt="precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float strength;\nuniform vec4 filterArea;\n\n\nvoid main(void)\n{\n\tvec2 onePixel = vec2(1.0 / filterArea);\n\n\tvec4 color;\n\n\tcolor.rgb = vec3(0.5);\n\n\tcolor -= texture2D(uSampler, vTextureCoord - onePixel) * strength;\n\tcolor += texture2D(uSampler, vTextureCoord + onePixel) * strength;\n\n\tcolor.rgb = vec3((color.r + color.g + color.b) / 3.0);\n\n\tfloat alpha = texture2D(uSampler, vTextureCoord).a;\n\n\tgl_FragColor = vec4(color.rgb * alpha, alpha);\n}\n",Ft=function(t){function e(e){void 0===e&&(e=5),t.call(this,Ut,Nt),this.strength=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={strength:{}};return r.strength.get=function(){return this.uniforms.strength},r.strength.set=function(t){this.uniforms.strength=t},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.EmbossFilter=Ft;
123
+ var Nt="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}",Ft="precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float strength;\nuniform vec4 filterArea;\n\n\nvoid main(void)\n{\n\tvec2 onePixel = vec2(1.0 / filterArea);\n\n\tvec4 color;\n\n\tcolor.rgb = vec3(0.5);\n\n\tcolor -= texture2D(uSampler, vTextureCoord - onePixel) * strength;\n\tcolor += texture2D(uSampler, vTextureCoord + onePixel) * strength;\n\n\tcolor.rgb = vec3((color.r + color.g + color.b) / 3.0);\n\n\tfloat alpha = texture2D(uSampler, vTextureCoord).a;\n\n\tgl_FragColor = vec4(color.rgb * alpha, alpha);\n}\n",jt=function(t){function e(e){void 0===e&&(e=5),t.call(this,Nt,Ft),this.strength=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={strength:{}};return r.strength.get=function(){return this.uniforms.strength},r.strength.set=function(t){this.uniforms.strength=t},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.EmbossFilter=jt;
124
124
  /*!
125
125
  * @pixi/filter-glow - v2.0.1
126
126
  * Compiled Tue, 12 Sep 2017 17:14:01 UTC
@@ -128,7 +128,7 @@ var Ut="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nunifor
128
128
  * pixi-filters is licensed under the MIT License.
129
129
  * http://www.opensource.org/licenses/mit-license
130
130
  */
131
- var jt="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n",kt="varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nuniform float distance;\nuniform float outerStrength;\nuniform float innerStrength;\nuniform vec4 glowColor;\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nvec2 px = vec2(1.0 / filterArea.x, 1.0 / filterArea.y);\n\nvoid main(void) {\n const float PI = 3.14159265358979323846264;\n vec4 ownColor = texture2D(uSampler, vTextureCoord);\n vec4 curColor;\n float totalAlpha = 0.0;\n float maxTotalAlpha = 0.0;\n float cosAngle;\n float sinAngle;\n vec2 displaced;\n for (float angle = 0.0; angle <= PI * 2.0; angle += %QUALITY_DIST%) {\n cosAngle = cos(angle);\n sinAngle = sin(angle);\n for (float curDistance = 1.0; curDistance <= %DIST%; curDistance++) {\n displaced.x = vTextureCoord.x + cosAngle * curDistance * px.x;\n displaced.y = vTextureCoord.y + sinAngle * curDistance * px.y;\n curColor = texture2D(uSampler, clamp(displaced, filterClamp.xy, filterClamp.zw));\n totalAlpha += (distance - curDistance) * curColor.a;\n maxTotalAlpha += (distance - curDistance);\n }\n }\n maxTotalAlpha = max(maxTotalAlpha, 0.0001);\n\n ownColor.a = max(ownColor.a, 0.0001);\n ownColor.rgb = ownColor.rgb / ownColor.a;\n float outerGlowAlpha = (totalAlpha / maxTotalAlpha) * outerStrength * (1. - ownColor.a);\n float innerGlowAlpha = ((maxTotalAlpha - totalAlpha) / maxTotalAlpha) * innerStrength * ownColor.a;\n float resultAlpha = (ownColor.a + outerGlowAlpha);\n gl_FragColor = vec4(mix(mix(ownColor.rgb, glowColor.rgb, innerGlowAlpha / ownColor.a), glowColor.rgb, outerGlowAlpha / resultAlpha) * resultAlpha, resultAlpha);\n}\n",Bt=function(t){function e(e,r,n,i,o){void 0===e&&(e=10),void 0===r&&(r=4),void 0===n&&(n=0),void 0===i&&(i=16777215),void 0===o&&(o=.1),t.call(this,jt,kt.replace(/%QUALITY_DIST%/gi,""+(1/o/e).toFixed(7)).replace(/%DIST%/gi,""+e.toFixed(7))),this.uniforms.glowColor=new Float32Array([0,0,0,1]),this.distance=e,this.color=i,this.outerStrength=r,this.innerStrength=n}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={color:{},distance:{},outerStrength:{},innerStrength:{}};return r.color.get=function(){return PIXI.utils.rgb2hex(this.uniforms.glowColor)},r.color.set=function(t){PIXI.utils.hex2rgb(t,this.uniforms.glowColor)},r.distance.get=function(){return this.uniforms.distance},r.distance.set=function(t){this.uniforms.distance=t},r.outerStrength.get=function(){return this.uniforms.outerStrength},r.outerStrength.set=function(t){this.uniforms.outerStrength=t},r.innerStrength.get=function(){return this.uniforms.innerStrength},r.innerStrength.set=function(t){this.uniforms.innerStrength=t},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.GlowFilter=Bt;
131
+ var kt="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n",Bt="varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nuniform float distance;\nuniform float outerStrength;\nuniform float innerStrength;\nuniform vec4 glowColor;\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nvec2 px = vec2(1.0 / filterArea.x, 1.0 / filterArea.y);\n\nvoid main(void) {\n const float PI = 3.14159265358979323846264;\n vec4 ownColor = texture2D(uSampler, vTextureCoord);\n vec4 curColor;\n float totalAlpha = 0.0;\n float maxTotalAlpha = 0.0;\n float cosAngle;\n float sinAngle;\n vec2 displaced;\n for (float angle = 0.0; angle <= PI * 2.0; angle += %QUALITY_DIST%) {\n cosAngle = cos(angle);\n sinAngle = sin(angle);\n for (float curDistance = 1.0; curDistance <= %DIST%; curDistance++) {\n displaced.x = vTextureCoord.x + cosAngle * curDistance * px.x;\n displaced.y = vTextureCoord.y + sinAngle * curDistance * px.y;\n curColor = texture2D(uSampler, clamp(displaced, filterClamp.xy, filterClamp.zw));\n totalAlpha += (distance - curDistance) * curColor.a;\n maxTotalAlpha += (distance - curDistance);\n }\n }\n maxTotalAlpha = max(maxTotalAlpha, 0.0001);\n\n ownColor.a = max(ownColor.a, 0.0001);\n ownColor.rgb = ownColor.rgb / ownColor.a;\n float outerGlowAlpha = (totalAlpha / maxTotalAlpha) * outerStrength * (1. - ownColor.a);\n float innerGlowAlpha = ((maxTotalAlpha - totalAlpha) / maxTotalAlpha) * innerStrength * ownColor.a;\n float resultAlpha = (ownColor.a + outerGlowAlpha);\n gl_FragColor = vec4(mix(mix(ownColor.rgb, glowColor.rgb, innerGlowAlpha / ownColor.a), glowColor.rgb, outerGlowAlpha / resultAlpha) * resultAlpha, resultAlpha);\n}\n",Ht=function(t){function e(e,r,n,i,o){void 0===e&&(e=10),void 0===r&&(r=4),void 0===n&&(n=0),void 0===i&&(i=16777215),void 0===o&&(o=.1),t.call(this,kt,Bt.replace(/%QUALITY_DIST%/gi,""+(1/o/e).toFixed(7)).replace(/%DIST%/gi,""+e.toFixed(7))),this.uniforms.glowColor=new Float32Array([0,0,0,1]),this.distance=e,this.color=i,this.outerStrength=r,this.innerStrength=n}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={color:{},distance:{},outerStrength:{},innerStrength:{}};return r.color.get=function(){return PIXI.utils.rgb2hex(this.uniforms.glowColor)},r.color.set=function(t){PIXI.utils.hex2rgb(t,this.uniforms.glowColor)},r.distance.get=function(){return this.uniforms.distance},r.distance.set=function(t){this.uniforms.distance=t},r.outerStrength.get=function(){return this.uniforms.outerStrength},r.outerStrength.set=function(t){this.uniforms.outerStrength=t},r.innerStrength.get=function(){return this.uniforms.innerStrength},r.innerStrength.set=function(t){this.uniforms.innerStrength=t},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.GlowFilter=Ht;
132
132
  /*!
133
133
  * @pixi/filter-outline - v2.0.1
134
134
  * Compiled Tue, 12 Sep 2017 17:14:01 UTC
@@ -136,7 +136,7 @@ var jt="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nunifor
136
136
  * pixi-filters is licensed under the MIT License.
137
137
  * http://www.opensource.org/licenses/mit-license
138
138
  */
139
- var Ht="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n",Xt="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform float thickness;\nuniform vec4 outlineColor;\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nvec2 px = vec2(1.0 / filterArea.x, 1.0 / filterArea.y);\n\nvoid main(void) {\n const float PI = 3.14159265358979323846264;\n vec4 ownColor = texture2D(uSampler, vTextureCoord);\n vec4 curColor;\n float maxAlpha = 0.;\n vec2 displaced;\n for (float angle = 0.; angle < PI * 2.; angle += %THICKNESS% ) {\n displaced.x = vTextureCoord.x + thickness * px.x * cos(angle);\n displaced.y = vTextureCoord.y + thickness * px.y * sin(angle);\n curColor = texture2D(uSampler, clamp(displaced, filterClamp.xy, filterClamp.zw));\n maxAlpha = max(maxAlpha, curColor.a);\n }\n float resultAlpha = max(maxAlpha, ownColor.a);\n gl_FragColor = vec4((ownColor.rgb + outlineColor.rgb * (1. - ownColor.a)) * resultAlpha, resultAlpha);\n}\n",Wt=function(t){function e(e,r){void 0===e&&(e=1),void 0===r&&(r=0),t.call(this,Ht,Xt.replace(/%THICKNESS%/gi,(1/e).toFixed(7))),this.thickness=e,this.uniforms.outlineColor=new Float32Array([0,0,0,1]),this.color=r}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={color:{},thickness:{}};return r.color.get=function(){return PIXI.utils.rgb2hex(this.uniforms.outlineColor)},r.color.set=function(t){PIXI.utils.hex2rgb(t,this.uniforms.outlineColor)},r.thickness.get=function(){return this.uniforms.thickness},r.thickness.set=function(t){this.uniforms.thickness=t},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.OutlineFilter=Wt;
139
+ var Xt="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n",Wt="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform float thickness;\nuniform vec4 outlineColor;\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nvec2 px = vec2(1.0 / filterArea.x, 1.0 / filterArea.y);\n\nvoid main(void) {\n const float PI = 3.14159265358979323846264;\n vec4 ownColor = texture2D(uSampler, vTextureCoord);\n vec4 curColor;\n float maxAlpha = 0.;\n vec2 displaced;\n for (float angle = 0.; angle < PI * 2.; angle += %THICKNESS% ) {\n displaced.x = vTextureCoord.x + thickness * px.x * cos(angle);\n displaced.y = vTextureCoord.y + thickness * px.y * sin(angle);\n curColor = texture2D(uSampler, clamp(displaced, filterClamp.xy, filterClamp.zw));\n maxAlpha = max(maxAlpha, curColor.a);\n }\n float resultAlpha = max(maxAlpha, ownColor.a);\n gl_FragColor = vec4((ownColor.rgb + outlineColor.rgb * (1. - ownColor.a)) * resultAlpha, resultAlpha);\n}\n",Gt=function(t){function e(e,r){void 0===e&&(e=1),void 0===r&&(r=0),t.call(this,Xt,Wt.replace(/%THICKNESS%/gi,(1/e).toFixed(7))),this.thickness=e,this.uniforms.outlineColor=new Float32Array([0,0,0,1]),this.color=r}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={color:{},thickness:{}};return r.color.get=function(){return PIXI.utils.rgb2hex(this.uniforms.outlineColor)},r.color.set=function(t){PIXI.utils.hex2rgb(t,this.uniforms.outlineColor)},r.thickness.get=function(){return this.uniforms.thickness},r.thickness.set=function(t){this.uniforms.thickness=t},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.OutlineFilter=Gt;
140
140
  /*!
141
141
  * @pixi/filter-pixelate - v2.0.1
142
142
  * Compiled Tue, 12 Sep 2017 17:14:01 UTC
@@ -144,7 +144,7 @@ var Ht="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nunifor
144
144
  * pixi-filters is licensed under the MIT License.
145
145
  * http://www.opensource.org/licenses/mit-license
146
146
  */
147
- var Gt="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}",Yt="precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform vec2 size;\nuniform sampler2D uSampler;\n\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 pixelate(vec2 coord, vec2 size)\n{\n\treturn floor( coord / size ) * size;\n}\n\nvoid main(void)\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n coord = pixelate(coord, size);\n\n coord = unmapCoord(coord);\n\n gl_FragColor = texture2D(uSampler, coord);\n}\n",zt=function(t){function e(e){void 0===e&&(e=10),t.call(this,Gt,Yt),this.size=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={size:{}};return r.size.get=function(){return this.uniforms.size},r.size.set=function(t){"number"==typeof t&&(t=[t,t]),this.uniforms.size=t},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.PixelateFilter=zt;
147
+ var Yt="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}",zt="precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform vec2 size;\nuniform sampler2D uSampler;\n\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 pixelate(vec2 coord, vec2 size)\n{\n\treturn floor( coord / size ) * size;\n}\n\nvoid main(void)\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n coord = pixelate(coord, size);\n\n coord = unmapCoord(coord);\n\n gl_FragColor = texture2D(uSampler, coord);\n}\n",Vt=function(t){function e(e){void 0===e&&(e=10),t.call(this,Yt,zt),this.size=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={size:{}};return r.size.get=function(){return this.uniforms.size},r.size.set=function(t){"number"==typeof t&&(t=[t,t]),this.uniforms.size=t},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.PixelateFilter=Vt;
148
148
  /*!
149
149
  * @pixi/filter-rgb-split - v2.0.1
150
150
  * Compiled Tue, 12 Sep 2017 17:14:04 UTC
@@ -152,7 +152,7 @@ var Gt="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nunifor
152
152
  * pixi-filters is licensed under the MIT License.
153
153
  * http://www.opensource.org/licenses/mit-license
154
154
  */
155
- var Vt="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}",Kt="precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nvoid main(void)\n{\n gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/filterArea.xy).r;\n gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/filterArea.xy).g;\n gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/filterArea.xy).b;\n gl_FragColor.a = texture2D(uSampler, vTextureCoord).a;\n}\n",qt=function(t){function e(e,r,n){void 0===e&&(e=[-10,0]),void 0===r&&(r=[0,10]),void 0===n&&(n=[0,0]),t.call(this,Vt,Kt),this.red=e,this.green=r,this.blue=n}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={red:{},green:{},blue:{}};return r.red.get=function(){return this.uniforms.red},r.red.set=function(t){this.uniforms.red=t},r.green.get=function(){return this.uniforms.green},r.green.set=function(t){this.uniforms.green=t},r.blue.get=function(){return this.uniforms.blue},r.blue.set=function(t){this.uniforms.blue=t},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.RGBSplitFilter=qt;
155
+ var Kt="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}",qt="precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nvoid main(void)\n{\n gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/filterArea.xy).r;\n gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/filterArea.xy).g;\n gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/filterArea.xy).b;\n gl_FragColor.a = texture2D(uSampler, vTextureCoord).a;\n}\n",Zt=function(t){function e(e,r,n){void 0===e&&(e=[-10,0]),void 0===r&&(r=[0,10]),void 0===n&&(n=[0,0]),t.call(this,Kt,qt),this.red=e,this.green=r,this.blue=n}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={red:{},green:{},blue:{}};return r.red.get=function(){return this.uniforms.red},r.red.set=function(t){this.uniforms.red=t},r.green.get=function(){return this.uniforms.green},r.green.set=function(t){this.uniforms.green=t},r.blue.get=function(){return this.uniforms.blue},r.blue.set=function(t){this.uniforms.blue=t},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.RGBSplitFilter=Zt;
156
156
  /*!
157
157
  * @pixi/filter-shockwave - v2.0.1
158
158
  * Compiled Tue, 12 Sep 2017 17:14:04 UTC
@@ -160,7 +160,7 @@ var Vt="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nunifor
160
160
  * pixi-filters is licensed under the MIT License.
161
161
  * http://www.opensource.org/licenses/mit-license
162
162
  */
163
- var Zt="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}",$t="varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nuniform vec2 center;\nuniform vec3 params; // 10.0, 0.8, 0.1\nuniform float time;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nvoid main()\n{\n vec2 uv = vTextureCoord * filterArea.xy / dimensions.xy;\n vec2 coord = uv;\n\n float dist = distance(coord, center);\n\n if ( (dist <= (time + params.z)) && (dist >= (time - params.z)) )\n {\n float diff = (dist - time);\n float powDiff = 1.0 - pow(abs(diff*params.x), params.y);\n\n float diffTime = diff * powDiff;\n vec2 diffUV = normalize(uv - center);\n coord = uv + (diffUV * diffTime);\n }\n\n coord *= dimensions.xy / filterArea.xy;\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n gl_FragColor = texture2D(uSampler, clampedCoord);\n if (coord != clampedCoord) {\n gl_FragColor *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n}\n",Jt=function(t){function e(e,r,n){void 0===e&&(e=[.5,.5]),void 0===r&&(r=[10,.8,.1]),void 0===n&&(n=0),t.call(this,Zt,$t,{center:{type:"v2",value:{x:.5,y:.5}},params:{type:"v3",value:{x:10,y:.8,z:.1}},time:{type:"1f",value:0},dimensions:{type:"2f",value:[0,0]}}),this.center=e,this.params=r,this.time=n}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={center:{},params:{},time:{}};return e.prototype.apply=function(t,e,r){this.uniforms.dimensions[0]=e.sourceFrame.width,this.uniforms.dimensions[1]=e.sourceFrame.height,t.applyFilter(this,e,r)},r.center.get=function(){return this.uniforms.center},r.center.set=function(t){this.uniforms.center=t},r.params.get=function(){return this.uniforms.params},r.params.set=function(t){this.uniforms.params=t},r.time.get=function(){return this.uniforms.time},r.time.set=function(t){this.uniforms.time=t},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.ShockwaveFilter=Jt;
163
+ var $t="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}",Jt="varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nuniform vec2 center;\nuniform vec3 params; // 10.0, 0.8, 0.1\nuniform float time;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nvoid main()\n{\n vec2 uv = vTextureCoord * filterArea.xy / dimensions.xy;\n vec2 coord = uv;\n\n float dist = distance(coord, center);\n\n if ( (dist <= (time + params.z)) && (dist >= (time - params.z)) )\n {\n float diff = (dist - time);\n float powDiff = 1.0 - pow(abs(diff*params.x), params.y);\n\n float diffTime = diff * powDiff;\n vec2 diffUV = normalize(uv - center);\n coord = uv + (diffUV * diffTime);\n }\n\n coord *= dimensions.xy / filterArea.xy;\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n gl_FragColor = texture2D(uSampler, clampedCoord);\n if (coord != clampedCoord) {\n gl_FragColor *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n}\n",Qt=function(t){function e(e,r,n){void 0===e&&(e=[.5,.5]),void 0===r&&(r=[10,.8,.1]),void 0===n&&(n=0),t.call(this,$t,Jt,{center:{type:"v2",value:{x:.5,y:.5}},params:{type:"v3",value:{x:10,y:.8,z:.1}},time:{type:"1f",value:0},dimensions:{type:"2f",value:[0,0]}}),this.center=e,this.params=r,this.time=n}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={center:{},params:{},time:{}};return e.prototype.apply=function(t,e,r){this.uniforms.dimensions[0]=e.sourceFrame.width,this.uniforms.dimensions[1]=e.sourceFrame.height,t.applyFilter(this,e,r)},r.center.get=function(){return this.uniforms.center},r.center.set=function(t){this.uniforms.center=t},r.params.get=function(){return this.uniforms.params},r.params.set=function(t){this.uniforms.params=t},r.time.get=function(){return this.uniforms.time},r.time.set=function(t){this.uniforms.time=t},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.ShockwaveFilter=Qt;
164
164
  /*!
165
165
  * @pixi/filter-simple-lightmap - v2.0.1
166
166
  * Compiled Tue, 12 Sep 2017 17:14:04 UTC
@@ -168,7 +168,7 @@ var Zt="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nunifor
168
168
  * pixi-filters is licensed under the MIT License.
169
169
  * http://www.opensource.org/licenses/mit-license
170
170
  */
171
- var Qt="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}",te="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform sampler2D uLightmap;\nuniform vec4 filterArea;\nuniform vec2 dimensions;\nuniform vec4 ambientColor;\nvoid main() {\n vec4 diffuseColor = texture2D(uSampler, vTextureCoord);\n vec2 lightCoord = (vTextureCoord * filterArea.xy) / dimensions;\n vec4 light = texture2D(uLightmap, lightCoord);\n vec3 ambient = ambientColor.rgb * ambientColor.a;\n vec3 intensity = ambient + light.rgb;\n vec3 finalColor = diffuseColor.rgb * intensity;\n gl_FragColor = vec4(finalColor, diffuseColor.a);\n}\n",ee=function(t){function e(e,r){void 0===r&&(r=0),t.call(this,Qt,te),this.uniforms.ambientColor=new Float32Array([0,0,0,1]),this.texture=e,this.color=r}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={texture:{},color:{},alpha:{}};return e.prototype.apply=function(t,e,r,n){this.uniforms.dimensions[0]=e.sourceFrame.width,this.uniforms.dimensions[1]=e.sourceFrame.height,t.applyFilter(this,e,r,n)},r.texture.get=function(){return this.uniforms.uLightmap},r.texture.set=function(t){this.uniforms.uLightmap=t},r.color.set=function(t){var e=this.uniforms.ambientColor;"number"==typeof t?(PIXI.utils.hex2rgb(t,e),this._color=t):(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],this._color=PIXI.utils.rgb2hex(e))},r.color.get=function(){return this._color},r.alpha.get=function(){return this.uniforms.ambientColor[3]},r.alpha.set=function(t){this.uniforms.ambientColor[3]=t},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.SimpleLightmapFilter=ee;
171
+ var te="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}",ee="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform sampler2D uLightmap;\nuniform vec4 filterArea;\nuniform vec2 dimensions;\nuniform vec4 ambientColor;\nvoid main() {\n vec4 diffuseColor = texture2D(uSampler, vTextureCoord);\n vec2 lightCoord = (vTextureCoord * filterArea.xy) / dimensions;\n vec4 light = texture2D(uLightmap, lightCoord);\n vec3 ambient = ambientColor.rgb * ambientColor.a;\n vec3 intensity = ambient + light.rgb;\n vec3 finalColor = diffuseColor.rgb * intensity;\n gl_FragColor = vec4(finalColor, diffuseColor.a);\n}\n",re=function(t){function e(e,r){void 0===r&&(r=0),t.call(this,te,ee),this.uniforms.ambientColor=new Float32Array([0,0,0,1]),this.texture=e,this.color=r}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={texture:{},color:{},alpha:{}};return e.prototype.apply=function(t,e,r,n){this.uniforms.dimensions[0]=e.sourceFrame.width,this.uniforms.dimensions[1]=e.sourceFrame.height,t.applyFilter(this,e,r,n)},r.texture.get=function(){return this.uniforms.uLightmap},r.texture.set=function(t){this.uniforms.uLightmap=t},r.color.set=function(t){var e=this.uniforms.ambientColor;"number"==typeof t?(PIXI.utils.hex2rgb(t,e),this._color=t):(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],this._color=PIXI.utils.rgb2hex(e))},r.color.get=function(){return this._color},r.alpha.get=function(){return this.uniforms.ambientColor[3]},r.alpha.set=function(t){this.uniforms.ambientColor[3]=t},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.SimpleLightmapFilter=re;
172
172
  /*!
173
173
  * @pixi/filter-tilt-shift - v2.0.1
174
174
  * Compiled Tue, 12 Sep 2017 17:14:05 UTC
@@ -176,7 +176,7 @@ var Qt="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nunifor
176
176
  * pixi-filters is licensed under the MIT License.
177
177
  * http://www.opensource.org/licenses/mit-license
178
178
  */
179
- var re="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}",ne="varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float blur;\nuniform float gradientBlur;\nuniform vec2 start;\nuniform vec2 end;\nuniform vec2 delta;\nuniform vec2 texSize;\n\nfloat random(vec3 scale, float seed)\n{\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));\n float radius = smoothstep(0.0, 1.0, abs(dot(vTextureCoord * texSize - start, normal)) / gradientBlur) * blur;\n\n for (float t = -30.0; t <= 30.0; t++)\n {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 sample = texture2D(uSampler, vTextureCoord + delta / texSize * percent * radius);\n sample.rgb *= sample.a;\n color += sample * weight;\n total += weight;\n }\n\n gl_FragColor = color / total;\n gl_FragColor.rgb /= gl_FragColor.a + 0.00001;\n}\n",ie=function(t){function e(e,r,n,i){void 0===e&&(e=100),void 0===r&&(r=600),void 0===n&&(n=null),void 0===i&&(i=null),t.call(this,re,ne),this.uniforms.blur=e,this.uniforms.gradientBlur=r,this.uniforms.start=n||new PIXI.Point(0,window.innerHeight/2),this.uniforms.end=i||new PIXI.Point(600,window.innerHeight/2),this.uniforms.delta=new PIXI.Point(30,30),this.uniforms.texSize=new PIXI.Point(window.innerWidth,window.innerHeight),this.updateDelta()}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={blur:{},gradientBlur:{},start:{},end:{}};return e.prototype.updateDelta=function(){this.uniforms.delta.x=0,this.uniforms.delta.y=0},r.blur.get=function(){return this.uniforms.blur},r.blur.set=function(t){this.uniforms.blur=t},r.gradientBlur.get=function(){return this.uniforms.gradientBlur},r.gradientBlur.set=function(t){this.uniforms.gradientBlur=t},r.start.get=function(){return this.uniforms.start},r.start.set=function(t){this.uniforms.start=t,this.updateDelta()},r.end.get=function(){return this.uniforms.end},r.end.set=function(t){this.uniforms.end=t,this.updateDelta()},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.TiltShiftAxisFilter=ie;var oe=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.updateDelta=function(){var t=this.uniforms.end.x-this.uniforms.start.x,e=this.uniforms.end.y-this.uniforms.start.y,r=Math.sqrt(t*t+e*e);this.uniforms.delta.x=t/r,this.uniforms.delta.y=e/r},e}(ie);PIXI.filters.TiltShiftXFilter=oe;var ae=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.updateDelta=function(){var t=this.uniforms.end.x-this.uniforms.start.x,e=this.uniforms.end.y-this.uniforms.start.y,r=Math.sqrt(t*t+e*e);this.uniforms.delta.x=-e/r,this.uniforms.delta.y=t/r},e}(ie);PIXI.filters.TiltShiftYFilter=ae;var se=function(t){function e(e,r,n,i){void 0===e&&(e=100),void 0===r&&(r=600),void 0===n&&(n=null),void 0===i&&(i=null),t.call(this),this.tiltShiftXFilter=new oe(e,r,n,i),this.tiltShiftYFilter=new ae(e,r,n,i)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={blur:{},gradientBlur:{},start:{},end:{}};return e.prototype.apply=function(t,e,r){var n=t.getRenderTarget(!0);this.tiltShiftXFilter.apply(t,e,n),this.tiltShiftYFilter.apply(t,n,r),t.returnRenderTarget(n)},r.blur.get=function(){return this.tiltShiftXFilter.blur},r.blur.set=function(t){this.tiltShiftXFilter.blur=this.tiltShiftYFilter.blur=t},r.gradientBlur.get=function(){return this.tiltShiftXFilter.gradientBlur},r.gradientBlur.set=function(t){this.tiltShiftXFilter.gradientBlur=this.tiltShiftYFilter.gradientBlur=t},r.start.get=function(){return this.tiltShiftXFilter.start},r.start.set=function(t){this.tiltShiftXFilter.start=this.tiltShiftYFilter.start=t},r.end.get=function(){return this.tiltShiftXFilter.end},r.end.set=function(t){this.tiltShiftXFilter.end=this.tiltShiftYFilter.end=t},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.TiltShiftFilter=se;
179
+ var ne="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}",ie="varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float blur;\nuniform float gradientBlur;\nuniform vec2 start;\nuniform vec2 end;\nuniform vec2 delta;\nuniform vec2 texSize;\n\nfloat random(vec3 scale, float seed)\n{\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));\n float radius = smoothstep(0.0, 1.0, abs(dot(vTextureCoord * texSize - start, normal)) / gradientBlur) * blur;\n\n for (float t = -30.0; t <= 30.0; t++)\n {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 sample = texture2D(uSampler, vTextureCoord + delta / texSize * percent * radius);\n sample.rgb *= sample.a;\n color += sample * weight;\n total += weight;\n }\n\n gl_FragColor = color / total;\n gl_FragColor.rgb /= gl_FragColor.a + 0.00001;\n}\n",oe=function(t){function e(e,r,n,i){void 0===e&&(e=100),void 0===r&&(r=600),void 0===n&&(n=null),void 0===i&&(i=null),t.call(this,ne,ie),this.uniforms.blur=e,this.uniforms.gradientBlur=r,this.uniforms.start=n||new PIXI.Point(0,window.innerHeight/2),this.uniforms.end=i||new PIXI.Point(600,window.innerHeight/2),this.uniforms.delta=new PIXI.Point(30,30),this.uniforms.texSize=new PIXI.Point(window.innerWidth,window.innerHeight),this.updateDelta()}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={blur:{},gradientBlur:{},start:{},end:{}};return e.prototype.updateDelta=function(){this.uniforms.delta.x=0,this.uniforms.delta.y=0},r.blur.get=function(){return this.uniforms.blur},r.blur.set=function(t){this.uniforms.blur=t},r.gradientBlur.get=function(){return this.uniforms.gradientBlur},r.gradientBlur.set=function(t){this.uniforms.gradientBlur=t},r.start.get=function(){return this.uniforms.start},r.start.set=function(t){this.uniforms.start=t,this.updateDelta()},r.end.get=function(){return this.uniforms.end},r.end.set=function(t){this.uniforms.end=t,this.updateDelta()},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.TiltShiftAxisFilter=oe;var ae=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.updateDelta=function(){var t=this.uniforms.end.x-this.uniforms.start.x,e=this.uniforms.end.y-this.uniforms.start.y,r=Math.sqrt(t*t+e*e);this.uniforms.delta.x=t/r,this.uniforms.delta.y=e/r},e}(oe);PIXI.filters.TiltShiftXFilter=ae;var se=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.updateDelta=function(){var t=this.uniforms.end.x-this.uniforms.start.x,e=this.uniforms.end.y-this.uniforms.start.y,r=Math.sqrt(t*t+e*e);this.uniforms.delta.x=-e/r,this.uniforms.delta.y=t/r},e}(oe);PIXI.filters.TiltShiftYFilter=se;var ue=function(t){function e(e,r,n,i){void 0===e&&(e=100),void 0===r&&(r=600),void 0===n&&(n=null),void 0===i&&(i=null),t.call(this),this.tiltShiftXFilter=new ae(e,r,n,i),this.tiltShiftYFilter=new se(e,r,n,i)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={blur:{},gradientBlur:{},start:{},end:{}};return e.prototype.apply=function(t,e,r){var n=t.getRenderTarget(!0);this.tiltShiftXFilter.apply(t,e,n),this.tiltShiftYFilter.apply(t,n,r),t.returnRenderTarget(n)},r.blur.get=function(){return this.tiltShiftXFilter.blur},r.blur.set=function(t){this.tiltShiftXFilter.blur=this.tiltShiftYFilter.blur=t},r.gradientBlur.get=function(){return this.tiltShiftXFilter.gradientBlur},r.gradientBlur.set=function(t){this.tiltShiftXFilter.gradientBlur=this.tiltShiftYFilter.gradientBlur=t},r.start.get=function(){return this.tiltShiftXFilter.start},r.start.set=function(t){this.tiltShiftXFilter.start=this.tiltShiftYFilter.start=t},r.end.get=function(){return this.tiltShiftXFilter.end},r.end.set=function(t){this.tiltShiftXFilter.end=this.tiltShiftYFilter.end=t},Object.defineProperties(e.prototype,r),e}(PIXI.Filter);PIXI.filters.TiltShiftFilter=ue;
180
180
  /*!
181
181
  * @pixi/filter-twist - v2.0.1
182
182
  * Compiled Tue, 12 Sep 2017 17:14:07 UTC
@@ -184,5 +184,5 @@ var re="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 ue="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}",le="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",ce=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,ue,le),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=ce;var he=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 fe(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:de}=i.utils,pe=100,_e=3e3,ve=100,ge={};class ye{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(_e/ve)*ve}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(ge[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.");ge[e.name]=n.response,t()}),n.onerror=r,n.open("GET",e.url,!0),n.send()}}).then(()=>{const t=[];for(let r=pe;r<=this.maxSvgSize;r+=ve){let n=de[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(ge[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=>ut.onTextureLoaded(n,t)))}return Promise.all(t)})}))).then(()=>this.loadedResources)}getResource(t,...e){var r=this;return fe(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:he({},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 fe(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 fe(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 me=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:Ee}=i.filters;var xe=(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]),!ut.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?me({},d):{x:1,y:1},R=_?me({},_):{},O=v?me({},v):{};if(void 0!==h&&(b._parsedWidth=ut.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=ut.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=ut.parseExpression(R.x,t)/T.x:void 0===O.x&&(O.x=.5),void 0!==R.y?R.y=ut.parseExpression(R.y,t)/T.y:void 0===O.y&&(O.y=.5),Object.assign(b,ut.parseExpression(m,t)),Object.assign(b.scale,ut.parseExpression(T,t)),b.anchor&&Object.assign(b.anchor,ut.parseExpression(O,t)),Object.assign(b.pivot,ut.parseExpression(R,t)),void 0!==g){const e=new Ee(ut.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},be=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 Te(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 Re=t=>{const{logger:e,payload:{drawings:r=[]}={}}=t,n=Te(t.payload,["drawings"]),o=Te(t,["logger","payload"]),a=xe(Object.assign(t,be({logger:e,payload:n},o)),i.Graphics);return a&&r.forEach(({method:r,params:n=[]})=>{const i=ut.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},Oe=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 Se(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 we=t=>{const{payload:{color:e,radius:r=25,stroke:n=0,strokeWidth:i}={}}=t,o=Se(t.payload,["color","radius","stroke","strokeWidth"]),a=Se(t,["payload"]),s=Re(Oe({payload:o},a));return s&&(i&&s.lineStyle(i,n,1),(e||0===e)&&s.beginFill(e),s.drawCircle(0,0,ut.parseExpression(r,t)),(e||0===e)&&s.endFill()),s},Ce=t=>xe(t,i.Container);const Ae=(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},Ie=({x:t,y:e},{CELL_SIZE:r})=>({x:r*t,y:r*e});const{BlurFilter:Pe}=i.filters,Me=.6,De=16770355,Le=16724787,Ue=16777011,Ne=2941736,Fe=13385022,je=3962311,ke=12164347,Be=16777215,He=16770355;function Xe(t,e,r){return t+(e-t)*r}function We(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}=Ie(i,a),{x:c,y:h}=Ie(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(Ae(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 Ge(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 Ye(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 ze(t,e,r,n,o,a,s,u=12,l,c=Me){const h=c*o,d=new i.Graphics;d.x=r.x,d.y=r.y;const{x:p,y:_}=Ie(n,a),v=p-d.x,g=_-d.y;return l&&(d.filters=[new Pe(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(Xe(n,o,h),Xe(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 Ve(t,e,r,n,i,o,a,s,u,l,c){t.push(ze(e,r,n,i,o,a,s,u,void 0,c)),t.push(ze(e,r,n,i,o,a,s,u,l,c))}const Ke=-Math.PI/2,qe=2*Math.PI/50/2,Ze=50,$e=18,Je={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 Qe(t,e,r,n,o,a){const s=new i.Graphics;return s.lineStyle($e,t,1),s.arc(0,0,Ze-$e/2,Ke+e,Ke+r,a),s.tint=t,n.addChild(s),o.push(s),s}function tr(t){return Array.isArray(t)?t:Object.keys(t).sort().map(e=>t[e])}var er=r(1),rr=r.n(er);const nr={[rr.a.PWR_DISRUPT_SOURCE]:"disrupt-source",[rr.a.PWR_DISRUPT_SPAWN]:"disrupt-spawn",[rr.a.PWR_DISRUPT_TERMINAL]:"disrupt-terminal",[rr.a.PWR_DISRUPT_TOWER]:"disrupt-tower",[rr.a.PWR_REGEN_MINERAL]:"regen-mineral",[rr.a.PWR_REGEN_SOURCE]:"regen-source",[rr.a.PWR_GENERATE_OPS]:"generate-ops",[rr.a.PWR_OPERATE_EXTENSION]:"operate-extension",[rr.a.PWR_OPERATE_LAB]:"operate-lab",[rr.a.PWR_OPERATE_OBSERVER]:"operate-observer",[rr.a.PWR_OPERATE_SPAWN]:"operate-spawn",[rr.a.PWR_OPERATE_STORAGE]:"operate-storage",[rr.a.PWR_OPERATE_TERMINAL]:"operate-terminal",[rr.a.PWR_OPERATE_TOWER]:"operate-tower",[rr.a.PWR_SHIELD]:"shield",[rr.a.PWR_FORTIFY]:"fortify",[rr.a.PWR_OPERATE_CONTROLLER]:"operate-controller",[rr.a.PWR_OPERATE_POWER]:"operate-power",[rr.a.PWR_BERSERK]:"berserk",[rr.a.PWR_DEFEND]:"defend",[rr.a.PWR_DISABLE]:"disable",[rr.a.PWR_ENCOURAGE]:"encourage",[rr.a.PWR_EXHAUST]:"exhaust",[rr.a.PWR_RENEW]:"renew",[rr.a.PWR_SIGHT]:"sight",[rr.a.PWR_SUMMON]:"summon",[rr.a.PWR_DEMOLISH]:"demolish",[rr.a.PWR_HARVEST_ENERGY]:"harvest-energy",[rr.a.PWR_HARVEST_MINERAL]:"harvest-mineral",[rr.a.PWR_KILL]:"kill",[rr.a.PWR_MASS_REPAIR]:"mass-repair",[rr.a.PWR_PUNCH]:"punch",[rr.a.PWR_REFLECT]:"reflect",[rr.a.PWR_REINFORCE]:"reinforce",[rr.a.PWR_REMOTE_TRANSFER]:"remote-transfer",[rr.a.PWR_SNIPE]:"snipe"};var ir=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 or={creepEnergy:{color:16770413,radius:20},energy:{color:16770413,radius:30},power:{color:15998771,radius:45}},ar={color:16777215,radius:45};function sr(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 ur(t){let e=Number(t).toString(16);return e.length<2&&(e=`0${e}`),e}function lr(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=sr(s,a,t+1/3),i=sr(s,a,t),o=sr(s,a,t-1/3)}return[Math.round(255*n),Math.round(255*i),Math.round(255*o)]}function cr(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]=lr(n,i,o*e);return"string"==typeof t?`#${ur(a)}${ur(s)}${ur(u)}`:u+(s<<8)+(a<<16)}function hr(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?`#${ur(n)}${ur(i)}${ur(o)}`:o+(i<<8)+(n<<16)}const fr=Math.sin(Math.PI/4);var dr=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 pr(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 _r=t=>{const{world:e,logger:r,payload:{text:n="?",style:o}={}}=t,a=pr(t.payload,["text","style"]),s=pr(t,["world","logger","payload"]),u=ut.parseExpression(n,t),l=ut.parseExpression(o,t),{app:{stage:c}}=e,h=xe(dr({world:e,logger:r,payload:a},s),i.Text,[u,l]);return ut.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}),ut.addTickerHandler(h,()=>ut.alignPositionToPixels(h,c)),h};var vr=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 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};function yr(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 mr=t=>{const{logger:e,rootContainer:r,scope:n,world:o,objectMetadata:{texture:s},payload:{parentId:u,texture:l=s}={},stage:{resourceManager:c}}=t,h=yr(t.payload,["parentId","texture"]),f=yr(t,["logger","rootContainer","scope","world","objectMetadata","payload","stage"]);if(!l)return void e.warn("texture is not provided");let d;const p=ut.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=xe(gr({logger:e,payload:gr({},h,{parentId:u}),rootContainer:r,scope:n},f),i.Sprite,[d.texture]);return ut.setSvgResizeHandler(o,t,d),t}{const t=Ce(gr({logger:e,payload:{parentId:u},rootContainer:r,scope:n},f));return c.getResource(l).then(n=>{const a=xe(gr({logger:e,payload:gr({},h,{addToParent:!1}),rootContainer:r,scope:{}},f),i.Sprite,[n.texture]);ut.setSvgResizeHandler(o,a,n),a.zIndex=-1e3,t.addChild(a)}),t}},Er=r(93),xr=r.n(Er);const br=50;var Tr=(t,e,r,n=!1)=>{const i={},o={};let a,s="";if(0===t.length)return{md5:"",result:!1};for(let t=0;t<br;t+=1)i[t]=new Array(br),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=xr()(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<br-1&&!i[t][e-1]?s+="a 50 50 0 0 0 50 -50 v 50 ":s+="h 50 "}function d(t,e){t<br-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===br-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===br-1||i[t+1][e]||e===br-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===br-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<br-1&&i[t+1][e]?(t===br-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===br-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===br-1||0===e||i[t+1][e-1]&&(n||i[t+1][e]||i[t][e-1])?d(t,e):s+="v 50 ",e<br-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<br&&e<br&&(o[t][e]=!0))}for(let t=0;t<br;t+=1)for(let e=0;e<br;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<br&&i[t+r][e]);let a=0;do{a+=1}while(e+a<br&&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<br-1&&i[t+1][e]?(t===br-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===br-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===br-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<br-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:Rr}=i.extras,{BlurFilter:Or}=i.filters;function Sr(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 wr(t,e,r){ut.addTickerHandler(t,n=>{t.tilePosition.x+=n*e,t.tilePosition.y+=n*r})}var Cr=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 Ar(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 Ir={radius:37,color:2236962},Pr={texture:null};const Mr={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 Dr={circle:we,container:Ce,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?Ve(C,r,l,n,d,a,h,je,18,5):A||We(C,n,o,s,d,a,h)),_&&(A||We(C,n,o,s,_,a,h),C.push(Ge(o,De,.9*a,Ie(_,h)))),b&&("invaderCore"===s.type?Ve(C,r,l,n,b,a,h,ke,18,5):A||We(C,n,o,s,b,a,h),C.push(Ge(o,ke,.9*a,Ie(b,h),"invaderCore"===s.type?.3*a:0))),v&&("tower"===s.type?Ve(C,r,l,n,v,a,h,Ne,18,5):A||We(C,n,o,s,v,a,h)),f&&g?C.push(Ye(o,Ue,.9*a)):g?C.push(Ye(o,Ne,.9*a)):f&&C.push(Ye(o,Le,.9*a)),m&&Ve(C,r,l,n,m,a,h,je,12,5),O&&Ve(C,r,l,n,O,a,h,He,18,5),E&&Ve(C,r,l,n,E,a,h,Ne,12,5),y&&Ve(C,r,l,n,y,a,h,Fe,12,5,.3),p&&(Ve(C,r,l,n,p,a,h,De,"invaderCore"===s.type?18:12,5),C.push(Ge(o,De,.9*a,Ie(p,h),.3*a))),S&&(Ve(C,r,l,n,S,a,h,De,"invaderCore"===s.type?18:12,5),C.push(Ge(o,De,.9*a,Ie(S,h),.3*a))),x&&(Ve(C,r,l,n,x,a,h,De,"tower"===s.type?18:12,5),C.push(Ge(o,De,.9*a,Ie(x,h),.3*a))),T){const{x1:t,y1:e,x2:n,y2:i}=T;Ve(C,r,l,Ie({x:t,y:e},h),s,a,h,Be,12,2),Ve(C,r,l,Ie({x:n,y:i},h),s,a,h,Be,12,2)}if(R){const{x1:t,y1:e,x2:i,y2:o}=R;Ve(C,r,l,n,{x:t,y:e},a,h,Be,12,2),Ve(C,r,l,n,{x:i,y:o},a,h,Be,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=tr(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=Je[e.type];if(n){const{backSide:t,color:i}=n,o=t?d:f,a=qe*(e.hits/100);Qe(i,o,o+a,u,r.bodySprites,!1),Qe(i,-o,-(o+a),u,r.bodySprites,!0),t?d+=a:f+=a}else t.warn(`Unsupported type ${e.type}`)}),tr(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:Re,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}=Ie(e,l),d=r?s[r]:i;if(!t){const t=[];a&&n&&t.push(new L(Ae(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:xe,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=nr[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,Ie({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}=ar}=or,u=(ut.parseExpression(a,t)||o)*Math.min(1,0!==i?n/i:0);return we(ir({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*fr,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?cr(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=ut.parseExpression(e,t),a=o.isPublic?14518408:13421772,s={align:"center",fill:"#111",fontFamily:"Roboto, sans-serif",fontSize:60},u=xe(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 _r(h),ut.addTickerHandler(u,()=>ut.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=ut.parseExpression(n.progress,t);if(o!==r.oldProgress){r.oldProgress=o;const a=Re(vr({rootContainer:e,scope:r},i)),s=ut.parseExpression(n.progressTotal,t),u=ut.parseExpression(n.color,t),l=ut.parseExpression(n.radius,t),c=ut.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:mr,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}=Tr(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(Sr(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(Sr(O,{size:_,VIEW_BOX:v},{fill:"#fff"}),{alpha:.25}),t[2]=E(Sr(O,{size:_,VIEW_BOX:v},{fill:"#fff"}),{alpha:.25}),t[3]=E(new Rr(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 Rr(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&&(wr(t[3],1.5,1.5),wr(t[4],-1.35,-1.35)))}else t[0]=E(Sr(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}=Tr([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(Sr(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}=Tr(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=cr(b.backgroundColor,b.backgroundBrightness),s=cr(b.strokeColor,b.strokeBrightness),"disabled"===y&&(o=hr(o,.5),s=hr(s,.3)));const u=Sr(P,{size:_,VIEW_BOX:v},{fill:o,stroke:s,"stroke-width":b?b.strokeWidth:10,"paint-order":"stroke"});ut.onTextureLoaded(u.texture,()=>{e.renderer.render(u,t[0]),u.destroy(!0)});const l=Sr(P,{size:_,VIEW_BOX:v},{fill:"#fff"});x.wallMask.texture!==i.Texture.EMPTY&&x.wallMask.texture.destroy(!0),x.wallMask.texture=l.texture,ut.onTextureLoaded(l.texture,()=>{if("disabled"!==y){const n=new Rr(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(),ut.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=Sr(P,{size:_,VIEW_BOX:v},{fill:"#000"});ut.onTextureLoaded(c.texture,()=>{c.filters=[new Or(.006*_.width)],e.renderer.render(c,t[2]),c.destroy(!0),ut.enableTextureMipmap(e.renderer,t[2].baseTexture),[,,t[3].texture]=t,t[3].visible=!0,n[3]&&n[3].destroy(!0)}),t[4]=E(Sr(P,{size:_,VIEW_BOX:v},{fill:"#808080",stroke:b?function(t,e,r){const[n,i,o]=lr(t,e,r);return`#${ur(n)}${ur(i)}${ur(o)}`}(0,0,b.strokeLighting):"#000000","stroke-width":b?b.strokeWidth:10,"paint-order":"stroke"}),{parentLayer:a,visible:!1}),ut.onTextureLoaded(t[4].texture,()=>{t[4].visible=!0,n[4]&&n[4].destroy(!0)})}else t[0]=E(Sr(P,{size:_,VIEW_BOX:v},{fill:"#111",stroke:"#000","stroke-width":10,"paint-order":"stroke"}),{zIndex:2,visible:!1}),ut.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=cr(s=parseInt(T.floorBackgroundColor.substring(1),16),T.floorBackgroundBrightness),"low"===y&&(s=hr(s,.65)),"disabled"===y&&(s=hr(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=Rr.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=cr(parseInt(T.floorForegroundColor.substr(1),16),T.floorForegroundBrightness);"low"===y&&(t=hr(t,.65)),"disabled"===y&&(t=hr(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 Rr(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 Rr(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:_r,userBadge:t=>{const{payload:{parentId:e,radius:r=Ir.radius,color:n=Ir.color}={},scope:i,scope:{[e]:o},state:{user:a},stateExtra:{users:s={}},state:u,stateExtra:l}=t,c=Ar(t.payload,["parentId","radius","color"]),h=Ar(t,["payload","scope","scope","state","stateExtra","state","stateExtra"]),f=a&&s[a]&&s[a].badgeUrl;if(f){const t=Cr({},Pr,{width:2*r,texture:f,parentId:e},c);return mr(Cr({payload:t,scope:{[e]:o}},h))}return we(Cr({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=cr(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(Mr[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=cr(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(Mr[t.animation].map(t=>new F([new h(t[0],t[1])]))));r.runAction(e,n)}})):e.warn("No parent available with id",u)}},Lr=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 Ur{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=Lr({},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]=ut.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=Lr({},f,{state:a,prevState:s,payload:e.payload});h[i]=ut.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),_=Lr({},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&&!ut.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&&ut.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 Nr=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 Fr(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 jr(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:kr,Stage:Br}=i.display;class Hr{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(jr(c),jr(e)),t.data=Nr({},d,n),t.calculations=[].concat(jr(h),jr(r)),t.processors=[].concat(jr(f),jr(i))}}),e.stage=new Br,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 ye({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 Fr(function*(){const{stage:e}=t;e.resources=yield t.resourceManager.load(t.resourceMap,t.options.rescaleResources),t.metadata.layers.forEach((()=>{var r=Fr(function*({id:r,isDefault:n=!1,afterCreate:i=function(){}}){const o=new kr;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=>Dr[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 Ur(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=Dr[n].run||Dr[n];if(!i)throw new Error(`No processor found for ${n}`);const{logger:o}=this.options;return o.debug("run processor",n),i(Nr({stage:this.stage,logger:o},e))}destructProcessor(t,e,r){const{name:n,type:i=n}=t,{destruct:o,config:{isOwner:a=!0}={}}=Dr[i];if(o){const{logger:t}=this.options;return t.debug("run destruct",i),o(Nr({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=>ut.createAction(t,Nr({},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 Xr=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:Wr,utils:Gr}=i,Yr=500;class zr{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=ut.compileExpression(t.func))}),t.processors&&t.processors.forEach(t=>{t.shouldRun&&!a.a.isFunction(t.shouldRun)&&(t.shouldRun=ut.compileExpression(t.shouldRun)),t.until&&!a.a.isFunction(t.until)&&(t.until=ut.compileExpression(t.until)),t.when&&!a.a.isFunction(t.when)&&(t.when=ut.compileExpression(t.when))}),t.data&&Object.entries(t.data).forEach(([e,r])=>{t.data[e]=ut.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 Wr(i,o,{antialias:!0,transparent:!n,forceCanvas:a.forceCanvas});e.app=d,n&&(d.renderer.backgroundColor=n),e.actionManager=new u,e.world=new Hr(Xr({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(),Gr.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>Yr&&this.animate(),this.animateCheckerTimer=setTimeout(this.animateChecker,Yr)}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(Mr[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=cr(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=cr(parseInt(t.foregroundColor.substr(1),16),t.foregroundBrightness);"disabled"===o&&(e=hr(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 Gr.isWebGLSupported()}}r.d(e,"GameRenderer",function(){return Vr}),r.d(e,"PIXI",function(){return Kr}),window&&(window.GameRenderer=zr);const Vr=zr,Kr=i;e.default=Vr}])});
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}])});
188
188
  //# sourceMappingURL=renderer.js.map