text: /*!
   * @license PLATYPUS v1.0.2
   *
   * Distributed under the terms of the MIT license.
   * http://www.opensource.org/licenses/mit-license.html
   *
   * This notice shall be included in all copies or substantial portions of the Software.
   */
  
  !function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.pako=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c||a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){"use strict";var d="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;c.assign=function(a){for(var b=Array.prototype.slice.call(arguments,1);b.length;){var c=b.shift();if(c){if("object"!=typeof c)throw new TypeError(c+"must be non-object");for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d])}}return a},c.shrinkBuf=function(a,b){return a.length===b?a:a.subarray?a.subarray(0,b):(a.length=b,a)};var e={arraySet:function(a,b,c,d,e){if(b.subarray&&a.subarray)return void a.set(b.subarray(c,c+d),e);for(var f=0;f<d;f++)a[e+f]=b[c+f]},flattenChunks:function(a){var b,c,d,e,f,g;for(d=0,b=0,c=a.length;b<c;b++)d+=a[b].length;for(g=new Uint8Array(d),e=0,b=0,c=a.length;b<c;b++)f=a[b],g.set(f,e),e+=f.length;return g}},f={arraySet:function(a,b,c,d,e){for(var f=0;f<d;f++)a[e+f]=b[c+f]},flattenChunks:function(a){return[].concat.apply([],a)}};c.setTyped=function(a){a?(c.Buf8=Uint8Array,c.Buf16=Uint16Array,c.Buf32=Int32Array,c.assign(c,e)):(c.Buf8=Array,c.Buf16=Array,c.Buf32=Array,c.assign(c,f))},c.setTyped(d)},{}],2:[function(a,b,c){"use strict";function d(a,b){if(b<65537&&(a.subarray&&g||!a.subarray&&f))return String.fromCharCode.apply(null,e.shrinkBuf(a,b));for(var c="",d=0;d<b;d++)c+=String.fromCharCode(a[d]);return c}var e=a("./common"),f=!0,g=!0;try{String.fromCharCode.apply(null,[0])}catch(j){f=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(j){g=!1}for(var h=new e.Buf8(256),i=0;i<256;i++)h[i]=i>=252?6:i>=248?5:i>=240?4:i>=224?3:i>=192?2:1;h[254]=h[254]=1,c.string2buf=function(a){var b,c,d,f,g,h=a.length,i=0;for(f=0;f<h;f++)c=a.charCodeAt(f),55296==(64512&c)&&f+1<h&&56320==(64512&(d=a.charCodeAt(f+1)))&&(c=65536+(c-55296<<10)+(d-56320),f++),i+=c<128?1:c<2048?2:c<65536?3:4;for(b=new e.Buf8(i),g=0,f=0;g<i;f++)c=a.charCodeAt(f),55296==(64512&c)&&f+1<h&&56320==(64512&(d=a.charCodeAt(f+1)))&&(c=65536+(c-55296<<10)+(d-56320),f++),c<128?b[g++]=c:c<2048?(b[g++]=192|c>>>6,b[g++]=128|63&c):c<65536?(b[g++]=224|c>>>12,b[g++]=128|c>>>6&63,b[g++]=128|63&c):(b[g++]=240|c>>>18,b[g++]=128|c>>>12&63,b[g++]=128|c>>>6&63,b[g++]=128|63&c);return b},c.buf2binstring=function(a){return d(a,a.length)},c.binstring2buf=function(a){for(var b=new e.Buf8(a.length),c=0,d=b.length;c<d;c++)b[c]=a.charCodeAt(c);return b},c.buf2string=function(a,b){var c,e,f,g,i=b||a.length,j=new Array(2*i);for(e=0,c=0;c<i;)if((f=a[c++])<128)j[e++]=f;else if((g=h[f])>4)j[e++]=65533,c+=g-1;else{for(f&=2===g?31:3===g?15:7;g>1&&c<i;)f=f<<6|63&a[c++],g--;g>1?j[e++]=65533:f<65536?j[e++]=f:(f-=65536,j[e++]=55296|f>>10&1023,j[e++]=56320|1023&f)}return d(j,e)},c.utf8border=function(a,b){var c;for(b=b||a.length,b>a.length&&(b=a.length),c=b-1;c>=0&&128==(192&a[c]);)c--;return c<0?b:0===c?b:c+h[a[c]]>b?c:b}},{"./common":1}],3:[function(a,b,c){"use strict";function d(a,b,c,d){for(var e=65535&a|0,f=a>>>16&65535|0,g=0;0!==c;){g=c>2e3?2e3:c,c-=g;do{e=e+b[d++]|0,f=f+e|0}while(--g);e%=65521,f%=65521}return e|f<<16|0}b.exports=d},{}],4:[function(a,b,c){"use strict";b.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],5:[function(a,b,c){"use strict";function d(){for(var a,b=[],c=0;c<256;c++){a=c;for(var d=0;d<8;d++)a=1&a?3988292384^a>>>1:a>>>1;b[c]=a}return b}function e(a,b,c,d){var e=f,g=d+c;a^=-1;for(var h=d;h<g;h++)a=a>>>8^e[255&(a^b[h])];return-1^a}var f=d();b.exports=e},{}],6:[function(a,b,c){"use strict";function d(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}b.exports=d},{}],7:[function(a,b,c){"use strict";var d=30;b.exports=function(a,b){var c,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B;c=a.state,e=a.next_in,A=a.input,f=e+(a.avail_in-5),g=a.next_out,B=a.output,h=g-(b-a.avail_out),i=g+(a.avail_out-257),j=c.dmax,k=c.wsize,l=c.whave,m=c.wnext,n=c.window,o=c.hold,p=c.bits,q=c.lencode,r=c.distcode,s=(1<<c.lenbits)-1,t=(1<<c.distbits)-1;a:do{p<15&&(o+=A[e++]<<p,p+=8,o+=A[e++]<<p,p+=8),u=q[o&s];b:for(;;){if(v=u>>>24,o>>>=v,p-=v,0==(v=u>>>16&255))B[g++]=65535&u;else{if(!(16&v)){if(0==(64&v)){u=q[(65535&u)+(o&(1<<v)-1)];continue b}if(32&v){c.mode=12;break a}a.msg="invalid literal/length code",c.mode=d;break a}w=65535&u,v&=15,v&&(p<v&&(o+=A[e++]<<p,p+=8),w+=o&(1<<v)-1,o>>>=v,p-=v),p<15&&(o+=A[e++]<<p,p+=8,o+=A[e++]<<p,p+=8),u=r[o&t];c:for(;;){if(v=u>>>24,o>>>=v,p-=v,!(16&(v=u>>>16&255))){if(0==(64&v)){u=r[(65535&u)+(o&(1<<v)-1)];continue c}a.msg="invalid distance code",c.mode=d;break a}if(x=65535&u,v&=15,p<v&&(o+=A[e++]<<p,(p+=8)<v&&(o+=A[e++]<<p,p+=8)),(x+=o&(1<<v)-1)>j){a.msg="invalid distance too far back",c.mode=d;break a}if(o>>>=v,p-=v,v=g-h,x>v){if((v=x-v)>l&&c.sane){a.msg="invalid distance too far back",c.mode=d;break a}if(y=0,z=n,0===m){if(y+=k-v,v<w){w-=v;do{B[g++]=n[y++]}while(--v);y=g-x,z=B}}else if(m<v){if(y+=k+m-v,(v-=m)<w){w-=v;do{B[g++]=n[y++]}while(--v);if(y=0,m<w){v=m,w-=v;do{B[g++]=n[y++]}while(--v);y=g-x,z=B}}}else if(y+=m-v,v<w){w-=v;do{B[g++]=n[y++]}while(--v);y=g-x,z=B}for(;w>2;)B[g++]=z[y++],B[g++]=z[y++],B[g++]=z[y++],w-=3;w&&(B[g++]=z[y++],w>1&&(B[g++]=z[y++]))}else{y=g-x;do{B[g++]=B[y++],B[g++]=B[y++],B[g++]=B[y++],w-=3}while(w>2);w&&(B[g++]=B[y++],w>1&&(B[g++]=B[y++]))}break}}break}}while(e<f&&g<i);w=p>>3,e-=w,p-=w<<3,o&=(1<<p)-1,a.next_in=e,a.next_out=g,a.avail_in=e<f?f-e+5:5-(e-f),a.avail_out=g<i?i-g+257:257-(g-i),c.hold=o,c.bits=p}},{}],8:[function(a,b,c){"use strict";function d(a){return(a>>>24&255)+(a>>>8&65280)+((65280&a)<<8)+((255&a)<<24)}function e(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function f(a){var b;return a&&a.state?(b=a.state,a.total_in=a.total_out=b.total=0,a.msg="",b.wrap&&(a.adler=1&b.wrap),b.mode=L,b.last=0,b.havedict=0,b.dmax=32768,b.head=null,b.hold=0,b.bits=0,b.lencode=b.lendyn=new s.Buf32(pa),b.distcode=b.distdyn=new s.Buf32(qa),b.sane=1,b.back=-1,D):G}function g(a){var b;return a&&a.state?(b=a.state,b.wsize=0,b.whave=0,b.wnext=0,f(a)):G}function h(a,b){var c,d;return a&&a.state?(d=a.state,b<0?(c=0,b=-b):(c=1+(b>>4),b<48&&(b&=15)),b&&(b<8||b>15)?G:(null!==d.window&&d.wbits!==b&&(d.window=null),d.wrap=c,d.wbits=b,g(a))):G}function i(a,b){var c,d;return a?(d=new e,a.state=d,d.window=null,c=h(a,b),c!==D&&(a.state=null),c):G}function j(a){return i(a,sa)}function k(a){if(ta){var b;for(q=new s.Buf32(512),r=new s.Buf32(32),b=0;b<144;)a.lens[b++]=8;for(;b<256;)a.lens[b++]=9;for(;b<280;)a.lens[b++]=7;for(;b<288;)a.lens[b++]=8;for(w(y,a.lens,0,288,q,0,a.work,{bits:9}),b=0;b<32;)a.lens[b++]=5;w(z,a.lens,0,32,r,0,a.work,{bits:5}),ta=!1}a.lencode=q,a.lenbits=9,a.distcode=r,a.distbits=5}function l(a,b,c,d){var e,f=a.state;return null===f.window&&(f.wsize=1<<f.wbits,f.wnext=0,f.whave=0,f.window=new s.Buf8(f.wsize)),d>=f.wsize?(s.arraySet(f.window,b,c-f.wsize,f.wsize,0),f.wnext=0,f.whave=f.wsize):(e=f.wsize-f.wnext,e>d&&(e=d),s.arraySet(f.window,b,c-d,e,f.wnext),d-=e,d?(s.arraySet(f.window,b,c-d,d,0),f.wnext=d,f.whave=f.wsize):(f.wnext+=e,f.wnext===f.wsize&&(f.wnext=0),f.whave<f.wsize&&(f.whave+=e))),0}function m(a,b){var c,e,f,g,h,i,j,m,n,o,p,q,r,pa,qa,ra,sa,ta,ua,va,wa,xa,ya,za,Aa=0,Ba=new s.Buf8(4),Ca=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!a||!a.state||!a.output||!a.input&&0!==a.avail_in)return G;c=a.state,c.mode===W&&(c.mode=X),h=a.next_out,f=a.output,j=a.avail_out,g=a.next_in,e=a.input,i=a.avail_in,m=c.hold,n=c.bits,o=i,p=j,xa=D;a:for(;;)switch(c.mode){case L:if(0===c.wrap){c.mode=X;break}for(;n<16;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(2&c.wrap&&35615===m){c.check=0,Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=u(c.check,Ba,2,0),m=0,n=0,c.mode=M;break}if(c.flags=0,c.head&&(c.head.done=!1),!(1&c.wrap)||(((255&m)<<8)+(m>>8))%31){a.msg="incorrect header check",c.mode=ma;break}if((15&m)!==K){a.msg="unknown compression method",c.mode=ma;break}if(m>>>=4,n-=4,wa=8+(15&m),0===c.wbits)c.wbits=wa;else if(wa>c.wbits){a.msg="invalid window size",c.mode=ma;break}c.dmax=1<<wa,a.adler=c.check=1,c.mode=512&m?U:W,m=0,n=0;break;case M:for(;n<16;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(c.flags=m,(255&c.flags)!==K){a.msg="unknown compression method",c.mode=ma;break}if(57344&c.flags){a.msg="unknown header flags set",c.mode=ma;break}c.head&&(c.head.text=m>>8&1),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=u(c.check,Ba,2,0)),m=0,n=0,c.mode=N;case N:for(;n<32;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.head&&(c.head.time=m),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,Ba[2]=m>>>16&255,Ba[3]=m>>>24&255,c.check=u(c.check,Ba,4,0)),m=0,n=0,c.mode=O;case O:for(;n<16;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.head&&(c.head.xflags=255&m,c.head.os=m>>8),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=u(c.check,Ba,2,0)),m=0,n=0,c.mode=P;case P:if(1024&c.flags){for(;n<16;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.length=m,c.head&&(c.head.extra_len=m),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=u(c.check,Ba,2,0)),m=0,n=0}else c.head&&(c.head.extra=null);c.mode=Q;case Q:if(1024&c.flags&&(q=c.length,q>i&&(q=i),q&&(c.head&&(wa=c.head.extra_len-c.length,c.head.extra||(c.head.extra=new Array(c.head.extra_len)),s.arraySet(c.head.extra,e,g,q,wa)),512&c.flags&&(c.check=u(c.check,e,q,g)),i-=q,g+=q,c.length-=q),c.length))break a;c.length=0,c.mode=R;case R:if(2048&c.flags){if(0===i)break a;q=0;do{wa=e[g+q++],c.head&&wa&&c.length<65536&&(c.head.name+=String.fromCharCode(wa))}while(wa&&q<i);if(512&c.flags&&(c.check=u(c.check,e,q,g)),i-=q,g+=q,wa)break a}else c.head&&(c.head.name=null);c.length=0,c.mode=S;case S:if(4096&c.flags){if(0===i)break a;q=0;do{wa=e[g+q++],c.head&&wa&&c.length<65536&&(c.head.comment+=String.fromCharCode(wa))}while(wa&&q<i);if(512&c.flags&&(c.check=u(c.check,e,q,g)),i-=q,g+=q,wa)break a}else c.head&&(c.head.comment=null);c.mode=T;case T:if(512&c.flags){for(;n<16;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m!==(65535&c.check)){a.msg="header crc mismatch",c.mode=ma;break}m=0,n=0}c.head&&(c.head.hcrc=c.flags>>9&1,c.head.done=!0),a.adler=c.check=0,c.mode=W;break;case U:for(;n<32;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}a.adler=c.check=d(m),m=0,n=0,c.mode=V;case V:if(0===c.havedict)return a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,F;a.adler=c.check=1,c.mode=W;case W:if(b===B||b===C)break a;case X:if(c.last){m>>>=7&n,n-=7&n,c.mode=ja;break}for(;n<3;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}switch(c.last=1&m,m>>>=1,n-=1,3&m){case 0:c.mode=Y;break;case 1:if(k(c),c.mode=ca,b===C){m>>>=2,n-=2;break a}break;case 2:c.mode=_;break;case 3:a.msg="invalid block type",c.mode=ma}m>>>=2,n-=2;break;case Y:for(m>>>=7&n,n-=7&n;n<32;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if((65535&m)!=(m>>>16^65535)){a.msg="invalid stored block lengths",c.mode=ma;break}if(c.length=65535&m,m=0,n=0,c.mode=Z,b===C)break a;case Z:c.mode=$;case $:if(q=c.length){if(q>i&&(q=i),q>j&&(q=j),0===q)break a;s.arraySet(f,e,g,q,h),i-=q,g+=q,j-=q,h+=q,c.length-=q;break}c.mode=W;break;case _:for(;n<14;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(c.nlen=257+(31&m),m>>>=5,n-=5,c.ndist=1+(31&m),m>>>=5,n-=5,c.ncode=4+(15&m),m>>>=4,n-=4,c.nlen>286||c.ndist>30){a.msg="too many length or distance symbols",c.mode=ma;break}c.have=0,c.mode=aa;case aa:for(;c.have<c.ncode;){for(;n<3;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.lens[Ca[c.have++]]=7&m,m>>>=3,n-=3}for(;c.have<19;)c.lens[Ca[c.have++]]=0;if(c.lencode=c.lendyn,c.lenbits=7,ya={bits:c.lenbits},xa=w(x,c.lens,0,19,c.lencode,0,c.work,ya),c.lenbits=ya.bits,xa){a.msg="invalid code lengths set",c.mode=ma;break}c.have=0,c.mode=ba;case ba:for(;c.have<c.nlen+c.ndist;){for(;Aa=c.lencode[m&(1<<c.lenbits)-1],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(qa<=n);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(sa<16)m>>>=qa,n-=qa,c.lens[c.have++]=sa;else{if(16===sa){for(za=qa+2;n<za;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m>>>=qa,n-=qa,0===c.have){a.msg="invalid bit length repeat",c.mode=ma;break}wa=c.lens[c.have-1],q=3+(3&m),m>>>=2,n-=2}else if(17===sa){for(za=qa+3;n<za;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=qa,n-=qa,wa=0,q=3+(7&m),m>>>=3,n-=3}else{for(za=qa+7;n<za;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=qa,n-=qa,wa=0,q=11+(127&m),m>>>=7,n-=7}if(c.have+q>c.nlen+c.ndist){a.msg="invalid bit length repeat",c.mode=ma;break}for(;q--;)c.lens[c.have++]=wa}}if(c.mode===ma)break;if(0===c.lens[256]){a.msg="invalid code -- missing end-of-block",c.mode=ma;break}if(c.lenbits=9,ya={bits:c.lenbits},xa=w(y,c.lens,0,c.nlen,c.lencode,0,c.work,ya),c.lenbits=ya.bits,xa){a.msg="invalid literal/lengths set",c.mode=ma;break}if(c.distbits=6,c.distcode=c.distdyn,ya={bits:c.distbits},xa=w(z,c.lens,c.nlen,c.ndist,c.distcode,0,c.work,ya),c.distbits=ya.bits,xa){a.msg="invalid distances set",c.mode=ma;break}if(c.mode=ca,b===C)break a;case ca:c.mode=da;case da:if(i>=6&&j>=258){a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,v(a,p),h=a.next_out,f=a.output,j=a.avail_out,g=a.next_in,e=a.input,i=a.avail_in,m=c.hold,n=c.bits,c.mode===W&&(c.back=-1);break}for(c.back=0;Aa=c.lencode[m&(1<<c.lenbits)-1],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(qa<=n);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(ra&&0==(240&ra)){for(ta=qa,ua=ra,va=sa;Aa=c.lencode[va+((m&(1<<ta+ua)-1)>>ta)],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(ta+qa<=n);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=ta,n-=ta,c.back+=ta}if(m>>>=qa,n-=qa,c.back+=qa,c.length=sa,0===ra){c.mode=ia;break}if(32&ra){c.back=-1,c.mode=W;break}if(64&ra){a.msg="invalid literal/length code",c.mode=ma;break}c.extra=15&ra,c.mode=ea;case ea:if(c.extra){for(za=c.extra;n<za;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.length+=m&(1<<c.extra)-1,m>>>=c.extra,n-=c.extra,c.back+=c.extra}c.was=c.length,c.mode=fa;case fa:for(;Aa=c.distcode[m&(1<<c.distbits)-1],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(qa<=n);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(0==(240&ra)){for(ta=qa,ua=ra,va=sa;Aa=c.distcode[va+((m&(1<<ta+ua)-1)>>ta)],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(ta+qa<=n);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=ta,n-=ta,c.back+=ta}if(m>>>=qa,n-=qa,c.back+=qa,64&ra){a.msg="invalid distance code",c.mode=ma;break}c.offset=sa,c.extra=15&ra,c.mode=ga;case ga:if(c.extra){for(za=c.extra;n<za;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.offset+=m&(1<<c.extra)-1,m>>>=c.extra,n-=c.extra,c.back+=c.extra}if(c.offset>c.dmax){a.msg="invalid distance too far back",c.mode=ma;break}c.mode=ha;case ha:if(0===j)break a;if(q=p-j,c.offset>q){if((q=c.offset-q)>c.whave&&c.sane){a.msg="invalid distance too far back",c.mode=ma;break}q>c.wnext?(q-=c.wnext,r=c.wsize-q):r=c.wnext-q,q>c.length&&(q=c.length),pa=c.window}else pa=f,r=h-c.offset,q=c.length;q>j&&(q=j),j-=q,c.length-=q;do{f[h++]=pa[r++]}while(--q);0===c.length&&(c.mode=da);break;case ia:if(0===j)break a;f[h++]=c.length,j--,c.mode=da;break;case ja:if(c.wrap){for(;n<32;){if(0===i)break a;i--,m|=e[g++]<<n,n+=8}if(p-=j,a.total_out+=p,c.total+=p,p&&(a.adler=c.check=c.flags?u(c.check,f,p,h-p):t(c.check,f,p,h-p)),p=j,(c.flags?m:d(m))!==c.check){a.msg="incorrect data check",c.mode=ma;break}m=0,n=0}c.mode=ka;case ka:if(c.wrap&&c.flags){for(;n<32;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m!==(4294967295&c.total)){a.msg="incorrect length check",c.mode=ma;break}m=0,n=0}c.mode=la;case la:xa=E;break a;case ma:xa=H;break a;case na:return I;case oa:default:return G}return a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,(c.wsize||p!==a.avail_out&&c.mode<ma&&(c.mode<ja||b!==A))&&l(a,a.output,a.next_out,p-a.avail_out)?(c.mode=na,I):(o-=a.avail_in,p-=a.avail_out,a.total_in+=o,a.total_out+=p,c.total+=p,c.wrap&&p&&(a.adler=c.check=c.flags?u(c.check,f,p,a.next_out-p):t(c.check,f,p,a.next_out-p)),a.data_type=c.bits+(c.last?64:0)+(c.mode===W?128:0)+(c.mode===ca||c.mode===Z?256:0),(0===o&&0===p||b===A)&&xa===D&&(xa=J),xa)}function n(a){if(!a||!a.state)return G;var b=a.state;return b.window&&(b.window=null),a.state=null,D}function o(a,b){var c;return a&&a.state?(c=a.state,0==(2&c.wrap)?G:(c.head=b,b.done=!1,D)):G}function p(a,b){var c,d,e=b.length;return a&&a.state?(c=a.state,0!==c.wrap&&c.mode!==V?G:c.mode===V&&(d=1,(d=t(d,b,e,0))!==c.check)?H:l(a,b,e,e)?(c.mode=na,I):(c.havedict=1,D)):G}var q,r,s=a("../utils/common"),t=a("./adler32"),u=a("./crc32"),v=a("./inffast"),w=a("./inftrees"),x=0,y=1,z=2,A=4,B=5,C=6,D=0,E=1,F=2,G=-2,H=-3,I=-4,J=-5,K=8,L=1,M=2,N=3,O=4,P=5,Q=6,R=7,S=8,T=9,U=10,V=11,W=12,X=13,Y=14,Z=15,$=16,_=17,aa=18,ba=19,ca=20,da=21,ea=22,fa=23,ga=24,ha=25,ia=26,ja=27,ka=28,la=29,ma=30,na=31,oa=32,pa=852,qa=592,ra=15,sa=ra,ta=!0;c.inflateReset=g,c.inflateReset2=h,c.inflateResetKeep=f,c.inflateInit=j,c.inflateInit2=i,c.inflate=m,c.inflateEnd=n,c.inflateGetHeader=o,c.inflateSetDictionary=p,c.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":1,"./adler32":3,"./crc32":5,"./inffast":7,"./inftrees":9}],9:[function(a,b,c){"use strict";var d=a("../utils/common"),e=15,f=852,g=592,h=0,i=1,j=2,k=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],l=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],m=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],n=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];b.exports=function(a,b,c,o,p,q,r,s){var t,u,v,w,x,y,z,A,B,C=s.bits,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=null,O=0,P=new d.Buf16(e+1),Q=new d.Buf16(e+1),R=null,S=0;for(D=0;D<=e;D++)P[D]=0;for(E=0;E<o;E++)P[b[c+E]]++;for(H=C,G=e;G>=1&&0===P[G];G--);if(H>G&&(H=G),0===G)return p[q++]=20971520,p[q++]=20971520,s.bits=1,0;for(F=1;F<G&&0===P[F];F++);for(H<F&&(H=F),K=1,D=1;D<=e;D++)if(K<<=1,(K-=P[D])<0)return-1;if(K>0&&(a===h||1!==G))return-1;for(Q[1]=0,D=1;D<e;D++)Q[D+1]=Q[D]+P[D];for(E=0;E<o;E++)0!==b[c+E]&&(r[Q[b[c+E]]++]=E);if(a===h?(N=R=r,y=19):a===i?(N=k,O-=257,R=l,S-=257,y=256):(N=m,R=n,y=-1),M=0,E=0,D=F,x=q,I=H,J=0,v=-1,L=1<<H,w=L-1,a===i&&L>f||a===j&&L>g)return 1;for(var T=0;;){T++,z=D-J,r[E]<y?(A=0,B=r[E]):r[E]>y?(A=R[S+r[E]],B=N[O+r[E]]):(A=96,B=0),t=1<<D-J,u=1<<I,F=u;do{u-=t,p[x+(M>>J)+u]=z<<24|A<<16|B|0}while(0!==u);for(t=1<<D-1;M&t;)t>>=1;if(0!==t?(M&=t-1,M+=t):M=0,E++,0==--P[D]){if(D===G)break;D=b[c+r[E]]}if(D>H&&(M&w)!==v){for(0===J&&(J=H),x+=F,I=D-J,K=1<<I;I+J<G&&!((K-=P[I+J])<=0);)I++,K<<=1;if(L+=1<<I,a===i&&L>f||a===j&&L>g)return 1;v=M&w,p[v]=H<<24|I<<16|x-q|0}}return 0!==M&&(p[x+M]=D-J<<24|64<<16|0),s.bits=H,0}},{"../utils/common":1}],10:[function(a,b,c){"use strict";b.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],11:[function(a,b,c){"use strict";function d(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}b.exports=d},{}],"/lib/inflate.js":[function(a,b,c){"use strict";function d(a){if(!(this instanceof d))return new d(a);this.options=h.assign({chunkSize:16384,windowBits:0,to:""},a||{});var b=this.options;b.raw&&b.windowBits>=0&&b.windowBits<16&&(b.windowBits=-b.windowBits,0===b.windowBits&&(b.windowBits=-15)),!(b.windowBits>=0&&b.windowBits<16)||a&&a.windowBits||(b.windowBits+=32),b.windowBits>15&&b.windowBits<48&&0==(15&b.windowBits)&&(b.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var c=g.inflateInit2(this.strm,b.windowBits);if(c!==j.Z_OK)throw new Error(k[c]);this.header=new m,g.inflateGetHeader(this.strm,this.header)}function e(a,b){var c=new d(b);if(c.push(a,!0),c.err)throw c.msg;return c.result}function f(a,b){return b=b||{},b.raw=!0,e(a,b)}var g=a("./zlib/inflate"),h=a("./utils/common"),i=a("./utils/strings"),j=a("./zlib/constants"),k=a("./zlib/messages"),l=a("./zlib/zstream"),m=a("./zlib/gzheader"),n=Object.prototype.toString;d.prototype.push=function(a,b){var c,d,e,f,k,l,m=this.strm,o=this.options.chunkSize,p=this.options.dictionary,q=!1;if(this.ended)return!1;d=b===~~b?b:!0===b?j.Z_FINISH:j.Z_NO_FLUSH,"string"==typeof a?m.input=i.binstring2buf(a):"[object ArrayBuffer]"===n.call(a)?m.input=new Uint8Array(a):m.input=a,m.next_in=0,m.avail_in=m.input.length;do{if(0===m.avail_out&&(m.output=new h.Buf8(o),m.next_out=0,m.avail_out=o),c=g.inflate(m,j.Z_NO_FLUSH),c===j.Z_NEED_DICT&&p&&(l="string"==typeof p?i.string2buf(p):"[object ArrayBuffer]"===n.call(p)?new Uint8Array(p):p,c=g.inflateSetDictionary(this.strm,l)),c===j.Z_BUF_ERROR&&!0===q&&(c=j.Z_OK,q=!1),c!==j.Z_STREAM_END&&c!==j.Z_OK)return this.onEnd(c),this.ended=!0,!1;m.next_out&&(0!==m.avail_out&&c!==j.Z_STREAM_END&&(0!==m.avail_in||d!==j.Z_FINISH&&d!==j.Z_SYNC_FLUSH)||("string"===this.options.to?(e=i.utf8border(m.output,m.next_out),f=m.next_out-e,k=i.buf2string(m.output,e),m.next_out=f,m.avail_out=o-f,f&&h.arraySet(m.output,m.output,e,f,0),this.onData(k)):this.onData(h.shrinkBuf(m.output,m.next_out)))),0===m.avail_in&&0===m.avail_out&&(q=!0)}while((m.avail_in>0||0===m.avail_out)&&c!==j.Z_STREAM_END);return c===j.Z_STREAM_END&&(d=j.Z_FINISH),d===j.Z_FINISH?(c=g.inflateEnd(this.strm),this.onEnd(c),this.ended=!0,c===j.Z_OK):d!==j.Z_SYNC_FLUSH||(this.onEnd(j.Z_OK),m.avail_out=0,!0)},d.prototype.onData=function(a){this.chunks.push(a)},d.prototype.onEnd=function(a){a===j.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=h.flattenChunks(this.chunks)),this.chunks=[],this.err=a,this.msg=this.strm.msg},c.Inflate=d,c.inflate=e,c.inflateRaw=f,c.ungzip=e},{"./utils/common":1,"./utils/strings":2,"./zlib/constants":4,"./zlib/gzheader":6,"./zlib/inflate":8,"./zlib/messages":10,"./zlib/zstream":11}]},{},[])("/lib/inflate.js")}),function(a,b,c){"use strict";var d={value:!1,writable:!0},e={},f=0;a.recycle={add:function(a,g,h,i){var j=a===c,k=[];return h&&e[h]&&console.warn('Recycle cache for "'+h+'" already exists.'),e[h||"cache-"+f++]=k,b.defineProperties(a,{setUp:{value:j?g?function(){var a=0,c=null;for(k.length?(c=k.pop(),c.recycled=!1):(c=[],b.defineProperty(c,"recycled",d)),a=0;a<arguments.length;a++)c.push(arguments[a]);return c}:function(){var a=0,b=null;for(b=k.length?k.pop():[],a=0;a<arguments.length;a++)b.push(arguments[a]);return b}:g?function(){var a=null;return k.length?(a=k.pop(),a.recycled=!1):(a=b.create(this.prototype),b.defineProperty(a,"recycled",d)),this.apply(a,arguments),a}:function(){var a=null;return a=k.length?k.pop():b.create(this.prototype),this.apply(a,arguments),a}},recycle:{value:g?function(a){a.recycled?console.warn("WHOA! I have already been recycled!",a):(a.recycled=!0,k.push(a))}:function(a){k.push(a)}}}),b.defineProperty(a.prototype,"recycle",{value:i||(j?function(b){var c=0;if(b>1)for(c=this.length,b-=1;c--;)this[c].recycle(b);this.length=0,a.recycle(this)}:function(){a.recycle(this)})}),k},cache:e}}(window,Object,Array),this.platypus=this.platypus||{},function(a){"use strict";var b=function(){},c=navigator.userAgent.toLowerCase(),d=c.search("edge")>-1,e=c.search("ipod")>-1,f=c.search("iphone")>-1,g=c.search("ipad")>-1||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,h=c.search("android")>-1,i=c.search("silk")>-1,j=e||f||g,k=j||h||i;a.supports={touch:"undefined"!==window.ontouchstart,edge:d,iPod:e,iPhone:f,iPad:g,safari:c.search("safari")>-1&&!d,ie:c.search("msie")>-1||c.search("trident")>-1,firefox:c.search("firefox")>-1,android:h,chrome:c.search("chrome")>-1&&!d,silk:i,iOS:j,mobile:k,desktop:!k},a.debug=springroll.Debug||{error:b,log:b,olive:b,warn:b},a.version="1.0.2",a.buildDate="Tue, 09 Mar 2021 20:50:29 GMT"}(this.platypus),function(a,b){"use strict";var c=a.prototype;c.union||b.defineProperty(c,"union",{value:function(a){var b=0,c=a.length;for(b=0;b<c;b++)-1===this.indexOf(a[b])&&this.push(a[b]);return this}}),c.greenSlice||b.defineProperty(c,"greenSlice",{value:function(){var b=a.setUp(),c=0,d=this.length;for(c=0;c<d;c++)b[c]=this[c];return b}}),c.greenSplice||b.defineProperty(c,"greenSplice",{value:function(a){var b=0,c=this[a],d=this.length;if(a<0||a>=d)return null;for(b=a+1;b<d;b++)this[b-1]=this[b];return d&&(this.length-=1),c}}),recycle.add(a,!!springroll.Debug,"Array")}(Array,Object),function(){"use strict";var a=include("PIXI.Graphics"),b=a.prototype;b.a=b.a||b.arc,b.at=b.at||b.arcTo,b.bt=b.bt||b.bezierCurveTo,b.c=b.c||b.clear,b.dc=b.dc||b.drawCircle,b.de=b.de||b.drawEllipse,b.dr=b.dr||b.drawRect,b.ef=b.ef||b.endFill,b.f=b.f||b.beginFill,b.lt=b.lt||b.lineTo,b.mt=b.mt||b.moveTo,b.qt=b.qt||b.quadraticCurveTo,b.r=b.r||b.drawRect,b.rr=b.rr||b.drawRoundedRect}(),function(a,b){"use strict";var c=a.prototype;c.greenSplit||b.defineProperty(c,"greenSplit",{value:function(a){var b=this.toString(),c=0,d=0,e=Array.setUp();if(a){for(d=b.indexOf(a),c=a.length;d>=0;)e.push(b.substr(0,d)),b=b.substr(d+c),d=b.indexOf(a);e.push(b)}else for(d=this.length,c=d-1;d--;)e.push(this[c-d]);return e}})}(String,Object),function(a){"use strict";var b=null,c=null,d=null;window.Map||(b={value:null},c=function(){b.value={},a.defineProperty(this,"map",b)},d=c.prototype,a.defineProperties(d,{get:{value:function(a){return this.map[a]}},has:{value:function(a){return this.map.hasOwnProperty(a)}},set:{value:function(a,b){return this.map[a]=b,this}},delete:{value:function(a){var b=this.map[a];return delete this.map[a],b}}}),window.Map=c)}(Object),platypus.Async=function(){"use strict";var a=function(a){this.increment-=1,this.increment||(this.resolve=a,this.timeout=setTimeout(a,0))},b=function(a){this.resolve=null,a(),this.recycle()},c=function(c,d){var e=b.bind(this,d),f=a.bind(this,e),g=c.length;if(g)for(this.increment=g,this.resolve=null;g--;)c[g](f);else e(),this.recycle()};return c.prototype.attemptResolution=function(){return!!this.resolve&&(clearTimeout(this.timeout),this.resolve(),!0)},recycle.add(c,!!springroll.Debug,"Async",function(){this.increment=0,this.resolve=null,this.timeout=0}),c}(),platypus.Data=function(){"use strict";var a=function(a){var b=arguments.length,c="";if(a)if("string"==typeof a)for(b%2&&(this[b]=null,b-=1);b;)this[arguments[b-2]]=arguments[b-1],b-=2;else for(c in a)a.hasOwnProperty(c)&&(this[c]=a[c])};return recycle.add(a,!!springroll.Debug,"Data",function(){var b="";for(b in this)this.hasOwnProperty(b)&&delete this[b];a.recycle(this)}),a}(),platypus.DataMap=function(){"use strict";var a=include("window.Map"),b=function(a,b,c){return this.get(b)!==c&&(this.has(b)||a.push(b),this.set(b,c)),c},c=function(a,b){var c=a.indexOf(b),d=this.get(b);return c>=0&&(a.greenSplice(c),this.delete(b)),d},d=function(a){for(var b=a.length;b--;)this.delete(a[b]);a.length=0},e=function(a){for(var b=a.length,c={};b--;)c[a[b]]=this.get(a[b]);return c},f={get:{value:null},has:{value:null},keys:{value:null},set:{value:null},delete:{value:null},clear:{value:null},toJSON:{value:null}},g=function(g){var h=arguments.length,i="",j=null,k=null,l=null;if(this.map||(l=f,k=this.map=new a,j=l.keys.value=Array.setUp(),l.get.value=k.get.bind(k),l.has.value=k.has.bind(k),l.set.value=b.bind(k,j),l.delete.value=c.bind(k,j),l.clear.value=d.bind(k,j),l.toJSON.value=e.bind(k,j),Object.defineProperties(this,l)),g)if(j=g.keys,"string"==typeof g)for(h%2&&(h-=1,this.set(arguments[h],null));h;)h-=2,this.set(arguments[h],arguments[h+1]);else if(j)for(h=j.length;h--;)this.set(j[h],g.get(j[h]));else for(i in g)g.hasOwnProperty(i)&&this.set(i,g[i])};return recycle.add(g,!!springroll.Debug,"DataMap",function(){this.clear(),g.recycle(this)}),g}(),function(){"use strict";var a=include("PIXI.BaseTexture"),b=include("PIXI.CanvasTinter"),c=include("platypus.Data"),d=include("PIXI.Point"),e=include("PIXI.Rectangle"),f=include("PIXI.Sprite"),g=include("PIXI.Texture"),h={},i={},j=function(){},k={texture:g.EMPTY,anchor:new d(0,0)},l=/[\[\]{},-]/g,m=function(b){var c=0,d=Array.setUp(),e=null,f=platypus.game.app.assetManager.cache,g=i,h=null;for(c=0;c<b.length;c++)if("string"==typeof(h=b[c])){if(!g[h]){if(!(e=f.read(h))){platypus.debug.warn('"'+h+'" is not a loaded asset.');break}g[h]=new a(e)}d.push(g[h])}else d.push(new a(h));return d},n=function(a){var b=0;if(a.id)return a.id;for(b=0;b<a.images.length;b++)if("string"!=typeof a.images[b])return"";return a.id=JSON.stringify(a).replace(l,""),a.id},o=function(a,b){var d=Array.setUp(),e=0;for(e=0;e<a;e++)d.push(b[e]||k);return c.setUp("id","default","frames",d,"next","default","speed",1)},p=function(a,b){var d="",e=c.setUp(),f=0,g=null,h="";for(h in a)if(a.hasOwnProperty(h)){for(d=a[h],g=d.frames.greenSlice(),f=g.length;f--;)g[f]=b[g[f]]||k;e[h]=c.setUp("id",h,"frames",g,"next",d.next,"speed",d.speed)}return e.default||(e.default=o(b.length,b)),e},q=function(a){var b=0,f=null,h=null,i=a.frames,j=a.images,k=null,l=Array.setUp(),n=m(j);for(b=0;b<i.length;b++)h=i[b],k=new g(n[h[4]],new e(h[0],h[1],h[2],h[3])),l.push({texture:k,anchor:new d((h[5]||0)/k.width,(h[6]||0)/k.height)});return f=p(a.animations,l),f.default||(f.default=o(l.length,l)),n.recycle(),c.setUp("textures",l,"animations",f)},r=function(a,b){var f=0,h=null,i=null,j=a.frames,k=a.images,l=null,n=Array.setUp(),o=m(k);for(f=0;f<j.length;f++)i=j[f],l=new g(o[i[4]],new e(i[0],i[1],i[2],i[3])),n.push({texture:l,anchor:new d((i[5]||0)/l.width,(i[6]||0)/l.height)});return h=p(a.animations,n),o.recycle(),c.setUp("textures",n,"animations",h,"viable",1,"cacheId",b)},s=function(a,b){var c=60,d=n(a),e=d?h[d]:null,g=(a.framerate||c)/c;d?e?(e.viable+=1,this.cacheId=d):(e=h[d]=r(a,d),this.cacheId=d):e=q(a),f.call(this,e.textures[0].texture),this._animations=e.animations,this._animation=null,this.animationSpeed=g,this.currentAnimation=null,this._currentTime=0,this.playing=!1,this._visible=!0,this._updating=!1,this.update=j,e.textures.length<2?this.gotoAndStop(b):this.gotoAndPlay(b)},t=s.prototype=Object.create(f.prototype);s.prototype.constructor=s,platypus.PIXIAnimation=s,Object.defineProperties(t,{visible:{get:function(){return this._visible},set:function(a){this._visible=a,this._syncUpdate()}},currentFrame:{get:function(){var a=this._animation.frames;return a[Math.floor(this._currentTime)%a.length]}},paused:{get:function(){return!this.playing},set:function(a){(a&&this.playing||!a&&!this.playing)&&(this.playing=!a,this._syncUpdate())}}}),t.stop=function(){this.paused=!0},t.play=function(){this.paused=!1},t._syncUpdate=function(){var a=function(a){var b="",c=0;this._currentTime+=this.animationSpeed*this._animation.speed*a*.06,c=Math.floor(this._currentTime),c<0&&(c=0),c<this._animation.frames.length?this.setFrame(c%this._animation.frames.length):c>=this._animation.frames.length&&(b=this._animation.id,this.gotoAndPlay(this._animation.next),this.emit("complete",b))}
  ;return function(){var b=this.playing&&this._visible;b!==this._updating&&(this._updating=b,this.update=b?a:j)}}(),t.gotoAndStop=function(a){this.stop(),this._currentTime=0,this._animation=this._animations[a],this._animation||(this._animation=this._animations.default),this.setFrame(0)},t.gotoAndPlay=function(a,b){this.currentAnimation===a&&!1===b||(this._currentTime=0,this._animation=this._animations[a],this.currentAnimation=a,this._animation||(this._animation=this._animations.default,this.currentAnimation="default"),this.setFrame(0)),this.play()},t.setFrame=function(a){var c=this._animation.frames[a];this._texture=c.texture,this.anchor=c.anchor,this.tintedTexture&&(this.tintedTexture=b.getTintedTexture(this,this.tint))},t.has=function(a){return!!this._animations[a]},t.destroy=function(){var a="";if(this.stop(),f.prototype.destroy.call(this),this.cacheId&&(h[this.cacheId].viable-=1,h[this.cacheId].viable<=0)){h[this.cacheId].textures.recycle();for(a in h[this.cacheId].animations)h[this.cacheId].animations.hasOwnProperty(a)&&h[this.cacheId].animations[a].frames.recycle();delete h[this.cacheId]}},s.preloadBaseTextures=function(a){var b=i,c="";if(a.updateTexture)for(c in b)b.hasOwnProperty(c)&&a.updateTexture(b[c])},s.unloadBaseTextures=function(a){var b=i,c="";for(c in b)b.hasOwnProperty(c)&&b[c]&&(b[c].destroy(),b[c]=null)},s.EmptySpriteSheet={framerate:60,frames:[],images:[],animations:{},recycleSpriteSheet:function(){}},s.formatSpriteSheet=function(){var a=/([\w-]+)\.(\w+)$/,b=function(a,b,c,d,e){var f="";for(f in a)a.hasOwnProperty(f)&&(b[f]&&(b[f].frames.recycle(),b[f].recycle(),platypus.debug.olive('PIXIAnimation "'+e+'": Overwriting duplicate animation for "'+f+'".')),b[f]=h(f,a[f],c,d))},d=function(a,b,c,d){var e=0,f=a.width,g=a.height,h=a.regX||0,i=a.regY||0,j=0,k=0,l=0,m=0;for(e=0;e<d.length;e++)for(j=d[e].realWidth-f,k=d[e].realHeight-g,m=0;m<=k;m+=g)for(l=0;l<=j;l+=f)b.push([l,m,f,g,e+c,h,i])},e=function(a,b,c){var d=null,e=0;for(e=0;e<a.length;e++)d=a[e],b.push(Array.setUp(d[0],d[1],d[2],d[3],d[4]+c,d[5],d[6]))},f=function(a){for(var b=a.length,c="",d="",e="";b--;)d=a[b].src||a[b],c+=e+d.substring(0,128),e=",";return c},g=function(a,c){var g=null,h=c.animations,j=c.images,k=c.framerate||60,l=c.frames,n=0,o=Array.setUp(),p=j.length,q=l.length,r=a.animations,s=a.images,t=a.framerate||60,u=a.frames;for(c.id?c.id+=";"+(a.id||f(a.images)):c.id=a.id||f(a.images),n=0;n<s.length;n++)o.push(i(s[n])),j.push(o[n]);return Array.isArray(u)?e(u,l,p):(g=m(o),d(u,l,p,g),g.recycle()),b(r,h,t/k,q,c.id),o.recycle(),c},h=function(a,b,d,e){var f=0,g=0,h=Array.setUp(),i=0;if("number"==typeof b)return h.push(b+e),c.setUp("frames",h,"next",a,"speed",d);if(Array.isArray(b)){for(g=b[0]||0,i=(b[1]||g)+1+e,g+=e,f=g;f<i;f++)h.push(f);return c.setUp("frames",h,"next",b[2]||a,"speed",(b[3]||1)*d)}for(f=0;f<b.frames.length;f++)h.push(b.frames[f]+e);return c.setUp("frames",h,"next",b.next||a,"speed",(b.speed||1)*d)},i=function(b){var c=!1;return"string"==typeof b&&(c=b.match(a))?c[1]:b},j=function(){var a=this.animations,b="";for(b in a)a.hasOwnProperty(b)&&a[b].frames.recycle(),a[b].recycle();this.frames.recycle(2),this.images.recycle(),this.recycle()},k=function(a,b){for(var c=a.length,d=null;c--;)d=a[c],"string"==typeof d&&(d=platypus.game.settings.spriteSheets[d]),d&&g(d,b);return b};return function(a){var b=s.EmptySpriteSheet,d=a;if("string"==typeof d&&(d=platypus.game.settings.spriteSheets[a]),d){if(b=c.setUp("animations",c.setUp(),"framerate",60,"frames",Array.setUp(),"id","","images",Array.setUp(),"recycleSpriteSheet",j),Array.isArray(d))return k(d,b);if(d)return g(d,b)}return b}}()}(),platypus.StateMap=function(){"use strict";var a=include("platypus.DataMap"),b=function(b){var c=arguments.length;c?1===c&&"string"==typeof b?(a.call(this),this.updateFromString(b)):a.apply(this,arguments):a.call(this)},c=extend(b,a);return Object.defineProperty(c,"updateFromString",{value:function(a){for(var b=a.greenSplit(","),c=b.length,d="";c--;)(d=b[c])&&("!"===d.substr(0,1)?this.set(d.substr(1),!1):this.set(d,!0));return b.recycle(),this}}),Object.defineProperty(c,"update",{value:function(a){for(var b=a.keys,c=b.length,d="",e=!1,f=!1;c--;)d=b[c],f=a.get(d),this.get(d)!==f&&(this.set(d,f),e=!0);return e}}),Object.defineProperty(c,"includes",{value:function(a){for(var b=a.keys,c=b.length,d="";c--;)if(d=b[c],this.get(d)!==a.get(d))return!1;return!0}}),Object.defineProperty(c,"intersects",{value:function(a){for(var b=a.keys,c=b.length,d="";c--;)if(d=b[c],this.get(d)===a.get(d))return!0;return!1}}),recycle.add(b,!!springroll.Debug,"StateMap",function(){this.clear(),b.recycle(this)}),b}(),platypus.Component=function(){"use strict";var a=include("platypus.Data"),b=function(){return Array.setUp()},c=function(b,c){this.type=b,this.owner=c,this.publicMethods=a.setUp(),this.listener=a.setUp("events",Array.setUp(),"messages",Array.setUp())},d=c.prototype;return d.toString=function(){return"[Component "+this.type+"]"},d.toJSON=null,d.destroy=function(){var a="";if(this.listener){this._destroy&&this._destroy();for(a in this.publicMethods)this.publicMethods.hasOwnProperty(a)&&this.removeMethod(a);this.publicMethods.recycle(),this.removeEventListeners(),this.listener.events.recycle(),this.listener.messages.recycle(),this.listener.recycle(),this.listener=null}},d.removeEventListeners=function(a){var b=0,c=null,d=null;if(a)for(b=0;b<a.length;b++)this.removeEventListener(a[b]);else{for(c=this.listener.events,d=this.listener.messages,b=0;b<c.length;b++)this.owner.off(c[b],d[b]);c.length=0,d.length=0}},d.addEventListener=function(a,b,c){var d=b.bind(this);return this.listener.events.push(a),this.listener.messages.push(d),this.owner.on(a,d,c),d},d.addMethod=function(a,b){this.owner[a]?platypus.debug.warn(this.owner.type+': Entity already has a method called "'+a+'". Method not added.'):(this.owner[a]=function(){return b.apply(this,arguments)}.bind(this),this.publicMethods[a]=b)},d.removeEventListener=function(a,b){var c=0,d=this.listener.events,e=this.listener.messages;for(c=d.length-1;c>=0;c--)d[c]!==a||b&&e[c]!==b||(this.owner.off(a,e[c]),this.listener.events.greenSplice(c),this.listener.messages.greenSplice(c))},d.removeMethod=function(a){this.owner[a]?delete this.owner[a]:platypus.debug.warn(this.owner.type+': Entity does not have a method called "'+a+'".'),delete this.publicMethods[a]},c.getAssetList=b,c.getLateAssetList=b,c}(),platypus.Messenger=function(){"use strict";var a=include("springroll.EventDispatcher"),b=function(){a.call(this),this.loopCheck=Array.setUp()},c=!!springroll.Debug,d=c&&window.performance&&window.performance.mark&&window.performance.measure&&window.performance,e=extend(b,a);return e.toString=function(){return"[Messenger Object]"},e._trigger=e.trigger,e.trigger=function(a,b,c){var d=null,e=0,f=0,g=b,h=null;if("string"==typeof a){if(-1===a.indexOf(" "))return this.triggerEvent.apply(this,arguments);for(h=a.split(" "),d=Array.prototype.greenSlice.call(arguments),e=0;e<h.length;e++)d[0]=h[e],f+=this.triggerEvent.apply(this,d);return d.recycle(),f}if(Array.isArray(a)){for(d=Array.prototype.greenSlice.call(arguments),e=0;e<a.length;e++)d[0]=a[e],f+=this.trigger.apply(this,d);return d.recycle(),f}return a.event?(void 0!==a.message&&(g=a.message),this.triggerEvent(a.event,g,a.debug||c)):(platypus.debug.warn('Event incorrectly formatted: must be string, array, or object containing an "event" property.',a),0)},e.triggerEvent=function(a){var b=0,c=0,d=null,e=this._listeners,f=null;if(!this._destroyed&&e.hasOwnProperty(a)&&e[a]){for(e=e[a].greenSlice(),arguments.length>1&&(f=Array.prototype.greenSlice.call(arguments),f.greenSplice(0)),b=c=e.length;c--;)d=e[c],d._eventDispatcherOnce&&(delete d._eventDispatcherOnce,this.off(a,d)),d.apply(this,f);f&&f.recycle(),e.recycle()}return b},c&&(e._triggerEvent=e.triggerEvent,e.triggerEvent=function(a,b){var c=0,e=b&&b.debug,f=0,g=0;if(e||this.debug){for(c=0;c<this.loopCheck.length;c++)if(this.loopCheck[c]===a){if((f+=1)>5)throw"Endless loop detected for '"+a+"'.";platypus.debug.warn("Event '"+a+"' is nested inside another '"+a+"' event.")}return this.loopCheck.push(a),d&&d.mark("a"),g=this._triggerEvent.apply(this,arguments),d&&(d.mark("b"),d.measure(this.type+":"+a,"a","b")),this.loopCheck.length=this.loopCheck.length-1,e&&(g?platypus.debug.olive('Entity "'+this.type+'": Event "'+a+'" has '+g+" subscriber"+(g>1?"s":"")+".",b):platypus.debug.warn('Entity "'+this.type+'": Event "'+a+'" has no subscribers.',b)),g}return this._triggerEvent.apply(this,arguments)}),e.getMessageIds=function(){return Object.keys(this._listeners)},e.eventDispatcherDestroy=e.destroy,e.destroy=function(){this.loopCheck.recycle(),this.eventDispatcherDestroy()},b}(),platypus.Entity=function(){"use strict";var a=include("platypus.Data"),b=include("platypus.StateMap"),c=function(a,b,c){this.addComponent(new a(this,b,c))},d={},e=function(e,f,g,h){var i=0,j=null,k=Array.setUp(),l=a.setUp(e),m=l.components,n=a.setUp(l.properties),o=a.setUp(f),p=a.setUp(o.properties),q=Array.setUp(),r=Array.setUp();if(platypus.Messenger.call(this),this.components=Array.setUp(),this.type=l.id||"none",this.id=o.id||p.id,this.id?0===this.id.search(this.type+"-")&&(i=parseInt(this.id.substring(this.id.search("-")+1),10),isNaN(i)||d[this.type]&&!(d[this.type]<=i)||(d[this.type]=i+1)):(d[this.type]||(d[this.type]=0),this.id=this.type+"-"+d[this.type],d[this.type]+=1),this.setProperty(n),this.setProperty(p),this.on("set-property",function(a){this.setProperty(a)}.bind(this)),this.state=b.setUp(this.state),this.lastState=b.setUp(),h&&(this.parent=h),this.trigger=this.triggerEvent=function(a,b){return q.push(a),r.push(b),-1},m)for(i=0;i<m.length;i++)(j=m[i])&&(platypus.components[j.type]?k.push(c.bind(this,platypus.components[j.type],j)):platypus.debug.warn('Entity "'+this.type+'": Component "'+j.type+'" is not defined.',j));this.loadingComponents=platypus.Async.setUp(k,function(){for(this.loadingComponents=null,delete this.trigger,delete this.triggerEvent,i=0;i<q.length;i++)this.trigger(q[i],r[i]);q.recycle(),r.recycle(),this.triggerEvent("load"),g&&g(this)}.bind(this)),k.recycle(),l.recycle(),n.recycle(),o.recycle(),p.recycle()},f=e.prototype=new platypus.Messenger;return f.toString=function(){return"[Entity "+this.type+"]"},f.toJSON=function(a){var b=this.components,c={properties:{id:this.id,state:this.state.toJSON()}},d=0,e=null,f=c.properties;for(a?(c.id=this.type,c.components=[]):c.type=this.type,d=0;d<b.length;d++)e=b[d].toJSON(f),a&&e&&c.components.push(e);return c},f.addComponent=function(a){return this.components.push(a),this.triggerEvent("component-added",a),a},f.removeComponent=function(a){var b=0;if("string"==typeof a){for(b=0;b<this.components.length;b++)if(this.components[b].type===a)return a=this.components[b],this.components.greenSplice(b),this.triggerEvent("component-removed",a),a.destroy(),a}else for(b=0;b<this.components.length;b++)if(this.components[b]===a)return this.components.greenSplice(b),this.triggerEvent("component-removed",a),a.destroy(),a;return!1},f.setProperty=function(a){var b="";for(b in a)a.hasOwnProperty(b)&&(this[b]=a[b])},f.messengerDestroy=f.destroy,f.destroy=function(){var a=this.components,b=0,c=a.length;if(!this._destroyed){for(b=0;b<c;b++)a[b].destroy();a.recycle(),this.state.recycle(),this.state=null,this.lastState.recycle(),this.lastState=null,this.messengerDestroy()}},e.getAssetList=function(a,b){var c=0,d=null,f=null,g=null,h=null;if(a.type)return h=platypus.game.settings.entities[a.type],h?e.getAssetList(h,a.properties):(platypus.debug.warn('Entity "'+a.type+'": This entity is not defined.',a),g);for(g=Array.setUp(),c=0;c<a.components.length;c++)(d=a.components[c]&&a.components[c].type&&platypus.components[a.components[c].type])&&(f=d.getAssetList(a.components[c],a.properties,b),g.union(f),f.recycle());return g},e.getLateAssetList=function(a,b,c){var d=0,f=null,g=null,h=null;if(a.type)return e.getLateAssetList(platypus.game.settings.entities[a.type],b,c);for(h=Array.setUp(),d=0;d<a.components.length;d++)(f=a.components[d]&&a.components[d].type&&platypus.components[a.components[d].type])&&(g=f.getLateAssetList(a.components[d],a.properties,b,c),h.union(g),g.recycle());return h},e}(),platypus.Scene=function(){"use strict";var a=include("platypus.Data"),b=include("platypus.Entity"),c=include("platypus.PIXIAnimation"),d=include("springroll.State"),e=/^(?:\w+:\/{2}\w+(?:\.\w+)*\/?)?(?:[\/.]*?(?:[^?]+)?\/)?(?:([^\/?]+)\.(\w+))(?:\?\S*)?$/,f=function(){var a=function(a,b){for(var c=b.length;c--;)if(b[c].id===a)return!0;return!1};return function(b,c){for(var d=null,e=platypus.game.app.assetManager.cache._cache,f=Array.setUp(),h=b.length;h--;)d=g(b[h]),e[d.id]||a(d.id,c)?d.recycle():f.push(d);return f}}(),g=function(b){var c=b.match(e),d=a.setUp("id",b,"src",b);return c?d.id=c[1]:platypus.debug.warn("Scene: A listed asset should provide the entire file path."),d},h=function(){var a=this.holds;a.count-=1,a.count||(this.sceneLive(),a.recycle(),this.holds=null)},i=function(a){this.app.unload(a),a.recycle()},j=function(a,c,d){this.layers.push(new b(a,{properties:c},d))},k=function(){var b=0,d="",e=Array.setUp(),f=this.layerDefinitions,g=!0,i=!1,k=null,l=null;for(this.holds=a.setUp("count",1,"release",h.bind(this)),this.storeMessages=!0,this.storedMessages=Array.setUp(),this.layers=Array.setUp(),b=0;b<f.length;b++){if(i=f[b],k={stage:this.stage,parent:this},i.properties)for(d in i.properties)i.properties.hasOwnProperty(d)&&(k[d]=i.properties[d]);if(i.type&&(i=platypus.game.settings.entities[i.type]),g=!0,i.filter){if(i.filter.includes){g=!1;for(d in i.filter.includes)i.filter.includes.hasOwnProperty(d)&&platypus.supports[i.filter.includes[d]]&&(g=!0)}if(i.filter.excludes)for(d in i.filter.excludes)i.filter.excludes.hasOwnProperty(d)&&platypus.supports[i.filter.excludes[d]]&&(g=!1)}g&&e.push(j.bind(this,i,k))}for(platypus.Async.setUp(e,function(){var a=this.holds;platypus.debug.olive("Scene loaded: "+this.id),this.triggerOnChildren("scene-loaded",this.data,a),c.preloadBaseTextures(this.app.display.renderer),a.release()}.bind(this)),l=this.storedMessages,this.storeMessages=!1,b=0;b<l.length;b++)this.triggerOnChildren(l[b].message,l[b].value);l.recycle(),this.storedMessages=null,e.recycle()},l=function(a,b){var c=this.getLateAssetList(a);c.length?(b.union(c),this.once("exit",i.bind(this,c))):c.recycle()},m=function(a,b){var c=null;d.call(this,a,b.options),c=this.getAssetList(b),this.id=b.id,this.preload.union(c),this.layerDefinitions=b.layers,this.storeMessages=!1,this.storedMessages=null,this.stage=a,this.layers=null,this.assets=b.assets||null,this.holds=null,this.on("loading",l.bind(this,b)),this.on("loaded",k),c.recycle()},n=extend(m,d);return n.sceneLive=function(){platypus.game.currentScene=this,platypus.debug.olive("Scene live: "+this.id),this.triggerOnChildren("scene-live",this.data)},n.exitStart=function(){platypus.debug.olive("Scene ending: "+this.id),this.triggerOnChildren("scene-ended",this.data)},n.triggerOnChildren=function(a,b){var c=0;if(this.storeMessages)this.storedMessages.push({message:a,value:b});else for(c=0;c<this.layers.length;c++)this.layers[c].trigger.apply(this.layers[c],arguments)},n.getEntityById=function(a){var b=0,c=null;for(b=0;b<this.layers.length;b++){if(this.layers[b].id===a)return this.layers[b];if(this.layers[b].getEntityById&&(c=this.layers[b].getEntityById(a)))return c}return null},n.getEntitiesByType=function(a){var b=0,c=null,d=Array.setUp();for(b=0;b<this.layers.length;b++)this.layers[b].type===a&&d.push(this.layers[b]),this.layers[b].getEntitiesByType&&(c=this.layers[b].getEntitiesByType(a),d.union(c),c.recycle());return d},n.exit=function(){var a=0;for(a=0;a<this.layers.length;a++)this.layers[a].destroy();this.layers.recycle(),this.layers=null,c.unloadBaseTextures(),platypus.game.currentScene=null},n.getAssetList=function(a){var c=0,d=null,e=Array.setUp();for(a.assets&&e.union(a.assets),c=0;c<a.layers.length;c++)d=b.getAssetList(a.layers[c]),e.union(d),d.recycle();return d=f(e,this.preload),e.recycle(),d},n.getLateAssetList=function(a){var c=0,d=null,e=Array.setUp();for(c=0;c<a.layers.length;c++)d=b.getLateAssetList(a.layers[c],null,this.data),e.union(d),d.recycle();return d=f(e,this.preload),e.recycle(),d},m}(),platypus.Game=function(){"use strict";var a=include("PIXI.Container"),b=include("platypus.Scene"),c=include("window.XMLHttpRequest"),d=function(a,b){var d=new c;d.open("GET",a,!0),d.responseType="text",d.onload=function(){var c=null;if(200===d.status)try{c=JSON.parse(d.responseText)}catch(e){platypus.debug.warn('Error parsing "'+a+'": '+e.message)}else platypus.debug.warn('Error opening "'+a+'": '+d.description);b(c)},d.send()},e=function(a,b){var c=0,f="",g=0,h=function(){(g-=1)||b(a)},i=function(a,b,c){e(a[b],function(d){a[b]=d,c(d)})};if(a){if(Array.isArray(a)){if(g=a.length)for(c=0;c<a.length;c++)i(a,c,h);else b(a);return}if("object"==typeof a){if(a.src&&a.src.length>5&&".json"===a.src.substring(a.src.length-5).toLowerCase())e(a.src,function(c){a.src!==c&&(a=c),b(a)});else{for(f in a)a.hasOwnProperty(f)&&(g+=1);if(g)for(f in a)a.hasOwnProperty(f)&&i(a,f,h);else b(a)}return}if("string"==typeof a&&a.length>5&&".json"===a.substring(a.length-5).toLowerCase())return void d(a,function(a){"object"==typeof a?e(a,b):b(a)})}b(a)},f=function(c,d,f){var g=function(c){var d="",e="",g=this.app.states||{};platypus.game=this,this.currentScene=null,this.settings=c,this.stage=this.app.display.stage;for(e in c.scenes)c.scenes.hasOwnProperty(e)&&(d=c.scenes[e].id=c.scenes[e].id||e,g[d]=new b(new a,c.scenes[e]));this.app.states||(this.app.states=g),f&&f(this),window.getEntityById=function(a){return this.getEntityById(a)}.bind(this),window.getEntitiesByType=function(a){return this.getEntitiesByType(a)}.bind(this),window.getVisibleSprites=function(a,b){var c=0;if(b=b||Array.setUp(),a=a||this.stage,!a.texture&&a.visible){for(c=0;c<a.children.length;c++)window.getVisibleSprites(a.children[c],b);return b}return a.visible?(b.push(a),b):b}.bind(this)}.bind(this);if(!c)return void platypus.debug.warn("No game definition is supplied. Game not created.");this.app=d,"string"==typeof c?e(c,g):g(c)},g=f.prototype;return g.tick=function(a){this.currentScene&&this.currentScene.triggerOnChildren("tick",a)},g.loadScene=function(){var c=function(c,d){var e="",f=null;c?"string"==typeof c?(this.app.states[c].data=d,this.app.manager.state=c):(e=c.id=c.id||"new-scene",f=new b(new a,c),f.data=d,this.app.manager.addState(e,f),this.stage.addChild(f.panel),this.app.trigger("stateAdded",e,f),this.app.manager.state=e):platypus.debug.warn("A scene id or scene definition must be provided to load a scene.")};return function(a,b){window.setTimeout(c.bind(this,a,b),1)}}(),g.getEntityById=function(a){return this.currentScene?this.currentScene.getEntityById(a):null},g.getEntitiesByType=function(a){return this.currentScene?this.currentScene.getEntitiesByType(a):Array.setUp()},g.destroy=function(){},f}(),platypus.Vector=function(){"use strict";var a=function(a,b,c){this.matrix?(this.matrix[0]=0,this.matrix[1]=0,this.matrix[2]=0):this.matrix=Array.setUp(0,0,0),this.set(a,b,c)},b=a.prototype;return Object.defineProperty(b,"x",{get:function(){return this.matrix[0]},set:function(a){this.matrix[0]=a}}),Object.defineProperty(b,"y",{get:function(){return this.matrix[1]},set:function(a){this.matrix[1]=a}}),Object.defineProperty(b,"z",{get:function(){return this.matrix[2]},set:function(a){this.matrix[2]=a}}),b.toString=function(){return"["+this.matrix.join(",")+"]"},b.set=function(a,b,c){return a&&a.matrix?this.setVector(a,b):a&&"number"==typeof a.x&&"number"==typeof a.y?this.setXYZ(a.x,a.y,a.z):a&&Array.isArray(a)?this.setArray(a,b):this.setXYZ(a,b,c)},b.setXYZ=function(a,b,c){var d=this.matrix;return d[0]=a||0,d[1]=b||0,d[2]=c||0,this},b.setVector=function(a,b){return this.setArray(a.matrix,b)},b.setArray=function(a,b){for(var c=b||a.length,d=this.matrix;c--;)d[c]=a[c];return this},b.equals=function(a,b,c){var d=null,e=0,f=this.matrix;if(a&&Array.isArray(a)){for(e=b||a.length;e--;)if(f[e]!==a[e])return!1;return!0}if(a&&a.matrix){for(d=a.matrix,e=b||d.length;e--;)if(f[e]!==d[e])return!1;return!0}return!("number"!=typeof a||f[0]!==a||"number"==typeof b&&f[1]!==b||"number"==typeof c&&f[2]!==c)},b.magnitude=function(a){var b=0,c=0;for(a=a||this.matrix.length,c=0;c<a;c++)b+=Math.pow(this.matrix[c],2);return Math.sqrt(b)},b.getAngle=function(){var a=this.magnitude(2),b=0;return 0!==a&&(b=Math.acos(this.x/a),this.y<0&&(b=2*Math.PI-b)),b},b.getUnit=function(){return platypus.Vector.setUp(this).normalize()},b.getInverse=function(){return platypus.Vector.setUp(this).multiply(-1)},b.normalize=function(){var a=this.magnitude();return 0===a?this:this.multiply(1/a)},b.cross=function(){var a=function(a,b,c,d){return a*d-b*c};return function(b){var c=a(this.y,this.z,b.y,b.z),d=-a(this.x,this.z,b.x,b.z),e=a(this.x,this.y,b.x,b.y);return this.x=c,this.y=d,this.z=e,this}}(),b.getCrossProduct=function(a){return platypus.Vector.setUp(this).cross(a)},b.rotate=function(a,b){var c=b,d=null,e=Math.cos(a),f=Math.sin(a),g=1-e,h=0,i=0,j=0,k=platypus.Vector.setUp();return c?"x"===c?c=k.setXYZ(1,0,0):"y"===c?c=k.setXYZ(0,1,0):"z"===c&&(c=k.setXYZ(0,0,1)):c=k.setXYZ(0,0,1),h=c.x,i=c.y,j=c.z,d=Array.setUp(Array.setUp(e+h*h*g,h*i*g-j*f,h*j*g+i*f),Array.setUp(i*h*g+j*f,e+i*i*g,i*j*g-h*f),Array.setUp(j*h*g-i*f,j*i*g+h*f,e+j*j*g)),this.multiply(d),k.recycle(),d.recycle(2),this},b.multiply=function(a,b){var c=0,d=0,e=null,f=0;if(Array.isArray(a)){for(e=this.matrix.greenSlice(),f=b||a.length,c=0;c<f;c++)for(this.matrix[c]=0,d=0;d<f;d++)this.matrix[c]+=e[d]*a[c][d];e.recycle()}else for(f=b||this.matrix.length,c=0;c<f;c++)this.matrix[c]*=a;return this},b.add=function(b,c,d){var e=b,f=0,g=0;for(Array.isArray(e)?f=c||this.matrix.length:e instanceof a?(e=e.matrix,f=c||this.matrix.length):(e=[b||0,c||0,d||0],f=this.matrix.length),g=0;g<f;g++)this.matrix[g]+=e[g];return this},b.addVector=function(a,b){return this.add(a,b)},b.subtractVector=function(a,b){return this.add(a.getInverse(),b)},b.scale=function(a,b){return this.multiply(a,b)},b.dot=function(a,b){var c=0,d=0,e=this.matrix,f=a.matrix;for(d=b||e.length;d--;)c+=e[d]*(f[d]||0);return c},b.angleTo=function(a){var b=this.getUnit(),c=a.getUnit(),d=0;return b.magnitude()&&c.magnitude()?d=Math.acos(b.dot(c)):(platypus.debug.warn("Vector: Attempted to find the angle of a zero-length vector."),d=NaN),b.recycle(),c.recycle(),d},b.signedAngleTo=function(a,b){var c=this.getUnit(),d=a.getUnit(),e=c.getCrossProduct(d),f=0;return f=0===e.magnitude()?0:e.dot(b)<0?-Math.acos(c.dot(d)):Math.acos(c.dot(d)),c.recycle(),d.recycle(),e.recycle(),f},b.scalarProjection=function(b){var c=null,d=0;return"number"==typeof b?this.magnitude(2)*Math.cos(b):(c=a.setUp(b).normalize(),d=this.dot(c),c.recycle(),d)},b.copy=function(){return platypus.Vector.setUp(this)},a.assign=function(){var a=function(a,b,c,d){var e=null,f=!1;"string"==typeof a&&void 0!==b[a]&&(e=b[a],delete b[a],f=!0),Object.defineProperty(b,a,{get:function(){return c.matrix[d]},set:function(a){c.matrix[d]=a},enumerable:!0}),f&&(b[a]=e)};return function(b,c){var d=0;if(b&&c){if(!b[c]){for(b[c]=platypus.Vector.setUp(),d=2;d<arguments.length;d++)arguments[d]!==c&&a(arguments[d],b,b[c],d-2);return null}return b[c]}return null}}(),recycle.add(a,!!springroll.Debug,"Vector",function(){this.matrix.length=0,a.recycle(this)}),a}(),platypus.AABB=function(){"use strict";var a=function(b,c,d,e){b instanceof a?this.set(b):(this.empty=!0,this.setAll(b,c,d,e))},b=a.prototype;return b.setAll=function(a,b,c,d){return this.empty=!1,this.x=a,this.y=b,this.resize(c,d),this},b.setBounds=function(a,b,c,d){return this.empty=!1,this.x=(c+a)/2,this.y=(b+d)/2,this.resize(c-a,d-b),this},b.set=function(a){return this.empty=a.empty,this.x=a.x,this.y=a.y,this.width=a.width,this.height=a.height,this.halfWidth=a.halfWidth,this.halfHeight=a.halfHeight,this.left=a.left,this.right=a.right,this.top=a.top,this.bottom=a.bottom,this},b.toString=function(){return"[AABB: "+this.width+"x"+this.height+" ("+this.x+", "+this.y+")]"},b.reset=function(){return this.empty=!0,this},b.resize=function(a,b){var c=a||0,d=b||0,e=c/2,f=d/2;return this.width=c,this.height=d,this.halfWidth=e,this.halfHeight=f,"number"==typeof this.x?(this.left=-e+this.x,this.right=e+this.x):this.empty=!0,"number"==typeof this.y?(this.top=-f+this.y,this.bottom=f+this.y):this.empty=!0,this},b.include=function(a){return this.empty?this.set(a):(this.left>a.left&&(this.left=a.left),this.right<a.right&&(this.right=a.right),this.top>a.top&&(this.top=a.top),this.bottom<a.bottom&&(this.bottom=a.bottom),this.width=this.right-this.left,this.height=this.bottom-this.top,this.halfWidth=this.width/2,this.halfHeight=this.height/2,this.x=this.left+this.halfWidth,this.y=this.top+this.halfHeight),this},b.move=function(a,b){return this.moveX(a),this.moveY(b),this},b.moveX=function(a){return this.x=a,this.left=-this.halfWidth+a,this.right=this.halfWidth+a,this},b.moveY=function(a){return this.y=a,this.top=-this.halfHeight+a,this.bottom=this.halfHeight+a,this},b.moveXBy=function(a){return this.moveX(this.x+a)},b.moveYBy=function(a){return this.moveY(this.y+a)},b.equals=function(a){return!this.empty&&!a.empty&&this.left===a.left&&this.top===a.top&&this.right===a.right&&this.bottom===a.bottom},b.contains=function(a){return a.top>=this.top&&a.bottom<=this.bottom&&a.left>=this.left&&a.right<=this.right},b.containsVector=function(a){return this.containsPoint(a.x,a.y)},b.containsPoint=function(a,b){return b>=this.top&&b<=this.bottom&&a>=this.left&&a<=this.right},b.collides=function(a){return a.bottom>this.top&&a.top<this.bottom&&a.right>this.left&&a.left<this.right},b.collidesPoint=function(a,b){return b>this.top&&b<this.bottom&&a>this.left&&a<this.right},b.intersects=function(a){return a.bottom>=this.top&&a.top<=this.bottom&&a.right>=this.left&&a.left<=this.right},b.getIntersectionArea=function(a){var b=Math.max,c=Math.min;return this.intersects(a)?(c(this.bottom,a.bottom)-b(this.top,a.top))*(c(this.right,a.right)-b(this.left,a.left)):0},recycle.add(a,!!springroll.Debug,"AABB"),a}(),platypus.ActionState=function(){"use strict";var a=include("platypus.Data"),b=include("platypus.StateMap"),c=function(c,d,e){this.event=c,this.trigger=e,this.active=!1,this.wasActive=!1,this.valid=!0,this.wasValid=!0,this.states=b.setUp(d),this.inputs=Array.setUp(),this.stateSummary=a.setUp("pressed",!1,"released",!1,"triggered",!1)},d=function(a){return a},e=c.prototype;return e.update=function(a){var b=this.stateSummary;return this.valid=a.includes(this.states),this.active=this.inputs.some(d),b.pressed=this.valid&&this.active,b.released=this.wasActive&&(!this.valid&&this.wasValid||this.valid&&!this.active),b.triggered=this.valid&&this.active&&!this.wasActive,this.wasValid=this.valid,this.wasActive=this.active,b.pressed||b.released||b.triggered},e.resolve=function(){this.trigger(this.event,this.stateSummary)},recycle.add(c,!!springroll.Debug,"ActionState",function(){this.states.recycle(),this.stateSummary.recycle(),this.inputs.recycle(),c.recycle(this)}),c}(),platypus.CollisionData=function(){"use strict";var a=include("platypus.Vector"),b=function(c){this.vector||(this.vector=a.setUp()),c instanceof b?this.copy(c):this.set.apply(this,arguments)},c=b.prototype;return c.set=function(a,b,c,d,e,f,g,h,i){this.occurred=a||!1,this.direction=b||null,this.position=c||null,this.deltaMovement=d||null,this.aABB=e||null,this.thisShape=f||null,this.thatShape=g||null,this.vector.set(h),this.stuck=i||0},c.copy=function(a){this.occurred=a.occurred,this.direction=a.direction,this.position=a.position,this.deltaMovement=a.deltaMovement,this.aABB=a.aABB,this.thisShape=a.thisShape,this.thatShape=a.thatShape,this.vector.setVector(a.vector),this.stuck=a.stuck},recycle.add(b,!!springroll.Debug,"CollisionData"),b}(),platypus.CollisionDataContainer=function(){"use strict";var a=function(){this.xData||this.yData?this.reset():(this.xData=Array.setUp(),this.yData=Array.setUp(),this.xDeltaMovement=1/0,this.yDeltaMovement=1/0)},b=a.prototype;return b.tryToAddX=function(a){return!(a.deltaMovement>this.xDeltaMovement)&&(a.deltaMovement<this.xDeltaMovement&&this.resetX(a.deltaMovement),this.xData.push(a),!0)},b.tryToAddY=function(a){return!(a.deltaMovement>this.yDeltaMovement)&&(a.deltaMovement<this.yDeltaMovement&&this.resetY(a.deltaMovement),this.yData.push(a),!0)},b.reset=function(){this.resetX(1/0),this.resetY(1/0)},b.resetX=function(a){for(var b=this.xData,c=b.length;c--;)b[c].recycle();b.length=0,this.xDeltaMovement=a},b.resetY=function(a){for(var b=this.yData,c=b.length;c--;)b[c].recycle();b.length=0,this.yDeltaMovement=a},recycle.add(a,!!springroll.Debug,"CollisionDataContainer"),a}(),platypus.CollisionShape=function(){"use strict";var a=include("platypus.AABB"),b=include("platypus.Vector"),c=function(a,b){var c=b.aABB,d=c.halfHeight,e=c.halfWidth,f=Math.abs,g=Math.pow,h=f(a.x-b.x),i=f(a.y-b.y),j=a.radius;return h<e||i<d||h<e+j&&i<d+j&&g(h-e,2)+g(i-d,2)<g(j,2)},d=function(a){var b=Math.pow;return this.aABB.collides(a.aABB)&&("rectangle"===a.type&&c(this,a)||"circle"===a.type&&b(this.x-a.x,2)+b(this.y-a.y,2)<=b(this.radius+a.radius,2))},e=function(){return!1},f=function(a){return this.aABB.collides(a.aABB)&&("rectangle"===a.type||"circle"===a.type&&c(a,this))},g=function(c,g,h){var i=g.regX,j=g.regY,k=g.width||2*g.radius||0,l=g.height||2*g.radius||0,m=g.radius||0,n=g.type||"rectangle";this.initialized||(this.initialized=!0,b.assign(this,"offset","offsetX","offsetY"),b.assign(this,"position","x","y"),b.assign(this,"size","width","height"),this.aABB=a.setUp()),this.owner=c,this.collisionType=h,this.type=n,this.subType="","circle"===n?(k=l=2*m,this.collides=d):this.collides="rectangle"===n?f:e,this.size.setXYZ(k,l),this.radius=m,"number"!=typeof i&&(i=k/2),"number"!=typeof j&&(j=l/2),this.offset.setXYZ(g.offsetX||k/2-i,g.offsetY||l/2-j),c?this.position.setXYZ(c.x,c.y).add(this.offset):this.position.setXYZ(g.x,g.y).add(this.offset),this.aABB.setAll(this.x,this.y,k,l)},h=g.prototype;return h.update=function(a,b){var c=a+this.offsetX,d=b+this.offsetY;this.position.setXYZ(c,d),this.aABB.move(c,d)},h.moveX=function(a){this.x=a,this.aABB.moveX(a)},h.moveY=function(a){this.y=a,this.aABB.moveY(a)},h.moveXY=function(a,b){this.x=a,this.y=b,this.aABB.move(a,b)},h.getAABB=function(){return this.aABB},h.setXWithEntityX=function(a){this.x=a+this.offsetX,this.aABB.moveX(this.x)},h.setYWithEntityY=function(a){this.y=a+this.offsetY,this.aABB.moveY(this.y)},h.multiply=function(a){var b=this.position,c=this.owner.position;b.subtractVector(c),b.multiply(a),this.offset.multiply(a),this.size.multiply(a),b.addVector(c),this.width=Math.abs(this.width),this.height=Math.abs(this.height),this.aABB.setAll(this.x,this.y,this.width,this.height)},h.containsPoint=function(a,b){var c=Math.pow;return this.aABB.containsPoint(a,b)&&("rectangle"===this.type||"circle"===this.type&&c(this.x-a,2)+c(this.y-b,2)<=c(this.radius,2))},h.toJSON=function(){var a={},b=this.size.width,c=this.size.height;return b/2!==this.regX&&(a.regX=this.regX),c/2!==this.regY&&(a.regY=this.regY),this.offset.x!==b/2-this.regX&&(a.offsetX=this.offset.x),this.offset.y!==c/2-this.regY&&(a.offsetY=this.offset.y),"circle"===this.type?a.radius=this.radius:(a.width=b,a.height=c),a.type=this.type,a},recycle.add(g,!!springroll.Debug,"CollisionShape"),g}(),function(){"use strict";var a=include("platypus.Component"),b=include("springroll.Debug",!1),c="",d=0,e=function(){},f=function(a,b,c){Object.defineProperty(b,a,{get:function(){return c[a]},set:function(b){c[a]=b},enumerable:!0})},g=function(a,b){return function(){a.apply(this,arguments),b.apply(this,arguments)}};platypus.components={},platypus.createComponentClass=function(h,i){var j=function(b,c,e){var g="",j="",k="",l="";if(a.call(this,h.id,b),i&&i.call(this),h.properties)for(g in h.properties)h.properties.hasOwnProperty(g)&&(c&&void 0!==c[g]?this[g]=c[g]:void 0!==this.owner[g]?this[g]=this.owner[g]:this[g]=h.properties[g])
  ;if(h.publicProperties)for(g in h.publicProperties)h.publicProperties.hasOwnProperty(g)&&(f(g,this,b),c&&void 0!==c[g]?this[g]=c[g]:void 0!==this.owner[g]?this[g]=this.owner[g]:this[g]=h.publicProperties[g]);if(h.events){d-=1;for(j in h.events)if(h.events.hasOwnProperty(j)&&(this.addEventListener(j,h.events[j],d),c&&c.aliases))for(l in c.aliases)c.aliases.hasOwnProperty(l)&&c.aliases[l]===j&&this.addEventListener(l,h.events[j],d)}if(h.publicMethods)for(j in h.publicMethods)if(h.publicMethods.hasOwnProperty(j)){if(k=j,c&&c.aliases)for(l in c.aliases)c.aliases.hasOwnProperty(l)&&c.aliases[l]===j&&(k=l);this.addMethod(k,h.publicMethods[j])}!this.initialize(c,e)&&e&&e()},k=null,l=j.prototype;if(i){l=extend(j,i);for(c in a.prototype)l[c]?l[c]=g(l[c],a.prototype[c]):l[c]=a.prototype[c]}else l=extend(j,a);if(l.initialize=h.initialize||e,l.toJSON=function(){var a=!1,c=function(b,d){var e=null,f=!1,g="",h=!1,i=0,j=typeof b;if(a||(a=!0,f=!0),"function"===j)h=!0;else if("object"===j&&null!==b)if(b.toJSON)e=d?d.greenSlice():Array.setUp(),e.push(b),c(b.toJSON(),e)||(h=!0);else if(Array.isArray(b))for(i=b.length;i--;){if(d&&d.indexOf(b[i])>=0){h=!0;break}if(e=d?d.greenSlice():Array.setUp(),e.push(b[i]),!c(b[i],e)){h=!0;break}}else for(g in b)if(b.hasOwnProperty(g)){if(d&&d.indexOf(b[g])>=0){h=!0;break}if(e=d?d.greenSlice():Array.setUp(),e.push(b[g]),!c(b[g],e)){h=!0;break}}return d&&d.recycle(),f&&(a=!1),!h};return b?function(b){var d=h.properties,e=h.publicProperties,f={type:this.type},g="";for(g in d)d.hasOwnProperty(g)&&d[g]!==this[g]&&(a||c(this[g])||platypus.debug.warn('Component "'+this.type+'" includes a non-JSON property value for "'+g+'" (type "'+typeof this[g]+'"). You may want to create a custom `toJSON` method for this component.',this[g]),f[g]=this[g]);for(g in e)e.hasOwnProperty(g)&&e[g]!==this.owner[g]&&void 0===b[g]&&(a||c(this.owner[g])||platypus.debug.warn('Component "'+this.type+'" includes a non-JSON public property value for "'+g+'" (type "'+typeof this.owner[g]+'"). You may want to create a custom `toJSON` method for this component.',this.owner[g]),b[g]=this.owner[g]);return f}:function(a){var b=h.properties,c=h.publicProperties,d={type:this.type},e="";for(e in b)b.hasOwnProperty(e)&&b[e]!==this[e]&&(d[e]=this[e]);for(e in c)c.hasOwnProperty(e)&&c[e]!==this.owner[e]&&(a[e]=this.owner[e]);return d}}(),h.methods)for(k in h.methods)h.methods.hasOwnProperty(k)&&("destroy"===k?l._destroy=h.methods[k]:l[k]=h.methods[k]);if(h.publicMethods)for(k in h.publicMethods)h.publicMethods.hasOwnProperty(k)&&(l[k]=h.publicMethods[k]);return j.getAssetList=h.getAssetList||a.getAssetList,j.getLateAssetList=h.getLateAssetList||a.getLateAssetList,platypus.components[h.id]=j,j}}(),function(){"use strict";var a=include("springroll.Application"),b=include("springroll.ApplicationPlugin"),c=include("window.PIXI",!1),d=include("createjs.Tween",!1),e=d?function(a,b,c){b.delta=c,d.tick(c),a.tick(b)}:function(a,b,c){b.delta=c,a.tick(b)},f=new b,g=function(a,b){a.currentScene&&a.currentScene.triggerOnChildren("resize",b)},h=function(){var b=function(a,b){return Math.floor(204*a/b)},d=function(a,c){var d=0,e=0,f=0,g=0,h=0,i=null;return c&&(i=c.greenSplit(".")),c&&3===i.length?(f=parseInt(i[0],10),g=parseInt(i[1],10),h=parseInt(i[2],10)):(f=a.charCodeAt(0)||0,g=a.charCodeAt(1)||0,h=a.charCodeAt(2)||0,e=Math.min(f,g,h),f-=e,g-=e,h-=e),i&&i.recycle(),d=Math.max(f,g,h,1),"color: #ffffff; line-height: 1.5em; border-radius: 6px; background-color: rgb("+b(f,d)+","+b(g,d)+","+b(h,d)+");"},e=function(a,b,c){var e=0,f="",g=Array.setUp(a);for(e=0;e<c.length;e++)f=c[e],g.push(d(f,f.substr(f.lastIndexOf(" ")-f.length+1)),"line-height: 1.5em;");return g};return function(b,f){var g=window.createjs,h=f.options,i=h.author?"by "+h.author:"",j=c,k=f.name||document.title||"",l="Platypus "+platypus.version,m=h.version||"(?)",n=Array.setUp(),o=Array.setUp(),p=platypus.supports;h.hideHello||(n=Array.setUp("SpringRoll "+a.version),j&&(n.push("Pixi.js "+j.VERSION),j.animate&&n.push("PixiAnimate "+j.animate.VERSION)),g&&(g.EaselJS&&n.push("EaselJS "+g.EaselJS.version),g.PreloadJS&&n.push("PreloadJS "+g.PreloadJS.version),g.SoundJS&&n.push("SoundJS "+g.SoundJS.version),g.TweenJS&&n.push("TweenJS "+g.TweenJS.version)),"(?)"!==m&&(k+=" "+m),p.firefox||p.chrome?(console.log("%c "+k+" %c "+i,d(k,k.substr(k.lastIndexOf(" ")-k.length+1)),"line-height: 1.5em;"),n.push(l),o=e("Using %c "+n.join(" %c %c ")+" %c ",k,n),console.log.apply(console,o),o.recycle()):console.log('--- "'+k+'" '+i+" - Using "+n.join(", ")+", and "+l+" ---"),n.recycle()),platypus.debug.olive("Game config loaded.",b)}}(),i=function(a){var b=null,c=null,d=null,e={};for(b in a)if(a[b].id)e[b]=a[b];else{c=i(a[b]);for(d in c)c.hasOwnProperty(d)&&(e[d]=c[d])}return e},j=function(a){var b="";for(b in a)a.hasOwnProperty(b)&&(a[b].id=b)};c&&c.utils.skipHello(),f.setup=function(){var a="",b=document.getElementsByName("author"),c=this.options;b.length&&(a=b[0].getAttribute("content")||""),c.add("author",a,!0),c.add("hideHello",!1,!0)},f.preload=function(a){var b=this.config.platypus||this.config,c=null,d={delta:0},f=!1;b?(this.options.debug&&(b.debug=!0),h(b,this),b.entities=i(b.entities),b.spriteSheets&&j(b.spriteSheets),c=this.platypusGame=new platypus.Game(b,this),Object.defineProperty(this,"platypus",{get:function(){return f||(platypus.debug.warn("Referencing `.platypus` to access the Platypus game instance on the SpringRoll Application has been deprecated in favor of `.platypusGame`."),f=!0),this.platypusGame}}),e=e.bind(null,c,d),this.on("update",e,320),g=g.bind(null,c),this.on("resize",g)):platypus.debug.warn("PlatypusPlugin: Platypus requires a game configuration."),a()},f.teardown=function(){this.platypusGame&&(this.off("update",e),this.off("resize",g),this.platypusGame.destroy(),delete this.platypusGame)}}(),function(){"use strict";platypus.createComponentClass({id:"EventRender",properties:{animationMap:null,component:null,restart:!0},initialize:function(){var a=function(a,b){this.owner.triggerEvent("play-animation",a,b)},b=function(a,b){this.playAnimation(a,b)};return function(){var c="",d=this.animationMap;for(c in d)d.hasOwnProperty(c)&&(this.component?this.addEventListener(c,b.bind(this.component,d[c],this.restart)):this.addEventListener(c,a.bind(this,d[c],this.restart)))}}(),methods:{toJSON:function(){return null}}})}(),function(){"use strict";var a=include("platypus.AABB"),b=include("PIXI.Circle"),c=include("platypus.Data"),d=include("PIXI.Polygon"),e=include("PIXI.Rectangle"),f={};platypus.createComponentClass({id:"Interactive",properties:{container:null,hitArea:null,hover:!1,relativeToSelf:!1},publicProperties:{buttonMode:!1},initialize:function(){this.pressed=!1,this.camera=a.setUp(),this.hitArea&&(this.container.hitArea=this.setHitArea(this.hitArea))},events:{"camera-update":function(a){this.camera.set(a.viewport)},"handle-render":function(){this.buttonMode!==this.container.buttonMode&&(this.container.buttonMode=this.buttonMode)},"dispatch-event":function(a){this.sprite.dispatchEvent(this.sprite,a.event,a.data)},"input-on":function(){this.removeInputListeners||this.addInputs()},"input-off":function(){this.removeInputListeners&&this.removeInputListeners()}},methods:{addInputs:function(){var a=function(a){var b=a.data,c=b.originalEvent;return void 0!==c.pointerId?"point"+c.pointerId:c.type.substr(0,5)+(b.identifier||0)},b=function(a,b){var d=this.camera,e=this.container,f=null,g=null;e&&b.data.originalEvent&&(g=this.relativeToSelf?e.transform.worldTransform:e.parent.transform.worldTransform,f=c.setUp("event",b.data.originalEvent,"pixiEvent",b,"x",b.data.global.x/g.a+d.left,"y",b.data.global.y/g.d+d.top,"entity",this.owner),this.owner.trigger(a,f),f.recycle())},d=function(c){f[a(c)]=this,b.call(this,"pointerdown",c),c.currentTarget.mouseTarget=!0,this.pressed=!0},e=function(c){var d=a(c);f[d]===this&&(b.call(this,"pointermove",c),this.pressed&&(b.call(this,"pressmove",c),c.currentTarget.mouseTarget=!0))},g=function(a){b.call(this,"pointertap",a)},h=function(a){b.call(this,"pointerout",a)},i=function(a){b.call(this,"pointerover",a)},j=function(c){var d=a(c);f[d]===this&&(f[d]=null,this.pressed&&(b.call(this,"pressup",c),this.pressed=!1),b.call(this,"pointerup",c),c.currentTarget.mouseTarget=!1,c.currentTarget.removeDisplayObject&&c.currentTarget.removeDisplayObject())},k=function(c){var d=a(c);f[d]===this&&(f[d]=null,this.pressed&&(b.call(this,"pressup",c),this.pressed=!1),b.call(this,"pointerupoutside",c),c.currentTarget.mouseTarget=!1,c.currentTarget.removeDisplayObject&&c.currentTarget.removeDisplayObject())},l=function(c){var d=a(c);f[d]===this&&(f[d]=null,this.pressed&&(b.call(this,"pressup",c),this.pressed=!1),b.call(this,"pointercancel",c),c.currentTarget.mouseTarget=!1,c.currentTarget.removeDisplayObject&&c.currentTarget.removeDisplayObject())},m=function(a,b,c,d,e,g,h,i,j){var k="";for(k in f)f.hasOwnProperty(k)&&f[k]===this&&(f[k]=null);a.removeListener("pointerdown",b),a.removeListener("pointerup",c),a.removeListener("pointerupoutside",d),a.removeListener("pointercancel",e),a.removeListener("pointermove",g),a.removeListener("pointertap",h),this.hover&&(a.removeListener("pointerover",i),a.removeListener("pointerout",j)),a.interactive=!1,this.removeInputListeners=null};return function(){var a=this.container,b=null,c=null,f=null,n=null,o=null,p=null,q=null,r=null;a.interactive=!0,b=d.bind(this),n=e.bind(this),o=j.bind(this),p=k.bind(this),q=l.bind(this),r=g.bind(this),a.addListener("pointerdown",b),a.addListener("pointerup",o),a.addListener("pointerupoutside",p),a.addListener("pointercancel",q),a.addListener("pointermove",n),a.addListener("pointertap",r),this.hover&&(c=i.bind(this),f=h.bind(this),a.addListener("pointerover",c),a.addListener("pointerout",f)),this.removeInputListeners=m.bind(this,a,b,o,p,q,n,r,c,f)}}(),setHitArea:function(){var a={};return function(c){var f=null,g="";return g=JSON.stringify(c),f=a[g],f||(f=Array.isArray(c)?new d(c):c.radius?new b(c.x||0,c.y||0,c.radius):new e(c.x||0,c.y||0,c.width||this.owner.width||0,c.height||this.owner.height||0),a[g]=f),f}}(),toJSON:function(){return null},destroy:function(){var a=function(){this.container.parent.removeChild(this.container),this.container=null};return function(){this.removeInputListeners&&this.removeInputListeners(),this.camera.recycle(),this.container.mouseTarget&&this.container.parent&&(this.container.visible=!1,this.container.removeDisplayObject=a.bind(this))}}()},publicMethods:{}})}(),function(){"use strict";var a=include("platypus.StateMap"),b=function(b,d){return"default"===b?c.bind(null,d):f.bind(null,d,a.setUp(b))},c=function(a){return a},d=function(a,b){this.component.playAnimation(a,b)},e=function(a){this.component.stopAnimation(a)},f=function(a,b,c){return!!c.includes(b)&&a},g=function(a,b){this.owner.triggerEvent("play-animation",a,b)},h=function(a){this.owner.triggerEvent("stop-animation",a)};platypus.createComponentClass({id:"StateRender",properties:{animationMap:null,component:null,forcePlayThrough:!1},initialize:function(){var a="",c="",f=this.animationMap;this.followThroughs={},this.checkStates=Array.setUp(),this.state=this.owner.state,this.stateChange=!0,this.lastState=-1;for(a in f)f.hasOwnProperty(a)&&(c=f[a],"!"===c[c.length-1]?(c=c.substring(0,c.length-1),this.followThroughs[c]=!0):this.followThroughs[c]=!1,this.checkStates.push(b(a,c)));this.waitingAnimation=!1,this.waitingState=0,this.playWaiting=!1,this.animationFinished=!1,this.component?(this.playAnimation=d,this.stopAnimation=e):(this.playAnimation=g,this.stopAnimation=h)},events:{"state-changed":function(){this.stateChange=!0},"animation-ended":function(a){a===this.currentAnimation&&(this.waitingAnimation?(this.currentAnimation=this.waitingAnimation,this.waitingAnimation=!1,this.lastState=this.waitingState,this.animationFinished=!1,this.playAnimation(this.currentAnimation)):this.animationFinished=!0)},"update-animation":function(a){var b=0,c=!1;if(this.stateChange){if(this.state.has("visible")&&(this.visible=this.state.get("visible")),this.checkStates)for(b=0;b<this.checkStates.length;b++)if(c=this.checkStates[b](this.state)){this.currentAnimation!==c?!this.followThroughs[this.currentAnimation]&&(!this.forcePlaythrough||this.animationFinished||this.lastState>=+b)?(this.currentAnimation=c,this.lastState=+b,this.animationFinished=!1,a?this.playAnimation(this.currentAnimation):this.stopAnimation(this.currentAnimation)):(this.waitingAnimation=c,this.waitingState=+b):this.waitingAnimation&&!this.followThroughs[this.currentAnimation]&&(this.waitingAnimation=!1);break}this.stateChange=!1}}},methods:{toJSON:function(){return null},destroy:function(){this.checkStates.recycle(),this.followThroughs=null,this.state=null}},publicMethods:{}})}(),function(){"use strict";var a=include("platypus.Vector");platypus.createComponentClass({id:"AIChaser",properties:{accelerate:!1,chasing:!0},publicProperties:{speed:.3},initialize:function(){this.target=this.owner.target||null,this.offset=a.setUp(0,0),this.state=this.owner.state,this.state.set("chasing",!1)},events:{load:function(){if(!this.owner.addMover)return void platypus.debug.warn('The "AIChaser" component requires a "Mover" component to function correctly.');this.direction=this.owner.addMover({vector:[this.speed,0,0],event:"chase",accelerator:this.accelerate}).vector},"handle-ai":function(){var b=null,c=0,d=!1;this.target&&this.chasing&&(b=a.setUp(this.offset).add(this.target.position).subtractVector(this.owner.position),c=b.magnitude(2),c&&(d=!0,this.direction.setVector(b).normalize().multiply(this.speed)),b.recycle()),d!==this.state.get("chasing")&&(this.state.set("chasing",d),this.owner.triggerEvent("chase",d))},"set-target":function(a){this.target=a,this.offset.x=0,this.offset.y=0},"set-target-offset":function(a){this.offset.x=a.x,this.offset.y=a.y},"start-chasing":function(a){a&&(this.target=a),this.chasing=!0},"stop-chasing":function(){this.chasing=!1}},methods:{destroy:function(){this.target=null,this.offset.recycle(),this.state=null}}})}(),function(){"use strict";platypus.createComponentClass({id:"AIPacer",properties:{movement:"both",direction:null},initialize:function(){this.lastDirection="",this.currentDirection=this.direction||("horizontal"===this.movement?"left":"up")},events:{"handle-ai":function(){this.currentDirection!==this.lastDirection&&(this.lastDirection=this.currentDirection,this.owner.triggerEvent("stop"),this.owner.triggerEvent("go-"+this.currentDirection))},"turn-around":function(a){"both"!==this.movement&&"horizontal"!==this.movement||(a.x>0?this.currentDirection="left":a.x<0&&(this.currentDirection="right")),"both"!==this.movement&&"vertical"!==this.movement||(a.y>0?this.currentDirection="up":a.y<0&&(this.currentDirection="down"))}}})}(),function(){"use strict";var a=include("platypus.Data"),b=include("platypus.StateMap"),c={interrupt:createjs.Sound.INTERRUPT_ANY,delay:0,offset:0,loop:0,volume:1,pan:0,mute:!1,paused:!1},d=function(b){var d="",e=null,f=function(a){a.audio&&!this.owner.destroyed&&(this.removeClip(a.audio),this.owner.triggerEvent("clip-complete")),a.recycle()};return"string"==typeof b?(d=b,e={}):(d=b.sound,e={interrupt:b.interrupt,delay:b.delay,offset:b.offset,loop:b.loop,volume:b.volume,pan:b.pan,startTime:b.startTime,duration:b.duration,mute:b.mute,paused:b.paused}),function(b){var g=null;b=b||e,g=a.setUp("interrupt",b.interrupt||e.interrupt||c.interrupt,"delay",b.delay||e.delay||c.delay,"loop",b.loop||e.loop||c.loop,"offset",b.offset||e.offset||c.offset,"volume",void 0!==b.volume?b.volume:void 0!==e.volume?e.volume:c.volume,"pan",b.pan||e.pan||c.pan,"mute",b.mute||e.mute||c.mute,"paused",b.paused||e.paused||c.paused),g.complete=f.bind(this,g),g.audio=this.player.play(d,g),g.audio&&(g.audio.soundId=d,this.activeAudioClips.push(g.audio))}},e=function(a,b,c,d){var e=d.includes(a.states);e!==a.playing&&(e?c():this.stopAudio(b,this.forcePlaythrough),a.playing=e)};platypus.createComponentClass({id:"AudioSFX",properties:{audioMap:null,forcePlayThrough:!0,eventBased:!0,stateBased:!1},initialize:function(a){var b="",c=null,e=null;if(this.activeAudioClips=Array.setUp(),this.state=this.owner.state,this.stateChange=!1,this.player=platypus.game.app.sound,a.audioMap){this.stateBased&&(this.checkStates=Array.setUp());for(b in a.audioMap)a.audioMap.hasOwnProperty(b)&&(e=a.audioMap[b],c=d(e),e.sound&&(e=e.sound),this.eventBased&&this.addEventListener(b,c),this.stateBased&&this.addStateCheck(b,e,c))}this.paused=!1},events:{"handle-render":function(){var a=0,b=null,c=this.state;if(!this.paused&&this.stateBased&&this.stateChange){for(b=this.checkStates,a=b.length;a--;)b[a].check(c);this.stateChange=!1}},"state-changed":function(){this.stateChange=!0},"toggle-mute":function(a){this.handleClip(a,function(a){a&&(a.unmuted?(a.volume=a.unmuted,delete a.unmuted):(a.unmuted=a.volume,a.volume=0))})},"stop-audio":function(a){a?"string"==typeof a?this.stopAudio(a):this.stopAudio(a.audioId||!1,a.playthrough||!1):this.stopAudio()},"mute-audio":function(a){this.handleClip(a,function(a){a&&(a.unmuted=a.volume,a.volume=0)})},"unmute-audio":function(a){this.handleClip(a,function(a){a&&(a.volume=a.unmuted,delete a.unmuted)})},"pause-audio":function(a){this.handleClip(a,function(a){a&&a.pause()})},"unpause-audio":function(a){this.handleClip(a,function(a){a&&a.unpause()})},"set-pan":function(a,b){var c=b||"",d=function(a,b){b&&(b.pan=a)};b?this.handleClip(c,d.bind(null,a)):this.getAllClips(d.bind(null,a))},"set-volume":function(a,b){var c=b||"",d=function(a,b){b&&(b.volume=a)};b?this.handleClip(c,d.bind(null,a)):this.getAllClips(d.bind(null,a))}},methods:{handleClip:function(a,b){"string"==typeof a?this.getClipById(a,b):this.getAllClips(b)},getClipById:function(a,b){var c=0,d=this.activeAudioClips;for(c=0;c<d.length;c++)if(d[c].soundId===a)return b&&b(d[c]),d[c];return b&&b(null),null},getAllClips:function(a){var b=0,c=this.activeAudioClips;if(a)for(b=0;b<c.length;b++)a(c[b]);return c},stopAudio:function(){var a=function(a){this.stopAudioInstance(a.currentTarget)};return function(b,c){var d=this.activeAudioClips,e=a.bind(this),f=d.length;if(b)for(;f--;)d[f].soundId===b&&(d[f].playthrough||c?d[f].addEventListener("loop",e):(d[f].stop(),d.greenSplice(f)));else{for(;f--;)c||d[f].playthrough?d[f].addEventListener("loop",e):d[f].stop();d.length=0}}}(),stopAudioInstance:function(a){var b=this.activeAudioClips,c=b?b.indexOf(a):-1;c>=0&&b.greenSplice(c),a.stop()},removeClip:function(a){var b=this.activeAudioClips.indexOf(a);b>=0&&this.activeAudioClips.greenSplice(b)},addStateCheck:function(c,d,f){var g=b.setUp(c),h=a.setUp("states",g,"playing",!1);h.check=e.bind(this,h,d,f.bind(this)),this.checkStates.push(h)},destroy:function(){var a=this.checkStates,b=null,c=0;if(this.stopAudio(),this.activeAudioClips.recycle(),this.activeAudioClips=null,this.state=null,a){for(c=a.length;c--;)b=a[c],b.states.recycle(),b.recycle();a.recycle(),this.checkStates=null}}}})}(),function(){"use strict";var a=include("platypus.Data"),b=function(a,b){return a.time-b.time},c=function(c,d){var e=0;for(e=0;e<c.length;e++)d.push(a.setUp("event",c[e].event,"time",c[e].time||0,"message",c[e].message));return e&&d.sort(b),d},d=function(c,d,e){var f=0,g=e.getElapsed();for(f=0;f<c.length;f++)d.push(a.setUp("event",c[f].event,"time",(c[f].time||0)+g,"message",c[f].message||null));f&&d.sort(b)},e=function(a,b,c){var e=0,f=Array.setUp();for(e=0;e<a.length;e++)a[e].sound?(a[e].events&&f.push(d.bind(this,a[e].events,b,c)),f.push(a[e].sound)):f.push(a[e]);return f},f=function(a,b){this.playingAudio=!1,this.player.unloadSound(),this.owner.destroyed||(this.checkTimeEvents(!0),this.owner.triggerEvent("sequence-complete")),b.recycle()},g=function(a,b){var d=null,g=Array.setUp(),h=this.player;"string"==typeof a?d=Array.setUp(a):Array.isArray(a)?d=e(a,g,h):(a.events&&c(a.events,g),d=Array.isArray(a.sound)?e(a.sound,g,h):Array.setUp(a.sound)),b&&b.events&&c(b.events,g),h.play(d,f.bind(this,!0,d),f.bind(this,!1,d)),this.eventList.recycle(),this.eventList=g,this.playingAudio=!0};platypus.createComponentClass({id:"AudioVO",properties:{audioMap:null},initialize:function(){var a="";if(this.eventList=Array.setUp(),this.playingAudio=!1,this.player=platypus.game.app.voPlayer,this.player.trackSound=platypus.supports.iOS,this.audioMap)for(a in this.audioMap)this.audioMap.hasOwnProperty(a)&&this.addEventListener(a,g.bind(this,this.audioMap[a]));this.paused=!1},events:{"handle-render":function(){this.paused||this.checkTimeEvents(!1)},"stop-audio":function(){this.player.stop(),this.player.voList=[]}},methods:{checkTimeEvents:function(a){var b=null,c=this.eventList,d=0,e=this.owner;if(c&&c.length)for(d=this.player.getElapsed();c.length&&(a||c[0].time<=d);)b=c.greenSplice(0),e.trigger(b.event,b.message),b.recycle()},destroy:function(){this.playingAudio&&(this.player.stop(),this.player.voList=[]),this.eventList.recycle()}}})}(),function(){"use strict";var a=window.devicePixelRatio||1,b=include("platypus.AABB"),c=include("platypus.Data"),d=include("platypus.Vector"),e=function(a,c,d,e){var f=b.setUp(e.x+c,e.y+d,e.width,e.height),g=a.x,h=a.y;return f.top<a.top?h-=a.top-f.top:f.bottom>a.bottom&&(h+=a.bottom-f.bottom),f.left<a.left?g-=a.left-f.left:f.right>a.right&&(g+=a.right-f.right),f.recycle(),this.move(g,h,0)},f=function(){return!1},g=function(a){return a.clientX?a.clientX:a.touches&&a.touches[0]&&a.touches[0].clientX?a.touches[0].clientX:0},h=function(a){return a.clientY?a.clientY:a.touches&&a.touches[0]&&a.touches[0].clientY?a.touches[0].clientY:0};platypus.createComponentClass({id:"Camera",properties:{width:0,height:0,mode:"static",overflow:!1,stretch:!1,threshold:1,rotate:!1,x:0,y:0},publicProperties:{canvas:null,transitionX:400,transitionY:600,transitionAngle:600},initialize:function(a){var d=b.setUp(this.x,this.y,this.width,this.height),e=c.setUp("viewport",d,"orientation",a.orientation||0);this.viewport=b.setUp(0,0,0,0),this.worldCamera=e,this.worldDimensions=b.setUp(),this.message=c.setUp("viewport",b.setUp(),"scaleX",0,"scaleY",0,"orientation",0,"stationary",!1,"world",this.worldDimensions),this.cameraLoadedMessage=c.setUp("viewport",this.message.viewport,"world",this.worldDimensions),this.worldIsLoaded=!1,this.following=null,this.state="static","pan"===this.mode&&(this.state="mouse-pan"),this.boundingBox=b.setUp(d.x,d.y,d.width/2,d.height/2),this.lastX=d.x,this.lastY=d.y,this.lastOrientation=e.orientation,this.forwardX=0,this.forwardY=0,this.forwardAngle=0,this.averageOffsetX=0,this.averageOffsetY=0,this.averageOffsetAngle=0,this.offsetX=0,this.offsetY=0,this.offsetAngle=0,this.forwardFollower=c.setUp("x",this.lastX,"y",this.lastY,"orientation",this.lastOrientation),this.lastFollow=c.setUp("entity",null,"mode",null,"offsetX",0,"offsetY",0,"begin",0),this.xMagnitude=0,this.yMagnitude=0,this.xWaveLength=0,this.yWaveLength=0,this.xShakeTime=0,this.yShakeTime=0,this.shakeTime=0,this.shakeIncrementor=0,this.direction=!0,this.stationary=!1,this.viewportUpdate=!1,this.owner.container?this.parentContainer=this.owner.container:this.owner.stage?(this.canvas=this.canvas||platypus.game.app.display.canvas,this.parentContainer=this.owner.stage,this.owner.width=this.canvas.width,this.owner.height=this.canvas.height):platypus.debug.warn("Camera: There appears to be no Container on this entity for the camera to display."),this.container=new PIXI.Container,this.container.visible=!1,this.parentContainer.addChild(this.container),this.movedCamera=!1},events:{load:function(){this.resize()},"render-world":function(a){this.world=a.world,this.container.addChild(this.world)},"child-entity-added":function(a){this.viewportUpdate=!0,this.worldIsLoaded&&a.triggerEvent("camera-loaded",this.cameraLoadedMessage)},"child-entity-updated":function(a){this.viewportUpdate=!0,this.worldIsLoaded&&a.triggerEvent("camera-update",this.message)},"world-loaded":function(a){this.message.viewport.set(this.worldCamera.viewport),this.worldDimensions.set(a.world),this.worldIsLoaded=!0,a.camera&&this.follow(a.camera),this.owner.triggerEventOnChildren&&this.owner.triggerEventOnChildren("camera-loaded",this.cameraLoadedMessage),this.updateMovementMethods()},pointerdown:function(a){var b=this.worldCamera.viewport;"mouse-pan"===this.state&&(this.mouseVector||(this.mouseVector=d.setUp(),this.mouseWorldOrigin=d.setUp()),this.mouse=this.mouseVector,this.mouse.x=g(a.event),this.mouse.y=h(a.event),this.mouseWorldOrigin.x=b.x,this.mouseWorldOrigin.y=b.y,a.pixiEvent.stopPropagation())},pressmove:function(b){this.mouse&&this.move(this.mouseWorldOrigin.x+(this.mouse.x-g(b.event))*a/this.world.transform.worldTransform.a,this.mouseWorldOrigin.y+(this.mouse.y-h(b.event))*a/this.world.transform.worldTransform.d)&&(this.viewportUpdate=!0,this.movedCamera=!0,b.pixiEvent.stopPropagation())},pressup:function(a){this.mouse&&(this.mouse=null,this.movedCamera&&(this.movedCamera=!1,a.pixiEvent.stopPropagation()))},tick:function(a){var b=this.message,c=b.viewport,d=this.worldCamera;"following"===this.state&&this.followingFunction(this.following,a.delta)&&(this.viewportUpdate=!0),this.canvas&&(this.owner.width=this.canvas.width,this.owner.height=this.canvas.height),this.owner.width===this.lastWidth&&this.owner.height===this.lastHeight||(this.resize(),this.lastWidth=this.owner.width,this.lastHeight=this.owner.height),this.viewportUpdate?(this.viewportUpdate=!1,this.stationary=!1,b.stationary=!1,c.set(d.viewport),this.shakeIncrementor<this.shakeTime&&(this.viewportUpdate=!0,this.shakeIncrementor+=a.delta,this.shakeIncrementor=Math.min(this.shakeIncrementor,this.shakeTime),this.shakeIncrementor<this.xShakeTime&&c.moveX(c.x+Math.sin(this.shakeIncrementor/this.xWaveLength*(2*Math.PI))*this.xMagnitude),this.shakeIncrementor<this.yShakeTime&&c.moveY(c.y+Math.sin(this.shakeIncrementor/this.yWaveLength*(2*Math.PI))*this.yMagnitude)),b.scaleX=this.windowPerWorldUnitWidth,b.scaleY=this.windowPerWorldUnitHeight,b.orientation=d.orientation,this.world.setTransform(-c.x,-c.y,1,1,0),this.container.setTransform(c.halfWidth*b.scaleX,c.halfHeight*b.scaleY,b.scaleX,b.scaleY,b.orientation),this.container.visible=!0,this.owner.triggerEvent("camera-update",b),this.owner.triggerEventOnChildren&&this.owner.triggerEventOnChildren("camera-update",b)):this.stationary||(this.stationary=!0,b.stationary=!0,this.owner.triggerEvent("camera-update",b),this.owner.triggerEventOnChildren&&this.owner.triggerEventOnChildren("camera-update",b)),this.lastFollow.begin&&this.lastFollow.begin<Date.now()&&this.follow(this.lastFollow)},"resize-camera":function(a){this.width=a.width,this.height=a.height,this.resize()},relocate:function(){var a=function(a){this.move(a.x,a.y)&&(this.viewportUpdate=!0)},b=function(){this.recycle()};return function(c){var e=null,f=this.worldCamera.viewport;c.time&&window.createjs&&createjs.Tween?(e=d.setUp(f.x,f.y),createjs.Tween.get(e).to({x:c.x,y:c.y},c.time,c.ease).on("change",a.bind(this,e)).call(b.bind(e))):this.move(c.x,c.y)&&(this.viewportUpdate=!0)}}(),follow:function(a){this.follow(a)},shake:function(a){var b=a||{},c=b.xMagnitude||0,d=b.yMagnitude||0,e=b.xFrequency||0,f=b.yFrequency||0,g=1e3,h=b.time||0;this.viewportUpdate=!0,this.shakeIncrementor=0,this.xMagnitude=c,this.yMagnitude=d,0===e?(this.xWaveLength=1,this.xShakeTime=0):(this.xWaveLength=g/e,this.xShakeTime=Math.ceil(h/this.xWaveLength)*this.xWaveLength),0===f?(this.yWaveLength=1,this.yShakeTime=0):(this.yWaveLength=g/f,this.yShakeTime=Math.ceil(h/this.yWaveLength)*this.yWaveLength),this.shakeTime=Math.max(this.xShakeTime,this.yShakeTime)}},methods:{follow:function(a){var b=.1;switch(a.time?(this.lastFollow.begin||(this.lastFollow.entity=this.following,this.lastFollow.mode=this.mode,this.lastFollow.offsetX=this.offsetX,this.lastFollow.offsetY=this.offsetY),this.lastFollow.begin=Date.now()+a.time):this.lastFollow.begin&&(this.lastFollow.begin=0),this.mode=a.mode,a.mode){case"locked":this.state="following",this.following=a.entity,this.followingFunction=this.lockedFollow,this.offsetX=a.offsetX||0,this.offsetY=a.offsetY||0,this.offsetAngle=a.offsetAngle||0;break;case"forward":this.state="following",this.followFocused=!1,this.following=a.entity,this.lastX=a.entity.x-a.offsetX||0,this.lastY=a.entity.y-a.offsetY||0,this.lastOrientation=a.entity.orientation||0,this.forwardX=a.movementX||this.transitionX*b,this.forwardY=a.movementY||this.transitionY*b,this.averageOffsetX=0,this.averageOffsetY=0,this.averageOffsetAngle=0,this.offsetX=a.offsetX||0,this.offsetY=a.offsetY||0,this.offsetAngle=a.offsetAngle||0,this.followingFunction=this.forwardFollow;break;case"bounding":this.state="following",this.following=a.entity,this.offsetX=a.offsetX||0,this.offsetY=a.offsetY||0,this.offsetAngle=a.offsetAngle||0,this.boundingBox.setAll(a.x,a.y,a.width,a.height),this.followingFunction=this.boundingFollow;break;case"anchor-bound":this.state="following",this.following=a.entity,this.followingFunction=e.bind(this,a.anchorAABB,a.offsetX||0,a.offsetY||0);break;case"pan":this.state="mouse-pan",this.following=null,this.followingFunction=null,a&&"number"==typeof a.x&&"number"==typeof a.y&&(this.move(a.x,a.y,a.orientation||0),this.viewportUpdate=!0);break;default:this.state="static",this.following=null,this.followingFunction=null,a&&"number"==typeof a.x&&"number"==typeof a.y&&(this.move(a.x,a.y,a.orientation||0),this.viewportUpdate=!0)}a.begin&&(a.begin=0)},move:function(a,b,c){var d=this.moveX(a);return d=this.moveY(b)||d,this.rotate&&(d=this.reorient(c||0)||d),d},moveX:f,moveY:f,reorient:function(a){var b=this.worldCamera;return Math.abs(b.orientation-a)>1e-4&&(b.orientation=a,!0)},lockedFollow:function(){var a=Math.min,b=function(a,b,c){return c*b+(1-c)*a},c=function(b,c){return b?a(c/b,1):1};return function(a,d){var e=this.worldCamera,f=e.viewport,g=b(f.x,a.x+this.offsetX,c(this.transitionX,d)),h=b(f.y,a.y+this.offsetY,c(this.transitionY,d));return this.rotate?this.move(g,h,b(e.orientation,-(a.orientation||0),c(this.transitionAngle,d))):this.move(g,h,0)}}(),forwardFollow:function(a,b){var c=.9,d=1-c,e=this.forwardFollower,f=!1,g=15,h=g/b,i=this.worldCamera,j=i.viewport,k=a.x+this.offsetX,l=a.y+this.offsetY,m=(a.orientation||0)+this.offsetAngle;return this.followFocused&&this.lastX===k&&this.lastY===l?this.lockedFollow(e,b):(this.averageOffsetX*=c,this.averageOffsetY*=c,this.averageOffsetX+=d*(k-this.lastX)*h,this.averageOffsetY+=d*(l-this.lastY)*h,Math.abs(this.averageOffsetX)>j.width/(2*this.forwardX)&&(this.averageOffsetX=0),Math.abs(this.averageOffsetY)>j.height/(2*this.forwardY)&&(this.averageOffsetY=0),this.rotate&&(this.averageOffsetAngle*=c,this.averageOffsetAngle+=d*(m-this.lastOrientation)*h,Math.abs(this.averageOffsetAngle)>i.orientation/(2*this.forwardAngle)&&(this.averageOffsetAngle=0)),e.x=this.averageOffsetX*this.forwardX+k,e.y=this.averageOffsetY*this.forwardY+l,e.orientation=this.averageOffsetAngle*this.forwardAngle+m,this.lastX=k,this.lastY=l,this.lastOrientation=m,f=this.lockedFollow(e,b),this.followFocused||f||(this.followFocused=!0),f)},boundingFollow:function(a,b){var c=0,d=0,e=this.transitionX?Math.min(b/this.transitionX,1):1,f=1-e,g=this.transitionY?Math.min(b/this.transitionY,1):1,h=1-g,i=this.worldCamera.viewport;return this.boundingBox.move(i.x,i.y),a.x>this.boundingBox.right?c=a.x-this.boundingBox.halfWidth:a.x<this.boundingBox.left&&(c=a.x+this.boundingBox.halfWidth),a.y>this.boundingBox.bottom?d=a.y-this.boundingBox.halfHeight:a.y<this.boundingBox.top&&(d=a.y+this.boundingBox.halfHeight),0!==c&&(c=this.moveX(e*c+f*i.x)),0!==d&&(d=this.moveY(g*d+h*i.y)),c||d},resize:function(){var a=this.width/this.height,b=this.owner.width/this.owner.height,c=this.worldCamera.viewport;this.viewport.setAll(this.owner.width/2,this.owner.height/2,this.owner.width,this.owner.height),this.stretch||(b>a?this.overflow?c.resize(this.height*b,this.height):this.viewport.resize(this.viewport.height*a,this.viewport.height):this.overflow?c.resize(this.width,this.width/b):this.viewport.resize(this.viewport.width,this.viewport.width/a)),
  this.worldPerWindowUnitWidth=c.width/this.viewport.width,this.worldPerWindowUnitHeight=c.height/this.viewport.height,this.windowPerWorldUnitWidth=this.viewport.width/c.width,this.windowPerWorldUnitHeight=this.viewport.height/c.height,this.container.setTransform(this.viewport.x-this.viewport.halfWidth,this.viewport.y-this.viewport.halfHeight),this.viewportUpdate=!0,this.updateMovementMethods()},updateMovementMethods:function(){var a=f,b=function(){var b=this.worldDimensions;return this.worldCamera.viewport.moveX(b.width/2+b.left),this.moveX=a,!0},c=function(){var b=this.worldDimensions;return this.worldCamera.viewport.moveY(b.height/2+b.top),this.moveY=a,!0},d=function(a){var b=this.worldCamera.viewport,c=this.worldDimensions,d=c.width,e=c.left;return Math.abs(b.x-a)>this.threshold&&(a+b.halfWidth>d+e?b.moveX(d-b.halfWidth+e):a<b.halfWidth+e?b.moveX(b.halfWidth+e):b.moveX(a),!0)},e=function(a){var b=this.worldCamera.viewport,c=this.worldDimensions,d=c.height,e=c.top;return Math.abs(b.y-a)>this.threshold&&(a+b.halfHeight>d+e?b.moveY(d-b.halfHeight+e):a<b.halfHeight+e?b.moveY(b.halfHeight+e):b.moveY(a),!0)},g=function(a){var b=this.worldCamera.viewport;return Math.abs(b.x-a)>this.threshold&&(b.moveX(a),!0)},h=function(a){var b=this.worldCamera.viewport;return Math.abs(b.y-a)>this.threshold&&(b.moveY(a),!0)};return function(){var a=this.threshold,f=this.worldCamera.viewport,i=this.worldDimensions,j=i.width,k=i.height;j?j<f.width?this.moveX=b:this.moveX=d:this.moveX=g,k?k<f.height?this.moveY=c:this.moveY=e:this.moveY=h,this.threshold=-1,this.moveX(f.x),this.moveY(f.y),this.threshold=a}}(),destroy:function(){this.parentContainer.removeChild(this.container),this.parentContainer=null,this.container=null,this.mouseVector&&(this.mouseVector.recycle(),this.mouseWorldOrigin.recycle()),this.boundingBox.recycle(),this.viewport.recycle(),this.worldCamera.viewport.recycle(),this.worldCamera.recycle(),this.message.viewport.recycle(),this.message.recycle(),this.cameraLoadedMessage.recycle(),this.worldDimensions.recycle(),this.forwardFollower.recycle(),this.lastFollow.recycle()}},publicMethods:{isOnCanvas:function(a){var b=this.canvas;return!a||!(a.x+a.width<0||a.x>b.width||a.y+a.height<0||a.y>b.height)},windowToWorld:function(a,b,c){var e=c||d.setUp();return e.x=a.x*this.worldPerWindowUnitWidth,e.y=a.y*this.worldPerWindowUnitHeight,!1!==b&&(e.x+=this.worldCamera.viewport.left,e.y+=this.worldCamera.viewport.top),e},worldToWindow:function(a,b,c){var e=c||d.setUp();return e.x=a.x*this.windowPerWorldUnitWidth,e.y=a.y*this.windowPerWorldUnitHeight,!1!==b&&(e.x+=this.viewport.x,e.y+=this.viewport.y),e}}})}(),function(){"use strict";var a=include("platypus.Data");platypus.createComponentClass({id:"CameraFollowMe",properties:{camera:{},mode:"forward",pause:!1},initialize:function(){this.pauseGame=this.pause&&this.camera.time?{time:this.camera.time}:null,this.camera=a.setUp("entity",this.owner,"mode",this.camera.mode||this.mode,"top",this.camera.top,"left",this.camera.left,"offsetX",this.camera.offsetX,"offsetY",this.camera.offsetY,"width",this.camera.width,"height",this.camera.height,"time",this.camera.time)},events:{"follow-me":function(b){var c=null;c=b?a.setUp("entity",this.owner,"mode",b.mode||this.camera.mode,"top",b.top||this.camera.top,"left",b.left||this.camera.left,"offsetX",b.offsetX||this.camera.offsetX,"offsetY",b.offsetY||this.camera.offsetY,"width",b.width||this.camera.width,"height",b.height||this.camera.height,"time",b.time||this.camera.time):a.setUp(this.camera),this.pauseGame&&(this.owner.parent.triggerEvent("pause-logic",this.pauseGame),this.owner.parent.triggerEvent("pause-render",this.pauseGame)),this.owner.parent.triggerEvent("follow",c),c.recycle()}},methods:{destroy:function(){this.camera.recycle()}}})}(),function(){"use strict";var a=include("platypus.AABB"),b=include("platypus.CollisionShape"),c=include("platypus.Data"),d=include("platypus.DataMap"),e=include("platypus.Vector"),f=function(){var a=function(a,b,c,d){d.myType===b&&d.hitType===c&&this.owner.triggerEvent(a,d)},b=function(a,b,c,d){var e=0;if(d.myType===b&&d.hitType===c)for(e=0;e<a.length;e++)this.owner.triggerEvent(a[e],d)},c=function(a,b,c,d){var e=d.x,f=d.y;!d.entity||e||f||(e=d.entity.x-this.owner.x,f=d.entity.y-this.owner.y),d.myType===b&&d.hitType===c&&(f>0&&a.bottom?this.owner.trigger(a.bottom,d):f<0&&a.top&&this.owner.trigger(a.top,d),e>0&&a.right?this.owner.trigger(a.right,d):e<0&&a.left&&this.owner.trigger(a.left,d),a.all&&this.owner.trigger(a.all,d))};return function(d,e,f){return"string"==typeof e?a.bind(d,e,d.collisionType,f):Array.isArray(e)?b.bind(d,e,d.collisionType,f):c.bind(d,e,d.collisionType,f)}}(),g=function(){var b=function(a,b,c){var d=b.keys,e=d.length,f=null;if(c)return f=b.get(c),f?f.getAABB():null;for(a.reset();e--;)a.include(b.get(d[e]).getAABB());return a},f=function(a,b){var c=a.get(b);return c?c.getPreviousAABB():null},g=function(a,b){var c=a.get(b);return c?c.getShapes():null},h=function(a,b){var c=a.get(b);return c?c.getPrevShapes():null},i=function(a,b,c){for(var d=a.keys,e=d.length;e--;)a.get(d[e]).prepareCollision(b,c)},j=function(){var a=function(a,b,c){var d=0,f=b.stuck;f&&(d=a.magnitude(),b.thatShape.owner&&Math.abs(f)>1&&(f*=.05),(!d||d>Math.abs(f))&&(b.vector.x&&(a.x=f,a.y=0),b.vector.y&&(a.x=0,a.y=f),c.stuckWith&&c.stuckWith.recycle(),c.stuckWith=e.setUp(b.thatShape.x,b.thatShape.y)))},b={position:null,unstick:null};return function(c,d){var f=d.xData[0],g=d.yData[0],h=b,i=null;f&&(i=e.setUp(0,0,0),a(i,f,this)),g&&(i=i||e.setUp(0,0,0),a(i,g,this)),h.position=c,h.unstick=i,this.triggerEvent("relocate-entity",h),i&&i.recycle()}}(),k=function(a,b){for(var c=a.keys,d=c.length;d--;)a.get(c[d]).movePreviousX(b)},l=function(){return this.collisionTypes},m=function(){return this.solidCollisionMap},n=function(){return this.getAABB()},o=function(){return this.getPreviousAABB()},p=function(){return this.getShapes()},q=function(){return this.getPrevShapes()},r=function(a,b){this.prepareCollision(a,b)},s=function(a){this.movePreviousX(a)};return function(e,t){var u=t.collisionFunctions;u||(u=t.collisionFunctions=d.setUp(),t.aabb=a.setUp(),t.getAABB=b.bind(t,t.aabb,u),t.getPreviousAABB=f.bind(t,u),t.getShapes=g.bind(t,u),t.getPrevShapes=h.bind(t,u),t.prepareCollision=i.bind(t,u),t.relocateEntity=j.bind(t),t.movePreviousX=k.bind(t,u),t.getCollisionTypes=l.bind(t),t.getSolidCollisions=m.bind(t)),u.set(e.collisionType,c.setUp("getAABB",n.bind(e),"getPreviousAABB",o.bind(e),"getShapes",p.bind(e),"getPrevShapes",q.bind(e),"prepareCollision",r.bind(e),"movePreviousX",s.bind(e)))}}();platypus.createComponentClass({id:"CollisionBasic",properties:{collisionType:"none",shapeType:"rectangle",ignoreOrientation:!1,regX:null,regY:null,width:0,height:0,radius:0,softCollisions:null,solidCollisions:null,margin:0,shapes:null},publicProperties:{immobile:!1,bullet:!1,jumpThrough:!1},initialize:function(c){var h=null,i=0,j="",k=null,l=this.regX,m=this.regY,n=this.width,o=this.height,p=this.radius,q=0,r=0,s=0,t=0;for("number"==typeof this.margin?(q=this.margin,r=this.margin,s=this.margin,t=this.margin):(q=this.margin.left||0,r=this.margin.right||0,s=this.margin.top||0,t=this.margin.bottom||0),null===l&&(l=this.regX=n/2),null===m&&(m=this.regY=o/2),e.assign(this.owner,"position","x","y","z"),e.assign(this.owner,"previousPosition","previousX","previousY","previousZ"),this.owner.previousX=this.owner.previousX||this.owner.x,this.owner.previousY=this.owner.previousY||this.owner.y,this.aabb=a.setUp(),this.prevAABB=a.setUp(),this.shapes?k=this.shapes:"circle"===this.shapeType?(p=p||((n||0)+(o||0))/4,k=[{regX:(isNaN(l)?p:l)-(r-q)/2,regY:(isNaN(m)?p:m)-(t-s)/2,radius:p,type:this.shapeType}]):k=[{regX:(isNaN(l)?(n||0)/2:l)+q,regY:(isNaN(m)?(o||0)/2:m)+s,points:c.points,width:(n||0)+q+r,height:(o||0)+s+t,type:this.shapeType}],this.owner.collisionTypes=this.owner.collisionTypes||Array.setUp(),this.owner.collisionTypes.push(this.collisionType),this.shapes=Array.setUp(),this.prevShapes=Array.setUp(),this.entities=null,i=0;i<k.length;i++)this.shapes.push(b.setUp(this.owner,k[i],this.collisionType)),this.prevShapes.push(b.setUp(this.owner,k[i],this.collisionType)),this.prevAABB.include(this.prevShapes[i].aABB),this.aabb.include(this.shapes[i].aABB);if(g(this,this.owner),this.owner.solidCollisionMap=this.owner.solidCollisionMap||d.setUp(),h=this.owner.solidCollisionMap.set(this.collisionType,Array.setUp()),this.solidCollisions)for(j in this.solidCollisions)this.solidCollisions.hasOwnProperty(j)&&(h.push(j),this.solidCollisions[j]&&this.addEventListener("hit-by-"+j,f(this,this.solidCollisions[j],"solid")));if(this.owner.softCollisionMap=this.owner.softCollisionMap||d.setUp(),h=this.owner.softCollisionMap.set(this.collisionType,Array.setUp()),this.softCollisions)for(j in this.softCollisions)this.softCollisions.hasOwnProperty(j)&&(h.push(j),this.softCollisions[j]&&this.addEventListener("hit-by-"+j,f(this,this.softCollisions[j],"soft")));this.active=!0,this.stuck=!1},events:{"collide-on":function(a){var b=this.owner,c=this.collisionType,d=b.collisionTypes;this.active||"string"==typeof a&&a!==c||(-1===d.indexOf(c)&&d.push(c),b.parent.triggerEvent("add-collision-entity",b),this.active=!0)},"collide-off":function(a){var b=0,c=this.owner,d=c.parent,e=this.collisionType,f=c.collisionTypes;!this.active||"string"==typeof a&&a!==e||(d.triggerEvent("remove-collision-entity",c),b=f.indexOf(e),b>=0&&f.greenSplice(b),this.active=!1,f.length&&d.triggerEvent("add-collision-entity",c))},"relocate-entity":function(a){var b=a.unstick,c=0,d=0,e=0,f=0,g=this.aabb,h=this.owner,i=null,j=this.shapes;for(b&&(c=b.magnitude()),this.move&&(this.move.recycle(),this.move=null),a.relative?h.position.setVector(h.previousPosition).add(a.position):h.position.setVector(a.position),this.stuck&&(c>0?h.position.add(b):this.stuck=!1),e=h.x,f=h.y,g.reset(),d=j.length;d--;)i=j[d],i.update(e,f),g.include(i.aABB);h.previousPosition.setVector(h.position),c>0&&(this.stuck||(this.stuck=!0),this.move=h.stuckWith.copy().add(-e,-f).normalize())},"handle-logic":function(){this.move&&this.owner.position.add(this.move)},"orientation-updated":function(a){var b=0;if(!this.ignoreOrientation)for(b=0;b<this.shapes.length;b++)this.shapes[b].multiply(a)}},methods:{getAABB:function(){return this.aabb},getPreviousAABB:function(){return this.prevAABB},getShapes:function(){return this.shapes},getPrevShapes:function(){return this.prevShapes},prepareCollision:function(a,b){var c=0,d=null,e=this.shapes,f=this.prevShapes,g=this.aabb;for(this.owner.x=a,this.owner.y=b,this.prevShapes=e,this.shapes=f,this.prevAABB.set(g),g.reset(),c=f.length;c--;)d=f[c],d.update(a,b),g.include(d.aABB)},movePreviousX:function(a){var b=0;for(this.prevAABB.moveX(a),b=0;b<this.prevShapes.length;b++)this.prevShapes[b].setXWithEntityX(a)},destroy:function(){var a=this.owner.collisionFunctions,b=this.collisionType,c=this.owner.collisionTypes.indexOf(b),d=this.owner;for(d.parent.triggerEvent("remove-collision-entity",d),this.aabb.recycle(),delete this.aabb,this.prevAABB.recycle(),delete this.prevAABB,c>=0&&d.collisionTypes.greenSplice(c),d.solidCollisionMap.has(b)&&d.solidCollisionMap.delete(b).recycle(),d.softCollisionMap.has(b)&&d.softCollisionMap.delete(b).recycle(),a.delete(b).recycle(),c=this.shapes.length;c--;)this.shapes[c].recycle(),this.prevShapes[c].recycle();this.shapes.recycle(),this.prevShapes.recycle(),delete this.shapes,delete this.prevShapes,delete this.entities,d.collisionTypes.length?d.parent.triggerEvent("add-collision-entity",d):(a.recycle(),d.collisionFunctions=null,d.solidCollisionMap.recycle(),d.solidCollisionMap=null,d.softCollisionMap.recycle(),d.softCollisionMap=null,d.aabb.recycle(),d.aabb=null)}}})}(),function(){"use strict";var a=function(a,b,c){this.state.get(a)&&this.trigger(b,c)},b=function(a,b,c){this.state.get(a)||this.trigger(b,c)};platypus.createComponentClass({id:"CollisionFilter",properties:{collisions:{},state:""},initialize:function(){var c="",d=this.collisions,e=this.state;if(d)if("!"===e[0]){e=e.substring(1);for(c in d)d.hasOwnProperty(c)&&this.addEventListener(c,b.bind(this.owner,e,d[c]))}else for(c in d)d.hasOwnProperty(c)&&this.addEventListener(c,a.bind(this.owner,e,d[c]))}})}(),function(){"use strict";var a=include("platypus.AABB"),b=include("platypus.DataMap"),c=include("platypus.Vector");platypus.createComponentClass({id:"CollisionGroup",initialize:function(){this.solidEntities=Array.setUp(),this.collisionTypes=Array.setUp(),this.shapes=Array.setUp(),this.prevShapes=Array.setUp(),this.terrain=null,this.aabb=a.setUp(this.owner.x,this.owner.y),this.prevAABB=a.setUp(this.owner.x,this.owner.y),this.filteredAABB=a.setUp(),c.assign(this.owner,"position","x","y","z"),c.assign(this.owner,"previousPosition","previousX","previousY","previousZ"),this.owner.previousX=this.owner.previousX||this.owner.x,this.owner.previousY=this.owner.previousY||this.owner.y,this.collisionGroup=this.owner.collisionGroup={getAllEntities:function(){var a=0,b=0,c=null;for(a=0;a<this.solidEntities.length;a++)c=this.solidEntities[a],c!==this.owner&&c.collisionGroup?b+=c.collisionGroup.getAllEntities():b+=1;return b}.bind(this),getSize:function(){return this.solidEntities.length}.bind(this),getCollisionTypes:function(){return this.getCollisionTypes()}.bind(this),getSolidCollisions:function(){return this.getSolidCollisions()}.bind(this),getAABB:function(a){return this.getAABB(a)}.bind(this),getPreviousAABB:function(a){return this.getPreviousAABB(a)}.bind(this),getShapes:function(a){return this.getShapes(a)}.bind(this),getPrevShapes:function(a){return this.getPrevShapes(a)}.bind(this),prepareCollision:function(a,b){return this.prepareCollision(a,b)}.bind(this),relocateEntity:function(a,b){return this.relocateEntity(a,b)}.bind(this),movePreviousX:function(a){return this.movePreviousX(a)}.bind(this),getSolidEntities:function(){return this.solidEntities}.bind(this),jumpThrough:!1}},events:{"child-entity-added":function(a){this.addCollisionEntity(a)},"add-collision-entity":function(a){this.addCollisionEntity(a)},"child-entity-removed":function(a){this.removeCollisionEntity(a)},"remove-collision-entity":function(a){this.removeCollisionEntity(a)},"relocate-entity":function(){this.owner.previousPosition.setVector(this.owner.position),this.updateAABB()}},methods:{addCollisionEntity:function(a){var b=0,c=a.collisionTypes;if(c){for(b=c.length;b--;)a.solidCollisionMap.get(c[b]).length&&!a.immobile&&(this.solidEntities[this.solidEntities.length]=a);this.updateAABB()}},removeCollisionEntity:function(a){var b=0,c=0,d=a.collisionTypes;if(d){for(c=d.length;c--;)a.solidCollisionMap.get(d[c]).length&&(b=this.solidEntities.indexOf(a))>=0&&this.solidEntities.greenSplice(b);this.updateAABB()}},getCollisionTypes:function(){var a=null,b=this.collisionTypes,c=this.solidEntities,d=c.length;for(b.length=0;d--;)a=c[d],a!==this.owner&&a.collisionGroup&&(a=a.collisionGroup),b.union(a.getCollisionTypes());return b},getSolidCollisions:function(){var a=0,c="",d=null,e=null,f=b.setUp(),g=null,h=0,i=null,j=null,k=!1;for(a=0;a<this.solidEntities.length;a++){for(k=!1,e=this.solidEntities[a],e!==this.owner&&e.collisionGroup&&(e=e.collisionGroup,k=!0),g=e.getSolidCollisions(),d=g.keys,h=d.length;h--;)c=d[h],i=f.get(c),j=g.get(c),i||(i=f.set(c,Array.setUp())),i.union(j),k&&j.recycle();k&&g.recycle()}return f},getAABB:function(a){var b=0,c=this.filteredAABB,d=null,e=null,f=this.solidEntities;if(a){for(c.reset(),b=f.length;b--;)d=f[b],d!==this.owner&&d.collisionGroup&&(d=d.collisionGroup),(e=d.getAABB(a))&&c.include(e);return c}return this.aabb},getPreviousAABB:function(a){var b=0,c=this.filteredAABB,d=null,e=null,f=this.solidEntities;if(a){for(c.reset(),b=f.length;b--;)d=f[b],d!==this.owner&&d.collisionGroup&&(d=d.collisionGroup),(e=d.getPreviousAABB(a))&&c.include(e);return c}return this.prevAABB},updateAABB:function(){var a=this.aabb,b=this.solidEntities,c=null,d=b.length,e=this.owner;for(a.reset();d--;)c=b[d],a.include(c!==e&&c.getCollisionGroupAABB?c.getCollisionGroupAABB():c.getAABB())},getShapes:function(a){var b=0,c=null,d=this.shapes,e=null;for(d.length=0,b=0;b<this.solidEntities.length;b++)c=this.solidEntities[b],c!==this.owner&&c.collisionGroup&&(c=c.collisionGroup),(e=c.getShapes(a))&&d.union(e);return d},getPrevShapes:function(a){var b=0,c=null,d=null,e=this.prevShapes;for(e.length=0,b=0;b<this.solidEntities.length;b++)c=this.solidEntities[b],c!==this.owner&&c.collisionGroup&&(c=c.collisionGroup),(d=c.getPrevShapes(a))&&e.union(d);return e},prepareCollision:function(a,b){var c=0,d=null,e=0,f=0;for(c=0;c<this.solidEntities.length;c++)d=this.solidEntities[c],d.saveDX=d.x-d.previousX,d.saveDY=d.y-d.previousY,e=d.saveOX=this.owner.previousX-d.previousX,f=d.saveOY=this.owner.previousY-d.previousY,d!==this.owner&&d.collisionGroup&&(d=d.collisionGroup),d.prepareCollision(a-e,b-f)},movePreviousX:function(a){var b=null,c=0,d=0;for(d=0;d<this.solidEntities.length;d++)b=this.solidEntities[d],c=b.saveOX,b!==this.owner&&b.collisionGroup&&(b=b.collisionGroup),b.movePreviousX(a-c)},relocateEntity:function(a,b){var d=null,e=null,f=0,g=null,h=this.owner,i=this.solidEntities,j=null;for(h.saveDX-=a.x-h.previousX,h.saveDY-=a.y-h.previousY,g=b.xData,f=g.length;f--;)if(g[f].thisShape.owner===h){h.saveDX=0;break}for(g=b.yData,f=g.length;f--;)if(g[f].thisShape.owner===h){h.saveDY=0;break}for(f=0;f<i.length;f++)d=e=i[f],d!==h&&d.collisionGroup&&(d=d.collisionGroup),j=c.setUp(a.x-e.saveOX,a.y-e.saveOY,d.z),d.relocateEntity(j,b),j.recycle(),e.x+=e.saveDX,e.y+=e.saveDY,e!==h&&(e.x+=h.saveDX,e.y+=h.saveDY)},destroy:function(){this.solidEntities.recycle(),this.collisionTypes.recycle(),this.shapes.recycle(),this.prevShapes.recycle(),this.aabb.recycle(),this.prevAABB.recycle(),this.filteredAABB.recycle()}},publicMethods:{getCollisionGroupAABB:function(){return this.getAABB()},getWorldEntities:function(){return this.owner.parent.getWorldEntities()},getWorldTerrain:function(){return this.owner.parent.getWorldTerrain()}}})}(),function(){"use strict";var a=include("platypus.AABB"),b=include("platypus.CollisionShape"),c=include("platypus.Data"),d=536870912,e=2147483648,f=1073741824,g=268435455,h=function(){return this.collisionType},i=function(a){return this.collisionTypeMap[a&g]||this.collisionType},j=function(a){return 0===a?a:a^f^d},k=function(a){return 0===a?a:a^e^d},l=function(a){return 0===a?a:a^e},m=function(a){return 0===a?a:a^f},n=function(a){return 0===a?a:d&a?a^f^d:a^e^d},o=function(a){return 0===a?a:a^e^f},p=function(a){return 0===a?a:d&a?a^e^d:a^f^d},q=function(a,b,c,d,e){var f=0,g=0,h=Array.setUp();for(g=0;g<e;g++)for(h[g]=Array.setUp(),f=0;f<d;f++)h[g][f]=a[b+f][c+g];return h},r=function(a,b,c,d,e){var f=0,g=0,h=Array.setUp();for(g=0;g<e;g++)for(h[g]=Array.setUp(),f=0;f<d;f++)h[g][f]=a[b+f][c+g],a[b+f][c+g]=-1;return h},s=function(a,b,c,d,e,f){var g=0,h=0;for(h=0;h<f;h++)for(g=0;g<e;g++)a[c+g][d+h]=b[h][g];return a},t={diagonal:function(a,b,c,d,e){var f=q(a,b,c,d,e),g=j,h=0,i=0;for(h=0;h<d;h++)for(i=0;i<e;i++)a[b+h][c+i]=g(f[h][i]);return f.recycle(2),a},"diagonal-inverse":function(a,b,c,d,e){var f=q(a,b,c,d,e),g=k,h=0,i=0;for(h=0;h<d;h++)for(i=0;i<e;i++)a[b+d-h-1][c+e-i-1]=g(f[h][i]);return f.recycle(2),a},horizontal:function(a,b,c,d,e){var f=q(a,b,c,d,e),g=l,h=0,i=0;for(i=0;i<e;i++)for(h=0;h<d;h++)a[b+d-h-1][c+i]=g(f[i][h]);return f.recycle(2),a},vertical:function(a,b,c,d,e){var f=q(a,b,c,d,e),g=m,h=0,i=0;for(i=0;i<e;i++)for(h=0;h<d;h++)a[b+h][c+e-i-1]=g(f[i][h]);return f.recycle(2),a},"rotate-90":function(a,b,c,d,e){var f=q(a,b,c,d,e),g=n,h=0,i=0;for(i=0;i<e;i++)for(h=0;h<d;h++)a[b+e-i-1][c+h]=g(f[i][h]);return f.recycle(2),a},"rotate-180":function(a,b,c,d,e){var f=q(a,b,c,d,e),g=o,h=0,i=0;for(i=0;i<e;i++)for(h=0;h<d;h++)a[b+d-h-1][c+e-i-1]=g(f[i][h]);return f.recycle(2),a},"rotate-270":function(a,b,c,d,e){var f=q(a,b,c,d,e),g=p,h=0,i=0;for(i=0;i<e;i++)for(h=0;h<d;h++)a[b+i][c+d-h-1]=g(f[i][h]);return f.recycle(2),a},translate:function(a,b,c,d,e,f,g){var h=r(a,b,c,d,e),i=0,j=0;for(j=0;j<e;j++)for(i=0;i<d;i++)a[b+i+f][c+j+g]=h[j][i];return h.recycle(2),a}};platypus.createComponentClass({id:"CollisionTiles",properties:{collisionTypeMap:null,collisionType:"tiles",top:0,left:0},publicProperties:{collisionMap:[],tileWidth:10,tileHeight:10},initialize:function(){this.tileOffsetLeft=this.tileWidth/2+this.left,this.tileOffsetTop=this.tileHeight/2+this.top,this.columns=this.collisionMap.length,this.rows=this.collisionMap[0].length,this.shapeDefinition=c.setUp("x",0,"y",0,"type","rectangle","width",this.tileWidth,"height",this.tileHeight),this.storedTiles=Array.setUp(),this.serveTiles=Array.setUp(),this.storedTileIndex=0,this.aabb=a.setUp(),this.aabb.setBounds(this.left,this.top,this.tileWidth*this.columns+this.left,this.tileHeight*this.rows+this.top),this.collisionTypeMap?this.getType=i:this.getType=h},events:{transform:function(a){this.transform(a)},translate:function(a){this.translate(a)}},methods:{getShape:function(a,c,d){var e=this.storedTileIndex,f=null,g=this.storedTiles;return e===g.length?(f=b.setUp(null,this.shapeDefinition,d),g.push(f)):(f=g[e],f.collisionType=d),f.update(a*this.tileWidth+this.tileOffsetLeft,c*this.tileHeight+this.tileOffsetTop),this.storedTileIndex+=1,f},addShape:function(a,b,c,h,i){var j=this.collisionMap[c][h],k=j&g,l=268435456,m=d,n=e,o=f;return j&&this.getType(k)===i&&(l&=j,l?(m&=j,n&=j,o&=j,m&&n?b.left>=(c+1)*this.tileWidth+this.left&&a.push(this.getShape(c,h,i)):m?b.right<=c*this.tileWidth+this.left&&a.push(this.getShape(c,h,i)):o?b.top>=(h+1)*this.tileHeight+this.top&&a.push(this.getShape(c,h,i)):b.bottom<=h*this.tileHeight+this.top&&a.push(this.getShape(c,h,i))):a.push(this.getShape(c,h,i))),a},destroy:function(){var a=this.storedTiles,b=a.length;for(this.shapeDefinition.recycle(),delete this.shapeDefinition;b--;)a[b].recycle();a.recycle(),delete this.storedTiles,this.serveTiles.recycle(),delete this.serveTiles,this.aabb.recycle(),delete this.aabb}},publicMethods:{getAABB:function(){return this.aabb},isTile:function(a,b){return!(a<0||b<0||a>=this.columns||b>=this.rows||-1===this.collisionMap[a][b])},getTileShapes:function(a,b,c){var d=c||"tiles",e=this.left,f=this.top,g=this.tileHeight,h=this.tileWidth,i=Math.max(Math.floor((a.left-e)/h),0),j=Math.max(Math.floor((a.top-f)/g),0),k=Math.min(Math.ceil((a.right-e)/h),this.columns),l=Math.min(Math.ceil((a.bottom-f)/g),this.rows),m=0,n=0,o=this.serveTiles;for(o.length=0,this.storedTileIndex=0,m=i;m<k;m++)for(n=j;n<l;n++)this.addShape(o,b,m,n,d);return o},transform:function(a){var b=a||{},c=b.left||0,d=b.top||0,e=b.width||this.rows,f=b.height||this.columns,g=b.type||"horizontal";return t[g]?t[g](this.collisionMap,c,d,e,f):null},translate:function(a){var b=a||{},c=b.left||0,d=b.top||0,e=b.width||this.rows,f=b.height||this.columns,g=b.dx||0,h=b.dy||0;return t.translate(this.collisionMap,c,d,e,f,g,h)},getCollisionMatrix:function(a,b,c,d){return q(this.collisionMap,a,b,c,d)},setCollisionMatrix:function(a,b,c,d,e){return s(this.collisionMap,a,b,c,d,e)}}})}(),function(){"use strict";var a=function(a){this.switches.push(a)};platypus.createComponentClass({id:"ComponentSwitcher",properties:{componentMap:null},initialize:function(){var b="";if(this.switches=Array.setUp(),this.componentMap)for(b in this.componentMap)this.componentMap.hasOwnProperty(b)&&this.addEventListener(b,a.bind(this,b))},events:{"prepare-logic":function(){var a=0;if(this.switches.length){for(a=0;a<this.switches.length;a++)this.switchComponents(this.componentMap[this.switches[a]]);this.switches.length=0}}},methods:{switchComponents:function(a){var b=0,c=0,d=this.owner,e=d.components,f=a.remove,g=a.add;if(f)if(Array.isArray(f))for(b=0;b<f.length;b++)for(c=e.length-1;c>-1;c--)e[c].type===f[b]&&d.removeComponent(e[c]);else for(b=e.length-1;b>-1;b--)e[b].type===f&&d.removeComponent(e[b]);if(g)if(Array.isArray(g))for(b=0;b<g.length;b++)d.addComponent(new platypus.components[g[b].type](d,g[b]));else d.addComponent(new platypus.components[g.type](d,g));d.parent.triggerEvent("child-entity-updated",d),d.triggerEvent("add-remove-component-complete")},destroy:function(){this.switches.recycle()}},getAssetList:function(a,b,c){var d=a.componentMap||b.componentMap||c.componentMap,e="",f=0,g=null,h=Array.setUp(),i=null;for(e in d)if(d.hasOwnProperty(e))for(f=0;f<d[e].add.length;f++)(g=platypus.components[d[e].add[f].type])&&(i=g.getAssetList(d[e].add[f],b,c),h.union(i),i.recycle());return h}})}(),function(){"use strict";var a=include("platypus.Data");platypus.createComponentClass({id:"Counter",publicProperties:{total:0},initialize:function(){this.count=0,this.lastTotal=0,this.lastCount=0,this.message=a.setUp("text","")},events:{"handle-logic":function(){var a=!1,b=this.message;this.total!==this.lastTotal&&(this.lastTotal=this.total,a=!0),this.count!==this.lastCount&&(this.lastCount=this.count,a=!0),a&&(this.total?b.text=String(this.count)+"/"+String(this.total):b.text=String(this.count),this.owner.triggerEvent("update-content",b))},"change-total":function(a){this.total=a},"change-count":function(a){this.count=a},"increment-count":function(){this.count+=1}},methods:{destroy:function(){this.message.recycle()}}})}(),function(){"use strict";var a=include("platypus.Data"),b=include("platypus.Entity"),c=function(a){return function(b,c){this.triggerOnChildren(a,b,c)}};platypus.createComponentClass({id:"EntityContainer",properties:{childEvents:[]},initialize:function(){var a=function(a,b){this.addEntity(a,b)};return function(b,c){var d=0,e=null,f=this.childEvents,g=null;for(this.newAdds=Array.setUp(),e=b.entities&&this.owner.entities?b.entities.concat(this.owner.entities):b.entities||this.owner.entities||null,this.owner.entities=this.entities=Array.setUp(),this.childEvents=Array.setUp(),d=0;d<f.length;d++)this.addNewPublicEvent(f[d]);if(this.addNewPrivateEvent("peer-entity-added"),this.addNewPrivateEvent("peer-entity-removed"),e){for(g=Array.setUp(),d=0;d<e.length;d++)g.push(a.bind(this,e[d]));return platypus.Async.setUp(g,function(){c()}),g.recycle(),!0}return!1}}(),events:{"add-entity":function(a,b){this.addEntity(a,b)},"remove-entity":function(a){this.removeEntity(a)},"child-entity-updated":function(a){this.updateChildEventListeners(a)},"logic-tick":function(){var a=null,b=this.newAdds,c=b.length,d=0,e=null;if(c){for(e=Array.setUp(),d=0;d<c;d++)a=b[d],(a.destroyed||!a.loadingComponents||a.loadingComponents.attemptResolution())&&e.push(d);for(d=e.length;d--;)b.greenSplice(e[d]);e.recycle()}}},methods:{addNewPublicEvent:function(a){var b=0;for(this.addNewPrivateEvent(a),b=0;b<this.childEvents.length;b++)if(this.childEvents[b]===a)return!1;return this.childEvents.push(a),this.addEventListener(a,c(a)),!0},addNewPrivateEvent:function(a){var b=0,c=0;if(this._listeners[a])return!1;for(this._listeners[a]=Array.setUp(),b=0;b<this.entities.length;b++)if(this.entities[b]._listeners[a])for(c=0;c<this.entities[b]._listeners[a].length;c++)this.addChildEventListener(this.entities[b],a,this.entities[b]._listeners[a][c]);return!0},updateChildEventListeners:function(a){this.removeChildEventListeners(a),this.addChildEventListeners(a)},addChildEventListeners:function(a){var b=0,c="";for(c in this._listeners)if(this._listeners.hasOwnProperty(c)&&a._listeners[c])for(b=0;b<a._listeners[c].length;b++)this.addChildEventListener(a,c,a._listeners[c][b])},removeChildEventListeners:function(a){var b=0,c=null,d=null;if(a.containerListener){for(c=a.containerListener.events,d=a.containerListener.messages,b=0;b<c.length;b++)this.removeChildEventListener(a,c[b],d[b]);c.recycle(),d.recycle(),a.containerListener.recycle(),a.containerListener=null}},addChildEventListener:function(b,c,d){b.containerListener||(b.containerListener=a.setUp("events",Array.setUp(),"messages",Array.setUp())),b.containerListener.events.push(c),b.containerListener.messages.push(d),this.on(c,d,d._priority||0)},removeChildEventListener:function(a,b,c){var d=0,e=a.containerListener.events,f=a.containerListener.messages;for(d=0;d<e.length;d++)e[d]!==b||c&&f[d]!==c||this.off(b,f[d])},destroy:function(){for(var a=this.entities.greenSlice(),b=a.length,c=null;b--;)c=a[b],this.removeChildEventListeners(c),c.destroy();a.recycle(),this.entities.recycle(),delete this.owner.entities,this.childEvents.recycle(),this.newAdds.recycle(),this.newAdds=null}},publicMethods:{getEntityById:function(a){var b=0,c=null;for(b=0;b<this.entities.length;b++){if(this.entities[b].id===a)return this.entities[b];if(this.entities[b].getEntityById&&(c=this.entities[b].getEntityById(a)))return c}return null},getEntitiesByType:function(a){var b=0,c=null,d=Array.setUp();for(b=0;b<this.entities.length;b++)this.entities[b].type===a&&d.push(this.entities[b]),this.entities[b].getEntitiesByType&&(c=this.entities[b].getEntitiesByType(a),d.union(c),c.recycle());return d},addEntity:function(){var a=function(a,b){var c=this.owner,d=this.entities,e=d.length;for(b.triggerEvent("adopted",b);e--&&b.triggerEvent("peer-entity-added",d[e]););this.triggerEventOnChildren("peer-entity-added",b),this.addChildEventListeners(b),d.push(b),c.triggerEvent("child-entity-added",b),a&&a(b)};return function(c,d){var e=null,f=this.owner;return c instanceof b?(e=c,e.parent=f,a.call(this,d,e)):(e="string"==typeof c?new b(platypus.game.settings.entities[c],null,a.bind(this,d),f):c.id?new b(c,null,a.bind(this,d),f):new b(platypus.game.settings.entities[c.type],c,a.bind(this,d),f),this.owner.triggerEvent("entity-created",e)),this.newAdds.push(e),e}}(),removeEntity:function(a){var b=this.entities.indexOf(a);return b>=0&&(this.removeChildEventListeners(a),this.entities.greenSplice(b),this.triggerEventOnChildren("peer-entity-removed",a),this.owner.triggerEvent("child-entity-removed",a),a.destroy(),a.parent=null,a)},triggerEventOnChildren:function(a,b,c){return this.destroyed?0:(this._listeners[a]||this.addNewPrivateEvent(a),this.triggerEvent(a,b,c))},triggerOnChildren:function(a){return this.destroyed?0:(this._listeners[a]||this.addNewPrivateEvent(a),this.trigger.apply(this,arguments))}},getAssetList:function(a,c,d){var e=0,f=Array.setUp(),g=Array.setUp(),h=null;for(a.entities&&g.union(a.entities),c&&c.entities?g.union(c.entities):d&&d.entities&&g.union(d.entities),e=0;e<g.length;e++)h=b.getAssetList(g[e]),f.union(h),h.recycle();return g.recycle(),f}},platypus.Messenger)}(),function(){"use strict";var a=include("platypus.ActionState"),b=include("platypus.Data"),c=include("platypus.DataMap"),d=include("platypus.StateMap"),e=function(a,b){var c=b.x-a.x,d=b.y-a.y;return Math.sqrt(c*c+d*d)},f=function(a,b,c){var d=b.x-a.x,e=b.y-a.y,f=0,g=2*Math.PI;return c?(f=Math.acos(d/c),e<0&&(f=g-f),f):f},g=[null,null,null,null,["east","south","west","north"],null,null,null,["east","southeast","south","southwest","west","northwest","north","northeast"],null,null,null,null,null,null,null,["east","east-southeast","southeast","south-southeast","south","south-southwest","southwest","west-southwest","west","west-northwest","northwest","north-northwest","north","north-northeast","northeast","east-northeast"]],h=["left-button","middle-button","right-button"],i=function(a,b){this.paused||this.owner.trigger(a,b)},j=function(a,b,c){!this.paused&&c[a]&&this.owner.trigger(b,c)};platypus.createComponentClass({id:"EntityController",properties:{controlMap:{},joystick:null,stateMaps:{}},publicProperties:{paused:!1},initialize:function(a){var e="",f=null;if(this.actions=c.setUp(),this.stateMaps)for(e in this.stateMaps)this.stateMaps.hasOwnProperty(e)&&(f=d.setUp(e),this.addMap(this.stateMaps[e],e,f),f.recycle());this.addMap(this.controlMap,"default"),a.joystick&&(this.joystick=b.setUp("directions",a.joystick.directions||4,"handleEdge",a.joystick.handleEdge||!1,"innerRadius",a.joystick.innerRadius||0,"outerRadius",a.joystick.outerRadius||1/0))},events:{"handle-controller":function(){for(var a=this.actions,b=a.keys,c=b.length,d="",e=Array.setUp(),f=this.owner.state;c--;)d=a.get(b[c]),d.update(f)&&e.push(d);for(c=e.length;c--;)e[c].resolve();e.recycle()},pointerdown:function(a){
  "mouse"===a.pixiEvent.data.pointerType&&this.owner.triggerEvent("mouse:"+h[a.event.button||0]+":down",a.event),this.joystick&&(this.owner.triggerEvent("joystick:down",a.event),this.handleJoy(a))},pressup:function(a){var b=this.owner;"mouse"===a.pixiEvent.data.pointerType&&b.triggerEvent("mouse:"+h[a.event.button||0]+":up",a.event),this.joystick&&(b.triggerEvent("joystick:up",a.event),b.triggerEvent("stop"))},pressmove:function(a){this.joystick&&this.handleJoy(a)},"pause-controls":function(){this.paused=!0},"unpause-controls":function(){this.paused=!1}},methods:{handleJoy:function(a){var b=this.joystick,c=this.owner,d=Math.PI/(b.directions/2),h=e(c,a),i=0,j="",k="";h>b.outerRadius||h<b.innerRadius||this.paused||(i=f(c,a,h),j=g[b.directions][Math.floor((i+d/2)%(2*Math.PI)/d)],b.handleEdge&&(d=Math.PI/b.directions,(k=g[2*b.directions][Math.floor((i+d/2)%(2*Math.PI)/d)])!==j&&c.triggerEvent(k.replace(j,"").replace("-",""),a)),c.triggerEvent("stop"),c.triggerEvent(j,a),c.triggerEvent("joystick-orientation",i))},addController:function(){var b=function(a){this.inputs[a]=!1},c=function(a){this.inputs[a]=!0};return function(d,e,f,g,h){var k=this.actions,l=e+"-"+f+"-"+(h||"all"),m=k.get(l);m||(m=h?k.set(l,a.setUp(f,g,j.bind(this,h))):k.set(l,a.setUp(f,g,i.bind(this)))),this.addEventListener(d+":up",b.bind(m,m.inputs.length)),this.addEventListener(d+":down",c.bind(m,m.inputs.length)),m.inputs.push(!1)}}(),addMap:function(a,b,c){var d=null,e=0,f="",g="";for(g in a)if(a.hasOwnProperty(g))if("string"==typeof(d=a[g]))this.addController(g,b,d,c);else if(Array.isArray(d))for(e=0;e<d.length;e++)this.addController(g,b,d[e],c);else for(f in d)if(d.hasOwnProperty(f))if("string"==typeof d[f])this.addController(g,b,d[f],c,f);else for(e=0;e<d[f].length;e++)this.addController(g,b,d[f][e],c,f)},destroy:function(){for(var a=this.actions,b=a.keys,c=b.length;c--;)a.get(b[c]).recycle();a.recycle(),this.joystick&&this.joystick.recycle()}}})}(),function(){"use strict";var a=65535,b=include("platypus.AABB"),c=include("platypus.CollisionData"),d=include("platypus.CollisionDataContainer"),e=include("platypus.Data"),f=include("platypus.DataMap"),g=include("platypus.Vector"),h=function(b,c){return b<<16|c&a},i=function(a,b,c){return h(a>>c,b>>c)},j={entity:null,target:null,type:null,x:0,y:0,hitType:null,myType:null},k=function(a,b){return a.collisionGroup.getAllEntities()-b.collisionGroup.getAllEntities()};platypus.createComponentClass({id:"HandlerCollision",properties:{gridBits:8},initialize:function(){this.againstGrid=e.setUp(),this.solidEntitiesLive=Array.setUp(),this.softEntitiesLive=Array.setUp(),this.allEntitiesLive=Array.setUp(),this.groupsLive=Array.setUp(),this.nonColliders=Array.setUp(),this.terrain=null,this.owner.previousX=this.owner.previousX||this.owner.x,this.owner.previousY=this.owner.previousY||this.owner.y,this.relocationMessage=e.setUp("position",g.setUp(),"relative",!1)},events:{"child-entity-added":function(a){a.collideOff||this.addCollisionEntity(a)},"add-collision-entity":function(a){this.addCollisionEntity(a)},"child-entity-removed":function(a){this.removeCollisionEntity(a)},"remove-collision-entity":function(a){this.removeCollisionEntity(a)},"child-entity-updated":function(a){this.removeCollisionEntity(a),this.addCollisionEntity(a)},"check-collision-group":function(a){this.checkCamera(a.camera,a.entities),this.checkGroupCollisions(),this.checkSolidCollisions(),this.resolveNonCollisions(),this.checkSoftCollisions(a)}},methods:{mapDown:function(a){var c=b.setUp(),d=this.gridBits;return c.setBounds(a.left>>d,a.top>>d,a.right>>d,a.bottom>>d)},getAgainstGrid:function(a,b,c){var d=this.mapDown(b),f=null,g=e.setUp(),i=0,j=null,k=this.againstGrid,l=null,m="",n=0,o=0;if(a&&b.equals(a.againstAABB))return this.getEntityAgainstGrid(a,c);for(n=d.left;n<=d.right;n++)for(o=d.top;o<=d.bottom;o++)if(j=k[h(n,o)])for(i=c.length;i--;)m=c[i],(f=j.get(m))&&f.length&&(l=g[m],l?l.union(f):g[m]=Array.setUp.apply(null,f));return d.recycle(),g},getEntityAgainstGrid:function(a,b){for(var c=a.againstGrid,d=null,f=e.setUp(),g=c.length,h=0,i=null,j=null,k="";g--;)for(i=c[g],h=b.length;h--;)k=b[h],(d=i.get(k))&&d.length&&(j=f[k],j?j.union(d):f[k]=Array.setUp.apply(null,d));return f},removeAgainst:function(a){for(var b=a.againstGrid,c=a.collisionTypes,d=null,e=b.length,f=0,g=0,h=c.length,i=null;e--;)for(i=b[e],f=h;f--;)(d=i.get(c[f]))&&(g=d.indexOf(a))>=0&&d.greenSplice(g);b.length=0},updateAgainst:function(a){var b=null,c=0,d="",e=a.collisionTypes,g=this.mapDown(a.getAABB()),i=a.againstGrid,j=0,k=null,l=this.againstGrid,m=0,n=0;if(!g.equals(a.againstAABB))for(a.againstAABB.set(g),this.removeAgainst(a),m=g.left;m<=g.right;m++)for(n=g.top;n<=g.bottom;n++){for(j=h(m,n),k=l[j],k||(k=l[j]=f.setUp()),c=e.length;c--;)d=e[c],b=k.get(d),b||(b=k.set(d,Array.setUp())),b.push(a);i.push(k)}g.recycle()},addCollisionEntity:function(a){a.getTileShapes?this.terrain=a:a.collisionTypes&&!a.againstGrid&&(a.againstGrid=Array.setUp(),a.againstAABB=b.setUp(),this.updateAgainst(a))},removeCollisionEntity:function(a){a.againstGrid&&(this.removeAgainst(a),a.againstGrid.recycle(),a.againstGrid=null,a.againstAABB.recycle(),a.againstAABB=null)},checkCamera:function(a,b){var c=b.length,d=0,e=this.allEntitiesLive,f=this.softEntitiesLive,g=this.solidEntitiesLive,h=this.nonColliders,i=this.groupsLive,j=null,l=null,m=!1;for(e.length=0,g.length=0,f.length=0,h.length=0,i.length=0;c--;)if(m=!1,j=b[c],l=j.collisionTypes,!j.immobile&&l&&l.length){if(e.push(j),j!==this.owner)for(d=l.length;d--;)if(j.solidCollisionMap.get(l[d]).length){g.push(j),m=!0;break}for(d=l.length;d--;)if(j.softCollisionMap.get(l[d]).length){f.push(j);break}m||h.push(j),j.collisionGroup&&i.push(j)}i.sort(k)},resolveNonCollisions:function(){var a=null,b=this.relocationMessage,c=this.nonColliders,d=c.length;for(b.relative=!1;d--;)a=c[d],a.position.x===a.previousPosition.x&&a.position.y===a.previousPosition.y||(b.position.setVector(a.position),a.triggerEvent("relocate-entity",b),this.updateAgainst(a))},checkGroupCollisions:function(){var a=function(a,b,c,d,e,f,g,h){var i=j;i.entity=b,i.target=a,i.myType=c,i.type=d,i.x=e,i.y=f,i.direction=h,i.hitType=g,a.triggerEvent("hit-by-"+d,i),b&&(i.entity=a,i.target=b,i.type=c,i.myType=d,i.x=-e,i.y=-f,i.direction=h.getInverse(),i.hitType=g,b.triggerEvent("hit-by-"+c,i),i.direction.recycle())};return function(){for(var b=0,c=this.groupsLive,d=c.length,e=null,f=null,g=null,h=null;d--;)if(e=c[d],e.collisionGroup.getSize()>1){for(h=this.checkSolidEntityCollision(e,e.collisionGroup),f=h.xData,b=f.length;b--;)g=f[b],a(g.thisShape.owner,g.thatShape.owner,g.thisShape.collisionType,g.thatShape.collisionType,g.direction,0,"solid",g.vector);for(f=h.yData,b=f.length;b--;)g=f[b],a(g.thisShape.owner,g.thatShape.owner,g.thisShape.collisionType,g.thatShape.collisionType,0,g.direction,"solid",g.vector);h.recycle()}}}(),checkSolidCollisions:function(){var a=function(a,b,c,d,e,f,g,h){var i=j;i.entity=b,i.target=a,i.myType=c,i.type=d,i.x=e,i.y=f,i.direction=h,i.hitType=g,a.triggerEvent("hit-by-"+d,i),b&&(i.entity=a,i.target=b,i.type=c,i.myType=d,i.x=-e,i.y=-f,i.direction=h.getInverse(),i.hitType=g,b.triggerEvent("hit-by-"+c,i),i.direction.recycle())};return function(){for(var b=0,c=this.solidEntitiesLive,d=c.length,e=null,f=null,g=null,h=null,i=a;d--;){for(e=c[d],h=this.checkSolidEntityCollision(e,e),f=h.xData,b=f.length;b--;)g=f[b],i(g.thisShape.owner,g.thatShape.owner,g.thisShape.collisionType,g.thatShape.collisionType,g.direction,0,"solid",g.vector);for(f=h.yData,b=f.length;b--;)g=f[b],i(g.thisShape.owner,g.thatShape.owner,g.thisShape.collisionType,g.thatShape.collisionType,0,g.direction,"solid",g.vector);h.recycle()}}}(),checkSolidEntityCollision:function(a,b){var c=d.setUp(),e=0,f=null,h=null,i=a.previousX,j=a.previousY,k=a.x-i,l=a.y-j,m=1/0,n=1/0,o=b.getCollisionTypes(),p=0,q=!1,r=null;if(b.getSolidEntities&&(q=b.getSolidEntities()),f=g.setUp(a.position),k||l){if(a.bullet){for(r=Math.min,p=o.length;p--;)h=b.getAABB(o[p]),m=r(m,h.width),n=r(n,h.height);for(e=Math.ceil(Math.max(Math.abs(k)/m,Math.abs(l)/n)),e=r(e,100),k/=e,l/=e;e--;){if(b.prepareCollision(a.previousX+k,a.previousY+l),f=this.processCollisionStep(a,b,q,c,f.setVector(a.position),k,l,o),f.x===a.previousX&&f.y===a.previousY){b.relocateEntity(f,c);break}b.relocateEntity(f,c)}}else b.prepareCollision(a.previousX+k,a.previousY+l),f=this.processCollisionStep(a,b,q,c,f,k,l,o),b.relocateEntity(f,c);f.x===i&&f.y===j||this.updateAgainst(a)}return f.recycle(),c},processCollisionStep:function(){var a=b.setUp(),c=function(a,b,c,d,e,f){var g=0;if(c===a)return!1;if(c.jumpThrough&&b.bottom>d.top)return!1;if(a.jumpThrough&&d.bottom>b.top)return!1;if(e)for(g=e.length;g--;)if(c===e[g])return!1;return f.collides(d)};return function(b,d,e,f,g,h,i,j){for(var k=j.length,l=0,m=0,n=0,o=c,p=!1,q=Array.setUp(),r=null,s=null,t=null,u=null,v=null,w="",x=null,y=null,z=null,A=this.terrain,B=null,C=d.getSolidCollisions(),D=null,E=a;k--;){for(q[k]=r=Array.setUp(),u=j[k],s=d.getPreviousAABB(u),t=d.getAABB(u),E.set(t),E.include(s),D=C.get(u),B=this.getAgainstGrid(b,E,D),l=D.length;l--;)if(w=D[l],z=B[w]){for(m=z.length;m--;)if(v=z[m],x=v.getAABB(w),o(b,s,v,x,e,E)){for(y=v.getShapes(w),n=y.length;n--;)r.push(y[n]);p=!0}z.recycle()}else if(A)for(y=A.getTileShapes(E,s,w),m=y.length;m--;)r.push(y[m]),p=!0;B.recycle()}return p&&(g=this.resolveCollisionPosition(b,d,g,q,f,j,h,i)),q.recycle(2),g}}(),resolveCollisionPosition:function(a,b,c,d,e,f,g,h){var i=0,j=null;if(0!==g)for(i=f.length;i--;)j=this.findMinAxisMovement(a,b,f[i],"x",d[i]),j.occurred&&e.tryToAddX(j)||j.recycle();if(j=e.xData[0],c.x=j?a.previousX+j.deltaMovement*j.direction:a.x,b.movePreviousX(c.x),0!==h)for(i=f.length;i--;)j=this.findMinAxisMovement(a,b,f[i],"y",d[i]),j.occurred&&e.tryToAddY(j)||j.recycle();return j=e.yData[0],c.y=j?a.previousY+j.deltaMovement*j.direction:a.y,c},findMinAxisMovement:function(a,b,d,e,f){for(var g=c.setUp(),h=b.getShapes(d),i=b.getPrevShapes(d),j=null,k=h.length;k--;)j=this.findMinShapeMovementCollision(i[k],h[k],e,f),j.occurred&&(!g.occurred||j.deltaMovement<g.deltaMovement)?(g.recycle(),g=j):j.recycle();return g},findMinShapeMovementCollision:function(){var a={position:0,contactVector:g.setUp()},b=function(a,b){var c=Math.pow;return Math.sqrt(c(b,2)-c(a,2))},d=function(a,b,c){var d=a-b;return d-d/Math.abs(d)*c},e=function(a,c,e,f,g){var h=0,i=c.aABB,j=i.halfWidth,k=a.x,l=a.y;return l>=i.top&&l<=i.bottom?j+a.radius:(l=d(l,c.y,i.halfHeight),h=j+b(l,a.radius),e===a?(g.x=-d(k-f*h,c.x,j)/2,l=-l):g.x=d(k,c.x-f*h,j)/2,g.y=l,g.normalize(),h)},f=function(a,c,e,f,g){var h=0,i=c.aABB,j=i.halfHeight,k=a.x,l=a.y;return k>=i.left&&k<=i.right?j+a.radius:(k=d(k,c.x,i.halfWidth),h=j+b(k,a.radius),e===a?(k=-k,g.y=-d(l-f*h,c.y,j)/2):g.y=d(l,c.y-f*h,j)/2,g.x=k,g.normalize(),h)},h={x:{rectangle:{rectangle:function(b,c,d){var e=a;return e.position=d.x-b*(d.aABB.halfWidth+c.aABB.halfWidth),e.contactVector.setXYZ(b,0),e},circle:function(b,c,d){var f=a;return f.position=d.x-b*e(d,c,c,b,f.contactVector.setXYZ(b,0)),f}},circle:{rectangle:function(b,c,d){var f=a;return f.position=d.x-b*e(c,d,c,b,f.contactVector.setXYZ(b,0)),f},circle:function(c,d,e){var f=e.y-d.y,g=e.x-c*b(f,d.radius+e.radius),h=a;return h.contactVector.setXYZ(e.x-g,f).normalize(),h.position=g,h}}},y:{rectangle:{rectangle:function(b,c,d){var e=a;return e.position=d.y-b*(d.aABB.halfHeight+c.aABB.halfHeight),e.contactVector.setXYZ(0,b),e},circle:function(b,c,d){var e=a;return e.position=d.y-b*f(d,c,c,b,e.contactVector.setXYZ(0,b)),e}},circle:{rectangle:function(b,c,d){var e=a;return e.position=d.y-b*f(c,d,c,b,e.contactVector.setXYZ(0,b)),e},circle:function(c,d,e){var f=e.x-d.x,g=e.y-c*b(f,d.radius+e.radius),h=a;return h.contactVector.setXYZ(f,e.y-g).normalize(),h.position=g,h}}}};return function(a,b,d,e){var f=0,g=a[d],i=b[d],j=a,k=g<i?1:-1,l=i,m=null,n=c.setUp(),o=null,p=i,q=null;if(g!==i)for(q=h[d][j.type],"x"===d?j.moveX(i):"y"===d&&j.moveY(i),f=e.length;f--;)m=e[f],l=i,j.collides(m)&&(o=q[m.type](k,j,m),l=o.position,k>0?l<p&&(l<g&&(l=g),p=l,n.set(!0,k,p,Math.abs(p-g),m.aABB,b,m,o.contactVector,0)):l>p&&(l>g&&(l=g),p=l,n.set(!0,k,p,Math.abs(p-g),m.aABB,b,m,o.contactVector,0)));return n}}(),checkSoftCollisions:function(){var a=function(a){this.triggerEvent("hit-by-"+a.type,a)};return function(){for(var b=this.softEntitiesLive,c=null,d=b.length,e=a;d--;)c=b[d],this.checkEntityForSoftCollisions(c,e.bind(c))}}(),checkEntityForSoftCollisions:function(a,b){var c=null,d=null,e=j,f=a.collisionTypes.length,g=0,h=0,i=0,k=0,l=null,m=null,n=null,o=null,p=null,q=null,r=!1;for(e.x=0,e.y=0;f--;){for(l=a.collisionTypes[f],m=a.softCollisionMap.get(l),c=this.getEntityAgainstGrid(a,m),g=m.length;g--;)if(o=m[g],n=c[o]){for(h=n.length;h--;)if((d=n[h])!==a&&a.getAABB(l).collides(d.getAABB(o)))for(r=!1,p=a.getShapes(l),q=d.getShapes(o),i=p.length;i--;){for(k=q.length;k--;)if(p[i].collides(q[k])){e.entity=d,e.target=a,e.type=o,e.myType=l,e.shape=q[k],e.hitType="soft",b(e),r=!0;break}if(r)break}n.recycle()}c.recycle()}},checkShapeForCollisions:function(a,b,c){var d=null,e=null,f=j,g=0,h=0,i=0,k=null,l=null,m=null;for(f.x=0,f.y=0,d=this.getAgainstGrid(null,a.getAABB(),b),g=b.length;g--;)if(l=b[g],k=d[l]){for(h=k.length;h--;)if(e=k[h],a.getAABB().collides(e.getAABB(l)))for(!1,m=e.getShapes(l),i=m.length;i--;)if(a.collides(m[i])){f.entity=e,f.target=null,f.type=l,f.myType="",f.shape=m[i],f.hitType="soft",c(f);break}k.recycle()}d.recycle()},checkPointForCollisions:function(a,b,c,d){var e=this.gridBits,f=this.againstGrid[i(a,b,e)],g=null,h=j,k=0,l=0,m=0,n=null,o=null,p=null;if(h.x=0,h.y=0,f)for(k=c.length;k--;)if(o=c[k],n=f.get(o))for(l=n.length;l--;)if(g=n[l],g.getAABB(o).containsPoint(a,b))for(p=g.getShapes(o),m=p.length;m--;)if(p[m].containsPoint(a,b)){h.entity=g,h.target=null,h.type=o,h.myType="",h.shape=p[m],h.hitType="soft",d(h);break}},destroy:function(){var a=this.againstGrid,b=null,c="",d=null,e=0;this.groupsLive.recycle(),this.nonColliders.recycle(),this.allEntitiesLive.recycle(),this.softEntitiesLive.recycle(),this.solidEntitiesLive.recycle(),this.relocationMessage.position.recycle(),this.relocationMessage.recycle();for(c in a)if(a.hasOwnProperty(c)){for(b=a[c],d=b.keys,e=d.length;e--;)b.get(d[e]).recycle();b.recycle()}a.recycle(),this.againstGrid=null}},publicMethods:{getWorldEntities:function(){return this.allEntitiesLive},getWorldTerrain:function(){return this.terrain},getEntityCollisions:function(a){var b=Array.setUp();return this.checkEntityForSoftCollisions(a,function(a){b.push(e.setUp(a))}),b},getShapeCollisions:function(a,b){var c=Array.setUp();return this.checkShapeForCollisions(a,b,function(a){c.push(e.setUp(a))}),c},getPointCollisions:function(a,b,c){var d=Array.setUp();return this.checkPointForCollisions(a,b,c,function(a){d.push(e.setUp(a))}),d}}})}(),function(){"use strict";var a={kc0:"unknown",kc8:"backspace",kc9:"tab",kc12:"numpad-5-shift",kc13:"enter",kc16:"shift",kc17:"ctrl",kc18:"alt",kc19:"pause",kc20:"caps-lock",kc27:"esc",kc32:"space",kc33:"page-up",kc34:"page-down",kc35:"end",kc36:"home",kc37:"left-arrow",kc38:"up-arrow",kc39:"right-arrow",kc40:"down-arrow",kc42:"numpad-multiply",kc43:"numpad-add",kc44:"print-screen",kc45:"insert",kc46:"delete",kc47:"numpad-division",kc48:"0",kc49:"1",kc50:"2",kc51:"3",kc52:"4",kc53:"5",kc54:"6",kc55:"7",kc56:"8",kc57:"9",kc59:"semicolon",kc61:"equals",kc65:"a",kc66:"b",kc67:"c",kc68:"d",kc69:"e",kc70:"f",kc71:"g",kc72:"h",kc73:"i",kc74:"j",kc75:"k",kc76:"l",kc77:"m",kc78:"n",kc79:"o",kc80:"p",kc81:"q",kc82:"r",kc83:"s",kc84:"t",kc85:"u",kc86:"v",kc87:"w",kc88:"x",kc89:"y",kc90:"z",kc91:"left-windows-start",kc92:"right-windows-start",kc93:"windows-menu",kc96:"back-quote",kc106:"numpad-multiply",kc107:"numpad-add",kc109:"numpad-minus",kc110:"numpad-period",kc111:"numpad-division",kc112:"f1",kc113:"f2",kc114:"f3",kc115:"f4",kc116:"f5",kc117:"f6",kc118:"f7",kc119:"f8",kc120:"f9",kc121:"f10",kc122:"f11",kc123:"f12",kc144:"num-lock",kc145:"scroll-lock",kc186:"semicolon",kc187:"equals",kc188:"comma",kc189:"hyphen",kc190:"period",kc191:"forward-slash",kc192:"back-quote",kc219:"open-bracket",kc220:"back-slash",kc221:"close-bracket",kc222:"quote"};platypus.createComponentClass({id:"HandlerController",initialize:function(){this.callbackKeyUp=null,this.callbackKeyDown=null,platypus.game.settings.debug?(this.callbackKeyDown=function(a){this.keyDown(a)}.bind(this),this.callbackKeyUp=function(a){this.keyUp(a)}.bind(this)):(this.callbackKeyDown=function(a){this.keyDown(a),a.preventDefault()}.bind(this),this.callbackKeyUp=function(a){this.keyUp(a),a.preventDefault()}.bind(this)),window.addEventListener("keydown",this.callbackKeyDown,!0),window.addEventListener("keyup",this.callbackKeyUp,!0)},events:{tick:function(a){this.owner.triggerEventOnChildren&&this.owner.triggerEventOnChildren("handle-controller",a)}},methods:{keyDown:function(b){this.owner.triggerEventOnChildren&&this.owner.triggerEventOnChildren("key:"+(a["kc"+b.keyCode]||"key-code-"+b.keyCode)+":down",b)},keyUp:function(b){this.owner.triggerEventOnChildren&&this.owner.triggerEventOnChildren("key:"+(a["kc"+b.keyCode]||"key-code-"+b.keyCode)+":up",b)},destroy:function(){window.removeEventListener("keydown",this.callbackKeyDown),window.removeEventListener("keyup",this.callbackKeyUp)}}})}(),function(){"use strict";var a=include("platypus.AABB"),b=function(a,b){var c=a.length;for(b.length=0;c--;)b.push(a[c])},c=function(a,b){return a.alwaysOn||a.aabb&&b.collides(a.getAABB())||void 0===a.x||b.containsPoint(a.x,a.y)},d=function(a,b,d){var e=a.length,f=null;for(b.length=0;e--;)f=a[e],c(f,d)&&b.push(f)},e=function(a){return"handle-logic"===a||"handle-post-collision-logic"===a||"prepare-logic"===a||"state-changed"===a||"handle-movement"===a};platypus.createComponentClass({id:"HandlerLogic",properties:{alwaysOn:!1},publicProperties:{buffer:-1,stepLength:5,maxStepsPerTick:100,timeMultiplier:1},initialize:function(){this.entities=Array.setUp(),this.activeEntities=Array.setUp(),this.removals=Array.setUp(),this.inLogicLoop=!1,this.alwaysOn?(this.updateList=b,this.camera=null):(this.updateList=d,this.camera=a.setUp()),this.paused=0,this.leftoverTime=0,this.message={delta:this.stepLength,tick:null,camera:this.camera,entities:this.activeEntities}},events:{"child-entity-updated":function(a){var b=this.entities.indexOf(a),d=a.getMessageIds().some(e);d&&b<0?(this.entities.push(a),!this.inLogicLoop||this.camera&&!c(a,this.camera)||this.activeEntities.push(a)):!d&&b>=0&&(this.entities.greenSplice(b),this.inLogicLoop&&this.removals.push(a))},"child-entity-added":function(a){a.getMessageIds().some(e)&&(this.entities.push(a),!this.inLogicLoop||this.camera&&!c(a,this.camera)||this.activeEntities.push(a))},"child-entity-removed":function(a){var b=this.entities.indexOf(a);b>=0&&(this.entities.greenSplice(b),this.inLogicLoop&&this.removals.push(a))},"pause-logic":function(a){a&&a.time?this.paused=a.time:this.paused=-1,this.owner.triggerEventOnChildren&&this.owner.triggerEventOnChildren("logic-paused")},"unpause-logic":function(){this.paused=0,this.owner.triggerEventOnChildren&&this.owner.triggerEventOnChildren("logic-unpaused")},"camera-update":function(a){var b=this.buffer,c=this.camera,d=null;c&&(-1===b&&(b=a.viewport.width/10),d=a.viewport,c.setBounds(d.left-b,d.top-b,d.right+b,d.bottom+b))},tick:function(a){var b=0,c=0,d=0,e=null,f=this.message,g=this.activeEntities,h=this.removals,i=this.stepLength;for(this.leftoverTime+=a.delta*this.timeMultiplier,d=Math.floor(this.leftoverTime/i)||1,f.delta=i,this.leftoverTime=Math.max(this.leftoverTime-d*i,0),f.tick=a,this.updateList(this.entities,g,this.camera),d=Math.min(d,this.maxStepsPerTick);d--;)if(this.paused>0&&(this.paused-=i,this.paused<0&&(this.paused=0)),!this.paused){for(this.inLogicLoop=!0,this.owner.triggerEvent("logic-tick",f),this.owner.triggerEventOnChildren&&this.owner.triggerEventOnChildren("handle-ai",f),b=g.length;b--;)e=g[b],e.triggerEvent("prepare-logic",f),e.triggerEvent("handle-logic",f),e.triggerEvent("handle-movement",f);if(this.inLogicLoop=!1,h.length){for(b=h.length;b--;)(c=g.indexOf(h[b]))>=0&&g.greenSplice(c);h.length=0}if(b=g.length,this.owner.triggerEvent("check-collision-group",f))for(;b--;)e=g[b],e.triggerEvent("handle-post-collision-logic",f),e.lastState.update(e.state)&&e.triggerEvent("state-changed",e.state);else for(;b--;)e=g[b],e.lastState.update(e.state)&&e.triggerEvent("state-changed",e.state)}}},methods:{destroy:function(){this.entities.recycle(),this.activeEntities.recycle(),this.removals.recycle()}}})}(),function(){"use strict";var a=include("PIXI.Container"),b=include("platypus.Data"),c=include("platypus.components.Interactive");platypus.createComponentClass({id:"HandlerRender",properties:{interactive:!1},publicProperties:{worldContainer:null},initialize:function(){var d=null,e=this.owner.renderGroups=this.renderGroups=Array.setUp();this.worldContainer=this.worldContainer||new a,this.worldContainer.name="",e.push(this.worldContainer),this.interactive&&(d=b.setUp("container",this.worldContainer,"hitArea",this.interactive.hitArea,"hover",this.interactive.hover,"relativeToSelf",!0),this.owner.addComponent(new c(this.owner,d)),d.recycle()),this.renderMessage=b.setUp("delta",0,"container",this.worldContainer,"renderGroups",e)},events:{load:function(){this.owner.triggerEvent("render-world",{world:this.worldContainer,renderGroups:this.renderGroups}),this.owner.triggerEvent("input-on")},"child-entity-added":function(a){a.triggerEvent("handle-render-load",this.renderMessage)},"pause-render":function(a){a&&a.time?this.paused=a.time:this.paused=-1,this.owner.triggerEventOnChildren&&this.owner.triggerEventOnChildren("render-paused")},"unpause-render":function(){this.paused=0,this.owner.triggerEventOnChildren&&this.owner.triggerEventOnChildren("render-unpaused")},tick:function(){var a=function(a,b){return a.z-b.z};return function(b){var c=this.renderMessage,d=null,e=this.renderGroups,f=e.length;for(c.delta=b.delta,this.paused>0&&(this.paused-=b.delta,this.paused<=0&&(this.paused=0)),!this.paused&&this.owner.triggerEventOnChildren&&this.owner.triggerEventOnChildren("handle-render",c);f--;)d=e[f],d.reorder&&(d.reorder=!1,d.children.sort(a))}}()},methods:{destroy:function(){this.worldContainer=null,this.renderGroups.recycle(),this.renderGroups=null,this.renderMessage.recycle()}}})}(),function(){"use strict";var a=function(a,b,c,d,e,f){var g=0,h=0,i=0,j=a.greenSlice();if("horizontal"===f){for(h=e-1;h>=0;h--)for(g=h*d,i=0;g<(h+1)*d;g++,i++)j.splice((h+1)*b+i,0,c[g]);return j}return"vertical"===f?a.concat(c):null},b=function(a,b,c,d){var e=0,f="",g=a.greenSlice(),h=null;for(e=0;e<b.length;e++){h={};for(f in b[e])b[e].hasOwnProperty(f)&&(h[f]=b[e][f]);"horizontal"===d?h.x+=c:"vertical"===d&&(h.y+=c),g.push(h)}return g},c=function(c,d,e,f){var g=0,h="";for(c.tilewidth||c.tileheight?c.tilewidth===d.tilewidth&&c.tileheight===d.tileheight||platypus.debug.warn("Tiled-Loader: Your map has segments with different tile sizes. All tile sizes must match. Segment: "+d):(c.tilewidth=d.tilewidth,c.tileheight=d.tileheight),"horizontal"===e?0===c.height?c.height=d.height:c.height!==d.height&&platypus.debug.warn("Tiled-Loader: You are trying to merge segments with different heights. All segments need to have the same height. Level: "+c+" Segment: "+d):"vertical"===e&&(0===c.width?c.width=d.width:c.width!==d.width&&platypus.debug.warn("Tiled-Loader: You are trying to merge segments with different widths. All segments need to have the same width. Level: "+c+" Segment: "+d)),g=0;g<d.layers.length;g++)if(c.layers[g])c.layers[g].type===d.layers[g].type?c.layers[g].data&&d.layers[g].data?(f(d.layers[g]),"horizontal"===e?(c.layers[g].data=a(c.layers[g].data,c.width,d.layers[g].data,d.width,c.height,e),c.layers[g].width+=d.width):"vertical"===e&&(c.layers[g].data=a(c.layers[g].data,c.height,d.layers[g].data,d.height,c.width,e),c.layers[g].height+=d.height)):c.layers[g].objects&&d.layers[g].objects&&("horizontal"===e?c.layers[g].objects=b(c.layers[g].objects,d.layers[g].objects,c.width*c.tilewidth,e):"vertical"===e&&(c.layers[g].objects=b(c.layers[g].objects,d.layers[g].objects,c.height*c.tileheight,e))):platypus.debug.warn("Tiled-Loader: The layers in your level segments do not match. Level: "+c+" Segment: "+d);else{f(d.layers[g]),c.layers[g]={};for(h in d.layers[g])d.layers[g].hasOwnProperty(h)&&(c.layers[g][h]=d.layers[g][h])}"horizontal"===e?c.width+=d.width:"vertical"===e&&(c.height+=d.height);for(h in d)d.hasOwnProperty(h)&&!c[h]&&(c[h]=d[h])},d=function(a,b){var d=0,e=0,f=platypus.game.settings.levels,g={height:0,width:0,layers:[]},h={height:0,width:0,layers:[]},i=a[d].length;for(d=0;d<a.length;d++){for(i!==a[d].length&&platypus.debug.warn("Tiled-Loader: Your map is not square. Maps must have an equal number of segments in every row."),g={height:0,width:0,layers:[]},e=0;e<a[d].length;e++)"string"==typeof a[d][e]?c(g,f[a[d][e]],"horizontal",b):c(g,a[d][e],"horizontal",b);c(h,g,"vertical",b)}return h};platypus.createComponentClass({id:"LevelBuilder",properties:{useUniques:!0,levelTemplate:null,levelPieces:null},publicProperties:{},initialize:function(){this.levelMessage={level:null,persistentData:null}},events:{"scene-loaded":function(a){var b=null,c=null,e="",f=0,g=0,h=0;if(this.levelMessage.persistentData=a,this.levelTemplate=a.levelTemplate||this.levelTemplate,this.useUniques=a.useUniques||this.useUniques,c=a.levelPieces||this.levelPieces,this.levelPieces={},c)for(e in c)if(c.hasOwnProperty(e))if("string"==typeof c[e])this.levelPieces[e]=c[e];else{if(!c[e].length)throw"Level Builder: Level pieces of incorrect type: "+c[e];for(this.levelPieces[e]=[],f=0;f<c[e].length;f++)this.levelPieces[e].push(c[e][f])}if(!this.levelTemplate)throw"Level Builder: There is no level template.";if(!this.levelTemplate)throw"Level Builder: Template is not defined";for(this.levelMessage.level=[],g=0;g<this.levelTemplate.length;g++)if("string"==typeof(b=this.levelTemplate[g]))this.levelMessage.level[g]=this.getLevelPiece(b);else{if(!b.length)throw"Level Builder: Template row is neither a string or array. What is it?";for(this.levelMessage.level[g]=[],h=0;h<b.length;h++)this.levelMessage.level[g][h]=this.getLevelPiece(b[h])}this.levelMessage.level&&(this.levelMessage.level=d(this.levelMessage.level,this.owner.decodeLayer),this.owner.triggerEvent("load-level",this.levelMessage))}},methods:{getLevelPiece:function(a){var b=this.levelPieces[a]||a,c=null,d=0;if(b){if("string"==typeof b)return this.useUniques?(c=b,this.levelPieces[a]=null,c):b;if(b.length)return d=Math.floor(Math.random()*b.length),this.useUniques?this.levelPieces[a].greenSplice(d):b[d];throw"Level Builder: There are no MORE level pieces of type: "+a}throw"Level Builder: There are no level pieces of type: "+a},destroy:function(){this.levelMessage.level=null,this.levelMessage.persistentData=null,this.levelMessage=null}},publicMethods:{mergeLevels:function(a){return d(a,this.owner.decodeLayer)}},getAssetList:function(a,b,c){var d=0,e=null,f=Array.setUp(),g="",h=null;if(a&&a.levelPieces?h=a.levelPieces:b&&b.levelPieces?h=b.levelPieces:c&&c.levelPieces&&(h=c.levelPieces),h)for(g in h)if(h.hasOwnProperty(g))if(Array.isArray(h[g]))for(d=0;d<h[g].length;d++)e=platypus.components.TiledLoader.getAssetList({level:h[g][d]},b,c),f.union(e),e.recycle();else e=platypus.components.TiledLoader.getAssetList({level:h[g]},b,c),f.union(e),e.recycle();return f}})}(),function(){"use strict";platypus.createComponentClass({id:"LogicAngularMovement",properties:{maxVelocity:3,acceleration:.01,visualOffset:0,startAngle:0},publicProperties:{},initialize:function(){this.angle=this.startAngle,this.v=Array.setUp(0,0),this.moving=!1,this.piOverTwo=Math.PI/2,this.owner.rotation=this.owner.rotation||this.visualOffset},events:{"handle-logic":function(a){var b=Math.PI,c=Math.sin,d=Math.cos,e=Math.min,f=Math.max,g=a.delta,h=0;this.moving&&(this.v[0]+=this.acceleration*d(this.angle)*g,this.v[1]+=this.acceleration*c(this.angle)*g,0===this.v[0]?h=this.v[1]>0?this.piOverTwo:this.v[1]<0?-this.piOverTwo:this.angle:(h=Math.atan(this.v[1]/this.v[0]),this.v[0]<0&&(h=b+h)),this.v[0]>=0?this.v[0]=e(this.v[0],this.maxVelocity*d(h)):this.v[0]=f(this.v[0],this.maxVelocity*d(h)),this.v[1]>=0?this.v[1]=e(this.v[1],this.maxVelocity*c(h)):this.v[1]=f(this.v[1],this.maxVelocity*c(h)),this.owner.x+=this.v[0],this.owner.y+=this.v[1],this.owner.rotation=h*(180/b)+this.visualOffset)},"set-angle":function(a){this.angle=a},move:function(){this.moving=!0},stop:function(){this.moving=!1,this.v[0]=0,this.v[1]=0},"set-max-velocity":function(a){this.maxVelocity=a}},methods:{destroy:function(){this.v.recycle()}}})}(),function(){"use strict";var a=include("platypus.Entity"),b=function(){var a=this.attachment;a&&a.trigger.apply(a,arguments)};platypus.createComponentClass({id:"LogicAttachment",properties:{attachState:"attached",attachment:"",events:null,startAttached:!1,offsetX:0,offsetY:0,offsetZ:.01},initialize:function(){var a="",c=this.events;if(this.state=this.owner.state,this.state.set(this.attachState,this.startAttached),this.attachmentPosition={x:0,y:0,z:0,dx:0,dy:0},this.attachmentProperties={type:this.attachment,properties:this.attachmentPosition},this.attachment=null,this.isAttached=this.startAttached,c)for(a in c)c.hasOwnProperty(a)&&this.addEventListener(a,b.bind(this,c[a]))},events:{"handle-logic":function(){var a=0,b=this.state;this.isAttached?(this.attachment||(this.attachmentPosition.x=this.owner.x,this.attachmentPosition.y=this.owner.y,this.attachmentPosition.z=this.owner.z,this.attachment=this.owner.parent.addEntity(this.attachmentProperties)),this.attachment.destroyed?(this.owner.parent.removeEntity(this.attachment),this.attachment=null,this.isAttached=!1):(this.attachment.x=this.owner.x,a=this.offsetX,b.get("left")?(a*=-1,this.attachment.rotation=180):b.get("right")&&(this.attachment.rotation=0),this.attachment.x+=a,this.attachment.y=this.owner.y,a=this.offsetY,b.get("top")?(a*=-1,this.attachment.rotation=90):b.get("bottom")&&(this.attachment.rotation=-90),this.attachment.y+=a,this.attachment.z=this.owner.z,this.attachment.z+=this.offsetZ)):this.attachment&&(this.owner.parent.removeEntity(this.attachment),this.attachment=null),b.set(this.attachState,this.isAttached)},attach:function(a){this.isAttached=!a||!1!==a.pressed},detach:function(){this.isAttached=!1},"change-attachment-offset":function(a){void 0!==a.x?this.offsetX=a.x:void 0!==a.y?this.offsetY=a.y:void 0!==a.z&&(this.offsetZ=a.z)}},methods:{destroy:function(){this.state.set(this.attachState,!1),this.attachment&&(this.owner.parent.removeEntity(this.attachment),this.attachment=null),this.isAttached=!1,this.state=null}},getAssetList:function(b,c,d){var e=b.attachment||c.attachment||d.attachment;return e?a.getAssetList({type:e}):Array.setUp()}})}(),function(){"use strict";var a=include("platypus.AABB"),b=include("platypus.Data");platypus.createComponentClass({id:"LogicButton",properties:{onPress:"",onRelease:"",onCancel:"",onHover:"",useOnce:!1,disabled:!1,toggle:!1,pressed:!1},publicProperties:{bottom:null,left:null,right:null,top:null},initialize:function(){var b=this.owner.state;this.aabb=a.setUp(),this.lastBottom=null,this.lastLeft=null,this.lastRight=null,this.lastTop=null,this.state=b,b.set("disabled",this.disabled),b.set("released",!this.pressed),b.set("pressed",this.pressed),b.set("highlighted",!1),this.owner.buttonMode=!this.disabled,this.cancelled=!1,this.readyToToggle=!1},events:{"handle-logic":function(){var a=this.bottom,b=this.left,c=this.right,d=this.top;this.lastBottom===a&&this.lastLeft===b&&this.lastRight===c&&this.lastTop===d||(this.updatePosition(this.aabb),this.lastBottom=a,this.lastLeft=b,this.lastRight=c,this.lastTop=d)},"camera-update":function(a){this.aabb.set(a.viewport),this.updatePosition(this.aabb)},pointerdown:function(a){this.state.get("disabled")||(this.toggle?this.readyToToggle=!0:(this.onPress&&this.owner.trigger(this.onPress),this.updateStateAndTrigger("pressed"),
  a&&a.pixiEvent&&a.pixiEvent.stopPropagation&&a.pixiEvent.stopPropagation(),this.useOnce&&this.removeEventListener&&this.removeEventListener("pointerdown")))},pressup:function(a){var b=this.state;b.get("disabled")||(this.cancelled?(this.onCancel&&this.owner.trigger(this.onCancel),this.updateStateAndTrigger("cancelled")):this.toggle?this.readyToToggle&&(b.get("pressed")?this.updateStateAndTrigger("released"):this.updateStateAndTrigger("pressed")):(this.onRelease&&this.owner.trigger(this.onRelease),this.updateStateAndTrigger("released")),a&&a.pixiEvent&&a.pixiEvent.stopPropagation&&a.pixiEvent.stopPropagation(),this.useOnce&&this.removeEventListener&&(this.removeEventListener("pressup"),this.state.set("disabled",!0),this.owner.buttonMode=!1)),this.cancelled=!1,this.readyToToggle=!1},pointerover:function(){this.onHover&&this.owner.trigger(this.onHover),this.state.get("pressed")&&(this.cancelled=!1)},pointerout:function(){this.state.get("pressed")&&(this.cancelled=!0)},disable:function(){this.state.set("disabled",!0),this.owner.buttonMode=!1},enable:function(){this.state.set("disabled",!1),this.owner.buttonMode=!0},"toggle-disabled":function(){var a=this.state.get("disabled");this.owner.buttonMode=a,this.state.set("disabled",!a)},highlight:function(){this.state.set("highlighted",!0)},unhighlight:function(){this.state.set("highlighted",!1)},"toggle-highlight":function(){var a=this.state;a.set("highlighted",!a.get("highlighted"))}},methods:{updatePosition:function(a){var b=this.bottom,c=this.left,d=this.owner,e=this.right,f=this.top;"number"==typeof c?d.x=a.left+c:"number"==typeof e&&(d.x=a.right-e),"number"==typeof f?d.y=a.top+f:"number"==typeof b&&(d.y=a.bottom-b)},updateStateAndTrigger:function(a){var c=null,d=this.owner,e=this.state,f=e.get("pressed"),g=e.get("released"),h=!1;g&&"pressed"===a?(e.set("pressed",!0),e.set("released",!1),h=!0):!f||"released"!==a&&"cancelled"!==a||(e.set("pressed",!1),e.set("released",!0),h=!0),h&&(c=b.setUp("released",f,"pressed",g,"triggered",g,"entity",d),d.triggerEvent(a,c),c.recycle())},destroy:function(){this.aabb.recycle(),this.aabb=null,this.owner.buttonMode=!1,this.state=null}}})}(),function(){"use strict";platypus.createComponentClass({id:"LogicCarrier",initialize:function(){},events:{load:function(){this.owner.triggerEvent("add-collision-entity",this.owner)||(this.owner.addComponent(new platypus.components.CollisionGroup(this.owner,{})),this.owner.triggerEvent("add-collision-entity",this.owner))},"carry-me":function(a){this.owner.triggerEvent("add-collision-entity",a.entity)},"release-me":function(a){this.owner.triggerEvent("remove-collision-entity",a.entity)}}})}(),function(){"use strict";platypus.createComponentClass({id:"LogicDestroyMe",properties:{delay:0,destroyed:!1},events:{"prepare-logic":function(a){var b=a.delta;this.destroyed&&!this.owner.state.get("paused")&&(this.delay-=b,this.delay<=0&&this.owner.parent.removeEntity(this.owner))},"destroy-me":function(){this.destroyed=!0}}})}(),function(){"use strict";var a=function(a){return function(b){this[a]=!b||!1!==b.pressed}},b=function(){},c={x:function(a,b){a!==b&&(a>180&&b<=180||a<=180&&b>180)&&this.owner.triggerEvent("transform","vertical")},y:function(a,b){a!==b&&(a>90&&a<=270&&(b<=90||b>270)||(a<=90||a>270)&&b>90&&b<=270)&&this.owner.triggerEvent("transform","horizontal")},z:function(a,b){a!==b&&this.owner.triggerEvent("replace-transform","rotate-"+a)}};platypus.createComponentClass({id:"LogicDirectionalMovement",properties:{axis:"y",speed:.3},initialize:function(){var a=this.state=this.owner.state;"number"==typeof this.speed&&(this.speed=[this.speed,0,0]),this.initialVector=platypus.Vector.setUp(this.speed),this.reorient=c[this.axis],this.reorient||(this.reorient=b),this.moving=a.set("moving",!1),this.left=a.set("left",!1),this.right=a.set("right",!1),this.up=a.set("up",!1),this.down=a.set("down",!1),this.upLeft=!1,this.upRight=!1,this.downLeft=!1,this.downRight=!1,this.heading=0,this.owner.heading=this.owner.heading||0},events:{"component-added":function(a){if(a===this){if(!this.owner.addMover)return void platypus.debug.warn('The "LogicDirectionalMovement" component requires a "Mover" component to function correctly.');this.direction=this.owner.addMover({velocity:this.speed,drag:0,friction:0,stopOnCollision:!1,orient:!1,aliases:{moving:"control-velocity"}}).velocity,this.owner.heading!==this.heading&&(this.direction.setVector(this.initialVector).rotate(this.owner.heading/180*Math.PI),this.heading=this.owner.heading),this.owner.triggerEvent("moving",this.moving)}},"handle-logic":function(){var a=this.state,b=this.up||this.upLeft||this.upRight,c=this.upLeft||this.up&&this.left,d=this.left||this.upLeft||this.downLeft,e=this.downLeft||this.down&&this.left,f=this.down||this.downLeft||this.downRight,g=this.downRight||this.down&&this.right,h=this.right||this.upRight||this.downRight,i=this.upRight||this.up&&this.right;if(d&&h||b&&f)this.moving=!1;else if(c)this.moving=!0,this.heading=225;else if(i)this.moving=!0,this.heading=315;else if(e)this.moving=!0,this.heading=135;else if(g)this.moving=!0,this.heading=45;else if(d)this.moving=!0,this.heading=180;else if(h)this.moving=!0,this.heading=0;else if(b)this.moving=!0,this.heading=270;else if(f)this.moving=!0,this.heading=90;else switch(this.moving=!1,this.heading){case 270:b=!0;break;case 90:f=!0;break;case 180:d=!0;break;case 225:b=!0,d=!0;break;case 315:b=!0,h=!0;break;case 135:f=!0,d=!0;break;case 45:f=!0,h=!0;break;case 0:default:h=!0}this.owner.heading!==this.heading&&(this.direction.setVector(this.initialVector).rotate(this.heading/180*Math.PI),this.reorient(this.heading,this.owner.heading),this.owner.heading=this.heading),a.get("moving")!==this.moving&&(this.owner.triggerEvent("moving",this.moving),a.set("moving",this.moving)),a.set("up",b),a.set("right",h),a.set("down",f),a.set("left",d)},"go-down":a("down"),"go-south":a("down"),"go-down-left":a("downLeft"),"go-southwest":a("downLeft"),"go-left":a("left"),"go-west":a("left"),"go-up-left":a("upLeft"),"go-northwest":a("upLeft"),"go-up":a("up"),"go-north":a("up"),"go-up-right":a("upRight"),"go-northeast":a("upRight"),"go-right":a("right"),"go-east":a("right"),"go-down-right":a("downRight"),"go-southeast":a("downRight"),stop:function(a){a&&!1===a.pressed||(this.left=!1,this.right=!1,this.up=!1,this.down=!1,this.upLeft=!1,this.upRight=!1,this.downLeft=!1,this.downRight=!1)},face:function(){var a={up:270,north:270,down:90,south:90,left:180,west:180,right:0,east:0,"up-left":225,northwest:225,"up-right":315,northeast:315,"down-left":135,southwest:135,"down-right":45,southeast:45};return function(b){this.heading=a[b]||0}}(),accelerate:function(a){this.initialVector.normalize().multiply(a),this.direction.normalize().multiply(a)}},methods:{destroy:function(){this.initialVector.recycle(),this.state=null}}})}(),function(){"use strict";platypus.createComponentClass({id:"LogicDragDrop",properties:{dragZ:1e4,stickyClick:!1},initialize:function(){this.nextX=this.owner.x,this.nextY=this.owner.y,this.lastZ=this.owner.z,this.grabOffsetX=0,this.grabOffsetY=0,this.state=this.owner.state,this.state.set("dragging",!1),this.state.set("noDrop",!1),this.tryDrop=!1,this.hitSomething=!1,this.hasCollision=!1,platypus.supports.mobile&&(this.stickyClick=!1)},events:{"component-added":function(a){"CollisionBasic"===a.type&&(this.hasCollision=!0)},"handle-logic":function(){this.state.get("dragging")&&(this.owner.x=this.nextX,this.owner.y=this.nextY,this.owner.triggerEvent("hovering")),this.state.set("noDrop",!1)},"handle-post-collision-logic":function(){this.tryDrop?(this.tryDrop=!1,this.hitSomething?(this.dropFailed=!1,this.state.set("noDrop",!0),this.state.set("dragging",!0),this.owner.dragMode=!0):(this.state.set("noDrop",!1),this.state.set("dragging",!1),this.owner.dragMode=!1)):this.hitSomething&&this.state.set("noDrop",!0),this.hitSomething=!1},pointerdown:function(a){this.sticking?(this.sticking=!1,this.release()):(this.nextX=this.owner.x,this.nextY=this.owner.y,this.lastZ=this.owner.z,this.grabOffsetX=a.x-this.owner.x,this.grabOffsetY=a.y-this.owner.y,this.owner.z=this.dragZ,this.state.set("dragging",!0),this.owner.dragMode=!0,this.sticking=this.stickyClick),a.pixiEvent.stopPropagation()},pressup:function(a){this.sticking||this.release(),a.pixiEvent.stopPropagation()},pointermove:function(a){this.sticking&&(this.nextX=a.x-this.grabOffsetX,this.nextY=a.y-this.grabOffsetY,a.event.preventDefault(),a.pixiEvent.stopPropagation())},pressmove:function(a){this.nextX=a.x-this.grabOffsetX,this.nextY=a.y-this.grabOffsetY,this.nextX===this.owner.x&&this.nextY===this.owner.y||(this.sticking=!1),a.event.preventDefault(),a.pixiEvent.stopPropagation()},"no-drop":function(){this.hitSomething=!0}},methods:{release:function(){this.hasCollision?this.tryDrop=!0:(this.state.set("noDrop",!1),this.state.set("dragging",!1),this.owner.dragMode=!1,this.owner.z=this.lastZ)},destroy:function(){this.state.set("dragging",!1),this.owner.dragMode=!1,this.state.set("noDrop",!1),this.state=null,this.owner.z=this.lastZ}}})}(),function(){"use strict";var a=include("platypus.Vector");platypus.createComponentClass({id:"LogicImpactLaunch",properties:{accelerationX:-.3,accelerationY:-.8,flipX:!0,flipY:!1},initialize:function(a){this.stunState=a.state||"stunned",this.flipX=this.flipX?-1:1,this.flipY=this.flipY?-1:1,this.justJumped=!1,this.stunned=!1,this.state=this.owner.state,this.state.set("impact",!1),this.state.set(this.stunState,!1)},events:{"component-added":function(b){if(b===this){if(!this.owner.addMover)return void platypus.debug.warn('The "LogicDirectionalMovement" component requires a "Mover" component to function correctly.');this.direction=this.owner.addMover({velocity:[0,0,0],orient:!1}).velocity,this.vector=a.setUp()}},"handle-logic":function(){this.state.set("impact",this.justJumped),this.state.set(this.stunState,this.stunned),this.justJumped&&(this.direction.setVector(this.vector),this.justJumped=!1,this.stunned=!0)},"impact-launch":function(a){var b=a.x,c=a.y;a.entity&&(b=a.entity.x-this.owner.x,c=a.entity.y-this.owner.y),this.stunned||(this.justJumped=!0,b>=0?this.vector.x=this.accelerationX:b<0&&(this.vector.x=this.accelerationX*this.flipX),c>=0?this.vector.y=this.accelerationY:c<0&&(this.vector.y=this.accelerationY*this.flipY))},"hit-solid":function(a){this.stunned&&a.y>0&&(this.direction.x=0,this.direction.y=0,this.stunned=!1)}},methods:{destroy:function(){this.vector.recycle(),this.state=null}}})}(),function(){"use strict";platypus.createComponentClass({id:"LogicPacingPlatform",initialize:function(a){this.ang=this.owner.angle||a.angle||0,this.dist=this.owner.distance||a.distance||128,this.dX=this.dist*Math.cos(this.ang),this.dY=this.dist*Math.sin(this.ang),this.period=this.owner.period||a.period||4e3,this.time=0,this.startPos=this.owner.startPos||a.startPos||0,this.offset=0,this.originX=this.owner.x,this.originY=this.owner.y},events:{"handle-logic":function(a){var b=this.period,c=a.delta;this.time+=c,this.time>b&&(this.time=this.time%b),this.offset=this.time/b*(2*Math.PI),this.owner.x=this.originX+Math.sin(this.offset+this.startPos)*this.dX,this.owner.y=this.originY+Math.sin(this.offset+this.startPos)*this.dY}}})}(),function(){"use strict";platypus.createComponentClass({id:"LogicPortable",properties:{portableDirections:{down:!0}},initialize:function(a){this.carrier=this.lastCarrier=null,this.message={entity:this.owner}},events:{"handle-logic":function(){var a=this.message;this.carrierConnected?(this.carrier!==this.lastCarrier&&(this.lastCarrier&&this.lastCarrier.triggerEvent("release-me",a),this.carrier.triggerEvent("carry-me",a)),this.carrierConnected=!1):this.carrier&&(this.carrier.triggerEvent("release-me",a),this.carrier=null),this.lastCarrier=this.carrier},"hit-solid":function(a){a.y>0?this.updateCarrier(a.entity,"down"):a.y<0?this.updateCarrier(a.entity,"up"):a.x<0?this.updateCarrier(a.entity,"left"):a.x>0&&this.updateCarrier(a.entity,"right")},"force-release":function(){this.carrier&&this.carrier.triggerEvent("release-me",this.message),this.carrier=null,this.lastCarrier=this.carrier,this.carrierConnected=!1}},methods:{updateCarrier:function(a,b){this.portableDirections[b]&&a&&(a!==this.carrier&&(this.carrier=a),this.carrierConnected=!0)}}})}(),function(){"use strict";var a=include("platypus.DataMap");platypus.createComponentClass({id:"LogicPortal",initialize:function(b){var c=0,d=b.entrants||b.entrant||"no one",e=this.owner.state;if(this.destination=this.owner.destination||b.destination,this.used=!1,this.ready=!1,this.wasReady=!1,this.entrants=a.setUp(),Array.isArray(d))for(c=0;c<d.length;c++)this.entrants.set(d[c],!1);else this.entrants.set(d,!1);this.state=e,e.set("occupied",!1),e.set("ready",!0)},events:{"handle-logic":function(){var a=this.entrants,b=a.keys,c=b.length,d=!1,e=!0,f=this.state;for(!this.used&&this.activated?(this.owner.triggerEvent("port-"+this.destination),this.used=!0):this.ready&&!this.wasReady?(this.owner.triggerEvent("portal-waiting"),this.wasReady=!0):this.wasReady&&!this.ready&&(this.owner.triggerEvent("portal-not-waiting"),this.wasReady=!1);c--;)a[b[c]]?(d=!0,a.set(b[c],!1)):e=!1;f.set("occupied",d),f.set("ready",e),this.ready=!1},"occupied-portal":function(a){var b=this.entrants,c=b.keys,d=c.length;for(b.set(a.entity.type,!0);d--;)if(!b.get(c[d]))return;this.ready=!0},"activate-portal":function(){this.activated=!0}},methods:{destroy:function(){this.state=null,this.entrants.recycle(),this.entrants=null}}})}(),function(){"use strict";var a=function(a,b){return a/Math.abs(a)*b};platypus.createComponentClass({id:"LogicPushable",initialize:function(a){this.yPush=a.push||a.yPush||0,this.xPush=a.push||a.xPush||.1,a.roll?(this.radius=a.radius||this.owner.radius||(this.owner.width||this.owner.height||2)/2,this.owner.orientation=this.owner.orientation||0):this.radius=0,this.currentPushX=0,this.currentPushY=0,this.lastX=this.owner.x,this.lastY=this.owner.y,this.pushers=Array.setUp()},events:{"handle-logic":function(b){var c=0,d=b.delta;for(this.currentPushY&&(this.owner.y+=a(this.currentPushY,this.yPush*d),this.currentPushY=0),this.currentPushX&&(this.owner.x+=a(this.currentPushX,this.xPush*d),this.currentPushX=0),this.lastX===this.owner.x&&this.lastY===this.owner.y||(this.radius&&(this.owner.orientation+=(this.owner.x+this.owner.y-this.lastX-this.lastY)/this.radius),this.lastX=this.owner.x,this.lastY=this.owner.y),c=0;c<this.pushers.length;c++)this.pushers[c].triggerEvent("pushed",this.owner);this.pushers.length=0},"push-entity":function(a){var b=a.x||0,c=a.y||0;this.currentPushX-=b,this.currentPushY-=c,(this.yPush&&c||this.xPush&&b)&&this.pushers.push(a.entity)},"hit-solid":function(a){return a.y>0&&this.vY>0||a.y<0&&this.vY<0?this.vY=0:(a.x<0&&this.vX<0||a.x>0&&this.vX>0)&&(this.vX=0),!0}},methods:{destroy:function(){this.pushers.recycle()}}})}(),function(){"use strict";var a=include("platypus.Vector");platypus.createComponentClass({id:"LogicRebounder",initialize:function(b){platypus.Vector.assign(this.owner,"velocity","dx","dy","dz"),this.owner.mass=this.owner.mass||b.mass||1,this.elasticity=b.elasticity||.8,this.v=a.setUp(0,0,0),this.incidentVector=a.setUp(0,0,0),this.staticCollisionOccurred=!1,this.nonStaticCollisionOccurred=!1,this.hitThisTick=Array.setUp(),this.otherV=a.setUp(0,0,0),this.otherVelocityData=Array.setUp()},events:{"handle-logic":function(){var a=0;for(this.hitThisTick.length=0,a=0;a<this.otherVelocityData.length;a++)this.otherVelocityData[a].velocity.recycle();this.otherVelocityData.length=0},"hit-static":function(a){var b=0,c=a.entity,d=0;for(d=0;d<this.hitThisTick.length;d++)if(c===this.hitThisTick[d])return;this.hitThisTick.push(c),this.v.setVector(this.owner.velocity),this.incidentVector.setVector(a.direction),b=this.v.scalarProjection(this.incidentVector),isNaN(b)||(this.incidentVector.scale(b*(1+this.elasticity)),this.v.subtractVector(this.incidentVector)),this.owner.velocity.setVector(this.v)},"hit-non-static":function(a){var b=0,c=a.entity,d=!1,e=0,f=0,g=0;if(!((b=this.hitThisTick.indexOf(c))>=0)){for(this.hitThisTick.push(c),b=0;b<this.otherVelocityData.length;b++)if(c===this.otherVelocityData[b].entity){this.otherV.setVector(this.otherVelocityData[b].velocity),d=!0;break}d||(this.otherV.setVector(c.velocity),c.triggerEvent("share-velocity",this.owner)),this.v.setVector(this.owner.velocity),this.incidentVector.setVector(a.direction),e=this.v.scalarProjection(this.incidentVector),e=isNaN(e)?0:e,f=this.otherV.scalarProjection(this.incidentVector),f=isNaN(f)?0:f,g=(e*(this.owner.mass-c.mass)+2*c.mass*f)/(this.owner.mass+c.mass),this.incidentVector.scale(g-e),this.owner.velocity.setVector(this.incidentVector)}},"share-velocity":function(b){this.otherVelocityData.push({entity:b,velocity:a.setUp(b.velocity)})}},methods:{destroy:function(){this.v.recycle(),this.incidentVector.recycle(),this.otherV.recycle(),this.hitThisTick.recycle(),this.otherVelocityData.recycle()}},publicMethods:{}})}(),function(){"use strict";var a=include("platypus.Entity");platypus.createComponentClass({id:"LogicRegionSpawner",initialize:function(a){var b=0,c=0,d=1,e=1,f=0,g=0,h=0,i=0;if(this.spawnPosition={x:0,y:0},this.spawnProperties={type:a.spawn,properties:this.spawnPosition},this.regions=null,this.usedRegions=null,this.regionWidth=0,this.regionHeight=0,a.regions)for(this.regions=Array.setUp(),this.usedRegions=Array.setUp(),this.regionWidth=f=a.regions.width||this.owner.width,this.regionHeight=g=a.regions.height||this.owner.height,d=Math.round(this.owner.width/f),e=Math.round(this.owner.height/g),b=0;b<d;b++)for(c=0;c<e;c++)h=Math.min(f,this.owner.width-b*f),i=Math.min(g,this.owner.height-c*g),this.regions.push({x:b*f,y:c*g,width:h,height:i});this.interval=this.owner.interval||a.interval||1e3,this.time=0},events:{"handle-logic":function(a){var b=this.regions,c=null;this.time+=a.delta,this.time>this.interval&&(this.time-=this.interval,b?(b.length||(this.regions=this.usedRegions,this.usedRegions=b,b=this.regions),c=b[Math.floor(b.length*Math.random())],this.spawnPosition.x=this.owner.x-(this.owner.regX||0)+(c.x+Math.random()*c.width),this.spawnPosition.y=this.owner.y-(this.owner.regY||0)+(c.y+Math.random()*c.height)):(this.spawnPosition.x=this.owner.x-(this.owner.regX||0)+Math.random()*this.owner.width,this.spawnPosition.y=this.owner.y-(this.owner.regY||0)+Math.random()*this.owner.height),this.owner.parent.addEntity(this.spawnProperties))}},methods:{destroy:function(){this.regions&&(this.regions.recycle(),this.usedRegions.recycle())}},getAssetList:function(b,c,d){var e=b.spawn||c.spawn||d.spawn;return e?a.getAssetList({type:e}):Array.setUp()}})}(),function(){"use strict";var a=Math.cos,b=Math.sin,c=function(b,c){return b*a(c)},d=function(a,c){return a*b(c)};platypus.createComponentClass({id:"LogicRotationalMovement",properties:{speed:.3,angle:0,degree:1},initialize:function(){var a=this.owner.state;this.magnitude=0,this.state=a,a.set("moving",!1),a.set("turningRight",!1),a.set("turningLeft",!1),this.owner.orientation=0,this.moving=!1,this.turningRight=!1,this.turningLeft=!1},events:{"handle-logic":function(a){var b=this.state;this.turningRight&&(this.angle+=this.degree*a.delta/15),this.turningLeft&&(this.angle-=this.degree*a.delta/15),this.moving&&(this.owner.x+=c(this.magnitude,this.angle)*a.delta,this.owner.y+=d(this.magnitude,this.angle)*a.delta),b.set("moving",this.moving),b.set("turningLeft",this.turningLeft),b.set("turningRight",this.turningRight),this.owner.orientation!==this.angle&&(this.owner.orientation=this.angle*Math.PI/180,this.owner.triggerEvent("orientation-updated"))},rotate:function(a){this.angle+=a},"turn-right":function(a){this.turningRight=!a||a.pressed},"turn-left":function(a){this.turningLeft=!a||a.pressed},"go-forward":function(a){!a||a.pressed?(this.moving=!0,this.magnitude=this.speed):this.moving=!1},"go-backward":function(a){!a||a.pressed?(this.moving=!0,this.magnitude=-this.speed):this.moving=!1},stop:function(a){a&&!a.pressed||(this.moving=!1,this.turningLeft=!1,this.turningRight=!1)},"stop-moving":function(a){a&&!a.pressed||(this.moving=!1)},"stop-turning":function(a){a&&!a.pressed||(this.turningLeft=!1,this.turningRight=!1)}},methods:{destroy:function(){this.state=null}}})}(),function(){"use strict";var a=include("platypus.Entity");platypus.createComponentClass({id:"LogicSpawner",initialize:function(a){var b=this.owner.spawneeClass||a.spawneeClass,c="",d=0;if(this.state=this.owner.state,this.stateName=a.state||"spawning",this.originalZ=platypus.game.settings.entities[b]&&platypus.game.settings.entities[b].properties&&platypus.game.settings.entities[b].properties.z||0,this.speed=a.speed||this.owner.speed||0,this.state.set(this.stateName,!1),this.spawneeProperties={x:0,y:0,z:0,dx:0,dy:0,spawner:this.owner},a.passOnProperties)for(d=0;d<a.passOnProperties.length;d++)c=a.passOnProperties[d],this.owner[c]&&(this.spawneeProperties[c]=this.owner[c]);this.propertiesContainer={type:b,properties:this.spawneeProperties},this.offsetX=this.owner.offsetX||a.offsetX||0,this.offsetY=this.owner.offsetY||a.offsetY||0,this.firing=!1},events:{"handle-logic":function(){var a=0,b=this.state;this.firing&&(this.spawneeProperties.x=this.owner.x,this.spawneeProperties.y=this.owner.y,this.spawneeProperties.z=this.owner.z+this.originalZ,a=this.offsetX,b.get("left")&&(a*=-1),this.spawneeProperties.x+=a,a=this.offsetY,b.get("top")&&(a*=-1),this.spawneeProperties.y+=a,this.speed?(b.get("top")?this.spawneeProperties.dy=-this.speed:b.get("bottom")?this.spawneeProperties.dy=this.speed:delete this.spawneeProperties.dy,b.get("left")?this.spawneeProperties.dx=-this.speed:b.get("right")?this.spawneeProperties.dx=this.speed:delete this.spawneeProperties.dx):(delete this.spawneeProperties.dx,delete this.spawneeProperties.dy),this.parent.addEntity(this.propertiesContainer)),b.set(this.stateName,this.firing),this.firing=!1},spawn:function(a){this.firing=!a||!1!==a.pressed,this.parent=this.owner.parent}},methods:{destroy:function(){this.state=null}},getAssetList:function(b,c,d){var e=b.spawneeClass||c.spawneeClass||d.spawneeClass;return e?a.getAssetList({type:e}):Array.setUp()}})}(),function(){"use strict";var a=include("platypus.DataMap"),b=include("platypus.StateMap"),c=function(a,b){b.update(a)},d=function(a,b){b.set(a,!0)},e=null,f=null,g=function(b){var c=null,d="";if(!b||"object"!=typeof b||Array.isArray(b)||b.event)return b;c=a.setUp();for(d in b)b.hasOwnProperty(d)&&c.set(d,g(b[d]));return c};e=function(a,b,c,d,g,h,i){var j=0,k="",l=null,m=d.message||0===d.message||!1===d.message,n=null;if(g){if("string"==typeof d)return void h.triggerEvent(d);if(Array.isArray(d)){for(j=0;j<d.length;j++)e(a,b,c,d[j],g,h,i);return}if(d.event&&(m||d.delay))return void(d.delay?i.push(d):h.trigger(d.event,d.message));d.get&&(n=d.get("true"))&&e(a,b,c,n,g,h,i)}if(l=d.keys)for(j=l.length;j--;)"true"!==(k=l[j])&&f(k,b,c,d.get(k),g,h,i)},f=function(a,b,c,d,f,g,h){var i=f,j=!1,k="",l=!1;"!"===a.charAt(0)?(k=a.substring(1),l=b.get(k),j=!1===l,"outputs"!==a&&c.get(k)!==l&&(i=!0)):(l=b.get(a),j=!0===l,"outputs"!==a&&c.get(a)!==l&&(i=!0)),(j||"outputs"===a)&&e(a,b,c,d,i,g,h)},platypus.createComponentClass({id:"LogicStateMachine",properties:{inputs:null,outputs:null},initialize:function(a){var e=0,f=this.inputs,h="",i=null,j=null,k=null,l=a["sustained-inputs"],m=this.owner.state;if(this.state=m,f){k=Array.setUp();for(h in f)if(f.hasOwnProperty(h))for(j=b.setUp(f[h]),k.push(j),this.addEventListener(h,c.bind(this,j,m)),i=j.keys,e=i.length;e--;)m.set(i[e],!1);this.stateObjects=k}if(this.sustainedState=b.setUp(),l)for(h in l)l.hasOwnProperty(h)&&(this.addEventListener(h,d.bind(this,l[h],this.sustainedState)),this.sustainedState.set(l[h],!1),m.set(l[h],!1));this.snapshot=b.setUp(),this.last=b.setUp(),this.queueTimes=Array.setUp(),this.queue=Array.setUp(),this.outputs=g(this.outputs)},events:{"handle-logic":function(a){for(var b=this.sustainedState,c="",d=b.keys,e=d.length,f=this.state;e--;)c=d[e],f.set(c,b.get(c)),b.set(c,!1);for(e=this.queue.length;e--;)this.queueTimes[e]-=a.delta,this.queueTimes[e]<=0&&(this.owner.trigger(this.queue[e].event,this.queue[e].message),this.queueTimes.greenSplice(e),this.queue.greenSplice(e))},"update-state":function(a){this.state.update(a)},"state-changed":function(a){var b=0,c=null,d=this.snapshot;if(this.outputs){for(d.update(a),c=Array.setUp(),f("outputs",d,this.last,this.outputs,!1,this.owner,c),b=c.length;b--;)this.queue.push(c[b]),this.queueTimes.push(c[b].delay);c.recycle(),this.last.update(d)}}},methods:{destroy:function(){var a=0,b=this.stateObjects;if(this.queueTimes.recycle(),this.queue.recycle(),b){for(a=b.length;a--;)b[a].recycle();b.recycle(),this.stateObjects=null}this.sustainedState.recycle(),this.snapshot.recycle(),this.last.recycle(),this.state=null,this.inputs=null}}})}(),function(){"use strict";platypus.createComponentClass({id:"LogicSwitch",initialize:function(a){this.state=this.owner.state,this.pressed=!1,this.wasPressed=this.pressed,this.sticky=a.sticky||!1,this.state.set("pressed",!1),this.initialPress=!0},events:{"handle-logic":function(){this.sticky?this.pressed&&!this.wasPressed&&(this.state.set("pressed",!0),this.wasPressed=!0,this.owner.triggerEvent("switch-on")):(this.pressed!==this.wasPressed&&(this.pressed?(this.state.set("pressed",!0),this.owner.triggerEvent("switch-on")):(this.state.set("pressed",!1),this.owner.triggerEvent("switch-off"))),this.wasPressed=this.pressed,this.pressed=!1)},"switch-pressed":function(){this.pressed=!0,this.initialPress&&(this.owner.triggerEvent("initial-press"),this.initialPress=!1)}},methods:{destroy:function(){this.state=null}}})}(),function(){"use strict";var a=include("platypus.Vector");platypus.createComponentClass({id:"LogicTeleportee",initialize:function(){this.teleportDestination=a.setUp(),this.teleportNow=!1,this.DestinationSet=!1,this.message={position:this.teleportDestination}},events:{"handle-logic":function(){this.teleportNow&&(this.owner.triggerEvent("relocate-entity",this.message),this.teleportNow=!1,this.owner.triggerEvent("teleport-complete"))},teleport:function(){this.destinationSet&&(this.teleportNow=!0)},"set-destination":function(a){this.setDestination(a)},"hit-telepoint":function(a){this.setDestination(a.entity)}},methods:{setDestination:function(a){this.teleportDestination.setXYZ(a.x,a.y,this.owner.z),this.destinationSet=!0},destroy:function(){this.teleportDestination.recycle()}}})}(),function(){"use strict";platypus.createComponentClass({id:"LogicTeleporter",initialize:function(a){this.destination=null,this.linkId=this.owner.teleportId||a.teleportId,this.facing=this.owner.facing||a.facing||!1,this.facing&&this.owner.state.set("facing-"+this.facing,!0)},events:{"peer-entity-added":function(a){this.destination||a.linkId!==this.linkId||(this.destination=a)},"teleport-entity":function(a){switch(this.facing){case"up":a.y<0&&a.entity.triggerEvent("teleport",this.destination);break;case"right":a.x>0&&a.entity.triggerEvent("teleport",this.destination);break;case"down":a.y>0&&a.entity.triggerEvent("teleport",this.destination);break;case"left":a.x<0&&a.entity.triggerEvent("teleport",this.destination);break;default:a.entity.triggerEvent("teleport",this.destination)}}},methods:{destroy:function(){this.destination=null}}})}(),function(){"use strict";platypus.createComponentClass({id:"LogicTimer",initialize:function(a){this.time=this.owner.time||a.time||0,this.prevTime=this.time,this.alarmTime=this.owner.alarmTime||a.alarmTime||0,this.isInterval=this.owner.isInterval||a.isInterval||!1,this.alarmMessage=this.owner.alarmMessage||a.alarmMessage||"",this.updateMessage=this.owner.updateMessage||a.updateMessage||"",this.isOn=this.owner.on||a.on||!0,this.isIncrementing=this.owner.isIncrementing||a.isIncrementing||!0,this.maxTime=this.owner.maxTime||a.maxTime||36e5},events:{"handle-logic":function(a){this.isOn&&(this.prevTime=this.time,this.isIncrementing?this.time+=a.delta:this.time-=a.delta,Math.abs(this.time)>this.maxTime&&(this.time>0?this.time=this.maxTime:this.time<0&&(this.time=-this.maxTime),this.triggerEvent("stop-timer")),0!==this.alarmTime&&(this.isInterval?this.isIncrementing?Math.floor(this.time/this.alarmTime)>Math.floor(this.prevTime/this.alarmTime)&&this.owner.trigger(this.alarmMessage):Math.floor(this.time/this.alarmTime)<Math.floor(this.prevTime/this.alarmTime)&&this.owner.trigger(this.alarmMessage):this.isIncrementing?this.time>this.alarmTime&&this.prevTime<this.alarmTime&&this.owner.trigger(this.alarmMessage):this.time<this.alarmTime&&this.prevTime>this.alarmTime&&this.owner.trigger(this.alarmMessage))),this.owner.trigger(this.updateMessage,{time:this.time})},"set-timer":function(a){this.time=a.time},"start-timer":function(){this.isOn=!0},"stop-timer":function(){this.isOn=!1}}})}(),function(){"use strict";platypus.createComponentClass({id:"LogicWindUpRacer",properties:{speed:.3,raceTime:5e3,windTime:500},initialize:function(){var a=this.owner.state;this.windProgress=0,this.winding=!1,this.racing=!1,this.blocked=!1,this.right=!1,this.left=!1,this.state=a,a.set("windingUp",!1),a.set("racing",!1),a.set("blocked",!1)},events:{"handle-logic":function(a){var b=this.state;this.racing?!this.blocked&&this.right&&b.get("right")?(this.owner.x+=this.speed*a.delta,this.owner.triggerEvent("racing")):!this.blocked&&this.left&&b.get("left")?(this.owner.x-=this.speed*a.delta,this.owner.triggerEvent("racing")):(this.racing=!1,this.owner.triggerEvent("stopped-racing")):this.winding?((this.right&&b.get("right")||this.left&&b.get("left"))&&(this.windProgress+=a.delta),this.owner.triggerEvent("winding",this.windProgress/this.windTime)):this.windProgress&&(this.windProgress>=this.windTime&&(this.racing=!0),this.windProgress=0,this.owner.triggerEvent("stopped-winding")),b.set("windingUp",this.winding),b.set("racing",this.racing),b.set("blocked",this.blocked),this.blocked=!1},"stop-racing":function(){this.racing=!1,this.owner.triggerEvent("stopped-racing")},"wind-up":function(a){this.winding=!a||!1!==a.pressed,this.right=this.state.get("right"),this.left=this.state.get("left")},"hit-solid":function(a){a.x&&this.racing&&(this.right&&a.x>0||this.left&&a.x<0)&&(this.blocked=!0,this.owner.triggerEvent("blocked",a))}},methods:{destroy:function(){this.state.set("windingUp",!1),this.state.set("racing",!1),this.state.set("blocked",!1),this.state=null}}})}(),function(){"use strict";var a=include("platypus.Vector"),b=function(){return!0},c=function(a,b){return a.get(b)},d=function(a,b,c){var d=a(),e=b();if(this.activeVelocity){if(this.enact&&!e&&(this.ready=!1),this.ready&&this.enact&&d)this.ready=!1,this.velocity.setVector(this.instant),c&&this.owner.triggerEvent(c);else if(this.ready||this.enact&&d){if(e)return null}else this.ready=!0,this.decay();return this.velocity}return null},e=function(a,b){return this.activeVelocity&&a()?(this.activeAcceleration&&this.move(b),this.velocity):null},f=function(a,f){var g=a.owner.state,h=f.controlState?c.bind(null,g,f.controlState):b,i=f.instantState?c.bind(null,g,f.instantState):b;a.instant||f.instantState?(a.instant=!0,a.update=d.bind(a,i,h,f.instantSuccess)):a.update=e.bind(a,h)};platypus.createComponentClass({id:"Motion",properties:{orient:!0,acceleration:0,activeAcceleration:!0,activeVelocity:!0,maxMagnitude:1/0,controlState:"",instant:!1,instantState:"",instantSuccess:"",instantDecay:null,velocity:0,stopOnCollision:!0,drag:-1,friction:-1},initialize:function(b){this.acceleration||(this.activeAcceleration=!1),this.acceleration=a.setUp(this.acceleration),this.velocity=a.setUp(this.velocity),this.triggered=!1,this.ready=!0,"number"==typeof this.instantDecay?this.capMagnitude=this.velocity.magnitude()*this.instantDecay:this.capMagnitude=-1,f(this,b),this.instant&&(this.enact=!1,this.instant=a.setUp(this.velocity),this.velocity.setXYZ(0,0,0)),this.orient&&(this.owner.triggerEvent("orient-vector",this.velocity),this.owner.triggerEvent("orient-vector",this.acceleration))},events:{"control-velocity":function(a){this.activeVelocity=a&&!1!==a.pressed},"stop-velocity":function(){this.activeVelocity=!1},"start-velocity":function(){
  this.activeVelocity=!0},"control-acceleration":function(a){this.activeAcceleration=a&&!1!==a.pressed},"stop-acceleration":function(){this.activeAcceleration=!1},"start-acceleration":function(){this.activeAcceleration=!0},"instant-motion":function(a){this.enact=a&&!1!==a.triggered},"instant-begin":function(){this.enact=!0},"instant-end":function(){this.enact=!1},"set-motion":function(a){a.acceleration&&this.acceleration.set(a.acceleration),a.velocity&&(this.velocity.set(a.velocity),"number"==typeof this.instantDecay?this.capMagnitude=this.velocity.magnitude()*this.instantDecay:this.capMagnitude=-1),"number"==typeof a.maxMagnitude&&(this.maxMagnitude=a.maxMagnitude)}},methods:{move:function(b){var c=a.setUp(this.acceleration).multiply(b);return this.velocity.add(c),c.recycle(),this.velocity.magnitude()>this.maxMagnitude&&this.velocity.normalize().multiply(this.maxMagnitude),this.velocity},decay:function(){this.capMagnitude>=0&&this.velocity.magnitude()>this.capMagnitude&&this.velocity.normalize().multiply(this.capMagnitude)},destroy:function(){this.orient&&(this.owner.triggerEvent("remove-vector",this.acceleration),this.owner.triggerEvent("remove-vector",this.velocity)),this.acceleration.recycle(),this.velocity.recycle(),this.instant&&this.instant.recycle()}},publicMethods:{}})}(),function(){"use strict";var a=include("platypus.Vector"),b=a.setUp(),c=function(a,b,c,d){return a&&b!==c?b<c?Math.min(b+a*d,c):Math.max(b-a*d,c):b},d=function(a,b){var d=this.maxMagnitudeInterim=c(this.maxMagnitudeDelta,this.maxMagnitudeInterim,this.maxMagnitude,b);a.magnitude()>d&&a.normalize().multiply(d)},e=function(a,b){var d=this.maxMagnitude,e=this.maxMagnitudeDelta,f=this.maxMagnitudeInterim;f.up=c(e,f.up,d.up,b),f.right=c(e,f.right,d.right,b),f.down=c(e,f.down,d.down,b),f.left=c(e,f.left,d.left,b),a.x>0?a.x>f.right&&(a.x=f.right):a.x<0&&a.x<-f.left&&(a.x=-f.left),a.y>0?a.y>f.down&&(a.y=f.down):a.y<0&&a.y<-f.up&&(a.y=-f.up)};platypus.createComponentClass({id:"Mover",properties:{ground:[0,1]},publicProperties:{movers:[],gravity:0,jump:0,speed:0,drag:.01,friction:.06,maxMagnitude:1/0,maxMagnitudeDelta:0,reorientVelocities:!0},initialize:function(){var b=1/0,c=this.maxMagnitude,f=this.owner.state;platypus.Vector.assign(this.owner,"position","x","y","z"),platypus.Vector.assign(this.owner,"velocity","dx","dy","dz"),this.position=this.owner.position,this.velocity=this.owner.velocity,this.lastVelocity=a.setUp(this.velocity),this.collision=null,this.pause=!1,this.moversCopy=this.movers,this.movers=Array.setUp(),this.velocityChanges=Array.setUp(),this.velocityDirections=Array.setUp(),this.ground=a.setUp(this.ground),this.state=f,f.set("grounded",!1),Object.defineProperty(this.owner,"maxMagnitude",{get:function(){return b},set:function(a){"number"==typeof a?(this.clamp=d,b=a,this.maxMagnitudeDelta||(this.maxMagnitudeInterim=a)):(this.clamp=e,"number"==typeof b&&(b={up:b,right:b,down:b,left:b}),"number"==typeof a.up&&(b.up=a.up),"number"==typeof a.right&&(b.right=a.right),"number"==typeof a.down&&(b.down=a.down),"number"==typeof a.left&&(b.left=a.left),"number"==typeof this.maxMagnitudeInterim?this.maxMagnitudeDelta?this.maxMagnitudeInterim={up:this.maxMagnitudeInterim,right:this.maxMagnitudeInterim,down:this.maxMagnitudeInterim,left:this.maxMagnitudeInterim}:this.maxMagnitudeInterim={up:b.up,right:b.right,down:b.down,left:b.left}:this.maxMagnitudeDelta||(this.maxMagnitudeInterim.up=b.up,this.maxMagnitudeInterim.right=b.right,this.maxMagnitudeInterim.down=b.down,this.maxMagnitudeInterim.left=b.left))}.bind(this)}),this.maxMagnitudeInterim=0,this.maxMagnitude=c},events:{"component-added":function(a){"Motion"===a.type&&this.movers.push(a)},"component-removed":function(a){var b=0;"Motion"===a.type&&(b=this.movers.indexOf(a))>=0&&this.movers.greenSplice(b)},load:function(){var a=0,b=this.moversCopy;for(delete this.moversCopy,a=0;a<b.length;a++)this.addMover(b[a]);this.externalForces=this.addMover({velocity:[0,0,0],orient:!1}).velocity,this.speed&&(isNaN(this.speed)||(this.speed=[this.speed,0,0]),this.speed=this.addMover({velocity:this.speed,controlState:"moving"}).velocity),this.gravity&&(isNaN(this.gravity)||(this.gravity=[0,this.gravity,0]),this.gravity=this.addMover({acceleration:this.gravity,orient:!1,aliases:{gravitate:"control-acceleration"}}).acceleration),this.jump&&(isNaN(this.jump)||(this.jump=[0,this.jump,0]),this.jump=this.addMover({velocity:this.jump,instant:!0,controlState:"grounded",state:"jumping",instantSuccess:"just-jumped",instantDecay:.2,aliases:{jump:"instant-motion"}}).instant)},"handle-movement":function(b){var c=b.delta,d=null,e=this.state,f=null,g=this.velocity,h=this.position,i=this.movers,j=i.length;if(!e.get("paused")&&!this.paused){for(g.equals(this.lastVelocity,2)||this.externalForces.addVector(g).subtractVector(this.lastVelocity),g.setXYZ(0,0,0);j--;)(d=i[j].update(c))&&(this.grounded?-1!==i[j].friction?d.multiply(1-i[j].friction):d.multiply(1-this.friction):-1!==i[j].drag?d.multiply(1-i[j].drag):d.multiply(1-this.drag),g.add(d));this.clamp(g,c),this.lastVelocity.setVector(g),f=a.setUp(g).multiply(c),h.add(f),f.recycle(),e.set("grounded",this.grounded),this.grounded=!1}},"hit-solid":function(b){var c=0,d=0,e=b.entity&&b.entity.velocity,f=b.direction,g=!0,h=this.velocityChanges,i=this.velocityDirections,j=h.length;if(f.dot(this.ground)>0&&(this.grounded=!0),(c=this.velocity.scalarProjection(f))>0){for(e?(d=Math.max(e.scalarProjection(f),0),c=d<c?d:0):c=0;j--;)if(c<h[j]&&i[j].dot(f)>0){h[j]=c,i[j].setVector(f),g=!1;break}g&&(h.push(c),i.push(a.setUp(f)))}},"handle-post-collision-logic":function(){var a=null,c=this.movers,d=this.velocityChanges,e=this.velocityDirections,f=d.length,g=c.length,h=null,i=0,j=0,k=null,l=b;if(f){for(k=Array.setUp();g--;)h=c[g],h.stopOnCollision&&k.push(h);for(;f--;){for(a=e[f],i=d[f],g=k.length,j=i/g;g--;)h=k[g],l.setVector(a).normalize().multiply(j-h.velocity.scalarProjection(a)),h.velocity.add(l);a.recycle()}d.length=0,e.length=0}},"set-mover":function(a){"number"==typeof a.maxMagnitudeDelta&&(this.maxMagnitudeDelta=a.maxMagnitudeDelta),a.maxMagnitude&&(this.maxMagnitude=a.maxMagnitude)},"pause-movement":function(){this.paused=!0},"unpause-movement":function(){this.paused=!1},"orientation-updated":function(a){this.reorientVelocities||this.lastVelocity.multiply(a)}},methods:{destroy:function(){var a=0,b=this.maxMagnitude;for(a=this.movers.length-1;a>=0;a--)this.removeMover(this.movers[a]);this.movers.recycle(),this.ground.recycle(),this.lastVelocity.recycle(),this.velocityChanges.recycle(),this.velocityDirections.recycle(),delete this.owner.maxMagnitude,this.owner.maxMagnitude=b,this.state=null}},publicMethods:{addMover:function(a){return this.owner.addComponent(new platypus.components.Motion(this.owner,a))},removeMover:function(a){this.owner.removeComponent(a)}}})}(),function(){"use strict";platypus.createComponentClass({id:"Node",publicProperties:{x:0,y:0,z:0},initialize:function(a){this.nodeId=a.nodeId||this.owner.nodeId||this.owner.id||String(Math.random()),"string"!=typeof this.nodeId&&this.nodeId.length&&(this.nodeId=a.nodeId.join("|")),this.owner.nodeId=this.nodeId,this.owner.isNode=!0,this.map=this.owner.map=this.owner.map||null,this.contains=this.owner.contains=Array.setUp(),this.edgesContain=this.owner.edgesContain=Array.setUp(),platypus.Vector.assign(this.owner,"position","x","y","z"),this.neighbors=this.owner.neighbors=a.neighbors||this.owner.neighbors||{}},events:{"add-neighbors":function(a){var b=0,c=null;for(c in a)a.hasOwnProperty(c)&&(this.neighbors[c]=a[c]);for(b=0;b<this.contains.length;b++)this.contains[b].triggerEvent("set-directions")},"remove-neighbor":function(a){var b=null,c=a;"string"!=typeof c&&(c=c.nodeId);for(b in this.neighbors)if(this.neighbors.hasOwnProperty(b))if("string"==typeof this.neighbors[b]){if(this.neighbors[b]===c){delete this.neighbors[b];break}}else if(this.neighbors[b].nodeId===c){delete this.neighbors[b];break}}},methods:{destroy:function(){this.contains.recycle(),this.edgesContain.recycle()}},publicMethods:{getNode:function(a){var b=null;if(!this.map&&this.owner.map&&(this.map=this.owner.map),this.neighbors[a]){if(b=this.neighbors[a],b.isNode)return b;if("string"==typeof b){if(b=this.map.getNode(b))return this.neighbors[a]=b,b}else if(b.length&&(b=this.map.getNode(b.join("|"))))return this.neighbors[a]=b,b;return null}return null},addToNode:function(a){var b=0;for(b=0;b<this.contains.length;b++)if(this.contains[b]===a)return!1;return this.contains.push(a),a},removeFromNode:function(a){var b=0;for(b=0;b<this.contains.length;b++)if(this.contains[b]===a)return this.contains.greenSplice(b);return!1},addToEdge:function(a){var b=0;for(b=0;b<this.edgesContain.length;b++)if(this.edgesContain[b]===a)return!1;return this.edgesContain.push(a),a},removeFromEdge:function(a){var b=0;for(b=0;b<this.edgesContain.length;b++)if(this.edgesContain[b]===a)return this.edgesContain.greenSplice(b);return!1}}})}(),function(){"use strict";var a=include("platypus.Vector"),b=function(a,b){a.id?"string"==typeof a.id?this.id=a.id:Array.isArray(a.id)?this.id=a.id.join("|"):this.id=String(Math.random()):this.id=String(Math.random()),this.isNode=!0,this.map=b,this.contains=Array.setUp(),this.type=a.type||"",this.x=a.x||0,this.y=a.y||0,this.z=a.z||0,this.neighbors=a.neighbors||{}},c=b.prototype;c.getNode=function(a){var b=null;if(this.neighbors[a]){if(b=this.neighbors[a],b.isNode)return b;if("string"==typeof b){if(b=this.map.getNode(b))return this.neighbors[a]=b,b}else if(Array.isArray(b)&&(b=this.map.getNode(b.join("|"))))return this.neighbors[a]=b,b;return null}return null},c.add=function(a){var b=0;for(b=0;b<this.contains.length;b++)if(this.contains[b]===a)return!1;return this.contains.push(a),a},c.remove=function(a){var b=0;for(b=0;b<this.contains.length;b++)if(this.contains[b]===a)return this.contains.greenSplice(b);return!1},c.recycle=function(){this.contains.recycle(),this.recycle()},recycle.add(b,!!springroll.Debug,"Node"),platypus.createComponentClass({id:"NodeMap",publicProperties:{map:[]},initialize:function(){var a=0,c=this.map;for(this.map=Array.setUp(),this.nodes={},this.residentsAwaitingNode=Array.setUp(),a=0;a<c.length;a++)this.addNode(b.setUp(c[a],this))},events:{"add-node":function(a){var c=0,d=null,e=null;for(a.isNode?(e=a,a.map=this):e=b.setUp(a,this),this.addNode(e),c=this.residentsAwaitingNode.length-1;c>=0;c--)d=this.residentsAwaitingNode[c],e.id===d.nodeId&&(this.residentsAwaitingNode.greenSplice(c),d.node=this.getNode(d.nodeId),d.triggerEvent("on-node",d.node))},"child-entity-added":function(a){a.isNode?this.owner.triggerEvent("add-node",a):a.nodeId&&(a.node=this.getNode(a.nodeId),a.node?a.triggerEvent("on-node",a.node):this.residentsAwaitingNode.push(a))}},methods:{addNode:function(a){this.map.push(a),this.nodes[a.id]=a},destroy:function(){var a=0;for(a=0;a<this.map.length;a++)this.map[a]instanceof platypus.Entity||this.map[a].recycle();this.map.recycle(),this.residentsAwaitingNode.recycle()}},publicMethods:{getNode:function(){var a=0,b="",c="",d=arguments;if(1===d.length){if(d[0].isNode)return d[0];Array.isArray(d[0])&&(d=d[0])}for(a=0;a<d.length;a++)b+=c+d[a],c="|";return this.nodes[b]||null},getClosestNode:function(b,c,d){var e=0,f=a.setUp(b),g=a.setUp(),h=0,i=c||this.map,j=null,k=1/0;for(e=0;e<i.length;e++)if((h=g.setVector(f).subtractVector(i[e].position).magnitude())<k){if(d&&d.indexOf(i[e])>=0)break;k=h,j=i[e]}return f.recycle(),g.recycle(),j}}})}(),function(){"use strict";var a=function(a,b,c){return function(){var d=b.getNode(a);return!!this.isPassable(d)&&(this.destinationNodes.length=0,this.destinationNodes.push(d),this.node?this.onEdge(d):this.distance=0,this.progress=0,this.setState("going-"+c),!0)}},b=function(a,b){var c=b.x-a.x,d=b.y-a.y,e=b.z-a.z;return Math.sqrt(c*c+d*d+e*e)},c=function(a,b,c,d){var e=b.x-a.x,f=b.y-a.y,g=0;return a.rotation&&b.rotation?(e=(a.rotation+180)%360,f=(b.rotation+180)%360,(e*(1-d)+f*d+180)%360):c?(g=Math.acos(e/c),f<0&&(g=2*Math.PI-g),180*g/Math.PI):g},d=function(a,b,c,d){return b*(1-a)+c*a+d},e=function(a,b){var c=0,d=0,e=!1;if(null===b)return!0;for(c=0;c<a.length;c++){for(d=0;d<b.length;d++)a[c].type===b[d]&&(e=!0);if(!e)return!1;e=!1}return!0};platypus.createComponentClass({id:"NodeResident",publicProperties:{speed:0},initialize:function(a){var c=a.offset||this.owner.nodeOffset||{};this.nodeId=this.owner.nodeId=a.nodeId||this.owner.nodeId,this.neighbors={},this.friendlyNodes=a.nodes||null,this.friendlyEntities=a.shares||null,this.snapToNodes=a.snapToNodes||!1,this.updateOrientation=a.updateOrientation||!1,this.distance=0,this.buffer=a.buffer||0,this.progress=0,this.offset={x:c.x||0,y:c.y||0,z:c.z||0},this.destinationNodes=Array.setUp(),this.algorithm=a.algorithm||b,this.state=this.owner.state,this.state.set("moving",!1),this.state.set("on-node",!1),this.currentState=""},events:{"set-algorithm":function(a){this.algorithm=a||b},"handle-logic":function(a){var b=0,e=0,f=0,g=null,h=null;if(this.owner.node||(h=Array.setUp(this.owner.x,this.owner.y),this.owner.triggerEvent("on-node",this.owner.parent.getClosestNode(h)),h.recycle(),this.owner.triggerEvent("in-location",this.owner)),this.followEntity?(g=this.followEntity.node||this.followEntity,g&&g.isNode&&g!==this.node?(this.lag=0,this.state.set("moving",this.gotoNode()),this.followDistance&&(f=this.lag)):this.followEntity=null):f=this.speed*a.delta,this.blocked&&(this.blocked=!1,this.goingToNode&&this.owner.triggerEvent("goto-closest-node",this.goingToNode)),this.destinationNodes.length){if(this.state.set("moving",0!==this.speed),this.node)this.onEdge(this.destinationNodes[0]);else if(!this.lastNode&&(this.owner.triggerEvent("on-node",this.destinationNodes[0]),this.destinationNodes.greenSplice(0),!this.destinationNodes.length))return void this.state.set("moving",!1);if(this.snapToNodes){for(b=0;b<this.destinationNodes.length;b++)this.owner.triggerEvent("on-node",this.destinationNodes[b]);this.destinationNodes.length=0}else for(;this.destinationNodes.length&&f;)this.progress+f>=this.distance?(g=this.destinationNodes[0],f-=this.distance-this.progress,this.progress=0,this.destinationNodes.greenSplice(0),this.owner.triggerEvent("on-node",g),this.destinationNodes.length&&f&&this.onEdge(this.destinationNodes[0])):(this.progress+=f,e=this.progress/this.distance,this.owner.x=d(e,this.lastNode.x,this.destinationNodes[0].x,this.offset.x),this.owner.y=d(e,this.lastNode.y,this.destinationNodes[0].y,this.offset.y),this.owner.z=d(e,this.lastNode.z,this.destinationNodes[0].z,this.offset.z),this.updateOrientation&&(this.owner.rotation=c(this.lastNode,this.destinationNodes[0],this.distance,e)),f=0)}else this.state.set("moving",!1)},"on-node":function(a){var b=0,c=null;for(this.owner.node=this.node=a,this.node.removeFromEdge(this.owner),this.lastNode&&this.lastNode.removeFromEdge(this.owner),this.node.addToNode(this.owner),this.setState("on-node"),this.owner.x=this.node.x+this.offset.x,this.owner.y=this.node.y+this.offset.y,this.owner.z=this.node.z+this.offset.z,this.updateOrientation&&this.node.rotation&&(this.owner.rotation=this.node.rotation),this.owner.triggerEvent("set-directions"),this.friendlyNodes&&this.friendlyNodes[a.type]&&this.owner.trigger(this.friendlyNodes[a.type],a),c=a.contains,b=0;b<c.length;b++)this.owner!==c[b]&&(c[b].triggerEvent("with-"+this.owner.type,this.owner),this.owner.triggerEvent("with-"+c[b].type,c[b]))},"leave-node":function(){this.node&&(this.node.removeFromNode(this.owner),this.owner.triggerEvent("left-node",this.node),this.owner.triggerEvent("remove-directions")),this.lastNode=this.node,this.node=null},"goto-node":function(a){this.gotoNode(a)},follow:function(a){a.entity?(this.followDistance=a.distance,this.followEntity=a.entity):(this.followDistance=0,this.followEntity=a)},"goto-closest-node":function(){var a=function(a,b){var c=0;for(c=0;c<b.length;c++)if(b[c]===a)return!0;return!1},b=function(a,b){return a.type===b},c=function(a,b){return a.type===b.type};return function(d){var e=null,f=this.node||this.lastNode,g=null,h=d.steps||0,i=null;this.goingToNode=d,g="string"==typeof d?b:"string"==typeof d.type?c:a,f&&d&&!g(f,d)&&(i=Array.setUp(),e=this.traverseNode({depth:20,origin:f,position:f,test:g,destination:d,nodes:i,shortestPath:1/0,distance:0,found:!1,algorithm:this.algorithm,blocked:!1}),e.distance-=this.progress,e.found?this.followEntity&&this.followDistance?e.distance+(this.followEntity.progress||0)>this.followDistance?(this.lag=e.distance+(this.followEntity.progress||0)-this.followDistance,this.setPath(e,h)):this.lag=0:this.setPath(e,h):e.blocked&&(this.blocked=!0),i.recycle())}}(),"set-directions":function(){var b="",c=0,d=null,e=this.node,f=null;this.owner.triggerEvent("remove-directions");for(b in e.neighbors)if(e.neighbors.hasOwnProperty(b)&&(this.neighbors[b]=a(e.neighbors[b],e.map,b),this.addEventListener(b,this.neighbors[b]),f=e.map.getNode(e.neighbors[b])))for(d=f.contains,c=0;c<d.length;c++)d[c].triggerEvent("next-to-"+this.owner.type,this.owner),this.owner.triggerEvent("next-to-"+d[c].type,d[c])},"remove-directions":function(){var a="";for(a in this.neighbors)this.neighbors.hasOwnProperty(a)&&(this.removeEventListener(a,this.neighbors[a]),delete this.neighbors[a])}},methods:{gotoNode:function(){var a=function(a,b){return a===b};return function(b){var c=null,d=this.node||this.lastNode,e=null,f=!1;return!b&&this.followEntity&&(b=this.followEntity.node||this.followEntity.lastNode||this.followEntity),d&&b&&this.node!==b&&(e=Array.setUp(),c=this.traverseNode({depth:20,origin:d,position:d,test:a,destination:b,nodes:e,shortestPath:1/0,distance:0,found:!1,algorithm:this.algorithm,blocked:!1}),c.distance-=this.progress,c.found?this.followEntity&&this.followDistance?c.distance+(this.followEntity.progress||0)>this.followDistance?(this.lag=c.distance+(this.followEntity.progress||0)-this.followDistance,this.setPath(c),f=!0):this.lag=0:(this.setPath(c),f=!0):c.blocked&&(this.blocked=!0),e.recycle()),f}}(),isPassable:function(a){return a&&this.node!==a&&(!this.friendlyNodes||void 0!==this.friendlyNodes[a.type])&&(!a.contains.length||e(a.contains,this.friendlyEntities))},traverseNode:function(a){var c=1,d="",e=a.position.map,f=null,g=null,h=null,i=null,j=a.algorithm||b,k={shortestPath:1/0,found:!1,blocked:!1},l=!0,m=!1;if(0===a.depth||a.distance>a.shortestPath)return a;if(a.test(a.position,a.destination))return a.found=!0,a.shortestPath=a.distance,a;for(h=a.nodes,c=1;c<h.length-1;c++)if(h[c]===a.position)return a;f=a.position.neighbors;for(d in f)f.hasOwnProperty(d)&&(g=e.getNode(f[d]),m=!0,this.isPassable(g)&&(h=a.nodes.greenSlice(),h.push(g),i=this.traverseNode({depth:a.depth-1,origin:a.origin,position:g,destination:a.destination,test:a.test,algorithm:j,nodes:h,shortestPath:a.shortestPath,distance:a.distance+j(a.position,g),gateway:a.gateway||d,found:!1,blocked:!1}),h.recycle(),i.found&&k.shortestPath>i.shortestPath&&(k=i),l=!1));return k.blocked=m&&l,k},setPath:function(a,b){a.nodes[0]===this.node&&a.nodes.greenSplice(0),this.destinationNodes.recycle(),this.destinationNodes=a.nodes.greenSlice(),b&&(this.destinationNodes.length=Math.min(b,this.destinationNodes.length))},setState:function(a){"on-node"===a?this.state.set("on-node",!0):(this.state.set("on-node",!1),this.currentState&&this.state.set(this.currentState,!1),this.currentState=a,this.state.set(a,!0))},onEdge:function(a){this.distance=b(this.node,a),this.updateOrientation&&(this.owner.rotation=c(this.node,a,this.distance,this.progress/this.distance)),this.node.addToEdge(this.owner),a.addToEdge(this.owner),this.owner.triggerEvent("leave-node")},destroy:function(){this.destinationNodes.recycle(),this.state=null}}})}(),function(){"use strict";var a=include("platypus.Data"),b=include("platypus.Vector"),c=b.setUp(0,0,1),d=b.setUp(1,0,0),e={identity:[[1,0,0],[0,1,0],[0,0,1]],horizontal:[[-1,0,0],[0,1,0],[0,0,-1]],vertical:[[1,0,0],[0,-1,0],[0,0,-1]],diagonal:[[0,1,0],[1,0,0],[0,0,-1]],"diagonal-inverse":[[0,-1,0],[-1,0,0],[0,0,-1]],"rotate-90":[[0,-1,0],[1,0,0],[0,0,1]],"rotate-180":[[-1,0,0],[0,-1,0],[0,0,1]],"rotate-270":[[0,1,0],[-1,0,0],[0,0,1]]},f=function(){var a=function(a,b,c){var d=0,e=0;for(d=0;d<a.length;d++)e+=a[d]*c[d][b];return e};return function(b,c,d){var e=0,f=0,g=Array.setUp();for(e=0;e<b.length;e++)for(f=0;f<b[0].length;f++)g.push(a(b[e],f,c));for(e=0;e<b.length;e++)for(f=0;f<b[0].length;f++)d[e][f]=g.greenSplice(0);g.recycle()}}(),g=function(a){var b=0,c=0;for(b=0;b<3;b++)for(c=0;c<3;c++)a[b][c]=b===c?1:0;return a};platypus.createComponentClass({id:"Orientation",publicProperties:{scaleX:1,scaleY:1,rotation:0,orientation:0,orientationMatrix:null},initialize:function(){var e=function(a,e){var h=b.setUp(1,0,0),i=a.owner,j=Array.setUp(Array.setUp(1,0,0),Array.setUp(0,1,0),Array.setUp(0,0,1));return Object.defineProperty(i,"orientationMatrix",{get:function(){return f(a.matrixTween,a.matrix,g(j)),j},enumerable:!0}),delete i.orientation,Object.defineProperty(i,"orientation",{get:function(){return h.signedAngleTo(d,c)},set:function(a){h.setVector(d).rotate(a)},enumerable:!0}),e&&("number"!=typeof e?h.set(e):h.rotate(e)),h};return function(){this.loadedOrientationMatrix=this.orientationMatrix,this.matrix=Array.setUp(Array.setUp(1,0,0),Array.setUp(0,1,0),Array.setUp(0,0,1)),this.matrixTween=Array.setUp(Array.setUp(1,0,0),Array.setUp(0,1,0),Array.setUp(0,0,1)),this.relocationMessage=a.setUp("position",null),this.vectors=Array.setUp(),this.inverses=Array.setUp(),this.tweens=Array.setUp(),this.orientationVector=e(this,this.orientation),this.owner.triggerEvent("orient-vector",this.orientationVector),this.owner.state.set("reorienting",!1)}}(),events:{load:function(){this.loadedOrientationMatrix?this.transform(this.loadedOrientationMatrix):(this.scaleX&&this.scaleX<0&&(this.scaleX=-this.scaleX,this.transform("horizontal")),this.scaleY&&this.scaleY<0&&(this.scaleY=-this.scaleY,this.transform("vertical")),this.rotation&&((this.rotation+270)%360==0?(this.rotation=0,this.transform("rotate-90")):(this.rotation+180)%360==0?(this.rotation=0,this.transform("rotate-180")):(this.rotation+90)%360==0&&(this.rotation=0,this.transform("rotate-270")))),delete this.loadedOrientationMatrix},"handle-logic":function(a){var b=this.tweens.length,c=a.delta,d=this.owner.state,e=null,f=null,h=this.relocationMessage;if(b){for(e=Array.setUp(),d.set("reorienting",!0),g(this.matrixTween);b--;)this.updateTween(this.tweens[b],c)&&e.push(this.tweens.greenSplice(b));for(b=this.vectors.length;b--;)this.updateVector(this.vectors[b],this.inverses[b]);for(b=e.length;b--;)f=e[b],this.transform(f.endMatrix),f.anchor&&(f.offset.multiply(f.endMatrix).addVector(f.anchor),h.position=f.offset,this.owner.triggerEvent("relocate-entity",h),f.recycleOffset&&f.offset.recycle()),f.onFinished(f.endMatrix),f.recycle();e.recycle()}else d.get("reorienting")&&(g(this.matrixTween),d.set("reorienting",!1))},"complete-tweens":function(){var a=0;for(a=0;a<this.tweens.length;a++)this.tweens[a].time=this.tweens[a].endTime},"drop-tweens":function(){var a=0;for(a=this.tweens.length;a--;)this.tweens[a].offset&&this.tweens[a].offset.recycle();for(this.tweens.length=0,a=this.vectors.length;a--;)this.updateVector(this.vectors[a],this.inverses[a])},"orient-vector":function(a){var c=a.aligned||!1;a.vector&&(a=a.vector),-1===this.vectors.indexOf(a)&&(c||a.multiply(this.matrix),this.vectors.push(a),this.inverses.push(b.setUp()))},"remove-vector":function(a){var b=this.vectors.indexOf(a);b>=0&&(this.vectors.greenSplice(b),this.inverses.greenSplice(b).recycle())},"tween-transform":function(){var b=function(){},c=function(){return!0},d=function(a){return a};return function(f){var g=null,h=f.angle||0,i=f.matrix,j=a.setUp("transform",f.transform,"anchor",f.anchor,"endTime",f.time||0,"time",0,"tween",f.tween||d,"onFinished",f.onFinished||b,"beforeTick",f.beforeTick||c,"afterTick",f.afterTick||b);if(i||(i=e[f.transform]),j.endMatrix=i,!h&&0===f.transform.indexOf("rotate"))switch(f.transform){case"rotate-90":h=Math.PI/2;break;case"rotate-180":h=Math.PI;break;case"rotate-270":h=-Math.PI/2;break;default:g=f.transform.greenSplit("-"),h=g[1]/180*Math.PI,g.recycle()}j.angle=h,f.anchor&&(j.offset=f.offset,j.offset||(j.offset=this.owner.position.copy().subtractVector(f.anchor,2),j.recycleOffset=!0)),this.tweens.push(j)}}(),transform:function(a){this.transform(a)},"prepend-transform":function(a){this.transform(a)},"append-transform":function(a){this.transform(a,!0)},"replace-transform":function(a){Array.isArray(a)?this.replace(a):"string"==typeof a&&e[a]&&this.replace(e[a])}},methods:{transform:function(a,b){Array.isArray(a)?this.multiply(a,b):"string"==typeof a&&e[a]&&this.multiply(e[a],b)},multiply:function(){return function(a,b){var c=0;for(b?f(this.matrix,a,this.matrix):f(a,this.matrix,this.matrix),c=0;c<this.vectors.length;c++)this.vectors[c].multiply(a),this.inverses[c].multiply(a);this.owner.triggerEvent("orientation-updated",a)}}(),replace:function(){var a=function(a,b,c,d){return a*d-b*c},b=function(a){var b=0,c=0;for(b=0;b<3;b++)c+=a[b][0]*a[(b+1)%3][1]*a[(b+2)%3][2],c-=a[b][2]*a[(b+1)%3][1]*a[(b+2)%3][0];return c},c=function(c){var d=Array.setUp(Array.setUp(),Array.setUp(),Array.setUp()),e=1/b(c);return d[0].push(a(c[1][1],c[1][2],c[2][1],c[2][2])*e),d[0].push(a(c[0][2],c[0][1],c[2][2],c[2][1])*e),d[0].push(a(c[0][1],c[0][2],c[1][1],c[1][2])*e),d[1].push(a(c[1][2],c[1][0],c[2][2],c[2][0])*e),d[1].push(a(c[0][0],c[0][2],c[2][0],c[2][2])*e),d[1].push(a(c[0][2],c[0][0],c[1][2],c[1][0])*e),d[2].push(a(c[1][0],c[1][1],c[2][0],c[2][1])*e),d[2].push(a(c[0][1],c[0][0],c[2][1],c[2][0])*e),d[2].push(a(c[0][0],c[0][1],c[1][0],c[1][1])*e),d};return function(a){var b=c(this.matrix);this.multiply(b),this.multiply(a),b.recycle(2)}}(),updateTween:function(){var a=function(a,b,c){return a*(1-c)+b*c};return function(c,d){var e=0,g=1,h=0,i=0,j=1,k=1,l=0,m=c.endMatrix,n=null,o=null,p=null;return c.beforeTick(c.time)&&(c.time+=d),c.time>=c.endTime||(e=c.tween(c.time/c.endTime),c.angle?(l=e*c.angle,g=j=Math.cos(l),h=Math.sin(l),i=-h):(g=a(g,m[0][0],e),h=a(h,m[1][0],e),i=a(i,m[0][1],e),j=a(j,m[1][1],e),k=a(k,m[2][2],e)),n=Array.setUp(Array.setUp(g,i,0),Array.setUp(h,j,0),Array.setUp(0,0,k)),f(this.matrixTween,n,this.matrixTween),c.anchor&&(o=b.setUp(c.offset).multiply(1-e),p=b.setUp(c.offset).multiply(e),this.owner.triggerEvent("relocate-entity",{position:o.add(p).multiply(n).addVector(c.anchor)}),o.recycle(),p.recycle()),c.afterTick(e,n),n.recycle(2),!1)}}(),updateVector:function(a,b){b.setVector(a.add(b)),a.multiply(this.matrixTween),b.subtractVector(a)},destroy:function(){this.vectors.recycle(),this.inverses.recycle(),this.tweens.recycle(),this.orientationVector.recycle(),this.orientationMatrix.recycle(2),this.matrix.recycle(2),this.matrixTween.recycle(2),this.relocationMessage.recycle()}}})}(),function(){"use strict";var a=function(a){return function(b,c){this.owner.trigger(a[Math.floor(Math.random()*a.length)],b,c)}};platypus.createComponentClass({id:"RandomEvents",initialize:function(b){var c="";if(b.events)for(c in b.events)b.events.hasOwnProperty(c)&&this.addEventListener(c,a(b.events[c]))}})}(),function(){"use strict";platypus.createComponentClass({id:"RelayFamily",properties:{events:null},initialize:function(){var a="";if(this.events)for(a in this.events)this.events.hasOwnProperty(a)&&this.addEventListener(a,this.broadcast.bind(this,null,this.events[a]));this.owner.familyLinks=Array.setUp(this.owner)},events:{"link-family":function(a){var b=0,c=this.owner.familyLinks,d=Array.setUp().union(a).union(c);for(b=0;b<d.length;b++)d[b].familyLinks=d;this.broadcast(a,"family-members-added",c),this.broadcast(c,"family-members-added",a),c.recycle()},"entity-created":function(a){a.triggerEvent("link-family",this.owner.familyLinks)||(a.addComponent(new platypus.components.RelayFamily(a,{})),a.triggerEvent("link-family",this.owner.familyLinks))}},methods:{broadcast:function(a){var b=a||this.owner.familyLinks,c=0,d=Array.prototype.greenSlice.call(arguments);for(d.greenSplice(0),c=0;c<b.length;c++)b[c].trigger.apply(b[c],d);d.recycle()},destroy:function(){var a=this.owner.familyLinks,b=a.indexOf(this.owner);b>=0&&a.greenSplice(b),this.broadcast(a,"family-member-removed",this.owner),this.events=null}}})}(),function(){"use strict";var a=function(){var a=platypus.game.currentScene;a.triggerOnChildren.apply(a,arguments)};platypus.createComponentClass({id:"RelayGame",properties:{events:null},initialize:function(){var b="",c=this.events;if(c)for(b in c)c.hasOwnProperty(b)&&this.addEventListener(b,a.bind(this,c[b]))}})}(),function(){"use strict";var a=function(){var a=0,b=null;for(a=0;a<this.links.length;a++)b=this.links[a],b.trigger.apply(b,arguments)};platypus.createComponentClass({id:"RelayLinker",properties:{linkId:"linked",events:null},initialize:function(){var b=0,c="";if(this.events)for(c in this.events)this.events.hasOwnProperty(c)&&this.addEventListener(c,a.bind(this,this.events[c]));if(this.owner.linkId||(this.owner.linkId=this.linkId),this.addEventListener("to-"+this.linkId+"-entities",a.bind(this,"from-"+this.linkId+"-entities")),this.addEventListener("from-"+this.linkId+"-entities",function(a){this.owner.trigger(a.message,a.value,a.debug)}.bind(this)),this.links=Array.setUp(),this.owner.linkEntities)for(b=0;b<this.owner.linkEntities.length;b++)this.links.push(this.owner.linkEntities[b]);this.message={message:"",value:null},this.linkMessage={entity:this.owner,linkId:this.linkId,reciprocate:!1}},events:{load:function(){for(var a=this.owner.parent;a.parent;)a=a.parent;this.linkMessage.reciprocate=!0,a.triggerOnChildren("link-entity",this.linkMessage)},"link-entity":function(a){a.linkId===this.linkId&&a.entity!==this.owner&&-1===this.links.indexOf(a.entity)&&(this.links.push(a.entity),a.reciprocate&&(this.linkMessage.reciprocate=!1,a.entity.triggerEvent("link-entity",this.linkMessage)))},"unlink-entity":function(a){var b=this.links.indexOf(a.entity);b>=0&&this.links.greenSplice(b)}},methods:{destroy:function(){var a=0;for(a=0;a<this.links.length;a++)this.links[a].triggerEvent("unlink-entity",this.linkMessage);this.links.recycle(),this.links=null,this.events=null}}})}(),function(){"use strict";var a=function(){var a=this.owner.parent;a&&a.trigger.apply(a,arguments)};platypus.createComponentClass({id:"RelayParent",properties:{events:null},initialize:function(){var b="",c=this.events;if(c)for(b in c)c.hasOwnProperty(b)&&this.addEventListener(b,a.bind(this,c[b]))}})}(),function(){"use strict";var a=function(){var a=this.owner;a.trigger.apply(a,arguments)};platypus.createComponentClass({id:"RelaySelf",properties:{events:null},initialize:function(){var b="",c=this.events;if(c)for(b in c)c.hasOwnProperty(b)&&this.addEventListener(b,a.bind(this,c[b]))}})}(),function(){"use strict";var a=include("platypus.AABB"),b=include("PIXI.animate.Animator",!1),c=include("platypus.Data"),d=include("platypus.components.EventRender"),e=include("PIXI.Graphics"),f=include("platypus.components.Interactive"),g=include("platypus.components.StateRender"),h=function(a){this.playAnimation(a),this.owner.triggerEvent("animation-ended",a,this.instance)},i=function(){var a=function(a,b){var c=0,d=b.indexOf("("),e=b.substring(0,d),f=b.substring(d+1,b.indexOf(")"));if(f.length){for(f=f.greenSplit(","),c=f.length;c--;)f[c]=+f[c];a[e].apply(a,f),f.recycle()}else a[e]()};return function(b,c){var d=0,e=c.greenSplit(".");for(d=0;d<e.length;d++)a(b,e[d]);e.recycle()}}();platypus.createComponentClass({id:"RenderAnimation",properties:{animation:"",animationMap:null,framerate:24,mask:null,interactive:!1,visible:!0,eventBased:!1,stateBased:!0,regX:0,regY:0,offsetZ:0},publicProperties:{scaleX:1,scaleY:1,x:0,y:0,z:0},initialize:function(){var b=function(a,b,c,d){var e=c-1,f=null,g=b.length;for(d[0]=e;g--;)d[b[g].label]=e,e=b[g].label;if(a)return a;if(Array.isArray(b)&&1===b.length)return null;for(f={},g=b.length;g--;)f[b[g].label]=b[g].label;return f},e=function(a,e){var h=null,i=b(this.animationMap,e.labels,e.totalFrames,this.endings);this.instance=e,e.framerate=this.framerate,
  this.stateBased=i&&this.stateBased,this.eventBased=i&&this.eventBased,i&&(this.eventBased&&(h=c.setUp("animationMap",i,"restart",this.restart,"component",this),this.owner.addComponent(new d(this.owner,h)),h.recycle()),this.stateBased&&(h=c.setUp("animationMap",i,"forcePlayThrough",this.forcePlayThrough,"component",this),this.owner.addComponent(new g(this.owner,h)),h.recycle())),this.parentContainer&&(this.parentContainer.addChild(this.instance),this.ready=!0,this.mask&&this.setMask(this.mask),this.update()),this.interactive?(h=c.setUp("container",e,"hitArea",this.interactive.hitArea,"hover",this.interactive.hover),this.owner.addComponent(new f(this.owner,h,function(){this.owner.triggerEvent("input-on"),a()}.bind(this))),h.recycle()):a()};return function(b,d){return this.endings=c.setUp(),this.instance=null,this.ready=!1,this.animation&&PIXI.animate.load(include(this.animation),e.bind(this,d)),this.parentContainer=null,this.wasVisible=this.visible,this.lastX=this.owner.x,this.lastY=this.owner.y,this.camera=a.setUp(),this.isOnCamera=!0,!0}}(),events:{"camera-update":function(a){this.camera.set(a.viewport),this.instance&&this.checkCameraBounds()},"handle-render-load":function(a){!this.parentContainer&&a&&a.container&&this.addStage(a.container)},"handle-render":function(a){this.ready||this.parentContainer||this.addStage(a.container),this.ready&&this.update()},"hide-animation":function(){this.visible=!1},"show-animation":function(){this.visible=!0},"set-mask":function(a){this.setMask(a)},"stop-animation":function(a){var c=this.instance;a&&c.has(a)?c.gotoAndStop(a):b.stop(c)},"play-animation":function(a,b){this.playAnimation(a,b)}},methods:{checkCameraBounds:function(){this.isOnCamera=this.owner.parent.isOnCanvas(this.instance.getBounds(!1))},addStage:function(a){return a?(this.parentContainer=a,this.instance&&(this.parentContainer.addChild(this.instance),this.ready=!0,this.mask&&this.setMask(this.mask)),this.playAnimation(0),a):null},playAnimation:function(a){var c=this.instance;b.fromTo(c,a,this.endings[a]||0,!1,h.bind(this,a))},setMask:function(a){var b=null;if(this.mask&&this.parentContainer&&this.parentContainer.removeChild(this.mask),!a)return void(this.mask=this.instance.mask=null);a instanceof e?b=a:(b=new e,b.beginFill(0,1),"string"==typeof a?i(b,a):a.radius?b.dc(a.x||0,a.y||0,a.radius):a.width&&a.height&&b.r(a.x||0,a.y||0,a.width,a.height),b.endFill()),b.isMask=!0,this.mask=this.instance.mask=b,this.mask.z=0,this.parentContainer&&this.parentContainer.addChild(this.mask)},update:function(){var a=this.instance,b=a.scale;b.x=this.scaleX,b.y=this.scaleY,a.x=this.x-this.regX*this.scaleX,a.y=this.y-this.regY*this.scaleY,a.z!==this.z+this.offsetZ&&(this.parentContainer&&(this.parentContainer.reorder=!0),a.z=this.z+this.offsetZ),(this.owner.opacity||0===this.owner.opacity)&&(this.instance.alpha=this.owner.opacity),this.instance&&(!this.wasVisible&&this.visible||this.lastX!==this.owner.x||this.lastY!==this.owner.y)&&this.checkCameraBounds(),this.lastX=this.owner.x,this.lastY=this.owner.y,this.wasVisible=this.visible,this.instance.visible=this.visible&&this.isOnCamera||this.dragMode},destroy:function(){this.camera.recycle(),this.parentContainer&&!this.instance.mouseTarget?(this.parentContainer.removeChild(this.instance),this.parentContainer=null):this.cache||this.instance.destroy(),this.instance=null}}})}(),function(){"use strict";var a=include("platypus.AABB"),b=include("PIXI.CanvasRenderer"),c=include("PIXI.filters.ColorMatrixFilter"),d=include("PIXI.Container"),e=include("platypus.Data"),f=include("PIXI.Graphics"),g=include("platypus.components.Interactive"),h=include("PIXI.Matrix"),i=new h,j=function(a){return null===a?a:("string"==typeof a&&"#"===a[0]&&(a="0x"+a.substring(1)),+a)},k=function(){var a=function(a,b){var c=0,d=b.indexOf("("),e=b.substring(0,d),f=b.substring(d+1,b.indexOf(")"));if(f.length){for(f=f.greenSplit(","),c=f.length;c--;)f[c]=+f[c];a[e].apply(a,f),f.recycle()}else a[e]()};return function(b,c){var d=0,e=c.greenSplit(".");for(d=0;d<e.length;d++)a(b,e[d]);e.recycle()}}();platypus.createComponentClass({id:"RenderContainer",properties:{mask:null,interactive:!1,rotate:!1,mirror:!1,flip:!1,visible:!0,cache:!1,ignoreOpacity:!1,localMask:!1},publicProperties:{dragMode:!1,renderGroup:"",rotation:0,scaleX:1,scaleY:1,skewX:0,skewY:0,tint:null,x:0,y:0,z:0},initialize:function(){var f=this.container=this.owner.container=new d,h=null,i=this.tint;this.rootContainer=null,this.parentContainer=null,this.renderGroups=null,this.wasVisible=this.visible,this.lastX=this.owner.x,this.lastY=this.owner.y,this.camera=a.setUp(),this.isOnCamera=!0,this.needsCameraCheck=!0,this._tint=null,platypus.game.app.display.renderer instanceof b?Object.defineProperty(this.owner,"tint",{get:function(){return this._tint}.bind(this),set:function(a){var b=this.container.children,c=b.length,d=j(a);if(d!==this._tint){for(;c--;)b[c].tint=d;this._tint=d}}.bind(this)}):Object.defineProperty(this.owner,"tint",{get:function(){return this._tint}.bind(this),set:function(a){var b=this.container.filters,d=null,e=j(a);e!==this._tint&&(null===e?b&&(this.container.filters=null):(b||(b=this.container.filters=Array.setUp(new c)),d=b[0].matrix,d[0]=(16711680&e)/16711680,d[6]=(65280&e)/65280,d[12]=(255&e)/255),this._tint=e)}.bind(this)}),this.storedRenderGroup=this.renderGroup,this._renderGroup=null,Object.defineProperty(this.owner,"renderGroup",{get:function(){return this._renderGroup}.bind(this),set:function(a){var b=this.renderGroups,c=b.length,e=null,f=null;if(a!==this._renderGroup){for(this._renderGroup=a,this.mask&&(f=this.mask,this.setMask());c--;)if(b[c].name===a)return this.parentContainer=b[c],b[c].addChild(this.container),b[c].reorder=!0,void(f&&this.setMask(f));e=new d,e.name=a,e.z=this.owner.z,b.push(e),this.rootContainer.addChild(e),this.rootContainer.reorder=!0,this.parentContainer=e,e.addChild(this.container),f&&this.setMask(f)}}.bind(this)}),null!==i&&(this.tint=i),this.interactive&&(h=e.setUp("container",f,"hitArea",this.interactive.hitArea,"hover",this.interactive.hover),this.owner.addComponent(new g(this.owner,h)),h.recycle()),this.cache&&(this.updateSprite(!1),this.owner.cacheRender=this.container)},events:{cache:function(){this.updateSprite(!1),this.owner.cacheRender=this.container,this.cache=!0,this.owner.parent.triggerEventOnChildren?this.owner.parent.triggerEventOnChildren("cache-sprite",this.owner):platypus.debug.warn("Unable to cache sprite for "+this.owner.type)},"camera-update":function(a){this.camera.set(a.viewport),this.needsCameraCheck=!0},"handle-render-load":function(a){!this.rootContainer&&a&&a.container&&(this.addStage(a.container,a.renderGroups),this.updateSprite(!0))},"handle-render":function(a){this.container&&(!this.rootContainer&&a&&a.container&&this.addStage(a.container,a.renderGroups),this.updateSprite(!0))},"hide-sprite":function(){this.visible=!1},"show-sprite":function(){this.visible=!0},"set-mask":function(a){this.setMask(a)}},methods:{addStage:function(a,b){return a?(this.rootContainer=a,this.renderGroups=b,this.renderGroup=this.storedRenderGroup,this.mask&&this.setMask(this.mask),this.owner.triggerEvent("input-on"),a):null},updateSprite:function(){var a=function(a,b){return a.z-b.z};return function(b){var c=0,d=0,e=this.owner.orientationMatrix,f=0,g=i,h=1,j=1,k=null;c=this.owner.x,d=this.owner.y,this.rotate&&(f=this.rotation),this.container.z!==this.owner.z&&(this.parentContainer&&(this.parentContainer.reorder=!0),this.container.z=this.owner.z),this.ignoreOpacity||!this.owner.opacity&&0!==this.owner.opacity||(this.container.alpha=this.owner.opacity),this.container.reorder&&(this.container.reorder=!1,this.container.children.sort(a),this.needsCameraCheck=!0),(this.mirror||this.flip)&&(k=this.rotation%360,this.mirror&&k>90&&k<270&&(h=-1),this.flip&&k<180&&(j=-1)),e?(g.a=e[0][0],g.b=e[1][0],g.tx=c+e[0][2],g.c=e[0][1],g.d=e[1][1],g.ty=d+e[1][2],this.container.transform.setFromMatrix(g)):this.container.setTransform(c,d,this.scaleX*h,this.scaleY*j,f?f/180*Math.PI:0,this.skewX,this.skewY),this.needsCameraCheck||(this.needsCameraCheck=this.lastX!==this.owner.x||this.lastY!==this.owner.y),b&&this.container&&(this.needsCameraCheck||!this.wasVisible&&this.visible)&&(this.isOnCamera=this.owner.parent.isOnCanvas(this.container.getBounds(!1)),this.needsCameraCheck=!1),this.lastX=this.owner.x,this.lastY=this.owner.y,this.wasVisible=this.visible,this.container.visible=this.visible&&this.isOnCamera||this.dragMode}}(),setMask:function(a){var b=null;if(this.mask&&(this.localMask?this.container.removeChild(this.mask):this.parentContainer&&this.parentContainer.removeChild(this.mask)),!a)return void(this.mask=this.container.mask=null);a instanceof f?b=a:(b=new f,b.beginFill(0,1),"string"==typeof a?k(b,a):a.radius?b.dc(a.x||0,a.y||0,a.radius):a.width&&a.height&&b.r(a.x||0,a.y||0,a.width,a.height),b.endFill()),b.isMask=!0,this.mask=this.container.mask=b,this.mask.z=0,this.localMask?this.container.addChild(this.mask):this.parentContainer&&this.parentContainer.addChild(this.mask)},destroy:function(){this.camera.recycle(),this.parentContainer&&!this.container.mouseTarget?(this.parentContainer.removeChild(this.container),this.parentContainer=null):this.cache||this.container.destroy(),this.container=null}}})}(),function(){"use strict";var a=include("PIXI.Graphics"),b=include("platypus.components.RenderContainer"),c=function(b,c,d,e,f,g,h,i){var j=(new a).beginFill(c,.1);switch(i&&j.lineStyle(i,c),b){case"rectangle":j.drawRect(d,e,f,g);break;case"circle":j.drawCircle(0,0,f)}return j.z=h,j},d=function(a){return"string"==typeof a?parseInt(a.replace("#",""),16):a};platypus.createComponentClass({id:"RenderDebug",properties:{aabbColor:16746751,collisionColor:16711935,groupColor:65280,renderColor:255,width:100,height:100,offsetZ:1e4},initialize:function(){this.shapes=Array.setUp(),this.isOutdated=!0,this.aabbColor=d(this.aabbColor),this.collisionColor=d(this.collisionColor),this.groupColor=d(this.groupColor),this.renderColor=d(this.renderColor)},events:{load:function(){if(!platypus.game.settings.debug)return void this.owner.removeComponent(this);this.owner.container||this.owner.addComponent(new b(this.owner,null))},"handle-render":function(){var a=null,b=-.5;this.isOutdated&&(this.updateSprites(),this.isOutdated=!1),this.owner.getCollisionGroupAABB&&(a=this.owner.getCollisionGroupAABB(),this.groupShape||(this.groupShape=c("rectangle",this.groupColor,b,b,1,1,this.offsetZ),this.owner.container.addChild(this.groupShape)),this.groupShape.scaleX=a.width,this.groupShape.scaleY=a.height,this.groupShape.x=a.x-this.owner.x,this.groupShape.y=a.y-this.owner.y)},"orientation-updated":function(){this.isOutdated=!0}},methods:{updateSprites:function(){var a=this.owner,b=this.offsetZ,d=0,e=0,f=2,g=this.width,h=this.height,i=null,j=null,k=null;for(d=0;d<this.shapes.length;d++)a.container.removeChild(this.shapes[d]);if(this.shapes.length=0,a.getAABB)for(e=0;e<a.collisionTypes.length;e++)for(j=a.getAABB(a.collisionTypes[e]),g=this.initialWidth=j.width,h=this.initialHeight=j.height,i=a.getShapes(a.collisionTypes[e]),k=c("rectangle",this.aabbColor,j.left-a.x,j.top-a.y,g,h,b--),this.shapes.push(k),a.container.addChild(k),this.addInput(k),d=0;d<i.length;d++)g=i[d].width-f,h=i[d].height-f,k=c(i[d].type,this.collisionColor,i[d].offsetX-g/2,i[d].offsetY-h/2,i[d].radius?i[d].radius-f:g,h,b--,f),this.shapes.push(k),a.container.addChild(k),this.addInput(k);else k=c("rectangle",this.renderColor,-g/2,-h/2,g,h,b--),this.shapes.push(k),a.container.addChild(k),this.addInput(k);a.container.reorder=!0},addInput:function(){var a=null,b=function(){return a!==this.owner&&(a=this.owner,platypus.debug.olive('Entity "'+a.type+'":',a)),!1};return function(a){a.interactive=!0,a.addListener("rightdown",b.bind(this))}}(),destroy:function(){var a=0;for(a=0;a<this.shapes.length;a++)this.owner.container.removeChild(this.shapes[a]);this.shapes.recycle()}}})}(),function(){"use strict";platypus.createComponentClass({id:"RenderDestroyMe",properties:{animationId:"",animationIds:null},initialize:function(a){this.animationId?this.animationIds=Array.setUp(a.animationId):this.animationIds&&(this.animationIds=this.animationIds.greenSlice())},events:{"animation-ended":function(a){(!this.animationIds||this.animationIds.indexOf(a)>=0)&&this.owner.parent.removeEntity(this.owner)}},methods:{destroy:function(){this.animationIds&&(this.animationIds.recycle(),delete this.animationIds)}}})}(),function(){"use strict";platypus.createComponentClass({id:"RenderProgress",properties:{backgroundColor:0,color:16777215,rotate:!1,mirror:!1,flip:!1,width:100,height:20,regX:0,regY:0},publicProperties:{x:0,y:0,z:0},initialize:function(){var a=new PIXI.Graphics,b=new PIXI.Graphics,c=new PIXI.Container;this.parentContainer=null,this.background=a,this.progress=b,this.container=c,"string"==typeof this.backgroundColor&&(this.backgroundColor=+this.backgroundColor.replace("#","0x")),"string"==typeof this.color&&(this.color=+this.color.replace("#","0x")),a.f(this.backgroundColor).r(-this.regX,-this.regY,this.width,this.height),b.f(this.color).r(-this.regX,-this.regY,this.width,this.height),b.scale=new PIXI.Point(1e-4,1),c.addChild(a),c.addChild(b)},events:{"handle-render-load":function(a){!this.parentContainer&&a&&a.container&&(this.parentContainer=a.container,this.parentContainer.addChild(this.container))},"handle-render":function(a){this.container&&(this.parentContainer||(a&&a.container?(this.parentContainer=a.container,this.parentContainer.addChild(this.container)):(platypus.debug.warn('No PIXI Stage, removing ProgressRender component from "'+this.owner.type+'".'),this.owner.removeComponent(this))),this.container.x=this.x,this.container.y=this.y,this.container.z=this.z)},"update-progress":function(a){isNaN(a)?"number"==typeof a.fraction?this.progress.scale.x=a.fraction:"number"==typeof a.total&&"number"==typeof a.progress&&(this.progress.scale.x=a.progress/a.total):this.progress.scale.x=a}},methods:{destroy:function(){this.parentContainer&&(this.parentContainer.removeChild(this.container),this.parentContainer=null),this.container=null}}})}(),function(){"use strict";var a=include("PIXI.spine.core.TextureAtlas",!1),b=include("PIXI.spine.core.AtlasAttachmentLoader",!1),c=include("PIXI.BaseTexture"),d=include("platypus.Data"),e=include("platypus.components.EventRender"),f=include("platypus.components.RenderContainer"),g=include("PIXI.spine.core.SkeletonJson",!1),h=include("PIXI.spine.Spine",!1),i=include("platypus.components.StateRender"),j=function(a){var b=null;return b=platypus.game.app.assetManager.cache.read(a.substring(a.lastIndexOf("/")+1,a.lastIndexOf("."))),b||platypus.debug.warn('RenderSpine: "'+a+'" is not a loaded asset.'),new c(b)};h&&platypus.createComponentClass({id:"RenderSpine",properties:{animationMap:null,mask:null,interactive:!1,mixTimes:0,offsetX:0,offsetY:0,offsetZ:0,atlas:"",skeleton:null,rotate:!1,mirror:!1,flip:!1,visible:!0,eventBased:!1,stateBased:!0},publicProperties:{dragMode:!1,scaleX:1,scaleY:1,skewX:0,skewY:0,rotation:0,x:0,y:0,z:0},initialize:function(){var c=function(a,b){var c=null,d="";if(a)return a;c={};for(d in b)b.hasOwnProperty(d)&&(c[d]=d);return c},k=function(a,b,c){var d=j(b);c(d),d.isLoading?d.on("loaded",a):a()},l=function(){this.owner.triggerEvent("animation-ended",this.currentAnimation)},m=function(a,b){var c=b.data.name;this.playAnimation(c)&&this.spine.update(1e-6),this.owner.trigger(c,b.data)};return function(j,n){var o="",p=null,q=platypus.game.settings,r=q.atlases[this.atlas],s=null,t=q.skeletons[this.skeleton],u=new a(r,k.bind(null,n)),v=new g(new b(u)),w=v.readSkeletonData(t),x=this.spine=new h(w);return x.state.addListener({event:m.bind(this),complete:l.bind(this)}),x.autoUpdate=!1,s=c(this.animationMap,t.animations),this.stateBased=s&&this.stateBased,this.eventBased=s&&this.eventBased,s&&(o=s.default||"",this.eventBased&&(p=d.setUp("animationMap",s,"component",this),this.owner.addComponent(new e(this.owner,p)),p.recycle()),this.stateBased&&(p=d.setUp("animationMap",s,"forcePlayThrough",this.forcePlayThrough,"component",this),this.owner.addComponent(new i(this.owner,p)),p.recycle())),this.mixTimes&&this.setMixTimes(this.mixTimes),o&&(this.currentAnimation=o,x.state.setAnimation(0,o,!0)),x.x=this.offsetX,x.y=this.offsetY,x.z=this.offsetZ,this.owner.container?this.addToContainer():(p=d.setUp("interactive",this.interactive,"mask",this.mask,"rotate",this.rotate,"mirror",this.mirror,"flip",this.flip,"visible",this.visible,"cache",this.cache,"ignoreOpacity",this.ignoreOpacity,"scaleX",this.scaleX,"scaleY",this.scaleY,"skewX",this.skewX,"skewY",this.skewY,"rotation",this.rotation),this.owner.addComponent(new f(this.owner,p,this.addToContainer.bind(this))),p.recycle()),!0}}(),events:{"handle-render":function(a){this.spine&&(this.owner.triggerEvent("update-animation",!0),this.spine.update(a.delta/1e3))},"set-mix-times":function(a){this.setMixTimes(a)},hide:function(){this.visible=!1},show:function(){this.visible=!0},"stop-animation":function(a){this.stopAnimation(a)},"play-animation":function(a){this.playAnimation(a)}},methods:{addToContainer:function(){var a=this.owner.container;a.addChild(this.spine),a.reorder=!0},playAnimation:function(a){var b=this.spine;return!(!a||!b.state.hasAnimation(a))&&(this.currentAnimation=a,b.state.setAnimation(0,a,!0),this.paused=!1,!0)},stopAnimation:function(a){var b=this.spine;a&&b.state.hasAnimation(a)&&(this.currentAnimation=a,b.state.setAnimation(0,a,!1)),this.paused=!0},setMixTimes:function(a){var b=this.spine,c=b.spineData.animations,d=0,e=0,f=0,g="",h=b.stateData;if("number"==typeof a)for(e=c.length;e--;)for(f=c.length;f--;)e!==f&&h.setMix(c[e].name,c[f].name,a);else for(g in a)a.hasOwnProperty(g)&&(d=g.indexOf(":"))>=0&&h.setMix(g.substring(0,d),g.substring(d+1),a[g]);this.mixTimes=h.animationToMixTime},destroy:function(){this.owner.container.removeChild(this.spine),this.spine.destroy(),this.spine=null,this.mixTimes=null}},getAssetList:function(){var a=function(a,b){var c=Array.setUp(),d=null,e=0;if(a){if(d=a.split("\n"),1===d.length){if(!(a=b[a]))return c;d=a.split("\n")}for(e=d.length;e--;)".png"===d[e].substr(d[e].length-4)&&c.push(d[e])}return c};return function(b,c,d){var e=null,f=0,g=null,h=platypus.game.settings.atlases,i=b.atlas||c.atlas||d.atlas;if(Array.isArray(i)){for(f=i.length,g=Array.setUp();f--;)e=a(i[f],h),g.union(e),e.recycle();return g}return a(i,h)}}()})}(),function(){"use strict";var a=(include("platypus.AABB"),include("platypus.Data")),b=include("platypus.components.EventRender"),c=include("platypus.components.RenderContainer"),d=include("platypus.PIXIAnimation"),e=include("platypus.components.StateRender");platypus.createComponentClass({id:"RenderSprite",properties:{spriteSheet:null,animationMap:null,mask:null,interactive:!1,offsetX:0,offsetY:0,offsetZ:0,restart:!0,rotate:!1,mirror:!1,flip:!1,visible:!0,eventBased:!1,stateBased:!0,cache:!1,forcePlayThrough:!1,ignoreOpacity:!1,scale:1,scaleX:1,scaleY:1,skew:0,skewX:0,skewY:0,rotation:0},initialize:function(){var f=function(a,b){var c=null,d="";if(a)return a;if(Array.isArray(b.frames)&&1===b.frames.length)return null;c={};for(d in b.animations)b.animations.hasOwnProperty(d)&&(c[d]=d);return c},g=function(a){this.owner.triggerEvent("animation-ended",a)};return function(){var h="",i=null,j=d.formatSpriteSheet(this.spriteSheet),k=null;j===d.EmptySpriteSheet&&platypus.debug.warn('Entity "'+this.owner.type+'": RenderSprite sprite sheet not defined.'),k=f(this.animationMap,j),this.stateBased=k&&this.stateBased,this.eventBased=k&&this.eventBased,k&&(h=k.default||"",this.eventBased&&(i=a.setUp("animationMap",k,"restart",this.restart,"component",this),this.owner.addComponent(new b(this.owner,i)),i.recycle()),this.stateBased&&(i=a.setUp("animationMap",k,"forcePlayThrough",this.forcePlayThrough,"component",this),this.owner.addComponent(new e(this.owner,i)),i.recycle())),this.sprite=new d(j,h),this.sprite.on("complete",g.bind(this)),this.sprite.x=this.offsetX,this.sprite.y=this.offsetY,this.sprite.z=this.offsetZ,this.owner.container?this.addToContainer():(i=a.setUp("interactive",this.interactive,"mask",this.mask,"rotate",this.rotate,"mirror",this.mirror,"flip",this.flip,"visible",this.visible,"cache",this.cache,"ignoreOpacity",this.ignoreOpacity,"scaleX",this.scaleX,"scaleY",this.scaleY,"skewX",this.skewX,"skewY",this.skewY,"rotation",this.rotation),this.owner.addComponent(new c(this.owner,i,this.addToContainer.bind(this))),i.recycle()),j.recycleSpriteSheet()}}(),events:{"handle-render":function(a){this.sprite&&(this.owner.triggerEvent("update-animation",!0),this.sprite.update(a.delta))},"stop-animation":function(a){this.stopAnimation(a)},"play-animation":function(a,b){this.playAnimation(a,b)}},methods:{addToContainer:function(){var a=this.owner.container;a.addChild(this.sprite),a.reorder=!0},playAnimation:function(a,b){var c=this.sprite;a&&c.has(a)?c.gotoAndPlay(a,b):c.play()},stopAnimation:function(a){var b=this.sprite;a&&b.has(a)?b.gotoAndStop(a):b.stop()},destroy:function(){this.owner.container.removeChild(this.sprite),this.sprite.destroy(),this.sprite=null}},getAssetList:function(){var a=function(b,c){if(b){if("string"==typeof b)return a(c[b],c);if(b.images)return b.images.greenSlice()}return Array.setUp()};return function(b,c,d){var e=null,f=0,g=null,h=platypus.game.settings.spriteSheets,i=b.spriteSheet||c.spriteSheet||d.spriteSheet;if(Array.isArray(i)){for(f=i.length,g=Array.setUp();f--;)e=a(i[f],h),g.union(e),e.recycle();return g}return a(i,h)}}()})}(),function(){"use strict";var a=include("platypus.components.RenderContainer"),b=include("PIXI.Text"),c={horizontal:{left:0,middle:.5,center:.5,right:1},vertical:{top:0,middle:.5,center:.5,bottom:1}};platypus.createComponentClass({id:"RenderText",properties:{offsetX:0,offsetY:0,offsetZ:0,text:"",style:null},initialize:function(d){var e=c.horizontal[this.style.align],f=c.vertical[this.style.verticalAlign];this.sprite=new b(this.text,this.style),this.sprite.anchor.x="number"==typeof e?e:.5,this.sprite.anchor.y="number"==typeof f?f:1,this.sprite.x=this.offsetX,this.sprite.y=this.offsetY,this.sprite.z=this.offsetZ,this.owner.container?this.addToContainer():this.owner.addComponent(new a(this.owner,d,this.addToContainer.bind(this)))},events:{"set-text":function(a){this.sprite.text=a}},methods:{addToContainer:function(){var a=this.owner.container;a.addChild(this.sprite),a.reorder=!0},destroy:function(){this.owner.container.removeChild(this.sprite),this.sprite.destroy(),this.sprite=null}}})}(),function(){"use strict";var a=1,b=2*a,c=include("platypus.AABB"),d=include("platypus.PIXIAnimation"),e=include("springroll.Application"),f=include("PIXI.CanvasRenderer"),g=include("PIXI.Container"),h=include("PIXI.Graphics"),i=g,j=include("PIXI.Rectangle"),k=include("platypus.components.RenderContainer"),l=include("PIXI.RenderTexture"),m=include("PIXI.Sprite"),n=function(a,b,c){var d=b.baseTexture,e=d._glRenderTargets[a.CONTEXT_UID];e&&e.clear(c)},o=function(){return null},p=c.setUp(),q=function(a,b){return a.z-b.z},r=function(a){for(var b=1;b<a;)b*=2;return b},s=function(a,b){var c=0;2147483648&a&&(b.scale.x=-1),1073741824&a&&(b.scale.y=-1),536870912&a&&(c=b.scale.x,b.scale.x=b.scale.y,b.scale.y=-c,b.rotation=Math.PI/2)},t=function(a,b,c){this.id=b,this.instances=Array.setUp(),this.index=0,this.tileSpriteSheet=a,this.getNext=this.initializeAndGetNext,this.uninitializedTiles=c,c.push(this)},u={getNext:o,destroy:o},v=t.prototype;v.initializeAndGetNext=function(){return this.initialize(),this.index+=1,this.instances[0]},v.initialize=function(){var a=+this.id.substring(4),b="tile"+(268435455&a),c=new m((this.tileSpriteSheet._animations[b]||this.tileSpriteSheet._animations.default).texture);s(a,c),c.template=this,this.instances.push(c),this.uninitializedTiles.greenSplice(this.uninitializedTiles.indexOf(this)),delete this.getNext},v.getNext=function(){var a=this.instances[this.index],b=null;return a||(b=this.instances[0],a=this.instances[this.index]=new m(b.texture),a.scale=b.scale,a.rotation=b.rotation,a.anchor=b.anchor),this.index+=1,a},v.clear=function(){this.index=0},v.destroy=function(){var a=0;for(a=0;a<this.instances.length;a++)this.instances[a].destroy();this.instances.recycle(),this.recycle()},recycle.add(t,!!springroll.Debug,"Template"),platypus.createComponentClass({id:"RenderTiles",properties:{buffer:0,cacheAll:!1,entityCache:!1,imageMap:[],maximumBuffer:2048,scaleX:1,scaleY:1,spriteSheet:null,tileCache:!0,tileHeight:10,tileWidth:10,top:0,left:0},initialize:function(a){var h=this.imageMap;this.doMap=null,this.cachedDisplayObjects=null,this.populate=this.populateTiles,this.tiles={},this.renderer=e.instance.display.renderer,this.tilesSprite=null,this.cacheTexture=null,this.mapContainer=null,this.laxCam=c.setUp(),this.worldWidth=this.tileWidth,this.worldHeight=this.tileHeight,this.cache=c.setUp(),this.cachePixels=c.setUp(),this.uninitializedTiles=Array.setUp(),this.spriteSheet=d.formatSpriteSheet(this.spriteSheet),this.tileSpriteSheet=new d(this.spriteSheet),this.tileContainer=this.spriteSheet.images.length>1||this.renderer instanceof f?new g:new i(15e3,{position:!0,rotation:!0,scale:!0}),this.mapContainer=new g,this.mapContainer.addChild(this.tileContainer),this.reorderedStage=!1,this.updateCache=!1,this.imageMap=Array.setUp(this.createMap(h)),this.tilesWidth=this.imageMap[0].length,this.tilesHeight=this.imageMap[0][0].length,this.layerWidth=this.tilesWidth*this.tileWidth,this.layerHeight=this.tilesHeight*this.tileHeight,this.cacheWidth=Math.min(r(this.layerWidth+b),this.maximumBuffer),this.cacheHeight=Math.min(r(this.layerHeight+b),this.maximumBuffer),this.tileCache||(this.buffer=0,this.cacheAll=!1),this.ready=!1,this.owner.container?this.addToContainer():this.owner.addComponent(new k(this.owner,a,this.addToContainer.bind(this)))},events:{"cache-sprite":function(a){this.cacheSprite(a)},"peer-entity-added":function(a){this.cacheSprite(a)},"add-tiles":function(a){var b=a.imageMap;b&&(this.imageMap.push(this.createMap(b)),this.updateCache=!0)},"change-tile":function(a,b,c,d){var e=this.imageMap;e&&(this.updateTile(a,e[d||0],b,c),this.updateCache=!0)},"camera-loaded":function(a){this.worldWidth=a.world.width,this.worldHeight=a.world.height,this.buffer&&!this.cacheAll&&this.updateBufferRegion(a.viewport)},"camera-update":function(a){this.ready&&this.updateCamera(a)},"handle-render":function(){this.updateCache?(this.updateCache=!1,this.cacheGrid?this.updateGrid():this.update(this.cacheTexture,this.cache)):this.uninitializedTiles.length&&this.uninitializedTiles[0].initialize()}},methods:{addToContainer:function(){var a=this.container=this.owner.container,b=2,c=this.mapContainer,d=null,e=this.owner.z;a.reorder=!0,this.ready=!0,this.updateRegion(0),this.tileCache?(this.mapContainerWrapper=new g,this.mapContainerWrapper.addChild(c),this.layerWidth<=this.cacheWidth&&this.layerHeight<=this.cacheHeight?(this.cacheAll=!0,this.render=this.renderCache,this.cacheTexture=l.create(this.cacheWidth,this.cacheHeight),this.tilesSprite=d=new m(this.cacheTexture),d.scale.x=this.scaleX,d.scale.y=this.scaleY,d.z=e,this.cache.setBounds(0,0,this.tilesWidth-1,this.tilesHeight-1),this.update(this.cacheTexture,this.cache),a.addChild(d)):this.cacheAll||this.layerWidth<=2*this.cacheWidth&&this.layerHeight<=this.cacheHeight||this.layerWidth<=this.cacheWidth&&this.layerHeight<=2*this.cacheHeight?(this.cacheAll=!0,this.cacheWidth=Math.min(r(this.layerWidth+b),this.maximumBuffer),this.cacheHeight=Math.min(r(this.layerHeight+b),this.maximumBuffer),this.updateRegion(b),this.render=this.renderCacheWithExtrusion,this.cacheGrid=this.createGrid(a),this.updateCache=!0):(this.render=this.renderCache,this.cacheAll=!1,this.cacheTexture=l.create(this.cacheWidth,this.cacheHeight),this.tilesSprite=new m(this.cacheTexture),this.tilesSprite.scale.x=this.scaleX,this.tilesSprite.scale.y=this.scaleY,this.tilesSprite.z=e,this.cacheTexture.alternate=l.create(this.cacheWidth,this.cacheHeight),this.tilesSpriteCache=new m(this.cacheTexture.alternate),this.cacheTexture.alternate.alternate=this.cacheTexture,a.addChild(this.tilesSprite))):(this.render=o,c.scale.x=this.scaleX,c.scale.y=this.scaleY,c.x=this.left,c.y=this.top,c.z=e,a.addChild(c))},cacheSprite:function(a){var b=0,c=0,d=a.cacheRender,e=null,f=0,g=0,h=0,i=0;if(this.entityCache&&d){for(this.doMap||(this.doMap=Array.setUp(),this.cachedDisplayObjects=Array.setUp(),this.populate=this.populateTilesAndEntities),this.cachedDisplayObjects.push(d),e=d.getBounds(d.transformMatrix),e.x-=this.left,e.y-=this.top,f=Math.max(0,Math.floor(e.y/this.tileHeight)),g=Math.min(this.tilesHeight,Math.ceil((e.y+e.height)/this.tileHeight)),i=Math.max(0,Math.floor(e.x/this.tileWidth)),h=Math.min(this.tilesWidth,Math.ceil((e.x+e.width)/this.tileWidth)),b=i;b<h;b++)for(this.doMap[b]||(this.doMap[b]=Array.setUp()),c=f;c<g;c++)this.doMap[b][c]||(this.doMap[b][c]=Array.setUp()),this.doMap[b][c].push(d);a.removeComponent("RenderSprite"),this.updateCache=!0}},convertCamera:function(a){var b=this.worldWidth/this.scaleX,c=b-a.width,d=this.worldHeight/this.scaleY,e=d-a.height,f=this.laxCam;return b!==this.layerWidth&&c?f.moveX((a.left-this.left)*(this.layerWidth-a.width)/c+a.halfWidth+this.left):f.moveX(a.x),d!==this.layerHeight&&e?f.moveY((a.top-this.top)*(this.layerHeight-a.height)/e+a.halfHeight+this.top):f.moveY(a.y),a.width===f.width&&a.height===f.height||f.resize(a.width,a.height),f},createTile:function(a){return"tile-1"===a?u:t.setUp(this.tileSpriteSheet,a,this.uninitializedTiles)},createMap:function(a){var b=0,c=0,d="",e=null;if("string"!=typeof a[0][0])return a;for(e=Array.setUp(),b=0;b<a.length;b++)for(e[b]=Array.setUp(),c=0;c<a[b].length;c++)d=a[b][c],this.updateTile(d,e,b,c);return e},updateCamera:function(a){var b=0,c=0,d=!1,e=null,f=0,g=0,h=0,i=0,j=this.cache,k=this.cachePixels,l=a.viewport,m=this.buffer&&(l.width!==this.laxCam.width||l.height!==this.laxCam.height),n=p,o=this.convertCamera(l);if(!this.cacheAll&&(k.empty||!k.contains(o))&&this.imageMap.length>0&&(m&&this.updateBufferRegion(o),f=this.cacheTilesWidth-1,g=this.cacheTilesHeight-1,h=f/2,i=g/2,n.setAll(Math.round((o.x-this.left)/this.tileWidth-h)+h,Math.round((o.y-this.top)/this.tileHeight-i)+i,f,g),n.left<0?n.moveX(n.halfWidth):n.right>this.tilesWidth-1&&n.moveX(this.tilesWidth-1-n.halfWidth),n.top<0?n.moveY(n.halfHeight):n.bottom>this.tilesHeight-1&&n.moveY(this.tilesHeight-1-n.halfHeight),this.tileCache?!j.empty&&n.contains(j)||(this.tilesSpriteCache.texture=this.cacheTexture,this.cacheTexture=this.cacheTexture.alternate,this.tilesSprite.texture=this.cacheTexture,this.update(this.cacheTexture,n,this.tilesSpriteCache,j)):this.update(null,n),k.setAll((j.x+.5)*this.tileWidth+this.left,(j.y+.5)*this.tileHeight+this.top,(j.width+1)*this.tileWidth,(j.height+1)*this.tileHeight)),this.cacheGrid)for(b=0;b<this.cacheGrid.length;b++)for(c=0;c<this.cacheGrid[b].length;c++)e=this.cacheGrid[b][c],k.setAll((b+.5)*this.cacheClipWidth+this.left,(c+.5)*this.cacheClipHeight+this.top,this.cacheClipWidth,this.cacheClipHeight),d=k.intersects(o),e.visible&&!d?e.visible=!1:!e.visible&&d&&(e.visible=!0),e.visible&&d&&(e.x=l.left-o.left+b*this.cacheClipWidth+this.left,e.y=l.top-o.top+c*this.cacheClipHeight+this.top);else this.tileCache&&(this.tilesSprite.x=l.left-o.left+j.left*this.tileWidth+this.left,this.tilesSprite.y=l.top-o.top+j.top*this.tileHeight+this.top)},updateTile:function(a,b,c,d){var e=null,f=this.tiles;a.id&&(a=a.id),e=f[a],e||null===e||(e=f[a]=this.createTile(a)),b[c][d]=e},createGrid:function(c){var d=this.cacheHeight,e=this.cacheWidth,f=this.cacheTilesHeight,g=this.cacheTilesWidth,h=0,i=0,k=b,n=a,o=null,p=this.scaleX,q=this.scaleY,s=this.tileHeight,t=this.tileWidth,u=this.tilesHeight,v=this.tilesWidth,w=0,x=0,y=this.owner.z,z=null,A=null,B=Array.setUp();for(w=0;w<v;w+=g)for(z=Array.setUp(),B.push(z),x=0;x<u;x+=f)i=Math.min(r((v-w)*t+k),e),h=Math.min(r((u-x)*s+k),d),o=l.create(i,h),o.frame=new j(n,n,((i-k)/t>>0)*t+n,((h-k)/s>>0)*s+n),A=new m(o),A.z=y,A.scale.x=p,A.scale.y=q,
  z.push(A),c.addChild(A),y-=1e-6;return B},updateRegion:function(a){var c=this.tileWidth*this.scaleX,d=this.tileHeight*this.scaleY,e=Math.min(this.tilesWidth,(this.cacheWidth-b)/c>>0),f=Math.min(this.tilesHeight,(this.cacheHeight-b)/d>>0);e||platypus.debug.warn('"'+this.owner.type+'" RenderTiles: The tiles are '+c+"px wide which is larger than "+(this.cacheWidth-b)+"px (maximum cache size of "+this.cacheWidth+"px minus a 2px edge bleed). Increase the maximum cache size or reduce tile size."),f||platypus.debug.warn('"'+this.owner.type+'" RenderTiles: The tiles are '+d+"px high which is larger than "+(this.cacheHeight-b)+"px (maximum cache size of "+this.cacheHeight+"px minus a 2px edge bleed). Increase the maximum cache size or reduce tile size."),this.cacheTilesWidth=e,this.cacheTilesHeight=f,this.cacheClipWidth=e*c,this.cacheClipHeight=f*d,this.tileCache&&(this.mapContainer.mask=(new h).beginFill(0).drawRect(0,0,this.cacheClipWidth+a,this.cacheClipHeight+a).endFill())},updateBufferRegion:function(a){var b=this.tileWidth*this.scaleX,c=this.tileHeight*this.scaleY;this.cacheTilesWidth=Math.min(this.tilesWidth,Math.ceil((a.width+2*this.buffer)/b),this.cacheWidth/b>>0),this.cacheTilesHeight=Math.min(this.tilesHeight,Math.ceil((a.height+2*this.buffer)/c),this.cacheHeight/c>>0),this.cacheClipWidth=this.cacheTilesWidth*b,this.cacheClipHeight=this.cacheTilesHeight*c,this.mapContainer.mask=(new h).beginFill(0).drawRect(0,0,this.cacheClipWidth,this.cacheClipHeight).endFill()},update:function(a,b,c,d){this.populate(b,d),this.render(b,a,this.mapContainer,this.mapContainerWrapper,c,d),d&&d.set(b)},populateTiles:function(a,b){var c=0,d=0,e=0,f=0,g=null,h=Array.setUp();for(this.tileContainer.removeChildren(),c=a.left;c<=a.right;c++)for(d=a.top;d<=a.bottom;d++)if(!b||b.empty||d>b.bottom||d<b.top||c>b.right||c<b.left)for(f=0;f<this.imageMap.length;f++)(g=this.imageMap[f][c][d].getNext())&&(g.template&&h.push(g.template),g.x=(c+.5)*this.tileWidth,g.y=(d+.5)*this.tileHeight,this.tileContainer.addChild(g));for(e=0;e<h.length;e++)h[e].clear();h.recycle()},populateTilesAndEntities:function(a,b){var c=0,d=0,e=0,f=0,g=null,h=null,i=Array.setUp(),j=Array.setUp(),k=null;for(this.tileContainer.removeChildren(),c=a.left;c<=a.right;c++)for(d=a.top;d<=a.bottom;d++)if(!b||b.empty||d>b.bottom||d<b.top||c>b.right||c<b.left){for(f=0;f<this.imageMap.length;f++)(g=this.imageMap[f][c][d].getNext())&&(g.template&&j.push(g.template),g.x=(c+.5)*this.tileWidth,g.y=(d+.5)*this.tileHeight,this.tileContainer.addChild(g));if(this.doMap[c]&&this.doMap[c][d])for(k=this.doMap[c][d],e=0;e<k.length;e++)k[e].drawn||(k[e].drawn=!0,i.push(k[e]))}if(this.mapContainer.removeChildren(),this.mapContainer.addChild(this.tileContainer),i.length)for(i.sort(q),e=0;e<i.length;e++)h=i[e],delete h.drawn,this.mapContainer.addChild(h),h.mask&&this.mapContainer.addChild(h.mask);for(e=0;e<j.length;e++)j[e].clear();j.recycle(),i.recycle()},renderCache:function(a,b,c,d,e,f){var g=this.renderer;e&&!f.empty&&(e.x=f.left*this.tileWidth,e.y=f.top*this.tileHeight,c.addChild(e)),n(g,b),c.x=-a.left*this.tileWidth,c.y=-a.top*this.tileHeight,g.render(d,b),b.requiresUpdate=!0},renderCacheWithExtrusion:function(a,b,c,d){var e=1,f=new h,g=this.renderer;f.lineStyle(1,0),f.drawRect(.5,.5,this.cacheClipWidth+1,this.cacheClipHeight+1),n(g,b),d.mask=f,c.x=-a.left*this.tileWidth,c.y=-a.top*this.tileHeight+e,g.render(d,b),c.x=-a.left*this.tileWidth+e,c.y=-a.top*this.tileHeight,g.render(d,b),c.x=-a.left*this.tileWidth+2*e,c.y=-a.top*this.tileHeight+e,g.render(d,b),c.x=-a.left*this.tileWidth+e,c.y=-a.top*this.tileHeight+2*e,g.render(d,b),d.mask=null,c.x=-a.left*this.tileWidth+e,c.y=-a.top*this.tileHeight+e,g.render(d,b),b.requiresUpdate=!0},updateGrid:function(){var a=this.cache,b=this.cacheTilesHeight,c=this.cacheTilesWidth,d=this.tilesHeight-1,e=this.tilesWidth-1,f=0,g=0,h=this.cacheGrid;for(f=0;f<h.length;f++)for(g=0;g<h[f].length;g++)a.setBounds(f*c,g*b,Math.min((f+1)*c,e),Math.min((g+1)*b,d)),this.update(h[f][g].texture,a)},toJSON:function(){for(var a=this.imageMap[0],b=[],c=a.length,d=0;c--;)for(d=a[c].length,b[c]=[];d--;)b[c][d]=a[c][d].id;return{type:"RenderTiles",buffer:this.buffer,cacheAll:this.cacheAll,entityCache:this.entityCache,imageMap:b,maximumBuffer:this.maximumBuffer,scaleX:this.scaleX,scaleY:this.scaleY,spriteSheet:this.spriteSheet,tileCache:this.tileCache,tileHeight:this.tileHeight,tileWidth:this.tileWidth,top:this.top,left:this.left}},destroy:function(){var a=0,b=0,c="",d=this.cacheGrid,e=this.doMap,f=this.imageMap;if(d){for(a=0;a<d.length;a++)for(b=0;b<d[a].length;b++)d[a][b].texture.destroy(!0),this.container.removeChild(d[a][b]);d.recycle(2),delete this.cacheGrid}else this.tilesSprite?(this.tilesSprite.texture.alternate&&this.tilesSprite.texture.alternate.destroy(!0),this.tilesSprite.texture.destroy(!0),this.container.removeChild(this.tilesSprite)):this.container.removeChild(this.mapContainer);f.recycle(2);for(c in this.tiles)this.tiles.hasOwnProperty(c)&&this.tiles[c].destroy();if(this.tiles=null,this.container=null,this.tilesSprite=null,this.spriteSheet.recycleSpriteSheet(),e){for(a=0;a<this.cachedDisplayObjects.length;a++)this.cachedDisplayObjects[a].destroy();for(this.cachedDisplayObjects.recycle(),a=0;a<e.length;a++)if(e[a]){for(b=0;b<e.length;b++)e[a][b]&&e[a][b].recycle();e[a].recycle()}e.recycle()}this.laxCam.recycle(),this.cache.recycle(),this.cachePixels.recycle(),this.uninitializedTiles.recycle()}},getAssetList:function(){var a=function(b,c){if(b){if("string"==typeof b)return a(c[b],c);if(b.images)return b.images.greenSlice()}return Array.setUp()};return function(b,c,d){var e=null,f=0,g=null,h=platypus.game.settings.spriteSheets,i=b.spriteSheet||c.spriteSheet||d.spriteSheet;if(i){if("string"==typeof i&&"import"!==i)return a(i,h);if(Array.isArray(i)){for(f=i.length,g=Array.setUp();f--;)e=a(i[f],h),g.union(e),e.recycle();return g}if(i.images)return i.images.greenSlice()}return Array.setUp()}}()})}(),function(){"use strict";var a=include("platypus.Data");platypus.createComponentClass({id:"SceneChanger",properties:{scene:"",persistentData:null},initialize:function(){this.persistentData=a.setUp(this.persistentData)},events:{"new-scene":function(a){var b=a||this,c=b.scene||this.scene,d=b.persistentData||this.persistentData;platypus.game.loadScene(c,d)},"set-scene":function(a){this.scene=a},"set-persistent-scene-data":function(a){var b=this.persistentData,c="";for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c])}},methods:{destroy:function(){}}})}(),function(){"use strict";var a=/^(?:(\w+:)\/{2}(\w+(?:\.\w+)*\/?))?([\/.]*?(?:[^?]+)?\/)?(?:(([^\/?]+)\.(\w+))|([^\/?]+))(?:\?((?:(?:[^&]*?[\/=])?(?:((?:(?:[^\/?&=]+)\.(\w+)))\S*?)|\S+))?)?$/,b=include("platypus.AABB"),c=include("platypus.Data"),d=include("platypus.Entity"),e=268435455,f=2147483648,g=1073741824,h=function(){var a=function(a,b){return a.charCodeAt(b)+(a.charCodeAt(b+1)<<8)+(a.charCodeAt(b+2)<<16)+(a.charCodeAt(b+3)<<24)>>>0},b=function(a,b){return a[b]+(a[b+1]<<8)+(a[b+2]<<16)+(a[b+3]<<24)>>>0};return function(c,d){var e=4,f=[],g=atob(c.replace(/\\/g,""));if("zlib"===d)for(g=pako.inflate(g);e<=g.length;)f.push(b(g,e-4)),e+=4;else for(;e<=g.length;)f.push(a(g,e-4)),e+=4;return f}}(),i=function(b){var c=b.match(a);return c[5]||c[7]},j=function(a,d,e,f,g,h,i,j){var k=c.setUp("level",null,"world",b.setUp(),"tile",b.setUp(),"camera",null);k.level=a,k.camera=this.followEntity,k.width=f,k.height=g,k.world.setBounds(d,e,d+f,e+g),k.tile.setBounds(0,0,h,i),this.owner.triggerEvent("world-loaded",k),k.world.recycle(),k.tile.recycle(),k.recycle(),this.owner.removeComponent(this),j&&j()},k=function(a){for(var b=1;b<a;)b*=10;return b},l={x:1,y:1,id:-1},m=function(a,b){var c=0;if(a){if(Array.isArray(a)){for(c=a.length;c--;)if(a[c].name===b)return a[c].value;return null}return a[b]}return null},n=function(a,b,c){var d=0;if(a)if(Array.isArray(a)){for(d=a.length;d--;)if(a[d].name===b)return a[d].type=typeof c,void(a[d].value=c);a.push({name:b,type:typeof c,value:c})}else a[b]=c},o=function(a){var b=l,c=!!(g&a),d=!!(f&a);return b.id=e&a,b.x=1,b.y=1,c&&(b.y=-1),d&&(b.x=-1),b},p=function(a,b){var c=0,d=a.gid||-1,e={},f={gid:-1,transform:null,properties:e,type:""},g=null,h=null,i=0;for(-1!==d&&(f.transform=o(d),d=f.gid=l.id),c=0;c<b.length&&!(b[c].firstgid>d);c++)h=b[c];return h&&(i=d-h.firstgid,h.tileproperties&&h.tileproperties[i]&&(g=h.tileproperties[i]),h.tiles&&h.tiles[i]&&(f.type=h.tiles[i].type||"")),f.type=a.type||f.type,""===f.type&&(a.name?(f.type=a.name,platypus.debug.warn('Component TiledLoader (loading "'+f.type+'"): Defining the entity type using the "name" property has been deprecated. Define the type using the object\'s "type" property in Tiled instead.')):g&&(g.entity?(f.type=g.entity,platypus.debug.warn('Component TiledLoader (loading "'+f.type+'"): Defining the entity type using the "entity" property in the object properties has been deprecated. Define the type using the object\'s "type" property in Tiled instead.')):g.type&&(f.type=g.type,platypus.debug.warn('Component TiledLoader (loading "'+f.type+'"): Defining the entity type in the object properties has been deprecated. Define the type using the object\'s "type" property in Tiled instead.')))),f.type?(f.transform?(e.scaleX=f.transform.x,e.scaleY=f.transform.y):(e.scaleX=1,e.scaleY=1),q(g,f.properties),q(a.properties,f.properties),f):null},q=function(a,b){var c=0,d="";if(a&&b)if(Array.isArray(a))for(c=0;c<a.length;c++)n(b,a[c].name,r(a[c].value));else for(d in a)a.hasOwnProperty(d)&&n(b,d,r(a[d]));return b},r=function(a){var b=0;if("string"==typeof a){if(0===(b=parseFloat(a))||b)return b;if("true"===a)return!0;if("false"===a)return!1;if(a.length>1&&("{"===a[0]&&"}"===a[a.length-1]||"["===a[0]&&"]"===a[a.length-1]))try{return JSON.parse(a)}catch(c){}}return a},s=function(a,b){var e=0,f=0,g=Array.setUp(),h=null,i=Array.setUp(),j=null,k=null,l=null;if("string"==typeof a&&(a=platypus.game.settings.levels[a]),a)if(a.tilesets&&(a.tilesets=v(a.tilesets)),a.assets)i.union(a.assets);else if(a.layers){for(e=0;e<a.layers.length;e++)if("objectgroup"===a.layers[e].type)for(f=0;f<a.layers[e].objects.length;f++)(k=p(a.layers[e].objects[f],a.tilesets))&&(l=d.getAssetList(k),i.union(l),l.recycle());else"imagelayer"===a.layers[e].type?i.union([a.layers[e].image]):(k=m(a.layers[e].properties,"entity"))&&(j=c.setUp("type",k),h=d.getAssetList(j),i.union(h),h.recycle(),j.recycle());if(!b){for(e=0;e<a.tilesets.length;e++)g.push(a.tilesets[e].image);i.union(g),g.recycle()}a.assets=i.greenSlice()}return i},t={"render-layer":{id:"render-layer",components:[{type:"RenderTiles",spriteSheet:"import",imageMap:"import",entityCache:!0}]},"collision-layer":{id:"collision-layer",components:[{type:"CollisionTiles",collisionMap:"import"}]},"image-layer":{id:"image-layer",components:[{type:"RenderTiles",spriteSheet:"import",imageMap:"import"}]}},u=function(a){var b="",c=platypus.game.settings.levels[a.source.replace(".json","")];for(b in c)c.hasOwnProperty(b)&&(a[b]=c[b]);return delete a.source,a},v=function(a){var b=0;for(b=0;b<a.length;b++)a[b].source&&(a[b]=u(a[b]));return a};platypus.createComponentClass({id:"TiledLoader",properties:{offsetMap:!1,showCollisionTiles:!1,images:null,layerIncrement:1e3,separateTiles:!1,spriteSheet:null},publicProperties:{level:null,unitsPerPixel:1,imagesScale:1,entityPositionX:"center",entityPositionY:"bottom",manuallyLoad:!1},initialize:function(){this.assetCache=platypus.game.app.assetManager.cache,this.layerZ=0,this.followEntity=!1},events:{"scene-loaded":function(a,b){this.manuallyLoad||(b.count+=1,this.loadLevel({level:this.level||a.level,persistentData:a},b.release))},"load-level":function(a,b){this.loadLevel(a,b)}},methods:{createLayer:function(a,b,c,f,g,h,i,j,k,l){var n=null,o=null,p=b.width,r=b.height,s=b.tileheight||h,u=b.tilewidth||g,v=0,w=0,x=0,y=0,z=0,A=JSON.parse(JSON.stringify(platypus.game.settings.entities[a]||t[a])),B={},C=[],D=[],E=[],F={images:b.image?[b.image]:j,frames:D,animations:B},G=!1,H=null,I=null,J=0,K=0,L=0,M="",N=null,O=function(a,b,c,d){var e=c.margin||0,f=c.spacing||0,g=c.tilewidth,h=c.tileheight,i=g/2,j=h/2,k=g+f,l=h+f,m=2*e,n=m-f,o=c.columns||c.imagewidth/k+n>>0,p=c.imageheight/l+n>>0,q=0,r=0;for(g*=d,h*=d,i*=d,j*=d,k*=d,l*=d,r=0;r<p;r++)for(q=0;q<o;q++)a.push([e+q*k,e+r*l,g,h,b,i,j])};if(this.decodeLayer(b),N=b.data,c+=b.offsetx||0,f+=b.offsety||0,A.properties=A.properties||{},b.properties){if(y=m(b.properties,"width"),y&&(v=parseInt(y,10)),x=m(b.properties,"height"),x&&(w=parseInt(x,10)),v||w){for(v=v||p,w=w||r,N=[],K=0;K<v;K++)for(L=0;L<w;L++)N[K+L*v]=K<p&&L<r?b.data[K+L*p]:0;p=v,r=w}q(b.properties,A.properties)}if("collision-layer"===a)for(I=[],K=0;K<i.length;K++)if(H=i[K],H.tileproperties)for(M in H.tileproperties)H.tileproperties.hasOwnProperty(M)&&H.tileproperties[M].jumpThrough&&I.push(H.firstgid+parseInt(M,10));if(A.properties.width=u*p*this.unitsPerPixel,A.properties.height=s*r*this.unitsPerPixel,A.properties.columns=p,A.properties.rows=r,A.properties.tileWidth=u*this.unitsPerPixel,A.properties.tileHeight=s*this.unitsPerPixel,A.properties.scaleX=this.imagesScale,A.properties.scaleY=this.imagesScale,A.properties.layerZ=this.layerZ,A.properties.left=A.properties.x||c,A.properties.top=A.properties.y||f,A.properties.z=A.properties.z||this.layerZ,i.length){for(K=0;K<i.length;K++)O(D,K,i[K],this.unitsPerPixel/this.imagesScale);for(n=i[i.length-1],z=n.firstgid+n.tilecount,K=-1;K<z;K++)B["tile"+K]=K}for(K=0;K<p;K++)for(C[K]=[],E[K]=[],L=0;L<r;L++)J=+N[K+L*p]-1,E[K][L]="tile"+J,J+=1,I&&I.length&&I[0]===(e&J)&&(J|=268435456),C[K][L]=J;for(K=0;K<A.components.length;K++)"RenderTiles"===A.components[K].type&&(G=A.components[K]),"import"===A.components[K].spriteSheet?A.components[K].spriteSheet=F:A.components[K].spriteSheet&&("string"==typeof A.components[K].spriteSheet&&platypus.game.settings.spriteSheets[A.components[K].spriteSheet]&&(A.components[K].spriteSheet=platypus.game.settings.spriteSheets[A.components[K].spriteSheet]),A.components[K].spriteSheet.animations||(A.components[K].spriteSheet.animations=B)),"import"===A.components[K].collisionMap&&(A.components[K].collisionMap=C),"import"===A.components[K].imageMap&&(A.components[K].imageMap=E);return this.layerZ+=this.layerIncrement,"render-layer"===a&&!this.separateTiles&&k&&k.tileHeight===s&&k.tileWidth===u&&k.columns===p&&k.rows===r?(k.triggerEvent("add-tiles",G),this.updateLoadingProgress(l),k):(o={},"render-layer"===a&&this.spriteSheet&&("string"==typeof this.spriteSheet?o.spriteSheet=platypus.game.settings.spriteSheets[this.spriteSheet]:o.spriteSheet=this.spriteSheet,o.spriteSheet.animations||(o.spriteSheet.animations=B)),this.owner.addEntity(new d(A,{properties:o},this.updateLoadingProgress.bind(this,l),this.owner)))},convertImageLayer:function(a){var b=null,c=0,d=0,e="",f=a.properties||{},g=m(f,"repeat"),h=m(f,"repeat-x"),j=m(f,"repeat-y"),k={data:[],image:"",height:1,name:a.name,type:"tilelayer",width:1,tileheight:1,tilewidth:1,x:a.x,y:a.y,properties:f};for(g&&(k.width=+g,k.height=+g),h&&(k.width=+h),j&&(k.height=+j),d=k.width*k.height,c=0;c<d;c++)k.data.push(1);return b=this.assetCache.read(a.name),b?(k.image=a.name,k.tileheight=b.height,k.tilewidth=b.width):(e=i(a.image),b=this.assetCache.read(e),b?(platypus.debug.warn('Component TiledLoader: Did not find a spritesheet for "'+a.name+'", so using "'+a.image+'" instead.'),k.image=e,k.tileheight=b.height,k.tilewidth=b.width):(platypus.debug.warn('Component TiledLoader: Cannot find the "'+a.name+'" sprite sheet. Add it to the list of assets in config.json and give it the id "'+a.name+'".'),k.image=a.image)),k.tileset={columns:1,image:k.image,imageheight:k.tileheight,imagewidth:k.tilewidth,margin:0,name:a.name,spacing:0,tilecount:1,tileheight:k.tileheight,tilewidth:k.tilewidth,type:"tileset"},k},loadLevel:function(a,b){var d=!0,e=null,f=null,g=null,h=0,l=0,n="",o=null,p=null,r=null,s=null,t=null,u=0,w=0,x=c.setUp("count",0,"progress",0,"total",0),y=0,z=0,A=0;if(g="string"==typeof a.level?platypus.game.settings.levels[a.level]:a.level,f=g.layers,t=v(g.tilesets),u=g.tilewidth,w=g.tileheight,g.properties&&q(g.properties,this.owner),o=this.images?this.images.greenSlice():Array.setUp(),0===o.length)for(l=0;l<t.length;l++)s=t[l],e=this.assetCache.read(s.name),e?o.push(s.name):(n=i(s.image),e=this.assetCache.read(n),e?(platypus.debug.warn('Component TiledLoader: Did not find a spritesheet for "'+s.name+'", so using "'+s.image+'" instead.'),o.push(n)):(platypus.debug.warn('Component TiledLoader: Cannot find the "'+s.name+'" sprite sheet. Add it to the list of assets in config.json and give it the id "'+s.name+'".'),o.push(s.image)));for(y=g.width*u*this.unitsPerPixel,h=g.height*w*this.unitsPerPixel,this.offsetMap&&(z=k(y),A=k(h)),x.total=l=f.length;l--;)"objectgroup"===f[l].type?x.total+=f[l].objects.length:!d||"collision"!==f[l].name&&"collision-layer"!==m(f[l].properties,"entity")||(d=!1);for(this.finishedLoading=j.bind(this,g,z,A,y,h,u,w,b),l=0;l<f.length;l++)switch(r=f[l],r.type){case"imagelayer":p=this.convertImageLayer(r),p=this.createLayer("image-layer",p,z,A,p.tilewidth,p.tileheight,[p.tileset],o,p,x);break;case"objectgroup":this.setUpEntities(r,z,A,u,w,t,x),p=null,this.updateLoadingProgress(x);break;case"tilelayer":p=this.setupLayer(r,d,p,z,A,u,w,t,o,x);break;default:platypus.debug.warn('Component TiledLoader: Platypus does not support Tiled layers of type "'+r.type+'". This layer will not be loaded.'),this.updateLoadingProgress(x)}},setUpEntities:function(a,b,c,e,f,g,h){var i=1e3,j=0,k=0,l=0,n=0,o=0,q=0,r=0,s=null,t=0,u=null,v=null,w=null,x=m(a.properties,"entityPositionX")||this.entityPositionX,y=m(a.properties,"entityPositionY")||this.entityPositionY,z="",A=-1,B=1/0,C=-1/0,D=1/0,E=-1/0,F=null,G=null,H=null,I=0,J=0;for(b+=a.offsetx||0,c+=a.offsety||0,t=0;t<a.objects.length;t++)if(u=a.objects[t],F=p(u,g)){if(A=F.gid,z=F.type,v=platypus.game.settings.entities[z],w=v?v.properties||null:null,G=F.properties,u.polygon||u.polyline){for(B=1/0,C=-1/0,D=1/0,E=-1/0,H=null,u.polygon?H=u.polygon:u.polyline&&(H=u.polyline),l=0;l<H.length;l++)H[l].x>C&&(C=H[l].x),H[l].x<B&&(B=H[l].x),H[l].y>E&&(E=H[l].y),H[l].y<D&&(D=H[l].y);if(G.width=C-B,G.height=E-D,G.x=u.x+B,G.y=u.y+D,j=0,k=0,G.width=G.width*this.unitsPerPixel,G.height=G.height*this.unitsPerPixel,G.x=G.x*this.unitsPerPixel+b,G.y=G.y*this.unitsPerPixel+c,u.polygon)for(G.shape={},G.shape.type="polygon",G.shape.points=[],n=0;n<H.length;n++)G.shape.points.push({x:(H[n].x-B)*this.unitsPerPixel+b,y:(H[n].y-D)*this.unitsPerPixel+c});else if(u.polyline)for(G.shape={},G.shape.type="polyline",G.shape.points=[],n=0;n<H.length;n++)G.shape.points.push({x:(H[n].x-B)*this.unitsPerPixel+b,y:(H[n].y-D)*this.unitsPerPixel+c})}else I=e*this.unitsPerPixel,J=f*this.unitsPerPixel,j=0,k=0,G.width=(u.width||0)*this.unitsPerPixel,G.height=(u.height||0)*this.unitsPerPixel,w&&("number"==typeof w.width&&(G.width=w.width,j=I),"number"==typeof w.height&&(G.height=w.height,k=J)),u.point||(G.width||(G.width=I),G.height||(G.height=J),j=j||G.width,k=k||G.height),G.x=u.x*this.unitsPerPixel,G.y=u.y*this.unitsPerPixel,u.rotation&&(o=(u.width||I)/2,q=(u.height||J)/2,r=u.rotation/180%2*Math.PI,s=platypus.Vector.setUp(o,-q).rotate(r),G.rotation=u.rotation,G.x=Math.round((G.x+s.x-o)*i)/i,G.y=Math.round((G.y+s.y+q)*i)/i,s.recycle()),"left"===x?G.regX=0:"center"===x?(G.regX=G.width/2,G.x+=j/2):"right"===x&&(G.regX=G.width,G.x+=j),G.x+=b,-1===A&&(G.y+=G.height),"bottom"===y?G.regY=G.height:"center"===y?(G.regY=G.height/2,G.y-=k/2):"top"===y&&(G.regY=0,G.y-=k),G.y+=c,u.ellipse?(G.shape={},G.shape.type="circle",G.shape.width=G.width*this.unitsPerPixel,G.shape.height=G.height*this.unitsPerPixel,G.shape.radius=(G.width+G.height)*this.unitsPerPixel/4):u.width&&u.height&&(G.shape={},G.shape.type="rectangle",G.shape.width=G.width*this.unitsPerPixel,G.shape.height=G.height*this.unitsPerPixel);w?(G.scaleX*=this.imagesScale*(w.scaleX||1),G.scaleY*=this.imagesScale*(w.scaleY||1)):(G.scaleX*=this.imagesScale,G.scaleY*=this.imagesScale),G.layerZ=this.layerZ,G.z?G.z+=this.layerZ:w&&"number"==typeof w.z?G.z=this.layerZ+w.z:G.z=this.layerZ,(u=this.owner.addEntity(new d(v,{properties:G},this.updateLoadingProgress.bind(this,h),this.owner)))&&(u.camera&&(this.followEntity={entity:u,mode:u.camera}),this.owner.triggerEvent("entity-created",u))}else this.updateLoadingProgress(h);this.layerZ+=this.layerIncrement},setupLayer:function(a,b,c,d,e,f,g,h,i,j){var k=!1,l=m(a.properties,"entity"),n=l||"render-layer",o=null,p=0;if(l||("collision"===a.name?n="collision-layer":"action"===a.name&&(n=b?"tile-layer":"render-layer")),"tile-layer"===n||this.showCollisionTiles&&platypus.game.settings.debug)return j.count+=1,this.createLayer("collision-layer",a,d,e,f,g,h,i,c,j),this.createLayer("render-layer",a,d,e,f,g,h,i,c,j);if("collision-layer"===n)return this.createLayer("collision-layer",a,d,e,f,g,h,i,c,j),null;if(o=platypus.game.settings.entities[n])for(p=o.components.length;p--;)if("RenderTiles"===o.components[p].type){k=!0;break}return k?this.createLayer(n,a,d,e,f,g,h,i,c,j):(this.createLayer(n,a,d,e,f,g,h,i,c,j),null)},updateLoadingProgress:function(a){a.count+=1,a.progress=a.count/a.total,this.owner.triggerEvent("level-loading-progress",a),a.count===a.total&&(a.recycle(),this.finishedLoading())},destroy:function(){}},publicMethods:{decodeLayer:function(a){return"base64"===a.encoding&&(a.data=h(a.data,a.compression),a.encoding="csv"),a}},getAssetList:function(a,b,c){var d=b||{},e=c||{},f=a.spriteSheet||d.spriteSheet||e.spriteSheet,g=a.images||d.images||e.images,h=s(a.level||d.level||e.level,f);return f&&("string"==typeof f?h.union(platypus.game.settings.spriteSheets[f].images):h.union(f.images)),g&&h.union(g),h},getLateAssetList:function(a,b,c,d){var e=b||{},f=c||{},g=a.spriteSheet||e.spriteSheet||f.spriteSheet;return d&&d.level?s(d.level,g):Array.setUp()}})}(),function(){"use strict";var a=include("platypus.Data"),b=function(){this.active--},c=function(){this.active++},d=function(a){this.timelineInstances.push(this.createTimeStampedTimeline(this.timelines[a]))},e=function(a){for(var b=a.delta,c=null,d=this.timelineInstances,e=d.length;e--;)c=d[e],c.remove?(d.greenSplice(e),c.timeline.recycle(2),c.recycle()):c.active&&(0===c.timeline.length?(d.greenSplice(e),c.timeline.recycle(2),c.recycle()):this.progressTimeline(c,b))};platypus.createComponentClass({id:"Timeline",properties:{timelines:{}},initialize:function(){var a=0;this.timelineInstances=Array.setUp();for(a in this.timelines)this.timelines.hasOwnProperty(a)&&this.addEventListener(a,d.bind(this,a))},events:{"logic-tick":e,"handle-logic":e,"stop-active-timelines":function(){for(var a=this.timelineInstances,b=a.length;b--;)a[b].remove=!0}},methods:{createTimeStampedTimeline:function(d){var e=Array.setUp(),f=0,g=0,h=null;for(f=0;f<d.length;f++)h=d[f],"number"==typeof h?g+=h:e.push(a.setUp("time",g,"value",h));return e.reverse(),a.setUp("timeline",e,"time",0,"active",1,"pause",b,"play",c,"remove",!1)},progressTimeline:function(a,b){var c=a.timeline,d=c.length,e=null,f=null,g=this.owner;for(a.time+=b;d--;){if(e=c[d],!(e.time<=a.time))return;if(f=e.value,"string"==typeof f?this.owner.triggerEvent(f):(f.entity&&((g=this.owner.getEntityById?this.owner.getEntityById(f.entity):this.owner.parent.getEntityById(f.entity))||(platypus.debug.warn("No entity of that id"),g=this.owner)),f.message?g.triggerEvent(f.event,f.message):g.trigger(f.event)),e.recycle(),c.pop(),!a.active)return;e=null,f=null,g=this.owner}},destroy:function(){for(var a=null,b=this.timelineInstances,c=b.length;c--;)a=b[c],a.timeline.recycle(2),a.recycle();b.recycle(),this.timelineInstances=null}}})}(),function(){"use strict";var a=function(a){var b=null;for(b in this.watchedEntities)a.type===b&&this.watchedEntities[b].push(a)},b=function(a){var b=0,c=a.type;for(b=this.watchedEntities[c].length-1;b>=0;b--)if(this.watchedEntities[c][b]===a){this.watchedEntities[c].splice(b,1);break}},c=function(a){var b=a.delta,c=0,d=null,e=null,f=-1,g=!1,h=null;for(c=0;c<this.tutorials.length;c++)if(g=!1,d=this.tutorials[c],this.playing||0!==this.theQueue.length?!this.playing&&this.theQueue.length>0&&d.priority>this.theQueue[0].priority?g=!0:this.playing&&this.playing.priority<d.priority?g=!0:d.queue&&(g=!0):g=!0,g&&this.checkRequirements(d.requirements)){if(d.replayDelay&&d.replayDelayTimer>0&&(d.replayDelayTimer-=b,d.replayDelayTimer>0))continue;(!e||e.priority<d.priority)&&(e=d,f=c)}e?(h=this.tutorials.splice(f,1)[0],this.playing?h.priority>this.playing.priority?(this.owner.triggerEvent("stop-audio"),this.play(h)):this.queue(h):this.theQueue.length>0?h.priority>this.theQueue[0].priority?this.play(h):(this.play(this.theQueue.splice(0,1)[0]),this.queue(h)):this.play(h)):!this.playing&&this.theQueue.length>0&&this.play(this.theQueue.splice(0,1)[0])};platypus.createComponentClass({id:"Tutorial",properties:{tutorialDefs:[]},publicProperties:{},initialize:function(){var a=0,b=null,c=null,d=null;for(this.playing=null,this.theQueue=[],this.watchedEntities={},this.tutorials=[],a=0;a<this.tutorialDefs.length;a++)if(c=this.tutorialDefs[a],d={},c.events){d.events=c.events.greenSlice(),d.originalEvents=c.events.greenSlice(),d.priority=c.priority||0,d.queue=c.queue||!1,d.timesToReplay="number"==typeof c.timesToReplay?c.timesToReplay:1/0,d.replayDelay=c.replayDelay||null,d.replayDelayTimer=d.replayDelay,d.level=c.level,d.requirements={};for(b in c.requirements)c.requirements.hasOwnProperty(b)&&(d.requirements[b]=c.requirements[b].greenSlice(),this.watchedEntities[b]||(this.watchedEntities[b]=[]));this.tutorials.push(d)}else platypus.debug.warn("Tutorial definition lacks events.")},events:{"child-entity-added":a,"peer-entity-added":a,"child-entity-removed":b,"peer-entity-removed":b,"logic-tick":c,"handle-logic":c,"sequence-complete":function(){this.playing.timesToReplay>=0&&this.tutorials.push(this.playing),this.playing=null}},methods:{play:function(a){var b=null;this.playing=a,0===this.playing.events.length&&(this.playing.events=this.playing.originalEvents.greenSlice()),b=this.playing.events.splice(Math.floor(Math.random()*this.playing.events.length),1)[0],this.owner.triggerEvent(b),a.timesToReplay-=1,a.replayDelayTimer=a.replayDelay},queue:function(a){var b=0,c=!1;for(b=0;b<this.theQueue.length;b++)if(this.theQueue[b].priority<a.priority){this.theQueue.splice(b,0,a),c=!0;break}c||this.theQueue.push(a)},checkRequirements:function(a){var b=0,c=0,d=null,e=null,f=null,g=!0;for(d in a)if(a.hasOwnProperty(d)){for(e=a[d],c=this.watchedEntities[d].length-1;c>=0;c--){for(f=this.watchedEntities[d][c],g=!0,b=0;b<e.length;b++)if(!f.state.get(e[b])){g=!1;break}if(g)break}if(!g)return!1}return!0},destroy:function(){this.watchedEntities=null,this.theQueue=null,this.playing=null,this.tutorials=null}}})}(),function(){"use strict";var a=include("createjs.Tween",!1),b={},c=function(a,b,c,e){var g=f(a,b,c);return g?"string"==typeof g?d(e,g):g:null},d=function(a,b,c,d){return function(){a.trigger(b,c,d)}},e=function(a,c){var e=0,f=this.owner,h=Array.isArray(a),i=h?a:a.tween,j=null,k=null,l=null,m=createjs.Tween.get(f,g(h?b:a,this,f));if(Array.isArray(c))i=c;else if(!Array.isArray(i))return void platypus.debug.warn("Tween: no array was supplied for this tween.");for(e=0;e<i.length;e++)j=i[e],"string"==typeof j?m.call(d(f,j)):Array.isArray(j)?"call"===j[0]&&"string"==typeof j[1]?m.call(d(f,j[1])):(k=j.greenSlice(),"to"===k.greenSplice(0)&&k[2]&&createjs.Ease[k[2]]&&(k.length>3?(l=k.greenSlice(),l.greenSplice(0),l.greenSplice(0),k[2]=createjs.Ease[l.greenSplice(0)].apply(null,l),l.recycle()):k[2]=createjs.Ease[k[2]]),m[j[0]].apply(m,k),k.recycle()):"call"===j.method&&"string"==typeof j.params?m.call(d(f,j.params)):m[j.method].apply(m,j.params)},f=function(a,b,c){return"undefined"!==a[b]?a[b]:c[b]},g=function(a,b,d){return{useTicks:f(a,"useTicks",b),ignoreGlobalPause:f(a,"ignoreGlobalPause",b),loop:f(a,"loop",b),reversed:f(a,"reversed",b),bounce:f(a,"bounce",b),timeScale:f(a,"timeScale",b),pluginData:f(a,"pluginData",b),paused:f(a,"paused",b),position:f(a,"position",b),onChange:c(a,"onChange",b,d),onComplete:c(a,"onComplete",b,d),override:f(a,"override",b)}};a?(a._inited=!0,platypus.createComponentClass({id:"Tween",properties:{events:null,useTicks:!1,ignoreGlobalPause:!1,loop:0,reversed:!1,bounce:!1,timeScale:1,pluginData:null,paused:!1,position:0,onChange:"",onComplete:"",override:!1},initialize:function(){var a="",b=this.events;if(b)for(a in b)b.hasOwnProperty(a)&&this.addEventListener(a,e.bind(this,b[a]))}})):platypus.createComponentClass({id:"Tween",initialize:function(){platypus.debug.warn("CreateJS Tween must be included in the project to use the Tween component.")}})}(),function(){"use strict";var a=include("platypus.components.AudioVO"),b=include("platypus.components.RenderAnimation"),c=include("platypus.components.RenderSprite"),d=function(a,b){return" "===b?a+"default":a+b},e=function(a,b,c){this.owner.addComponent(new a(this.owner,b,c))},f=function(a,b,c,e){var f=0,g="",h={},i=0,j="",k="",l=a.voice,m=a.mouthCues;if("string"==typeof a)h.sound=a,h.events=Array.setUp();else if("string"==typeof a.sound)h.sound=a.sound,h.events=Array.setUp();else{for(g in a.sound)a.sound.hasOwnProperty(g)&&(h[g]=a.sound[g]);h.events?h.events=h.events.greenSlice():h.events=Array.setUp()}if(l||m||!platypus.game.app.config.mouthCues||(m=platypus.game.app.config.mouthCues[h.sound]),l)for(l+=" ",f=0;f<l.length;f++)k=l[f],k!==j&&(j=k,h.events.push({time:i,event:d(c,k)})),i+=e;else if(m)for(f=0;f<m.length;f++)k=m[f],h.events.push({time:1e3*k.start,event:d(c,k.value)}),i+=e;return h},g=function(a,b,c,d){var e=0,g=Array.setUp();if(b[" "]||(b[" "]=b.default),Array.isArray(a)){for(e=0;e<a.length;e++)"number"==typeof a[e]?g.push(a[e]):g.push(f(a[e],b,c,d));return g}return f(a,b,c,d)};platypus.createComponentClass({id:"VoiceOver",properties:{animationMap:{default:"default"},renderComponent:"",frameLength:100,messagePrefix:"",voiceOverMap:{}},initialize:function(f,h){var i="",j=Array.setUp(),k={audioMap:{},aliases:f.aliases},l={acceptInput:f.acceptInput,aliases:f.aliases,animation:f.animation,animationMap:{},eventBased:!0,flip:f.flip,hidden:f.hidden,interactive:f.interactive,mask:f.mask,mirror:f.mirror,offsetZ:f.offsetZ,regX:f.regX,regY:f.regY,restart:f.restart,rotate:f.rotate,scaleX:f.scaleX,scaleY:f.scaleY,spriteSheet:f.spriteSheet,stateBased:f.stateBased||!1};this.messagePrefix?this.message=this.messagePrefix+"-":this.message="";for(i in this.animationMap)this.animationMap.hasOwnProperty(i)&&(l.animationMap[d(this.message,i)]=this.animationMap[i]);l.animationMap.default=this.animationMap.default,this.renderComponent?j.push(e.bind(this,platypus.components[this.renderComponent],l)):j.push(e.bind(this,f.animation?b:c,l));for(i in this.voiceOverMap)this.voiceOverMap.hasOwnProperty(i)&&(k.audioMap[i]=g(this.voiceOverMap[i],this.animationMap,this.message,this.frameLength));return j.push(e.bind(this,a,k)),platypus.Async.setUp(j,h),j.recycle(),!0},events:{load:function(){this.owner.removeComponent(this)}},getAssetList:function(a,b,c){var d=a.spriteSheet||b.spriteSheet||c&&c.spriteSheet;return"string"==typeof d?platypus.game.settings.spriteSheets[d].images.greenSlice():d?d.images.greenSlice():Array.setUp()}})}(),function(){"use strict";var a=include("window.XMLHttpRequest");platypus.createComponentClass({id:"XHR",properties:{method:"GET",path:"",responseType:"text",withCredentials:!1},initialize:function(a){this.setProperties(a)},events:{request:function(a){if(this.setProperties(a),"GET"===this.method)this.get();else{if("POST"!==this.method)throw"Method must be GET or POST";this.post()}}},methods:{setProperties:function(a){var b="",c="",d=a||this;if(this.method=d.method||this.method||"GET",this.path=d.path||this.path||null,this.responseType=d.responseType||this.responseType||"text",this.withCredentials=d.withCredentials||this.withCredentials||!1,d!==this&&d.data){this.data="";for(b in d.data)d.data.hasOwnProperty(b)&&(this.data+=c+b+"="+d.data[b],c="&")}else this.data=""
  ;this.onload=d.onload||this.onload||function(){200===this.status&&this.owner.triggerEvent("response",this.responseText)}.bind(this)},get:function(){var b=new a,c=this.path;this.data&&(c+="?"+this.data),b.open(this.method,c,!0),b.withCredentials=this.withCredentials,b.responseType=this.responseType,b.onload=this.onload,b.send()},post:function(){var b=new a;b.open(this.method,this.path,!0),b.withCredentials=this.withCredentials,b.responseType=this.responseType,b.setRequestHeader("Content-type","application/x-www-form-urlencoded"),b.onload=this.onload,b.send(this.data)}}})}();